Introduction
Aromamora PLC is a company which sells essential oils to Aromatherapists, Health Shops, Chemists and other mass users of essential oils. Every month, details of sales to these customers are gathered together into a Sales File (SALES.dat). A program is required which will produce a report from this file showing the quantities and values of essential oils purchased. Although Aromamora sells both base and essential oils, the report should only show sales of essential oils. The report should be printed sequenced on Oil-Name within Customer-Name.
Files
The Sales File
The Sales File contains details of sales to all Aromamora customers. It has been validated and has been sorted in ascending order on Customer-Id. The records in the Sales File have the following description:
| FieldName | Type | Length | Value |
|---|---|---|---|
| Customer-Id | 9 | 5 | 0-99999 |
| Oil-Id | X | 3 | B01-B10 or E01-E30 |
| Unit-Size | 9 | 1 | 1-3 |
| Qty-Sold | 9 | 3 | 1-999 |
The Customer Details File
The Sales File does not contain any information about the customer other than the Customer-Id. The Customer-Name must be retrieved from the Customer Details File (CDF.dat). This file is a sequential file ordered on ascending Customer-Id. The records in the Customer Details File have the following description:
| Field | Type | Length | Value |
|---|---|---|---|
| Customer-Id | 9 | 5 | 0-99999 |
| Customer-Name | X | 25 | - |
| Customer-Address | X | 30 | - |
The Oil Details File
The Oil-Name and the per millilitre cost of the oil are held in the Oil Details File (ODF.dat). Before this information can be used it must be read into a table. Since the report is only concerned with essential oils the table need only have enough elements for the 30 essential oils. Records of the Oil Details File have the following description;
| Field | Type | Length | Value |
|---|---|---|---|
| Oil-Id | X | 3 | B01-B10 or E01-E30 |
| Oil-Name | X | 20 | - |
| Cost-Per-Ml | 9 | 4 | 0.01-99.99 |
Unit Sizes
The oils are supplied in three different sized units. The quantity of oil supplied for a given size depends on the type of the oil. Essential oils (identified by an E in the Oil-Id) are supplied in 2, 5 and 9 millilitre volumes. Base oils (identified by a B in the Oil-Id) are supplied in 30, 50 and 100 millilitre quantities.
The Sales Report
Numeric values must be printed using comma insertion and zero suppression or the floating currency symbol. Change page after line 49 unless the Customer-Totals or the Final Totals are the next thing to be printed. The Customer-Name should be suppressed after its first occurrence unless a customer's entries span more than one page, when the Customer-Name should again appear on the new page.
| Line 1 | Page Heading. To be printed at the top of each page. The programmer field should contain the name of the person who wrote the report program. |
| Line 3-5 | Report Heading. To be printed on the first page of the report only. |
| Line 8 | SalesHeading. To be printed on line 8 for the first page and on lines 3 on each succeeding page. |
| Line 9 | Detail line showing the Customer-Name.. Qty-Sold is the sum of the quantities of this oil (in millilitres) sold to this customer (a particular customer may have ordered this oil several times). Sales-Value is the value of the oils sold (Qty-Sold * Cost-Per-Ml). |
| Line 10 | Detail line with the Customer-Name suppressed. |
| Line 14-16 | Totals for the Customer. This is the sum of the Oil Totals. Preceded by one blank line. |
| Line 53-55 | Overall totals. This is the sum of the Customer-Totals. To be printed at the end of the report. Preceded by 2 blank lines. |
