#!c:\perl\bin\perl #be sure this above line points to your perl interpreter ## ## A script that, given a SDNumber, provides a view of the corresponding ## order in the SnarkDreams database. ## Author: Zach Tomaszewski ## Date: 30 April 2003 ## use Win32::ODBC; use CGI ":cgi"; $cgi = new CGI; $sdno = $cgi->param('sdno'); #the user-requested order number ############################################# start CUT $DSN="SnarkDreams"; $username=""; $password=""; #Provide the three needed sql statements below. $SQLforCustomer =""; $SQLforOrder_Prod = ""; $SQLforOrder = ""; ############################################# end CUT ##main program printHeader(); if ($cgi->param('sdno')) { #then a specific order number has been requested printOrderView(); printSystemInfo(); } printFooter(); ###END main program ## # Prints the beginning of the html page ## sub printHeader(){ print "Content-Type: text/html\n\n"; #html header print qq^
Error connecting to database.
\n";
print "Error: " . Win32::ODBC::Error() . "
SD No: $sdno
Date: $orderData{ORDERDATE}
Kagi: $orderData{KAGI_NO}
$customerData{FIRSTNAME} $customerData{LASTNAME}
$customerData{ADDRESS}
$customerData{COUNTRY} -- $customerData{STATE}
Tel: $customerData{TELEPHONE}
Email: $customerData{EMAIL}
^;
#cycle through all ordered items
while ($db->FetchRow()){
%itemData = $db->DataHash();
print "$itemData{QUANTITY} x $itemData{DESCRIPTION}
\n";
undef %itemData;
}
$costtotal = $orderData{COST} + $orderData{KAGI_PERCENT};
#continue printing
print qq^
Comments: $orderData{COMMENTS}
Total Price: $orderData{TOTAL_PRICE}
Kagi Percent: $orderData{KAGI_PERCENT}
Cost: $orderData{COST}
Cost Total: $costtotal
Profit: $orderData{PROFIT}
";
my @keys = ();
foreach $key (HTTP_HOST, REMOTE_ADDR, HTTP_USER_AGENT, SERVER_SIGNATURE){
print "$key: $ENV{$key}
\n";
}
print "
SQL failed.
\n Error: " . $db->Error() . "
\n";
print "
Statement:
$SQL
There is no order with SDNumber \"$sdno\" in database.
"; printFooter(); exit(); } }