コード例 #1
0
 function getTrading($values)
 {
     write_my_log_path('Bravo-log', $_SERVER['REMOTE_ADDR'] . ' function_name getTrading AccountNo ' . $values["AccountNo"] . ' previewDate ' . $values["TradingDate"] . ' TypeDataSet P' . date('Y-m-d h:i:s'), VCB_PATH);
     if ($this->chk == 1) {
         $params["key"] = BRAVO_KEY;
         $params["previewDate"] = $values["TradingDate"];
         $params["TypeDataSet"] = "P";
         $params["customerCode"] = $values["AccountNo"];
         $this->soap_client->NewDataSet($params);
         $data = $this->soap_client->__getLastResponse();
         $xml = new XML_Unserializer(array("complexType" => "array", "parseAttributes" => TRUE));
         $xml->unserialize($data, FALSE);
         $ret = $xml->getUnserializedData();
         return $ret["soap:Body"]["NewDataSetResponse"]["NewDataSetResult"]['DS'];
     } else {
         $ret['table1']['Id'] = 0;
         $ret['table0']['Result'] = 1;
         return $ret;
     }
 }
コード例 #2
0
 /**
  * Function DeleteDividendPrivilege	: SendSMS_BuyingStockForDividend
  * Input 					: 'EventID'
  * OutPut 					: error code. Return 0 if success else return error code (number >0).
  */
 function DeleteDividendPrivilege($EventID, $AccountNo, $UpdatedBy)
 {
     try {
         $class_name = $this->class_name;
         $function_name = 'DeleteDividendPrivilege';
         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 ($EventID == '' || $EventID <= 0) {
             $this->_ERROR_CODE = 22114;
         } else {
             if ($AccountNo == '') {
                 $this->_ERROR_CODE = 22115;
             }
         }
         if ($this->_ERROR_CODE == 0) {
             $query = sprintf("CALL sp_DeleteDividendPrivilege('%s', '%s', '%s')", $EventID, $AccountNo, $UpdatedBy);
             $result = $this->_MDB2_WRITE->extended->getAll($query);
             //Can not update
             if (empty($result) || is_object($result)) {
                 $this->_ERROR_CODE = 22127;
                 write_my_log_path('ErrorCallStore', $query . '  ' . $result->backtrace[0]['args'][4], EVENT_PATH);
             } else {
                 if (isset($result[0]['varerror'])) {
                     if ($result[0]['varerror'] < 0) {
                         switch ($result[0]['varerror']) {
                             case '0':
                                 //sucess
                                 $this->_ERROR_CODE = 0;
                                 break;
                             case '-1':
                                 //exception
                                 $this->_ERROR_CODE = 22128;
                                 break;
                             case '-2':
                                 // ko ton tai EventId
                                 $this->_ERROR_CODE = 22129;
                                 break;
                             case '-3':
                                 // ko ton tai AccountID
                                 $this->_ERROR_CODE = 22130;
                                 break;
                             case '-4':
                                 // ko ton tai (event, account) trong dividend_privilege ; hoac (event, account) da cat tien roi
                                 $this->_ERROR_CODE = 22131;
                                 break;
                             case '-5':
                                 // ngay hien tai nho hon ngay dang ky cuoi cung
                                 $this->_ERROR_CODE = 22148;
                                 break;
                             default:
                                 //deafulr error
                                 $this->_ERROR_CODE = 22132;
                                 write_my_log_path($function_name, $query . '  VarError ' . $result[0]['varerror'], EVENT_PATH);
                                 break;
                         }
                     }
                 }
             }
         }
     } catch (Exception $e) {
         write_my_log_path('PHP-Exception', $function_name . ' Caught exception: ' . $e->getMessage() . ' ' . date('Y-m-d h:i:s'), DEBUG_PATH);
         $this->_ERROR_CODE = 23022;
     }
     return returnXML(func_get_args(), $this->class_name, $function_name, $this->_ERROR_CODE, $this->items, $this);
 }
