INDEX
01. OVERVIEW
Use this routine to generate checks before posting bills. You can generate a single check for several bills from the same supplier. The posting binds bank/branch/account/check.
02. EXECUTION
Procedure manually performed through the Checks on Bills routine (FINA390), with the display of the screens involved in the process - actions/commands from the user are required
Procedure automatically performed in the Checks on Bills routine (FINA390) 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)
#Include 'Protheus.ch'
//---------------------------------
// CHEQUE SOBRE TITULOS |
//---------------------------------
User Function 1DupPref()
Local aArray := {}
Local cCheque:= "2906001"
Local nOpc := 2 // 2 - Chq s/ titulo, 3 - Avulso
Private lMsErroAuto
aArray := { { "AUTBANCO" , "237" , NIL },;
{ "AUTAGENCIA" , "33901" , NIL },;
{ "AUTCONTA" , "125008 " , NIL },;
{ "AUTCHEQUE" , cCheque , NIL },;
{ "AUTVENCINI" , CtoD("21/06/2016"), NIL },; // Remover caso utilizar opc 3
{ "AUTVENCFIM" , CtoD("29/06/2016"), NIL },; // Remover caso utilizar opc 3
{ "AUTVALOR" , 5000 , NIL },;
{ "AUTFORN" , "001" , NIL },;
{ "AUTBENEF" , "F PADRAO ", NIL },;
{ "AUTNATUREZA" , "10101 " , NIL }}
MsExecAuto( { |x,y,z| FINA390(x,y,z)} ,0, aArray, nOpc)
If lMsErroAuto
MostraErro()
Else
Alert("O cheque "cCheque" foi gerado com sucesso!")
Endif
Return
#Include 'Protheus.ch'
//---------------------------------
// CHEQUE SOBRE TITULOS |
//---------------------------------
User Function MyCanFA390()
Local aArray := {}
Local cCheque:= "2906001"
Private lMsErroAuto := .F.
aArray := { { "AUTBANCO" , "237" , NIL },;
{ "AUTAGENCIA" , "33901" , NIL },;
{ "AUTCONTA" , "125008 " , NIL },;
{ "AUTCHEQUE" , cCheque , NIL },;
{ "AUTCHQIMPR" , .T. , NIL }}// Identifica se deve ou não reutilizar o cheque caso impresso.
MsExecAuto( { |x,y,z| FINA390(x,y,z)} ,0, aArray, 5)
If lMsErroAuto
MostraErro()
Else
Alert("O cheque "cCheque" foi cancelado com sucesso!")
Endif
Return
03. OPERATIONS
Procedure to add checks that lack associated bills.
Procedure for the user to add and link a check to a bill that has not yet been posted.
Search for the bill in the accounts payable file, having it placed and highlighted in the browser.
Procedure to delete a check and cancel the bank transaction.
Display query with accounting entry of check, if it has already been booked.
Display caption chart and check status definitions

