コード例 #1
0
ファイル: class.display.php プロジェクト: SjayLiFe/CTRev
 /**
  * Преобразование получаемого времени в UNIXTIME
  * @param string $name префикс поля
  * @param string $must_be обязательные поля для выборки времени(формат ymdhis)
  * @return int время в формате UNIXTIME
  */
 public function make_time($name = "", $must_be = "")
 {
     $name = $name ? $name . "_" : "";
     $yarr = array("year", "month", "day", "hour", "minute", "second");
     if ($must_be) {
         $must_be = strtolower($must_be);
         foreach ($yarr as $field) {
             if ($field == "minute") {
                 $f = "i";
             } else {
                 $f = $field[0];
             }
             if (strpos($must_be, $f) !== false && !longval($_REQUEST[$name . $field])) {
                 return 0;
             }
         }
     }
     $r = unsigned(@mktime((int) $_REQUEST[$name . "hour"], (int) $_REQUEST[$name . "minute"], (int) $_REQUEST[$name . "second"], (int) $_REQUEST[$name . "month"], (int) $_REQUEST[$name . "day"], (int) $_REQUEST[$name . "year"]));
     return $r;
 }
コード例 #2
0
ファイル: classBank.php プロジェクト: quangbt2005/vhost-kis
 function confirmInternalTransfer($ID, $UpdatedBy, $FromAccountNo, $ToAccountNo, $Amount)
 {
     $function_name = 'confirmInternalTransfer';
     $struct = '{urn:' . $this->class_name . '}' . $function_name . 'Struct';
     if (authenUser(func_get_args(), $this, $function_name) > 0) {
         return returnXML(func_get_args(), $this->class_name, $function_name, $this->_ERROR_CODE, $this->items, $this);
     }
     if (!required($ID) || !unsigned($ID) || !required($FromAccountNo) || !required($ToAccountNo) || !required($Amount) || !unsigned($Amount)) {
         if (!required($ID) || !unsigned($ID)) {
             $this->_ERROR_CODE = 13175;
         }
         if (!required($FromAccountNo)) {
             $this->_ERROR_CODE = 13176;
         }
         if (!required($ToAccountNo)) {
             $this->_ERROR_CODE = 13177;
         }
         if (!required($Amount) || !unsigned($Amount)) {
             $this->_ERROR_CODE = 13178;
         }
     } else {
         $query = sprintf("CALL sp_VirtualBank_confirmInternalTransfer(%u, '%s' )", $ID, $UpdatedBy);
         $rs = $this->_MDB2_WRITE->extended->getRow($query);
         if (empty($rs)) {
             $this->_ERROR_CODE = 13179;
         } else {
             $result = $rs['varerror'];
             $content = date("d/m/Y H:i:s") . "\tChuyen khoan: ID => {$ID}, FromAccountNo => {$FromAccountNo}, ToAccountNo => {$ToAccountNo}, Amount => {$Amount}, UpdatedBy => {$UpdatedBy} --> {$result}";
             write_log($function, $content, VIRTUAL_BANK_LOG_FILE_PATH);
             if ($result < 0) {
                 switch ($result) {
                     case '-1':
                         $this->_ERROR_CODE = 13180;
                         break;
                     case '-2':
                         $this->_ERROR_CODE = 13181;
                         break;
                     case '-3':
                         $this->_ERROR_CODE = 13182;
                         break;
                     case '-4':
                         $this->_ERROR_CODE = 13183;
                         break;
                     case '-5':
                         $this->_ERROR_CODE = 13184;
                         break;
                     case '-6':
                         $this->_ERROR_CODE = 13185;
                         break;
                     default:
                         $this->_ERROR_CODE = $result;
                 }
                 //switch
             } else {
                 //if
                 $soap =& new Bravo();
                 $date = date("Y-m-d");
                 $withdrawValue = array("TradingDate" => $date, 'TransactionType' => INTERNAL_TRANSFER, "AccountNo" => $FromAccountNo, "Amount" => $Amount, "Fee" => 0, "Bank" => VIRTUAL_BANK_BANKCODE, "Note" => "Chuyen khoan");
                 $ret = $soap->withdraw($withdrawValue);
                 if ($ret['table0']['Result'] != 1) {
                     // success
                     switch ($ret['table0']['Result']) {
                         case '-2':
                             $this->_ERROR_CODE = 23002;
                             break;
                         case '-1':
                             $this->_ERROR_CODE = 23003;
                             break;
                         case '-13':
                             $this->_ERROR_CODE = 23006;
                             break;
                         case '-15':
                             $this->_ERROR_CODE = 23005;
                             break;
                         case '-16':
                             $this->_ERROR_CODE = 23004;
                             break;
                         default:
                             $this->_ERROR_CODE = 'Bravo' . $ret['table0']['Result'];
                     }
                     //switch
                 } else {
                     $arrDeposit = array("TradingDate" => $date, "TransactionType" => INTERNAL_TRANSFER, "AccountNo" => $ToAccountNo, "Amount" => $Amount, "Fee" => 0, "Bank" => VIRTUAL_BANK_BANKCODE, "Note" => "Chuyen khoan");
                     $bravo_result = $bravo_service->deposit($arrDeposit);
                     if ($bravo_result['table0']['Result'] != 1) {
                         switch ($result) {
                             case '-1':
                                 $this->_ERROR_CODE = 23003;
                                 break;
                             case '-2':
                                 $this->_ERROR_CODE = 23002;
                                 break;
                             case '-13':
                                 $this->_ERROR_CODE = 23006;
                                 break;
                             case '-15':
                                 $this->_ERROR_CODE = 23005;
                                 break;
                             case '-16':
                                 $this->_ERROR_CODE = 23004;
                                 break;
                         }
                         //switch
                     }
                     //if
                 }
                 //else
             }
         }
         //if WS
     }
     return returnXML(func_get_args(), $this->class_name, $function_name, $this->_ERROR_CODE, $this->items, $this);
 }
