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.

...

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
Informações
titleNote

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 


03. OPERATIONS

  • Clear

Use this operation to clear bills payable: 
 - Clearing bills from a supplier/store with advances from the same supplier/store
 - Clearing bills from a given supplier with advances from the same supplier regardless of the bill receivable store
 - Clear a bill from a given supplier with advances from several suppliers, in which case a supplier range or all suppliers can be established. Then, the bill can be cleared with any advance bill from the same supplier pending in the bill file, irrespective of the supplier for this bill.


Aviso
titleImportant

The Clearing Date must be after the date of issue of the bills involved. For example:

  • PA issued on 3/29
  • NF issued on 4/02

You can only clear these bills after 4/02, considering that on 3/29 the NF did not yet exist, so the postings concept is correctly applied to clearing operations. (E2_Posting after E2_ISSUE)

  • You cannot, through Financials, clear Advance Payments bound to Purchase Orders.

For clearance between advances and bills from different branches, use button Branches to define which branches to consider for selection of bills to clear.If you do not use button Branches, only bills of the current branch are considered for clearing.
Image Added

...

Informações
titleNote

If the financial base is fully shared and you do not use button Branches, all advances from all branches are considered for the process.




  • Delete

Operation to delete the transaction generated by the clearing

...