Exemple #1
0
     }
 }
 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 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 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 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 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 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\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   '{$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   '{$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   '{$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   '{$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   '{$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);
Exemple #2
0
function getBrnoByBrName($conn, $brnName)
{
    $getBrno = sqlanywhere_query($conn, "SELECT brnBranchCode FROM SETBRANCHINFO WHERE brnBranchName = '{$brnName}' ");
    $row = sqlanywhere_fetch_array($getBrno);
    return $row['brnBranchCode'];
}
Exemple #3
0
function getBank($brno)
{
    /*$population = sqlanywhere_query($conn, "SELECT c.acct, c.mobile as telno, c.names 
    														FROM setBankInfo a 
    														JOIN setBranchInfo b
    														ON a.bnkBankCode = b.brnBankInfoCode
    														JOIN names c
    														ON b.brnBranchCode = c.vcBrno
    														WHERE c.names <> '' AND (mobile <> '' AND mobile <> 'none') AND c.vcBrno = $brno ORDER BY c.names ASC");
    		$row = sqlanywhere_fetch_array($population);
    		print_r($row['pnmbr']);
    		//$data = extractThis($population);
    		//return json_encode($data);*/
    $getDet = sqlanywhere_query($conn, "SELECT * FROM gcash_TempProf");
    $row = sqlanywhere_fetch_array($getDet);
    $pnmbrRow = $row['pnmbr'];
    return $pnmbrRow;
}
Exemple #4
0
 function get_interest($ctrl, $acct, $cycle, $brno)
 {
     include 'config.php';
     $tranData = sqlanywhere_query($conn, "SELECT dptDailyDatePost FROM setDailyPosting WHERE dptDailyAppType ='LN' AND brno ='{$brno}'");
     $rowTranData = sqlanywhere_fetch_array($tranData);
     $date = explode(" ", $rowTranData[0]);
     $loanInfo = sqlanywhere_query($conn, "SELECT loan_amount, rate, terms, idiv, date_release , prin_bal, int_to, int_days_cov, lapsterm, loan_code, date_maturity\n              FROM loans, groups, loancode, balance\n              WHERE loans.ctrl = '" . $ctrl . "'\n                AND loans.acct = '" . $acct . "'\n                AND loans.cycle = '" . $cycle . "'\n                AND loans.ctrl = groups.ctrl\n                AND loans.acct = groups.acct\n                AND loans.cycle = groups.cycle\n                AND loans.ctrl = balance.ctrl\n                AND loans.acct = balance.acct\n                AND loans.cycle = balance.cycle   \n                AND groups.loan_code = loancode.code");
     $rowloanInfo = sqlanywhere_fetch_array($loanInfo);
     $amt = $rowloanInfo['0'];
     $rte = $rowloanInfo['1'];
     $trm = $rowloanInfo['2'];
     $div = $rowloanInfo['3'];
     $dtrel = $rowloanInfo['4'];
     $prin_bal = $rowloanInfo['5'];
     $dtrel = explode(" ", $dtrel);
     $int_to = $rowloanInfo['6'];
     $int_to = explode(" ", $int_to);
     $int_days_cov = $rowloanInfo['7'];
     $laps = $rowloanInfo['8'];
     $loan_code = $rowloanInfo['9'];
     $date_maturity = $rowloanInfo['10'];
     $date_maturity = explode(" ", $date_maturity);
     $selMethod = sqlanywhere_query($conn, "SELECT method FROM loancode\n              WHERE code = '" . $loan_code . "' ");
     $rowMethod = sqlanywhere_fetch_array($selMethod);
     $method = $rowMethod['0'];
     if ($method == 'D') {
         $get_tot_int = sqlanywhere_query($conn, "SELECT sum(interest) - sum(int_pay) \n\t\t            FROM amort \n\t\t              WHERE ctrl = '" . $ctrl . "'\n\t\t                AND acct = '" . $acct . "'\n\t\t                AND cycle = '" . $cycle . "'\n\t\t                and schdate <= '" . $date[0] . "'");
         $row_int = sqlanywhere_fetch_array($get_tot_int);
         $get_tot_int = $row_int['0'];
         $actualInterest = round($get_tot_int, 2);
     } else {
         if ($int_to[0] == '') {
             $actualIntCount = sqlanywhere_query($conn, "SELECT DATEDIFF(dd, '{$dtrel['0']}', '{$date['0']}')");
         } else {
             $actualIntCount = sqlanywhere_query($conn, "SELECT DATEDIFF(dd, '{$int_to['0']}', '{$date['0']}')");
         }
         $rowCount = sqlanywhere_fetch_array($actualIntCount);
         if ($laps == '') {
             $lapseTerm = $rowCount[0];
             $t_a = $lapseTerm;
         } else {
             $get_ta = $laps - $int_days_cov;
             $get_diff = floor($get_ta);
             $ta_val = $get_ta - $get_diff;
             if ($int_to[0] == $date[0] || $dtrel[0] == $date[0] || $ta_val == 0) {
                 $lapseTerm = $rowCount[0];
                 $t_a = $lapseTerm;
             } else {
                 $lapseTerm = $rowCount[0] - 1 + $ta_val;
                 $t_a = $lapseTerm;
             }
         }
         if ($t_a < 0) {
             $t_a = 0;
         }
         if ($loan_code == '02' || $int_to[0] > $date_maturity[0]) {
             $actualInterest = 0;
         } else {
             $actualInterest = $prin_bal * ($rte / 100) * $t_a / $div;
         }
         if ($int_to[0] >= $date_maturity[0]) {
             $actualInterest = 0;
         }
         $actualInterest = round($actualInterest, 2);
     }
     return $actualInterest;
 }
Exemple #5
0
            $tempProfile = sqlanywhere_query($conn, trim($_POST['query']));
            $dataField = array();
            while ($row = sqlanywhere_fetch_field($tempProfile)) {
                $dataField[] = $row;
            }
            $obj = json_encode($dataField);
            foreach (json_decode($obj) as $row) {
                //echo $row->name;
                echo "<th>" . strtoupper($row->name) . "</th>";
            }
            ?>
			</tr>
		</thead>
		<tbody>	
	<?php 
            while ($rowVal = sqlanywhere_fetch_array($tempProfile)) {
                echo '<tr>';
                foreach (json_decode($obj) as $row_val) {
                    echo "<td>" . htmlspecialchars($rowVal[$row_val->name], ENT_QUOTES) . "</td>";
                }
                echo '</tr>';
            }
        }
        //end of $firstWord[0];
    } else {
        echo '<div class="container">
						<div class="row">
							<div class="col-md-3"></div>
							<div class="col-md-6">
								<div class="alert alert-danger" role="alert">Invalid Query</div>
							</div>
Exemple #6
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'));
     }
 }