
The RESERVATION INVOICES procedure tells DataEase what information to print on each reservation invoice.
The information we want to appear on the Club ParaDEASE invoice includes the following items:
· RESERVATION ID.
· MEMBER ID.
· DATE
· MEMBER NAME.
· ADDRESS.
· DESTINATION.
· DEPARTURE information.
· FIRST and LAST NAME of each family member taking the trip.
· AGE STATUS of each family member.
· PRICE for each family member.
· DISCOUNT.
· Total Price for all family members.
· Cost of reservations.
To generate a report that can be formatted like the invoice shown on the previous page, the script includes the following lines:
define global "RESTOTAL" Number .
define global "DISCOUNT" Number .
define global "RESERVATION#" Number .
for RESERVATIONS
MEMBER ID ;
DATE ;
FIRST NAME ;
LAST NAME ;
STREET ;
CITY ;
STATE ;
ZIP ;
CLUB NAME ;
CLUB LOCATION ;
DEPARTURE DATE ;
DEPARTURE CITY ;
all RESERVATION DETAIL FIRST NAME ;
all RESERVATION DETAIL LAST NAME ;
all RESERVATION DETAIL AGE STATUS ;
all RESERVATION DETAIL RESERVATION PRICE ;
global RESTOTAL - global DISCOUNT .
In addition to listing information on the invoice, we also want this procedure to do one last important task: change the value in the CONFIRMED field from No to Yes. This is specified by adding three more lines to the script:
See DG 6 for information on how to create the layout of a report document.
Now, let's review this script line by line.
for RESERVATIONS
The for command selects the script's Primary form¾the RESERVATIONS form.
The with operator introduces the record selection criteria: process only records with the value No in the CONFIRMED field. The list records command tells DataEase what items we want to appear in the output. These items (called list items) follow the list records command. In this report there are two types of list items: (1)fields from the Primary and/or Secondary forms, and(2)values that were calculated during the processing of the previous script but do not actually appear on any database forms. Those values were passed to this procedure via global variables.
The next line tells DataEase to group RESERVATION DETAIL records with the same RESERVATION ID together and to arrange the groups in ascending order.
RESERVATION ID in groups ,
Each of the following lines specifies a field on the RESERVATIONS form. Here, we are telling DataEase to include the value in each of these fields in the report output.
MEMBER ID ;
DATE ;
FIRST NAME ;
LAST NAME ;
STREET , ;
CITY ;
STATE ;
ZIP ;
CLUB NAME ;
CLUB LOCATION ;
DEPARTURE DATE ;
DEPARTURE CITY ;
The next four lines are used to retrieve information stored in the related RESERVATION DETAIL file.
all RESERVATION DETAIL FIRST NAME ;
all RESERVATION DETAIL LAST NAME ;
all RESERVATION DETAIL AGE STATUS ;
all RESERVATION DETAIL RESERVATION PRICE ;
Each of these four lines specifies a field on the RESERVATION DETAIL form. The relational operator all tells DataEase to find every RESERVATION DETAIL record that has the same RESERVATION ID as the RESERVATIONS record currently being processed.
The next line lists one of the three global variables:
In the previous procedure, we calculated the discount amount to apply to each reservation based on the number of children and adults included in the reservation. The value DataEase calculated was assigned to a global variable called DISCOUNT. Since the amount of the discount was calculated in the previous procedure, we don't have to calculate the discount again in the current procedure. We simply use a global variable to pass the value to this procedure.
The next line lists another global variable whose value was calculated in the previous procedure:
In the last procedure we told DataEase to sum the PRICE field values in all the related RESERVATION DETAIL records for each RESERVATIONS record processed. That calculated value was then assigned to the RESTOTAL variable. This line tells DataEase to list the value in the RESTOTAL variable in the printed invoice. This information is displayed as the overall Reservation Total on the invoice.
The final line under the list records command calculates the net total for the invoice:
global RESTOTAL - global DISCOUNT .
This line tells DataEase to subtract the value in the global DISCOUNT variable from the amount stored in the global RESTOTAL variable. The result is the net total for each order, taking into account each member's discount as calculated in the previous procedure. This information is displayed as the Total Due on the invoice.
The last three lines of the script tell DataEase to modify each record:
As each RESERVATIONS record is processed, DataEase changes the value in the CONFIRMED field from No to Yes. This ensures that a reservation that has already been processed will not be processed again.
Product: DataEase for Windows 7.x. Written by George Washington 11/04/14 at 08:26:17
Product: DataEase 8 Reporter. Written by eduardo paez 02/05/14 at 14:40:11
Product: . Written by Marco Marchesi 15/02/16 at 14:50:46
Product: . Written by Grossi Gioacchino 18/11/19 at 14:33:44
Product: Dataease [{8}]FIVE. Written by Rainer 22/03/21 at 11:13:10
Product: Dataease [{8}]FIVE. Written by Rainer 08/06/21 at 14:12:40