|
From: <dai...@us...> - 2017-01-13 23:02:12
|
Revision: 7726
http://sourceforge.net/p/web-erp/reponame/7726
Author: daintree
Date: 2017-01-13 23:02:10 +0000 (Fri, 13 Jan 2017)
Log Message:
-----------
customer receipt can now take payment discount based on discount percentages entered against the payment methods
Modified Paths:
--------------
trunk/CustomerReceipt.php
trunk/PDFChequeListing.php
trunk/css/wood/bullet.gif
trunk/css/wood/images/ar.png
trunk/css/wood/images/company.png
trunk/css/wood/images/contract.png
trunk/css/wood/images/customer.png
trunk/css/wood/images/desk.jpg
trunk/css/wood/images/error.png
trunk/css/wood/images/folder_add.png
trunk/css/wood/images/folders.gif
trunk/css/wood/images/group_add.png
trunk/css/wood/images/help.png
trunk/css/wood/images/inquiries.png
trunk/css/wood/images/inventory.png
trunk/css/wood/images/magnifier.png
trunk/css/wood/images/maintenance.png
trunk/css/wood/images/money_add.png
trunk/css/wood/images/note_add.png
trunk/css/wood/images/pdf.png
trunk/css/wood/images/reports.gif
trunk/css/wood/images/reports.png
trunk/css/wood/images/sales.png
trunk/css/wood/images/security.png
trunk/css/wood/images/supplier.png
trunk/css/wood/images/tick.png
trunk/css/wood/images/transactions 2.png
trunk/css/wood/images/transactions.png
trunk/css/wood/images/user.png
trunk/css/wood/images/wood.jpg
trunk/includes/DefineReceiptClass.php
trunk/includes/GetPaymentMethods.php
trunk/includes/footer.inc
Modified: trunk/CustomerReceipt.php
===================================================================
--- trunk/CustomerReceipt.php 2017-01-12 16:45:37 UTC (rev 7725)
+++ trunk/CustomerReceipt.php 2017-01-13 23:02:10 UTC (rev 7726)
@@ -5,6 +5,7 @@
include('includes/DefineReceiptClass.php');
include('includes/session.inc');
+
$Title = _('Receipt Entry');
if ($_GET['Type']=='GL') {
@@ -53,10 +54,14 @@
} else {
$BankAccountEmpty=false;
}
+
$Errors = array();
+
if (!isset($_GET['Delete']) AND isset($_SESSION['ReceiptBatch' . $identifier])){
//always process a header update unless deleting an item
+ include('includes/GetPaymentMethods.php');
+
$_SESSION['ReceiptBatch' . $identifier]->Account = $_POST['BankAccount'];
/*Get the bank account currency and set that too */
@@ -177,6 +182,9 @@
if (!isset($_POST['CustomerName'])) {
$_POST['CustomerName']='';
}
+ if ($_POST['Discount']==0 AND $ReceiptTypes[$_SESSION['ReceiptBatch' . $identifier]->ReceiptType]['percentdiscount']>0){
+ $_POST['Discount'] = $_POST['Amount']*$ReceiptTypes[$_SESSION['ReceiptBatch' . $identifier]->ReceiptType]['percentdiscount'];
+ }
if ($_POST['GLCode'] == '' AND $_GET['Type']=='GL') {
prnMsg( _('No General Ledger code has been chosen') . ' - ' . _('so this GL analysis item could not be added'),'warn');
@@ -407,7 +415,7 @@
'" . (($_SESSION['ReceiptBatch' . $identifier]->ExRate * $_SESSION['ReceiptBatch' . $identifier]->FunctionalExRate)/$TrfFromBankExRate). "',
'" . $TrfFromBankExRate . "',
'" . FormatDateForSQL($_SESSION['ReceiptBatch' . $identifier]->DateBanked) . "',
- '" . $_SESSION['ReceiptBatch' . $identifier]->ReceiptType . "',
+ '" . $ReceiptTypes[$_SESSION['ReceiptBatch' . $identifier]->ReceiptType]['paymentname'] . "',
'" . -$ReceiptItem->Amount . "',
'" . $_SESSION['ReceiptBatch' . $identifier]->Currency . "'
)";
@@ -450,7 +458,7 @@
'" . FormatDateForSQL($_SESSION['ReceiptBatch' . $identifier]->DateBanked) . "',
'" . date('Y-m-d H-i-s') . "',
'" . $PeriodNo . "',
- '" . $_SESSION['ReceiptBatch' . $identifier]->ReceiptType . ' ' . $ReceiptItem->PayeeBankDetail . "',
+ '" . $ReceiptTypes[$_SESSION['ReceiptBatch' . $identifier]->ReceiptType]['paymentname'] . ' ' . $ReceiptItem->PayeeBankDetail . "',
'',
'" . ($_SESSION['ReceiptBatch' . $identifier]->FunctionalExRate*$_SESSION['ReceiptBatch' . $identifier]->ExRate) . "',
'" . -$ReceiptItem->Amount . "',
@@ -498,7 +506,7 @@
'" . $_SESSION['ReceiptBatch' . $identifier]->ExRate . "',
'" . $_SESSION['ReceiptBatch' . $identifier]->FunctionalExRate . "',
'" . FormatDateForSQL($_SESSION['ReceiptBatch' . $identifier]->DateBanked) . "',
- '" . $_SESSION['ReceiptBatch' . $identifier]->ReceiptType . "',
+ '" . $ReceiptTypes[$_SESSION['ReceiptBatch' . $identifier]->ReceiptType]['paymentname'] . "',
'" . ($BatchReceiptsTotal * $_SESSION['ReceiptBatch' . $identifier]->FunctionalExRate * $_SESSION['ReceiptBatch' . $identifier]->ExRate) . "',
'" . $_SESSION['ReceiptBatch' . $identifier]->Currency . "'
)";
@@ -785,7 +793,7 @@
/*set up the form whatever */
-echo '<form action="' . htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8') . '?Type='.$_GET['Type'] . '&identifier=' . $identifier . '" method="post" id="form1">';
+echo '<form action="' . htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8') . '?Type=' . $_GET['Type'] . '&identifier=' . $identifier . '" method="post" id="form1">';
echo '<div>';
echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />';
@@ -902,6 +910,7 @@
}
if($_SESSION['ReceiptBatch' . $identifier]->AccountCurrency != $_SESSION['CompanyRecord']['currencydefault'] AND isset($_SESSION['ReceiptBatch' . $identifier]->AccountCurrency)) {
+
if($_SESSION['ReceiptBatch' . $identifier]->FunctionalExRate==1 AND isset($SuggestedFunctionalExRate)) {
$_SESSION['ReceiptBatch' . $identifier]->FunctionalExRate = $SuggestedFunctionalExRate;
}
@@ -918,17 +927,16 @@
echo '<tr>
<td>' . _('Receipt Type') . ':</td>
- <td><select name="ReceiptType" tabindex="6">';
+ <td><select name="ReceiptType" tabindex="6" onchange="ReloadForm(form1.BatchInput)">';
-include('includes/GetPaymentMethods.php');
/* The array ReceiptTypes is defined from the setup tab of the main menu under
payment methods - the array is populated from the include file GetPaymentMethods.php */
foreach ($ReceiptTypes as $RcptType) {
- if (isset($_POST['ReceiptType']) and $_POST['ReceiptType']==$RcptType){
- echo '<option selected="selected" value="' . $RcptType . '">' . $RcptType . '</option>';
+ if (isset($_POST['ReceiptType']) AND $_POST['ReceiptType']==$RcptType['paymentid']){
+ echo '<option selected="selected" value="' . $RcptType['paymentid'] . '">' . $RcptType['paymentname'] . '</option>';
} else {
- echo '<option value="' .$RcptType . '">' . $RcptType . '</option>';
+ echo '<option value="' . $RcptType['paymentid'] . '">' . $RcptType['paymentname'] . '</option>';
}
}
echo '</select></td>
@@ -969,7 +977,7 @@
/* Now show the entries made so far */
if (!$BankAccountEmpty) {
echo '<p class="page_title_text"><img src="'.$RootPath.'/css/'.$Theme.'/images/transactions.png" title="' . _('Banked') . '" alt="" />
- ' . ' ' . $_SESSION['ReceiptBatch' . $identifier]->ReceiptType . ' - ' . _('Banked into the') . " " .
+ ' . ' ' . $ReceiptTypes[$_SESSION['ReceiptBatch' . $identifier]->ReceiptType]['paymentname'] . ' - ' . _('Banked into the') . " " .
$_SESSION['ReceiptBatch' . $identifier]->BankAccountName . ' ' . _('on') . ' ' . $_SESSION['ReceiptBatch' . $identifier]->DateBanked . '</p>';
}
@@ -1064,7 +1072,11 @@
echo '<table class="selection">';
- $DisplayDiscountPercent = locale_number_format($_SESSION['CustomerRecord' . $identifier]['pymtdiscount']*100,2) . '%';
+ if ($_SESSION['CustomerRecord' . $identifier]['pymtdiscount'] > $ReceiptTypes[$_SESSION['ReceiptBatch' . $identifier]->ReceiptType]['percentdiscount']) {
+ $DisplayDiscountPercent = locale_number_format($_SESSION['CustomerRecord' . $identifier]['pymtdiscount']*100,2) . '%';
+ } else {
+ $DisplayDiscountPercent = locale_number_format($ReceiptTypes[$_SESSION['ReceiptBatch' . $identifier]->ReceiptType]['percentdiscount']*100,2) . '%';
+ }
echo '<input type="hidden" name="CustomerID" value="' . $_POST['CustomerID'] . '" />';
echo '<input type="hidden" name="CustomerName" value="' . $_SESSION['CustomerRecord' . $identifier]['name'] . '" />';
@@ -1130,6 +1142,10 @@
}
}
+
+
+
+
/*if either a customer is selected or its a GL Entry then set out
the fields for entry of receipt amt, disc, payee details, narrative */
Modified: trunk/PDFChequeListing.php
===================================================================
--- trunk/PDFChequeListing.php 2017-01-12 16:45:37 UTC (rev 7725)
+++ trunk/PDFChequeListing.php 2017-01-13 23:02:10 UTC (rev 7726)
@@ -224,7 +224,4 @@
$result = SendmailBySmtp($mail,$ChkListingRecipients);
}
}
-
-
-
?>
Modified: trunk/css/wood/bullet.gif
===================================================================
(Binary files differ)
Modified: trunk/css/wood/images/ar.png
===================================================================
(Binary files differ)
Modified: trunk/css/wood/images/company.png
===================================================================
(Binary files differ)
Modified: trunk/css/wood/images/contract.png
===================================================================
(Binary files differ)
Modified: trunk/css/wood/images/customer.png
===================================================================
(Binary files differ)
Modified: trunk/css/wood/images/desk.jpg
===================================================================
(Binary files differ)
Modified: trunk/css/wood/images/error.png
===================================================================
(Binary files differ)
Modified: trunk/css/wood/images/folder_add.png
===================================================================
(Binary files differ)
Modified: trunk/css/wood/images/folders.gif
===================================================================
(Binary files differ)
Modified: trunk/css/wood/images/group_add.png
===================================================================
(Binary files differ)
Modified: trunk/css/wood/images/help.png
===================================================================
(Binary files differ)
Modified: trunk/css/wood/images/inquiries.png
===================================================================
(Binary files differ)
Modified: trunk/css/wood/images/inventory.png
===================================================================
(Binary files differ)
Modified: trunk/css/wood/images/magnifier.png
===================================================================
(Binary files differ)
Modified: trunk/css/wood/images/maintenance.png
===================================================================
(Binary files differ)
Modified: trunk/css/wood/images/money_add.png
===================================================================
(Binary files differ)
Modified: trunk/css/wood/images/note_add.png
===================================================================
(Binary files differ)
Modified: trunk/css/wood/images/pdf.png
===================================================================
(Binary files differ)
Modified: trunk/css/wood/images/reports.gif
===================================================================
(Binary files differ)
Modified: trunk/css/wood/images/reports.png
===================================================================
(Binary files differ)
Modified: trunk/css/wood/images/sales.png
===================================================================
(Binary files differ)
Modified: trunk/css/wood/images/security.png
===================================================================
(Binary files differ)
Modified: trunk/css/wood/images/supplier.png
===================================================================
(Binary files differ)
Modified: trunk/css/wood/images/tick.png
===================================================================
(Binary files differ)
Modified: trunk/css/wood/images/transactions 2.png
===================================================================
(Binary files differ)
Modified: trunk/css/wood/images/transactions.png
===================================================================
(Binary files differ)
Modified: trunk/css/wood/images/user.png
===================================================================
(Binary files differ)
Modified: trunk/css/wood/images/wood.jpg
===================================================================
(Binary files differ)
Modified: trunk/includes/DefineReceiptClass.php
===================================================================
--- trunk/includes/DefineReceiptClass.php 2017-01-12 16:45:37 UTC (rev 7725)
+++ trunk/includes/DefineReceiptClass.php 2017-01-13 23:02:10 UTC (rev 7726)
@@ -25,6 +25,7 @@
$this->Items = array();
$this->ItemCounter=0;
$this->total=0;
+ $this->ReceiptType=array();
}
function add_to_batch($Amount, $Customer, $Discount, $Narrative, $GLCode, $PayeeBankDetail, $CustomerName, $tag){
@@ -78,4 +79,4 @@
}
}
-?>
\ No newline at end of file
+?>
Modified: trunk/includes/GetPaymentMethods.php
===================================================================
--- trunk/includes/GetPaymentMethods.php 2017-01-12 16:45:37 UTC (rev 7725)
+++ trunk/includes/GetPaymentMethods.php 2017-01-13 23:02:10 UTC (rev 7726)
@@ -4,9 +4,11 @@
$PaytTypes = array();
$ReceiptTypes = array();
-$sql = 'SELECT paymentname,
+$sql = 'SELECT paymentid,
+ paymentname,
paymenttype,
- receipttype
+ receipttype,
+ percentdiscount
FROM paymentmethods
ORDER by paymentname';
@@ -16,8 +18,8 @@
$PaytTypes[] = $PMrow['paymentname'];
}
if ($PMrow['receipttype']==1) {
- $ReceiptTypes[] = $PMrow['paymentname'];
+ $ReceiptTypes[$PMrow['paymentid']] = $PMrow;
}
}
DB_free_result($PMResult); // no longer needed
-?>
\ No newline at end of file
+?>
Modified: trunk/includes/footer.inc
===================================================================
--- trunk/includes/footer.inc 2017-01-12 16:45:37 UTC (rev 7725)
+++ trunk/includes/footer.inc 2017-01-13 23:02:10 UTC (rev 7726)
@@ -24,7 +24,7 @@
echo '</div>'; // FooterDiv
echo '</div>'; // Canvas
-echo '</body>';
-echo '</html>';
+echo '</body>
+ </html>';
-?>
\ No newline at end of file
+?>
|