コード例 #1
0
ファイル: GiftCardTender.php プロジェクト: phpsmith/IS4C
 /**
   Check for errors
   @return True or an error message string
 */
 public function errorCheck()
 {
     if ($this->amount > CoreLocal::get("amtdue") + 0.005 && CoreLocal::get("amtdue") >= 0) {
         return DisplayLib::xboxMsg(_("tender cannot exceed purchase amount"), DisplayLib::standardClearButton());
     }
     return true;
 }
コード例 #2
0
ファイル: CheckTender.php プロジェクト: phpsmith/IS4C
 /**
   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;
 }
コード例 #3
0
 /**
   Check for errors
   @return True or an error message string
 */
 public function errorCheck()
 {
     if (MiscLib::truncate2(CoreLocal::get("amtdue")) < MiscLib::truncate2($this->amount)) {
         return DisplayLib::xboxMsg(_("tender cannot exceed purchase amount"), DisplayLib::standardClearButton());
     }
     return true;
 }
コード例 #4
0
ファイル: WedgeScParser.php プロジェクト: phpsmith/IS4C
 function parse($str)
 {
     $json = $this->default_json();
     $arg = $this->left;
     CoreLocal::set("sc", 1);
     $staffID = substr($arg, 0, 4);
     $pQuery = "select staffID,chargecode,blueLine from chargecodeview where chargecode = '" . $arg . "'";
     $pConn = Database::pDataConnect();
     $result = $pConn->query($pQuery);
     $num_rows = $pConn->num_rows($result);
     $row = $pConn->fetch_array($result);
     if ($num_rows == 0) {
         $json['output'] = DisplayLib::xboxMsg(_("unable to authenticate staff ") . $staffID, DisplayLib::standardClearButton());
         CoreLocal::set("isStaff", 0);
         // apbw 03/05/05 SCR
         return $json;
     } else {
         CoreLocal::set("isStaff", 1);
         // apbw 03/05/05 SCR
         CoreLocal::set("memMsg", $row["blueLine"]);
         $tQuery = "update localtemptrans set card_no = '" . $staffID . "', percentDiscount = 15";
         $tConn = Database::tDataConnect();
         $this->addscDiscount();
         TransRecord::discountnotify(15);
         $tConn->query($tQuery);
         Database::getsubtotals();
         $chk = self::ttl();
         if ($chk !== True) {
             $json['main_frame'] = $chk;
             return $json;
         }
         CoreLocal::set("runningTotal", CoreLocal::get("amtdue"));
         return self::tender("MI", CoreLocal::get("runningTotal") * 100);
     }
 }
コード例 #5
0
ファイル: CoopCredTender.php プロジェクト: phpsmith/IS4C
 /**
   Check for errors
   @return True or an error message string
 */
 public function errorCheck()
 {
     global $CORE_LOCAL;
     $this->conn = CoopCredLib::ccDataConnect();
     if ($this->conn === False) {
         return "Error: ccDataConnect() failed.";
     }
     $programOK = CoopCredLib::programOK($this->tender_code, $this->conn);
     if ($programOK !== True) {
         return DisplayLib::boxMsg("{$programOK}");
     }
     $subtotals = CoopCredLib::getCCredSubtotals($this->tender_code, $this->conn);
     if ($subtotals !== True) {
         return DisplayLib::boxMsg("{$subtotals}");
     }
     $pc = $CORE_LOCAL->get("CCredProgramCode");
     //$pc = $CORE_LOCAL->get("programCode");
     /* For Refunding the total without entering the exact amount
      *  i.e. with QA alone.
      */
     if ($this->amount == '' && $this->DefaultTotal() < 0) {
         $this->amount = $this->DefaultTotal();
     }
     /* No Available Balance.
      */
     if ($CORE_LOCAL->get("{$pc}availBal") < 0) {
         return DisplayLib::boxMsg(_("Member") . " #" . $CORE_LOCAL->get("memberID") . ' ' . _("does not have enough Coop Cred in ") . '<b>' . $CORE_LOCAL->get("{$pc}programName") . '</b>' . _(" to cover this purchase."));
     }
     /* Tender more than Available Balance
      * the amount remaining less the amount of this type already tendered
      * in the current transaction.
      * I think availBal already includes memChargeTotal.
      */
     if (abs($CORE_LOCAL->get("{$pc}memChargeTotal")) + $this->amount >= $CORE_LOCAL->get("{$pc}availBal") + 0.005) {
         $memChargeCommitted = $CORE_LOCAL->get("{$pc}availBal") + $CORE_LOCAL->get("{$pc}memChargeTotal");
         return DisplayLib::xboxMsg(_("The amount of Coop Cred you have in ") . '<b>' . $CORE_LOCAL->get("{$pc}programName") . '</b>' . _(" is only \$") . number_format($memChargeCommitted, 2) . '.');
     }
     /* Tender more than Amount Due.
      */
     if (MiscLib::truncate2($CORE_LOCAL->get("amtdue")) < MiscLib::truncate2($this->amount)) {
         return DisplayLib::xboxMsg(_("The amount of Coop Cred tendered may not exceed the Amount Due."));
     }
     /* Add the tender to those used in this transaction.
      */
     if ($CORE_LOCAL->get('CCredTendersUsed') == '') {
         $CORE_LOCAL->set('CCredTendersUsed', array("{$this->tender_code}" => $CORE_LOCAL->get("CCredProgramID")));
     } else {
         $tu = $CORE_LOCAL->get('CCredTendersUsed');
         if (!array_key_exists("{$this->tender_code}", $tu)) {
             $tu["{$this->tender_code}"] = $CORE_LOCAL->get("CCredProgramID");
             $CORE_LOCAL->set('CCredTendersUsed', $tu);
         }
     }
     return true;
     // errorCheck()
 }
