value("viewrightblocks"); ############################ # View Receipt ############################ function viewReceipt($orderID, $code) { global $prefix, $db, $bgcolor2, $cartconfig; $userinfo = cartuserinfo(); $orderInfo = cartorderinfo($orderID); if($orderInfo['userID'] == $userinfo['user_id'] || $code == $orderInfo['code']){ include("header.php"); OpenTable(); echo "
"._EMPORIUM_MODULE_ORDERS_ORDERRECEIPT."
"; CloseTable(); echo "
"; OpenTable(); echo "" ."" ."" ."" ."" ."" ."" ."
"._EMPORIUM_MODULE_ORDERS_BILLTO.""._EMPORIUM_MODULE_ORDERS_SHIPTO."
" ."" ."" ."
$orderInfo[billFirstName] $orderInfo[billLastName]" ."
$orderInfo[billAddress1]"; if($orderInfo['billAddress2'] != ''){ echo "
$orderInfo[billAddress2]"; } echo "
$orderInfo[billCity], $orderInfo[billState] $orderInfo[billZip]" ."
$orderInfo[billCountry]" ."

"._EMPORIUM_MODULE_ORDERS_PAYMENTMETHOD." $orderInfo[payMethodName]" ."
" ."
" ."" ."" ."
$orderInfo[shipFirstName] $orderInfo[shipLastName]" ."
$orderInfo[shipAddress1]"; if($orderInfo['shipAddress2'] != ''){ echo "
$orderInfo[shipAddress2]"; } echo "
$orderInfo[shipCity], $orderInfo[shipState] $orderInfo[shipZip]" ."
$orderInfo[shipCountry]" ."

"._EMPORIUM_MODULE_ORDERS_SHIPPINGMETHOD." $orderInfo[shipMethodName]" ."
" ."
"; CloseTable(); echo "
"; OpenTable(); echo "" ."" .""; ereg ("([0-9]{4})-([0-9]{1,2})-([0-9]{1,2}) ([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2})", $orderInfo['orderDate'], $datetime); $datetime = strftime("%m/%d/%Y", mktime($datetime[4],$datetime[5],$datetime[6],$datetime[2],$datetime[3],$datetime[1])); $datetime = ucfirst($datetime); echo "" ."" .""; $orderStatus = $db->sql_query("select statusID, statusLabel, statusInfo from ".$prefix."_cart_orders_status where statusID='$orderInfo[orderStatus]' AND statusType='1'"); list($statusID, $statusLabel, $statusInfo) = $db->sql_fetchrow($orderStatus); $orderStatus2 = $db->sql_query("select statusID, statusLabel, statusInfo from ".$prefix."_cart_orders_status where statusID='$orderInfo[orderSubStatus]' AND statusType='2'"); list($statusID2, $statusLabel2, $statusInfo2) = $db->sql_fetchrow($orderStatus2); if($statusLabel2 != ''){ $statusLabel2 = " ( $statusLabel2 )"; } echo ""; if($orderInfo['statusDate'] != 0){ ereg ("([0-9]{4})-([0-9]{1,2})-([0-9]{1,2}) ([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2})", $orderInfo['statusDate'], $datetime); $datetime = strftime("%m/%d/%Y", mktime($datetime[4],$datetime[5],$datetime[6],$datetime[2],$datetime[3],$datetime[1])); $datetime = ucfirst($datetime); $statusDate = "$datetime"; } else { $statusDate = "N/A"; } echo "" ."" ."
"._EMPORIUM_MODULE_ORDERS_ORDER." # $orderInfo[orderID]"._EMPORIUM_MODULE_ORDERS_ORDERDATE." $datetime
"._EMPORIUM_MODULE_ORDERS_STATUS." $statusLabel$statusLabel2"._EMPORIUM_MODULE_ORDERS_STATUSDATE." $statusDate
"; echo "" ."" ."" ."" ."" ."" .""; $result = $db->sql_query("SELECT itemID, prodID, prodName, prodBrand, prodModel, itemCost, qty FROM ".$prefix."_cart_orders_cartitems WHERE orderID='$orderID' order by itemID asc"); $c = 0; while (list($iid, $sid, $prodName, $prodBrand, $prodModel, $itemCost, $qty) = $db->sql_fetchrow($result)) { $c++; if($prodBrand != ""){ $prodBrand = "$prodBrand "; } if($prodModel != ""){ $prodModel = " - $prodModel"; } $cost = $itemCost; $total = $cost * $qty; if($c > 1){ echo ""; } echo "" ."" ."" ."" ."" .""; $result2 = $db->sql_query("select * from ".$prefix."_cart_orders_cartitems_options where itemID='$iid'"); $numrows = $db->sql_numrows($result2); if ($numrows > 0){ $optionresult = $db->sql_query("select optionName, selectionName, selectionAction, selectionValue from ".$prefix."_cart_orders_cartitems_options where itemID='$iid' AND orderID='$orderID' order by optionID, selectionID"); while(list($optionName, $selectionName, $selectionAction, $selectionValue) = $db->sql_fetchrow($optionresult)){ echo ""; } } } echo ""; echo ""; echo ""; echo ""; $subTotal = $orderInfo['productTotal'] + $orderInfo['shipTotal'] + $orderInfo['handlingTotal'] + $orderInfo['taxTotal']; echo ""; echo "
"._EMPORIUM_MODULE_ORDERS_PRODUCT.""._EMPORIUM_MODULE_ORDERS_QTY.""._EMPORIUM_MODULE_ORDERS_COST.""._EMPORIUM_MODULE_ORDERS_TOTAL."
" ."
\"\"
$prodBrand$prodName$prodModel$qty".price_format($cost)."".price_format($total)."
· $optionName: $selectionName

