当前位置: 首页>>代码示例>>PHP>>正文


PHP Database::tDataConnect方法代码示例

本文整理汇总了PHP中Database::tDataConnect方法的典型用法代码示例。如果您正苦于以下问题:PHP Database::tDataConnect方法的具体用法?PHP Database::tDataConnect怎么用?PHP Database::tDataConnect使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Database的用法示例。


在下文中一共展示了Database::tDataConnect方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: fetch

 /**
   Implementation function
   @return SQL result object
 */
 public function fetch($empNo = false, $laneNo = false, $transNo = false)
 {
     $op_db = CoreLocal::get('pDatabase');
     $sql = Database::tDataConnect();
     $join_table = $op_db . $sql->sep() . 'MasterSuperDepts';
     $column = 's.super_name';
     if (!$sql->table_exists($join_table)) {
         $join_table = $op_db . $sql->sep() . 'subdepts';
         $column = 's.subdept_name';
     }
     $query = 'SELECT l.upc,l.trans_type,l.description,
         l.total,l.percentDiscount,l.trans_status,
         l.charflag,l.scale,l.quantity,l.unitPrice,
         l.ItemQtty,l.matched,l.numflag,l.tax,
         l.foodstamp,l.trans_id,l.department,
         l.trans_subtype,l.regPrice,
         ' . $column . ' AS category 
         FROM localtemptrans AS l 
             LEFT JOIN ' . $join_table . ' AS s ON l.department=s.dept_ID
         WHERE trans_type <> \'L\'
         ORDER BY trans_id DESC';
     if ($empNo && $laneNo && $transNo) {
         $query = sprintf("SELECT l.upc,l.trans_type,l.description,\n                l.total,l.percentDiscount,l.trans_status,\n                l.charflag,l.scale,l.quantity,l.unitPrice,\n                l.ItemQtty,l.matched,l.numflag,l.tax,\n                l.foodstamp,l.trans_id,l.department,\n                l.trans_subtype,l.regPrice,\n                " . $column . " AS category \n                FROM localtranstoday as l \n                    LEFT JOIN " . $join_table . " AS s ON l.department=s.dept_ID\n                WHERE trans_type <> 'L' AND\n                emp_no=%d AND register_no=%d AND trans_no=%d\n                AND datetime >= " . $sql->curdate() . "\n                ORDER BY trans_id DESC", $empNo, $laneNo, $transNo);
     }
     $result = $sql->query($query);
     return $result;
 }
开发者ID:phpsmith,项目名称:IS4C,代码行数:31,代码来源:DefaultReceiptDataFetch.php

示例2: addItem

 function addItem($row, $quantity, $priceObj)
 {
     if ($quantity == 0) {
         return False;
     }
     // enforce limit on discounting sale items
     $dsi = CoreLocal::get('DiscountableSaleItems');
     if ($dsi == 0 && $dsi !== '' && $priceObj->isSale()) {
         $row['discount'] = 0;
     }
     /*
       Use "quantity" field in products record as a per-transaction
       limit. This is analogous to a similar feature with sale items.
     */
     if (!$priceObj->isSale() && $row['quantity'] > 0) {
         $db = Database::tDataConnect();
         $query = "SELECT SUM(quantity) as qty FROM localtemptrans\n                WHERE upc='{$row['upc']}'";
         $result = $db->query($query);
         if ($db->num_rows($result) > 0) {
             $chkRow = $db->fetch_row($result);
             if ($chkRow['qty'] + $quantity > $row['quantity']) {
                 $this->error_msg = _("item only allows ") . $row['quantity'] . _(" per transaction");
                 return False;
             }
         }
     }
     $pricing = $priceObj->priceInfo($row, $quantity);
     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'], 'discount' => $pricing['discount'], 'memDiscount' => $pricing['memDiscount'], 'discountable' => $row['discount'], 'discounttype' => $row['discounttype'], 'ItemQtty' => $quantity, 'volDiscType' => $row['pricemethod'], 'volume' => $row['quantity'], 'VolSpecial' => $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;
 }
开发者ID:phpsmith,项目名称:IS4C,代码行数:30,代码来源:BasicPM.php

