Пример #1
0
 function parse($str)
 {
     CoreLocal::set("msgrepeat", 0);
     CoreLocal::set("strendered", "");
     CoreLocal::set("strRemembered", "");
     CoreLocal::set("SNR", 0);
     // added by apbw 6/04/05 to correct voiding of refunded items
     CoreLocal::set("refund", 0);
     //CoreLocal::set("autoReprint",0);
     if (CoreLocal::get("tare") > 0) {
         TransRecord::addTare(0);
     }
     $ret = $this->default_json();
     $ret['main_frame'] = MiscLib::base_url() . "gui-modules/pos2.php";
     return $ret;
 }
Пример #2
0
 function parse($str)
 {
     $ret = $this->default_json();
     $left = substr($str, 0, strlen($str) - 2);
     if ($left == "") {
         $left = 1;
     }
     if (strlen($left) > 4) {
         $ret['output'] = DisplayLib::boxMsg(MiscLib::truncate2($left / 100) . _(" tare not supported"), _('Invalid Tare'), false, DisplayLib::standardClearButton());
     } elseif ($left / 100 > CoreLocal::get("weight") && CoreLocal::get("weight") > 0) {
         $ret['output'] = DisplayLib::boxMsg(_("Tare cannot be") . "<br />" . _("greater than item weight"), _('Excess Tare'), false, DisplayLib::standardClearButton());
     } else {
         TransRecord::addTare($left);
         $ret['output'] = DisplayLib::lastpage();
     }
     return $ret;
 }
Пример #3
0
 public static function requestTareCallback($tare, $in_item)
 {
     if (is_numeric($tare)) {
         TransRecord::addTare($tare);
         $ret_url = '../../gui-modules/pos2.php?reginput=' . $in_item;
         return $ret_url;
     }
     return False;
 }
Пример #4
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;
 }