From: <dai...@us...> - 2014-02-08 04:12:11
|
Revision: 6566 http://sourceforge.net/p/web-erp/reponame/6566 Author: daintree Date: 2014-02-08 04:12:08 +0000 (Sat, 08 Feb 2014) Log Message: ----------- Deletion of internal requests Modified Paths: -------------- trunk/CustomerReceipt.php trunk/InternalStockRequestAuthorisation.php trunk/Payments.php trunk/doc/Change.log Modified: trunk/CustomerReceipt.php =================================================================== --- trunk/CustomerReceipt.php 2014-02-06 08:42:57 UTC (rev 6565) +++ trunk/CustomerReceipt.php 2014-02-08 04:12:08 UTC (rev 6566) @@ -175,18 +175,36 @@ 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'); + } else { - $_SESSION['ReceiptBatch']->add_to_batch(filter_number_format($_POST['Amount']), - $_POST['CustomerID'], - filter_number_format($_POST['Discount']), - $_POST['Narrative'], - $_POST['GLCode'], - $_POST['PayeeBankDetail'], - $_POST['CustomerName'], - $_POST['tag']); - - /*Make sure the same receipt is not double processed by a page refresh */ - $Cancel = 1; + $AllowThisPosting = true; + if ($_SESSION['ProhibitJournalsToControlAccounts'] == 1) { + if ($_SESSION['CompanyRecord']['gllink_debtors'] == '1' AND $_POST['GLCode'] == $_SESSION['CompanyRecord']['debtorsact']) { + prnMsg(_('Payments involving the debtors control account cannot be entered. The general ledger debtors ledger (AR) integration is enabled so control accounts are automatically maintained. This setting can be disabled in System Configuration'), 'warn'); + $AllowThisPosting = false; + } + if ($_SESSION['CompanyRecord']['gllink_creditors'] == '1' AND + ($_POST['GLCode'] == $_SESSION['CompanyRecord']['creditorsact'] OR $_POST['GLCode'] == $_SESSION['CompanyRecord']['grnact'])) { + prnMsg(_('Payments involving the creditors control account or the GRN suspense account cannot be entered. The general ledger creditors ledger (AP) integration is enabled so control accounts are automatically maintained. This setting can be disabled in System Configuration'), 'warn'); + $AllowThisPosting = false; + } + if ($_POST['GLCode'] == $_SESSION['CompanyRecord']['retainedearnings']) { + prnMsg(_('Payments involving the retained earnings control account cannot be entered. This account is automtically maintained.'), 'warn'); + $AllowThisPosting = false; + } + } + if ($AllowThisPosting) { + $_SESSION['ReceiptBatch']->add_to_batch(filter_number_format($_POST['Amount']), + $_POST['CustomerID'], + filter_number_format($_POST['Discount']), + $_POST['Narrative'], + $_POST['GLCode'], + $_POST['PayeeBankDetail'], + $_POST['CustomerName'], + $_POST['tag']); + /*Make sure the same receipt is not double processed by a page refresh */ + $Cancel = 1; + } } } Modified: trunk/InternalStockRequestAuthorisation.php =================================================================== --- trunk/InternalStockRequestAuthorisation.php 2014-02-06 08:42:57 UTC (rev 6565) +++ trunk/InternalStockRequestAuthorisation.php 2014-02-08 04:12:08 UTC (rev 6566) @@ -13,14 +13,29 @@ echo '<p class="page_title_text"><img src="'.$RootPath.'/css/'.$Theme.'/images/transactions.png" title="' . $Title . '" alt="" />' . ' ' . $Title . '</p>'; if (isset($_POST['UpdateAll'])) { - foreach ($_POST as $key => $value) { - if (mb_substr($key,0,6)=='status') { - $RequestNo=mb_substr($key,6); + foreach ($_POST as $POSTVariableName => $POSTValue) { + if (mb_substr($POSTVariableName,0,6)=='status') { + $RequestNo=mb_substr($POSTVariableName,6); $sql="UPDATE stockrequest SET authorised='1' - WHERE dispatchid='".$RequestNo."'"; + WHERE dispatchid='" . $RequestNo . "'"; $result=DB_query($sql, $db); } + if (strpos($POSTVariableName, 'cancel')) { + $CancelItems = explode('cancel', $POSTVariableName); + $sql = "UPDATE stockrequestitems + SET completed=1 + WHERE dispatchid='" . $CancelItems[0] . "' + AND dispatchitemsid='" . $CancelItems[1] . "'"; + $result = DB_query($sql, $db); + $result = DB_Query("SELECT stockid FROM stockrequestitems WHERE completed=0 AND dispatchid='" . $CancelItems[0] . "'",$db); + if (DB_num_rows($result) ==0){ + $result = DB_query("UPDATE stockrequest + SET authorised='1' + WHERE dispatchid='" . $CancelItems[0] . "'",$db); + } + + } } } @@ -47,10 +62,8 @@ echo '<form method="post" action="' . htmlspecialchars($_SERVER['PHP_SELF'], ENT_QUOTES, 'UTF-8') . '">'; echo '<div>'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; -echo '<table class="selection">'; - -/* Create the table for the purchase order header */ -echo '<tr> +echo '<table class="selection"> + <tr> <th>' . _('Request Number') . '</th> <th>' . _('Department') . '</th> <th>' . _('Location Of Stock') . '</th> @@ -69,7 +82,7 @@ <td>' . $myrow['narrative'] . '</td> <td><input type="checkbox" name="status'.$myrow['dispatchid'].'" /></td> </tr>'; - $linesql="SELECT stockrequestitems.dispatchitemsid, + $LinesSQL="SELECT stockrequestitems.dispatchitemsid, stockrequestitems.stockid, stockrequestitems.decimalplaces, stockrequestitems.uom, @@ -78,8 +91,9 @@ FROM stockrequestitems INNER JOIN stockmaster ON stockmaster.stockid=stockrequestitems.stockid - WHERE dispatchid='".$myrow['dispatchid'] . "'"; - $lineresult=DB_query($linesql, $db); + WHERE dispatchid='".$myrow['dispatchid'] . "' + AND completed=0"; + $LineResult=DB_query($LinesSQL, $db); echo '<tr> <td></td> @@ -89,13 +103,15 @@ <th>' . _('Product') . '</th> <th>' . _('Quantity Required') . '</th> <th>' . _('Units') . '</th> + <th>' . _('Cancel Line') . '</th> </tr>'; - while ($linerow=DB_fetch_array($lineresult)) { + while ($LineRow=DB_fetch_array($LineResult)) { echo '<tr> - <td>' . $linerow['description'] . '</td> - <td class="number">' . locale_number_format($linerow['quantity'],$linerow['decimalplaces']) . '</td> - <td>' . $linerow['uom'] . '</td> + <td>' . $LineRow['description'] . '</td> + <td class="number">' . locale_number_format($LineRow['quantity'],$LineRow['decimalplaces']) . '</td> + <td>' . $LineRow['uom'] . '</td> + <td><input type="checkbox" name="' . $myrow['dispatchid'] . 'cancel' . $LineRow['dispatchitemsid'] . '" /></td </tr>'; } // end while order line detail echo '</table> @@ -108,4 +124,4 @@ </form>'; include('includes/footer.inc'); -?> \ No newline at end of file +?> Modified: trunk/Payments.php =================================================================== --- trunk/Payments.php 2014-02-06 08:42:57 UTC (rev 6565) +++ trunk/Payments.php 2014-02-08 04:12:08 UTC (rev 6566) @@ -649,13 +649,31 @@ prnMsg( _('The Cheque/Voucher number has already been used') . ' - ' . _('This GL analysis item could not be added'),'error'); } else { $myrow = DB_fetch_array($Result); - $_SESSION['PaymentDetail' . $identifier]->add_to_glanalysis(filter_number_format($_POST['GLAmount']), - $_POST['GLNarrative'], - $_POST['GLManualCode'], - $myrow['accountname'], - $_POST['Tag'], - $_POST['Cheque']); - unset($_POST['GLManualCode']); + $AllowThisPosting = true; + if ($_SESSION['ProhibitJournalsToControlAccounts'] == 1) { + if ($_SESSION['CompanyRecord']['gllink_debtors'] == '1' AND $_POST['GLManualCode'] == $_SESSION['CompanyRecord']['debtorsact']) { + prnMsg(_('Payments involving the debtors control account cannot be entered. The general ledger debtors ledger (AR) integration is enabled so control accounts are automatically maintained. This setting can be disabled in System Configuration'), 'warn'); + $AllowThisPosting = false; + } + if ($_SESSION['CompanyRecord']['gllink_creditors'] == '1' AND + ($_POST['GLManualCode'] == $_SESSION['CompanyRecord']['creditorsact'] OR $_POST['GLManualCode'] == $_SESSION['CompanyRecord']['grnact'])) { + prnMsg(_('Payments involving the creditors control account or the GRN suspense account cannot be entered. The general ledger creditors ledger (AP) integration is enabled so control accounts are automatically maintained. This setting can be disabled in System Configuration'), 'warn'); + $AllowThisPosting = false; + } + if ($_POST['GLManualCode'] == $_SESSION['CompanyRecord']['retainedearnings']) { + prnMsg(_('Payments involving the retained earnings control account cannot be entered. This account is automtically maintained.'), 'warn'); + $AllowThisPosting = false; + } + } + if ($AllowThisPosting) { + $_SESSION['PaymentDetail' . $identifier]->add_to_glanalysis(filter_number_format($_POST['GLAmount']), + $_POST['GLNarrative'], + $_POST['GLManualCode'], + $myrow['accountname'], + $_POST['Tag'], + $_POST['Cheque']); + unset($_POST['GLManualCode']); + } } } else if (DB_num_rows($ChequeNoResult)!=0 AND $_POST['Cheque']!=''){ prnMsg( _('The cheque number has already been used') . ' - ' . _('This GL analysis item could not be added'),'error'); Modified: trunk/doc/Change.log =================================================================== --- trunk/doc/Change.log 2014-02-06 08:42:57 UTC (rev 6565) +++ trunk/doc/Change.log 2014-02-08 04:12:08 UTC (rev 6566) @@ -2,8 +2,9 @@ -2/2/14 Release 4.11.3 +10/2/14 Release 4.11.3 +8/2/14 Phil: Used Tim's code as the basis to allow deletion of internal stock request items. 6/2/14 Eduardo Marzolla: geocode integration geocode with google API v3. You need to get a API Key from google. The parameters to geocode must be: geocode key: your API key geocode lat: your lat geocode long: your long geocode height: 100 geocode width: 100 host geocode: maps.googleapis.com 6/2/14 icedlava: Payments.php - correct javascript to prevent error popup on every manual GL code entry, correct spacing. 6/2/14 icedlava: BankMatching.php - correct column heading order. |