コード例 #1
0
ファイル: ePay.php プロジェクト: rezarahimi4861/icmf
 public function m_invoiceMaker($transactionType, $bankId, $amount = null)
 {
     global $system, $settings, $lang;
     $system->xorg->smarty->assign("MID", $settings['MID']);
     $system->xorg->smarty->assign("RedirectURL", $settings['RedirectURL']);
     $system->xorg->smarty->assign("LogoURL", $settings['LogoURL']);
     $invoiceNumber = $system->dbm->db->findMax("`{$settings['financialInvoice']}`", "invoiceNumber") + 1;
     $timeStamp = time();
     if (empty($amount)) {
         require_once 'module/shop/model/shop.php';
         require_once 'module/eDelivery/model/eDelivery.php';
         $result = mysql_query("SELECT `objectId`, `uid`, `count` FROM `{$settings['basketObject']}` WHERE `uid` = {$_SESSION['uid']}");
         while ($row = mysql_fetch_array($result)) {
             $sellPrice = m_shop::m_sellPriceCalculator($row[objectId]);
             // Insert invoice in financial system
             $system->dbm->db->insert("`{$settings['financialInvoice']}`", "`active`, `owner`, `group`, `or`, `ow`, `ox`, `gr`, `gx`, `timeStamp`, `invoiceNumber`, `objectId`, `uid`, `count`, `price`", "1, 1, 1, 1, 1, 1, 1, 1, {$timeStamp}, {$invoiceNumber}, {$row['objectId']}, {$row['uid']}, {$row['count']}, {$sellPrice}");
             // Insert to eDelivery system
             m_eDelivery::m_addObject($row['objectId']);
         }
         require_once 'module/basket/model/basket.php';
         $amount = m_basket::m_calculate('return');
     }
     $system->xorg->smarty->assign("amount", $amount);
     $countTransaction = $system->dbm->db->max_auto_inc($settings[financialTransaction]);
     $system->xorg->smarty->assign("ResNum", ++$countTransaction);
     // Insert in financial transaction control
     $this->m_insertTrans("BATCH:FOR:{$countTransaction}", $transactionType, $bankId, $amount, $invoiceNumber);
     // Delete from basket
     $system->dbm->db->delete("`{$settings['basketObject']}`", "`uid` = {$_SESSION['uid']}");
     $system->xorg->smarty->display("{$settings['moduleAddress']}/{$settings['moduleName']}/{$settings['viewAddress']}/{$settings['tplAddress']}/direct2Bank" . $settings['ext4']);
 }
コード例 #2
0
ファイル: basket.php プロジェクト: rezarahimi4861/icmf
 public function m_calculate($mode = 'print')
 {
     global $system, $lang, $settings;
     $system->dbm->db->select("`id`, `count`, `objectId`", "`{$settings['basketObject']}`", "`active` = 1 AND `uid` = {$_SESSION['uid']}");
     require_once 'module/shop/model/shop.php';
     while ($row = $system->dbm->db->fetch_array()) {
         $row[sellPrice] = m_shop::m_sellPriceCalculator($row[objectId]);
         $row[totalMulPrice] = $row[count] * $row[sellPrice];
         $caculate += $row[totalMulPrice];
     }
     require_once 'module/eDelivery/model/eDelivery.php';
     $caculate = $caculate + m_eDelivery::m_totalPrice();
     if ($mode == 'return') {
         return $caculate;
     } else {
         echo $caculate;
     }
 }