コード例 #6
0
ファイル: FoodstampTender.php プロジェクト: phpsmith/IS4C
 /**
   Check for errors
   @return True or an error message string
 */
 public function errorCheck()
 {
     if (CoreLocal::get("fntlflag") == 0) {
         return DisplayLib::boxMsg(_("eligible amount must be totaled before foodstamp tender can be accepted"), '', false, array('Total [FS Total]' => 'parseWrapper(\'FNTL\');$(\'#reginput\').focus();', 'Dimiss [clear]' => 'parseWrapper(\'CL\');'));
     } elseif ($this->amount !== false && $this->amount > 0 && $this->amount > CoreLocal::get("fsEligible") + 0.005) {
         return DisplayLib::xboxMsg(_('Foodstamp tender cannot exceed eligible amount'), DisplayLib::standardClearButton());
     } elseif ($this->amount !== false && $this->amount <= 0 && $this->amount < CoreLocal::get("fsEligible") - 0.005) {
         return DisplayLib::xboxMsg(_('Foodstamp return cannot exceed eligible amount' . $info), DisplayLib::standardClearButton());
     }
     return true;
 }
コード例 #7
0
ファイル: ECheckTender.php プロジェクト: phpsmith/IS4C
 /**
   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);
     } else {
         if (CoreLocal::get("isMember") == 0 && $this->amount - CoreLocal::get("amtdue") - 0.005 > 0) {
             return DisplayLib::xboxMsg(_('non-member check tender cannot exceed total purchase'), $clearButton);
         }
     }
     return true;
 }
コード例 #8
0
ファイル: StoreTransferTender.php プロジェクト: phpsmith/IS4C
 /**
   Check for errors
   @return True or an error message string
 */
 public function errorCheck()
 {
     if (MiscLib::truncate2(CoreLocal::get("amtdue")) < MiscLib::truncate2($this->amount)) {
         return DisplayLib::xboxMsg(_("store transfer exceeds purchase amount"), DisplayLib::standardClearButton());
     }
     $db = Database::pDataConnect();
     $query = 'SELECT chargeOk FROM custdata WHERE chargeOk=1 AND CardNo=' . CoreLocal::get('memberID');
     $result = $db->query($query);
     if ($db->num_rows($result) == 0) {
         return DisplayLib::xboxMsg(_("member cannot make transfers"), DisplayLib::standardClearButton());
     }
     return true;
 }
