Páginas filhas
  • Accounts Payable Clearing - FINA340 - Financials - P12

Versões comparadas

Chave

  • Esta linha foi adicionada.
  • Esta linha foi removida.
  • A formatação mudou.

...

The advances selected and entered by the user are deducted from the total amount of the original bill.

02. EXECUTION

  • Manually

Procedure manually performed through routine Accounts Payable Clearing (FINA340), with the display of the screens involved in the process - actions/commands from the user are required

  • Automatically

Procedure automatically performed in routine Accounts Payable Clearing (FINA340) without the display of screen - no interaction from the user required.

Used in customizations in which the process does not required user's interactions (MSEXECAUTO)

...


Bloco de código
languagejava
themeMidnight
titleExample of Automatic Routine
collapsetrue
#INCLUDE "Protheus.ch"

...


#INCLUDE "RWMAKE.CH"

...


#INCLUDE "TBICONN.CH"

...



Static __COMPAUT := Nil

...



User Function CMPAUTOMA()

...


Local lRet := .F.

...


Local cQry := ""

...


Local aTipos := {"NF ", "PA ", "NDF"}

...


Local cTblTmp := ""

...


Local aNF := {}

...


Local aPA_NDF := {}

...


Local aContabil := {}

...


Local bBlock := Nil

...


Local aEstorno := {}

...


Local nSldComp := 0

...


Local nTaxaPA := 0

...


Local nTaxaNF := 0

...


Local nHdl := 0

...


Local nOperacao := 0

...



If __COMPAUT == Nil

...



cQry := "SELECT E2_TIPO TIPO, R_E_C_N_O_ R_E_C_N_O FROM " + RetSqlName("SE2") + " "

...


cQry += "WHERE E2_SALDO > 0 AND E2_TIPO IN

...

  "

...


cQry += "ORDER BY E2_TIPO"

...


cQry := ChangeQuery(cQry)

...


__COMPAUT := FWPreparedStatement():New(cQry)

...


EndIf

...



__COMPAUT:SetIn(1, aTipos)

...


cQry := __COMPAUT:GetFixQuery()

...


cTblTmp := MpSysOpenQuery(cQry)

...



While (cTblTmp)->(!Eof())

...


If (cTblTmp)->TIPO $ MVPAGANT+"|"+MV_CPNEG

...


Aadd(aPA_NDF, (cTblTmp)->R_E_C_N_O)

...


Else

...


Aadd(aNF, (cTblTmp)->R_E_C_N_O)

...


EndIf

...


(cTblTmp)->(DbSkip())

...


lRet := .T.

...


EndDo

...



(cTblTmp)->(DbCloseArea())

...


cTblTmp := ""

...



If lRet

...


Pergunte("AFI340", .F.)

...


lContabiliza := MV_PAR11 == 1

...


lAglutina := MV_PAR08 == 1

...


lDigita := MV_PAR09 == 1

...



lRet := FinCmpAut(aNF, aPA_NDF, aContabil, bBlock, aEstorno, nSldComp, dDatabase, nTaxaPA ,nTaxaNF, nHdl, nOperacao)

...



If lRet

...



Alert("Compensation successful")

...



Else

...



Alert("An error occurred in the compensation process")

...



EndIf

...



EndIf

...



Return






Note
To use the Automatic Accounts Payable Compensation process, call the function: FinCmpAut. Clearing can be carried out from N to N: N advances/returns (PA or NDF) for N bills (NF, DP, etc.) or vice versa.
Accounts Payable Clearing 

...