"); die(" Untitled You have to start a new order! This transaction has been committed already! Home Page "); } // SQL Populate Query Code $SQLQuery = "SELECT * FROM CI_Orders WHERE CustId='".$sCustID."' AND ID='".$sID."'"; $order=CI_Query($SQLQuery,$dbConnection); while($RSProp=mysql_fetch_array($order)) { $OrderID=$RSProp["OrderId"]; $sql="SELECT * FROM CI_OrderItems WHERE OrderId=".$OrderID; $orderDetail = CI_Query($sql,$dbConnection); $currSubTotal = 0; $strOrderHeader.=" ".$RSProp["Company"]."\r\n"; $strOrderHeader.=" ".$RSProp["ShippingName"]." "."\r\n"; $strOrderHeader.=" ".$RSProp["ShippingAddress"]." ".$RSProp["ShippingAddress2"]."\r\n" ; $strOrderHeader.=" ".$RSProp["ShippingCity"].", ".$RSProp["ShippingState"]." ".$RSProp["ShippingZip"]."\r\n"; $strOrderHeader.=" ". $RSProp["ShippingCountry"]."\r\n"; $strOrderHeader.="\r\n"; $strOrderInfo = " *** ORDER ID: ".$sID." CUST NO: ".$sCustID." OrderNo: ".$OrderID." ***"."\r\n"; $strOrderInfo.="Quantity Prod Code Product Name Unit Price Subtotal "."\r\n"; $strOrderInfo.="-------- --------- ------------------------------- ---------- ----------"."\r\n"; while($oRS=mysql_fetch_array($orderDetail)) { $strOrderInfo.=str_repeat(" ",8-strlen($oRS["Quantity"])).$oRS["Quantity"]." "; $strOrderInfo.=str_repeat(" ",9-strlen($oRS["SkuId"])). $oRS["SkuId"]." "; $strItemName = $oRS["Product"]; $prodSummary=substr($strItemName,0,31); $strOrderInfo.=$prodSummary.str_repeat(" ",31 - strlen($prodSummary))." "; $strOrderInfo.=str_repeat(" ",10-strlen(number_format($oRS["UnitPrice"],2))).number_format($oRS["UnitPrice"],2)." "; $currItemTotal = $oRS["UnitPrice"] * $oRS["Quantity"]; $strOrderInfo.=str_repeat(" ",10-strlen(number_format($currItemTotal,2))).number_format($currItemTotal,2)."\r\n"; $currSubTotal = $currSubTotal + $currItemTotal; } $currSubTotal = 0; $strEMail=$strOrderHeader; $strEMail.=" "."\r\n"."\r\n"; $strEMail.=" "."\r\n"."\r\n"; $strEMail.=$strOrderInfo; $strEMail.=" "."\r\n"."\r\n"; $strEMail.="Subtotal:".str_repeat(" ",8-strlen(number_format($RSProp["SubTotal"],2))).number_format($RSProp["SubTotal"],2). "\r\n"; $strEMail.="Taxes: ".str_repeat(" ",8-strlen(number_format($RSProp["TaxAmount"],2))).number_format($RSProp["TaxAmount"],2)."\r\n"; $strEMail.="Shipping:".str_repeat(" ",8-strlen(number_format($RSProp["ShippingCost"],2))).number_format($RSProp["ShippingCost"],2)."\r\n"; $strEMail.="Total: ".str_repeat(" ",8-strlen(number_format($RSProp["GrandTotal"],2))).number_format($RSProp["GrandTotal"],2)."\r\n"."\r\n"; $strEMail.=" "."\r\n"."\r\n"; $strEMail.="******* Payment: ".$RSProp["PayMethod"]." *******"."\r\n"."\r\n"; $strEMail.=" "."\r\n"."\r\n"; $strEMail.="*** BILLING INFO: "."\r\n"."\r\n"; $strEMail.="Company: ".$RSProp["Company"]."\r\n"; $BuyerMailRecipient=$RSProp["CardHolderFirstName"]." ".$RSProp["CardHolderLastName"]; $strEMail.="Name: ".$BuyerMailRecipient."\r\n"; $strEMail.="Street: ".$RSProp["CardHolderAddress"]."\r\n"; $strEMail.="Street2: ".$RSProp["CardHolderAddress2"]."\r\n"; $strEMail.="City: ". $RSProp["CardHolderCity"]."\r\n"; $strEMail.="State: ". $RSProp["CardHolderState"]."\r\n"; $strEMail.="Postal Code: ".$RSProp["CardHolderZip"]."\r\n"; $strEMail.="Country: ". $RSProp["CardHolderCountry"]."\r\n"; $strEMail.="Phone: ".$RSProp["DaytimePhoneNbr"]."\r\n"; $strEMail.="Fax: ".$RSProp["CardholderFax"]."\r\n"; $BuyerMailRecipientEmail=$RSProp["emailaddress"]; $strEMail.="Email: ".$BuyerMailRecipientEmail."\r\n"."\r\n"; $strEMail.=" "."\r\n"."\r\n"; $strEMail.="*** SHIPPING INFO:"."\r\n"."\r\n"; $strEMail.="Shipping: ".$RSProp["ShippingType"]."\r\n"; $strEMail.="Shipping Method: ".$RSProp["ShippingMethod"]."\r\n"; $strEMail.="Shipping Option: ".$RSProp["ShippingOption"]."\r\n"; $strEMail.="Name: ".$RSProp["ShippingName"]."\r\n"; $strEMail.="Company: ".$RSProp["ShippingCompany"]."\r\n"; $strEMail.="Street: ".$RSProp["ShippingAddress"]."\r\n"; $strEMail.="Street2: ".$RSProp["ShippingAddress2"]."\r\n"; $strEMail.="City: ".$RSProp["ShippingCity"]."\r\n"; $strEMail.="State: ".$RSProp["ShippingState"]."\r\n"; $strEMail.="Postal Code: ".$RSProp["ShippingZip"]."\r\n"; $strEMail.="Country: ".$RSProp["ShippingCountry"]."\r\n"; $strEMail.=" "."\r\n"."\r\n"; $strEMail.="Thank you for your order!"."\r\n"."\r\n"; // The below lines clears out the users cookies to allow for additional orders setcookie ("customerid", "", time() - 3600); // Order has been completed toggle CI_Query("UPDATE CI_Orders SET Status=1 WHERE OrderId=".$OrderID,$dbConnection); } $MerchantEmailBody=$MerchantHeader." ".$strEMail; $BuyerEmailBody=$BuyerHeader." ".$strEMail; // SEND EMAIL TO Merchant if(!mail($MerchantMailRecipientEmail." (".$MerchantMailRecipient.")", $MerchantMailSubject, $MerchantEmailBody, "From:".$MerchantMailFromAddress." (".$MerchantMailFromName.")")) { echo "Your order did not contain a valid email address or the mail services failed.
Please print the page for your records and call the merchant to notifiy them of this error message. Error: 101 Reciept page.

