Home

Grocery Delivery Database - eGroceries

image

Contents

1. Increase customer balance UPDATE Customers SET Balance balance SbasePrice salesTax SdeliveryCost Create order record Run query INSERT INTO ORDERS BasketID PaymentID DeliveryDate DeliveryTimeRange DriverID BasePrice SalesTax DeliveryCharge VALUES SbasketID SpaymentID deliveryDate SdeliveryTimeRange SdriverID basePrice salesTax SdeliveryCost Fulfill Order If OrderID not valid exit with error Run query INSERT INTO TRANSACTIONS OrderID VALUES SorderID Create tickets and bill dispatch driver Update transaction record with times comments upon delivery Receive Payment If orderID is not valid exit with error Find associated Stransaction SELECT TransactionID FROM Transactions WHERE orderID SorderID If no valid Stransaction exit with error Get current Sbalance SELECT Balance FROM Customers WHERE CustomerID ScustomerID Update transaction record UPDATE Transactions SET AmountPaid SamountPaid DateTimePaid currentDateTime Decrease customer balance UPDATE Customers SET Balance balance SamountPaid 37 Page Generate Average Basket Value Report Begin with empty array Sbaskets Run guery SELECT BasketID FROM Bas
2. 54 Page if mysql num rows orderInfoListResult echo lt tr gt lt td colspan 7 align center gt lt i gt No Proce ssed Orders Found lt is lt td gt lt tr gt while SorderInfoListRow mysql fetch assoc orderInfo ListResult SuserinfoResult mysql query SELECT FROM CUSTOME RS WHERE CustomerID SorderInfoListRow CustomerID SuserinfoRow mysql fetch assoc userinfoResult StransactionInfoQuery SELECT FROM TRANSACTIONS WHERE OrderiD SorderlnfoListBow OrderlrDp transactionInfoResults mysql query transactionIn foQuery transactionInfo mysql fetch assoc transactionInf oResults SpaymentTypeDetailsResult mysql query SELECT FR OM PAYMENT TYPES WHERE CustomerID orderInfoListRow CustomerID AND PaymentID S orderInfoListRow PaymentID SpaymentTypeDetailsRow mysql fetch assoc paymentT ypeDetailsResult if Sit Scolor style background color F3F3F3 else unset Scolor echo lt tr Scolor gt td align center gt SorderInfoListRow OrderID J T4 pgs td SuserinfoRow LastName SuserinfoRow FirstName ID SorderInfoListRow CustomerID lt td gt td date m d Y g i ai strtotime transaction Info DateTimeArrived c td td toMoney orderInfoL
3. SusernameResult mysql query SELECT FROM CUSTOMERS W HERE Username mysql real escape string POST Username if mysql num rows usernameResult SpasswordResult mysql query SELECT FROM CUSTOMERS WHERE Username mysql real escape string POST Username A ND Password md5 mysql real escape string POST Password ar if mysql num rows passwordResult SuserInfo mysql fetch assoc passwordResult SESSION userinfo SuserInfo echo lt p class success style width 455px gt lt str ong gt Success lt strong gt Please wait to be redirected lt p gt lt meta http equiv REFRESH content 0 url account php gt Svalid true else echo lt p class error style width 455px gt lt strong gt Error lt strong gt Invalid password lt br gt Please try again or lt a href re gister php gt register lt a gt now lt p gt else echo lt p class error style width 455px gt lt strong gt Er ror strong Invalid username lt br gt Please try again or a href regi ster php gt register lt a gt now lt p gt else echo lt p class error style width 455px gt lt strong gt Erro r strong Username and Password are required br Please try again or lt a href register php gt register lt a gt now lt p gt if valid YA lt p gt 96 Page lt f
4. msResult SbasketItems explode basketItemsRow Pr oductArray foreach basketItems as basketlItemID SupdateProductStockResult mysql query UPD ATE PRODUCTS SET Stock Stock 1 WHERE ProductID SbasketItemID echo lt p class success gt lt strong gt Success lt str ong gt Your order has been placed Please wait to be redirected lt p gt lt m eta http equiv REFRESH content 0 url pastorders php orderID newOrderID f else SbasketItemsResult mysql_query SELECT FROM BASKET S WHERE CustomerID SESSION userinfo CustomerID AND Act ive 1 if mysql num rows basketItemsResult SbasketItemsRow mysql fetch assoc basketItemsResu It SbasketItems explode SbasketItemsRow ProductA rr y futureStockAdj array SoutOfStock array foreach basketltems as key gt thisProductID productInfoResult mysql query SELECT FROM PR ODUCTS WHERE ProductrD SthisProductID productInfoRow mysql fetch assoc productInfoRe sult if futureStockAdj thisProductID SfutureStockAdj SthisProductID futureStock SproductInfoRow Stock 1 else S futureStockAdj SthisProductID SfutureStockAdj thisProductID 1 if S futureStock lt 0 SoutOfStock thisProductID SfutureStockAdj SthisProductI
5. sProguctID 1 unset basketItems key if count S outoOfStock 4 echo lt br gt out of stock SupdateBasketItemsResult mysql query UPDATE BASKETS SET Pro ductArray trim implode SbasketItems WHERE CustomerID U SoustlID AND Active TIT Ssubtotal 0 taxableSubtotal 0 if count basketltems foreach SbasketItems as SproductID SproductsResult mysql_query SELECT FROM PRODUCTS WHER E ProductrD SoroductID ys productRow mysql fetch assoc productsResult if productRow Stock gt 0 if SproductRow SaleStatus Ssubtotal Ssubtotal S productRow SalePrice if SproductRow Taxable StaxableSubtotal taxableSubtotal Sproduct Row SalePrice else Ssubtotal Ssubtotal productRow Price if productRow Taxable StaxableSubtotal taxableSubtotal Sproduct Bew Price l 124 Page deco r 44 else echo lt td width 60 ration line through color StaxSubtotal SaddPaymentQuery PaymentType PaymentInfo 44333322221111 SaddPaymentResult SpaymentTypeDetailsResult VALUES ES W HERE CustomerID SeustiDb TE E ment De te tota der AS T et new Ticket and Bill Numbers br MySQ u gt lt VH Dt Spayment
6. tr tr height 30 gt td style font weight bold gt Transaction History lt td gt lt td gt lt input type button name TransactionHistory v alue View Transaction History onClick window location transactionh istory php gt lt td gt lt tr gt lt tr gt td colspan 2 align center gt nbsp lt td gt lt tr gt lt tr height 30 gt lt td colspan 2 align center gt lt input type submit name update value Update Information gt lt td gt lt tr gt lt table gt lt form gt lt p gt lt 7 php 25 div div id footer gt lt php include kunden homepages 25 d123903211 htdocs egroceri es includes footer inc php div div body html Customer Account Status account status php lt include kunden homepages 25 d123903211 htdocs egroceries includes global inc php 7 49 Page lt DOCTYPE html PUBLIC W3C DTD XHTML 1 0 Transitional EN http www w3 org TR xhtmll DT D xhtmll transitional dtd gt lt html xmlns http www w3 org 1999 xhtml lt head gt lt meta http equiv Content Type content text html charset utf 8 gt lt title gt eGroceries lt title gt lt link rel stylesheet href styles main css type text css gt lt head gt lt body gt lt div id frame gt lt div id header gt lt php include kunden homepages 25 d123903211 htdocs eg roceries includes head
7. SusernameResult mysql_query SELECT FROM CUSTOMERS WHERE Username POST Username if mysql num rows usernameResult Svalid false SuserNameExists true if POST Password valid false missing Passwo md 88 Page if valid SinsertQuery INSERT INTO CUSTOMERS FirstName LastName AddressStreet AddressCity AddressZip AddressState Gender Email U sername Password VALUES mysql real escape string POST FirstNa me mysql real escape string POST LastName mysql real escape string POST AddressStreet mysql real escape __ string POST AddressCity mysql real escape string POSTI AddressZip mysqgl real escape string POST AddressState mysql real escape string POST Gender mysql real es cape string POST Email mysql real escape string POST U sername md5 POST Password SinsertResult mysql query insertQuery if mysql error echo lt p class error style width 455px gt lt strong gt Error lt strong gt MySQL Error lt u gt mysql error u p else echo lt p class success style width 455px gt lt strong gt Succ ess lt strong gt Your information has been added and account created Re directing you to the sign in page lt p gt lt meta http equiv REFRESH content 0 url signin php else if count
8. TRANSACTIONS CREATE TABLE TRANSACTIONS TransactionID int 11 NOT NULL auto increment OrderID int 11 NOT NULL StandingOrderID int 11 default NULL TicketNum int 11 NOT NULL BillNum int 11 NOT NULL DateTimeOrdered datetime default NULL DateTimeDispatched datetime default NULL DateTimeArrived datetime default NULL DateTimeReturned datetime default NULL DateTimePaid datetime default NULL AmountPaid varchar 7 default NULL Comments varchar 500 default NULL PRIMARY KEY TransactionID 14 UNIQUE KEY OrderID OrderID UNIQUE KEY TicketNum TicketNum UNIQUE KEY BillNum BillNum KEY StandingOrderID StandingOrderID CONSTRAINT TRANSACTIONS ibfk 1 FOREIGN KEY OrderID REFERENCES ORDERS OrderID CONSTRAINT TRANSACTIONS ibfk 2 FOREIGN KEY StandingOrderID REFERENCES STANDING ORDERS StandingOrderID ENGINE InnoDB BACKGROUND PROCESSES CREATE TABLE BACKGROUND PROCESSES ProcessID int 11 NOT NULL auto increment TaskID varchar 10 NOT NULL Days varchar 13 NOT NULL default 0 0 0 0 0 0 0 Times varchar 500 NOT NULL Frequency int 11 NOT NULL LastRan datetime default NULL PRIMARY KEY ProcessID ENGINE InnoDB 12 OrderlD i
9. BPT BPINFO Background Background Process Process Information Task 14 Page TASK NUMBER TASK NAME PERFORMER PURPOSE ENABLING COND DESCRIPTION FREOUENCY DURATION IMPORTANCE MAKIMUM DELAY INPUT OUTPUT DOCUMENT USE OPS PERFORMED SUBTASKS ERROR COND ABT Add to Basket Customer Adds a product to a customer s basket creating basket if necessary Customer exist in Customer Information CINFO Products exist in Product Information PINFO Adds a product selected by the Customer into his her basket Frequently Short High 10 seconds Add to Basket Request ABR Product Information PINFO Basket Information BINFO APBF Add Product to Basket Form Generate and execute insert query to add product to customer basket None If customer or product does not exist return error PINFO Product Information as ABR SPR Add to Basket Addto Suggest Product Request Basket Report BINFO Basket Information 15 Page TASK NUMBER TASK NAME PERFORMER PURPOSE ENABLING COND DESCRIPTION FREOUENCY DURATION IMPORTANCE MAKIMUM DELAY INPUT OUTPUT DOCUMENT USE OPS PERFORMED SUBTASKS ERROR COND SOT Standing Order Customer Starts or stops a Standing Order Order exists in Order Information OINFO Allows a customer to designate or deactivate a standing order that occurs on se
10. GET pID SpaymentTypesRow PaymentID se lected selected gt SpaymentTypesRow PaymentType substr SpaymentTypesRow PaymentInfo 4 option else echo lt option value SpaymentTypesRo w PaymentID GET pID SpaymentTypesRow PaymentID se lected selected gt SpaymentTypesRow PaymentType toMone y SpaymentTypesRow PaymentInfo true lt option gt echo lt select gt lt td gt lt eo echo lt table gt echo lt div style text align center margin 10px gt lt input type submit name checkout valu e Conftirm Checkout gt lt dave gt echo lt form gt else echo lt div class error gt lt strong gt Error lt strong gt N o items exist in your basket lt div gt else echo lt div class error gt lt strong gt Error lt strong gt No items exist in your basket lt div gt div lt div id footer gt lt php include kunden homepages 25 d123903211 htdocs egroceri es includes footer inc php gt lt div gt lt div gt 77 Page lt body gt lt html gt Main Index Page index php lt include kunden homepages 25 d123903211 htdocs egroceries includes global inc php 25 lt DOCTYPE html PUBLIC W3C DTD XHTML 1 0 Transitional EN http www w3 org TR xhtmll DT D xhtmll transitional dtd gt lt html xmlns http www w3 org 199
11. average 0 for Ss Ll lt 77 Ski ShourSumQuery SELECT SUM BasePrice COUNT OrderID AS Average FROM SELECT DISTINCT O OrderID O BasePrice O SalesTax O D eliveryCharge FROM ORDERS O TRANSACTIONS T WHERE O OrderID T OrderI D AND T DateTimeOrdered BETWEEN date Y m d H i s mktime Si D 0 date n date 3j j3 AND date Y m d Hesgass mkEdime S21T1 O0 0 date n datet 7 AS RES ShourSumResult mysql query hourSumQuery ShourSum mysql fetch assoc hourSumResult Saverage ShourSum Average Saverage 7 echo lt set value average str replace toMoney av erage false 0 ZS lt dataset gt lt graph gt e 109 Page 2 6 2 Secondary Helper Page Code Database Connection Include File database inc php php link mysql connect db2675 perfora net dbo348384459 3f le lank i die Could not connect mysql errotr mysql select db db348384459 link 22 Page Footer Include File footer inc php This site created by Stephen Eskin and Jeff Lasser Most of the conten t of this site was lt span style text decoration line through gt stolen lt span gt borrowed from a href http shop safeway com superstore style color 666 text decoration none target new Safeway Grocery Delivery lt a gt and
12. else echo lt p class error gt lt strong gt Error lt strong gt Invalid r eport Please wait to be redirected p meta http equiv REFRESH content 0 url admin php page reports else echo lt p class error gt lt strong gt Error lt strong gt Invalid adm in page Please wait to be redirected p meta http equiv REFRESH content 0 url admin php a 64 Page lt div gt lt div id footer gt lt php include kunden homepages 25 d123903211 htdocs eg roceries includes footer inc php gt lt div gt lt div gt lt body gt lt html gt Basket Management basket php lt include kunden homepages 25 d123903211 htdocs egroceries includes global ino php gt lt DOCTYPE html PUBLIC W3C DTD XHTML 1 0 Transitional EN http www w3 org TR xhtmll DT D xhtmll transitional dtd lt html xmlns http www w3 org 1999 xhtml lt head gt lt meta http equiv Content Type content text html charset utf 8 gt lt title gt eGroceries lt title gt lt link rel stylesheet href styles main css type text css gt lt head gt lt body gt lt div id frame gt lt div id header gt lt php include kunden homepages 25 d123903211 htdocs egroceri es includes header inc php gt lt div gt lt div id nav gt lt php include kunden homepages 25 d123903211 htdocs egroceri e
13. php include kunden homepages 25 d123903211 htdocs egroceries includes global e php if GET report ABVR gt lt graph numdivlines 6 lineThickness 2 showValues 0 numVDivLin es 10 formatNumberScale 1 rotateNames 1 decimalPrecision 2 anc horRadius 2 anchorBgAlpha 0 numberPrefix divLineAlpha 30 sho wAlternateHGridColor 1 yAxisMinValue 0 shadowAlpha 50 gt categories gt category Name 12 lam category Name 1 2am category Name 2 3am category Name 3 4am category Name 4 5am category Name 5 6am category Name 6 7am category Name 7 8am category Name 8 9am category Name 9 10am category Name 10 11am category Name 11 12pm category Name 12 1pm category Name 1 2pm category Name 2 3pm category Name 3 4pm category Name 4 5pm category Name 5 6pm category Name 6 7pm category Name 7 8pm category Name 8 9pm category Name 9 10pm category Name 10 11pm category Name 11 12am gt categories dataset seriesName Today color FF8B00 anchorBorderColor FF8B 00 anchorRadius 4 gt lt for Si OF Si lt 247 She f ShourSumQuery SELECT SUM BasePrice COUNT OrderID AS A verage FROM SELECT DISTINCT O OrderID O BasePrice O SalesTax O Del iveryCharge FROM ORDERS O TRANSACTIONS T WHERE O OrderID T Orde
14. r errnto Bassketrp w g ys SpaymentTypeDetailsResult mysql query SELECT FROM P AYMENT TYPES WHERE CustomerID orderInfo CustomerID AND Pay mentID orderInfo PaymentID paymentTypeDetailsRow mysql fetch assoc paymentTypeD etailsResult echo div style font weight bold margin bottoms 10px font size l6px Order GET orderID Information lt div gt echo lt table cellpadding 1 cellspacing 2 style text align Left margin Left 75px width 600px gt echo tr th Item Description lt th gt lt tr gt if mysql num rows basketItemsResult SbasketItemsRow mysql fetch assoc basketltemsResult SbasketItems explode SbasketItemsRow ProductArr 99 Page ay 3 0G foreach S basketItems as SproductID SproductsResult mysql_query SELECT FROM PRODUCT S WHERE ProductiD S productliD while productRow mysql fetch assoc productsResu Ley i if Si 2 Scolor background color F3F3F3 else unset color echo lt tr gt lt td style Scolor gt SproductRow Descri pen ls Sit if basketItemsRow ProductArray trim implode sbpasketIltems U r echo lt tr gt lt td colspan 2 style text align center font style italic Eomnt Size llpx gt No items exist in your basket lt td gt lt tr gt lt table gt else StaxSubtotal 0 06 taxableSubto
15. toMoney Ssubtotal StaxSubtotal deliveryCost false SinsertTransactionInfoResult mysql query insertTransact ionInfoQuery if mysql error ot create transaction information br MySQI lt ir ps echo lt p class error gt lt strong gt Error lt strong gt Could n Error lt u gt mysql errori SundoInsertOrderQuery DELETE FROM ORDERS WHERE Orde rID newOrderID SundoInsertOrderResult mysql query undoInsertOrderQ uery else Update Account Balance If ScDstID 15 d SupdateAccountBalanceQuery UPDATE CUSTOMERS SET Balance toMoney 0 Ssubtotal taxSubtotal deliveryCost false BalanceDate date WHERE CustomerID custID SupdateAccountBalanceResult mysql query updateA ccountBalanceQuery 0 LastModified oQuery Update Basket Info Supda ws Supda teBasketInfoQuery UPDATE BASKETS SET Active time WHERE CustomerID ScustID teBasketInfoResult mysql query S updateBasketInf Update Product Stock Sbask S WHERE CustomerID SbasketItemsRow mysql fetch assoc basketItemsResult ay TS SET Stock Sbask tItemsResult mysql query SELECT FROM BASKET custID AND BasketID SbaskID tItems explode b
16. 5 for lt 3 mile radius 7 for gt 3 and lt 5 mile radius 10 for gt 5 miles Next you are prompted to select a delivery date and time range 9am 1pm 1pm 5pm 5pm 9pm ranging from todays date and up to 1 hour before the later end of the time range if available to up to one week in the future At this point a complicated script is run to calculate the estimated time of arrival of your order This script first queries the database for all pending orders for your route on your chosen date and during your chosen time range and plots all of their points along with the warehouse and your address on an instance of Google Maps Atthis time an open sourced script by Geir K Engdahl runs to solve the Traveling Salesman Problem of finding the faster route from the warehouse to each customer and then back again Using the results of the estimated time required to complete the route as a maximum bound the time plus the beginning time of the selected time range is used to calculate the estimated time of arrival for simplicity Finally a payment method is required to be chosen to pay for the order If no payment methods exist for the customer an error will be displayed and they will be asked to add a payment method before continuing If a checking account is selected as a payment method whose balance is less than that of the grand total of an order will result in an error message after submitting an order To complete the c
17. lt div id frame gt lt div id header gt lt php include kunden homepages 25 d123903211 htdocs egroceri 97 Page es includes header inc php gt lt div gt lt div id nav lt php include kunden homepages 25 d123903211 htdocs egroceri es includes nav inc php gt lt div gt lt div id content gt lt hl gt My eGroceries Account Standing Orders lt hl gt php if SESSION userinfo echo lt p class error gt lt strong gt Error lt strong gt You are not logged in Please wait to be redirected p meta http equiv REFRESH content 0 url signin php gt else if GET orderID SorderInfoResult mysql_query SELECT FROM ORDERS WHERE OrderID GET orderID SorderInfo mysql fetch assoc S orderInfoResult if mysql num rows S orderInfoResult echo lt p class error gt lt strong gt Error lt strong gt Invalid O rder ID Please wait to be redirected lt p gt lt meta http equiv REFRESH content 0 url account php else if POST modifyOrder if POST StartDate amp amp POST EndDate amp amp POST FrequencyNum amp amp POST FrequencyUnit frequency POST FrequencyNum if POST FrequencyUnit Weeks Sfrequency 7 else if POST FrequencyUnit Months Sfrequency 30 if POST existingSta
18. lt title gt eGroceries lt title gt lt link rel stylesheet href styles main css type text css gt lt head gt lt body onload init onunload GUnload gt lt div id frame gt lt div id header gt lt php include kunden homepages 25 d123903211 htdocs egroceri es includes header inc php gt lt div gt lt div id nav gt lt php include kunden homepages 25 d123903211 htdocs egroceri es includes nav inc php 2 gt lt div gt lt div id content gt lt hl gt Checkout lt h1 gt php if SESSION userinfo echo lt p class error gt lt strong gt Error lt strong gt You are not logged in Please wait to be redirected p meta http equiv REFRESH content 0 url signin php gt elseif SESSION userinfo Active N echo lt p class error style margin top 150px strong Error strong Your account has been labeled In active and is not able to order any food at this time lt br gt Please cont act an administrator to rectify your situation and then visit your a href account status php gt Account Status lt a gt page to Reactivate your account ps p else paymentTypesResult mysql query SELECT FROM PAYMENT T YPES WHERE CustomerID SESSION userinfo CustomerID if mysql num rows paymentTypesResult 0 echo lt p class error gt lt strong gt
19. 24 hour clock do Generate gaussian variable using Box Muller u 2 0 mt rand mt getrandmax 1 0 v 2 0 mt rand mt getrandmax 1 0 s u ut v v while s 1 gauss u sqrt 2 0 log s s if mt rand 0 1 1 ScurPeak peakl else ScurPeak Speak2 Sgauss Sgauss Sstdev ScurPeak Transform to correct peak an d standard deviation while gauss lt 0 gausst hoursOnClock Wrap around hours to keep the random time SrandTime fmod gauss hoursOnClock Shour intval S randTime Smin intval randTime Shour 60 0 Ssec intval randTime Shour min 60 0 60 0 60 0 do SdaysOffset mt rand 0 8 date 2010 12 str pad 11 daysOffset 2 0 STR_PAD LEFT time date str pad hour 2 0 STR_PAD LEFT str_ pad Smin 2 O STR PAD LEET Gtr pad 9sec 2 Q STR PAD LEFT echo time time while date 2010 12 11 amp amp hour gt 13 echo order time S time createBasket mysql query INSERT INTO BASKETS CustomerID Prod uctArray LastModified Active VALUES custID Stime Is pU bidQuery mysql query SELECT BasketID FROM BASKETS WHERE Custom erzID oustID SbaskID mysql result SbidQuery 0 echo basket id SbaskID numProducts mt rand 1 maxProducts echo lt br gt numProducts pro
20. CONSTRAINT ORDERS ibfk 1 FOREIGN KEY CustomerID REFERENCES CUSTOMERS CustomerID CONSTRAINT ORDERS ibfk 2 FOREIGN KEY BasketID REFERENCES BASKETS BasketID CONSTRAINT ORDERS ibfk 3 FOREIGN KEY DriverID REFERENCES DELIVERY PEOPLE DriverID ENGINE InnoDB 7 RoutelD is a foreign key to the DELIVERY ROUTES table used in the DELIVERY PERSON ASSIGNED A ROUTE relation CustomerID is a foreign key to the CUSTOMERS table used in the CUSTOMER PLACES A ORDER relation BasketlD is a foreign key to the BASKETS table used in the ORDERS CONTAIN BASKETS relation e PaymentiD is a foreign key to the PAYMENT TYPES table used in the ORDERS PAID BY PAYMENT TYPE relation 11 DriverlD is a foreign key to the DELIVERY PEOPLE table used in the ORDERS DELIVERED BY DELIVERY PEOPLE relation 32 Page STANDING ORDERS CREATE TABLE STANDING ORDERS StandingOrderID int 11 NOT NULL auto increment OrderID int 11 NOT NULL 17 Frequency int 11 NOT NULL StartDate date NOT NULL EndDate date NOT NULL Active int 1 NOT NULL default 1 PRIMARY KEY StandingOrderID UNIQUE KEY OrderID OrderID CONSTRAINT STANDING ORDERS ibfk 1 FOREIGN KEY OrderID REFERENCES ORDERS OrderID ENGINE InnoDB
21. Les solid 000 gt lt tr gt lt th gt Customer Comments lt th gt lt tr gt lt tr height 200 gt lt td gt amp nbsp lt td gt lt tr gt lt table gt lt body gt lt html gt EOF Sfp fopen tickets SticketNum html w fwrite Sfp html fclose fp Update the DB to set a new set of random products on sale function runPlaceProductOnSaleTask numProductsChanged 0 customersToEmail array Remove all previous sales mysql query UPDATE PRODUCTS SET SaleStatus NULL SalePrice NU LL products array sales array Select items with a price 3 productsResult mysql query SELECT ProductID cat subcat Pric e FROM PRODUCTS WHERE Price 3 while productRow mysql fetch assoc productsResult products productRow cat productRow subcat arra y productRow ProductID productRow Price foreach products as cat subcat gt subcatProducts 1 SnumSubcatProducts count subcatProducts SnumToSale ceil numSubcatProducts 1 Select 10 of as ubcat s products to put on sale for i 0 i lt SnumToSale Sitt randomID rand 0 numSubcatProducts 1 Pick a random product in this subcat SrandomSaleAmount rand 5 15 0 01 Pick a random sale a mount from 5 15 off SupdateQuery UPDATE PRODUCTS SET SaleStatus 1 SalePrice toMoney products cat subcat randomI
22. addslashes manufact u rermatches l 7 trim bthisproduct 6 SshelfID Q t wa S8 helti yn echo n nDone Customer Basket and Order Transaction Population Script php include kunden homepages 25 d123903211 htdocs egroceries includes fu netrons sne php link mysql connect db2675 perfora net dbo348384459 w x if link die Could not connecti T mysql error 0 else echo Connected to db lt br gt mysql select db db348384459 link SnumBaskets 1000 SmaxProducts 20 for i 0 i lt numBaskets i SstreetNum 7300 Si 122 Page sqlInsert INSERT INTO CUSTOMERS FirstName LastName Addresss treet AddressCity AddressState AddressZip Gender Email Username Password VALUES Cust 51 Cust 51 SstreetNum Baltimo re Ave College Park MD 20740 Male noemail fake domain e user pi1 md5 password z echo Customer created SinsertResult mysql query sqlInsert getCust mysql query SELECT FROM CUSTOMERS WHERE Username user S228 Ts 3 echo lt br gt custID mysql_result getCust 0 echo Customer id echo custID lt br gt modified from http stackoverflow com questions 152115 gaussia n distributions with php on a 24h time period Speakl 12 Speak2 18 Sstdev 2 0 Standard deviation of two hours ShoursOnClock 24
23. insertTransactionInfoResult mysql query inse rtTransactionInfoQuery if mysql etror 1 echo lt p class error gt lt strong gt Error lt strong gt Could not create transaction information lt br gt MySQL Error lt u gt mysql Grtor ux ps s SundoInsertOrderQuery DELETE FROM ORDERS WH ERE OrderID newOrderID SundoInsertOrderResult mysql query undoInse rtOrderQuery else Update Account Balance SupdateAccountBalanceQuery UPDATE CUSTOMERS SET Balance toMoney SESSION userinfo Balance POST subtotal POST taxSubtotal t POST deliveryCost false BalanceDate CURDATE WHERE CustomerID SESSION userinfo CustomerID 71 Page SupdateAccountBalanceResult mysql query upd ateAccountBalanceQuery Update Basket Info SupdateBasketInfoQuery UPDATE BASKETS SET A ctive 0 LastModified NOW WHERE CustomerID SESSION useri nfo CustomerID AND BasketID POST BasketID SupdateBasketInfoResult mysql query updateB asketInfoQuery Update Product Stock SbasketItemsResult mysql query SELECT FRO M BASKETS WHERE CustomerID SESSION userinfo CustomerID AND BasketID POST BasketID SbasketItemsRow mysql fetch assoc basketlte
24. lt option value 4 SfreqNum 4 se lected selected gt 4 lt option gt lt option value 5 SfreqNum 5 se lected selected 55 option lt option value 6 fregNum 6 se lected selected 6 option lt option value 7 S freqNum 7 se 102 Page lected selected 7 option select lt select name FrequencyUnit gt lt option value gt lt option gt lt option value Days freqUnit Days selected selected gt Days lt option gt lt option value Weeks freqUnit Weeks selected selected Weeks option lt option value Months SfreqUnit Months selected selected gt Months lt option gt lt select gt lt td gt echo lt td align left gt lt input type checkbox name Active SstandingOrderInfo Active standingOrderInfo Sta ndingOrderID checked checked gt Active lt td gt echo lt tr gt echo lt tr gt lt td colspan 2 align center gt lt input ty pe submit name modifyOrder value SstandingOrderInfo StandingO rderID Update Standing Order Add Standing Order gt lt td gt lt tr gt We echo lt table gt if S standingOrderInfo StandingOrderID echo lt input type hidden name existingStandin gOrder value standingOrderInfo StandingOrderID echo form br el
25. lt td gt lt input type text name Username size 30 v alue lt POST Username gt gt lt td gt lt tr gt lt tr gt lt td style font weight bold gt Password lt td gt lt td gt lt input type password name Password size 3 0 value lt POST Password gt gt lt td gt lt tr gt lt tr gt lt td style font weight bold gt Email Address lt td gt lt td gt lt input type text name Email size 30 valu e lt POST Email gt gt lt td gt lt tr gt lt tr gt td colspan 2 align center gt amp nbsp lt td gt lt tr gt lt tr gt lt td colspan 2 align center gt lt input type submit name register value Register gt lt td gt tr table form 90 Page lt p gt lt php 7 gt lt div gt lt div id footer gt lt php include kunden homepages 25 d123903211 htdocs egroceri es includes footer inc php gt lt div gt lt div gt lt body gt html Search Page search php include kunden homepages 25 d123903211 htdocs egroceries includes global inc php gt lt DOCTYPE html PUBLIC W3C DTD XHTML 1 0 Transitional EN http www w3 org TR xhtmll DT D xhtmll transitional dtd lt html xmlns http www w3 org 1999 xhtml lt head gt lt meta http equiv Content Type content text html charset utf 8 gt lt title gt eGroceries lt title gt l
26. table width 650 cellpadding 3 cellspacing 0 style border 1px solid 000 gt Cro th align left gt Product Description lt th gt lt th colspan 2 align s righbt Prise tb lt tr gt SproductHTML lt table gt SextraInfoHTML lt body gt lt html gt EOF I E gt snbsp lt td gt color 4 Sfp fopen bills S billNum html w fwrite fp Shtml fclose fp Create the static HTML Ticket for an order function makeTicket ticketNum orderID SorderInfoResult mysql query SELECT FROM ORDERS WHERE OrderID rnwosorderID 2 SorderInfo mysql fetch assoc orderInfoResult SuserinfoResult mysql query SELECT FROM CUSTOMERS WHERE Custo merrD SorderlInfo CustomerlrD z SuserinfoRow mysql fetch assoc userinfoResult 114 Page paymentTypeDetailsResult mysql query SELECT FROM PAYMENT TYP ES WHERE CustomerID S orderInfo CustomerID AND PaymentID SorderInfo PaymentID SpaymentTypeDetailsRow mysql fetch assoc paymentTypeDetailsResu lt SbasketItemsResult mysql query SELECT FROM BASKETS WHERE Cust omerID orderInfo CustomerID AND BasketID S orderInfo BasketrD si ys SbasketItemsRow mysql fetch assoc basketl
27. DeliveryDate DeliveryTimeRange DriverlD BasePrice SalesTax DeliveryCharge 29 Page STANDING ORDERS StandingOrderID OrderID Frequency StartDate EndDate Active TRANSACTIONS TransactionID OrderID StandingOrderID TicketNum BillNum DateTimeOrdered DateTimeDispatched DateTi meArrived DateTimeReturned DateTimePaid AmountPaid Comments BACKGROUND_PROCESSES ProcessID TaskID Days Tim es Frequency LastRan Note TasklDs will be identifiers of hard coded tasks and will be used to decide which task to run Days will be an array of seven 0 or 1s for true false Times will be an array of 24 hour times Frequency will be an amou 4 2 CUSTOMERS CREATE TABLE CustomerID FirstName varchar 50 LastName varchar 50 AddressStreet varchar AddressCity varchar 5 AddressState varchar AddressZip varchar 5 Gender varchar 6 NOT Username varchar 16 Password varchar 32 Email varchar 75 NOT Balance varchar 6 NO BalanceDat date defa Active varchar 1 NOT AdminUser tinyint 1 PRIMARY KEY Customer UNIQUE KEY Username CUSTOMERS int 11 NO nt of hours between runs Data Definition Language T NULL auto increment NOT NULL NOT NULL
28. POST AddressZip AddressState mysql real esc ape string POST AddressState Gender mysql real escape s tring POST Gender Email mysql real escape string S POST Email WHERE CustomerID SESSION userinfo CustomerID whe MN m SupdateResult mysql query updateQuery if mysql error echo lt p class error gt lt strong gt Error lt strong gt MySQL rror lt u gt mysql error lt u gt lt p gt else echo lt p class success gt lt strong gt Success lt strong gt You r information has been updated lt p gt else echo lt p class error gt lt strong gt Error lt strong gt The follo wing fields were missing and are required u implode missing P lt gt lt pes else SuserinfoResult mysql query SELECT FROM CUSTOMERS WHE RE CustomerID SESSION userinfo CustomerID SuserinfoRow mysql fetch assoc userinfoResult SESSION userinfo userinfoRow if SESSION userinfo Active N echo lt p class warning strong Warning strong Your a ccount has been labeled Inactive as a result of your choice or due to your outstanding balance br Please contact an administrator to recti Ei 45 Page fy your situation and then visit your lt a href account status php Ac count Status lt a gt page to Reactivate your
29. Product Information PINFO PSF Product Sale Form 1 Generate and execute Product update query to reflect sale price 2 Run Message Customer MCT to alert customers of sale price Message Customer MCT If product appears in Product Sale List SALE but not in Product Information PINFO return error for this product If Message Customer MCT returns an error return same error RAND Random Product Selector Product Sale List PPOST Place Product on Sale SALE PINFO Product Information BPT BPINFO Background Background Process Process Information Task 13 Page TASK NUMBER TASK NAME PERFORMER PURPOSE ENABLING COND DESCRIPTION FREOUENCY DURATION IMPORTANCE MAKIMUM DELAY INPUT OUTPUT DOCUMENT USE OPS PERFORMED SUBTASKS ERROR COND BPT Background Process Task System Execute a background process subtask at a designated date time See subtask General task used to determine when to run and to actually run a subtask designated in Background Process Information BPINFO See subtask See subtask See subtask See subtask Background Process Information BPINFO See subtask Background Process Information BPINFO See subtask internal 1 Start designated subtask 2 See subtask Place Product on Sale PPOST Place Order POT Generate Delinquency Report RPT 3 See subtasks TASK External Task
30. SI Eos echo tr td align top style font weight bold padding bottom 10px gt Delivery Date lt td gt td style padding bottom 10px date l F jS strtotime orderInfo DeliveryDate select td eu pact echo tr td align top style font weight bold padding bottom 10px gt Delivery Time Range lt td gt td style padding bottom 10px gt echo lt input type hidden name DeliveryTimeR ange24 id DeliveryTimeRange24 value if SorderInfo DeliveryTimeRange 9am lpm echo 09 md if SorderInfo DeliveryTimeRange lpm 5pm echo 13 m TimeRange 5pm if SorderInfo Delivery Spm oho VIWA echo echo S orderInfo DeliveryTimeRange td EJ gp echo tr if Stransactioninfo DateTimeArrived echo td valign top style font weight bold Delivery Date Time lt td gt td date m d Y g i a strtotime tra nsactionInfo DateTimeArrived td else echo td valign top style font weight bold gt Estimated Arrival td Saddresses array 38 98989 76 936226 SexistingOrdersQuery SELECT FROM ORDERS WHERE DeliveryDate S orderInfo DeliveryDate AND DeliveryTim eRange SorderInfo DeliveryTimeRange AND DriverID Sorde rIWwFfo Drerverrb ORDER BY Orderrbp 8
31. and divides by the number of orders fitting the requirements and then graphs the results Best Worst Seller Report This report returns a list of the top 10 of both the top selling and the worst selling products their category and sub category price and amount sold For the worst selling products there are also action buttons that allow an administrator to either place the product on sale in an attempt to increase sales or remove the product from the system altogether Delinquency Report This report runs a duplicate of the automated task that runs daily in which the system will search for a list of each customer that has an account balance exceeding 25 and whose balance has not been updated in over a week The system then sends out a message via email to the customer notifying them that they are delinquent their balance and that their account has been listed as inactive disallowing the customer to place another order but still allowing them to log in to the website 132 Page Testing Efforts 8 1 Tests Performed Page Security A series of tests were performed to ensure secure pages such as My Account Checkout and Administrative Options were inaccessible by unauthorized users The server correctly identified and returned an error for unauthorized access Registration Customer Account Update Page Validation The eGroceries Registration page as well as the My Account Customer Account Update Page was tested to ensure tha
32. cellspacing 0 gt Cre td valign top width 50 rowspan 4 img src gr logo jp eh welt lt td valign top width 21 5 style font weight bold amp nbsp td lt td valign top width 28 5 gt snbsp lt td gt ey tu SEIS lt td valign top style font weight bold padding left 25px gt Customer ID lt td gt td valign top gt SorderInfo CustomerID lt td gt KILEO Cro td valign top style font weight bold padding left 25px gt Order ID lt td gt lt td valign top gt SorderID lt td gt lt I TE gt SEI lt td valign top style font weight bold padding left 25px gt Ticket Num lt td gt lt td valign top gt SticketNum lt td gt lt gt lt table gt lt br gt lt table width 650 cellpadding 3 cellspacing 0 style border Les solid 000 gt lt tr gt th colspan 2 width 50 class border gt Delivery Informatio n lt th gt th colspan 3 width 50 gt Billing Information lt th gt fere vU Ie lt td valign top style font weight bold gt Delivery Address lt td gt lt td valign top class border gt SuserinfoRow FirstName userinfoRow LastName lt td gt lt td valign top style font weight bold gt Payment Method lt td gt td valign top colspan 2 gt SpaymentInfo lt td gt STEEF lt tr gt 116 Page lt td gt lt lt lt td td td td td valign v
33. changePW if POST CurrentPW validCurrPW false else if SESSION userinfo Password le md5 POST C urrentPW SvalidCurrPW false if POST NewPW POST ConfirmPW SconfirmMatch true if strlen POST NewPW gt 0 SnotBlank true if validCurrPW Ss SconfirmMatch amp amp notBlank SupdateQuery UPDATE CUSTOMERS SET Password md5 _POST NewPW WHERE CustomerID SESSION userinfo Custom Seip eters SupdateResult mysql query SupdateQuery if mysql error echo lt p class error gt lt strong gt Error lt strong gt MySQL E rror lt u gt myeql error u p else echo lt p class success gt lt strong gt Success lt strong gt You r password has been updated lt p gt else if S validCurrPW echo lt p class error style width 455px gt lt strong gt Er ror strong Your current password does not match our records p else if confirmMatch echo lt p class error style width 455px gt lt strong gt Er ror lt strong gt Confirmation does not match new password lt p gt 68 Page else if SnotBlank echo lt p class error style width 455px strong l ror strong You must enter a new password lt p gt GI H a lt form method POST style width 425px gt lt h2 class h2 gt Password Information lt
34. margin top 7px margin right 5px lt p gt This site was created for educational purposes by Stephen E Skin and Jeff Lasser for the Database Design Project for the Universit y of Maryland s CMSC424 Database Design course It is a fictional rep resentation of modern online grocery delivery services and is not mea nt to be an actual product No claims are made of ownership of any im ages product information or other intellectual property other than p rogram and database code A majority of the product data has come from a href http shop safeway com superstore target new class m ainlink gt Safeway Grocery Delivery lt a gt and is amp copy 2009 2010 Safeway Inc p div div id footer gt lt php include kunden homepages 25 d123903211 htdocs egroceri 78 Page es includes footer inc php gt lt div gt lt div gt lt body gt lt html gt Logout Page logout php lt php session Start unset _ SESSION session destroy 7 header Location index php gt Past Customer Orders pastorders php lt include kunden homepages 25 d123903211 htdocs egroceries includes global ian php gt lt DOCTYPE html PUBLIC W3C DTD XHTML 1 0 Transitional EN http www w3 org TR xhtmll DT D xhtmll transitional dtd lt html xmlns http www w3 org 1999 xhtml head meta http equiv Content Type conten
35. missing echo lt p class error style width 455px gt lt strong gt Error lt strong gt The following fields were missing and are required lt u gt imp lode S missing u p elseif SuserNameExists echo lt p class error style width 455px gt lt strong gt Error lt strong gt Username already exists please choose another lt p gt else echo lt p class error style width 455px gt lt strong gt Error lt strong gt The following fields were missing and are required lt u gt imp logde Smissing c u c pes if valid a gt lt p gt lt form method POST style width 425px gt lt table style width 425px gt lt tr gt lt td colspan 2 align center gt lt h2 style text decoration underline font size 18px margin top Opx gt Personal Information lt h2 gt lt td gt lt tr gt lt tr gt td style font weight bold gt First Name lt td gt lt td gt lt input type text name FirstName size 30 value lt POST FirstName gt gt lt td gt lt tr gt lt tr gt lt td style font weight bold gt Last Name lt td gt lt td gt lt input type text name LastName size 30 v alue lt POST LastName gt gt lt td gt lt tr gt lt tr gt lt td style font weight bold gt Address Street lt td gt lt td gt lt input type text name AddressStreet size 89 Pa
36. text html charset utf 8 gt lt title gt eGroceries lt title gt lt link rel stylesheet href styles main css type text css gt lt head gt lt body gt lt div id frame gt lt div id header gt lt php include kunden homepages 25 d123903211 htdocs egroceri es includes header inc php gt lt div gt lt div id nav gt lt php include kunden homepages 25 d123903211 htdocs egroceri es includes nav inc php gt lt div gt lt div id content gt lt img src gr keyboard jpg style float right padding 2px border lpx solid ccc margin 5px gt lt hl gt Register for eGroceries lt hl gt lt php if POST register Svalid true missing array if POST FirstName valid false missing First Name if POST LastName valid false missing Last N ame J if POST AddressStreet valid false missing A ddress Street if POST AddressCity valid false missing Adad resse City s p if POST AddressZip valid false missing Addr ess Zip Code if POST AddressState valid false missing Ad dress State Code if POST Gender valid false missing Gender if POST Email valid false missing Email Add ress if POST Username valid false missing Userna me else
37. valign top colspan 2 gt SpaymentInfo lt td gt top style font weight bold gt amp nbsp lt td gt top class border gt SuserinfoRow AddressStreet top style font weight bold gt Payment Info lt td gt top gt Subtotal lt td gt 113 Page td valign top align right gt Ssubtotal lt td gt Sq Lr td valign top style font weight bold amp nbsp td td valign top class border gt SuserinfoRow AddressCity SuserinfoRow AddressState SuserinfoRow AddressZip lt td gt lt td valign top gt amp nbsp lt td gt lt td valign top gt Sales Tax lt td gt lt td valign top align right gt salesTax lt td gt lt tr gt SEES lt td valign top style font weight bold gt Delivery Date lt td gt lt td valign top class border gt deliveryDate lt td gt td valign top gt snbsp lt td gt lt td valign top gt Delivery Fee lt td gt lt td valign top align right gt deliveryFee lt td gt lt tr gt ILES lt td valign top style font weight bold Delivery Time Range lt td gt td valign top class border gt Between SorderInfo DeliveryT imeRange lt td gt td valign top style background color 4E td valign top style background EEE Grand Total td td valign top align right style background color EEE gt Stotal lt td gt lt tr gt lt table gt abr gt
38. value Make Standing Order Le lt form gt a eas echo lt tr gt echo lt table gt 2 div div id footer gt lt php include kunden homepages 25 d123903211 htdocs egroceri es includes footer inc php div div body lt html gt 105 Page Transaction History transactionhistory php lt include kunden homepages 25 d123903211 htdocs egroceries includes global inc php gt lt DOCTYPE html PUBLIC W3C DTD XHTML 1 0 Transitional EN http www w3 org TR xhtmll DT D xhtmll transitional dtd gt lt html xmlns http www w3 org 1999 xhtml lt head gt meta http equiv Content Type content text html charset utf 8 gt lt title gt eGroceries lt title gt lt link rel stylesheet href styles main css type text css gt lt head gt lt body onload init onunload GUnload gt lt div id frame gt lt div id header gt lt php include kunden homepages 25 d123903211 htdocs egroceri es includes header inc php gt lt div gt lt div id nav gt lt php include kunden homepages 25 d123903211 htdocs egroceri es includes nav inc php gt lt div gt lt div id content gt lt hl gt My eGroceries Account Transaction History lt hl gt lt php 1f 18 SESSION userinfo echo lt p class error gt lt strong gt Error lt strong gt You are not logged in Please wait to be re
39. 60 style text decoration line through colori 4CE5DCOZ 2O0ut ofcbr 8tockc tgd echo lt td width 90 style text align center gt form name form productRow ProductID Si method post gt lt input type hidden name productToRemove va 66 Page lue SproductRow ProductID gt lt input type hidden name productToRemoveDesc ription value SproductRow Description gt lt a href javascript document form SproductRow ProductID i submit class basketlink gt Remove lt br gt from Basket lt a gt lt form gt Eds echo lt tr gt if basketItemsRow ProductArray trim implode Sbasketltems W W mm echo lt tr gt lt td colspan 4 style text align center font style italic font size llpx gt No items exist in your basket lt td gt lt tr gt else echo lt tr gt lt td colspan 2 gt amp nbsp lt td gt lt td colspan 2 s tyle font weight bold gt Subtotal toMoney Ssubtotal true lt td gt lt tr gt echo lt tr gt lt td colspan 4 style text align center gt lt input type button name checkout value Checkout No w onClick window location checkout php gt lt td gt lt tr gt echo lt table gt else echo lt div class warning gt lt strong gt Warning lt strong gt No items exist in your basket lt div gt 2 gt lt div gt lt div id footer gt lt php i
40. CustomerID orderInfo CustomerID AND BasketID SorderInfo BasketID paymentTypeDetailsResult mysql query SELECT FROM PAYMENT TYPES WHERE CustomerID orderInfo CustomerID AND P aymentID SorderInfo PaymentID driverinfoResult mysql query SELECT FROM DELIVER Y PEOPLE WHERE DriverID Um Sorderlmto Driverip teet s driverinfoRow mysql fetch assoc driverinfoResult driverlntfo SdriverintoRBow Name Bt Sdri verinfoRow RouteID SpaymentTypeDetailsRow mysql fetch assoc paymentTyp eDetailsResult echo lt table cellpadding 1 cellspacing 2 style te xt aligns left margin left 75px widths 600px gt T echo tr th Item Description lt th gt lt tr gt if mysql num rows basketItemsResult SbasketItemsRow mysql fetch assoc basketltemsResu lt SbasketItems explode SbasketItemsRow ProductA Pray qi g foreach basketltems as productID productsResult mysql_query SELECT FROM PRODU CTS WHERE ProductID SproducEID while productRow mysql fetch assoc productsRe Bult if i 2 Scolor background color F3F3F3 else unset Scolor echo lt tr gt lt td style Scolor gt SproductRow Desc ladis sel e usq P s s eeh itt if SbasketItemsRow
41. ERES o ERE e ERRARE AA RA 135 10 1 System Gredits 2 s neos mu u Qin sua u P AER 135 10 2 References of Works Ui 135 2 Page Environment and Reguirement Analysis 1 1 Project Description This project an online grocery ordering and delivery service is meant to teach CMSC424 students to analyze project reguirements in Order to successfully design implement document and demonstrate a database system in our case based on the web programming language PHP with an MySQL database backend The web interface will support purchasing groceries from a nearby store and then dispatch a delivery driver with the purchased merchandise to the customer s address Customers will be able to prepare a shopping basket of items and will specify a delivery window during which they will be home to receive the goods 1 2 Phase I Purpose Phase of the project involves determining the environment and requirements as well as analyzing and specifying the details of the system Here we will investigate the information needs of and the activities within the grocery delivery enterprise and determine the boundary of our design problem We will also divide the functions from the Top Level Information Flow Diagram into reasonably independent tasks until each task is small enough to be clearly understood and until the documents used by each task can be conveniently expressed in terms of data elements that cannot be divided any further 1 3 Phasell Purpos
42. Error lt strong gt You do no t have any Payment Methods associated with this account br Please go to a href paymentmethods php gt Payment Methods lt a gt and add one befor e attempting to checkout lt p gt else if POST checkout Do actual order submittion here paymentTypeDetailsResult mysql query SELECT FROM PAYMENT TYPES WHERE CustomerID SESSION userinfo CustomerID ra AND PaymentID POST PaymentID paymentTypeDetailsRow mysql fetch assoc paymentTyp eDetailsResult if SpaymentTypeDetailsRow PaymentType Checking Account amp amp SpaymentTypeDetailsRow PaymentInfo lt SESSION useri nio Balange CS POST subtotal S POST taxSubtotal POS T deliveryCost echo lt p class error gt lt strong gt Error lt strong gt If yo u purchase this basket your Account Balance will exceed your Checking Accounts Balance lt br gt Please go lt a href javascript history go 1 gt back lt a gt and select a different Payment Method lt p gt else Create Order 70 Page SinsertOrderQuery INSERT INTO ORDERS CustomerID BasketID PaymentID DeliveryDate DeliveryTimeRange DriverID BaseP rice SalesTax DeliveryCharge VALUES SESSION userinfo Cust omerrp t S PDST Basketrp T S POST PaymentrDp t T S POST DeliveryDat
43. PERFORMED SUBTASKS ERROR COND RPT 3 Generate Delinquency Report System Alert Customers of delinquency issues Customers have been set up CST Database has been loaded DLT Background processes are running BPT Orders have been placed POT Orders have been fulfilled FOT Generates a report of customers with an outstanding balance that exceeds some maximum and who have not ordered any products more than some specified time sends them a delinquency notice and de activates them Daily Medium Very high 1 minute Customer Information CINFO Order Information OINFO Transaction Information TINFO Background Process Information BPINFO Delinquency Report DR DRF Delinquency Report Form 1 Generate and execute query to find all customers with an outstanding balance that exceeds some maximum and who have not ordered any products more than some specified time 2 Call MCT to send customer a delinquency notice 3 Call DCT to de activate customer Message Customer MCT De activate Customer DCT If no orders have been placed return error DCT CINFO De activate Customer Customer Information E BPINFO DR RPT Background Process Delinquency Reports Information Report OINFO MCT Order Information Message TINEO Customer Transaction Information 24 Page TASK NUMBER TASK NAME PERFORMER PURPOSE ENABLING COND DESCRIPTION FR
44. PERFORMED SUBTASKS ERROR COND RCT Re activate Customer Administrative Staff Re activate customer record in system Customer exists in Customer Information CINFO Customer is not currently activated Marks a customer as active in the database Infreguently Short Low 1 minute Administrator Options Page AOP Customer Information CINFO CSF Customer Status Form Update Customer Information to set ACTIVE TRUE None If customer is not de activated return error CIUR Customer Info Update Request RCT CINFO Re activate Customer Customer Information CIUR Customer Info Update Request 11 Page TASK NUMBER TASK NAME PERFORMER PURPOSE ENABLING COND DESCRIPTION FREOUENCY DURATION IMPORTANCE MAKIMUM DELAY INPUT OUTPUT DOCUMENT USE OPS PERFORMED SUBTASKS ERROR COND Data CINFO Generator Customer GPINFO Information Generated Product Information PINFO Product Information DLT DLT Database Load Database Administrator Populate the database The database has been created Populates the database with products customers delivery drivers and randomly generated baskets and transactions Once Medium Very high N A Safeway Website data SAFEWAY Product Information PINFO Customer Information CINFO Basket Information BINFO Delivery Person Information DINFO Transaction Information TINFO DLF
45. SELECT FROM BASKETS WHERE CustomerID SESSION userinfo CustomerID AND Baske EID e orderiInfo BasketlID 2 y paymentTypeDetailsResult mysql query SELECT FROM P AYMENT TYPES WHERE CustomerID SESSION userinfo CustomerID AND PaymentID S orderInfo PaymentID SpaymentTypeDetailsRow mysql fetch assoc paymentTypeD etailsResult echo lt table cellpadding 1 cellspacing 2 style text caligng left margin left 75Dx width 600px gt echo tr th Item Description lt th gt lt tr gt if mysql num rows basketItemsResult SbasketItemsRow mysql_fetch_assoc basketItemsResult SbasketItems explode SbasketItemsRow ProductArr ay si 0 foreach basketltems as SproductID productsResult mysql query SELECT FROM PRODUCT WHERE ProductlID proda ctlID while productRow mysql fetch assoc productsResu lt if i 2 Scolor background color F3F3F3 else unset Scolor echo lt tr gt lt td style Scolor gt SproductRow Descri eta tf Sitt if basketItemsRow ProductArray trim implode SbasketlItems U W echo lt tr gt lt td colspan 2 style text align center font style italic font size llpx gt No items exist in your basket lt td gt lt tr gt lt table gt else StaxSubtotal 0 06 taxableSubtotal deliveryCost getDeliveryCos
46. WHERE ProductID randomID RUM suggestions S randomID mysql fetch assoc simil arItemDetailsResult foreach S suggestions as productID gt SproductInfo Simage http shop safeway com productimages 10 0x100 productID _100x100 jpg if GetImageSize Simage Display product image from Safeway s site if exists otherwise missing image SproductImage image else SproductImage gr missingProduct jpg SsuggestionHTML lt td align center valign top t width 20 onClick window open shop php cat SproductInfo cat amp subcat productInfo subcat productID N style cursor pointer font size llpx img src Simage height 50px width 50px gt lt br gt Spr oductlInfo Description td echo lt p class success lt strong gt Success lt strong gt The product POST productToAddDescription has been added to your a href basket php gt basket lt a gt lt br gt Below are a few other products by SitemQu antityRow Manufacturer that you might also enjoy pons echo lt table width 100 2 tr suggestionHTML tr table gt else echo lt p class error gt lt strong gt Error lt strong gt There is not enough stock to add this product to your basket Please try a gain later lt p gt else echo lt p class error gt lt strong gt Error lt strong gt You are not logged in Please lt
47. a href signin php gt Sign In lt a gt or lt a href re gister php gt Register lt a gt before you attempt to buy items lt p gt 93 Page echo lt ta echo lt tr align center gt P Swhere if GETI 9 o ble cellpadding 1 gt gt lt th colspan 2 gt Item Description lt th gt lt th colspan rice th Er D Swhere Ko g strtolower trim if GETI cat if GE ND Swhere L ng strtolower trim if GET Price ET searchP if GET ees prige ET search if Sand Sproduc subcat D Sproduc TI Swhere DH H Swhere trim Gl We where m dr duos G ER BY Cat if mysql echo sults found i td while p if SE I Sprod CustomerID Ir SE E SproductR prod E F ay LIKE ghtQuery if my con echo lt Simage S productRow Produc if 8Get Safeway s site if exi prod else prod echo src Sp if pro manu else manu echo font style italic size 12px gt Manufactu if Sore H S lt fa es img G wes Sand 0 searchDescription if Sand Swhere AN WER Description LIKE mysql real escape strin ET searchDescription Sand 1 searchCategory if Sand Swhere AND GET searchCategory Sand 1 searchManufacturer if Sand
48. colsp an 2 align center gt Price lt th gt lt tr gt foreach S basketItems as productID Sl productsResult mysql query SELECT FROM PRODUCTS WHERE Prod uctID SproductlID while productRow mysql fetch assoc productsResult echo Vates Simage http shop safeway com productimages 100x 100 2productRow ProductriD 100x100 3pg if GetImageSize image Display product image f rom Safeway s site if exists otherwise missing image SproductImage image else productlImage gr missingProduct jpg echo lt td width 100 gt lt img src SproductImage t gos if SproductRow Manufacturer Smanufacturer SproductRow Manufacturer else Smanufacturer Not Available echo td productRow Description br span s tyle c font style italic fonte size 12px gt Manufacturer manufacturer lt span gt lt td gt if prod ctRow Stock gt 0 if SproductRow SaleStatus echo lt td width 60 gt lt span style text decoration line through gt SproductRow Price lt span gt lt br gt lt span style color FF8F20 font x br S productRow SalePrice span saos subtotal Ssubtotal productRow SalePrice weight bold gt SAL 5 else echo lt td width 60 gt S SproductRow Price lt Edo Ssubtotal Ssubtotal productRow Price else echo lt td width
49. exportData style display none Ue dq lt div id durationsData style display no ney gt lt div gt lt div id ordering style display none gt lt div gt dry 1d my textual day style display m ene T gt lt div gt Ws echo td id path gt Loading lt td gt echo lt tr gt echo lt table gt echo td td width 50 valign top gt echo h2 class h2 gt Billing Information lt h2 gt echo lt table width 100 gt echo lt tr gt td align top style font weight bold padding bottom 10px width 150 gt Payment Method lt td gt lt td style padding bottom 10px gt 83 Page if SpaymentTypeDetailsRow PaymentType Credit Card echo SpaymentTypeDetailsRow PaymentType substr paymentTypeDetailsRow PaymentInfo 4 else echo SpaymentTypeDetailsRow PaymentType toMoney paymentTypeDetailsRow PaymentInfo true echo td lt prt if StransactionInfo DateTimePaid echo lt tr gt lt td align top style font weight bold padding bottom 10px gt Payment Recieved lt td gt lt td style padding bottom 10px toMoney transactionInfo AmountPaid true on date m d y g i a strtotime transactionInfo DateTimePaid tds tp else echo lt tr gt lt td align top style font weight bold padding bottom 10px gt Payment Recieved lt td gt lt td style pad
50. g if SESSION userinfo sessionInfoResult mysql_query SELECT FROM CUSTOMERS WHER E CustomerID SESSION userinfo CustomerID SESSION userinfo mysql fetch assoc sessionInfoResult YA Page Header Include File header inc php div id homelink onClick window location index php gt gnbsp lt div gt php if SESSION userinfo echo i Welcome SESSION userinfo FirstName S SSTON userinto nastName s 3 SnumBasketItemsResult mysql query SELECT FROM BASKETS WHE CustomerID SESSION userinfo CustomerID AND Active eda GI RE eil if mysql num rows SnumBbasketitemsrResult SnumBasketItemsRow mysql fetch assoc numBasketltemsResu It if SnumBasketItemsRow ProductArray SnumBasketItems count explode SnumBasketItemsRow ProductArray else SnumBasketItems 0 else SnumBasketItems 0 if POST productToAdd numBasketltemstt if POST productToRemove numBasketltems if numBasketltems lt 0 numBasketltems 0 echo lt a href search php gt Search lt a gt a href basket php gt V iew Basket lt b gt numBasketltems lt b gt lt a gt a href checkout php gt C heckout lt a gt a href account php gt My Account lt a gt if
51. gt SESSION userinfo AddressStreet lt br gt SESS ION userinfo AddressCity SESSION userinfo AddressStat e SESSION userinfo AddressZip br a href account php class mainlink style font size llpx gt Edit this address lt a gt lt td gt Veron echo tr 7A Page td align top style font weight bold padding bottom 10px gt Delivery Date lt td gt lt td style padding bottom 10px gt lt select name DeliveryDate id DeliveryDa Lei onChange javascript changeDateTimeRange gt lt option value gt lt opt ions for i20 i lt 7 i echo lt option value date Y m d time i 24 60 60 GET dDate date Y m d time Si 24 60 60 selected selected gt gate l Ea time Si 24 50 B50 option echo lt select gt lt td gt sf echo lt tr gt lt td align top style font weight bold padding bottom 10px gt Delivery Time Range lt td gt if GET dDate echo lt td style padding bottom 10pzx i Pick a Delivery Date tirst c i td else echo lt td style padding bottom 10px gt echo lt input type hidden name Deliver yTimeRange24 id DeliveryTimeRange24 value if str replace 20 GET dTime 9am lpm echo 09 if str replac
52. id content gt lt hl gt My eGroceries Account Manage Payment Methods lt h1 gt php if SESSION userinfo echo lt p class error gt lt strong gt Error lt strong gt You are not 1 ogged in Please wait to be redirected p meta http equiv REFRESH content 0 url signin php else if POST PaymentID if POST PaymentID NEW if POST PaymentInfo echo lt p class error gt lt strong gt Error lt strong gt A Credi t Card Number or Checking Account Limit is required lt p gt else SnewPaymentIDQuery SELECT MAX PaymentID as Payment ID FROM PAYMENT TYPES WHERE CustomerID SESSION userinfo Cus tomgrziDp res newPaymentIDResult mysql query newPaymentIDQuery newPaymentIDRow mysql fetch assoc newPaymentlIDResu 1t SnewPaymentID newPaymentIDRow PaymentID 1 SaddPaymentQuery INSERT INTO PAYMENT TYPES Custome CID PaymentID PaymentType PaymentInfo VALUES SESSION userin fo CustomerID newPaymentID POST PaymentType str replace POST PaymentInfo SaddPaymentResult mysql query addPaymentQuery if mysql error 1 echo lt p class error gt lt strong gt Error lt strong gt MySQL Error WO mysql error lt p gt else echo lt p class success gt lt strong gt Suc
53. is 6 copy 2009 2010 Safeway Inc br This site was created for educational purposes and does not claim own ership of any images product content or other material other than pr ogram code Common Functions Include File functions inc php lt Convert a float to a price function toMoney value showDollar true setlocale LC MONETARY en US if showDollar return money format 2n value else return money format 2n value Find the distance from a customer address to return the price of the assigned route s delivery f function getDeliveryCost customerID SuserAddressQuery SELECT AddressStreet AddressCity AddressSta te AddressZip FROM CUSTOMERS WHERE CustomerID customerID SuserAddressResult mysql query userAddressQuery SuserAddressRow mysql fetch assoc userAddressResult SuserAddress str replace t userAddressRow AddressStreet 1 SuserAddressRow AddressCity SuserAddressRow Add ressState SuserAddressRow AddressZip SwarehouseAddress 38 98989 76 936226 googleMapsAddress http maps google com maps q fromt wareho useAddress ttot userAddress soutput kml 110 Page googleMapsXML file get contents googleMapsAddress matches array preg match Distance amp 160 i googleMapsXML matches Sdistance Smat
54. mysql e tInfo mysql fetch assoc prod Smessage wow Scustome FROM PRO ERE ProductID uery Sprod uery uctInfoRes H lt a href http egroceries antiemotion com shop p hp cat productInfo cat amp subcat productInfo subcat pr messageCustomer customerID return numProductsChanged Function to send an email message to customer function messageCustomer c ScustomerInfoQuery SELECT Email FROM CUSTOM customerID customerInfoResult mysql query customerInfoQuery mysql fetch assoc customerInfoResul customerInfo Semail customerInfo ustomerID far Smessage Pia a JL T Smessage uctID target blank gt productInfo Description toMoney productInfo SalePrice true off of tInfo Price true ERE CustomerID Here the function would normally use php s mail function to send the message message to the email address email echo lt hr gt lt strong gt Email To strong Semail lt br gt lt strong gt Message lt strong message lt hr gt f Global Page Code Include File global inc php lt 7 119 Page session start include kunden homepages 25 d123903211 htdocs egroceries include s database inc php include kunden homepages 25 d123903211 htdocs egroceries include sy functloHs incdphp
55. of the scope of this project and are assumed to be valid and approved by the banking company Cash as an impractical payment method is not allowed For the purpose of the project the Developers are also the Administrative Staff Actions handled outside of the scope of the project such as delivery people printing and then returning with and filing bills and dispatch tickets are assumed to be completed Routes are based on distances from the warehouse 5 for lt 3 mile radius 7 for gt 3 and 5 mile radius 10 for 5 miles Employees other than drivers will be handled in another application Vehicles are assigned a Vehicle Number and are managed in another application Delivery times will be estimated by Google Maps and will not take into account any traffic accidents weather etc Costs of products are assumed to not change other than sales for simplicity The adding and changing of products is assumed to be handled offline by developers Maryland has a 6 sales tax on all candy soda and prepared foods salad bar headed foods deli products etc Dispatch Tickets and Bills are printed automatically at the warehouse upon order and are collected in batch to dispatch drivers at the beginning of a time range Delivery drivers write the Date amp Time dispatched arrived and returned on the Dispatch Ticket and turn the ticket in when they return Ata later time an Administrator will enter this information plus date amp
56. td gt lt td gt lt input type text name Email size 30 value lt SuserinfoRow Email s gt gt lt td gt lt tr gt lt tr height 30 gt lt td style font weight bold gt Payment Methods lt td gt lt td gt lt input type button name ManagePaymentMethods value Manage Payment Methods onClick window location paymentmetho ds php gt lt td gt lt tr gt lt tr height 30 gt 48 Page td style font weight bold gt Account Balance lt td gt td style padding left 2px font Size 12px gt lt toMoney userinfoRow Balance true since SuserinfoRow BalanceDate date m d y strtotime SuserinfoRow Balan ceDate always gt lt td gt lt tr gt lt tr height 30 gt lt td style font weight bold gt Account Status lt td gt lt td gt lt input type button name AccountStatus value Account Status onClick window location account status php gt lt td gt lt tr gt lt tr height 30 gt lt td style font weight bold gt Past Orders lt td gt lt td gt lt input type button name astOrders value Vi ew Past Orders onClick window location pastorders php gt lt td gt tr tr height 30 gt td style font weight bold gt Standing Orders lt td gt lt td gt lt input type button name StandingOrders value Modify Standing Orders onClick 2 window location standingorders php In s lt td gt
57. td valign 25px Customer td valign ES gt td valign 25px Order ID td valign E td valign td valign EE tab lt br gt table width 650 cellpadding 3 lpx solid le gt 000 gt SEES lt ney th gt lt ftr UE amp td valign Geneva th colspan 2 Opx padding Spx Tont sans serif font size tccc border bottom 1px solid 000 12px lpx solid 4000 cellspacing 0 gt top width 50 rowspan 4 gt lt img src gr logo jp top width 21 5 style font ZE top width 28 5 gt amp nbsp lt td gt top style font weight bold padding ID lt td gt top gt SorderInfo CustomerID lt td gt top style font weight bold padding ref tg top gt SorderID lt td gt top style font weight bold padding 25px gt Bill Number lt td gt top gt billNum lt td gt cellspacing 0 style border width 50 class border gt Delivery Informatio th colspan 3 width 50 gt Billing Information lt th gt top style font weight bold gt Delivery Address lt td gt s td valign top class border gt SuserinfoRow FirstName userinfoRow LastName td lt td valign top style font weight bold gt Payment Method lt td gt lt td valign ftr SES lt e pertas lt td td valign valign Eel td valign
58. the new system The administrators will also need to develop an inventory management system to ensure that products are kept in stock at reasonable quantities They will also be responsible for hiring a sufficient number of drivers to handle the deliveries processed through the website 2 1 3 Developer Procedures The developer will need to consider the interactions of multiple components when creating the system The data will be stored on a MySQL server where the developer will need to implement an efficient structure to manage the data The MySQL server will interface with the web server upon client initiated requests The data flow will be bidirectional as queries are processed on the MySQL server and then returned to the web server for formatting 2 1 1 Server Procedures The Apache web server will run PHP in order to facilitate communication with the MySQL server The main page will provide an opportunity for either the user or an administrator to log in If a user logs in the server will display a page providing the options available such as placing a new order or initiating queries based on prior orders Selecting a query will result in backend processing by the server to format the request for data from the MySQL database It will then receive the response and format it appropriately for display to the user In the case that an administrator logs in instead of a customer a different set of queries and reports will be available but they
59. time and amount paid into the system in the Administrative Options section Any credit back from customer comments is handled manually on a case by case basis outside of the system In production background tasks would be run automatically but for simplicity a script to check for tasks to run will be run on demand by Administrators 4 Page 1 5 Technical Conceptual Problems and Solutions 1 5 1 Technical Problems Problem No easy way to gather product data to populate the database in the future Solution Plan a custom script to scrape data off of Safeway s site and populate DB Problem Needed a way to map customer addresses and get distance from warehouse Solution Implemented the Google Maps API Problem Needed a way to estimate delivery times Solution Implemented a Traveling Salesman Problem solver for Google Maps that maps each currently pending order for the same date time range and driver and then gives the upper bound of the estimated time that the driver would arrive back at the warehouse after visiting each customer Problem Needed a way to run recurring tasks on a schedule Solution Created a background tasks feature that queried the database for scheduled tasks to run given the days times frequencies etc This script is assumed to be run every minute by a process on the server in order to automate the procedure 1 5 2 Conceptual Problems Problem Not enough details known on the workings of a grocery delive
60. 0396253934 Repeate701298172253934 3B s vi CS vi1 2674E4390501381E 60000111400121AA4 CE track 7B57D9FCBA 2D5716 2D4F3E 2D8EF222D8BOD51C F3A41 7D GWCK2 servicenotifyzip amp pzip 20740 ASPSESSIONIDSSTCTAAR ECP CGKNBPFFBBKDGABAKALAO ASPSESSIONIDACRBRBDT DLADGFNBLCKCLIGJOHHBDEGI ASPSESSIONIDOORCRBDR NPFGCKNBJOOOEBOGHOMAGCOD ASPSESSIONIDQSTDSDBR FF OOBKNBJKEEOGDMOPIOCHBN ASPSESSIONIDAAQBOBDT NMFJFFNBBCOLFDMNMPOPICNA ASPSESSIONIDCSACSABO IALHGPMBGBNMCLEEOFNIDBCG ASPSESSIONIDACTBOBCS J FAOPENBNNPHMJEKFGLGJIMB s sess 20c 3DundefinedDirect 2520LoadDirect 2520Load 3B 20s cc 3Dtrue 3B 20s sq 3D 3B BranchNumber 2753 GWCK img pref l1 amp BranchNumber 2753 amp brandid 1 amp RTFCreateDate 1950 2D01 2D01 amp brand shop 2bEsafeway 2Ecom amp browse true amp DivisionID EAS brand shop 2Esafeway 2Ecom brandid 1 EmailStatus 2B CID 123456789 I context stream context create Sopts Sproduct HTML file get contents http shop safeway com dnet RichProductInformation aspx promo window 1 amp bpn trim S thisproduct 2 false S context preg match span id nlabel ctl0 blmessage brV fi productHTML manufacturermatches echo INSERT INTO PRODUCTS ProductID Description Ma hufacturer Price cat subcat VALUES itrim Sthisproduct 2 w str replace trim S thisproduct 3
61. 2 Page SexistingOrdersResult mysql_query existin gOrdersQuery while existingOrdersRow mysql fetch asso c SexistingOrdersResult SuserinfoResult mysql query SELECT FR OM CUSTOMERS WHERE CustomerID existingOrdersRow CustomerID 5 SuserinfoRow mysql fetch assoc userinfo Result Saddresses userinfoRow AddressStreet SuserinfoRow AddressCity SuserinfoRow AddressS tate SuserinfoRow AddressZip echo lt input type hidden name DeliveryEst imate id DeliveryEstimate gt lt input type hidden name DeliveryTime Range id DeliveryTimeRange value SorderInfo DeliveryTimeRange PPS lt script src http maps google com maps f ile api amp amp v 2 amp amp key ABOIAAAAt43n15i060ao0U bD 8028xOZrun2bISZn4KqMWt44f5SUkl1G xTVx44HD 4ofbG2GGaPJOnEAUVtOg type text javascript gt lt script gt lt script type text javascript src js Bp TspSolver js gt lt script gt lt script type text javascript src js ts p ges seript lt script type text javascript src js da be format S gt lt script gt lt script type text javascript gt function zxnxt0 4 isDone false loadAtStart 37 4419 1272 1419 8 addList implode n Saddresses darrectrons 0 0 0 lt script gt div id map style display none lt di v gt lt div id
62. 75 NOT NULL 0 NOT NULL 2 NOT NULL NOT NULL NULL NOT NULL NOT NULL NULL T NULL ult NULL NULL default Y NOT NULL default O ID Username default 0 ENGINE InnoDB PAYMENT_TYPES CREATE TABLE PAYMENT TYPE CustomerID int 11 NOT PaymentID tinyint 4 NO PaymentType enum Credi PaymentInfo varchar 75 S NULL T NULL t Card Checking Account NOT NULL D PaymentID 2 ES ibfk 1 FOREIGN KEY PRIMARY KEY CustomerI CONSTRAINT PAYMENT TYP CUSTOMERS Custome ENGINE InnoDB rID 1 The CustomerlD is a common foreign key to many relations 2 CustomerID is a foreign key to the CUSTOMERS table used in the CUSTOMER HAVE PAYMENT TYPES relation CustomerID default NUL Ly RE ENCE 30 Page PRODUCT CATEGORIES CREATE TABLE PRODUCT CATEGORIES CATEGORY IDX tinyint 2 NOT NULL CATEGORY varchar 75 NOT NULL PRIMARY KEY CATEGORY IDX ENGINE InnoDB PRODUCT SUB CATEGORIES CREATE TABLE PRODUCT SUB CATEGORIES CATEGORY IDX tinyint 2 NOT NULL SUB CATEGORY IDX tinyint 2 NOT NULL CATEGORY varchar 75 NOT NULL PRIMARY KEY CATEGORY IDX SUB CATEGORY IDX CONSTRAINT PRODUCT SUB CATEGORIES ibfk 1 FOREIGN KEY CATEGORY IDX REFERENCES PRODUCT CATEGORIE
63. 9 xhtml lt head gt lt meta http equiv Content Type content text html charset utf 8 gt lt title gt eGroceries lt title gt lt link rel stylesheet href styles main css type text css gt lt head gt lt body gt lt div id frame gt lt div id header gt lt php include kunden homepages 25 d123903211 htdocs egroceri es includes header inc php gt lt div gt lt div id nav gt lt php include kunden homepages 25 d123903211 htdocs egrocer ies includes nav inc php gt lt div gt lt div id content gt lt img src gr keyboard jpg style float right padding 2px border lpx solid ccc margin 5px gt lt hl gt Welcome to eGroceries hl lt p gt Welcome to the wonderful world of online grocery shopping No longer will you have to make the long trek to pickup the necessitie S of life Thanks to the stunning innovations in technology you can now order food and personal items directly from your home PC Items a re delivered by our first class delivery drivers from nearby warehouse S directly to your front door After you place your order you will r eceive a guaranteed delivery time range and delivery fee To begin s imply a href register php class mainlink gt register lt a gt or lt a href signin php class mainlink gt Sign In lt a gt today lt p gt lt hl gt About This Site lt h1 gt lt img src gr umd jpg style float left padding 2px borde r 1px solid ccc
64. ASKS ERROR COND RPT 2 Generate Best Worst Seller Report System Administrative Staff Find the best and worst selling products Customers have been set up CST Database has been loaded DLT Background processes are running BPT Orders have been placed POT Generates a weekly report to find the best and worse selling products by category to ensure stock as well as suggest products to be put on sale or to be discontinued and start subtask if instructed by Administrator Weekly or on demand by Administrative Staff Medium High 1 minute Product Information PINFO Order Information OINFO Background Process Information BPINFO Best Worst Seller Report BWSR BWSRF Best Worst Seller Report Form 1 Request time frame to report Use weekly time frame 2 Generate and execute query to average basket value for given time interval 3 Display results in report form including graph of hourly daily intervals 4 Suggest and place items on sale if approved by Administrator Place Product on Sale PPOST If no products have been ordered return error PINFO Product Information BPINFO RPT BWSR Background Process Best Worst Seller v Reports Information Report OINFO Order Information 23 Page TASK NUMBER TASK NAME PERFORMER PURPOSE ENABLING COND DESCRIPTION FREOUENCY DURATION IMPORTANCE MAXIMUM DELAY INPUT OUTPUT DOCUMENT USE OPS
65. AddressState AddressZip Gender Username Password Email Balance BalanceDate Active AdminUser Note The BalanceDate stores the last date that the Customer s account balance was updated PAYMENT TYPES CustomerID PaymentID PaymentType PaymentInfo Note The Paymentinfo stores a credit card number or a balance limit depending on PaymentType PRODUCT CATEGORIES Category IDX Category PRODUCT SUB CATEGORIES Category IDX Sub Category IDX Category PRODUCTS ProductID Description cat subcat Manufacturer Price Taxable SaleStatus SalePrice Stock BASKETS BasketID CustomerID ProductArray LastModified Active Note The ProductArray will be a comma separated list of ProductIDs parsed by the application Active will indicate whether the basket is a current or past order DELIVERY_PEOPLE DriverlD RoutelD Name Address WorkHours Salary Vehicle Note The Vehicle field is assumed to be a Vehicle Number managed by a separate application DELIVERY_ROUTES RoutelD LowerRange UpperRange Price Note Routes are assumed to be based on distance ie a lt 1 mile radius a gt 1 and lt 2 mile radius etc ORDERS OrderlD CustomerlD BasketID PaymentID
66. BasePrice SorderInfoListRow SalesTax SorderInfoListRow DeliveryCharge t rue lt td gt td align center a href bills transactio nInfo BillNum html class mainlink target blank View Bill lt a gt lt td gt i td align center a href tickets transact lonInfo TicketNum html class main ink target blank 2View Tic ket a td td align center gt lt a href admin php page proce Ssorders amp act modifyorder amp orderID S orderInfoListRow OrderID cla ss mainlink gt Modify Order lt a gt lt td gt xy ppt echo table echo br echo div style font weight bold Processed Orders lt div gt echo lt style gt table outstandingOrders td font size 12px lt style gt echo lt table cellpadding 5 cellspacing 2 class outs tatndangOrders echo tr th align center gt ID lt th gt lt th gt Customer lt th gt lt th Delivery Date Time lt th gt lt th align center gt Total lt th gt lt th align cent er gt Bill lt th gt lt th align center gt Ticket lt th gt lt th align center gt Modify lt Es EE SorderInfoListResult mysql query SELECT FROM ORDE RS O WHERE SELECT T DateTimeDispatched FROM TRANSACTIONS T WHERE T Or derID O OrderID IS NOT NULL OR SELECT T AmountPaid FROM TRANSACTIO NS T WHERE T OrderID O OrderID IS NOT NULL ORDER BY O DeliveryDate DESC O OrderID DESC
67. ById key PaymentTypeDisplay Style display e WA document getElementById key PaymentType style display none document getElementById key PaymentInfo disabl ed true document getElementById key PaymentInfo style border none document editPaymentInfoForm PaymentID value key document editPaymentInfoForm PaymentType value doc ument getElementById key PaymentType value document editPaymentInfoForm PaymentInfo value doc ument getElementById key PaymentInfo value document editPaymentlInfoForm submit if document getElementById key 4 PaymentTypeDispla y object src gr edit gif j sf w y paymentTypesResult mysql query SELECT FROM PAYMENT TYP ES WHERE CustomerID SESSION userinfo CustomerID echo lt form method post name editPaymentInfoForm id edi tPaymentInfoForm echo table echo tr th align center gt ID lt th gt lt th gt Payment Type lt th gt lt th gt Credit Card Number Checking Account Limit lt th gt lt th align center gt Acti One th e vtr while paymentTypesRow mysql fetch assoc paymentTypesResu TE d echo tr td align center gt SpaymentTypesRow PaymentID lt td gt lt td gt lt input name paymentTypesRow PaymentID Payme ntTypeDisplay id paymentTypesRow PaymentID PaymentTypeDispla vi value Spaym
68. CMSC424 FALL 2010 Grocery Delivery Database Phase III Implementation and Testing Stephen Eskin Jeff Lasser 12 11 2010 Table of Contents 1 Environment and Requirement Analysis 3 1 1 Project Deser o o QE EE D a Bai KG 3 1 2 Phase d PULDOSE EE 3 1 3 Phase I PUFDOS u uuu Q u u u Paene Ee eae ideae vetere dea a dee edes 3 14 hiii NP ua 3 1 4 ASSUMPTIONS ungi al Gana aan all dee oet Gana 4 1 5 Technical Conceptual Problems and Solutions 5 1 5 1 Technical Problems erri enne enter ett ee ep erede erts AR 5 1 5 2 Conceptual ProbleMS ENEE 5 System Analysis and Specification 6 2 1 E ee UE 6 244 1 User ee E 6 2 1 2 Administrator Procedures rare 6 2 1 3 Developer POSA Mia 6 2 1 1 Server ee 6 2 2 DOCUMENT ATI O Mies eaters 7 2 2 1 Top Level Information Flow Diagram 7 2 2 2 Tasks Subtasks and Task Flow Diagrams 8 2 2 8 Documents and Document Forms nente nnne enne nnne nnns 26 L elle ee Re TEE 28 3 1 E R Model Graphical Schema c sn sagan adda a eet 28 Logical MoOd li 8 sasssa ska EEE KR a DA ed ses RN de BG A RA a a OEA 29 4 1 Logi
69. D 42 Page SundoInsertOrderResult mysql query undoInsertOr derQuery else Update Account Balance SupdateAccountBalanceQuery UPDATE CUSTOMERS SET Balance toMoney customerInfo Balance Ssubtotal taxSubtotal deliveryCost false BalanceDate CURDATE WHERE CustomerID S orderInfo CustomerID SupdateAccountBalanceResult mysql query SupdateA ccountBalanceQuery Update Product Stock SbasketItemsResult mysql query SELECT FROM BA SKETS WHERE CustomerID SorderInfo CustomerID AND BasketiID i Dorderlintol Basketrlbt rss SbasketItemsRow mysql fetch assoc basketItemsRe sult SbasketItems explode basketItemsRow Produc EATEray foreach basketltems as SbasketItemID SupdateProductStockResult mysql query UPDATE PRODUCTS SET Stock Stock 1 WHERE ProductID SbasketItemID SnumOrders if S debug echo date m d y H i s DEBUG St anding Order standingOrdersRow StandingOrderID successfully pl aced lt br gt if debug echo date m d y H i s DEBUG Place Order Ta Sk for Standing Order PPOST task complete lt u gt numOrders lt u gt orders were placed lt br gt break case RPT 3 Generate Delinquency Report if debug echo date m d y H i s DEBUG Generate Delin quency
70. D 1 products cat subcat randomID 1 randomSaleAmount false WHERE ProductID Sproducts cat_subcat randomID 0 mysql query updateQuery 118 Page Message customers who have purchased this product in the pa Sx SbasketSearchQuery SELECT CustomerID FROM BASKETS WHERE Pro ductArray LIKE amp S products cat subcat randomID 0 SbasketSearchResult mysql query SbasketSearchQuery while basketSearchRow mysql fetch assoc SbasketSearchResul t 1 ScustomersTo cts cat subcat S randomID 0 SnumProductsChanged numToSale foreach customersTol ScustomerInfoQuery SELECT customerID customerInfoResult mysql query customerInfoQ customerInfo message Dear rliInfo LastName ng items that you have purchased in the past n n FROM CUSTOM Email SbasketSearchRow CustomerID produ Email as customerID gt SproductArray ERE CustomerID uery mysql fetch assoc customerInfoResult De n nCheck out ScustomerInfo FirstName this week of the followi the sales foreach S productArray as productID Sproduc SoroductrD Sproduc Sproduc od uctInfo Prod la SALE PRICE toMoney produc tInfoQuery SELECT LinfokResult
71. D j SthisProductID 1 unset SbasketItems Skey SfutureStock SfutureStockAd 72 Page echo lt p class warning gt lt strong gt Warning lt stron g gt The product lt a href shop php cat SproductInfoRow cat amp subc at SproductInfoRow subcat SproductInfoRow ProductID tar get blank productInfoRow Description a N is out of stock and has been removed from your basket lt p gt if count outOfStock SupdateBasketItemsResult mysql guery UPDATE BAS KETS SET ProductArray trim implode basketltems Las tModified NOW WHERE CustomerID SESSION userinfo Custome rrIp AND Actaye Tits gt 1 0 subtotal 0 taxableSubtotal 0 if count basketltems echo h2 class h2 gt Basket Information lt h2 gt echo lt table cellpadding 1 cellspacing 2 style text align left margin left 75px width 600px gt echo tr th colspan 1 gt Item Description lt th gt lt th eolspans i a amp ligne center Pricec th tr foreach basketltems as productID productsResult mysql query SELECT FROM PRO DUCTS WHERE ProductID productID productRow mysql fetch assoc productsResult if i 2 color background color F3F3F3 else unset Scolor echo lt tr gt echo lt td style
72. Database Load Form 1 Generate and execute Product Customer and Delivery Driver insert queries 2 Generate and execute insert queries of baskets using a random number generator to generate M baskets with anything between 1 N number of items per basket spread over the different times of the day with a binormal distribution on time with peaks around noon and 6 pm None None DGEN Database Load PSCRAPE Product Scraper BINFO Basket Information TINFO DINFO eer B Transaction Delivery Person Safeway Website Information Information 12 Page TASK NUMBER TASK NAME PERFORMER PURPOSE ENABLING COND DESCRIPTION FREOUENCY DURATION IMPORTANCE MAXIMUM DELAY INPUT OUTPUT DOCUMENT USE OPS PERFORMED SUBTASKS ERROR COND PPOST Place Unplace Product on Sale System Places an item on sale and notifies customers removes a sale price from an item Products exist in Product Information PINFO It is time for a task in Background Process Information BPINFO to run specifically this PPOST task Weekly process that inputs a list of products to put on sale updates the price in Product Information PINFO and sends out a message to customers who have purchased the items in the past or removes a sale price from a product Weekly Short Medium 12 hours Product Sale List SALE Background Process Information BPINFO
73. De activated customer The Manage Users page allows administrators to activate or deactivate a customer A table is displayed with the ID Name Account Balance and Status of each account with a button to either Activate or Deactivate a user based on their current status Place Products on Sale Related Tasks amp Queries Place Product on Sale Product Query Every week a random selection of products needs to be put on sale after removing the sales from the previous week In addition to the automatic background task for this an Administrator is allowed to manually perform this task which updates the database to remove all of the current sales as well as selecting about 1096 of the products from each subcategory and assigning them a sale price of a random amount of 5 15 off Reports Related Tasks amp Queries Product Query Order Query Balance Query Customer Transactions The Reports section of the Administrator page allows Administrators to run one of three reports on data in the database Note that the Suggest Product report is integrated in the Add to Basket task and is displayed on the shop page as discussed above Average Basket Value This report creates a dynamic line graph that details the average value of a basket between every hour in three time periods today yesterday and last week The average is calculated by a complex query that adds up the total values of all of the baskets that fall into that hourly range
74. EGORIES WHERE CATEGORY IDX cat AS Ca tegory SELECT CATEGORY FROM PRODUCT SUB CATEGORIES WHERE CATEGORY ID X cat AND SUB CATEGORY IDX subeat AS SubCategory SELECT COUNT B asketID FROM BASKETS WHERE ProductArray LIKE ProductID AS Sales Pri ce SaleStatus FROM PRODUCTS ORDER BY Sales LIMIT 0 10 S worstProductsResult mysql query worstProductsQuery echo lt div style font weight bold margin bottom 10px margin top 20px fonte size l6px gt Worst Selling Products lt div gt echo lt table cellpadding 5 cellspacing 2 class outs tandingOrders echo tr th align center gt Product lt th gt lt th align cent er gt Price lt th gt lt th align center gt Sales lt th gt lt th align center gt Action lt houses while worstProducts mysql fetch assoc worstProductsR esult if i 2 color style background color F3F3F3 else unset color echo lt tr Socoloms5 echo lt td gt SworstProducts Description lt br gt lt spa n style font style italic font size llpx gt SworstProducts Category SworstProducts SubCategory lt span gt lt td gt echo lt td align right gt toMoney SworstProducts Pr iicet true lt td gt echo lt td align center gt SworstProducts Sales e pgs echo lt td align ce
75. EGORY IDX cat AS Cate gory SELECT CATEGORY FROM PRODUCT SUB CATEGORIES WHERE CATEGORY IDX cat AND SUB CATEGORY IDX subcat AS SubCategory SELECT COUNT Bas ketID FROM BASKETS WHERE ProductArray LIKE ProductID AS Sales Price SaleStatus FROM PRODUCTS ORDER BY Sales DESC LIMIT 0 10 topProductsResult mysql query topProductsQuery echo lt div style font weight bold margin bottom 10px font size l6px Best Selling Products lt div gt echo lt table cellpadding 5 cellspacing 2 class outs tandingOrders echo tr th align center gt Product lt th gt lt th align cent er gt Price lt th gt lt th align center gt Sales lt th gt lt tr gt while StopProducts mysql fetch assoc S topProductsResul El if i 2 color style background color F3F3F3 else unset color echo lt tr color echo td topProducts Description br span style font style italic font size llpx StopProducts Category 62 Page StopProducts SubCategory span td echo lt td align right toMoney topProducts Pric SA Me keep echo lt td aligns center topProducts Sales car echo eer echo lt table gt SworstProductsQuery SELECT ProductID Description S ELECT CATEGORY FROM PRODUCT CAT
76. EOUENCY DURATION IMPORTANCE MAKIMUM DELAY INPUT OUTPUT DOCUMENT USE OPS PERFORMED SUBTASKS ERROR COND RPT 4 Generate Suggest Product Report System Gather statistical information on average basket value Customers have been set up CST Database has been loaded DLT Background processes are running BPT Orders have been placed POT Customer has transaction history Generates a list of recommended products based on prior purchases Upon customer request Short Medium 1 minute Basket Information BINFO Product Information PINFO Suggest Product Report SPR SPRF Suggest Product Report Form 1 Generate query to search Product Information PINFO for items similar to the item just added to the basket 2 Execute query and receive results 3 Display results on basket page and suggest Customer adds recommended products to basket as well Add to Basket ABT None PINFO Product Information RPT SER Rua d Suggest Product P Report BINFO Basket Information 25 Page 2 2 8 Documents and Document Forms POF Place Order Form CMF Customer Message Form CustomerNum CustomerNum BasketID CustomerEmailResult DeliveryTime MessageContent Paymentinfo ORQ Order Query CustomerNum Orders OrderResult DeliveryTime PRO Product Query CustomerNum Category Manufacturer PriceRange LimitPriorPurchase ProductResult Barcode Description CPWF Customer Pas
77. HD 4ofbG2GGaPJOnEAUVtOg type text javascript gt lt script gt lt script type text javascript src js BpTspSolver js gt lt script gt lt script type text javascript src js tsp Js script lt script type text javascript src js date format js gt lt script gt lt script type text javascript gt furctuion ama ey f isDone false loadAtStart 37 4419 122 1419 8 addList implode n Saddresses directions 0 0 0 lt script gt lt div id map style display none lt dave lt div id exportData style display non e div 76 Page lt div id durationsData style display none gt lt div gt lt div id ordering style display none gt lt div gt dry ad my textual dav style display none gt lt div gt echo lt td id path Loading td input type hidden name DeliveryEstimate id DeliveryEstimate gt echo lt tr gt echo lt table gt echo h2 class h2 gt Billing Information lt h2 gt echo lt table width 100 gt echo lt tr gt lt td align top style font weight bold width 175 gt Payment Method lt td gt lt td gt lt select name PaymentID id PaymentID while paymentTypesRow mysql fetch assoc SpaymentTypesResult if SpaymentTypesRow PaymentType C redit Card echo lt option value SpaymentTypesRo w PaymentID
78. ID SESSION userinfo CustomerID 0 Y echo check ed 2 gt Active lt td gt tr 50 Page lt tr gt lt td gt lt input type radio name status value N lt if m ysql result mysql query SELECT Active FROM CUSTOMERS WHERE CustomerID SESSION userinfo CustomerID 0 N echo check ed 2 gt Inactive lt td gt lt tr gt Stt td colspan 2 align center input type submit name Confirm value Update Status td tr table lt form gt lt div gt lt div id footer gt lt php include kunden homepages 25 d123903211 htdocs eg roceries includes footer inc php gt lt div gt lt div gt lt body gt lt html gt Administrative Options admin php lt include kunden homepages 25 d123903211 htdocs egroceries includes Global ine php gt lt DOCTYPE html PUBLIC W3C DTD XHTML 1 0 Transitional EN http www w3 org TR xhtmll DT D xhtmll transitional dtd gt lt html xmlns http www w3 org 1999 xhtml lt head gt lt meta http equiv Content Type content text html charset utf 8 gt lt title gt eGroceries lt title gt lt link rel stylesheet href styles main css type text css gt lt head gt lt body onload init onunload GUnload gt lt div id frame gt lt
79. ProductArray trim implode SbasketItems ww echo lt tr gt lt td colspan 2 style text align center font styles italic font size llpx gt No items exist in your basket lt td gt lt tr gt lt table gt else StaxSubtotal 0 06 taxableSubtotal SdeliveryCost getDeliveryCost SorderInfo Custom 57 Page erID echo lt tr gt lt td colspan 2 style font weight bold text align right gt Subtotal toMoney SorderInfo BasePrice true lt td gt KUBA echo lt tr gt lt td colspan 2 style font weight bold text align right gt Sales Tax toMoney SorderInfo SalesTax true lt td gt cy ys echo lt tr gt lt td colspan 2 style font weight bold text align right gt Delivery Fee toMoney SorderInfo DeliveryCharge tru E lt tde lt 7 tro echo lt tr gt lt td colspan 2 style font weight bold text align right color 861E23 gt lt span style border top lpx solid 000 gt Grand Total toMoney SorderInfo BasePrice SorderInfo SalesTax SorderInfo DeliveryCharge true lt span gt eltdsetres echo table echo lt style gt td font size 12px lt style gt echo lt table width 100 cellpadding 0 cellspac ing 2 gt lt tr gt lt td width 50 valign top gt echo lt div style font weight bold margin bottom 10px font size l6px Delivery Information lt div gt echo
80. Report lt strong gt lt strong gt RPT 3 task found Running lt br gt SnumDisabled 0 balanceAmountThreshold 25 SbalanceDateTh reshold date Y m d time 7 24 60 60 SdelinquentCustomerQuery SELECT FROM CUSTOMERS WHERE Acti ve Y AND Balance lt balanceAmountThreshold AND BalanceDate lt ba lanceDateThreshold ORDER BY LastName FirstName if debug echo date m d y H i s DEBUG Checking for d elinquent customers with query SdelinquentCustomerQuery lt br gt delinquentCustomerResult mysql query delinquentCustomerQue ry while delinquentCustomer mysql fetch assoc delinquentCusto merResult if debug echo date m d y H i s DEBUG Delinquent C ustomer found delinquentCustomer LastName delinquentCusto mer FirstName delinquentCustomer CustomerID at toMone y SdelinquentCustomer Balance true since delinquentCustomer BalanceDate date m d y strtotime delinquentCustomer BalanceDate D ysUaskwaust er 43 Page Disable customer in the database mysql guery UPDATE CUSTOMERS SET Active N WHERE Custo merID SdelinquentCustomer CustomerID Message the customer delinquency notice messageCustomer delinquentCustomer CustomerID Attention delinquentCustomer FirstName delinquentCustomer Las tName nYour eGrocerie
81. S CATEGORY IDX ENGINE InnoDB 3 PRODUCTS CREATE TABLE PRODUCTS ProductID varchar 10 NOT NULL Description varchar 75 NOT NULL cat tinyint 2 NOT NULL subcat tinyint 2 NOT NULL anufacturer varchar 100 default NULL Price float NOT NULL Taxable tinyint 1 default NULL SaleStatus tinyint 1 default NULL SalePrice varchar 6 default NULL Stock int 4 default NULL RIMARY KEY ProductID EY cat cat EY subcat subcat ONSTRAINT PRODUCTS ibfk 1 FOREIGN KEY cat REFERENCES PRODUCT CATEGORIES CATEGORY IDX NGINE InnoDB 5 P K K C za BASKETS CREATE TABLE BASKETS BasketID int 11 NOT NULL auto increment CustomerID int 11 NOT NULL ProductArray varchar 2000 default NULL LastModified datetime NOT NULL Active tinyint 1 NOT NULL default 1 PRIMARY KEY BasketID KEY CustomerID CustomerID CONSTRAINT BASKETS ibfk 1 FOREIGN KEY CustomerID REFERENCES CUSTOMERS CustomerID NGINE InnoDB el CATEGORY IDX is a foreign key to the PRODUCT CATEGORIES table used in the SUBCATEGORY OF CATEGORY relation cat is a foreign key to the PRODUCT CATEGORIES table used in the PRODUCT OF CATEGORY relation subcat is a foreign key to the PRODUCT CATEGORIES
82. S orderInfoResults if SstandingOrderListRow Frequency 30 0 Sfrequency standingOrderListRow Frequency 30 Months 103 Page else if standingOrderListRow Frequency 7 0 Sfreguency standingOrderListRow Frequency 7 Weeks else Sfrequency standingOrderListRow Frequency Da ys if itt 2 color style background color F3F3F3 else unset color echo lt tr gt echo lt td align center Scolor gt standingOrderListRo w StandingOrderID td echo lt td align center Scolor gt date m d y strtot ime SstandingOrderListRow StartDate lt td gt echo lt td align center color date m d y strtot ime standingOrderListRow EndDate td echo lt td color Every frequency lt td gt echo lt td Scolor gt toMoney SorderInfoRow BasePrice SorderInfoRow SalesTax SorderInfoRow DeliveryCharge true ol echo lt td align center Scolor gt lt a class mainlink hr ef bills transactioninfo BillNum html target blank view Bill a td echo lt td align center Scolor gt SstandingOrderListR ow Active Yes No td echo lt td align center Scolor gt lt form method get lt input type hidden name orderID value st andingOrderListRow OrderID lt input type submit value Modify Standing Orde Fr gt l
83. SESSION userinfo AdminUser echo a href admin php style font weight bold gt Admin lt a gt echo a href logout php gt Log Out lt a gt else echo lt a href search php gt Search lt a gt a href signin php S ign In a a href register php gt Register lt a gt SS Page Navigation Include File nav inc php lt hl gt lt a href shop php class navheaderlink gt Shop By Aisle lt a gt lt hl gt opp echo lt ul class marin aisle gt catResult mysql query SELECT FROM PRODUCT CATEGORIES 120 Page while catRow mysql fetch assoc catResult if GET cat catRow CATEGORY IDX catStyle color D2905E border bottom 1px D2905E dashed else unset catStyle echo lt li gt lt a href shop php cat catRow CATEGORY IDX s tyle ScatStyle gt ScatRow CATEGORY lt a gt lt li gt if GET cat catRow CATEGORY IDX echo ul elass sub aisle subCatResult mysql query SELECT FROM PRODUCT SUB CAT EGORIES WHERE CATEGORY IDX ScatRow CATEGORY IDX while subCatRow mysql fetch assoc subCatResult if GET subcat subCatRow SUB CATEGORY IDX subCatStyle color 3A817C border bottom 1px 3A817C dashed else unset subCatStyle echo lt li gt lt a hret shop php eat ScatRow CATEGORY ID X amp subcat subCatRo
84. SalesTax SorderInfo DeliveryCharge true if SpaymentTypeDetailsRow PaymentType Credit Card SextraInfoHTML lt br gt lt table width 650 cellpadding 5 cellspacing 0 sty le border 1px solid 000 gt lt tr height 35 gt td style border right 1px solid 000 font weight bold width 80 align center gt Driver Tip lt td gt lt td style border right lpx solid 000 gt amp nbsp lt td gt td style border right 1px solid 000 font weight bold width 80 align center gt Signature lt td gt td width 50 gt amp nbsp lt td gt S EE lt table gt Shtml lt lt lt EOF lt DOCTYPE html PUBLIC W3C DTD XHTML 1 0 Transitional EN http www w3 org TR xhtmll DT D xhtmll transitional dtd lt html xmlns http www w3 org 1999 xhtml head meta http equiv Content Type content text html charset utf 112 Page gn gt lt title gt Bill Number SbillNum for Order ID SorderID lt title gt lt head gt lt body gt lt style type text css gt body margin family Verdana th background color border border right lt style gt lt table width 650 cellpadding 0 Sir lt g lt weight bold gt amp nbsp lt lt t SES lt left lt lt t SCE lt left lt ey SEES x left E gt lt jtea gt S td valign td valign td valign E gt
85. Short High 1 minute New Customer Request NCR Customer Information CINFO CIF Customer Information Form 1 Analyze data credit record offline assign delivery address to route compute distance 2 Inset data into Customer Information CINFO None If fields are missing customer address is outside of delivery range or if customer credit record returns unfavorable return error CDVAL Customer Data Validation we NCR Iden EA CINFO New Customer Customer Customer Reguest Nem Information 8 Page TASK NUMBER TASK NAME PERFORMER PURPOSE ENABLING COND DESCRIPTION FREOUENCY DURATION IMPORTANCE MAKIMUM DELAY INPUT OUTPUT DOCUMENT USE OPS PERFORMED SUBTASKS ERROR COND CDUT Customer Data Update Customer To allow customer to update profile data Customer exists in Customer Information CINFO Allows customers to update any profile information including address credit card etc May resultin need to recalculate distance or recheck credit record Infrequently Short High 1 minute Customer Info Update Request CIUR Customer Information CINFO Customer Information CINFO CIF Customer Information Form 1 Update information in Customer Information CINFO with new data 2 If needed rerun recalculate distance or recheck credit record None If fields are missing customer address is outside of delivery range or if customer credit record returns u
86. Staff Generate a variety of system reports Customers have been set up CST Database has been loaded DLT Background processes are running BPT Orders have been placed POT Orders have been fulfilled FOT Generates system reports on a variety of subjects including Average Basket Values Best Worst Sellers Delinquency Reports and Suggested Products based on data recorded by the program and generated either on a schedule or on demand see subtasks for more details See subtasks See subtasks See subtasks See subtasks Customer Information CINFO Product Information PINFO Order Information OINFO Transaction Information TINFO Background Process Information BPINFO Average Basket Value Report ABVR Best Worst Seller Report BWSR Delinquency Report DR Suggest Product Report SPR RRF Report Request Form See subtasks Generate Average Basket Value Report RPT 1 Generate Best Worst Seller Report RPT 2 Generate Delinquency Report RPT 3 Generate Suggest Product Report RPT 4 See subtasks ABVR Average Basket Value Report CINFO Customer Information BWSR Best Worst Seller PINFO Product Information Report RPT Reports DR Delinquency Report BPINFO Background Process Information SPR Suggest Product Report OINFO Order Information BINFO Basket Information TINFO Tra
87. State gt gt lt td gt lt tr gt lt tr height 30 gt lt td style font weight bold gt Address Zip lt td gt lt td gt lt input type text name AddressZip size 5 ma xlength 5 value lt SuserinfoRow AddressZip gt gt lt td gt lt tr gt lt tr height 30 gt lt td style font weight bold gt Gender lt td gt lt td gt lt select name Gender gt lt option lt if SuserinfoRow Ge nder Male echo selected selected gt gt Male lt option gt lt option lt if SuserinfoRow Gender Female echo selected selected gt gt Female lt option gt lt option lt if SuserinfoRow Gender Other echo selected selected gt gt Other lt option gt lt select gt lt td gt lt tr gt lt tr gt lt td colspan 2 align center gt lt h2 style text decoration underline font size 18px gt Account Information lt h2 gt lt td gt lt tr gt lt tr height 30 gt lt td style font weight bold gt Username lt td gt lt td style padding left 2px font size 12px gt lt SuserinfoRow Username gt lt td gt lt tr gt lt tr height 30 gt lt td style font weight bold gt Password lt td gt lt td gt lt input type button name ChangePassword value Change Password onClick window location changepass php gt lt td gt tr tr height 30 gt td style font weight bold gt Email Address lt
88. Swhere A OWER Description LIKE mysql real escape stri GET searchManufacturer Sand 1 searchPriceLow if Sand where AND gt mysql real escape string str replace riceLow Sand 1 searchPriceHigh if and where AND e lt mysql real escape string str replace PriceHigh Sand 1 tsQuery SELECT FROM PRODUCTS WHERE Swhere OR escription tsResult mysql query productsQuery _num rows SproductsResult tr td colspan 4 align center gt lt i gt No search re Spero roductRow mysql fetch assoc productsResult SSION userinfo amp amp GET searchPrevPurchased uctPrevBoughtQuery SELECT FROM BASKETS WHER SSION userinfo CustomerID AND ProductArr D ow ProductID uctPrevBoughtResult mysql query productPrevBou sql num rows productPrevBoughtResult tinue xo Ts http shop safeway com productimages 100x100 tID 100x100 jpg ImageSize image Display product image from sts otherwise missing image uct Image Simage uctImage gr missingProduct jpg td width 100 gt lt a name SproductRow ProductID roductImage gt lt td gt ductRow Manufacturer facturer SproductRow Manufacturer facturer Not Available td gt SproductRow Description lt br gt lt span styl
89. TimeRange osdr verrpNum S delDa UC Staxsub Y MW besten 4 TLT i Ssubtotal insertOrderQuery or lt strong gt Could not create or ja Ue pee pot s ql query SELECT MAX TicketNum FROM TRANSACTIONS rong gt Error lt strong gt Could not g Errori u mysgl error h ETE h ERE OrderID FROM ORDERS WH SundoInsertOrderResult mysql query undolnsertOrderQuery pet SundolnsertOrderQuery D S newOrderID else ticketBillNums mysql fe Create Dispatch Ticket SnewTicketNum SticketBil makeTicket newOrderID Create Bill SnewBillNum makeBill newOrderID SticketBillN teh assoc getTicketBillNumsResu lNums TicketNum 1 SnewTicketNum ums Balinum 1 newBillNum 125 Page Create Transaction Info if Scustip lt 15 SinsertTransactionInfoQuery INSERT INTO TRANSACTIONS 0 rderID TicketNum BillNum DateTimeOrdered VALUES newOrderID e newTicketNum SnewBillNum TH Stime ja else SinsertTransactionInfoQuery INSERT INTO TRANSACTIONS O rderID TicketNum BillNum DateTimeOrdered DateTimeDispatched DateT imeArrived DateTimeReturned DateTimePaid AmountPaid VALUES ne wOrderID newTicketNum newBillNum Stime time Stime Stines p T Stime
90. TypeDetailsRow SdelDay SdelDate SrandTime if randTime else if SrandTime else SdelTime 5pm SdriverIDQuery SEL 1 AND WorkHours SdriverIDResult SdriverIDNum t rand 1 7 a Xl 2010 12 S delDay mr xand 0 2 SdelTime Spm i delTime mysql res ID DeliveryDate style text align CE5C62 0 06 StaxableSubto INSERT INTO PAYMENT TYPES mysql query add mysql query S AND Paymen mysql fetch assoc paymentTypeDetailsResu SdelTime ECT DriverID FROM D mysql query driverIDQ ult S5driverIl SinsertOrderQuery INSERT INTO ORDERS right texte ogolor O0ut ot Stocke tdo tal deliveryCost 5 CustomerID Payment i Credzt Card o Sua TD Dr CO Pl ET PaymentQuery BCT PROM PAYMENT TYP patita Tje Dam lom ipm Som WH ERE ELIVERY PEOPL Route tn uery ult Op CustomerID BasketID DriverID BasePrice DRes Pay SalesTax liveryCharge VALUES Lo C IBgelTime gg l Y Speliverytcost s SinsertOrderResult mysql query S xfi mysaql error echo lt p class error gt lt strong gt Err br2MySQL Error u mysqi error else SnewOrderID mysql insert 1d SgetTicketBillNumsResult mys icketNum MAX BillNum AS BillNum LE mysql error 1 echo lt p class error st Te eege 2 Delivery
91. account lt p gt gt lt script type text javascript src http maps google com maps api js sensor false gt lt script gt lt div id map canvas style width 300px height 300px flo at right padding 2px border 1px solid ccc margin top 5px div lt script type text javascript gt var youraddresslatlong var geocoder new google maps Geocoder var lating new google maps LatLng 38 98989 76 936226 var myOptions mapTypeControl false mapTypeld google maps MapTypeld ROADMAP var map new google maps Map document getElementById map canvas myOptions var youraddressimage new google maps MarkerImage http www inatel br iwt components com docman themes default images icons 32x32 home png This marker is 20 pixels wide by 32 pixels tall new google maps Size 32 32 The origin for this image is 0 0 new google maps Point 0 0 The anchor for this image is the base of the flagpole at 0 32 new google maps Point 0 32 var address lt php echo userinfoRow AddressStreet SuserinfoRow AddressCity SuserinfoRow AddressState SuserinfoRow AddressZip gt geocoder geocode address address function results status if status google maps GeocoderStatus OK youraddresslatlong results 0 geometry location var marker new google maps Marker map map icon youraddressimage position resu
92. actionInfoListRow DateTimeDispatched echo lt td color date m d y g ia strtotime Stra nsactionInfoListRow DateTimeDispatched td else echo lt td Scolor gt N A lt td gt if transactionInfoListRow DateTimeArrived echo lt td color date m d y g ia strtotime Stra nsactionInfoListRow DateTimeArrived td else echo lt td Scolor gt N A lt td gt if transactionInfoListRow DateTimeReturned echo lt td Scolor gt date m d y g ia strtotime Stra nsactionInfoListRow DateTimeReturned td else echo lt td color N A td if StransactionInfoListRow DateTimePaid echo lt td color date m d y g ia strtotime tra nsactionInfoListRow DateTimePaid td else echo lt td Scolor gt N A lt td gt echo lt td Scolor gt toMoney SorderInfoRow BasePrice SorderInfoRow SalesTax SorderInfoRow DeliveryCharge true Ma if StransactionInfoListRow AmountPaid echo lt td color toMoney S transactionInfoListRow AmountPaid l ttue td else echo lt td Scolor gt 0 00 lt td gt echo efr echo lt table gt gt 107 Page div div id footer gt lt php include kunden homepages 25 d123903211 htdocs egroceri es includes footer inc php div div body html Report Data Output Page report data php
93. ailsRow PaymentType toMoney paymentTypeDetailsRow PaymentInfo true echo td sfero if StransactionInfo DateTimePaid echo lt tr gt lt td align top style text decoration underline padding bottom 10px gt Payment Recieved td td style padding bottom 10px toMoney transactionInfo AmountPaid true on date m d y g i a strtotime transactionInfo DateTimePaid Eds prt else echo tr td align top style text decoration underline padding bottom 10px gt Payment Recieved td td style padding bottoms 10px 50 00 td tr echo tr td align top style text decoration underline padding 101 Page bottom bottom 10px gt View Bill lt td gt lt td style pa ddzng l0px 2 a href bills StransactionInfo BillNum html arget blank olass mainlink View Bill a td te5 echo table echo lt tr gt lt table gt echo lt form method post size Ions style font t echo lt p gt lt strong gt Note lt strong gt Adding a standing order will create a recurring order that will be automatically charged to your specified Payment Method nged you will be charged the new price want to continue select a quency of orders below Yo If the prices of any item have cha Without notification starting and ending date u may return later to modify these op
94. align valign valign valign ftr SEA lt lt td Lo valign valign top top top top top top style font weigh class border gt style font weigh top gt Subtotal lt td gt align right gt s style font weigh class border SuserinfoRow AddressState Suserinfo bold gt amp nbsp lt td gt userinfoRow AddressStreet bold Payment Info td ubtotalj td bold gt amp nbsp lt td gt userinfoRow AddressCity Row AddressZip lt td gt alesTax lt td gt deliveryDate lt td gt eliveryFee lt td gt lt td valign top gt amp nbsp lt td gt lt td valign top gt Sales Tax lt td gt lt td valign top align right gt s ftr SEE lt td valign top style font weight bold gt Delivery Date lt td gt lt td valign top class border gt td valign top gt nbsp lt td gt td valign top gt Delivery Fee lt td gt lt td valign top align right gt d ey tu CES td valign top style font weight bold Delivery Time Range lt td gt lt td valign top class border gt Betw imeRange lt td gt lt td valign top style background lt td valign top style background color EEE gt Grand Total lt td gt td valign top align right sty color EEE gt total lt td gt LEEF lt table gt lt br gt lt table width 650 1
95. ame LastName SlastName Address Saddress Sex sex Age Sage Email email WHERE CustomerID customerID to update customer information Run query UPDATE PAYMENT TYPES SET PaymentType paymentType PaymentInfo paymentInfo WHERE CustomerID customerID to update current customer s payment information OR run query INSERT INTO PAYMENT TYPES CustomerID PaymentType PaymentInfo VALUES customerID paymentType SpaymentInfo to create new customer s payment information De activate Customer Run query UPDATE CUSTOMERS SET Active customerID to de activate customer ll o WHERE CustomerID Re activate Customer Run query UPDATE CUSTOMERS SET Active customerID to re activate customer ll p WHERE CustomerID 34 Page Database Load Parse input HTML from Safeway to create array of product information For each product in array Run query INSERT INTO PRODUCTS Description Category Manufacturer Supplier Price Taxable SaleStatus SalePrice Barcode Stock VALUES Sdescription category manufacturer supplier price taxable 0 NULL barcode stock to create new product For each randomly generated customer Run query INSERT INTO CUSTOMERS FirstName LastName Address Sex Age Email Active VALUES
96. ansactionInfoQuery UPDATE TRANSACTIONS SET DateTimeDispatched dateTimeDispatched DateTimeArrived dateTim Arrived DateTimeReturned dateTimeReturned DateTimePaid SdateTim ePaid amountPaid Comments mysql real escape string POST Comm ents WHERE OrderID GET orderID SupdateTransactionInfoResult sactionInfoQuery if mysgl error 1 echo lt p class error gt lt strong gt Error lt strong gt Could not update transaction information lt br gt MySQL Error lt u gt mysql error tefur pr stoMonevistr replace else if SamountPaid AmountPaid SuserBalanceResult mysql query SELECT CustomerI D Balance FROM CUSTOMERS WHERE CustomerID SELECT CustomerID FROM O RDERS WHERE OrderID GET orderID SuserBalanceRow mysql fetch assoc userBalanceRe sult SupdateAccountBalanceQuery UPDATE CUSTOMERS SET Balance toMoney userBalanceRow Balance toMoney str replac e POST AmountPaid false false BalanceDate CURDAT E WHERE CustomerID S userBalanceRow CustomerID SupdateAccountBalanceResult mysql query SupdateA ccountBalanceQuery if mysql error 1 echo lt p class error gt lt strong gt Error lt strong gt C ould not update customer balance lt
97. asketItemsRow ProductArr foreach SbasketItems as SbasketItemID SupdateProductStockResult mysql_query UPDATE PRODUC Steck 1 WHERE ProductID SbasketItemID 126 Page 64 Third Party Source Code Google Maps Traveling Salesman Problem Solver Geir K Engdahl 6 http code google com p google maps tsp solver Javascript Date Format Function Steven Levithan http blog stevenlevithan com archives date time format FusionCharts Interactive Flash amp JavaScript Charts FusionCharts Technologies LLP http www fusioncharts com Gaussian Random Number Distribution Chris Johnson http stackoverflow com questions 152115 gaussian distributions with php on a 24h time period 127 Page User Manual 7 1 Accessing eGroceries To access eGroceries you will first need an internet connected computer The address for the eGroceries website is http eGroceries antiemotion com and is best viewed in the Google Chrome or Mozilla Firefox web browser 7 2 Navigating eGroceries eGroceries has three basic sections including Shopping User Account Control and Administrator Options Each section represents a group of related functions webpages 7 2 1 Shopping Shop by Aisle Related Tasks amp Queries Product Query Category amp Subcategory Query Basket Update Query To shop aisle to aisle a primary aisle may be chosen from the last hand n
98. assoc SorderInfoList Result 1 StransactionInfoQuery SELECT FROM TRANSACTIONS WHER E OrderrD S SorderInfoListRow OrderrD S transactionInfoResults mysql query transactionInfoQu ery transactionInfo mysql fetch assoc transactionInfoRes ules SpaymentTypeDetailsResult mysql query SELECT FROM P AYMENT TYPES WHERE CustomerID SESSION userinfo CustomerID AND PaymentID S orderInfoListRow PaymentID paymentTypeDetailsRow mysql fetch assoc paymentTypeD etailsResult if i 2 Scolor style background color 4F3F3F3 else unset color echo lt tr onClick N window location pastorders php orde rID SorderInfoListRow OrderID style cursor pointer gt echo lt td align center Scolor gt SorderInfoListRow 0O rderrp amp btds if StransaetioniInfo BateTimeArrived echo lt td color date m d Y g i a strtotime tr ansactionInfo DateTimeArrived td else echo lt td color date m d Y strtotime 5orderInfo ListRow DeliveryDate SorderInfoListRow DeliveryTimeRange eu eae if SpaymentTypeDetailsRow PaymentType Credit Ca gat echo lt td Scolor gt SpaymentTypeDetailsRow PaymentTy pe substr paymentTypeDetailsRow PaymentInfo 4 td else echo lt td color paymentTypeDetailsRow PaymentTy pe toMoney Spaymen
99. avigation of any page on the site Alternatively the Shop By Aisle header is a link to a table based layout of graphical representations of the Aisles kindly provided by Safeway that also links to the same category page This category page is another breakdown of the products into common items such as Baby Accessories or Bacon into similar graphical representations again kindly provided by Safeway On the next page is the actual list of products for that aisle and category that displays a small image of the product provided once again by Safeway a product description manufacturer price and sale price if applicable as well as a link to add the product to the basket For simplicity to add more than one of the same item to the basket a Add Another to Basket link will appear on items already in the basket After adding a product to the basket a success message is displayed with a link to your basket if you are done shopping above an area where suggested products are printed in a row based on the manufacturer of the item added to the basket After choosing products or if an item is wished to be removed from the basket you must go to the View Basket page Search Related Tasks amp Queries Product Query Dynamic Search Query The search screen allows for simple product searching with the option of searching descriptions categories aisles manufacturers and price ranges You also have the option to hide all results that you
100. bit for day of w eek is not set do not run Check to see if this task runs this hour DISABLED FOR EXAMPLE StaskHours explode backgroundTasksRows Times Lf lin array date H S taskHours runTask false 77 If hour s not one of the hours task should run at do not run my Check to see if task has been run within past Requency of LastR an SlastRan strtotime backgroundTasksRows LastRan SnextRun SlastRan SbackgroundTasksRows Frequency 60 60 E if SnextRun gt time SrunTask false If next run time is in the future do not run if SxunTask if debug echo date m d y H i s DEBUG Task found Proc essID backgroundTasksRows ProcessID TaskID SbackgroundT asksRows TaskID Next Run date m d y h ia nextRun lt br gt runTask backgroundTasksRows TaskID debug mysql query UPDATE BACKGROUND PROCESSES SET LastRan NOW WHE RE ProcessID backgroundTasksRows ProcessID if debug echo date m d y H i s DEBUG Background process c 39 Page heck complete lt br gt function runTask task Sdebug switch Stask case PPOST Place Products on Sale if debug echo date m d y H i s DEBUG Place Products on Sale PPOST task found Running lt br gt numChanged unPlaceProductOnSaleTask if debug echo date m d y H i s DEBUG P
101. body gt lt html gt Sign In Page signin php lt include kunden homepages 25 d123903211 htdocs egroceries includes global inc php 7 gt lt DOCTYPE html PUBLIC W3C DTD XHTML 1 0 Transitional EN http www w3 org TR xhtmll DT D xhtmll transitional dtd gt lt html xmlns http www w3 org 1999 xhtml lt head gt meta http equiv Content Type content text html charset utf 8 gt lt title gt eGroceries lt title gt 95 Page lt link rel stylesheet href styles main css type text css lt head gt lt body gt lt div id frame gt lt div id header gt lt php include kunden homepages 25 d123903211 htdocs egroceri es includes header inc php gt lt div gt lt div id nav gt lt php include kunden homepages 25 d123903211 htdocs egroceri es includes nav inc php gt lt div gt lt div id content gt lt img src gr keyboard jpg style float right padding 2px border lpx solid ccc margin 5px gt hl style margin bottom 50px gt Sign In to eGroceries lt h1 gt lt php if SESSION userinfo echo lt p class error gt lt strong gt Error lt strong gt You are alrea dy logged in Please wait to be redirected lt p gt lt meta http equiv REFRESH content 0 url account php else Ef S POST signin if POST Username amp amp S POST Password
102. br gt MySQL Error u mysql error Wwe nep else echo lt p class success gt lt strong gt Success lt stron g gt Order transaction information has been updated lt p gt else echo lt p class success gt lt strong gt Success lt strong gt Order transaction information has been updated lt p gt echo lt div style font weight bold margin bottom 10px fonte size l6px Order f GET orderID Information lt div gt SorderInfoResult mysql_query SELECT FROM ORDERS WHE RE OrderlD GET orderiD z 56 Page SorderInfo mysql fetch assoc orderInfoResult if mysql num rows orderInfoResult echo lt p class error gt lt strong gt Error lt strong gt Invalid Order ID Please wait to be redirected lt p gt lt meta http equiv REFRESH content 0 url account php else SuserinfoResult mysql query SELECT FROM CUSTOMERS WHERE CustomerID Sorderlnfo CustomerlID s SuserinfoRow mysql fetch assoc userinfoResult StransactionInfoQuery SELECT FROM TRANSACTIONS WH ERE OrderID GET orderID transactionInfoResults mysql query transactionInf oQuery transactionInfo mysql fetch assoc transactionInfoR esults SbasketItemsResult mysql_query SELECT FROM BASKET S WHERE
103. cal SCHEMA etico deese jaa dai sto apa genera e degna doen uuo desee di denies a at ala 29 4 2 Data Definition Language u eee tee e etre i i e aet tene Dep bereitet 30 Task Su Ee EE 34 EN Task Design Spa ene oie ene teet Pee eene Sal ag a EA a aaa 34 Programi SOURCE CO AE RI m na E MEUM a 8 39 6 1 Primary Pag Code ui 39 6 2 Secondary Helper Page Code 110 6 3 One Time Database Population Scripts Source Code 121 6 4 Third Party Source Code ecce cte teo te tede NBA Aa tede ede eaa ee ud da PASE e TERRE ERES ARE 127 10 Usemi an au ua dE Ee Eet ATA E AA 128 FV ACCESSING CGOCEMES nk a a Gr 128 7 2 Navigating eGroceries iE e se el Slee ee on eee nls el Pee a 128 E Deele 128 7 2 2 User Account CODtrol AA Wadi saa 130 7 2 3 Administrator Options cete e RE ERR FIR AS RUE NERIS NE REESE Ee iss 132 Testing Et OEIS imber Drei eee ie n Deu 133 8 1 Tests Performed susunan unu kuma uma akuspa Poe ee eun Eee Reda pe katu ak 133 System Limitations amp Possibilities for Improvement 134 9 1 System Limitations ette a ENEE EES AAA 134 9 2 Possibilities for Improvement 134 Credits and Retere ces nana et emere eani na EE Y HUKU ER
104. cess lt strong gt Y our new POST PaymentType payment method has been added lt p gt elseif substr POST PaymentInfo 0 3 xxx SupdatePaymentQuery UPDATE PAYMENT TYPES SET PaymentT ype POST PaymentType PaymentInfo str replace r POST PaymentInfo WHERE CustomerID SESSION userinfo CustomerID AND PaymentID POST PaymentID SupdatePaymentResult mysql query updatePaymentQuery if mysql error echo lt p class error gt lt strong gt Error lt strong gt MySQL E rror mysql error e p s else echo lt p class success gt lt strong gt Success lt strong gt You r POST PaymentType payment method has been updated lt p gt 85 Page echo lt script language javascript type text javascript function editRow object key if document getElementById key PaymentInfo disab led true document getElementById key PaymentTypeDisplay Style display none document get Ej lementByld key PaymentType style display r document getElementById key PaymentInfo disabl ed false document getElementById key PaymentInfo style border object src gr save gif else if document getElementById key PaymentTypeDispla YA document getElement
105. ches 1 SdistancePriceQuery SELECT Price FROM DELIVERY ROUTES WHERE Low erRange lt Sdistance AND UpperRange gt distance distancePriceResult mysql query distancePriceQuery distancePriceRow mysql fetch assoc distancePriceResult return SdistancePriceRow Price Find the delivery route for a customers address function getDeliveryRoute customerID SuserAddressQuery SELECT AddressStreet AddressCity AddressSta te AddressZip FROM CUSTOMERS WHERE CustomerID customerID SuserAddressResult mysql query userAddressQuery SuserAddressRow mysql fetch assoc userAddressResult SuserAddress str replace 4 userAddressRow AddressStreet 1 SuserAddressRow AddressCity userAddressRow Add ressState SuserAddressRow AddressZip SwarehouseAddress 38 98989 76 936226 googleMapsAddress http maps google com maps q fromt wareho useAddress ttot userAddress soutput kml googleMapsXML file get contents googleMapsAddress Smatches array preg match Distance amp 160 i googleMapsXML matches Sdistance Smatches 1 distanceRouteQuery SELECT RouteID FROM DELIVERY ROUTES WHERE L owerRange lt Sdistance AND UpperRange gt Sdistance distanceRouteResult mysql query distanceRouteQuery distanceRouteRo
106. color productRow Descript ion me deem if prodactRow Stock gt 0 if S productRow SaleStatus echo lt td width 60 align right style c olor gt S SproductRow SalePrice lt td gt Ssubtotal Ssubtotal productRow SalePri ce if S productRow Taxable StaxableSubtotal StaxableSubtotal Spro ductRow SalePrice else echo lt td width 60 align right style c oler gt SproductRow Price lt td gt Ssubtotal Ssubtotal productRow Price if S productRow Taxable StaxableSubtotal taxableSubtotal Spro ductRow Price else echo lt td width 60 style text align right text decoration line through color CES5CGz S Scolor sQut of Stock lt td gt echo lt tr gt Sit 73 Page StaxSubtotal 0 06 taxableSubtotal deliveryCost getDeliveryCost SESSION userinf o Customerrb echo lt tr gt lt td colspan 2 style font weight bold text align right gt Subtotal toMoney subtotal true td tr echo lt tr gt lt td colspan 2 style font weight bold text align right gt Sales Tax toMoney StaxSubtotal true lt td gt lt tr gt echo lt tr gt lt td colspan 2 style font weight bold text align right gt Delivery Fee toMoney deliveryCost true lt td gt lt tr gt echo lt tr gt lt td colspan 2 style f
107. ct Information PINFO Basket Information BINFO Delivery Person Information DINFO Delivery Pricing Information DPINFO Order Information OINFO POF Place Order Form 1 Check the availability of the products in the basket return any errors 2 Calculate the total cost including delivery fees 3 Estimate the earliest possible delivery time from available delivery people 4 If the order is accepted activate the Fulfill Order subtask Fulfill Order FOT If any of the enabling conditions are not met return an error PCHECK Product Stock Check DTALG CINFO Delivery Time Customer Algorithm Information PINFO POR Product Information Place Order Request OINFO BINFO Order Information Basket Information DINFO DPINFO Delivery Person Delivery Pricing Information Information 17 Page TASK NUMBER TASK NAME PERFORMER PURPOSE ENABLING COND DESCRIPTION FREOUENCY DURATION IMPORTANCE MAKIMUM DELAY INPUT OUTPUT DOCUMENT USE OPS PERFORMED SUBTASKS ERROR COND FOT Fulfill Order System Fulfills a customer s order Valid order exists in Order Information OINFO Accepts order and generates dispatch ticket and bill records transaction information and dispatches delivery person Frequently Short Very high 1 minute Order Information OINFO Delivery Person Information DINFO Transacti
108. d gt lt input name searchPriceLow styl e width 80px value lt GET searchPriceLow gt gt to lt input n ame searchPriceHigh style width 80px value lt GET searchPri ceHigh gt lt td gt tr tr td colspan 2 gt Include Previously Purchased Items amp nbsp amp nbsp lt label for searchPrevPurchasedl gt lt input type radio na me searchPrevPurchased id searchPrevPurchasedl value 1 lt if G ET searchPrevPurchased GET searchPrevPurchased i echo checked checked gt gt Yes lt label gt amp nbsp lt label for searchPrevPurchased0 gt lt input type radio na me searchPrevPurchased id searchPrevPurchased0 value 0 lt if G ET searchPrevPurchased 0 echo checked checked gt gt No lt 1 abel gt lt td gt td colspan 2 align center gt lt input type submit name search value Search Products gt lt td gt lt tr gt lt table gt lt form gt lt php if GET search Display Products if SESSION userinfo SbasketItemsResult mysql_query SELECT FROM BASKETS WHERE CustomerID SESSION userinfo CustomerID AND Activ Bom A EUIS if mysql num rows basketItemsResult SbasketItemsRow mysql_fetch_assoc SbasketItemsResult SbasketItems explode SbasketItemsRow ProductArr ay ec
109. ding bottom I0px 220 00 7td tEro echo lt tr gt lt td align top style font weight bold gt View Bill lt td gt lt td gt lt a href bills S transactionInfo BillNum html target blank class mainlink gt View Bill Here lt a gt lt fed tr echo table echo lt t gt lt tables 7 gt lt div gt lt div id footer gt lt php include kunden homepages 25 d123903211 htdocs egroceri es includes footer inc php gt lt div gt lt div gt lt body gt lt html gt Customer Payment Methods paymentmethods php lt include kunden homepages 25 d123903211 htdocs egroceries includes global inc php gt lt DOCTYPE html PUBLIC W3C DTD XHTML 1 0 Transitional EN http www w3 org TR xhtmll DT D xhtmll transitional dtd gt lt html xmlns http www w3 org 1999 xhtml lt head gt meta http equiv Content Type content text html charset utf 8 gt lt title gt eGroceries lt title gt lt link rel stylesheet href styles main css type text css gt 84 Page lt head gt lt body gt lt div id frame gt lt div id header gt lt php include kunden homepages 25 d123903211 htdocs egroceri es includes header inc php gt lt div gt lt div id nav gt lt php include kunden homepages 25 d123903211 htdocs egroceri es includes nav inc php gt lt div gt lt div
110. directed lt p gt lt meta http equiv REFRESH content 0 url signin php gt else echo lt h2 class h2 gt Search Transaction History lt h2 gt echo lt form method get echo Start Date mm dd yy lt input type text name startD ate maxlength 8 size 8 value GET startDate amp nbsp amp nbs pr5nbsp echo End Date mm dd yy input type text name endDate maxlength 8 size 8 value GET endDate amp nbsp amp nbsp amp nbs p echo input type submit value Search Transactions echo form if GET startDate amp amp GET endDate startDate date Y m d strtotime GET startDate SendDate date Y m d strtotime GET endDate echo lt h2 class h2 gt Search Results lt h2 gt echo lt p gt Click on a row to visit the Past Orders detail pa ge in a new window lt p gt echo lt style gt td font size llpx lt style gt echo lt table cellpadding 5 cellspacing 2 gt echo tr th align center gt ID lt th gt lt th gt Ordered On lt th gt lt th gt Dispatched At th th Arrived At lt th gt lt th gt Returned At th th Paid On lt th gt lt th align center gt Total lt th gt lt th align center gt Paid lt th gt lt tr gt 3 97 StransactionInfoListQuery SELECT FROM TRANSACTIONS T WHERE DateTimeOrdered gt startDate OR DateTim
111. div id header gt lt php include kunden homepages 25 d123903211 htdocs eg roceries includes header inc php gt lt div gt lt div id nav gt lt php include kunden homepages 25 d123903211 htdocs eg roceries includes nav inc php gt lt div gt lt div id content gt lt hl gt eGroceries Administration lt hl gt lt php if SESSION userinfo echo lt p class error gt lt strong gt Error lt strong gt You are not 1 ogged in Please wait to be redirected lt p gt lt meta http equiv REFRESH content 0 url signin php gt else if SESSION userinfo AdminUser echo lt p class error gt lt strong gt Error lt strong gt You are not a uthorized to access this page lt p gt else 51 Page if GET page echo h2 class h2 gt Administrative Functions lt h2 gt echo lt p gt ul lt li gt lt a href admin php page manageusers Manage User s lt a gt lt li gt lt li gt lt a href admin php page placeproductonsale gt Plac e Products on Sale lt a gt lt li gt lt li gt lt a href admin php page processorders gt Process O rders a li lt li gt lt a href backgroundtasks php gt Simulate Backgroun d Tasks a li lt ul gt lt pe echo h2 class h2 gt Reports lt h2 gt echo lt p gt ul lt li gt lt a href admin php page reports amp report ABVR Ave rage Basket Valu
112. ductArray trim implode SbasketItems LastMod ified NOW WHERE BasketID SorderInfo BasketID StaxSubtotal 0 06 taxableSubtotal SdeliveryCost getDeliveryCost SorderInfo CustomerID Submit order SpaymentTypeDetailsResult mysql query SELECT FROM PAY 41 Page MENT TYPES WHERE CustomerID orderInfo CustomerID AND Payme ntID SorderInfo PaymentID SpaymentTypeDetailsRow mysql fetch assoc paymentTypeDet ailsResult if SpaymentTypeDetailsRow PaymentType Checking Acco unt E SpaymentTypeDetailsRow PaymentInfo lt customerInfo Balan ce Ssubtotal taxSubtotal SdeliveryCost date m d y H i s ERROR Account Balance will exc eed Checking Accounts Balance Order cancelled lt br gt else Create Order SinsertOrderQuery INSERT INTO ORDERS CustomerID Bas ketID PaymentID DeliveryDate DeliveryTimeRange DriverID BasePrice SalesTax DeliveryCharge VALUES orderInfo CustomerID SorderInfo BasketID SorderInfo PaymentID date Y me d SorderInfo DeliveryTimeRange driverID su btotal StaxSubtotal S deliveryCost SinsertOrderResult mysql query S insertOrderQuery Lf mysql error date m d y H i s ERROR Could not create order MySQL Error lt u gt mysq
113. ducts in basket lt br gt lt br gt 123 Page unset products unset prodQuery SprodQuery mysql_query SELECT ProductID FROM PRODUCTS ORDER BY BAND O mb rand 0 100 LIMIT enumProgducts z ys for j 0 j lt numProducts SIFF products mysql result prodQuery j SupdateBasketItemsResult mysql query UPDATE BASKETS SET Product Array trim implode products WHERE CustomerID custID AND Active 1 SbasketItemsResult mysql query SELECT FROM BASKETS WHERE Cust omerID custID AND Active 1 if mysql num rows basketItemsResult SbasketItemsRow mysql fetch assoc basketltemsResult SbasketItems explode SbasketItemsRow ProductArray SfutureStockAdj array SoutOfStock array foreach S basketItems as key gt S thisProductID productInfoResult mysql_query SELECT FROM PRODUCTS W HERE ProductID SthisProductID productInfoRow mysql fetch assoc productInfoResult if futureStockAdj thisProductID SfutureStockAdj SthisProductID futureStock productI nfoRowl Stock 1 else SfutureStockAdj S thisProductID futureStock S futureSt ockAdj S thisProductID 1 if SfutureStock lt 0 SoutOfStock thisProductID SfutureStockAdj SthisProductID futureStockAdj S thi
114. e POST DeliveryTimeRange POST rep Te is POST subtotal w o POST taxSubtotsl p OU POST deliveryCost Jg SinsertOrderResult mysql query insertOrderQuery Lf mysql error echo lt p class error gt lt strong gt Error lt strong gt Cou ld not create order lt br gt MySQL Error lt u gt mysql error lt u gt lt p gt else newOrderID mysql insert id getTicketBillNumsResult mysql query SELECT MAX TicketNum AS TicketNum MAX BillNum AS BillNum FROM TRANSACTIONS if mysql error echo lt p class error gt lt strong gt Error lt strong gt C ould not get new Ticket and Bill Numbers lt br gt MySQL Error u mysql _ error y efi pe SundoInsertOrderQuery DELETE FROM ORDERS WHER E OrderID newOrderID SundoInsertOrderResult mysql query undolnsert OrderQuery else ticketBillNums mysql fetch assoc getTicketBi llNumsResult Create Dispatch Ticket newTicketNum ticketBillNums TicketNum 1 makeTicket SnewOrderID newTicketNum Create Bill SnewBillNum SticketBillNums BillNum 1 makeBill newOrderID SnewBillNum Create Transaction Info SinsertTransactionInfoQuery INSERT INTO TRANS ACTIONS OrderID TicketNum BillNum DateTimeOrdered VALUES Snew OrderID newTicketNum newBillNum NOW
115. e 20 GET dTime lpm 5pm echo 13 if str replace 20 GET dTime 5pm 9pm echo 17 echo 7S echo lt select name DeliveryTimeRange i d 2 DeliveryTimeRange onChange javascript changeDateTimeRange opt ion value gt lt option gt if GET dDate date Y m d amp amp date H 12 GET dDate date Y m d echo lt option value 9am lpm str replace 20 GET dTime 2 9am lpm selected selected 9am lpm lt option gt if GET dDate date Y m d 66 date H lt 16 GET dDate date Y m d echo lt option value lpm 5pm str replace 20 GET dTime lpm 5pm selected selected 1pm 5pm lt option gt if GET dDate date Y m d amp amp date H 20 GET dDate date Y m d echo lt option value 5pm 9pm str replace 20 GET dTime 5pm 9pm selected selected 5pm 9pm lt option gt echo select echo td echo lt tr gt echo lt tr gt lt td valign top style font weight bold width 175 gt Estimated Arrival lt td gt if GET dDate GET dTime 75 Page echo lt td gt lt i gt Pick a Delivery Date and Time Range first i td else Saddresses array 38 98989 76 936226 Sdr
116. e Phase II of the project involves designing a conceptual schema E R data model along with a logical data model Relational Schema of the database We will also obtain the design and specification of the software which includes creating pseudocode of each task This is done at the same time as the design of the database schema to catch most of the errors before the implementation of the program 1 4 Phase III Purpose Phase lll of the project involves the implementation and testing of the application In this phase the conceptual schema and task design specifications are transformed into actual schema definitions DDL and application program modules program code After the database is created sample data is entered into the system for later testing After program coding is completed through testing is done using the sample data to ensure the application is working as desired This testing is documented in testing efforts and should include erroneous cases and how the system detects and handles these cases appropriately A user manual is then created to describe how to use the system appropriately Finally the system is analyzed for any limitations and possibilities for improvements are created to address these limitation 3 Page 14 Assumptions Parts of New Customer Setup Customer Data Update are assumed to be handled offline ie credit check username and password creation etc Actual billing of credit cards amp checks is outside
117. e font rer ductRow SaleStatus Smanufacturer lt span gt lt td gt 94 Page echo td width 60 gt lt span style text decoration line through gt SproductRow Price lt span gt lt br gt lt span style color FF8F20 font lt br gt toMoney S productRow SalePrice lt span gt Se else echo lt td width 60 gt toMoney S productRow Price weight bold gt SAL GI E BO if S productRow Stock gt 0 if in_array productRow ProductID basketItems SaddToBasketText Add Another lt br gt to Basket else SaddToBasketText Add to lt br gt Basket echo lt td width 70 style text align center gt form name form SproductRow ProductID meth od post lt input type hidden name productToAdd value prod ctRow ProductID lt input type hidden name productToAddDescripti oni value SproductRow Description gt a href javascript document form productRow ProductID submit class basketlink gt SaddToBasketText lt a gt form se else echo lt td width 70 style text align center text decoration line through color CE5C62 gt Out of lt br gt Stock lt td gt echo tr echo table H que div div id footer gt lt php include kunden homepages 25 d123903211 htdocs egroceri es includes footer inc php div div lt
118. e Report lt a gt lt li gt lt li gt lt a href admin php page reports amp report BWSR Bes t Worst Seller Report lt a gt lt li gt lt li gt lt a href admin php page reports amp report DR Delin quency Report lt a gt lt li gt lt ul gt x p gt else if GET page manageusers echo h2 class h2 gt Manage Users lt h2 gt if POST updateStatus ScustomerUpdateQuery UPDATE CUSTOMERS SET Active POST updateTo WHERE CustomerID POST updateID customerUpdateResult mysql query customerUpdateQuery if mysql error echo lt p class error gt lt strong gt Error lt strong gt MySQL pi Pror lt u gt mysql ertror u ps else echo lt p class success gt lt strong gt Success lt strong gt POST updateName s account has been POST updateTo Y a ctivated deactivated p echo lt table cellpadding 5 cellspacing 2 class outsta ndingOrders echo tr th align center gt ID lt th gt lt th gt Last Name lt th gt lt th gt First Name lt th gt lt th align center Account Balance lt th gt lt th align cente r gt Status lt th gt lt th align center gt Activate Deactive lt th gt lt tr gt SuserListResult mysql query SELECT FROM CUSTOMERS ORD ER BY LastName FirstName if mysql num rows userListResult echo lt tr gt lt td colspan 6 a
119. e order does not exist refuse the payment and return an error OINFO Order Information TINFO DTIX f B Transaction Dispatch Ticket K RPAYT Information Receive Payment BILL CINFO A Customer Bill X Information AENTER Administrator Entry 19 Page TASK NUMBER TASK NAME PERFORMER PURPOSE ENABLING COND DESCRIPTION FREOUENCY DURATION IMPORTANCE MAKIMUM DELAY INPUT OUTPUT DOCUMENT USE OPS PERFORMED SUBTASKS ERROR COND MCT Message Customer System Send a message to a customer The customer exists in Customer Information CINFO Sends a message to a customer for a variety of reasons including delinquency notice sale notice order placement etc Frequently Short Medium 1 minute Customer Information CINFO Optionally Product Information OINFO Order Information OINFO A message to a customer CMF Customer Message Form Send message parameter to customer parameter None If message send fails return error CINFO MCT OINFO customer HS Order Information Information Customer PINFO Product Information 20 Page TASK NUMBER TASK NAME PERFORMER PURPOSE ENABLING COND DESCRIPTION FREOUENCY DURATION IMPORTANCE MAKIMUM DELAY INPUT OUTPUT DOCUMENT USE OPS PERFORMED SUBTASKS ERROR COND RPT Reports System Administrative
120. eDispatched gt star tDate OR DateTimeArrived gt startDate OR DateTimeReturned gt sta 106 Page rtDate OR DateTimePaid gt SstartDate AND DateTimeOrdered lt Send Date OR DateTimeDispatched lt SendDate OR DateTimeArrived lt SendD ate OR DateTimeReturned lt SendDate OR DateTimePaid lt SendDate AND SELECT O CustomerID FROM ORDERS O WHERE O OrderID T OrderID SESSION userinfo CustomerID transactionInfoListResult mysql query transactionInfoL istQuery while transactionInfoListRow mysql fetch assoc transac tionInfoListResult SorderInfoQuery SELECT FROM ORDERS WHERE CustomerID SESSION userinfo CustomerID AND OrderID transac tionInfoListRow Orderip i SorderInfoResult mysql query orderInfoQuery SorderInfoRow mysql fetch assoc orderInfoResult if itt 2 Scolor style background color F3F3F3 else unset color echo lt tr onClick N window open pastorders php orderID S StransactionInfoListRow OrderID N style cursor pointer gt echo lt td align center color transactionInfoList Row OrderlID td if StransactionInfoListRow DateTimeOrdered echo lt td Scolor gt date m d y g ia strtotime tra nsactionInfoListRow DateTimeOrdered td else echo lt td Scolor gt N A lt td gt if Strans
121. entTypeDetailsRow PaymentInfo true echo lt td gt lt f eron if StransactionInfo DateTimePaid echo lt tr gt lt td align top style text decoration underline padding bottom 10px gt Payment Recieved td td style padding bottom 10px gt toMoney transactionInfo AmountPaid true on date m d y g i a strtotime transactionInfo DateTimePaid tax else echo tr td align top style text decoration underline padding bottom 10px gt Payment Recieved td td style padding bottoms TOpx 90 00 tO0 c tr echo lt tr gt lt td align top style text decoration underline padding bottom 10px gt View Bill lt td gt lt td style padding bottom 10px a href bills transactionInfo BillNum html t arget blank class mainlink gt View Bill lt a gt lt td gt lt tr gt echo lt tr gt lt td align top style text decoration underline gt View Ticket lt td gt lt td gt lt a href tickets Stran sactionInfo TicketNum html target blank class mainlink gt View Dispatch Ticket a td tr echo lt table gt echo tr table br echo div style font weight bold margin bottom 10px font size l6px Transaction Information lt div gt echo lt form method post echo lt table width 100 gt echo tret echo lt td style text 60 Page decoration unde
122. entTypesRow PaymentType disabled true style width 100 color 4000000 important text 86 Page decoration none border Opx background color fff gt select name paymentTypesRow PaymentID Paym entType id paymentTypesRow PaymentID PaymentType style wid th 100 color 000000 important text decoration none background color fff display none gt lt option value Credit Card paymentTy pesRow PaymentType Credit Card selected selected gt Cre dit Card lt option gt lt option value Checking Account SpaymentTypesRow PaymentType Checking Account selected selected gt Checki ng Account lt option gt lt select gt lt td gt lt td gt lt input name SpaymentTypesRow PaymentID Pay mentInfo id paymentTypesRow PaymentID PaymentInfo maxlength 16 value paymentTypesRow PaymentType Credit Card xxxx xxxxxxxx substr paymentTypesRow PaymentInfo 4 SpaymentTypesRow PaymentInfo disabled true style width 1 00 color 000000 important text decoration none border Opx background color fff gt lt td gt lt td align center gt lt img src gr edit gif alt Edit onclick javascript editRow this SpaymentTypesRow PaymentID style cursor pointer gt lt td gt lt A echo lt tr gt td align center gt NEW lt td gt lt
123. er ID lt th gt lt th gt Custome r Name lt th gt lt th gt Balance lt th gt lt th gt Delinquent Since lt th gt lt tr gt if mysql num rows delinquentCustomerResult echo lt tr gt lt td colspan 4 align center gt lt i gt No Delinqu ent Customers Found lt i gt lt td gt lt tr gt while S delinquentCustomer mysql fetch assoc delinquen tCustomerResult echo Tete echo lt td align center gt delinquentCustomer Cust Gmerrp fed echo td delinquentCustomer LastName de linquentCustomer FirstName td echo lt td gt toMoney SdelinquentCustomer Balance t rue Meta echo lt td gt SdelinquentCustomer BalanceDate date m d y strtotime delinquentCustomer BalanceDate always lt t a echo lt tr gt Disable customer in the database mysql query UPDATE CUSTOMERS SET Active N WHERE CustomerID delinquentCustomer CustomerID Message the customer delinquency notice messageCustomer delinquentCustomer CustomerID Att ention delinquentCustomer FirstName delinquentCustome r LastName nYour eGroceries has been deactivated due to an ous tanding balance of toMoney delinquentCustomer Balance true si nce SdelinquentCustomer BalanceDate date m d y strtotime deli nquentCustomer BalanceDate always Please contact an admini strator to reactivate your account echo table
124. er inc php gt lt div gt lt div id nav gt lt php include kunden homepages 25 d123903211 htdocs eg roceries includes nav inc php gt lt div gt lt div id content gt lt hl gt My eGroceries Account User Account Status lt hl gt lt php if SESSION userinfo echo lt p class error gt lt strong gt Error lt strong gt No user logge din Please wait to be redirected lt p gt lt meta http equiv REFRESH content 2 url signin php gt else if cPOST Confurm 4 SupdateQuery UPDATE CUSTOMERS SET Active POST s tatus WHERE CustomerrD 9 SESSION userintfo CustomerrD Y s y id SupdateResult mysql query SupdateQuery if mysql exter echo lt p class error gt lt strong gt Error lt strong gt MySQL Err ert lt ul mysql error a lt uS lt oe else echo lt p class success gt lt strong gt Success lt strong gt Your information has been updated lt p gt 2 gt lt form method POST style width 425px gt lt table style width 425px gt lt tr gt lt td colspan 2 align center gt lt h2 style text decoration underline font size 18px margin top Opx Account Status lt h2 gt lt td gt lt tr gt tr lt td gt lt input type radio name status value Y lt if m ysql result mysql query SELECT Active FROM CUSTOMERS WHERE Customer
125. erates a dynamically created update query to update the database The map displayed to the right is the graphical representation of the Google Maps API function to calculate the customers distance from the warehouse as described in Order Checkout The bottom section contains buttons that link to other pages as well as the result of the Balance Query for the customer which displays a negative balance if they have a pending order that has not yet been delivered and paid for or else SO Change Password Related Tasks amp Queries Customer Data Update The Change Password page simply allows a customer to change their account password by prompting for the current and new password as well as confirming the new password After confirming the old password is valid and the new password matches the confirmation the customer record in the database is updated with the new password 130 Page Manage Payment Methods Related Tasks 8 Queries Customer Data Update This page allows a customer to update or add a new payment method to their account To edit an existing entry click the edit icon in the action column next to the entry to change The textboxes will then activate and allow customers to update the payment details note that credit card numbers are censored on display and will only be updated if a valid 16 digit number is entered For simplicity it is assumed that a customer sends a voided check to eGroceries with checking account informa
126. firstName SlastName Saddress sex Sage Semail 1 to create new random customer Run query INSERT INTO PAYMENT TYPES CustomerID PaymentType PaymentInfo VALUES ScustomerID SpaymentType SpaymentInfo create new random customer s payment information For each randomly generated delivery driver Run query INSERT INTO DELIVERY PEOPLE RouteID Name Address WorkHours Salary Vehicle CostPerMile VALUES SrouteID Sname Saddress workHours salary vehicleNumber costPerMile to create new random delivery driver SN rand SM rand For Si 0 to SM do SproductArray array For Sj 0 to SN do SproductArray random Product ID Run query INSERT INTO BASKETS CustomerID ProductArray LastModified VALUES SrandomCustomerID productArray randomDateTime to create new basket to Message Customer Run query SELECT Email FROM CUSTOMERS WHERE CustomerID customerID to get current customer email address Generate and send email to customer email with message Smessage Add to Basket If CustomerID or ProductID are invalid then exit and return error Run query SELECT BasketID ProductArray FROM Baskets WHERE CustomerID customerID to get current Basket ID If BasketID exists SupdatedProductArray SproductArray SnewProductID Run query UPDATE Baskets SET ProductArray SupdatedProduc
127. ge 30 value lt POST AddressStreet gt gt lt td gt lt tr gt lt tr gt td style font weight bold gt Address City lt td gt lt td gt lt input type text name AddressCity size 30 value lt POST AddressCity gt gt lt td gt lt tr gt lt tr gt lt td style font weight bold gt Address State Code lt td gt lt td gt lt input type text name AddressState size 2 maxlength 2 value lt POST AddressState gt gt lt td gt lt tr gt lt tr gt lt td style font weight bold gt Address Zip lt td gt lt td gt lt input type text name AddressZip size 5 maxlength 5 value lt POST AddressZip gt gt lt td gt lt tr gt lt tr gt lt td style font weight bold gt Gender lt td gt lt td gt lt select name Gender gt lt option lt if POST Gender Male ec ho selected selected gt gt Male lt option gt lt option lt if POST Gender Female echo selected selected gt gt Female lt option gt lt option lt if POST Gender Other cho selected selected gt gt Other lt option gt lt select gt lt td gt lt tr gt lt tr gt td colspan 2 align center gt lt h2 style text decoration underline font size 18px gt Account Information lt h2 gt lt td gt lt tr gt lt tr gt lt td style font weight bold gt Username lt td gt
128. gistration page is the first stop for new customers To begin a customer will enter their personal information as well as pick a username and password stored as an MD5 hash in the database to access the system All fields are required and an error message will display at the top is any question is left blank The system will also check that the username is unique before completing registration After submission of the form a new customer record is created from the supplied information with a default balance of 0 and a status of active Note that to make the user an Administrator the database entry must be manually updated to mark the user as an AdminUser After the entry has been created the customer is redirected to the Sign In page User Sign In Related Tasks amp Queries Customer Login The User Sign In page consist of simply a username and password prompt that checks for an existing username and MD5 hash of the provided password in the database and if valid assigns the user a session that stores the users account information for easy access updated every page load After authentication a customer is redirected to the My Account page My Account Related Tasks amp Queries Customer Data Update Balance Query The My Account page is both a customer information update section as well as a navigation area for common customer actions discussed below The top section is a simplified version of the registration page which gen
129. h2 gt lt table style width 425px gt lt tr gt lt td style font weight bold gt Current Password lt td gt lt td gt lt input type password name C urrentPW size 30 value td lt tr gt lt tr gt lt td style font weight bold gt New Password lt td gt lt td gt lt input type password name N ewPW size 30 value gt lt td gt lt tr gt lt tr gt lt td style font weight bold gt Confirm New Password lt td gt lt td gt lt input type password name C onfirmPW size 30 value gt lt td gt lt tr gt lt tr gt lt td colspan 2 align center gt nbsp lt td gt lt tr gt lt tr gt lt td colspan 2 align center gt lt inpu t type submit name changePW value Submit gt lt td gt lt tr gt lt table gt lt form gt lt div gt lt div id footer gt lt php include kunden homepages 25 d123903211 htdocs egroceri es includes footer inc php gt lt div gt lt div gt lt body gt lt html gt Checkout Page checkout php lt include kunden homepages 25 d123903211 htdocs egroceries includes lglobal inc php 22 lt DOCTYPE html PUBLIC W3C DTD XHTML 1 0 Transitional EN http www w3 org TR xhtmll DT D xhtmll transitional dtd gt 69 Page lt html xmlns http www w3 org 1999 xhtml lt head gt lt meta http equiv Content Type content text html charset utf 8 gt
130. have purchased in the past The search query is built dynamically from these fields and supports partial searches for descriptions and manufacturers Products are then displayed in the same manner as on aisle category pages as described above View Basket Related Tasks amp Queries Product Query Basket Update Query Although the View Basket page looks very similar to the category page of an aisle the links have been changed to Remove from Basket and a subtotal of the base cost of the products is displayed at the bottom of the table After verifying all of the products you may click the Checkout Now button at the bottom of the page 128 Page Checkout Related Tasks 8 Queries Order Placement Order Fulfillment Product Query Order Query The checkout page again mimics the View Basket page but now with a simplified view of just product description and price and also includes sales tax delivery fee as well as a grand total If any items in your basket are out of stock or your order would decrease the stock to below 0 the item will be removed from your basket and a warning message will be displayed The delivery fee is calculated by querying the database for your address and then plotting the position along with the position of the warehouse the CSI building on a Google Maps instance controlled by the Google Maps API This is then used to calculate the distance and assign the address to a delivery route based on mile radius
131. heckout you may click the Confirm Check button at the bottom of the page Note if an account is listed as inactive disabled in the database a customer is NOT allowed to complete a checkout and will immediately be displayed an error to contact an administrator to reactivate their account At this point a new order is entered into the database that links the basket you have approved the payment method chosen delivery date amp time range driver of the route as base sale delivery totals to your CustomerID and is given a unique OrderlD Then a new ticket and bill are created and stored in plain HTML on the server as an html file This will ensure that individual product prices are saved for later display and will generate the printed ticket a driver will use to deliver the goods to the customer These ticket and bill numbers as well as the date and time of the order placement are tied to an OrderlD and stored in a transactions table in the database Next the balance of the customer is decremented by the grand total of the order and the basket is marked as inactive in the database to allow the customer to create a new basket yet to save the list of products for future queries Finally the stock of the product is decremented in the database and the customer is redirected to the Order History page for their newly placed order 129 Page 7 2 2 User Account Control Register New User Related Tasks 8 Queries Customer Setup The re
132. ho eh oglass h2 S8earch Besubts h2 if POST productToAdd if SESSION userinfo SitemQuantityResult mysql query SELECT FROM PRODU CTS WHERE ProductID POST productIcoAdg z SitemQuantityRow mysql fetch assoc itemQuantityResu Lt if SitemQuantityRow Stock gt 0 SbasketItems POST productToAdd if mysql_num_rows basketItemsResult SupdateBasketItemsResult mysql_query UPDATE BAS KETS SET ProductArray trim implode S basketItems WHER E CustomerID SESSION userinfo CustomerID AND Active 92 Page ua else ScreateBasketItemsResult mysql query INSERT INT O BASKETS CustomerID ProductArray LastModified Active VALUES SESSION userinfo CustomerID implode basketItems NOW 1 suggestions array similarlItemIDs array similarltemsResult mysql_query SELECT ProductID FROM PRODUCTS WHERE LOWER Manufacturer LIKE strtolower itemQuant ityRow Manufacturer while similarltemsRow mysql fetch assoc similarI temsResult SsimilarItemIDs similarItemsRow ProductID for i 0 1 5 Sake SrandomID similarItemIDs rand 0 count similarI temIDs 1 similarlItemDetailsResult mysql_query SELECT ca t subcat Description FROM PRODUCTS
133. istRow BasePrice SorderInfoListRow SalesTax SorderInfoListRow DeliveryCharge t Hue efa td align center gt lt a href bills Stransactio nInfo BillNum html class mainlink target blank gt View Bill lt a se i td align center gt lt a href tickets Stransact ionInfo TicketNum html class mainlink target blank gt View Tic ket lt a gt lt td gt td align center gt lt a href admin php page proce Ssorders amp act modifyorder amp orderID S orderInfoListRow OrderID cla ss mainlink gt Modify Order lt a gt lt td gt rero echo lt table gt else if GG GET act modifyorder 44 _GET orderID D d if POST updateorder if 5 eDispatched da eDispatched date Y m d His s strtotime _ imeDispatched else da eDispatched NULL if D eArrived da d Heiss streotime gt else da AE Arrived date Y m eArrived Arrived NULL eReturned 55 Page SdateTimeReturned date Y m d H i s strtotime POST DateTimeReturned else SdateTimeReturned NULL if POST DateTimePaid SdateTimePaid date Y m d H i s strtotime POST DateTimePaid else SdateTimePaid NULL if POST AmountPaid SamountPaid AmountPaid sv um POST AmountPsid Talse U s else SamountPaid SupdateTr
134. iverIDQuery SELECT DriverID FROM DEL IVERY PEOPLE WHERE RouteID getDeliv ryRoute SESSION userinfo CustomerID AND WorkHours str replace 20 GET dTi Me y ee SdriverIDResult mysql_query SdriverIDQue ry driverIDRow mysql fetch assoc driverID Result SdriverID driverIDRow DriverID echo lt input type hidden name driverID value SdriverID gt SexistingOrdersResult mysql query SELEC T FROM ORDERS WHERE DeliveryDate GET dDate AND Delivery TimeRange str replace 20 GET dTime AND DriverID S5drzverriD ORDER BY OrderrD while existingOrdersRow mysql fetch as soc SexistingOrdersResult SuserinfoResult mysql query SELECT FROM CUSTOMERS WHERE CustomerID SexistingOrdersRow CustomerID LESE SuserinfoRow mysql fetch assoc userin foResult Saddresses userinfoRow AddressStre et SuserinfoRow AddressCity SuserinfoRow Addres sState SuserinfoRow AddressZip addresses SESSION userinfo Addr essStreet SESSION userinfo AddressCity SE SSION userinfo AddressState SESSION userinfo Addr essZip echo lt script src http maps google com maps file api amp amp v 2 amp amp key ABOTAAAAt 43n15i060a0U bD 8028xOZrun2bISZn4KqMWt44f5SUkl1G xTVx44
135. kets WHERE startRange lt LastModified AND SendRange gt LastModified Insert basketID s from query into Sbaskets For each basketID in Sbaskets Get SproductArray Run query SELECT productArray FROM Baskets WHERE BasketID basketID SbasketID For each SproductID in SproductArray add value to sum SELECT price FROM products WHERE productID SproductID Divide Ssum by number of baskets Display average value and graph Generate Best Worst Seller Report Find orders in last week SELECT OrderID BasketID FROM Orders WHERE DeliveryTime gt Snow lweek For each basketID For each productID Add to SproductsSold Sort products sold by quantity Run query SELECT productID FROM Products GROUP BY Category For each Category sort find lowest number of products sold lowest value indices in array Of these select SnumToPutOnSale Find highest number of products sold from each category highest valued indices in array Display best and worst selling products Display SnumToPutOnSale of lowest selling products as recommendation for sale items Generate Delinquency Report Run query SELECT CustomerID FROM Customers WHERE balance gt 0 AND balanceDate lt maximumDormant to get delinquent customerlD s For each customerlD Use Message Customer MCT task to send message Call De activate Cus
136. l error u br else newOrderID mysql insert id getTicketBillNumsResult mysql_query SELECT MAX Tic ketNum AS TicketNum MAX BillNum AS BillNum FROM TRANSACTIONS if mysql error 4 date m d y H i s ERROR Could not get new Ti cket and Bill Numbers MySQL Error lt u gt mysql error u br SundoInsertOrderQuery DELETE FROM ORDERS WHERE Or derID newOrderID SundoInsertOrderResult mysql query undoInsertOrde rQuery else ticketBillNums mysql fetch assoc getTicketBillNu msResult Create Dispatch Ticket SnewTicketNum ticketBillNums TicketNum 1 makeTicket newOrderID newTicketNum Create Bill SnewBillNum SticketBillNums BillNum 1 makeBill newOrderID newBillNum Create Transaction Info SinsertTransactionInfoQuery INSERT INTO TRANSACTI ONS OrderID StandingOrderID TicketNum BillNum DateTimeOrdered VA LUES newOrderID standingOrdersRow StandingOrderID newTicketNum newBillNum NOW SinsertTransactionInfoResult mysql query insertTr ansactionInfoQuery if mysql error 1 date m d y H i s ERROR Could not create t ransaction information MySQL Error u mysql error u br SundoInsertOrderQuery DELETE FROM ORDERS WHERE OrderrD newOrderl
137. lace Products on Sale PPOST task complete lt u gt SnumChanged lt u gt products were place d on sale br break case POT Place Order Task for Standing Order numOrders 0 if debug echo date m d y H i s DEBUG Place Order Ta sk for Standing Order POT task found Runmuing br standingOrdersQuery SELECT FROM STANDING ORDERS WHERE Ac tive 1 AND StartDate lt NOW AND EndDate gt NOW if debug echo date m d y H i s DEBUG Checking for s cheduled standing orders with query SstandingOrdersQuery lt br gt standingOrdersResult mysql query standingOrdersQuery while standingOrdersRow mysql fetch assoc standingOrdersRe sgult Look at the last order placed for this standing order to see if it is time to submit another order SorderTransactionHistoryQuery SELECT DateTimeOrdered FROM TRANSACTIONS WHERE StandingOrderID standingOrdersRow StandingO rderID ORDER BY DateTimeOrdered DESC LIMIT 1 SorderTransactionHistoryResult mysql query orderTransacti onHistoryQuery SorderTransactionHistory mysql fetch assoc orderTransacti onHistoryResult if strtotime SorderTransactionHistory DateTimeOrdered SstandingOrdersRow Frequency 24 60 60 lt time SorderInfoResult mysql query SELECT FROM ORDERS WHERE OrderID S
138. lations rather than just by manufacturer The script to estimate delivery time could be further tuned to use the estimated arrival time of the delivery driver to the customers address vs the upper bound of the estimated time of the driver returning to the warehouse More administrator options could be added such as manually updating customer information managing product information manually placing a product on sale etc Support for the case where a customer does not pay for the entire price of an order or the case where items are not found satisfactory and money is given back to the customer 134 Page 10 Credits and References 10 1 System Credits The eGroceries system was created and coded by Stephen Eskin and Jeff Lasser All PHP HTML Javascript code unless otherwise noted and database queries are originally created The script used to scrape Safeway s site and populate the database was created and run by Stephen while the rest of the database load script was created and run by Jeff Database design was a cooperative effort between Stephen and Jeff and the majority of product code was contributed by Stephen with parts of the User Account Control and Administrative Options contributed by Jeff The project phase reports were created and maintained by both Stephen and Jeff and both did research required to create the reports Certain scripts used such as for mapping and delivery estimates are open sourced algorithms integrated in
139. le width 145px transactionInfo AmountPaid di sabled true value StransactionInfo AmountPaid toMoney StramnsasctionlInfo AmountPaid false t gt lt td gt echo lt tr gt gt echo lt tr gt echo lt td style text decoration underline valign top gt Comments lt td gt lt td colspan 3 gt lt te xtarea name Comments style width 513px rows 3 gt StransactionInf o Comments textarea td echo lt tr gt echo lt tr gt lt td colspan 4 align center gt lt input type submit name updateorder value Update Transaction Information r style margin top l0px td tr echo lt table gt echo form else if GET page reports if GET report echo h2 class h2 gt Reports lt h2 gt echo lt p gt ud lt li gt lt a href admin php page reports amp report ABVR A verage Basket Value Report lt a gt lt li gt lt li gt lt a href admin php page reports report BWSR gt B est Worst Seller Report lt a gt lt li gt lt li gt lt a href admin php page reports report DR gt Del inquency Report lt a gt lt li gt lt ul gt 61 Page lt p gt else if GET report ABVR echo h2 class h2 gt Average Basket Value Report lt h2 gt echo lt script language javascript src includes fusio neherste FustonOharts 8 2 7 8G0PXDE echo lt div id char
140. lign center gt lt i gt No Customers Found 124 taks Er while userListRow mysql fetch assoc userListResult if itt 2 Scolor style background color F3F3F3 else unset color echo lt tr color gt td align center gt SuserListRow CustomerID lt t d lt td gt SuserListRow LastName lt td gt 52 Page td S userListRow FirstName td td toMoney userListRow Balance true sinc e SuserListRow BalanceDate date m d y strtotime SuserListRow BalanceDate always td td align center gt SuserListRow Active Y A Cctive Inactive c tgd td align center gt form method post lt input type hidden name updateID value Su serListRow CustomerID gt lt input type hidden name updateName value SuserListRow FirstName SuserListRow LastName gt lt input type hidden name updateTo value userListRow Active J Y N y gt lt input type submit name updateStatus value SuserListRBow Actiye Y Deactivate User Activate User lt form gt lt td gt xfer echo lt table gt else if _GET page placeproductonsale echo h2 class h2 Place Products on Sale lt h2 gt if POSTI confirm 1 runPlaceProductOnSaleTask echo lt p class success gt lt strong gt Success
141. lt strong gt A new batch of products have been put on sale p else echo lt form method post style text align center gt Warning This will remove all current sales and plac e about 10 of the products br in each subcategory on sale for a rand om amount of 5 15 off br Do you wish to continue br br lt input type submit name confirm value Yes Plac e products on sale now gt lt forms else if GET page processorders echo h2 class h2 gt Process Orders lt h2 gt if GET act echo div style font weight bold Outstanding Orders lt div gt echo lt style gt table outstandingOrders td font size 12px lt style gt echo lt table cellpadding 5 cellspacing 2 class outs tandingOrders echo tr th align center gt ID lt th gt lt th gt Customer lt th gt lt th Delivery Date Time lt th gt lt th align center gt Total lt th gt lt th align cent er gt Bill lt th gt lt th align center gt Ticket lt th gt lt th align center gt Modify lt Ens EET SorderInfoListResult mysql query SELECT FROM ORD RS O WHERE SELECT T DateTimeDispatched FROM TRANSACTIONS T WHERE T Or derID O OrderID IS NULL OR SELECT T AmountPaid FROM TRANSACTIONS T WHERE T OrderID O OrderID IS NULL ORDER BY O DeliveryDate DESC O OrderrD DESC GI if mysql num
142. lt table width 100 gt echo lt tr gt lt td valign top style text decoration underline padding bottom 10px width 150 gt Deliver To lt td gt lt td style padding bottom 10px gt SuserinfoRow LastName SuserinfoRow FirstName ID S userinfoRow CustomerID br userinfoRow AddressSt reet br S userinfoRow AddressCity S userinfoRow AddressS tate SuserinfoRow AddressZip lt td gt siero echo lt tr gt td align top style text decoration underline padding bottom 10px gt Delivery Date lt td gt lt td style padding bottom 10px date l F jS strtotime SorderInfo DeliveryDate select td e EE echo lt tr gt td align top style text decoration underline padding bottom 10px gt Delivery Time Range lt td gt lt td sStyle padding bottom 10px echo lt input type hidden name DeliveryTim eRange24 id DeliveryTimeRange24 value if SorderInfo DeliveryTimeRange 9am lpm echo 09 if SorderInfo DeliveryTimeRange 1pm Spm echo 13 if SorderInfo DeliveryTimeRange 5pm Spm echo l7 echo WA puts 58 Page echo SorderInfo DeliveryTimeRange lt td gt siero echo lt tr gt rf S transactionInfo BateTimeArrived 1 echo lt td valign top style text decoration underline width 150 gt Delivery Date Time lt td gt td da
143. lts 0 geometry location title Your Address II var youraddressinfowindow new google maps InfoWindow content Your Address Size new google maps Size 10 10 google maps event addListener marker click functio youraddressinfowindow open map marker I var latlngbounds new google maps LatLngBounds latlngbounds extend youraddresslatlong 46 Page latlngbounds extend latlng map setCenter latlngbounds getCenter map fitBounds latlngbounds else alert Geocode was not successful for the following reas on status var warehouseimage new google maps MarkerImage http www erply com images warehouse 32x32 png This marker is 20 pixels wide by 32 pixels tall new google maps Size 32 32 The origin for this image is 0 0 new google maps Point 0 0 The anchor for this image is the base of the flagpole at 0 32 new google maps Point 0 32 var warehouseMarker new google maps Marker map map icon warehouseimage position lating title eGroceries Warehouse var warehouseinfowindow new google maps InfoWindow content eGroceries Warehouse Size new google maps Size 10 10 google maps event addListener warehouseMarker click function warehouseinfowindow open map warehouseMarker script lt p gt lt form method POST style width 425px gt lt table style width 425px gt l
144. nclude kunden homepages 25 d123903211 htdocs egroceri es includes footer inc php gt lt div gt lt div gt lt body gt lt html gt Customer Change Password Page changepass php lt include kunden homepages 25 d123903211 htdocs egroceries includes qlobal ince php 2 gt lt DOCTYPE html PUBLIC W3C DTD XHTML 1 0 Transitional EN http www w3 org TR xhtmll DT D xhtmll transitional dtd html xmlns http www w3 org 1999 xhtml lt head gt meta http equiv Content Type content text html charset utf 8 lt title gt eGroceries lt title gt lt link rel stylesheet href styles main css type text css lt head gt lt body gt lt div id frame gt 67 Page lt div id header gt lt php include kunden homepages 25 d123903211 htdocs egroceri es includes header inc php gt lt div gt lt div id nav gt lt php include kunden homepages 25 d123903211 htdocs egrocer ies includes nav inc php gt lt div gt lt div id content gt lt hl gt My eGroceries Account Change assword lt hl gt lt php if SESSION userinfo echo lt p class error gt lt strong gt Error lt strong gt You are not 1 ogged in Please wait to be redirected lt p gt lt meta http equiv REFRESH content 0 url signin php else SvalidCurrPW true confirmMatch false SnotBlank false if POST
145. ndingOrder rj updateStandingOrderQuery UPDATE STANDING ORDER S SET Frequency frequency StartDate date Y m d strtotime POST StartDate EndDate date Y m d strtotime POST EndDate Active POST Active 1 0 WHERE StandingOrderID POST existingStandingOrder updateStandingOrderResult mysql query updateSt andingOrderQuery if mysql error msg lt p class error gt lt strong gt Error lt strong gt MySQL Erfor lt u gt mysql error u p SupdateTransactionsQuery UPDATE TRANSACTIONS SET StandingOrderID mysql insert id WHERE OrderID GE Ti orderi 9 s SupdateTransactionsResult mysql_query updateT ransactionsQuery msg lt p class success strong Success str ong gt Your standing order has been added lt p gt else SaddStandingOrderQuery INSERT INTO STANDING ORD ERS OrderID Frequency StartDate EndDate Active VALUES GETI orderID S frequency date Y m d strtotime POST StartDate gate Y m 98 Page d strtotime s POST bndDate AA SA Wa KK DT a f DH SaddStandingOrderResult mysql query addStanding OrderQuery Li mysql exrer y Smsg lt p class error gt lt strong gt Error lt s
146. nfavorable return error CDVAL Customer Data Validation CDUT CIUR CINFO Customer Customer Info Customer Data Update Request Information Update 9 Page TASK NUMBER TASK NAME PERFORMER PURPOSE ENABLING COND DESCRIPTION FREOUENCY DURATION IMPORTANCE MAKIMUM DELAY INPUT OUTPUT DOCUMENT USE OPS PERFORMED SUBTASKS ERROR COND DCT De activate Customer Customer Administrative Staff or System De activate customer record but not delete from system Customer exists in Customer Information CINFO Customer is not already de activated Marks a customer as inactive in the database either by Administrative action if the customer is delinquent for some period of time or customer decision Infrequently Short Low 1 day Customer Info Update Request CIUR or Administrator Options Page AOP Customer Information CINFO CSF Customer Status Form Update Customer Information to set ACTIVE FALSE None If customer is already de activated return error CIUR Customer Info Update Request DCT CINFO De activate 4 Customer Customer Information AOP Administrator Options Page BPINFO Background Process Information 10 Page TASK NUMBER TASK NAME PERFORMER PURPOSE ENABLING COND DESCRIPTION FREOUENCY DURATION IMPORTANCE MAKIMUM DELAY INPUT OUTPUT DOCUMENT USE OPS
147. nfoRow Addre sszip etg lt tr gt 100 Page echo tr td align top style text decoration underline padding bottom 10px gt Delivery Date td td style padding bottom 10px date l F jS strtotime orderInfo DeliveryDate select td lt J ero echo lt tr gt td align top style text decoration underline padding bottom 10px gt Delivery Time Range lt td gt td style padding bottom 10px gt echo lt input type hidden name DeliveryTimeR ange24 id DeliveryTimeRange24 value if SorderInfo DeliveryTimeRange 9am lpm echo 09 if SorderInfo DeliveryTimeRange lpm 5pm echo 13 if SorderInfo DeliveryTimeRange 5pm spm echo T17 echo Z gt echo SorderInfo DeliveryTimeRange lt td gt echo table echo td td width 50 valign top gt echo lt div style font weight bold margin bottom 10px font size l6px oBilling informationc div echo lt table width 100 gt echo lt tr gt lt td align top style text decoration underline padding bottom 10px width 150 gt Payment Method lt td gt td style padding bottom 10px7 gt if SpaymentTypeDetailsRow PaymentType Credit Card echo SpaymentTypeDetailsRow PaymentType substr paymentTypeDetailsRow PaymentInfo 4 else echo SpaymentTypeDet
148. nsaction Information 21 Page TASK NUMBER TASK NAME PERFORMER PURPOSE ENABLING COND DESCRIPTION FREOUENCY DURATION IMPORTANCE MAXIMUM DELAY INPUT OUTPUT DOCUMENT USE OPS PERFORMED SUBTASKS ERROR COND RPT 1 Generate Average Basket Value Report Administrative Staff Gather statistical information on average basket value Customers have been set up CST Database has been loaded DLT Background processes are running BPT Orders have been placed POT Generates a report on demand detailing the average basket value at a range of times from hours to days to weeks and etc This report will display each days hourly average or each weeks daily average etc On demand by Administrative Staff Medium Very high 1 minute Basket Information BINFO Average Basket Value Report ABVR ABVRF Average Basket Value Form 1 Request time frame to report 2 Generate and execute query to average basket value for given time interval 3 Display results in report form including graph of hourly daily intervals None If no baskets have been created return error GRAPH External Graph Generator ABVR Average Basket Value Report BINFO RPT Basket Information Reports 22 Page TASK NUMBER TASK NAME PERFORMER PURPOSE ENABLING COND DESCRIPTION FREOUENCY DURATION IMPORTANCE MAKIMUM DELAY INPUT OUTPUT DOCUMENT USE OPS PERFORMED SUBT
149. nter gt lt form method post gt lt input type hidden name updateID value worstProducts ProductID lt input type hidden name updatePrice value o SworstProdgucts Price 7 lt input type hidden name updateName value l worstProducts Description 7 lt input type submit name setOnSale value S et On Sale gt lt br gt lt input type submit name deleteItem value Remove Product gt lt form gt g edo echo lt tr gt echo lt table gt else if GET report DR echo h2 class h2 Delinquency Report lt h2 gt SbalanceAmountThreshold 25 balanceDateThreshold da te Yemeg time 7 24 G0 60 63 Page echo lt p gt Delinguent Customers are customers who have an account balance exceeding toMoney balanceAmountThreshold since date m d y strtotime balanceDateThreshold or earlier A delinq uency notice has been emailed to each customer and their account has b een deactivated p delinquentCustomerQuery SELECT FROM CUSTOMERS WHER Active Y AND Balance balanceAmountThreshold AND BalanceDate SbalanceDateThreshold ORDER BY LastName FirstName delinquentCustomerResult mysql query delinquentCusto Ih al merQuery echo lt table cellpadding 5 cellspacing 2 class outs tandingOrders echo tr th align center gt Custom
150. omerID SESSION userinfo CustomerID AND PaymentID S orderInfoListRow PaymentID paymentTypeDetailsRow mysql fetch assoc paymentTypeD etailsResult if itt 2 Scolor style background color F3F3F3 else unset color echo str echo lt td align center color orderInfoListRow O rderrp efeg if StransactionInfo DateTimeArrived echo td color date m d Y est a strtotime str ansactaionlnfo BDateTimeArrived l s td else echo lt td Scolor date m d Y strtotime 5orderIlInfo ListRow DeliveryDate SorderInfoListRow DeliveryTimeRange lt td gt if SpaymentTypeDetailsRow PaymentType Credit Ca pl echo lt td color paymentTypeDetailsRow PaymentTy pe substr paymentTypeDetailsRow PaymentInfo 4 td else echo lt td color paymentTypeDetailsRow PaymentTy pe toMoney paymentTypeDetailsRow PaymentInfo true td echo lt td color toMoney S orderInfoListRow BasePri ce SorderInfoListRow SalesTax orderInfoListRow DeliveryChar ge true td echo lt td align center Scolor gt lt a class mainlink hr efs pills transactionInfo BillNum html target blank view Bill a td echo lt td align center color form method get lt input type hidden name orderID value or derInfoListRow OrderID lt input type submit
151. on Information TINFO Dispatch Ticket DTIX Bill BILL internal 1 Generate a dispatch ticket and a bill 2 Determine who will deliver the order and when 3 Generate and execute insert statement for generated documents in Transaction Information TINFO None If the order does not exist return an error OINFO Order Information SEE Transaction Information DTIX DINFO p Dispatch Ticket Delivery Person FOT Fulfill Order Information BILL Bill TGEN Dispatch Ticket Generator BGEN Bill Generator 18 Page TASK NUMBER TASK NAME PERFORMER PURPOSE ENABLING COND DESCRIPTION FREOUENCY DURATION IMPORTANCE MAKIMUM DELAY INPUT OUTPUT DOCUMENT USE OPS PERFORMED SUBTASKS ERROR COND RPAYT Receive Payment System Updates customer account balance amp transaction log Order exists in Order Information OINFO A payment is received from a customer and his her account balance and the transaction log are updated accordingly Also records and comments from customer on dispatch ticket Frequently Varies Very high Varies Bill BILL Dispatch Ticket DTIX Order Information OINFO Transaction Information TINFO internal 1 Generate and execute update query on customers account balance 2 Generate and execute insert statement for transaction in Transaction Information TINFO None If th
152. ont weight bold text align right color 861E23 gt lt span style border top lpx solid 000 gt Grand Total toMoney subtotal StaxSubtotal SdeliveryCost true lt span gt lt td gt lt tr gt echo lt table gt echo lt script gt function changeDateTimeRange if document getElementById DeliveryTimeRang e window location checkout php dDate document getElementById DeliveryDate value amp dTime document g etElementById DeliveryTimeRange value amp pID document getEleme ntById PaymentID value else window location checkout php dDate document getElementById DeliveryDate value amp pID document get ElementById PaymentID value lt script gt echo lt form method post gt echo lt input type hidden name BasketID value SbasketItemsRow BasketID echo lt input type hidden name subtotal value toMoney subtotal false gt echo lt input type hidden name taxSubtotal valu e toMoney taxSubtotal false gt echo lt input type hidden name deliveryCost val ue toMoney deliveryCost false gt echo lt h2 class h2 gt Delivery Information lt h2 gt echo lt table width 100 gt echo lt tr gt lt td valign top style font weight bold padding bottom 10px width 175 gt Deliver To lt td gt lt td style padding bottom 10px
153. orm method POST style width 450px gt lt table style width 450px gt lt tr gt lt td style font weight bold align right gt Username lt td gt td input type text name Username size 20 s tyle width 150px td lt tr gt lt tr gt lt td style font weight bold align right gt Password lt td gt lt td gt lt input type password name Password size 2 0 style width 150px gt lt td gt lt tr gt lt tr gt td colspan 2 align center gt nbsp lt td gt lt tr gt lt tr gt lt td colspan 2 align center gt lt input type submit name signin value Sign In gt lt td gt tr table form lt p gt lt php 2 div lt div id footer gt lt php include kunden homepages 25 d123903211 htdocs egroceri es includes footer inc php div div lt body gt lt html gt Standing Orders standingorders php lt include kunden homepages 25 d123903211 htdocs egroceries includes global ime pha T gt lt DOCTYPE html PUBLIC W3C DTD XHTML 1 0 Transitional EN http www w3 org TR xhtmll DT D xhtmll transitional dtd gt lt html xmlns http www w3 org 1999 xhtml lt head gt meta http equiv Content Type content text html charset utf 8 gt lt title gt eGroceries lt title gt lt link rel stylesheet href styles main css type text css gt lt head gt lt body gt
154. px solid 000 gt lt tr gt lt th colspan 4 gt Driver Information lt th gt lt tr gt lt tr height 35 gt cellpadding 5 cel style border right n SorderInfo DeliveryT I TE s la E gt gnbsp lt td gt le background lspacing 0 style border ipx solid 000 border lpx solid 000 width 50 gt lt strong gt Driver lt strong gt SdriverIn td style font weight bold border lpx solid 000 width 27 gt Date Time Dispatched lt td gt style border ipx solid 000 gt amp nbsp lt td gt td style font weight bold border width 25 gt Date Time Arrived lt td gt style border 1px solid 000 gt snbsp lt td gt td style font weight bold border width 27 gt Date Time Returned lt td gt lt td colspan 2 bottom fo lt td gt lt right 1px solid 000 border bottom td width 23 bottom Er tr height 35 gt right Ipx solid 000 lt td width 25 right lt right lpx solid 000 td width 23 gt nbsp lt td gt 117 Page lt tr gt lt table gt lt br gt lt table width 650 cellpadding 3 cellspacing 0 style border 1px solid 000 gt STI th align left gt Product Description lt th gt lt th colspan 2 align 2 rgight Pricec th lt tr gt SproductHTML lt table gt aie fe lt table width 650 cellpadding 5 cellspacing 0 style border
155. rID AND T DateTimeOrdered BETWEEN date Y m 108 Page d Hei s mktime Si 0 0 AND date Y m d Hsiss mktime 141 Q0 0 AS BES ShourSumResult mysql query hourSumQuery hourSum mysql fetch assoc hourSumResult echo lt set value hourSum Average str replace toMoney ShourSum Average false 0 gt lt dataset gt dataset seriesName Yesterday color 00B454 anchorBorderColor 00B454 anchorRadius 4 gt lt for en Oy Sa 2145 Sith 4d ShourSumQuery SELECT SUM BasePrice COUNT OrderID AS A verage FROM SELECT DISTINCT O OrderID O BasePrice O SalesTax O Del iveryCharge FROM ORDERS O TRANSACTIONS T WHERE O OrderID T OrderID AND T DateTimeOrdered BETWEEN date Y m d Kast mktime r O0 0 date n date j Lat AND T date Y m d Hiits mktime Si 1 U 0 date sm date q L AS RES hourSumResult mysql query hourSumQuery ShourSum mysql fetch assoc hourSumResult echo lt set value hourSum Average str replace toMoney ShourSum Average false 0 lt dataset gt lt dataset seriesName Last Week color 086CA2 anchorBorderColor 086CA2 anchorRadius 4 lt for si Of i lt 24 Sixt
156. requency StartDate SstartDate EndDate SendDate Active SActive WHERE StandingOrderID standingOrderID Else insert new record Run query INSERT INTO Standing Orders OrderID Frequency StartDate EndDate Active VALUES SorderID frequency SstartDate SendDate Sactive 36 Page Place Order If CustomerID or BasketiD is invalid exit with error Get customer balance SELECT Balance FROM Customers WHERE CustomerID ScustomerID Set SproductArray Result of query SELECT ProductArray from Baskets WHERE BasketID SbasketID For each productID in SproductArray Check stock Run query SELECT stock FROM Products where ProductID SproductID If insufficient stock remove from array and generate error message Update product array associated with order Run query UPDATE Baskets SET ProductArray productArray WHERE BasketID SbasketID Get address associated with customer SELECT Address FROM Customers WHERE CustomerID ScustomerID Calculate distance based on address to find Srange Get SroutelD and SdeliveryCost SELECT RouteID Cost FROM Delivery Routes WHERE Range Srange Find SdriverlD for route Run query SELECT driverID FROM Delivery People WHERE routeID SrouteID ij If no available driver exit with error Calculate SsalesTax 06 SbasePrice
157. rline width 150 gt Driver lt td gt lt td gt SdriverInfo lt td gt echo lt td style text decoration underline width 150 gt Date Time Dispatched lt td gt lt td gt lt inp ut type text name DateTimeDispatched style width 145px value transactionInfo DateTimeDispatched date m d Y g i a strtotime StransactionInfo DateTimeDispatched td echo lt tr gt echo takes echo lt td style text decoration underline gt Date Time Arrived td td input type text name DateTimeArrived style width 145px value transactionInfo DateTimeArrived date m d Y g i ai strtotime transactionInfo Da teTimeArfrived z gt lt tdpt echo lt td style text decoration underline gt Date Time Returned lt td gt lt td gt lt input type text name DateTimeReturned style width 145px value StransactionIn fo DateTimeReturned date m d Y g i ai strtotime transactionInfo DateTimeReturned gt lt td gt echo lt tr gt echo lt td style text decoration underline gt Date Time Paid lt td gt lt td gt lt input type text nam e DateTimePaid style width 145px value StransactionInfo Date TimePaid date m d Y g i ai strtotime transactionInfo DateTimePai qp se TP vosmet echo lt td style text decoration underline gt Amount Paid lt td gt lt td gt lt input type text name AmountPaid sty
158. roductsResult products productRow cat SproductRow i 0 SproductHTML foreach Sproducts as Scat gt Sarray if i 2 color background color EEE else unset Scolor SproductHTML lt tr gt lt td style font weight bold color colspan 4 gt Scat lt td gt lt tr gt foreach Sarray as Srow if i 2 color background color EEE else unset Scolor SproductHTML lt tr gt lt td style Scolor gt amp nbsp nbsp amp nbsp Sr ow Description td td style Scolor align right gt Srow Sale Status SALE td td style color align right width 50 gt to Money row SalePrice true amp nbsp td td style color align ri ght width 50 gt toMoney row Price true td tr if SpaymentTypeDetailsRow PaymentType Credit Card paymentInfo paymentTypeDetailsRow PaymentType substr SpaymentTypeDetailsRow PaymentInfo 4 else SpaymentInfo paymentTypeDetailsRow PaymentType toMone y SpaymentTypeDetailsRow PaymentInfo true SdeliveryDate date 1l F jS strtotime SorderInfo DeliveryDate 1337 subtotal toMoney SorderInfo BasePrice true SsalesTax toMoney SorderInfo SalesTax true SdeliveryFee toMoney orderInfo DeliveryCharge true Stotal toMoney SorderInfo BasePrice SorderInfo
159. rows SorderInfoListResult echo lt tr gt lt td colspan 7 align center gt lt i gt No Outst 53 Page anding Orders Found lt i gt lt td gt lt tr gt while SorderInfoListRow mysql fetch assoc orderInfo ListResult SuserinfoResult mysql_query SELECT FROM CUSTOME RS WHERE CustomerID SorderlintoListhRow CustomerrDb z ys SuserinfoRow mysql fetch assoc userinfoResult StransactionInfoQuery SELECT FROM TRANSACTIONS WHERE OrderlD fw SorderinioListRow OrderibD jT m transactionInfoResults mysql query transactionIn foQuery transactionInfo mysql fetch assoc transactionInf oResults SpaymentTypeDetailsResult mysql query SELECT FR OM PAYMENT TYPES WHERE CustomerID orderInfoListRow CustomerID AND PaymentID S orderInfoListRow PaymentID paymentTypeDetailsRow mysql fetch assoc paymentT ypeDetailsResult 1f Si 2 Scolor style background color F3F3F3 else unset color echo lt tr Scolor gt lt td align center gt SorderInfoListRow OrderID ef a lt td gt SuserinfoRow LastName SuserinfoRow FirstName ID SorderInfoListRow CustomerID lt td gt lt td gt date m d Y strtotime SorderInfoListRow DeliveryDate SorderInfoListRow DeliveryTimeRange lt td gt td toMoney orderInfoListRow
160. rue amp nbsp td td style color align ri ght width 50 gt toMoney row Price true td tr if SpaymentTypeDetailsRow PaymentType Credit Card paymentInfo paymentTypeDetailsRow PaymentType substr SpaymentTypeDetailsRow PaymentInfo 4 else SpaymentInfo paymentTypeDetailsRow PaymentType toMone y SpaymentTypeDetailsRow PaymentInfo true SdeliveryDate date l F jS strtotime S orderInfo DeliveryDate 1329 Ssubtotal toMoney orderInfo BasePrice true SsalesTax toMoney SorderInfo SalesTax true SdeliveryFee toMoney S orderInfo DeliveryCharge true Stotal toMoney SorderInfo BasePrice SorderInfo SalesTax SorderInfo DeliveryCharge true Shtml lt lt lt EOF lt DOCTYPE html PUBLIC 115 Page W3C DTD XHTML 1 0 Transitional EN http www w3 org TR xhtmll DT D xhtmll transitional dtd lt html xmlns http www w3 org 1999 xhtml lt head gt meta http equiv Content Type content text html charset utf 8 f lt title gt Ticket Number ticketNum for Order ID SorderID lt title gt head body lt style type text css gt body margin Opx padding 5px font family Verdana Geneva sans serif font size 12px th background color ccc border bottom lpx solid 000 border border right lpx solid 000 lt style gt lt table width 650 cellpadding 0
161. ry service Solution Research various existing services to thoroughly understand the requirements Problem Design was overly complicated and impossible to model given constraints Solution Created additional assumptions to simplify design Problem Delinquent customers need to be deactivated after a certain period of time but still need to be able to access the site in order to view their balance Solution Create a field in the database Active which when set to false will disallow a customer from placing an order but will still allow them to login to the site 5 Page System Analysis and Specification 2 1 Procedures The grocery delivery system will provide a web interface that allows a customer to browse products select products to purchase and create orders The system will process the order to dispatch a driver to the designated location 2 1 1 User Procedures The user will visit the main web page of the grocery system From there he can utilize the web interface to create orders or initiate queries based on prior transactions The queries will be formulated into MySQL commands in order to communicate with the MySQL backend database The results from the MySQL queries will then be formatted appropriately for display to the user in the web browser 2 1 2 Administrator Procedures The administrators will first find the source of product information from preexisting grocery websites to be used as the basis for the inventory in
162. s a foreign key to the ORDERS table used in the STANDING ORDER OF ORDER relation OrderlD is a foreign key to the ORDERS table used in the TRANSACTION FOR ORDER relation M StandingOrderlD is a foreign key to the STANDING ORDERS table used in the TRANSACTION FOR STANDING ORDER relation 33 Page 5 Task Emulation 5 1 Task Design Specification Customer Setup While no data error in data Prompt for customer data First amp Last Name Address Sex Age Email Payment Info If data includes credit card number then run credit check offline Analyze address to compute distance and assign to delivery route Run query TNSERT INTO CUSTOMERS FirstName LastName Address Sex Age Email Active VALUES firstName SlastName Saddress sex Sage Semail 1 to create new customer Run query INSERT INTO PAYMENT TYPES CustomerID PaymentType PaymentInfo VALUES ScustomerID paymentType paymentInfo to create new customer s payment information Customer Data Update Run query SELECT FROM CUSTOMERS WHERE CustomerID customerID to get current customer information While no data error in data Prompt for customer data First amp Last Name Address Sex Age Email Payment Info If data includes a new credit card number then run credit check offline If address has changed analyze new address to compute distance and assign to delivery route Run query UPDATE CUSTOMERS SET FirstName firstN
163. s has been deactivated due to an oustandin g balance of toMoney delinquentCustomer Balance true since SdelinquentCustomer BalanceDate date m d y strtotime Sdelinquent Customer BalanceDate always Please contact an administrato r to reactivate your account numDisabledtt if debug echo date m d y H i s DEBUG Generate Delin quency Report lt strong gt lt strong gt RPT 3 task complete lt u gt numDisabled lt u accounts were disabled lt br gt break default echo date m d y H i s found br break ERROR Invalid TaskID Stask A Customer Account account php include kunden homepages 25 d123903211 htdocs egroceries includes global tne php Ss lt DOCTYPE html PUBLIC W3C DTD XHTML 1 0 Transitional EN http www w3 org TR xhtmll DT D xhtmll transitional dtd gt lt html xmlns http www w3 org 1999 xhtml lt head gt meta http equiv Content Type content text html charset utf 8 gt lt title gt eGroceries lt title gt lt link rel stylesheet href styles main css type text css gt lt head gt lt body gt lt div id frame gt lt div id header gt lt php include kunden homepages 25 d123903211 htdocs egroceri es includes header inc php gt lt div gt lt div id nav gt lt php include kunden homepages 25 d123903211 htdocs egroceri es includes nav inc php gt lt div g
164. s includes nav inc php gt lt div gt lt div id content gt lt hl gt View Basket lt h1 gt lt php if SESSION userinfo echo lt p class error gt lt strong gt Error lt strong gt You are not logged in Please wait to be redirected lt p gt lt meta http equiv REFRESH content 0 url signin php else SbasketItemsResult mysql query SELECT FROM BASKETS WH ERE CustomerID SESSION userinfo CustomerID AND Active Ia if mysql_num rows SbasketItemsResult SbasketItemsRow mysql fetch assoc basketltemsResult SbasketItems explode SbasketItemsRow ProductArray III if POST productToRemove foreach basketltems as key gt Svalue if value POST productToRemove unset SbasketItems Skey break SupdateBasketItemsResult mysql query UPDATE BASKETS 65 Page SET ProductArray trim implode SbasketItems LastMod ified NOW WHERE CustomerID SESSION userinfo CustomerID AND Active 1 echo lt p class success gt lt strong gt Success lt strong gt The product POST productToRemoveDescription has been removed from your basket lt p gt i 0 subtotal 0 echo lt table cellpadding 1 gt echo tr th colspan 2 gt Item Description lt th gt lt th
165. se echo h2 class h2 gt Modify Standing Orders lt h2 gt standingOrderListResult mysql query SELECT FROM STAN DING ORDERS S WHERE SELECT O CustomerID FROM ORDERS O WHERE O OrderID S OrderID SESSION userinfo CustomerID echo lt style gt td font size 13px lt style gt echo lt table cellpadding 5 cellspacing 2 gt echo tr th align center gt ID lt th gt lt th align center gt Sta rt Date lt th gt lt th align center gt End Date lt th gt lt th gt Frequency lt th gt lt th gt Tota l th th align center gt Bill lt th gt lt th align center gt Active lt th gt lt th a lign center gt Modify Standing Order lt th gt lt tr gt pi Hrs if mysql num rows standingOrderListResult echo lt tr gt lt td colspan 8 align center gt lt i gt No Standing Orders found i td tr while standingOrderListRow mysql fetch assoc standingO rderListResult StransactionInfoQuery SELECT FROM TRANSACTIONS WHER E OrderID SstandingOrderListRow OrderID StransactionInfoResults mysql query transactionInfoQu I ery StransactionInfo mysql_fetch_assoc transactionInfoRes ulte SorderInfoQuery SELECT FROM ORDERS WHERE OrderID SstandingOrderListRow OrderID SorderInfoResults mysql query orderInfoQuery SorderInfoRow mysql fetch assoc
166. standingOrdersRow OrderID SorderInfo mysql fetch assoc orderInfoResult customerInfoResult mysql query SELECT FROM CUSTOMERS WHERE OrderID orderInfo CustomerID customerInfo mysql fetch assoc customerInfoResult Make sure customer is not deactivated before submitting order Lf Scustomerinto Active N if debug echo date m d y H i s DEBUG Customer has been deactivated aborting order lt br gt else Ssubtotal 0 StaxableSubtotal 0 SdriverIDQuery SELECT DriverID FROM DELIVERY PEOPLE WHE RE RouteID getDeliveryRoute S orderInfo CustomerID AND Work Hours SorderInfo DeliveryTimeRange S driverIDResult mysql query driverIDQuery driverIDRow mysql fetch assoc driverIDResult SdriverID driverIDRow DriverID if debug echo date m d y H i s DEBUG Standing O rder found CustmerID S orderInfo CustomerID StandingOrderID SstandingOrdersRow StandingOrderID OrderID standingOrde rsRow OrderrD Submitting order lt br gt 40 Page Check for out of stock products first SbasketItemsResult mysql_query SELECT FROM BASKETS WH ERE BasketID orderInfo BasketID if mysql num rows basketItemsResult SbasketItemsRow mysql fetch assoc basketItemsResult SbasketItems e
167. stem Limitations amp Possibilities for Improvement 9 1 System Limitations Below are a few system limitations due to the simplified model used for the program 1 9 2 Currently the system only supports US based addresses based on state abbreviations vs a dedicated dropdown list of states The addresses are not validated and are assumed to be correct Payment methods are overly simplified and are not validated besides a check for a 16 digit number for a credit card number or a price for a checking account balance Currently accounts disabled due to outstanding balances on an account are able to be reactivated by a customer on the Account Status page Standing orders are handled overly simply The system currently does not support refunding customer money for unsatisfactory products Possibilities for Improvement If this were a production system a few basic improvements could be implemented for a better more secure shopping experience 1 Qv ur eren ba Street addresses and Email addresses on the registration amp customer account update page could be validated Sign in and checkout could be secured with SSL for security More options for searching past orders could be added More search options could be added to product search Support for specifying quantities of products to add to a basket vs adding one at a time Product suggestions could be expanded by searching purchase history for the customer or other re
168. sword Form Price CustomerNum OnSale CurrentPassword OnSaleResult NMewPassword PasswordConfirmation BLO Balance Query CTHQ Customer Transaction History Query CustomerNum CustomerNum Account TimeRange BalanceResult TransactionResult CIF Customer Information Form Name Address RangeResult Gender Phone Email Password Creditinfo CSF Customer Status Form CustomerNum ActiveStatus 26 Page APBF Add Product to Basket Form SORF Standing Order Reguest Form CustomerNum CustomerNum ProductNum ProductNums Quantity Quantities BasketID DeliveryTime DeliveryFrequency PSF Product Sale Form PSF Product Sale Form ProductID ProductID SalePrice SalePrice SaleDuration SaleDuration DLF Database Load Form RRF Report Request Form RawData ReportID ABVRF Average Basket Value BWSRF Best Worst Seller Request Form Report ID 1 Report Form Report ID 2 TimeRange ProductIDs AvgBasketResult TimeRange BestWorstProductList DRF Delinquency Report Form SRPF Suggest Product Report Report ID 3 Form Report ID 4 MaxBalance CustomerID MaxTimeFrame TransactionHistory CustomerResult RecProductResult 27 Page Conceptual Modeling 3 E R Model Graphical Schema 3 1 sz uvHOWV A oyup ue wed WANS ach Due wed INIANIL GRUB ueg TT LNI ape uan 4 TT LNI ape uan 28 Page Logical Modeling 4 1 Logical Schema CUSTOMERS CustomerID FirstName LastName AddressStreet AddressCity
169. t lt div id content gt lt hl gt My eGroceries Account lt hl gt lt php if s SESSION userinfo 44 Page echo lt p class error gt lt strong gt Error lt strong gt You are not 1 ogged in Please wait to be redirected lt p gt lt meta http equiv REFRESH content 0 url signin php else if POST update valid true missing array SuserinfoRow _POST if POST FirstName valid false missing F irst Name if POST LastName valid false missing La st Name if POST AddressStreet valid false missing Address Street if POST AddressCity valid false Smissing Address City s if POST AddressZip valid false missing Address Zip Code if POST AddressState valid false missing Address State Code if POST Gender valid false missing Gend er if POST Email valid false missing Email Address if Qovalidy A SupdateQuery UPDATE CUSTOMERS SET FirstName mysq l real escape string POST FirstName LastName mysgl real escape string POST LastName AddressStreet mysql real e scape string POST AddressStreet AddressCity mysql real escape string POST AddressCity AddressZip mysql real es cape string
170. t SESSION userinfo CustomerID echo lt tr gt lt td colspan 2 style font weight bold text align right gt Subtotal toMoney SorderInfo BasePrice true lt td gt SD E echo lt tr gt lt td colspan 2 style font weight bold text align right gt Sales Tax toMoney S orderInfo SalesTax true td ou eh cs echo lt tr gt lt td colspan 2 style font weight bold text align right gt Delivery Fee toMoney SorderInfo DeliveryCharge tru 81 Page eh 2 s e echo lt tr gt lt td colspan 2 style font weight bold text align right color 861E23 gt lt span style border top lpx solid 000 gt Grand Total toMoney SorderInfo BasePrice SorderInfo SalesTax SorderInfo DeliveryCharge true lt span gt lt eden ere echo lt table gt echo lt style gt td font size 13px lt style gt echo lt table width 100 cellpadding 0 cellspacin g 2 gt lt tr gt lt td width 50 valign top gt echo lt h2 class h2 gt Delivery Information lt h2 gt echo lt table width 100 gt echo lt tr gt lt td valign top style font weight bold padding bottom 10px width 160 gt Deliver To lt td gt lt td style padding bottom 10px gt SESSION userinfo AddressStreet br SESS ION userinfo AddressCity SESSION userinfo AddressStat e SESSION userinfo AddressZip td
171. t form gt lt td gt echo lt brs echo lt table gt echo lt h2 class h2 gt Add A Standing Order from a Past Orde re hgs SorderInfoListResult mysql query SELECT FROM ORDERS W HERE CustomerID SESSION userinfo CustomerID AND OrderI D NOT IN SELECT OrderID FROM STANDING ORDERS ORDER BY DeliveryDate D BSC Orderip DESC echo lt style gt td font size 13px lt style gt echo lt table cellpadding 5 cellspacing 2 gt echo lt tr gt lt th align center gt ID lt th gt lt th gt Delivery Date Time lt th gt lt th gt Order Payment Method lt th gt lt th align center gt Total lt th gt lt th ali gn center gt Bill lt th gt lt th align center gt Make Standing Order lt th gt lt tr gt Si 0 if mysql num rows SorderInfoListResult echo lt tr gt lt td colspan 6 align center gt lt i gt No Previous Orders found lt i gt lt td gt lt tr gt while SorderInfoListRow mysql fetch assoc SorderInfoList Result StransactionInfoQuery SELECT FROM TRANSACTIONS WHER E OrderiD SorderintfolistBow Orderrzp w transactionInfoResults mysql query transactionInfoQu ery 104 Page transactionInfo mysql fetch assoc transactionInfoRes ults paymentTypeDetailsResult mysql query SELECT FROM P AYMENT TYPES WHERE Cust
172. t gt amp nbsp lt div gt echo script type text javascript var chart2 new FusionCharts includes fusionchar te FCF MSLIne swr Ohrdi 700 400 5 chart2 setDataURL report data php report ABVR chart2 render chart q Serape gt else if GET report BWSR echo lt h2 class h2 gt Best Worst Seller Report lt h2 gt if POST setOnSale SrandomSaleAmount rand 5 15 0 01 Pick a rando m sale amount from 5 15 off SupdateQuery UPDATE PRODUCTS SET SaleStatus 1 Sa lePrice toMoney POST updatePrice POST updatePrice randomSaleAmount true WHERE ProductID UU E POST updatetp i mysql query updateQuery if mysql error echo lt p class error gt lt strong gt Error lt strong gt Could not update product information lt br gt MySQL Error lt u gt mysql error Sp else echo lt p class success gt lt strong gt Success lt strong gt POST updateName s have been placed on sale for u toMoney PoST updatePrace POST updatePrice randomSaleAmount false lt u gt lt p gt else if POST deleteItem echo lt p class warning gt lt strong gt Warning lt strong gt Not implemented p echo lt style gt td font size 12px lt style gt StopProductsQuery SELECT ProductID Description SEL ECT CATEGORY FROM PRODUCT CATEGORIES WHERE CAT
173. t non standing orders Existing standing orders are listed by ID Start amp End Date Frequency of the order Order Total a link to the Bill and an indication whether the standing order is active or inactive To add or modify a standing order the customer selects an order and clicks the Make Modify Standing Order button This will bring the customer to a page listing details of the order similar to the View Past Orders page Below the order details the customer may specify a Starting and Ending date for the standing order how often the order should occur Frequency and finally may specify if the standing order is active or inactive in case the customer goes on vacation for example Standing orders are then checked by a background process task to automatically submit a copy of the order every time the frequency reoccurs 131 Page View Transaction History Related Tasks 8 Queries Customer Transaction History Order Query In order to search for all transactions between any two dates customers may visit the View Transaction History page The two dates provided are used to query the database for all orders that were placed dispatched arrived returned or paid during the time period These dates as well as the order total and amount paid are displayed in a table where each row links to the Order History page for that order 72 3 Administrator Options Manage Users Related Tasks amp Queries De activated Re activate an Active
174. t text html charset utf 8 lt title gt eGroceries lt title gt lt link rel stylesheet href styles main css type text css gt lt head gt lt body onload init onunload GUnload gt lt div id frame gt lt div id header gt lt php include kunden homepages 25 d123903211 htdocs egroceri es includes header inc php gt lt div gt lt div id nav gt lt php include kunden homepages 25 d123903211 htdocs egrocer ies includes nav inc php gt lt div gt lt div id content gt lt hl gt My eGroceries Account Past Orders lt h1 gt php if SESSION userinfo echo lt p class error gt lt strong gt Error lt strong gt You are not logged in Please wait to be redirected p meta http equiv REFRESH content 0 url signin php gt else if GET orderID SorderInfoListResult mysql query SELECT FROM ORDERS W HERE CustomerID SESSION userinfo CustomerID ORDER BY D eliveryDate DESC OrderID DESC echo lt table cellpadding 5 cellspacing 2 gt echo tr th align center gt Order ID lt th gt lt th gt Delivery Dat e Time th th Order Payment Method lt th gt lt th align center Total th th align center gt Paid lt th gt lt th align center Details th tr i 0 79 Page while SorderInfoListRow mysql fetch
175. t data met loose requirements First off data was tested that involved invalid SQL characters such as apostrophes then other types of invalid data such as previously used usernames and incomplete sets of form entries The server was able to replace invalid data and display a warning for missing data as well Change Password Test The change password account page was tested to ensure that the all fields were required the old password was checked and that the new password and the confirmation password were also checked to be identical The system correctly handled both cases Out of Stock Product Test A test was performed to ensure products that were out of stock could not be ordered The server correctly warned the user and removed the product from the basket before checkout could occur Checking Account Limit Check The system was tested to ensure that any order paid with a Checking Account with a total that would exceed the accounts limit would produce an error The system correctly identified the case and prevented an order from being completed Rollback of Changes on Checkout Failure The system was rigged to test a failsafe built in to undo changes if an order fails For example after an order entry was created and a ticket and bill created a transaction entry entered was simulated to fail and caused the system to delete the order just created in effect undoing the order until the problem could be resolved 133 Page 9 Sy
176. t delivery times Varies Short High 1 minute Standing Order Request SOR Order Information OINFO Background Process Information BPINFO Order Information OINFO SORF Standing Order Request Form Enable or disable Standing Order in Background Process Information BPINFO None If order does not exist in Order Information OINFO return error BPINFO Background Process Information Standing Order Request SOR SOT Standing Order OINFO Order Information CTCHECK Customer Inactive Check 16 Page TASK NUMBER TASK NAME PERFORMER PURPOSE ENABLING COND DESCRIPTION FREOUENCY DURATION IMPORTANCE MAKIMUM DELAY INPUT OUTPUT DOCUMENT USE OPS PERFORMED SUBTASKS ERROR COND POT Place Order Customer System Allows a customer to place an order Customer exist in Customer Information CINFO Products exist in Product Information PINFO Basket is present in Basket Information BINFO Delivery Person is available in Delivery Person Information DINFO The customers address exists in Delivery Pricing Information DPINFO Customer supplies order payment method and delivery time and the system calculates the availability of the products and an estimate for the delivery time Can also be run by system acting on a Standing Order Frequently Medium Very high 1 minute Place Order Request POR Customer Information CINFO Produ
177. t link rel stylesheet href styles main css type text css gt lt head gt lt body gt lt div id frame gt lt div id header gt lt php include kunden homepages 25 d123903211 htdocs egroceri es includes header inc php gt lt div gt lt div id nav gt lt php include kunden homepages 25 d123903211 htdocs egroceri es includes nav inc php gt lt div gt lt div id content gt lt hl gt Search eGroceries lt hl gt lt form method get gt lt table width 100 gt lt tr gt lt td gt Description lt td gt lt td gt lt input name searchDescription s tyle width 250px value lt GET searchDescription gt td lt td gt Category lt td gt lt td gt lt select name SearchCategory style width 193px lt option value gt lt option gt lt php catResult mysql query SELECT FROM PRODUCT CATE GORIES while catRow mysql fetch assoc catResult echo lt option value catRow CATEGORY IDX GET searchCategory catRow CATEGORY IDX selected selec Eee tami Sm Seat Row I CATEGORY lt eption gt 91 Page 2 lt select gt lt td gt lt tr gt lt tr gt td Manufacturer td td input name searchManufacturer style width 250px value lt GET searchManufacturer gt gt lt td lt td gt Price Range lt td gt lt t
178. t tr height 30 gt lt td colspan 2 align center gt lt h2 style text decoration underline font size 18px margin top Opx gt Personal Information lt h2 gt lt td gt lt tr gt lt tr height 30 gt lt td style font weight bold gt Customer ID lt td gt lt td style padding left 2px font size 12px gt lt SuserinfoRow CustomerID gt lt td gt lt tr gt lt tr height 30 gt lt td style font weight bold gt First Name lt td gt lt td gt lt input type text name FirstName size 30 va lue lt SuserinfoRow FirstName gt gt lt td gt lt tr gt lt tr height 30 gt lt td style font weight bold gt Last Name lt td gt lt td gt lt input type text name LastName size 30 val ue lt SuserinfoRow LastName gt gt lt td gt lt tr gt lt tr height 30 gt 47 Page lt td style font weight bold gt Address Street lt td gt td input type text name AddressStreet size 30 value lt S userinfoRow AddressStreet td tr tr height 30 gt td style font weight bold gt Address City lt td gt td input type text name AddressCity size 30 value lt SuserinfoRow AddressCity td tr tr height 30 gt td style font weight bold gt Address State Code lt td gt lt td gt lt input type text name AddressState size 2 maxlength 2 value lt SuserinfoRow Address
179. tArray LastModified Snow WHERE BasketID basketID to update the basket Else Run query INSERT INTO Baskets CustomerID ProductArray LastModified Active VALUES customerID newProductID Snow 1 to create basket T 35 Page Place Unplace Product on Sale If ProductiD is invalid then exit and return error If action set Runquery UPDATE Products SET SaleStatus 1 SalePrice salePric WHERE ProductID productID to get mark the product as on sale Else if action remove Runquery UPDATE Products SET SaleStatus 0 SalePrice NULL WHERE ProductID productID to get mark the product as not on sale Background Process Task Runquery SELECT FROM BACKGROUND PROCESSES WHERE Days LIKE SStodayDay OR Times LIKE todayTime to get the list of tasks to run For each TaskID returned If TaskID is invalid skip If Snow gt LastRan Frequency Run task with TaskID Runquery UPDATE BACKGROUND PROCESSES SET LastRan now WHERE ProcessID processID to update the time the task last ran now Standing Order If orderID invalid exit and return error Get current SstandingOrderlD Runquery SELECT StandingOrderID FROM Standing Orders WHERE orderID SorderID If exists run query UPDATE Standing Orders SET Frequency F
180. tTypeDetailsRow PaymentInfo true lt td gt echo lt td color toMoney orderInfoListRow BasePri ce SorderInfoListRow SalesTax SorderInfoListRow DeliveryChar ge true lt td gt if StransactionInfo AmountPaid echo lt td color toMoney transactionInfo AmountP aad trus etu else echo lt td color gt 0 00 lt td gt echo lt td align center color gt lt a class mainlink hr ef pastorders php orderID orderInfoListRow OrderID View Deta ilsclase tds s echo eges echo table else echo h2 class h2 gt Order GET orderID Informat iome ng Us SorderInfoResult mysql query SELECT FROM ORDERS WHERE OrderID GET orderlID SorderInfo mysql fetch assoc orderInfoResult if mysql num rows S orderInfoResult echo lt p class error gt lt strong gt Error lt strong gt Invalid Q rder ID Please wait to be redirected lt p gt lt meta http 80 Page equiv REFRESH content 0 url account php else StransactionInfoQuery SELECT FROM TRANSACTIONS WHER E OrderID GET orderID transactionInfoResults mysql query transactionInfoQ uery transactionInfo mysql fetch assoc transactionInfoRes BEES SbasketItemsResult mysql_query
181. table used in the PRODUCT OF SUBCATEGORY relation CustomerID is a foreign key to the CUSTOMERS table used in the CUSTOMERS HAVE BASKETS relation 31 Page DELIVERY PEOPLE CREATE TABLE DELIVERY PEOPLE DriverID int 11 NOT NULL auto increment RouteID int 11 NOT NULL Name varchar 100 NOT NULL Address varchar 150 NOT NULL WorkHours varchar 10 NOT NULL Salary float NOT NULL Vehicle int 11 NOT NULL PRIMARY KEY DriverID KEY RouteID RouteID CONSTRAINT DELIVERY PEOPLE ibfk 1 FOREIGN KEY RouteID REFERENCES DELIVERY ROUTES RouteID NGINE InnoDB el DELIVERY ROUTES CREATE TABLE DELIVERY ROUTES RouteID int 11 NOT NULL auto increment LowerRange float NOT NULL UpperRange float NOT NULL Price float NOT NULL PRIMARY KEY RouteID ENGINE InnoDB ORDERS CREATE TABLE ORDERS OrderID int 11 NOT NULL auto increment CustomerID int 11 NOT NULL BasketID int 11 NOT NULL PaymentID tinyint 4 NOT NULL DeliveryDate date NOT NULL DeliveryTimeRange varchar 15 NOT NULL DriverID int 11 NOT NULL BasePrice float NOT NULL SalesTax float NOT NULL DeliveryCharge float NOT NULL PRIMARY KEY OrderID KEY CustomerID CustomerID KEY BasketID BasketID KEY PaymentID PaymentID KEY DriverID DriverID
182. tal SdeliveryCost getDeliveryCost SorderInfo Customer ID echo lt tr gt lt td colspan 2 style font weight bold text align right gt Subtotal toMoney orderInfo BasePrice true td CU pace echo lt tr gt lt td colspan 2 style font weight bold text align right gt Sales Tax toMoney SorderInfo SalesTax true lt td gt E echo lt tr gt lt td colspan 2 style font weight bold text align right gt Delivery Fee toMoney SorderInfo DeliveryCharge tru St tee echo lt tr gt lt td colspan 2 style font weight bold text align right color 861E23 gt lt span style border top lpx solid 000 gt Grand Total toMoney SorderInfo BasePrice SorderInfo SalesTax SorderInfo DeliveryCharge true lt span gt lt td gt lt te gt echo lt table gt echo lt style gt td font size 12px lt style gt echo lt table width 100 cellpadding 0 cellspacin g 2 gt lt tr gt lt td width 50 valign top gt echo lt div style font weight bold margin bottom 10px font size l6px Delivery Information lt div gt echo lt table width 100 gt echo lt tr gt td valign top style text decoration underline padding bottom 10px width 150 gt Deliver To lt td gt td style padding bottom 10px gt SuserinfoRow AddressStreet lt br gt SuserinfoRow A ddressCity SuserinfoRow AddressState Suseri
183. td gt lt select name NEW PaymentType id NEW PaymentType style width 100 color 000000 important text decoration none background color fff gt lt option value Credit Card gt Credit Card lt option gt lt option v alue Checking Account gt Checking Account lt option gt lt select gt lt td gt lt td gt lt input name NEW PaymentInfo id NEW PaymentInfo m axlength 16 style width 100 color 000000 important text decoration none background color fff td td align center gt lt img src gr save gif alt Save on click javascript editRow this NEW style cursor pointer gt lt td s 2 2 echo table echo lt input type hidden name PaymentID value inpu t type hidden name PaymentType value input type hidden nam e PaymentInfo value echo form Qu div div id footer gt lt php include kunden homepages 25 d123903211 htdocs egroceri es includes footer inc php div div body lt html gt Registration Page register php lt include kunden homepages 25 d123903211 htdocs egroceries includes 87 Page dlobal ine php s 2 lt DOCTYPE html PUBLIC W3C DTD XHTML 1 0 Transitional EN http www w3 org TR xhtmll DT D xhtmll transitional dtd gt lt html xmlns http www w3 org 1999 xhtml gt lt head gt meta http equiv Content Type content
184. te m d Y g i a strtotime t ransactionInfo DateTimeArrived td else echo lt td valign top style text decoration underline width 150 gt Estimated Arrival lt td gt Saddresses array 38 98989 76 936226 SexistingOrdersQuery SELECT FROM ORDE RS WHERE DeliveryDate orderInfo DeliveryDate AND DeliveryT imeRange SorderInfo DeliveryTimeRange AND DriverID Sor derrnfo DrfQiverrp ORDER BY Orde rrp SexistingOrdersResult mysql query exist ingOrdersQuery while existingOrdersRow mysql fetch as soc SexistingOrdersResult SuserinfoResult mysql query SELECT FROM CUSTOMERS WHERE CustomerID SexistingOrdersRow CustomerID D eR SuserinfoRow mysql fetch assoc userin foResult Saddresses userinfoRow AddressStre et SuserinfoRow AddressCity SuserinfoRow Addres sState Tp SuserinfoRow AddressZip echo lt input type hidden name DeliveryE stimate id DeliveryEstimate gt lt input type hidden name DeliveryTi meRange id DeliveryTimeRange value SorderInfo DeliveryTimeRang ET T script src http maps google com maps file api amp amp v 2 amp amp key ABOIAAAAt43nl5iO60ao0U bD 8028xOZrun2bISZn4KqMWt44f5SUkl1G xTVx44HD 4o0fbG2GGaPJOnEAUVtOg type text javascript gt lt script gt lt script type
185. temsResult driverinfoResult mysql query SELECT FROM DELIVERY PEOPLE WHE RE DriverlD SorderlInfol DrriveriD r driverinfoRow mysql fetch assoc driverinfoResult driverInfo driverinfoRow Name Route SdriverinfoRow RouteTD SbasketItems explode SbasketItemsRow ProductArray foreach SbasketItems as productID SproductsResult mysql_query SELECT SELECT CATEGORY FROM PROD UCT CATEGORIES WHERE CATEGORY IDX cat AS cat Description Manufact urer SaleStatus SalePrice Price FROM PRODUCTS WHERE ProductID SproductID while productRow mysql fetch assoc productsResult products productRow cat productRow i 0 productHTML foreach products as Scat gt Sarray if i 2 color background color EEE else unset Scolor SproductHTML lt tr gt lt td style font weight bold color colspan 4 cat td tr foreach Sarray as row if i 2 S color background color EEE else unset color productHTML lt tr gt lt td style Scolor gt amp nbsp amp nbsp amp nbsp Sr ow Description td td style Scolor align right gt Srow Sale Status SALE td td style color align right width 50 gt to Money row SalePrice t
186. text javascript src js BpTspSolver js script lt script type text javascript src js tsp Js script lt script type text javascript src js date format js gt lt script gt lt script type text javascript gt funecteon SHE 4 isDone false loadAtStart 37 4419 127 1419 86 addList implode n Saddresses directions 0 0 0 7 SEEIDES div id map style display none lt dave lt div id exportData style display non e div lt div id durationsData style display 59 Page none gt lt div gt lt div id ordering style display none gt lt div gt lt div id my textual div style display none gt lt day gt YA echo lt td id path gt Loading lt td gt echo lt tr gt echo lt table gt echo td td width 50 valign top gt echo lt div style font weight bold margin bottom 10px fontesize lopx oBilling Information lt div gt echo lt table width 100 gt echo lt tr gt lt td align top style text decoration underline padding bottom 10px width 150 gt Payment Method lt td gt lt td style padding bottom 10px gt if SpaymentTypeDetailsRow PaymentType Credit Card echo SpaymentTypeDetailsRow PaymentType 1 substr S paymentTypeDetailsRow PaymentInfo 4 else echo paymentTypeDetailsRow PaymentType 1 toMoney Spaym
187. tion and only prompts the customer for their account limit After editing click the save icon in the action column to update the database Alternatively to add a new payment entry use the last row to enter new information and click the save icon Account Status Related Tasks 8 Queries De activated Re activate an Active De activated customer The Account Status page allows a user to deactivate their account if they no longer wish to use the eGroceries system If the user wishes to reactivate their account they may also do so on this page View Past Orders Related Tasks amp Queries Order Query Product Query To view pending or processed orders a customer may visit the View Past Orders page to get a list of Order IDs Delivery Date Times Payment Methods Order Totals and Amount Paid Entries also have a link to a page listing details of the order including a list of products purchased the order totals base sales tax delivery fee total delivery information address date amp time estimated arrival if pending as well as a link to view the generated Bill that was will be delivered to the customer Modify Standing Orders Related Tasks amp Queries Standing Order Management Order Query Product Query In order to create a standing recurring order a customer must first place an order and then visit the Modify Standing Orders page to select the order A list of current standing orders is displayed above a list of pas
188. tions T you as well as a fre or temporarily disable the standing order for when example you go on vacation p echo table cellspacing 10 echo CES echo lt td align right gt Starting Date mm dd yy lt input type text name StartDate maxlength 8 size 8 value S standingOrderInfo StartDate date m d y Te etartbste i y Ww seta echo td align left gt name EndDate maxlength 8 put type text Ending Date size 8 strtotime standingOrderIn mm dd yy in value stand ingOrderInfo EndDate date m d y strtotime standingOrderInfo End Date Joc echo feretro if S standingOrderInfo Frequency if SstandingOrderInfo Frequency 30 0 SfreqUnit Months SfreqNum SstandingOrderInfo Frequency 3 else if standingOrderInfo Frequency 7 zm d SfreqUnit Weeks SfreqNum standingOrderInfo Frequency 7 else freqUnit Days SfreqNum standingOrderInfo Frequency echo lt td align right gt Frequency Every lt select n ame FrequencyNum gt lt option value gt lt option gt lt option value 1 S freqNum 1 se lected selected 1 option lt option value 2 fregNum 2 se lected selected 2 option lt option value 3 fregNum 3 se lected selected gt 3 lt option gt
189. to original code and are detailed below 10 2 References of Works Used 1 Safeway Grocery Delivery http shop safeway com superstore 2 Google Maps API http code google com apis maps index html 3 Google Maps Traveling Salesman Problem Solver Geir K Engdahl http code google com oogle maps tsp solver 4 Javascript Date Format Function Steven Levithan http blog stevenlevithan com archives date time format 5 FusionCharts Interactive Flash amp JavaScript Charts FusionCharts Technologies LLP http www fusioncharts com 6 Gaussian distributions with PHP on a 24h time period Chris Johnson http stackoverflow com questions 152115 gaussian distributions with php on a 24h time period 135 Page
190. tomer DCT Generate Suggest Product Report If no item added return blank section Get Scategory of SmostRecentProduct SELECT Category FROM Products WHERE ProductID SmostRecentProduct Run query SELECT productID FROM Products WHERE Category Category AND Stock gt 0 Sort productID s by price choose nearest 4 to SmostRecentProductPrice Display results below basket on check out page 38 Page 6 Program Source Code 6 1 Primary Page Code Background Tasks backgroundtasks php lt php This file will be run automatically by a scheduled task every hou r or so on the server Connect to DB and common functions include kunden homepages 25 d123903211 htdocs egroceries includes global zmnophp debug true Check the database for any scheduled tasks that should be run SbackgroundTasksQuery SELECT FROM BACKGROUND PROCESSES if debug echo date m d y H i s DEBUG Checking for schedul ed background tests with query SbackgroundTasksQuery lt br gt backgroundTasksResult mysql query backgroundTasksQuery while backgroundTasksRows mysql fetch assoc backgroundTasksResul t 1 SrunTask true Check to see if this task runs today StaskDays explode backgroundTasksRows Days if taskDays date w runTask false If
191. trong gt MySQL Error u mysql error lt u gt lt p gt else Smsg lt p class success gt lt strong gt Success lt str ong gt Your standing order has been added lt p gt else Smsg lt p class error gt lt strong gt Error lt strong gt Sta rting Ending Dates and Frequency are all required fields Please try again lt p gt standingOrderInfoResult mysql_query SELECT FROM ST ANDING ORDERS WHERE OrderID gt GET orderin Tt standingOrderInfo mysql fetch assoc standingOrderiInf oResult if mysql num rows standingOrderInfo echo h2 class h2 gt Modify Standing Order lt h2 gt else echo h2 class h2 gt Add A Standing Order from a Past Ordercz hz if S POST modifyOrder echo msg userinfoResult mysql query SELECT FROM CUSTOMERS W HERE CustomerID orderInfo CustomerID SuserinfoRow mysql fetch assoc userinfoResult StransactionInfoQuery SELECT FROM TRANSACTIONS WHER E OrderID GET orderID transactionInfoResults mysql query transactionInfoQ uery transactionInfo mysql fetch assoc transactionInfoRes ulaji SbasketItemsResult mysql_query SELECT FROM BASKETS WHERE CustomerID SorderInfo CustomerlID AND BasketiD o0
192. w mysql fetch assoc distanceRouteResult return distanceRouteRow RouteID Create the static HTML Bill for an order function makeBill billNum SorderID SorderInfoResult mysql query SELECT FROM ORDERS WHERE OrderID Sardar SorderInfo mysql fetch assoc orderInfoResult SuserinfoResult mysql_query SELECT FROM CUSTOMERS WHERE Custo merID orderInfo CustomerID SuserinfoRow mysql fetch assoc userinfoResult paymentTypeDetailsResult mysql query SELECT FROM PAYMENT TYP ES WHERE CustomerID S orderInfo CustomerID AND PaymentID SorderInfo PaymentID SpaymentTypeDetailsRow mysql fetch assoc paymentTypeDetailsResu It SbasketItemsResult mysql_query SELECT FROM BASKETS WHERE Cust omerID SorderInfo CustomerID AND BasketID SorderiInfo Basketin ja 7 3 SbasketItemsRow mysql fetch assoc basketltemsResult SbasketItems explode SbasketItemsRow ProductArray foreach S basketItems as SproductID productsResult mysql query SELECT SELECT CATEGORY FROM PROD UCT CATEGORIES WHERE CATEGORY IDX cat AS cat Description Manufact 111 Page urer SaleStatus SalePrice Price FROM PRODUCTS WHERE ProductID Sproduetip W while productRow mysql fetch assoc p
193. w SUB CATEGORY IDX style SsubCatStyle gt S subCatRow CATEGORY a li echo lt ul gt echo lt ul gt 2 6 3 One Time Database Population Scripts Source Code Safeway Grocery Delivery Site Scraper lt php error reporting E ALL Sfiles scandir C NNinetpubNNwwwrootNNsafeway Sproducts array Scounter 0 foreach files as file Af Xs Gay SELLS 6 rile w W E amp Stile le q dir C inetpub wwwroot safeway S file Sfiles2 scandir dir foreach files2 as file2 if file2 l w w amp amp Sfile2 Sdir2 C inetpub wwwroot safeway file file2 Sfiles3 scandir dir2 foreach files3 as file3 if file3 amp amp file3 Sthisfile dir2 C inetpub wwwroot safeway Sf ple X Spuler WAYNE E ler preg match all RenderProduoctRowN 7i file qe t contents thisfile matches Stheseproducts array foreach matches 1 as match Sthisproduct explode S match Smanufacturermatches array Sopts array http array method GET 121 Page header gt Cookie s pers e20g evar39cvpe 3D 255B 255B Direct 252520Load 252C 1290389618392 255D 255D 7C144815601839223B 220 8 GVal3j68vDe3D 255BS250B Dir6cte252520L080 7520 1290389518395 2 DDDS 2 55D 7C1448156018393 3B 20s nr 3D129
194. will be processed in the same way 6 Page Documentation 2 2 2 2 1 Top Level Information Flow Diagram ysanbay Jap4Q 3uipueis sos opio Buypueys 105 Jap4O un 104 WPL uxiedsiq uonewozu xua 5582044 punoJ8x eg OANIdS quawAed BAI I Y A lAVdH Ku uonetuuJ9ju Juud Aanijag 3s ejes 3onpoug O4NIdG avs 2 v l PA aysqam Aemajes O4NIL uosieg Ais 7 d A s ZN Uuoneu0juj Zaps A9pJQ 92e d a eg suondo T ke JOJEJISIUI WAY 40v Moden g 1npoJg 1s333ns KS Hds yodey Aouanbuag ya asenbay ayepan Ojuy Jawojsn gt uni yodey alas ION 158g usms uoneuuoju ysanbay jeuiojsn Jawojsn3 M N OIND YON yoday anjen 224 529 a EJany Wagy J9pJQ ld 3 yseg 0 ppy uod uev 7 Page 2 2 2 Tasks Subtasks and Task Flow Diagrams TASK NUMBER TASK NAME PERFORMER PURPOSE ENABLING COND DESCRIPTION FREQUENCY DURATION IMPORTANCE MAXIMUM DELAY INPUT OUTPUT DOCUMENT USE OPS PERFORMED SUBTASKS ERROR COND CST Customer Setup New Customer Allows the setup of a new customer after receiving customer data New Customer Request NCR has been received Receives incoming data from a New Customer Request NCR and analyzes for credit record delivery address to be assigned to a route and computes distance then enters customer data into the Customer Information CINFO structure Once per new customer
195. xplode SbasketItemsRow ProductArray 12 SfutureStockAdj array SoutOfStock array foreach SbasketItems as key gt S thisProductID SproductInfoResult mysql query SELECT FROM PRODUC TS WHERE ProductID SthisProductID productInfoRow mysql fetch assoc productInfoResult if S futureStockAdj thisProductID SfutureStockAdj thisProductID futureStock Spr oductlInfoRow Stock 1 else SfutureStockAdj SthisProductID futureStock fu tureStockAdj thisProductID 1 if SfutureStock lt 1 SoutOfStock thisProductID SfutureStockAdj S thisProductID S futureStockAdj t haisProductlD 1 unset SbasketItems Skey if debug echo date m d y H i s DEBUG The product SproductInfoRow Description lt a gt is out of stock and has been removed from the basket lt p gt else if SproductInfoRow SaleStatus Ssubtotal Ssubtotal SproductInfoRow SalePrice Il if S productInfoRow Taxable StaxableSubtotal StaxableSubtotal productIn foRow SalePrice else subtotal Ssubtotal S productInfoRow Price if productInfoRow Taxable StaxableSubtotal StaxableSubtotal productIn foRow Price if count SoutOfStock SupdateBasketItemsResult mysql_query UPDATE BASKETS SET Pro

Download Pdf Manuals

image

Related Search

Related Contents

Bedienungsanleitung  Safety Notices  Metroplan 44532/DB 90 x 60cm  Rexel RDM1150  hb954tzw-ad / sb94tz-f/s/c/w / w94r  HR4501C HR4510C HR4511C  Notice ()  Manual de usuario  Manuel MC 8000 DSC FR.p65  

Copyright © All rights reserved.
Failed to retrieve file