Back to DFS's Workshop Page
Back to Agenda Page
Chinese Restaurant Cash Register
For this problem, you are to cannibalize any available code and write a pair of PHP scripts which will do the following. Click here to see how the scripts would work.
- The Recursively Called PHP Script: cash.php
- Use this tab-separated flat-file database for information about the items on the menu. See Files III to learn how to read in the data and use literal subscripts for the array.
- Use two nested tables:
- On the left, create a touchscreen simulator for specifying each order.
- Make a 3xN table.
- In each cell, print the item number and description together and the price underneath.
- The text in each cell should serve as a recursive link this script, incrementing the count of orders for the item in the cell. Pass the values for how many of each item have been ordered as parameters of the link.
- If the number of orders for an item is non-zero, print the number in red at the top of the cell.
- On the right, create a running receipt with a total and a form for inputting the amount paid and calling the second script to determine the change and print a receipt.
- The running receipt should consist of five columns: an opportunity to remove an item, the item number, the item, how many at what price, calculated total for each item.
- Print the running total.
- Provide a form to allow the cashier to input the amount paid. Use the hidden type input to pass the values for how many of each item have been ordered.
- Below the tables, include a link to cancel the order.
- The Receipt PHP Script: receipt.php
- The script will receive an array of how many of each item has been ordered and the amount paid.
- Use two nested tables:
- Print a four-column list of the item number, the item, how many at what price, calculated total for each item.
- Print the total due.
- Print the amount paid.
- Print the amount of change and a thank you; or
- Print the amount still owing.
- Print a date and time stamp.
- Provide a link to cash.php to handle the next customer.
To see how this could work, view this possible solution.
© 2007 DFStermole
Created 3 Jan 07
Last Modified 11 Jan 07