if ($_SESSION["isMember"] == 1) { $_SESSION["yousaved"] = number_format($_SESSION["transDiscount"] + $_SESSION["discounttotal"] + $_SESSION["memSpecial"] + $_SESSION["memCouponTTL"], 2); $_SESSION["couldhavesaved"] = 0; $_SESSION["specials"] = number_format($_SESSION["discounttotal"] + $_SESSION["memSpecial"], 2); } else { $dblyousaved = number_format($_SESSION["memSpecial"], 2); $_SESSION["yousaved"] = $_SESSION["discounttotal"]; $_SESSION["couldhavesaved"] = number_format($_SESSION["memSpecial"], 2); $_SESSION["specials"] = $_SESSION["discounttotal"]; } // call to transLog, the body of the receipt comes from the view 'receipt' $query = "select * from rp_receipt where register_no = " . $laneno . " and emp_no = " . $cashierNo . " and trans_no = " . $transno . " order by trans_id"; $db = tDataConnect(); $result = sql_query($query, $db); $num_rows = sql_num_rows($result); $receipt = $title . printReceiptHeader($dateTimeStamp, $ref); // loop through the results to generate the items listing. for ($i = 0; $i < $num_rows; $i++) { $row = sql_fetch_array($result); $receipt .= $row["linetoprint"] . "\n"; } // The Nitty Gritty: $member = "Member " . trim($_SESSION["memberID"]); $your_discount = $_SESSION["transDiscount"] + $_SESSION["memCouponTTL"]; if ($_SESSION["transDiscount"] + $_SESSION["memCouponTTL"] + $_SESSION["specials"] > 0) { $receipt .= "\n" . centerString("------------------ YOUR SAVINGS -------------------") . "\n"; if ($your_discount > 0) { $receipt .= " DISCOUNTS: \$" . number_format($your_discount, 2) . "\n"; } if ($_SESSION["specials"] > 0) { $receipt .= " SPECIALS: \$" . number_format($_SESSION["specials"], 2) . "\n";
function printReceipt($arg1) { $receipt = ""; setDrawerKick(); if ($arg1 == "full" and $_SESSION["kick"] != 0) { // ---- apbw 03/29/05 Drawer Kick Patch writeLine(chr(27) . chr(112) . chr(0) . chr(48) . "0"); } /* -------------------------------------------------------------- turn off staff charge receipt printing if toggled - apbw 2/1/05 ---------------------------------------------------------------- */ if ($_SESSION["TenderType"] == "MI" and ($_SESSION["receiptToggle"] == 0 or $_SESSION["SCReceipt"] == 0)) { $_SESSION["noreceipt"] = 1; } // apbw 2/15/05 SCR $dateTimeStamp = time(); // moved by apbw 2/15/05 SCR // -- Our Reference number for the transaction. $ref = trim($_SESSION["CashierNo"]) . "-" . trim($_SESSION["laneno"]) . "-" . trim($_SESSION["transno"]); $_SESSION["noreceipt"] = ($_SESSION["receiptToggle"] + 1) % 2; if ($_SESSION["noreceipt"] != 1) { $receipt = printReceiptHeader($dateTimeStamp, $ref); // call to transLog, the body of the receipt comes from the view 'receipt' $query = "SELECT * from receipt"; $db = tDataConnect(); $result = sql_query($query, $db); $num_rows = sql_num_rows($result); // loop through the results to generate the items listing. for ($i = 0; $i < $num_rows; $i++) { $row = sql_fetch_array($result); $receipt .= $row[0] . "\n"; } // The Nitty Gritty: if ($arg1 == "full") { $member = "Member " . trim($_SESSION["memberID"]); $your_discount = $_SESSION["transDiscount"] + $_SESSION["memCouponTTL"]; if ($_SESSION["transDiscount"] + $_SESSION["memCouponTTL"] + $_SESSION["specials"] > 0) { $receipt .= "\n" . centerString("------------------ YOUR SAVINGS -------------------") . "\n"; if ($your_discount > 0) { $receipt .= " DISCOUNTS: \$" . number_format($your_discount, 2) . "\n"; } if ($_SESSION["specials"] > 0) { $receipt .= " SPECIALS: \$" . number_format($_SESSION["specials"], 2) . "\n"; } $receipt .= centerString("---------------------------------------------------") . "\n"; } $receipt .= "\n"; // ccm-rle - will need to modify this to equal whatever we choose for non-member I changed the code because we aren't currently using memberships if (trim($_SESSION["memberID"]) != 2) { // mem# 99999 = NON-MEMBER // $receipt .= centerString("Thank You - ".$member)."\n"; $receipt .= centerString("Thank You!") . "\n"; } else { $receipt .= centerString("Thank You!") . "\n"; } if ($_SESSION["yousaved"] > 0) { $receipt .= centerString("You Saved \$" . number_format($_SESSION["yousaved"], 2)) . "\n"; } if ($_SESSION["couldhavesaved"] > 0 && $_SESSION["yousaved"] > 0) { $receipt .= centerString("You could have saved an additional \$" . number_format($_SESSION["couldhavesaved"], 2)) . "\n"; } elseif ($_SESSION["couldhavesaved"] > 0) { $receipt .= centerString("You could have saved \$" . number_format($_SESSION["couldhavesaved"], 2)) . "\n"; } $receipt .= centerString($_SESSION["receiptFooter1"]) . "\n" . centerString($_SESSION["receiptFooter2"]) . "\n" . centerString($_SESSION["receiptFooter3"]) . "\n" . centerString($_SESSION["receiptFooter4"]) . "\n"; // --- apbw 2/15/05 SCR --- if ($_SESSION["chargetender"] == 1) { $receipt = $receipt . printChargeFooterCust($dateTimeStamp, $ref); } if ($_SESSION["ccTender"] == 1) { $receipt = $receipt . printCCFooter($dateTimeStamp, $ref); } if ($_SESSION["promoMsg"] == 1) { promoMsg(); } $_SESSION["headerprinted"] = 0; } else { $dashes = "\n" . centerString("----------------------------------------------") . "\n"; if ($arg1 == "partial") { $receipt .= $dashes . centerString("* P A R T I A L T R A N S A C T I O N *") . $dashes; } elseif ($arg1 == "cancelled") { $receipt .= $dashes . centerString("* T R A N S A C T I O N C A N C E L L E D *") . $dashes; } elseif ($arg1 == "resume") { $receipt .= $dashes . centerString("* T R A N S A C T I O N R E S U M E D *") . $dashes . centerString("A complete receipt will be printed\n") . centerString("at the end of the transaction"); } elseif ($arg1 == "suspended") { $receipt .= $dashes . centerString("* T R A N S A C T I O N S U S P E N D E D *") . $dashes . $option . centerString($ref); } } } /* -------------------------------------------------------------- print store copy of charge slip regardless of receipt print setting - apbw 2/14/05 ---------------------------------------------------------------- */ if ($_SESSION["chargetender"] == 1) { if ($_SESSION["noreceipt"] == 1) { $receipt = printChargeFooterStore($dateTimeStamp, $ref); } else { $receipt = $receipt . printChargeFooterStore($dateTimeStamp, $ref); } } //------------------------------------------------------------------- $receipt = $receipt . "\n\n\n\n\n\n\n"; if ($_SESSION["noreceipt"] == 0) { writeLine($receipt . chr(27) . chr(105)); } $receipt = ""; $_SESSION["noreceipt"] = 1; // apbw 2/15/05 SCR - 9/25/09 ccm-rle commented out and a variable with noreceipt = 0 set at top to see if it turns of receipt printing while still enabling manual receipt printing $_SESSION["kick"] = 1; // apbw 05/03/05 KickFix }