MAC-PAC Homecontact ussupport login 
Documentation > MAC-PAC Technical Library > Distribution > Order Processing > Programs > Consolidated Billing Update - Purpose > Consolidated Billing Update - Calculations

Consolidated Billing Update - Calculations

OP640E

A.   Housekeeping

1.   Key lists are defined for each file retrieved by the program.

2.   Workfields are defined and program constants are initialized.

3.   The following records are retrieved from the Reference file (REFERP):

a.   Reference File access codes are retrieved from Reference File category 015.

b.   Order status codes are retrieved from Reference File category 403.

c.   Part types are retrieved from Reference File category 405.

d.   The aging periods are retrieved from Reference File category P44.

e.   The date format record (category 049) is retrieved.  If flag is Y, format date as DDMMYY.  If flag is N, format date as MMDDYY.  If flag is A, format date as YYMMDD.  If this record is not found, the date format defaults to MMDDYY.

f.    The System Defaults record (category 133) is retrieved to determine whether the system has been set up to process in a multi-currency environment or not. If the flag is Y, the system retrieves all the valid currency codes from Reference File category D89.

g.   Document types are retrieved from Reference File category 329 and account class codes are retrieved from Reference File category 340.

h.   The system determines the current sales period from Reference File category 407 and the last sales period posted from Reference File category 435.  Based on the values set in category 435, the period posting date is retrieved.

4.   The program formats successful/unsuccessful invoice messages.

B.   Mainline

1.   The program reads the Invoice Header Request file (OP290AP1) to retrieve invoices requested via the Consolidated Billing Selection program (OP290E).

a.   the program retrieves the first selected shipments from OP290AP2 to be consolidated on this invoice.

b.   If the accounting date (HRACDT) is greater than the current period posting date (PSTDAT) established in the Housekeeping routine, the program sets the current period posting flag to N (next period).  If the accounting date (HRACDT) is less than or equal to the current period posting date (PSTDAT), the program sets the posting flag to Y (current period).

c.   Company/location default information is retrieved from Reference File 132 for the selling company/location (HRSLCO) to determine whether this company/location operates in a VAT environment.

(1)  If operating in a VAT environment, the accounts receivable vat defaults are retrieved from Reference File category 307 and the VAT types are retrieved from Reference File category 024.

d.   Company/location default information is retrieved from Reference File 002 to determine the base currency (BASECC).

(1)  Decimal precision guidelines are determined and the order processing default records are retrieved from Reference File categories 412 and 413 for the selling company/location.

e.   The customer's VAT suspension date/limit is checked to determine if suspension should be applied.  The cash discount (HRPMCD) is established for the invoice payment terms.  The program chains to the General Ledger Account file (GLFILEL5) to retrieve the suspense accounts.  The A/R account is then retrieved from the Reference file.

(1)  The following validation is performed on A/R.  The account status (MFACST) must be active, the account class (MFACCL) must be A/R, and the customer currency (CMCUCD) must have the same currency code as the G/L Account Master (GLFILEL5).

2.   The Invoice Request Detail records from OP290AP2 are retrieved and processed.

a.   Invoice header records from the Pending Invoice Header file (ARPNDOP) is retrieved and processed.

b.   The VAT array is loaded once per invoice with the vat codes and vat rates.

c.   Invoice line records from the Pending Invoice Distribution file (ARPNDDP) are retrieved and processed.

(1)  If the line is a tax record, tax processing is performed for sales orders.

(2)  If the line is freight, freight processing is performed for sales orders.

(3)  If the line is a sales record, the Sales Order Line record (OP100M2) and Workfile records (OP120AP2) are retrieved.  Vat and sales amounts are recalculated and amounts are accumulated for the invoice totals.  If sales adjustments are needed the header record is updated accordingly.

d.   If requested, comments are processed for the pending invoice for sales orders.  This information is retrieved and processed from the Open Item Comments by Sales Order file (ARCMTSL1).  Open Item Comments (ARCMSTL1) generated at the time are updated with the invoice number.

e.   The sales order is updated with the invoice number.  For transfer orders, the Transfer Order Shipping/Billing file is updated with the invoice number.

f.    The Invoice Request Detail Record and Pending Invoice Records are deleted.

3.   A check is made to determine is fiscal authorization number is required.

a.   A fiscal authorization number is required if the invoice contains either exonerated or suspended VAT.  If one is not entered and is required, the program aborts.

4.   VAT distribution records are written from the VAT arrays.

5.   The Invoice Header record is formatted and the Customer Master file (ARCUSTL1) is updated.

a.   The total order amount (OIOAMF) is added to the customer's A/R balance (CMARBF).

b.   The account aging buckets are updated if necessary.

c.   The accounting transaction fields, G/L account/center, and journal entry amounts are formatted for the accounts receivable transactions.

d.   If the customer passes validation of it's status and allows transactions, the invoice is immediate (as determined on the Reference file), an invoice request record is formatted and written to the Open Item Print file (OP530AP).

6.   If no processing errors have occurred, the program determines whether an invoice gain/loss must be booked.  A gain/loss must be booked if the exchange rate used to book the accounts receivable account differs form the exchange rate used to book any of the accrued receivable accounts.

a.   If a gain/loss must be booked, a distribution record is written to the Pending Invoice Distribution file (ARPNDDP) and the accounting transaction is recorded.

7.   If there are no more records to be processed, set the status indicator to 'END' (PGMEND = PGMSTS).

8.   If a critical error has occurred (CT010) a rollback is performed and the necessary files are updated (i.e., the pending invoice records are deselected).

9.   The request records are deleted and a commit is made.

10.  A successful/unsuccessful message is sent to the workstation that requested the consolidated invoice.

OP640E Program Menu