Índice |
---|
Note
Essa rotina foi ajustada para atender a Lei Geral de Proteção de Dados (Lei n° This routine was adjusted to comply with the General Personal Data Protection Law (LGPD law No. 13.70), sendo que alguns campos que apresentam informações consideradas como dados sensíveis e/ou pessoais, serão ofuscados deixando de ser legíveisso that some fields containing data regarded as sensitive and/or personal are blurred, becoming illegible.
This routine clears all advances made and registered by the Suppliers (PA bills type), in addition to the credit notes to be deducted (NDF bills type).
The advances selected and entered by the user are deducted from the total amount of the original bill.
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
...
Example of automatic routine Expandir origem
#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
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.
Important
The Clearing Date must be after the date of issue of the bills involved. For example:
...
Operation to view the bill selected and check its balance and value.
List of parameters applied to FINA340 and its processing Âncora composition-deck-Parâmetros composition-deck-Parâmetros
Questions (F12)
Question | Description |
Consider store? | This field indicates whether to consider the store of the supplier when filtering records to be cleared. Thus, if you select "No", all "PA" bills from all stores are displayed for confirmation of clearing. If you select "Yes", only "PA" bills from the main bill store are considered. |
Consider Supplier? | Select option "Original" to consider same supplier of bill in clearing, or "Others" to clear bills between different suppliers. |
From Supplier? | Enter the initial code of the range of suppliers to be considered in clearing |
To Supplier ? | Enter the final code of the range of stores to be considered in clearing |
Cons. branches below? | Enter "Yes" to consider branches of your system, or "No" to consider only the branch you logged on. This question no longer affects the clearing process. Use button Branches to select the branches to be considered when selecting bills to be cleared. |
From Branch? | Enter the initial code of the range of branches to be considered in clearing. This question no longer affects the clearing process. Use button Branches to select the branches to be considered when selecting bills to be cleared. |
To Branch ? | Enter the final code of the range of branches to be considered in clearing. This question no longer affects the clearing process. Use button Branches to select the branches to be considered when selecting bills to be cleared. |
Group Entries? | Enter "YES" to group the accounting entries generated through clearing in a single entry |
Display Entries? | Enter "YES" to display onscreen the accounting entries generated through clearing, otherwise "NO" |
Clear Bills? | Enter option "Regular" for clearing to consider bills of type NF, PA, NDF, or "Tax" to consider TX and TXA generated tax bills. |
Accounts online? | Enter "YES" to book online the entries related to accounts payable clearing, otherwise "NO". |
Clear transferred? | Enter "Yes" to allow clearing of bills transferred to bank (Bordereau), otherwise "No" |
Clear tax balance? | Define not to zero TX balance when clearing between taxes, leaving the submission of DARF and tax payment pending, the feature of this question is only applied when |
Consider ps of tax. of PA? | Define, when clearing between regular NF x PA bills, if taxes of type TXA of PA have postings, whether these values are used to clear the balance of TX of NF, the feature of this question is only applied when |
...
Parameter | Description | Default |
MV_CTBFLAG | Enter whether to select booking flags of the offline routines in the accounting entry transaction - SIGACTB. | .F. |
MV_BX10925 | Define when withholding of PIS COFINS and CSLL taxes are processed: 1 = At Posting or 2 = At Issue | 1 |
MV_PABRUTO | Define, at PA generation with taxes, whether 1 = Generate a PA with gross value. 2 = Generate a PA with net value (system default). | 2 |
MV_LIBCHEQ | Option for release of bank balance when checks are generated before write-off. | S |
MV_PAPRIME | It defines whether, at PA generation with taxes, the INSS and ISS taxes are provisioned in the net PA. 1=Yes 2=No (default) | 2 |
MV_CTLIPAG | Control postings payable through filled out release date. If .T., the system checks whether field E2_DATALIB is filled out, otherwise it does not control them | .F. |
MV_VLMINPG | Minimum value to post the bill, even if field E2_DATALIB is not filled out and the content of parameter MV_CTLIPAG is .T. | 0 |
MV_IMPADT | Define the use of IRRF generation in advance payable | |
MV_SOLNCP | Define the use of Credit Note request routine | .F. |
MV_MUNIC | Identifies the code of the finance department of the municipality for ISS collection. | MUNIC |
MV_MCUSTO | Currency used to check the credit limit entered in the customer register. | 2 |
MV_COMSEIC | Enable integration of service purchase order for Easy Siscoserv. | .F. |
MV_ESS0012 | Enable integration of Incoming Document from SIGACOM to SIGAESS. | .F. |
MV_ESS0013 | Enable integration of bills generated in SIGAFIN by SIGACOM for SIGAESS. | .F. |
MV_ESS0022 | Enable SIGAEIC x SIGAESS Integration | .F. |
MV_JURXFIN | Enable integration between modules SIGAFIN - Financials and SIGAPFS - Legal. Disabled by default. | |
MV_PCOINTE | It indicates whether the integration of Planning and Budget Control processes with Entries/Locks processes is active (1=Yes / 2=No). | 2 |
MV_BXDTFIN | To not allow postings dated before the date set in parameter MV_DATAFIM (1=Allow, 2=Do not Allow) | 2 |
MV_UNIAO | Identify the code given to the Federal Revenue for payment of Income Tax. | UNION |
MV_ESTADO | Acronym of the state of the company using the System, to calculate the ICMS (7, 12 or 18%). | SP |
MV_PISNAT | Nature for bills related to PIS. | PIS |
MV_COFINS | Nature for bills related to COFINS. | COFINS |
MV_CSLL | Nature for bills related to CSLL. | CSLL |
MV_IRF | Nature for bills related to IRF. | IRF |
MV_ISS | Nature for bills related to ISS. | ISS |
MV_BP10925 | Define whether to consider the gross value of partial posting or the net value plus taxes. (1=Gross Val./2=Net Val.) | 1 |
MV_COMPCP | It indicates whether in an Invoice clearance with a PA, the taxes are proportionated. | .F. |
MV_MRETISS | ISS withholding mode in acquisition of services. 1 = when issuing main bill; 2 = when posting main bill | 1 |
MV_CPIMPAT | Indica se haverá compensação automática de impostos a pagar. 1 - Automatic; 2 - Manual | 2 |
MV_AG10925 | Enter whether to combine CCP taxes in one bill only when the three taxes occur in the same bill. | 2 |
MV_FINVDOC | Activate control of required documents in routines for releasing bill payable postings/transactions? ("1" = Yes / "2" = No) | 2 |
MV_CMTXCON | Indicate whether to generate indexation for bills with rate contracted at CP clearing. T = Generate CM / F = Do Not Generate CM | .F. |
MV_CALCCM | Indicate whether to calculate indexation. Valid: "S" - calculate it or "N" - do not calculate it. | S |
MV_TXPRCON | Define whether to use the rate entered in clearing in entire process. T = Rt in Process, F = Individual Rt | .F. |
The booking of processes applied to an accounts payable clearing via Financials module is done through the standard entries below:
...
IMPORTANT!
A contabilização da compensação sera sempre feita com base nos dados do Título Compensado podendo ser qualquer tipo de obrigação: NF, TX, DP, etc. as long as the transfer (SE5) has the following classification: E5_TIPODOC = 'CP' and E5_MOTBX = 'CMP'
Information
Booking of DIC type
The booking of DIC type generated by clearing can be done by LP 510 - Addition of Bill Payable, because it is generated through the FINA050 (Accounts Payable) automatic routine.
Booking of taxes generated when clearing.
LP 597 - Clearing Payable itself can book taxes generated by clearing, through variables: NPIS340, NCOF340, NCSL340, NIRF340, NISS340.
In the other cases, the booking remains unchanged, as documented below:
Booking Variables FINA340
...
Entry point | Note |
F340BROW | Entry point F340BROW is called before the browser, which you can use to handle the data displayed by the browser. |
F340LIBT | The entry point indicates whether to validate the bill release when clearing. |
F340DTFIN | PE is called in MV_DATAFIN parameter validations found in CP Clearing. |
F340TAXA | In this entry point you can change the currency rates used when clearing accounts payable. |
F340ATLIS | Use this entry point to handle the aTitulos Array, to change the listBox of the clearing screen.Document: {+}http://tdn.totvs.com/x/gKRc+ |
F340TOTCP | Use entry point F340TOTCP() to handle the total values of bills to be cleared. |
F340MKTIT | Use entry point F340MKTIT to customize bills already selected in the markbrowse. You can handle an array that contains the bills and, with its 8th occurrence, containing a logical value that indicates whether the bill is selected or not.Document:{+}http://tdn.totvs.com/x/L6Rc+ |
F340NAT | |
F340_PA | Entry point F340_PA is executed after booking each clearance payable bill. |
F340SE5 | Entry point F340SE5 handles Processed Bank Transactions with parameter Recno of records SE5 used in Clearing. |
F340GRV | Entry point F340GRV validates the addition in routine Accounts Payable Clearing (FINA340) |
F340ACAN | Use this entry point to create a rule to enter when the Reversal will occur, or not. |
F340CAN | Entry Point called upon confirmation of clearance reversal. |
F340GREST | Recording of additional data in clearance reversal |
F340FCAN | Use this entry point to save complementary data when reversing the clearance. |
FA340QRY | Query complement for cancellation of clearance |
FA340FILT | Run entry point FA340FILT when assembling the table of bills to clear and use it to select which bills you will clearDocument: {+}http://tdn.totvs.com/x/rqNc+ |
F340CMP | Use this entry point to calculate the NDF or PA bill. It is called in function Fa340Tit() |
FA340ORD | Use this Entry Point to edit the index, changing the order of bills displayed on the markbrowse for clearing payableDocument: {+}http://tdn.totvs.com/x/r6Nc+ |
F340ValOk | Entry point F340ValOk allows controlling data and confirming the payable bills clearing screenDocument: {+}http://tdn.totvs.com/x/fKVc+ |
F340TOTCP | Use this entry point to handle the total values of bills to be cleared. |
F340VLD | Use this entry point to validate whether a bill will be cleared or not.Document: {+}http://tdn.totvs.com/x/J6Vc+ |
F340LEGE | |
SE5FI340 | Use this Entry Point to make complementary recordings in table SE5, after recording the bank transaction of the main bill in automatic clearing payableDocument: {+}http://tdn.totvs.com/x/56Rc+ |
SE5FI341 | Use this Entry Point to make complementary recordings in table SE5, after recording the bank transaction of the Advance bill in automatic clearing payable.Document: {+}http://tdn.totvs.com/x/6KRc+ |
F340GERNDF | Use this to save additional fields when adding the NDF generated by the clearing payable. |
FA340NDFGrv | |
F340FLCP | Use this to implement a complementary expression in the bills filter. |
F340FCPTOP | Use this entry point to create a new filter for the routine Accounts Payable Clearing - FINA340. |
Âncora | ||||
---|---|---|---|---|
|
...