Exemplo n.º 1
0
 public function addDiscountLine()
 {
     if (CoreLocal::get("isMember") == 1 || CoreLocal::get("memberID") == CoreLocal::get("visitingMem")) {
         TransRecord::adddiscount($this->savedInfo['memDiscount'], $this->savedRow['department']);
     }
     if ($this->savedInfo['discount'] != 0) {
         TransRecord::adddiscount($this->savedInfo['discount'], $this->savedRow['department']);
     }
 }
Exemplo n.º 2
0
 function parse($str)
 {
     $ret = $this->default_json();
     // this is the currently selected item
     $transID = CoreLocal::get("currentid");
     $row = PrehLib::peekItem(true, $transID);
     if ($row === false) {
         // this shouldn't happen unless there's some weird session problem
         $ret['output'] = DisplayLib::boxMsg(_("Item not found"), '', false, DisplayLib::standardClearButton());
     } else {
         if ($row['trans_type'] != 'I' && $row['trans_type'] != 'D') {
             // only items & open rings are discountable
             $ret['output'] = DisplayLib::boxMsg(_("Line is not discountable"), '', false, DisplayLib::standardClearButton());
         } elseif ($row['discounttype'] != 0) {
             // for simplicity, sale items cannot be discounted
             // this also prevents using this function more than
             // once on a single item
             $ret['output'] = DisplayLib::boxMsg(_("Item already discounted"), '', false, DisplayLib::standardClearButton());
         } else {
             // discount is simply the total times the
             //   non-member discount percentage
             // total is discounted immediately using
             //   the non-member percentage
             // memDiscount is the difference between total
             //   member discount and the non-member discount
             //   since the non-member discount is applied
             //   immediately
             // setting discounttype=2 makes the member discount
             //   apply when a [valid] member number is entered
             $discQ = sprintf("UPDATE localtemptrans SET\n                    discount=(regPrice * quantity * %f), \n                    total=(total-(regPrice*quantity*%f)),\n                    memDiscount=((regPrice*quantity*%f) - (regPrice*quantity*%f)),\n                    discounttype=2\n                    WHERE trans_id=%d", CoreLocal::get("LineItemDiscountNonMem"), CoreLocal::get("LineItemDiscountNonMem"), CoreLocal::get("LineItemDiscountMem"), CoreLocal::get("LineItemDiscountNonMem"), $transID);
             $dbc = Database::tDataConnect();
             $discR = $dbc->query($discQ);
             // add notification line for nonMem discount
             TransRecord::adddiscount($row['regPrice'] * $row['quantity'] * CoreLocal::get("LineItemDiscountNonMem"), $row['department']);
             // footer should be redrawn since savings and totals
             // have changed. Output is the list of items
             $ret['redraw_footer'] = true;
             $ret['output'] = DisplayLib::lastpage();
         }
     }
     return $ret;
 }
Exemplo n.º 3
0
 public function addDiscountLine()
 {
     if (isset($this->savedInfo) && $this->savedInfo['discount'] != 0) {
         TransRecord::adddiscount($this->savedInfo['discount'], $this->savedRow['department']);
     }
 }