Procedure that reverses the transaction generated by the counter check operation
04. PARAMETERS
List of parameters applied to FINA390 and its processing
Question |
Description |
Ch. w/out Bill in Bordereau? |
Enter "YES" for this routine to consider bills already listed in checks bordereau as well, otherwise "NO" |
Display Acc.Entry? |
Enter "YES" to display onscreen the accounting entries generated through checks, otherwise "NO" |
Accounts online? |
Enter "YES" to book online the entries related to checks without bills, otherwise "NO". |
Group Entries? |
Enter "YES" to group the accounting entries generated through checks in a single entry |
Question |
Description |
Default |
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_JURXFIN |
Enable integration between modules SIGAFIN - Financials and SIGAPFS - Legal. Disabled by default. |
|
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_CTBFLAG |
Enter whether to select accounting flags of the offline routines in the accounting entry transaction - SIGACTB. |
.F. |
MV_FINVDOC |
Activate control of required documents in routines for releasing bill payable postings/transactions? ("1" = Yes / "2" = No) |
2 |
MV_LIBCHEQ |
Option to release bank balance when checks are generated before posting. |
S |
MV_CTBAIXA |
Posting Booking Type (Acc. Payable): (B) Posting, in generation of (C) Check or in (A) Both cases. |
C |
MV_BX10925 |
Define when withholding of PIS COFINS and CSLL taxes are processed: 1 = At Posting or 2 = At Issue |
1 |
MV_DEDISS |
Define when ISS deduction is processed (at posting or at issue of bill). 1 = at posting; 2 = at issue |
1 |
MV_CARTEIR |
Codes of banks in the portfolio. |
|
05. FINANCIAL RULE
A check is a prompt payment order. When the issuer uses the Check on Bills operation to generate a check, they order a bank to pay a given amount to a beneficiary.
Besides a payment order, the check is also considered a "credit bill". That is, the issuer admits to a debt; thus, if payment is not made, the check can be protested or lead to a collection lawsuit.
The check is paid when a balance exists in the checking account to be verified in table SE8 - Bank Balances of the company/business unit/branch to which the user is logged. If there is no balance, the check is considered bounced and returned, requiring a Cancel operation.
06. TAX CALCULATION
The taxes to be considered in calculation:
- PIS - Social Integration Program
- COFINS - Contribution to the Financing of Social Security
- CSLL - Social Contribution on Net Profit
- IR - Income Tax
- ISS - Tax on Service
The minimum withholding value is considered from the taxes, only to recompose the tax calculation base, so the check keeps the net value:
- PIS - Social Integration Program
- COFINS - Contribution to the Financing of Social Security
- CSLL - Social Contribution on Net Profit
- IR - Income Tax
Example:
- Addition of a bill payable with PIS, COFINS and CSLL in the amount of 100 does not reach the calculation minimum entered in parameter (MV_VL10925 = 10)
- Generate check on bills.
- The check value will be 100, because the minimum for withholding was not reached.
- Thus, when the posting is made by routine FINA080 - manual postings payable, the posting value becomes equal to the check value.
Cumulativeness only occurs when a pending withholding bill is already posted, on the same day the check is generated for a second bill.
Example:
- Addition of a bill payable with PIS, COFINS and CSLL in the value of 100.
- Generate check on bills.
- The check value will be 100, because the minimum for withholding was not reached.
- Post bill through routine FINA080 - manual postings payable.
- Addition of a second bill payable with PIS, COFINS and CSLL in the amount of 200. At this point, the tax calculation is performed on 300, because the previous bill did not reach the minimum, and tax cumulativeness is executed.
- Generate check on bills.
The check value will be 186.05, calculated as follows:
Value withholding pending |
Addition of second bill, executing cumulativeness |
Generation of check on bill of 200.00 |
Bill - 100.00 |
Bill - 200.00 |
Tax base = 300 |
Pis - 0.65 |
Pis - 1.3 |
Pis = 1.95 |
Cofins - 3 |
Cofins - 6 |
Cofins = 9 |
Csll - 1 |
Csll - 2 |
Csll = 6 |
Taxes total = 4.65 |
Taxes total = 9.3 |
Total of taxes to be calculated = 13.95 |
|
|
Net value of check ( 200 - 13.95 = 186.05) |
IMPORTANT!
The routine is not responsible for withholding the tax. It only recomposes the base so the check value is a net amount.
07. ACCOUNTING
The booking of processes applied to a check added via Financials module is done through the standard entries below:
SE | Generator Fact | ON | OFF (CTBAFIN) |
566 | Generation of checks on bills pending | X | X |
567 | Generation of counter checks | X | X |
568 | Cancellation of Counter Check | X | X |
569 | Redeposit of checks on bills pending | X | X |
571 | Cancellation of checks on bills pending / Deletion of payment order | X | X |
08. TABLES
- SE2 - Accounts Payable Register
- SEF - Checks Register
- SED - Natures Register
- SA6 - Banks Register
- SA2 - Suppliers Register
- FK2 - Postings Payable
- FK3 - Calculated Taxes
- FK4 - Withheld Taxes
- FK5 - Bank Transactions
- FK6 - Accessory Values
- FKA - Transaction Tracking
09. ENTRY POINTS
Entry point | Note |
F390BROW | Entry Point that allows creating a filter in the browser of routine FINA390.Document: http://tdn.totvs.com/x/7qRc+ |
F390BFIL | Allows entering an expression for filtering bills on the main screen of the Check Generation routine, to run only in the TopConnect environment. Enter the expression in SQL.Documentation: http://tdn.totvs.com/x/oKRc+ |
A390HIST | Use entry point A390HIST to fill out field cHist390 (initialization of history in generation of checks on bills). Documentation: http://tdn.totvs.com/x/OKJc+ |
F390FIL | Entry point F390FIL implements a condition in default filter of work file (table) when selecting bills to generate Checks on Bills. Documentation: http://tdn.totvs.com/x/oAdoDg+ |
A390ACR |
|
F390GCHE | Use entry point F390GCHE to handle the issue date of the check when generated through button "Check W/out Bill" of routine FINA390.Document: http://tdn.totvs.com/x/m6Rc+ |
A390SEF | Entry point A390SEF is used for complementary saving items of check on bill. It is executed after saving data to SEF. Documentation: http://tdn.totvs.com/x/OaJc+ |
A390CHEQ | The entry point is called in the bill selection function for check generation (FA390tit). Entry point for processing checks before booking. Documentation: http://tdn.totvs.com/x/N6Jc+ |
A390AVU | The Entry Point is called in the check on bills generation program, on posting of bills or counter checks after saving check to SE5. Documentation: http://tdn.totvs.com/x/NqJc+ |
F390CANC | Entry point that allows or prohibits check cancellation.Documentation: http://tdn.totvs.com/x/RaRc+ |
F390CBX | Entry point for saving complements after check cancellation. |
F390REDP | Use entry point F390REDP to save complementary SEF data when handling a redeposit. Documentation: http://tdn.totvs.com/x/A6Nc+ |
FA390NATUR |
|
F390NATU |
|
F390BEN |
|
F390TIT | Entry point F390TIT checks the possibility of selecting the bill to compose the check. If the bill selection is changed, ExecBlock must return .F., so there is nochange to accumulators of values and numbers of bills.Document: http://tdn.totvs.com/x/YqVc+ |
FA390TOK | Use entry point FA390TOK in validation (All Okay) of data digitalized when generating checks and redepositing. You can use the following variables: cBanco390, cAgencia390, cConta390, cHist390, cNatur390, cCheque390, cForn390, cBenef390 e nValor390.Document: http://tdn.totvs.com/x/taNc+ |
F390FILUSU | Entry point for validation of bills for CH generation. |
F390GRV | The purpose of entry point F390GRV is to handle checks. It is called in function fa390Ver() before checking whether the cancellation refers to counter check or bill. |
F390CBX2 | Entry point for saving complements after check cancellation. |