コード例 #3
0
 /**
 	Function: executeStockTTBTPrivateAccount
 	Description: 
 	Input: 'AccountID', 'StockID', 'T3Quantity', 'TradingDate'
 	Output: ID or vaerror
 */
 function executeStockTTBTPrivateAccount($AccountID, $StockID, $T3Quantity, $TradingDate)
 {
     $function_name = 'executeStockTTBTPrivateAccount';
     $class_name = $this->class_name;
     $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($TradingDate)) {
         $this->_ERROR_CODE = 34518;
     } else {
         if (!required($AccountID)) {
             $this->_ERROR_CODE = 34519;
         } else {
             if (!required($StockID)) {
                 $this->_ERROR_CODE = 34520;
             } else {
                 if (!required($T3Quantity)) {
                     $this->_ERROR_CODE = 34521;
                 } else {
                     $query = sprintf("CALL sp_executeStockTTBTPrivateAccount(%u, %u, '%s', '%s')", $AccountID, $StockID, $T3Quantity, $TradingDate);
                     $result = $this->_MDB2_WRITE->extended->getAll($query);
                     //Can not add
                     if (empty($result) || is_object($result)) {
                         $this->_ERROR_CODE = 34522;
                         write_my_log_path('ErrorCallStore', $query . '  ' . $result->backtrace[0]['args'][4], DEBUG_PATH);
                     } else {
                         if (isset($result[0]['varerror'])) {
                             //success
                             if ($result[0]['varerror'] > 0) {
                                 $this->items[0] = new SOAP_Value('items', '{urn:' . $class_name . '}' . $function_name . 'Struct', array('ID' => new SOAP_Value("ID", "string", $result[0]['varerror'])));
                             } else {
                                 if ($result[0]['varerror'] < 0) {
                                     $this->_ERROR_CODE = 34523;
                                     write_my_log_path($function_name, $query . '  VarError ' . $result[0]['varerror'], DEBUG_PATH);
                                 }
                             }
                         }
                     }
                 }
             }
         }
     }
     return returnXML(func_get_args(), $this->class_name, $function_name, $this->_ERROR_CODE, $this->items, $this);
 }
コード例 #4
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);
 }
コード例 #5
0
 function getAdvanceAmountforBankAndDate($AdvanceDate, $TDate, $BankID)
 {
     try {
         $class_name = $this->class_name;
         $function_name = 'getAdvanceAmountforBankAndDate';
         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);
         }
         $this->items = array();
         $query = sprintf("CALL sp_getAdvanceAmountforBankAndDate('%s','%s','%s')", $AdvanceDate, $TDate, $BankID);
         $result = $this->_MDB2->extended->getAll($query);
         $num_row = count($result);
         if ($num_row > 0) {
             for ($i = 0; $i < $num_row; $i++) {
                 $this->items[$i] = new SOAP_Value('items', '{urn:' . $class_name . '}' . $function_name . 'Struct', array('AdvanceAmount' => new SOAP_Value("AdvanceAmount", "string", $result[$i]['advanceamount']), 'Numday' => new SOAP_Value("Numday", "string", $result[$i]['numday']), 'Val' => new SOAP_Value("Val", "string", $result[$i]['val'])));
             }
         }
     } catch (Exception $e) {
         write_my_log_path('PHP-Exception', $function_name . ' Caught exception: ' . $e->getMessage() . ' ' . date('Y-m-d h:i:s'), DEBUG_PATH);
         $this->_ERROR_CODE = 23022;
     }
     return returnXML(func_get_args(), $this->class_name, $function_name, $this->_ERROR_CODE, $this->items, $this);
 }
