| 
     
      
      
      From: <dai...@us...> - 2014-02-03 09:04:05
      
     
   | 
Revision: 6558
          http://sourceforge.net/p/web-erp/reponame/6558
Author:   daintree
Date:     2014-02-03 09:04:01 +0000 (Mon, 03 Feb 2014)
Log Message:
-----------
Fix Payments.php was entering multiple lines for the total payment for each GL analysis line rather than just a single payment line for the total
Modified Paths:
--------------
    trunk/Payments.php
    trunk/doc/Change.log
Modified: trunk/Payments.php
===================================================================
--- trunk/Payments.php	2014-02-03 08:48:54 UTC (rev 6557)
+++ trunk/Payments.php	2014-02-03 09:04:01 UTC (rev 6558)
@@ -337,7 +337,9 @@
 					 /*The functional currency amount will be the
 					 payment currenct amount  / the bank account currency exchange rate  - to get to the bank account currency
 					 then / the functional currency exchange rate to get to the functional currency */
-					if ($PaymentItem->Cheque=='') $PaymentItem->Cheque=0;
+					if ($PaymentItem->Cheque=='') {
+						$PaymentItem->Cheque=0;
+					}
 					$SQL = "INSERT INTO gltrans (type,
 												typeno,
 												trandate,
@@ -346,17 +348,16 @@
 												narrative,
 												amount,
 												chequeno,
-												tag) ";
-				 	$SQL= $SQL . "VALUES (1,
-						'" . $TransNo . "',
-						'" . FormatDateForSQL($_SESSION['PaymentDetail' . $identifier]->DatePaid) . "',
-						'" . $PeriodNo . "',
-						'" . $PaymentItem->GLCode . "',
-						'" . $PaymentItem->Narrative . "',
-						'" . ($PaymentItem->Amount/$_SESSION['PaymentDetail' . $identifier]->ExRate/$_SESSION['PaymentDetail' . $identifier]->FunctionalExRate) . "',
-						'". $PaymentItem->Cheque ."',
-						'" . $PaymentItem->Tag . "'
-						)";
+												tag)
+							VALUES (1,
+									'" . $TransNo . "',
+									'" . FormatDateForSQL($_SESSION['PaymentDetail' . $identifier]->DatePaid) . "',
+									'" . $PeriodNo . "',
+									'" . $PaymentItem->GLCode . "',
+									'" . $PaymentItem->Narrative . "',
+									'" . ($PaymentItem->Amount/$_SESSION['PaymentDetail' . $identifier]->ExRate/$_SESSION['PaymentDetail' . $identifier]->FunctionalExRate) . "',
+									'". $PaymentItem->Cheque ."',
+									'" . $PaymentItem->Tag . "')";
 					$ErrMsg = _('Cannot insert a GL entry for the payment using the SQL');
 					$result = DB_query($SQL,$db,$ErrMsg,_('The SQL that failed was'),true);
 
@@ -564,44 +565,16 @@
 		}
 
 		/*now enter the BankTrans entry */
-		if ($TransType==22) {
-			$SQL="INSERT INTO banktrans (transno,
-										type,
-										bankact,
-										ref,
-										exrate,
-										functionalexrate,
-										transdate,
-										banktranstype,
-										amount,
-										currcode)
-							VALUES ('" . $TransNo . "',
-									'" . $TransType . "',
-									'" . $_SESSION['PaymentDetail' . $identifier]->Account . "',
-									'" . $_SESSION['PaymentDetail' . $identifier]->BankTransRef . "',
-									'" . $_SESSION['PaymentDetail' . $identifier]->ExRate . "',
-									'" . $_SESSION['PaymentDetail' . $identifier]->FunctionalExRate . "',
-									'" . FormatDateForSQL($_SESSION['PaymentDetail' . $identifier]->DatePaid) . "',
-									'" . $_SESSION['PaymentDetail' . $identifier]->Paymenttype . "',
-									'" . -$_SESSION['PaymentDetail' . $identifier]->Amount . "',
-									'" . $_SESSION['PaymentDetail' . $identifier]->Currency . "'
-								)";
-
-			$ErrMsg = _('Cannot insert a bank transaction because');
-			$DbgMsg = _('Cannot insert a bank transaction using the SQL');
-			$result = DB_query($SQL,$db,$ErrMsg,$DbgMsg,true);
-		} else {
-			foreach ($_SESSION['PaymentDetail' . $identifier]->GLItems as $PaymentItem) {
-				$SQL="INSERT INTO banktrans (transno,
-											type,
-											bankact,
-											ref,
-											exrate,
-											functionalexrate,
-											transdate,
-											banktranstype,
-											amount,
-											currcode)
+		$SQL="INSERT INTO banktrans (transno,
+									type,
+									bankact,
+									ref,
+									exrate,
+									functionalexrate,
+									transdate,
+									banktranstype,
+									amount,
+									currcode)
 						VALUES ('" . $TransNo . "',
 								'" . $TransType . "',
 								'" . $_SESSION['PaymentDetail' . $identifier]->Account . "',
@@ -611,13 +584,11 @@
 								'" . FormatDateForSQL($_SESSION['PaymentDetail' . $identifier]->DatePaid) . "',
 								'" . $_SESSION['PaymentDetail' . $identifier]->Paymenttype . "',
 								'" . -$_SESSION['PaymentDetail' . $identifier]->Amount . "',
-								'" . $_SESSION['PaymentDetail' . $identifier]->Currency . "' )";
+								'" . $_SESSION['PaymentDetail' . $identifier]->Currency . "')";
 
-				$ErrMsg = _('Cannot insert a bank transaction because');
-				$DbgMsg = _('Cannot insert a bank transaction using the SQL');
-				$result = DB_query($SQL,$db,$ErrMsg,$DbgMsg,true);
-			}
-		}
+		$ErrMsg = _('Cannot insert a bank transaction because');
+		$DbgMsg = _('Cannot insert a bank transaction using the SQL');
+		$result = DB_query($SQL,$db,$ErrMsg,$DbgMsg,true);
 
 		DB_Txn_Commit($db);
 		prnMsg(_('Payment') . ' ' . $TransNo . ' ' . _('has been successfully entered'),'success');
Modified: trunk/doc/Change.log
===================================================================
--- trunk/doc/Change.log	2014-02-03 08:48:54 UTC (rev 6557)
+++ trunk/doc/Change.log	2014-02-03 09:04:01 UTC (rev 6558)
@@ -2,6 +2,7 @@
 
 2/2/14 Release 4.11.3
 
+3/2/14 Phil: Fix bug in Payments.php that was duplicating payments for mutliple GL analysis entries. Now just a single bank trans is created for the payment which can be analysed to any number of GL accounts
 31/1/14 Andrew Galuski: Profit and Loss format fixed for detailed - don't show zero balances accounts
 31/1/14 Muthu: Added sequence field to BOMs.php
 30/1/14 gilberto dos santos alves: Updated pt_BR and also applied to pt_PT translation since pt_PT translation was quite old
 |