Customer Invoice History - demoilst.bbx
The customer invoice history display is used by the Customer Inquiry application to show a listing of invoices associated with a given customer. The application uses the Scrolling Customer Listing program, and each customer listed is linked to this program through a URL containing the customer ID.
|
As with the scrolling customer listing, a "startwith" value can be supplied to begin the invoice listing at a particular point. A "more records" link, containing the "startwith" value, is specified in this program where there are more than 10 invoices to display.
|
The invoices are presented in a HTML table structure, so each line from the invoices file is formatted with table row tags. In addition, the table and column heading tags are required above and below the invoice list and are stored in TABLETOP$ and TABLEBOT$.
|
The customer record is read into CUST$, and a table is built from a list of fields in the CIST$ template. The HTML text for the table is placed in CUSTINFO$.
|
A list of invoices (up to MAXRECS at a time) is loaded into the variable INVLIST$. The list begins with the customer ID, plus the invoice number indicated in the STARTWITH$, and continues until all invoices for the customer ID have been read. If there are more than MAXRECS invoices, the CURKEY$ contains that next one in line, after the customer ID is trimmed off. This is used to construct the global string $MOREURL, which is referenced in the HTML text file "demoilst.txt" to allow the user to continue the list. Note the use of the "startwith" value in the URL.
The CGI environment variable SCRIPT_NAME contains the name of the cgi script that launched this program. Because the same script is used for all the sample programs, it provides a convenient way of building another URL.
|
Both the customer information and the invoice list are substituted into the demoilst.txt file, using specific comments as place markers, with the result sent to the user, and the program exits.
|