示例3: body_content

    function body_content()
    {
        $db = Database::tDataConnect();
        $query = "\n            SELECT register_no, \n                emp_no, \n                trans_no, \n                SUM(CASE \n                    WHEN trans_type='T' AND department=0 THEN -1 * total \n                    ELSE 0 \n                END) AS total \n            FROM localtranstoday \n            WHERE register_no = ?\n                AND emp_no = ?\n                AND datetime >= " . $db->curdate() . "\n            GROUP BY register_no, \n                emp_no, \n                trans_no \n            ORDER BY trans_no DESC";
        $args = array(CoreLocal::get('laneno'), CoreLocal::get('CashierNo'));
        $prep = $db->prepare($query);
        $result = $db->execute($prep, $args);
        $num_rows = $db->num_rows($result);
        ?>

        <div class="baseHeight">
        <div class="listbox">
        <form name="selectform" method="post" id="selectform" 
            action="<?php 
        echo $_SERVER['PHP_SELF'];
        ?>
" >
        <select name="selectlist" size="15" id="selectlist"
            onblur="$('#selectlist').focus()" >

        <?php 
        $selected = "selected";
        for ($i = 0; $i < $num_rows; $i++) {
            $row = $db->fetch_array($result);
            echo "<option value='" . $row["register_no"] . "::" . $row["emp_no"] . "::" . $row["trans_no"] . "'";
            echo $selected;
            echo ">lane " . substr(100 + $row["register_no"], -2) . " Cashier " . substr(100 + $row["emp_no"], -2) . " #" . $row["trans_no"] . " -- \$" . sprintf('%.2f', $row["total"]);
            $selected = "";
        }
        ?>

        </select>
        </div>
        <?php 
        if (CoreLocal::get('touchscreen')) {
            echo '<div class="listbox listboxText">' . DisplayLib::touchScreenScrollButtons('#selectlist') . '</div>';
        }
        ?>
        <div class="listboxText coloredText centerOffset">
        <?php 
        echo _("use arrow keys to navigate");
        ?>
<br />
        <p>
            <button type="submit" class="pos-button wide-button coloredArea">
            Reprint <span class="smaller">[enter]</span>
            </button>
        </p>
        <p>
            <button type="submit" class="pos-button wide-button errorColoredArea"
            onclick="$('#selectlist').append($('<option>').val(''));$('#selectlist').val('');">
            Cancel <span class="smaller">[clear]</span>
        </button></p>
        </div>
        </form>
        <div class="clear"></div>
        </div>

        <?php 
    }
开发者ID:phpsmith,项目名称:IS4C,代码行数:60,代码来源:rplist.php

示例4: savingsMessage

 public function savingsMessage($trans_num)
 {
     if (preg_match('/^(\\d+)\\D+(\\d+)\\D+(\\d+)$/', $trans_num, $matches)) {
         $emp = $matches[1];
         $reg = $matches[2];
         $trans = $matches[3];
     } else {
         return '';
     }
     $db = Database::tDataConnect();
     $query = "\n            SELECT\n                SUM(CASE WHEN discounttype IN (1) THEN discount ELSE 0 END) AS sales,\n                SUM(CASE WHEN trans_status='M' THEN -total ELSE 0 END) AS memSales,\n                SUM(CASE WHEN discounttype IN (2) THEN discount ELSE 0 END) AS availableMemSales,\n                SUM(CASE WHEN upc='DISCOUNT' THEN -total ELSE 0 END) AS transDiscount,\n                SUM(CASE WHEN trans_subtype IN ('CP','IC') THEN -total ELSE 0 END) as coupons,\n                MAX(percentDiscount) AS percentDiscount\n            FROM localtranstoday\n            WHERE emp_no=" . (int) $emp . " AND register_no=" . (int) $reg . " AND trans_no=" . (int) $trans;
     $result = $db->query($query);
     if (!$result || $db->num_rows($result) == 0) {
         return '';
     }
     $row = $db->fetch_row($result);
     $msg = '';
     if ($row['transDiscount'] > 0) {
         $msg .= $row['percentDiscount'] . _('% DISCOUNT SAVINGS = $') . number_format($row['transDiscount'], 2) . "\n";
     }
     if ($row['sales'] + $row['memSales'] > 0) {
         $msg .= _('SALE SAVINGS = $') . number_format($row['sales'] + $row['memSales'], 2) . "\n";
     }
     if ($row['coupons'] > 0) {
         $msg .= _('COUPONS = $') . number_format($row['coupons'], 2) . "\n";
     }
     return $msg;
 }