コード例 #3
0
 /**
 	Function: lockMoney
 */
 function lockMoney($OrderID, $Amount, $AccountNo)
 {
     $function_name = 'lockMoney';
     $struct = '{urn:' . $this->class_name . '}' . $function_name . 'Struct';
     if (authenUser(func_get_args(), $this, $function_name) > 0) {
         return returnXML(func_get_args(), $this->class_name, $function_name, $this->_ERROR_CODE, $this->items, $this);
     }
     if (!required($OrderID) || !unsigned($OrderID) || !required($Amount) || !unsigned($Amount) || !required($AccountNo)) {
         if (!required($OrderID) || !unsigned($OrderID)) {
             $this->_ERROR_CODE = 34430;
         }
         if (!required($Amount) || !unsigned($Amount)) {
             $this->_ERROR_CODE = 34431;
         }
         if (!required($AccountNo)) {
             $this->_ERROR_CODE = 34432;
         }
     } else {
         //block money in bank
         $query = sprintf("SELECT * FROM vw_ListAccountBank_Detail WHERE AccountNo='%s' ORDER BY Priority ", $AccountNo);
         $bank_rs = $this->_MDB2->extended->getAll($query);
         $dab_rs = 999;
         for ($i = 0; $i < count($bank_rs); $i++) {
             switch ($bank_rs[$i]['bankid']) {
                 case DAB_ID:
                     $dab =& new CDAB();
                     $dab_rs = $dab->blockMoney($bank_rs[$i]['bankaccount'], $bank_rs[$i]['cardno'], $AccountNo, $OrderID, $Amount, date('Y-m-d'));
                     break;
                 case VCB_ID:
                     $dab =& new CVCB();
                     $suffix = date("His");
                     $newOrderID = $OrderID . $suffix;
                     $dab_rs = $dab->blockMoney($AccountNo, $newOrderID, $Amount);
                     $query = sprintf(" CALL sp_updateUnitCode(%u, '%s' )", $OrderID, $suffix);
                     $rs = $this->_MDB2_WRITE->extended->getRow($query);
                     $this->_MDB2_WRITE->disconnect();
                     $this->_MDB2_WRITE->connect();
                     break;
                 case NVB_ID:
                     $dab =& new CNVB();
                     $dab_rs = $dab->blockMoney(substr($OrderID . date("His"), 3), $bank_rs[$i]['bankaccount'], $Amount, $OrderID);
                     break;
                 case OFFLINE:
                     $query = sprintf("CALL sp_VirtualBank_Lock('%s', %u,  %u, %f, '%s', '%s')", $AccountNo, OFFLINE, $OrderID, $Amount, $OrderDate, $CreatedBy);
                     $this->_MDB2_WRITE->connect();
                     $off_rs = $this->_MDB2_WRITE->extended->getRow($query);
                     $this->_MDB2_WRITE->disconnect();
                     $dab_rs = $off_rs['varerror'];
                     break;
             }
             if ($dab_rs == 0) {
                 $query = sprintf("CALL sp_updateBankIDWhenInsertWarningOrder( %u, %u ) ", $OrderID, $bank_rs[$i]['bankid']);
                 $status_rs = $this->_MDB2_WRITE->extended->getRow($query);
                 if (empty($status_rs)) {
                     $this->_ERROR_CODE = 34145;
                 }
                 break;
             }
         }
         if ($dab_rs != 0) {
             //fail
             $i = $i - 1;
             switch ($bank_rs[$i]['bankid']) {
                 case DAB_ID:
                     switch ($dab_rs) {
                         case '-1':
                             $this->_ERROR_CODE = 41020;
                             break;
                         case '-2':
                             $this->_ERROR_CODE = 41021;
                             break;
                         case '-3':
                             $this->_ERROR_CODE = 41022;
                             break;
                         case '-4':
                             $this->_ERROR_CODE = 41023;
                             break;
                         case '-5':
                             $this->_ERROR_CODE = 41024;
                             break;
                         case '1':
                             $this->_ERROR_CODE = 41025;
                             break;
                         case '2':
                             $this->_ERROR_CODE = 41026;
                             break;
                         case '3':
                             $this->_ERROR_CODE = 41027;
                             break;
                         case '4':
                             $this->_ERROR_CODE = 41028;
                             break;
                         case '5':
                             $this->_ERROR_CODE = 41030;
                             break;
                         case '99':
                             $this->_ERROR_CODE = 41029;
                             break;
                         default:
                             $this->_ERROR_CODE = $dab_rs;
                     }
                     break;
                 case VCB_ID:
                     $this->_ERROR_CODE = $dab_rs;
                     break;
                 case NVB_ID:
                     $this->_ERROR_CODE = $dab_rs;
                     break;
                 case OFFLINE:
                     switch ($dab_rs) {
                         case '-1':
                             $this->_ERROR_CODE = 30650;
                             break;
                         case '-2':
                             $this->_ERROR_CODE = 30651;
                             break;
                         case '-3':
                             $this->_ERROR_CODE = 30652;
                             break;
                         case '-4':
                             $this->_ERROR_CODE = 30653;
                             break;
                         default:
                             $this->_ERROR_CODE = $dab_rs;
                     }
                     break;
             }
             //switch
         }
     }
     return returnXML(func_get_args(), $this->class_name, $function_name, $this->_ERROR_CODE, $this->items, $this);
 }
