|
From: <dai...@us...> - 2017-01-12 09:09:28
|
Revision: 7721
http://sourceforge.net/p/web-erp/reponame/7721
Author: daintree
Date: 2017-01-12 09:09:25 +0000 (Thu, 12 Jan 2017)
Log Message:
-----------
add discount percentage to paymentmethods table
Modified Paths:
--------------
trunk/PaymentMethods.php
trunk/doc/Change.log
trunk/sql/mysql/upgrade4.13.1-4.14.sql
Modified: trunk/PaymentMethods.php
===================================================================
--- trunk/PaymentMethods.php 2017-01-11 05:50:37 UTC (rev 7720)
+++ trunk/PaymentMethods.php 2017-01-12 09:09:25 UTC (rev 7721)
@@ -47,6 +47,22 @@
$Errors[$i] = 'MethodName';
$i++;
}
+ if (!is_numeric(filter_number_format($_POST['DiscountPercent']))) {
+ $InputError = 1;
+ prnMsg( _('The discount percentage must be a number less than 1'),'error');
+ $Errors[$i] = 'DiscountPercent';
+ $i++;
+ } else if (filter_number_format($_POST['DiscountPercent'])>1) {
+ $InputError = 1;
+ prnMsg( _('The discount percentage must be a number less than 1'),'error');
+ $Errors[$i] = 'DiscountPercent';
+ $i++;
+ } else if (filter_number_format($_POST['DiscountPercent'])<0) {
+ $InputError = 1;
+ prnMsg( _('The discount percentage must be either zero or less than 1'),'error');
+ $Errors[$i] = 'DiscountPercent';
+ $i++;
+ }
if (isset($_POST['SelectedPaymentID']) AND $InputError !=1) {
/*SelectedPaymentID could also exist if submit had not been clicked this code would not run in this case cos submit is false of course see the delete code below*/
@@ -73,7 +89,8 @@
paymenttype = '" . $_POST['ForPayment'] . "',
receipttype = '" . $_POST['ForReceipt'] . "',
usepreprintedstationery = '" . $_POST['UsePrePrintedStationery']. "',
- opencashdrawer = '" . $_POST['OpenCashDrawer'] . "'
+ opencashdrawer = '" . $_POST['OpenCashDrawer'] . "',
+ percentdiscount = '" . filter_number_format($_POST['DiscountPercent']) . "'
WHERE paymentname " . LIKE . " '".$OldName."'";
} else {
@@ -97,12 +114,14 @@
paymenttype,
receipttype,
usepreprintedstationery,
- opencashdrawer)
+ opencashdrawer,
+ percentdiscount)
VALUES ('" . $_POST['MethodName'] ."',
'" . $_POST['ForPayment'] ."',
'" . $_POST['ForReceipt'] ."',
'" . $_POST['UsePrePrintedStationery'] ."',
- '" . $_POST['OpenCashDrawer'] . "')";
+ '" . $_POST['OpenCashDrawer'] . "',
+ '" . filter_number_format($_POST['DiscountPercent']) . "')";
}
$msg = _('New payment method added');
$ErrMsg = _('Could not insert the new payment method');
@@ -174,7 +193,8 @@
paymenttype,
receipttype,
usepreprintedstationery,
- opencashdrawer
+ opencashdrawer,
+ percentdiscount
FROM paymentmethods
ORDER BY paymentid";
@@ -188,6 +208,7 @@
<th class="ascending">' . _('Use For Receipts') . '</th>
<th class="ascending">' . _('Use Pre-printed Stationery') . '</th>
<th class="ascending">' . _('Open POS Cash Drawer for Sale') . '</th>
+ <th class="ascending">' . _('Payment discount') . ' %</th>
<th colspan="2"> </th>
</tr>';
@@ -207,6 +228,7 @@
<td class="centre">' . ($myrow['receipttype'] ? _('Yes') : _('No')) . '</td>
<td class="centre">' . ($myrow['usepreprintedstationery'] ? _('Yes') : _('No')) . '</td>
<td class="centre">' . ($myrow['opencashdrawer'] ? _('Yes') : _('No')) . '</td>
+ <td class="centre">' . locale_number_format($myrow['percentdiscount']*100,2) . '</td>
<td><a href="' . htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8') . '?SelectedPaymentID=' . $myrow['paymentid'] . '">' . _('Edit') . '</a></td>
<td><a href="' . htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8') . '?SelectedPaymentID=' . $myrow['paymentid'] . '&delete=1" onclick="return confirm(\'' . _('Are you sure you wish to delete this payment method?') . '\');">' . _('Delete') . '</a></td>
</tr>';
@@ -235,7 +257,9 @@
paymentname,
paymenttype,
receipttype,
- usepreprintedstationery
+ usepreprintedstationery,
+ opencashdrawer,
+ percentdiscount
FROM paymentmethods
WHERE paymentid='" . $SelectedPaymentID . "'";
@@ -252,6 +276,7 @@
$_POST['ForReceipt'] = $myrow['receipttype'];
$_POST['UsePrePrintedStationery'] = $myrow['usepreprintedstationery'];
$_POST['OpenCashDrawer'] = $myrow['opencashdrawer'];
+ $_POST['DiscountPercent'] = $myrow['percentdiscount'];
echo '<input type="hidden" name="SelectedPaymentID" value="' . $_POST['MethodID'] . '" />';
echo '<table class="selection">';
@@ -263,6 +288,7 @@
$_POST['ForReceipt'] = 1; // Default is use for receipts
$_POST['UsePrePrintedStationery'] = 0; // Default is use for receipts
$_POST['OpenCashDrawer'] = 0; //Default is not to open cash drawer
+ $_POST['DiscountPercent']=0;
echo '<table class="selection">';
}
echo '<tr>
@@ -297,6 +323,10 @@
<option' . ($_POST['OpenCashDrawer'] ? '' : ' selected="selected"') .' value="0">' . _('No') . '</option>
</select></td>
</tr>';
+ echo '<tr>
+ <td>' . _('Payment Discount Percent on Receipts') . ':' . '</td>
+ <td><input type="text" class="number" min="0" max="1" name="DiscountPercent" value="' . locale_number_format($_POST['DiscountPercent'],2) . '" /></td>
+ </tr>';
echo '</table>';
echo '<br /><div class="centre"><input type="submit" name="submit" value="' . _('Enter Information') . '" /></div>';
Modified: trunk/doc/Change.log
===================================================================
--- trunk/doc/Change.log 2017-01-11 05:50:37 UTC (rev 7720)
+++ trunk/doc/Change.log 2017-01-12 09:09:25 UTC (rev 7721)
@@ -1,5 +1,6 @@
webERP Change Log
+12/1/17 Phil: Added a discount percentage field to the payment methods - to allow calculation of discount when receipts entered... still yet to code this bit
06/01/17 RChacon: Add Turn off/on the page help and the field help.
05/01/17 RChacon: In GLCashFlowsIndirect.php, fix named key in Associative array with config value. Thanks Tim.
05/01/17 RChacon: For strict Standards, removes the "&" before the variable in DB_fetch_row() and in DB_fetch_array() in ConnectDB_XXX.inc. Thanks Tim.
@@ -13,7 +14,7 @@
02/12/16 PaulT: WriteReport.inc: Fix condition needed to support PHP7, reported by Tim.
02/12/16 RChacon: fix and improve code for existent parameters in GLCashFlowsSetup.php.
02/12/16 Exson: Add location code and reference to Work Orders search result in SelectWorkOrder.php.
-02/12/16 Exson: Fixed the no users data displayed bug and copy BOM fields error bug in WWW_Users.php and CopyBOM.php. Thanks for shane's report.
+02/12/16 Exson: Fixed the no users data displayed bug and copy BOM fields error bug in WWW_Users.php and CopyBOM.php. Thanks for shane's report.
30/11/16 Exson: Fixed the bug that write off option not work without freight cost input in Credit_Invoice.php.
27/11/16 4.13.1 release
Modified: trunk/sql/mysql/upgrade4.13.1-4.14.sql
===================================================================
--- trunk/sql/mysql/upgrade4.13.1-4.14.sql 2017-01-11 05:50:37 UTC (rev 7720)
+++ trunk/sql/mysql/upgrade4.13.1-4.14.sql 2017-01-12 09:09:25 UTC (rev 7721)
@@ -4,5 +4,7 @@
-- Add new user's options:
ALTER TABLE `www_users` ADD `showpagehelp` TINYINT(1) NOT NULL DEFAULT '1' COMMENT 'Turn off/on page help' AFTER `showdashboard`, ADD `showfieldhelp` TINYINT(1) NOT NULL DEFAULT '1' COMMENT 'Turn off/on field help' AFTER `showpagehelp`;
+ALTER TABLE `paymentmethods` ADD COLUMN `percentdiscount` DOUBLE NOT NULL DEFAULT 0;
+
-- Update version number:
UPDATE config SET confvalue='4.14' WHERE confname='VersionNumber';
|