コード例 #6
0
 /**
  * (Function nay chi khac ConfirmBuyingStockForDividend_CutMoney o cho tham so $Note - Tao ngay 20100712, request ngay 20100709)
  * Function ConfirmBuyingStockForDividend_CutMoney_ForTraiPhieu  : Ke toan cat tien -- day dl qua Bravo -- cap nhat bankid khi cat tien thanh cong
  * Input            : $EventID, $AccountID, $Today, $UpdatedBy, $Note
  * OutPut           : error code. Return 0 if success else return error code (number >0).
  */
 function ConfirmBuyingStockForDividend_CutMoney_ForTraiPhieu($EventID, $AccountID, $UpdatedBy, $Today, $BankID, $Note)
 {
     try {
         $class_name = $this->class_name;
         $function_name = 'ConfirmBuyingStockForDividend_CutMoney_ForTraiPhieu';
         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($EventID) || !numeric($EventID)) {
             $this->_ERROR_CODE = 22042;
         }
         if ($this->_ERROR_CODE == 0 && (!required($AccountID) || !numeric($AccountID))) {
             $this->_ERROR_CODE = 22005;
         }
         if ($this->_ERROR_CODE == 0 && (!required($Today) || !valid_date($Today))) {
             $this->_ERROR_CODE = 22056;
         }
         if ($this->_ERROR_CODE == 0) {
             $Withdrawal = $this->CheckConfirmBuyingStock_CutMoney($EventID, $AccountID, $Today);
             if ($Withdrawal['ErrorCode'] == '0') {
                 // money in bank
                 $query = sprintf("SELECT BankID, BankAccount, BravoCode FROM vw_ListAccountBank_Detail WHERE AccountID='%s' AND BankID ='%s' ", $AccountID, $BankID);
                 $this->_MDB2->disconnect();
                 $this->_MDB2->connect();
                 $bank_rs = $this->_MDB2->extended->getAll($query);
                 $dab_rs = 999;
                 $BankID = 0;
                 $TransactionType = BRAVO_BUYING_STOCK;
                 // phat hanh them cp
                 if ($Withdrawal['AccountNo'] != PAGODA_ACCOUNT) {
                     if (count($bank_rs) > 0) {
                         $i = 0;
                         $BankID = $bank_rs[$i]['bankid'];
                         $BravoCode = $bank_rs[$i]['bravocode'];
                         switch ($BankID) {
                             case DAB_ID:
                                 $dab =& new CDAB();
                                 $dab_rs = $dab->transfertoEPS($bank_rs[$i]['bankaccount'], $Withdrawal['AccountNo'], '3_' . $EventID . '_' . $AccountID, $Withdrawal['Amount'], $Note);
                                 write_my_log_path('transfertoEPS', $function_name . ' BankAccount ' . $bank_rs[$i]['bankaccount'] . '  AccountNo ' . $Withdrawal['AccountNo'] . '  Event_AccountID ' . '3_' . $EventID . ' ' . $AccountID . '  Amount ' . $Withdrawal['Amount'] . ' Description ' . $Note . ' Error ' . $dab_rs, EVENT_PATH);
                                 break;
                             case OFFLINE:
                                 $mdb2 = initWriteDB();
                                 //`sp_VirtualBank_insertBuyingStockDivident`(inAccountID bigint, inBankID int, inAmount double,inTransactionDate date, inNote text(1000), inCreatedBy varchar(100))
                                 $query = sprintf("CALL sp_VirtualBank_insertBuyingStockDivident(%u, %u, %f, '%s', '%s', '%s' )", $AccountID, $BankID, $Withdrawal['Amount'], $Today, $Note, $UpdatedBy);
                                 $rs = $mdb2->extended->getRow($query);
                                 $mdb2->disconnect();
                                 $dab_rs = $rs["varerror"];
                                 break;
                             default:
                                 $dab_rs = 0;
                         }
                     } else {
                         $dab_rs = 9999;
                         $this->_ERROR_CODE = 22155;
                         //TK k co TK Ngan hang nay
                     }
                 } else {
                     $TransactionType = BRAVO_BUYING_STOCK;
                     // phat hanh them cp
                     $dab_rs = 0;
                     $BankID = EXI_ID;
                 }
                 if ($dab_rs == 0) {
                     if ($BankID == OFFLINE) {
                         $query = "SELECT mobilephone,ab.usableamount FROM " . TBL_INVESTOR;
                         $query .= " i INNER JOIN " . TBL_ACCOUNT . " a ON(i.id=a.investorId)";
                         $query .= " INNER JOIN " . TBL_ACCOUNT_BANK . " ab ON(a.id=ab.accountid)";
                         $query .= " WHERE a.accountNo='" . $Withdrawal['AccountNo'] . "' AND ab.bankid=" . OFFLINE;
                         $mdb = initWriteDB();
                         $acc_rs = $mdb->extended->getRow($query);
                         $mdb->disconnect();
                         if (!empty($acc_rs['mobilephone'])) {
                             $message = 'Tai khoan cua quy khach tai KIS da thay doi: -' . number_format($Withdrawal['Amount'], 0, '.', ',') . '. ' . $Note;
                             $message .= '. So du hien tai la: ' . number_format($acc_rs['usableamount'], 0, '.', ',');
                             sendSMS(array('Phone' => $acc_rs['mobilephone'], 'Content' => $message), 'ConfirmBuyingStockForDividend_CutMoney_ForTraiPhieu');
                         }
                     }
                     $soap =& new Bravo();
                     $Withdrawal_value = array("TradingDate" => $Today, 'TransactionType' => $TransactionType, "AccountNo" => $Withdrawal['AccountNo'], "Amount" => $Withdrawal['Amount'], "Bank" => $BravoCode, "Branch" => "", "Note" => $Note);
                     //'011C001458'
                     //var_dump($withdraw_value);
                     $ret = $soap->withdraw($Withdrawal_value);
                     if ($ret['table0']['Result'] == 1) {
                         $query = sprintf("CALL sp_UpdateDividendPrivilege_BankID ('%s','%s','%s','%s')", $BankID, $EventID, $AccountID, $UpdatedBy);
                         //echo $query;
                         $result = $this->_MDB2_WRITE->extended->getAll($query);
                         //Can not update
                         if (empty($result) || is_object($result)) {
                             $this->_ERROR_CODE = 22120;
                             write_my_log_path('ErrorCallStore', $query . '  ' . $result->backtrace[0]['args'][4], EVENT_PATH);
                         } else {
                             if (isset($result[0]['varerror'])) {
                                 //p_iDividentPrivilege sai hoac dang ky mua chua xac nhan hoac da cat tien roi
                                 if ($result[0]['varerror'] == -2) {
                                     $this->_ERROR_CODE = 22121;
                                 } else {
                                     if ($result[0]['varerror'] == -3) {
                                         //qua ngay cat tien
                                         $this->_ERROR_CODE = 22149;
                                     } else {
                                         if ($result[0]['varerror'] == -1) {
                                             //Exception
                                             $this->_ERROR_CODE = 22122;
                                         } else {
                                             if ($result[0]['varerror'] < 0) {
                                                 $this->_ERROR_CODE = 22134;
                                                 write_my_log_path($function_name, $query . '  VarError ' . $result[0]['varerror'], EVENT_PATH);
                                             }
                                         }
                                     }
                                 }
                             }
                         }
                         if ($this->_ERROR_CODE != 0) {
                             $soap->rollback($ret['table1']['Id'], $Today);
                         }
                     } else {
                         switch ($ret['table0']['Result']) {
                             case 0:
                                 $this->_ERROR_CODE = 0;
                                 break;
                             case -2:
                                 //Error - bravo
                                 $this->_ERROR_CODE = 23002;
                                 break;
                             case -1:
                                 //Invalid key
                                 $this->_ERROR_CODE = 23003;
                                 break;
                             case -13:
                                 /*Invalid Transaction Type*/
                                 $this->_ERROR_CODE = 23006;
                                 break;
                             case -15:
                                 /*Invalid CustomerCode*/
                                 $this->_ERROR_CODE = 23005;
                                 break;
                             case -16:
                                 /*Invalid DestCustomerCode*/
                                 $this->_ERROR_CODE = 23004;
                                 break;
                             default:
                                 //Unknown Error
                                 $this->_ERROR_CODE = 23009;
                                 write_my_log_path($function_name, '  Bravo ' . $ret['table0']['Result'], EVENT_PATH);
                                 break;
                         }
                     }
                 } else {
                     switch ($dab_rs) {
                         case '-1':
                             //unauthenticate partner
                             $this->_ERROR_CODE = 22135;
                             break;
                         case '-2':
                             //invalid parameters
                             $this->_ERROR_CODE = 22136;
                             break;
                         case '-3':
                             //invalid date
                             $this->_ERROR_CODE = 22137;
                             break;
                         case '-12':
                             // Tai khoan khong ton tai
                             $this->_ERROR_CODE = 12001;
                             break;
                         case '-4':
                             //no customer found
                             $this->_ERROR_CODE = 22140;
                             break;
                         case '-5':
                             //transfer unsuccessful
                             $this->_ERROR_CODE = 22141;
                             break;
                         case '-13':
                         case '1':
                             //invalid account
                             $this->_ERROR_CODE = 22142;
                             break;
                         case '2':
                             //invalid amount
                             $this->_ERROR_CODE = 22143;
                             break;
                         case '3':
                             //duplicate transfer
                             $this->_ERROR_CODE = 22147;
                             break;
                         case '-14':
                         case '5':
                             //not enough balance
                             $this->_ERROR_CODE = 22144;
                             break;
                         case '6':
                             //duplicate account
                             $this->_ERROR_CODE = 22145;
                             break;
                         case '-15':
                             //can not add history transaction
                             $this->_ERROR_CODE = 22228;
                             break;
                         case '-11':
                         case '99':
                             //unknown error
                             $this->_ERROR_CODE = 22138;
                             break;
                         default:
                             $this->_ERROR_CODE = 22139;
                     }
                 }
             } else {
                 $this->_ERROR_CODE = $Withdrawal['ErrorCode'];
             }
         }
     } catch (Exception $e) {
         write_my_log_path('PHP-Exception', $function_name . ' Caught exception: ' . $e->getMessage() . ' ' . date('Y-m-d h:i:s'), DEBUG_PATH);
         $this->_ERROR_CODE = 23022;
     }
     return returnXML(func_get_args(), $this->class_name, $function_name, $this->_ERROR_CODE, $this->items, $this);
 }