コード例 #4
0
 function insertBuyingStockDivident($AccountID, $BankID, $Amount, $DepositDate, $Note, $CreatedBy)
 {
     $function_name = 'insertBuyingStockDivident';
     $struct = '{urn:' . $this->class_name . '}' . $function_name . 'Struct';
     if (authenUser(func_get_args(), $this, $function_name) > 0) {
         return returnXML(func_get_args(), $this->class_name, $function_name, $this->_ERROR_CODE, $this->items, $this);
     }
     if (!required($AccountID) || !unsigned($AccountID) || !required($BankID) || !unsigned($BankID) || !required($Amount) || !unsigned($Amount) || !required($DepositDate)) {
         if (!required($AccountID) || !unsigned($AccountID)) {
             $this->_ERROR_CODE = 22230;
         }
         if (!required($BankID) || !unsigned($BankID)) {
             $this->_ERROR_CODE = 22231;
         }
         if (!required($Amount) || !unsigned($Amount)) {
             $this->_ERROR_CODE = 22232;
         }
         if (!required($DepositDate)) {
             $this->_ERROR_CODE = 22233;
         }
     } else {
         $query = sprintf("CALL sp_VirtualBank_insertBuyingStockDivident(%u, %u, %f, '%s', '%s', '%s' )", $AccountID, $BankID, $Amount, $DepositDate, $Note, $CreatedBy);
         $rs = $this->_MDB2_WRITE->extended->getRow($query);
         if (empty($rs)) {
             $this->_ERROR_CODE = 22234;
         } else {
             $result = $rs['varerror'];
             if ($result < 0) {
                 switch ($result) {
                     case '-1':
                         $this->_ERROR_CODE = 22235;
                         break;
                     case '-2':
                         $this->_ERROR_CODE = 22236;
                         break;
                     case '-3':
                         $this->_ERROR_CODE = 22237;
                         break;
                     case '-4':
                         $this->_ERROR_CODE = 22238;
                         break;
                     case '-5':
                         $this->_ERROR_CODE = 22239;
                         break;
                     case '-9':
                         $this->_ERROR_CODE = 22240;
                         break;
                     default:
                         $this->_ERROR_CODE = $result;
                 }
             }
         }
     }
     return returnXML(func_get_args(), $this->class_name, $function_name, $this->_ERROR_CODE, $this->items, $this);
 }
コード例 #5
0
ファイル: classOrder.php プロジェクト: quangbt2005/vhost-kis
 function displayOrder($StockExchangeID, $IsVIP, $OrderDate, $UpdatedBy)
 {
     $function_name = 'displayOrder';
     $struct = '{urn:' . $this->class_name . '}' . $function_name . 'Struct';
     if (authenUser(func_get_args(), $this, $function_name) > 0) {
         return returnXML(func_get_args(), $this->class_name, $function_name, $this->_ERROR_CODE, $this->items, $this);
     }
     if (!required($StockExchangeID) || !unsigned($StockExchangeID) || !required($IsVIP) || !required($OrderDate)) {
         if (!required($StockExchangeID) || !unsigned($StockExchangeID)) {
             $this->_ERROR_CODE = 30530;
         }
         if (!required($IsVIP)) {
             $this->_ERROR_CODE = 30531;
         }
         if (!required($OrderDate)) {
             $this->_ERROR_CODE = 30532;
         }
     } else {
         $query = sprintf("CALL sp_Order_getOrderInfoToSend(%u, %u, '%s')", $StockExchangeID, $IsVIP, $OrderDate);
         $result = $this->_MDB2->extended->getRow($query);
         if ($result['id'] > 0) {
             $query = sprintf("CALL sp_order_updateFromApprovedToTranfered(%u, '%s')", $result['id'], $UpdatedBy);
             $rs = $this->_MDB2_WRITE->extended->getRow($query);
             if (empty($rs)) {
                 $this->_ERROR_CODE = 30533;
             } else {
                 $updateResult = $rs['varerror'];
                 if ($updateResult < 0) {
                     switch ($updateResult) {
                         case '-1':
                             $this->_ERROR_CODE = 30534;
                             break;
                         case '-2':
                             $this->_ERROR_CODE = 30535;
                             break;
                         case '-3':
                             $this->_ERROR_CODE = 30536;
                             break;
                         default:
                             $this->_ERROR_CODE = 666;
                     }
                     //switch
                 } else {
                     // if result
                     $this->items[0] = new SOAP_Value('item', $struct, array("ID" => new SOAP_Value("ID", "string", $result['id']), "AccountNo" => new SOAP_Value("AccountNo", "string", $result['accountno']), "Symbol" => new SOAP_Value("Symbol", "string", $result['symbol']), "OrderQuantity" => new SOAP_Value("OrderQuantity", "string", $result['orderquantity']), "OrderPrice" => new SOAP_Value("OrderPrice", "string", $result['orderprice']), "OrderSideName" => new SOAP_Value("OrderSideName", "string", $result['ordersidename']), "Note" => new SOAP_Value("Note", "string", $result['note']), "OrderStyleName" => new SOAP_Value("OrderStyleName", "string", $result['orderstylename'])));
                 }
             }
             // if store
         }
     }
     //requirement
     return returnXML(func_get_args(), $this->class_name, $function_name, $this->_ERROR_CODE, $this->items, $this);
 }
