Exemple #1
0
 private function addDeposit($upc)
 {
     $upc = str_pad($upc, 13, '0', STR_PAD_LEFT);
     $db = Database::pDataConnect();
     $query = "select description,scale,tax,foodstamp,discounttype,\n            discount,department,normal_price\n                   from products where upc='" . $upc . "'";
     $result = $db->query($query);
     if ($db->num_rows($result) <= 0) {
         return;
     }
     $row = $db->fetch_array($result);
     $description = $row["description"];
     $description = str_replace("'", "", $description);
     $description = str_replace(",", "", $description);
     $scale = 0;
     if ($row["scale"] != 0) {
         $scale = 1;
     }
     list($tax, $foodstamp, $discountable) = PrehLib::applyToggles($row['tax'], $row['foodstamp'], $row['discount']);
     $discounttype = MiscLib::nullwrap($row["discounttype"]);
     $quantity = 1;
     if (CoreLocal::get("quantity") != 0) {
         $quantity = CoreLocal::get("quantity");
     }
     $save_refund = CoreLocal::get("refund");
     TransRecord::addRecord(array('upc' => $upc, 'description' => $description, 'trans_type' => 'I', 'trans_subtype' => 'AD', 'department' => $row['department'], 'quantity' => $quantity, 'ItemQtty' => $quantity, 'unitPrice' => $row['normal_price'], 'total' => $quantity * $row['normal_price'], 'regPrice' => $row['normal_price'], 'scale' => $scale, 'tax' => $tax, 'foodstamp' => $foodstamp, 'discountable' => $discountable, 'discounttype' => $discounttype));
     CoreLocal::set("refund", $save_refund);
 }