コード例 #7
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);
 }
コード例 #8
0
 function InsertListOfQuota4AcountVB($TradingDate)
 {
     $class_name = $this->class_name;
     $function_name = 'InsertListOfQuota4AcountVB';
     $struct = '{urn:' . $this->class_name . '}' . $function_name . 'Struct';
     $log[] = sprintf('InsertListOfQuota4AcountVB - TradingDate:%s;BankID:%s;ExecutedTime:%s', $TradingDate, OFFLINE, date('Y-m-d h:i:s'));
     if (authenUser(func_get_args(), $this, $function_name) > 0) {
         $log[] = sprintf('ErrorCode:%s(authenUser);', $this->_ERROR_CODE);
         write_my_log_path("InsertListOfQuota4AcountVB", implode("\n --> ", $log), '/home/vhosts/eSMS/htdocs/logs/quota/');
         return returnXML(func_get_args(), $this->class_name, $function_name, $this->_ERROR_CODE, $this->items, $this);
     }
     $query = sprintf("CALL sp_quota_getQuota4Bravo('%s', %u)", $TradingDate, OFFLINE);
     $result = $this->_MDB2->extended->getAll($query);
     $count = count($result);
     $log[] = sprintf('Query:%s;Count:%s', $query, $count);
     $f_args = func_get_args();
     $argscount = count($f_args);
     for ($i = 0; $i < $count; $i++) {
         $error_code = 0;
         $query = sprintf("CALL sp_quota_insertQuota4AccountVB(%u, %f, '%s', '%s', %u, '%s')", $result[$i]['accountid'], $result[$i]['debtamount'], 'Nộp hạn mức', $TradingDate, OFFLINE, $f_args[$argscount - 2]);
         $mdb = initWriteDB();
         $result2 = $mdb->extended->getAll($query);
         $log[] = sprintf('Query:%s; Times:%s', $query, $i);
         if (!isset($result2[0]['varerror'])) {
             $error_code = 40001;
         } else {
             $varerror = $result2[0]['varerror'];
             if ($varerror < 0) {
                 switch ($varerror) {
                     case '-1':
                         $error_code = 40002;
                         break;
                     case '-2':
                         $error_code = 40047;
                         break;
                     case '-3':
                         $error_code = 40048;
                         break;
                     case '-4':
                         $error_code = 40049;
                         break;
                     case '-5':
                         $error_code = 40050;
                         break;
                     default:
                         $error_code = $varerror;
                         break;
                 }
             }
         }
         $log[] = sprintf('ErrorCode:%s;', $error_code);
         if ($error_code == 0) {
             $deposit = array("TradingDate" => date("Y-m-d"), 'TransactionType' => BRAVO_QUOTA, "AccountNo" => $result[$i]['accountno'], "Amount" => $result[$i]['debtamount'], "Fee" => $result[$i]['debtamount'], "Bank" => VIRTUAL_BANK_BRAVO_BANKCODE, "Branch" => "", "Note" => 'Nop han muc');
             $log[] = sprintf('Bravo: TransactionType:%s;AccountNo:%s;Amount:%s;Fee:%s;Bank:%s;', BRAVO_QUOTA, $result[$i]['accountno'], $result[$i]['debtamount'], $result[$i]['debtamount'], VIRTUAL_BANK_BRAVO_BANKCODE);
             $soap =& new Bravo();
             $ret = $soap->deposit($deposit);
             if ($ret['table0']['Result'] != 1) {
                 switch ($ret['table0']['Result']) {
                     case '-2':
                         $error_code = 23002;
                         break;
                     case '-1':
                         $error_code = 23003;
                         break;
                     case '-13':
                         $error_code = 23006;
                         break;
                     case '-15':
                         $error_code = 23005;
                         break;
                     case '-16':
                         $error_code = 23004;
                         break;
                     default:
                         $error_code = 'Bravo' . $ret['table0']['Result'];
                 }
             }
             $log[] = sprintf('ErrorCode:%s;', $error_code);
         }
         if ($error_code != 0) {
             $this->_ERROR_CODE = $error_code;
             $this->items[] = new SOAP_Value('item', $struct, array("AccountID" => new SOAP_Value("AccountID", "string", $result[$i]['accountid']), "AccountNo" => new SOAP_Value("AccountNo", "string", $result[$i]['accountno']), "DebtAmount" => new SOAP_Value("DebtAmount", "string", $result[$i]['debtamount']), "BravoCode" => new SOAP_Value("BravoCode", "string", $result[$i]['bravocode']), "ErrorCode" => new SOAP_Value("ErrorCode", "string", $error_code)));
         }
     }
     $log[] = "\n\n";
     write_my_log_path("InsertListOfQuota4AcountVB", implode("\n --> ", $log), '/home/vhosts/eSMS/htdocs/logs/quota/');
     return returnXML(func_get_args(), $this->class_name, $function_name, $this->_ERROR_CODE, $this->items, $this);
 }
