Documentation >
MAC-PAC Technical Library >
Distribution >
Sales Analysis >
Programs >
Month-End Sales Analysis by Product Class - Purpose >
Month-End Sales Analysis by Product Class - Calculations
Month-End Sales Analysis by Product Class - Calculations
SA530E
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. A parameter list is set up for the requested output queue.
3. The following records are retrieved from the Reference file (REFERP):
a. The last sales period posted record (category 435) is retrieved and moved to the current period. If the record is not found the program ends abnormally.
b. The last year sales calendar record (category 408) is retrieved. If the record is not found, no prior year information was stored.
c. The current sales period calendar record (category 407) is retrieved. If the record is not found, the program ends abnormally.
d. The system defaults record (category 133) is retrieved and the multiple currency flag is saved. If the record is not found, the program ends abnormally.
e. The entity name record (category 002) is retrieved. In a multi-currency environment, the base currency and currency description are saved. If the record is not found, a default message is used for company name.
f. The date format record (category 049) is retrieved. If the record is not found, a message is sent to the system operator, the date format defaults to MMDDYY, and processing continues.
g. The following categories are retrieved and stored in arrays for access during processing:
· Last sales period posted (category 435)
· Current sales period calendar (category 407)
· Product class code and description (category 426)
· Product subclass code and description (category 427)
4. The Report Request file is read for month-end history requests. (Those with key=R67), and the request is validated by checking that low values are less than or equal to high values for company/location, product class, product subclass.
B. Mainline
1. The Sales History File lower limits are set using the low range company, location, product class, and product subclass.
2. The Sales History file is read and checked for the control record.
3. The company/location numbers, customer number, part number, product class code, and subclass codes are saved. The company name and location name are retrieved from the Reference file. The product class and subclass descriptions are retrieved from arrays. These arrays are loaded from the Reference file in housekeeping.
4. The record processed flag is set to No, and requests are processed until the end flag is set to Yes.
a. Out-of-range conditions are checked. If the sales history record is out-of-range and records have been processed, end of request processing is performed. If it is out-of-range and no records have been processed, an error routine is performed.
· If company/location is not equal to the saved company/location; customer totals, part totals, product subclass totals, and company/location, totals are processed. Line counters are reset and the current company/location, product class, product subclass, part, and customer are saved. The company name, location name, product class, and subclass are retrieved and saved.
· If company/location equals the saved value, but product class is not equal to the saved product class; customer totals, part totals, product subclass totals, product class totals are processed. Line counters are reset, and the current product class, subclass, part, and customer are saved. The product class and subclass descriptions are retrieved and saved.
· If company/location equals the saved value and product class equals its saved value, subclass values are compared.
· If subclass is not equal to saved subclass customer totals, part totals, and product subclass totals are processed. The subclass description is retrieved and saved.
· If subclass is equal to saved subclass, part values are compared.
· If part number is not equal to the saved part number, customer and part totals are processed and part and customer are saved.
· If the part number is equal to its saved value, customer numbers are compared.
· If the customer number is not equal to the saved customer number, customer totals are processed and the customer is saved.
· If customer number is equal to the saved customer number, processing continues.
b. The detail line is printed if the request type specified by the user in the request file is 1 (detail) or 3 (both). A page break is performed and headings for the detail report are printed. Gross margin and gross margin percent are calculated, and the detail line is printed.
The next record is read. If the control record is read (all nines), end of report processing is performed.
5. The Sales Analysis Report Request Record is deleted from the Sales Analysis Report Request file.
6. The Sales Analysis Report Request file is read for the next request. If it is at end of file, end of report processing is performed. If a record is found, it is validated and mainline repeats from step 2.
Gross Margin = (Sales Amount + Other Charges) - Cost of Goods Sold
Gross Margin Percent =
These calculations are performed for customer, part, product subclass, product class, company/location, and grand totals.