Exemplo n.º 4
0
 private static function deptOpenRing($dept, $price, $discount, $ret)
 {
     /**
       Enforce memberOnly flag
     */
     if ($dept['memberOnly'] > 0) {
         switch ($dept['memberOnly']) {
             case 1:
                 // member only, no override
                 if (CoreLocal::get('isMember') == 0) {
                     $ret['output'] = DisplayLib::boxMsg(_(_('Department is member-only'), _('Enter member number first'), false, array('Member Search [ID]' => 'parseWrapper(\'ID\');', 'Dismiss [clear]' => 'parseWrapper(\'CL\');')));
                     return $ret;
                 }
                 break;
             case 2:
                 // member only, can override
                 if (CoreLocal::get('isMember') == 0) {
                     if (CoreLocal::get('msgrepeat') == 0 || CoreLocal::get('lastRepeat') != 'memberOnlyDept') {
                         CoreLocal::set('boxMsg', _('Department is member-only<br />' . '[enter] to continue, [clear] to cancel'));
                         CoreLocal::set('lastRepeat', 'memberOnlyDept');
                         $ret['main_frame'] = $my_url . 'gui-modules/boxMsg2.php';
                         return $ret;
                     } else {
                         if (CoreLocal::get('lastRepeat') == 'memberOnlyDept') {
                             CoreLocal::set('lastRepeat', '');
                         }
                     }
                 }
                 break;
             case 3:
                 // anyone but default non-member
                 if (CoreLocal::get('memberID') == '0') {
                     $ret['output'] = DisplayLib::boxMsg(_(_('Department is member-only'), _('Enter member number first'), false, array('Member Search [ID]' => 'parseWrapper(\'ID\');', 'Dismiss [clear]' => 'parseWrapper(\'CL\');')));
                     return $ret;
                 } else {
                     if (CoreLocal::get('memberID') == CoreLocal::get('defaultNonMem')) {
                         $ret['output'] = DisplayLib::boxMsg(_(_('Department not allowed with this member'), '', false, DisplayLib::standardClearButton()));
                         return $ret;
                     }
                 }
                 break;
         }
     }
     $deptmax = $dept['dept_limit'] ? $dept['dept_limit'] : 0;
     $deptmin = $dept['dept_minimum'] ? $dept['dept_minimum'] : 0;
     $tax = $dept["dept_tax"];
     $foodstamp = $dept['dept_fs'] != 0 ? 1 : 0;
     $deptDiscount = $dept["dept_discount"];
     list($tax, $foodstamp, $deptDiscount) = self::applyToggles($tax, $foodstamp, $deptDiscount);
     if ($price > $deptmax && (CoreLocal::get('OpenRingHardMinMax') || CoreLocal::get("msgrepeat") == 0)) {
         CoreLocal::set("boxMsg", "\$" . $price . " " . _("is greater than department limit"));
         $maxButtons = array('Confirm [enter]' => '$(\'#reginput\').val(\'\');submitWrapper();', 'Cancel [clear]' => '$(\'#reginput\').val(\'CL\');submitWrapper();');
         // remove Confirm button/text if hard limits enforced
         if (CoreLocal::get('OpenRingHardMinMax')) {
             array_shift($maxButtons);
         }
         CoreLocal::set('boxMsgButtons', $maxButtons);
         $ret['main_frame'] = MiscLib::base_url() . 'gui-modules/boxMsg2.php';
     } elseif ($price < $deptmin && (CoreLocal::get('OpenRingHardMinMax') || CoreLocal::get("msgrepeat") == 0)) {
         CoreLocal::set("boxMsg", "\$" . $price . " " . _("is lower than department minimum"));
         $minButtons = array('Confirm [enter]' => '$(\'#reginput\').val(\'\');submitWrapper();', 'Cancel [clear]' => '$(\'#reginput\').val(\'CL\');submitWrapper();');
         if (CoreLocal::get('OpenRingHardMinMax')) {
             array_shift($minButtons);
         }
         CoreLocal::set('boxMsgButtons', $minButtons);
         $ret['main_frame'] = MiscLib::base_url() . 'gui-modules/boxMsg2.php';
     } else {
         if (CoreLocal::get("casediscount") > 0) {
             TransRecord::addcdnotify();
             CoreLocal::set("casediscount", 0);
         }
         TransRecord::addRecord(array('upc' => $price . 'DP' . $dept['dept_no'], 'description' => $dept['dept_name'], 'trans_type' => 'D', 'department' => $dept['dept_no'], 'quantity' => CoreLocal::get('quantity'), 'ItemQtty' => CoreLocal::get('quantity'), 'unitPrice' => $price, 'total' => $price * CoreLocal::get('quantity'), 'regPrice' => $price, 'tax' => $tax, 'foodstamp' => $foodstamp, 'discountable' => $deptDiscount, 'voided' => 0, 'discount' => $discount));
         CoreLocal::set("ttlflag", 0);
         CoreLocal::set("msgrepeat", 0);
         if (CoreLocal::get("itemPD") > 0) {
             TransRecord::adddiscount($discount, $dept);
         }
         $ret['output'] = DisplayLib::lastpage();
         $ret['redraw_footer'] = true;
         $ret['udpmsg'] = 'goodBeep';
     }
     return $ret;
 }
