01. OVERVIEW
In the Billing (SIGAFAT) module, in the Sales Order (MATA410) routine, it is possible to enter the cost center apportionments in different items, according to the TIO configuration we can have items that generate financials or not.
In this case, when billing, we can have an invoice value different from the bills' value.
For this integration, only items that generate financials are considered, in which the TIO is set to generate a trade note F4_DUPLIC = "S".
When we add a Sales Order (MATA410) and set the cost center apportionments for the order items (Other Actions > Apportionment), the information is stored in table AGG - Sales Order Apportionment, and, when billing, either by the Outgoing Document routine (MATA461) or directly by the Sales Order (MATA410) routine, table AGH - Outgoing Invoice Apportionment will be saved. At this point, we implement the saving of the AGH_TOTAL field and, depending on the configuration of the MV_RTCCFIN and MV_MULNATR parameters, if they are enabled, the SEV - Multiple natures by bill and SEZ - Distribution of natures in cost center tables used to integrate with the Financial module will be saved.
To implement the integration process it is necessary to have the continuous shipping package of the Billing module (SIGAFAT) with a date equal to or greater than 01/24/2022 applied, the AGH_TOTAL field configured in the dictionary, and the MV_RTCCFIN and MV_MULNATR parameters activated.
If the environment does not have the settings mentioned above, follow the step by step below.
With exclusive access to the environment, access the Configurator module.
Access the path Database>Dictionary>Databases.
Click to expand the company information and select the option Data Dictionary.
Click the Searchicon.
The Search option is displayed. Search for the AGH table.
The table is displayed next to the search, as shown below. Click the row to select it.
With the row selected, click the Edit icon.
Click to expand the table information and select the option Fields.
Click the Add icon.
The Database Manager is displayed. Fill it out as shown below:
Field: AGH_TOTAL
Type: 2 - Numeric
Size: 14
Decimal: 2
Format (automatically generated): @E 99.999.999.999,99
TOTVS POS: 1 - Yes
Modal: 2 - No
Click the Information tab and fill it out as shown below:
Title: Vl. Total
Description: Vl. Total Item CC Apportionment
Help: Total value of apportionment by item's cost center.
Click the Use tab, select the field as Used, in accordance with the image below, and click Save.
Confirm that you are done editing the table in the Check icon.
Then, click the Directory icon.
Click to expand the Company information and select the Parameters option.
Click the Add icon.
The Database Manager is displayed. Fill it out as shown below:
Var Name: MV_RTCCFIN
Type: 3 - Logic
Cont.Por: .T.
Click Save.
Click the Add icon.
The Database Manager is displayed.
Fill it out as shown below:
Var Name: MV_MULNATR
Type: 3 - Logic
Cont.Por: .T.
Click Save.
Click Data Dictionary again and, using the Floppy Disk icon, start saving. Then, click Next until you reach the Finish operation.
After you finish saving, click the door icon to exit.