コード例 #9
0
ファイル: StoreChargeTender.php プロジェクト: phpsmith/IS4C
 /**
   Check for errors
   @return True or an error message string
 */
 public function errorCheck()
 {
     $charge_ok = PrehLib::chargeOk();
     $buttons = array('[clear]' => 'parseWrapper(\'CL\');');
     if ($charge_ok == 0) {
         return DisplayLib::boxMsg(_("member") . ' ' . CoreLocal::get("memberID") . '<br />' . _("is not authorized") . '<br />' . _("to make charges"), 'Not Allowed', false, $buttons);
     } else {
         if (CoreLocal::get("availBal") < 0) {
             return DisplayLib::boxMsg(_("member") . ' ' . CoreLocal::get("memberID") . '<br />' . _("is over limit"), 'Over Limit', false, $buttons);
         } elseif (abs(CoreLocal::get("memChargeTotal")) + $this->amount >= CoreLocal::get("availBal") + 0.005) {
             $memChargeRemain = CoreLocal::get("availBal");
             $memChargeCommitted = $memChargeRemain + CoreLocal::get("memChargeTotal");
             return DisplayLib::xboxMsg(_("available balance for charge") . '<br />' . _("is only \$") . $memChargeCommitted, $buttons);
         } elseif (MiscLib::truncate2(CoreLocal::get("amtdue")) < MiscLib::truncate2($this->amount)) {
             return DisplayLib::xboxMsg(_("charge tender exceeds purchase amount"), $buttons);
         }
     }
     return true;
 }
コード例 #10
0
ファイル: TenderModule.php プロジェクト: phpsmith/IS4C
 /**
   Check for errors
   @return True or an error message string
 */
 public function errorCheck()
 {
     //force negative entered value when the total is negative.
     if (CoreLocal::get("amtdue") < 0 && $this->amount >= 0) {
         $this->amount = -1 * $this->amount;
     }
     $clearButton = array('OK [clear]' => 'parseWrapper(\'CL\');');
     if (CoreLocal::get("LastID") == 0) {
         return DisplayLib::boxMsg(_("no transaction in progress"), '', false, $clearButton);
     } elseif (CoreLocal::get('refund') == 1) {
         CoreLocal::set('refund', 0);
         return DisplayLib::boxMsg(_("refund cannot apply to tender"), '', false, $clearButton);
     } else {
         if ($this->amount > 99999.99000000001) {
             return DisplayLib::boxMsg(_("tender amount of") . " " . $this->amount . "<br />" . _("exceeds allowable limit"), '', false, $clearButton);
         } else {
             if (CoreLocal::get("ttlflag") == 0) {
                 return DisplayLib::boxMsg(_("transaction must be totaled before tender can be accepted"), '', false, array('Total [subtotal]' => 'parseWrapper(\'TL\');$(\'#reginput\').focus();', 'Dimiss [clear]' => 'parseWrapper(\'CL\');'));
             } else {
                 if ($this->name_string === "") {
                     return DisplayLib::inputUnknown();
                 } elseif (CoreLocal::get('fntlflag') && CoreLocal::get('fsEligible') < 0 && abs($this->amount - CoreLocal::get('fsEligible')) < 0.005) {
                     // not actually an error
                     // if return tender exactly matches FS elgible return amount
                     // pass through so the subsequent exact amount error
                     // does not occur.
                 } elseif (abs($this->amount - CoreLocal::get('amtdue')) > 0.005 && CoreLocal::get("amtdue") < 0 && $this->amount != 0) {
                     // the return tender needs to be exact because the transaction state can get weird.
                     return DisplayLib::xboxMsg(_("return tender must be exact"), $clearButton);
                 } elseif (CoreLocal::get("amtdue") > 0 && $this->amount < 0) {
                     return DisplayLib::xboxMsg(_("Why are you using a negative number for a positive sale?"), $clearButton);
                 } elseif (CoreLocal::get('TenderHardMinMax') && $this->amount > $this->max_limit) {
                     return DisplayLib::boxMsg("\$" . $this->amount . " " . _("is greater than tender limit for") . " " . $this->name_string, '', false, $clearButton);
                 }
             }
         }
     }
     return true;
 }
コード例 #11
0
ファイル: PaycardLib.php プロジェクト: phpsmith/IS4C
 public static function paycard_errBox($type, $title, $msg, $action)
 {
     return DisplayLib::xboxMsg("<b>" . trim($title) . "</b><p><font size=-1>" . trim($msg) . "<p>" . trim($action) . "</font>");
 }
