function preprocess() { if (isset($_REQUEST['selectlist'])) { if (!empty($_REQUEST['selectlist'])) { $print_class = CoreLocal::get('ReceiptDriver'); if ($print_class === '' || !class_exists($print_class)) { $print_class = 'ESCPOSPrintHandler'; } $PRINT_OBJ = new $print_class(); $receipt = ReceiptLib::printReceipt('reprint', $_REQUEST['selectlist']); if (session_id() != '') { session_write_close(); } if (is_array($receipt)) { if (!empty($receipt['any'])) { $PRINT_OBJ->writeLine($receipt['any']); } if (!empty($receipt['print'])) { $PRINT_OBJ->writeLine($receipt['print']); } } elseif (!empty($receipt)) { $PRINT_OBJ->writeLine($receipt); } } $this->change_page($this->page_url . "gui-modules/pos2.php"); return false; } return true; }
protected function ajax() { CoreLocal::set("cabReference", $_REQUEST['input']); $receipt = ReceiptLib::printReceipt('cab', CoreLocal::get('cabReference')); ReceiptLib::writeLine($receipt); return 'Done'; }
$print_class = CoreLocal::get('ReceiptDriver'); if ($print_class === '' || !class_exists($print_class)) { $print_class = 'ESCPOSPrintHandler'; } $PRINT_OBJ = new $print_class(); $email = trim(CoreState::getCustomerPref('email_receipt')); $customerEmail = filter_var($email, FILTER_VALIDATE_EMAIL); $doEmail = $customerEmail !== false ? true : false; if ($receiptType != "none") { $receiptContent[] = ReceiptLib::printReceipt($receiptType, $receiptNum, false, $doEmail); } if ($receiptType == "ccSlip" || $receiptType == 'gcSlip') { // don't mess with reprints } elseif (CoreLocal::get("autoReprint") == 1) { CoreLocal::set("autoReprint", 0); $receiptContent[] = ReceiptLib::printReceipt($receiptType, $receiptNum, true); } // use same email class for sending the receipt // as was used to generate the receipt $email_class = ReceiptLib::emailReceiptMod(); if ($transFinished) { CoreLocal::set("End", 0); $output = $yesSync; UdpComm::udpSend("termReset"); $sd = MiscLib::scaleObject(); if (is_object($sd)) { $sd->ReadReset(); } CoreLocal::set('ccTermState', 'swipe'); uploadAndReset($receiptType); }
<form action="receiptTest.php" method="get"> <b>Receipt Type</b>: <select name="rtype"> <option value="full">Normal Transaction</option> <option value="cab">Cab Coupon</option> <option value="partial">Partial Transaction</option> <option value="cancelled">Cancelled Transaction</option> <option value="resume">Resumed Transaction</option> <option value="suspended">Suspended Transaction</option> <option value="ccSlip">Credit Card Slip</option> <option value="gcSlip">Gift Card Slip</option> <option value="gcBalSlip">Gift Card Balance</option> </select> <input type="submit" value="Get Receipt"> </form> <hr /> <?php if (isset($_REQUEST['rtype'])) { echo '<b>Results</b><br /><pre>'; $receipt = ReceiptLib::printReceipt($_REQUEST['rtype'], False, False); if (is_array($receipt)) { echo $receipt['print']; } else { echo $receipt; } echo '</pre>'; } ?> </body> </html>
<?php /******************************************************************************* Copyright 2010 Whole Foods Co-op. This file is part of IT CORE. IT CORE is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. IT CORE is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License in the file license.txt along with IT CORE; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *********************************************************************************/ ini_set('display_errors', 'Off'); include_once dirname(__FILE__) . '/../lib/AutoLoader.php'; CoreLocal::set("cabReference", $_REQUEST['input']); $receipt = ReceiptLib::printReceipt('cab', CoreLocal::get('cabReference')); ReceiptLib::writeLine($receipt); echo "Done";