コード例 #6
0
 function updatePaymentContract($PaymentContractID, $PaymentContractDetail, $UpdatedBy)
 {
     $mdbwrite2 = initWriteDB();
     if ($this->_ERROR_CODE == 0) {
         if (!required($PaymentContractID) || !unsigned($PaymentContractID)) {
             $this->_ERROR_CODE = 21001;
         }
         if ($this->_ERROR_CODE == 0 && (!required($PaymentContractDetail) || !unsigned($PaymentContractDetail))) {
             $this->_ERROR_CODE = 21027;
         }
     }
     if ($this->_ERROR_CODE == 0) {
         $query = sprintf("CALL `sp_updatePaymentContractID` ('%s','%s','%s')", $PaymentContractID, $PaymentContractDetail, $UpdatedBy);
         //echo $query;
         $result = $mdbwrite2->extended->getAll($query);
         if (empty($result) || is_object($result)) {
             $this->_ERROR_CODE = 21002;
             write_my_log_path('ErrorCallStore', $query . '  ' . $result->backtrace[0]['args'][4], ADVANCE_PATH);
         } else {
             if (isset($result[0]['varerror'])) {
                 /*Invalid PaymentContractID*/
                 if ($result[0]['varerror'] == -1) {
                     $this->_ERROR_CODE = 21001;
                 } else {
                     if ($result[0]['varerror'] == -2) {
                         /*mortage contract detail khong thuoc vao mortage contract can giai toa*/
                         $this->_ERROR_CODE = 21036;
                     } else {
                         if ($result[0]['varerror'] == -9998) {
                             // Exception
                             $this->_ERROR_CODE = 21024;
                         } else {
                             if ($result[0]['varerror'] < 0) {
                                 $this->_ERROR_CODE = 22134;
                                 write_my_log_path($function_name, $query . '  VarError ' . $result[0]['varerror'], ADVANCE_PATH);
                             }
                         }
                     }
                 }
             }
         }
     }
     return $this->_ERROR_CODE;
     //returnXML($class_name, $function_name, $this->_ERROR_CODE, $this->items);
 }
コード例 #7
0
 function InsertExtraCollectDisbursement($AccountID, $Amount, $BankID, $TradingDate, $Note, $TranTypeID, $CreatedBy)
 {
     $function_name = 'InsertExtraCollectDisbursement';
     $struct = '{urn:' . $this->class_name . '}' . $function_name . 'Struct';
     if (authenUser(func_get_args(), $this, $function_name) > 0) {
         return returnXML(func_get_args(), $this->class_name, $function_name, $this->_ERROR_CODE, $this->items, $this);
     }
     if (!required($AccountID) || !unsigned($AccountID) || !required($Amount) || !unsigned($Amount)) {
         if (!required($AccountID) || !unsigned($AccountID)) {
             $this->_ERROR_CODE = 31445;
         }
         if (!required($Amount) || !unsigned($Amount)) {
             $this->_ERROR_CODE = 31446;
         }
     } else {
         $query = sprintf("CALL sp_ExtraCollectDisbursement_insert( %u, %f, '%s', '%s', '%s', '%s', '%s')", $AccountID, $Amount, $BankID, $TradingDate, $Note, $TranTypeID, $CreatedBy);
         $rs = $this->_MDB2_WRITE->extended->getRow($query);
         if (empty($rs)) {
             $this->_ERROR_CODE = 31447;
         } else {
             $result = $rs['varerror'];
             if ($result < 0) {
                 switch ($result) {
                     case '-1':
                         $this->_ERROR_CODE = 21115;
                         break;
                 }
             } else {
                 $this->items[0] = new SOAP_Value('item', $struct, array("ID" => new SOAP_Value("ID", "string", $result)));
             }
         }
     }
     return returnXML(func_get_args(), $this->class_name, $function_name, $this->_ERROR_CODE, $this->items, $this);
 }