"._EMPORIUM_MODULE_ORDERS_PRODUCTTOTAL." ".price_format($orderInfo['productTotal'])."
"._EMPORIUM_MODULE_ORDERS_SHIPPINGHANDLING." ".price_format($orderInfo['shipTotal'] + $orderInfo['handlingTotal'])."
"._EMPORIUM_MODULE_ORDERS_TAX." ".price_format($orderInfo['taxTotal'])."

"._EMPORIUM_MODULE_ORDERS_GRANDTOTAL." ".price_format($subTotal)."
"; CloseTable(); echo "
"; //Display Shipping Info $shipping = new emporium_shipping($orderInfo['shipMethod']); $shipping_method = $shipping->load_module(); $shipping_method->order_id = $orderID; $shipping_method->shipping('receipt_display'); //Display Payment Info $payment = new emporium_payment($orderInfo['payMethod']); $payment_method = $payment->load_module(); $payment_method->order_id = $orderID; $payment_method->payment('receipt_display'); include("footer.php"); } else { die(header("Location: modules.php?name=Shopping_Cart")); } } function printReceipt($orderID, $code) { global $prefix, $db, $bgcolor2, $cartconfig; $userinfo = cartuserinfo(); $orderInfo = cartorderinfo($orderID); if($orderInfo['userID'] == $userinfo['user_id'] || $code == $orderInfo['code']){ echo ""; echo ""._EMPORIUM_MODULE_ORDERS_RECEIPT_TITLE." #$orderID"; echo ""; echo ""; echo ""; echo "
"; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo "
"; echo ""; echo ""; echo ""; echo ""; echo ""; echo "
".$cartconfig->value("companyName")."
".$cartconfig->value("cartadminmail")."
".$cartconfig->value("companyPhone")."
"; echo ""._EMPORIUM_MODULE_ORDERS_RECEIPT_ORDERRECEIPT."
"; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; ereg ("([0-9]{4})-([0-9]{1,2})-([0-9]{1,2}) ([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2})", $orderInfo['orderDate'], $datetime); $datetime = strftime("%m/%d/%Y", mktime($datetime[4],$datetime[5],$datetime[6],$datetime[2],$datetime[3],$datetime[1])); $datetime = ucfirst($datetime); echo ""; echo ""; echo "

"._EMPORIUM_MODULE_ORDERS_RECEIPT_ORDERID."

"._EMPORIUM_MODULE_ORDERS_RECEIPT_DATEPRINTED."

"._EMPORIUM_MODULE_ORDERS_RECEIPT_ORDERDATE."

