Páginas filhas
  • Integration Routines – CTBANFE and CTBANFS

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 routines work with queries that unify the information dispersed in "N" tables into a single record of a new ALIAS.
  • The routine usage method depends on the parameters: MV_OPTNFE and MV_OPTNFS.


Purchase Accounting - CTBANFE

The main configuration feature of routine CTBANFE is the use of the 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.

  • Only table SD1 will be handled by the routine's query, restricting the fields of this table, which can be used in Standard Entries. The ALIAS for the query in this situation will be "SD1".


Table

Available Fields

SD1

All fields, except those that start with "D1_BASE" and D1_BASI"


  • Tables SA1, SA2, SB1, SF1, and SF4 will be positioned and can be used normally in the Standard Entries. Example:


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.

  • Tables SA1, SA2, SB1, SD1, SF1, and SF4 will be handled by the routine's Query, restricting the fields of these tables, which can be used in the Standard Entries. The ALIAS for the query in this situation will be "CTBANFE".


  • In this situation, the Standard Entry must be configured according to the example:


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+…


  • If the OFFLINE Standard Entries have been set to handle the "CTBANFE" ALIAS, they cannot be used in an ONLINE accounting process.
  • The fields available in the CTBANFE query are:


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 that start with "D1_BASE" and "D1_BASI"

SF1

All fields, except those that start with "F1_BASE" and "F1_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 CTBNFE, which allows the query manipulation, must be used. A template of this entry point is available at CTBNFE - Change of Query for Optimization


Billing Accounting - CTBANFS

The main configuration feature of routine CTBANFS is the use of the 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.

  • Only table SD2 will be handled by the routine's query, restricting the fields of this table, which can be used in Standard Entries. The ALIAS for the query in this situation will be "SD2".


Table

Available Fields

SD2

All fields, except those that start with "D2_BASE" and D2_BASI"


  • Tables SA1, SA2, SB1, SF2, and SF4 will be positioned and can be used normally in the Standard Entries. Example:


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.
 

  • Tables SA1, SA2, SB1, SD2, SF2, and SF4 will be handled by the routine's Query, restricting the fields of these tables, which can be used in the Standard Entries. The ALIAS for the query in this situation will be "CTBANFS".
  • In this situation, the Standard Entry must be configured according to the example:


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


  • If the OFFLINE Standard Entries have been set to handle the "CTBANFS" ALIAS, they cannot be used in an ONLINE accounting process.


  • The fields available in the CTBANFS query are:


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 that start with "D2_BASE" and "D2_BASI"

SF2

All fields, except those that start with "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