コード例 #8
0
ファイル: classOTC.php プロジェクト: quangbt2005/vhost-kis
 function insertCoSellOrder($CoAccountNo, $AccountNo, $StockID, $OrderQuantity, $OrderPrice, $Session, $FromTypeID, $Note, $OrderDate, $IsAssigner, $IsGotPaper, $CreatedBy, $AccountNoContra, $CompanyNameContra)
 {
     $function_name = 'insertCoSellOrder';
     $struct = '{urn:' . $this->class_name . '}' . $function_name . 'Struct';
     $log[] = sprintf('insertCoSellOrder - CoAccountNo:%s;AccountNo:%s;StockID:%s;OrderQuantity:%s;OrderPrice:%s;Session:%s;FromTypeID:%s;Note:%s;OrderDate:%s;IsAssigner:%s;IsGotPaper:%s;CreatedBy:%s;AccountNoContra:%s;CompanyNameContra:%s;ExecutedTime:%s', $CoAccountNo, $AccountNo, $StockID, $OrderQuantity, $OrderPrice, $Session, $FromTypeID, $Note, $OrderDate, $IsAssigner, $IsGotPaper, $CreatedBy, $AccountNoContra, $CompanyNameContra, date('Y-m-d h:i:s'));
     if (authenUser(func_get_args(), $this, $function_name) > 0) {
         $log[] = sprintf('authenUser: ERROR_CODE: %s', $this->_ERROR_CODE);
         write_my_log_path("insertCoSellOrder", implode("\n --> ", $log), '/home/vhosts/eSMS/htdocs/logs/otc/');
         return returnXML(func_get_args(), $this->class_name, $function_name, $this->_ERROR_CODE, $this->items, $this);
     }
     $log[] = sprintf('authenUser: ERROR_CODE: %s', $this->_ERROR_CODE);
     // checking account is active / not
     if (!checkAccountIsActive($AccountNo) || !checkAccountIsActive($CoAccountNo)) {
         $this->_ERROR_CODE = 30275;
         $log[] = sprintf('checkAccountIsActive: ERROR_CODE: %s; AccountNo:%s,%s;CoAccountNo: %s,%s', $this->_ERROR_CODE, $AccountNo, checkAccountIsActive($AccountNo) ? 'TRUE' : 'FALSE', $CoAccountNo, checkAccountIsActive($CoAccountNo) ? 'TRUE' : 'FALSE');
         write_my_log_path("insertCoSellOrder", implode("\n --> ", $log), '/home/vhosts/eSMS/htdocs/logs/otc/');
         return returnXML(func_get_args(), $this->class_name, $function_name, 30275, $this->items, $this);
     }
     $log[] = sprintf('checkAccountIsActive: ERROR_CODE: %s; AccountNo:%s,%s;CoAccountNo: %s,%s', $this->_ERROR_CODE, $AccountNo, checkAccountIsActive($AccountNo) ? 'TRUE' : 'FALSE', $CoAccountNo, checkAccountIsActive($CoAccountNo) ? 'TRUE' : 'FALSE');
     if (!required($CoAccountNo) || !required($AccountNo) || !required($OrderDate) || !required($StockID) || !required($OrderQuantity) || !required($OrderPrice) || !required($Session) || !unsigned($OrderQuantity) || !unsigned($StockID)) {
         if (!required($AccountNo) || !required($CoAccountNo)) {
             $this->_ERROR_CODE = 30051;
         }
         if (!required($OrderDate)) {
             $this->_ERROR_CODE = 30052;
         }
         if (!required($StockID) || !unsigned($StockID)) {
             $this->_ERROR_CODE = 30053;
         }
         if (!required($OrderQuantity) || !unsigned($OrderQuantity)) {
             $this->_ERROR_CODE = 30054;
         }
         if (!required($Session)) {
             $this->_ERROR_CODE = 30055;
         }
         if (!required($OrderPrice)) {
             $this->_ERROR_CODE = 30056;
         }
         $log[] = sprintf('check require: ERROR_CODE: %s', $this->_ERROR_CODE);
     } else {
         $vip = checkVIPAccount($AccountNo);
         // 1: exist 0: not exist
         $vipCo = checkVIPAccount($CoAccountNo);
         // 1: exist 0: not exist
         if (($vip == 1 || $vipCo == 1) && $FromTypeID == 5) {
             // web
             $this->_ERROR_CODE = 30602;
             $log[] = sprintf('Vip on web: Fail; AccountNo: %s;CoAccountNo: %s', $vip == 0 ? 'not vip' : 'vip', $vipCo == 0 ? 'not vip' : 'vip');
             write_my_log_path("insertCoSellOrder", implode("\n --> ", $log), '/home/vhosts/eSMS/htdocs/logs/otc/');
             return returnXML(func_get_args(), $this->class_name, $function_name, $this->_ERROR_CODE, $this->items, $this);
         }
         if ((strpos(EOT_PROHIBITION_ACCOUNT, $AccountNo) !== false || strpos(EOT_PROHIBITION_ACCOUNT, $CoAccountNo) !== false) && $FromTypeID == 5) {
             $this->_ERROR_CODE = 30602;
             $log[] = sprintf('check EOT_PROHIBITION_ACCOUNT: ERROR_CODE: %s;AccountNo:%s,%s;CoAccountNo:%s,%s', $this->_ERROR_CODE, $AccountNo, strpos(EOT_PROHIBITION_ACCOUNT, $AccountNo), $CoAccountNo, strpos(EOT_PROHIBITION_ACCOUNT, $CoAccountNo));
             write_my_log_path("insertCoSellOrder", implode("\n --> ", $log), '/home/vhosts/eSMS/htdocs/logs/otc/');
             return returnXML(func_get_args(), $this->class_name, $function_name, $this->_ERROR_CODE, $this->items, $this);
         }
         if (!checkStockPrice($StockID, $OrderPrice, $OrderDate)) {
             $this->_ERROR_CODE = 30057;
         }
         $log[] = sprintf('checkStockPrice: ERROR_CODE: %s', $this->_ERROR_CODE);
         $sellingOrderID = '';
         $buyingOrderID = '';
         try {
             if ($this->_ERROR_CODE == 0) {
                 // -------------------------------------------------------------------------------------- //
                 // Insert sell order for $CoAccountNo
                 // -------------------------------------------------------------------------------------- //
                 $query = sprintf("CALL sp_upcom_insertSellingOrder('%s', %u, %u, %u, %u, '%u', '%s', '%s', '%u', '%u', '%s', '%s', '%s')", $CoAccountNo, $StockID, $OrderQuantity, $OrderPrice, $Session, $FromTypeID, $Note, $OrderDate, $IsAssigner, $IsGotPaper, $CreatedBy, $AccountNoContra, $CompanyNameContra);
                 $log[] = sprintf('%s', $query);
                 $mdb = initWriteDB();
                 $rs = $mdb->extended->getRow($query);
                 $mdb->disconnect();
                 if (empty($rs)) {
                     $this->_ERROR_CODE = 30060;
                 } else {
                     $result = $rs['varerror'];
                     if ($result < 0) {
                         switch ($result) {
                             case '-1':
                                 $this->_ERROR_CODE = 19010;
                                 break;
                             case '-2':
                                 $this->_ERROR_CODE = 19011;
                                 break;
                             case '-3':
                                 $this->_ERROR_CODE = 19012;
                                 break;
                             case '-4':
                                 $this->_ERROR_CODE = 19013;
                                 break;
                             case '-5':
                                 $this->_ERROR_CODE = 19014;
                                 break;
                             case '-6':
                                 $this->_ERROR_CODE = 19015;
                                 break;
                             default:
                                 $this->_ERROR_CODE = $result;
                         }
                     } else {
                         $sellingOrderID = $result;
                     }
                 }
                 $log[] = sprintf('ERROR_CODE: %s', $this->_ERROR_CODE);
                 $log[] = sprintf('SellingOrderID: %s', $sellingOrderID);
             }
             if ($this->_ERROR_CODE == 0) {
                 // -------------------------------------------------------------------------------------- //
                 // Insert buy order for $AccountNo
                 // -------------------------------------------------------------------------------------- //
                 $query = sprintf("CALL sp_upcom_insertBuyingOrder('%s', %u, %u, %u, %u, %u, '%s', '%s', '%u', '%u', '%s', '%s', '%s')", $AccountNo, $StockID, $OrderQuantity, $OrderPrice, $Session, $FromTypeID, $Note, $OrderDate, $IsAssigner, $IsGotPaper, $CreatedBy, $AccountNoContra, $CompanyNameContra);
                 $log[] = sprintf('%s', $query);
                 $rs = $this->_MDB2_WRITE->extended->getRow($query);
                 if (empty($rs)) {
                     $this->_ERROR_CODE = 30015;
                     $log[] = sprintf('ERROR_CODE: %s', $this->_ERROR_CODE);
                 } else {
                     $result = $rs['varerror'];
                     if ($result < 0) {
                         switch ($result) {
                             case '-1':
                                 $this->_ERROR_CODE = 19001;
                                 break;
                             case '-2':
                                 $this->_ERROR_CODE = 19002;
                                 break;
                             case '-3':
                                 $this->_ERROR_CODE = 19003;
                                 break;
                             case '-4':
                                 $this->_ERROR_CODE = 19004;
                                 break;
                             case '-5':
                                 $this->_ERROR_CODE = 19005;
                                 break;
                             default:
                                 $this->_ERROR_CODE = $result;
                         }
                         $log[] = sprintf('ERROR_CODE: %s', $this->_ERROR_CODE);
                     } else {
                         $isQuotaAccount = CheckIsQuotaAccount($AccountNo);
                         $vip = checkVIPAccount($AccountNo);
                         // 1: exist 0: not exist
                         $log[] = sprintf('ERROR_CODE: %s', $this->_ERROR_CODE);
                         $log[] = sprintf('BuyingOrderID: %s', $result);
                         $buyingOrderID = $result;
                         //block money in bank
                         $query = sprintf("SELECT * FROM vw_ListAccountBank_Detail WHERE AccountNo='%s' ORDER BY Priority ", $AccountNo);
                         $log[] = sprintf('%s', $query);
                         $mdb = initWriteDB();
                         $bank_rs = $mdb->extended->getAll($query);
                         $log[] = sprintf('PAGODA_ACCOUNT: %s', strpos(PAGODA_ACCOUNT, $AccountNo) === false ? 'FALSE' : 'TRUE');
                         $log[] = sprintf('VIP_ACCOUNT: %s', $vip == 0 ? 'FALSE' : 'TRUE');
                         if (strpos(PAGODA_ACCOUNT, $AccountNo) === false && $vip == 0) {
                             $dab_rs = 999;
                             if ($isQuotaAccount != 0) {
                                 $BankID = NHHM;
                                 $mdb = initWriteDB();
                                 $query = sprintf("CALL sp_VirtualBank_Lock('%s', %u,  %u, %f, '%s', '%s')", $AccountNo, NHHM, $result, $rs['varordervalue'], $OrderDate, $CreatedBy);
                                 $off_rs = $mdb->extended->getRow($query);
                                 $mdb->disconnect();
                                 $dab_rs = $off_rs['varerror'];
                                 $log[] = sprintf('block_money: bankid:NHHM;result:%s', $dab_rs);
                             } else {
                                 for ($i = 0; $i < count($bank_rs); $i++) {
                                     switch ($bank_rs[$i]['bankid']) {
                                         case DAB_ID:
                                             $dab =& new CDAB();
                                             $dab_rs = $dab->blockMoney($bank_rs[$i]['bankaccount'], $bank_rs[$i]['cardno'], $AccountNo, $result, $rs['varordervalue'], $OrderDate);
                                             $log[] = sprintf('block_money: bankid:DAB_ID;result:%s', $dab_rs);
                                             break;
                                         case VCB_ID:
                                             $dab =& new CVCB();
                                             $OrderID = $result . $rs['varunitcode'];
                                             if (!killStupidBank()) {
                                                 // VCB is stupid
                                                 $dab_rs = $dab->blockMoney($AccountNo, $OrderID, $rs['varordervalue']);
                                             } else {
                                                 $dab_rs = 30999;
                                             }
                                             $log[] = sprintf('block_money: bankid:VCB_ID;result:%s', $dab_rs);
                                             break;
                                         case ANZ_ID:
                                             $OrderID = $result;
                                             $query = sprintf("CALL sp_anz_money_request_lock( %u, '%s', '%s', '%s' )", $OrderID, $AccountNo, $rs['varordervalue'], $CreatedBy);
                                             $this->_MDB2_WRITE->connect();
                                             $rs1 = $this->_MDB2_WRITE->extended->getRow($query);
                                             $this->_MDB2_WRITE->disconnect();
                                             switch ($rs1['varerror']) {
                                                 case -1:
                                                     $dab_rs = 34511;
                                                     //database error
                                                     break;
                                                 case -2:
                                                     $dab_rs = 34512;
                                                     //not enough money to unlock
                                                     break;
                                                 case -3:
                                                     $dab_rs = 34513;
                                                     //account does not exist
                                                     break;
                                                 default:
                                                     $dab_rs = $rs1['varerror'];
                                             }
                                             $log[] = sprintf('block_money: bankid:ANZ_ID;result:%s', $dab_rs);
                                             // added by Quang, 20100407 ------------------------------------
                                             break;
                                         case OFFLINE:
                                             //inAccountNo varchar(20),inBankID int,inOrderID bigint,inOrderAmount double,inOrderDate date,inCreatedBy
                                             $mdb = initWriteDB();
                                             $query = sprintf("CALL sp_VirtualBank_Lock('%s', %u,  %u, %f, '%s', '%s')", $AccountNo, OFFLINE, $result, $rs['varordervalue'], $OrderDate, $CreatedBy);
                                             $off_rs = $mdb->extended->getRow($query);
                                             $mdb->disconnect();
                                             $dab_rs = $off_rs['varerror'];
                                             $log[] = sprintf('block_money: bankid:OFFLINE;result:%s', $dab_rs);
                                             break;
                                             // end add -----------------------------------------------------
                                     }
                                     if ($dab_rs == 0) {
                                         $BankID = $bank_rs[$i]['bankid'];
                                         break;
                                     }
                                 }
                             }
                         } else {
                             $dab_rs = 0;
                         }
                         if ($dab_rs == 0) {
                             //Successfully
                             $log[] = sprintf('successded_block_money');
                             $mdb = initWriteDB();
                             if ($Session <= 3) {
                                 $query = sprintf("CALL sp_updateBuyingOrderFromPendingToApproved(%u, %u) ", $result, $BankID);
                             } else {
                                 $query = sprintf("CALL sp_updateBuyingOrderFromPendingToTransfered(%u, %u) ", $result, $BankID);
                             }
                             $log[] = sprintf('%s', $query);
                             $status_rs = $mdb->extended->getRow($query);
                             $mdb->disconnect();
                             if (empty($status_rs)) {
                                 $this->_ERROR_CODE = 30143;
                             } else {
                                 $result = $status_rs['varerror'];
                                 if ($result < 0) {
                                     //update Order Status fail
                                     switch ($result) {
                                         case '-1':
                                             $this->_ERROR_CODE = 30141;
                                             break;
                                         case '-2':
                                             $this->_ERROR_CODE = 30142;
                                             break;
                                     }
                                     //switch
                                 }
                                 // if
                             }
                             // if WS
                             $log[] = sprintf('ERROR_CODE: %s', $this->_ERROR_CODE);
                         } else {
                             // bank fail
                             $log[] = sprintf('failed_block_money');
                             switch ($dab_rs) {
                                 case '-1':
                                     $this->_ERROR_CODE = 41020;
                                     break;
                                 case '-2':
                                     $this->_ERROR_CODE = 41021;
                                     break;
                                 case '-3':
                                     $this->_ERROR_CODE = 41022;
                                     break;
                                 case '-4':
                                     $this->_ERROR_CODE = 41023;
                                     break;
                                 case '-5':
                                     $this->_ERROR_CODE = 41024;
                                     break;
                                 case '1':
                                     $this->_ERROR_CODE = 41025;
                                     break;
                                 case '2':
                                     $this->_ERROR_CODE = 41026;
                                     break;
                                 case '3':
                                     $this->_ERROR_CODE = 41027;
                                     break;
                                 case '4':
                                     $this->_ERROR_CODE = 41028;
                                     break;
                                 case '5':
                                     $this->_ERROR_CODE = 41030;
                                     break;
                                 case '99':
                                     $this->_ERROR_CODE = 41029;
                                     break;
                                 default:
                                     $this->_ERROR_CODE = $dab_rs;
                             }
                             $log[] = sprintf('ERROR_CODE: %s', $this->_ERROR_CODE);
                             $mdb = initWriteDB();
                             $query = sprintf("CALL sp_updateBuyingOrderFromPendingToDenied(%u, '%s') ", $result, $dab_rs);
                             $log[] = sprintf('%s', $query);
                             $status_rs = $mdb->extended->getRow($query);
                             $mdb->disconnect();
                             if (empty($status_rs)) {
                                 $this->_ERROR_CODE = 30144;
                             } else {
                                 $result = $status_rs['varerror'];
                                 if ($result < 0) {
                                     //update Order Status fail
                                     switch ($result) {
                                         case '-1':
                                             $this->_ERROR_CODE = 30145;
                                             break;
                                         case '-2':
                                             $this->_ERROR_CODE = 30146;
                                             break;
                                     }
                                     //switch
                                 }
                                 // if
                             }
                             // if WS
                             $log[] = sprintf('ERROR_CODE: %s', $this->_ERROR_CODE);
                         }
                     }
                 }
                 // -------------------------------------------------------------------------------------- //
                 // End Insert buy order for $AccountNo
                 // -------------------------------------------------------------------------------------- //
             }
             $this->items[0] = new SOAP_Value('item', $struct, array("BuyingOrderID" => new SOAP_Value("BuyingOrderID", "string", $buyingOrderID), "SellingOrderID" => new SOAP_Value("SellingOrderID", "string", $sellingOrderID)));
         } catch (Exception $e) {
             $log[] = sprintf('Exception: %s', $e->getMessage());
             $this->_ERROR_CODE = 30060;
         }
     }
     write_my_log_path("insertCoSellOrder", implode("\n --> ", $log), '/home/vhosts/eSMS/htdocs/logs/otc/');
     return returnXML(func_get_args(), $this->class_name, $function_name, $this->_ERROR_CODE, $this->items, $this);
 }
