Simplicty and flexibility!


Support::

Procedure 3: RESERVATION INVOICES


Parameters


Returns/Result


Examples


Reference

Procedure 3: RESERVATION INVOICES

Procedure 3: RESERVATION INVOICES

The RESERVATION INVOICES procedure tells DataEase what information to print on each reservation invoice.

 

image\dql4-25.gif

 

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.

 

Script for the RESERVATION INVOICES Procedure

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

 with CONFIRMED = NO ; ;

   list records

  RESERVATION ID in groups ;

  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 DISCOUNT ;

  global RESTOTAL ;

  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:

 

 modify records

  CONFIRMED := YES .

end

 

Explanation of the Script

image\Dql_0003.gif

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.

 

 with CONFIRMED = NO ;

  list records

 

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:

 

 global DISCOUNT ;

 

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:

 

 global RESTOTAL ;

 

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:

 

  modify records

   CONFIRMED := YES .

 end

 

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.

See Also


On the forum about Procedure 3: RESERVATION INVOICES

[@EOF@]...

Product: . Written by alembagheri tahmas 07/12/13 at 13:37:32

Hi there,I am trying to use an external MySQL DB in dataease. I have successfully create the ODBC link and added the DB to dataease. I can also access the DB from dataease. Now, just for testing purposes, I am trying to create a simple report b...

Product: DataEase for Windows 7.x. Written by George Washington 11/04/14 at 08:26:17

no se pude exportar ahora archivos a pdf, ni a excel o otros cosa mala. en verdad creo que hace faltaen las versiones anteriores me funcionaba mas o menos bien. le hace falta a los aplicativos que se desarrollan en Dataeasegr...

Product: DataEase 8 Reporter. Written by eduardo paez 02/05/14 at 14:40:11

Thanks. Anyway I'm trying to use this fuction but it seems to me that it doesn't work on 8.2. I tried also in a DQL.There's something wrong?<img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAA9IAAAJ3CAYAAAB4NWk3AAAAAXNSR0IArs4...

Product: . Written by Marco Marchesi 15/02/16 at 14:50:46

[@EOF@]...

Product: Dataease [{8}]FIVE. Written by Chamil Rajindra 21/02/19 at 10:17:46

Thanks for the very good explanation!AS...

Product: . Written by afonso santos 28/10/19 at 00:50:14

I am pleased to see that the migration from Dos 4.53 is then sa 5.5 works. A really useful thing would be a compiler of SQL languages. Will you get there?Original Text:Mi compiaccio a vedere che la migrazione da Dos 4.53 è poi sa 5.5 funzio...

Product: . Written by Grossi Gioacchino 18/11/19 at 14:33:44

How can i delete a Style sheet?...

Product: Dataease [{8}]FIVE. Written by Rainer 22/03/21 at 11:13:10

I run W7 and since a few days&nbsp;Dataease 8.5 is not starting any more, do you have an idea? i installed it again but that did not help....

Product: Dataease [{8}]FIVE. Written by Rainer 08/06/21 at 14:12:40

[@EOF@]...

Product: . Written by Hiralal Rampul 01/12/21 at 17:47:10

On the blog about Procedure 3: RESERVATION INVOICES


dg3_HelpView