Documentation >
MAC-PAC Technical Library >
Distribution >
Sales Analysis >
Programs >
Sales Statistics Post - Purpose >
Sales Statistics Post - Calculations
Sales Statistics Post - Calculations
SA100E
A. Housekeeping
1. See the Common Processing Routines - Housekeeping section of this manual for a general discussion of the Housekeeping subroutine. Processing specific to this program is described below.
2. The default Company Name is retrieved from the System Control file (CT100M). If this record is not found, a default message is used.
3. The following information is retrieved from the Reference file (REFERP):
a. The Sales Analysis control parameter record (category A03) is retrieved to determine last period posting type, and if month-end reports should be printed.
b. The current sales period calendar (category 407) and the last year sales period calendar (category 408) records are retrieved.
c. The default freight part (category 413) is retrieved.
4. The Sales Period Calendar Array is filled with the sales period ending dates through the sales posting period (defined on the parameter record). Remaining posting periods greater than the sales posting period are filled with the sales posting period end date for the current sales period. The data for this array is obtained from the current sales period calendar and the last sales period calendar.
B. Mainline
1. The Warehouse Balance file (IC140M) is read sequentially to roll the following sales statistics fields: Shipped Order Quantity, Cost of Sales, Shipped Sales Amount, Shipped Order Lines, Shipped Backorder Quantity, Return Quantity, Cost of Returns, Return Sales, and Return Lines.
a. If the sales period is the last sales period of this year (period 12 if year calendar or period 13 if period calendar), the current year-to-date fields are rolled into the prior year fields. The current year-to-date fields are then set equal to the next period fields.
b. If it is not the last sales period of the year, the current period fields are added to the year-to-date fields.
c. For all periods, the current fields are set equal to the next sales period fields. The next sales period fields are set to zero.
2. The logical Customer file (ARCUSTL1) is read sequentially to roll the following sales statistics fields: Booked Orders, Booked Order Lines, Booked Order Amount, Booked Order Cost, Shipped Orders, Shipped Order Lines, Cash Sales, Non-cash Sales, Cost of Sales, Return Quantity, Cost of Returns, Return Sales, Return Lines, and Other Charges.
a. If the sales period is the last sales period of the year (period 12 if year calendar or period 13 if period calendar), the current year-to-date fields are rolled into the prior year fields. The current year-to-date fields are then set equal to the next period fields.
b. If it is not the last sales period of the year, the current period fields are added to the year-to-date fields.
c. For all periods, the current fields are set equal to the next sales period fields, and the next sales period fields are set to zero.
3. The logical Sales History file (OP120ML1) consists of records in which the Sales Analysis update flag is set to N (No). It read sequentially to update the Sales Analysis file (SA100M).
a. The shipment date on the sales history record is compared to the values in the Sales Period Calendar Array. The shipment date must be less than or equal to the posting period date of the sales period being updated.
b. The first time the sales history record is read, the key fields are saved. These fields are used to determine when all records for a given Sales Analysis record have been read.
(1) The corresponding Sales Analysis record is retrieved.
(a) If the Sales Analysis record is found, the following amounts are stored in accumulator arrays consisting of the sales periods for the current and previous years:
· Shipped order lines
· Cash sales amount
· Non-cash sales amount
· Cost of sales
· Return Lines
· Return Sales Amount
· Cost of Returns
· Other charges
(b) If the record is not found, the fields in the above accumulator arrays are set to zero and a new Sales Analysis record is created.
(2) The values from the sales history record are added to the appropriate accumulator fields in the arrays.
c. Each sales history record is compared against the saved key fields.
(1) If a break has not occurred, the values from the sales history record are added to the appropriate accumulator fields in the arrays.
(2) If a break has occurred, the accumulator arrays are used to update the sales analysis record. The key fields are resaved and the accumulator arrays are reset to zero.
d. After a sales history record has been processed, the Sales Analysis update flag is set to D (demand post) or F (final post), and the record is updated.
e. Records are processed from the logical Sales History file until the file control record is read.
4. If the sales period being processed is the last period of the year, further processing is performed for the Sales Analysis file. Processing continues until the file control record is read.
a. The following amounts are stored in arrays consisting of the sales periods for the current and previous years:
· Shipped order lines
· Cash sales amount
· Non-cash sales amount
· Cost of sales
· Return Lines
· Return Sales Amount
· Cost of Returns
· Other charges
b. If a record has no activity (zero quantity) in all current and previous year periods, the Sales Analysis record is deleted.
c. If a record has activity, the fields for the previous year are set to the values from the current year. The fields for the current year are set to zero.
d. The number of records deleted is accumulated and printed on the Sales Analysis File Reorganization Control Summary (SA100A).
5. If a final post was performed, the last period posted on the Reference File (category 435) is updated.