コード例 #9
0
 function deleteSetOfEmployee4Group($GroupID, $SetOfEmployeeID, $UpdatedBy)
 {
     $function_name = 'deleteSetOfEmployee4Group';
     $struct = '{urn:' . $this->class_name . '}' . $function_name . 'Struct';
     $delete_log = array();
     $lastest_error = 0;
     if (authenUser(func_get_args(), $this, $function_name) > 0) {
         $delete_log[] = sprintf('GroupID:%s;SetOfEmployeeID:%s;UpdatedBy:%s;ErrorCode:%s;ExecutedTime:%s', $GroupID, $SetOfEmployeeID, $UpdatedBy, $this->_ERROR_CODE, date('Y-m-d h:i:s'));
         write_my_log_path("deleteSetOfEmployee4Group", implode("\n --> ", $delete_log), '/home/vhosts/eSMS/htdocs/logs/employee/');
         return returnXML(func_get_args(), $this->class_name, $function_name, $this->_ERROR_CODE, $this->items, $this);
     }
     if (!required($GroupID) || !unsigned($GroupID) || !required($SetOfEmployeeID)) {
         if (!required($GroupID) || !unsigned($GroupID)) {
             $this->_ERROR_CODE = $lastest_error = 32071;
         }
         if (!required($SetOfEmployeeID)) {
             $this->_ERROR_CODE = $lastest_error = 32070;
         }
         $delete_log[] = sprintf('GroupID:%s;SetOfEmployeeID:%s;UpdatedBy:%s;ErrorCode:%s;ExecutedTime:%s', $GroupID, $SetOfEmployeeID, $UpdatedBy, $this->_ERROR_CODE, date('Y-m-d h:i:s'));
     } else {
         $arr_epm = explode(',', $SetOfEmployeeID);
         $delete_success = array();
         $delete_fail = array();
         $delete_log[] = sprintf('GroupID:%s;SetOfEmployeeID:%s;UpdatedBy:%s;ExecutedTime:%s', $GroupID, $SetOfEmployeeID, $UpdatedBy, date('Y-m-d h:i:s'));
         foreach ($arr_epm as $emp_id) {
             $this->_ERROR_CODE = 0;
             $result = NULL;
             if (!unsigned($emp_id)) {
                 $this->_ERROR_CODE = 32070;
                 $delete_fail[] = trim($emp_id);
             } else {
                 $query = sprintf("CALL sp_deleteEmployeeGroup(%u, %u, '%s')", trim($emp_id), $GroupID, $UpdatedBy);
                 $mdb = initWriteDB();
                 $rs = $mdb->extended->getRow($query);
                 if (empty($rs)) {
                     $this->_ERROR_CODE = 32072;
                     $delete_fail[] = trim($emp_id);
                 } else {
                     $result = $rs['varerror'];
                     if ($result < 0) {
                         $delete_fail[] = trim($emp_id);
                         switch ($result) {
                             case '-1':
                                 $this->_ERROR_CODE = 32073;
                                 break;
                             case '-2':
                                 $this->_ERROR_CODE = 32074;
                                 break;
                         }
                     }
                 }
             }
             if ($this->_ERROR_CODE == 0) {
                 $delete_success[] = trim($emp_id);
             } else {
                 $lastest_error = $this->_ERROR_CODE;
             }
             $delete_log[] = sprintf('GroupID:%s;EmployeeID:%s;UpdatedBy:%s;ErrorCode:%s;ExecutedTime:%s', $GroupID, trim($emp_id), $UpdatedBy, $this->_ERROR_CODE, date('Y-m-d h:i:s'));
         }
         $this->items[] = new SOAP_Value('item', $struct, array("SuccessdedEmployeeID" => new SOAP_Value("SuccessdedEmployeeID", "string", implode(', ', $delete_success)), "FailedEmployeeID" => new SOAP_Value("FailedEmployeeID", "string", implode(', ', $delete_fail))));
     }
     write_my_log_path("deleteSetOfEmployee4Group", implode("\n --> ", $delete_log), '/home/vhosts/eSMS/htdocs/logs/employee/');
     return returnXML(func_get_args(), $this->class_name, $function_name, $lastest_error, $this->items, $this);
 }
