Documentation >
MAC-PAC Technical Library >
Distribution >
Order Processing >
Programs >
Report Extract - Purpose >
Report Extract - Calculations
Report Extract - Calculations
OP500E
A. Housekeeping
1. See the Common Processing Routines - Housekeeping section of this manual for a general discussion of this subroutine. Processing specific to this program is described below.
2. The company name record is retrieved from the System Control file (CT100M).
3. The date format (category 049) and the Order Processing system defaults record (category 412 and 413) are retrieved from the Reference file (REFERP).
4. The Company/Warehouse Leadtime Array is loaded from the Warehouse Description file (IC170M). Up to 100 Company/Warehouse combinations may be placed in this array. If more than 100 Company/Warehouse combinations exist, the program aborts. If this error occurs, the user must expand the size of the Company/Warehouse Leadtime Arrays and recompile the program.
B. Mainline
1. The Order Processing control parameters record (category 424) is retrieved from the Reference file (REFERP).
a. The report request flags on the Order Processing control parameters record are checked. The reports that may be requested include:
· Sales Order Document (OP520A)
· Sales Order Register (OP520B)
· Sales Order Credit Exceptions (OP530A)
· Sales Order Pricing Exceptions (OP530B)
· Sales Order Availability Exceptions (OP530C)
· Sales Order Hold Code Exceptions (OP530D)
b. If a report has been requested, the overall report request flag is set to Y.
c. The Sales Order Print flag (SHSOPF) may contain the following values:
· S print sales order only
· R print register only
· B print sales order and register
2. If at least one report has been requested, the logical Sales Order Header file (OP100ML5) is read sequentially, and each sales order is processed. The logical file contains all header records with a print action flag of Y.
a. Each sales order header record has flags indicating that the sales order and/or sales order register, credit exception, pricing exception, and/or availability exception records are to be extracted. These flags are compared to the program report request flags from step 1.
b. If both the sales order header flag and the program report request flag contain Y for the Credit Exception, Pricing Exception, and/or Availability Exception reports, the corresponding extract flag is set to Y. Report records will be extracted.
c. If the program report request flag indicates that sales orders should be printed, and the sales order flag indicates that the sales order has not been printed yet, the corresponding extract flag is set to Y. Report records will be extracted.
d. If the program report request flag indicates that the sales order register should be printed, and the sales order header flag indicates that the order has not been printed on the sales order register, the corresponding extract flag is set to Y. A report record will be extracted.
3. If the sales order extract flag contains Y, the header, line, line/lot and comment records for the Sales Order are extracted.
a. Header records are written to the Sales Order Header Print file (OP500AP1), line records to the Sales Order Line Item Print file (OP500AP2), comments to the Sales Order Comment Print file (OP500AP3), and line/lot records to the Sales Order Line/Lot Print file (OP500AP4).
b. The Number of Sales Orders Counter is incremented by one. The Number of Sales Order Lines Counter is incremented by the number of lines extracted.
4. If the sales order register extract flag is Y and the sales order is not being extracted, the header for the Sales Order is extracted.
a. Header records are written to the Sales Order Header Print file (OP500AP1).
b. The Number of Sales Order Register Orders Counter is incremented by one.
5. If the manual hold exception flag is Y, execute the subroutine to report the hold.
a. Total sales are calculated.
b. The remaining sales order hold code exception report record fields are formatted.
c. The sales order hold code exception report record is written.
6. If the credit exceptions extract flag contains Y, each of the ten credit exception flags on the sales order header record is checked.
a. For each credit exception flag that contains Y a record is written to the Sales Order Credit Exceptions file (OP500CP1).
b. An error message is assigned to each record according to the credit exception flag.
c. Total Sales (CTOSL) is calculated:
Sales Amount (SHSLAM) plus Other Charges (SHOCHG).
d. The Credit Exception Number of Orders Counter is incremented by one. The Credit Exception Number of Lines Counter is incremented by the number of records extracted.
7. If the pricing exceptions extract flag contains Y, each of the ten pricing exception flags on the sales order header record is checked.
a. For each pricing exception flag that contains Y, a record is written to the Sales Order Pricing Exceptions file (OP500CP2).
b. An error message is assigned to each record according to the pricing exception flag.
c. Gross Margin is calculated:
((Extended Price minus (Unit Cost times Order Qty)) divided by Extended Price) times 100.
d. The Pricing Exception Number of Orders Counter is incremented by one. The Pricing Exception Number of Lines Counter is incremented by the number of records extracted.
8. If the availability exceptions extract flag contains Y, each of the ten availability exception flags on the sales order header record is checked.
a. For each availability exception flag that contains Y, a record is written to the Sales Order Availability Exceptions file (OP500CP3).
b. An error message is assigned to each record according to the availability exception flag.
c. The Availability Exception Number of Orders Counter is incremented by one. The Availability Exception Number of Lines Counter is incremented by the number of records extracted.
9. For each record that was written to a print file, the corresponding flag on the sales order header or line record is set to N. This indicates that the sales order, EDI order acknowledgment, sales order register, or exception report request has been processed. If all sales order header flags contain N, the print action flag is set to N.
C. Windup
1. The report request flags on the Order Processing control parameters record (category 424) on the Reference file are set to N (No).
2. The Order Processing Report Extract Control Summary (OP500A) is printed with the totals for each counter accumulated during the program.