Exemplo n.º 5
0
 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;
 }
Exemplo n.º 6
0
 public function addDiscountLine()
 {
     if (CoreLocal::get("isMember")) {
         TransRecord::adddiscount($this->savedInfo['memDiscount'], $this->savedRow['department']);
     }
 }
Exemplo n.º 7
0
 function addItem($row, $quantity, $priceObj)
 {
     if ($quantity == 0) {
         return false;
     }
     $pricing = $priceObj->priceInfo($row, $quantity);
     // enforce limit on discounting sale items
     $dsi = CoreLocal::get('DiscountableSaleItems');
     if ($dsi == 0 && $dsi !== '' && $priceObj->isSale()) {
         $row['discount'] = 0;
     }
     /* group definition: number of items
        that make up a group, price for a
        full set. Use "special" rows if the
        item is on sale */
     $groupQty = $row['quantity'];
     $groupPrice = $row['groupprice'];
     if ($priceObj->isSale()) {
         $groupQty = $row['specialquantity'];
         $groupPrice = $row['specialgroupprice'];
     }
     /* calculate how many complete sets are
        present in this scan and how many remain
        after complete sets */
     $new_sets = floor($quantity / $groupQty);
     $remainder = $quantity % $groupQty;
     /* add complete sets */
     if ($new_sets > 0) {
         $percentDiscount = 0;
         if (!$priceObj->isSale() && $pricing['unitPrice'] != $row['normal_price']) {
             $percentDiscount = ($row['normal_price'] - $pricing['unitPrice']) / $row['normal_price'];
             $groupPrice *= 1 - $percentDiscount;
         } else {
             if ($priceObj->isSale() && $pricing['unitPrice'] != $row['special_price']) {
                 $percentDiscount = ($row['special_price'] - $pricing['unitPrice']) / $row['special_price'];
                 $groupPrice *= 1 - $percentDiscount;
             }
         }
         /* discount for complete set */
         $discount = $new_sets * ($pricing['unitPrice'] * $groupQty - $groupPrice);
         $total = $new_sets * $groupQty * $pricing['unitPrice'] - $discount;
         $unit = $total / ($new_sets * $groupQty);
         $memDiscount = 0;
         if ($priceObj->isMemberSale() || $priceObj->isStaffSale()) {
             $memDiscount = $discount;
             $discount = 0;
         }
         TransRecord::addRecord(array('upc' => $row['upc'], 'description' => $row['description'], 'trans_type' => 'I', 'trans_subtype' => isset($row['trans_subtype']) ? $row['trans_subtype'] : '', 'department' => $row['department'], 'quantity' => $new_sets * $groupQty, 'unitPrice' => MiscLib::truncate2($unit), 'total' => MiscLib::truncate2($total), 'regPrice' => $pricing['regPrice'], 'scale' => $row['scale'], 'tax' => $row['tax'], 'foodstamp' => $row['foodstamp'], 'discount' => $discount, 'memDiscount' => $memDiscount, 'discountable' => $row['discount'], 'discounttype' => $row['discounttype'], 'ItemQtty' => $new_sets * $groupQty, 'volDiscType' => $priceObj->isSale() ? $row['specialpricemethod'] : $row['pricemethod'], 'volume' => $priceObj->isSale() ? $row['specialquantity'] : $row['quantity'], 'VolSpecial' => $priceObj->isSale() ? $row['specialgroupprice'] : $row['groupprice'], 'mixMatch' => $row['mixmatchcode'], 'matched' => $new_sets * $groupQty, 'cost' => isset($row['cost']) ? $row['cost'] * $new_sets * $groupQty : 0.0, 'numflag' => isset($row['numflag']) ? $row['numflag'] : 0, 'charflag' => isset($row['charflag']) ? $row['charflag'] : ''));
         if ($percentDiscount != 0) {
             $discount -= $pricing['discount'];
         }
         TransRecord::adddiscount($discount, $row['department']);
         $quantity = $quantity - $new_sets * $groupQty;
         if ($quantity < 0) {
             $quantity = 0;
         }
     }
     /* if potential matches remain, check for sets */
     if ($remainder > 0) {
         /* count items in the transaction
            from the given group, minus
            items that have already been used
            in a grouping */
         $mixMatch = $row["mixmatchcode"];
         $queryt = "select sum(ItemQtty - matched) as mmqtty, \n                mixMatch from localtemptrans \n                where trans_status <> 'R' AND \n                mixMatch = '" . $mixMatch . "' group by mixMatch";
         if (!$mixMatch || $mixMatch == '0') {
             $mixMatch = 0;
             $queryt = "select sum(ItemQtty - matched) as mmqtty from " . "localtemptrans where trans_status<>'R' AND " . "upc = '" . $row['upc'] . "' group by upc";
         }
         $dbt = Database::tDataConnect();
         $resultt = $dbt->query($queryt);
         $num_rowst = $dbt->num_rows($resultt);
         $trans_qty = 0;
         if ($num_rowst > 0) {
             $rowt = $dbt->fetch_array($resultt);
             $trans_qty = floor($rowt['mmqtty']);
         }
         /* remainder from current scan plus existing
            unmatched items complete a new set, so
            add one item with the group discount */
         if ($trans_qty + $remainder >= $groupQty) {
             /* adjusted price for the "last" item in a set */
             $priceAdjust = $groupPrice - ($groupQty - 1) * $pricing['unitPrice'];
             $discount = $pricing['unitPrice'] - $priceAdjust;
             $memDiscount = 0;
             if ($priceObj->isMemberSale() || $priceObj->isStaffSale()) {
                 $memDiscount = $discount;
                 $discount = 0;
             }
             TransRecord::addRecord(array('upc' => $row['upc'], 'description' => $row['description'], 'trans_type' => 'I', 'trans_subtype' => isset($row['trans_subtype']) ? $row['trans_subtype'] : '', 'department' => $row['department'], 'quantity' => 1, 'unitPrice' => $pricing['unitPrice'] - $discount, 'total' => $pricing['unitPrice'] - $discount, 'regPrice' => $pricing['regPrice'], 'scale' => $row['scale'], 'tax' => $row['tax'], 'foodstamp' => $row['foodstamp'], 'discount' => $discount, 'memDiscount' => $memDiscount, 'discountable' => $row['discount'], 'discounttype' => $row['discounttype'], 'ItemQtty' => 1, 'volDiscType' => $priceObj->isSale() ? $row['specialpricemethod'] : $row['pricemethod'], 'volume' => $priceObj->isSale() ? $row['specialquantity'] : $row['quantity'], 'VolSpecial' => $priceObj->isSale() ? $row['specialgroupprice'] : $row['groupprice'], 'mixMatch' => $row['mixmatchcode'], 'matched' => $groupQty, 'cost' => isset($row['cost']) ? $row['cost'] * $new_sets * $groupQty : 0.0, 'numflag' => isset($row['numflag']) ? $row['numflag'] : 0, 'charflag' => isset($row['charflag']) ? $row['charflag'] : ''));
             $quantity -= 1;
             if ($quantity < 0) {
                 $quantity = 0;
             }
         }
     }
     /* any remaining quantity added without
        grouping discount */
     if ($quantity > 0) {
         TransRecord::addRecord(array('upc' => $row['upc'], 'description' => $row['description'], 'trans_type' => 'I', 'trans_subtype' => isset($row['trans_subtype']) ? $row['trans_subtype'] : '', 'department' => $row['department'], 'quantity' => $quantity, 'unitPrice' => $pricing['unitPrice'], 'total' => MiscLib::truncate2($pricing['unitPrice'] * $quantity), 'regPrice' => $pricing['regPrice'], 'scale' => $row['scale'], 'tax' => $row['tax'], 'foodstamp' => $row['foodstamp'], 'discountable' => $row['discount'], 'discounttype' => $row['discounttype'], 'ItemQtty' => $quantity, 'volDiscType' => $priceObj->isSale() ? $row['specialpricemethod'] : $row['pricemethod'], 'volume' => $priceObj->isSale() ? $row['specialquantity'] : $row['quantity'], 'VolSpecial' => $priceObj->isSale() ? $row['specialgroupprice'] : $row['groupprice'], 'mixMatch' => $row['mixmatchcode'], 'cost' => isset($row['cost']) ? $row['cost'] * $quantity : 0.0, 'numflag' => isset($row['numflag']) ? $row['numflag'] : 0, 'charflag' => isset($row['charflag']) ? $row['charflag'] : ''));
     }
     return True;
 }