コード例 #12
0
ファイル: DisabledTender.php プロジェクト: phpsmith/IS4C
 public function errorCheck()
 {
     return DisplayLib::xboxMsg($this->name_string . " " . _("tender disabled"), DisplayLib::standardClearButton());
 }
コード例 #13
0
ファイル: BaseLibsTest.php プロジェクト: phpsmith/IS4C
 public function testDisplayLib()
 {
     $footer = DisplayLib::printfooter();
     $this->assertInternalType('string', $footer);
     $this->assertNotEmpty($footer);
     $pmsg = DisplayLib::plainmsg('test message');
     $this->assertInternalType('string', $pmsg);
     $this->assertNotEmpty($pmsg);
     $this->assertContains('test message', $pmsg);
     $mbox = DisplayLib::msgbox('test msgbox', '', True);
     $this->assertInternalType('string', $mbox);
     $this->assertNotEmpty($mbox);
     $this->assertContains('test msgbox', $mbox);
     $xbox = DisplayLib::xboxMsg('test xboxMsg');
     $this->assertInternalType('string', $xbox);
     $this->assertNotEmpty($xbox);
     $this->assertContains('test xboxMsg', $xbox);
     $bmsg = DisplayLib::boxMsg('test boxMsg', '', True);
     $this->assertInternalType('string', $bmsg);
     $this->assertNotEmpty($bmsg);
     $this->assertContains('test boxMsg', $bmsg);
     $unk = DisplayLib::inputUnknown();
     $this->assertInternalType('string', $unk);
     $this->assertNotEmpty($unk);
     $headerb = DisplayLib::printheaderb();
     $this->assertInternalType('string', $headerb);
     $this->assertNotEmpty($headerb);
     $item = DisplayLib::printItem('name', 'weight', '1.99', 'T', 1);
     $this->assertInternalType('string', $item);
     $this->assertNotEmpty($item);
     $itemC = DisplayLib::printItemColor('004080', 'name', 'weight', '1.99', 'T', 2);
     $this->assertInternalType('string', $itemC);
     $this->assertNotEmpty($itemC);
     $itemH = DisplayLib::printItemColorHilite('004080', 'name', 'weight', '1.99', 'T');
     $this->assertInternalType('string', $itemH);
     $this->assertNotEmpty($itemH);
     CoreLocal::set('weight', 0);
     CoreLocal::set('scale', 0);
     CoreLocal::set('SNR', 0);
     $basic = DisplayLib::scaledisplaymsg();
     $this->assertInternalType('string', $basic);
     $this->assertEquals('0.00 lb', $basic);
     $scale_in_out = array('S11000' => '0.00 lb', 'S11001' => '0.01 lb', 'S11' => '_ _ _ _', 'S141' => '_ _ _ _', 'S143' => '0.00 lb', 'S145' => 'err -0', 'S142' => 'error', 'ASDF' => '? ? ? ?', 'S144000' => '0.00 lb', 'S144002' => '0.02 lb');
     foreach ($scale_in_out as $input => $output) {
         $test = DisplayLib::scaledisplaymsg($input);
         $this->assertInternalType('array', $test);
         $this->assertArrayHasKey('display', $test);
         $this->assertEquals($output, $test['display']);
     }
     $this->assertEquals(1, CoreLocal::get('scale'));
     $this->assertEquals(0.02, CoreLocal::get('weight'));
     CoreLocal::set('SNR', '4011');
     $both = DisplayLib::scaledisplaymsg('S11050');
     $this->assertInternalType('array', $both);
     $this->assertArrayHasKey('display', $both);
     $this->assertArrayHasKey('upc', $both);
     $this->assertEquals('0.50 lb', $both['display']);
     $this->assertEquals('4011', $both['upc']);
     $list = DisplayLib::listItems(0, 0);
     $this->assertInternalType('string', $list);
     $rf = DisplayLib::printReceiptFooter();
     $this->assertInternalType('string', $rf);
     $draw = DisplayLib::drawItems(0, 11, 0);
     $this->assertInternalType('string', $draw);
     $lp = DisplayLib::lastpage();
     $this->assertInternalType('string', $lp);
     $this->assertEquals($lp, $list);
 }