From: <ex...@us...> - 2016-07-07 11:11:37
|
Revision: 7565 http://sourceforge.net/p/web-erp/reponame/7565 Author: exsonqu Date: 2016-07-07 11:11:34 +0000 (Thu, 07 Jul 2016) Log Message: ----------- 07/07/16: Exson: Fixed the bug of wrong original amount of payments to another bank accounts in GLAccountInquiry.php and wrong transaction link in DailyBankTransactions.php and add payment transaction no in bank transaction ref to make it traceable. Modified Paths: -------------- trunk/DailyBankTransactions.php trunk/GLAccountInquiry.php trunk/Payments.php Modified: trunk/DailyBankTransactions.php =================================================================== --- trunk/DailyBankTransactions.php 2016-07-03 06:58:29 UTC (rev 7564) +++ trunk/DailyBankTransactions.php 2016-07-07 11:11:34 UTC (rev 7565) @@ -194,6 +194,10 @@ $k = 0; } //check the GL narrative + if ($myrow['type'] == 2) { + $myrow['typeid'] = 1; + $myrow['transno'] = substr($myrow['ref'],1,strpos($myrow['ref'],' ')-1); + } $sql = "SELECT narrative FROM gltrans WHERE type='" . $myrow['typeid'] . "' AND typeno='" . $myrow['transno'] . "'"; $ErrMsg = _('Failed to retrieve gl narrative'); $glresult = DB_query($sql,$ErrMsg); Modified: trunk/GLAccountInquiry.php =================================================================== --- trunk/GLAccountInquiry.php 2016-07-03 06:58:29 UTC (rev 7564) +++ trunk/GLAccountInquiry.php 2016-07-07 11:11:34 UTC (rev 7565) @@ -165,7 +165,6 @@ } $sql = $sql . " ORDER BY periodno, gltrans.trandate, counterindex"; - $namesql = "SELECT accountname FROM chartmaster WHERE accountcode='" . $SelectedAccount . "'"; $nameresult = DB_query($namesql); $namerow=DB_fetch_array($nameresult); @@ -296,6 +295,29 @@ $BankRef = $bankrow['ref']; $OrgAmt = $bankrow['amount']; $Currency = $bankrow['currcode']; + } elseif ($myrow['type'] == 1) { + //We should find out when transaction happens between bank accounts; + $bankreceivesql = "SELECT ref,type,transno,currcode,amount FROM banktrans + WHERE ref LIKE '@%' AND transdate='" . $myrow['trandate'] . "' AND bankact='" . $SelectedAccount . "'"; + $ErrMsg = _('Failed to retrieve bank receive data'); + $bankresult = DB_query($bankreceivesql,$ErrMsg); + if (DB_num_rows($bankresult)>0) { + while ($bankrow = DB_fetch_array($bankresult)) { + if (substr($bankrow['ref'],1,strpos($bankrow['ref'],' ')-1) == $myrow['typeno']) { + $BankRef = $bankrow['ref']; + $OrgAmt = $bankrow['amount']; + $Currency = $bankrow['currcode']; + $BankReceipt = true; + break; + } + } + } + if (!isset($BankReceipt)) { + $BankRef = ''; + $OrgAmt = $myrow['amount']; + $Currency = $_SESSION['CompanyRecord']['currencydefault']; + } + } elseif(isset($BankAccount)){ $BankRef = ''; $OrgAmt = $myrow['amount']; Modified: trunk/Payments.php =================================================================== --- trunk/Payments.php 2016-07-03 06:58:29 UTC (rev 7564) +++ trunk/Payments.php 2016-07-07 11:11:34 UTC (rev 7565) @@ -460,7 +460,7 @@ $ReceiptTransNo . "', 2,'" . $PaymentItem->GLCode . "','" . - _('Act Transfer From ') . $_SESSION['PaymentDetail'.$identifier]->Account . ' - ' . $PaymentItem->Narrative . "','" . + '@' . $TransNo . ' ' . _('Act Transfer From ') . $_SESSION['PaymentDetail'.$identifier]->Account . ' - ' . $PaymentItem->Narrative . "','" . (($_SESSION['PaymentDetail'.$identifier]->ExRate * $_SESSION['PaymentDetail'.$identifier]->FunctionalExRate)/$TrfToBankExRate). "','" . $TrfToBankExRate . "','" . FormatDateForSQL($_SESSION['PaymentDetail'.$identifier]->DatePaid) . "','" . |