Assume, there is an ice cream manufacturing company that has four production plants, that all make the company's seven ice cream flavors.
From these four facilities, delivery trucks pick up ice cream products for delivery to local stores for sale. There are two tables:
a table named icinv that holds the ice cream product inventory for all plants;
a table named pickup_trans that hold the trucker pickup transactions.
The table structures are shown below.
Table name: icinv | Table name: pickup_trans |
plant_id int NOT NULL, [plant id: 1, 2, 3 or 4] prod_id int NOT NULL, [ice cream product id: 1 → 7] cur_inv int NOT NULL, [current inventory in gallons for the prod_id currently in plant_id location] |
trans_id int IDENTITY (1,1), pick_up_year int, pick_up_month int, pick_up_day int, truck_id int, plant_id int, p1 int; [gallons of ice cream product 1 picked up] p2 int; [gallons of ice cream product 2 picked up] p3 int; [gallons of ice cream product 3 picked up] p4 int; [gallons of ice cream product 4 picked up] p5 int; [gallons of ice cream product 5 picked up] p6 int; [gallons of ice cream product 6 picked up] p7 int; [gallons of ice cream product 7 picked up] (PRIMARY KEY (trans_id)) |
The tables are in a database named "gl001".
For a recordset, the credential string is: rs.open some_sql_string,"DSN=gl001;UID=gl001;PWD=11111" For a connection, the credential string is: cn.open "gl001","gl001","11111" |
2. (50 points) In the program above, there would be normally be an additional step (not discussed in #1 above or required that you write).
This would involve adding the pickup transaction as a row to the table named pickup_trans (see description above) which records the cumulative transaction history of all pickups. Thus, all the details of the pickup transactions are available from this table.
Assume in a query program, the second pass receives three values from an HTML form with element names: pm (for pickup_month), py (for pickup_year) and pi (for plant_id). Assume the three values are available in pass2 as: Request.form("pm"); Request.Form("py"); and Request.Form("pi"). Write this query program's second pass to create a report that contains:
(a) Plant ID, Month and Year on the first line (i.e., the data sent in pass 1)
(b) A seven-row by two-column table, where each row contains:
(a) the ice cream product name (for values see below)
(b) the total gallons of this product picked up from the plant, in the month and year specified.
(Note: there will be many pickup transactions that contribute to the 7 totals)
Assume the following arrays are available in the second pass:
pname = Array("Chocolate","Vanilla","Strawberry","Neopolitan","Rocky Road","Peach","Mint")
ptotal = Array(0,0,0,0,0,0,0) (use this to accumulate the pickup amounts for each ice cream product)
Write only the code for the second pass. Do not write MAIN.