コード例 #10
0
 /**
 	Function: NewDeletePaymentDetailWithoutConfirmed
 	Description:
 	Input:
 	Output: success / error code
 */
 function NewDeletePaymentDetailWithoutConfirmed($PaymentDetailID, $UpdatedBy)
 {
     $function_name = 'NewDeletePaymentDetailWithoutConfirmed';
     $struct = '{urn:' . $this->class_name . '}' . $function_name . 'Struct';
     if (authenUser(func_get_args(), $this, $function_name) > 0) {
         return returnXML(func_get_args(), $this->class_name, $function_name, $this->_ERROR_CODE, $this->items, $this);
     }
     if (!required($PaymentDetailID) || !unsigned($PaymentDetailID)) {
         $this->_ERROR_CODE = 21165;
     } else {
         $query = sprintf("CALL sp_Mortage_deletePaymentDetailWithoutConfirmed(%u, '%s')", $PaymentDetailID, $UpdatedBy);
         $rs = $this->_MDB2_WRITE->extended->getRow($query);
         if (empty($rs)) {
             $this->_ERROR_CODE = 21166;
         } else {
             $result = $rs['varerror'];
             if ($result < 0) {
                 switch ($result) {
                     case '-1':
                         $this->_ERROR_CODE = 21167;
                         break;
                     case '-2':
                         $this->_ERROR_CODE = 21168;
                         break;
                 }
             }
         }
     }
     return returnXML(func_get_args(), $this->class_name, $function_name, $this->_ERROR_CODE, $this->items, $this);
 }