function check($str) { // only check & warn once per transaction if (CoreLocal::get('cashDropWarned') == True) { return False; } // checking one time CoreLocal::set('cashDropWarned', True); // cannot check in standalone if (CoreLocal::get('standalone') == 1) { return False; } // lookup cashier total $db = Database::mDataConnect(); $q = sprintf("SELECT sum(-total) FROM dtransactions WHERE\n trans_subtype='CA' AND trans_status <> 'X' AND emp_no=%d", CoreLocal::get('CashierNo')); $r = $db->query($q); $ttl = 0; if ($db->num_rows($r) > 0) { $row = $db->fetch_row($r); $ttl = $row[0]; } if ($ttl > CoreLocal::get('cashDropThreshold')) { return True; } else { return False; } }
public function testDatabase() { $db = Database::tDataConnect(); $this->assertInstanceOf('\\COREPOS\\pos\\lib\\SQLManager', $db); $this->assertEquals(CoreLocal::get('tDatabase'), $db->default_db); $db = Database::pDataConnect(); $this->assertInstanceOf('\\COREPOS\\pos\\lib\\SQLManager', $db); $this->assertEquals(CoreLocal::get('pDatabase'), $db->default_db); $this->assertEquals(1, Database::gettransno(-1)); // not a real emp_no $db = Database::tDataConnect(); $matches = Database::localMatchingColumns($db, 'localtrans', 'localtemptrans'); $this->assertInternalType('string', $matches); $this->assertRegExp('/(.+)/', $matches); $globals = array('CashierNo' => 9999, 'cashier' => 'TRAINING', 'LoggedIn' => 0, 'TransNo' => 1, 'TTLFlag' => 0, 'FntlFlag' => 0, 'TaxExempt' => 0); Database::setglobalvalues($globals); $this->assertEquals(9999, CoreLocal::get('CashierNo')); $this->assertEquals('TRAINING', CoreLocal::get('cashier')); $this->assertEquals(0, CoreLocal::get('LoggedIn')); $this->assertEquals(1, CoreLocal::get('transno')); $this->assertEquals(0, CoreLocal::get('ttlflag')); $this->assertEquals(0, CoreLocal::get('fntlflag')); $this->assertEquals(0, CoreLocal::get('TaxExempt')); Database::loadglobalvalues(); // reload session from db. shouldn't change. $this->assertEquals(9999, CoreLocal::get('CashierNo')); $this->assertEquals('TRAINING', CoreLocal::get('cashier')); $this->assertEquals(0, CoreLocal::get('LoggedIn')); $this->assertEquals(1, CoreLocal::get('transno')); $this->assertEquals(0, CoreLocal::get('ttlflag')); $this->assertEquals(0, CoreLocal::get('fntlflag')); $this->assertEquals(0, CoreLocal::get('TaxExempt')); Database::setglobalvalue('TTLFlag', 1); Database::loadglobalvalues(); $this->assertEquals(1, CoreLocal::get('ttlflag')); Database::setglobalflags(0); Database::loadglobalvalues(); $this->assertEquals(0, CoreLocal::get('ttlflag')); $this->assertEquals(0, CoreLocal::get('fntlflag')); if (!class_exists('lttLib')) { include dirname(__FILE__) . '/lttLib.php'; } lttLib::clear(); $record = lttLib::genericRecord(); $record['upc'] = '0000000000000'; $record['description'] = uniqid('TEST-'); TransRecord::addRecord($record); SuspendLib::suspendorder(); $db = Database::mDataConnect(); $query = "\n SELECT *\n FROM suspended\n WHERE upc='{$record['upc']}'\n AND description='{$record['description']}'\n AND datetime >= " . $db->curdate(); $result = $db->query($query); $this->assertNotEquals(false, $result, 'Could not query suspended record'); $this->assertEquals(1, $db->num_rows($result), 'Could not find suspended record'); $row = $db->fetch_row($result); $this->assertInternalType('array', $row, 'Invalid suspended record'); foreach ($record as $column => $value) { $this->assertArrayHasKey($column, $row, 'Suspended missing ' . $column); $this->assertEquals($value, $row[$column], 'Suspended mismatch on column ' . $column); } }
/** Check for errors @return True or an error message string */ public function errorCheck() { $clearButton = array('OK [clear]' => 'parseWrapper(\'CL\');'); if (CoreLocal::get("isMember") != 0 && $this->amount - CoreLocal::get("amtdue") - 0.005 > CoreLocal::get("dollarOver") && CoreLocal::get("cashOverLimit") == 1) { return DisplayLib::boxMsg(_("member check tender cannot exceed total purchase by over \$") . CoreLocal::get("dollarOver"), '', false, $clearButton); } elseif (CoreLocal::get("store") == "wfc" && CoreLocal::get("isMember") != 0 && $this->amount - CoreLocal::get("amtdue") - 0.005 > 0) { // This should really be a separate tender // module for store-specific behavior $db = Database::pDataConnect(); $q = sprintf("SELECT card_no FROM custReceiptMessage\n WHERE card_no=%d AND modifier_module='WfcEquityMessage'", CoreLocal::get('memberID')); $r = $db->query($q); if ($db->num_rows($r) > 0) { return DisplayLib::xboxMsg(_("member check tender cannot exceed total purchase if equity is owed"), $clearButton); } // multi use if (CoreLocal::get('standalone') == 0) { $chkQ = "select trans_num from dlog \n where trans_type='T' and trans_subtype in ('CA','CK') \n and card_no=" . (int) CoreLocal::get('memberID') . "\n group by trans_num \n having sum(case when trans_subtype='CK' then total else 0 end) < 0 \n and sum(Case when trans_subtype='CA' then total else 0 end) > 0"; $db = Database::mDataConnect(); $chkR = $db->query($chkQ); if ($db->num_rows($chkR) > 0) { return DisplayLib::xboxMsg(_("already used check over benefit today"), $clearButton); } } } elseif (CoreLocal::get("isMember") == 0 && $this->amount - CoreLocal::get("amtdue") - 0.005 > 0) { $msg = _('Non-members may not write checks for more than the total purchase.'); return DisplayLib::xboxMsg($msg, $clearButton); } return true; }
public function message($val, $ref, $reprint = false) { $date = ReceiptLib::build_time(time()); list($emp, $reg, $trans) = explode('-', $ref); $slip = ''; // query database for receipt info $db = Database::tDataConnect(); if ($reprint) { $db = Database::mDataConnect(); } $query = "SELECT q.amount, q.name, q.PAN, q.refNum,\n CASE \n WHEN q.mode = 'EBTFOOD_Sale' THEN 'Ebt FS Sale'\n WHEN q.mode = 'EBTFOOD_Return' THEN 'Ebt FS Refund'\n WHEN q.mode = 'EBTCASH_Sale' THEN 'Ebt Cash Sale'\n WHEN q.mode = 'EBTCASH_Return' THEN 'Ebt Cash Refund'\n ELSE q.mode\n END as ebtMode,\n r.xResultMessage, r.xTransactionID\n FROM efsnetRequest AS q\n LEFT JOIN efsnetResponse AS r ON\n q.date = r.date AND\n q.laneNo = r.laneNo AND\n q.transNo = r.transNo AND\n q.transID = r.transID AND\n q.cashierNo = r.cashierNo\n WHERE r.xResultMessage LIKE '%Approve%'\n AND q.mode LIKE 'EBT%'\n AND r.validResponse=1\n AND q.date=" . date('Ymd') . "\n AND q.transNo=" . (int) $trans . "\n ORDER BY q.refNum, q.datetime"; if ($db->table_exists('PaycardTransactions')) { $trans_type = $db->concat('p.cardType', "' '", 'p.transType', ''); $query = "SELECT p.amount,\n p.name,\n p.PAN,\n p.refNum,\n {$trans_type} AS ebtMode,\n p.xResultMessage,\n p.xTransactionID,\n p.xBalance,\n p.requestDatetime AS datetime\n FROM PaycardTransactions AS p\n WHERE dateID=" . date('Ymd') . "\n AND empNo=" . $emp . "\n AND registerNo=" . $reg . "\n AND transNo=" . $trans . "\n AND p.validResponse=1\n AND p.xResultMessage LIKE '%APPROVE%'\n AND p.cardType LIKE 'EBT%'\n ORDER BY p.requestDatetime"; } $result = $db->query($query); $prevRefNum = false; while ($row = $db->fetch_row($result)) { // failover to mercury's backup server can // result in duplicate refnums. this is // by design (theirs, not CORE's) if ($row['refNum'] == $prevRefNum) { continue; } $slip .= ReceiptLib::centerString("................................................") . "\n"; // store header for ($i = 1; $i <= CoreLocal::get('chargeSlipCount'); $i++) { $slip .= ReceiptLib::centerString(CoreLocal::get("chargeSlip" . $i)) . "\n"; } $slip .= "\n"; $col1 = array(); $col2 = array(); $col1[] = $row['ebtMode']; $col2[] = "Entry Method: swiped\n"; $col1[] = "Sequence: " . $row['xTransactionID']; $col2[] = "Card: " . $row['PAN']; $col1[] = "Authorization: " . $row['xResultMessage']; $col2[] = ReceiptLib::boldFont() . "Amount: " . $row['amount'] . ReceiptLib::normalFont(); $balance = 'unknown'; $ebt_type = substr(strtoupper($row['ebtMode']), 0, 5); if ($ebt_type == 'EBT F' || $ebt_type == 'EBTFO') { if (is_numeric(CoreLocal::get('EbtFsBalance'))) { $balance = sprintf('%.2f', CoreLocal::get('EbtFsBalance')); } } else { if ($ebt_type == 'EBT C' || $ebt_type == 'EBTCA') { if (is_numeric(CoreLocal::get('EbtCaBalance'))) { $balance = sprintf('%.2f', CoreLocal::get('EbtCaBalance')); } } } $col1[] = "New Balance: " . $balance; $col2[] = ''; $slip .= ReceiptLib::twoColumns($col1, $col2); $slip .= ReceiptLib::centerString("................................................") . "\n"; $prevRefNum = $row['refNum']; } return $slip; }
/** Print a tender report This tender report is based on a single tender tape view rather than multiple views (e.g. ckTenders, ckTenderTotal, etc). Which tenders to include is defined via checkboxes by the tenders on the install page's "extras" tab. */ public static function get() { $DESIRED_TENDERS = CoreLocal::get("TRDesiredTenders"); $db_a = Database::mDataConnect(); $blank = " "; $fieldNames = " " . substr("Time" . $blank, 0, 13) . substr("Lane" . $blank, 0, 9) . substr("Trans #" . $blank, 0, 12) . substr("Change" . $blank, 0, 14) . substr("Amount" . $blank, 0, 14) . "\n"; $ref = ReceiptLib::centerString(trim(CoreLocal::get("CashierNo")) . " " . trim(CoreLocal::get("cashier")) . " " . ReceiptLib::build_time(time())) . "\n\n"; $receipt = ""; foreach (array_keys($DESIRED_TENDERS) as $tender_code) { $query = "select tdate from TenderTapeGeneric where emp_no=" . CoreLocal::get("CashierNo") . " and tender_code = '" . $tender_code . "' order by tdate"; $result = $db_a->query($query); $num_rows = $db_a->num_rows($result); if ($num_rows <= 0) { continue; } //$receipt .= chr(27).chr(33).chr(5); $titleStr = ""; $itemize = 1; for ($i = 0; $i < strlen($DESIRED_TENDERS[$tender_code]); $i++) { $titleStr .= $DESIRED_TENDERS[$tender_code][$i] . " "; } $titleStr = substr($titleStr, 0, strlen($titleStr) - 1); $receipt .= ReceiptLib::centerString($titleStr) . "\n"; $receipt .= $ref; if ($itemize == 1) { $receipt .= ReceiptLib::centerString("------------------------------------------------------"); } $query = "select tdate,register_no,trans_no,tender\n from TenderTapeGeneric where emp_no=" . CoreLocal::get("CashierNo") . " and tender_code = '" . $tender_code . "' order by tdate"; $result = $db_a->query($query); $num_rows = $db_a->num_rows($result); if ($itemize == 1) { $receipt .= $fieldNames; } $sum = 0; for ($i = 0; $i < $num_rows; $i++) { if ((CoreLocal::get("store") == "harvest-cb" || CoreLocal::get("store") == "harvest-jp") && ($tender_code == "PE" || $tender_code == "BU" || $tender_code == "EL" || $tender_code == "PY" || $tender_code == "TV")) { $itemize = 1; } else { $itemize = 0; } $row = $db_a->fetch_array($result); $timeStamp = self::timeStamp($row["tdate"]); if ($itemize == 1) { $receipt .= " " . substr($timeStamp . $blank, 0, 13) . substr($row["register_no"] . $blank, 0, 9) . substr($row["trans_no"] . $blank, 0, 8) . substr($blank . number_format("0", 2), -10) . substr($blank . number_format($row["tender"], 2), -14) . "\n"; } $sum += $row["tender"]; } $receipt .= ReceiptLib::centerString("------------------------------------------------------"); $receipt .= substr($blank . $blank . $blank . "Count: " . $num_rows . " Total: " . number_format($sum, 2), -56) . "\n"; $receipt .= str_repeat("\n", 4); // $receipt .= chr(27).chr(105); } return $receipt . chr(27) . chr(105); }
protected function varied_message($ref, $reprint = false, $sigSlip = false) { if (CoreLocal::get('autoReprint') == 1) { $sigSlip = true; } $date = ReceiptLib::build_time(time()); list($emp, $reg, $trans) = explode('-', $ref); $slip = ''; // query database for gc receipt info $db = Database::tDataConnect(); if ($reprint) { $db = Database::mDataConnect(); } $order = $sigSlip ? 'DESC' : 'ASC'; $trans_type = $db->concat('p.cardType', "' '", 'p.transType', ''); $sql = "SELECT {$trans_type} AS tranType,\n CASE WHEN p.transType = 'Return' THEN -1*p.amount ELSE p.amount END as amount,\n p.registerNo as terminalID,\n p.PAN,\n CASE WHEN p.manual=1 THEN 'Manual' ELSE 'Swiped' END as entryMethod,\n CASE WHEN transType='VOID' THEN '' ELSE p.xApprovalNumber END AS xAuthorizationCode,\n p.xBalance,\n CASE WHEN transType='VOID' THEN p.xApprovalNumber ELSE '' END AS xVoidCode,\n p.transID,\n p.requestDatetime AS datetime\n FROM PaycardTransactions AS p\n WHERE dateID=" . date('Ymd') . "\n AND empNo=" . $emp . "\n AND registerNo=" . $reg . "\n AND transNo=" . $trans . "\n AND p.validResponse=1\n AND p.xResultMessage LIKE '%Appro%'\n AND p.cardType = 'Gift'\n ORDER BY p.requestDatetime " . $order; $result = $db->query($sql); $num = $db->num_rows($result); while ($row = $db->fetch_row($result)) { $slip .= ReceiptLib::centerString("................................................") . "\n"; // store header for ($i = 1; $i <= CoreLocal::get('chargeSlipCount'); $i++) { $slip .= ReceiptLib::centerString(CoreLocal::get("chargeSlip" . $i)) . "\n"; } $slip .= "\n"; $col1 = array(); $col2 = array(); $col1[] = $row['tranType']; $col2[] = "Date: " . date('m/d/y h:i a', strtotime($row['datetime'])); $col1[] = "Terminal ID: " . $row['terminalID']; $col2[] = "Reference: " . $ref . "-" . $row['transID']; $col1[] = "Card: " . $row['PAN']; $col2[] = "Entry Method: " . $row['entryMethod']; if ((int) $row['xVoidCode'] > 0) { $col1[] = "Void Auth: " . $row['xVoidCode']; $col2[] = "Orig Auth: " . $row['xAuthorizationCode']; } else { $col1[] = "Authorization: " . $row['xAuthorizationCode']; $col2[] = ""; } $col1[] = ReceiptLib::boldFont() . "Amount: " . PaycardLib::paycard_moneyFormat($row['amount']) . ReceiptLib::normalFont(); // bold ttls apbw 11/3/07 $col2[] = "New Balance: " . PaycardLib::paycard_moneyFormat($row['xBalance']); $slip .= ReceiptLib::twoColumns($col1, $col2); // name/phone on activation only if (($row['tranType'] == 'Gift Card Activation' || $row['tranType'] == 'Gift Card Issue') && $sigSlip) { $slip .= "\n" . ReceiptLib::centerString("Name: ___________________________________") . "\n" . "\n" . ReceiptLib::centerString("Phone: ___________________________________") . "\n"; } $slip .= ReceiptLib::centerString("................................................") . "\n"; } return $slip; }
function preprocess() { /* form submitted */ if (isset($_REQUEST['selectlist'])) { if (!empty($_REQUEST['selectlist'])) { // selected a transaction $tmp = explode("::", $_REQUEST['selectlist']); $this->doResume($tmp[0], $tmp[1], $tmp[2]); // if it is a member transaction, verify correct name if (CoreLocal::get('memberID') != '0' && CoreLocal::get('memberID') != CoreLocal::get('defaultNonMem')) { $this->change_page($this->page_url . 'gui-modules/memlist.php?idSearch=' . CoreLocal::get('memberID')); } else { $this->change_page($this->page_url . "gui-modules/pos2.php"); } } else { // pressed clear $this->change_page($this->page_url . "gui-modules/pos2.php"); } return false; } $query_local = "SELECT register_no, emp_no, trans_no, SUM(total) AS total " . " FROM suspended " . " WHERE datetime >= " . date("'Y-m-d 00:00:00'") . " GROUP BY register_no, emp_no, trans_no"; $db_a = Database::tDataConnect(); $result = ""; if (CoreLocal::get("standalone") == 1) { $result = $db_a->query($query_local); } else { $db_a = Database::mDataConnect(); $result = $db_a->query($query_local); } $num_rows = $result ? $db_a->num_rows($result) : 0; /* if there are suspended transactions available, * store the result and row count as class variables * so they can be retrieved in body_content() * * otherwise notify that there are no suspended * transactions */ if ($num_rows > 0) { $this->temp_result = $result; $this->temp_num_rows = $num_rows; $this->temp_db = $db_a; return true; } else { CoreLocal::set("boxMsg", _("no suspended transaction")); $this->change_page($this->page_url . "gui-modules/pos2.php"); return false; } return true; }
public function testMinServer() { $db = Database::mDataConnect(); $errors = InstallUtilities::createMinServer($db, CoreLocal::get('mDatabase')); $this->assertInternalType('array', $errors); $this->assertInternalType('array', $errors); foreach ($errors as $error) { $this->assertInternalType('array', $error, 'Invalid status entry'); $this->assertArrayHasKey('error', $error, 'Status entry missing key: error'); $this->assertEquals(0, $error['error'], 'Error creating ' . $error['struct'] . ', ' . print_r($error, true)); if (isset($error['query']) && stristr($error['query'], 'DROP VIEW')) { // don't check for existence on DROP VIEW queries continue; } $exists = $db->table_exists($error['struct']); $this->assertEquals(true, $exists, 'Failed to create ' . $error['struct'] . ', ' . print_r($error, true)); } }
/** Check whether there are suspended transactions @return - 1 Yes - 0 No This function ignores any transactions that are not from the current day. */ public static function checksuspended() { $db_a = Database::tDataConnect(); $query_local = "SELECT upc \n FROM suspended\n WHERE datetime >= " . date("'Y-m-d 00:00:00'"); $result = ""; if (CoreLocal::get("standalone") == 1) { $result = $db_a->query($query_local); } else { $db_a = Database::mDataConnect(); $result = $db_a->query($query_local); } $num_rows = $db_a->num_rows($result); if ($num_rows == 0) { return 0; } else { return 1; } }
private function memAddress() { $db_name = CoreLocal::get('ServerOpDB'); $ret = ''; $dbc = Database::mDataConnect(); $query = 'SELECT street, zip, phone, email_1, email_2 FROM ' . $db_name . $dbc->sep() . 'meminfo WHERE card_no = ' . (int) CoreLocal::get('memberID'); $result = $dbc->query($query); if ($dbc->num_rows($result) > 0) { $row = $dbc->fetch_row($result); $ret .= _('Owner Address: ') . str_replace("\n", ", ", $row['street']) . "\n"; $ret .= _('Zip Code: ') . $row['zip'] . "\n"; $ret .= _('Owner Phone(s): ') . $row['phone'] . ' ' . $row['email_2'] . "\n"; $ret .= _('Owner Email: ') . $row['email_1'] . "\n"; } return $ret; }
function body_content() { $local = array(); $other = array(); $db = Database::tDataConnect(); $localQ = 'SELECT amount, PAN, refNum FROM efsnetRequest GROUP BY amount, PAN, refNum'; $localR = $db->query($localQ); while ($w = $db->fetch_row($localR)) { $local['_l' . $w['refNum']] = '(CURRENT)' . $w['PAN'] . ' : ' . sprintf('%.2f', $w['amount']); } if (CoreLocal::get('standalone') == 0) { $emp = CoreLocal::get('CashierNo'); $sec = Authenticate::getPermission($emp); $supervisor = $sec >= 30 ? true : false; $db = Database::mDataConnect(); $otherQ = 'SELECT MIN(datetime) as dt, amount, PAN, refNum, cashierNo, laneNo, transNo FROM efsnetRequest WHERE date=' . date('Ymd'); if (!$supervisor) { $otherQ .= ' AND laneNo=' . (int) CoreLocal::get('laneno') . ' AND cashierNo=' . (int) CoreLocal::get('CashierNo'); } $otherQ .= ' GROUP BY amount, PAN, refNum ORDER BY datetime DESC'; $otherR = $db->query($otherQ); while ($w = $db->fetch_row($otherR)) { $other[$w['refNum']] = $w['dt'] . ' : ' . $w['cashierNo'] . '-' . $w['laneNo'] . '-' . $w['transNo'] . ' : ' . sprintf('%.2f', $w['amount']); } } ?> <div class="baseHeight"> <div class="listbox"> <form name="selectform" method="post" id="selectform" action="<?php echo $_SERVER['PHP_SELF']; ?> " > <select name="selectlist" size="10" id="selectlist" onblur="$('#selectlist').focus()" > <?php $selected = 'selected'; foreach ($local as $id => $label) { printf('<option %s value="%s">%s</option>', $selected, $id, $label); $selected = ''; } foreach ($other as $id => $label) { printf('<option %s value="%s">%s</option>', $selected, $id, $label); $selected = ''; } if (count($local) == 0 && count($other) == 0) { echo '<option value="" selected>No transactions found</option>'; } ?> </select> </form> </div> <div class="listboxText coloredText centerOffset"> <?php echo _("use arrow keys to navigate"); ?> <br /> <?php echo _("enter to reprint receipt"); ?> <br /> <?php echo _("clear to cancel"); ?> </div> <div class="clear"></div> </div> <?php $this->add_onload_command("\$('#selectlist').keypress(processkeypress);\n"); $this->add_onload_command("\$('#selectlist').focus();\n"); }
/** Check if the member has overdue store charge balance @param $cardno member number @return True or False The logic for what constitutes past due has to be built into the unpaid_ar_today view. Without that this function doesn't really do much. */ public static function checkUnpaidAR($cardno) { // only attempt if server is available // and not the default non-member if ($cardno == CoreLocal::get("defaultNonMem")) { return false; } if (CoreLocal::get("balance") == 0) { return false; } $dbc = Database::mDataConnect(); if (!$dbc->table_exists("unpaid_ar_today")) { return false; } $query = "SELECT old_balance,recent_payments FROM unpaid_ar_today\n WHERE card_no = {$cardno}"; $result = $dbc->query($query); // should always be a row, but just in case if ($dbc->num_rows($result) == 0) { return false; } $row = $dbc->fetch_row($result); $bal = $row["old_balance"]; $paid = $row["recent_payments"]; if (CoreLocal::get("memChargeTotal") > 0) { $paid += CoreLocal::get("memChargeTotal"); } if ($bal <= 0) { return false; } if ($paid >= $bal) { return false; } // only case where customer prompt should appear if ($bal > 0 && $paid < $bal) { CoreLocal::set("old_ar_balance", $bal - $paid); return true; } // just in case i forgot anything... return false; }
/** The same data can be rendered two different ways. One's a signature slip, the other is just a list of date, amount, approval code, etc */ protected function variable_slip($ref, $reprint = False, $sigSlip = False) { $date = ReceiptLib::build_time(time()); list($emp, $reg, $trans) = explode('-', $ref); $sort = 'asc'; $slip = ''; $idclause = ''; $db = Database::tDataConnect(); if ($reprint) { $db = Database::mDataConnect(); } if ($sigSlip && is_numeric(CoreLocal::get('paycard_id'))) { $idclause = ' AND transID=' . CoreLocal::get('paycard_id'); } // query database for cc receipt info $query = "select tranType, amount, PAN, entryMethod, issuer, xResultMessage, xApprovalNumber, xTransactionID, name, " . " datetime, transID from ccReceiptView where date=" . date('Ymd', time()) . " and cashierNo = " . $emp . " and laneNo = " . $reg . " and transNo = " . $trans . " " . $idclause . " order by datetime {$sort}, transID DESC"; if ($db->table_exists('PaycardTransactions')) { $trans_type = $db->concat('p.cardType', "' '", 'p.transType', ''); $query = "SELECT {$trans_type} AS tranType,\n CASE WHEN p.transType = 'Return' THEN -1*p.amount ELSE p.amount END as amount,\n p.PAN,\n CASE WHEN p.manual=1 THEN 'Manual' ELSE 'Swiped' END as entryMethod,\n p.issuer,\n p.xResultMessage,\n p.xApprovalNumber,\n p.xTransactionID,\n p.name,\n p.requestDatetime AS datetime,\n p.transID\n FROM PaycardTransactions AS p\n WHERE dateID=" . date('Ymd') . "\n AND empNo=" . $emp . "\n AND registerNo=" . $reg . "\n AND transNo=" . $trans . $idclause . "\n AND p.validResponse=1\n AND (p.xResultMessage LIKE '%APPROVE%' OR p.xResultMessage LIKE '%PENDING%')\n AND p.cardType IN ('Credit', 'Debit')\n ORDER BY p.requestDatetime"; } $result = $db->query($query); $emvP = $db->prepare(' SELECT content FROM EmvReceipt WHERE dateID=? AND empNo=? AND registerNo=? AND transNo=? AND transID=? '); while ($row = $db->fetch_array($result)) { $slip .= ReceiptLib::centerString("................................................") . "\n"; // do not look for EmvReceipt server side; use classic receipt $emvR = $reprint ? false : $db->execute($emvP, array(date('Ymd'), $emp, $reg, $trans, $row['transID'])); if ($emvR && $db->numRows($emvR)) { $emvW = $db->fetchRow($emvR); $lines = explode("\n", $emvW['content']); for ($i = 0; $i < count($lines); $i++) { if (isset($lines[$i + 1]) && strlen($lines[$i]) + strlen($lines[$i + 1]) < 56) { // don't columnize the amount lines if (strstr($lines[$i], 'AMOUNT') || strstr($lines[$i + 1], 'AMOUNT')) { $slip .= ReceiptLib::centerString($lines[$i]) . "\n"; } elseif (strstr($lines[$i], 'TOTAL') || strstr($lines[$i + 1], 'TOTAL')) { $slip .= ReceiptLib::centerString($lines[$i]) . "\n"; } else { $spacer = 56 - strlen($lines[$i]) - strlen($lines[$i + 1]); $slip .= $lines[$i] . str_repeat(' ', $spacer) . $lines[$i + 1] . "\n"; $i++; } } else { if (strstr($lines[$i], 'x___')) { if ($sigSlip) { $slip .= "\n\n\n"; } else { $i++; continue; } } $slip .= ReceiptLib::centerString($lines[$i]) . "\n"; } } if ($sigSlip) { $slip .= "\n" . ReceiptLib::centerString($emp . '-' . $reg . '-' . $trans) . "\n"; $slip .= ReceiptLib::centerString(_('(Merchant Copy)')) . "\n"; } else { $slip .= "\n" . ReceiptLib::centerString(_('(Customer Copy)')) . "\n"; } } else { $trantype = $row['tranType']; if ($row['amount'] < 0) { $amt = "-\$" . number_format(-1 * $row['amount'], 2); } else { $amt = "\$" . number_format($row['amount'], 2); } $pan = $row['PAN']; // already masked in the database $entryMethod = $row['entryMethod']; $cardBrand = $row['issuer']; $approvalPhrase = $row['xResultMessage']; $authCode = "#" . $row['xApprovalNumber']; $sequenceNum = $row['xTransactionID']; $name = $row["name"]; if ($sigSlip) { for ($i = 1; $i <= CoreLocal::get('chargeSlipCount'); $i++) { $slip .= ReceiptLib::centerString(CoreLocal::get("chargeSlip" . $i)) . "\n"; } $slip .= $trantype . "\n" . "Card: " . $cardBrand . " " . $pan . "\n" . "Reference: " . $ref . "\n" . "Date & Time: " . $date . "\n" . "Entry Method: " . $entryMethod . "\n" . "Sequence Number: " . $sequenceNum . "\n" . "Authorization: " . $approvalPhrase . "\n" . ReceiptLib::boldFont() . "Amount: " . $amt . "\n" . ReceiptLib::normalFont(); $slip .= ReceiptLib::centerString("I agree to pay above total amount") . "\n" . ReceiptLib::centerString("according to card issuer agreement.") . "\n\n" . ReceiptLib::centerString("X____________________________________________") . "\n" . ReceiptLib::centerString($name) . "\n"; } else { // use columns instead $c1 = array(); $c2 = array(); $c1[] = $trantype; $c1[] = "Entry Method: " . $entryMethod; $c1[] = "Sequence Number: " . $sequenceNum; $c2[] = $cardBrand . " " . $pan; $c2[] = "Authorization: " . $approvalPhrase; $c2[] = ReceiptLib::boldFont() . "Amount: " . $amt . ReceiptLib::normalFont(); $slip .= ReceiptLib::twoColumns($c1, $c2); } } $slip .= ReceiptLib::centerString(".................................................") . "\n"; if ($sigSlip) { // Cut is added automatically by printing process //$slip .= "\n\n\n\n".chr(27).chr(105); break; } } return $slip; }
/** The same data can be rendered two different ways. One's a signature slip, the other is just a list of date, amount, approval code, etc N.B. This isn't finished for CoopCred, just a placeholder. */ protected function variable_slip($ref, $reprint = False, $sigSlip = False) { global $CORE_LOCAL; $date = ReceiptLib::build_time(time()); list($emp, $reg, $trans) = explode('-', $ref); $sort = 'asc'; $slip = ''; $idclause = ''; $db = Database::tDataConnect(); if ($reprint) { $db = Database::mDataConnect(); } if ($sigSlip && is_numeric($CORE_LOCAL->get('paycard_id'))) { $idclause = ' AND transID=' . $CORE_LOCAL->get('paycard_id'); } // query database for cc receipt info $query = "SELECT tranType, amount, PAN, entryMethod, issuer, " . " xResultMessage, xApprovalNumber, xTransactionID, name, datetime " . " FROM ccReceiptView where date=" . date('Ymd', time()) . " and cashierNo = " . $emp . " and laneNo = " . $reg . " and transNo = " . $trans . " " . $idclause . " ORDER BY datetime {$sort}, transID DESC"; if ($db->table_exists('PaycardTransactions')) { $trans_type = $db->concat('p.cardType', "' '", 'p.transType', ''); $query = "SELECT {$trans_type} AS tranType,\n CASE WHEN p.transType = 'Return' THEN -1*p.amount\n ELSE p.amount END as amount,\n p.PAN,\n CASE WHEN p.manual=1 THEN 'Manual'\n ELSE 'Swiped' END as entryMethod,\n p.issuer,\n p.xResultMessage,\n p.xApprovalNumber,\n p.xTransactionID,\n p.name,\n p.requestDatetime AS datetime\n FROM PaycardTransactions AS p\n WHERE dateID=" . date('Ymd') . "\n AND empNo=" . $emp . "\n AND registerNo=" . $reg . "\n AND transNo=" . $trans . $idclause . "\n AND p.validResponse=1\n AND (p.xResultMessage LIKE '%APPROVE%' OR\n p.xResultMessage LIKE '%PENDING%')\n AND p.cardType IN ('Credit', 'Debit')\n ORDER BY p.requestDatetime"; } $result = $db->query($query); while ($row = $db->fetch_array($result)) { $trantype = $row['tranType']; if ($row['amount'] < 0) { $amt = "-\$" . number_format(-1 * $row['amount'], 2); } else { $amt = "\$" . number_format($row['amount'], 2); } $pan = $row['PAN']; // already masked in the database $entryMethod = $row['entryMethod']; $cardBrand = $row['issuer']; $approvalPhrase = $row['xResultMessage']; $authCode = "#" . $row['xApprovalNumber']; $sequenceNum = $row['xTransactionID']; $name = $row["name"]; $slip .= ReceiptLib::centerString("................................................") . "\n"; if ($sigSlip) { $slip .= ReceiptLib::centerString($CORE_LOCAL->get("chargeSlip1")) . "\n" . ReceiptLib::centerString($CORE_LOCAL->get("chargeSlip3") . ", " . $CORE_LOCAL->get("chargeSlip4")) . "\n" . ReceiptLib::centerString($CORE_LOCAL->get("chargeSlip5")) . "\n" . ReceiptLib::centerString($CORE_LOCAL->get("receiptHeader2")) . "\n\n"; // phone // trans type: purchase, canceled purchase, refund or canceled refund $slip .= $trantype . "\n" . "Card: " . $cardBrand . " " . $pan . "\n" . "Reference: " . $ref . "\n" . "Date & Time: " . $date . "\n" . "Entry Method: " . $entryMethod . "\n" . "Sequence Number: " . $sequenceNum . "\n" . "Authorization: " . $approvalPhrase . "\n" . ReceiptLib::boldFont() . "Amount: " . $amt . "\n" . ReceiptLib::normalFont(); $slip .= ReceiptLib::centerString("I agree to pay above total amount") . "\n" . ReceiptLib::centerString("according to the card issuer agreement.") . "\n\n" . ReceiptLib::centerString("X____________________________________________") . "\n" . ReceiptLib::centerString($name) . "\n"; } else { // use columns instead $c1 = array(); $c2 = array(); $c1[] = $trantype; $c1[] = "Entry Method: " . $entryMethod; $c1[] = "Sequence Number: " . $sequenceNum; $c2[] = $cardBrand . " " . $pan; $c2[] = "Authorization: " . $approvalPhrase; $c2[] = ReceiptLib::boldFont() . "Amount: " . $amt . ReceiptLib::normalFont(); $slip .= ReceiptLib::twoColumns($c1, $c2); } $slip .= ReceiptLib::centerString(".................................................") . "\n"; if ($sigSlip) { // Cut is added automatically by the printing process break; } } return $slip; }
/** Prepare the tender report. @return string The report, ready to send to printer. */ public static function get() { global $CORE_LOCAL; /* First, check for anything still in * . localtemptrans * . dtransactions * and for a proper End of Shift. */ $localCheck = ""; $db_a = Database::tDataConnect(); $localQ = "SELECT *\n FROM localtemptrans\n ORDER BY datetime"; $localR = $db_a->query($localQ); $rowCount1 = 0; $transCount1 = 0; $endOfShiftCount1 = 0; $lastUPC1 = ""; while ($localRow = $db_a->fetch_row($localR)) { $rowCount1++; $lastUPC1 = $localRow['upc']; if ($lastUPC1 == 'ENDOFSHIFT') { $endOfShiftCount1++; } if ($localRow['trans_type'] == 'A') { $transCount1++; } } $localQ = "SELECT *\n FROM dtransactions\n ORDER BY datetime"; $localR = $db_a->query($localQ); $rowCount2 = 0; $transCount2 = 0; $endOfShiftCount2 = 0; $lastUPC2 = ""; while ($localRow = $db_a->fetch_row($localR)) { $rowCount2++; $lastUPC2 = $localRow['upc']; if ($lastUPC2 == 'ENDOFSHIFT') { $endOfShiftCount2++; } if ($localRow['trans_type'] == 'A') { $transCount2++; } } /* Ideally, either * . both tables are empty * . there is one record, an upc=ENDOFSHIFT, * in either localtemptrans or dtransactions * and the other table is empty. */ if ($rowCount1 == 0 && $rowCount2 == 0) { $localCheck .= "\n\nThe shift was ended properly, buffers empty. " . "Good!"; } elseif ($lastUPC1 == 'ENDOFSHIFT' && $rowCount1 == 1 && $rowCount2 == 0 || $lastUPC2 == 'ENDOFSHIFT' && $rowCount2 == 1 && $rowCount1 == 0) { $localCheck .= "\n\nThe shift was ended properly, EndOfShift only. " . "Good!"; } elseif ($lastUPC1 == 'ENDOFSHIFT' && ($rowCount1 > 0 || $endOfShiftCount1 > 0)) { $localCheck .= "\n\nThe local transaction-in-progress buffer suggests " . "the shift was ended but perhaps not properly. " . "\n Please SignOff once again and then re-run this report." . "\n If the same problem or another one is reported just use the " . "\n last or best report you have."; } elseif ($rowCount1 > 0) { $localCheck .= "\nThe local transaction-in-progress still contains " . "{$rowCount1} items." . "\nPlease complete or cancel the current transaction " . "and run this " . "\n report again." . "\n If the same problem or another one is reported just use the " . "\n last or best report you have."; } elseif ($lastUPC2 == 'ENDOFSHIFT' && ($rowCount2 > 0 || $endOfShiftCount2 > 0)) { $localCheck .= "\n\nThe local completed-transaction buffer suggests " . "the shift " . "\n was ended but perhaps not properly. " . "\n Please SignOff once again and then re-run this report." . "\n If the same problem or another one is reported just use the " . "\n last or best report you have."; } else { $localCheck .= "\n\nThe local completed-transaction buffer suggests " . "the shift was not " . "\n ended properly. " . "\nPlease SignOff, again if you already have, and then re-run " . "this report." . "\n If the same problem or another one is reported just use the " . "\n last or best report you have."; } if ($transCount2 > 0) { $localCheck .= "\n\nThe local completed-transaction buffer contains " . "{$transCount2} transactions " . "\n that probably will not appear in this report. " . "\n Please alert the shift co-ordinator."; } if (MiscLib::pingport($CORE_LOCAL->get("mServer"), $CORE_LOCAL->get("mDBMS"))) { $db_a = Database::mDataConnect(); $tTable = "dlog"; $tDate = "tdate"; $tSource = "Fannie"; $excl = ""; } else { $db_a = Database::tDataConnect(); $tTable = "localtranstoday"; $tDate = "datetime"; $tSource = "Lane" . $CORE_LOCAL->get('laneno'); $excl = " AND d.trans_status not in ('D','X','Z') AND d.emp_no <> 9999 " . "AND d.register_no <> 99"; } self::$db_a = $db_a; self::$tTable = $tTable; self::$tDate = $tDate; self::$excl = $excl; $shiftCutoff = date('Y-m-d 00:00:00'); self::$shiftCutoff = $shiftCutoff; $DESIRED_TENDERS = $CORE_LOCAL->get("TRDesiredTenders"); self::$dashLine = str_repeat('-', 54); $receipt = ""; $blank = str_repeat(' ', 13); /* Literal spacing from left margin. C a s h ------------------------------------------------------ Time Lane Trans # Emp # Mem # Amount 03:27 PM 1 1 62 484 -6.00 04:14 PM 1 1 63 484 -7.00 ------------------------------------------------------ Count: 2 Total: -13.00 */ $fieldNames = " " . substr("Time" . $blank, 0, 10) . substr("Lane" . $blank, 0, 8) . substr("Trans #" . $blank, 0, 10) . substr("Emp #" . $blank, 0, 8) . substr("Mem #" . $blank, 0, 11) . substr("Amount" . $blank, 0, 14) . "\n"; $ref = ReceiptLib::centerString(trim($CORE_LOCAL->get("CashierNo")) . " " . trim($CORE_LOCAL->get("cashier")) . " " . ReceiptLib::build_time(time())) . "\n"; $cashier_names = ""; $cashierQ = "SELECT CONCAT(SUBSTR(e.FirstName,1,1),SUBSTR(e.Lastname,1,1)) as cashier\n FROM {$tTable} d, " . $CORE_LOCAL->get('pDatabase') . ".employees e\n WHERE d.emp_no = e.emp_no AND d.register_no = " . $CORE_LOCAL->get('laneno') . " AND d.trans_type <> 'L' \n AND d.{$tDate} >= '" . $shiftCutoff . "'{$excl}\n GROUP BY d.emp_no\n ORDER BY d.{$tDate}"; $cashierR = $db_a->query($cashierQ); for ($i = 0; $i < ($row = $db_a->fetch_array($cashierR)); $i++) { $cashier_names .= $row['cashier'] . ", "; } $receipt .= ReceiptLib::centerString("T E N D E R R E P O R T") . "\n"; $receipt .= ReceiptLib::centerString("Data from {$tSource}") . "\n"; $receipt .= $ref; $receipt .= ReceiptLib::centerString("Lane " . $CORE_LOCAL->get('laneno') . " -- Cashiers: " . $cashier_names) . "\n\n"; if ($localCheck) { $receipt .= "{$localCheck}\n\n\n"; } /* NET TOTAL * Does not include tenders such as StoreCharge and Coupons. */ if ($CORE_LOCAL->get('store') == 'WEFC_Toronto') { $netTenderList = "'CA','CK','DC','CC'"; $netTenderMessage = "(Only: Cash, Cheque, Debit, Credit)"; } else { $netTenderList = "'CA','CK','DC','CC','FS','EC'"; $netTenderMessage = "(Only: Cash, Check, Debit, Credit, SNAPs)"; } $netQ = "SELECT -SUM(total) AS net, COUNT(total)\n FROM {$tTable} d\n WHERE register_no=" . $CORE_LOCAL->get('laneno') . " AND trans_subtype IN({$netTenderList})" . " AND {$tDate} >= '{$shiftCutoff}'{$excl}"; $netR = $db_a->query($netQ); $net = $db_a->fetch_row($netR); $receipt .= " " . substr("NET Total: " . $blank . $blank, 0, 20); $receipt .= substr($blank . number_format($net[0], 2), -8) . "\n {$netTenderMessage}\n"; $receipt .= "\n"; /* Total for each of a Tender Type or combination. * Each is listed even if no items. * The PFC version was driven by Desired Tenders. */ $receipt .= self::trTotal('CA', 'CASH'); if ($CORE_LOCAL->get('store') == 'WEFC_Toronto') { $receipt .= self::trTotal('CK', 'CHEQUE'); } else { $receipt .= self::trTotal('CK', 'CHECK'); } $receipt .= self::trTotal(array('CP', 'MC'), 'VENDOR COUPON'); $receipt .= self::trTotal('CC', 'CREDIT CARD'); $receipt .= self::trTotal('DC', 'DEBIT CARD'); if (!$CORE_LOCAL->get('store') == 'WEFC_Toronto') { $receipt .= self::trTotal('FS', 'SNAP - FOOD'); $receipt .= self::trTotal('EC', 'SNAP - CASH'); } $receipt .= self::trTotal('GC', 'GIFT CARD'); $receipt .= self::trTotal('MI', 'INSTORE CHARGE'); $receipt .= self::trTotal('IC', 'INSTORE COUPON'); $receipt .= "\n"; if ($CORE_LOCAL->get('store') == 'WEFC_Toronto') { $receipt .= self::trTotal(array('CA', 'CK'), 'CASH + CHEQUE'); $receipt .= self::trTotal(array('DC', 'CC'), 'DEBIT + CREDIT'); } else { $receipt .= self::trTotal('PT', 'PATRONAGE'); $receipt .= self::trTotal(array('CA', 'CK'), 'CASH + CHECK'); $receipt .= self::trTotal(array('DC', 'CC', 'FS', 'EC'), 'DEB/CRED/SNAP'); } if (!$CORE_LOCAL->get('store') == 'WEFC_Toronto') { $receipt .= self::trTotal(45, 'RCVD. on ACCT.'); $receipt .= self::trTotal(37, 'FRMRS MARKET SNAP'); } $receipt .= ReceiptLib::centerString(self::$dashLine); $receipt .= str_repeat("\n", 5); /* Detail for each Desired Tender Type or combination. * Types with no items are skipped. * The output seems very similar to trTotal(). */ /* If you share a credit/debit-card terminal between cash registers * you might want to list those tenders for all lanes * to help with day-end reconciliation. * Add an item to this array for each tender you want treated that way. */ $allLaneTenders = array(); $allLaneTenders[] = 'CC'; $allLaneTenders[] = 'DC'; foreach (array_keys($DESIRED_TENDERS) as $tender_code) { /* Skip Tender Type if no items of that type. * The first search seems the same as the lower search except for total tests. */ if (in_array($tender_code, $allLaneTenders)) { $registerArg = ''; } else { $registerArg = " AND register_no=" . $CORE_LOCAL->get('laneno'); } $query = "SELECT {$tDate}" . " FROM {$tTable} d" . " WHERE trans_subtype = '" . $tender_code . "'" . $registerArg . " AND {$tDate} >= '{$shiftCutoff}'{$excl}" . " ORDER BY {$tDate}"; $result = $db_a->query($query); $numRows = $db_a->num_rows($result); if ($numRows <= 0) { continue; } $titleStr = ""; $itemize = 1; for ($i = 0; $i < strlen($DESIRED_TENDERS[$tender_code]); $i++) { $titleStr .= $DESIRED_TENDERS[$tender_code][$i] . " "; } $titleStr = substr($titleStr, 0, strlen($titleStr) - 1); $receipt .= ReceiptLib::centerString($titleStr) . "\n"; if ($registerArg == '') { $receipt .= _("The list includes items for all lanes."); } if ($itemize == 1) { $receipt .= ReceiptLib::centerString(self::$dashLine) . "\n"; } $query = "SELECT {$tDate},register_no,emp_no,trans_no,card_no,total" . " FROM {$tTable} d" . " WHERE trans_subtype = '" . $tender_code . "'" . $registerArg . " AND (total <> 0 OR total <> -0) " . " AND {$tDate} >= '{$shiftCutoff}'{$excl}" . " ORDER BY {$tDate}"; $result = $db_a->query($query); $numRows = $db_a->num_rows($result); if ($itemize == 1) { $receipt .= $fieldNames; } $sum = 0; for ($i = 0; $i < $numRows; $i++) { $row = $db_a->fetch_array($result); $timeStamp = self::timeStamp($row["{$tDate}"]); if ($itemize == 1 && $row["total"]) { $receipt .= " " . substr($timeStamp . $blank, 0, 10) . substr($row["register_no"] . $blank, 0, 9) . substr($row["trans_no"] . $blank, 0, 8) . substr($blank . $row['emp_no'], -6) . substr($blank . $row["card_no"], -6) . substr($blank . number_format($row["total"], 2), -14) . "\n"; } $sum += $row["total"]; } $receipt .= ReceiptLib::centerString(self::$dashLine) . "\n"; $receipt .= substr($blank . $blank . $blank . "Count: " . $numRows . " Total: " . number_format($sum, 2), -55) . "\n"; $receipt .= str_repeat("\n", 3); // each desired tender. } /* Each item of purchase of these kinds. * first-param depts are PioneerFoodCoop, not WEFC_Toronto */ $receipt .= self::trTotal(36, 'MEMBER EQUITY', True, False); $receipt .= self::trTotal(45, 'RCVD / ACCOUNT', True, False); $receipt .= self::trTotal(41, 'GIFT CARDS SOLD', True, False); $receipt .= str_repeat("\n", 5); // cut paper? return $receipt . chr(27) . chr(105); // get() }
function preprocess() { $this->box_color = "coloredArea"; $this->msg = "Undo transaction"; if (isset($_REQUEST['reginput'])) { $trans_num = strtoupper($_REQUEST['reginput']); // clear/cancel undo attempt if ($trans_num == "" || $trans_num == "CL") { $this->change_page($this->page_url . "gui-modules/pos2.php"); return False; } // error: malformed transaction number if (!strpos($trans_num, "-")) { $this->box_color = "errorColoredArea"; $this->msg = "Transaction not found"; return True; } $temp = explode("-", $trans_num); // error: malformed transaction number (2) if (count($temp) != 3) { $this->box_color = "errorColoredArea"; $this->msg = "Transaction not found"; return True; } $emp_no = $temp[0]; $register_no = $temp[1]; $old_trans_no = $temp[2]; // error: malformed transaction number (3) if (!is_numeric($emp_no) || !is_numeric($register_no) || !is_numeric($old_trans_no)) { $this->box_color = "errorColoredArea"; $this->msg = "Transaction not found"; return True; } $db = 0; $query = ""; if ($register_no == CoreLocal::get("laneno")) { // look up transation locally $db = Database::tDataConnect(); $query = "select upc, description, trans_type, trans_subtype,\n trans_status, department, quantity, scale, unitPrice,\n total, regPrice, tax, foodstamp, discount, memDiscount,\n discountable, discounttype, voided, PercentDiscount,\n ItemQtty, volDiscType, volume, VolSpecial, mixMatch,\n matched, card_no, trans_id\n from localtranstoday where register_no = {$register_no}\n and emp_no = {$emp_no} and trans_no = {$old_trans_no}\n and datetime >= " . $db->curdate() . "\n and trans_status <> 'X'\n order by trans_id"; } else { if (CoreLocal::get("standalone") == 1) { // error: remote lookups won't work in standalone $this->box_color = "errorColoredArea"; $this->msg = "Transaction not found"; return True; } else { // look up transaction remotely $db = Database::mDataConnect(); $query = "select upc, description, trans_type, trans_subtype,\n trans_status, department, quantity, scale, unitPrice,\n total, regPrice, tax, foodstamp, discount, memDiscount,\n discountable, discounttype, voided, PercentDiscount,\n ItemQtty, volDiscType, volume, VolSpecial, mixMatch,\n matched, card_no, trans_id\n from dtransactions where register_no = {$register_no}\n and emp_no = {$emp_no} and trans_no = {$old_trans_no}\n and datetime >= " . $db->curdate() . "\n and trans_status <> 'X'\n order by trans_id"; } } $result = $db->query($query); // transaction not found if ($db->num_rows($result) < 1) { $this->box_color = "errorColoredArea"; $this->msg = "Transaction not found"; return True; } /* change the cashier to the original transaction's cashier */ $prevCashier = CoreLocal::get("CashierNo"); CoreLocal::set("CashierNo", $emp_no); CoreLocal::set("transno", Database::gettransno($emp_no)); /* rebuild the transaction, line by line, in reverse */ $card_no = 0; TransRecord::addcomment("VOIDING TRANSACTION {$trans_num}"); while ($row = $db->fetch_array($result)) { $card_no = $row["card_no"]; if ($row["upc"] == "TAX") { //TransRecord::addtax(); } elseif ($row["trans_type"] == "T") { if ($row["description"] == "Change") { TransRecord::addchange(-1 * $row["total"]); } elseif ($row["description"] == "FS Change") { TransRecord::addfsones(-1 * $row["total"]); } else { TransRecord::addtender($row["description"], $row["trans_subtype"], -1 * $row["total"]); } } elseif (strstr($row["description"], "** YOU SAVED")) { $temp = explode("\$", $row["description"]); TransRecord::adddiscount(substr($temp[1], 0, -3), $row["department"]); } elseif ($row["upc"] == "FS Tax Exempt") { TransRecord::addfsTaxExempt(); } elseif (strstr($row["description"], "% Discount Applied")) { $temp = explode("%", $row["description"]); TransRecord::discountnotify(substr($temp[0], 3)); } elseif ($row["description"] == "** Order is Tax Exempt **") { TransRecord::addTaxExempt(); } elseif ($row["description"] == "** Tax Excemption Reversed **") { TransRecord::reverseTaxExempt(); } elseif ($row["description"] == " * Manufacturers Coupon") { TransRecord::addCoupon($row["upc"], $row["department"], -1 * $row["total"]); } elseif (strstr($row["description"], "** Tare Weight")) { $temp = explode(" ", $row["description"]); TransRecord::addTare($temp[3] * 100); } elseif ($row["upc"] == "DISCOUNT") { //TransRecord::addTransDiscount(); } elseif ($row["trans_status"] != "M" && $row["upc"] != "0" && (is_numeric($row["upc"]) || strstr($row["upc"], "DP"))) { $row["trans_status"] = "V"; $row["total"] *= -1; $row["discount"] *= -1; $row["memDiscount"] *= -1; $row["quantity"] *= -1; $row["ItemQtty"] *= -1; TransRecord::addRecord($row); } } PrehLib::setMember($card_no, 1); CoreLocal::set("autoReprint", 0); /* do NOT restore logged in cashier until this transaction is complete */ $this->change_page($this->page_url . "gui-modules/undo_confirm.php"); return False; } return True; }
public static function get() { $db_a = Database::mDataConnect(); $shiftCutoff = date('Y-m-d 00:00:00'); $excl = " AND emp_no <> 9999 "; // $lookup = $db_a->query("SELECT MAX(datetime) FROM dtransactions // WHERE DATE(datetime) = CURDATE() AND upc='ENDOFSHIFT' AND // register_no=".CoreLocal::get('laneno')); // if ($db_a->num_rows($lookup) > 0){ // $row = $db_a->fetch_row($lookup); // if ($row[0] != '') $shiftCutoff = $row[0]; // } // TransRecord::add_log_record(array('upc'=>'ENDOFSHIFT')); $DESIRED_TENDERS = CoreLocal::get("TRDesiredTenders"); $db_a = Database::mDataConnect(); $blank = " "; $fieldNames = " " . substr("Time" . $blank, 0, 13) . substr("Lane" . $blank, 0, 9) . substr("Trans #" . $blank, 0, 12) . substr("Change" . $blank, 0, 14) . substr("Amount" . $blank, 0, 14) . "\n"; $ref = ReceiptLib::centerString(trim(CoreLocal::get("CashierNo")) . " " . trim(CoreLocal::get("cashier")) . " " . ReceiptLib::build_time(time())) . "\n\n"; $receipt = ""; $cashier_names = ""; $cashierQ = "SELECT CONCAT(SUBSTR(e.FirstName,1,1),e.Lastname) as cashier\n FROM dlog d, is4c_op.employees e\n WHERE d.emp_no = e.emp_no AND d.register_no = " . CoreLocal::get('laneno') . " AND d.emp_no <> 9999 AND d.trans_type <> 'L' \n AND d.tdate >= '" . $shiftCutoff . "'\n GROUP BY d.emp_no ORDER BY d.tdate"; $cashierR = $db_a->query($cashierQ); for ($i = 0; $i < ($row = $db_a->fetch_array($cashierR)); $i++) { $cashier_names .= $row['cashier'] . ", "; } $receipt .= ReceiptLib::centerString("T E N D E R R E P O R T") . "\n"; $receipt .= $ref; $receipt .= ReceiptLib::centerString("Cashiers: " . $cashier_names) . "\n\n"; // NET TOTAL $netQ = "SELECT -SUM(total) AS net, COUNT(total) FROM dlog \n WHERE register_no=" . CoreLocal::get('laneno') . " AND (trans_subtype IN('CA','CK','DC','CC','EF','FS','EC','GD','TC','WT') OR (trans_subtype = 'MI' AND staff <> 1))\n AND tdate >= '{$shiftCutoff}'{$excl}"; $netR = $db_a->query($netQ); $net = $db_a->fetch_row($netR); $receipt .= " " . substr("GROSS Total: " . $blank . $blank, 0, 20); $receipt .= substr($blank . number_format($net[0], 2), -8) . "\n"; $receipt .= "\n"; $receipt .= trTotal('CA', 'CASH'); $receipt .= trTotal('CK', 'CHECK'); $receipt .= trTotal('CC', 'CREDIT CARD'); $receipt .= trTotal('DC', 'DEBIT CARD'); $receipt .= trTotal('EF', 'EBT - FOOD'); $receipt .= trTotal('EC', 'EBT - CASH'); $receipt .= trTotal('GD', 'GIFT CARD'); $receipt .= trTotal('TC', 'GIFT CERT.'); $receipt .= trTotal('WT', 'WIC'); $receipt .= "\n"; $receipt .= trTotal(array('CP', 'MC'), 'VENDOR COUPON'); $receipt .= trTotal('MI', 'STORE CHARGE'); $receipt .= trTotal('IC', 'INSTORE COUPON'); $receipt .= "\n\n"; foreach (array_keys($DESIRED_TENDERS) as $tender_code) { $query = "select tdate from TenderTapeGeneric where emp_no=" . CoreLocal::get("CashierNo") . " and tender_code = '" . $tender_code . "' order by tdate"; $result = $db_a->query($query); $num_rows = $db_a->num_rows($result); if ($num_rows <= 0) { continue; } //$receipt .= chr(27).chr(33).chr(5); $titleStr = ""; $itemize = 1; for ($i = 0; $i < strlen($DESIRED_TENDERS[$tender_code]); $i++) { $titleStr .= $DESIRED_TENDERS[$tender_code][$i] . " "; } $titleStr = substr($titleStr, 0, strlen($titleStr) - 1); $receipt .= ReceiptLib::centerString($titleStr) . "\n"; $receipt .= $ref; if ($itemize == 1) { $receipt .= ReceiptLib::centerString("------------------------------------------------------"); } $query = "select tdate,register_no,trans_no,tender_code,tender\n from TenderTapeGeneric where register_no=" . CoreLocal::get("laneno") . " and tender_code = '" . $tender_code . "' order by tdate"; $result = $db_a->query($query); $num_rows = $db_a->num_rows($result); if ($itemize == 1) { $receipt .= $fieldNames; } $sum = 0; for ($i = 0; $i < $num_rows; $i++) { // if (((CoreLocal::get("store") == "harvest-cb") || (CoreLocal::get("store") == "harvest-jp")) && ($tender_code == "PE" || $tender_code == "BU" || $tender_code == "EL" || $tender_code == "PY" || $tender_code == "TV")) $itemize = 1; // else $itemize = 0; $row = $db_a->fetch_array($result); $timeStamp = self::timeStamp($row["tdate"]); if ($itemize == 1) { $receipt .= " " . substr($timeStamp . $blank, 0, 13) . substr($row["register_no"] . $blank, 0, 9) . substr($row["trans_no"] . $blank, 0, 8) . substr($blank . number_format("0", 2), -10) . substr($blank . number_format($row["tender"], 2), -14) . "\n"; } $sum += $row["tender"]; } $receipt .= ReceiptLib::centerString("------------------------------------------------------"); $receipt .= substr($blank . $blank . $blank . "Count: " . $num_rows . " Total: " . number_format($sum, 2), -56) . "\n"; $receipt .= str_repeat("\n", 4); // $receipt .= chr(27).chr(105); } return $receipt . chr(27) . chr(105); }
/** Print a tender report This tender report is based on a single tender tape view rather than multiple views (e.g. ckTenders, ckTenderTotal, etc) adding a new tender is mostly just a matter of adding it to the $DESIRED_TENDERS array (exception being if you want special handling in the tender tape view (e.g., three tender types are actually compined under EBT) */ public static function get() { $DESIRED_TENDERS = CoreLocal::get("TRDesiredTenders"); $DESIRED_TENDERS = array("CK" => "CHECK TENDERS", "CC" => "CREDIT CARD TENDERS", "GD" => "GIFT CARD TENDERS", "TC" => "GIFT CERT TENDERS", "MI" => "STORE CHARGE TENDERS", "EF" => "EBT CARD TENDERS", "CP" => "COUPONS TENDERED", "IC" => "INSTORE COUPONS TENDERED", "ST" => "STAMP BOOKS SOLD", "BP" => "BUS PASSES SOLD", "AR" => "AR PAYMENTS", "EQ" => "EQUITY SALES", "SN" => "SANDWICH CARD", "CF" => "COFFEE CARD", "SC" => "STORE CREDIT"); $db_a = Database::mDataConnect(); $blank = " "; $fieldNames = " " . substr("Time" . $blank, 0, 13) . substr("Lane" . $blank, 0, 9) . substr("Trans #" . $blank, 0, 12) . substr("Change" . $blank, 0, 14) . substr("Amount" . $blank, 0, 14) . "\n"; $ref = ReceiptLib::centerString(trim(CoreLocal::get("CashierNo")) . " " . trim(CoreLocal::get("cashier")) . " " . ReceiptLib::build_time(time())) . "\n\n"; $receipt = ""; $itemize = 0; foreach ($DESIRED_TENDERS as $tender_code => $header) { $query = "select tdate,register_no,trans_no,-total AS tender\n from dlog where emp_no=" . CoreLocal::get("CashierNo") . " and trans_type='T' AND trans_subtype='" . $tender_code . "'\n ORDER BY tdate"; switch ($tender_code) { case 'CC': $query = "select tdate,register_no,trans_no,-total AS tender\n from dlog where emp_no=" . CoreLocal::get("CashierNo") . " and trans_type='T' AND trans_subtype IN ('CC','AX')\n ORDER BY tdate"; break; case 'EF': $query = "select tdate,register_no,trans_no,-total AS tender\n from dlog where emp_no=" . CoreLocal::get("CashierNo") . " and trans_type='T' AND trans_subtype IN ('EF','EC')\n ORDER BY tdate"; break; case 'CP': $query = "select tdate,register_no,trans_no,-total AS tender\n from dlog where emp_no=" . CoreLocal::get("CashierNo") . " and trans_type='T' AND trans_subtype ='CP' AND\n upc NOT LIKE '%MAD%' ORDER BY tdate"; break; case 'SC': $query = "select tdate,register_no,trans_no,-total AS tender\n from dlog where emp_no=" . CoreLocal::get("CashierNo") . " and trans_type='T' AND trans_subtype ='SC' AND\n total<0 ORDER BY tdate"; break; case 'AR': $query = "select tdate,register_no,trans_no,total AS tender\n from dlog where emp_no=" . CoreLocal::get("CashierNo") . " and trans_type='D' AND department = 990\n ORDER BY tdate"; break; case 'EQ': $query = "select tdate,register_no,trans_no,total AS tender\n from dlog where emp_no=" . CoreLocal::get("CashierNo") . " and trans_type='D' AND department IN (991,992)\n ORDER BY tdate"; break; case 'ST': $query = "select tdate,register_no,trans_no,total AS tender\n from dlog where emp_no=" . CoreLocal::get("CashierNo") . " and trans_type='I' AND upc = '0000000001065'\n ORDER BY tdate"; break; case 'BP': $query = "select tdate,register_no,trans_no,total AS tender\n from dlog where emp_no=" . CoreLocal::get("CashierNo") . " and trans_type='I' AND upc IN('0000000007573','0000000007574')\n ORDER BY tdate"; break; case 'SN': $query = "select tdate,register_no,trans_no,total AS tender\n from dlog where emp_no=" . CoreLocal::get("CashierNo") . " and trans_type='I' AND upc LIKE '002001000%'\n ORDER BY tdate"; break; case 'CF': $query = "select tdate,register_no,trans_no,total AS tender\n from dlog where emp_no=" . CoreLocal::get("CashierNo") . " and trans_type='I' AND upc LIKE '002000600%'\n ORDER BY tdate"; break; } $result = $db_a->query($query); $num_rows = $db_a->num_rows($result); if ($num_rows <= 0) { continue; } //$receipt .= chr(27).chr(33).chr(5); $titleStr = ""; for ($i = 0; $i < strlen($header); $i++) { $titleStr .= $header[$i] . " "; } $titleStr = substr($titleStr, 0, strlen($titleStr) - 1); $receipt .= ReceiptLib::centerString($titleStr) . "\n"; $receipt .= $ref; if ($itemize == 1) { $receipt .= ReceiptLib::centerString("------------------------------------------------------"); } $itemize = 1; if ($itemize == 1) { $receipt .= $fieldNames; } $sum = 0; for ($i = 0; $i < $num_rows; $i++) { $row = $db_a->fetch_array($result); $timeStamp = self::timeStamp($row["tdate"]); if ($itemize == 1) { $receipt .= " " . substr($timeStamp . $blank, 0, 13) . substr($row["register_no"] . $blank, 0, 9) . substr($row["trans_no"] . $blank, 0, 8) . substr($blank . number_format("0", 2), -10) . substr($blank . number_format($row["tender"], 2), -14) . "\n"; } $sum += $row["tender"]; } $receipt .= ReceiptLib::centerString("------------------------------------------------------"); $receipt .= substr($blank . $blank . $blank . "Count: " . $num_rows . " Total: " . number_format($sum, 2), -56) . "\n"; $receipt .= str_repeat("\n", 4); $receipt .= chr(27) . chr(105); } return $receipt . chr(27) . chr(105); }
/** Check how many times the coupon has been used and compare against usage limits - e.g., one per transaction, one per member, etc. This is a separate method from checkQualifications() so that calling code has the option of working around limits via voids or amount adjustments @param $id [int] coupon ID @return [boolean] true or [string] error message */ public function checkLimits($id) { $infoW = $this->lookupCoupon($id); if ($infoW === false) { return $this->errorOrQuiet(_('coupon not found'), false); } $prefix = CoreLocal::get('houseCouponPrefix'); if ($prefix == '') { $prefix = '00499999'; } $upc = $prefix . str_pad($id, 5, '0', STR_PAD_LEFT); /* check the number of times this coupon * has been used in this transaction * against the limit */ $transDB = Database::tDataConnect(); $limitQ = "select case when sum(ItemQtty) is null\n then 0 else sum(ItemQtty) end\n from localtemptrans where\n upc = '" . $upc . "'"; $limitR = $transDB->query($limitQ); $limitW = $transDB->fetch_row($limitR); $times_used = $limitW[0]; if ($times_used >= $infoW["limit"]) { return $this->errorOrQuiet(_('coupon already applied'), false); } /** For members, enforce limits against longer transaction history */ if ($infoW["memberOnly"] == 1 && CoreLocal::get("standalone") == 0 && CoreLocal::get('memberID') != CoreLocal::get('visitingMem')) { $mDB = Database::mDataConnect(); // Lookup usage of this coupon by this member // Subquery is to combine today (dlog) // with previous days (dlog_90_view) // Potential replacement for houseCouponThisMonth $monthStart = date('Y-m-01 00:00:00'); $altQ = "SELECT SUM(s.quantity) AS quantity,\n MAX(tdate) AS lastUse\n FROM (\n SELECT upc, card_no, quantity, tdate\n FROM dlog\n WHERE\n trans_type='T'\n AND trans_subtype='IC'\n AND upc='{$upc}'\n AND card_no=" . (int) CoreLocal::get('memberID') . "\n \n UNION ALL\n\n SELECT upc, card_no, quantity, tdate\n FROM dlog_90_view\n WHERE\n trans_type='T'\n AND trans_subtype='IC'\n AND upc='{$upc}'\n AND card_no=" . (int) CoreLocal::get('memberID') . "\n AND tdate >= '{$monthStart}'\n ) AS s\n GROUP BY s.upc, s.card_no"; $mRes = $mDB->query("SELECT quantity \n FROM houseCouponThisMonth\n WHERE card_no=" . CoreLocal::get("memberID") . " and\n upc='{$upc}'"); if ($mDB->num_rows($mRes) > 0) { $mRow = $mDB->fetch_row($mR); $uses = $mRow['quantity']; if ($uses >= $infoW["limit"]) { return $this->errorOrQuiet(_('coupon already used<br />on this membership'), false); } } } return true; }
/** Print a tender report This tender report is based on a single tender tape view rather than multiple views (e.g. ckTenders, ckTenderTotal, etc) adding a new tender is mostly just a matter of adding it to the $DESIRED_TENDERS array (exception being if you want special handling in the tender tape view (e.g., three tender types are actually compined under EBT) */ public static function get() { $DESIRED_TENDERS = CoreLocal::get("TRDesiredTenders"); // $DESIRED_TENDERS = array( // "CK"=>"CHECK TENDERS", // "GD"=>"GIFT CARD TENDERS", // "TC"=>"GIFT CERT TENDERS", // "MI"=>"STORE CHARGE TENDERS", // "EF"=>"EBT CARD TENDERS", // "CP"=>"COUPONS TENDERED", // "IC"=>"INSTORE COUPONS TENDERED", // "AR"=>"AR PAYMENTS", // "EQ"=>"EQUITY SALES" // ); $DESIRED_TENDERS += array("CP" => "COUPONS TENDERED", "FS" => "EBT CARD TENDERS", "CK" => "CHECK TENDERS", "AR" => "ACCOUNTANT ONLY", "EQ" => "EQUITY"); $db_a = Database::mDataConnect(); $blank = " "; $fieldNames = " " . substr("Time" . $blank, 0, 13) . substr("Lane" . $blank, 0, 9) . substr("Trans #" . $blank, 0, 12) . substr("Change" . $blank, 0, 14) . substr("Amount" . $blank, 0, 14) . "\n"; $ref = ReceiptLib::centerString(trim(CoreLocal::get("CashierNo")) . " " . trim(CoreLocal::get("cashier")) . " " . ReceiptLib::build_time(time())) . "\n\n"; $receipt = ""; $itemize = 0; foreach ($DESIRED_TENDERS as $tender_code => $header) { $query = "select tdate,register_no,trans_no,-total AS tender\n from dlog where emp_no=" . CoreLocal::get("CashierNo") . " and trans_type='T' AND trans_subtype='" . $tender_code . "'\n AND total <> 0 ORDER BY tdate"; switch ($tender_code) { case 'FS': $query = "select tdate,register_no,trans_no,-total AS tender\n from dlog where emp_no=" . CoreLocal::get("CashierNo") . " and trans_type='T' AND trans_subtype IN ('EF','EC','EB','EK')\n AND total <> 0 ORDER BY tdate"; break; case 'CK': $query = "select tdate,register_no,trans_no,-total AS tender\n from dlog where emp_no=" . CoreLocal::get("CashierNo") . " and trans_type='T' AND trans_subtype IN ('PE','BU','EL','PY','TV')\n AND total <> 0 ORDER BY tdate"; break; case 'MC': $query = "select tdate,register_no,trans_no,-total AS tender\n from dlog where emp_no=" . CoreLocal::get("CashierNo") . " and trans_type='T' AND trans_subtype IN ('CP','MC') AND\n upc NOT LIKE '%MAD%' AND total <> 0 ORDER BY tdate"; break; case 'AR': $query = "select tdate,register_no,trans_no,total AS tender\n from dlog where emp_no=" . CoreLocal::get("CashierNo") . " and trans_type='D' AND total <> 0 AND department = 98\n ORDER BY tdate"; break; case 'EQ': $query = "select tdate,register_no,trans_no,total AS tender\n from dlog where emp_no=" . CoreLocal::get("CashierNo") . " and trans_type='D' AND department IN (70,71)\n AND total <> 0 ORDER BY tdate"; break; } $result = $db_a->query($query); $num_rows = $db_a->num_rows($result); if ($num_rows <= 0) { continue; } //$receipt .= chr(27).chr(33).chr(5); $titleStr = ""; for ($i = 0; $i < strlen($header); $i++) { $titleStr .= $header[$i] . " "; } $titleStr = substr($titleStr, 0, strlen($titleStr) - 1); $receipt .= ReceiptLib::centerString($titleStr) . "\n"; $receipt .= $ref; if ($itemize == 1) { $receipt .= ReceiptLib::centerString("------------------------------------------------------"); } // $itemize = 1; if ($itemize == 1) { $receipt .= $fieldNames; } $sum = 0; for ($i = 0; $i < $num_rows; $i++) { $row = $db_a->fetch_array($result); $timeStamp = self::timeStamp($row["tdate"]); if ($itemize == 1) { $receipt .= " " . substr($timeStamp . $blank, 0, 13) . substr($row["register_no"] . $blank, 0, 9) . substr($row["trans_no"] . $blank, 0, 8) . substr($blank . number_format("0", 2), -10) . substr($blank . number_format($row["tender"], 2), -14) . "\n"; } $sum += $row["tender"]; } $receipt .= ReceiptLib::centerString("------------------------------------------------------"); $receipt .= substr($blank . $blank . $blank . "Count: " . $num_rows . " Total: " . number_format($sum, 2), -56) . "\n"; $receipt .= str_repeat("\n", 4); // $receipt .= chr(27).chr(105); } return $receipt . chr(27) . chr(105); }
function body_content() { $fes = Authenticate::getPermission(CoreLocal::get('CashierNo')); /* if front end security >= 25, pull all * available receipts; other wise, just * current cashier's receipt */ $result = -1; if ($fes >= 25) { $query = "select emp_no, register_no, trans_no, sum((case when trans_type = 'T' then -1 * total else 0 end)) as total " . "from localtranstoday " . " group by register_no, emp_no, trans_no\n having sum((case when trans_type='T' THEN -1*total ELSE 0 end)) >= 30\n order by register_no,emp_no,trans_no desc"; $db = Database::tDataConnect(); if (CoreLocal::get("standalone") == 0) { $query = str_replace("localtranstoday", "dtransactions", $query); $db = Database::mDataConnect(); } $result = $db->query($query); } else { $db = Database::tDataConnect(); $query = "\n SELECT emp_no, \n register_no, \n trans_no, \n SUM((CASE WHEN trans_type = 'T' THEN -1 * total ELSE 0 END)) AS total \n FROM localtranstoday \n WHERE register_no = ?\n AND emp_no = ?\n AND datetime >= " . $db->curdate() . "\n GROUP BY register_no, \n emp_no, \n trans_no\n HAVING SUM((CASE WHEN trans_type='T' THEN -1*total ELSE 0 END)) >= 30\n ORDER BY trans_no desc"; $args = array(CoreLocal::get('laneno'), CoreLocal::get('CashierNo')); $prep = $db->prepare($query); $result = $db->execute($prep, $args); } $num_rows = $db->num_rows($result); ?> <div class="baseHeight"> <div class="listbox"> <form id="selectform" name="selectform" onsubmit="return submitWrapper();"> <select name="selectlist" size="15" onblur="$('#selectlist').focus()" id="selectlist"> <?php $selected = "selected"; for ($i = 0; $i < $num_rows; $i++) { $row = $db->fetch_array($result); echo "<option value='" . $row["emp_no"] . "-" . $row["register_no"] . "-" . $row["trans_no"] . "'"; echo $selected; echo ">lane " . substr(100 + $row["register_no"], -2) . " Cashier " . $row["emp_no"] . " #" . $row["trans_no"] . " -- \$" . $row["total"]; $selected = ""; } if ($num_rows == 0) { echo "<option selected value=\"\">None found</option>"; } ?> </select> </div> <?php if (CoreLocal::get('touchscreen')) { echo '<div class="listbox listboxText">' . DisplayLib::touchScreenScrollButtons('#selectlist') . '</div>'; } ?> <div class="listboxText coloredText centerOffset"> <?php echo _("use arrow keys to navigate"); ?> <br /> <p> <button type="submit" class="pos-button wide-button coloredArea"> Reprint <span class="smaller">[enter]</span> </button> </p> <p> <button type="submit" class="pos-button wide-button errorColoredArea" onclick="$('#selectlist').append($('<option>').val(''));$('#selectlist').val('');"> Cancel <span class="smaller">[clear]</span> </button></p> </div> </form> <div class="clear"></div> </div> <?php }