コード例 #9
0
ファイル: vcb.php プロジェクト: quangbt2005/vhost-kis
 function getAvailBalance($epsAccount)
 {
     $params["Reference_Number"] = '';
     $params["Stock_Account"] = $epsAccount;
     $params["Amount"] = '';
     $params["Stock_Code"] = '';
     $params["Stock_Price"] = '';
     $params["Quantity"] = '';
     $params["Reserve_Code"] = '';
     $params["Transaction_Date"] = date('dmy');
     //'190407';//
     $params["Command_Code"] = '';
     $params["Command_Style"] = '';
     $params["Currency_Code"] = 'VND';
     $params["Securities_ID"] = 'EPSHCM';
     $params["Market_Command"] = '';
     $params["Command_Language"] = "V";
     $params["Password"] = VCB_P;
     try {
         $this->soapClient->BALANCE($params);
         $data = $this->soapClient->__getLastResponse();
         $xml = new XML_Unserializer(array("complexType" => "array", "parseAttributes" => TRUE));
         $xml->unserialize($data, FALSE);
         $ret = $xml->getUnserializedData();
         $result = $ret["soap:Body"]["BALANCEResponse"]["BALANCEResult"];
         //	var_dump($result);
         $arr = explode("|", $result['DESCRIPT']);
         //var_dump($arr);
         //	write_my_log_path('VCB-order',$_SERVER['REMOTE_ADDR'].' function_name getAvailBalance TK'. $epsAccount.' ' .date('Y-m-d h:i:s'),VCB_PATH);
         settype($arr[1], "double");
         return $arr[1];
         //return $ret["soap:Body"]["BALANCEResponse"]["BALANCEResult"];//.' '.$ret["soap:Body"]["Khop_LenhResponse"]["Khop_LenhResult"]['DESCRIPT'];
     } catch (Exception $e) {
         write_my_log_path('VCB-order', $_SERVER['REMOTE_ADDR'] . ' function_name getAvailBalance ErrorCode 9876 Exception' . ' Caught exception: ' . $e->getMessage() . ' ' . date('Y-m-d h:i:s'), VCB_PATH);
         return '0';
     }
 }