"; } //echo(""); // SEND EMAIL TO Buyer if(!mail($BuyerMailRecipientEmail." (".$BuyerMailRecipient.")", $BuyerMailSubject, $BuyerEmailBody, "From:".$BuyerMailFromAddress." (".$BuyerMailFromName.")")) { echo "Your order did not contain a valid email address or the mail services failed.
Please print the page for your records and call the merchant to notifiy them of this error message. Error: 101 Reciept page.

"; } //echo(""); // The below lines clear session values to avoid duplicate ordering using Refresh session_unregister("cust"); session_unregister("cartID"); //Clear Cart contents for the customer $strSQL = "DELETE FROM CI_Cart WHERE custID='".$sCustID."'"; $query=CI_Query($strSQL,$dbConnection); // ------------------ Beginning of HTML receipt -------------------------- $strSQL = "SELECT * FROM CI_OrderItems, CI_Orders WHERE CI_Orders.OrderId = ".$OrderID." AND CI_OrderItems.OrderId=CI_Orders.OrderId"; $getorders=CI_Query($strSQL,$dbConnection); $oRS = mysql_fetch_array($getorders); ?> Order Details -- Print Format

DeNami Design Rubber Stamps
P.O. Box 5617
Kent, WA 98064
phone 253.437.1626

Please print this page for your records.

Order ID:    CUST NO:
Quantity SKU
Product Name
Unit Price
Sub Total
 
 
 
Sub Total  
Taxes  
Shipping Cost  
Grand Total  
Payment:
Billing Info:
Card Type  
Card Number  
Card Expiration  
Company  
Name   
Address  
 
City  
State/Province  
Zip/Postal Code  
Country  
Daytime Phone  
Fax Number  
Email Address  
Date Order Placed  
Shipping Info:
Shipping Method  
Name  
Address  
 
City  
State/Province  
Zip/Postal Code  
Country  


Return to www.denamidesign.com