Exemplo n.º 8
0
 public function addDiscountLine()
 {
     if ($this->savedRow['specialpricemethod'] == 0 && $this->savedInfo['discount'] != 0) {
         TransRecord::adddiscount($this->savedInfo['discount'], $this->savedRow['department']);
     }
 }
Exemplo n.º 9
0
 public function testTransRecord()
 {
     if (!class_exists('lttLib')) {
         include 'lttLib.php';
     }
     lttLib::clear();
     CoreLocal::set('infoRecordQueue', array());
     TransRecord::addQueued('1234567890123', 'UNIT TEST', 1, 'UT', 1.99);
     $queue = CoreLocal::get('infoRecordQueue');
     $this->assertInternalType('array', $queue);
     $this->assertEquals(1, count($queue));
     $this->assertArrayHasKey(0, $queue);
     $this->assertInternalType('array', $queue[0]);
     $this->assertArrayHasKey('upc', $queue[0]);
     $this->assertEquals('1234567890123', $queue[0]['upc']);
     $this->assertArrayHasKey('description', $queue[0]);
     $this->assertEquals('UNIT TEST', $queue[0]['description']);
     $this->assertArrayHasKey('numflag', $queue[0]);
     $this->assertEquals(1, $queue[0]['numflag']);
     $this->assertArrayHasKey('charflag', $queue[0]);
     $this->assertEquals('UT', $queue[0]['charflag']);
     $this->assertArrayHasKey('regPrice', $queue[0]);
     $this->assertEquals(1.99, $queue[0]['regPrice']);
     TransRecord::emptyQueue();
     $queue = CoreLocal::get('infoRecordQueue');
     $this->assertInternalType('array', $queue);
     $this->assertEquals(0, count($queue));
     $record = lttLib::genericRecord();
     $record['upc'] = '1234567890123';
     $record['description'] = 'UNIT TEST';
     $record['numflag'] = 1;
     $record['charflag'] = 'UT';
     $record['regPrice'] = 1.99;
     $record['trans_type'] = 'C';
     $record['trans_status'] = 'D';
     lttLib::verifyRecord(1, $record, $this);
     lttLib::clear();
     CoreLocal::set('taxTotal', 1.23);
     TransRecord::addtax();
     $record = lttLib::genericRecord();
     $record['upc'] = 'TAX';
     $record['description'] = 'Tax';
     $record['trans_type'] = 'A';
     $record['total'] = 1.23;
     lttLib::verifyRecord(1, $record, $this);
     lttLib::clear();
     TransRecord::addtender('UT TENDER', 'UT', 2.34);
     $record = lttLib::genericRecord();
     $record['description'] = 'UT TENDER';
     $record['trans_type'] = 'T';
     $record['trans_subtype'] = 'UT';
     $record['total'] = 2.34;
     lttLib::verifyRecord(1, $record, $this);
     lttLib::clear();
     TransRecord::addcomment('UNIT TEST COMMENT');
     $record = lttLib::genericRecord();
     $record['description'] = 'UNIT TEST COMMENT';
     $record['trans_type'] = 'C';
     $record['trans_subtype'] = 'CM';
     $record['trans_status'] = 'D';
     lttLib::verifyRecord(1, $record, $this);
     lttLib::clear();
     TransRecord::addchange(3.14, 'UT');
     $record = lttLib::genericRecord();
     $record['description'] = 'Change';
     $record['trans_type'] = 'T';
     $record['trans_subtype'] = 'UT';
     $record['total'] = 3.14;
     $record['voided'] = 8;
     lttLib::verifyRecord(1, $record, $this);
     lttLib::clear();
     TransRecord::addfsones(3);
     $record = lttLib::genericRecord();
     $record['description'] = 'FS Change';
     $record['trans_type'] = 'T';
     $record['trans_subtype'] = 'FS';
     $record['total'] = 3;
     $record['voided'] = 8;
     lttLib::verifyRecord(1, $record, $this);
     lttLib::clear();
     TransRecord::adddiscount(5.45, 25);
     $record = lttLib::genericRecord();
     $record['description'] = '** YOU SAVED $5.45 **';
     $record['trans_type'] = 'I';
     $record['trans_status'] = 'D';
     $record['department'] = 25;
     $record['voided'] = 2;
     lttLib::verifyRecord(1, $record, $this);
     lttLib::clear();
     TransRecord::addfsTaxExempt();
     $record = lttLib::genericRecord();
     $record['upc'] = 'FS Tax Exempt';
     $record['description'] = ' Fs Tax Exempt ';
     $record['trans_type'] = 'C';
     $record['trans_status'] = 'D';
     $record['voided'] = 17;
     lttLib::verifyRecord(1, $record, $this);
     lttLib::clear();
     TransRecord::discountnotify(5);
     $record = lttLib::genericRecord();
     $record['description'] = '** 5% Discount Applied **';
     $record['trans_status'] = 'D';
     $record['voided'] = 4;
     lttLib::verifyRecord(1, $record, $this);
     lttLib::clear();
     TransRecord::addTaxExempt();
     $record = lttLib::genericRecord();
     $record['description'] = '** Order is Tax Exempt **';
     $record['trans_status'] = 'D';
     $record['voided'] = 10;
     $record['tax'] = 9;
     lttLib::verifyRecord(1, $record, $this);
     $this->assertEquals(1, CoreLocal::get('TaxExempt'));
     lttLib::clear();
     TransRecord::reverseTaxExempt();
     $record = lttLib::genericRecord();
     $record['description'] = '** Tax Exemption Reversed **';
     $record['trans_status'] = 'D';
     $record['voided'] = 10;
     $record['tax'] = 9;
     lttLib::verifyRecord(1, $record, $this);
     $this->assertEquals(0, CoreLocal::get('TaxExempt'));
     lttLib::clear();
     CoreLocal::set('casediscount', 7);
     TransRecord::addcdnotify();
     $record = lttLib::genericRecord();
     $record['description'] = '** 7% Case Discount Applied';
     $record['trans_status'] = 'D';
     $record['voided'] = 6;
     lttLib::verifyRecord(1, $record, $this);
     lttLib::clear();
     TransRecord::addCoupon('0051234512345', 123, -1.23, 1);
     $record = lttLib::genericRecord();
     $record['upc'] = '0051234512345';
     $record['description'] = ' * Manufacturers Coupon';
     $record['trans_type'] = 'I';
     $record['trans_subtype'] = 'CP';
     $record['trans_status'] = 'C';
     $record['department'] = 123;
     $record['unitPrice'] = -1.23;
     $record['total'] = -1.23;
     $record['regPrice'] = -1.23;
     $record['foodstamp'] = 1;
     $record['quantity'] = 1;
     $record['ItemQtty'] = 1;
     lttLib::verifyRecord(1, $record, $this);
     lttLib::clear();
     TransRecord::addhousecoupon('0049999912345', 122, -1.22);
     $record = lttLib::genericRecord();
     $record['upc'] = '0049999912345';
     $record['description'] = ' * Store Coupon';
     $record['trans_type'] = 'I';
     $record['trans_subtype'] = 'IC';
     $record['trans_status'] = 'C';
     $record['department'] = 122;
     $record['unitPrice'] = -1.22;
     $record['total'] = -1.22;
     $record['regPrice'] = -1.22;
     $record['quantity'] = 1;
     $record['ItemQtty'] = 1;
     $record['discountable'] = 1;
     lttLib::verifyRecord(1, $record, $this);
     lttLib::clear();
     TransRecord::additemdiscount(345, 3.45);
     $record = lttLib::genericRecord();
     $record['upc'] = 'ITEMDISCOUNT';
     $record['description'] = ' * Item Discount';
     $record['trans_type'] = 'I';
     $record['department'] = 345;
     $record['unitPrice'] = -3.45;
     $record['total'] = -3.45;
     $record['regPrice'] = -3.45;
     $record['quantity'] = 1;
     $record['ItemQtty'] = 1;
     lttLib::verifyRecord(1, $record, $this);
     lttLib::clear();
     TransRecord::addtare(5);
     $record = lttLib::genericRecord();
     $record['description'] = '** Tare Weight 0.05 **';
     $record['trans_status'] = 'D';
     $record['voided'] = 6;
     lttLib::verifyRecord(1, $record, $this);
     $this->assertEquals(0.05, CoreLocal::get('tare'));
     lttLib::clear();
     CoreLocal::set('transDiscount', 3.24);
     TransRecord::addTransDiscount();
     $record = lttLib::genericRecord();
     $record['upc'] = 'DISCOUNT';
     $record['description'] = 'Discount';
     $record['trans_type'] = 'S';
     $record['quantity'] = 1;
     $record['ItemQtty'] = 1;
     $record['unitPrice'] = -3.24;
     $record['total'] = -3.24;
     lttLib::verifyRecord(1, $record, $this);
     lttLib::clear();
     TransRecord::addCashDrop('90.78');
     $record = lttLib::genericRecord();
     $record['upc'] = 'DROP';
     $record['description'] = 'Cash Drop';
     $record['trans_type'] = 'I';
     $record['trans_status'] = 'X';
     $record['quantity'] = 1;
     $record['ItemQtty'] = 1;
     $record['unitPrice'] = -90.78;
     $record['total'] = -90.78;
     $record['charflag'] = 'CD';
     lttLib::verifyRecord(1, $record, $this);
     lttLib::clear();
     $record = lttLib::genericRecord();
     $record['upc'] = 'UNITTEST';
     $record['description'] = 'Unit Test';
     $record['department'] = 5;
     $record['numflag'] = 4;
     $record['charflag'] = 'UT';
     $record['amount1'] = 1.23;
     $record['total'] = 1.23;
     $record['amount2'] = 1.24;
     $record['regPrice'] = 1.24;
     TransRecord::add_log_record($record);
     unset($record['amount1']);
     // not real column
     unset($record['amount2']);
     // not real column
     $record['trans_type'] = 'L';
     $record['trans_subtype'] = 'OG';
     $record['trans_status'] = 'D';
     lttLib::verifyRecord(1, $record, $this);
     lttLib::clear();
 }