开发者ID:phpsmith,项目名称:IS4C,代码行数:28,代码来源:SeparateReceiptSavings.php

示例5: next_valid

 /**
   New function: log rows don't appear in screendisplay
   so scrolling by simplying incrementing trans_id
   can land on a "blank" line. It still works if you
   keep scrolling but the cursor disappears from the screen.
   This function finds the next visible line instead.
  
   @param $id the current id
   @param $up bool
     [True] => scroll towards top of screen
     [False] => scroll towards bottom of screen
 */
 function next_valid($id, $up = True)
 {
     $db = Database::tDataConnect();
     $next = $id;
     while (True) {
         $prev = $next;
         $next = $up ? $next - 1 : $next + 1;
         if ($next <= 0) {
             return $prev;
         }
         $r = $db->query("SELECT MAX(trans_id) as max,\n                    SUM(CASE WHEN trans_id={$next} THEN 1 ELSE 0 END) as present\n                    FROM screendisplay");
         if ($db->num_rows($r) == 0) {
             return 1;
         }
         $w = $db->fetch_row($r);
         if ($w['max'] == '') {
             return 1;
         }
         if ($w['present'] > 0) {
             return $next;
         }
         if ($w['max'] <= $next) {
             return $w['max'];
         }
         // failsafe; shouldn't happen
         if ($next > 1000) {
             break;
         }
     }
     return $id;
 }
开发者ID:phpsmith,项目名称:IS4C,代码行数:43,代码来源:ScrollItems.php

示例6: parse

 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);
     }
 }
开发者ID:phpsmith,项目名称:IS4C,代码行数:35,代码来源:WedgeScParser.php

示例7: normalize

 /**
   localtranstoday used to be a view; recreate
   it as a table if needed.
 */
 public function normalize($db_name, $mode = BasicModel::NORMALIZE_MODE_CHECK, $doCreate = False)
 {
     if ($db_name == CoreLocal::get('pDatabase')) {
         $this->connection = Database::pDataConnect();
     } else {
         if ($db_name == CoreLocal::get('tDatabase')) {
             $this->connection = Database::tDataConnect();
         } else {
             echo "Error: Unknown database ({$db_name})";
             return false;
         }
     }
     if ($this->connection->isView($this->name)) {
         if ($mode == BasicModel::NORMALIZE_MODE_CHECK) {
             echo "View {$this->name} should be a table!\n";
             echo "==========================================\n";
             printf("%s table %s\n", "Check complete. Need to drop view & create replacement table.", $this->name);
             echo "==========================================\n\n";
             return 999;
         } else {
             $drop = $this->connection->query('DROP VIEW ' . $this->name);
             echo "==========================================\n";
             printf("Dropping view %s %s\n", $this->name, $drop ? "OK" : "failed");
             if ($drop) {
                 $cResult = $this->create();
                 printf("Update complete. Creation of table %s %s\n", $this->name, $cResult ? "OK" : "failed");
             }
             echo "==========================================\n";
             return true;
         }
     } else {
         return parent::normalize($db_name, $mode, $doCreate);
     }
 }
开发者ID:phpsmith,项目名称:IS4C,代码行数:38,代码来源:LocalTransTodayModel.php

示例8: normalize

 public function normalize($db_name, $mode = BasicModel::NORMALIZE_MODE_CHECK, $doCreate = False)
 {
     if ($db_name == CoreLocal::get('pDatabase')) {
         $this->connection = Database::pDataConnect();
     } else {
         if ($db_name == CoreLocal::get('tDatabase')) {
             $this->connection = Database::tDataConnect();
         } else {
             echo "Error: Unknown database ({$db_name})";
             return false;
         }
     }
     $viewSQL = $this->connection->getViewDefinition($this->name);
     echo "==========================================\n";
     printf("%s view %s\n", $mode == BasicModel::NORMALIZE_MODE_CHECK ? "Checking" : "Updating", "{$db_name}.{$this->name}");
     echo "==========================================\n";
     if (strstr($viewSQL, '0 AS memType') || strstr($viewSQL, '0 AS ' . $this->connection->identifier_escape('memType'))) {
         /**
           Structure-check 27Dec2013
           Make sure memType is calcluated instead of hardcoded to zero
         */
         echo "==========================================\n";
         if ($mode == BasicModel::NORMALIZE_MODE_CHECK) {
             echo "View needs to be rebuild to calculate memType correctly\n";
         } else {
             echo "Rebuilding view to calculate memType correctly... ";
             $this->connection->query('DROP VIEW ' . $this->connection->identifier_escape($this->name));
             $success = $this->create();
             echo ($success ? 'succeeded' : 'failed') . "\n";
         }
     }
     return 0;
 }