コード例 #10
0
 function UpdateIsCollectedVSDFee()
 {
     $class_name = $this->class_name;
     $function_name = 'UpdateIsCollectedVSDFee';
     $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);
     }
     $date_array = getdate();
     $csv_dir = $this->path . 'vcb_kq/';
     if (!is_dir($csv_dir)) {
         mkdir($csv_dir, 0755);
     }
     $csv_dir = $csv_dir . 'logs/';
     if (!is_dir($csv_dir)) {
         mkdir($csv_dir, 0755);
     }
     $csv_dir = $csv_dir . $date_array['year'] . '/';
     if (!is_dir($csv_dir)) {
         mkdir($csv_dir, 0755);
     }
     $csv_dir = $csv_dir . $date_array['mon'] . '/';
     if (!is_dir($csv_dir)) {
         mkdir($csv_dir, 0755);
     }
     $filename = 'eps' . date('Ymd') . '_buy_log.vcbit';
     $filepath = $csv_dir . $filename;
     $vsdlogfile = 'vsdrefno_' . date('Ymd') . '.txt';
     $vsdlogfile = sprintf('%s%s%s/%s/%s', $this->path, 'vcb_kq/', $date_array['year'], $date_array['mon'], $vsdlogfile);
     if (is_file($vsdlogfile)) {
         if (!is_file($filepath)) {
             $conn_id = ftp_connect($this->ftp_server);
             // login with username and password
             $login_result = ftp_login($conn_id, $this->ftp_user_name, $this->ftp_user_pass);
             // check connection
             if (!$conn_id || !$login_result) {
                 $this->_ERROR_CODE = 24001;
             } else {
                 $destination_file = $filepath;
                 // open some file to write to
                 $handle = fopen($destination_file, 'w');
                 $source_file = 'OUT/' . $filename;
                 // get the size of $file
                 $res = ftp_size($conn_id, $source_file);
                 if ($res != -1) {
                     $upload = ftp_fget($conn_id, $handle, $source_file, FTP_BINARY);
                     // check upload status
                     if (!$upload) {
                         $this->_ERROR_CODE = 24002;
                     } else {
                         $this->_ERROR_CODE = 0;
                     }
                 } else {
                     //echo "couldn't get the size";
                     $this->_ERROR_CODE = 24005;
                 }
                 // close the FTP stream
                 ftp_close($conn_id);
                 fclose($handle);
             }
         }
         if (file_exists($filepath) === true) {
             $handle = fopen($vsdlogfile, "r");
             $vsdlogcontent = fgets($handle);
             fclose($handle);
             $vsdrefarray = explode('_', $vsdlogcontent);
             $handle = fopen($filepath, "r");
             while (!feof($handle)) {
                 $line = fgets($handle);
                 $splited = explode(';', $line);
                 if (in_array($splited[1], $vsdrefarray)) {
                     $orderID = substr($splited[1], 0, strlen($splited[1]) - 6);
                     $unitCode = substr($splited[1], -6);
                     if ($splited[15] == '0000') {
                         $this->_MDB2->connect();
                         $query = sprintf("CALL sp_FeeForVSD_updateIsCollectedForVCB('%s')", $orderID);
                         $result = $this->_MDB2->extended->getAll($query);
                         $this->_MDB2->disconnect();
                     }
                     $content = $line . ' ' . $query . ' varerror: ' . $result[0]['varerror'];
                     write_my_log_path('UpdateIsCollectedVSDFee', $content, $csv_dir);
                     $this->items[] = new SOAP_Value('item', $struct, array('Refno' => new SOAP_Value("Refno", "string", $splited[1]), 'OrderID' => new SOAP_Value("OrderID", "string", $orderID), 'UnitCode' => new SOAP_Value("UnitCode", "string", $unitCode), 'AccountNo' => new SOAP_Value("AccountNo", "string", $splited[4]), 'Amount' => new SOAP_Value("Amount", "string", $splited[12]), 'VCBResult' => new SOAP_Value("VCBResult", "string", $splited[15]), 'Note' => new SOAP_Value("Note", "string", substr($splited[16], 0, strlen($splited[16]) - 1)), 'UpdateIsCollectedResult' => new SOAP_Value("UpdateIsCollectedResult", "string", $result[0]['varerror'])));
                 }
             }
             fclose($handle);
         } else {
             // Chua co log file
             $this->_ERROR_CODE = 24004;
         }
     } else {
         // Khong tim thay file vsdfee refno log
         $this->_ERROR_CODE = 43007;
     }
     return returnXML(func_get_args(), $this->class_name, $function_name, $this->_ERROR_CODE, $this->items, $this);
 }