Combining TOTAL, GRAND-TOTAL, and BREAK-ON
The following example illustrates the use of TOTAL and GRAND-TOTAL in conjunction with BREAK-ON.
In this example:
-
The unmodified output specification (BILL-CODE BILL-AMOUNT BILL-DESC) precedes the output modifiers (BREAK-ON, TOTAL, and GRAND-TOTAL).
-
The BREAK-ON option L is used to suppress the blank line before the total at each break.
-
The text specified for the GRAND-TOTAL modifier is output on the bottom line.
-
The total for each guest is output twice: once on the first detail line and once on the break line.
-
In the GUESTS file, the item-id and the room number are the same value, so it appears twice.
:SORT GUESTS WITH BILL-TOTAL > "245.00" BY ROOM BILL-CODE BILL-AMOUNT BILL-DESC BREAK-ON ROOM "'L'" TOTAL BILL-TOTAL GRAND-TOTAL "Total:" HDR-SUPP GUESTS Bill Amount.. Description.. Room.. Bill Total Code * 411 2 $93.00 Room 411 $249.76 10 $45.00 Rest.(Bar) 2 $93.00 Room 4 $18.76 Breakfast *** $249.76 535 2 $98.00 Room 535 $281.42 13 $45.00 Bar (2) 15 $33.77 Telephone 2 $98.00 Room 5 $6.65 Lunch *** $281.42 Total: $531.18