コード例 #1
0
ファイル: Totals.php プロジェクト: phpsmith/IS4C
 function parse($str)
 {
     $ret = $this->default_json();
     if ($str == "FNTL") {
         $ret['main_frame'] = MiscLib::base_url() . 'gui-modules/fsTotalConfirm.php';
     } elseif ($str == "TETL") {
         $ret['main_frame'] = MiscLib::base_url() . 'gui-modules/requestInfo.php?class=Totals';
     } elseif ($str == "FTTL") {
         PrehLib::finalttl();
     } elseif ($str == "TL") {
         CoreLocal::set('End', 0);
         $chk = PrehLib::ttl();
         if ($chk !== True) {
             $ret['main_frame'] = $chk;
         }
     } elseif ($str == "MTL") {
         $chk = PrehLib::omtr_ttl();
         if ($chk !== True) {
             $ret['main_frame'] = $chk;
         }
     } elseif ($str == "WICTL") {
         $ttl = PrehLib::wicableTotal();
         $ret['output'] = DisplayLib::boxMsg(_('WIC Total') . sprintf(': $%.2f', $ttl), '', true, DisplayLib::standardClearButton());
         // return early since output has been set
         return $ret;
     }
     if (!$ret['main_frame']) {
         $ret['output'] = DisplayLib::lastpage();
         $ret['redraw_footer'] = True;
     }
     return $ret;
 }
コード例 #2
0
ファイル: BaseLibsTest.php プロジェクト: phpsmith/IS4C
 public function testPrehLib()
 {
     if (!class_exists('lttLib')) {
         include 'lttLib.php';
     }
     lttLib::clear();
     TransRecord::addcomment('peek');
     $peek = PrehLib::peekItem();
     $this->assertEquals('peek', $peek);
     lttLib::clear();
     CoreLocal::set('percentDiscount', 5);
     CoreLocal::set('transDiscount', 0.51);
     CoreLocal::set('taxTotal', 1.45);
     CoreLocal::set('fsTaxExempt', 1.11);
     CoreLocal::set('amtdue', 9.550000000000001);
     // should add four records
     PrehLib::finalttl();
     // verify discount record
     $record = lttLib::genericRecord();
     $record['description'] = 'Discount';
     $record['trans_type'] = 'C';
     $record['trans_status'] = 'D';
     $record['unitPrice'] = -0.51;
     $record['voided'] = 5;
     lttLib::verifyRecord(1, $record, $this);
     // verify subtotal record
     $record = lttLib::genericRecord();
     $record['upc'] = 'Subtotal';
     $record['description'] = 'Subtotal';
     $record['trans_type'] = 'C';
     $record['trans_status'] = 'D';
     $record['unitPrice'] = 0.34;
     $record['voided'] = 11;
     lttLib::verifyRecord(2, $record, $this);
     // verify fs tax exempt record
     $record = lttLib::genericRecord();
     $record['upc'] = 'Tax';
     $record['description'] = 'FS Taxable';
     $record['trans_type'] = 'C';
     $record['trans_status'] = 'D';
     $record['unitPrice'] = 1.11;
     $record['voided'] = 7;
     lttLib::verifyRecord(3, $record, $this);
     // verify total record
     $record = lttLib::genericRecord();
     $record['upc'] = 'Total';
     $record['description'] = 'Total';
     $record['trans_type'] = 'C';
     $record['trans_status'] = 'D';
     $record['unitPrice'] = 9.550000000000001;
     $record['voided'] = 11;
     lttLib::verifyRecord(4, $record, $this);
     lttLib::clear();
     CoreLocal::set('cashierAge', 17);
     CoreLocal::set('cashierAgeOverride', 0);
     list($age_required, $json) = PrehLib::ageCheck(21, array());
     $this->assertEquals(true, $age_required);
     $this->assertInternalType('array', $json);
     CoreLocal::set('cashierAgeOverride', 1);
     list($age_required, $json) = PrehLib::ageCheck(21, array());
     $this->assertEquals(true, $age_required);
     $this->assertInternalType('array', $json);
     CoreLocal::set('memAge', date('Ymd', strtotime('21 years ago')));
     list($age_required, $json) = PrehLib::ageCheck(21, array());
     $this->assertEquals(false, $age_required);
     $this->assertInternalType('array', $json);
     CoreLocal::set('memAge', date('Ymd', strtotime('20 years ago')));
     list($age_required, $json) = PrehLib::ageCheck(21, array());
     $this->assertEquals(true, $age_required);
     $this->assertInternalType('array', $json);
 }