From: <te...@us...> - 2015-11-26 01:03:51
|
Revision: 7399 http://sourceforge.net/p/web-erp/reponame/7399 Author: tehonu Date: 2015-11-26 01:03:48 +0000 (Thu, 26 Nov 2015) Log Message: ----------- Enforce the Petty cash tab cash limit when assigning new cash Modified Paths: -------------- trunk/PcAssignCashToTab.php Modified: trunk/PcAssignCashToTab.php =================================================================== --- trunk/PcAssignCashToTab.php 2015-11-24 08:50:28 UTC (rev 7398) +++ trunk/PcAssignCashToTab.php 2015-11-26 01:03:48 UTC (rev 7399) @@ -68,17 +68,28 @@ prnMsg('<br />' . _('The Amount must be input'),'error'); } - $sqlLimit = "SELECT tablimit - FROM pctabs - WHERE tabcode='" . $SelectedTabs . "'"; + $sqlLimit = "SELECT pctabs.tablimit, + pctabs.currency, + currencies.decimalplaces + FROM pctabs, + currencies + WHERE pctabs.currency = currencies.currabrev + AND pctabs.tabcode='" . $SelectedTabs . "'"; $ResultLimit = DB_query($sqlLimit); $Limit=DB_fetch_array($ResultLimit); - if (($_POST['CurrentAmount']+$_POST['Amount'])>$Limit['tablimit']){ - prnMsg(_('The balance after this assignment would be greater than the specified limit for this PC tab'),'warning'); + if (($_POST['CurrentAmount'])>$Limit['tablimit']){ + $InputError = 1; + prnMsg(_('Cash NOT assigned because PC tab current balance is over its cash limit of') . ' ' . locale_number_format($Limit['tablimit'],$Limit['decimalplaces']) . ' ' . $Limit['currency'],'error'); + prnMsg(_('Report expenses before being allowed to assign more cash or ask the administrator to increase the limit'),'error'); } + if ($InputError !=1 AND (($_POST['CurrentAmount']+$_POST['Amount'])>$Limit['tablimit'])){ + prnMsg(_('Cash assigned but PC tab current balance is over its cash limit of') . ' ' . locale_number_format($Limit['tablimit'],$Limit['decimalplaces']) . ' ' . $Limit['currency'],'warning'); + prnMsg(_('Report expenses before being allowed to assign more cash or ask the administrator to increase the limit'),'warning'); + } + if ($InputError !=1 AND isset($SelectedIndex) ) { $sql = "UPDATE pcashdetails |