Concepts
The CTBANFE and CTBANFS routines were developed to improve the performance of the offline accounting process.
Among the main features of the enhancements and modifications implemented by these routines are:
The main configuration feature of routine CTBANFE is in the use of parameter MV_OPTNFE. This parameter defines if the routine will group the main tables used in the accounting process into a single query ALIAS.
Parameter MV_OPTNFE set to .F.
Table |
Available Fields |
SD1 |
All fields, except those started in "D1_BASE" and D1_BASI" |
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 set to .T.
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+… |
Table |
Available Fields |
SA1* |
A1_FILIAL,A1_COD,A1_LOJA,A1_CONTA,A1_NOME,A1_NREDUZ |
SA2* |
A2_FILIAL,A2_COD,A2_LOJA,A2_CONTA,A2_NOME,A2_NREDUZ |
SB1 |
B1_FILIAL,B1_COD,B1_CONTA |
SD1 |
All fields, except those started in "D1_BASE" and "D1_BASI" |
SF1 |
All fields, except those started in "F1_BASE" and "F1_BASI" |
SF4 |
F4_FILIAL,F4_CODIGO,F4_CF |
*depending on the type of account
The main configuration feature of routine CTBANFS in the use of parameter MV_OPTNFS. This parameter defines if the routine will group the main tables used in the accounting process into a single query ALIAS.
Parameter MV_OPTNFS set to .F.
Table |
Available Fields |
SD2 |
All fields, except those started in "D2_BASE" and D2_BASI" |
Credit |
IIF(!SF2->F2_TIPO$'DB',SA1->A1_CONTA,SA2->A2_CONTA) |
Debit |
SD2->D2_CONTA |
Value |
SD2->D2_TOTAL+SD2->D2_VALIPI+SD2->D2_ICMRET |
Parameter MV_OPTNFE set to .T.
Credit |
IIF(!CTBANFS->F2_TIPO $ 'DB',CTBANFS->A1_CONTA,CTBANFS->A2_CONTA) |
Debit |
CTBANFS->D2_CONTA |
Value |
CTBANFS->D2_TOTAL-CTBANFS->D2_VALIPI+CTBANFS->D2_ICMRET |
Table |
Available Fields |
SA1* |
A1_FILIAL,A1_COD,A1_LOJA,A1_CONTA,A1_NOME,A1_NREDUZ |
SA2* |
A2_FILIAL,A2_COD,A2_LOJA,A2_CONTA,A2_NOME,A2_NREDUZ |
SB1 |
B1_FILIAL,B1_COD,B1_CONTA |
SD2 |
All fields, except those started in "D2_BASE" and "D2_BASI" |
SF2 |
All fields, except those started in "F2_BASE" and "F2_BASI" |
SF4 |
F4_FILIAL,F4_CODIGO,F4_CF |
*depending on the type of account
If other fields need to be used besides the ones available at the query, the Entry Point CTBNFS, which allows the query manipulation, must be used.
A template of this entry point is available at CTBNFE - Change of Query for Optimization