$orderID

".date("m/d/y")."

$datetime

"; echo "
"; echo "
"; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo "
"._EMPORIUM_MODULE_ORDERS_RECEIPT_SHIPPINGINFO.""._EMPORIUM_MODULE_ORDERS_RECEIPT_BILLINGINFO."
"; echo "$orderInfo[shipFirstName] $orderInfo[shipLastName]"; echo "
$orderInfo[shipAddress1]"; if($orderInfo['shipAddress2'] != ''){ echo "
$orderInfo[shipAddress2]"; } echo "
$orderInfo[shipCity], $orderInfo[shipState] $orderInfo[shipZip]"; echo "
$orderInfo[shipCountry]

"._EMPORIUM_MODULE_ORDERS_RECEIPT_SHIPPINGMETHOD." $orderInfo[shipMethodName]
"; echo "$orderInfo[billFirstName] $orderInfo[billLastName]"; echo "
$orderInfo[billAddress1]"; if($orderInfo['billAddress2'] != ''){ echo "
$orderInfo[billAddress2]"; } echo "
$orderInfo[billCity], $orderInfo[billState] $orderInfo[billZip]"; echo "
$orderInfo[billCountry]

"._EMPORIUM_MODULE_ORDERS_RECEIPT_BILLINGMETHOD." $orderInfo[payMethodName]
"; echo "

"._EMPORIUM_MODULE_ORDERS_RECEIPT_PRODUCTDETAILS.""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; $result = $db->sql_query("SELECT itemID, prodID, prodCode, prodName, prodBrand, prodModel, itemCost, qty FROM ".$prefix."_cart_orders_cartitems WHERE orderID='$orderID' order by itemID asc"); while (list($iid, $sid, $prodCode, $prodName, $prodBrand, $prodModel, $itemCost, $qty) = $db->sql_fetchrow($result)) { if($prodBrand != ""){ $prodBrand = "$prodBrand "; } if($prodModel != ""){ $prodModel = " - $prodModel"; } $cost = $itemCost; $total = $cost * $qty; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; } echo ""; echo ""; echo ""; echo "
"._EMPORIUM_MODULE_ORDERS_RECEIPT_PRODUCTCODE.""._EMPORIUM_MODULE_ORDERS_RECEIPT_PRODUCTNAME.""._EMPORIUM_MODULE_ORDERS_RECEIPT_QTY.""._EMPORIUM_MODULE_ORDERS_RECEIPT_PRICE.""._EMPORIUM_MODULE_ORDERS_RECEIPT_TOTAL."
$prodCode$prodBrand$prodName$prodModel"; $optionresult = $db->sql_query("select optionName, selectionName, selectionAction, selectionValue from ".$prefix."_cart_orders_cartitems_options where itemID='$iid' AND orderID='$orderID' order by optionID, selectionID"); while(list($optionName, $selectionName, $selectionAction, $selectionValue) = $db->sql_fetchrow($optionresult)){ echo "
· $optionName: $selectionName"; } echo "
$qty".price_format($cost)."".price_format($total)."
"; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo "

"._EMPORIUM_MODULE_ORDERS_RECEIPT_PRODUCTTOTAL."

".price_format($orderInfo['productTotal'])."

"._EMPORIUM_MODULE_ORDERS_RECEIPT_SHIPPINGHANDLING."

".price_format($orderInfo['shipTotal'] + $orderInfo['handlingTotal'])."

"._EMPORIUM_MODULE_ORDERS_RECEIPT_TAX."

".price_format($orderInfo['taxTotal'])."

  

"._EMPORIUM_MODULE_ORDERS_RECEIPT_GRANDTOTAL."

".price_format($orderInfo['productTotal'] + $orderInfo['shipTotal'] + $orderInfo['handlingTotal'] + $orderInfo['taxTotal'])."

"; echo "
"; echo "
"; echo "
"; echo ""; echo ""; die(); } else { die(header("Location: modules.php?name=Shopping_Cart")); } } switch($c_op) { case "printReceipt": printReceipt($orderID, $code); break; case "viewReceipt": default: viewReceipt($orderID, $code); break; } ?>