开发者ID:phpsmith,项目名称:IS4C,代码行数:33,代码来源:MemDiscountAddModel.php

示例9: parse

 function parse($str)
 {
     $curID = CoreLocal::get("currentid");
     $dbc = Database::tDataConnect();
     $query = "SELECT trans_type,tax,foodstamp FROM localtemptrans WHERE trans_id={$curID}";
     $res = $dbc->query($query);
     if ($dbc->num_rows($res) == 0) {
         return True;
     }
     // shouldn't ever happen
     $item = $dbc->fetch_row($res);
     $query = "SELECT MAX(id) FROM taxrates";
     $res = $dbc->query($query);
     $tax_cap = 0;
     if ($dbc->num_rows($res) > 0) {
         $taxID = $dbc->fetch_row($res);
         $max = $taxID[0];
         if (!empty($max)) {
             $tax_cap = $max;
         }
     }
     $dbc->query($query);
     $next_tax = $item['tax'] + 1;
     $next_fs = 0;
     if ($next_tax > $max) {
         $next_tax = 0;
         $next_fs = 1;
     }
     $query = "UPDATE localtemptrans \n            set tax={$next_tax},foodstamp={$next_fs} \n            WHERE trans_id={$curID}";
     $dbc->query($query);
     $ret = $this->default_json();
     $ret['output'] = DisplayLib::listItems(CoreLocal::get("currenttopid"), $curID);
     return $ret;
     // maintain item cursor position
 }
开发者ID:phpsmith,项目名称:IS4C,代码行数:35,代码来源:TaxFoodShift.php

