Note

This routine was adjusted to comply with the General Personal Data Protection Law (Statute No. 13.70), so that some fields containing data regarded as sensitive and/or personal are blurred, becoming illegible.

The Withholding Income Tax Declaration - DIRF is the declaration made by the PAYING SOURCE, in order to inform the Federal Revenue Service of Brazil of the amount of income tax and/or contributions withheld from income paid or credited to its beneficiaries.

For companies that use the Payroll of the Personnel Management module integrated into the Financial Services, this routine generates the necessary data for DIRF, feeding the SRL (DIRF/Income Report) and SR4 (DIRF Items) tables.

For the bill to be considered for sending the data to SR4 and SRL (DIRF/Income Report Items), the following registrations must be configured:

    In the Suppliers File (SA2), the fields checked when the DIRF is generated are:

    Registrations

    • Company Name (A2_Nome)
    • Type (A2_TIPO)
    • EIN/SSN (A2_CGC)

    Adm./Fin.

    • Inc. Tax (A2_IRPROG)
    • Inc. Tax. SSN (A2_CPFIRP)

    For the cases with Sched. Inc. Tax, there is also the registration of Sched. Inc. Tax SSN (FKJ), to enter the Income Tax apportionment for more than one SSN. 

    Check further details on Registration of CPFs progressive apportionment of Federal Income Tax sent to DIRF

    Tax

    • INSS Calc (A2_RECINSS)
    • PIS Coll. (A2_RECPIS)
    • Cofins Coll. (A2_RECCOFI)
    • CSLL Coll. (A2_RECCSLL)
    • Tax Calc. (A2_CALCIRF)

    TMS

    • Dependents (A2_NUMDEP)

    Residing abroad

    Check further details on Generate DIRF for suppliers residing abroad

    Others

    • PJ Clas. (A2_TPENT) 

    Check further details on DSERFINP-8673 DT DIRF 2018 VPEIM Immune and Exempt Entities

    Warning

    The SSN/EIN field must always be entered so as not to generate inconsistencies in the DIRF validator, except in the case of foreign suppliers, where the mandatory information will be the NIF code (A2_NIFEX); if not, inform the NIF reason (A2_MOTNIF).

    In the Natures File (SED), the fields checked in the generation of the DIRF are:

    Taxes

    • Calculate Inc. Tax (ED_CALCIRF)
    • Tax Perc. (ED_PERCIRF)
    • Calculate INSS (ED_CALCINS)
    • INSS Perc. (ED_PERCINS)
    • Calculate CSLL (ED_CALCCSL)
    • CSLL Perc. (ED_PERCCSL)
    • COFINS (ED_CALCCOF)
    • COFINS Perc. (ED_PERCCOF)
    • Calculate PIS (ED_CALCPIS)
    • PIS Perc. (ED_PERCPIS)
    • Tax Base (ED_BASEIRF)
    • RT INSS PA (ED_RINSSPA)
    • Car. Inc. Tax. Base. (ED_BASEIRC)


    When registering the bill payable, it is important to enter the following fields:

    Taxes

    • Generate DIRF (E2_DIRF)
    • Withholding Cd (E2_CODRET) 

    How the bills must be saved once the TXs have been generated:

    Invoice Bill (ORIGINAL Bill)

    Field “Generate DIRF for this bill?” (E2_DIRF) must be set to 2 - No.

    The field Withholding Code (E2_CODRET) must be filled out.

    The field Tax Parent Bill (E2_TITPAI) must be blank.


    TX Bill (Tax Bill)

    Field “Generate DIRF for this bill?” (E2_DIRF) must be set to 1 - Yes.

    The field Withholding Code (E2_CODRET) must be filled out.

    The field "Tax Parent Bill" (E2_TITPAI) must be filled out with data from the parent bill (prefix+number+ installment+type+supplier+store).


    Generation

    The process for generating data for the DIRF occurs in the following manner:

    • The following taxes are considered:

    For Legal Entity:

    IR - Income Tax

    PIS - Social Integration Program

    COFINS - Contribution to the Financing of Social Security

    CSLL - Contribution to the Social Security

    For natural person:

    IR - Income Tax

    INSS - National Institute of Social Security


    • All the bills that did not have withholding but have the withholding code filled in will be sent to DIRF.
    • This routine must be processed from time to time. It is suggested to process it at the time of the Income Reports delivery, and the generation be executed month by month, avoiding overload in the case of processing the whole year.
    • This operation creates required information in tables SRL and SR4 (Header and items from DIRF and from Income Report), to be used in the Personnel Management module, for example, reports printing, file maintenance, generation of files to be submitted to the Federal Revenue Service, among others.


    Important:

    By adding an inbound document with Type of Inflow and Outflow (TIO) configured to generate bills in Financials, check if the content of the parameter MV_VISDIRF is enabled (content 1). This parameter allows you to enter the withholding code for the taxes in the inbound document.

    Minimum value

    The validation of the minimum limit of BRL 6,000.00 for sending bills without withholding to SR4 was removed. All bills in which the fields Generate DIRF = Yes and that have a withholding code will be considered for submission to SR4. That way, the minimum value treatment can be performed when generating the DIRF file using the NVLLIMDIRF and NVLLIMOUT mnemonics, used by the routine that generates the DIRF file.

    * To comply with the law - Normative Instruction 1.663/2016: to establish that the exemption from withholding taxes in payments to educational and social assistance institutions, and to philanthropic, recreational, cultural, scientific institutions, and non-profit civil associations, is restricted to the services for which they have been established. Payments for these services, although exempt from withholding, must be reported in the DIRF for events occurring as of the calendar year 2017, regardless of the amount.

      Consider Date (MV_PAR01)

      The DIRF must be generated for the Year:

      Example: Calendar 2021 (Period from 01/01/2020 to 12/31/2020).

      Select the field of the date that should be considered for generating the data of the main bill* and Income Tax.

      If you select Digital Issue, the system will consider the Issue Period (E2_EMIS1) between the start date and the end date entered, and thus with the Due Date (E2_VENCTO), Actual Due Date (E2_VENCREA), and Actual Issue (E2_EMISSAO)

      If the Posting Dt option is selected for the question Consider Date, bills with the field E2_BAIXA are filtered first in the period entered in the fields Date from/to

      For bills not posted (blank E2_BAIXA), this same period is considered. However, the issue date (E2_EMIS1) is applied to it. This prevents any mandatory information from being suppressed from the DIRF due to a gap in parameter settings.

      ATTENTION: According to our legal advice, all bills must be considered, even if they have not been posted. If you have any questions, check the Private Company - DIRF report at http://tdn.totvs.com/pages/viewpage.action?pageId=134152556

      ATTENTION: The questions "DATE FROM" and "DATE TO" (MV_PAR02, MV_PAR03), which allow DIRF calculation files to be generated for a period different from the one mentioned above, are only for isolated data of a certain period, i.e., for verification purposes only.

      *As parameters set for the Check Date? Question


      Date From (MV_PAR02) and Date To (MV_PAR03)

      The questions "DATE FROM" and "DATE TO" (MV_PAR02, MV_PAR03) allow you to select the desired period considering, for the bills filter, the date field entered in the questions "Consider Date?" and "Consider PCC Date?


      Supplier Type (MV_PAR04)

      Select the type of supplier (natural person or legal entity) to be considered for the generation. Only the bills of the suppliers registered as the type of person chosen in this question will be considered in the generation of the data (blank A2_TIPO will not be considered).

      Notes:

      A supplier of the Legal type (A2_TIPO = J) configured with Sched. Inc. Tax = Yes will be considered as a Legal Entity in this filter. 

      A Supplier of the Foreign type (A2_TIPO = X) will be considered as a Legal Entity in this filter.


      Check Date (MV_PAR05)

      Defines whether the date period entered will be applied to the main bill or to the tax bill.

      It must always be generated as "MAIN BILL".

      Even though the option of generation by TAX BILL is available in the routine, it is not considered as a valid mechanism to generate DIRF in any official document (Federal Revenue).


      Centralize at Branch (MV_PAR06)

      Enter the DIRF's centralizing branch. If no branch is entered, the DIRF will be generated with the EIN of the current branch.                          

      Keep in mind that the DIRF delivery is per Company (Matrix).


      Generate Processing Log (MV_PAR07)

      When you select Yes (generate the log), the report is displayed for checking all the bills, generated in the month and per withholding code, that were sent to table SR4, and can be accessed in the File Maintenance routine (GPEM560).

      Note

      For each processing, a .CSV file (Excel format) is generated based on the log report and stored in the folder SYSTEM\DIRF of Protheus.


      Select Branches (MV_PAR08)

      This allows you to select a range of branches for processing the bills. 

      WARNING: In these cases, field E2_FILORIG is not verified. This means that the E2_FILIAL field will be considered for processing.


      Consider PCC Date (MV_PAR09)

      This works as the Consider Date (MV_PAR01) parameter, but selecting the date that refers to the Pis/Cofins/Csll bills (main or tax bills*). If you select Issue (E2_EMIS1), the system will consider the Issue period between the Start Date (MV_PAR02) and the End Date (MV_PAR03) entered, as well as the Due Date (E2_VENCTO), Actual Due Date (E2_VENCREA), Posting Dat e(E2_BAIXA), and Actual Issue (E2_EMISSAO)

      Posting Date - If these bills have not been posted, they will not be sent to the DIRF. 

      Note:

      Consider Date = Issue, Actual Issue Date, Due Date, and Actual Due Date

      Check date = Tax Bill

      This is a variation not stated by law, i.e. it is only available for checking and managerial view. This is because, according to the law, the PCC retention is on payment.

      *As parameters set for the Check Date? Question


      Consider Advance Payment (MV_PAR10)

      If set to No, maintain the default submission, generating only Invoice information.

      If set to Yes, only the TXs of Income Tax, PIS, COFINS, and CSLL (configured on posting) generated by the PA will be considered. The value of the Invoice settled with the PA will be ignored.

      For further information about this question, refer to DIRF Considers PA submission


      Reprocessing Message

      Processing: While bills are not processed by DIRF routine, the field E2_DTDIRF is blank.

      Reprocess = No: keep the records in SR4 and consider only the records that were not processed yet (blank E2_DTDIRF).

      Reprocess = Yes: SR4 records will be deleted according to the year entered in Start and End Date, and the DIRF processing date (E2_DTDIRF) will be cleared for reconsideration. The bills considered will be the same as the filter configured.

      Reprocessing Option (FINA401 - SIGAFIN)


      Procedures

      To generate data for the DIRF:

      1. Access Miscellaneous > Files > Generate Data for the DIRF (FINA401).
      2. In Generate Data for the DIRF, the routine description screen is displayed.
      3. Click Parameters and fill them out according to field help instructions.
      4. Check the data and confirm it.
        1. The system returns to the routine's description screen.
      5. By confirming it again, a screen is displayed to ask if data generation for the year should be reprocessed.
        1. This screen explains the processes to be made according to the selection.
      6. Confirm it as needed. 
        1. The system starts the process of generating bills payable data for SIGAGPE.
      7. At the end of the processing, the question "View log report with the bills processed?” is displayed. (if the Generate processing log question is set).
      8. Enter Yes to view the detailed report of processed bills per supplier, withholding code, and month.

      After generating the data for the DIRF, the date of processing is stored in the field Dt. Gen. field (E2_DTDIRF) for the processed bills.



      DIRF - Recommendations

      • Generate DIRF by MAIN BILL. Even though the option of generation by TAX BILL is available in the routine, it is not considered as a valid mechanism to generate DIRF in any official document (Federal Revenue). 
      • The DIRF must be generated for the Calendar Year (Example: Period from 01/01/2020 to 12/31/2020): The questions DATE FROM and DATE TO that enable generation of DIRF calculation files by a period different from the one mentioned above are only used to query isolated data of a certain period. Thus, they are not checked with data considered in a period required by the Federal Revenue Office (Calendar Year), since the same rules applied to DIRF Calendar Year are exclusively applied to the period annotated, not considering records out of this period. 
      • If some bills were not considered when processing the DIRF:
        1. Check if the E2_DTDIRF field is blank. If it is, it was not run by FINA401. Check if a withholding code exists and review the parameter settings.
        2. Check if there were any changes in the nature of taxes (MV_IRF, MV_PISNAT, MV_COFINS, MV_CSLL) during the selected period. The program only considers as tax what is in the content of the parameters; if it is different, it will not be considered.
        3. Check if, during the use of the selected period, there were any changes in the field group of the INSTALLMENT field or bill number; if so, check if the field E2_TITPAI is with the incorrect key.



      ENTRY POINTS

      FA401QRY- Change query select conditions  

      LF401GRV - Consider certain records of SE2

      F401QRY2 - Add or change data when selecting tax bills

      F401QRY3 - Add or change data when selecting tax bills

      F401QRY4 - Add or change data when selecting tax bills

      F401QRY5 - Add or change data when selecting tax bills

      FA401PROC - Processing and generating DIRF data

      FA401SR4 - DIRF Bases

      F401REX - Change list of withholding codes

      F401DCMP to save complementary data

      LF401GRV - Consider certain records of SE2

      FINCDRET - Return withholding codes

      OTHER RELATED ROUTINES

      Monthly registration of the dependent's deduction amount for income tax

      Registration of CPFs progressive apportionment of IRRF sent to DIRF

      SCP Partners Registration

      SEE ALSO

      For further information about DIRF, refer to:

      FIN0041_CPAG_Geração_de_Dados_para_DIRF_(FINA401)

      Information on DIRF?

      FAQ - Protheus - Personnel Management