The Offline Accounting must be processed to generate the accounting file.
This routine registers offline accounting entries for inflow documents and purchase orders, according to routine parameters and accounting rules of standard entries:
Important: This routine runs on any system version. However, check the following considerations:
According to this parameter, the standard entry must be configured in accordance with examples below: |
Parameter MV_OPTNFE defined as F
The routine selects records through database query. Before registering standard entries, the aliases are selected and made available for use. Thus, entries could be:
Credit | Iif(SF1->F1_TIPO$’DB’,SA1->A1_CONTA,SA2->A2_CONTA) |
Debit | SD1->D1_CONTA |
Value | SD1->D1_TOTAL-SD1->D1_VALDESC+SD1->D1_VALIPI+SD1->D1_ICMRET |
Parameter MV_OPTNFE defined as T
The routine selects records through database query. For standard entry registration, the alias CTBANFE is provided, with some fields from tables mentioned in standard entries. Thus, entries could be:
Credit | Iif(CTBANFE->F1_TIPO$’DB’,CTBANFE->A1_CONTA,CTBANFE->A2_CONTA) |
Debit | CTBANFE->D1_CONTA |
Value | CTBANFE->D1_TOTAL-CTBANFE->D1_VALDESC+CTBANFE->D1_VALIPI+CTBANFE->D1_ICMRET |
Tip: If parameter MV_OPTNFE is set as T, the files SD1 - Inflow Document Item and SF1 - Inflow Document Header are not selected. Therefore, you must use the alias CTBANFE when creating standard entries, as shown in the example above. |
Fields available in the alias CTBANFE
SF1 | All fields, except those started by: F1_BASE and F1_BASI |
SD1 | All fields, except those started by: D1_BASE and D1_BASI |
SA2 | A2_FILIAL, A2_COD, A2_LOJA, A2_CONTA, A2_NOME, A2_NREDUZ |
SA1 | A1_FILIAL, A1_COD, A1_LOJA, A1_CONTA, A1_NOME, A1_NREDUZ |
SB1 | B1_FILIAL, B1_COD, B1_CONTA |
SF4 | F4_FILIAL, F4_CODIGO, F4_CF |
SC7 | All fields in SC7 (Only for Standard Entry 652) |
To add other fields, use the entry point CTBNFE.
Example:
User Function CTBNFE()
If PARAMIXB <> Nil
aSelect := PARAMIXB[1]
aFrom : PARAMIXB[2]
cWhere := PARAIXB[3]
//Aqui eu adiciono o campo especifico da TES.
Aadd(aSelect,{”F4_MEUTS”,"C",3,0})
//Aqui eu adiciono o campo especifico do Produto
Aadd(aSelect,{”B1_MEUPRD”,"C",15,0})
//Aqui eu adiciono o campo especifico do Fornecedor
Aadd(aSelect,{”B1_MEUSA2”,"C",6,0})
Return({aSelect,aFrom,cWhere})
Else
Return(PARAMIXB)
EndIf
User Function CTBPC()
If PARAMIXB <> Nil
aSelect := PARAMIXB[1]
aFrom : PARAMIXB[2]
cWhere := PARAIXB[3]
//Add the specific TIO field here.
Aadd(aSelect,{”F4_MEUTS”,"C",3,0})
//Add the specific Product field here.
Aadd(aSelect,{”B1_MEUPRD”,"C",15,0})
//Add the specific Supplier field here.
Aadd(aSelect,{”B1_MEUSA2”,"C",6,0})
Return({aSelect,aFrom,cWhere})
Else
Return(PARAMIXB)
EndIf
See Also