示例10: standalone_receipt

 public function standalone_receipt($ref, $reprint = false)
 {
     list($emp, $reg, $trans) = explode('-', $ref, 3);
     $ret = 'Date of Application: ' . date('M d, Y') . "\n";
     $ret .= 'Owner Name: ' . CoreLocal::get('fname') . ' ' . CoreLocal::get('lname') . ', Owner No.: ' . CoreLocal::get('memberID') . "\n";
     $ret .= "\n";
     $ret .= ReceiptLib::centerString(str_repeat('_', 30)) . "\n";
     $ret .= ReceiptLib::centerString('Owner Signature') . "\n";
     if (CoreLocal::get('standalone') == 0) {
         $ret .= $this->memAddress();
     }
     $ret .= "\n";
     $ret .= ReceiptLib::centerString(str_repeat('_', 30)) . "\n";
     $ret .= ReceiptLib::centerString('Employee Signature') . "\n";
     $ret .= "\n";
     $ret .= ReceiptLib::centerString(str_repeat('_', 30)) . "\n";
     $ret .= ReceiptLib::centerString('Manager Signature') . "\n";
     $dbc = Database::tDataConnect();
     $query = sprintf('SELECT MAX(numflag) FROM localtemptrans
                     WHERE upc=\'ACCESS\'
                         AND emp_no=%d
                         AND register_no=%d
                         AND trans_no=%d', $emp, $reg, $trans);
     if ($reprint) {
         $query = str_replace('localtemptrans', 'localtranstoday', $query);
     }
     $result = $dbc->query($query);
     if ($dbc->num_rows($result) > 0) {
         $row = $dbc->fetch_row($result);
         if ($row[0] != 0) {
             $ret .= 'Program No: ' . $row[0] . "\n";
         }
     }
     return $ret;
 }
开发者ID:phpsmith,项目名称:IS4C,代码行数:35,代码来源:AccessProgramReceipt.php

示例11: message

 public function message($val, $ref, $reprint = false)
 {
     $date = ReceiptLib::build_time(time());
     list($emp, $reg, $trans) = explode('-', $ref);
     $slip = '';
     // query database for receipt info
     $db = Database::tDataConnect();
     if ($reprint) {
         $db = Database::mDataConnect();
     }
     $query = "SELECT q.amount, q.name, q.PAN, q.refNum,\n                    CASE \n                        WHEN q.mode = 'EBTFOOD_Sale' THEN 'Ebt FS Sale'\n                        WHEN q.mode = 'EBTFOOD_Return' THEN 'Ebt FS Refund'\n                        WHEN q.mode = 'EBTCASH_Sale' THEN 'Ebt Cash Sale'\n                        WHEN q.mode = 'EBTCASH_Return' THEN 'Ebt Cash Refund'\n                        ELSE q.mode\n                    END as ebtMode,\n                    r.xResultMessage, r.xTransactionID\n                  FROM efsnetRequest AS q\n                    LEFT JOIN efsnetResponse AS r ON\n                        q.date = r.date AND\n                        q.laneNo = r.laneNo AND\n                        q.transNo = r.transNo AND\n                        q.transID = r.transID AND\n                        q.cashierNo = r.cashierNo\n                  WHERE r.xResultMessage LIKE '%Approve%'\n                        AND q.mode LIKE 'EBT%'\n                        AND r.validResponse=1\n                        AND q.date=" . date('Ymd') . "\n                        AND q.transNo=" . (int) $trans . "\n                  ORDER BY q.refNum, q.datetime";
     if ($db->table_exists('PaycardTransactions')) {
         $trans_type = $db->concat('p.cardType', "' '", 'p.transType', '');
         $query = "SELECT p.amount,\n                        p.name,\n                        p.PAN,\n                        p.refNum,\n                        {$trans_type} AS ebtMode,\n                        p.xResultMessage,\n                        p.xTransactionID,\n                        p.xBalance,\n                        p.requestDatetime AS datetime\n                      FROM PaycardTransactions AS p\n                      WHERE dateID=" . date('Ymd') . "\n                        AND empNo=" . $emp . "\n                        AND registerNo=" . $reg . "\n                        AND transNo=" . $trans . "\n                        AND p.validResponse=1\n                        AND p.xResultMessage LIKE '%APPROVE%'\n                        AND p.cardType LIKE 'EBT%'\n                      ORDER BY p.requestDatetime";
     }
     $result = $db->query($query);
     $prevRefNum = false;
     while ($row = $db->fetch_row($result)) {
         // failover to mercury's backup server can
         // result in duplicate refnums. this is
         // by design (theirs, not CORE's)
         if ($row['refNum'] == $prevRefNum) {
             continue;
         }
         $slip .= ReceiptLib::centerString("................................................") . "\n";
         // store header
         for ($i = 1; $i <= CoreLocal::get('chargeSlipCount'); $i++) {
             $slip .= ReceiptLib::centerString(CoreLocal::get("chargeSlip" . $i)) . "\n";
         }
         $slip .= "\n";
         $col1 = array();
         $col2 = array();
         $col1[] = $row['ebtMode'];
         $col2[] = "Entry Method: swiped\n";
         $col1[] = "Sequence: " . $row['xTransactionID'];
         $col2[] = "Card: " . $row['PAN'];
         $col1[] = "Authorization: " . $row['xResultMessage'];
         $col2[] = ReceiptLib::boldFont() . "Amount: " . $row['amount'] . ReceiptLib::normalFont();
         $balance = 'unknown';
         $ebt_type = substr(strtoupper($row['ebtMode']), 0, 5);
         if ($ebt_type == 'EBT F' || $ebt_type == 'EBTFO') {
             if (is_numeric(CoreLocal::get('EbtFsBalance'))) {
                 $balance = sprintf('%.2f', CoreLocal::get('EbtFsBalance'));
             }
         } else {
             if ($ebt_type == 'EBT C' || $ebt_type == 'EBTCA') {
                 if (is_numeric(CoreLocal::get('EbtCaBalance'))) {
                     $balance = sprintf('%.2f', CoreLocal::get('EbtCaBalance'));
                 }
             }
         }
         $col1[] = "New Balance: " . $balance;
         $col2[] = '';
         $slip .= ReceiptLib::twoColumns($col1, $col2);
         $slip .= ReceiptLib::centerString("................................................") . "\n";
         $prevRefNum = $row['refNum'];
     }
     return $slip;
 }
开发者ID:phpsmith,项目名称:IS4C,代码行数:59,代码来源:EbtReceiptMessage.php

示例12: priceInfo

 public function priceInfo($row, $quantity = 1)
 {
     if (is_array($this->savedInfo)) {
         return $this->savedInfo;
     }
     $ret = array();
     $ret["regPrice"] = $row['normal_price'];
     $ret["unitPrice"] = $row['special_price'];
     /* if not by weight, just use the sticker price 
           (for scaled items, the UPC parse module
           calculates a weight estimate and sets a quantity
           so normal_price can be used. This could be done
           for all items, but typically the deli doesn't
           keep good track of whether their items are
           marked scale correctly since it only matters when an
           item goes on sale
        */
     if (isset($row['stickerprice']) && $row['scale'] == 0) {
         $ret['regPrice'] = $row['stickerprice'];
     }
     $ret['discount'] = ($ret['regPrice'] - $row['special_price']) * $quantity;
     $ret['memDiscount'] = 0;
     if ($row['line_item_discountable'] == 1 && CoreLocal::get("itemPD") > 0) {
         $discount = $row['special_price'] * (CoreLocal::get("itemPD") / 100);
         $ret["unitPrice"] = $row['special_price'] - $discount;
         $ret["discount"] += $discount * $quantity;
     }
     // enforce per-transaction limit
     if ($row['specialpricemethod'] == 0 && $row['specialquantity'] > 0) {
         $tdb = Database::tDataConnect();
         $chkQ = "SELECT sum(ItemQtty) FROM\n                localtemptrans WHERE upc='{$row['upc']}'";
         if (strlen($row['mixmatchcode']) > 0 && $row['mixmatchcode'][0] == 'b') {
             $chkQ .= " OR mixMatch='{$row['mixmatchcode']}'";
         }
         $chkR = $tdb->query($chkQ);
         $prevSales = 0;
         if ($tdb->num_rows($chkR) > 0) {
             $prevSales = array_pop($tdb->fetch_row($chkR));
         }
         if ($prevSales >= $row['specialquantity']) {
             // already sold the limit; use non-sale price
             $ret['unitPrice'] = $row['normal_price'];
             $ret['discount'] = 0;
         } else {
             if ($prevSales + $quantity > $row['specialquantity']) {
                 // this multiple qty ring will pass the limit
                 // set discount based on appropriate quantity
                 // and adjust unitPrice so total comes out correctly
                 $discountQty = $row['specialquantity'] - $prevSales;
                 $ret['discount'] = ($ret['regPrice'] - $row['special_price']) * $discountQty;
                 $total = $ret['regPrice'] * $quantity - $ret['discount'];
                 $ret['unitPrice'] = MiscLib::truncate2($total / $quantity);
             }
         }
     }
     $this->savedRow = $row;
     $this->savedInfo = $ret;
     return $ret;
 }
开发者ID:phpsmith,项目名称:IS4C,代码行数:59,代码来源:EveryoneSale.php

示例13: dumpRecord

 public static function dumpRecord($trans_id)
 {
     $db = Database::tDataConnect();
     $p = $db->prepare_statement('SELECT * FROM localtemptrans WHERE trans_id=?');
     ob_start();
     var_dump($db->getRow($p, array($trans_id)));
     return ob_get_clean();
 }
开发者ID:phpsmith,项目名称:IS4C,代码行数:8,代码来源:lttLib.php

示例14: doKick

 /**
   Determine whether to open the drawer
   @param $trans_num [string] transaction identifier
   @return boolean
 */
 public function doKick($trans_num)
 {
     if (CoreLocal::get('training') == 1) {
         return false;
     }
     $db = Database::tDataConnect();
     $query = "SELECT trans_id   \n                  FROM localtranstoday \n                  WHERE \n                    (trans_subtype = 'CA' and total <> 0)\n                    AND " . $this->refToWhere($trans_num);
     $result = $db->query($query);
     $num_rows = $db->num_rows($result);
     return $num_rows > 0 ? true : false;
 }
开发者ID:phpsmith,项目名称:IS4C,代码行数:16,代码来源:Kicker.php

示例15: varied_message

 protected function varied_message($ref, $reprint = false, $sigSlip = false)
 {
     if (CoreLocal::get('autoReprint') == 1) {
         $sigSlip = true;
     }
     $date = ReceiptLib::build_time(time());
     list($emp, $reg, $trans) = explode('-', $ref);
     $slip = '';
     // query database for gc receipt info
     $db = Database::tDataConnect();
     if ($reprint) {
         $db = Database::mDataConnect();
     }
     $order = $sigSlip ? 'DESC' : 'ASC';
     $trans_type = $db->concat('p.cardType', "' '", 'p.transType', '');
     $sql = "SELECT {$trans_type} AS tranType,\n                    CASE WHEN p.transType = 'Return' THEN -1*p.amount ELSE p.amount END as amount,\n                    p.registerNo as terminalID,\n                    p.PAN,\n                    CASE WHEN p.manual=1 THEN 'Manual' ELSE 'Swiped' END as entryMethod,\n                    CASE WHEN transType='VOID' THEN '' ELSE p.xApprovalNumber END AS xAuthorizationCode,\n                    p.xBalance,\n                    CASE WHEN transType='VOID' THEN p.xApprovalNumber ELSE '' END AS xVoidCode,\n                    p.transID,\n                    p.requestDatetime AS datetime\n                FROM PaycardTransactions AS p\n                WHERE dateID=" . date('Ymd') . "\n                    AND empNo=" . $emp . "\n                    AND registerNo=" . $reg . "\n                    AND transNo=" . $trans . "\n                    AND p.validResponse=1\n                    AND p.xResultMessage LIKE '%Appro%'\n                    AND p.cardType = 'Gift'\n                ORDER BY p.requestDatetime " . $order;
     $result = $db->query($sql);
     $num = $db->num_rows($result);
     while ($row = $db->fetch_row($result)) {
         $slip .= ReceiptLib::centerString("................................................") . "\n";
         // store header
         for ($i = 1; $i <= CoreLocal::get('chargeSlipCount'); $i++) {
             $slip .= ReceiptLib::centerString(CoreLocal::get("chargeSlip" . $i)) . "\n";
         }
         $slip .= "\n";
         $col1 = array();
         $col2 = array();
         $col1[] = $row['tranType'];
         $col2[] = "Date: " . date('m/d/y h:i a', strtotime($row['datetime']));
         $col1[] = "Terminal ID: " . $row['terminalID'];
         $col2[] = "Reference: " . $ref . "-" . $row['transID'];
         $col1[] = "Card: " . $row['PAN'];
         $col2[] = "Entry Method: " . $row['entryMethod'];
         if ((int) $row['xVoidCode'] > 0) {
             $col1[] = "Void Auth: " . $row['xVoidCode'];
             $col2[] = "Orig Auth: " . $row['xAuthorizationCode'];
         } else {
             $col1[] = "Authorization: " . $row['xAuthorizationCode'];
             $col2[] = "";
         }
         $col1[] = ReceiptLib::boldFont() . "Amount: " . PaycardLib::paycard_moneyFormat($row['amount']) . ReceiptLib::normalFont();
         // bold ttls apbw 11/3/07
         $col2[] = "New Balance: " . PaycardLib::paycard_moneyFormat($row['xBalance']);
         $slip .= ReceiptLib::twoColumns($col1, $col2);
         // name/phone on activation only
         if (($row['tranType'] == 'Gift Card Activation' || $row['tranType'] == 'Gift Card Issue') && $sigSlip) {
             $slip .= "\n" . ReceiptLib::centerString("Name:  ___________________________________") . "\n" . "\n" . ReceiptLib::centerString("Phone: ___________________________________") . "\n";
         }
         $slip .= ReceiptLib::centerString("................................................") . "\n";
     }
     return $slip;
 }
开发者ID:phpsmith,项目名称:IS4C,代码行数:52,代码来源:GCReceiptMessage.php


注:本文中的Database::tDataConnect方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。