示例#1
0
文件: trans12.php 项目: kirkmicz/iSMS
 $vcFinance = $row5['vcFinance'];
 $datDepositorAddress = $row5['datDepositorAddress'];
 $dateTransaction = $row5['datLastMovementDate'];
 $str = $row5['datDepositorName'];
 $dttDepositorName = str_replace("'", " ", $str);
 $query6 = sqlanywhere_query($conn, "INSERT INTO dmmDepositTransaction\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t (dttAppCode, dttAccountCode, dttProductCode,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t  dttSequence, dttTransactionDate, dttTransactionCode,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t  dttTransactionSymbol, dttCashCociCode,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t  dttDebitTransaction,dttCreditTransaction,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t  dttAvailableBalance, dttOutstandingBalance, \n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t  dttUserInitial, dttDepositorName,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t  dttErrorCorrect, dttBranchName, dttCheckNumber,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t  dttFloatDay, dttPrintPassbook, \n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t  dttPrintLedger,dttReference, dttDateIssued,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t  dttDepositAmount, dttInterestAmount,        \n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t  dttTaxAmount, dttTransno, vcFinance)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tVALUES('{$dttAppCode}', '{$dttAccountCode}', '{$dttProductCode}',\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t   '{$dttSequence}', '{$dttTransactionDate}', '{$dttTransactionCode}',  \n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t  '{$dttTransactionSymbol}', '{$dttCashCociCode}',\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t  '{$dttDebitTransaction}', '{$dttCreditTransaction}',\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t  '{$dttAvailableBalance}','{$dttOutstandingBalance}',\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t  '{$dttUserInitial}', '{$dttDepositorName}', '{$dttErrorCorrect}',\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t  '{$dttBranchName}', '{$dttCheckNumber}', {$dttFloatDay},\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t  '{$dttPrintPassbook}', '{$dttPrintLedger}', '{$dttReference}',\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t  '{$dttDateIssued}', '{$dttDepositAmount}',\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t  '{$dttInterestAmount}','{$dttTaxAmount}',\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t  '{$dttTransno}', '{$vcFinance}')");
 if (!$query6) {
     //echo  "ERROR|Invalid Transaction";
     echo json_encode(array('success' => false, 'message' => 'Invalid Transaction'));
     $counter++;
     //2;
     exit;
 } else {
     //$counter++;//3
     $query7 = sqlanywhere_query($conn, "SELECT * FROM  fpddepositproducttransaction\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tWHERE dtfAppCode ='{$dttAppCode}'                                   \t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tAND dtfTransactionCode ='{$dttTransactionCode}' \n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tAND dtfProductCode ='{$dttProductCode}'");
     if (sqlanywhere_num_rows($query7) == 0) {
         //echo "ERROR|Invalid Prod ID";
         echo json_encode(array('success' => false, 'message' => 'Invalid Prod ID'));
     } else {
         $row7 = sqlanywhere_fetch_array($query7);
         $dtfGLAcctDebit = $row7['dtfGLAcctDebit'];
         $dtfGLAcctCredit = $row7['dtfGLAcctCredit'];
         $trdatepost = $timetrans;
         $dttBranchName = $dttBranchName;
         $trdebit = $dttDepositAmount;
         $trcredit = 0.0;
         $trparticulars = "Savings of " . $dttDepositorName;
         $trno = get_trno($trdatepost, $dttBranchName);
         $trtype = '1';
         $trans_no = get_transno($trdatepost, $dttBranchName);
         $trtime = $timetrans;
示例#2
0
 function setSequenceDisburse($user, $brno, $transType)
 {
     include 'config.php';
     $query_get_ctrlno = sqlanywhere_query($conn, "SELECT uscSeqDisbursement FROM usrSequenceControl\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t  WHERE uscUserName = '******'\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tAND uscBrno = '{$brno}'");
     if (!sqlanywhere_num_rows($query_get_ctrlno) == 0) {
         $row = sqlanywhere_fetch_array($query_get_ctrlno);
         $ctrlnumber = $row['0'];
         $control = $ctrlnumber;
         if ($transType == 'update') {
             $control = $ctrlnumber + 1;
             $update_control = sqlanywhere_query($conn, "UPDATE usrSequenceControl SET uscSeqDisbursement = '{$control}'\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t  WHERE uscUserName = '******'\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tAND uscBrno = '{$brno}'");
             // ");
             if ($update_contro) {
                 sqlanywhere_free_result($update_control);
             }
         }
     } else {
         $getTellerNumber = sqlanywhere_query($conn, "SELECT count(*) FROM usrSequenceControl");
         $rowTellerNo = sqlanywhere_fetch_array($getTellerNumber);
         $totCount = $rowTellerNo['0'];
         $totCount = $totCount + 1;
         $control = 1;
         $insert_control = sqlanywhere_query($conn, "INSERT INTO usrSequenceControl(uscUserName, uscUserNo, uscBrno, uscSeqReceipt, uscSeqDisbursement, uscCashVoucher, uscCheckVoucher, uscSeqJournal )\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tVALUES('{$user}', '{$totCount}','{$brno}', 0, '{$control}', 0, 0, 0)");
     }
     return $control;
 }
示例#3
0
文件: service.php 项目: kirkmicz/iSMS
function get_acct($conn, $ctrlname)
{
    $query_get_ctrlno = sqlanywhere_query($conn, "SELECT ctnseqno FROM setControlNo\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t  WHERE ctnctrlname = '{$ctrlname}'");
    // and brno = '$brno'");
    if (!sqlanywhere_num_rows($query_get_ctrlno) == 0) {
        $row = sqlanywhere_fetch_array($query_get_ctrlno);
        $ctrlnumber = $row['ctnseqno'];
        $control = $ctrlnumber + 1;
        //echo $ctrlnumber."control";
        $update_control = sqlanywhere_query($conn, "UPDATE setControlNo SET ctnseqno = '{$control}'\n\t\t\t\t\t\t\t\t\t\t\t\t       WHERE ctnctrlname = '{$ctrlname}'");
        // and brno = '$brno'");
        if ($update_contro) {
            sqlanywhere_free_result($update_control);
        }
    } else {
        $insert_control = sqlanywhere_query($conn, "INSERT INTO setControlNo(ctnctrlname, ctnctrldesc, ctnseqno, brno)\n\t\t\t\t\t\t\t\t\t\t\t\t\tVALUES('{$ctrlname}','Filled by Administrator','1','{$brno}')");
        $control = 1;
    }
    return $control;
}
示例#4
0
 public function process_deposit($phone, $depositAmount)
 {
     $commit = 0;
     $counter = 0;
     $query_brno = sqlanywhere_query($conn, "SELECT vcBrno, vccard_number FROM names\n\t\t\t\t\t\t\t\t\t\t\tWHERE mobile = '{$phone}' AND btcard_status='1'");
     $brno_numrows = sqlanywhere_num_rows($query_brno);
     if ($brno_numrows > 0) {
         $brno_row = sqlanywhere_fetch_row($query_brno);
         $brno = $brno_row[0];
         $cardID = $brno_row[1];
         $query_card = sqlanywhere_query($conn, "SELECT vccard_expirydate\n\t\t\t\t\t\t\t\t\t\t\t  \t\tFROM names\n\t\t\t\t\t\t\t\t\t\t\t\t\tWHERE vccard_number = '{$cardID}'\n\t\t\t\t\t\t\t\t\t\t\t\t\tAND btcard_status='1'\n\t\t\t\t\t\t\t\t\t\t\t\t\tAND vcBrno = '{$brno}'");
         $card_numrows = sqlanywhere_num_rows($query_card);
         if ($card_numrows == 0 || $card_numrows > 1) {
             //echo "ERROR|Invalid Card #";
             echo json_encode(array('success' => false, 'message' => 'Invalid card number'));
         } else {
             $card_row = sqlanywhere_fetch_row($query_card);
             $expiry_date = $card_row[0];
             $query = sqlanywhere_query($conn, "SELECT dptdailydatepost FROM setdailyposting \n\t\t\t\t\t\t\t\t\t\t\t\t\tWHERE dptdailyapptype='SA' AND brno = '{$brno}'");
             $row = sqlanywhere_fetch_array($query);
             $dateTran = $row['dptdailydatepost'];
             $date_tran = explode(" ", $dateTran);
             $trandate = $date_tran[0];
             $timepost = date("h:i:s");
             $timetrans = $trandate . " " . $timepost;
             $date_exp = explode(" ", $expiry_date);
             $date_expired = $date_exp[0];
             //select regular savings
             $selProd = sqlanywhere_query($conn, "SELECT * FROM fpdDepositProduct WHERE dpfProductDesc ='REGULAR SAVINGS'");
             $rowProd = sqlanywhere_fetch_array($selProd);
             $productID = $rowProd['dpfProductCode'];
             if (!($date_expired > $trandate)) {
                 //echo "ERROR|Date not synch";
                 echo json_encode(array('success' => false, 'message' => 'Date not sync'));
             } else {
                 $query1 = sqlanywhere_query($conn, "SELECT ctrl, acct, vcbrno FROM names \n\t\t\t\t\t\t\t\t\t\t\t\tWHERE vccard_number = '{$cardID}' AND btcard_status='1'\n\t\t\t\t\t\t\t\t\t\t\t\tAND vcBrno = '{$brno}'");
                 $existCard = sqlanywhere_num_rows($query1);
                 if ($existCard == 1) {
                     $query = sqlanywhere_query($conn, "SELECT * FROM names  WHERE vccard_number = '{$cardID}' \n\t\t\t\t\t\t\t\t\t\t\t\t\t   AND vcBrno = '{$brno}'");
                     if (sqlanywhere_num_rows($query) == 0) {
                         //echo "ERROR|Invalid Card #";
                         echo json_encode(array('success' => false, 'message' => 'Invalid Card number'));
                         exit;
                     } else {
                         $row = sqlanywhere_fetch_array($query);
                         $card_no = $row['vccard_number'];
                         $cName = $row['names'];
                         $checkCard = sqlanywhere_query($conn, "SELECT * FROM dmmDepositAccount WHERE vccard_number = '" . $card_no . "' \n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t   AND  datProductCode = '{$productID}'");
                         if (sqlanywhere_num_rows($checkCard) == 0) {
                             //echo "ERROR|Invalid Prod ID";
                             echo json_encode(array('success' => false, 'message' => 'Invalid Prod ID'));
                         } else {
                             $rowStatus = sqlanywhere_fetch_array($checkCard);
                             $AccountStatus = $rowStatus['datAccountStatus'];
                             if ($AccountStatus == '01') {
                                 $query3 = sqlanywhere_query($conn, "SELECT * FROM dmmDepositAccount \n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tWHERE vccard_number = '" . $card_no . "'  \n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tAND  datProductCode = '{$productID}'\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tAND datAccountStatus = '01'");
                                 if (sqlanywhere_num_rows($query3) == 0) {
                                     //echo "ERROR|Invalid Card # & Prod ID";
                                     echo json_encode(array('success' => false, 'message' => 'Invalid Card # & Prod ID'));
                                     exit;
                                 } else {
                                     $row3 = sqlanywhere_fetch_array($query3);
                                     $availableBal = $row3['datAvailableBalance'];
                                     $outstandingBal = $row3['datOutstandingBalance'];
                                     $sequenceNo = $row3['datSequence'];
                                     $lastMovementDate = $dateTran;
                                     $lastTransactionDate = $row3['datLastMovementDate'];
                                     $t_AvailableBal = $depositAmount + $availableBal;
                                     $t_outstandingBal = $depositAmount + $outstandingBal;
                                     $res = $sequenceNo + '1';
                                     $t_sequenceNo = leading_zeros($res, 10);
                                     $query4 = sqlanywhere_query($conn, "UPDATE dmmDepositAccount \n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tSET datAvailableBalance = {$t_AvailableBal} ,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tdatOutstandingBalance ={$t_outstandingBal}  ,                \n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tdatLastMovementDate = '{$lastMovementDate}' ,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tdatLastTransactionDate ='{$lastTransactionDate}',\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tdatSequence ='{$t_sequenceNo}'\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tWHERE vccard_number= '" . $card_no . "' \n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tAND datProductCode ='{$productID}' \n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tAND datAccountStatus = '01'");
                                     if (!$query4) {
                                         //echo "ERROR|Invalid Card # & Prod ID";
                                         echo json_encode(array('success' => false, 'message' => 'Invalid Card # & Prod ID'));
                                         $counter++;
                                         exit;
                                     } else {
                                         $query5 = sqlanywhere_query($conn, "SELECT * FROM dmmDepositAccount \n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t  WHERE vccard_number= '" . $card_no . "' \n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t  AND datProductCode ='{$productID}'\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t  AND datAccountStatus = '01'");
                                         if (sqlanywhere_num_rows($query5) == 0) {
                                             //echo "ERROR|Invalid Card # & Prod ID";
                                             echo json_encode(array('success' => false, 'message' => 'Invalid Card # & Prod ID'));
                                         } else {
                                             $row5 = sqlanywhere_fetch_array($query5);
                                             $availableBal = $row5['datAvailableBalance'];
                                             $dttAppCode = $row5['datAppCode'];
                                             $dttAccountCode = $row5['datAccountCode'];
                                             $dttProductCode = $row5['datProductCode'];
                                             $dttSequence = $row5['datSequence'];
                                             $dttTransactionDate = $timetrans;
                                             $dttTransactionCode = '001';
                                             $dttTransactionSymbol = 'CSDP';
                                             $dttCashCociCode = '1';
                                             $dttDebitTransaction = 0.0;
                                             $dttCreditTransaction = $depositAmount;
                                             $dttAvailableBalance = $t_AvailableBal;
                                             $dttOutstandingBalance = $t_outstandingBal;
                                             $dttUserInitial = $user;
                                             $dttErrorCorrect = '0';
                                             $dttBranchName = $row5['datBranchCode'];
                                             $dttCheckNumber = NULL;
                                             $dttFloatDay = '0';
                                             $dttPrintPassbook = '1';
                                             $dttPrintLedger = '1';
                                             $refnum = get_controlno('REFNUM', $dttBranchName);
                                             $trrefnum = set_reference($refnum);
                                             $RefNum = explode("-", $trrefnum);
                                             $RefNum = $RefNum[1];
                                             $dttReference = $trrefnum;
                                             $dttDateIssued = $dateTran;
                                             $dttDepositAmount = $depositAmount;
                                             $dttInterestAmount = NULL;
                                             $dttTaxAmount = NULL;
                                             $dttTransno = NULL;
                                             $vcFinance = $row5['vcFinance'];
                                             $datDepositorAddress = $row5['datDepositorAddress'];
                                             $dateTransaction = $row5['datLastMovementDate'];
                                             $str = $row5['datDepositorName'];
                                             $dttDepositorName = str_replace("'", " ", $str);
                                             $query6 = sqlanywhere_query($conn, "INSERT INTO dmmDepositTransaction\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t (dttAppCode, dttAccountCode, dttProductCode,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t  dttSequence, dttTransactionDate, dttTransactionCode,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t  dttTransactionSymbol, dttCashCociCode,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t  dttDebitTransaction,dttCreditTransaction,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t  dttAvailableBalance, dttOutstandingBalance, \n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t  dttUserInitial, dttDepositorName,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t  dttErrorCorrect, dttBranchName, dttCheckNumber,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t  dttFloatDay, dttPrintPassbook, \n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t  dttPrintLedger,dttReference, dttDateIssued,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t  dttDepositAmount, dttInterestAmount,        \n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t  dttTaxAmount, dttTransno, vcFinance)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tVALUES('{$dttAppCode}', '{$dttAccountCode}', '{$dttProductCode}',\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t   '{$dttSequence}', '{$dttTransactionDate}', '{$dttTransactionCode}',  \n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t  '{$dttTransactionSymbol}', '{$dttCashCociCode}',\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t  '{$dttDebitTransaction}', '{$dttCreditTransaction}',\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t  '{$dttAvailableBalance}','{$dttOutstandingBalance}',\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t  '{$dttUserInitial}', '{$dttDepositorName}', '{$dttErrorCorrect}',\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t  '{$dttBranchName}', '{$dttCheckNumber}', {$dttFloatDay},\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t  '{$dttPrintPassbook}', '{$dttPrintLedger}', '{$dttReference}',\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t  '{$dttDateIssued}', '{$dttDepositAmount}',\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t  '{$dttInterestAmount}','{$dttTaxAmount}',\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t  '{$dttTransno}', '{$vcFinance}')");
                                             if (!$query6) {
                                                 //echo  "ERROR|Invalid Transaction";
                                                 echo json_encode(array('success' => false, 'message' => 'Invalid Transaction'));
                                                 $counter++;
                                                 //2;
                                                 exit;
                                             } else {
                                                 //$counter++;//3
                                                 $query7 = sqlanywhere_query($conn, "SELECT * FROM  fpddepositproducttransaction\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tWHERE dtfAppCode ='{$dttAppCode}'                                   \t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tAND dtfTransactionCode ='{$dttTransactionCode}' \n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tAND dtfProductCode ='{$dttProductCode}'");
                                                 if (sqlanywhere_num_rows($query7) == 0) {
                                                     //echo "ERROR|Invalid Prod ID";
                                                     echo json_encode(array('success' => false, 'message' => 'Invalid Prod ID'));
                                                 } else {
                                                     $row7 = sqlanywhere_fetch_array($query7);
                                                     $dtfGLAcctDebit = $row7['dtfGLAcctDebit'];
                                                     $dtfGLAcctCredit = $row7['dtfGLAcctCredit'];
                                                     $trdatepost = $timetrans;
                                                     $dttBranchName = $dttBranchName;
                                                     $trdebit = $dttDepositAmount;
                                                     $trcredit = 0.0;
                                                     $trparticulars = "Savings of " . $dttDepositorName;
                                                     $trno = get_trno($trdatepost, $dttBranchName);
                                                     $trtype = '1';
                                                     $trans_no = get_transno($trdatepost, $dttBranchName);
                                                     $trtime = $timetrans;
                                                     $teller = $user;
                                                     $brno = $dttBranchName;
                                                     $trname = $dttDepositorName;
                                                     $traddress = $datDepositorAddress;
                                                     $trn_seq = get_controlno('TMPTRAN', $dttBranchName);
                                                     $vcappcode = 'SA';
                                                     $vcfinance = $vcFinance;
                                                     //insert gl transaction
                                                     if ($trcredit != 0.0) {
                                                         $tracctnum = $dtfGLAcctCredit;
                                                         //echo "trcredit".$trcredit."<BR>";
                                                         //echo "dtfGLAcctDebit".$dtfGLAcctDebit."<BR>";
                                                         $query8 = sqlanywhere_query($conn, "INSERT INTO  tmptrans(trdatepost,tracctnum,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t  trno, trans_no, brno,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t  trn_seq, trrefnum,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t  trdebit, trcredit, \n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t  trparticulars, trtype,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t  trtime, teller, trname,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t  traddr, vcAppCode,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t  vcFinance)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tVALUES('{$trdatepost}', '{$tracctnum}',\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t   '{$trno}','{$trans_no}', '{$dttBranchName}',\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t   '{$trn_seq}', '{$trrefnum}', '{$trdebit}',\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t   '{$trcredit}', '{$trparticulars}',\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t   '{$trtype}', '{$trtime}', '{$teller}',\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t   '{$trname}', '{$traddress}',\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t   '{$vcappcode}','{$vcfinance}')");
                                                         if (!$query8) {
                                                             $counter++;
                                                             //4
                                                         }
                                                     }
                                                     if ($trdebit == 0.0) {
                                                         $tracctnum = $dtfGLAcctDebit;
                                                         //echo "debit".$trdebit."<BR>";
                                                         //echo "dtfGLAcctCredit".$dtfGLAcctCredit."<BR>";
                                                         $query9 = sqlanywhere_query($conn, "INSERT INTO tmptrans(trdatepost,tracctnum, trno,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t trans_no, brno, trn_seq,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t trrefnum, trdebit, trcredit,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t trparticulars, trtype,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t trtime, teller, trname,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t traddr, vcAppCode, vcFinance)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tVALUES('{$trdatepost}', '{$tracctnum}', '{$trno}',\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t   '{$trans_no}' ,'{$dttBranchName}', '{$trn_seq}',\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t   '{$trrefnum}', '{$trcredit}', '{$trdebit}',\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t   '{$trparticulars}', '{$trtype}', '{$trtime}',\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t   '{$teller}', '{$trname}', '{$traddress}',\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t   '{$vcappcode}','{$vcfinance}')");
                                                         if (!$query9) {
                                                             $counter++;
                                                         }
                                                     }
                                                     //echo "counter".$counter."<BR>";
                                                     if ($counter == 0) {
                                                         //auditrail for mtm epoy 4-12-2013
                                                         $query13 = sqlanywhere_query($conn, "SELECT stlAppType, stlWindow, stlAudType, stlAudDesc FROM setTransactionLibrary WHERE stlID = '54'");
                                                         $row2 = sqlanywhere_fetch_array($query13);
                                                         $stlAppType = $row2['stlAppType'];
                                                         $stlWindow = $row2['stlWindow'];
                                                         $stlAudType = $row2['stlAudType'];
                                                         $stlAudDesc = $row2['stlAudDesc'];
                                                         $insertLogs = sqlanywhere_query($conn, "INSERT INTO AuditTrail(auddate, audapptype, audwindowtitle, audaudittype, audkeyvalue, auduserid, \taudremarks, transType)VALUES('{$timetrans}','{$stlAppType}','{$stlWindow}','{$stlAudType}','{$user}', '{$user}', '{$stlAudDesc}', 'M')");
                                                         if (!$insertLogs) {
                                                             //echo  "ERROR|PLS TRY AGAIN!";
                                                             echo json_encode(array('success' => false, 'message' => 'Please try again!'));
                                                             exit;
                                                         }
                                                         //end
                                                         /*$selProductName = sqlanywhere_query($conn, "SELECT * FROM fpdDepositProduct 
                                                         												WHERE dpfProductCode ='$dttProductCode'");
                                                         			
                                                         		$rowselProductName =  sqlanywhere_fetch_array($selProductName);
                                                         		$dpfProductDesc = $rowselProductName['dpfProductDesc'];
                                                         							
                                                         		$card = card_hidden($cardID);
                                                         		$savingsDep = "SUCCESSFUL";*/
                                                         echo json_encode(array('success' => true, 'message' => 'Successful'));
                                                         /*if(sqlanywhere_commit($conn))
                                                         		{ 
                                                         			$selProductName = sqlanywhere_query($conn, "SELECT * FROM fpdDepositProduct 
                                                         												WHERE dpfProductCode ='$dttProductCode'");
                                                         			
                                                         			$rowselProductName =  sqlanywhere_fetch_array($selProductName);
                                                         			$dpfProductDesc = $rowselProductName['dpfProductDesc'];
                                                         								
                                                         			$card = card_hidden($cardID);
                                                         			$savingsDep = "SUCCESSFUL";
                                                         			echo json_encode(array('success' => true, 'message' => 'Successful'));
                                                         			//echo $savingsDep;
                                                         		}
                                                         		else
                                                         		{
                                                         			//echo "ERROR|PLS TRY AGAIN.";
                                                         			echo json_encode(array('success' => false, 'message' => 'Please try again!'));
                                                         		}*/
                                                     } else {
                                                         if (sqlanywhere_rollback($conn)) {
                                                             //echo "ERROR|PLS TRY AGAIN.";
                                                             echo json_encode(array('success' => false, 'message' => 'Please try again!'));
                                                         }
                                                     }
                                                 }
                                             }
                                         }
                                     }
                                 }
                             } else {
                                 //echo "ERROR|Account is inactive";
                                 echo json_encode(array('success' => false, 'message' => 'Account is inactive'));
                             }
                         }
                     }
                 } else {
                     //echo "ERROR|Card # inactive.";
                     echo json_encode(array('success' => false, 'message' => 'Card # inactive'));
                 }
             }
         }
     } else {
         //echo "ERROR|NO MOBILE LINK";
         echo json_encode(array('success' => false, 'message' => 'NO MOBILE LINK'));
     }
 }