From: <dai...@us...> - 2011-09-19 09:38:27
|
Revision: 4696 http://web-erp.svn.sourceforge.net/web-erp/?rev=4696&view=rev Author: daintree Date: 2011-09-19 09:38:20 +0000 (Mon, 19 Sep 2011) Log Message: ----------- number_formats Modified Paths: -------------- trunk/BankReconciliation.php trunk/includes/LanguageSetup.php trunk/sql/mysql/upgrade4.05-4.06.sql Modified: trunk/BankReconciliation.php =================================================================== --- trunk/BankReconciliation.php 2011-09-18 01:22:23 UTC (rev 4695) +++ trunk/BankReconciliation.php 2011-09-19 09:38:20 UTC (rev 4696) @@ -17,13 +17,17 @@ $_POST['ShowRec']=true; } +if (isset($_POST['BankStatementBalance'])){ + $_POST['BankStatementBalance'] = filter_number_format($_POST['BankStatementBalance']); +} + if (isset($_POST['PostExchangeDifference']) and is_numeric($_POST['DoExchangeDifference'])){ - if (!is_numeric(filter_number_format($_POST['BankStatementBalance']))){ + if (!is_numeric($_POST['BankStatementBalance'])){ prnMsg(_('The entry in the bank statement balance is not numeric. The balance on the bank statement should be entered. The exchange difference has not been calculated and no general ledger journal has been created'),'warn'); echo '<p>' . $_POST['BankStatementBalance']; } else { - $_POST['BankStatementBalance'] = filter_number_format($_POST['BankStatementBalance']); + /* Now need to get the currency of the account and the current table ex rate */ $SQL = "SELECT rate, bankaccountname, Modified: trunk/includes/LanguageSetup.php =================================================================== --- trunk/includes/LanguageSetup.php 2011-09-18 01:22:23 UTC (rev 4695) +++ trunk/includes/LanguageSetup.php 2011-09-19 09:38:20 UTC (rev 4696) @@ -4,7 +4,7 @@ /* Set internal character encoding to UTF-8 */ mb_internal_encoding('UTF-8'); -include('includes/LanguagesArray.php'); + /* This file is included in session.inc or PDFStarter.php or a report script that does not use PDFStarter.php to check for the existance of gettext function and setup the necessary enviroment to allow for automatic translation @@ -24,40 +24,9 @@ $Language = $_SESSION['Language']; } -if (defined('LC_MESSAGES')){ //it's a unix/linux server - $Locale = setlocale (LC_MESSAGES, $_SESSION['Language']); - $Locale = setlocale (LC_NUMERIC, $_SESSION['Language']); -} else { // it's a windows server - $Locale = setlocale (LC_ALL, $LanguageArray[$_SESSION['Language']]['WindowsLocale']); -} -$Locale = setlocale (LC_NUMERIC, 'fr_FR.utf8'); - -$LocaleInfo = localeconv(); -if ($LocaleInfo['mon_decimal_point']==''){ - $LocaleInfo['mon_decimal_point']= $LocaleInfo['decimal_point']; -} -if ($LocaleInfo['mon_thousands_sep']==''){ - $LocaleInfo['mon_thousands_sep']= $LocaleInfo['thousands_sep']; -} - - - -//Turkish seems to be a special case -if ($_SESSION['Language']=='tr_TR.utf8') { - $Locale = setlocale(LC_CTYPE, 'C'); -} - - -if (function_exists('gettext')){ - - // possibly even if locale fails the language will still switch by using Language instead of locale variable - putenv('LANG=' . $_SESSION['Language']); - putenv('LANGUAGE=' . $_SESSION['Language']); - bindtextdomain ('messages', $PathPrefix . 'locale'); - textdomain ('messages'); - bind_textdomain_codeset('messages', 'UTF-8'); - -} else { +/*Since LanguagesArray requires the function _() to translate the language names - we must provide a substitute if it doesn't exist aready before we include includes/LanguagesArray.php + * */ +if (!function_exists('gettext')) { /* PHPGettext integration by Braian Gomez http://www.vairux.com/ @@ -91,7 +60,40 @@ return $text; } } - $LocaleInfo = localeconv(); } +include('includes/LanguagesArray.php'); + +if (defined('LC_MESSAGES')){ //it's a unix/linux server + $Locale = setlocale (LC_MESSAGES, $_SESSION['Language']); + $Locale = setlocale (LC_NUMERIC, $_SESSION['Language']); +} else { // it's a windows server + $Locale = setlocale (LC_ALL, $LanguageArray[$_SESSION['Language']]['WindowsLocale']); +} + +//for testing number_formats $Locale = setlocale (LC_NUMERIC, 'fr_FR.utf8'); + +$LocaleInfo = localeconv(); +if ($LocaleInfo['mon_decimal_point']==''){ + $LocaleInfo['mon_decimal_point']= $LocaleInfo['decimal_point']; +} +if ($LocaleInfo['mon_thousands_sep']==''){ + $LocaleInfo['mon_thousands_sep']= $LocaleInfo['thousands_sep']; +} + +//Turkish seems to be a special case +if ($_SESSION['Language']=='tr_TR.utf8') { + $Locale = setlocale(LC_CTYPE, 'C'); +} + +if (function_exists('gettext')){ + + // possibly even if locale fails the language will still switch by using Language instead of locale variable + putenv('LANG=' . $_SESSION['Language']); + putenv('LANGUAGE=' . $_SESSION['Language']); + bindtextdomain ('messages', $PathPrefix . 'locale'); + textdomain ('messages'); + bind_textdomain_codeset('messages', 'UTF-8'); +} + ?> Modified: trunk/sql/mysql/upgrade4.05-4.06.sql =================================================================== --- trunk/sql/mysql/upgrade4.05-4.06.sql 2011-09-18 01:22:23 UTC (rev 4695) +++ trunk/sql/mysql/upgrade4.05-4.06.sql 2011-09-19 09:38:20 UTC (rev 4696) @@ -2,4 +2,5 @@ ALTER TABLE stockmaster ADD lastcostupdate DATE NOT NULL; INSERT INTO `config` (`confname` ,`confvalue`) VALUES ('InventoryManagerEmail', ''); +ALTER TABLE `banktrans` ADD INDEX ( `ref` ); UPDATE config SET confvalue='4.05.2' WHERE confname='VersionNumber'; \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dai...@us...> - 2011-09-19 09:38:27
|
Revision: 4696 http://web-erp.svn.sourceforge.net/web-erp/?rev=4696&view=rev Author: daintree Date: 2011-09-19 09:38:20 +0000 (Mon, 19 Sep 2011) Log Message: ----------- number_formats Modified Paths: -------------- trunk/BankReconciliation.php trunk/includes/LanguageSetup.php trunk/sql/mysql/upgrade4.05-4.06.sql Modified: trunk/BankReconciliation.php =================================================================== --- trunk/BankReconciliation.php 2011-09-18 01:22:23 UTC (rev 4695) +++ trunk/BankReconciliation.php 2011-09-19 09:38:20 UTC (rev 4696) @@ -17,13 +17,17 @@ $_POST['ShowRec']=true; } +if (isset($_POST['BankStatementBalance'])){ + $_POST['BankStatementBalance'] = filter_number_format($_POST['BankStatementBalance']); +} + if (isset($_POST['PostExchangeDifference']) and is_numeric($_POST['DoExchangeDifference'])){ - if (!is_numeric(filter_number_format($_POST['BankStatementBalance']))){ + if (!is_numeric($_POST['BankStatementBalance'])){ prnMsg(_('The entry in the bank statement balance is not numeric. The balance on the bank statement should be entered. The exchange difference has not been calculated and no general ledger journal has been created'),'warn'); echo '<p>' . $_POST['BankStatementBalance']; } else { - $_POST['BankStatementBalance'] = filter_number_format($_POST['BankStatementBalance']); + /* Now need to get the currency of the account and the current table ex rate */ $SQL = "SELECT rate, bankaccountname, Modified: trunk/includes/LanguageSetup.php =================================================================== --- trunk/includes/LanguageSetup.php 2011-09-18 01:22:23 UTC (rev 4695) +++ trunk/includes/LanguageSetup.php 2011-09-19 09:38:20 UTC (rev 4696) @@ -4,7 +4,7 @@ /* Set internal character encoding to UTF-8 */ mb_internal_encoding('UTF-8'); -include('includes/LanguagesArray.php'); + /* This file is included in session.inc or PDFStarter.php or a report script that does not use PDFStarter.php to check for the existance of gettext function and setup the necessary enviroment to allow for automatic translation @@ -24,40 +24,9 @@ $Language = $_SESSION['Language']; } -if (defined('LC_MESSAGES')){ //it's a unix/linux server - $Locale = setlocale (LC_MESSAGES, $_SESSION['Language']); - $Locale = setlocale (LC_NUMERIC, $_SESSION['Language']); -} else { // it's a windows server - $Locale = setlocale (LC_ALL, $LanguageArray[$_SESSION['Language']]['WindowsLocale']); -} -$Locale = setlocale (LC_NUMERIC, 'fr_FR.utf8'); - -$LocaleInfo = localeconv(); -if ($LocaleInfo['mon_decimal_point']==''){ - $LocaleInfo['mon_decimal_point']= $LocaleInfo['decimal_point']; -} -if ($LocaleInfo['mon_thousands_sep']==''){ - $LocaleInfo['mon_thousands_sep']= $LocaleInfo['thousands_sep']; -} - - - -//Turkish seems to be a special case -if ($_SESSION['Language']=='tr_TR.utf8') { - $Locale = setlocale(LC_CTYPE, 'C'); -} - - -if (function_exists('gettext')){ - - // possibly even if locale fails the language will still switch by using Language instead of locale variable - putenv('LANG=' . $_SESSION['Language']); - putenv('LANGUAGE=' . $_SESSION['Language']); - bindtextdomain ('messages', $PathPrefix . 'locale'); - textdomain ('messages'); - bind_textdomain_codeset('messages', 'UTF-8'); - -} else { +/*Since LanguagesArray requires the function _() to translate the language names - we must provide a substitute if it doesn't exist aready before we include includes/LanguagesArray.php + * */ +if (!function_exists('gettext')) { /* PHPGettext integration by Braian Gomez http://www.vairux.com/ @@ -91,7 +60,40 @@ return $text; } } - $LocaleInfo = localeconv(); } +include('includes/LanguagesArray.php'); + +if (defined('LC_MESSAGES')){ //it's a unix/linux server + $Locale = setlocale (LC_MESSAGES, $_SESSION['Language']); + $Locale = setlocale (LC_NUMERIC, $_SESSION['Language']); +} else { // it's a windows server + $Locale = setlocale (LC_ALL, $LanguageArray[$_SESSION['Language']]['WindowsLocale']); +} + +//for testing number_formats $Locale = setlocale (LC_NUMERIC, 'fr_FR.utf8'); + +$LocaleInfo = localeconv(); +if ($LocaleInfo['mon_decimal_point']==''){ + $LocaleInfo['mon_decimal_point']= $LocaleInfo['decimal_point']; +} +if ($LocaleInfo['mon_thousands_sep']==''){ + $LocaleInfo['mon_thousands_sep']= $LocaleInfo['thousands_sep']; +} + +//Turkish seems to be a special case +if ($_SESSION['Language']=='tr_TR.utf8') { + $Locale = setlocale(LC_CTYPE, 'C'); +} + +if (function_exists('gettext')){ + + // possibly even if locale fails the language will still switch by using Language instead of locale variable + putenv('LANG=' . $_SESSION['Language']); + putenv('LANGUAGE=' . $_SESSION['Language']); + bindtextdomain ('messages', $PathPrefix . 'locale'); + textdomain ('messages'); + bind_textdomain_codeset('messages', 'UTF-8'); +} + ?> Modified: trunk/sql/mysql/upgrade4.05-4.06.sql =================================================================== --- trunk/sql/mysql/upgrade4.05-4.06.sql 2011-09-18 01:22:23 UTC (rev 4695) +++ trunk/sql/mysql/upgrade4.05-4.06.sql 2011-09-19 09:38:20 UTC (rev 4696) @@ -2,4 +2,5 @@ ALTER TABLE stockmaster ADD lastcostupdate DATE NOT NULL; INSERT INTO `config` (`confname` ,`confvalue`) VALUES ('InventoryManagerEmail', ''); +ALTER TABLE `banktrans` ADD INDEX ( `ref` ); UPDATE config SET confvalue='4.05.2' WHERE confname='VersionNumber'; \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dai...@us...> - 2011-09-20 10:21:35
|
Revision: 4697 http://web-erp.svn.sourceforge.net/web-erp/?rev=4697&view=rev Author: daintree Date: 2011-09-20 10:21:28 +0000 (Tue, 20 Sep 2011) Log Message: ----------- number formats Modified Paths: -------------- trunk/POReport.php trunk/PO_AuthoriseMyOrders.php trunk/PO_Header.php trunk/PO_OrderDetails.php trunk/PO_PDFPurchOrder.php trunk/PO_SelectOSPurchOrder.php trunk/PO_SelectPurchOrder.php trunk/Prices.php trunk/includes/DateFunctions.inc trunk/includes/LanguageSetup.php trunk/includes/MiscFunctions.php Modified: trunk/POReport.php =================================================================== --- trunk/POReport.php 2011-09-19 09:38:20 UTC (rev 4696) +++ trunk/POReport.php 2011-09-20 10:21:28 UTC (rev 4697) @@ -53,7 +53,7 @@ // Had to add supplierid to SummaryType when do summary by name because there could be several accounts // with the same name. Tried passing 'suppname,supplierid' in form, but it only read 'suppname' if (isset($_POST['SummaryType']) and $_POST['SummaryType'] == 'suppname') { - $_POST['SummaryType'] = 'suppname,suppliers.supplierid'; + $_POST['SummaryType'] = "suppname, suppliers.supplierid"; } if (isset($_POST['submit'])) { @@ -566,10 +566,10 @@ <td>%s</td> <td>%s</td> <td>%s</td> - <td class=number>%s</td> - <td class=number>%s</td> - <td class=number>%s</td> - <td class=number>%s</td> + <td class="number">%s</td> + <td class="number">%s</td> + <td class="number">%s</td> + <td class="number">%s</td> <td>%s</td> <td>%s</td> <td>%s</td> @@ -600,10 +600,10 @@ <td>%s</td> <td>%s</td> <td>%s</td> - <td class=number>%s</td> - <td class=number>%s</td> - <td class=number>%s</td> - <td class=number>%s</td> + <td class="number">%s</td> + <td class="number">%s</td> + <td class="number">%s</td> + <td class="number">%s</td> <td>%s</td> <td>%s</td> </tr>', @@ -653,10 +653,10 @@ <td>%s</td> <td>%s</td> <td>%s</td> - <td class=number>%s</td> - <td class=number>%s</td> - <td class=number>%s</td> - <td class=number>%s</td> + <td class="number">%s</td> + <td class="number">%s</td> + <td class="number">%s</td> + <td class="number">%s</td> <td>%s</td> <td>%s</td> <td>%s</td> @@ -681,30 +681,41 @@ $TotalInvQty += $myrow['qtyinvoiced']; } //END WHILE LIST LOOP // Print totals - printf("<tr><td>%s</td><td>%s</td><td>%s</td><td>%s</td><td>%s</td><td class=number>%s</td><td class=number> - %s</td><td class=number>%s</td><td class=number>%s</td><td>%s</td><td>%s</td></tr>", - 'Totals', - _('Lines - ') . $linectr, - ' ', - ' ', - ' ', - locale_number_format($TotalQty,$LastDecimalPlaces), - locale_number_format($TotalExtCost,2), - locale_number_format($TotalExtPrice,2), - locale_number_format($TotalInvQty,$LastDecimalPlaces), - ' ', - ' '); + printf('<tr> + <td>%s</td> + <td>%s</td> + <td>%s</td> + <td>%s</td> + <td>%s</td> + <td class="number">%s</td> + <td class="number">%s</td> + <td class="number">%s</td> + <td class="number">%s</td> + <td>%s</td> + <td>%s</td> + </tr>', + _('Totals'), + _('Lines - ') . $linectr, + ' ', + ' ', + ' ', + locale_number_format($TotalQty,$LastDecimalPlaces), + locale_money_format($TotalExtCost,2), + locale_money_format($TotalExtPrice,2), + locale_money_format($TotalInvQty,$LastDecimalPlaces), + ' ', + ' '); } echo '</table>'; } else { // Print summary stuff - echo '<br /><table class=selection width=98%>'; + echo '<br /><table class="selection" width="98%">'; $summarytype = $_POST['SummaryType']; // For SummaryType 'suppname' had to add supplierid to it for the GROUP BY in the sql, // but have to take it away for $myrow[$summarytype] to be valid // Set up description based on the Summary Type - if ($summarytype == 'suppname,suppliers.supplierid') { - $summarytype = 'suppname'; + if ($summarytype == "suppname,suppliers.supplierid") { + $summarytype = "suppname"; $description = 'supplierno'; $summaryheader = _('Supplier Name'); $descriptionheader = _('Supplier Number'); @@ -738,7 +749,14 @@ $summaryheader = _('Month'); $descriptionheader = _('Month'); } - printf("<tr><th>%s</th><th>%s</th><th>%s</th><th>%s</th><th>%s</th><th>%s</th></tr>", + printf('<tr> + <th>%s</th> + <th>%s</th> + <th>%s</th> + <th>%s</th> + <th>%s</th> + <th>%s</th> + </tr>', _($summaryheader), _($descriptionheader), _('Quantity'), @@ -763,10 +781,10 @@ } printf('<td>%s</td> <td>%s</td> - <td class=number>%s</td> - <td class=number>%s</td> - <td class=number>%s</td> - <td class=number>%s</td> + <td class="number">%s</td> + <td class="number">%s</td> + <td class="number">%s</td> + <td class="number">%s</td> </tr>', $myrow[$summarytype], $myrow[$description], @@ -784,10 +802,10 @@ printf('<tr> <td>%s</td> <td>%s</td> - <td class=number>%s</td> - <td class=number>%s</td> - <td class=number>%s</td> - <td class=number>%s</td> + <td class="number">%s</td> + <td class="number">%s</td> + <td class="number">%s</td> + <td class="number">%s</td> </tr>', _('Totals'), _('Lines - ') . $linectr, Modified: trunk/PO_AuthoriseMyOrders.php =================================================================== --- trunk/PO_AuthoriseMyOrders.php 2011-09-19 09:38:20 UTC (rev 4696) +++ trunk/PO_AuthoriseMyOrders.php 2011-09-20 10:21:28 UTC (rev 4697) @@ -26,7 +26,7 @@ SET status='".$Status."', stat_comment='".$Comment."', allowprint=1 - WHERE orderno='".$OrderNo."'"; + WHERE orderno='".filter_number_format($OrderNo)."'"; $result=DB_query($sql, $db); } } @@ -39,7 +39,7 @@ suppliers.currcode, www_users.realname, www_users.email, - currencies.decimalplaces + currencies.decimalplaces AS currdecimalplaces FROM purchorders INNER JOIN suppliers ON suppliers.supplierid=purchorders.supplierno INNER JOIN currencies @@ -95,9 +95,10 @@ <option value="Cancelled">'._('Cancelled').'</option> </select></td> </tr>'; - echo "<input type='hidden' name='comment' value='".$myrow['stat_comment']."'>"; + echo '<input type="hidden" name="comment" value="' . $myrow['stat_comment'] . '" />'; $LineSQL="SELECT purchorderdetails.*, - stockmaster.description + stockmaster.description, + stockmaster.decimalplaces FROM purchorderdetails LEFT JOIN stockmaster ON stockmaster.stockid=purchorderdetails.itemcode @@ -116,13 +117,18 @@ <th>'._('Line Total').'</th> </tr>'; - while ($linerow=DB_fetch_array($LineResult)) { + while ($LineRow=DB_fetch_array($LineResult)) { + if ($LineRow['decimalplaces']!=NULL){ + $DecimalPlaces = $LineRow['decimalplaces']; + }else { + $DecimalPlaces = 2; + } echo '<tr> - <td>'.$linerow['description'].'</td> - <td class="number">'.locale_number_format($linerow['quantityord'],2).'</td> + <td>'.$LineRow['description'].'</td> + <td class="number">'.locale_number_format($LineRow['quantityord'],$DecimalPlaces).'</td> <td>'.$myrow['currcode'].'</td> - <td class="number">'.locale_number_format($linerow['unitprice'],$myrow['decimalplaces']).'</td> - <td class="number">'.locale_number_format($linerow['unitprice']*$linerow['quantityord'],$myrow['decimalplaces']).'</td> + <td class="number">'.locale_number_format($LineRow['unitprice'],$myrow['decimalplaces']).'</td> + <td class="number">'.locale_number_format($LineRow['unitprice']*$LineRow['quantityord'],$myrow['currdecimalplaces']).'</td> </tr>'; } // end while order line detail echo '</table></td></tr>'; Modified: trunk/PO_Header.php =================================================================== --- trunk/PO_Header.php 2011-09-19 09:38:20 UTC (rev 4696) +++ trunk/PO_Header.php 2011-09-20 10:21:28 UTC (rev 4697) @@ -209,7 +209,7 @@ $_SESSION['PO'.$identifier]->Version = $_POST['Version']; $_SESSION['PO'.$identifier]->DeliveryDate = $_POST['DeliveryDate']; $_SESSION['PO'.$identifier]->Revised = $_POST['Revised']; - $_SESSION['PO'.$identifier]->ExRate = $_POST['ExRate']; + $_SESSION['PO'.$identifier]->ExRate = filter_number_format($_POST['ExRate']); $_SESSION['PO'.$identifier]->Comments = $_POST['Comments']; $_SESSION['PO'.$identifier]->DeliveryBy = $_POST['DeliveryBy']; if (isset($_POST['StatusComments'])){ @@ -856,7 +856,7 @@ $LocnResult = DB_query($sql,$db); while ($LocnRow=DB_fetch_array($LocnResult)){ - if (isset($_POST['StkLocation']) and ($_POST['StkLocation'] == $LocnRow['loccode'] OR + if (isset($_POST['StkLocation']) AND ($_POST['StkLocation'] == $LocnRow['loccode'] OR ($_POST['StkLocation']=='' AND $LocnRow['loccode']==$_SESSION['UserStockLocation']))){ echo '<option selected value="' . $LocnRow['loccode'] . '">' . $LocnRow['locationname'] . '</option>'; } else { @@ -1076,7 +1076,7 @@ if ($_SESSION['PO'.$identifier]->CurrCode != $_SESSION['CompanyRecord']['currencydefault']) { echo '<tr><td>'. _('Exchange Rate').':'.'</td> - <td><input type="text" name="ExRate" value='.$_POST['ExRate'].' class="number" size=11></td> + <td><input type="text" name="ExRate" value='. $_POST['ExRate'].' class="number" size=11></td> </tr>'; } else { echo '<input type=hidden name="ExRate" value="1">'; Modified: trunk/PO_OrderDetails.php =================================================================== --- trunk/PO_OrderDetails.php 2011-09-19 09:38:20 UTC (rev 4696) +++ trunk/PO_OrderDetails.php 2011-09-20 10:21:28 UTC (rev 4697) @@ -1,10 +1,7 @@ <?php /* $Id$*/ -/* $Revision: 1.15 $ */ -//$PageSecurity = 2; - include('includes/session.inc'); if (isset($_GET['OrderNo'])) { @@ -18,16 +15,15 @@ if (isset($_GET['FromGRNNo'])){ $SQL= "SELECT purchorderdetails.orderno - FROM purchorderdetails, - grns - WHERE purchorderdetails.podetailitem=grns.podetailitem - AND grns.grnno='" . $_GET['FromGRNNo'] ."'"; + FROM purchorderdetails INNER JOIN grns + ON purchorderdetails.podetailitem=grns.podetailitem + WHERE grns.grnno='" . $_GET['FromGRNNo'] ."'"; $ErrMsg = _('The search of the GRNs was unsuccessful') . ' - ' . _('the SQL statement returned the error'); - $orderResult = DB_query($SQL, $db, $ErrMsg); + $OrderResult = DB_query($SQL, $db, $ErrMsg); - $orderRow = DB_fetch_row($orderResult); - $_GET['OrderNo'] = $orderRow[0]; + $OrderRow = DB_fetch_row($OrderResult); + $_GET['OrderNo'] = $OrderRow[0]; echo '<br /><font size=4 color=BLUE>' . _('Order Number') . ' ' . $_GET['OrderNo'] . '</font>'; } @@ -38,7 +34,7 @@ echo '<table class="table_index"> <tr><td class="menu_group_item"> - <li><a href="'. $rootpath . '/PO_SelectPurchOrder.php?'. SID .'">' . _('Outstanding Purchase Orders') . '</a></li> + <li><a href="'. $rootpath . '/PO_SelectPurchOrder.php">' . _('Outstanding Purchase Orders') . '</a></li> </td></tr></table>'; include('includes/footer.inc'); exit; @@ -50,15 +46,18 @@ suppliers.suppname, suppliers.currcode, www_users.realname, - locations.locationname - FROM purchorders + locations.locationname, + currencies.decimalplaces AS currdecimalplaces + FROM purchorders + INNER JOIN locations + ON locations.loccode=purchorders.intostocklocation + INNER JOIN suppliers + ON purchorders.supplierno = suppliers.supplierid + INNER JOIN currencies + ON suppliers.currcode = currencies.currabrev LEFT JOIN www_users ON purchorders.initiator=www_users.userid - LEFT JOIN locations - ON locations.loccode=purchorders.intostocklocation - LEFT JOIN suppliers - ON purchorders.supplierno = suppliers.supplierid - WHERE purchorders.orderno = '" . $_GET['OrderNo'] ."'"; + WHERE purchorders.orderno = '" . filter_number_format($_GET['OrderNo']) ."'"; $GetOrdHdrResult = DB_query($OrderHeaderSQL,$db, $ErrMsg); @@ -71,7 +70,7 @@ } echo '<table class="table_index"> <tr><td class="menu_group_item"> - <li><a href="'. $rootpath . '/PO_SelectPurchOrder.php?'. SID .'">' . _('Outstanding Sales Orders') . '</a></li> + <li><a href="'. $rootpath . '/PO_SelectPurchOrder.php">' . _('Outstanding Sales Orders') . '</a></li> </td></tr></table>'; include('includes/footer.inc'); @@ -85,8 +84,8 @@ echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/supplier.png" title="' . _('Purchase Order') . '" alt="" />' . ' ' . $title . '</p>'; -echo '<table class=selection cellpadding=2>'; -echo '<tr><th colspan=8><font size=3 color=navy>'. _('Order Header Details'). '</font></th></tr>'; +echo '<table class="selection" cellpadding="2">'; +echo '<tr><th colspan="8"><font size="3" color="navy">'. _('Order Header Details'). '</font></th></tr>'; echo '<tr><th style="text-align:left">' . _('Supplier Code'). '</td><td><a href="SelectSupplier.php?SupplierID='.$myrow['supplierid'].'">' . $myrow['supplierid'] . '</a></td> <th style="text-align:left">' . _('Supplier Name'). '</td><td><a href="SelectSupplier.php?SupplierID='.$myrow['supplierid'].'">' . $myrow['suppname'] . '</a></td></tr>'; @@ -126,17 +125,22 @@ echo '</table>'; +$CurrDecimalPlaces = $myrow['currdecimalplaces']; echo '<br />'; /*Now get the line items */ $ErrMsg = _('The line items of the purchase order could not be retrieved'); -$LineItemsSQL = "SELECT purchorderdetails.* FROM purchorderdetails - WHERE purchorderdetails.orderno = '" . $_GET['OrderNo'] ."'"; +$LineItemsSQL = "SELECT purchorderdetails.*, + stockmaster.decimalplaces + FROM purchorderdetails + LEFT JOIN stockmaster + ON purchorderdetails.itemcode=stockmaster.stockid + WHERE purchorderdetails.orderno = '" . filter_number_format($_GET['OrderNo']) ."'"; $LineItemsResult = db_query($LineItemsSQL,$db, $ErrMsg); -echo '<table colspan=8 class=selection cellpadding=0>'; +echo '<table colspan="8" class="selection" cellpadding="0">'; echo '<tr><th colspan=8><font size=3 color=navy>'. _('Order Line Details'). '</font></th></tr>'; echo '<tr> <th>' . _('Item Code'). '</td> @@ -159,7 +163,11 @@ $RecdTotal += ($myrow['quantityrecd'] * $myrow['unitprice']); $DisplayReqdDate = ConvertSQLDate($myrow['deliverydate']); - + if ($myrow['decimalplaces']!=NULL){ + $DecimalPlaces = $myrow['decimalplaces']; + } else { + $DecimalPlaces = 2; + } // if overdue and outstanding quantities, then highlight as so if (($myrow['quantityord'] - $myrow['quantityrecd'] > 0) AND Date1GreaterThanDate2(Date($_SESSION['DefaultDateFormat']), $DisplayReqdDate)){ @@ -176,31 +184,31 @@ printf ('<td>%s</td> <td>%s</td> - <td class=number>%01.2f</td> - <td class=number>%01.2f</td> - <td class=number>%01.2f</td> - <td class=number>%01.2f</td> - <td class=number>%01.2f</td> + <td class="number">%s</td> + <td class="number">%s</td> + <td class="number">%s</td> + <td class="number">%s</td> + <td class="number">%s</td> <td>%s</td> </tr>' , $myrow['itemcode'], $myrow['itemdescription'], - $myrow['quantityord'], - $myrow['quantityrecd'], - $myrow['qtyinvoiced'], - $myrow['unitprice'], - $myrow['actprice'], + locale_number_format($myrow['quantityord'],$DecimalPlaces), + locale_number_format($myrow['quantityrecd'],$DecimalPlaces), + locale_number_format($myrow['qtyinvoiced'],$DecimalPlaces), + locale_money_format($myrow['unitprice'],$CurrDecimalPlaces), + locale_money_format($myrow['actprice'],$CurrDecimalPlaces), $DisplayReqdDate); } echo '<tr><td><br /></td> </tr> - <tr><td colspan=4 class=number>' . _('Total Order Value Excluding Tax') .'</td> - <td colspan=2 class=number>' . locale_number_format($OrderTotal,2) . '</td></tr>'; + <tr><td colspan=4 class="number">' . _('Total Order Value Excluding Tax') .'</td> + <td colspan=2 class="number">' . locale_money_format($OrderTotal,$CurrDecimalPlaces) . '</td></tr>'; echo '<tr> - <td colspan=4 class=number>' . _('Total Order Value Received Excluding Tax') . '</td> - <td colspan=2 class=number>' . locale_number_format($RecdTotal,2) . '</td></tr>'; + <td colspan=4 class="number">' . _('Total Order Value Received Excluding Tax') . '</td> + <td colspan=2 class="number">' . locale_money_format($RecdTotal,$CurrDecimalPlaces) . '</td></tr>'; echo '</table>'; echo '<br />'; Modified: trunk/PO_PDFPurchOrder.php =================================================================== --- trunk/PO_PDFPurchOrder.php 2011-09-19 09:38:20 UTC (rev 4696) +++ trunk/PO_PDFPurchOrder.php 2011-09-20 10:21:28 UTC (rev 4697) @@ -6,7 +6,7 @@ include('includes/SQL_CommonFunctions.inc'); include('includes/DefinePOClass.php'); -if(!isset($_GET['OrderNo']) && !isset($_POST['OrderNo'])){ +if(!isset($_GET['OrderNo']) AND !isset($_POST['OrderNo'])){ $title = _('Select a Purchase Order'); include('includes/header.inc'); echo '<div class="centre"><br /><br /><br />'; @@ -95,9 +95,12 @@ purchorders.paymentterms, suppliers.currcode, purchorders.status, - purchorders.stat_comment + purchorders.stat_comment, + currencies.decimalplaces AS currdecimalplaces FROM purchorders INNER JOIN suppliers ON purchorders.supplierno = suppliers.supplierid + INNER JOIN currencies + ON suppliers.currcode=currencies.currabrev WHERE purchorders.orderno='" . $OrderNo ."'"; $result=DB_query($sql,$db, $ErrMsg); if (DB_num_rows($result)==0){ /*There is no order header returned */ @@ -215,8 +218,8 @@ include('includes/PO_PDFOrderPageHeader.inc'); $YPos=$Page_Height - $FormDesign->Data->y; $OrderTotal = 0; - while ((isset($OrderNo) and $OrderNo=='Preview') - OR (isset($result) and $POLine=DB_fetch_array($result))) { + while ((isset($OrderNo) AND $OrderNo=='Preview') + OR (isset($result) AND $POLine=DB_fetch_array($result))) { /* If we are previewing the order then fill the * order line with dummy data */ if ($OrderNo=='Preview') { @@ -230,15 +233,20 @@ $POLine['conversionfactor']=1; $POLine['decimalplaces']=2; } - $DisplayQty = locale_number_format($POLine['quantityord']/$POLine['conversionfactor'],$POLine['decimalplaces']); + if ($POLine['decimalplaces']!=NULL){ + $DecimalPlaces = $POLine['decimalplaces']; + } else { + $DecimalPlaces = 2; + } + $DisplayQty = locale_number_format($POLine['quantityord']/$POLine['conversionfactor'],$DecimalPlaces); if ($_POST['ShowAmounts']=='Yes'){ - $DisplayPrice = locale_number_format($POLine['unitprice']*$POLine['conversionfactor'],2); + $DisplayPrice = locale_money_format($POLine['unitprice']*$POLine['conversionfactor'],$POHeader['currdecimalplaces']); } else { $DisplayPrice = '----'; } - $DisplayDelDate = ConvertSQLDate($POLine['deliverydate'],2); + $DisplayDelDate = ConvertSQLDate($POLine['deliverydate']); if ($_POST['ShowAmounts']=='Yes'){ - $DisplayLineTotal = locale_number_format($POLine['unitprice']*$POLine['quantityord'],2); + $DisplayLineTotal = locale_money_format($POLine['unitprice']*$POLine['quantityord'],$POHeader['currdecimalplaces']); } else { $DisplayLineTotal = '----'; } @@ -285,7 +293,7 @@ include ('includes/PO_PDFOrderPageHeader.inc'); } //end if need a new page headed up if ($_POST['ShowAmounts']=='Yes'){ - $DisplayOrderTotal = locale_number_format($OrderTotal,2); + $DisplayOrderTotal = locale_money_format($OrderTotal,$POHeader['currdecimalplaces']); } else { $DisplayOrderTotal = '----'; } @@ -330,15 +338,15 @@ $sql = "UPDATE purchorders SET allowprint = 0, dateprinted = '" . Date('Y-m-d') . "', status = 'Printed', - stat_comment = '" . $StatusComment . "' - WHERE purchorders.orderno = '" . $OrderNo."'"; + stat_comment = '" . DB_escape_string($StatusComment) . "' + WHERE purchorders.orderno = '" . filter_number_format($OrderNo) ."'"; $result = DB_query($sql,$db); } include('includes/footer.inc'); } /* There was enough info to either print or email the purchase order */ else { /*the user has just gone into the page need to ask the question whether to print the order or email it to the supplier */ include ('includes/header.inc'); - echo '<form action="' . $_SERVER['PHP_SELF'] . '" method=post>'; + echo '<form action="' . $_SERVER['PHP_SELF'] . '" method="post">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; if ($ViewingOnly==1){ echo '<input type=hidden name="ViewingOnly" value=1>'; @@ -381,7 +389,7 @@ suppliercontacts.email FROM suppliercontacts INNER JOIN purchorders ON suppliercontacts.supplierid=purchorders.supplierno - WHERE purchorders.orderno='".$OrderNo."'"; + WHERE purchorders.orderno='".filter_number_format($OrderNo)."'"; $ContactsResult=DB_query($SQL,$db, $ErrMsg); if (DB_num_rows($ContactsResult)>0){ echo '<tr><td>'. _('Email to') .':</td><td><select name="EmailTo">'; @@ -404,7 +412,7 @@ } else { echo '</table>'; } - echo '<br /><div class="centre"><input type=submit name="DoIt" value="' . _('OK') . '"></div>'; + echo '<br /><div class="centre"><input type="submit" name="DoIt" value="' . _('OK') . '"></div>'; echo '</form>'; include('includes/footer.inc'); } Modified: trunk/PO_SelectOSPurchOrder.php =================================================================== --- trunk/PO_SelectOSPurchOrder.php 2011-09-19 09:38:20 UTC (rev 4696) +++ trunk/PO_SelectOSPurchOrder.php 2011-09-20 10:21:28 UTC (rev 4697) @@ -18,9 +18,9 @@ } if (isset($_GET['OrderNumber'])){ - $OrderNumber=trim($_GET['OrderNumber']); + $OrderNumber=(filter_number_format($_GET['OrderNumber'])); } elseif (isset($_POST['OrderNumber'])){ - $OrderNumber=trim($_POST['OrderNumber']); + $OrderNumber=(filter_number_format($_POST['OrderNumber'])); } if (isset($_GET['SelectedSupplier'])){ Modified: trunk/PO_SelectPurchOrder.php =================================================================== --- trunk/PO_SelectPurchOrder.php 2011-09-19 09:38:20 UTC (rev 4696) +++ trunk/PO_SelectPurchOrder.php 2011-09-20 10:21:28 UTC (rev 4697) @@ -11,9 +11,9 @@ $SelectedStockItem = $_POST['SelectedStockItem']; } if (isset($_GET['OrderNumber'])) { - $OrderNumber = $_GET['OrderNumber']; + $OrderNumber = filter_number_format($_GET['OrderNumber']); } elseif (isset($_POST['OrderNumber'])) { - $OrderNumber = $_POST['OrderNumber']; + $OrderNumber = filter_number_format($_POST['OrderNumber']); } if (isset($_GET['SelectedSupplier'])) { $SelectedSupplier = $_GET['SelectedSupplier']; @@ -166,20 +166,20 @@ } } echo '</select><td><font size=1>' . _('Enter text extracts in the') . ' <b>' . _('description') . '</b>:</font></td>'; -echo '<td><input type="Text" name="Keywords" size=20 maxlength=25></td></tr><tr><td></td>'; +echo '<td><input type="text" name="Keywords" size=20 maxlength=25></td></tr><tr><td></td>'; echo '<td><font size=3><b>' . _('OR') . ' </b></font><font size=1>' . _('Enter extract of the') . '<b>' . _('Stock Code') . '</b>:</font></td>'; echo '<td><input type="text" name="StockCode" size=15 maxlength=18></td></tr>'; -echo '<tr><td colspan=3><div class=centre><input type=submit name="SearchParts" value="' . _('Search Parts Now') . '">'; +echo '<tr><td colspan=3><div class="centre"><input type=submit name="SearchParts" value="' . _('Search Parts Now') . '">'; echo '<input type=submit name="ResetPart" value="' . _('Show All') . '"></div></td></tr>'; echo '</table><br /><br />'; if (isset($StockItemsResult)) { echo '<table cellpadding=2 colspan=7 class=selection>'; - $TableHeader = '<tr><td class="tableheader">' . _('Code') . '</td> - <td class="tableheader">' . _('Description') . '</td> - <td class="tableheader">' . _('On Hand') . '</td> - <td class="tableheader">' . _('Orders') . '<br />' . _('Outstanding') . '</td> - <td class="tableheader">' . _('Units') . '</td> - </tr>'; + $TableHeader = '<tr><th>' . _('Code') . '</th> + <th>' . _('Description') . '</th> + <th>' . _('On Hand') . '</th> + <th>' . _('Orders') . '<br />' . _('Outstanding') . '</th> + <th>' . _('Units') . '</th> + </tr>'; echo $TableHeader; $j = 1; $k = 0; //row colour counter @@ -244,7 +244,7 @@ ON purchorders.supplierno = suppliers.supplierid INNER JOIN currencies ON suppliers.currcode=currencies.currabrev - WHERE purchorders.orderno='" . $OrderNumber . "' + WHERE purchorders.orderno='" . filter_number_format($OrderNumber) . "' GROUP BY purchorders.orderno, suppliers.suppname, purchorders.orddate, @@ -417,7 +417,7 @@ $ViewPurchOrder = $rootpath . '/PO_OrderDetails.php?OrderNo=' . $myrow['orderno']; $FormatedOrderDate = ConvertSQLDate($myrow['orddate']); $FormatedDeliveryDate = ConvertSQLDate($myrow['deliverydate']); - $FormatedOrderValue = locale_number_format($myrow['ordervalue'], $myrow['decimalplaces']); + $FormatedOrderValue = locale_money_format($myrow['ordervalue'], $myrow['decimalplaces']); /* View Supplier Currency Requisition Order Date Initiator Order Total ModifyPage, $myrow["orderno"], $myrow["suppname"], $myrow["currcode"], $myrow["requisitionno"] $FormatedOrderDate, $myrow["initiator"] $FormatedOrderValue Order Status*/ echo '<td><a href="' . $ViewPurchOrder . '">' . $myrow['orderno'] . '</a></td> Modified: trunk/Prices.php =================================================================== --- trunk/Prices.php 2011-09-19 09:38:20 UTC (rev 4696) +++ trunk/Prices.php 2011-09-20 10:21:28 UTC (rev 4697) @@ -67,7 +67,7 @@ //first off validate inputs sensible // This gives some date in 1999?? $ZeroDate = Date($_SESSION['DefaultDateFormat'],Mktime(0,0,0,0,0,0)); - if (!is_double((double) trim($_POST['Price'])) OR $_POST['Price']=='') { + if (!is_numeric((double) filter_number_format($_POST['Price'])) OR $_POST['Price']=='') { $InputError = 1; prnMsg( _('The price entered must be numeric'),'error'); } @@ -103,7 +103,7 @@ AND enddate ='" . FormatDateForSQL($_POST['EndDate']) . "' AND prices.typeabbrev='" . $_POST['TypeAbbrev'] . "' AND prices.currabrev='" . $_POST['CurrAbrev'] . "' - AND prices.price='" . $_POST['Price'] . "' + AND prices.price='" . filter_number_format($_POST['Price']) . "' "; $result = DB_query($sql, $db); @@ -124,7 +124,7 @@ $sql = "UPDATE prices SET typeabbrev='" . $_POST['TypeAbbrev'] . "', currabrev='" . $_POST['CurrAbrev'] . "', - price='" . $_POST['Price'] . "', + price='" . filter_number_format($_POST['Price']) . "', startdate='" . FormatDateForSQL($_POST['StartDate']) . "', enddate='" . $SQLEndDate . "' WHERE prices.stockid='".$Item."' @@ -156,7 +156,7 @@ '" . $_POST['CurrAbrev'] . "', '" . FormatDateForSQL($_POST['StartDate']) . "', '" . $SQLEndDate. "', - '" . $_POST['Price'] . "')"; + '" . filter_number_format($_POST['Price']) . "')"; $ErrMsg = _('The new price could not be added'); $result = DB_query($sql,$db,$ErrMsg); @@ -208,11 +208,16 @@ $result = DB_query($sql,$db); if (DB_num_rows($result) > 0) { - echo '<table class=selection>'; - echo '<tr><th colspan=7><form method="post" action="' . $_SERVER['PHP_SELF'] . '">'; - echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; - echo _('Pricing for part') . ':<input type="text" name="Item" maxsizee=22 value="' . $Item . '" maxlength=20><input type=submit name="NewPart" value="' . _('Review Prices') . '">'; - echo '</th></tr></form>'; + echo '<form method="post" action="' . $_SERVER['PHP_SELF'] . '"> + <table class=selection> + <tr> + <th colspan=7> + <input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />' . + _('Pricing for part') . ': + <input type="text" name="Item" size="22" value="' . $Item . '" maxlength="20"> + <input type=submit name="NewPart" value="' . _('Review Prices') . '"></th> + </tr> + </form>'; echo '<tr><th>' . _('Currency') . '</th> <th>' . _('Sales Type') . '</th> @@ -240,7 +245,7 @@ if (in_array(5,$_SESSION['AllowedPageSecurityTokens'])) { echo '<td>' . $myrow['currency'] . '</td> <td>' . $myrow['sales_type'] . '</td> - <td class=number>' . locale_number_format($myrow['price'],$myrow['decimalplaces']) . '</td> + <td class="number">' . locale_number_format($myrow['price'],$myrow['decimalplaces']) . '</td> <td>' . ConvertSQLDate($myrow['startdate']) . '</td> <td>' . $EndDateDisplay . '</td> <td><a href="' . $_SERVER['PHP_SELF'] . '?Item=' . $myrow['stockid'] . '&TypeAbbrev=' .$myrow['typeabbrev'] . '&CurrAbrev=' . $myrow['currabrev'] . '&Price=' . $myrow['price'] . '&StartDate=' . $myrow['startdate'] . '&EndDate=' . $myrow['enddate'] . '&Edit=1">' . _('Edit') . '</td> @@ -249,7 +254,7 @@ } else { echo '<td>' . $myrow['currency'] . '</td> <td>' . $myrow['sales_type'] . '</td> - <td class=number>' . locale_number_format($myrow['price'],$myrow['decimalplaces']) . '</td> + <td class="number">' . locale_number_format($myrow['price'],$myrow['decimalplaces']) . '</td> <td>' . ConvertSQLDate($myrow['startdate']) . '</td> <td>' . $EndDateDisplay . '</td></tr>'; } @@ -270,7 +275,7 @@ echo '<input type=hidden name="OldEndDate" value="' . $_GET['EndDate'] . '">'; $_POST['CurrAbrev'] = $_GET['CurrAbrev']; $_POST['TypeAbbrev'] = $_GET['TypeAbbrev']; - $_POST['Price'] = $_GET['Price']; + $_POST['Price'] = filter_number_format($_GET['Price']); $_POST['StartDate'] = ConvertSQLDate($_GET['StartDate']); if ($_GET['EndDate']=='' OR $_GET['EndDate']=='0000-00-00'){ $_POST['EndDate'] = ''; @@ -282,14 +287,15 @@ $SQL = "SELECT currabrev, currency FROM currencies"; $result = DB_query($SQL,$db); - echo '<br /><table class=selection>'; + echo '<br /><table class="selection">'; echo '<tr><th colspan=5><font color=BLUE size=3><b>' . $Item . ' - ' . $PartDescription . '</b></font></th></tr>'; - echo '<tr><td>' . _('Currency') . ':</td><td><select name="CurrAbrev">'; + echo '<tr><td>' . _('Currency') . ':</td> + <td><select name="CurrAbrev">'; while ($myrow = DB_fetch_array($result)) { if ($myrow['currabrev']==$_POST['CurrAbrev']) { - echo '<option selected VALUE="'; + echo '<option selected value="'; } else { - echo '<option VALUE="'; + echo '<option value="'; } echo $myrow['currabrev'] . '">' . $myrow['currency'] . '</option>'; } //end while loop @@ -305,9 +311,9 @@ while ($myrow = DB_fetch_array($result)) { if ($myrow['typeabbrev']==$_POST['TypeAbbrev']) { - echo '<option selected VALUE="'; + echo '<option selected value="'; } else { - echo '<option VALUE="'; + echo '<option value="'; } echo $myrow['typeabbrev'] . '">' . $myrow['sales_type'] . '</option>'; @@ -319,7 +325,9 @@ if (!isset($_POST['StartDate'])){ $_POST['StartDate'] = Date($_SESSION['DefaultDateFormat']); } - + if (!isset($_POST['EndDate'])){ + $_POST['EndDate'] = ''; + } echo '<tr><td>' . _('Price Effective From Date') . ':</td> <td><input type="text" class=date alt="'.$_SESSION['DefaultDateFormat'].'" name="StartDate" size=10 maxlength=10 value="' . $_POST['StartDate'] . '"></td></tr>'; echo '<tr><td>' . _('Price Effective To Date') . ':</td> @@ -330,16 +338,17 @@ <tr><td><?php echo _('Price'); ?>:</td> <td> - <input type="Text" class=number name="Price" size=12 maxlength=11 value= + <input type="text" class="number" name="Price" size=12 maxlength=11 value= <?php if(isset($_POST['Price'])) { echo $_POST['Price']; - }?>> + } + ?> > </td></tr> </table> <br /><div class="centre"> - <input type="Submit" name="submit" value="<?php echo _('Enter') . '/' . _('Amend Price'); ?>"> + <input type="submit" name="submit" value="<?php echo _('Enter') . '/' . _('Amend Price'); ?>"> </div> <?php Modified: trunk/includes/DateFunctions.inc =================================================================== --- trunk/includes/DateFunctions.inc 2011-09-19 09:38:20 UTC (rev 4696) +++ trunk/includes/DateFunctions.inc 2011-09-20 10:21:28 UTC (rev 4697) @@ -385,7 +385,7 @@ /* takes a date in a the format specified in $_SESSION['DefaultDateFormat'] and converts to a yyyy/mm/dd format */ - + $DateArray = array(); $DateEntry = trim($DateEntry); if (mb_strpos($DateEntry,'/')) { @@ -414,12 +414,13 @@ } return $Date_Array[0].'-'.$Date_Array[1].'-'.$Date_Array[2]; - }elseif (($_SESSION['DefaultDateFormat']=='d/m/Y') OR $_SESSION['DefaultDateFormat']=='d.m.Y'){ + }elseif (($_SESSION['DefaultDateFormat']=='d/m/Y') + OR $_SESSION['DefaultDateFormat']=='d.m.Y'){ if (mb_strlen($Date_Array[2])==2) { if ((int)$Date_Array[2] <=60) { $Date_Array[2] = '20'.$Date_Array[2]; } elseif ((int)$Date_Array[2] >60 AND (int)$Date_Array[2] <100) { - $Date_Array[2] = '19'.$Date_Array[2]; + $Date_Array[2] = '19'. $Date_Array[2]; } } /* echo '<BR>The date returned is ' . $Date_Array[2].'/'.$Date_Array[1].'/'.$Date_Array[0]; */ Modified: trunk/includes/LanguageSetup.php =================================================================== --- trunk/includes/LanguageSetup.php 2011-09-19 09:38:20 UTC (rev 4696) +++ trunk/includes/LanguageSetup.php 2011-09-20 10:21:28 UTC (rev 4697) @@ -65,13 +65,13 @@ include('includes/LanguagesArray.php'); if (defined('LC_MESSAGES')){ //it's a unix/linux server - $Locale = setlocale (LC_MESSAGES, $_SESSION['Language']); - $Locale = setlocale (LC_NUMERIC, $_SESSION['Language']); + $LocaleSet = setlocale (LC_MESSAGES, $_SESSION['Language']); + $LocaleSet = setlocale (LC_NUMERIC, $_SESSION['Language']); } else { // it's a windows server - $Locale = setlocale (LC_ALL, $LanguageArray[$_SESSION['Language']]['WindowsLocale']); + $LocaleSet = setlocale (LC_ALL, $LanguageArray[$_SESSION['Language']]['WindowsLocale']); } -//for testing number_formats $Locale = setlocale (LC_NUMERIC, 'fr_FR.utf8'); +$LocaleSet = setlocale (LC_NUMERIC, 'nl_NL.utf8'); $LocaleInfo = localeconv(); if ($LocaleInfo['mon_decimal_point']==''){ Modified: trunk/includes/MiscFunctions.php =================================================================== --- trunk/includes/MiscFunctions.php 2011-09-19 09:38:20 UTC (rev 4696) +++ trunk/includes/MiscFunctions.php 2011-09-20 10:21:28 UTC (rev 4697) @@ -328,6 +328,7 @@ function filter_number_format($Number) { global $LocaleInfo; + $Number = trim($Number); return str_replace($LocaleInfo['decimal_point'],'.',str_replace($LocaleInfo['thousands_sep'],'',$Number)); } ?> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dai...@us...> - 2011-09-20 10:21:35
|
Revision: 4697 http://web-erp.svn.sourceforge.net/web-erp/?rev=4697&view=rev Author: daintree Date: 2011-09-20 10:21:28 +0000 (Tue, 20 Sep 2011) Log Message: ----------- number formats Modified Paths: -------------- trunk/POReport.php trunk/PO_AuthoriseMyOrders.php trunk/PO_Header.php trunk/PO_OrderDetails.php trunk/PO_PDFPurchOrder.php trunk/PO_SelectOSPurchOrder.php trunk/PO_SelectPurchOrder.php trunk/Prices.php trunk/includes/DateFunctions.inc trunk/includes/LanguageSetup.php trunk/includes/MiscFunctions.php Modified: trunk/POReport.php =================================================================== --- trunk/POReport.php 2011-09-19 09:38:20 UTC (rev 4696) +++ trunk/POReport.php 2011-09-20 10:21:28 UTC (rev 4697) @@ -53,7 +53,7 @@ // Had to add supplierid to SummaryType when do summary by name because there could be several accounts // with the same name. Tried passing 'suppname,supplierid' in form, but it only read 'suppname' if (isset($_POST['SummaryType']) and $_POST['SummaryType'] == 'suppname') { - $_POST['SummaryType'] = 'suppname,suppliers.supplierid'; + $_POST['SummaryType'] = "suppname, suppliers.supplierid"; } if (isset($_POST['submit'])) { @@ -566,10 +566,10 @@ <td>%s</td> <td>%s</td> <td>%s</td> - <td class=number>%s</td> - <td class=number>%s</td> - <td class=number>%s</td> - <td class=number>%s</td> + <td class="number">%s</td> + <td class="number">%s</td> + <td class="number">%s</td> + <td class="number">%s</td> <td>%s</td> <td>%s</td> <td>%s</td> @@ -600,10 +600,10 @@ <td>%s</td> <td>%s</td> <td>%s</td> - <td class=number>%s</td> - <td class=number>%s</td> - <td class=number>%s</td> - <td class=number>%s</td> + <td class="number">%s</td> + <td class="number">%s</td> + <td class="number">%s</td> + <td class="number">%s</td> <td>%s</td> <td>%s</td> </tr>', @@ -653,10 +653,10 @@ <td>%s</td> <td>%s</td> <td>%s</td> - <td class=number>%s</td> - <td class=number>%s</td> - <td class=number>%s</td> - <td class=number>%s</td> + <td class="number">%s</td> + <td class="number">%s</td> + <td class="number">%s</td> + <td class="number">%s</td> <td>%s</td> <td>%s</td> <td>%s</td> @@ -681,30 +681,41 @@ $TotalInvQty += $myrow['qtyinvoiced']; } //END WHILE LIST LOOP // Print totals - printf("<tr><td>%s</td><td>%s</td><td>%s</td><td>%s</td><td>%s</td><td class=number>%s</td><td class=number> - %s</td><td class=number>%s</td><td class=number>%s</td><td>%s</td><td>%s</td></tr>", - 'Totals', - _('Lines - ') . $linectr, - ' ', - ' ', - ' ', - locale_number_format($TotalQty,$LastDecimalPlaces), - locale_number_format($TotalExtCost,2), - locale_number_format($TotalExtPrice,2), - locale_number_format($TotalInvQty,$LastDecimalPlaces), - ' ', - ' '); + printf('<tr> + <td>%s</td> + <td>%s</td> + <td>%s</td> + <td>%s</td> + <td>%s</td> + <td class="number">%s</td> + <td class="number">%s</td> + <td class="number">%s</td> + <td class="number">%s</td> + <td>%s</td> + <td>%s</td> + </tr>', + _('Totals'), + _('Lines - ') . $linectr, + ' ', + ' ', + ' ', + locale_number_format($TotalQty,$LastDecimalPlaces), + locale_money_format($TotalExtCost,2), + locale_money_format($TotalExtPrice,2), + locale_money_format($TotalInvQty,$LastDecimalPlaces), + ' ', + ' '); } echo '</table>'; } else { // Print summary stuff - echo '<br /><table class=selection width=98%>'; + echo '<br /><table class="selection" width="98%">'; $summarytype = $_POST['SummaryType']; // For SummaryType 'suppname' had to add supplierid to it for the GROUP BY in the sql, // but have to take it away for $myrow[$summarytype] to be valid // Set up description based on the Summary Type - if ($summarytype == 'suppname,suppliers.supplierid') { - $summarytype = 'suppname'; + if ($summarytype == "suppname,suppliers.supplierid") { + $summarytype = "suppname"; $description = 'supplierno'; $summaryheader = _('Supplier Name'); $descriptionheader = _('Supplier Number'); @@ -738,7 +749,14 @@ $summaryheader = _('Month'); $descriptionheader = _('Month'); } - printf("<tr><th>%s</th><th>%s</th><th>%s</th><th>%s</th><th>%s</th><th>%s</th></tr>", + printf('<tr> + <th>%s</th> + <th>%s</th> + <th>%s</th> + <th>%s</th> + <th>%s</th> + <th>%s</th> + </tr>', _($summaryheader), _($descriptionheader), _('Quantity'), @@ -763,10 +781,10 @@ } printf('<td>%s</td> <td>%s</td> - <td class=number>%s</td> - <td class=number>%s</td> - <td class=number>%s</td> - <td class=number>%s</td> + <td class="number">%s</td> + <td class="number">%s</td> + <td class="number">%s</td> + <td class="number">%s</td> </tr>', $myrow[$summarytype], $myrow[$description], @@ -784,10 +802,10 @@ printf('<tr> <td>%s</td> <td>%s</td> - <td class=number>%s</td> - <td class=number>%s</td> - <td class=number>%s</td> - <td class=number>%s</td> + <td class="number">%s</td> + <td class="number">%s</td> + <td class="number">%s</td> + <td class="number">%s</td> </tr>', _('Totals'), _('Lines - ') . $linectr, Modified: trunk/PO_AuthoriseMyOrders.php =================================================================== --- trunk/PO_AuthoriseMyOrders.php 2011-09-19 09:38:20 UTC (rev 4696) +++ trunk/PO_AuthoriseMyOrders.php 2011-09-20 10:21:28 UTC (rev 4697) @@ -26,7 +26,7 @@ SET status='".$Status."', stat_comment='".$Comment."', allowprint=1 - WHERE orderno='".$OrderNo."'"; + WHERE orderno='".filter_number_format($OrderNo)."'"; $result=DB_query($sql, $db); } } @@ -39,7 +39,7 @@ suppliers.currcode, www_users.realname, www_users.email, - currencies.decimalplaces + currencies.decimalplaces AS currdecimalplaces FROM purchorders INNER JOIN suppliers ON suppliers.supplierid=purchorders.supplierno INNER JOIN currencies @@ -95,9 +95,10 @@ <option value="Cancelled">'._('Cancelled').'</option> </select></td> </tr>'; - echo "<input type='hidden' name='comment' value='".$myrow['stat_comment']."'>"; + echo '<input type="hidden" name="comment" value="' . $myrow['stat_comment'] . '" />'; $LineSQL="SELECT purchorderdetails.*, - stockmaster.description + stockmaster.description, + stockmaster.decimalplaces FROM purchorderdetails LEFT JOIN stockmaster ON stockmaster.stockid=purchorderdetails.itemcode @@ -116,13 +117,18 @@ <th>'._('Line Total').'</th> </tr>'; - while ($linerow=DB_fetch_array($LineResult)) { + while ($LineRow=DB_fetch_array($LineResult)) { + if ($LineRow['decimalplaces']!=NULL){ + $DecimalPlaces = $LineRow['decimalplaces']; + }else { + $DecimalPlaces = 2; + } echo '<tr> - <td>'.$linerow['description'].'</td> - <td class="number">'.locale_number_format($linerow['quantityord'],2).'</td> + <td>'.$LineRow['description'].'</td> + <td class="number">'.locale_number_format($LineRow['quantityord'],$DecimalPlaces).'</td> <td>'.$myrow['currcode'].'</td> - <td class="number">'.locale_number_format($linerow['unitprice'],$myrow['decimalplaces']).'</td> - <td class="number">'.locale_number_format($linerow['unitprice']*$linerow['quantityord'],$myrow['decimalplaces']).'</td> + <td class="number">'.locale_number_format($LineRow['unitprice'],$myrow['decimalplaces']).'</td> + <td class="number">'.locale_number_format($LineRow['unitprice']*$LineRow['quantityord'],$myrow['currdecimalplaces']).'</td> </tr>'; } // end while order line detail echo '</table></td></tr>'; Modified: trunk/PO_Header.php =================================================================== --- trunk/PO_Header.php 2011-09-19 09:38:20 UTC (rev 4696) +++ trunk/PO_Header.php 2011-09-20 10:21:28 UTC (rev 4697) @@ -209,7 +209,7 @@ $_SESSION['PO'.$identifier]->Version = $_POST['Version']; $_SESSION['PO'.$identifier]->DeliveryDate = $_POST['DeliveryDate']; $_SESSION['PO'.$identifier]->Revised = $_POST['Revised']; - $_SESSION['PO'.$identifier]->ExRate = $_POST['ExRate']; + $_SESSION['PO'.$identifier]->ExRate = filter_number_format($_POST['ExRate']); $_SESSION['PO'.$identifier]->Comments = $_POST['Comments']; $_SESSION['PO'.$identifier]->DeliveryBy = $_POST['DeliveryBy']; if (isset($_POST['StatusComments'])){ @@ -856,7 +856,7 @@ $LocnResult = DB_query($sql,$db); while ($LocnRow=DB_fetch_array($LocnResult)){ - if (isset($_POST['StkLocation']) and ($_POST['StkLocation'] == $LocnRow['loccode'] OR + if (isset($_POST['StkLocation']) AND ($_POST['StkLocation'] == $LocnRow['loccode'] OR ($_POST['StkLocation']=='' AND $LocnRow['loccode']==$_SESSION['UserStockLocation']))){ echo '<option selected value="' . $LocnRow['loccode'] . '">' . $LocnRow['locationname'] . '</option>'; } else { @@ -1076,7 +1076,7 @@ if ($_SESSION['PO'.$identifier]->CurrCode != $_SESSION['CompanyRecord']['currencydefault']) { echo '<tr><td>'. _('Exchange Rate').':'.'</td> - <td><input type="text" name="ExRate" value='.$_POST['ExRate'].' class="number" size=11></td> + <td><input type="text" name="ExRate" value='. $_POST['ExRate'].' class="number" size=11></td> </tr>'; } else { echo '<input type=hidden name="ExRate" value="1">'; Modified: trunk/PO_OrderDetails.php =================================================================== --- trunk/PO_OrderDetails.php 2011-09-19 09:38:20 UTC (rev 4696) +++ trunk/PO_OrderDetails.php 2011-09-20 10:21:28 UTC (rev 4697) @@ -1,10 +1,7 @@ <?php /* $Id$*/ -/* $Revision: 1.15 $ */ -//$PageSecurity = 2; - include('includes/session.inc'); if (isset($_GET['OrderNo'])) { @@ -18,16 +15,15 @@ if (isset($_GET['FromGRNNo'])){ $SQL= "SELECT purchorderdetails.orderno - FROM purchorderdetails, - grns - WHERE purchorderdetails.podetailitem=grns.podetailitem - AND grns.grnno='" . $_GET['FromGRNNo'] ."'"; + FROM purchorderdetails INNER JOIN grns + ON purchorderdetails.podetailitem=grns.podetailitem + WHERE grns.grnno='" . $_GET['FromGRNNo'] ."'"; $ErrMsg = _('The search of the GRNs was unsuccessful') . ' - ' . _('the SQL statement returned the error'); - $orderResult = DB_query($SQL, $db, $ErrMsg); + $OrderResult = DB_query($SQL, $db, $ErrMsg); - $orderRow = DB_fetch_row($orderResult); - $_GET['OrderNo'] = $orderRow[0]; + $OrderRow = DB_fetch_row($OrderResult); + $_GET['OrderNo'] = $OrderRow[0]; echo '<br /><font size=4 color=BLUE>' . _('Order Number') . ' ' . $_GET['OrderNo'] . '</font>'; } @@ -38,7 +34,7 @@ echo '<table class="table_index"> <tr><td class="menu_group_item"> - <li><a href="'. $rootpath . '/PO_SelectPurchOrder.php?'. SID .'">' . _('Outstanding Purchase Orders') . '</a></li> + <li><a href="'. $rootpath . '/PO_SelectPurchOrder.php">' . _('Outstanding Purchase Orders') . '</a></li> </td></tr></table>'; include('includes/footer.inc'); exit; @@ -50,15 +46,18 @@ suppliers.suppname, suppliers.currcode, www_users.realname, - locations.locationname - FROM purchorders + locations.locationname, + currencies.decimalplaces AS currdecimalplaces + FROM purchorders + INNER JOIN locations + ON locations.loccode=purchorders.intostocklocation + INNER JOIN suppliers + ON purchorders.supplierno = suppliers.supplierid + INNER JOIN currencies + ON suppliers.currcode = currencies.currabrev LEFT JOIN www_users ON purchorders.initiator=www_users.userid - LEFT JOIN locations - ON locations.loccode=purchorders.intostocklocation - LEFT JOIN suppliers - ON purchorders.supplierno = suppliers.supplierid - WHERE purchorders.orderno = '" . $_GET['OrderNo'] ."'"; + WHERE purchorders.orderno = '" . filter_number_format($_GET['OrderNo']) ."'"; $GetOrdHdrResult = DB_query($OrderHeaderSQL,$db, $ErrMsg); @@ -71,7 +70,7 @@ } echo '<table class="table_index"> <tr><td class="menu_group_item"> - <li><a href="'. $rootpath . '/PO_SelectPurchOrder.php?'. SID .'">' . _('Outstanding Sales Orders') . '</a></li> + <li><a href="'. $rootpath . '/PO_SelectPurchOrder.php">' . _('Outstanding Sales Orders') . '</a></li> </td></tr></table>'; include('includes/footer.inc'); @@ -85,8 +84,8 @@ echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/supplier.png" title="' . _('Purchase Order') . '" alt="" />' . ' ' . $title . '</p>'; -echo '<table class=selection cellpadding=2>'; -echo '<tr><th colspan=8><font size=3 color=navy>'. _('Order Header Details'). '</font></th></tr>'; +echo '<table class="selection" cellpadding="2">'; +echo '<tr><th colspan="8"><font size="3" color="navy">'. _('Order Header Details'). '</font></th></tr>'; echo '<tr><th style="text-align:left">' . _('Supplier Code'). '</td><td><a href="SelectSupplier.php?SupplierID='.$myrow['supplierid'].'">' . $myrow['supplierid'] . '</a></td> <th style="text-align:left">' . _('Supplier Name'). '</td><td><a href="SelectSupplier.php?SupplierID='.$myrow['supplierid'].'">' . $myrow['suppname'] . '</a></td></tr>'; @@ -126,17 +125,22 @@ echo '</table>'; +$CurrDecimalPlaces = $myrow['currdecimalplaces']; echo '<br />'; /*Now get the line items */ $ErrMsg = _('The line items of the purchase order could not be retrieved'); -$LineItemsSQL = "SELECT purchorderdetails.* FROM purchorderdetails - WHERE purchorderdetails.orderno = '" . $_GET['OrderNo'] ."'"; +$LineItemsSQL = "SELECT purchorderdetails.*, + stockmaster.decimalplaces + FROM purchorderdetails + LEFT JOIN stockmaster + ON purchorderdetails.itemcode=stockmaster.stockid + WHERE purchorderdetails.orderno = '" . filter_number_format($_GET['OrderNo']) ."'"; $LineItemsResult = db_query($LineItemsSQL,$db, $ErrMsg); -echo '<table colspan=8 class=selection cellpadding=0>'; +echo '<table colspan="8" class="selection" cellpadding="0">'; echo '<tr><th colspan=8><font size=3 color=navy>'. _('Order Line Details'). '</font></th></tr>'; echo '<tr> <th>' . _('Item Code'). '</td> @@ -159,7 +163,11 @@ $RecdTotal += ($myrow['quantityrecd'] * $myrow['unitprice']); $DisplayReqdDate = ConvertSQLDate($myrow['deliverydate']); - + if ($myrow['decimalplaces']!=NULL){ + $DecimalPlaces = $myrow['decimalplaces']; + } else { + $DecimalPlaces = 2; + } // if overdue and outstanding quantities, then highlight as so if (($myrow['quantityord'] - $myrow['quantityrecd'] > 0) AND Date1GreaterThanDate2(Date($_SESSION['DefaultDateFormat']), $DisplayReqdDate)){ @@ -176,31 +184,31 @@ printf ('<td>%s</td> <td>%s</td> - <td class=number>%01.2f</td> - <td class=number>%01.2f</td> - <td class=number>%01.2f</td> - <td class=number>%01.2f</td> - <td class=number>%01.2f</td> + <td class="number">%s</td> + <td class="number">%s</td> + <td class="number">%s</td> + <td class="number">%s</td> + <td class="number">%s</td> <td>%s</td> </tr>' , $myrow['itemcode'], $myrow['itemdescription'], - $myrow['quantityord'], - $myrow['quantityrecd'], - $myrow['qtyinvoiced'], - $myrow['unitprice'], - $myrow['actprice'], + locale_number_format($myrow['quantityord'],$DecimalPlaces), + locale_number_format($myrow['quantityrecd'],$DecimalPlaces), + locale_number_format($myrow['qtyinvoiced'],$DecimalPlaces), + locale_money_format($myrow['unitprice'],$CurrDecimalPlaces), + locale_money_format($myrow['actprice'],$CurrDecimalPlaces), $DisplayReqdDate); } echo '<tr><td><br /></td> </tr> - <tr><td colspan=4 class=number>' . _('Total Order Value Excluding Tax') .'</td> - <td colspan=2 class=number>' . locale_number_format($OrderTotal,2) . '</td></tr>'; + <tr><td colspan=4 class="number">' . _('Total Order Value Excluding Tax') .'</td> + <td colspan=2 class="number">' . locale_money_format($OrderTotal,$CurrDecimalPlaces) . '</td></tr>'; echo '<tr> - <td colspan=4 class=number>' . _('Total Order Value Received Excluding Tax') . '</td> - <td colspan=2 class=number>' . locale_number_format($RecdTotal,2) . '</td></tr>'; + <td colspan=4 class="number">' . _('Total Order Value Received Excluding Tax') . '</td> + <td colspan=2 class="number">' . locale_money_format($RecdTotal,$CurrDecimalPlaces) . '</td></tr>'; echo '</table>'; echo '<br />'; Modified: trunk/PO_PDFPurchOrder.php =================================================================== --- trunk/PO_PDFPurchOrder.php 2011-09-19 09:38:20 UTC (rev 4696) +++ trunk/PO_PDFPurchOrder.php 2011-09-20 10:21:28 UTC (rev 4697) @@ -6,7 +6,7 @@ include('includes/SQL_CommonFunctions.inc'); include('includes/DefinePOClass.php'); -if(!isset($_GET['OrderNo']) && !isset($_POST['OrderNo'])){ +if(!isset($_GET['OrderNo']) AND !isset($_POST['OrderNo'])){ $title = _('Select a Purchase Order'); include('includes/header.inc'); echo '<div class="centre"><br /><br /><br />'; @@ -95,9 +95,12 @@ purchorders.paymentterms, suppliers.currcode, purchorders.status, - purchorders.stat_comment + purchorders.stat_comment, + currencies.decimalplaces AS currdecimalplaces FROM purchorders INNER JOIN suppliers ON purchorders.supplierno = suppliers.supplierid + INNER JOIN currencies + ON suppliers.currcode=currencies.currabrev WHERE purchorders.orderno='" . $OrderNo ."'"; $result=DB_query($sql,$db, $ErrMsg); if (DB_num_rows($result)==0){ /*There is no order header returned */ @@ -215,8 +218,8 @@ include('includes/PO_PDFOrderPageHeader.inc'); $YPos=$Page_Height - $FormDesign->Data->y; $OrderTotal = 0; - while ((isset($OrderNo) and $OrderNo=='Preview') - OR (isset($result) and $POLine=DB_fetch_array($result))) { + while ((isset($OrderNo) AND $OrderNo=='Preview') + OR (isset($result) AND $POLine=DB_fetch_array($result))) { /* If we are previewing the order then fill the * order line with dummy data */ if ($OrderNo=='Preview') { @@ -230,15 +233,20 @@ $POLine['conversionfactor']=1; $POLine['decimalplaces']=2; } - $DisplayQty = locale_number_format($POLine['quantityord']/$POLine['conversionfactor'],$POLine['decimalplaces']); + if ($POLine['decimalplaces']!=NULL){ + $DecimalPlaces = $POLine['decimalplaces']; + } else { + $DecimalPlaces = 2; + } + $DisplayQty = locale_number_format($POLine['quantityord']/$POLine['conversionfactor'],$DecimalPlaces); if ($_POST['ShowAmounts']=='Yes'){ - $DisplayPrice = locale_number_format($POLine['unitprice']*$POLine['conversionfactor'],2); + $DisplayPrice = locale_money_format($POLine['unitprice']*$POLine['conversionfactor'],$POHeader['currdecimalplaces']); } else { $DisplayPrice = '----'; } - $DisplayDelDate = ConvertSQLDate($POLine['deliverydate'],2); + $DisplayDelDate = ConvertSQLDate($POLine['deliverydate']); if ($_POST['ShowAmounts']=='Yes'){ - $DisplayLineTotal = locale_number_format($POLine['unitprice']*$POLine['quantityord'],2); + $DisplayLineTotal = locale_money_format($POLine['unitprice']*$POLine['quantityord'],$POHeader['currdecimalplaces']); } else { $DisplayLineTotal = '----'; } @@ -285,7 +293,7 @@ include ('includes/PO_PDFOrderPageHeader.inc'); } //end if need a new page headed up if ($_POST['ShowAmounts']=='Yes'){ - $DisplayOrderTotal = locale_number_format($OrderTotal,2); + $DisplayOrderTotal = locale_money_format($OrderTotal,$POHeader['currdecimalplaces']); } else { $DisplayOrderTotal = '----'; } @@ -330,15 +338,15 @@ $sql = "UPDATE purchorders SET allowprint = 0, dateprinted = '" . Date('Y-m-d') . "', status = 'Printed', - stat_comment = '" . $StatusComment . "' - WHERE purchorders.orderno = '" . $OrderNo."'"; + stat_comment = '" . DB_escape_string($StatusComment) . "' + WHERE purchorders.orderno = '" . filter_number_format($OrderNo) ."'"; $result = DB_query($sql,$db); } include('includes/footer.inc'); } /* There was enough info to either print or email the purchase order */ else { /*the user has just gone into the page need to ask the question whether to print the order or email it to the supplier */ include ('includes/header.inc'); - echo '<form action="' . $_SERVER['PHP_SELF'] . '" method=post>'; + echo '<form action="' . $_SERVER['PHP_SELF'] . '" method="post">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; if ($ViewingOnly==1){ echo '<input type=hidden name="ViewingOnly" value=1>'; @@ -381,7 +389,7 @@ suppliercontacts.email FROM suppliercontacts INNER JOIN purchorders ON suppliercontacts.supplierid=purchorders.supplierno - WHERE purchorders.orderno='".$OrderNo."'"; + WHERE purchorders.orderno='".filter_number_format($OrderNo)."'"; $ContactsResult=DB_query($SQL,$db, $ErrMsg); if (DB_num_rows($ContactsResult)>0){ echo '<tr><td>'. _('Email to') .':</td><td><select name="EmailTo">'; @@ -404,7 +412,7 @@ } else { echo '</table>'; } - echo '<br /><div class="centre"><input type=submit name="DoIt" value="' . _('OK') . '"></div>'; + echo '<br /><div class="centre"><input type="submit" name="DoIt" value="' . _('OK') . '"></div>'; echo '</form>'; include('includes/footer.inc'); } Modified: trunk/PO_SelectOSPurchOrder.php =================================================================== --- trunk/PO_SelectOSPurchOrder.php 2011-09-19 09:38:20 UTC (rev 4696) +++ trunk/PO_SelectOSPurchOrder.php 2011-09-20 10:21:28 UTC (rev 4697) @@ -18,9 +18,9 @@ } if (isset($_GET['OrderNumber'])){ - $OrderNumber=trim($_GET['OrderNumber']); + $OrderNumber=(filter_number_format($_GET['OrderNumber'])); } elseif (isset($_POST['OrderNumber'])){ - $OrderNumber=trim($_POST['OrderNumber']); + $OrderNumber=(filter_number_format($_POST['OrderNumber'])); } if (isset($_GET['SelectedSupplier'])){ Modified: trunk/PO_SelectPurchOrder.php =================================================================== --- trunk/PO_SelectPurchOrder.php 2011-09-19 09:38:20 UTC (rev 4696) +++ trunk/PO_SelectPurchOrder.php 2011-09-20 10:21:28 UTC (rev 4697) @@ -11,9 +11,9 @@ $SelectedStockItem = $_POST['SelectedStockItem']; } if (isset($_GET['OrderNumber'])) { - $OrderNumber = $_GET['OrderNumber']; + $OrderNumber = filter_number_format($_GET['OrderNumber']); } elseif (isset($_POST['OrderNumber'])) { - $OrderNumber = $_POST['OrderNumber']; + $OrderNumber = filter_number_format($_POST['OrderNumber']); } if (isset($_GET['SelectedSupplier'])) { $SelectedSupplier = $_GET['SelectedSupplier']; @@ -166,20 +166,20 @@ } } echo '</select><td><font size=1>' . _('Enter text extracts in the') . ' <b>' . _('description') . '</b>:</font></td>'; -echo '<td><input type="Text" name="Keywords" size=20 maxlength=25></td></tr><tr><td></td>'; +echo '<td><input type="text" name="Keywords" size=20 maxlength=25></td></tr><tr><td></td>'; echo '<td><font size=3><b>' . _('OR') . ' </b></font><font size=1>' . _('Enter extract of the') . '<b>' . _('Stock Code') . '</b>:</font></td>'; echo '<td><input type="text" name="StockCode" size=15 maxlength=18></td></tr>'; -echo '<tr><td colspan=3><div class=centre><input type=submit name="SearchParts" value="' . _('Search Parts Now') . '">'; +echo '<tr><td colspan=3><div class="centre"><input type=submit name="SearchParts" value="' . _('Search Parts Now') . '">'; echo '<input type=submit name="ResetPart" value="' . _('Show All') . '"></div></td></tr>'; echo '</table><br /><br />'; if (isset($StockItemsResult)) { echo '<table cellpadding=2 colspan=7 class=selection>'; - $TableHeader = '<tr><td class="tableheader">' . _('Code') . '</td> - <td class="tableheader">' . _('Description') . '</td> - <td class="tableheader">' . _('On Hand') . '</td> - <td class="tableheader">' . _('Orders') . '<br />' . _('Outstanding') . '</td> - <td class="tableheader">' . _('Units') . '</td> - </tr>'; + $TableHeader = '<tr><th>' . _('Code') . '</th> + <th>' . _('Description') . '</th> + <th>' . _('On Hand') . '</th> + <th>' . _('Orders') . '<br />' . _('Outstanding') . '</th> + <th>' . _('Units') . '</th> + </tr>'; echo $TableHeader; $j = 1; $k = 0; //row colour counter @@ -244,7 +244,7 @@ ON purchorders.supplierno = suppliers.supplierid INNER JOIN currencies ON suppliers.currcode=currencies.currabrev - WHERE purchorders.orderno='" . $OrderNumber . "' + WHERE purchorders.orderno='" . filter_number_format($OrderNumber) . "' GROUP BY purchorders.orderno, suppliers.suppname, purchorders.orddate, @@ -417,7 +417,7 @@ $ViewPurchOrder = $rootpath . '/PO_OrderDetails.php?OrderNo=' . $myrow['orderno']; $FormatedOrderDate = ConvertSQLDate($myrow['orddate']); $FormatedDeliveryDate = ConvertSQLDate($myrow['deliverydate']); - $FormatedOrderValue = locale_number_format($myrow['ordervalue'], $myrow['decimalplaces']); + $FormatedOrderValue = locale_money_format($myrow['ordervalue'], $myrow['decimalplaces']); /* View Supplier Currency Requisition Order Date Initiator Order Total ModifyPage, $myrow["orderno"], $myrow["suppname"], $myrow["currcode"], $myrow["requisitionno"] $FormatedOrderDate, $myrow["initiator"] $FormatedOrderValue Order Status*/ echo '<td><a href="' . $ViewPurchOrder . '">' . $myrow['orderno'] . '</a></td> Modified: trunk/Prices.php =================================================================== --- trunk/Prices.php 2011-09-19 09:38:20 UTC (rev 4696) +++ trunk/Prices.php 2011-09-20 10:21:28 UTC (rev 4697) @@ -67,7 +67,7 @@ //first off validate inputs sensible // This gives some date in 1999?? $ZeroDate = Date($_SESSION['DefaultDateFormat'],Mktime(0,0,0,0,0,0)); - if (!is_double((double) trim($_POST['Price'])) OR $_POST['Price']=='') { + if (!is_numeric((double) filter_number_format($_POST['Price'])) OR $_POST['Price']=='') { $InputError = 1; prnMsg( _('The price entered must be numeric'),'error'); } @@ -103,7 +103,7 @@ AND enddate ='" . FormatDateForSQL($_POST['EndDate']) . "' AND prices.typeabbrev='" . $_POST['TypeAbbrev'] . "' AND prices.currabrev='" . $_POST['CurrAbrev'] . "' - AND prices.price='" . $_POST['Price'] . "' + AND prices.price='" . filter_number_format($_POST['Price']) . "' "; $result = DB_query($sql, $db); @@ -124,7 +124,7 @@ $sql = "UPDATE prices SET typeabbrev='" . $_POST['TypeAbbrev'] . "', currabrev='" . $_POST['CurrAbrev'] . "', - price='" . $_POST['Price'] . "', + price='" . filter_number_format($_POST['Price']) . "', startdate='" . FormatDateForSQL($_POST['StartDate']) . "', enddate='" . $SQLEndDate . "' WHERE prices.stockid='".$Item."' @@ -156,7 +156,7 @@ '" . $_POST['CurrAbrev'] . "', '" . FormatDateForSQL($_POST['StartDate']) . "', '" . $SQLEndDate. "', - '" . $_POST['Price'] . "')"; + '" . filter_number_format($_POST['Price']) . "')"; $ErrMsg = _('The new price could not be added'); $result = DB_query($sql,$db,$ErrMsg); @@ -208,11 +208,16 @@ $result = DB_query($sql,$db); if (DB_num_rows($result) > 0) { - echo '<table class=selection>'; - echo '<tr><th colspan=7><form method="post" action="' . $_SERVER['PHP_SELF'] . '">'; - echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; - echo _('Pricing for part') . ':<input type="text" name="Item" maxsizee=22 value="' . $Item . '" maxlength=20><input type=submit name="NewPart" value="' . _('Review Prices') . '">'; - echo '</th></tr></form>'; + echo '<form method="post" action="' . $_SERVER['PHP_SELF'] . '"> + <table class=selection> + <tr> + <th colspan=7> + <input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />' . + _('Pricing for part') . ': + <input type="text" name="Item" size="22" value="' . $Item . '" maxlength="20"> + <input type=submit name="NewPart" value="' . _('Review Prices') . '"></th> + </tr> + </form>'; echo '<tr><th>' . _('Currency') . '</th> <th>' . _('Sales Type') . '</th> @@ -240,7 +245,7 @@ if (in_array(5,$_SESSION['AllowedPageSecurityTokens'])) { echo '<td>' . $myrow['currency'] . '</td> <td>' . $myrow['sales_type'] . '</td> - <td class=number>' . locale_number_format($myrow['price'],$myrow['decimalplaces']) . '</td> + <td class="number">' . locale_number_format($myrow['price'],$myrow['decimalplaces']) . '</td> <td>' . ConvertSQLDate($myrow['startdate']) . '</td> <td>' . $EndDateDisplay . '</td> <td><a href="' . $_SERVER['PHP_SELF'] . '?Item=' . $myrow['stockid'] . '&TypeAbbrev=' .$myrow['typeabbrev'] . '&CurrAbrev=' . $myrow['currabrev'] . '&Price=' . $myrow['price'] . '&StartDate=' . $myrow['startdate'] . '&EndDate=' . $myrow['enddate'] . '&Edit=1">' . _('Edit') . '</td> @@ -249,7 +254,7 @@ } else { echo '<td>' . $myrow['currency'] . '</td> <td>' . $myrow['sales_type'] . '</td> - <td class=number>' . locale_number_format($myrow['price'],$myrow['decimalplaces']) . '</td> + <td class="number">' . locale_number_format($myrow['price'],$myrow['decimalplaces']) . '</td> <td>' . ConvertSQLDate($myrow['startdate']) . '</td> <td>' . $EndDateDisplay . '</td></tr>'; } @@ -270,7 +275,7 @@ echo '<input type=hidden name="OldEndDate" value="' . $_GET['EndDate'] . '">'; $_POST['CurrAbrev'] = $_GET['CurrAbrev']; $_POST['TypeAbbrev'] = $_GET['TypeAbbrev']; - $_POST['Price'] = $_GET['Price']; + $_POST['Price'] = filter_number_format($_GET['Price']); $_POST['StartDate'] = ConvertSQLDate($_GET['StartDate']); if ($_GET['EndDate']=='' OR $_GET['EndDate']=='0000-00-00'){ $_POST['EndDate'] = ''; @@ -282,14 +287,15 @@ $SQL = "SELECT currabrev, currency FROM currencies"; $result = DB_query($SQL,$db); - echo '<br /><table class=selection>'; + echo '<br /><table class="selection">'; echo '<tr><th colspan=5><font color=BLUE size=3><b>' . $Item . ' - ' . $PartDescription . '</b></font></th></tr>'; - echo '<tr><td>' . _('Currency') . ':</td><td><select name="CurrAbrev">'; + echo '<tr><td>' . _('Currency') . ':</td> + <td><select name="CurrAbrev">'; while ($myrow = DB_fetch_array($result)) { if ($myrow['currabrev']==$_POST['CurrAbrev']) { - echo '<option selected VALUE="'; + echo '<option selected value="'; } else { - echo '<option VALUE="'; + echo '<option value="'; } echo $myrow['currabrev'] . '">' . $myrow['currency'] . '</option>'; } //end while loop @@ -305,9 +311,9 @@ while ($myrow = DB_fetch_array($result)) { if ($myrow['typeabbrev']==$_POST['TypeAbbrev']) { - echo '<option selected VALUE="'; + echo '<option selected value="'; } else { - echo '<option VALUE="'; + echo '<option value="'; } echo $myrow['typeabbrev'] . '">' . $myrow['sales_type'] . '</option>'; @@ -319,7 +325,9 @@ if (!isset($_POST['StartDate'])){ $_POST['StartDate'] = Date($_SESSION['DefaultDateFormat']); } - + if (!isset($_POST['EndDate'])){ + $_POST['EndDate'] = ''; + } echo '<tr><td>' . _('Price Effective From Date') . ':</td> <td><input type="text" class=date alt="'.$_SESSION['DefaultDateFormat'].'" name="StartDate" size=10 maxlength=10 value="' . $_POST['StartDate'] . '"></td></tr>'; echo '<tr><td>' . _('Price Effective To Date') . ':</td> @@ -330,16 +338,17 @@ <tr><td><?php echo _('Price'); ?>:</td> <td> - <input type="Text" class=number name="Price" size=12 maxlength=11 value= + <input type="text" class="number" name="Price" size=12 maxlength=11 value= <?php if(isset($_POST['Price'])) { echo $_POST['Price']; - }?>> + } + ?> > </td></tr> </table> <br /><div class="centre"> - <input type="Submit" name="submit" value="<?php echo _('Enter') . '/' . _('Amend Price'); ?>"> + <input type="submit" name="submit" value="<?php echo _('Enter') . '/' . _('Amend Price'); ?>"> </div> <?php Modified: trunk/includes/DateFunctions.inc =================================================================== --- trunk/includes/DateFunctions.inc 2011-09-19 09:38:20 UTC (rev 4696) +++ trunk/includes/DateFunctions.inc 2011-09-20 10:21:28 UTC (rev 4697) @@ -385,7 +385,7 @@ /* takes a date in a the format specified in $_SESSION['DefaultDateFormat'] and converts to a yyyy/mm/dd format */ - + $DateArray = array(); $DateEntry = trim($DateEntry); if (mb_strpos($DateEntry,'/')) { @@ -414,12 +414,13 @@ } return $Date_Array[0].'-'.$Date_Array[1].'-'.$Date_Array[2]; - }elseif (($_SESSION['DefaultDateFormat']=='d/m/Y') OR $_SESSION['DefaultDateFormat']=='d.m.Y'){ + }elseif (($_SESSION['DefaultDateFormat']=='d/m/Y') + OR $_SESSION['DefaultDateFormat']=='d.m.Y'){ if (mb_strlen($Date_Array[2])==2) { if ((int)$Date_Array[2] <=60) { $Date_Array[2] = '20'.$Date_Array[2]; } elseif ((int)$Date_Array[2] >60 AND (int)$Date_Array[2] <100) { - $Date_Array[2] = '19'.$Date_Array[2]; + $Date_Array[2] = '19'. $Date_Array[2]; } } /* echo '<BR>The date returned is ' . $Date_Array[2].'/'.$Date_Array[1].'/'.$Date_Array[0]; */ Modified: trunk/includes/LanguageSetup.php =================================================================== --- trunk/includes/LanguageSetup.php 2011-09-19 09:38:20 UTC (rev 4696) +++ trunk/includes/LanguageSetup.php 2011-09-20 10:21:28 UTC (rev 4697) @@ -65,13 +65,13 @@ include('includes/LanguagesArray.php'); if (defined('LC_MESSAGES')){ //it's a unix/linux server - $Locale = setlocale (LC_MESSAGES, $_SESSION['Language']); - $Locale = setlocale (LC_NUMERIC, $_SESSION['Language']); + $LocaleSet = setlocale (LC_MESSAGES, $_SESSION['Language']); + $LocaleSet = setlocale (LC_NUMERIC, $_SESSION['Language']); } else { // it's a windows server - $Locale = setlocale (LC_ALL, $LanguageArray[$_SESSION['Language']]['WindowsLocale']); + $LocaleSet = setlocale (LC_ALL, $LanguageArray[$_SESSION['Language']]['WindowsLocale']); } -//for testing number_formats $Locale = setlocale (LC_NUMERIC, 'fr_FR.utf8'); +$LocaleSet = setlocale (LC_NUMERIC, 'nl_NL.utf8'); $LocaleInfo = localeconv(); if ($LocaleInfo['mon_decimal_point']==''){ Modified: trunk/includes/MiscFunctions.php =================================================================== --- trunk/includes/MiscFunctions.php 2011-09-19 09:38:20 UTC (rev 4696) +++ trunk/includes/MiscFunctions.php 2011-09-20 10:21:28 UTC (rev 4697) @@ -328,6 +328,7 @@ function filter_number_format($Number) { global $LocaleInfo; + $Number = trim($Number); return str_replace($LocaleInfo['decimal_point'],'.',str_replace($LocaleInfo['thousands_sep'],'',$Number)); } ?> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dai...@us...> - 2011-09-21 07:32:22
|
Revision: 4698 http://web-erp.svn.sourceforge.net/web-erp/?rev=4698&view=rev Author: daintree Date: 2011-09-21 07:32:16 +0000 (Wed, 21 Sep 2011) Log Message: ----------- number formats Modified Paths: -------------- trunk/CustomerReceipt.php trunk/includes/LanguageSetup.php Modified: trunk/CustomerReceipt.php =================================================================== --- trunk/CustomerReceipt.php 2011-09-20 10:21:28 UTC (rev 4697) +++ trunk/CustomerReceipt.php 2011-09-21 07:32:16 UTC (rev 4698) @@ -527,6 +527,8 @@ echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/printer.png" title="' . _('Print') . '" alt="">' . ' ' . '<a href="' . $rootpath . '/PDFBankingSummary.php?BatchNo=' . $_SESSION['ReceiptBatch']->BatchNo . '">' . _('Print PDF Batch Summary') . '</a></p>'; echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/allocation.png" title="' . _('Allocate') . '" alt="">' . ' ' . '<a href="' . $rootpath . '/CustomerAllocations.php">' . _('Allocate Receipts') . '</a></p>'; + echo '<p class="page_title_text">• ' . $rootpath . '/CustomerReceipt.php?NewReceipt=Yes&Type=Customer ' . _('Enter Receipts') . ' </p>'; + unset($_SESSION['ReceiptBatch']); include('includes/footer.inc'); exit; Modified: trunk/includes/LanguageSetup.php =================================================================== --- trunk/includes/LanguageSetup.php 2011-09-20 10:21:28 UTC (rev 4697) +++ trunk/includes/LanguageSetup.php 2011-09-21 07:32:16 UTC (rev 4698) @@ -68,10 +68,10 @@ $LocaleSet = setlocale (LC_MESSAGES, $_SESSION['Language']); $LocaleSet = setlocale (LC_NUMERIC, $_SESSION['Language']); } else { // it's a windows server - $LocaleSet = setlocale (LC_ALL, $LanguageArray[$_SESSION['Language']]['WindowsLocale']); + $LocaleSet = setlocale (LC_ALL, $LanguagesArray[$_SESSION['Language']]['WindowsLocale']); } -$LocaleSet = setlocale (LC_NUMERIC, 'nl_NL.utf8'); +//$LocaleSet = setlocale (LC_NUMERIC, 'nl_NL.utf8'); $LocaleInfo = localeconv(); if ($LocaleInfo['mon_decimal_point']==''){ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dai...@us...> - 2011-09-21 07:32:23
|
Revision: 4698 http://web-erp.svn.sourceforge.net/web-erp/?rev=4698&view=rev Author: daintree Date: 2011-09-21 07:32:16 +0000 (Wed, 21 Sep 2011) Log Message: ----------- number formats Modified Paths: -------------- trunk/CustomerReceipt.php trunk/includes/LanguageSetup.php Modified: trunk/CustomerReceipt.php =================================================================== --- trunk/CustomerReceipt.php 2011-09-20 10:21:28 UTC (rev 4697) +++ trunk/CustomerReceipt.php 2011-09-21 07:32:16 UTC (rev 4698) @@ -527,6 +527,8 @@ echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/printer.png" title="' . _('Print') . '" alt="">' . ' ' . '<a href="' . $rootpath . '/PDFBankingSummary.php?BatchNo=' . $_SESSION['ReceiptBatch']->BatchNo . '">' . _('Print PDF Batch Summary') . '</a></p>'; echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/allocation.png" title="' . _('Allocate') . '" alt="">' . ' ' . '<a href="' . $rootpath . '/CustomerAllocations.php">' . _('Allocate Receipts') . '</a></p>'; + echo '<p class="page_title_text">• ' . $rootpath . '/CustomerReceipt.php?NewReceipt=Yes&Type=Customer ' . _('Enter Receipts') . ' </p>'; + unset($_SESSION['ReceiptBatch']); include('includes/footer.inc'); exit; Modified: trunk/includes/LanguageSetup.php =================================================================== --- trunk/includes/LanguageSetup.php 2011-09-20 10:21:28 UTC (rev 4697) +++ trunk/includes/LanguageSetup.php 2011-09-21 07:32:16 UTC (rev 4698) @@ -68,10 +68,10 @@ $LocaleSet = setlocale (LC_MESSAGES, $_SESSION['Language']); $LocaleSet = setlocale (LC_NUMERIC, $_SESSION['Language']); } else { // it's a windows server - $LocaleSet = setlocale (LC_ALL, $LanguageArray[$_SESSION['Language']]['WindowsLocale']); + $LocaleSet = setlocale (LC_ALL, $LanguagesArray[$_SESSION['Language']]['WindowsLocale']); } -$LocaleSet = setlocale (LC_NUMERIC, 'nl_NL.utf8'); +//$LocaleSet = setlocale (LC_NUMERIC, 'nl_NL.utf8'); $LocaleInfo = localeconv(); if ($LocaleInfo['mon_decimal_point']==''){ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dai...@us...> - 2011-09-21 09:41:27
|
Revision: 4699 http://web-erp.svn.sourceforge.net/web-erp/?rev=4699&view=rev Author: daintree Date: 2011-09-21 09:41:21 +0000 (Wed, 21 Sep 2011) Log Message: ----------- number_formats Modified Paths: -------------- trunk/PricesBasedOnMarkUp.php trunk/PricesByCost.php trunk/Prices_Customer.php trunk/PrintCheque.php Modified: trunk/PricesBasedOnMarkUp.php =================================================================== --- trunk/PricesBasedOnMarkUp.php 2011-09-21 07:32:16 UTC (rev 4698) +++ trunk/PricesBasedOnMarkUp.php 2011-09-21 09:41:21 UTC (rev 4699) @@ -1,9 +1,6 @@ <?php -/* $Revision: 1.9 $ */ /* $Id$*/ -//$PageSecurity=11; - include('includes/session.inc'); $title=_('Update Pricing'); include('includes/header.inc'); @@ -48,7 +45,7 @@ <td><select name="CurrCode">'; if (!isset($_POST['CurrCode'])){ - echo '<option selected value=0>' . _('No Price List Currency Selected'); + echo '<option selected value=0>' . _('No Price List Currency Selected') . '</option>'; } while ($Currencies=DB_fetch_array($result)){ @@ -94,7 +91,7 @@ echo '<option selected VALUE=0>' . _('No Price List Selected') . '</option>'; } while ($PriceLists=DB_fetch_array($PricesResult)){ - if (isset($_POST['BasePriceList']) and $_POST['BasePriceList']==$PriceLists['typeabbrev']){ + if (isset($_POST['BasePriceList']) AND $_POST['BasePriceList']==$PriceLists['typeabbrev']){ echo '<option selected value="' . $PriceLists['typeabbrev'] . '">' . $PriceLists['sales_type'] . '</option>'; } else { echo '<option value="' . $PriceLists['typeabbrev'] . '">' . $PriceLists['sales_type'] . '</option>'; @@ -161,10 +158,10 @@ } echo '<tr><td>' . _('Percentage Increase (positive) or decrease (negative)') . '</td> - <td><input type="text" name="IncreasePercent" class=number size=4 maxlength=4 VALUE="' . $_POST['IncreasePercent'] . '"></td></tr></table>'; + <td><input type="text" name="IncreasePercent" class="number" size="4" maxlength="4" value="' . $_POST['IncreasePercent'] . '"></td></tr></table>'; -echo '<p><div class="centre"><input type=submit name="UpdatePrices" VALUE="' . _('Update Prices') . '\' onclick="return confirm(\'' . _('Are you sure you wish to update or add all the prices according to the criteria selected?') . '\');"></div>'; +echo '<p><div class="centre"><input type="submit" name="UpdatePrices" value="' . _('Update Prices') . '\' onclick="return confirm(\'' . _('Are you sure you wish to update or add all the prices according to the criteria selected?') . '\');"></div>'; echo '</form>'; @@ -247,7 +244,7 @@ AND categoryid <='" . $_POST['StkCatTo'] . "'"; $PartsResult = DB_query($sql,$db); - $IncrementPercentage = $_POST['IncreasePercent']/100; + $IncrementPercentage = filter_number_format($_POST['IncreasePercent']/100); $CurrenciesResult = DB_query("SELECT rate FROM currencies WHERE currabrev='" . $_POST['CurrCode'] . "'",$db); $CurrencyRow = DB_fetch_row($CurrenciesResult); @@ -300,7 +297,7 @@ prnMsg(_('The cost for this item is not set up or is set up as less than or equal to zero - no price changes will be made based on zero cost items. The item concerned is:') . ' ' . $myrow['stockid'],'warn'); } } - + $_POST['RoundingFactor'] = filter_number_format($_POST['RoundingFactor']); if ($_POST['CostType']!='OtherPriceList'){ $RoundedPrice = round(($Cost * (1+ $IncrementPercentage) * $CurrencyRate+($_POST['RoundingFactor']/2))/$_POST['RoundingFactor']) * $_POST['RoundingFactor']; if ($RoundedPrice <=0){ @@ -315,15 +312,15 @@ if ($Cost > 0) { $CurrentPriceResult = DB_query("SELECT price, - startdate, - enddate - FROM prices - WHERE typeabbrev= '" . $_POST['PriceList'] . "' - AND debtorno ='' - AND currabrev='" . $_POST['CurrCode'] . "' - AND startdate <='" . Date('Y-m-d') . "' - AND (enddate>='" . Date('Y-m-d') . "' OR enddate='0000-00-00') - AND stockid='" . $myrow['stockid'] . "'",$db); + startdate, + enddate + FROM prices + WHERE typeabbrev= '" . $_POST['PriceList'] . "' + AND debtorno ='' + AND currabrev='" . $_POST['CurrCode'] . "' + AND startdate <='" . Date('Y-m-d') . "' + AND (enddate>='" . Date('Y-m-d') . "' OR enddate='0000-00-00') + AND stockid='" . $myrow['stockid'] . "'",$db); if (DB_num_rows($CurrentPriceResult)==1){ $DayPriorToNewPrice = DateAdd($_POST['PriceStartDate'],'d',-1); $CurrentPriceRow = DB_fetch_array($CurrentPriceResult); @@ -336,8 +333,8 @@ AND stockid='" . $myrow['stockid'] . "'"; $ErrMsg =_('Error updating prices for') . ' ' . $myrow['stockid'] . ' ' . _('because'); $result = DB_query($UpdateSQL,$db,$ErrMsg); - - } + + } $sql = "INSERT INTO prices (stockid, typeabbrev, currabrev, @@ -349,11 +346,11 @@ '" . $_POST['CurrCode'] . "', '" . FormatDateForSQL($_POST['PriceStartDate']) . "', '" . $SQLEndDate . "', - '" . $RoundedPrice . "')"; + '" . filter_number_format($RoundedPrice) . "')"; $ErrMsg =_('Error inserting new price for') . ' ' . $myrow['stockid'] . ' ' . _('because'); $result = DB_query($sql,$db,$ErrMsg); prnMsg(_('Inserting new price for') . ' ' . $myrow['stockid'] . ' ' . _('to') . ' ' . $RoundedPrice,'info'); - + }// end if cost > 0 }//end while loop around items in the category } Modified: trunk/PricesByCost.php =================================================================== --- trunk/PricesByCost.php 2011-09-21 07:32:16 UTC (rev 4698) +++ trunk/PricesByCost.php 2011-09-21 09:41:21 UTC (rev 4699) @@ -27,20 +27,20 @@ prices.debtorno, prices.branchcode, (stockmaster.materialcost + stockmaster.labourcost + stockmaster.overheadcost) as cost, - prices.price as price, - prices.debtorno AS customer, + prices.price as price, + prices.debtorno AS customer, prices.branchcode AS branch, prices.startdate, prices.enddate, currencies.decimalplaces, currencies.rate - FROM stockmaster INNER JOIN prices + FROM stockmaster INNER JOIN prices ON stockmaster.stockid=prices.stockid - INNER JOIN currencies + INNER JOIN currencies ON prices.currabrev=currencies.currabrev - WHERE stockmaster.discontinued = 0 + WHERE stockmaster.discontinued = 0 " . $Category . " - AND prices.price" . $Comparator . "(stockmaster.materialcost + stockmaster.labourcost + stockmaster.overheadcost) * '" . $_POST['Margin'] . "' + AND prices.price" . $Comparator . "(stockmaster.materialcost + stockmaster.labourcost + stockmaster.overheadcost) * '" . filter_number_format($_POST['Margin']) . "' AND prices.typeabbrev ='" . $_POST['SalesType'] . "' AND prices.currabrev ='" . $_POST['CurrCode'] . "' AND (prices.enddate>='" . Date('Y-m-d') . "' OR prices.enddate='0000-00-00')"; @@ -53,7 +53,7 @@ while ($myrow = DB_fetch_array($result)) { /*The logic here goes like this: * 1. If the price at the same start and end date already exists then do nowt!! - * 2. If not then check if a price with the start date of today already exists - then we should be updating it + * 2. If not then check if a price with the start date of today already exists - then we should be updating it * 3. If not either of the above then insert the new price */ $SQLTestExists = "SELECT price FROM prices @@ -62,13 +62,13 @@ AND prices.currabrev ='" . $_POST['CurrCode'] . "' AND prices.debtorno ='" . $_POST['DebtorNo_' . $PriceCounter] . "' AND prices.branchcode ='" . $_POST['BranchCode_' . $PriceCounter] . "' - AND prices.startdate ='" . $_POST['StartDate_' . $PriceCounter] . "' + AND prices.startdate ='" . $_POST['StartDate_' . $PriceCounter] . "' AND prices.enddate ='" . $_POST['EndDate_' . $PriceCounter] . "' - AND prices.price ='" . $_POST['Price_' . $PriceCounter] . "'"; + AND prices.price ='" . filter_number_format($_POST['Price_' . $PriceCounter]) . "'"; $TestExistsResult = DB_query($SQLTestExists,$db); if (DB_num_rows($TestExistsResult)==0){ //the price doesn't currently exist //now check to see if a new price has already been created from start date of today - + $SQLTestExists = "SELECT price FROM prices WHERE stockid = '" . $_POST['StockID_' . $PriceCounter] . "' AND prices.typeabbrev ='" . $_POST['SalesType'] . "' @@ -79,7 +79,7 @@ $TestExistsResult = DB_query($SQLTestExists,$db); if (DB_num_rows($TestExistsResult)==1){ //then we are updating - $SQLUpdate = "UPDATE prices SET price = '" . $_POST['Price_' . $PriceCounter] . "' + $SQLUpdate = "UPDATE prices SET price = '" . filter_number_format($_POST['Price_' . $PriceCounter]) . "' WHERE stockid = '" . $_POST['StockID_' . $PriceCounter] . "' AND prices.typeabbrev ='" . $_POST['SalesType'] . "' AND prices.currabrev ='" . $_POST['CurrCode'] . "' @@ -109,7 +109,7 @@ startdate ) VALUES ( '" . $_POST['StockID_' . $PriceCounter] . "', - '" . $_POST['Price_' . $PriceCounter] . "', + '" . filter_number_format($_POST['Price_' . $PriceCounter]) . "', '" . $_POST['SalesType'] . "', '" . $_POST['CurrCode'] . "', '" . $_POST['DebtorNo_' . $PriceCounter] . "', @@ -163,7 +163,7 @@ echo '<form action="' .$_SERVER['PHP_SELF'] .'" method="POST" name="update">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; echo'<input type="hidden" value=' . $_POST['StockCat'] . ' name="StockCat"> - <input type="hidden" value=' . $_POST['Margin'] . ' name="Margin"> + <input type="hidden" value=' . filter_number_format($_POST['Margin']) . ' name="Margin"> <input type="hidden" value=' . $_POST['CurrCode'] . ' name="CurrCode"> <input type="hidden" value=' . $_POST['Comparator'] . ' name="Comparator"> <input type="hidden" value=' . $_POST['SalesType'] . ' name="SalesType">'; @@ -186,11 +186,11 @@ } /*end of else Cost */ //variables for update - echo '<input type="hidden" value=' . $myrow['stockid'] . ' name="StockID_' . $PriceCounter .'"> - <input type="hidden" value=' . $myrow['debtorno'] . ' name="DebtorNo_' . $PriceCounter .'"> - <input type="hidden" value=' . $myrow['branchcode'] . ' name="BranchCode_' . $PriceCounter .'"> - <input type="hidden" value=' . $myrow['startdate'] . ' name="StartDate_' . $PriceCounter .'"> - <input type="hidden" value=' . $myrow['enddate'] . ' name="EndDate_' . $PriceCounter .'">'; + echo '<input type="hidden" value=' . $myrow['stockid'] . ' name="StockID_' . $PriceCounter .'" /> + <input type="hidden" value=' . $myrow['debtorno'] . ' name="DebtorNo_' . $PriceCounter .'" /> + <input type="hidden" value=' . $myrow['branchcode'] . ' name="BranchCode_' . $PriceCounter .'" /> + <input type="hidden" value=' . $myrow['startdate'] . ' name="StartDate_' . $PriceCounter .'" /> + <input type="hidden" value=' . $myrow['enddate'] . ' name="EndDate_' . $PriceCounter .'" />'; //variable for current margin if ($myrow['price'] != 0){ $CurrentGP = (($myrow['price']/$myrow['rate'])-$Cost)*100 / ($myrow['price']/$myrow['rate']); @@ -198,7 +198,7 @@ $CurrentGP = 0; } //variable for proposed - $ProposedPrice = $Cost * $_POST['Margin']; + $ProposedPrice = $Cost * filter_number_format($_POST['Margin']); if ($myrow['enddate']=='0000-00-00'){ $EndDateDisplay = _('No End Date'); } else { @@ -210,10 +210,10 @@ <td>' . $myrow['branch'] . '</td> <td>' . ConvertSQLDate($myrow['startdate']) . '</td> <td>' . $EndDateDisplay . '</td> - <td class="number">' . locale_number_format($Cost, $_SESSION['CompanyRecord']['decimalplaces']) . '</td> + <td class="number">' . locale_money_format($Cost, $_SESSION['CompanyRecord']['decimalplaces']) . '</td> <td class="number">' . locale_number_format($CurrentGP, 1) . '%</td> - <td class="number">' . locale_number_format($ProposedPrice, $myrow['decimalplaces']) . '</td> - <td><input type="text" class="number" name="Price_' . $PriceCounter . '" maxlength=14 size=10 value="' . $myrow['price'] . '"></td> + <td class="number">' . locale_money_format($ProposedPrice, $myrow['decimalplaces']) . '</td> + <td><input type="text" class="number" name="Price_' . $PriceCounter . '" maxlength=14 size=10 value="' . locale_money_format($myrow['price'],$myrow['decimalplaces']) . '"></td> </tr> '; $PriceCounter++; } //end of looping @@ -254,7 +254,7 @@ if (!isset($_POST['Margin'])){ $_POST['Margin']=1; } - echo '<td><input type="text" class="number" name="Margin" MAXLENGTH =8 size=8 value=' .$_POST['Margin'] . '></td></tr>'; + echo '<td><input type="text" class="number" name="Margin" maxlength="8" size="8" value=' .$_POST['Margin'] . '></td></tr>'; $result = DB_query("SELECT typeabbrev, sales_type FROM salestypes", $db); echo '<tr><td>' . _('Sales Type') . '/' . _('Price List') . ':</td> <td><select name="SalesType">'; Modified: trunk/Prices_Customer.php =================================================================== --- trunk/Prices_Customer.php 2011-09-21 07:32:16 UTC (rev 4698) +++ trunk/Prices_Customer.php 2011-09-21 09:41:21 UTC (rev 4699) @@ -70,7 +70,7 @@ //first off validate inputs sensible - if (!is_double((double) trim($_POST['Price'])) OR $_POST['Price']=="") { + if (!is_numeric(filter_number_format($_POST['Price'])) OR $_POST['Price']=='') { $InputError = 1; $msg = _('The price entered must be numeric'); } @@ -105,13 +105,13 @@ $msg = _('The end date is expected to be after today. There is no point entering a new price where the effective date is before today!'); } - if ((isset($_POST['Editing']) and $_POST['Editing']=='Yes') AND mb_strlen($Item)>1 AND $InputError !=1) { + if ((isset($_POST['Editing']) AND $_POST['Editing']=='Yes') AND mb_strlen($Item)>1 AND $InputError !=1) { //editing an existing price $sql = "UPDATE prices SET typeabbrev='" . $SalesType . "', currabrev='" . $CurrCode . "', - price='" . $_POST['Price'] . "', + price='" . filter_number_format($_POST['Price']) . "', branchcode='" . $_POST['Branch'] . "', startdate='" . FormatDateForSQL($_POST['StartDate']) . "', enddate='" . FormatDateForSQL($_POST['EndDate']) . "' @@ -138,7 +138,7 @@ '".$SalesType."', '".$CurrCode."', '" . $_SESSION['CustomerID'] . "', - '" . $_POST['Price'] . "', + '" . filter_number_format($_POST['Price']) . "', '" . $_POST['Branch'] . "', '" . FormatDateForSQL($_POST['StartDate']) . "', '" . FormatDateForSQL($_POST['EndDate']) . "' @@ -294,7 +294,7 @@ echo '<input type=hidden name="Editing" value="Yes">'; echo '<input type=hidden name="OldStartDate" value="' . $_GET['StartDate'] .'">'; echo '<input type=hidden name="OldEndDate" value="' . $_GET['EndDate'] . '">'; - $_POST['Price']=$_GET['Price']; + $_POST['Price']=filter_number_format($_GET['Price']); $_POST['Branch']=$_GET['Branch']; $_POST['StartDate'] = ConvertSQLDate($_GET['StartDate']); if (Is_Date($_GET['EndDate'])){ Modified: trunk/PrintCheque.php =================================================================== --- trunk/PrintCheque.php 2011-09-21 07:32:16 UTC (rev 4698) +++ trunk/PrintCheque.php 2011-09-21 09:41:21 UTC (rev 4699) @@ -13,7 +13,7 @@ $PageNumber=1; $line_height=12; -$result = db_query("SELECT hundredsname FROM currencies WHERE currabrev='" . $_SESSION['PaymentDetail']->Currency . "'",$db); +$result = db_query("SELECT hundredsname, decimalplaces FROM currencies WHERE currabrev='" . $_SESSION['PaymentDetail']->Currency . "'",$db); If (DB_num_rows($result) == 0){ include ('includes/header.inc'); @@ -24,6 +24,7 @@ $CurrencyRow = db_fetch_row($result); $HundredsName = $CurrencyRow[0]; +$CurrDecimalPlaces = $CurrencyRow[1]; // cheque $YPos= $Page_Height-5*$line_height; @@ -34,7 +35,7 @@ $LeftOvers = $pdf->addTextWrap(75,$YPos,475,$FontSize,$AmountWords, 'left'); $YPos -= 1*$line_height; $LeftOvers = $pdf->addTextWrap($Page_Width-225,$YPos,100,$FontSize,$_SESSION['PaymentDetail']->DatePaid, 'left'); -$LeftOvers = $pdf->addTextWrap($Page_Width-75,$YPos,75,$FontSize,locale_number_format(round($_SESSION['PaymentDetail']->Amount,2),2), 'left'); +$LeftOvers = $pdf->addTextWrap($Page_Width-75,$YPos,75,$FontSize,locale_money_format($_SESSION['PaymentDetail']->Amount,$CurrDecimalPlaces), 'left'); $YPos -= 1*$line_height; $LeftOvers = $pdf->addTextWrap(75,$YPos,300,$FontSize,$_SESSION['PaymentDetail']->SuppName, 'left'); @@ -51,7 +52,7 @@ $YPos -= 2*$line_height; $LeftOvers = $pdf->addTextWrap(75,$YPos,300,$FontSize, $AmountWords, 'left'); -$LeftOvers = $pdf->addTextWrap(375,$YPos,100,$FontSize, locale_number_format($_SESSION['PaymentDetail']->Amount,2), 'right'); +$LeftOvers = $pdf->addTextWrap(375,$YPos,100,$FontSize, locale_money_format($_SESSION['PaymentDetail']->Amount,$CurrDecimalPlaces), 'right'); // remittance advice 1 @@ -66,7 +67,7 @@ $LeftOvers = $pdf->addTextWrap(25,$YPos,75,$FontSize,$_SESSION['PaymentDetail']->DatePaid, 'left'); $LeftOvers = $pdf->addTextWrap(100,$YPos,100,$FontSize,$_SESSION['PaymentDetail']->SupplierID, 'left'); $LeftOvers = $pdf->addTextWrap(250,$YPos,75,$FontSize,$_GET['ChequeNum'], 'left'); -$LeftOvers = $pdf->addTextWrap(350,$YPos,75,$FontSize,locale_number_format(round($_SESSION['PaymentDetail']->Amount,2),2), 'left'); +$LeftOvers = $pdf->addTextWrap(350,$YPos,75,$FontSize,locale_money_format($_SESSION['PaymentDetail']->Amount,$CurrDecimalPlaces), 'left'); // remittance advice 2 $YPos -= 15*$line_height; @@ -80,7 +81,7 @@ $LeftOvers = $pdf->addTextWrap(25,$YPos,75,$FontSize,$_SESSION['PaymentDetail']->DatePaid, 'left'); $LeftOvers = $pdf->addTextWrap(100,$YPos,100,$FontSize,$_SESSION['PaymentDetail']->SupplierID, 'left'); $LeftOvers = $pdf->addTextWrap(250,$YPos,75,$FontSize,$_GET['ChequeNum'], 'left'); -$LeftOvers = $pdf->addTextWrap(350,$YPos,75,$FontSize,locale_number_format(round($_SESSION['PaymentDetail']->Amount,2),2), 'left'); +$LeftOvers = $pdf->addTextWrap(350,$YPos,75,$FontSize,locale_money_format($_SESSION['PaymentDetail']->Amount,$CurrDecimalPlaces), 'left'); $pdf->OutputD($_SESSION['DatabaseName'] . '_Cheque_' . date('Y-m-d') . '_ChequeNum_' . $_GET['ChequeNum'] . '.pdf'); $pdf->__destruct(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dai...@us...> - 2011-09-21 09:41:28
|
Revision: 4699 http://web-erp.svn.sourceforge.net/web-erp/?rev=4699&view=rev Author: daintree Date: 2011-09-21 09:41:21 +0000 (Wed, 21 Sep 2011) Log Message: ----------- number_formats Modified Paths: -------------- trunk/PricesBasedOnMarkUp.php trunk/PricesByCost.php trunk/Prices_Customer.php trunk/PrintCheque.php Modified: trunk/PricesBasedOnMarkUp.php =================================================================== --- trunk/PricesBasedOnMarkUp.php 2011-09-21 07:32:16 UTC (rev 4698) +++ trunk/PricesBasedOnMarkUp.php 2011-09-21 09:41:21 UTC (rev 4699) @@ -1,9 +1,6 @@ <?php -/* $Revision: 1.9 $ */ /* $Id$*/ -//$PageSecurity=11; - include('includes/session.inc'); $title=_('Update Pricing'); include('includes/header.inc'); @@ -48,7 +45,7 @@ <td><select name="CurrCode">'; if (!isset($_POST['CurrCode'])){ - echo '<option selected value=0>' . _('No Price List Currency Selected'); + echo '<option selected value=0>' . _('No Price List Currency Selected') . '</option>'; } while ($Currencies=DB_fetch_array($result)){ @@ -94,7 +91,7 @@ echo '<option selected VALUE=0>' . _('No Price List Selected') . '</option>'; } while ($PriceLists=DB_fetch_array($PricesResult)){ - if (isset($_POST['BasePriceList']) and $_POST['BasePriceList']==$PriceLists['typeabbrev']){ + if (isset($_POST['BasePriceList']) AND $_POST['BasePriceList']==$PriceLists['typeabbrev']){ echo '<option selected value="' . $PriceLists['typeabbrev'] . '">' . $PriceLists['sales_type'] . '</option>'; } else { echo '<option value="' . $PriceLists['typeabbrev'] . '">' . $PriceLists['sales_type'] . '</option>'; @@ -161,10 +158,10 @@ } echo '<tr><td>' . _('Percentage Increase (positive) or decrease (negative)') . '</td> - <td><input type="text" name="IncreasePercent" class=number size=4 maxlength=4 VALUE="' . $_POST['IncreasePercent'] . '"></td></tr></table>'; + <td><input type="text" name="IncreasePercent" class="number" size="4" maxlength="4" value="' . $_POST['IncreasePercent'] . '"></td></tr></table>'; -echo '<p><div class="centre"><input type=submit name="UpdatePrices" VALUE="' . _('Update Prices') . '\' onclick="return confirm(\'' . _('Are you sure you wish to update or add all the prices according to the criteria selected?') . '\');"></div>'; +echo '<p><div class="centre"><input type="submit" name="UpdatePrices" value="' . _('Update Prices') . '\' onclick="return confirm(\'' . _('Are you sure you wish to update or add all the prices according to the criteria selected?') . '\');"></div>'; echo '</form>'; @@ -247,7 +244,7 @@ AND categoryid <='" . $_POST['StkCatTo'] . "'"; $PartsResult = DB_query($sql,$db); - $IncrementPercentage = $_POST['IncreasePercent']/100; + $IncrementPercentage = filter_number_format($_POST['IncreasePercent']/100); $CurrenciesResult = DB_query("SELECT rate FROM currencies WHERE currabrev='" . $_POST['CurrCode'] . "'",$db); $CurrencyRow = DB_fetch_row($CurrenciesResult); @@ -300,7 +297,7 @@ prnMsg(_('The cost for this item is not set up or is set up as less than or equal to zero - no price changes will be made based on zero cost items. The item concerned is:') . ' ' . $myrow['stockid'],'warn'); } } - + $_POST['RoundingFactor'] = filter_number_format($_POST['RoundingFactor']); if ($_POST['CostType']!='OtherPriceList'){ $RoundedPrice = round(($Cost * (1+ $IncrementPercentage) * $CurrencyRate+($_POST['RoundingFactor']/2))/$_POST['RoundingFactor']) * $_POST['RoundingFactor']; if ($RoundedPrice <=0){ @@ -315,15 +312,15 @@ if ($Cost > 0) { $CurrentPriceResult = DB_query("SELECT price, - startdate, - enddate - FROM prices - WHERE typeabbrev= '" . $_POST['PriceList'] . "' - AND debtorno ='' - AND currabrev='" . $_POST['CurrCode'] . "' - AND startdate <='" . Date('Y-m-d') . "' - AND (enddate>='" . Date('Y-m-d') . "' OR enddate='0000-00-00') - AND stockid='" . $myrow['stockid'] . "'",$db); + startdate, + enddate + FROM prices + WHERE typeabbrev= '" . $_POST['PriceList'] . "' + AND debtorno ='' + AND currabrev='" . $_POST['CurrCode'] . "' + AND startdate <='" . Date('Y-m-d') . "' + AND (enddate>='" . Date('Y-m-d') . "' OR enddate='0000-00-00') + AND stockid='" . $myrow['stockid'] . "'",$db); if (DB_num_rows($CurrentPriceResult)==1){ $DayPriorToNewPrice = DateAdd($_POST['PriceStartDate'],'d',-1); $CurrentPriceRow = DB_fetch_array($CurrentPriceResult); @@ -336,8 +333,8 @@ AND stockid='" . $myrow['stockid'] . "'"; $ErrMsg =_('Error updating prices for') . ' ' . $myrow['stockid'] . ' ' . _('because'); $result = DB_query($UpdateSQL,$db,$ErrMsg); - - } + + } $sql = "INSERT INTO prices (stockid, typeabbrev, currabrev, @@ -349,11 +346,11 @@ '" . $_POST['CurrCode'] . "', '" . FormatDateForSQL($_POST['PriceStartDate']) . "', '" . $SQLEndDate . "', - '" . $RoundedPrice . "')"; + '" . filter_number_format($RoundedPrice) . "')"; $ErrMsg =_('Error inserting new price for') . ' ' . $myrow['stockid'] . ' ' . _('because'); $result = DB_query($sql,$db,$ErrMsg); prnMsg(_('Inserting new price for') . ' ' . $myrow['stockid'] . ' ' . _('to') . ' ' . $RoundedPrice,'info'); - + }// end if cost > 0 }//end while loop around items in the category } Modified: trunk/PricesByCost.php =================================================================== --- trunk/PricesByCost.php 2011-09-21 07:32:16 UTC (rev 4698) +++ trunk/PricesByCost.php 2011-09-21 09:41:21 UTC (rev 4699) @@ -27,20 +27,20 @@ prices.debtorno, prices.branchcode, (stockmaster.materialcost + stockmaster.labourcost + stockmaster.overheadcost) as cost, - prices.price as price, - prices.debtorno AS customer, + prices.price as price, + prices.debtorno AS customer, prices.branchcode AS branch, prices.startdate, prices.enddate, currencies.decimalplaces, currencies.rate - FROM stockmaster INNER JOIN prices + FROM stockmaster INNER JOIN prices ON stockmaster.stockid=prices.stockid - INNER JOIN currencies + INNER JOIN currencies ON prices.currabrev=currencies.currabrev - WHERE stockmaster.discontinued = 0 + WHERE stockmaster.discontinued = 0 " . $Category . " - AND prices.price" . $Comparator . "(stockmaster.materialcost + stockmaster.labourcost + stockmaster.overheadcost) * '" . $_POST['Margin'] . "' + AND prices.price" . $Comparator . "(stockmaster.materialcost + stockmaster.labourcost + stockmaster.overheadcost) * '" . filter_number_format($_POST['Margin']) . "' AND prices.typeabbrev ='" . $_POST['SalesType'] . "' AND prices.currabrev ='" . $_POST['CurrCode'] . "' AND (prices.enddate>='" . Date('Y-m-d') . "' OR prices.enddate='0000-00-00')"; @@ -53,7 +53,7 @@ while ($myrow = DB_fetch_array($result)) { /*The logic here goes like this: * 1. If the price at the same start and end date already exists then do nowt!! - * 2. If not then check if a price with the start date of today already exists - then we should be updating it + * 2. If not then check if a price with the start date of today already exists - then we should be updating it * 3. If not either of the above then insert the new price */ $SQLTestExists = "SELECT price FROM prices @@ -62,13 +62,13 @@ AND prices.currabrev ='" . $_POST['CurrCode'] . "' AND prices.debtorno ='" . $_POST['DebtorNo_' . $PriceCounter] . "' AND prices.branchcode ='" . $_POST['BranchCode_' . $PriceCounter] . "' - AND prices.startdate ='" . $_POST['StartDate_' . $PriceCounter] . "' + AND prices.startdate ='" . $_POST['StartDate_' . $PriceCounter] . "' AND prices.enddate ='" . $_POST['EndDate_' . $PriceCounter] . "' - AND prices.price ='" . $_POST['Price_' . $PriceCounter] . "'"; + AND prices.price ='" . filter_number_format($_POST['Price_' . $PriceCounter]) . "'"; $TestExistsResult = DB_query($SQLTestExists,$db); if (DB_num_rows($TestExistsResult)==0){ //the price doesn't currently exist //now check to see if a new price has already been created from start date of today - + $SQLTestExists = "SELECT price FROM prices WHERE stockid = '" . $_POST['StockID_' . $PriceCounter] . "' AND prices.typeabbrev ='" . $_POST['SalesType'] . "' @@ -79,7 +79,7 @@ $TestExistsResult = DB_query($SQLTestExists,$db); if (DB_num_rows($TestExistsResult)==1){ //then we are updating - $SQLUpdate = "UPDATE prices SET price = '" . $_POST['Price_' . $PriceCounter] . "' + $SQLUpdate = "UPDATE prices SET price = '" . filter_number_format($_POST['Price_' . $PriceCounter]) . "' WHERE stockid = '" . $_POST['StockID_' . $PriceCounter] . "' AND prices.typeabbrev ='" . $_POST['SalesType'] . "' AND prices.currabrev ='" . $_POST['CurrCode'] . "' @@ -109,7 +109,7 @@ startdate ) VALUES ( '" . $_POST['StockID_' . $PriceCounter] . "', - '" . $_POST['Price_' . $PriceCounter] . "', + '" . filter_number_format($_POST['Price_' . $PriceCounter]) . "', '" . $_POST['SalesType'] . "', '" . $_POST['CurrCode'] . "', '" . $_POST['DebtorNo_' . $PriceCounter] . "', @@ -163,7 +163,7 @@ echo '<form action="' .$_SERVER['PHP_SELF'] .'" method="POST" name="update">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; echo'<input type="hidden" value=' . $_POST['StockCat'] . ' name="StockCat"> - <input type="hidden" value=' . $_POST['Margin'] . ' name="Margin"> + <input type="hidden" value=' . filter_number_format($_POST['Margin']) . ' name="Margin"> <input type="hidden" value=' . $_POST['CurrCode'] . ' name="CurrCode"> <input type="hidden" value=' . $_POST['Comparator'] . ' name="Comparator"> <input type="hidden" value=' . $_POST['SalesType'] . ' name="SalesType">'; @@ -186,11 +186,11 @@ } /*end of else Cost */ //variables for update - echo '<input type="hidden" value=' . $myrow['stockid'] . ' name="StockID_' . $PriceCounter .'"> - <input type="hidden" value=' . $myrow['debtorno'] . ' name="DebtorNo_' . $PriceCounter .'"> - <input type="hidden" value=' . $myrow['branchcode'] . ' name="BranchCode_' . $PriceCounter .'"> - <input type="hidden" value=' . $myrow['startdate'] . ' name="StartDate_' . $PriceCounter .'"> - <input type="hidden" value=' . $myrow['enddate'] . ' name="EndDate_' . $PriceCounter .'">'; + echo '<input type="hidden" value=' . $myrow['stockid'] . ' name="StockID_' . $PriceCounter .'" /> + <input type="hidden" value=' . $myrow['debtorno'] . ' name="DebtorNo_' . $PriceCounter .'" /> + <input type="hidden" value=' . $myrow['branchcode'] . ' name="BranchCode_' . $PriceCounter .'" /> + <input type="hidden" value=' . $myrow['startdate'] . ' name="StartDate_' . $PriceCounter .'" /> + <input type="hidden" value=' . $myrow['enddate'] . ' name="EndDate_' . $PriceCounter .'" />'; //variable for current margin if ($myrow['price'] != 0){ $CurrentGP = (($myrow['price']/$myrow['rate'])-$Cost)*100 / ($myrow['price']/$myrow['rate']); @@ -198,7 +198,7 @@ $CurrentGP = 0; } //variable for proposed - $ProposedPrice = $Cost * $_POST['Margin']; + $ProposedPrice = $Cost * filter_number_format($_POST['Margin']); if ($myrow['enddate']=='0000-00-00'){ $EndDateDisplay = _('No End Date'); } else { @@ -210,10 +210,10 @@ <td>' . $myrow['branch'] . '</td> <td>' . ConvertSQLDate($myrow['startdate']) . '</td> <td>' . $EndDateDisplay . '</td> - <td class="number">' . locale_number_format($Cost, $_SESSION['CompanyRecord']['decimalplaces']) . '</td> + <td class="number">' . locale_money_format($Cost, $_SESSION['CompanyRecord']['decimalplaces']) . '</td> <td class="number">' . locale_number_format($CurrentGP, 1) . '%</td> - <td class="number">' . locale_number_format($ProposedPrice, $myrow['decimalplaces']) . '</td> - <td><input type="text" class="number" name="Price_' . $PriceCounter . '" maxlength=14 size=10 value="' . $myrow['price'] . '"></td> + <td class="number">' . locale_money_format($ProposedPrice, $myrow['decimalplaces']) . '</td> + <td><input type="text" class="number" name="Price_' . $PriceCounter . '" maxlength=14 size=10 value="' . locale_money_format($myrow['price'],$myrow['decimalplaces']) . '"></td> </tr> '; $PriceCounter++; } //end of looping @@ -254,7 +254,7 @@ if (!isset($_POST['Margin'])){ $_POST['Margin']=1; } - echo '<td><input type="text" class="number" name="Margin" MAXLENGTH =8 size=8 value=' .$_POST['Margin'] . '></td></tr>'; + echo '<td><input type="text" class="number" name="Margin" maxlength="8" size="8" value=' .$_POST['Margin'] . '></td></tr>'; $result = DB_query("SELECT typeabbrev, sales_type FROM salestypes", $db); echo '<tr><td>' . _('Sales Type') . '/' . _('Price List') . ':</td> <td><select name="SalesType">'; Modified: trunk/Prices_Customer.php =================================================================== --- trunk/Prices_Customer.php 2011-09-21 07:32:16 UTC (rev 4698) +++ trunk/Prices_Customer.php 2011-09-21 09:41:21 UTC (rev 4699) @@ -70,7 +70,7 @@ //first off validate inputs sensible - if (!is_double((double) trim($_POST['Price'])) OR $_POST['Price']=="") { + if (!is_numeric(filter_number_format($_POST['Price'])) OR $_POST['Price']=='') { $InputError = 1; $msg = _('The price entered must be numeric'); } @@ -105,13 +105,13 @@ $msg = _('The end date is expected to be after today. There is no point entering a new price where the effective date is before today!'); } - if ((isset($_POST['Editing']) and $_POST['Editing']=='Yes') AND mb_strlen($Item)>1 AND $InputError !=1) { + if ((isset($_POST['Editing']) AND $_POST['Editing']=='Yes') AND mb_strlen($Item)>1 AND $InputError !=1) { //editing an existing price $sql = "UPDATE prices SET typeabbrev='" . $SalesType . "', currabrev='" . $CurrCode . "', - price='" . $_POST['Price'] . "', + price='" . filter_number_format($_POST['Price']) . "', branchcode='" . $_POST['Branch'] . "', startdate='" . FormatDateForSQL($_POST['StartDate']) . "', enddate='" . FormatDateForSQL($_POST['EndDate']) . "' @@ -138,7 +138,7 @@ '".$SalesType."', '".$CurrCode."', '" . $_SESSION['CustomerID'] . "', - '" . $_POST['Price'] . "', + '" . filter_number_format($_POST['Price']) . "', '" . $_POST['Branch'] . "', '" . FormatDateForSQL($_POST['StartDate']) . "', '" . FormatDateForSQL($_POST['EndDate']) . "' @@ -294,7 +294,7 @@ echo '<input type=hidden name="Editing" value="Yes">'; echo '<input type=hidden name="OldStartDate" value="' . $_GET['StartDate'] .'">'; echo '<input type=hidden name="OldEndDate" value="' . $_GET['EndDate'] . '">'; - $_POST['Price']=$_GET['Price']; + $_POST['Price']=filter_number_format($_GET['Price']); $_POST['Branch']=$_GET['Branch']; $_POST['StartDate'] = ConvertSQLDate($_GET['StartDate']); if (Is_Date($_GET['EndDate'])){ Modified: trunk/PrintCheque.php =================================================================== --- trunk/PrintCheque.php 2011-09-21 07:32:16 UTC (rev 4698) +++ trunk/PrintCheque.php 2011-09-21 09:41:21 UTC (rev 4699) @@ -13,7 +13,7 @@ $PageNumber=1; $line_height=12; -$result = db_query("SELECT hundredsname FROM currencies WHERE currabrev='" . $_SESSION['PaymentDetail']->Currency . "'",$db); +$result = db_query("SELECT hundredsname, decimalplaces FROM currencies WHERE currabrev='" . $_SESSION['PaymentDetail']->Currency . "'",$db); If (DB_num_rows($result) == 0){ include ('includes/header.inc'); @@ -24,6 +24,7 @@ $CurrencyRow = db_fetch_row($result); $HundredsName = $CurrencyRow[0]; +$CurrDecimalPlaces = $CurrencyRow[1]; // cheque $YPos= $Page_Height-5*$line_height; @@ -34,7 +35,7 @@ $LeftOvers = $pdf->addTextWrap(75,$YPos,475,$FontSize,$AmountWords, 'left'); $YPos -= 1*$line_height; $LeftOvers = $pdf->addTextWrap($Page_Width-225,$YPos,100,$FontSize,$_SESSION['PaymentDetail']->DatePaid, 'left'); -$LeftOvers = $pdf->addTextWrap($Page_Width-75,$YPos,75,$FontSize,locale_number_format(round($_SESSION['PaymentDetail']->Amount,2),2), 'left'); +$LeftOvers = $pdf->addTextWrap($Page_Width-75,$YPos,75,$FontSize,locale_money_format($_SESSION['PaymentDetail']->Amount,$CurrDecimalPlaces), 'left'); $YPos -= 1*$line_height; $LeftOvers = $pdf->addTextWrap(75,$YPos,300,$FontSize,$_SESSION['PaymentDetail']->SuppName, 'left'); @@ -51,7 +52,7 @@ $YPos -= 2*$line_height; $LeftOvers = $pdf->addTextWrap(75,$YPos,300,$FontSize, $AmountWords, 'left'); -$LeftOvers = $pdf->addTextWrap(375,$YPos,100,$FontSize, locale_number_format($_SESSION['PaymentDetail']->Amount,2), 'right'); +$LeftOvers = $pdf->addTextWrap(375,$YPos,100,$FontSize, locale_money_format($_SESSION['PaymentDetail']->Amount,$CurrDecimalPlaces), 'right'); // remittance advice 1 @@ -66,7 +67,7 @@ $LeftOvers = $pdf->addTextWrap(25,$YPos,75,$FontSize,$_SESSION['PaymentDetail']->DatePaid, 'left'); $LeftOvers = $pdf->addTextWrap(100,$YPos,100,$FontSize,$_SESSION['PaymentDetail']->SupplierID, 'left'); $LeftOvers = $pdf->addTextWrap(250,$YPos,75,$FontSize,$_GET['ChequeNum'], 'left'); -$LeftOvers = $pdf->addTextWrap(350,$YPos,75,$FontSize,locale_number_format(round($_SESSION['PaymentDetail']->Amount,2),2), 'left'); +$LeftOvers = $pdf->addTextWrap(350,$YPos,75,$FontSize,locale_money_format($_SESSION['PaymentDetail']->Amount,$CurrDecimalPlaces), 'left'); // remittance advice 2 $YPos -= 15*$line_height; @@ -80,7 +81,7 @@ $LeftOvers = $pdf->addTextWrap(25,$YPos,75,$FontSize,$_SESSION['PaymentDetail']->DatePaid, 'left'); $LeftOvers = $pdf->addTextWrap(100,$YPos,100,$FontSize,$_SESSION['PaymentDetail']->SupplierID, 'left'); $LeftOvers = $pdf->addTextWrap(250,$YPos,75,$FontSize,$_GET['ChequeNum'], 'left'); -$LeftOvers = $pdf->addTextWrap(350,$YPos,75,$FontSize,locale_number_format(round($_SESSION['PaymentDetail']->Amount,2),2), 'left'); +$LeftOvers = $pdf->addTextWrap(350,$YPos,75,$FontSize,locale_money_format($_SESSION['PaymentDetail']->Amount,$CurrDecimalPlaces), 'left'); $pdf->OutputD($_SESSION['DatabaseName'] . '_Cheque_' . date('Y-m-d') . '_ChequeNum_' . $_GET['ChequeNum'] . '.pdf'); $pdf->__destruct(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dai...@us...> - 2011-09-22 10:09:26
|
Revision: 4702 http://web-erp.svn.sourceforge.net/web-erp/?rev=4702&view=rev Author: daintree Date: 2011-09-22 10:09:20 +0000 (Thu, 22 Sep 2011) Log Message: ----------- number_formats Modified Paths: -------------- trunk/GLAccountReport.php trunk/includes/LanguageSetup.php trunk/includes/MiscFunctions.php Modified: trunk/GLAccountReport.php =================================================================== --- trunk/GLAccountReport.php 2011-09-22 02:33:04 UTC (rev 4701) +++ trunk/GLAccountReport.php 2011-09-22 10:09:20 UTC (rev 4702) @@ -121,9 +121,9 @@ $LeftOvers = $pdf->addTextWrap($Left_Margin,$YPos,150,$FontSize, _('Brought Forward Balance')); if ($RunningTotal < 0 ){ //its a credit balance b/fwd - $LeftOvers = $pdf->addTextWrap(210,$YPos,50,$FontSize, locale_money_format(-$RunningTotal,2) , 'right'); + $LeftOvers = $pdf->addTextWrap(210,$YPos,50,$FontSize, locale_money_format(-$RunningTotal,$_SESSION['CompanyRecord']['decimalplaces']) , 'right'); } else { //its a debit balance b/fwd - $LeftOvers = $pdf->addTextWrap(160,$YPos,50,$FontSize, locale_money_format($RunningTotal,2) , 'right'); + $LeftOvers = $pdf->addTextWrap(160,$YPos,50,$FontSize, locale_money_format($RunningTotal,$_SESSION['CompanyRecord']['decimalplaces']) , 'right'); } } $PeriodTotal = 0; Modified: trunk/includes/LanguageSetup.php =================================================================== --- trunk/includes/LanguageSetup.php 2011-09-22 02:33:04 UTC (rev 4701) +++ trunk/includes/LanguageSetup.php 2011-09-22 10:09:20 UTC (rev 4702) @@ -66,14 +66,17 @@ if (defined('LC_MESSAGES')){ //it's a unix/linux server $LocaleSet = setlocale (LC_MESSAGES, $_SESSION['Language']); - $LocaleSet = setlocale (LC_NUMERIC, $_SESSION['Language']); + $LocaleSet = setlocale (LC_ALL, $_SESSION['Language']); } else { // it's a windows server $LocaleSet = setlocale (LC_ALL, $LanguagesArray[$_SESSION['Language']]['WindowsLocale']); } -//$LocaleSet = setlocale (LC_NUMERIC, 'nl_NL.utf8'); +//$LocaleSet = setlocale (LC_NUMERIC, 'fr_FR.utf8','fr_FR'); $LocaleInfo = localeconv(); +//echo '<br/>Thousands separator = ' . strlen($LocaleInfo['thousands_sep']); +//echo '<br/>Mon Thousands separator = ' . strlen($LocaleInfo['mon_thousands_sep']); + if ($LocaleInfo['mon_decimal_point']==''){ $LocaleInfo['mon_decimal_point']= $LocaleInfo['decimal_point']; } Modified: trunk/includes/MiscFunctions.php =================================================================== --- trunk/includes/MiscFunctions.php 2011-09-22 02:33:04 UTC (rev 4701) +++ trunk/includes/MiscFunctions.php 2011-09-22 10:09:20 UTC (rev 4702) @@ -329,6 +329,6 @@ function filter_number_format($Number) { global $LocaleInfo; $Number = trim($Number); - return str_replace($LocaleInfo['decimal_point'],'.',str_replace($LocaleInfo['thousands_sep'],'',$Number)); + return str_replace($LocaleInfo['decimal_point'],'.',str_replace($LocaleInfo['thousands_sep'],'',str_replace($LocaleInfo['mon_thousands_sep'],'',$Number))); } ?> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dai...@us...> - 2011-09-22 10:09:26
|
Revision: 4702 http://web-erp.svn.sourceforge.net/web-erp/?rev=4702&view=rev Author: daintree Date: 2011-09-22 10:09:20 +0000 (Thu, 22 Sep 2011) Log Message: ----------- number_formats Modified Paths: -------------- trunk/GLAccountReport.php trunk/includes/LanguageSetup.php trunk/includes/MiscFunctions.php Modified: trunk/GLAccountReport.php =================================================================== --- trunk/GLAccountReport.php 2011-09-22 02:33:04 UTC (rev 4701) +++ trunk/GLAccountReport.php 2011-09-22 10:09:20 UTC (rev 4702) @@ -121,9 +121,9 @@ $LeftOvers = $pdf->addTextWrap($Left_Margin,$YPos,150,$FontSize, _('Brought Forward Balance')); if ($RunningTotal < 0 ){ //its a credit balance b/fwd - $LeftOvers = $pdf->addTextWrap(210,$YPos,50,$FontSize, locale_money_format(-$RunningTotal,2) , 'right'); + $LeftOvers = $pdf->addTextWrap(210,$YPos,50,$FontSize, locale_money_format(-$RunningTotal,$_SESSION['CompanyRecord']['decimalplaces']) , 'right'); } else { //its a debit balance b/fwd - $LeftOvers = $pdf->addTextWrap(160,$YPos,50,$FontSize, locale_money_format($RunningTotal,2) , 'right'); + $LeftOvers = $pdf->addTextWrap(160,$YPos,50,$FontSize, locale_money_format($RunningTotal,$_SESSION['CompanyRecord']['decimalplaces']) , 'right'); } } $PeriodTotal = 0; Modified: trunk/includes/LanguageSetup.php =================================================================== --- trunk/includes/LanguageSetup.php 2011-09-22 02:33:04 UTC (rev 4701) +++ trunk/includes/LanguageSetup.php 2011-09-22 10:09:20 UTC (rev 4702) @@ -66,14 +66,17 @@ if (defined('LC_MESSAGES')){ //it's a unix/linux server $LocaleSet = setlocale (LC_MESSAGES, $_SESSION['Language']); - $LocaleSet = setlocale (LC_NUMERIC, $_SESSION['Language']); + $LocaleSet = setlocale (LC_ALL, $_SESSION['Language']); } else { // it's a windows server $LocaleSet = setlocale (LC_ALL, $LanguagesArray[$_SESSION['Language']]['WindowsLocale']); } -//$LocaleSet = setlocale (LC_NUMERIC, 'nl_NL.utf8'); +//$LocaleSet = setlocale (LC_NUMERIC, 'fr_FR.utf8','fr_FR'); $LocaleInfo = localeconv(); +//echo '<br/>Thousands separator = ' . strlen($LocaleInfo['thousands_sep']); +//echo '<br/>Mon Thousands separator = ' . strlen($LocaleInfo['mon_thousands_sep']); + if ($LocaleInfo['mon_decimal_point']==''){ $LocaleInfo['mon_decimal_point']= $LocaleInfo['decimal_point']; } Modified: trunk/includes/MiscFunctions.php =================================================================== --- trunk/includes/MiscFunctions.php 2011-09-22 02:33:04 UTC (rev 4701) +++ trunk/includes/MiscFunctions.php 2011-09-22 10:09:20 UTC (rev 4702) @@ -329,6 +329,6 @@ function filter_number_format($Number) { global $LocaleInfo; $Number = trim($Number); - return str_replace($LocaleInfo['decimal_point'],'.',str_replace($LocaleInfo['thousands_sep'],'',$Number)); + return str_replace($LocaleInfo['decimal_point'],'.',str_replace($LocaleInfo['thousands_sep'],'',str_replace($LocaleInfo['mon_thousands_sep'],'',$Number))); } ?> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dai...@us...> - 2011-09-24 07:39:44
|
Revision: 4704 http://web-erp.svn.sourceforge.net/web-erp/?rev=4704&view=rev Author: daintree Date: 2011-09-24 07:39:35 +0000 (Sat, 24 Sep 2011) Log Message: ----------- number_formats Modified Paths: -------------- trunk/PrintCustOrder.php trunk/PrintCustOrder_generic.php trunk/PrintCustStatements.php trunk/PrintCustTransPortrait.php trunk/PurchData.php trunk/RecurringSalesOrders.php trunk/RecurringSalesOrdersProcess.php trunk/ReorderLevel.php trunk/ReorderLevelLocation.php trunk/ReverseGRN.php trunk/includes/LanguageSetup.php Removed Paths: ------------- trunk/ReportBug.php Modified: trunk/PrintCustOrder.php =================================================================== --- trunk/PrintCustOrder.php 2011-09-23 09:13:29 UTC (rev 4703) +++ trunk/PrintCustOrder.php 2011-09-24 07:39:35 UTC (rev 4704) @@ -2,8 +2,6 @@ /* $Id$ */ -//$PageSecurity = 2; - include('includes/session.inc'); include('includes/class.pdf.php'); include('includes/SQL_CommonFunctions.inc'); @@ -25,51 +23,51 @@ /*retrieve the order details from the database to print */ $ErrMsg = _('There was a problem retrieving the order header details for Order Number') . ' ' . $_GET['TransNo'] . ' ' . _('from the database'); $sql = "SELECT salesorders.customerref, - salesorders.comments, - salesorders.orddate, - salesorders.deliverto, - salesorders.deladd1, - salesorders.deladd2, - salesorders.deladd3, - salesorders.deladd4, - salesorders.deladd5, - salesorders.deladd6, - salesorders.debtorno, - salesorders.branchcode, - salesorders.deliverydate, - debtorsmaster.name, - debtorsmaster.address1, - debtorsmaster.address2, - debtorsmaster.address3, - debtorsmaster.address4, - debtorsmaster.address5, - debtorsmaster.address6, - shippers.shippername, - salesorders.printedpackingslip, - salesorders.datepackingslipprinted, - locations.locationname - FROM salesorders INNER JOIN debtorsmaster - ON salesorders.debtorno=debtorsmaster.debtorno - INNER JOIN shippers - ON salesorders.shipvia=shippers.shipper_id - INNER JOIN locations - ON salesorders.fromstkloc=locations.loccode - WHERE salesorders.orderno='" . $_GET['TransNo']. "'"; + salesorders.comments, + salesorders.orddate, + salesorders.deliverto, + salesorders.deladd1, + salesorders.deladd2, + salesorders.deladd3, + salesorders.deladd4, + salesorders.deladd5, + salesorders.deladd6, + salesorders.debtorno, + salesorders.branchcode, + salesorders.deliverydate, + debtorsmaster.name, + debtorsmaster.address1, + debtorsmaster.address2, + debtorsmaster.address3, + debtorsmaster.address4, + debtorsmaster.address5, + debtorsmaster.address6, + shippers.shippername, + salesorders.printedpackingslip, + salesorders.datepackingslipprinted, + locations.locationname + FROM salesorders INNER JOIN debtorsmaster + ON salesorders.debtorno=debtorsmaster.debtorno + INNER JOIN shippers + ON salesorders.shipvia=shippers.shipper_id + INNER JOIN locations + ON salesorders.fromstkloc=locations.loccode + WHERE salesorders.orderno='" . filter_number_format($_GET['TransNo']). "'"; $result=DB_query($sql,$db, $ErrMsg); //If there are no rows, there's a problem. if (DB_num_rows($result)==0){ -/* Javier */ $ListCount = 0; + $ListCount = 0; $title = _('Print Packing Slip Error'); include('includes/header.inc'); echo '<div class=centre><br /><br /><br />'; prnMsg( _('Unable to Locate Order Number') . ' : ' . $_GET['TransNo'] . ' ', 'error'); echo '<br /><br /><br /><table class="table_index"><tr><td class="menu_group_item"> - <LI><a href="'. $rootpath . '/SelectSalesOrder.php?'. SID .'">' . _('Outstanding Sales Orders') . '</a></LI> - <LI><a href="'. $rootpath . '/SelectCompletedOrder.php?'. SID .'">' . _('Completed Sales Orders') . '</a></LI> + <li><a href="'. $rootpath . '/SelectSalesOrder.php">' . _('Outstanding Sales Orders') . '</a></li> + <li><a href="'. $rootpath . '/SelectCompletedOrder.php">' . _('Completed Sales Orders') . '</a></li> </td></tr></table></div><br /><br /><br />'; include('includes/footer.inc'); exit(); @@ -85,16 +83,24 @@ prnMsg( _('The packing slip for order number') . ' ' . $_GET['TransNo'] . ' ' . _('has previously been printed') . '. ' . _('It was printed on'). ' ' . ConvertSQLDate($myrow['datepackingslipprinted']) . '<br />' . _('This check is there to ensure that duplicate packing slips are not produced and dispatched more than once to the customer'), 'warn' ); - echo '<p><a href="' . $rootpath . '/PrintCustOrder.php?' . SID . 'TransNo=' . $_GET['TransNo'] . '&Reprint=OK">' + echo '<p><a href="' . $rootpath . '/PrintCustOrder.php?TransNo=' . $_GET['TransNo'] . '&Reprint=OK">' . _('Do a Re-Print') . ' (' . _('On Pre-Printed Stationery') . ') ' . _('Even Though Previously Printed') . '</a><p>' . - '<a href="' . $rootpath. '/PrintCustOrder_generic.php?' . SID . 'TransNo=' . $_GET['TransNo'] . '&Reprint=OK">'. _('Do a Re-Print') . ' (' . _('Plain paper') . ' - ' . _('A4') . ' ' . _('landscape') . ') ' . _('Even Though Previously Printed'). '</a>'; + '<a href="' . $rootpath. '/PrintCustOrder_generic.php?TransNo=' . $_GET['TransNo'] . '&Reprint=OK">'. _('Do a Re-Print') . ' (' . _('Plain paper') . ' - ' . _('A4') . ' ' . _('landscape') . ') ' . _('Even Though Previously Printed'). '</a>'; echo '<br /><br /><br />'; echo _('Or select another Order Number to Print'); - echo '<table class="table_index"><tr><td class="menu_group_item"> - <li><a href="'. $rootpath . '/SelectSalesOrder.php?'. SID .'">' . _('Outstanding Sales Orders') . '</a></li> - <li><a href="'. $rootpath . '/SelectCompletedOrder.php?'. SID .'">' . _('Completed Sales Orders') . '</a></li> - </td></tr></table></div><br /><br /><br />'; + echo '<table class="table_index"> + <tr> + <td class="menu_group_item"> + <li><a href="'. $rootpath . '/SelectSalesOrder.php">' . _('Outstanding Sales Orders') . '</a></li> + <li><a href="'. $rootpath . '/SelectCompletedOrder.php">' . _('Completed Sales Orders') . '</a></li> + </td> + </tr> + </table> + </div> + <br /> + <br /> + <br />'; include('includes/footer.inc'); exit; @@ -109,13 +115,14 @@ $PageNumber = 1; $ErrMsg = _('There was a problem retrieving the details for Order Number') . ' ' . $_GET['TransNo'] . ' ' . _('from the database'); $sql = "SELECT salesorderdetails.stkcode, - stockmaster.description, - salesorderdetails.quantity, - salesorderdetails.qtyinvoiced, - salesorderdetails.unitprice - FROM salesorderdetails INNER JOIN stockmaster - ON salesorderdetails.stkcode=stockmaster.stockid - WHERE salesorderdetails.orderno='" . $_GET['TransNo'] . "'"; + stockmaster.description, + salesorderdetails.quantity, + salesorderdetails.qtyinvoiced, + salesorderdetails.unitprice, + stockmaster.decimalplaces + FROM salesorderdetails INNER JOIN stockmaster + ON salesorderdetails.stkcode=stockmaster.stockid + WHERE salesorderdetails.orderno='" . filter_number_format($_GET['TransNo']) . "'"; $result=DB_query($sql, $db, $ErrMsg); if (DB_num_rows($result)>0){ @@ -162,9 +169,9 @@ while ($myrow2=DB_fetch_array($result)){ - $DisplayQty = locale_number_format($myrow2['quantity'],2); - $DisplayPrevDel = locale_number_format($myrow2['qtyinvoiced'],2); - $DisplayQtySupplied = locale_number_format($myrow2['quantity'] - $myrow2['qtyinvoiced'],2); + $DisplayQty = locale_number_format($myrow2['quantity'],$myrow2['decimalplaces']); + $DisplayPrevDel = locale_number_format($myrow2['qtyinvoiced'],$myrow2['decimalplaces']); + $DisplayQtySupplied = locale_number_format($myrow2['quantity'] - $myrow2['qtyinvoiced'],$myrow2['decimalplaces']); $LeftOvers = $pdf->addTextWrap(13,$YPos,135,$FontSize,$myrow2['stkcode']); $LeftOvers = $pdf->addTextWrap(148,$YPos,239,$FontSize,$myrow2['description']); @@ -188,14 +195,16 @@ $pdf->OutputD($_SESSION['DatabaseName'] . '_Customer_Order_' . $_GET['TransNo'] . '_' . Date('Y-m-d') .'.pdf'); $pdf-> __destruct(); - $sql = "UPDATE salesorders SET printedpackingslip=1, datepackingslipprinted='" . Date('Y-m-d') . "' WHERE salesorders.orderno='" .$_GET['TransNo'] . "'"; + $sql = "UPDATE salesorders SET printedpackingslip=1, + datepackingslipprinted='" . Date('Y-m-d') . "' + WHERE salesorders.orderno='" .filter_number_format($_GET['TransNo']) . "'"; $result = DB_query($sql,$db); } else { $title = _('Print Packing Slip Error'); include('includes/header.inc'); echo '<p>'. _('There were no outstanding items on the order to deliver. A dispatch note cannot be printed'). - '<br /><a href="' . $rootpath . '/SelectSalesOrder.php?' . SID . '">'. _('Print Another Packing Slip/Order'). - '</a>' . '<br />'. '<a href="' . $rootpath . '/index.php?' . SID . '">' . _('Back to the menu') . '</a>'; + '<br /><a href="' . $rootpath . '/SelectSalesOrder.php">'. _('Print Another Packing Slip/Order'). + '</a>' . '<br />'. '<a href="' . $rootpath . '/index.php">' . _('Back to the menu') . '</a>'; include('includes/footer.inc'); exit; } /*end if there are order details to show on the order*/ Modified: trunk/PrintCustOrder_generic.php =================================================================== --- trunk/PrintCustOrder_generic.php 2011-09-23 09:13:29 UTC (rev 4703) +++ trunk/PrintCustOrder_generic.php 2011-09-24 07:39:35 UTC (rev 4704) @@ -11,7 +11,7 @@ If (!isset($_GET['TransNo']) OR $_GET['TransNo']==""){ $title = _('Select Order To Print'); include('includes/header.inc'); - echo '<div class=centre><br /><br /><br />'; + echo '<div class="centre"><br /><br /><br />'; prnMsg( _('Select an Order Number to Print before calling this page') , 'error'); echo '<br /> <br /> @@ -65,7 +65,7 @@ WHERE salesorders.debtorno=debtorsmaster.debtorno AND salesorders.shipvia=shippers.shipper_id AND salesorders.fromstkloc=locations.loccode - AND salesorders.orderno='" . $_GET['TransNo'] . "'"; + AND salesorders.orderno='" . filter_number_format($_GET['TransNo']) . "'"; $result=DB_query($sql,$db, $ErrMsg); @@ -166,7 +166,7 @@ stockmaster.decimalplaces FROM salesorderdetails INNER JOIN stockmaster ON salesorderdetails.stkcode=stockmaster.stockid - WHERE salesorderdetails.orderno='" . $_GET['TransNo'] . "'"; + WHERE salesorderdetails.orderno='" . filter_number_format($_GET['TransNo']) . "'"; $result=DB_query($sql,$db, $ErrMsg); if (DB_num_rows($result)>0){ @@ -248,7 +248,7 @@ $pdf->__destruct(); $sql = "UPDATE salesorders SET printedpackingslip=1, datepackingslipprinted='" . Date('Y-m-d') . "' - WHERE salesorders.orderno='" .$_GET['TransNo'] . "'"; + WHERE salesorders.orderno='" . filter_number_format($_GET['TransNo']) . "'"; $result = DB_query($sql,$db); } Modified: trunk/PrintCustStatements.php =================================================================== --- trunk/PrintCustStatements.php 2011-09-23 09:13:29 UTC (rev 4703) +++ trunk/PrintCustStatements.php 2011-09-24 07:39:35 UTC (rev 4704) @@ -23,16 +23,14 @@ } if (isset($_GET['FromCust'])) { - $getFrom = $_GET['FromCust']; - $_POST['FromCust'] = $getFrom; + $_POST['FromCust'] = $_GET['FromCust']; } if (isset($_GET['ToCust'])) { - $getTo = $_GET['ToCust']; - $_POST['ToCust'] = $getTo; + $_POST['ToCust'] = $_GET['ToCust']; } -If (isset($_POST['PrintPDF']) && isset($_POST['FromCust']) && $_POST['FromCust']!=''){ +If (isset($_POST['PrintPDF']) AND isset($_POST['FromCust']) AND $_POST['FromCust']!=''){ $_POST['FromCust'] = mb_strtoupper($_POST['FromCust']); If (!isset($_POST['ToCust'])){ @@ -68,6 +66,7 @@ debtorsmaster.lastpaid, debtorsmaster.lastpaiddate, currencies.currency, + currencies.decimalplaces AS currdecimalplaces, paymentterms.terms FROM debtorsmaster INNER JOIN currencies ON debtorsmaster.currcode=currencies.currabrev @@ -163,8 +162,8 @@ while ($myrow=DB_fetch_array($SetldTrans)){ - $DisplayAlloc = locale_number_format($myrow['alloc'],2); - $DisplayOutstanding = locale_number_format($myrow['ostdg'],2); + $DisplayAlloc = locale_money_format($myrow['alloc'],$StmtHeader['currdecimalplaces']); + $DisplayOutstanding = locale_money_format($myrow['ostdg'],$StmtHeader['currdecimalplaces']); $FontSize=9; @@ -174,10 +173,10 @@ $FontSize=10; if ($myrow['total']>0){ - $DisplayTotal = locale_number_format($myrow['total'],2); + $DisplayTotal = locale_money_format($myrow['total'],$StmtHeader['currdecimalplaces']); $LeftOvers = $pdf->addTextWrap($Left_Margin+300,$YPos,60,$FontSize,$DisplayTotal, 'right'); } else { - $DisplayTotal = locale_number_format(-$myrow['total'],2); + $DisplayTotal = locale_money_format(-$myrow['total'],$StmtHeader['currdecimalplaces']); $LeftOvers = $pdf->addTextWrap($Left_Margin+382,$YPos,60,$FontSize,$DisplayTotal, 'right'); } $LeftOvers = $pdf->addTextWrap($Left_Margin+459,$YPos,60,$FontSize,$DisplayAlloc, 'right'); @@ -214,8 +213,8 @@ while ($myrow=DB_fetch_array($OstdgTrans)){ - $DisplayAlloc = locale_number_format($myrow['alloc'],2); - $DisplayOutstanding = locale_number_format($myrow['ostdg'],2); + $DisplayAlloc = locale_money_format($myrow['alloc'],$StmtHeader['currdecimalplaces']); + $DisplayOutstanding = locale_money_format($myrow['ostdg'],$StmtHeader['currdecimalplaces']); $FontSize=9; $LeftOvers = $pdf->addTextWrap($Left_Margin+1,$YPos,60,$FontSize,$myrow['typename'], 'left'); @@ -224,10 +223,10 @@ $FontSize=10; if ($myrow['total']>0){ - $DisplayTotal = locale_number_format($myrow['total'],2); + $DisplayTotal = locale_money_format($myrow['total'],$StmtHeader['currdecimalplaces']); $LeftOvers = $pdf->addTextWrap($Left_Margin+300,$YPos,55,$FontSize,$DisplayTotal, 'right'); } else { - $DisplayTotal = locale_number_format(-$myrow['total'],2); + $DisplayTotal = locale_money_format(-$myrow['total'],$StmtHeader['currdecimalplaces']); $LeftOvers = $pdf->addTextWrap($Left_Margin+382,$YPos,55,$FontSize,$DisplayTotal, 'right'); } @@ -344,11 +343,11 @@ /*Now print out the footer and totals */ - $DisplayDue = locale_number_format($AgedAnalysis['due']-$AgedAnalysis['overdue1'],2); - $DisplayCurrent = locale_number_format($AgedAnalysis['balance']-$AgedAnalysis['due'],2); - $DisplayBalance = locale_number_format($AgedAnalysis['balance'],2); - $DisplayOverdue1 = locale_number_format($AgedAnalysis['overdue1']-$AgedAnalysis['overdue2'],2); - $DisplayOverdue2 = locale_number_format($AgedAnalysis['overdue2'],2); + $DisplayDue = locale_money_format($AgedAnalysis['due']-$AgedAnalysis['overdue1'],$StmtHeader['currdecimalplaces']); + $DisplayCurrent = locale_money_format($AgedAnalysis['balance']-$AgedAnalysis['due'],$StmtHeader['currdecimalplaces']); + $DisplayBalance = locale_money_format($AgedAnalysis['balance'],$StmtHeader['currdecimalplaces']); + $DisplayOverdue1 = locale_money_format($AgedAnalysis['overdue1']-$AgedAnalysis['overdue2'],$StmtHeader['currdecimalplaces']); + $DisplayOverdue2 = locale_money_format($AgedAnalysis['overdue2'],$StmtHeader['currdecimalplaces']); $pdf->line($Page_Width-$Right_Margin, $Bottom_Margin+(4*$line_height),$Left_Margin,$Bottom_Margin+(4*$line_height)); @@ -376,9 +375,9 @@ $pdf->line($Left_Margin, $YPos,$Perforation,$YPos); - if (mb_strlen($StmtHeader['lastpaiddate'])>1 && $StmtHeader['lastpaid']!=0){ + if (mb_strlen($StmtHeader['lastpaiddate'])>1 AND $StmtHeader['lastpaid']!=0){ $pdf->addText($Left_Margin+5, $Bottom_Margin+13, $FontSize, _('Last payment received').' ' . ConvertSQLDate($StmtHeader['lastpaiddate']) . - ' ' . _('Amount received was').' ' . locale_number_format($StmtHeader['lastpaid'],2)); + ' ' . _('Amount received was').' ' . locale_money_format($StmtHeader['lastpaid'],$StmtHeader['currdecimalplaces'])); } /*also show the total due in the remittance section */ @@ -411,19 +410,19 @@ $title = _('Select Statements to Print'); include('includes/header.inc'); echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/printer.png" title="' . _('Print') . '" alt="" />' . ' ' . _('Print Customer Account Statements') . '</p>'; - if (!isset($_POST['FromCust']) || $_POST['FromCust']=='') { + if (!isset($_POST['FromCust']) OR $_POST['FromCust']=='') { /*if FromTransNo is not set then show a form to allow input of either a single statement number or a range of statements to be printed. Also get the last statement number created to show the user where the current range is up to */ - echo '<form action="' . $_SERVER['PHP_SELF'] . '" method="POST"><table class=selection>'; + echo '<form action="' . $_SERVER['PHP_SELF'] . '" method="POST"><table class="selection">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; echo '<tr><td>' . _('Starting Customer statement to print (Customer code)'). ' - </td><td><input Type=text max=6 size=7 name=FromCust value="1"></td></tr> + </td><td><input type="text" max="6" size="7" name="FromCust" value="1" /></td></tr> <tr><td>'. _('Ending Customer statement to print (Customer code)').'</td><td> - <input Type=text max=6 size=7 name=ToCust value="zzzzzz"></td></tr></table> + <input type="text" max="6" size="7" name="ToCust" value="zzzzzz"></td></tr></table> <br /><div class="centre"> - <input type=Submit Name="PrintPDF" Value="' . + <input type="submit" name="PrintPDF" value="' . _('Print All Statements in the Range Selected').'"> </div>'; } Modified: trunk/PrintCustTransPortrait.php =================================================================== --- trunk/PrintCustTransPortrait.php 2011-09-23 09:13:29 UTC (rev 4703) +++ trunk/PrintCustTransPortrait.php 2011-09-24 07:39:35 UTC (rev 4704) @@ -5,9 +5,9 @@ include('includes/session.inc'); if (isset($_GET['FromTransNo'])) { - $FromTransNo = $_GET['FromTransNo']; + $FromTransNo = filter_number_format($_GET['FromTransNo']); } elseif (isset($_POST['FromTransNo'])){ - $FromTransNo = $_POST['FromTransNo']; + $FromTransNo = filter_number_format($_POST['FromTransNo']); } else { $FromTransNo = ''; } @@ -25,8 +25,8 @@ } If (!isset($_POST['ToTransNo']) - or trim($_POST['ToTransNo'])=='' - or $_POST['ToTransNo'] < $FromTransNo) { + OR trim($_POST['ToTransNo'])=='' + OR filter_number_format($_POST['ToTransNo']) < $FromTransNo) { $_POST['ToTransNo'] = $FromTransNo; } @@ -69,7 +69,7 @@ $FirstPage = true; $line_height=16; - while ($FromTransNo <= $_POST['ToTransNo']){ + while ($FromTransNo <= filter_number_format($_POST['ToTransNo'])){ /*retrieve the invoice details from the database to print notice that salesorder record must be present to print the invoice purging of sales orders will @@ -164,7 +164,7 @@ INNER JOIN currencies ON debtorsmaster.currcode=currencies.currabrev WHERE debtortrans.type=10 - AND debtortrans.transno='" . $FromTransNo . "'"; + AND debtortrans.transno='" . filter_number_format($FromTransNo) . "'"; if (isset($_POST['PrintEDI']) and $_POST['PrintEDI']=='No') { $sql = $sql . " AND debtorsmaster.ediinvoices=0"; @@ -217,7 +217,7 @@ INNER JOIN currencies ON debtorsmaster.currcode=currencies.currabrev WHERE debtortrans.type=11 - AND debtortrans.transno='" . $FromTransNo . "'"; + AND debtortrans.transno='" . filter_number_format($FromTransNo) . "'"; if (isset($_POST['PrintEDI']) and $_POST['PrintEDI']=='No'){ @@ -234,7 +234,7 @@ prnMsg( _('There was a problem retrieving the invoice or credit note details for note number') . ' ' . $InvoiceToPrint . ' ' . _('from the database') . '. ' . _('To print an invoice, the sales order record, the customer transaction record and the branch record for the customer must not have been purged') . '. ' . _('To print a credit note only requires the customer, transaction, salesman and branch records be available'),'error'); if ($debug==1){ - prnMsg (_('The SQL used to get this information that failed was') . "<br />" . $sql,'error'); + prnMsg (_('The SQL used to get this information that failed was') . '<br />' . $sql,'error'); } include ('includes/footer.inc'); exit; @@ -260,7 +260,7 @@ FROM stockmoves INNER JOIN stockmaster ON stockmoves.stockid = stockmaster.stockid WHERE stockmoves.type=10 - AND stockmoves.transno='" . $FromTransNo . "' + AND stockmoves.transno='" . filter_number_format($FromTransNo) . "' AND stockmoves.show_on_inv_crds=1"; } else { /* only credit notes to be retrieved */ @@ -279,7 +279,7 @@ FROM stockmoves INNER JOIN stockmaster ON stockmoves.stockid = stockmaster.stockid WHERE stockmoves.type=11 - AND stockmoves.transno='" . $FromTransNo . "' + AND stockmoves.transno='" . filter_number_format($FromTransNo) . "' AND stockmoves.show_on_inv_crds=1"; } // end else @@ -537,7 +537,7 @@ echo '<option value="Credit">' . _('Credit Notes') . '</option>'; } else { echo '<option selected value="Credit">' . _('Credit Notes') . '</option>'; - echo '<option VALUE="Invoice">' . _('Invoices') . '</option>'; + echo '<option value="Invoice">' . _('Invoices') . '</option>'; } echo '</select></td></tr>'; @@ -545,11 +545,11 @@ if ($InvOrCredit=='Invoice' OR !isset($InvOrCredit)){ echo '<option selected value="No">' . _('Do not Print PDF EDI Transactions') . '</option>'; - echo '<option VALUE="Yes">' . _('Print PDF EDI Transactions Too') . '</option>'; + echo '<option value="Yes">' . _('Print PDF EDI Transactions Too') . '</option>'; } else { - echo '<option VALUE="No">' . _('Do not Print PDF EDI Transactions') . '</option>'; + echo '<option value="No">' . _('Do not Print PDF EDI Transactions') . '</option>'; echo '<option selected value="Yes">' . _('Print PDF EDI Transactions Too') . '</option>'; } @@ -642,7 +642,7 @@ INNER JOIN currencies ON debtorsmaster.currcode=currencies.currabrev WHERE debtortrans.type=10 - AND debtortrans.transno='" . $FromTransNo . "'"; + AND debtortrans.transno='" . filter_number_format($FromTransNo) . "'"; } else { //its a credit note $sql = "SELECT debtortrans.trandate, @@ -682,7 +682,7 @@ INNER JOIN currencies ON debtorsmaster.currcode=currencies.currabrev WHERE debtortrans.type=11 - AND debtortrans.transno='" . $FromTransNo . "'"; + AND debtortrans.transno='" . filter_number_format($FromTransNo) . "'"; } @@ -729,7 +729,7 @@ echo _('Facsimile') . ': ' . $_SESSION['CompanyRecord']['fax'] . '<br />'; echo _('Email') . ': ' . $_SESSION['CompanyRecord']['email'] . '<br />'; - echo '</td><td width=50% class=number>'; + echo '</td><td width=50% class+"number">'; /*Now the customer charged to details in a sub table within a cell of the main table*/ @@ -809,7 +809,7 @@ FROM stockmoves INNER JOIN stockmaster ON stockmoves.stockid = stockmaster.stockid WHERE stockmoves.type=10 - AND stockmoves.transno='" . $FromTransNo . "' + AND stockmoves.transno='" . filter_number_format($FromTransNo) . "' AND stockmoves.show_on_inv_crds=1"; } else { /* then its a credit note */ @@ -848,7 +848,7 @@ FROM stockmoves INNER JOIN stockmaster ON stockmoves.stockid = stockmaster.stockid WHERE stockmoves.type=11 - AND stockmoves.transno='" . $FromTransNo . "' + AND stockmoves.transno='" . filter_number_format($FromTransNo) . "' AND stockmoves.show_on_inv_crds=1"; } @@ -903,11 +903,11 @@ printf ('<td>%s</td> <td>%s</td> - <td class=number>%s</td> - <td class=number>%s</td> - <td class=number>%s</td> - <td class=number>%s</td> - <td class=number>%s</td> + <td class+"number">%s</td> + <td class+"number">%s</td> + <td class+"number">%s</td> + <td class+"number">%s</td> + <td class+"number">%s</td> </tr>', $myrow2['stockid'], $myrow2['description'], @@ -949,7 +949,7 @@ echo _('Telephone') . ': ' . $_SESSION['CompanyRecord']['telephone'] . '<br />'; echo _('Facsimile') . ': ' . $_SESSION['CompanyRecord']['fax'] . '<br />'; echo _('Email') . ': ' . $_SESSION['CompanyRecord']['email'] . '<br />'; - echo '</td><td class=number>' . _('Page') . ': ' . $PageNumber . '</td></tr></table>'; + echo '</td><td class+"number">' . _('Page') . ': ' . $PageNumber . '</td></tr></table>'; echo '<table class="table1"> <tr> <th>' . _('Item Code') . '</th> @@ -997,7 +997,7 @@ echo _('Telephone') . ': ' . $_SESSION['CompanyRecord']['telephone'] . '<br />'; echo _('Facsimile') . ': ' . $_SESSION['CompanyRecord']['fax'] . '<br />'; echo _('Email') . ': ' . $_SESSION['CompanyRecord']['email'] . '<br />'; - echo '</td><td class=number>' . _('Page') . ': ' . $PageNumber . '</td> + echo '</td><td class+"number">' . _('Page') . ': ' . $PageNumber . '</td> </tr> </table>'; echo '<table class="table1"> @@ -1051,7 +1051,7 @@ echo '<tr><td class="number"><b>' . _('TOTAL INVOICE') . '</b></td> <td class="number" bgcolor="#EEEEEE"><U><b>' . $DisplayTotal . '</b></U></td></tr>'; } else { - echo '<tr><td class=number><font color=RED><b>' . _('TOTAL CREDIT') . '</b></font></td> + echo '<tr><td class+"number"><font color=RED><b>' . _('TOTAL CREDIT') . '</b></font></td> <td class="number" bgcolor="#EEEEEE"><font color="red"><U><b>' . $DisplayTotal . '</b></u></font></td></tr>'; } echo '</table>'; Modified: trunk/PurchData.php =================================================================== --- trunk/PurchData.php 2011-09-23 09:13:29 UTC (rev 4703) +++ trunk/PurchData.php 2011-09-24 07:39:35 UTC (rev 4704) @@ -25,7 +25,7 @@ $NoPurchasingData=0; -echo '<a href="' . $rootpath . '/SelectProduct.php?' . SID . '">' . _('Back to Items') . '</a><br />'; +echo '<a href="' . $rootpath . '/SelectProduct.php">' . _('Back to Items') . '</a><br />'; if (isset($_POST['SupplierDescription'])) { $_POST['SupplierDescription'] = trim($_POST['SupplierDescription']); @@ -37,25 +37,24 @@ $InputError = 1; prnMsg(_('There is no stock item set up enter the stock code or select a stock item using the search page'), 'error'); } - if (!is_numeric($_POST['Price'])) { + if (!is_numeric(filter_number_format($_POST['Price']))) { $InputError = 1; unset($_POST['Price']); prnMsg(_('The price entered was not numeric and a number is expected. No changes have been made to the database'), 'error'); - } - if ($_POST['Price'] == 0) { + }elseif ($_POST['Price'] == 0) { prnMsg(_('The price entered is zero') . ' ' . _('Is this intentional?'), 'warn'); } - if (!is_numeric($_POST['LeadTime'])) { + if (!is_numeric(filter_number_format($_POST['LeadTime']))) { $InputError = 1; unset($_POST['LeadTime']); prnMsg(_('The lead time entered was not numeric a number of days is expected no changes have been made to the database'), 'error'); } - if (!is_numeric($_POST['MinOrderQty'])) { + if (!is_numeric(filter_number_format($_POST['MinOrderQty']))) { $InputError = 1; unset($_POST['MinOrderQty']); prnMsg(_('The minimum order quantity was not numeric and a number is expected no changes have been made to the database'), 'error'); } - if (!is_numeric($_POST['ConversionFactor'])) { + if (!is_numeric(filter_number_format($_POST['ConversionFactor']))) { $InputError = 1; unset($_POST['ConversionFactor']); prnMsg(_('The conversion factor entered was not numeric') . ' (' . _('a number is expected') . '). ' . _('The conversion factor is the number which the price must be divided by to get the unit price in our unit of measure') . '. <br />' . _('E.g.') . ' ' . _('The supplier sells an item by the tonne and we hold stock by the kg') . '. ' . _('The suppliers price must be divided by 1000 to get to our cost per kg') . '. ' . _('The conversion factor to enter is 1000') . '. <br /><br />' . _('No changes will be made to the database'), 'error'); @@ -74,14 +73,14 @@ preferred) VALUES ('" . $SupplierID . "', '" . $StockID . "', - '" . $_POST['Price'] . "', + '" . filter_number_format($_POST['Price']) . "', '" . FormatDateForSQL($_POST['EffectiveFrom']) . "', '" . $_POST['SuppliersUOM'] . "', - '" . $_POST['ConversionFactor'] . "', + '" . filter_number_format($_POST['ConversionFactor']) . "', '" . $_POST['SupplierDescription'] . "', '" . $_POST['SupplierCode'] . "', - '" . $_POST['LeadTime'] . "', - '" . $_POST['MinOrderQty'] . "', + '" . filter_number_format($_POST['LeadTime']) . "', + '" . filter_number_format($_POST['MinOrderQty']) . "', '" . $_POST['Preferred'] . "')"; $ErrMsg = _('The supplier purchasing details could not be added to the database because'); $DbgMsg = _('The SQL that failed was'); @@ -89,14 +88,14 @@ prnMsg(_('This supplier purchasing data has been added to the database'), 'success'); } if ($InputError == 0 AND isset($_POST['UpdateRecord'])) { - $sql = "UPDATE purchdata SET price='" . $_POST['Price'] . "', + $sql = "UPDATE purchdata SET price='" . filter_number_format($_POST['Price']) . "', effectivefrom='" . FormatDateForSQL($_POST['EffectiveFrom']) . "', suppliersuom='" . $_POST['SuppliersUOM'] . "', - conversionfactor='" . $_POST['ConversionFactor'] . "', + conversionfactor='" . filter_number_format($_POST['ConversionFactor']) . "', supplierdescription='" . $_POST['SupplierDescription'] . "', suppliers_partno='" . $_POST['SupplierCode'] . "', - leadtime='" . $_POST['LeadTime'] . "', - minorderqty='" . $_POST['MinOrderQty'] . "', + leadtime='" . filter_number_format($_POST['LeadTime']) . "', + minorderqty='" . filter_number_format($_POST['MinOrderQty']) . "', preferred='" . $_POST['Preferred'] . "' WHERE purchdata.stockid='".$StockID."' AND purchdata.supplierno='".$SupplierID."' @@ -136,20 +135,23 @@ if (!isset($_GET['Edit'])) { echo '<p class="page_title_text"><img src="' . $rootpath . '/css/' . $theme . '/images/maintenance.png" title="' . _('Search') . '" alt="" />' . ' ' . $title . ' ' . _('For Stock Code') . ' - ' . $StockID . '</p><br />'; - $sql = "SELECT purchdata.supplierno, - suppliers.suppname, - purchdata.price, - suppliers.currcode, - purchdata.effectivefrom, - purchdata.suppliersuom, - purchdata.supplierdescription, - purchdata.leadtime, - purchdata.suppliers_partno, - purchdata.minorderqty, - purchdata.preferred, - purchdata.conversionfactor + $sql = "SELECT purchdata.supplierno, + suppliers.suppname, + purchdata.price, + suppliers.currcode, + purchdata.effectivefrom, + purchdata.suppliersuom, + purchdata.supplierdescription, + purchdata.leadtime, + purchdata.suppliers_partno, + purchdata.minorderqty, + purchdata.preferred, + purchdata.conversionfactor, + currencies.decimalplaces AS currdecimalplaces FROM purchdata INNER JOIN suppliers ON purchdata.supplierno=suppliers.supplierid + INNER JOIN currencies + ON suppliers.currcode=currencies.currabrev WHERE purchdata.stockid = '" . $StockID . "' ORDER BY purchdata.effectivefrom DESC"; $ErrMsg = _('The supplier purchasing details for the selected part could not be retrieved because'); @@ -189,24 +191,24 @@ } else { $DisplayPreferred = _('No'); } - printf("<td>%s</td> - <td class=number>%s</td> + printf('<td>%s</td> + <td class="number">%s</td> <td>%s</td> - <td class=number>%s</td> - <td class=number>%s</td> + <td class="number">%s</td> + <td class="number">%s</td> <td>%s</td> <td>%s</td> <td>%s</td> - <td>%s " . _('days') . "</td> + <td>%s ' . _('days') . '</td> <td>%s</td> - <td><a href='%s?StockID=%s&SupplierID=%s&Edit=1&EffectiveFrom=%s'>" . _('Edit') . "</a></td> - <td><a href='%s?StockID=%s&SupplierID=%s&Delete=1&EffectiveFrom=%s' onclick=\"return confirm('" . _('Are you sure you wish to delete this suppliers price?') . "');\">" . _('Delete') . "</a></td> - </tr>", + <td><a href="%s?StockID=%s&SupplierID=%s&Edit=1&EffectiveFrom=%s">' . _('Edit') . '</a></td> + <td><a href="%s?StockID=%s&SupplierID=%s&Delete=1&EffectiveFrom=%s" onclick=\'return confirm("' . _('Are you sure you wish to delete this suppliers price?') . '");\'>' . _('Delete') . '</a></td> + </tr>', $myrow['suppname'], - locale_number_format($myrow['price'], 3), + locale_money_format($myrow['price'], $myrow['currdecimalplaces']), $myrow['suppliersuom'], $myrow['conversionfactor'], - locale_number_format($myrow['price']/$myrow['conversionfactor'],2), + locale_money_format($myrow['price']/$myrow['conversionfactor'],$myrow['currdecimalplaces']), $myrow['currcode'], ConvertSQLDate($myrow['effectivefrom']), $myrow['minorderqty'], @@ -232,7 +234,13 @@ } /* Only show the existing purchasing data records if one is not being edited */ if (isset($SupplierID) AND $SupplierID != '' AND !isset($_POST['SearchSupplier'])) { /*NOT EDITING AN EXISTING BUT SUPPLIER selected OR ENTERED*/ - $sql = "SELECT suppliers.suppname, suppliers.currcode FROM suppliers WHERE supplierid='".$SupplierID."'"; + $sql = "SELECT suppliers.suppname, + suppliers.currcode, + currencies.decimalplaces AS currdecimalplaces + FROM suppliers + INNER JOIN currencies + ON suppliers.currcode=currencies.currabrev + WHERE supplierid='".$SupplierID."'"; $ErrMsg = _('The supplier details for the selected supplier could not be retrieved because'); $DbgMsg = _('The SQL that failed was'); $SuppSelResult = DB_query($sql, $db, $ErrMsg, $DbgMsg); @@ -240,6 +248,7 @@ $myrow = DB_fetch_array($SuppSelResult); $SuppName = $myrow['suppname']; $CurrCode = $myrow['currcode']; + $CurrDecimalPlaces = $myrow['currdecimalplaces']; } else { prnMsg(_('The supplier code') . ' ' . $SupplierID . ' ' . _('is not an existing supplier in the database') . '. ' . _('You must enter an alternative supplier code or select a supplier using the search facility below'), 'error'); unset($SupplierID); @@ -249,16 +258,18 @@ echo '<p class="page_title_text"><img src="' . $rootpath . '/css/' . $theme . '/images/maintenance.png" title="' . _('Search') . '" alt="" />' . ' ' . $title . ' ' . _('For Stock Code') . ' - ' . $StockID . '</p><br />'; } if (!isset($_POST['SearchSupplier'])) { - echo '<form action="' . $_SERVER['PHP_SELF'] . '?' . SID . '" method=post><table cellpadding=3 colspan=4 class=selection><tr>'; + echo '<form action="' . $_SERVER['PHP_SELF'] . '" method="post"> + <table cellpadding="3" colspan="4" class="selection"> + <tr>'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; echo '<input type="hidden" name="StockID" value="' . $StockID . '">'; echo '<td>' . _('Text in the Supplier') . ' <b>' . _('NAME') . '</b>:</font></td>'; - echo '<td><input type="Text" name="Keywords" size=20 maxlength=25></td>'; + echo '<td><input type="text" name="Keywords" size="20" maxlength="25"></td>'; echo '<td><font size=3><b>' . _('OR') . '</b></font></td>'; echo '<td>' . _('Text in Supplier') . ' <b>' . _('CODE') . '</b>:</font></td>'; - echo '<td><input type="Text" name="SupplierCode" size=15 maxlength=18></td>'; + echo '<td><input type="text" name="SupplierCode" size=15 maxlength=18></td>'; echo '</tr></table><br />'; - echo '<div class="centre"><input type=submit name="SearchSupplier" value="' . _('Find Suppliers Now') . '"></div></form>'; + echo '<div class="centre"><input type="submit" name="SearchSupplier" value="' . _('Find Suppliers Now') . '"></div></form>'; include ('includes/footer.inc'); exit; }; @@ -326,15 +337,16 @@ $StockID = ''; $StockUOM = 'each'; } - echo '<form action="' . $_SERVER['PHP_SELF'] . '?' . SID . '" method=post><table cellpadding=2 colspan=7 class=selection>'; + echo '<form action="' . $_SERVER['PHP_SELF'] . '" method=post> + <table cellpadding="2" colspan="7" class="selection">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; $TableHeader = '<tr><th>' . _('Code') . '</th> <th>' . _('Supplier Name') . '</th> - <th>' . _('Currency') . '</th> - <th>' . _('Address 1') . '</th> - <th>' . _('Address 2') . '</th> - <th>' . _('Address 3') . '</th> - </tr>'; + <th>' . _('Currency') . '</th> + <th>' . _('Address 1') . '</th> + <th>' . _('Address 2') . '</th> + <th>' . _('Address 3') . '</th> + </tr>'; echo $TableHeader; $k = 0; while ($myrow = DB_fetch_array($SuppliersResult)) { @@ -359,8 +371,8 @@ $myrow['address2'], $myrow['address3']); - echo '<input type=hidden name=StockID value="' . $StockID . '">'; - echo '<input type=hidden name=StockUOM value="' . $StockUOM . '">'; + echo '<input type="hidden" name="StockID" value="' . $StockID . '" />'; + echo '<input type="hidden" name="StockUOM" value="' . $StockUOM . '" />'; } //end of while loop @@ -384,7 +396,7 @@ purchdata.minorderqty, purchdata.preferred, stockmaster.units, - currencies.decimalplaces + currencies.decimalplaces AS currdecimalplaces FROM purchdata INNER JOIN suppliers ON purchdata.supplierno=suppliers.supplierid INNER JOIN stockmaster @@ -401,6 +413,7 @@ $_POST['Price'] = $myrow['price']; $_POST['EffectiveFrom'] = ConvertSQLDate($myrow['effectivefrom']); $CurrCode = $myrow['currcode']; + $CurrDecimalPlaces = $myrow['currdecimalplaces']; $_POST['SuppliersUOM'] = $myrow['suppliersuom']; $_POST['SupplierDescription'] = $myrow['supplierdescription']; $_POST['LeadTime'] = $myrow['leadtime']; @@ -418,10 +431,10 @@ } if (isset($_GET['Edit'])) { echo '<tr><td>' . _('Supplier Name') . ':</td> - <td><input type=hidden name="SupplierID" value="' . $SupplierID . '">' . $SupplierID . ' - ' . $SuppName . '<input type=hidden name="WasEffectiveFrom" value="' . $myrow['effectivefrom'] . '"></td></tr>'; + <td><input type=hidden name="SupplierID" value="' . $SupplierID . '">' . $SupplierID . ' - ' . $SuppName . '<input type=hidden name="WasEffectiveFrom" value="' . $myrow['effectivefrom'] . '" /></td></tr>'; } else { echo '<tr><td>' . _('Supplier Name') . ':</td> - <input type=hidden name="SupplierID" maxlength=10 size=11 value="' . $SupplierID . '">'; + <input type=hidden name="SupplierID" maxlength=10 size=11 value="' . $SupplierID . '" />'; if ($SupplierID!='') { echo '<td>'.$SuppName; } @@ -432,7 +445,7 @@ } echo '</td></tr>'; } - echo '<td><input type=hidden name="StockID" maxlength=10 size=11 value="' . $StockID . '">'; + echo '<td><input type=hidden name="StockID" maxlength=10 size=11 value="' . $StockID . '" />'; if (!isset($CurrCode)) { $CurrCode = ''; } @@ -457,7 +470,7 @@ echo '<tr><td>' . _('Currency') . ':</td> <td><input type=hidden name="CurrCode" . value="' . $CurrCode . '">' . $CurrCode . '</td></tr>'; echo '<tr><td>' . _('Price') . ' (' . _('in Supplier Currency') . '):</td> - <td><input type="text" class="number" name="Price" maxlength=12 size=12 value=' . round($_POST['Price'], $myrow['decimalplaces']) . '></td></tr>'; + <td><input type="text" class="number" name="Price" maxlength=12 size=12 value=' . locale_money_format(round($_POST['Price'], $CurrDecimalPlaces),$CurrDecimalPlaces) . ' /></td></tr>'; echo '<tr><td>' . _('Date Updated') . ':</td> <td><input type="text" class="date" alt="' . $_SESSION['DefaultDateFormat'] . '" name="EffectiveFrom" maxlength=10 size=11 value="' . $_POST['EffectiveFrom'] . '"></td></tr>'; echo '<tr><td>' . _('Our Unit of Measure') . ':</td>'; @@ -467,17 +480,17 @@ echo '<tr><td>' . _('Suppliers Unit of Measure') . ':</td>'; echo '<td><input type="text" name="SuppliersUOM" size="20" maxlength="20" value ="' . $_POST['SuppliersUOM'] . '"/>'; echo '</td></tr>'; - if (!isset($_POST['ConversionFactor']) OR $_POST['ConversionFactor'] == "") { + if (!isset($_POST['ConversionFactor']) OR $_POST['ConversionFactor'] == '') { $_POST['ConversionFactor'] = 1; } echo '<tr><td>' . _('Conversion Factor (to our UOM)') . ':</td> - <td><input type="text" class=number name="ConversionFactor" maxlength=12 size=12 value=' . $_POST['ConversionFactor'] . '></td></tr>'; + <td><input type="text" class="number" name="ConversionFactor" maxlength="12" size="12" value=' . $_POST['ConversionFactor'] . '></td></tr>'; echo '<tr><td>' . _('Supplier Stock Code') . ':</td> - <td><input type="text" name="SupplierCode" maxlength=15 size=15 value="' . $_POST['SupplierCode'] . '"></td></tr>'; + <td><input type="text" name="SupplierCode" maxlength="15" size="15" value="' . $_POST['SupplierCode'] . '"></td></tr>'; echo '<tr><td>' . _('MinOrderQty') . ':</td> - <td><input type="text" class=number name="MinOrderQty" maxlength=15 size=15 value="' . $_POST['MinOrderQty'] . '"></td></tr>'; + <td><input type="text" class="number" name="MinOrderQty" maxlength=15 size=15 value="' . $_POST['MinOrderQty'] . '"></td></tr>'; echo '<tr><td>' . _('Supplier Stock Description') . ':</td> - <td><input type="text" name="SupplierDescription" maxlength=50 size=51 value="' . $_POST['SupplierDescription'] . '"></td></tr>'; + <td><input type="text" name="SupplierDescription" maxlength="50" size="51" value="' . $_POST['SupplierDescription'] . '"></td></tr>'; if (!isset($_POST['LeadTime']) OR $_POST['LeadTime'] == "") { $_POST['LeadTime'] = 1; } Modified: trunk/RecurringSalesOrders.php =================================================================== --- trunk/RecurringSalesOrders.php 2011-09-23 09:13:29 UTC (rev 4703) +++ trunk/RecurringSalesOrders.php 2011-09-24 07:39:35 UTC (rev 4704) @@ -16,9 +16,9 @@ $identifier=$_GET['identifier']; } -if ($_GET['NewRecurringOrder']=='Yes'){ +if (isset($_GET['NewRecurringOrder'])){ $NewRecurringOrder ='Yes'; -} elseif ($_POST['NewRecurringOrder']=='Yes'){ +} elseif (isset($_POST['NewRecurringOrder'])){ $NewRecurringOrder ='Yes'; } else { $NewRecurringOrder ='No'; @@ -57,12 +57,12 @@ recurringsalesorders.stopdate, recurringsalesorders.lastrecurrence, recurringsalesorders.autoinvoice - FROM recurringsalesorders, - debtorsmaster, - salestypes - WHERE recurringsalesorders.ordertype=salestypes.typeabbrev - AND recurringsalesorders.debtorno = debtorsmaster.debtorno - AND recurringsalesorders.recurrorderno = '" . $_GET['ModifyRecurringSalesOrder'] . "'"; + FROM recurringsalesorders + INNER JOIN debtorsmaster + ON recurringsalesorders.debtorno = debtorsmaster.debtorno + INNER JOIN salestypes + ON recurringsalesorders.ordertype=salestypes.typeabbrev + WHERE recurringsalesorders.recurrorderno = '" . $_GET['ModifyRecurringSalesOrder'] . "'"; $ErrMsg = _('The order cannot be retrieved because'); $GetOrdHdrResult = DB_query($OrderHeaderSQL,$db,$ErrMsg); @@ -84,7 +84,7 @@ $_SESSION['Items'.$identifier]->ShipVia = $myrow['shipvia']; $BestShipper = $myrow['shipvia']; $_SESSION['Items'.$identifier]->DeliverTo = $myrow['deliverto']; - $_SESSION['Items'.$identifier]->DeliveryDate = ConvertSQLDate($myrow['deliverydate']); + //$_SESSION['Items'.$identifier]->DeliveryDate = ConvertSQLDate($myrow['deliverydate']); $_SESSION['Items'.$identifier]->DelAdd1 = $myrow['deladd1']; $_SESSION['Items'.$identifier]->DelAdd2 = $myrow['deladd2']; $_SESSION['Items'.$identifier]->DelAdd3 = $myrow['deladd3']; @@ -160,11 +160,11 @@ if (isset($_POST['DeleteRecurringOrder'])){ - $sql = "DELETE FROM recurrsalesorderdetails WHERE recurrorderno='" . $_POST['ExistingRecurrOrderNo'] . "'"; + $sql = "DELETE FROM recurrsalesorderdetails WHERE recurrorderno='" . filter_number_format($_POST['ExistingRecurrOrderNo']) . "'"; $ErrMsg = _('Could not delete recurring sales order lines for the recurring order template') . ' ' . $_POST['ExistingRecurrOrderNo']; $result = DB_query($sql,$db,$ErrMsg); - $sql = "DELETE FROM recurringsalesorders WHERE recurrorderno='" . $_POST['ExistingRecurrOrderNo'] . "'"; + $sql = "DELETE FROM recurringsalesorders WHERE recurrorderno='" . filter_number_format($_POST['ExistingRecurrOrderNo']) . "'"; $ErrMsg = _('Could not delete the recurring sales order template number') . ' ' . $_POST['ExistingRecurrOrderNo']; $result = DB_query($sql,$db,$ErrMsg); @@ -200,7 +200,6 @@ if ($InputErrors == 0 ){ /*Error checks above all passed ok so lets go*/ - if ($NewRecurringOrder=='Yes'){ /* finally write the recurring order header to the database and then the line details*/ @@ -234,7 +233,7 @@ '" . $_SESSION['Items'.$identifier]->Branch . "', '". $_SESSION['Items'.$identifier]->CustRef ."', '". $_SESSION['Items'.$identifier]->Comments ."', - '" . Date("Y-m-d H:i") . "', + '" . Date('Y-m-d H:i') . "', '" . $_SESSION['Items'.$identifier]->DefaultSalesType . "', '" . $_SESSION['Items'.$identifier]->DeliverTo . "', '" . $_SESSION['Items'.$identifier]->DelAdd1 . "', @@ -254,32 +253,37 @@ '" . $_POST['AutoInvoice'] . "')"; $ErrMsg = _('The recurring order cannot be added because'); - $InsertQryResult = DB_query($HeaderSQL,$db,$ErrMsg,true); + $DbgMsg = _('The SQL that failed was'); + $InsertQryResult = DB_query($HeaderSQL,$db,$ErrMsg,$DbgMsg,true); + + echo '<br/>' . $HeaderSQL; $RecurrOrderNo = DB_Last_Insert_ID($db,'recurringsalesorders','recurrorderno'); echo 'xxx'.$RecurrOrderNo; - $StartOf_LineItemsSQL = "INSERT INTO recurrsalesorderdetails ( - recurrorderno, - stkcode, - unitprice, - quantity, - discountpercent, - narrative) - values ('"; - + $StartOf_LineItemsSQL = "INSERT INTO recurrsalesorderdetails (recurrorderno, + stkcode, + unitprice, + quantity, + discountpercent, + narrative) + VALUES ('"; + foreach ($_SESSION['Items'.$identifier]->LineItems as $StockItem) { $LineItemsSQL = $StartOf_LineItemsSQL . - $RecurrOrderNo . "', - '" . $StockItem->StockID . "', - '". $StockItem->Price . "', - '" . $StockItem->Quantity . "', - '" . $StockItem->DiscountPercent . "', - '" . $StockItem->Narrative . "' - )"; + $RecurrOrderNo . "', + '" . $StockItem->StockID . "', + '". filter_number_format($StockItem->Price) . "', + '" . filter_number_format($StockItem->Quantity) . "', + '" . filter_number_format($StockItem->DiscountPercent) . "', + '" . $StockItem->Narrative . "')"; $Ins_LineItemResult = DB_query($LineItemsSQL,$db,$ErrMsg,$DbgMsg,true); + + echo '<br/>' . $LineItemsSQL; + } /* inserted line items into sales order details */ - + + $result = DB_Txn_Commit($db); prnmsg(_('The new recurring order template has been added'),'success'); } else { /* must be updating an existing recurring order */ @@ -287,7 +291,7 @@ stopdate = '" . FormatDateforSQL($_POST['StopDate']) . "', frequency = '" . $_POST['Frequency'] . "', autoinvoice = '" . $_POST['AutoInvoice'] . "' - WHERE recurrorderno = '" . $_POST['ExistingRecurrOrderNo'] . "'"; + WHERE recurrorderno = '" . filter_number_format($_POST['ExistingRecurrOrderNo']) . "'"; $ErrMsg = _('The recurring order cannot be updated because'); $UpdateQryResult = DB_query($HeaderSQL,$db,$ErrMsg); @@ -304,7 +308,6 @@ exit; } - $result = DB_Txn_Commit($db); } echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/customer.png" title="' . _('Search') . @@ -333,8 +336,8 @@ foreach ($_SESSION['Items'.$identifier]->LineItems as $StockItem) { $LineTotal = $StockItem->Quantity * $StockItem->Price * (1 - $StockItem->DiscountPercent); - $DisplayLineTotal = locale_number_format($LineTotal,2); - $DisplayPrice = locale_number_format($StockItem->Price,2); + $DisplayLineTotal = locale_money_format($LineTotal,$_SESSION['Items'.$identifier]->CurrDecimalPlaces); + $DisplayPrice = locale_money_format($StockItem->Price,$_SESSION['Items'.$identifier]->CurrDecimalPlaces); $DisplayQuantity = locale_number_format($StockItem->Quantity,$StockItem->DecimalPlaces); $DisplayDiscount = locale_number_format(($StockItem->DiscountPercent * 100),2); @@ -347,28 +350,29 @@ $k=1; } - echo '<td>$StockItem->StockID</td> - <td>$StockItem->ItemDescription</td> - <td class=number>$DisplayQuantity</td> - <td>$StockItem->Units</td> - <td class=number>$DisplayPrice</td> - <td class=number>$DisplayDiscount</td> - <td class=number>$DisplayLineTotal</td> + echo '<td>' . $StockItem->StockID . '</td> + <td>' . $StockItem->ItemDescription . '</td> + <td class="number">' . $DisplayQuantity . '</td> + <td>' . $StockItem->Units . '</td> + <td class="number">' . $DisplayPrice . '</td> + <td class="number">' . $DisplayDiscount . '</td> + <td class="number">' . $DisplayLineTotal . '</td> </tr>'; - $_SESSION['Items'.$identifier]->total = $_SESSION['Items'.$identifier]->total + $LineTotal; - $_SESSION['Items'.$identifier]->totalVolume = $_SESSION['Items'.$identifier]->totalVolume + ($StockItem->Quantity * $StockItem->Volume); - $_SESSION['Items'.$identifier]->totalWeight = $_SESSION['Items'.$identifier]->totalWeight + ($StockItem->Quantity * $StockItem->Weight); + $_SESSION['Items'.$identifier]->total += $LineTotal; + $_SESSION['Items'.$identifier]->totalVolume += ($StockItem->Quantity * $StockItem->Volume); + $_SESSION['Items'.$identifier]->totalWeight += ($StockItem->Quantity * $StockItem->Weight); } -$DisplayTotal = locale_number_format($_SESSION['Items'.$identifier]->total,2); +$DisplayTotal = locale_money_format($_SESSION['Items'.$identifier]->total,$_SESSION['Items'.$identifier]->CurrDecimalPlaces); echo '<tr> - <td colspan=6 class=number><b>'. _('TOTAL Excl Tax/Freight') .'</b></td> - <td class=number>$DisplayTotal</td> -</tr></table>'; + <td colspan="6" class="number"><b>'. _('TOTAL Excl Tax/Freight') .'</b></td> + <td class="number">' . $DisplayTotal . '</td> + </tr> + </table>'; -echo '<br /><table class=selection>'; -echo '<tr><th colspan=7><font size=2 color=navy><b>'._('Order Header Details').'</b></font></th></tr>'; +echo '<br /><table class="selection">'; +echo '<tr><th colspan="7"><font size=2 color=navy><b>'._('Order Header Details').'</b></font></th></tr>'; echo '<tr> <td>'. _('Deliver To') .':</td> @@ -415,7 +419,7 @@ if ($NewRecurringOrder=='Yes'){ echo '<tr> <td>'. _('Start Date') .':</td> - <td><input type=TEXT class=date alt="'.$_SESSION['DefaultDateFormat'].'" name="StartDate" size=11 maxlength=10 value="' . $_POST['StartDate'] .'" /></td></tr>'; + <td><input type="text" class="date" alt="'.$_SESSION['DefaultDateFormat'].'" name="StartDate" size=11 maxlength=10 value="' . $_POST['StartDate'] .'" /></td></tr>'; } else { echo '<tr> <td>'. _('Last Recurrence') . ':</td> @@ -429,7 +433,7 @@ echo '<tr> <td>'. _('Finish Date') .':</td> - <td><input type=TEXT class=date alt="'.$_SESSION['DefaultDateFormat'].'" name="StopDate" size=11 maxlength=10 value="' . $_POST['StopDate'] .'" /></td></tr>'; + <td><input type="text" class="date" alt="'.$_SESSION['DefaultDateFormat'].'" name="StopDate" size=11 maxlength=10 value="' . $_POST['StopDate'] .'" /></td></tr>'; echo '<tr> <td>'. _('Frequency of Recurrence') .':</td> @@ -493,15 +497,15 @@ echo '<br /><div class="centre">'; if ($NewRecurringOrder=='Yes'){ - echo '<input type="hidden" name="NewRecurringOrder" value="Yes">'; - echo '<input type="submit" name="Process" value="' . _('Create Recurring Order') . '">'; + echo '<input type="hidden" name="NewRecurringOrder" value="Yes" />'; + echo '<input type="submit" name="Process" value="' . _('Create Recurring Order') . '" />'; } else { echo '<input type=hidden name="NewRecurringOrder" value="No">'; - echo '<input type=hidden name="ExistingRecurrOrderNo" value=' . $_POST['ExistingRecurrOrderNo'] . '>'; + echo '<input type=hidden name="ExistingRecurrOrderNo" value="' . $_POST['ExistingRecurrOrderNo'] . '" />'; - echo '<input type="submit" name="Process" value="' . _('Update Recurring Order Details') . '">'; + echo '<input type="submit" name="Process" value="' . _('Update Recurring Order Details') . '" />'; echo '<hr>'; - echo '<br /><br /><input type=submit name="DeleteRecurringOrder" value="' . _('Delete Recurring Order') . ' ' . $_POST['ExistingRecurrOrderNo'] . '" onclick="return confirm(\'' . _('Are you sure you wish to delete this recurring order template?') . '\');">'; + echo '<br /><br /><input type=submit name="DeleteRecurringOrder" value="' . _('Delete Recurring Order') . ' ' . $_POST['ExistingRecurrOrderNo'] . '" onclick="return confirm(\'' . _('Are you sure you wish to delete this recurring order template?') . '\');" />'; } echo '</form></div>'; Modified: trunk/RecurringSalesOrdersProcess.php =================================================================== --- trunk/RecurringSalesOrdersProcess.php 2011-09-23 09:13:29 UTC (rev 4703) +++ trunk/RecurringSalesOrdersProcess.php 2011-09-24 07:39:35 UTC (rev 4704) @@ -4,7 +4,7 @@ /*need to allow this script to run from Cron or windows scheduler */ $AllowAnyone = true; -/* Get this puppy to run from cron (cd weberp && php -f RecurringSalesOrdersProcess.php "weberpdemo") or direct URL (RecurringSalesOrdersProcess.php?Database=weberpdemo) */ +/* Get this puppy to run from cron (cd webERP && php -f RecurringSalesOrdersProcess.php "weberpdemo") or direct URL (RecurringSalesOrdersProcess.php?Database=weberpdemo) */ if (isset($_GET['Database'])) { $_SESSION['DatabaseName'] = $_GET['Database']; $DatabaseName = $_GET['Database']; @@ -27,50 +27,50 @@ include('includes/GetSalesTransGLCodes.inc'); include('includes/htmlMimeMail.php'); -$sql = 'SELECT recurringsalesorders.recurrorderno, - recurringsalesorders.debtorno, - recurringsalesorders.branchcode, - recurringsalesorders.customerref, - recurringsalesorders.buyername, - recurringsalesorders.comments, - recurringsalesorders.orddate, - recurringsalesorders.ordertype, - recurringsalesorders.shipvia, - recurringsalesorders.deladd1, - recurringsalesorders.deladd2, - recurringsalesorders.deladd3, - recurringsalesorders.deladd4, - recurringsalesorders.deladd5, - recurringsalesorders.deladd6, - recurringsalesorders.contactphone, - recurringsalesorders.contactemail, - recurringsalesorders.deliverto, - recurringsalesorders.freightcost, - recurringsalesorders.fromstkloc, - recurringsalesorders.lastrecurrence, - recurringsalesorders.stopdate, - recurringsalesorders.frequency, - recurringsalesorders.autoinvoice, - debtorsmaster.name, - debtorsmaster.currcode, - salestypes.sales_type, - custbranch.area, - custbranch.taxgroupid, - locations.contact, - locations.email - FROM recurringsalesorders, - debtorsmaster, - custbranch, - salestypes, - locations - WHERE recurringsalesorders.ordertype=salestypes.typeabbrev - AND recurringsalesorders.debtorno = debtorsmaster.debtorno - AND recurringsalesorders.debtorno = custbranch.debtorno - AND recurringsalesorders.branchcode = custbranch.branchcode - AND recurringsalesorders.fromstkloc=locations.loccode - AND recurringsalesorders.ordertype=salestypes.typeabbrev - AND (TO_DAYS(NOW()) - TO_DAYS(recurringsalesorders.lastrecurrence)) > (365/recurringsalesorders.frequency) - AND DATE_ADD(recurringsalesorders.lastrecurrence, ' . INTERVAL ('365/recurringsalesorders.frequency', 'DAY') . ') <= recurringsalesorders.stopdate'; +$sql = "SELECT recurringsalesorders.recurrorderno, + recurringsalesorders.debtorno, + recurringsalesorders.branchcode, + recurringsalesorders.customerref, + recurringsalesorders.buyername, + recurringsalesorders.comments, + recurringsalesorders.orddate, + recurringsalesorders.ordertype, + recurringsalesorders.shipvia, + recurringsalesorders.deladd1, + recurringsalesorders.deladd2, + recurringsalesorders.deladd3, + recurringsalesorders.deladd4, + recurringsalesorders.deladd5, + recurringsalesorders.deladd6, + recurringsalesorders.contactphone, + recurringsalesorders.contactemail, + recurringsalesorders.deliverto, + recurringsalesorders.freightcost, + recurringsalesorders.fromstkloc, + recurringsalesorders.lastrecurrence, + recurringsalesorders.stopdate, + recurringsalesorders.frequency, + recurringsalesorders.autoinvoice, + debtorsmaster.name, + debtorsmaster.currcode, + salestypes.sales_type, + custbranch.area, + custbranch.taxgroupid, + locations.contact, + locations.email + FROM recurringsalesorders, + debtorsmaster, + custbranch, + salestypes, + locations + WHERE recurringsalesorders.ordertype=salestypes.typeabbrev + AND recurringsalesorders.debtorno = debtorsmaster.debtorno + AND recurringsalesorders.debtorno = custbranch.debtorno + AND recurringsalesorders.branchcode = custbranch.branchcode + AND recurringsalesorders.fromstkloc=locations.loccode + AND recurringsalesorders.ordertype=salestypes.typeabbrev + AND (TO_DAYS(NOW()) - TO_DAYS(recurringsalesorders.lastrecurrence)) > (365/recurringsalesorders.frequency) + AND DATE_ADD(recurringsalesorders.lastrecurrence, " . INTERVAL ('365/recurringsalesorders.frequency', 'DAY') . ") <= recurringsalesorders.stopdate"; $RecurrOrdersDueResult = DB_query($sql,$db,_('There was a problem retrieving the recurring sales order templates. The database reported:')); @@ -178,12 +178,12 @@ while ($RecurrOrderLineRow=DB_fetch_array($LineItemsResult)) { $LineItemsSQL = $StartOf_LineItemsSQL . - " '" . $LineCounter . "', - '" . $RecurrOrderLineRow['stkcode'] . "', - '". $RecurrOrderLineRow['unitprice'] . "', - '" . $RecurrOrderLineRow['quantity'] . "', - '" . floatval($RecurrOrderLineRow['discountpercent']) . "', - '" . $RecurrOrderLineRow['narrative'] . "')"; + " '" . $LineCounter . "', + '" . $RecurrOrderLineRow['stkcode'] . "', + '". $RecurrOrderLineRow['unitprice'] . "', + '" . $RecurrOrderLineRow['quantity'] . "', + '" . floatval($RecurrOrderLineRow['discountpercent']) . "', + '" . $RecurrOrderLineRow['narrative'] . "')"; $Ins_LineItemResult = DB_query($LineItemsSQL,$db,_('Could not insert the order lines from the recurring order template'),true); /*Populating a new order line items*/ $LineCounter ++; @@ -427,9 +427,9 @@ if ($myrow[0]>0){ /*Update the existing record that already exists */ $SQL = "UPDATE salesanalysis - SET amt=amt+" . ($RecurrOrderLineRow['unitprice'] * $RecurrOrderLineRow['quantity'] / $CurrencyRate) . ", + SET amt=amt+" . filter_number_format($RecurrOrderLineRow['unitprice'] * $RecurrOrderLineRow['quantity'] / $CurrencyRate) . ", qty=qty +" . $RecurrOrderLineRow['quantity'] . ", - disc=disc+" . ($RecurrOrderLineRow['discountpercent'] * $RecurrOrderLineRow['unitprice'] * $RecurrOrderLineRow['quantity'] / $CurrencyRate) . " + disc=disc+" . filter_number_format($... [truncated message content] |
From: <dai...@us...> - 2011-09-24 07:39:45
|
Revision: 4704 http://web-erp.svn.sourceforge.net/web-erp/?rev=4704&view=rev Author: daintree Date: 2011-09-24 07:39:35 +0000 (Sat, 24 Sep 2011) Log Message: ----------- number_formats Modified Paths: -------------- trunk/PrintCustOrder.php trunk/PrintCustOrder_generic.php trunk/PrintCustStatements.php trunk/PrintCustTransPortrait.php trunk/PurchData.php trunk/RecurringSalesOrders.php trunk/RecurringSalesOrdersProcess.php trunk/ReorderLevel.php trunk/ReorderLevelLocation.php trunk/ReverseGRN.php trunk/includes/LanguageSetup.php Removed Paths: ------------- trunk/ReportBug.php Modified: trunk/PrintCustOrder.php =================================================================== --- trunk/PrintCustOrder.php 2011-09-23 09:13:29 UTC (rev 4703) +++ trunk/PrintCustOrder.php 2011-09-24 07:39:35 UTC (rev 4704) @@ -2,8 +2,6 @@ /* $Id$ */ -//$PageSecurity = 2; - include('includes/session.inc'); include('includes/class.pdf.php'); include('includes/SQL_CommonFunctions.inc'); @@ -25,51 +23,51 @@ /*retrieve the order details from the database to print */ $ErrMsg = _('There was a problem retrieving the order header details for Order Number') . ' ' . $_GET['TransNo'] . ' ' . _('from the database'); $sql = "SELECT salesorders.customerref, - salesorders.comments, - salesorders.orddate, - salesorders.deliverto, - salesorders.deladd1, - salesorders.deladd2, - salesorders.deladd3, - salesorders.deladd4, - salesorders.deladd5, - salesorders.deladd6, - salesorders.debtorno, - salesorders.branchcode, - salesorders.deliverydate, - debtorsmaster.name, - debtorsmaster.address1, - debtorsmaster.address2, - debtorsmaster.address3, - debtorsmaster.address4, - debtorsmaster.address5, - debtorsmaster.address6, - shippers.shippername, - salesorders.printedpackingslip, - salesorders.datepackingslipprinted, - locations.locationname - FROM salesorders INNER JOIN debtorsmaster - ON salesorders.debtorno=debtorsmaster.debtorno - INNER JOIN shippers - ON salesorders.shipvia=shippers.shipper_id - INNER JOIN locations - ON salesorders.fromstkloc=locations.loccode - WHERE salesorders.orderno='" . $_GET['TransNo']. "'"; + salesorders.comments, + salesorders.orddate, + salesorders.deliverto, + salesorders.deladd1, + salesorders.deladd2, + salesorders.deladd3, + salesorders.deladd4, + salesorders.deladd5, + salesorders.deladd6, + salesorders.debtorno, + salesorders.branchcode, + salesorders.deliverydate, + debtorsmaster.name, + debtorsmaster.address1, + debtorsmaster.address2, + debtorsmaster.address3, + debtorsmaster.address4, + debtorsmaster.address5, + debtorsmaster.address6, + shippers.shippername, + salesorders.printedpackingslip, + salesorders.datepackingslipprinted, + locations.locationname + FROM salesorders INNER JOIN debtorsmaster + ON salesorders.debtorno=debtorsmaster.debtorno + INNER JOIN shippers + ON salesorders.shipvia=shippers.shipper_id + INNER JOIN locations + ON salesorders.fromstkloc=locations.loccode + WHERE salesorders.orderno='" . filter_number_format($_GET['TransNo']). "'"; $result=DB_query($sql,$db, $ErrMsg); //If there are no rows, there's a problem. if (DB_num_rows($result)==0){ -/* Javier */ $ListCount = 0; + $ListCount = 0; $title = _('Print Packing Slip Error'); include('includes/header.inc'); echo '<div class=centre><br /><br /><br />'; prnMsg( _('Unable to Locate Order Number') . ' : ' . $_GET['TransNo'] . ' ', 'error'); echo '<br /><br /><br /><table class="table_index"><tr><td class="menu_group_item"> - <LI><a href="'. $rootpath . '/SelectSalesOrder.php?'. SID .'">' . _('Outstanding Sales Orders') . '</a></LI> - <LI><a href="'. $rootpath . '/SelectCompletedOrder.php?'. SID .'">' . _('Completed Sales Orders') . '</a></LI> + <li><a href="'. $rootpath . '/SelectSalesOrder.php">' . _('Outstanding Sales Orders') . '</a></li> + <li><a href="'. $rootpath . '/SelectCompletedOrder.php">' . _('Completed Sales Orders') . '</a></li> </td></tr></table></div><br /><br /><br />'; include('includes/footer.inc'); exit(); @@ -85,16 +83,24 @@ prnMsg( _('The packing slip for order number') . ' ' . $_GET['TransNo'] . ' ' . _('has previously been printed') . '. ' . _('It was printed on'). ' ' . ConvertSQLDate($myrow['datepackingslipprinted']) . '<br />' . _('This check is there to ensure that duplicate packing slips are not produced and dispatched more than once to the customer'), 'warn' ); - echo '<p><a href="' . $rootpath . '/PrintCustOrder.php?' . SID . 'TransNo=' . $_GET['TransNo'] . '&Reprint=OK">' + echo '<p><a href="' . $rootpath . '/PrintCustOrder.php?TransNo=' . $_GET['TransNo'] . '&Reprint=OK">' . _('Do a Re-Print') . ' (' . _('On Pre-Printed Stationery') . ') ' . _('Even Though Previously Printed') . '</a><p>' . - '<a href="' . $rootpath. '/PrintCustOrder_generic.php?' . SID . 'TransNo=' . $_GET['TransNo'] . '&Reprint=OK">'. _('Do a Re-Print') . ' (' . _('Plain paper') . ' - ' . _('A4') . ' ' . _('landscape') . ') ' . _('Even Though Previously Printed'). '</a>'; + '<a href="' . $rootpath. '/PrintCustOrder_generic.php?TransNo=' . $_GET['TransNo'] . '&Reprint=OK">'. _('Do a Re-Print') . ' (' . _('Plain paper') . ' - ' . _('A4') . ' ' . _('landscape') . ') ' . _('Even Though Previously Printed'). '</a>'; echo '<br /><br /><br />'; echo _('Or select another Order Number to Print'); - echo '<table class="table_index"><tr><td class="menu_group_item"> - <li><a href="'. $rootpath . '/SelectSalesOrder.php?'. SID .'">' . _('Outstanding Sales Orders') . '</a></li> - <li><a href="'. $rootpath . '/SelectCompletedOrder.php?'. SID .'">' . _('Completed Sales Orders') . '</a></li> - </td></tr></table></div><br /><br /><br />'; + echo '<table class="table_index"> + <tr> + <td class="menu_group_item"> + <li><a href="'. $rootpath . '/SelectSalesOrder.php">' . _('Outstanding Sales Orders') . '</a></li> + <li><a href="'. $rootpath . '/SelectCompletedOrder.php">' . _('Completed Sales Orders') . '</a></li> + </td> + </tr> + </table> + </div> + <br /> + <br /> + <br />'; include('includes/footer.inc'); exit; @@ -109,13 +115,14 @@ $PageNumber = 1; $ErrMsg = _('There was a problem retrieving the details for Order Number') . ' ' . $_GET['TransNo'] . ' ' . _('from the database'); $sql = "SELECT salesorderdetails.stkcode, - stockmaster.description, - salesorderdetails.quantity, - salesorderdetails.qtyinvoiced, - salesorderdetails.unitprice - FROM salesorderdetails INNER JOIN stockmaster - ON salesorderdetails.stkcode=stockmaster.stockid - WHERE salesorderdetails.orderno='" . $_GET['TransNo'] . "'"; + stockmaster.description, + salesorderdetails.quantity, + salesorderdetails.qtyinvoiced, + salesorderdetails.unitprice, + stockmaster.decimalplaces + FROM salesorderdetails INNER JOIN stockmaster + ON salesorderdetails.stkcode=stockmaster.stockid + WHERE salesorderdetails.orderno='" . filter_number_format($_GET['TransNo']) . "'"; $result=DB_query($sql, $db, $ErrMsg); if (DB_num_rows($result)>0){ @@ -162,9 +169,9 @@ while ($myrow2=DB_fetch_array($result)){ - $DisplayQty = locale_number_format($myrow2['quantity'],2); - $DisplayPrevDel = locale_number_format($myrow2['qtyinvoiced'],2); - $DisplayQtySupplied = locale_number_format($myrow2['quantity'] - $myrow2['qtyinvoiced'],2); + $DisplayQty = locale_number_format($myrow2['quantity'],$myrow2['decimalplaces']); + $DisplayPrevDel = locale_number_format($myrow2['qtyinvoiced'],$myrow2['decimalplaces']); + $DisplayQtySupplied = locale_number_format($myrow2['quantity'] - $myrow2['qtyinvoiced'],$myrow2['decimalplaces']); $LeftOvers = $pdf->addTextWrap(13,$YPos,135,$FontSize,$myrow2['stkcode']); $LeftOvers = $pdf->addTextWrap(148,$YPos,239,$FontSize,$myrow2['description']); @@ -188,14 +195,16 @@ $pdf->OutputD($_SESSION['DatabaseName'] . '_Customer_Order_' . $_GET['TransNo'] . '_' . Date('Y-m-d') .'.pdf'); $pdf-> __destruct(); - $sql = "UPDATE salesorders SET printedpackingslip=1, datepackingslipprinted='" . Date('Y-m-d') . "' WHERE salesorders.orderno='" .$_GET['TransNo'] . "'"; + $sql = "UPDATE salesorders SET printedpackingslip=1, + datepackingslipprinted='" . Date('Y-m-d') . "' + WHERE salesorders.orderno='" .filter_number_format($_GET['TransNo']) . "'"; $result = DB_query($sql,$db); } else { $title = _('Print Packing Slip Error'); include('includes/header.inc'); echo '<p>'. _('There were no outstanding items on the order to deliver. A dispatch note cannot be printed'). - '<br /><a href="' . $rootpath . '/SelectSalesOrder.php?' . SID . '">'. _('Print Another Packing Slip/Order'). - '</a>' . '<br />'. '<a href="' . $rootpath . '/index.php?' . SID . '">' . _('Back to the menu') . '</a>'; + '<br /><a href="' . $rootpath . '/SelectSalesOrder.php">'. _('Print Another Packing Slip/Order'). + '</a>' . '<br />'. '<a href="' . $rootpath . '/index.php">' . _('Back to the menu') . '</a>'; include('includes/footer.inc'); exit; } /*end if there are order details to show on the order*/ Modified: trunk/PrintCustOrder_generic.php =================================================================== --- trunk/PrintCustOrder_generic.php 2011-09-23 09:13:29 UTC (rev 4703) +++ trunk/PrintCustOrder_generic.php 2011-09-24 07:39:35 UTC (rev 4704) @@ -11,7 +11,7 @@ If (!isset($_GET['TransNo']) OR $_GET['TransNo']==""){ $title = _('Select Order To Print'); include('includes/header.inc'); - echo '<div class=centre><br /><br /><br />'; + echo '<div class="centre"><br /><br /><br />'; prnMsg( _('Select an Order Number to Print before calling this page') , 'error'); echo '<br /> <br /> @@ -65,7 +65,7 @@ WHERE salesorders.debtorno=debtorsmaster.debtorno AND salesorders.shipvia=shippers.shipper_id AND salesorders.fromstkloc=locations.loccode - AND salesorders.orderno='" . $_GET['TransNo'] . "'"; + AND salesorders.orderno='" . filter_number_format($_GET['TransNo']) . "'"; $result=DB_query($sql,$db, $ErrMsg); @@ -166,7 +166,7 @@ stockmaster.decimalplaces FROM salesorderdetails INNER JOIN stockmaster ON salesorderdetails.stkcode=stockmaster.stockid - WHERE salesorderdetails.orderno='" . $_GET['TransNo'] . "'"; + WHERE salesorderdetails.orderno='" . filter_number_format($_GET['TransNo']) . "'"; $result=DB_query($sql,$db, $ErrMsg); if (DB_num_rows($result)>0){ @@ -248,7 +248,7 @@ $pdf->__destruct(); $sql = "UPDATE salesorders SET printedpackingslip=1, datepackingslipprinted='" . Date('Y-m-d') . "' - WHERE salesorders.orderno='" .$_GET['TransNo'] . "'"; + WHERE salesorders.orderno='" . filter_number_format($_GET['TransNo']) . "'"; $result = DB_query($sql,$db); } Modified: trunk/PrintCustStatements.php =================================================================== --- trunk/PrintCustStatements.php 2011-09-23 09:13:29 UTC (rev 4703) +++ trunk/PrintCustStatements.php 2011-09-24 07:39:35 UTC (rev 4704) @@ -23,16 +23,14 @@ } if (isset($_GET['FromCust'])) { - $getFrom = $_GET['FromCust']; - $_POST['FromCust'] = $getFrom; + $_POST['FromCust'] = $_GET['FromCust']; } if (isset($_GET['ToCust'])) { - $getTo = $_GET['ToCust']; - $_POST['ToCust'] = $getTo; + $_POST['ToCust'] = $_GET['ToCust']; } -If (isset($_POST['PrintPDF']) && isset($_POST['FromCust']) && $_POST['FromCust']!=''){ +If (isset($_POST['PrintPDF']) AND isset($_POST['FromCust']) AND $_POST['FromCust']!=''){ $_POST['FromCust'] = mb_strtoupper($_POST['FromCust']); If (!isset($_POST['ToCust'])){ @@ -68,6 +66,7 @@ debtorsmaster.lastpaid, debtorsmaster.lastpaiddate, currencies.currency, + currencies.decimalplaces AS currdecimalplaces, paymentterms.terms FROM debtorsmaster INNER JOIN currencies ON debtorsmaster.currcode=currencies.currabrev @@ -163,8 +162,8 @@ while ($myrow=DB_fetch_array($SetldTrans)){ - $DisplayAlloc = locale_number_format($myrow['alloc'],2); - $DisplayOutstanding = locale_number_format($myrow['ostdg'],2); + $DisplayAlloc = locale_money_format($myrow['alloc'],$StmtHeader['currdecimalplaces']); + $DisplayOutstanding = locale_money_format($myrow['ostdg'],$StmtHeader['currdecimalplaces']); $FontSize=9; @@ -174,10 +173,10 @@ $FontSize=10; if ($myrow['total']>0){ - $DisplayTotal = locale_number_format($myrow['total'],2); + $DisplayTotal = locale_money_format($myrow['total'],$StmtHeader['currdecimalplaces']); $LeftOvers = $pdf->addTextWrap($Left_Margin+300,$YPos,60,$FontSize,$DisplayTotal, 'right'); } else { - $DisplayTotal = locale_number_format(-$myrow['total'],2); + $DisplayTotal = locale_money_format(-$myrow['total'],$StmtHeader['currdecimalplaces']); $LeftOvers = $pdf->addTextWrap($Left_Margin+382,$YPos,60,$FontSize,$DisplayTotal, 'right'); } $LeftOvers = $pdf->addTextWrap($Left_Margin+459,$YPos,60,$FontSize,$DisplayAlloc, 'right'); @@ -214,8 +213,8 @@ while ($myrow=DB_fetch_array($OstdgTrans)){ - $DisplayAlloc = locale_number_format($myrow['alloc'],2); - $DisplayOutstanding = locale_number_format($myrow['ostdg'],2); + $DisplayAlloc = locale_money_format($myrow['alloc'],$StmtHeader['currdecimalplaces']); + $DisplayOutstanding = locale_money_format($myrow['ostdg'],$StmtHeader['currdecimalplaces']); $FontSize=9; $LeftOvers = $pdf->addTextWrap($Left_Margin+1,$YPos,60,$FontSize,$myrow['typename'], 'left'); @@ -224,10 +223,10 @@ $FontSize=10; if ($myrow['total']>0){ - $DisplayTotal = locale_number_format($myrow['total'],2); + $DisplayTotal = locale_money_format($myrow['total'],$StmtHeader['currdecimalplaces']); $LeftOvers = $pdf->addTextWrap($Left_Margin+300,$YPos,55,$FontSize,$DisplayTotal, 'right'); } else { - $DisplayTotal = locale_number_format(-$myrow['total'],2); + $DisplayTotal = locale_money_format(-$myrow['total'],$StmtHeader['currdecimalplaces']); $LeftOvers = $pdf->addTextWrap($Left_Margin+382,$YPos,55,$FontSize,$DisplayTotal, 'right'); } @@ -344,11 +343,11 @@ /*Now print out the footer and totals */ - $DisplayDue = locale_number_format($AgedAnalysis['due']-$AgedAnalysis['overdue1'],2); - $DisplayCurrent = locale_number_format($AgedAnalysis['balance']-$AgedAnalysis['due'],2); - $DisplayBalance = locale_number_format($AgedAnalysis['balance'],2); - $DisplayOverdue1 = locale_number_format($AgedAnalysis['overdue1']-$AgedAnalysis['overdue2'],2); - $DisplayOverdue2 = locale_number_format($AgedAnalysis['overdue2'],2); + $DisplayDue = locale_money_format($AgedAnalysis['due']-$AgedAnalysis['overdue1'],$StmtHeader['currdecimalplaces']); + $DisplayCurrent = locale_money_format($AgedAnalysis['balance']-$AgedAnalysis['due'],$StmtHeader['currdecimalplaces']); + $DisplayBalance = locale_money_format($AgedAnalysis['balance'],$StmtHeader['currdecimalplaces']); + $DisplayOverdue1 = locale_money_format($AgedAnalysis['overdue1']-$AgedAnalysis['overdue2'],$StmtHeader['currdecimalplaces']); + $DisplayOverdue2 = locale_money_format($AgedAnalysis['overdue2'],$StmtHeader['currdecimalplaces']); $pdf->line($Page_Width-$Right_Margin, $Bottom_Margin+(4*$line_height),$Left_Margin,$Bottom_Margin+(4*$line_height)); @@ -376,9 +375,9 @@ $pdf->line($Left_Margin, $YPos,$Perforation,$YPos); - if (mb_strlen($StmtHeader['lastpaiddate'])>1 && $StmtHeader['lastpaid']!=0){ + if (mb_strlen($StmtHeader['lastpaiddate'])>1 AND $StmtHeader['lastpaid']!=0){ $pdf->addText($Left_Margin+5, $Bottom_Margin+13, $FontSize, _('Last payment received').' ' . ConvertSQLDate($StmtHeader['lastpaiddate']) . - ' ' . _('Amount received was').' ' . locale_number_format($StmtHeader['lastpaid'],2)); + ' ' . _('Amount received was').' ' . locale_money_format($StmtHeader['lastpaid'],$StmtHeader['currdecimalplaces'])); } /*also show the total due in the remittance section */ @@ -411,19 +410,19 @@ $title = _('Select Statements to Print'); include('includes/header.inc'); echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/printer.png" title="' . _('Print') . '" alt="" />' . ' ' . _('Print Customer Account Statements') . '</p>'; - if (!isset($_POST['FromCust']) || $_POST['FromCust']=='') { + if (!isset($_POST['FromCust']) OR $_POST['FromCust']=='') { /*if FromTransNo is not set then show a form to allow input of either a single statement number or a range of statements to be printed. Also get the last statement number created to show the user where the current range is up to */ - echo '<form action="' . $_SERVER['PHP_SELF'] . '" method="POST"><table class=selection>'; + echo '<form action="' . $_SERVER['PHP_SELF'] . '" method="POST"><table class="selection">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; echo '<tr><td>' . _('Starting Customer statement to print (Customer code)'). ' - </td><td><input Type=text max=6 size=7 name=FromCust value="1"></td></tr> + </td><td><input type="text" max="6" size="7" name="FromCust" value="1" /></td></tr> <tr><td>'. _('Ending Customer statement to print (Customer code)').'</td><td> - <input Type=text max=6 size=7 name=ToCust value="zzzzzz"></td></tr></table> + <input type="text" max="6" size="7" name="ToCust" value="zzzzzz"></td></tr></table> <br /><div class="centre"> - <input type=Submit Name="PrintPDF" Value="' . + <input type="submit" name="PrintPDF" value="' . _('Print All Statements in the Range Selected').'"> </div>'; } Modified: trunk/PrintCustTransPortrait.php =================================================================== --- trunk/PrintCustTransPortrait.php 2011-09-23 09:13:29 UTC (rev 4703) +++ trunk/PrintCustTransPortrait.php 2011-09-24 07:39:35 UTC (rev 4704) @@ -5,9 +5,9 @@ include('includes/session.inc'); if (isset($_GET['FromTransNo'])) { - $FromTransNo = $_GET['FromTransNo']; + $FromTransNo = filter_number_format($_GET['FromTransNo']); } elseif (isset($_POST['FromTransNo'])){ - $FromTransNo = $_POST['FromTransNo']; + $FromTransNo = filter_number_format($_POST['FromTransNo']); } else { $FromTransNo = ''; } @@ -25,8 +25,8 @@ } If (!isset($_POST['ToTransNo']) - or trim($_POST['ToTransNo'])=='' - or $_POST['ToTransNo'] < $FromTransNo) { + OR trim($_POST['ToTransNo'])=='' + OR filter_number_format($_POST['ToTransNo']) < $FromTransNo) { $_POST['ToTransNo'] = $FromTransNo; } @@ -69,7 +69,7 @@ $FirstPage = true; $line_height=16; - while ($FromTransNo <= $_POST['ToTransNo']){ + while ($FromTransNo <= filter_number_format($_POST['ToTransNo'])){ /*retrieve the invoice details from the database to print notice that salesorder record must be present to print the invoice purging of sales orders will @@ -164,7 +164,7 @@ INNER JOIN currencies ON debtorsmaster.currcode=currencies.currabrev WHERE debtortrans.type=10 - AND debtortrans.transno='" . $FromTransNo . "'"; + AND debtortrans.transno='" . filter_number_format($FromTransNo) . "'"; if (isset($_POST['PrintEDI']) and $_POST['PrintEDI']=='No') { $sql = $sql . " AND debtorsmaster.ediinvoices=0"; @@ -217,7 +217,7 @@ INNER JOIN currencies ON debtorsmaster.currcode=currencies.currabrev WHERE debtortrans.type=11 - AND debtortrans.transno='" . $FromTransNo . "'"; + AND debtortrans.transno='" . filter_number_format($FromTransNo) . "'"; if (isset($_POST['PrintEDI']) and $_POST['PrintEDI']=='No'){ @@ -234,7 +234,7 @@ prnMsg( _('There was a problem retrieving the invoice or credit note details for note number') . ' ' . $InvoiceToPrint . ' ' . _('from the database') . '. ' . _('To print an invoice, the sales order record, the customer transaction record and the branch record for the customer must not have been purged') . '. ' . _('To print a credit note only requires the customer, transaction, salesman and branch records be available'),'error'); if ($debug==1){ - prnMsg (_('The SQL used to get this information that failed was') . "<br />" . $sql,'error'); + prnMsg (_('The SQL used to get this information that failed was') . '<br />' . $sql,'error'); } include ('includes/footer.inc'); exit; @@ -260,7 +260,7 @@ FROM stockmoves INNER JOIN stockmaster ON stockmoves.stockid = stockmaster.stockid WHERE stockmoves.type=10 - AND stockmoves.transno='" . $FromTransNo . "' + AND stockmoves.transno='" . filter_number_format($FromTransNo) . "' AND stockmoves.show_on_inv_crds=1"; } else { /* only credit notes to be retrieved */ @@ -279,7 +279,7 @@ FROM stockmoves INNER JOIN stockmaster ON stockmoves.stockid = stockmaster.stockid WHERE stockmoves.type=11 - AND stockmoves.transno='" . $FromTransNo . "' + AND stockmoves.transno='" . filter_number_format($FromTransNo) . "' AND stockmoves.show_on_inv_crds=1"; } // end else @@ -537,7 +537,7 @@ echo '<option value="Credit">' . _('Credit Notes') . '</option>'; } else { echo '<option selected value="Credit">' . _('Credit Notes') . '</option>'; - echo '<option VALUE="Invoice">' . _('Invoices') . '</option>'; + echo '<option value="Invoice">' . _('Invoices') . '</option>'; } echo '</select></td></tr>'; @@ -545,11 +545,11 @@ if ($InvOrCredit=='Invoice' OR !isset($InvOrCredit)){ echo '<option selected value="No">' . _('Do not Print PDF EDI Transactions') . '</option>'; - echo '<option VALUE="Yes">' . _('Print PDF EDI Transactions Too') . '</option>'; + echo '<option value="Yes">' . _('Print PDF EDI Transactions Too') . '</option>'; } else { - echo '<option VALUE="No">' . _('Do not Print PDF EDI Transactions') . '</option>'; + echo '<option value="No">' . _('Do not Print PDF EDI Transactions') . '</option>'; echo '<option selected value="Yes">' . _('Print PDF EDI Transactions Too') . '</option>'; } @@ -642,7 +642,7 @@ INNER JOIN currencies ON debtorsmaster.currcode=currencies.currabrev WHERE debtortrans.type=10 - AND debtortrans.transno='" . $FromTransNo . "'"; + AND debtortrans.transno='" . filter_number_format($FromTransNo) . "'"; } else { //its a credit note $sql = "SELECT debtortrans.trandate, @@ -682,7 +682,7 @@ INNER JOIN currencies ON debtorsmaster.currcode=currencies.currabrev WHERE debtortrans.type=11 - AND debtortrans.transno='" . $FromTransNo . "'"; + AND debtortrans.transno='" . filter_number_format($FromTransNo) . "'"; } @@ -729,7 +729,7 @@ echo _('Facsimile') . ': ' . $_SESSION['CompanyRecord']['fax'] . '<br />'; echo _('Email') . ': ' . $_SESSION['CompanyRecord']['email'] . '<br />'; - echo '</td><td width=50% class=number>'; + echo '</td><td width=50% class+"number">'; /*Now the customer charged to details in a sub table within a cell of the main table*/ @@ -809,7 +809,7 @@ FROM stockmoves INNER JOIN stockmaster ON stockmoves.stockid = stockmaster.stockid WHERE stockmoves.type=10 - AND stockmoves.transno='" . $FromTransNo . "' + AND stockmoves.transno='" . filter_number_format($FromTransNo) . "' AND stockmoves.show_on_inv_crds=1"; } else { /* then its a credit note */ @@ -848,7 +848,7 @@ FROM stockmoves INNER JOIN stockmaster ON stockmoves.stockid = stockmaster.stockid WHERE stockmoves.type=11 - AND stockmoves.transno='" . $FromTransNo . "' + AND stockmoves.transno='" . filter_number_format($FromTransNo) . "' AND stockmoves.show_on_inv_crds=1"; } @@ -903,11 +903,11 @@ printf ('<td>%s</td> <td>%s</td> - <td class=number>%s</td> - <td class=number>%s</td> - <td class=number>%s</td> - <td class=number>%s</td> - <td class=number>%s</td> + <td class+"number">%s</td> + <td class+"number">%s</td> + <td class+"number">%s</td> + <td class+"number">%s</td> + <td class+"number">%s</td> </tr>', $myrow2['stockid'], $myrow2['description'], @@ -949,7 +949,7 @@ echo _('Telephone') . ': ' . $_SESSION['CompanyRecord']['telephone'] . '<br />'; echo _('Facsimile') . ': ' . $_SESSION['CompanyRecord']['fax'] . '<br />'; echo _('Email') . ': ' . $_SESSION['CompanyRecord']['email'] . '<br />'; - echo '</td><td class=number>' . _('Page') . ': ' . $PageNumber . '</td></tr></table>'; + echo '</td><td class+"number">' . _('Page') . ': ' . $PageNumber . '</td></tr></table>'; echo '<table class="table1"> <tr> <th>' . _('Item Code') . '</th> @@ -997,7 +997,7 @@ echo _('Telephone') . ': ' . $_SESSION['CompanyRecord']['telephone'] . '<br />'; echo _('Facsimile') . ': ' . $_SESSION['CompanyRecord']['fax'] . '<br />'; echo _('Email') . ': ' . $_SESSION['CompanyRecord']['email'] . '<br />'; - echo '</td><td class=number>' . _('Page') . ': ' . $PageNumber . '</td> + echo '</td><td class+"number">' . _('Page') . ': ' . $PageNumber . '</td> </tr> </table>'; echo '<table class="table1"> @@ -1051,7 +1051,7 @@ echo '<tr><td class="number"><b>' . _('TOTAL INVOICE') . '</b></td> <td class="number" bgcolor="#EEEEEE"><U><b>' . $DisplayTotal . '</b></U></td></tr>'; } else { - echo '<tr><td class=number><font color=RED><b>' . _('TOTAL CREDIT') . '</b></font></td> + echo '<tr><td class+"number"><font color=RED><b>' . _('TOTAL CREDIT') . '</b></font></td> <td class="number" bgcolor="#EEEEEE"><font color="red"><U><b>' . $DisplayTotal . '</b></u></font></td></tr>'; } echo '</table>'; Modified: trunk/PurchData.php =================================================================== --- trunk/PurchData.php 2011-09-23 09:13:29 UTC (rev 4703) +++ trunk/PurchData.php 2011-09-24 07:39:35 UTC (rev 4704) @@ -25,7 +25,7 @@ $NoPurchasingData=0; -echo '<a href="' . $rootpath . '/SelectProduct.php?' . SID . '">' . _('Back to Items') . '</a><br />'; +echo '<a href="' . $rootpath . '/SelectProduct.php">' . _('Back to Items') . '</a><br />'; if (isset($_POST['SupplierDescription'])) { $_POST['SupplierDescription'] = trim($_POST['SupplierDescription']); @@ -37,25 +37,24 @@ $InputError = 1; prnMsg(_('There is no stock item set up enter the stock code or select a stock item using the search page'), 'error'); } - if (!is_numeric($_POST['Price'])) { + if (!is_numeric(filter_number_format($_POST['Price']))) { $InputError = 1; unset($_POST['Price']); prnMsg(_('The price entered was not numeric and a number is expected. No changes have been made to the database'), 'error'); - } - if ($_POST['Price'] == 0) { + }elseif ($_POST['Price'] == 0) { prnMsg(_('The price entered is zero') . ' ' . _('Is this intentional?'), 'warn'); } - if (!is_numeric($_POST['LeadTime'])) { + if (!is_numeric(filter_number_format($_POST['LeadTime']))) { $InputError = 1; unset($_POST['LeadTime']); prnMsg(_('The lead time entered was not numeric a number of days is expected no changes have been made to the database'), 'error'); } - if (!is_numeric($_POST['MinOrderQty'])) { + if (!is_numeric(filter_number_format($_POST['MinOrderQty']))) { $InputError = 1; unset($_POST['MinOrderQty']); prnMsg(_('The minimum order quantity was not numeric and a number is expected no changes have been made to the database'), 'error'); } - if (!is_numeric($_POST['ConversionFactor'])) { + if (!is_numeric(filter_number_format($_POST['ConversionFactor']))) { $InputError = 1; unset($_POST['ConversionFactor']); prnMsg(_('The conversion factor entered was not numeric') . ' (' . _('a number is expected') . '). ' . _('The conversion factor is the number which the price must be divided by to get the unit price in our unit of measure') . '. <br />' . _('E.g.') . ' ' . _('The supplier sells an item by the tonne and we hold stock by the kg') . '. ' . _('The suppliers price must be divided by 1000 to get to our cost per kg') . '. ' . _('The conversion factor to enter is 1000') . '. <br /><br />' . _('No changes will be made to the database'), 'error'); @@ -74,14 +73,14 @@ preferred) VALUES ('" . $SupplierID . "', '" . $StockID . "', - '" . $_POST['Price'] . "', + '" . filter_number_format($_POST['Price']) . "', '" . FormatDateForSQL($_POST['EffectiveFrom']) . "', '" . $_POST['SuppliersUOM'] . "', - '" . $_POST['ConversionFactor'] . "', + '" . filter_number_format($_POST['ConversionFactor']) . "', '" . $_POST['SupplierDescription'] . "', '" . $_POST['SupplierCode'] . "', - '" . $_POST['LeadTime'] . "', - '" . $_POST['MinOrderQty'] . "', + '" . filter_number_format($_POST['LeadTime']) . "', + '" . filter_number_format($_POST['MinOrderQty']) . "', '" . $_POST['Preferred'] . "')"; $ErrMsg = _('The supplier purchasing details could not be added to the database because'); $DbgMsg = _('The SQL that failed was'); @@ -89,14 +88,14 @@ prnMsg(_('This supplier purchasing data has been added to the database'), 'success'); } if ($InputError == 0 AND isset($_POST['UpdateRecord'])) { - $sql = "UPDATE purchdata SET price='" . $_POST['Price'] . "', + $sql = "UPDATE purchdata SET price='" . filter_number_format($_POST['Price']) . "', effectivefrom='" . FormatDateForSQL($_POST['EffectiveFrom']) . "', suppliersuom='" . $_POST['SuppliersUOM'] . "', - conversionfactor='" . $_POST['ConversionFactor'] . "', + conversionfactor='" . filter_number_format($_POST['ConversionFactor']) . "', supplierdescription='" . $_POST['SupplierDescription'] . "', suppliers_partno='" . $_POST['SupplierCode'] . "', - leadtime='" . $_POST['LeadTime'] . "', - minorderqty='" . $_POST['MinOrderQty'] . "', + leadtime='" . filter_number_format($_POST['LeadTime']) . "', + minorderqty='" . filter_number_format($_POST['MinOrderQty']) . "', preferred='" . $_POST['Preferred'] . "' WHERE purchdata.stockid='".$StockID."' AND purchdata.supplierno='".$SupplierID."' @@ -136,20 +135,23 @@ if (!isset($_GET['Edit'])) { echo '<p class="page_title_text"><img src="' . $rootpath . '/css/' . $theme . '/images/maintenance.png" title="' . _('Search') . '" alt="" />' . ' ' . $title . ' ' . _('For Stock Code') . ' - ' . $StockID . '</p><br />'; - $sql = "SELECT purchdata.supplierno, - suppliers.suppname, - purchdata.price, - suppliers.currcode, - purchdata.effectivefrom, - purchdata.suppliersuom, - purchdata.supplierdescription, - purchdata.leadtime, - purchdata.suppliers_partno, - purchdata.minorderqty, - purchdata.preferred, - purchdata.conversionfactor + $sql = "SELECT purchdata.supplierno, + suppliers.suppname, + purchdata.price, + suppliers.currcode, + purchdata.effectivefrom, + purchdata.suppliersuom, + purchdata.supplierdescription, + purchdata.leadtime, + purchdata.suppliers_partno, + purchdata.minorderqty, + purchdata.preferred, + purchdata.conversionfactor, + currencies.decimalplaces AS currdecimalplaces FROM purchdata INNER JOIN suppliers ON purchdata.supplierno=suppliers.supplierid + INNER JOIN currencies + ON suppliers.currcode=currencies.currabrev WHERE purchdata.stockid = '" . $StockID . "' ORDER BY purchdata.effectivefrom DESC"; $ErrMsg = _('The supplier purchasing details for the selected part could not be retrieved because'); @@ -189,24 +191,24 @@ } else { $DisplayPreferred = _('No'); } - printf("<td>%s</td> - <td class=number>%s</td> + printf('<td>%s</td> + <td class="number">%s</td> <td>%s</td> - <td class=number>%s</td> - <td class=number>%s</td> + <td class="number">%s</td> + <td class="number">%s</td> <td>%s</td> <td>%s</td> <td>%s</td> - <td>%s " . _('days') . "</td> + <td>%s ' . _('days') . '</td> <td>%s</td> - <td><a href='%s?StockID=%s&SupplierID=%s&Edit=1&EffectiveFrom=%s'>" . _('Edit') . "</a></td> - <td><a href='%s?StockID=%s&SupplierID=%s&Delete=1&EffectiveFrom=%s' onclick=\"return confirm('" . _('Are you sure you wish to delete this suppliers price?') . "');\">" . _('Delete') . "</a></td> - </tr>", + <td><a href="%s?StockID=%s&SupplierID=%s&Edit=1&EffectiveFrom=%s">' . _('Edit') . '</a></td> + <td><a href="%s?StockID=%s&SupplierID=%s&Delete=1&EffectiveFrom=%s" onclick=\'return confirm("' . _('Are you sure you wish to delete this suppliers price?') . '");\'>' . _('Delete') . '</a></td> + </tr>', $myrow['suppname'], - locale_number_format($myrow['price'], 3), + locale_money_format($myrow['price'], $myrow['currdecimalplaces']), $myrow['suppliersuom'], $myrow['conversionfactor'], - locale_number_format($myrow['price']/$myrow['conversionfactor'],2), + locale_money_format($myrow['price']/$myrow['conversionfactor'],$myrow['currdecimalplaces']), $myrow['currcode'], ConvertSQLDate($myrow['effectivefrom']), $myrow['minorderqty'], @@ -232,7 +234,13 @@ } /* Only show the existing purchasing data records if one is not being edited */ if (isset($SupplierID) AND $SupplierID != '' AND !isset($_POST['SearchSupplier'])) { /*NOT EDITING AN EXISTING BUT SUPPLIER selected OR ENTERED*/ - $sql = "SELECT suppliers.suppname, suppliers.currcode FROM suppliers WHERE supplierid='".$SupplierID."'"; + $sql = "SELECT suppliers.suppname, + suppliers.currcode, + currencies.decimalplaces AS currdecimalplaces + FROM suppliers + INNER JOIN currencies + ON suppliers.currcode=currencies.currabrev + WHERE supplierid='".$SupplierID."'"; $ErrMsg = _('The supplier details for the selected supplier could not be retrieved because'); $DbgMsg = _('The SQL that failed was'); $SuppSelResult = DB_query($sql, $db, $ErrMsg, $DbgMsg); @@ -240,6 +248,7 @@ $myrow = DB_fetch_array($SuppSelResult); $SuppName = $myrow['suppname']; $CurrCode = $myrow['currcode']; + $CurrDecimalPlaces = $myrow['currdecimalplaces']; } else { prnMsg(_('The supplier code') . ' ' . $SupplierID . ' ' . _('is not an existing supplier in the database') . '. ' . _('You must enter an alternative supplier code or select a supplier using the search facility below'), 'error'); unset($SupplierID); @@ -249,16 +258,18 @@ echo '<p class="page_title_text"><img src="' . $rootpath . '/css/' . $theme . '/images/maintenance.png" title="' . _('Search') . '" alt="" />' . ' ' . $title . ' ' . _('For Stock Code') . ' - ' . $StockID . '</p><br />'; } if (!isset($_POST['SearchSupplier'])) { - echo '<form action="' . $_SERVER['PHP_SELF'] . '?' . SID . '" method=post><table cellpadding=3 colspan=4 class=selection><tr>'; + echo '<form action="' . $_SERVER['PHP_SELF'] . '" method="post"> + <table cellpadding="3" colspan="4" class="selection"> + <tr>'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; echo '<input type="hidden" name="StockID" value="' . $StockID . '">'; echo '<td>' . _('Text in the Supplier') . ' <b>' . _('NAME') . '</b>:</font></td>'; - echo '<td><input type="Text" name="Keywords" size=20 maxlength=25></td>'; + echo '<td><input type="text" name="Keywords" size="20" maxlength="25"></td>'; echo '<td><font size=3><b>' . _('OR') . '</b></font></td>'; echo '<td>' . _('Text in Supplier') . ' <b>' . _('CODE') . '</b>:</font></td>'; - echo '<td><input type="Text" name="SupplierCode" size=15 maxlength=18></td>'; + echo '<td><input type="text" name="SupplierCode" size=15 maxlength=18></td>'; echo '</tr></table><br />'; - echo '<div class="centre"><input type=submit name="SearchSupplier" value="' . _('Find Suppliers Now') . '"></div></form>'; + echo '<div class="centre"><input type="submit" name="SearchSupplier" value="' . _('Find Suppliers Now') . '"></div></form>'; include ('includes/footer.inc'); exit; }; @@ -326,15 +337,16 @@ $StockID = ''; $StockUOM = 'each'; } - echo '<form action="' . $_SERVER['PHP_SELF'] . '?' . SID . '" method=post><table cellpadding=2 colspan=7 class=selection>'; + echo '<form action="' . $_SERVER['PHP_SELF'] . '" method=post> + <table cellpadding="2" colspan="7" class="selection">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; $TableHeader = '<tr><th>' . _('Code') . '</th> <th>' . _('Supplier Name') . '</th> - <th>' . _('Currency') . '</th> - <th>' . _('Address 1') . '</th> - <th>' . _('Address 2') . '</th> - <th>' . _('Address 3') . '</th> - </tr>'; + <th>' . _('Currency') . '</th> + <th>' . _('Address 1') . '</th> + <th>' . _('Address 2') . '</th> + <th>' . _('Address 3') . '</th> + </tr>'; echo $TableHeader; $k = 0; while ($myrow = DB_fetch_array($SuppliersResult)) { @@ -359,8 +371,8 @@ $myrow['address2'], $myrow['address3']); - echo '<input type=hidden name=StockID value="' . $StockID . '">'; - echo '<input type=hidden name=StockUOM value="' . $StockUOM . '">'; + echo '<input type="hidden" name="StockID" value="' . $StockID . '" />'; + echo '<input type="hidden" name="StockUOM" value="' . $StockUOM . '" />'; } //end of while loop @@ -384,7 +396,7 @@ purchdata.minorderqty, purchdata.preferred, stockmaster.units, - currencies.decimalplaces + currencies.decimalplaces AS currdecimalplaces FROM purchdata INNER JOIN suppliers ON purchdata.supplierno=suppliers.supplierid INNER JOIN stockmaster @@ -401,6 +413,7 @@ $_POST['Price'] = $myrow['price']; $_POST['EffectiveFrom'] = ConvertSQLDate($myrow['effectivefrom']); $CurrCode = $myrow['currcode']; + $CurrDecimalPlaces = $myrow['currdecimalplaces']; $_POST['SuppliersUOM'] = $myrow['suppliersuom']; $_POST['SupplierDescription'] = $myrow['supplierdescription']; $_POST['LeadTime'] = $myrow['leadtime']; @@ -418,10 +431,10 @@ } if (isset($_GET['Edit'])) { echo '<tr><td>' . _('Supplier Name') . ':</td> - <td><input type=hidden name="SupplierID" value="' . $SupplierID . '">' . $SupplierID . ' - ' . $SuppName . '<input type=hidden name="WasEffectiveFrom" value="' . $myrow['effectivefrom'] . '"></td></tr>'; + <td><input type=hidden name="SupplierID" value="' . $SupplierID . '">' . $SupplierID . ' - ' . $SuppName . '<input type=hidden name="WasEffectiveFrom" value="' . $myrow['effectivefrom'] . '" /></td></tr>'; } else { echo '<tr><td>' . _('Supplier Name') . ':</td> - <input type=hidden name="SupplierID" maxlength=10 size=11 value="' . $SupplierID . '">'; + <input type=hidden name="SupplierID" maxlength=10 size=11 value="' . $SupplierID . '" />'; if ($SupplierID!='') { echo '<td>'.$SuppName; } @@ -432,7 +445,7 @@ } echo '</td></tr>'; } - echo '<td><input type=hidden name="StockID" maxlength=10 size=11 value="' . $StockID . '">'; + echo '<td><input type=hidden name="StockID" maxlength=10 size=11 value="' . $StockID . '" />'; if (!isset($CurrCode)) { $CurrCode = ''; } @@ -457,7 +470,7 @@ echo '<tr><td>' . _('Currency') . ':</td> <td><input type=hidden name="CurrCode" . value="' . $CurrCode . '">' . $CurrCode . '</td></tr>'; echo '<tr><td>' . _('Price') . ' (' . _('in Supplier Currency') . '):</td> - <td><input type="text" class="number" name="Price" maxlength=12 size=12 value=' . round($_POST['Price'], $myrow['decimalplaces']) . '></td></tr>'; + <td><input type="text" class="number" name="Price" maxlength=12 size=12 value=' . locale_money_format(round($_POST['Price'], $CurrDecimalPlaces),$CurrDecimalPlaces) . ' /></td></tr>'; echo '<tr><td>' . _('Date Updated') . ':</td> <td><input type="text" class="date" alt="' . $_SESSION['DefaultDateFormat'] . '" name="EffectiveFrom" maxlength=10 size=11 value="' . $_POST['EffectiveFrom'] . '"></td></tr>'; echo '<tr><td>' . _('Our Unit of Measure') . ':</td>'; @@ -467,17 +480,17 @@ echo '<tr><td>' . _('Suppliers Unit of Measure') . ':</td>'; echo '<td><input type="text" name="SuppliersUOM" size="20" maxlength="20" value ="' . $_POST['SuppliersUOM'] . '"/>'; echo '</td></tr>'; - if (!isset($_POST['ConversionFactor']) OR $_POST['ConversionFactor'] == "") { + if (!isset($_POST['ConversionFactor']) OR $_POST['ConversionFactor'] == '') { $_POST['ConversionFactor'] = 1; } echo '<tr><td>' . _('Conversion Factor (to our UOM)') . ':</td> - <td><input type="text" class=number name="ConversionFactor" maxlength=12 size=12 value=' . $_POST['ConversionFactor'] . '></td></tr>'; + <td><input type="text" class="number" name="ConversionFactor" maxlength="12" size="12" value=' . $_POST['ConversionFactor'] . '></td></tr>'; echo '<tr><td>' . _('Supplier Stock Code') . ':</td> - <td><input type="text" name="SupplierCode" maxlength=15 size=15 value="' . $_POST['SupplierCode'] . '"></td></tr>'; + <td><input type="text" name="SupplierCode" maxlength="15" size="15" value="' . $_POST['SupplierCode'] . '"></td></tr>'; echo '<tr><td>' . _('MinOrderQty') . ':</td> - <td><input type="text" class=number name="MinOrderQty" maxlength=15 size=15 value="' . $_POST['MinOrderQty'] . '"></td></tr>'; + <td><input type="text" class="number" name="MinOrderQty" maxlength=15 size=15 value="' . $_POST['MinOrderQty'] . '"></td></tr>'; echo '<tr><td>' . _('Supplier Stock Description') . ':</td> - <td><input type="text" name="SupplierDescription" maxlength=50 size=51 value="' . $_POST['SupplierDescription'] . '"></td></tr>'; + <td><input type="text" name="SupplierDescription" maxlength="50" size="51" value="' . $_POST['SupplierDescription'] . '"></td></tr>'; if (!isset($_POST['LeadTime']) OR $_POST['LeadTime'] == "") { $_POST['LeadTime'] = 1; } Modified: trunk/RecurringSalesOrders.php =================================================================== --- trunk/RecurringSalesOrders.php 2011-09-23 09:13:29 UTC (rev 4703) +++ trunk/RecurringSalesOrders.php 2011-09-24 07:39:35 UTC (rev 4704) @@ -16,9 +16,9 @@ $identifier=$_GET['identifier']; } -if ($_GET['NewRecurringOrder']=='Yes'){ +if (isset($_GET['NewRecurringOrder'])){ $NewRecurringOrder ='Yes'; -} elseif ($_POST['NewRecurringOrder']=='Yes'){ +} elseif (isset($_POST['NewRecurringOrder'])){ $NewRecurringOrder ='Yes'; } else { $NewRecurringOrder ='No'; @@ -57,12 +57,12 @@ recurringsalesorders.stopdate, recurringsalesorders.lastrecurrence, recurringsalesorders.autoinvoice - FROM recurringsalesorders, - debtorsmaster, - salestypes - WHERE recurringsalesorders.ordertype=salestypes.typeabbrev - AND recurringsalesorders.debtorno = debtorsmaster.debtorno - AND recurringsalesorders.recurrorderno = '" . $_GET['ModifyRecurringSalesOrder'] . "'"; + FROM recurringsalesorders + INNER JOIN debtorsmaster + ON recurringsalesorders.debtorno = debtorsmaster.debtorno + INNER JOIN salestypes + ON recurringsalesorders.ordertype=salestypes.typeabbrev + WHERE recurringsalesorders.recurrorderno = '" . $_GET['ModifyRecurringSalesOrder'] . "'"; $ErrMsg = _('The order cannot be retrieved because'); $GetOrdHdrResult = DB_query($OrderHeaderSQL,$db,$ErrMsg); @@ -84,7 +84,7 @@ $_SESSION['Items'.$identifier]->ShipVia = $myrow['shipvia']; $BestShipper = $myrow['shipvia']; $_SESSION['Items'.$identifier]->DeliverTo = $myrow['deliverto']; - $_SESSION['Items'.$identifier]->DeliveryDate = ConvertSQLDate($myrow['deliverydate']); + //$_SESSION['Items'.$identifier]->DeliveryDate = ConvertSQLDate($myrow['deliverydate']); $_SESSION['Items'.$identifier]->DelAdd1 = $myrow['deladd1']; $_SESSION['Items'.$identifier]->DelAdd2 = $myrow['deladd2']; $_SESSION['Items'.$identifier]->DelAdd3 = $myrow['deladd3']; @@ -160,11 +160,11 @@ if (isset($_POST['DeleteRecurringOrder'])){ - $sql = "DELETE FROM recurrsalesorderdetails WHERE recurrorderno='" . $_POST['ExistingRecurrOrderNo'] . "'"; + $sql = "DELETE FROM recurrsalesorderdetails WHERE recurrorderno='" . filter_number_format($_POST['ExistingRecurrOrderNo']) . "'"; $ErrMsg = _('Could not delete recurring sales order lines for the recurring order template') . ' ' . $_POST['ExistingRecurrOrderNo']; $result = DB_query($sql,$db,$ErrMsg); - $sql = "DELETE FROM recurringsalesorders WHERE recurrorderno='" . $_POST['ExistingRecurrOrderNo'] . "'"; + $sql = "DELETE FROM recurringsalesorders WHERE recurrorderno='" . filter_number_format($_POST['ExistingRecurrOrderNo']) . "'"; $ErrMsg = _('Could not delete the recurring sales order template number') . ' ' . $_POST['ExistingRecurrOrderNo']; $result = DB_query($sql,$db,$ErrMsg); @@ -200,7 +200,6 @@ if ($InputErrors == 0 ){ /*Error checks above all passed ok so lets go*/ - if ($NewRecurringOrder=='Yes'){ /* finally write the recurring order header to the database and then the line details*/ @@ -234,7 +233,7 @@ '" . $_SESSION['Items'.$identifier]->Branch . "', '". $_SESSION['Items'.$identifier]->CustRef ."', '". $_SESSION['Items'.$identifier]->Comments ."', - '" . Date("Y-m-d H:i") . "', + '" . Date('Y-m-d H:i') . "', '" . $_SESSION['Items'.$identifier]->DefaultSalesType . "', '" . $_SESSION['Items'.$identifier]->DeliverTo . "', '" . $_SESSION['Items'.$identifier]->DelAdd1 . "', @@ -254,32 +253,37 @@ '" . $_POST['AutoInvoice'] . "')"; $ErrMsg = _('The recurring order cannot be added because'); - $InsertQryResult = DB_query($HeaderSQL,$db,$ErrMsg,true); + $DbgMsg = _('The SQL that failed was'); + $InsertQryResult = DB_query($HeaderSQL,$db,$ErrMsg,$DbgMsg,true); + + echo '<br/>' . $HeaderSQL; $RecurrOrderNo = DB_Last_Insert_ID($db,'recurringsalesorders','recurrorderno'); echo 'xxx'.$RecurrOrderNo; - $StartOf_LineItemsSQL = "INSERT INTO recurrsalesorderdetails ( - recurrorderno, - stkcode, - unitprice, - quantity, - discountpercent, - narrative) - values ('"; - + $StartOf_LineItemsSQL = "INSERT INTO recurrsalesorderdetails (recurrorderno, + stkcode, + unitprice, + quantity, + discountpercent, + narrative) + VALUES ('"; + foreach ($_SESSION['Items'.$identifier]->LineItems as $StockItem) { $LineItemsSQL = $StartOf_LineItemsSQL . - $RecurrOrderNo . "', - '" . $StockItem->StockID . "', - '". $StockItem->Price . "', - '" . $StockItem->Quantity . "', - '" . $StockItem->DiscountPercent . "', - '" . $StockItem->Narrative . "' - )"; + $RecurrOrderNo . "', + '" . $StockItem->StockID . "', + '". filter_number_format($StockItem->Price) . "', + '" . filter_number_format($StockItem->Quantity) . "', + '" . filter_number_format($StockItem->DiscountPercent) . "', + '" . $StockItem->Narrative . "')"; $Ins_LineItemResult = DB_query($LineItemsSQL,$db,$ErrMsg,$DbgMsg,true); + + echo '<br/>' . $LineItemsSQL; + } /* inserted line items into sales order details */ - + + $result = DB_Txn_Commit($db); prnmsg(_('The new recurring order template has been added'),'success'); } else { /* must be updating an existing recurring order */ @@ -287,7 +291,7 @@ stopdate = '" . FormatDateforSQL($_POST['StopDate']) . "', frequency = '" . $_POST['Frequency'] . "', autoinvoice = '" . $_POST['AutoInvoice'] . "' - WHERE recurrorderno = '" . $_POST['ExistingRecurrOrderNo'] . "'"; + WHERE recurrorderno = '" . filter_number_format($_POST['ExistingRecurrOrderNo']) . "'"; $ErrMsg = _('The recurring order cannot be updated because'); $UpdateQryResult = DB_query($HeaderSQL,$db,$ErrMsg); @@ -304,7 +308,6 @@ exit; } - $result = DB_Txn_Commit($db); } echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/customer.png" title="' . _('Search') . @@ -333,8 +336,8 @@ foreach ($_SESSION['Items'.$identifier]->LineItems as $StockItem) { $LineTotal = $StockItem->Quantity * $StockItem->Price * (1 - $StockItem->DiscountPercent); - $DisplayLineTotal = locale_number_format($LineTotal,2); - $DisplayPrice = locale_number_format($StockItem->Price,2); + $DisplayLineTotal = locale_money_format($LineTotal,$_SESSION['Items'.$identifier]->CurrDecimalPlaces); + $DisplayPrice = locale_money_format($StockItem->Price,$_SESSION['Items'.$identifier]->CurrDecimalPlaces); $DisplayQuantity = locale_number_format($StockItem->Quantity,$StockItem->DecimalPlaces); $DisplayDiscount = locale_number_format(($StockItem->DiscountPercent * 100),2); @@ -347,28 +350,29 @@ $k=1; } - echo '<td>$StockItem->StockID</td> - <td>$StockItem->ItemDescription</td> - <td class=number>$DisplayQuantity</td> - <td>$StockItem->Units</td> - <td class=number>$DisplayPrice</td> - <td class=number>$DisplayDiscount</td> - <td class=number>$DisplayLineTotal</td> + echo '<td>' . $StockItem->StockID . '</td> + <td>' . $StockItem->ItemDescription . '</td> + <td class="number">' . $DisplayQuantity . '</td> + <td>' . $StockItem->Units . '</td> + <td class="number">' . $DisplayPrice . '</td> + <td class="number">' . $DisplayDiscount . '</td> + <td class="number">' . $DisplayLineTotal . '</td> </tr>'; - $_SESSION['Items'.$identifier]->total = $_SESSION['Items'.$identifier]->total + $LineTotal; - $_SESSION['Items'.$identifier]->totalVolume = $_SESSION['Items'.$identifier]->totalVolume + ($StockItem->Quantity * $StockItem->Volume); - $_SESSION['Items'.$identifier]->totalWeight = $_SESSION['Items'.$identifier]->totalWeight + ($StockItem->Quantity * $StockItem->Weight); + $_SESSION['Items'.$identifier]->total += $LineTotal; + $_SESSION['Items'.$identifier]->totalVolume += ($StockItem->Quantity * $StockItem->Volume); + $_SESSION['Items'.$identifier]->totalWeight += ($StockItem->Quantity * $StockItem->Weight); } -$DisplayTotal = locale_number_format($_SESSION['Items'.$identifier]->total,2); +$DisplayTotal = locale_money_format($_SESSION['Items'.$identifier]->total,$_SESSION['Items'.$identifier]->CurrDecimalPlaces); echo '<tr> - <td colspan=6 class=number><b>'. _('TOTAL Excl Tax/Freight') .'</b></td> - <td class=number>$DisplayTotal</td> -</tr></table>'; + <td colspan="6" class="number"><b>'. _('TOTAL Excl Tax/Freight') .'</b></td> + <td class="number">' . $DisplayTotal . '</td> + </tr> + </table>'; -echo '<br /><table class=selection>'; -echo '<tr><th colspan=7><font size=2 color=navy><b>'._('Order Header Details').'</b></font></th></tr>'; +echo '<br /><table class="selection">'; +echo '<tr><th colspan="7"><font size=2 color=navy><b>'._('Order Header Details').'</b></font></th></tr>'; echo '<tr> <td>'. _('Deliver To') .':</td> @@ -415,7 +419,7 @@ if ($NewRecurringOrder=='Yes'){ echo '<tr> <td>'. _('Start Date') .':</td> - <td><input type=TEXT class=date alt="'.$_SESSION['DefaultDateFormat'].'" name="StartDate" size=11 maxlength=10 value="' . $_POST['StartDate'] .'" /></td></tr>'; + <td><input type="text" class="date" alt="'.$_SESSION['DefaultDateFormat'].'" name="StartDate" size=11 maxlength=10 value="' . $_POST['StartDate'] .'" /></td></tr>'; } else { echo '<tr> <td>'. _('Last Recurrence') . ':</td> @@ -429,7 +433,7 @@ echo '<tr> <td>'. _('Finish Date') .':</td> - <td><input type=TEXT class=date alt="'.$_SESSION['DefaultDateFormat'].'" name="StopDate" size=11 maxlength=10 value="' . $_POST['StopDate'] .'" /></td></tr>'; + <td><input type="text" class="date" alt="'.$_SESSION['DefaultDateFormat'].'" name="StopDate" size=11 maxlength=10 value="' . $_POST['StopDate'] .'" /></td></tr>'; echo '<tr> <td>'. _('Frequency of Recurrence') .':</td> @@ -493,15 +497,15 @@ echo '<br /><div class="centre">'; if ($NewRecurringOrder=='Yes'){ - echo '<input type="hidden" name="NewRecurringOrder" value="Yes">'; - echo '<input type="submit" name="Process" value="' . _('Create Recurring Order') . '">'; + echo '<input type="hidden" name="NewRecurringOrder" value="Yes" />'; + echo '<input type="submit" name="Process" value="' . _('Create Recurring Order') . '" />'; } else { echo '<input type=hidden name="NewRecurringOrder" value="No">'; - echo '<input type=hidden name="ExistingRecurrOrderNo" value=' . $_POST['ExistingRecurrOrderNo'] . '>'; + echo '<input type=hidden name="ExistingRecurrOrderNo" value="' . $_POST['ExistingRecurrOrderNo'] . '" />'; - echo '<input type="submit" name="Process" value="' . _('Update Recurring Order Details') . '">'; + echo '<input type="submit" name="Process" value="' . _('Update Recurring Order Details') . '" />'; echo '<hr>'; - echo '<br /><br /><input type=submit name="DeleteRecurringOrder" value="' . _('Delete Recurring Order') . ' ' . $_POST['ExistingRecurrOrderNo'] . '" onclick="return confirm(\'' . _('Are you sure you wish to delete this recurring order template?') . '\');">'; + echo '<br /><br /><input type=submit name="DeleteRecurringOrder" value="' . _('Delete Recurring Order') . ' ' . $_POST['ExistingRecurrOrderNo'] . '" onclick="return confirm(\'' . _('Are you sure you wish to delete this recurring order template?') . '\');" />'; } echo '</form></div>'; Modified: trunk/RecurringSalesOrdersProcess.php =================================================================== --- trunk/RecurringSalesOrdersProcess.php 2011-09-23 09:13:29 UTC (rev 4703) +++ trunk/RecurringSalesOrdersProcess.php 2011-09-24 07:39:35 UTC (rev 4704) @@ -4,7 +4,7 @@ /*need to allow this script to run from Cron or windows scheduler */ $AllowAnyone = true; -/* Get this puppy to run from cron (cd weberp && php -f RecurringSalesOrdersProcess.php "weberpdemo") or direct URL (RecurringSalesOrdersProcess.php?Database=weberpdemo) */ +/* Get this puppy to run from cron (cd webERP && php -f RecurringSalesOrdersProcess.php "weberpdemo") or direct URL (RecurringSalesOrdersProcess.php?Database=weberpdemo) */ if (isset($_GET['Database'])) { $_SESSION['DatabaseName'] = $_GET['Database']; $DatabaseName = $_GET['Database']; @@ -27,50 +27,50 @@ include('includes/GetSalesTransGLCodes.inc'); include('includes/htmlMimeMail.php'); -$sql = 'SELECT recurringsalesorders.recurrorderno, - recurringsalesorders.debtorno, - recurringsalesorders.branchcode, - recurringsalesorders.customerref, - recurringsalesorders.buyername, - recurringsalesorders.comments, - recurringsalesorders.orddate, - recurringsalesorders.ordertype, - recurringsalesorders.shipvia, - recurringsalesorders.deladd1, - recurringsalesorders.deladd2, - recurringsalesorders.deladd3, - recurringsalesorders.deladd4, - recurringsalesorders.deladd5, - recurringsalesorders.deladd6, - recurringsalesorders.contactphone, - recurringsalesorders.contactemail, - recurringsalesorders.deliverto, - recurringsalesorders.freightcost, - recurringsalesorders.fromstkloc, - recurringsalesorders.lastrecurrence, - recurringsalesorders.stopdate, - recurringsalesorders.frequency, - recurringsalesorders.autoinvoice, - debtorsmaster.name, - debtorsmaster.currcode, - salestypes.sales_type, - custbranch.area, - custbranch.taxgroupid, - locations.contact, - locations.email - FROM recurringsalesorders, - debtorsmaster, - custbranch, - salestypes, - locations - WHERE recurringsalesorders.ordertype=salestypes.typeabbrev - AND recurringsalesorders.debtorno = debtorsmaster.debtorno - AND recurringsalesorders.debtorno = custbranch.debtorno - AND recurringsalesorders.branchcode = custbranch.branchcode - AND recurringsalesorders.fromstkloc=locations.loccode - AND recurringsalesorders.ordertype=salestypes.typeabbrev - AND (TO_DAYS(NOW()) - TO_DAYS(recurringsalesorders.lastrecurrence)) > (365/recurringsalesorders.frequency) - AND DATE_ADD(recurringsalesorders.lastrecurrence, ' . INTERVAL ('365/recurringsalesorders.frequency', 'DAY') . ') <= recurringsalesorders.stopdate'; +$sql = "SELECT recurringsalesorders.recurrorderno, + recurringsalesorders.debtorno, + recurringsalesorders.branchcode, + recurringsalesorders.customerref, + recurringsalesorders.buyername, + recurringsalesorders.comments, + recurringsalesorders.orddate, + recurringsalesorders.ordertype, + recurringsalesorders.shipvia, + recurringsalesorders.deladd1, + recurringsalesorders.deladd2, + recurringsalesorders.deladd3, + recurringsalesorders.deladd4, + recurringsalesorders.deladd5, + recurringsalesorders.deladd6, + recurringsalesorders.contactphone, + recurringsalesorders.contactemail, + recurringsalesorders.deliverto, + recurringsalesorders.freightcost, + recurringsalesorders.fromstkloc, + recurringsalesorders.lastrecurrence, + recurringsalesorders.stopdate, + recurringsalesorders.frequency, + recurringsalesorders.autoinvoice, + debtorsmaster.name, + debtorsmaster.currcode, + salestypes.sales_type, + custbranch.area, + custbranch.taxgroupid, + locations.contact, + locations.email + FROM recurringsalesorders, + debtorsmaster, + custbranch, + salestypes, + locations + WHERE recurringsalesorders.ordertype=salestypes.typeabbrev + AND recurringsalesorders.debtorno = debtorsmaster.debtorno + AND recurringsalesorders.debtorno = custbranch.debtorno + AND recurringsalesorders.branchcode = custbranch.branchcode + AND recurringsalesorders.fromstkloc=locations.loccode + AND recurringsalesorders.ordertype=salestypes.typeabbrev + AND (TO_DAYS(NOW()) - TO_DAYS(recurringsalesorders.lastrecurrence)) > (365/recurringsalesorders.frequency) + AND DATE_ADD(recurringsalesorders.lastrecurrence, " . INTERVAL ('365/recurringsalesorders.frequency', 'DAY') . ") <= recurringsalesorders.stopdate"; $RecurrOrdersDueResult = DB_query($sql,$db,_('There was a problem retrieving the recurring sales order templates. The database reported:')); @@ -178,12 +178,12 @@ while ($RecurrOrderLineRow=DB_fetch_array($LineItemsResult)) { $LineItemsSQL = $StartOf_LineItemsSQL . - " '" . $LineCounter . "', - '" . $RecurrOrderLineRow['stkcode'] . "', - '". $RecurrOrderLineRow['unitprice'] . "', - '" . $RecurrOrderLineRow['quantity'] . "', - '" . floatval($RecurrOrderLineRow['discountpercent']) . "', - '" . $RecurrOrderLineRow['narrative'] . "')"; + " '" . $LineCounter . "', + '" . $RecurrOrderLineRow['stkcode'] . "', + '". $RecurrOrderLineRow['unitprice'] . "', + '" . $RecurrOrderLineRow['quantity'] . "', + '" . floatval($RecurrOrderLineRow['discountpercent']) . "', + '" . $RecurrOrderLineRow['narrative'] . "')"; $Ins_LineItemResult = DB_query($LineItemsSQL,$db,_('Could not insert the order lines from the recurring order template'),true); /*Populating a new order line items*/ $LineCounter ++; @@ -427,9 +427,9 @@ if ($myrow[0]>0){ /*Update the existing record that already exists */ $SQL = "UPDATE salesanalysis - SET amt=amt+" . ($RecurrOrderLineRow['unitprice'] * $RecurrOrderLineRow['quantity'] / $CurrencyRate) . ", + SET amt=amt+" . filter_number_format($RecurrOrderLineRow['unitprice'] * $RecurrOrderLineRow['quantity'] / $CurrencyRate) . ", qty=qty +" . $RecurrOrderLineRow['quantity'] . ", - disc=disc+" . ($RecurrOrderLineRow['discountpercent'] * $RecurrOrderLineRow['unitprice'] * $RecurrOrderLineRow['quantity'] / $CurrencyRate) . " + disc=disc+" . filter_number_format($... [truncated message content] |
From: <dai...@us...> - 2011-09-25 03:05:34
|
Revision: 4705 http://web-erp.svn.sourceforge.net/web-erp/?rev=4705&view=rev Author: daintree Date: 2011-09-25 03:05:27 +0000 (Sun, 25 Sep 2011) Log Message: ----------- number_formats Modified Paths: -------------- trunk/ReprintGRN.php trunk/ReverseGRN.php trunk/SalesByTypePeriodInquiry.php trunk/SalesCategories.php trunk/SalesCategoryPeriodInquiry.php Modified: trunk/ReprintGRN.php =================================================================== --- trunk/ReprintGRN.php 2011-09-24 07:39:35 UTC (rev 4704) +++ trunk/ReprintGRN.php 2011-09-25 03:05:27 UTC (rev 4705) @@ -5,20 +5,19 @@ $title=_('Reprint a GRN'); include('includes/header.inc'); -echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/supplier.png" title="' . - $title . '" alt="" />' . ' ' . $title . '</p>'; +echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/supplier.png" title="' . $title . '" alt="" />' . ' ' . $title . '</p>'; if (!isset($_POST['PONumber'])) { $_POST['PONumber']=''; } -echo '<form action="' . $_SERVER['PHP_SELF'] . '?' . SID . '" method=post>'; +echo '<form action="' . $_SERVER['PHP_SELF'] . '" method=post>'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; echo '<table class="selection">'; echo '<tr><th colspan="2"><font size="2" color="navy">' . _('Select a purchase order') . '</th></tr>'; echo '<tr><td>' . _('Enter a Purchase Order Number') . '</td>'; echo '<td>' . '<input type="text" name="PONumber" class="number" size="7" value="'.$_POST['PONumber'].'" /></td></tr>'; -echo '<tr><td colspan=2 style="text-align: center">' . '<input type="submit" name="Show" value="Show GRNs" /></td></tr>'; +echo '<tr><td colspan=2 style="text-align: center"><input type="submit" name="Show" value="Show GRNs" /></td></tr>'; echo '</table>'; echo '</form>'; @@ -42,21 +41,21 @@ exit; } $sql="SELECT grnbatch, - grnno, - grns.podetailitem, - grns.itemcode, - grns.itemdescription, - grns.deliverydate, - grns.qtyrecd, - suppliers.suppname, - stockmaster.decimalplaces - FROM grns INNER JOIN suppliers - ON grns.supplierid=suppliers.supplierid - INNER JOIN purchorderdetails - ON grns.podetailitem=purchorderdetails.podetailitem - LEFT JOIN stockmaster - ON grns.itemcode=stockmaster.stockid - WHERE orderno='" . $_POST['PONumber'] ."'"; + grnno, + grns.podetailitem, + grns.itemcode, + grns.itemdescription, + grns.deliverydate, + grns.qtyrecd, + suppliers.suppname, + stockmaster.decimalplaces + FROM grns INNER JOIN suppliers + ON grns.supplierid=suppliers.supplierid + INNER JOIN purchorderdetails + ON grns.podetailitem=purchorderdetails.podetailitem + LEFT JOIN stockmaster + ON grns.itemcode=stockmaster.stockid + WHERE orderno='" . $_POST['PONumber'] ."'"; $result=DB_query($sql, $db); if (DB_num_rows($result)==0) { echo '<br />'; Modified: trunk/ReverseGRN.php =================================================================== --- trunk/ReverseGRN.php 2011-09-24 07:39:35 UTC (rev 4704) +++ trunk/ReverseGRN.php 2011-09-25 03:05:27 UTC (rev 4705) @@ -44,11 +44,11 @@ purchorderdetails.stdcostunit, purchorders.intostocklocation, purchorders.orderno - FROM grns INNER JOIN purchorderdetails - ON grns.podetailitem=purchorderdetails.podetailitem - INNER JOIN purchorders - ON purchorderdetails.orderno = purchorders.orderno - WHERE AND grnno='" . filter_number_format($_GET['GRNNo']) . "'"; + FROM grns INNER JOIN purchorderdetails + ON grns.podetailitem=purchorderdetails.podetailitem + INNER JOIN purchorders + ON purchorderdetails.orderno = purchorders.orderno + WHERE AND grnno='" . filter_number_format($_GET['GRNNo']) . "'"; $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('Could not get the details of the GRN selected for reversal because') . ' '; $DbgMsg = _('The following SQL to retrieve the GRN details was used') . ':'; @@ -81,18 +81,18 @@ stockserialmoves.moveqty FROM stockmoves INNER JOIN stockserialmoves ON stockmoves.stkmoveno= stockserialmoves.stockmoveno - WHERE stockmoves.stockid='" . $GRN['itemcode'] . "' - AND stockmoves.type =25 - AND stockmoves.transno='" . $GRN['grnbatch'] . "'"; + WHERE stockmoves.stockid='" . $GRN['itemcode'] . "' + AND stockmoves.type =25 + AND stockmoves.transno='" . $GRN['grnbatch'] . "'"; $GetStockMoveResult = DB_query($SQL,$db,_('Could not retrieve the stock movement reference number which is required in order to retrieve details of the serial items that came in with this GRN')); while ($SerialStockMoves = DB_fetch_array($GetStockMoveResult)){ $SQL = "SELECT stockserialitems.quantity FROM stockserialitems - WHERE stockserialitems.stockid='" . $GRN['itemcode'] . "' - AND stockserialitems.loccode ='" . $GRN['intostocklocation'] . "' - AND stockserialitems.serialno ='" . $SerialStockMoves['serialno'] . "'"; + WHERE stockserialitems.stockid='" . $GRN['itemcode'] . "' + AND stockserialitems.loccode ='" . $GRN['intostocklocation'] . "' + AND stockserialitems.serialno ='" . $SerialStockMoves['serialno'] . "'"; $GetQOHResult = DB_query($SQL,$db,_('Unable to retrieve the quantity on hand of') . ' ' . $GRN['itemcode'] . ' ' . _('for Serial No') . ' ' . $SerialStockMoves['serialno']); $GetQOH = DB_fetch_row($GetQOHResult); if ($GetQOH[0] < $SerialStockMoves['moveqty']){ @@ -175,7 +175,7 @@ /*now reverse the cost put to fixedassets */ $SQL = "UPDATE fixedassets SET cost = cost - " . filter_number_format($GRN['stdcostunit'] * $QtyToReverse) . " - WHERE assetid = '" . $GRN['assetid'] . "'"; + WHERE assetid = '" . $GRN['assetid'] . "'"; $ErrMsg = _('CRITICAL ERROR! NOTE DOWN THIS ERROR AND SEEK ASSISTANCE. The fixed asset cost addition could not be reversed:'); $DbgMsg = _('The following SQL was used to attempt the reduce the cost of the asset was:'); $Result = DB_query($SQL,$db,$ErrMsg, $DbgMsg, true); @@ -183,8 +183,8 @@ } //end of if it is an asset $SQL = "SELECT stockmaster.controlled - FROM stockmaster - WHERE stockmaster.stockid = '" . $GRN['itemcode'] . "'"; + FROM stockmaster + WHERE stockmaster.stockid = '" . $GRN['itemcode'] . "'"; $Result = DB_query($SQL, $db, _('Could not determine if the item exists because'),'<br />' . _('The SQL that failed was') . ' ',true); if (DB_num_rows($Result)==1){ /* if the GRN is in fact a stock item being reversed */ @@ -195,9 +195,9 @@ /* Update location stock records - NB a PO cannot be entered for a dummy/assembly/kit parts */ /*Need to get the current location quantity will need it later for the stock movement */ $SQL="SELECT quantity - FROM locstock - WHERE stockid='" . $GRN['itemcode'] . "' - AND loccode= '" . $GRN['intostocklocation'] . "'"; + FROM locstock + WHERE stockid='" . $GRN['itemcode'] . "' + AND loccode= '" . $GRN['intostocklocation'] . "'"; $Result = DB_query($SQL, $db, _('Could not get the quantity on hand of the item before the reversal was processed'),_('The SQL that failed was'),true); if (DB_num_rows($Result)==1){ @@ -209,9 +209,9 @@ } $SQL = "UPDATE locstock - SET quantity = quantity - " . $QtyToReverse . " - WHERE stockid = '" . $GRN['itemcode'] . "' - AND loccode = '" . $GRN['intostocklocation'] . "'"; + SET quantity = quantity - " . $QtyToReverse . " + WHERE stockid = '" . $GRN['itemcode'] . "' + AND loccode = '" . $GRN['intostocklocation'] . "'"; $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The location stock record could not be updated because'); $DbgMsg = _('The following SQL to update the location stock record was used'); @@ -366,7 +366,7 @@ prnMsg(_('There are no outstanding goods received yet to be invoiced for') . ' ' . $_POST['SuppName'] . '.<br />' . _('To reverse a GRN that has been invoiced first it must be credited'),'warn'); } else { //there are GRNs to show - echo '<br /><table cellpadding=2 colspan=7 class=selection>'; + echo '<br /><table cellpadding=2 colspan=7 class="selection">'; $TableHeader = '<tr> <th>' . _('GRN') . ' #</th> <th>' . _('Item Code') . '</th> @@ -395,17 +395,17 @@ $DisplayQtyInv = locale_number_format($myrow['quantityinv'],2); $DisplayQtyRev = locale_number_format($myrow['qtytoreverse'],2); $DisplayDateDel = ConvertSQLDate($myrow['deliverydate']); - $LinkToRevGRN = '<a href="' . $_SERVER['PHP_SELF'] . '?' . SID . '&GRNNo=' . $myrow['grnno'] . '">' . _('Reverse') . '</a>'; + $LinkToRevGRN = '<a href="' . $_SERVER['PHP_SELF'] . '?GRNNo=' . $myrow['grnno'] . '">' . _('Reverse') . '</a>'; - printf("<td>%s</td> + printf('<td>%s</td> <td>%s</td> <td>%s</td> <td>%s</td> - <td class=number>%s</td> - <td class=number>%s</td> - <td class=number>%s</td> + <td class="number">%s</td> + <td class="number">%s</td> + <td class="number">%s</td> <td>%s</td> - </tr>", + </tr>', $myrow['grnno'], $myrow['itemcode'], $myrow['itemdescription'], Modified: trunk/SalesByTypePeriodInquiry.php =================================================================== --- trunk/SalesByTypePeriodInquiry.php 2011-09-24 07:39:35 UTC (rev 4704) +++ trunk/SalesByTypePeriodInquiry.php 2011-09-25 03:05:27 UTC (rev 4705) @@ -71,7 +71,7 @@ </tr>'; } echo '</table> - </td><td valign=top> + </td><td valign="top"> <table>'; echo '<tr><th colspan="2" class="centre">' . _('Display Data') . '</th> @@ -365,11 +365,11 @@ if ($LastPeriodHeading != 'First Run Through'){ //print the footer for the period echo '<td colspan="2" class="number">' . _('Total') . '-' . $LastPeriodHeading . '</td> <td class="number">' . $PrdTotalOrders . '</td> - <td class="number">' . locale_number_format($PrdTotalSales,2) . '</td> - <td class="number">' . locale_number_format($PrdTotalRefunds,2) . '</td> - <td class="number">' . locale_number_format($PrdTotalNetSales,2) . '</td> - <td class="number">' . locale_number_format($PrdTotalCost,2) . '</td> - <td class="number">' . locale_number_format($PrdTotalGP,2) . '</td> + <td class="number">' . locale_money_format($PrdTotalSales,$_SESSION['CompanyRecord']['decimalplaces']) . '</td> + <td class="number">' . locale_money_format($PrdTotalRefunds,$_SESSION['CompanyRecord']['decimalplaces']) . '</td> + <td class="number">' . locale_money_format($PrdTotalNetSales,$_SESSION['CompanyRecord']['decimalplaces']) . '</td> + <td class="number">' . locale_money_format($PrdTotalCost,$_SESSION['CompanyRecord']['decimalplaces']) . '</td> + <td class="number">' . locale_money_format($PrdTotalGP,$_SESSION['CompanyRecord']['decimalplaces']) . '</td> </tr>'; if ($k==1){ echo '<tr class="EvenTableRows"><td colspan="8"><hr></td></tr>'; @@ -400,11 +400,11 @@ if ($LastPeriodHeading != 'First Run Through'){ echo '<td colspan="2" class="number">' . _('Total') . '-' . $LastPeriodHeading . '</td> <td class="number">' . $PrdTotalOrders . '</td> - <td class="number">' . locale_number_format($PrdTotalSales,2) . '</td> - <td class="number">' . locale_number_format($PrdTotalRefunds,2) . '</td> - <td class="number">' . locale_number_format($PrdTotalNetSales,2) . '</td> - <td class="number">' . locale_number_format($PrdTotalCost,2) . '</td> - <td class="number">' . locale_number_format($PrdTotalGP,2) . '</td> + <td class="number">' . locale_money_format($PrdTotalSales,$_SESSION['CompanyRecord']['decimalplaces']) . '</td> + <td class="number">' . locale_money_format($PrdTotalRefunds,$_SESSION['CompanyRecord']['decimalplaces']) . '</td> + <td class="number">' . locale_money_format($PrdTotalNetSales,$_SESSION['CompanyRecord']['decimalplaces']) . '</td> + <td class="number">' . locale_money_format($PrdTotalCost,$_SESSION['CompanyRecord']['decimalplaces']) . '</td> + <td class="number">' . locale_money_format($PrdTotalGP,$_SESSION['CompanyRecord']['decimalplaces']) . '</td> </tr>'; if ($k==1){ echo '<tr class="EvenTableRows"><td colspan="8"><hr></td></tr>'; @@ -435,11 +435,11 @@ if ($LastPeriodHeading != 'First Run Through'){ echo '<td colspan="2" class="number">' . _('Total') . '-' . $LastPeriodHeading . '</td> <td class="number">' . $PrdTotalOrders . '</td> - <td class="number">' . locale_number_format($PrdTotalSales,2) . '</td> - <td class="number">' . locale_number_format($PrdTotalRefunds,2) . '</td> - <td class="number">' . locale_number_format($PrdTotalNetSales,2) . '</td> - <td class="number">' . locale_number_format($PrdTotalCost,2) . '</td> - <td class="number">' . locale_number_format($PrdTotalGP,2) . '</td> + <td class="number">' . locale_money_format($PrdTotalSales,$_SESSION['CompanyRecord']['decimalplaces']) . '</td> + <td class="number">' . locale_money_format($PrdTotalRefunds,$_SESSION['CompanyRecord']['decimalplaces']) . '</td> + <td class="number">' . locale_money_format($PrdTotalNetSales,$_SESSION['CompanyRecord']['decimalplaces']) . '</td> + <td class="number">' . locale_money_format($PrdTotalCost,$_SESSION['CompanyRecord']['decimalplaces']) . '</td> + <td class="number">' . locale_money_format($PrdTotalGP,$_SESSION['CompanyRecord']['decimalplaces']) . '</td> </tr>'; if ($k==1){ echo '<tr class="EvenTableRows"><td colspan="8"><hr></td></tr>'; @@ -470,11 +470,11 @@ if ($LastPeriodHeading != 'First Run Through'){ echo '<td colspan="2" class="number">' . _('Total') . '-'. $LastPeriodHeading . '</td> <td class="number">' . $PrdTotalOrders . '</td> - <td class="number">' . locale_number_format($PrdTotalSales,2) . '</td> - <td class="number">' . locale_number_format($PrdTotalRefunds,2) . '</td> - <td class="number">' . locale_number_format($PrdTotalNetSales,2) . '</td> - <td class="number">' . locale_number_format($PrdTotalCost,2) . '</td> - <td class="number">' . locale_number_format($PrdTotalGP,2) . '</td> + <td class="number">' . locale_money_format($PrdTotalSales,$_SESSION['CompanyRecord']['decimalplaces']) . '</td> + <td class="number">' . locale_money_format($PrdTotalRefunds,$_SESSION['CompanyRecord']['decimalplaces']) . '</td> + <td class="number">' . locale_money_format($PrdTotalNetSales,$_SESSION['CompanyRecord']['decimalplaces']) . '</td> + <td class="number">' . locale_money_format($PrdTotalCost,$_SESSION['CompanyRecord']['decimalplaces']) . '</td> + <td class="number">' . locale_money_format($PrdTotalGP,$_SESSION['CompanyRecord']['decimalplaces']) . '</td> </tr>'; if ($k==1){ echo '<tr class="EvenTableRows"><td colspan="8"><hr></td></tr>'; @@ -502,11 +502,11 @@ } echo '<td>' . $SalesRow['tpe'] . '</td> <td class="number">' . $SalesRow['nooforders'] . '</td> - <td class="number">' . locale_number_format($SalesRow['salesvalue'],2) . '</td> - <td class="number">' . locale_number_format($SalesRow['returnvalue'],2) . '</td> - <td class="number">' . locale_number_format($SalesRow['salesvalue']+$SalesRow['returnvalue'],2) . '</td> - <td class="number">' . locale_number_format($SalesRow['cost'],2) . '</td> - <td class="number">' . locale_number_format(($SalesRow['salesvalue']+$SalesRow['returnvalue']-$SalesRow['cost']),2) . '</td> + <td class="number">' . locale_money_format($SalesRow['salesvalue'],$_SESSION['CompanyRecord']['decimalplaces']) . '</td> + <td class="number">' . locale_money_format($SalesRow['returnvalue'],$_SESSION['CompanyRecord']['decimalplaces']) . '</td> + <td class="number">' . locale_money_format($SalesRow['salesvalue']+$SalesRow['returnvalue'],$_SESSION['CompanyRecord']['decimalplaces']) . '</td> + <td class="number">' . locale_money_format($SalesRow['cost'],$_SESSION['CompanyRecord']['decimalplaces']) . '</td> + <td class="number">' . locale_money_format(($SalesRow['salesvalue']+$SalesRow['returnvalue']-$SalesRow['cost']),$_SESSION['CompanyRecord']['decimalplaces']) . '</td> </tr>'; $PrdTotalOrders +=$SalesRow['nooforders']; $PrdTotalSales += $SalesRow['salesvalue']; @@ -531,11 +531,11 @@ } echo '<td colspan="2" class="number">' . _('Total') . ' ' . $LastPeriodHeading . '</td> <td class="number">' . $PrdTotalOrders . '</td> - <td class="number">' . locale_number_format($PrdTotalSales,2) . '</td> - <td class="number">' . locale_number_format($PrdTotalRefunds,2) . '</td> - <td class="number">' . locale_number_format($PrdTotalNetSales,2) . '</td> - <td class="number">' . locale_number_format($PrdTotalCost,2) . '</td> - <td class="number">' . locale_number_format($PrdTotalGP,2) . '</td> + <td class="number">' . locale_money_format($PrdTotalSales,$_SESSION['CompanyRecord']['decimalplaces']) . '</td> + <td class="number">' . locale_money_format($PrdTotalRefunds,$_SESSION['CompanyRecord']['decimalplaces']) . '</td> + <td class="number">' . locale_money_format($PrdTotalNetSales,$_SESSION['CompanyRecord']['decimalplaces']) . '</td> + <td class="number">' . locale_money_format($PrdTotalCost,$_SESSION['CompanyRecord']['decimalplaces']) . '</td> + <td class="number">' . locale_money_format($PrdTotalGP,$_SESSION['CompanyRecord']['decimalplaces']) . '</td> </tr>'; if ($k==1){ echo '<tr class="EvenTableRows"><td colspan="8"><hr></td></tr>'; @@ -546,11 +546,11 @@ } echo '<td colspan="2" class="number">' . _('GRAND Total') . '</td> <td class="number">' . $CumulativeTotalOrders . '</td> - <td class="number">' . locale_number_format($CumulativeTotalSales,2) . '</td> - <td class="number">' . locale_number_format($CumulativeTotalRefunds,2) . '</td> - <td class="number">' . locale_number_format($CumulativeTotalNetSales,2) . '</td> - <td class="number">' . locale_number_format($CumulativeTotalCost,2) . '</td> - <td class="number">' . locale_number_format($CumulativeTotalGP,2) . '</td> + <td class="number">' . locale_money_format($CumulativeTotalSales,$_SESSION['CompanyRecord']['decimalplaces']) . '</td> + <td class="number">' . locale_money_format($CumulativeTotalRefunds,$_SESSION['CompanyRecord']['decimalplaces']) . '</td> + <td class="number">' . locale_money_format($CumulativeTotalNetSales,$_SESSION['CompanyRecord']['decimalplaces']) . '</td> + <td class="number">' . locale_money_format($CumulativeTotalCost,$_SESSION['CompanyRecord']['decimalplaces']) . '</td> + <td class="number">' . locale_money_format($CumulativeTotalGP,$_SESSION['CompanyRecord']['decimalplaces']) . '</td> </tr>'; echo '</table>'; Modified: trunk/SalesCategories.php =================================================================== --- trunk/SalesCategories.php 2011-09-24 07:39:35 UTC (rev 4704) +++ trunk/SalesCategories.php 2011-09-25 03:05:27 UTC (rev 4705) @@ -164,9 +164,10 @@ $CategoryPath = '<a href="'.$_SERVER['PHP_SELF'] . '?ParentCategory=0">' . _('Main') . '</a>' . " \\ "; $TempPath = ''; -if ($ParentCategory == null){ - $ParentCategory =0; +if (isset($ParentCategory)){ + $ParentCategory=0; } + if (isset($ParentCategory)) { $TmpParentID = $ParentCategory; } @@ -300,8 +301,7 @@ $_POST['SalesCatName'] = $myrow['salescatname']; echo '<input type=hidden name="SelectedCategory" value="' . $SelectedCategory . '">'; - echo '<input type=hidden name="ParentCategory" value="' . - (isset($_POST['ParentCatId'])?($_POST['ParentCategory']):('0')) . '">'; + echo '<input type=hidden name="ParentCategory" value="' . (isset($_POST['ParentCatId'])?($_POST['ParentCategory']):('0')) . '">'; $FormCaps = _('Edit Sub Category'); } else { //end of if $SelectedCategory only do the else when a new record is being entered @@ -313,12 +313,11 @@ (isset($_POST['ParentCategory'])?($_POST['ParentCategory']):('0')) . '">'; $FormCaps = _('New Sub Category'); } -echo '<input type=hidden name="EditName" value="1">'; -echo '<table class=selection>'; +echo '<input type="hidden" name="EditName" value="1">'; +echo '<table class="selection">'; echo '<tr><th colspan="2">' . $FormCaps . '</th></tr>'; echo '<tr><td>' . _('Category Name') . ':</td> - <td><input type="Text" name="SalesCatName" size=20 maxlength=20 value="' . - $_POST['SalesCatName'] . '"></td></tr>'; + <td><input type="text" name="SalesCatName" size="20" maxlength="20" value="' . $_POST['SalesCatName'] . '"></td></tr>'; // Image upload only if we have a selected category if (isset($SelectedCategory)) { echo '<tr><td>'. _('Image File (.jpg)') . ':</td> @@ -326,7 +325,7 @@ } echo '</table>'; -echo '<br /><div class="centre"><input type="Submit" name="submit" value="' . _('Submit Information') . '"></div>'; +echo '<br /><div class="centre"><input type="submit" name="submit" value="' . _('Submit Information') . '" /></div>'; echo '</form></p>'; @@ -369,16 +368,17 @@ echo '<p><form enctype="multipart/form-data" method="post" action="' . $_SERVER['PHP_SELF'] .'">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; if( isset($SelectedCategory) ) { // If we selected a category we need to keep it selected - echo '<input type=hidden name="SelectedCategory" value="' . $SelectedCategory . '">'; + echo '<input type=hidden name="SelectedCategory" value="' . $SelectedCategory . '" />'; } echo '<input type=hidden name="ParentCategory" value="' . - (isset($_POST['ParentCategory'])?($_POST['ParentCategory']):('0')) . '">'; + (isset($_POST['ParentCategory'])?($_POST['ParentCategory']):('0')) . '" /> '; - echo ''; - echo '<table class=selection>'; - echo '<tr><th colspan="2">'._('Add Inventory to this category.').'</th></tr>'; - echo '<tr><td>' . _('Select Inv. Item') . ':</td><td>'; - echo '<select name="AddStockID">'; + + echo '<table class="selection"> + <tr><th colspan="2">'._('Add Inventory to this category.').'</th></tr> + <tr><td>' . _('Select Inv. Item') . ':</td> + <td><select name="AddStockID">'; + while( $myrow = DB_fetch_array($result) ) { if ( !array_keys( $stockids, $myrow['stockid'] ) ) { // Only if the StockID is not already selected @@ -415,10 +415,10 @@ $result = DB_query($sql,$db); if($result ) { if( DB_num_rows($result)) { - echo '<table class=selection>'; - echo '<tr><th colspan="3">'._('Inventory items in this category.').'</th></tr>'; - echo '<tr><th>' . _('Stock Code') . '</th>'; - echo '<th>' . _('Description') . '</th></tr>'; + echo '<table class="selection">'; + echo '<tr><th colspan="3">'._('Inventory items in this category.').'</th></tr> + <tr><th>' . _('Stock Code') . '</th> + <th>' . _('Description') . '</th></tr>'; $k=0; //row colour counter Modified: trunk/SalesCategoryPeriodInquiry.php =================================================================== --- trunk/SalesCategoryPeriodInquiry.php 2011-09-24 07:39:35 UTC (rev 4704) +++ trunk/SalesCategoryPeriodInquiry.php 2011-09-25 03:05:27 UTC (rev 4705) @@ -22,37 +22,37 @@ echo '<tr><th colspan="2" class="centre">' . _('Date Selection') . '</th> </tr> - <tr> + <tr> <td>' . _('Custom Range') . ':</td> <td><input type="radio" name="DateRange" value="Custom" '; if ($_POST['DateRange']=='Custom'){ echo 'checked'; } -echo '></td> +echo ' /></td> </tr> - <tr> + <tr> <td>' . _('This Week') . ':</td> <td><input type="radio" name="DateRange" value="ThisWeek" '; if ($_POST['DateRange']=='ThisWeek'){ echo 'checked'; } -echo '></td> +echo ' /></td> </tr> - <tr> + <tr> <td>' . _('This Month') . ':</td> <td><input type="radio" name="DateRange" value="ThisMonth" '; if ($_POST['DateRange']=='ThisMonth'){ echo 'checked'; } -echo '></td> +echo ' /></td> </tr> - <tr> + <tr> <td>' . _('This Quarter') . ':</td> <td><input type="radio" name="DateRange" value="ThisQuarter" '; if ($_POST['DateRange']=='ThisQuarter'){ echo 'checked'; } -echo '></td> +echo ' /></td> </tr>'; if ($_POST['DateRange']=='Custom'){ echo '<tr> @@ -67,7 +67,7 @@ echo '</table>'; -echo '<br /><div class="centre"><input tabindex=4 type=submit name="ShowSales" value="' . _('Show Sales') . '">'; +echo '<br /><div class="centre"><input tabindex=4 type=submit name="ShowSales" value="' . _('Show Sales') . '" />'; echo '</form></div>'; echo '<br />'; @@ -184,11 +184,11 @@ } echo '<td>' . $SalesRow['categoryid'] . ' - ' . $SalesRow['categorydescription'] . '</td> - <td class="number">' . locale_number_format($SalesRow['salesvalue'],2) . '</td> - <td class="number">' . locale_number_format($SalesRow['returnvalue'],2) . '</td> - <td class="number">' . locale_number_format($SalesRow['salesvalue']+$SalesRow['returnvalue'],2) . '</td> - <td class="number">' . locale_number_format($SalesRow['cost'],2) . '</td> - <td class="number">' . locale_number_format(($SalesRow['salesvalue']+$SalesRow['returnvalue']-$SalesRow['cost']),2) . '</td> + <td class="number">' . locale_money_format($SalesRow['salesvalue'],$_SESSION['CompanyRecord']['decimalplaces']) . '</td> + <td class="number">' . locale_money_format($SalesRow['returnvalue'],$_SESSION['CompanyRecord']['decimalplaces']) . '</td> + <td class="number">' . locale_money_format($SalesRow['salesvalue']+$SalesRow['returnvalue'],$_SESSION['CompanyRecord']['decimalplaces']) . '</td> + <td class="number">' . locale_money_format($SalesRow['cost'],$_SESSION['CompanyRecord']['decimalplaces']) . '</td> + <td class="number">' . locale_money_format(($SalesRow['salesvalue']+$SalesRow['returnvalue']-$SalesRow['cost']),$_SESSION['CompanyRecord']['decimalplaces']) . '</td> </tr>'; $CumulativeTotalSales += $SalesRow['salesvalue']; @@ -206,11 +206,11 @@ echo '<tr class="EvenTableRows">'; } echo '<td class="number">' . _('GRAND Total') . '</td> - <td class="number">' . locale_number_format($CumulativeTotalSales,2) . '</td> - <td class="number">' . locale_number_format($CumulativeTotalRefunds,2) . '</td> - <td class="number">' . locale_number_format($CumulativeTotalNetSales,2) . '</td> - <td class="number">' . locale_number_format($CumulativeTotalCost,2) . '</td> - <td class="number">' . locale_number_format($CumulativeTotalGP,2) . '</td> + <td class="number">' . locale_money_format($CumulativeTotalSales,$_SESSION['CompanyRecord']['decimalplaces']) . '</td> + <td class="number">' . locale_money_format($CumulativeTotalRefunds,$_SESSION['CompanyRecord']['decimalplaces']) . '</td> + <td class="number">' . locale_money_format($CumulativeTotalNetSales,$_SESSION['CompanyRecord']['decimalplaces']) . '</td> + <td class="number">' . locale_money_format($CumulativeTotalCost,$_SESSION['CompanyRecord']['decimalplaces']) . '</td> + <td class="number">' . locale_money_format($CumulativeTotalGP,$_SESSION['CompanyRecord']['decimalplaces']) . '</td> </tr>'; echo '</table>'; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dai...@us...> - 2011-09-25 03:05:34
|
Revision: 4705 http://web-erp.svn.sourceforge.net/web-erp/?rev=4705&view=rev Author: daintree Date: 2011-09-25 03:05:27 +0000 (Sun, 25 Sep 2011) Log Message: ----------- number_formats Modified Paths: -------------- trunk/ReprintGRN.php trunk/ReverseGRN.php trunk/SalesByTypePeriodInquiry.php trunk/SalesCategories.php trunk/SalesCategoryPeriodInquiry.php Modified: trunk/ReprintGRN.php =================================================================== --- trunk/ReprintGRN.php 2011-09-24 07:39:35 UTC (rev 4704) +++ trunk/ReprintGRN.php 2011-09-25 03:05:27 UTC (rev 4705) @@ -5,20 +5,19 @@ $title=_('Reprint a GRN'); include('includes/header.inc'); -echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/supplier.png" title="' . - $title . '" alt="" />' . ' ' . $title . '</p>'; +echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/supplier.png" title="' . $title . '" alt="" />' . ' ' . $title . '</p>'; if (!isset($_POST['PONumber'])) { $_POST['PONumber']=''; } -echo '<form action="' . $_SERVER['PHP_SELF'] . '?' . SID . '" method=post>'; +echo '<form action="' . $_SERVER['PHP_SELF'] . '" method=post>'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; echo '<table class="selection">'; echo '<tr><th colspan="2"><font size="2" color="navy">' . _('Select a purchase order') . '</th></tr>'; echo '<tr><td>' . _('Enter a Purchase Order Number') . '</td>'; echo '<td>' . '<input type="text" name="PONumber" class="number" size="7" value="'.$_POST['PONumber'].'" /></td></tr>'; -echo '<tr><td colspan=2 style="text-align: center">' . '<input type="submit" name="Show" value="Show GRNs" /></td></tr>'; +echo '<tr><td colspan=2 style="text-align: center"><input type="submit" name="Show" value="Show GRNs" /></td></tr>'; echo '</table>'; echo '</form>'; @@ -42,21 +41,21 @@ exit; } $sql="SELECT grnbatch, - grnno, - grns.podetailitem, - grns.itemcode, - grns.itemdescription, - grns.deliverydate, - grns.qtyrecd, - suppliers.suppname, - stockmaster.decimalplaces - FROM grns INNER JOIN suppliers - ON grns.supplierid=suppliers.supplierid - INNER JOIN purchorderdetails - ON grns.podetailitem=purchorderdetails.podetailitem - LEFT JOIN stockmaster - ON grns.itemcode=stockmaster.stockid - WHERE orderno='" . $_POST['PONumber'] ."'"; + grnno, + grns.podetailitem, + grns.itemcode, + grns.itemdescription, + grns.deliverydate, + grns.qtyrecd, + suppliers.suppname, + stockmaster.decimalplaces + FROM grns INNER JOIN suppliers + ON grns.supplierid=suppliers.supplierid + INNER JOIN purchorderdetails + ON grns.podetailitem=purchorderdetails.podetailitem + LEFT JOIN stockmaster + ON grns.itemcode=stockmaster.stockid + WHERE orderno='" . $_POST['PONumber'] ."'"; $result=DB_query($sql, $db); if (DB_num_rows($result)==0) { echo '<br />'; Modified: trunk/ReverseGRN.php =================================================================== --- trunk/ReverseGRN.php 2011-09-24 07:39:35 UTC (rev 4704) +++ trunk/ReverseGRN.php 2011-09-25 03:05:27 UTC (rev 4705) @@ -44,11 +44,11 @@ purchorderdetails.stdcostunit, purchorders.intostocklocation, purchorders.orderno - FROM grns INNER JOIN purchorderdetails - ON grns.podetailitem=purchorderdetails.podetailitem - INNER JOIN purchorders - ON purchorderdetails.orderno = purchorders.orderno - WHERE AND grnno='" . filter_number_format($_GET['GRNNo']) . "'"; + FROM grns INNER JOIN purchorderdetails + ON grns.podetailitem=purchorderdetails.podetailitem + INNER JOIN purchorders + ON purchorderdetails.orderno = purchorders.orderno + WHERE AND grnno='" . filter_number_format($_GET['GRNNo']) . "'"; $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('Could not get the details of the GRN selected for reversal because') . ' '; $DbgMsg = _('The following SQL to retrieve the GRN details was used') . ':'; @@ -81,18 +81,18 @@ stockserialmoves.moveqty FROM stockmoves INNER JOIN stockserialmoves ON stockmoves.stkmoveno= stockserialmoves.stockmoveno - WHERE stockmoves.stockid='" . $GRN['itemcode'] . "' - AND stockmoves.type =25 - AND stockmoves.transno='" . $GRN['grnbatch'] . "'"; + WHERE stockmoves.stockid='" . $GRN['itemcode'] . "' + AND stockmoves.type =25 + AND stockmoves.transno='" . $GRN['grnbatch'] . "'"; $GetStockMoveResult = DB_query($SQL,$db,_('Could not retrieve the stock movement reference number which is required in order to retrieve details of the serial items that came in with this GRN')); while ($SerialStockMoves = DB_fetch_array($GetStockMoveResult)){ $SQL = "SELECT stockserialitems.quantity FROM stockserialitems - WHERE stockserialitems.stockid='" . $GRN['itemcode'] . "' - AND stockserialitems.loccode ='" . $GRN['intostocklocation'] . "' - AND stockserialitems.serialno ='" . $SerialStockMoves['serialno'] . "'"; + WHERE stockserialitems.stockid='" . $GRN['itemcode'] . "' + AND stockserialitems.loccode ='" . $GRN['intostocklocation'] . "' + AND stockserialitems.serialno ='" . $SerialStockMoves['serialno'] . "'"; $GetQOHResult = DB_query($SQL,$db,_('Unable to retrieve the quantity on hand of') . ' ' . $GRN['itemcode'] . ' ' . _('for Serial No') . ' ' . $SerialStockMoves['serialno']); $GetQOH = DB_fetch_row($GetQOHResult); if ($GetQOH[0] < $SerialStockMoves['moveqty']){ @@ -175,7 +175,7 @@ /*now reverse the cost put to fixedassets */ $SQL = "UPDATE fixedassets SET cost = cost - " . filter_number_format($GRN['stdcostunit'] * $QtyToReverse) . " - WHERE assetid = '" . $GRN['assetid'] . "'"; + WHERE assetid = '" . $GRN['assetid'] . "'"; $ErrMsg = _('CRITICAL ERROR! NOTE DOWN THIS ERROR AND SEEK ASSISTANCE. The fixed asset cost addition could not be reversed:'); $DbgMsg = _('The following SQL was used to attempt the reduce the cost of the asset was:'); $Result = DB_query($SQL,$db,$ErrMsg, $DbgMsg, true); @@ -183,8 +183,8 @@ } //end of if it is an asset $SQL = "SELECT stockmaster.controlled - FROM stockmaster - WHERE stockmaster.stockid = '" . $GRN['itemcode'] . "'"; + FROM stockmaster + WHERE stockmaster.stockid = '" . $GRN['itemcode'] . "'"; $Result = DB_query($SQL, $db, _('Could not determine if the item exists because'),'<br />' . _('The SQL that failed was') . ' ',true); if (DB_num_rows($Result)==1){ /* if the GRN is in fact a stock item being reversed */ @@ -195,9 +195,9 @@ /* Update location stock records - NB a PO cannot be entered for a dummy/assembly/kit parts */ /*Need to get the current location quantity will need it later for the stock movement */ $SQL="SELECT quantity - FROM locstock - WHERE stockid='" . $GRN['itemcode'] . "' - AND loccode= '" . $GRN['intostocklocation'] . "'"; + FROM locstock + WHERE stockid='" . $GRN['itemcode'] . "' + AND loccode= '" . $GRN['intostocklocation'] . "'"; $Result = DB_query($SQL, $db, _('Could not get the quantity on hand of the item before the reversal was processed'),_('The SQL that failed was'),true); if (DB_num_rows($Result)==1){ @@ -209,9 +209,9 @@ } $SQL = "UPDATE locstock - SET quantity = quantity - " . $QtyToReverse . " - WHERE stockid = '" . $GRN['itemcode'] . "' - AND loccode = '" . $GRN['intostocklocation'] . "'"; + SET quantity = quantity - " . $QtyToReverse . " + WHERE stockid = '" . $GRN['itemcode'] . "' + AND loccode = '" . $GRN['intostocklocation'] . "'"; $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The location stock record could not be updated because'); $DbgMsg = _('The following SQL to update the location stock record was used'); @@ -366,7 +366,7 @@ prnMsg(_('There are no outstanding goods received yet to be invoiced for') . ' ' . $_POST['SuppName'] . '.<br />' . _('To reverse a GRN that has been invoiced first it must be credited'),'warn'); } else { //there are GRNs to show - echo '<br /><table cellpadding=2 colspan=7 class=selection>'; + echo '<br /><table cellpadding=2 colspan=7 class="selection">'; $TableHeader = '<tr> <th>' . _('GRN') . ' #</th> <th>' . _('Item Code') . '</th> @@ -395,17 +395,17 @@ $DisplayQtyInv = locale_number_format($myrow['quantityinv'],2); $DisplayQtyRev = locale_number_format($myrow['qtytoreverse'],2); $DisplayDateDel = ConvertSQLDate($myrow['deliverydate']); - $LinkToRevGRN = '<a href="' . $_SERVER['PHP_SELF'] . '?' . SID . '&GRNNo=' . $myrow['grnno'] . '">' . _('Reverse') . '</a>'; + $LinkToRevGRN = '<a href="' . $_SERVER['PHP_SELF'] . '?GRNNo=' . $myrow['grnno'] . '">' . _('Reverse') . '</a>'; - printf("<td>%s</td> + printf('<td>%s</td> <td>%s</td> <td>%s</td> <td>%s</td> - <td class=number>%s</td> - <td class=number>%s</td> - <td class=number>%s</td> + <td class="number">%s</td> + <td class="number">%s</td> + <td class="number">%s</td> <td>%s</td> - </tr>", + </tr>', $myrow['grnno'], $myrow['itemcode'], $myrow['itemdescription'], Modified: trunk/SalesByTypePeriodInquiry.php =================================================================== --- trunk/SalesByTypePeriodInquiry.php 2011-09-24 07:39:35 UTC (rev 4704) +++ trunk/SalesByTypePeriodInquiry.php 2011-09-25 03:05:27 UTC (rev 4705) @@ -71,7 +71,7 @@ </tr>'; } echo '</table> - </td><td valign=top> + </td><td valign="top"> <table>'; echo '<tr><th colspan="2" class="centre">' . _('Display Data') . '</th> @@ -365,11 +365,11 @@ if ($LastPeriodHeading != 'First Run Through'){ //print the footer for the period echo '<td colspan="2" class="number">' . _('Total') . '-' . $LastPeriodHeading . '</td> <td class="number">' . $PrdTotalOrders . '</td> - <td class="number">' . locale_number_format($PrdTotalSales,2) . '</td> - <td class="number">' . locale_number_format($PrdTotalRefunds,2) . '</td> - <td class="number">' . locale_number_format($PrdTotalNetSales,2) . '</td> - <td class="number">' . locale_number_format($PrdTotalCost,2) . '</td> - <td class="number">' . locale_number_format($PrdTotalGP,2) . '</td> + <td class="number">' . locale_money_format($PrdTotalSales,$_SESSION['CompanyRecord']['decimalplaces']) . '</td> + <td class="number">' . locale_money_format($PrdTotalRefunds,$_SESSION['CompanyRecord']['decimalplaces']) . '</td> + <td class="number">' . locale_money_format($PrdTotalNetSales,$_SESSION['CompanyRecord']['decimalplaces']) . '</td> + <td class="number">' . locale_money_format($PrdTotalCost,$_SESSION['CompanyRecord']['decimalplaces']) . '</td> + <td class="number">' . locale_money_format($PrdTotalGP,$_SESSION['CompanyRecord']['decimalplaces']) . '</td> </tr>'; if ($k==1){ echo '<tr class="EvenTableRows"><td colspan="8"><hr></td></tr>'; @@ -400,11 +400,11 @@ if ($LastPeriodHeading != 'First Run Through'){ echo '<td colspan="2" class="number">' . _('Total') . '-' . $LastPeriodHeading . '</td> <td class="number">' . $PrdTotalOrders . '</td> - <td class="number">' . locale_number_format($PrdTotalSales,2) . '</td> - <td class="number">' . locale_number_format($PrdTotalRefunds,2) . '</td> - <td class="number">' . locale_number_format($PrdTotalNetSales,2) . '</td> - <td class="number">' . locale_number_format($PrdTotalCost,2) . '</td> - <td class="number">' . locale_number_format($PrdTotalGP,2) . '</td> + <td class="number">' . locale_money_format($PrdTotalSales,$_SESSION['CompanyRecord']['decimalplaces']) . '</td> + <td class="number">' . locale_money_format($PrdTotalRefunds,$_SESSION['CompanyRecord']['decimalplaces']) . '</td> + <td class="number">' . locale_money_format($PrdTotalNetSales,$_SESSION['CompanyRecord']['decimalplaces']) . '</td> + <td class="number">' . locale_money_format($PrdTotalCost,$_SESSION['CompanyRecord']['decimalplaces']) . '</td> + <td class="number">' . locale_money_format($PrdTotalGP,$_SESSION['CompanyRecord']['decimalplaces']) . '</td> </tr>'; if ($k==1){ echo '<tr class="EvenTableRows"><td colspan="8"><hr></td></tr>'; @@ -435,11 +435,11 @@ if ($LastPeriodHeading != 'First Run Through'){ echo '<td colspan="2" class="number">' . _('Total') . '-' . $LastPeriodHeading . '</td> <td class="number">' . $PrdTotalOrders . '</td> - <td class="number">' . locale_number_format($PrdTotalSales,2) . '</td> - <td class="number">' . locale_number_format($PrdTotalRefunds,2) . '</td> - <td class="number">' . locale_number_format($PrdTotalNetSales,2) . '</td> - <td class="number">' . locale_number_format($PrdTotalCost,2) . '</td> - <td class="number">' . locale_number_format($PrdTotalGP,2) . '</td> + <td class="number">' . locale_money_format($PrdTotalSales,$_SESSION['CompanyRecord']['decimalplaces']) . '</td> + <td class="number">' . locale_money_format($PrdTotalRefunds,$_SESSION['CompanyRecord']['decimalplaces']) . '</td> + <td class="number">' . locale_money_format($PrdTotalNetSales,$_SESSION['CompanyRecord']['decimalplaces']) . '</td> + <td class="number">' . locale_money_format($PrdTotalCost,$_SESSION['CompanyRecord']['decimalplaces']) . '</td> + <td class="number">' . locale_money_format($PrdTotalGP,$_SESSION['CompanyRecord']['decimalplaces']) . '</td> </tr>'; if ($k==1){ echo '<tr class="EvenTableRows"><td colspan="8"><hr></td></tr>'; @@ -470,11 +470,11 @@ if ($LastPeriodHeading != 'First Run Through'){ echo '<td colspan="2" class="number">' . _('Total') . '-'. $LastPeriodHeading . '</td> <td class="number">' . $PrdTotalOrders . '</td> - <td class="number">' . locale_number_format($PrdTotalSales,2) . '</td> - <td class="number">' . locale_number_format($PrdTotalRefunds,2) . '</td> - <td class="number">' . locale_number_format($PrdTotalNetSales,2) . '</td> - <td class="number">' . locale_number_format($PrdTotalCost,2) . '</td> - <td class="number">' . locale_number_format($PrdTotalGP,2) . '</td> + <td class="number">' . locale_money_format($PrdTotalSales,$_SESSION['CompanyRecord']['decimalplaces']) . '</td> + <td class="number">' . locale_money_format($PrdTotalRefunds,$_SESSION['CompanyRecord']['decimalplaces']) . '</td> + <td class="number">' . locale_money_format($PrdTotalNetSales,$_SESSION['CompanyRecord']['decimalplaces']) . '</td> + <td class="number">' . locale_money_format($PrdTotalCost,$_SESSION['CompanyRecord']['decimalplaces']) . '</td> + <td class="number">' . locale_money_format($PrdTotalGP,$_SESSION['CompanyRecord']['decimalplaces']) . '</td> </tr>'; if ($k==1){ echo '<tr class="EvenTableRows"><td colspan="8"><hr></td></tr>'; @@ -502,11 +502,11 @@ } echo '<td>' . $SalesRow['tpe'] . '</td> <td class="number">' . $SalesRow['nooforders'] . '</td> - <td class="number">' . locale_number_format($SalesRow['salesvalue'],2) . '</td> - <td class="number">' . locale_number_format($SalesRow['returnvalue'],2) . '</td> - <td class="number">' . locale_number_format($SalesRow['salesvalue']+$SalesRow['returnvalue'],2) . '</td> - <td class="number">' . locale_number_format($SalesRow['cost'],2) . '</td> - <td class="number">' . locale_number_format(($SalesRow['salesvalue']+$SalesRow['returnvalue']-$SalesRow['cost']),2) . '</td> + <td class="number">' . locale_money_format($SalesRow['salesvalue'],$_SESSION['CompanyRecord']['decimalplaces']) . '</td> + <td class="number">' . locale_money_format($SalesRow['returnvalue'],$_SESSION['CompanyRecord']['decimalplaces']) . '</td> + <td class="number">' . locale_money_format($SalesRow['salesvalue']+$SalesRow['returnvalue'],$_SESSION['CompanyRecord']['decimalplaces']) . '</td> + <td class="number">' . locale_money_format($SalesRow['cost'],$_SESSION['CompanyRecord']['decimalplaces']) . '</td> + <td class="number">' . locale_money_format(($SalesRow['salesvalue']+$SalesRow['returnvalue']-$SalesRow['cost']),$_SESSION['CompanyRecord']['decimalplaces']) . '</td> </tr>'; $PrdTotalOrders +=$SalesRow['nooforders']; $PrdTotalSales += $SalesRow['salesvalue']; @@ -531,11 +531,11 @@ } echo '<td colspan="2" class="number">' . _('Total') . ' ' . $LastPeriodHeading . '</td> <td class="number">' . $PrdTotalOrders . '</td> - <td class="number">' . locale_number_format($PrdTotalSales,2) . '</td> - <td class="number">' . locale_number_format($PrdTotalRefunds,2) . '</td> - <td class="number">' . locale_number_format($PrdTotalNetSales,2) . '</td> - <td class="number">' . locale_number_format($PrdTotalCost,2) . '</td> - <td class="number">' . locale_number_format($PrdTotalGP,2) . '</td> + <td class="number">' . locale_money_format($PrdTotalSales,$_SESSION['CompanyRecord']['decimalplaces']) . '</td> + <td class="number">' . locale_money_format($PrdTotalRefunds,$_SESSION['CompanyRecord']['decimalplaces']) . '</td> + <td class="number">' . locale_money_format($PrdTotalNetSales,$_SESSION['CompanyRecord']['decimalplaces']) . '</td> + <td class="number">' . locale_money_format($PrdTotalCost,$_SESSION['CompanyRecord']['decimalplaces']) . '</td> + <td class="number">' . locale_money_format($PrdTotalGP,$_SESSION['CompanyRecord']['decimalplaces']) . '</td> </tr>'; if ($k==1){ echo '<tr class="EvenTableRows"><td colspan="8"><hr></td></tr>'; @@ -546,11 +546,11 @@ } echo '<td colspan="2" class="number">' . _('GRAND Total') . '</td> <td class="number">' . $CumulativeTotalOrders . '</td> - <td class="number">' . locale_number_format($CumulativeTotalSales,2) . '</td> - <td class="number">' . locale_number_format($CumulativeTotalRefunds,2) . '</td> - <td class="number">' . locale_number_format($CumulativeTotalNetSales,2) . '</td> - <td class="number">' . locale_number_format($CumulativeTotalCost,2) . '</td> - <td class="number">' . locale_number_format($CumulativeTotalGP,2) . '</td> + <td class="number">' . locale_money_format($CumulativeTotalSales,$_SESSION['CompanyRecord']['decimalplaces']) . '</td> + <td class="number">' . locale_money_format($CumulativeTotalRefunds,$_SESSION['CompanyRecord']['decimalplaces']) . '</td> + <td class="number">' . locale_money_format($CumulativeTotalNetSales,$_SESSION['CompanyRecord']['decimalplaces']) . '</td> + <td class="number">' . locale_money_format($CumulativeTotalCost,$_SESSION['CompanyRecord']['decimalplaces']) . '</td> + <td class="number">' . locale_money_format($CumulativeTotalGP,$_SESSION['CompanyRecord']['decimalplaces']) . '</td> </tr>'; echo '</table>'; Modified: trunk/SalesCategories.php =================================================================== --- trunk/SalesCategories.php 2011-09-24 07:39:35 UTC (rev 4704) +++ trunk/SalesCategories.php 2011-09-25 03:05:27 UTC (rev 4705) @@ -164,9 +164,10 @@ $CategoryPath = '<a href="'.$_SERVER['PHP_SELF'] . '?ParentCategory=0">' . _('Main') . '</a>' . " \\ "; $TempPath = ''; -if ($ParentCategory == null){ - $ParentCategory =0; +if (isset($ParentCategory)){ + $ParentCategory=0; } + if (isset($ParentCategory)) { $TmpParentID = $ParentCategory; } @@ -300,8 +301,7 @@ $_POST['SalesCatName'] = $myrow['salescatname']; echo '<input type=hidden name="SelectedCategory" value="' . $SelectedCategory . '">'; - echo '<input type=hidden name="ParentCategory" value="' . - (isset($_POST['ParentCatId'])?($_POST['ParentCategory']):('0')) . '">'; + echo '<input type=hidden name="ParentCategory" value="' . (isset($_POST['ParentCatId'])?($_POST['ParentCategory']):('0')) . '">'; $FormCaps = _('Edit Sub Category'); } else { //end of if $SelectedCategory only do the else when a new record is being entered @@ -313,12 +313,11 @@ (isset($_POST['ParentCategory'])?($_POST['ParentCategory']):('0')) . '">'; $FormCaps = _('New Sub Category'); } -echo '<input type=hidden name="EditName" value="1">'; -echo '<table class=selection>'; +echo '<input type="hidden" name="EditName" value="1">'; +echo '<table class="selection">'; echo '<tr><th colspan="2">' . $FormCaps . '</th></tr>'; echo '<tr><td>' . _('Category Name') . ':</td> - <td><input type="Text" name="SalesCatName" size=20 maxlength=20 value="' . - $_POST['SalesCatName'] . '"></td></tr>'; + <td><input type="text" name="SalesCatName" size="20" maxlength="20" value="' . $_POST['SalesCatName'] . '"></td></tr>'; // Image upload only if we have a selected category if (isset($SelectedCategory)) { echo '<tr><td>'. _('Image File (.jpg)') . ':</td> @@ -326,7 +325,7 @@ } echo '</table>'; -echo '<br /><div class="centre"><input type="Submit" name="submit" value="' . _('Submit Information') . '"></div>'; +echo '<br /><div class="centre"><input type="submit" name="submit" value="' . _('Submit Information') . '" /></div>'; echo '</form></p>'; @@ -369,16 +368,17 @@ echo '<p><form enctype="multipart/form-data" method="post" action="' . $_SERVER['PHP_SELF'] .'">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; if( isset($SelectedCategory) ) { // If we selected a category we need to keep it selected - echo '<input type=hidden name="SelectedCategory" value="' . $SelectedCategory . '">'; + echo '<input type=hidden name="SelectedCategory" value="' . $SelectedCategory . '" />'; } echo '<input type=hidden name="ParentCategory" value="' . - (isset($_POST['ParentCategory'])?($_POST['ParentCategory']):('0')) . '">'; + (isset($_POST['ParentCategory'])?($_POST['ParentCategory']):('0')) . '" /> '; - echo ''; - echo '<table class=selection>'; - echo '<tr><th colspan="2">'._('Add Inventory to this category.').'</th></tr>'; - echo '<tr><td>' . _('Select Inv. Item') . ':</td><td>'; - echo '<select name="AddStockID">'; + + echo '<table class="selection"> + <tr><th colspan="2">'._('Add Inventory to this category.').'</th></tr> + <tr><td>' . _('Select Inv. Item') . ':</td> + <td><select name="AddStockID">'; + while( $myrow = DB_fetch_array($result) ) { if ( !array_keys( $stockids, $myrow['stockid'] ) ) { // Only if the StockID is not already selected @@ -415,10 +415,10 @@ $result = DB_query($sql,$db); if($result ) { if( DB_num_rows($result)) { - echo '<table class=selection>'; - echo '<tr><th colspan="3">'._('Inventory items in this category.').'</th></tr>'; - echo '<tr><th>' . _('Stock Code') . '</th>'; - echo '<th>' . _('Description') . '</th></tr>'; + echo '<table class="selection">'; + echo '<tr><th colspan="3">'._('Inventory items in this category.').'</th></tr> + <tr><th>' . _('Stock Code') . '</th> + <th>' . _('Description') . '</th></tr>'; $k=0; //row colour counter Modified: trunk/SalesCategoryPeriodInquiry.php =================================================================== --- trunk/SalesCategoryPeriodInquiry.php 2011-09-24 07:39:35 UTC (rev 4704) +++ trunk/SalesCategoryPeriodInquiry.php 2011-09-25 03:05:27 UTC (rev 4705) @@ -22,37 +22,37 @@ echo '<tr><th colspan="2" class="centre">' . _('Date Selection') . '</th> </tr> - <tr> + <tr> <td>' . _('Custom Range') . ':</td> <td><input type="radio" name="DateRange" value="Custom" '; if ($_POST['DateRange']=='Custom'){ echo 'checked'; } -echo '></td> +echo ' /></td> </tr> - <tr> + <tr> <td>' . _('This Week') . ':</td> <td><input type="radio" name="DateRange" value="ThisWeek" '; if ($_POST['DateRange']=='ThisWeek'){ echo 'checked'; } -echo '></td> +echo ' /></td> </tr> - <tr> + <tr> <td>' . _('This Month') . ':</td> <td><input type="radio" name="DateRange" value="ThisMonth" '; if ($_POST['DateRange']=='ThisMonth'){ echo 'checked'; } -echo '></td> +echo ' /></td> </tr> - <tr> + <tr> <td>' . _('This Quarter') . ':</td> <td><input type="radio" name="DateRange" value="ThisQuarter" '; if ($_POST['DateRange']=='ThisQuarter'){ echo 'checked'; } -echo '></td> +echo ' /></td> </tr>'; if ($_POST['DateRange']=='Custom'){ echo '<tr> @@ -67,7 +67,7 @@ echo '</table>'; -echo '<br /><div class="centre"><input tabindex=4 type=submit name="ShowSales" value="' . _('Show Sales') . '">'; +echo '<br /><div class="centre"><input tabindex=4 type=submit name="ShowSales" value="' . _('Show Sales') . '" />'; echo '</form></div>'; echo '<br />'; @@ -184,11 +184,11 @@ } echo '<td>' . $SalesRow['categoryid'] . ' - ' . $SalesRow['categorydescription'] . '</td> - <td class="number">' . locale_number_format($SalesRow['salesvalue'],2) . '</td> - <td class="number">' . locale_number_format($SalesRow['returnvalue'],2) . '</td> - <td class="number">' . locale_number_format($SalesRow['salesvalue']+$SalesRow['returnvalue'],2) . '</td> - <td class="number">' . locale_number_format($SalesRow['cost'],2) . '</td> - <td class="number">' . locale_number_format(($SalesRow['salesvalue']+$SalesRow['returnvalue']-$SalesRow['cost']),2) . '</td> + <td class="number">' . locale_money_format($SalesRow['salesvalue'],$_SESSION['CompanyRecord']['decimalplaces']) . '</td> + <td class="number">' . locale_money_format($SalesRow['returnvalue'],$_SESSION['CompanyRecord']['decimalplaces']) . '</td> + <td class="number">' . locale_money_format($SalesRow['salesvalue']+$SalesRow['returnvalue'],$_SESSION['CompanyRecord']['decimalplaces']) . '</td> + <td class="number">' . locale_money_format($SalesRow['cost'],$_SESSION['CompanyRecord']['decimalplaces']) . '</td> + <td class="number">' . locale_money_format(($SalesRow['salesvalue']+$SalesRow['returnvalue']-$SalesRow['cost']),$_SESSION['CompanyRecord']['decimalplaces']) . '</td> </tr>'; $CumulativeTotalSales += $SalesRow['salesvalue']; @@ -206,11 +206,11 @@ echo '<tr class="EvenTableRows">'; } echo '<td class="number">' . _('GRAND Total') . '</td> - <td class="number">' . locale_number_format($CumulativeTotalSales,2) . '</td> - <td class="number">' . locale_number_format($CumulativeTotalRefunds,2) . '</td> - <td class="number">' . locale_number_format($CumulativeTotalNetSales,2) . '</td> - <td class="number">' . locale_number_format($CumulativeTotalCost,2) . '</td> - <td class="number">' . locale_number_format($CumulativeTotalGP,2) . '</td> + <td class="number">' . locale_money_format($CumulativeTotalSales,$_SESSION['CompanyRecord']['decimalplaces']) . '</td> + <td class="number">' . locale_money_format($CumulativeTotalRefunds,$_SESSION['CompanyRecord']['decimalplaces']) . '</td> + <td class="number">' . locale_money_format($CumulativeTotalNetSales,$_SESSION['CompanyRecord']['decimalplaces']) . '</td> + <td class="number">' . locale_money_format($CumulativeTotalCost,$_SESSION['CompanyRecord']['decimalplaces']) . '</td> + <td class="number">' . locale_money_format($CumulativeTotalGP,$_SESSION['CompanyRecord']['decimalplaces']) . '</td> </tr>'; echo '</table>'; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dai...@us...> - 2011-09-25 09:15:11
|
Revision: 4706 http://web-erp.svn.sourceforge.net/web-erp/?rev=4706&view=rev Author: daintree Date: 2011-09-25 09:15:03 +0000 (Sun, 25 Sep 2011) Log Message: ----------- number_formats Modified Paths: -------------- trunk/GLAccountReport.php trunk/SalesCategoryPeriodInquiry.php trunk/SalesInquiry.php trunk/SalesPeople.php trunk/SalesTopItemsInquiry.php trunk/SalesTypes.php trunk/SecurityTokens.php trunk/includes/LanguageSetup.php Modified: trunk/GLAccountReport.php =================================================================== --- trunk/GLAccountReport.php 2011-09-25 03:05:27 UTC (rev 4705) +++ trunk/GLAccountReport.php 2011-09-25 09:15:03 UTC (rev 4706) @@ -136,19 +136,8 @@ if ($myrow['periodno']!=$PeriodNo){ if ($PeriodNo!=-9999){ //ie its not the first time around - /*Get the ChartDetails balance b/fwd and the actual movement in the account for the period as recorded in the chart details - need to ensure integrity of transactions to the chart detail movements. Also, for a balance sheet account it is the balance carried forward that is important, not just the transactions*/ - $sql = "SELECT bfwd, - actual, - period - FROM chartdetails - WHERE chartdetails.accountcode='" . $SelectedAccount . "' - AND chartdetails.period='" . $PeriodNo . "'"; - - $ErrMsg = _('The chart details for account') . ' ' . $SelectedAccount . ' ' . _('could not be retrieved'); - $ChartDetailsResult = DB_query($sql,$db,$ErrMsg); - $ChartDetailRow = DB_fetch_array($ChartDetailsResult); - $YPos -=$line_height; - $LeftOvers = $pdf->addTextWrap($Left_Margin,$YPos,150,$FontSize, _('Period Total')); + $YPos -=$line_height; + $LeftOvers = $pdf->addTextWrap($Left_Margin,$YPos,150,$FontSize, _('Period Total')); if ($PeriodTotal < 0 ){ //its a credit balance b/fwd $LeftOvers = $pdf->addTextWrap(210,$YPos,50,$FontSize, locale_money_format(-$PeriodTotal,$_SESSION['CompanyRecord']['decimalplaces']) , 'right'); } else { //its a debit balance b/fwd Modified: trunk/SalesCategoryPeriodInquiry.php =================================================================== --- trunk/SalesCategoryPeriodInquiry.php 2011-09-25 03:05:27 UTC (rev 4705) +++ trunk/SalesCategoryPeriodInquiry.php 2011-09-25 09:15:03 UTC (rev 4706) @@ -15,7 +15,7 @@ $_POST['DateRange']='ThisMonth'; } -echo '<form action="' . $_SERVER['PHP_SELF'] . '" method="post">'; +echo '<form name="form1" action="' . $_SERVER['PHP_SELF'] . '" method="post">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; echo '<table cellpadding=2 class="selection">'; @@ -28,7 +28,7 @@ if ($_POST['DateRange']=='Custom'){ echo 'checked'; } -echo ' /></td> +echo ' onChange="ReloadForm(form1.ShowSales)" /></td> </tr> <tr> <td>' . _('This Week') . ':</td> @@ -36,7 +36,7 @@ if ($_POST['DateRange']=='ThisWeek'){ echo 'checked'; } -echo ' /></td> +echo ' onChange="ReloadForm(form1.ShowSales)" /></td> </tr> <tr> <td>' . _('This Month') . ':</td> @@ -44,7 +44,7 @@ if ($_POST['DateRange']=='ThisMonth'){ echo 'checked'; } -echo ' /></td> +echo ' onChange="ReloadForm(form1.ShowSales)" /></td> </tr> <tr> <td>' . _('This Quarter') . ':</td> @@ -52,9 +52,14 @@ if ($_POST['DateRange']=='ThisQuarter'){ echo 'checked'; } -echo ' /></td> +echo ' onChange="ReloadForm(form1.ShowSales)" /></td> </tr>'; if ($_POST['DateRange']=='Custom'){ + if (!isset($_POST['FromDate'])){ + unset($_POST['ShowSales']); + $_POST['FromDate'] = Date($_SESSION['DefaultDateFormat'],mktime(1,1,1,Date('m')-12,Date('d')+1,Date('Y'))); + $_POST['ToDate'] = Date($_SESSION['DefaultDateFormat']); + } echo '<tr> <td>' . _('Date From') . ':</td> <td><input type="text" class="date" alt="' . $_SESSION['DefaultDateFormat'] . '" name="FromDate" maxlength="10" size="11" value="' . $_POST['FromDate'] . '" /></td> @@ -67,14 +72,10 @@ echo '</table>'; -echo '<br /><div class="centre"><input tabindex=4 type=submit name="ShowSales" value="' . _('Show Sales') . '" />'; +echo '<br /><div class="centre"><input tabindex=4 type="submit" name="ShowSales" value="' . _('Show Sales') . '" />'; echo '</form></div>'; echo '<br />'; -if ($_POST['DateRange']=='Custom' AND !isset($_POST['FromDate']) AND !isset($_POST['ToDate'])){ - //Don't run the report until custom dates entered - unset($_POST['ShowSales']); -} if (isset($_POST['ShowSales'])){ $InputError=0; //assume no input errors now test for errors @@ -154,7 +155,6 @@ $ErrMsg = _('The sales data could not be retrieved because') . ' - ' . DB_error_msg($db); $SalesResult = DB_query($sql,$db,$ErrMsg); - $OrdersResult = DB_query($OrdersSQL,$db,$ErrMsg); echo '<table cellpadding=2 class="selection">'; Modified: trunk/SalesInquiry.php =================================================================== --- trunk/SalesInquiry.php 2011-09-25 03:05:27 UTC (rev 4705) +++ trunk/SalesInquiry.php 2011-09-25 09:15:03 UTC (rev 4706) @@ -26,39 +26,52 @@ } # Part Number operator - either LIKE or = -$PartNumberOp = $_POST['PartNumberOp']; +if (isset($_POST['PartNumberOp'])){ + $PartNumberOp = $_POST['PartNumberOp']; +} else { + $PartNumberOp = '='; +} if (isset($_POST['DebtorNo'])){ $DebtorNo = trim(mb_strtoupper($_POST['DebtorNo'])); } elseif (isset($_GET['DebtorNo'])){ $DebtorNo = trim(mb_strtoupper($_GET['DebtorNo'])); } - -$DebtorNoOp = $_POST['DebtorNoOp']; - +if (isset($_POST['DebtorNoOp'])){ + $DebtorNoOp = $_POST['DebtorNoOp']; +} else { + $DebtorNoOp = '='; +} if (isset($_POST['DebtorName'])){ $DebtorName = trim(mb_strtoupper($_POST['DebtorName'])); } elseif (isset($_GET['DebtorName'])){ $DebtorName = trim(mb_strtoupper($_GET['DebtorName'])); } +if (isset($_POST['DebtorNameOp'])){ + $DebtorNameOp = $_POST['DebtorNameOp']; +} else { + $DebtorNameOp = '='; +} -$DebtorNameOp = $_POST['DebtorNameOp']; - -// Save $_POST['SummaryType'] in $savesummarytype because change $_POST['SummaryType'] when +// Save $_POST['SummaryType'] in $SaveSummaryType because change $_POST['SummaryType'] when // create $sql -$savesummarytype = $_POST['SummaryType']; +if (isset($_POST['SummaryType'])){ + $SaveSummaryType = $_POST['SummaryType']; +} else { + $SaveSummaryType = 'name'; +} if (isset($_POST['submit'])) { - submit($db,$PartNumber,$PartNumberOp,$DebtorNo,$DebtorNoOp,$DebtorName,$DebtorNameOp,$savesummarytype); + submit($db,$PartNumber,$PartNumberOp,$DebtorNo,$DebtorNoOp,$DebtorName,$DebtorNameOp,$SaveSummaryType); } else { display($db); } //####_SUBMIT_SUBMIT_SUBMIT_SUBMIT_SUBMIT_SUBMIT_SUBMIT_SUBMIT_SUBMIT_SUBMIT_SUBMIT_SUBMIT#### -function submit(&$db,$PartNumber,$PartNumberOp,$DebtorNo,$DebtorNoOp,$DebtorName,$DebtorNameOp,$savesummarytype) { +function submit(&$db,$PartNumber,$PartNumberOp,$DebtorNo,$DebtorNoOp,$DebtorName,$DebtorNameOp,$SaveSummaryType) { - //initialize no input errors + //initialise no input errors $InputError = 0; /* actions to take once the user has clicked the submit button @@ -115,8 +128,10 @@ } if (mb_strlen($DebtorNo) > 0) { $WhereDebtorNo = " AND salesorders.debtorno " . $DebtorNoOp . " '" . $DebtorNo . "' "; + } else { + $WhereDebtorNo = ' '; } - + $WhereDebtorName = ' '; if (mb_strlen($DebtorName) > 0 AND $DebtorNameOp == 'LIKE') { $DebtorName = $DebtorName . '%'; @@ -128,9 +143,10 @@ } if (mb_strlen($_POST['OrderNo']) > 0) { $WhereOrderNo = " AND salesorderdetails.orderno = " . " '" . $_POST['OrderNo'] . "' "; + } else { + $WhereOrderNo = " "; } - $WhereLineStatus = ' '; # Had to use IF statement instead of comparing 'linestatus' to $_POST['LineStatus'] #in WHERE clause because the WHERE clause did not recognize @@ -163,7 +179,7 @@ if ($_POST['InvoiceType'] != 'All') { $WhereType = " AND tempstockmoves.type = '" . $_POST['InvoiceType'] . "'"; } - if ($inputError !=1) { + if ($InputError !=1) { $FromDate = FormatDateForSQL($_POST['FromDate']); $ToDate = FormatDateForSQL($_POST['ToDate']); if ($_POST['ReportType'] == 'Detail') { @@ -191,18 +207,18 @@ LEFT JOIN debtorsmaster ON salesorders.debtorno = debtorsmaster.debtorno LEFT JOIN custbranch ON salesorders.branchcode = custbranch.branchcode LEFT JOIN stockmaster ON salesorderdetails.stkcode = stockmaster.stockid - WHERE salesorders.orddate >='$FromDate' - AND salesorders.orddate <='$ToDate' - AND salesorders.quotation = '" . $_POST['OrderType'] . "' - $WherePart - $WhereOrderNo - $WhereDebtorNo - $WhereDebtorName - $WhereLineStatus - $WhereArea - $WhereSalesman - $WhereCategory - ORDER BY " . $_POST['SortBy']; + WHERE salesorders.orddate >='" . $FromDate . "' + AND salesorders.orddate <='" . $ToDate . "' + AND salesorders.quotation = '" . $_POST['OrderType'] . "'" . + $WherePart . + $WhereOrderNo . + $WhereDebtorNo . + $WhereDebtorName . + $WhereLineStatus . + $WhereArea . + $WhereSalesman . + $WhereCategory . + "ORDER BY " . $_POST['SortBy']; } else { // Selects by tempstockmoves.trandate not order date $sql = "SELECT salesorderdetails.orderno, @@ -233,21 +249,21 @@ LEFT JOIN debtorsmaster ON salesorders.debtorno = debtorsmaster.debtorno LEFT JOIN custbranch ON salesorders.branchcode = custbranch.branchcode LEFT JOIN stockmaster ON salesorderdetails.stkcode = stockmaster.stockid - WHERE tempstockmoves.trandate >='$FromDate' - AND tempstockmoves.trandate <='$ToDate' + WHERE tempstockmoves.trandate >='" . $FromDate . "' + AND tempstockmoves.trandate <='" . $ToDate . "' AND tempstockmoves.stockid=salesorderdetails.stkcode AND tempstockmoves.hidemovt=0 - AND salesorders.quotation = '" . $_POST['OrderType'] . "' - $WherePart - $WhereType - $WhereOrderNo - $WhereDebtorNo - $WhereDebtorName - $WhereLineStatus - $WhereArea - $WhereSalesman - $WhereCategory - ORDER BY " . $_POST['SortBy']; + AND salesorders.quotation = '" . $_POST['OrderType'] . "' " . + $WherePart . + $WhereType . + $WhereOrderNo . + $WhereDebtorNo . + $WhereDebtorName . + $WhereLineStatus . + $WhereArea . + $WhereSalesman . + $WhereCategory . + "ORDER BY " . $_POST['SortBy']; } } else { // sql for Summary report @@ -260,7 +276,7 @@ $orderby = 'extprice DESC'; } if ($_POST['DateType'] == 'Order') { - if ($_POST['SummaryType'] == 'extprice' || $_POST['SummaryType'] == 'stkcode') { + if ($_POST['SummaryType'] == 'extprice' OR $_POST['SummaryType'] == 'stkcode') { $sql = "SELECT salesorderdetails.stkcode, SUM(salesorderdetails.quantity) as quantity, SUM(salesorderdetails.qtyinvoiced) as qtyinvoiced, @@ -276,18 +292,18 @@ LEFT JOIN stockcategory ON stockcategory.categoryid = stockmaster.categoryid LEFT JOIN salesman ON salesman.salesmancode = custbranch.salesman LEFT JOIN areas ON areas.areacode = custbranch.area - WHERE salesorders.orddate >='$FromDate' - AND salesorders.orddate <='$ToDate' - AND salesorders.quotation = '" . $_POST['OrderType'] . "' - $WherePart - $WhereOrderNo - $WhereDebtorNo - $WhereDebtorName - $WhereLineStatus - $WhereArea - $WhereSalesman - $WhereCategory - GROUP BY " . $_POST['SummaryType'] . + WHERE salesorders.orddate >='" . $FromDate . "' + AND salesorders.orddate <='" . $ToDate . "' + AND salesorders.quotation = '" . $_POST['OrderType'] . "' " . + $WherePart . + $WhereOrderNo . + $WhereDebtorNo . + $WhereDebtorName . + $WhereLineStatus . + $WhereArea . + $WhereSalesman . + $WhereCategory . + "GROUP BY " . $_POST['SummaryType'] . ",salesorderdetails.stkcode, stockmaster.description, stockmaster.decimalplaces @@ -308,22 +324,22 @@ LEFT JOIN stockcategory ON stockcategory.categoryid = stockmaster.categoryid LEFT JOIN salesman ON salesman.salesmancode = custbranch.salesman LEFT JOIN areas ON areas.areacode = custbranch.area - WHERE salesorders.orddate >='$FromDate' - AND salesorders.orddate <='$ToDate' - AND salesorders.quotation = '" . $_POST['OrderType'] . "' - $WherePart - $WhereOrderNo - $WhereDebtorNo - $WhereDebtorName - $WhereLineStatus - $WhereArea - $WhereSalesman - $WhereCategory - GROUP BY " . $_POST['SummaryType'] . + WHERE salesorders.orddate >='" . $FromDate . "' + AND salesorders.orddate <='" . $ToDate . "' + AND salesorders.quotation = '" . $_POST['OrderType'] . "' " . + $WherePart . + $WhereOrderNo . + $WhereDebtorNo . + $WhereDebtorName . + $WhereLineStatus . + $WhereArea . + $WhereSalesman . + $WhereCategory . + "GROUP BY " . $_POST['SummaryType'] . ",salesorders.debtorno, debtorsmaster.name ORDER BY " . $orderby; - } elseif ($_POST['SummaryType'] == 'debtorno' || $_POST['SummaryType'] == 'name') { + } elseif ($_POST['SummaryType'] == 'debtorno' OR $_POST['SummaryType'] == 'name') { if ($_POST['SummaryType'] == 'name') { $orderby = 'name'; } @@ -341,21 +357,20 @@ LEFT JOIN stockcategory ON stockcategory.categoryid = stockmaster.categoryid LEFT JOIN salesman ON salesman.salesmancode = custbranch.salesman LEFT JOIN areas ON areas.areacode = custbranch.area - WHERE salesorders.orddate >='$FromDate' - AND salesorders.orddate <='$ToDate' - AND salesorders.quotation = '" . $_POST['OrderType'] . "' - $WherePart - $WhereOrderNo - $WhereDebtorNo - $WhereDebtorName - $WhereLineStatus - $WhereArea - $WhereSalesman - $WhereCategory - - GROUP BY debtorsmaster.debtorno" . ' ' . - ",debtorsmaster.name - ORDER BY " . $orderby; + WHERE salesorders.orddate >='" . $FromDate . "' + AND salesorders.orddate <='" . $ToDate . "' + AND salesorders.quotation = '" . $_POST['OrderType'] . "' " . + $WherePart . + $WhereOrderNo . + $WhereDebtorNo . + $WhereDebtorName . + $WhereLineStatus . + $WhereArea . + $WhereSalesman . + $WhereCategory . + "GROUP BY debtorsmaster.debtorno + ,debtorsmaster.name + ORDER BY " . $orderby; } elseif ($_POST['SummaryType'] == 'month') { $sql = "SELECT EXTRACT(YEAR_MONTH from salesorders.orddate) as month, CONCAT(MONTHNAME(salesorders.orddate),' ',YEAR(salesorders.orddate)) as monthname, @@ -371,20 +386,20 @@ LEFT JOIN stockcategory ON stockcategory.categoryid = stockmaster.categoryid LEFT JOIN salesman ON salesman.salesmancode = custbranch.salesman LEFT JOIN areas ON areas.areacode = custbranch.area - WHERE salesorders.orddate >='$FromDate' - AND salesorders.orddate <='$ToDate' - AND salesorders.quotation = '" . $_POST['OrderType'] . "' - $WherePart - $WhereOrderNo - $WhereDebtorNo - $WhereDebtorName - $WhereLineStatus - $WhereArea - $WhereSalesman - $WhereCategory - GROUP BY " . $_POST['SummaryType'] . + WHERE salesorders.orddate >='" . $FromDate . "' + AND salesorders.orddate <='" . $ToDate . "' + AND salesorders.quotation = '" . $_POST['OrderType'] . "'" . + $WherePart . + $WhereOrderNo . + $WhereDebtorNo . + $WhereDebtorName . + $WhereLineStatus . + $WhereArea . + $WhereSalesman . + $WhereCategory . + "GROUP BY " . $_POST['SummaryType'] . ",monthname - ORDER BY " . $orderby; + ORDER BY " . $orderby; } elseif ($_POST['SummaryType'] == 'categoryid') { $sql = "SELECT stockmaster.categoryid, stockcategory.categorydescription, @@ -400,20 +415,20 @@ LEFT JOIN stockcategory ON stockcategory.categoryid = stockmaster.categoryid LEFT JOIN salesman ON salesman.salesmancode = custbranch.salesman LEFT JOIN areas ON areas.areacode = custbranch.area - WHERE salesorders.orddate >='$FromDate' - AND salesorders.orddate <='$ToDate' - AND salesorders.quotation = '" . $_POST['OrderType'] . "' - $WherePart - $WhereOrderNo - $WhereDebtorNo - $WhereDebtorName - $WhereLineStatus - $WhereArea - $WhereSalesman - $WhereCategory - GROUP BY " . $_POST['SummaryType'] . + WHERE salesorders.orddate >='" . $FromDate . "' + AND salesorders.orddate <='" . $ToDate . "' + AND salesorders.quotation = '" . $_POST['OrderType'] . "'" . + $WherePart . + $WhereOrderNo . + $WhereDebtorNo . + $WhereDebtorName . + $WhereLineStatus . + $WhereArea . + $WhereSalesman . + $WhereCategory . + "GROUP BY " . $_POST['SummaryType'] . ",categorydescription - ORDER BY " . $orderby; + ORDER BY " . $orderby; } elseif ($_POST['SummaryType'] == 'salesman') { $sql = "SELECT custbranch.salesman, salesman.salesmanname, @@ -429,20 +444,20 @@ LEFT JOIN stockcategory ON stockcategory.categoryid = stockmaster.categoryid LEFT JOIN salesman ON salesman.salesmancode = custbranch.salesman LEFT JOIN areas ON areas.areacode = custbranch.area - WHERE salesorders.orddate >='$FromDate' - AND salesorders.orddate <='$ToDate' - AND salesorders.quotation = '" . $_POST['OrderType'] . "' - $WherePart - $WhereOrderNo - $WhereDebtorNo - $WhereDebtorName - $WhereLineStatus - $WhereArea - $WhereSalesman - $WhereCategory - GROUP BY " . $_POST['SummaryType'] . + WHERE salesorders.orddate >='" . $FromDate . "' + AND salesorders.orddate <='" . $ToDate . "' + AND salesorders.quotation = '" . $_POST['OrderType'] . "'" . + $WherePart . + $WhereOrderNo . + $WhereDebtorNo . + $WhereDebtorName . + $WhereLineStatus . + $WhereArea . + $WhereSalesman . + $WhereCategory . + "GROUP BY " . $_POST['SummaryType'] . ",salesmanname - ORDER BY " . $orderby; + ORDER BY " . $orderby; } elseif ($_POST['SummaryType'] == 'area') { $sql = "SELECT custbranch.area, areas.areadescription, @@ -458,24 +473,24 @@ LEFT JOIN stockcategory ON stockcategory.categoryid = stockmaster.categoryid LEFT JOIN salesman ON salesman.salesmancode = custbranch.salesman LEFT JOIN areas ON areas.areacode = custbranch.area - WHERE salesorders.orddate >='$FromDate' - AND salesorders.orddate <='$ToDate' - AND salesorders.quotation = '" . $_POST['OrderType'] . "' - $WherePart - $WhereOrderNo - $WhereDebtorNo - $WhereDebtorName - $WhereLineStatus - $WhereArea - $WhereSalesman - $WhereCategory - GROUP BY " . $_POST['SummaryType'] . - ",areas.areadescription - ORDER BY " . $orderby; + WHERE salesorders.orddate >='" . $FromDate . "' + AND salesorders.orddate <='" . $ToDate . "' + AND salesorders.quotation = '" . $_POST['OrderType'] . "' " . + $WherePart . + $WhereOrderNo . + $WhereDebtorNo . + $WhereDebtorName . + $WhereLineStatus . + $WhereArea . + $WhereSalesman . + $WhereCategory . + "GROUP BY " . $_POST['SummaryType'] . + ",areas.areadescription + ORDER BY " . $orderby; } } else { // Selects by tempstockmoves.trandate not order date - if ($_POST['SummaryType'] == 'extprice' || $_POST['SummaryType'] == 'stkcode') { + if ($_POST['SummaryType'] == 'extprice' OR $_POST['SummaryType'] == 'stkcode') { $sql = "SELECT salesorderdetails.stkcode, SUM(salesorderdetails.quantity) as quantity, SUM(salesorderdetails.qtyinvoiced) as qtyinvoiced, @@ -492,23 +507,23 @@ LEFT JOIN stockcategory ON stockcategory.categoryid = stockmaster.categoryid LEFT JOIN salesman ON salesman.salesmancode = custbranch.salesman LEFT JOIN areas ON areas.areacode = custbranch.area - WHERE tempstockmoves.trandate >='$FromDate' - AND tempstockmoves.trandate <='$ToDate' + WHERE tempstockmoves.trandate >='" . $FromDate . "' + AND tempstockmoves.trandate <='" . $ToDate . "' AND tempstockmoves.stockid=salesorderdetails.stkcode AND tempstockmoves.hidemovt=0 - AND salesorders.quotation = '" . $_POST['OrderType'] . "' - $WherePart - $WhereType - $WhereOrderNo - $WhereDebtorNo - $WhereDebtorName - $WhereLineStatus - $WhereArea - $WhereSalesman - $WhereCategory - GROUP BY " . $_POST['SummaryType'] . + AND salesorders.quotation = '" . $_POST['OrderType'] . "'" . + $WherePart . + $WhereType . + $WhereOrderNo . + $WhereDebtorNo . + $WhereDebtorName . + $WhereLineStatus . + $WhereArea . + $WhereSalesman . + $WhereCategory . + "GROUP BY " . $_POST['SummaryType'] . ",stockmaster.description - ORDER BY " . $orderby; + ORDER BY " . $orderby; } elseif ($_POST['SummaryType'] == 'orderno') { $sql = "SELECT salesorderdetails.orderno, salesorders.debtorno, @@ -527,25 +542,25 @@ LEFT JOIN stockcategory ON stockcategory.categoryid = stockmaster.categoryid LEFT JOIN salesman ON salesman.salesmancode = custbranch.salesman LEFT JOIN areas ON areas.areacode = custbranch.area - WHERE tempstockmoves.trandate >='$FromDate' - AND tempstockmoves.trandate <='$ToDate' + WHERE tempstockmoves.trandate >='" . $FromDate . "' + AND tempstockmoves.trandate <='" . $ToDate . "' AND tempstockmoves.stockid=salesorderdetails.stkcode AND tempstockmoves.hidemovt=0 - AND salesorders.quotation = '" . $_POST['OrderType'] . "' - $WherePart - $WhereType - $WhereOrderNo - $WhereDebtorNo - $WhereDebtorName - $WhereLineStatus - $WhereArea - $WhereSalesman - $WhereCategory - GROUP BY " . $_POST['SummaryType'] . + AND salesorders.quotation = '" . $_POST['OrderType'] . "'" . + $WherePart . + $WhereType . + $WhereOrderNo . + $WhereDebtorNo . + $WhereDebtorName . + $WhereLineStatus . + $WhereArea . + $WhereSalesman . + $WhereCategory . + "GROUP BY " . $_POST['SummaryType'] . ",salesorders.debtorno, - debtorsmaster.name - ORDER BY " . $orderby; - } elseif ($_POST['SummaryType'] == 'debtorno' || $_POST['SummaryType'] == 'name') { + debtorsmaster.name + ORDER BY " . $orderby; + } elseif ($_POST['SummaryType'] == 'debtorno' OR $_POST['SummaryType'] == 'name') { if ($_POST['SummaryType'] == 'name') { $orderby = 'name'; } @@ -565,23 +580,23 @@ LEFT JOIN stockcategory ON stockcategory.categoryid = stockmaster.categoryid LEFT JOIN salesman ON salesman.salesmancode = custbranch.salesman LEFT JOIN areas ON areas.areacode = custbranch.area - WHERE tempstockmoves.trandate >='$FromDate' - AND tempstockmoves.trandate <='$ToDate' + WHERE tempstockmoves.trandate >='" . $FromDate . "' + AND tempstockmoves.trandate <='" . $ToDate . "' AND tempstockmoves.stockid=salesorderdetails.stkcode AND tempstockmoves.hidemovt=0 - AND salesorders.quotation = '" . $_POST['OrderType'] . "' - $WherePart - $WhereType - $WhereOrderNo - $WhereDebtorNo - $WhereDebtorName - $WhereLineStatus - $WhereArea - $WhereSalesman - $WhereCategory - GROUP BY debtorsmaster.debtorno" . ' ' . + AND salesorders.quotation = '" . $_POST['OrderType'] . "'" . + $WherePart . + $WhereType . + $WhereOrderNo . + $WhereDebtorNo . + $WhereDebtorName . + $WhereLineStatus . + $WhereArea . + $WhereSalesman . + $WhereCategory . + "GROUP BY debtorsmaster.debtorno" . ' ' . ",debtorsmaster.name - ORDER BY " . $orderby; + ORDER BY " . $orderby; } elseif ($_POST['SummaryType'] == 'month') { $sql = "SELECT EXTRACT(YEAR_MONTH from salesorders.orddate) as month, CONCAT(MONTHNAME(salesorders.orddate),' ',YEAR(salesorders.orddate)) as monthname, @@ -599,21 +614,21 @@ LEFT JOIN stockcategory ON stockcategory.categoryid = stockmaster.categoryid LEFT JOIN salesman ON salesman.salesmancode = custbranch.salesman LEFT JOIN areas ON areas.areacode = custbranch.area - WHERE tempstockmoves.trandate >='$FromDate' - AND tempstockmoves.trandate <='$ToDate' + WHERE tempstockmoves.trandate >='" . $FromDate . "' + AND tempstockmoves.trandate <='" . $ToDate . "' AND tempstockmoves.stockid=salesorderdetails.stkcode AND tempstockmoves.hidemovt=0 - AND salesorders.quotation = '" . $_POST['OrderType'] . "' - $WherePart - $WhereType - $WhereOrderNo - $WhereDebtorNo - $WhereDebtorName - $WhereLineStatus - $WhereArea - $WhereSalesman - $WhereCategory - GROUP BY " . $_POST['SummaryType'] . + AND salesorders.quotation = '" . $_POST['OrderType'] . "'" . + $WherePart . + $WhereType . + $WhereOrderNo . + $WhereDebtorNo . + $WhereDebtorName . + $WhereLineStatus . + $WhereArea . + $WhereSalesman . + $WhereCategory . + "GROUP BY " . $_POST['SummaryType'] . ",monthname ORDER BY " . $orderby; } elseif ($_POST['SummaryType'] == 'categoryid') { @@ -633,21 +648,21 @@ LEFT JOIN stockcategory ON stockcategory.categoryid = stockmaster.categoryid LEFT JOIN salesman ON salesman.salesmancode = custbranch.salesman LEFT JOIN areas ON areas.areacode = custbranch.area - WHERE tempstockmoves.trandate >='$FromDate' - AND tempstockmoves.trandate <='$ToDate' + WHERE tempstockmoves.trandate >='" . $FromDate . "' + AND tempstockmoves.trandate <='" . $ToDate . "' AND tempstockmoves.stockid=salesorderdetails.stkcode AND tempstockmoves.hidemovt=0 - AND salesorders.quotation = '" . $_POST['OrderType'] . "' - $WherePart - $WhereType - $WhereOrderNo - $WhereDebtorNo - $WhereDebtorName - $WhereLineStatus - $WhereArea - $WhereSalesman - $WhereCategory - GROUP BY " . $_POST['SummaryType'] . + AND salesorders.quotation = '" . $_POST['OrderType'] . "'" . + $WherePart . + $WhereType . + $WhereOrderNo . + $WhereDebtorNo . + $WhereDebtorName . + $WhereLineStatus . + $WhereArea . + $WhereSalesman . + $WhereCategory . + "GROUP BY " . $_POST['SummaryType'] . ",categorydescription ORDER BY " . $orderby; } elseif ($_POST['SummaryType'] == 'salesman') { @@ -667,21 +682,21 @@ LEFT JOIN stockcategory ON stockcategory.categoryid = stockmaster.categoryid LEFT JOIN salesman ON salesman.salesmancode = custbranch.salesman LEFT JOIN areas ON areas.areacode = custbranch.area - WHERE tempstockmoves.trandate >='$FromDate' - AND tempstockmoves.trandate <='$ToDate' + WHERE tempstockmoves.trandate >='" . $FromDate . "' + AND tempstockmoves.trandate <='" . $ToDate . "' AND tempstockmoves.stockid=salesorderdetails.stkcode AND tempstockmoves.hidemovt=0 - AND salesorders.quotation = '" . $_POST['OrderType'] . "' - $WherePart - $WhereType - $WhereOrderNo - $WhereDebtorNo - $WhereDebtorName - $WhereLineStatus - $WhereArea - $WhereSalesman - $WhereCategory - GROUP BY " . $_POST['SummaryType'] . + AND salesorders.quotation = '" . $_POST['OrderType'] . "'" . + $WherePart . + $WhereType . + $WhereOrderNo . + $WhereDebtorNo . + $WhereDebtorName . + $WhereLineStatus . + $WhereArea . + $WhereSalesman . + $WhereCategory . + "GROUP BY " . $_POST['SummaryType'] . ",salesmanname ORDER BY " . $orderby; } elseif ($_POST['SummaryType'] == 'area') { @@ -701,21 +716,21 @@ LEFT JOIN stockcategory ON stockcategory.categoryid = stockmaster.categoryid LEFT JOIN salesman ON salesman.salesmancode = custbranch.salesman LEFT JOIN areas ON areas.areacode = custbranch.area - WHERE tempstockmoves.trandate >='$FromDate' - AND tempstockmoves.trandate <='$ToDate' + WHERE tempstockmoves.trandate >='" . $FromDate . "' + AND tempstockmoves.trandate <='" . $ToDate . "' AND tempstockmoves.stockid=salesorderdetails.stkcode AND tempstockmoves.hidemovt=0 - AND salesorders.quotation = '" . $_POST['OrderType'] . "' - $WherePart - $WhereType - $WhereOrderNo - $WhereDebtorNo - $WhereDebtorName - $WhereLineStatus - $WhereArea - $WhereSalesman - $WhereCategory - GROUP BY " . $_POST['SummaryType'] . + AND salesorders.quotation = '" . $_POST['OrderType'] . "'" . + $WherePart . + $WhereType . + $WhereOrderNo . + $WhereDebtorNo . + $WhereDebtorName . + $WhereLineStatus . + $WhereArea . + $WhereSalesman . + $WhereCategory . + "GROUP BY " . $_POST['SummaryType'] . ",areas.areadescription ORDER BY " . $orderby; } @@ -731,7 +746,7 @@ $TotalExtPrice = 0; $TotalInvQty = 0; - // Create array for summary type to display in header. Access it with $savesummarytype + // Create array for summary type to display in header. Access it with $SaveSummaryType $Summary_Array['orderno'] = _('Order Number'); $Summary_Array['stkcode'] = _('Stock Code'); $Summary_Array['extprice'] = _('Extended Price'); @@ -751,7 +766,7 @@ // Display Header info if ($_POST['ReportType'] == 'Summary') { - $SortBy_Display = $Summary_Array[$savesummarytype]; + $SortBy_Display = $Summary_Array[$SaveSummaryType]; } else { $SortBy_Display = $Detail_Array[$_POST['SortBy']]; } @@ -836,8 +851,8 @@ $myrow['name'], $myrow['brname'], locale_number_format($myrow['quantity'],$myrow['decimalplaces']), - locale_number_format($myrow['extcost'],2), - locale_number_format($myrow['extprice'],2), + locale_money_format($myrow['extcost'],$_SESSION['CompanyRecord']['decimalplaces']), + locale_money_format($myrow['extprice'],$_SESSION['CompanyRecord']['decimalplaces']), locale_number_format($myrow['qtyinvoiced'],$myrow['decimalplaces']), $myrow['linestatus'], ConvertSQLDate($myrow['itemdue']), @@ -857,8 +872,8 @@ $myrow['name'], $myrow['brname'], locale_number_format($myrow['qty'],$myrow['decimalplaces']), - locale_number_format($myrow['extcost'],2), - locale_number_format($myrow['extprice'],2), + locale_money_format($myrow['extcost'],$_SESSION['CompanyRecord']['decimalplaces']), + locale_money_format($myrow['extprice'],$_SESSION['CompanyRecord']['decimalplaces']), $myrow['linestatus'], ConvertSQLDate($myrow['trandate']), $myrow['salesman'], @@ -882,8 +897,8 @@ ' ', ' ', locale_number_format($TotalQty,2), - locale_number_format($TotalExtCost,2), - locale_number_format($TotalExtPrice,2), + locale_money_format($TotalExtCost,$_SESSION['CompanyRecord']['decimalplaces']), + locale_money_format($TotalExtPrice,$_SESSION['CompanyRecord']['decimalplaces']), locale_number_format($TotalInvQty,2), ' ', ' ', @@ -899,8 +914,8 @@ ' ', ' ', locale_number_format($TotalQty,2), - locale_number_format($TotalExtCost,2), - locale_number_format($TotalExtPrice,2), + locale_money_format($TotalExtCost,$_SESSION['CompanyRecord']['decimalplaces']), + locale_money_format($TotalExtPrice,$_SESSION['CompanyRecord']['decimalplaces']), ' ', ' ', ' '); @@ -990,8 +1005,8 @@ $myrow[$SummaryType], $myrow[$Description], locale_number_format($DisplayQty,2), - locale_number_format($myrow['extcost'],2), - locale_number_format($myrow['extprice'],2), + locale_money_format($myrow['extcost'],$_SESSION['CompanyRecord']['decimalplaces']), + locale_money_format($myrow['extprice'],$_SESSION['CompanyRecord']['decimalplaces']), locale_number_format($myrow['qtyinvoiced'],2), $column7); @@ -1006,8 +1021,8 @@ _('Totals'), _('Lines - ') . $linectr, locale_number_format($TotalQty,2), - locale_number_format($TotalExtCost,2), - locale_number_format($TotalExtPrice,2), + locale_money_format($TotalExtCost,$_SESSION['CompanyRecord']['decimalplaces']), + locale_money_format($TotalExtPrice,$_SESSION['CompanyRecord']['decimalplaces']), locale_number_format($TotalInvQty,2), ' '); echo '</pre>'; @@ -1029,81 +1044,122 @@ echo '<table>'; - echo '<tr><td>' . _('Report Type') . ':</td>'; - echo '<td><select name="ReportType">'; - echo '<option selected value="Detail">' . _('Detail') . '</option>'; - echo '<option value="Summary">' . _('Summary') . '</option>'; - echo '</select></td><td> </td></tr>'; + echo '<tr> + <td>' . _('Report Type') . ':</td> + <td><select name="ReportType"> + <option selected value="Detail">' . _('Detail') . '</option> + <option value="Summary">' . _('Summary') . '</option> + </select></td> + <td> </td> + </tr>'; - echo '<tr><td>' . _('Order Type') . ':</td>'; - echo '<td><select name="OrderType">'; - echo '<option selected value="0">' . _('Sales Order') . '</option>'; - echo '<option value="1">' . _('Quotation') . '</option>'; - echo '</select></td><td> </td></tr>'; + echo '<tr> + <td>' . _('Order Type') . ':</td> + <td><select name="OrderType"> + <option selected value="0">' . _('Sales Order') . '</option> + <option value="1">' . _('Quotation') . '</option> + </select></td> + <td> </td> + </tr>'; - echo '<tr><td>' . _('Date Type') . ':</td>'; - echo '<td><select name="DateType">'; - echo '<option selected value="Order">' . _('Order Date') . '</option>'; - echo '<option value="Invoice">' . _('Invoice Date') . '</option>'; - echo '</select></td><td> </td></tr>'; + echo '<tr> + <td>' . _('Date Type') . ':</td> + <td><select name="DateType"> + <option selected value="Order">' . _('Order Date') . '</option> + <option value="Invoice">' . _('Invoice Date') . '</option> + </select></td> + <td> </td> + </tr>'; - echo '<tr><td>' . _('Invoice Type') . ':</td>'; - echo '<td><select name="InvoiceType">'; - echo '<option selected value="All">' . _('All') . '</option>'; - echo '<option value="10">' . _('Sales Invoice') . '</option>'; - echo '<option value="11">' . _('Credit Note') . '</option>'; - echo '</select></td><td> </td><td>' . _('Only Applies To Invoice Date Type') . '</td></tr>'; + echo '<tr> + <td>' . _('Invoice Type') . ':</td> + <td><select name="InvoiceType"> + <option selected value="All">' . _('All') . '</option> + <option value="10">' . _('Sales Invoice') . '</option> + <option value="11">' . _('Credit Note') . '</option> + </select></td> + <td> </td> + <td>' . _('Only Applies To Invoice Date Type') . '</td> + </tr>'; echo '<tr> - <td>' . _('Date Range') . ':</td> - <td><input type="text" class="date" alt="' .$_SESSION['DefaultDateFormat'] .'" name="FromDate" size=10 maxlength=10 value="' . $_POST['FromDate'] . '"></td> - <td>' . _('To') . ':</td> - <td><input type="text" class="date" alt="' . $_SESSION['DefaultDateFormat'] . '" name="ToDate" size=10 maxlength=10 value="' . $_POST['ToDate'] . '"></td> - </tr>'; + <td>' . _('Date Range') . ':</td> + <td><input type="text" class="date" alt="' .$_SESSION['DefaultDateFormat'] .'" name="FromDate" size=10 maxlength=10 value="' . $_POST['FromDate'] . '"></td> + <td>' . _('To') . ':</td> + <td><input type="text" class="date" alt="' . $_SESSION['DefaultDateFormat'] . '" name="ToDate" size=10 maxlength=10 value="' . $_POST['ToDate'] . '"></td> + </tr>'; + if (!isset($_POST['PartNumber'])){ + $_POST['PartNumber']=''; + } + echo '<tr> + <td>' . _('Stock Code') . ':</td> + <td><select name="PartNumberOp"> + <option selected value="Equals">' . _('Equals') . '</option> + <option value="LIKE">' . _('Begins With') . '</option> + </select></td> + <td> </td> + <td><input type="text" name="PartNumber" size=20 maxlength=20 value="'. $_POST['PartNumber'] . '"></td> + </tr>'; + if (!isset($_POST['DebtorNo'])){ + $_POST['DebtorNo']=''; + } + echo '<tr> + <td>' . _('Customer Number') . ':</td> + <td><select name="DebtorNoOp"> + <option selected value="Equals">' . _('Equals') . '</option> + <option value="LIKE">' . _('Begins With') . '</option> + </select></td> + <td> </td> + <td><input type="text" name="DebtorNo" size=10 maxlength=10 value="' . $_POST['DebtorNo'] . '"></td> + </tr>'; + if (!isset($_POST['DebtorName'])){ + $_POST['DebtorName']=''; + } + echo '<tr> + <td>' . _('Customer Name') . ':</td> + <td><select name="DebtorNameOp"> + <option selected value="LIKE">' . _('Begins With') . '</option> + <option value="Equals">' . _('Equals') . '</option> + </select></td> + <td> </td> + <td><input type="text" name="DebtorName" size=30 maxlength=30 value="' . $_POST['DebtorName'] .'"></td> + </tr>'; + if (!isset($_POST['OrderNo'])){ + $_POST['OrderNo']=''; + } + echo '<tr> + <td>' . _('Order Number') . ':</td> + <td>' . _('Equals') . '</td> + <td> </td> + <td><input type="text" name="OrderNo" size=10 maxlength=10 value="' . $_POST['OrderNo'] . '" /></td> + </tr>'; - echo '<tr><td>' . _('Stock Code') . ':</td>'; - echo '<td><select name="PartNumberOp">'; - echo '<option selected value="Equals">' . _('Equals') . '</option>'; - echo '<option value="LIKE">' . _('Begins With') . '</option>'; - echo '</select></td><td> </td>'; - echo '<td><input type="text" name="PartNumber" size=20 maxlength=20 value="'. $_POST['PartNumber'] . '"></td></tr>'; + echo '<tr> + <td>' . _('Line Item Status') . ':</td> + <td><select name="LineStatus"> + <option selected value="All">' . _('All') . '</option> + <option value="Completed">' . _('Completed') . '</option> + <option value="Open">' . _('Not Completed') . '</option> + </select></td> + <td> </td> + </tr>'; - echo '<tr><td>' . _('Customer Number') . ':</td>'; - echo '<td><select name="DebtorNoOp">'; - echo '<option selected value="Equals">' . _('Equals') . '</option>'; - echo '<option value="LIKE">' . _('Begins With') . '</option>'; - echo '</select></td><td> </td>'; - echo '<td><input type="text" name="DebtorNo" size=10 maxlength=10 value="' . $_POST['DebtorNo'] . '"></td></tr>'; + echo '<tr> + <td>' . _('Stock Categories') . ':</td> + <td><select name="Category">'; - echo '<tr><td>' . _('Customer Name') . ':</td>'; - echo '<td><select name="DebtorNameOp">'; - echo '<option selected value="LIKE">' . _('Begins With') . '</option>'; - echo '<option value="Equals">' . _('Equals') . '</option>'; - echo '</select></td><td> </td>'; - echo '<td><input type="text" name="DebtorName" size=30 maxlength=30 value="' . $_POST['DebtorName'] .'"></td></tr>'; - - echo '<tr><td>' . _('Order Number') . ':</td>'; - echo '<td>Equals</td><td> </td>'; - echo '<td><input type="text" name="OrderNo" size=10 maxlength=10 value="' . $_POST['OrderNo'] . '" /></td></tr>'; - - echo '<tr><td>' . _('Line Item Status') . ':</td>'; - echo '<td><select name="LineStatus">'; - echo '<option selected value="All">' . _('All') . '</option>'; - echo '<option value="Completed">' . _('Completed') . '</option>'; - echo '<option value="Open">' . _('Not Completed') . '</option>'; - echo '</select></td><td> </td></tr>'; - - echo '<tr><td>' . _('Stock Categories') . ':</td><td><select name="Category">'; - $CategoryResult= DB_query("SELECT categoryid, categorydescription FROM stockcategory",$db); echo '<option selected value="All">' . _('All Categories') . '</option>'; While ($myrow = DB_fetch_array($CategoryResult)){ echo '<option value="' . $myrow['categoryid'] . '">' . $myrow['categorydescription'] . '</option>'; } - echo '</select></td></tr>'; + echo '</select></td> + </tr>'; - echo '<tr><td>' . _('For Sales Man') . ':</td><td><select name="Salesman">'; + echo '<tr> + <td>' . _('For Sales Person') . ':</td> + <td><select name="Salesman">'; $sql="SELECT salesmancode, salesmanname FROM salesman"; $SalesmanResult= DB_query($sql,$db); echo '<option selected value="All">' . _('All Salesmen') . '</option>'; @@ -1113,7 +1169,8 @@ echo '</select></td></tr>'; // Use name='Areas[]' multiple - if want to create an array for Areas and allow multiple selections - echo '<tr><td>' . _('For Sales Areas') . ':</td><td><select name="Area">'; + echo '<tr><td>' . _('For Sales Areas') . ':</td> + <td><select name="Area">'; $AreasResult= DB_query("SELECT areacode, areadescription FROM areas",$db); echo '<option selected value="All">' . _('All Areas') . '</option>'; While ($myrow = DB_fetch_array($AreasResult)){ @@ -1122,42 +1179,49 @@ echo '</select></td></tr>'; echo '<tr><td> </td></tr>'; - echo '<tr><td>' . _('Sort By') . ':</td>'; - echo '<td><select name="SortBy">'; - echo '<option selected value="salesorderdetails.orderno">' . _('Order Number') . '</option>'; - echo '<option value="salesorderdetails.stkcode">' . _('Stock Code') . '</option>'; - echo '<option value="debtorsmaster.debtorno,salesorderdetails.orderno">' . _('Customer Number') . '</option>'; - echo '<option value="debtorsmaster.name,debtorsmaster.debtorno,salesorderdetails.orderno">' . _('Customer Name') . '</option>'; - echo '<option value="tempstockmoves.transno,salesorderdetails.stkcode">' . _('Transaction Number') . '</option>'; - echo '</select></td><td> </td><td>Transaction Number sort only valid for Invoice Date Type</td></tr>'; + echo '<tr> + <td>' . _('Sort By') . ':</td> + <td><select name="SortBy"> + <option selected value="salesorderdetails.orderno">' . _('Order Number') . '</option> + <option value="salesorderdetails.stkcode">' . _('Stock Code') . '</option> + <option value="debtorsmaster.debtorno,salesorderdetails.orderno">' . _('Customer Number') . '</option> + <option value="debtorsmaster.name,debtorsmaster.debtorno,salesorderdetails.orderno">' . _('Customer Name') . '</option> + <option value="tempstockmoves.transno,salesorderdetails.stkcode">' . _('Transaction Number') . '</option> + </select></td> + <td> </td> + <td>' . _('Transaction Number sort only valid for Invoice Date Type') . '</td> + </tr>'; echo '<tr><td> </td></tr> - <tr><td> </td></tr> - <tr><td> </td></tr>'; - + <tr><td> </td></tr> + <tr><td> </td></tr>'; + echo '<tr><td> </td></tr>'; - echo '<tr><td>' . _('Summary Type') . ':</td>'; - echo '<td><select name="SummaryType">'; - echo '<option selected value="orderno">' . _('Order Number') . '</option>'; - echo '<option value="transno">' . _('Transaction Number') . '</option>'; - echo '<option value="stkcode">' . _('Stock Code') . '</option>'; - echo '<option value="extprice">' . _('Extended Price') . '</option>'; - echo '<option value="debtorno">' . _('Customer Number') . '</option>'; - echo '<option value="name">' . _('Customer Name') . '</option>'; - echo '<option value="month">' . _('Month') . '</option>'; - echo '<option value="categoryid">' . _('Stock Category') . '</option>'; - echo '<option value="salesman">' . _('Salesman') . '</option>'; - echo '<option value="area">' . _('Sales Area') . '</option>'; - echo '</select></td><td> </td><td>Transaction Number summary only valid for Invoice Date Type</td></tr>'; + echo '<tr><td>' . _('Summary Type') . ':</td> + <td><select name="SummaryType"> + <option selected value="orderno">' . _('Order Number') . '</option> + <option value="transno">' . _('Transaction Number') . '</option> + <option value="stkcode">' . _('Stock Code') . '</option> + <option value="extprice">' . _('Extended Price') . '</option> + <option value="debtorno">' . _('Customer Number') . '</option> + <option value="name">' . _('Customer Name') . '</option> + <option value="month">' . _('Month') . '</option> + <option value="categoryid">' . _('Stock Category') . '</option> + <option value="salesman">' . _('Salesman') . '</option> + <option value="area">' . _('Sales Area') . '</option> + </select></td> + <td> </td> + <td>' . _('Transaction Number summary only valid for Invoice Date Type') . '</td> + </tr>'; - echo ' - <tr><td> </td></tr> - <tr><td> </td></tr> - <tr><td> </td></tr> - <tr><td> </td> - <td><input type="submit" name="submit" value="' . _('Run Inquiry') . '"></td> - </tr> - </table> + echo '<tr><td> </td></tr> + <tr><td> </td></tr> + <tr><td> </td></tr> + <tr> + <td> </td> + <td><input type="submit" name="submit" value="' . _('Run Inquiry') . '" /></td> + </tr> + </table> <br />'; echo '</form>'; Modified: trunk/SalesPeople.php =================================================================== --- trunk/SalesPeople.php 2011-09-25 03:05:27 UTC (rev 4705) +++ trunk/SalesPeople.php 2011-09-25 09:15:03 UTC (rev 4706) @@ -5,10 +5,10 @@ $title = _('Sales People Maintenance'); include('includes/header.inc'); -if (isset($_GET['SelectedSaleperson'])){ - $SelectedSaleperson =mb_strtoupper($_GET['SelectedSaleperson']); -} elseif(isset($_POST['SelectedSaleperson'])){ - $SelectedSaleperson =mb_strtoupper($_POST['SelectedSaleperson']); +if (isset($_GET['SelectedSalesPerson'])){ + $SelectedSalesPerson =mb_strtoupper($_GET['SelectedSalesPerson']); +} elseif(isset($_POST['SelectedSalesPerson'])){ + $SelectedSalesPerson =mb_strtoupper($_POST['SelectedSalesPerson']); } if (isset($Errors)) { @@ -53,10 +53,14 @@ $InputError = 1; prnMsg(_('The salesperson telephone number must be twenty characters or less long'),'error'); - } elseif (!is_double((double)$_POST['CommissionRate1']) OR !is_double((double) $_POST['CommissionRate2'])) { + } elseif (!is_numeric(filter_number_format($_POST['CommissionRate1'])) + OR !is_numeric(filter_number_format($_POST['CommissionRate2']))) { $InputError = 1; prnMsg(_('The commission rates must be a floating point number'),'error'); - } elseif (!is_double((double)$_POST['Breakpoint'])) { + echo '<br/>Commission Rate 1 = ' . filter_number_format($_POST['CommissionRate1']); + echo '<br/>Commission Rate 2 = ' . filter_number_format($_POST['CommissionRate2']); + echo '<br/>The locale decimal point is ' . $LocaleInfo['decimal_point']; + } elseif (!is_numeric(filter_number_format($_POST['Breakpoint']))) { $InputError = 1; prnMsg(_('The breakpoint should be a floating point number'),'error'); } @@ -80,18 +84,18 @@ $_POST['Current']=0; } - if (isset($SelectedSaleperson) AND $InputError !=1) { + if (isset($SelectedSalesPerson) AND $InputError !=1) { - /*SelectedSaleperson 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*/ + /*SelectedSalesPerson 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*/ $sql = "UPDATE salesman SET salesmanname='" . $_POST['SalesmanName'] . "', - commissionrate1='" . $_POST['CommissionRate1'] . "', + commissionrate1='" . filter_number_format($_POST['CommissionRate1']) . "', smantel='" . $_POST['SManTel'] . "', smanfax='" . $_POST['SManFax'] . "', - breakpoint='" . $_POST['Breakpoint'] . "', - commissionrate2='" . $_POST['CommissionRate2'] . "', + breakpoint='" . filter_number_format($_POST['Breakpoint']) . "', + commissionrate2='" . filter_number_format($_POST['CommissionRate2']) . "', current='" . $_POST['Current'] . "' - WHERE salesmancode = '".$SelectedSaleperson."'"; + WHERE salesmancode = '".$SelectedSalesPerson."'"; $msg = _('Salesperson record for') . ' ' . $_POST['SalesmanName'] . ' ' . _('has been updated'); } elseif ($InputError !=1) { @@ -107,12 +111,12 @@ smanfax, current) VALUES ('" . $_POST['SalesmanCode'] . "', - '" . $_POST['SalesmanName'] . "', - '" . $_POST['CommissionRate1'] . "', - '" . $_POST['CommissionRate2'] . "', - '" . $_POST['Breakpoint'] . "', - '" . $_POST['SManTel'] . "', - '" . $_POST['SManFax'] . "', + '" . DB_escape_string($_POST['SalesmanName']) . "', + '" . filter_number_format($_POST['CommissionRate1']) . "', + '" . filter_number_format($_POST['CommissionRate2']) . "', + '" . filter_number_format($_POST['Breakpoint']) . "', + '" . DB_escape_string($_POST['SManTel']) . "', + '" . DB_escape_string($_POST['SManFax']) . "', '" . $_POST['Current'] . "' )"; @@ -126,7 +130,7 @@ prnMsg($msg , 'success'); - unset($SelectedSalesperson); + unset($SelectedSalesPerson); unset($_POST['SalesmanCode']); unset($_POST['SalesmanName']); unset($_POST['CommissionRate1']); @@ -142,61 +146,63 @@ // PREVENT DELETES IF DEPENDENT RECORDS IN 'DebtorsMaster' - $sql= "SELECT COUNT(*) FROM custbranch WHERE custbranch.salesman='".$SelectedSaleperson."'"; + $sql= "SELECT COUNT(*) FROM custbranch WHERE custbranch.salesman='".$SelectedSalesPerson."'"; $result = DB_query($sql,$db); $myrow = DB_fetch_row($result); if ($myrow[0]>0) { prnMsg(_('Cannot delete this salesperson because branches are set up referring to them') . ' - ' . _('first alter the branches concerned') . '<br />' . _('There are') . ' ' . $myrow[0] . ' ' . _('branches that refer to this salesperson'),'error'); } else { - $sql= "SELECT COUNT(*) FROM salesanalysis WHERE salesanalysis.salesperson='".$SelectedSaleperson."'"; + $sql= "SELECT COUNT(*) FROM salesanalysis WHERE salesanalysis.salesperson='".$SelectedSalesPerson."'"; $result = DB_query($sql,$db); $myrow = DB_fetch_row($result); if ($myrow[0]>0) { prnMsg(_('Cannot delete this salesperson because sales analysis records refer to them') , '<br />' . _('There are') . ' ' . $myrow[0] . ' ' . _('sales analysis records that refer to this salesperson'),'error'); } else { - $sql="DELETE FROM salesman WHERE salesmancode='".$SelectedSaleperson."'"; + $sql="DELETE FROM salesman WHERE salesmancode='". $SelectedSalesPerson."'"; $ErrMsg = _('The salesperson could not be deleted because'); $result = DB_query($sql,$db,$ErrMsg); - prnMsg(_('Salesperson') . ' ' . $SelectedSalesperson . ' ' . _('has been deleted from the database'),'success'); - unset ($SelectedSalesperson); + prnMsg(_('Salesperson') . ' ' . $SelectedSalesPerson . ' ' . _('has been deleted from the database'),'success'); + unset ($SelectedSalesPerson); unset($delete); } } //end if Sales-person used in GL accounts } -if (!isset($SelectedSaleperson)) { +if (!isset($SelectedSalesPerson)) { -/* It could still be the second time the page has been run and a record has been selected for modification - SelectedSaleperson will exist because it was sent with the new call. If its the first time the page has been displayed with no parameters +/* It could still be the second time the page has been run and a record has been selected for modification - SelectedSalesPerson will exist because it was sent with the new call. If its the first time the page has been displayed with no parameters then none of the above are true and the list of Sales-persons will be displayed with links to delete or edit each. These will call the same page again and allow update/input or deletion of the records*/ $sql = "SELECT salesmancode, - salesmanname, - smantel, - smanfax, - commissionrate1, - breakpoint, - commissionrate2, - current - FROM salesman"; + salesmanname, + smantel, + smanfax, + commissionrate1, + breakpoint, + commissionrate2, + current + FROM salesman"; $result = DB_query($sql,$db); - echo '<table class=selection>'; - echo '<tr><th>' . _('Code') . '</th> - <th>' . _('Name') . '</th> - <th>' . _('Telephone') . '</th> - <th>' . _('Facsimile') . '</th> - <th>' . _('Comm Rate 1') . '</th> - <th>' . _('Break') . '</th> - <th>' . _('Comm Rate 2') . '</th> - <th>' . _('Current') . '</th></tr>'; + echo '<table class="selection">'; + echo '<tr> + <th>' . _('Code') . '</th> + <th>' . _('Name') . '</th> + <th>' . _('Telephone') . '</th> + <th>' . _('Facsimile') . '</th> + <th>' . _('Comm Rate 1') . '</th> + <th>' . _('Break') . '</th> + <th>' . _('Comm Rate 2') . '</th> + <th>' . _('Current') . '</th> + </tr>'; $k=0; - while ($myrow=DB_fetch_row($result)) { + while ($myrow=DB_fetch_array($result)) { if ($k==1){ echo '<tr class="EvenTableRows">'; @@ -205,38 +211,41 @@ echo '<tr class="OddTableRows">'; $k++; } - if ($myrow[7] == 1) $ActiveText = _("Yes"); else $ActiveText = _("No"); + if ($myrow[7] == 1) { + $ActiveText = _('Yes'); + } else { + $ActiveText = _('No'); + } - printf(' - <td>%s</td> - <td>%s</td> - <td>%s</td> - <td>%s</td> - <td class=number>%s</td> - <td class=number>%s</td> - <td class=number>%s</td> - <td>%s</td> - <td><a href="%sSelectedSaleperson=%s">'. _('Edit') . '</a></td> - <td><a href="%sSelectedSaleperson=%s&delete=1">' . _('Delete') . '</a></td> - </tr>', - $myrow[0], - $myrow[1], - $myrow[2], - $myrow[3], - $myrow[4], - $myrow[5], - $myrow[6], - $ActiveText, - $_SERVER['PHP_SELF'] . '?' . SID . '&', - $myrow[0], - $_SERVER['PHP_SELF'] . '?' . SID . '&', - $myrow[0]); - + printf('<td>%s</td> + <td>%s</td> + <td>%s</td> + <td>%s</td> + <td class="number">%s</td> + <td class="number">%s</td> + <td class="number">%s</td> + <td>%s</td> + <td><a href="%sSelectedSalesPerson=%s">'. _('Edit') . '</a></td> + <td><a href="%sSelectedSalesPerson=%s&delete=1" onclick="return confirm(\'' . _('Are you sure you wish to delete this sales person?') . '\');">' . _('Delete') . '</a></td> + </tr>', + $myrow['salesmancode'], + $myrow['salesmanname'], + $myrow['smantel'], + $myrow['smanfax'], + locale_number_format($myrow['commissionrate1'],2), + locale_money_format($myrow['breakpoint'],$_SESSION['CompanyRecord']['decimalplaces']), + locale_number_format($myrow['commissionrate2'],2), + $ActiveText, + $_SERVER['PHP_SELF'] . '?', + $myrow['salesmancode'], + $_SERVER['PHP_SELF'] . '?', + $myrow['salesmancode']); + } //END WHILE LIST LOOP echo '</table><br />'; } //end of ifs and buts! -if (isset($SelectedSaleperson)) { +if (isset($SelectedSalesPerson)) { echo '<div class="centre"><a href="' . $_SERVER['PHP_SELF'] . '">' . _('Show All Sales People') . '</a></div>'; } @@ -245,19 +254,19 @@ echo '<form method="post" action="' . $_SERVER['PHP_SELF'] . '">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; - if (isset($SelectedSaleperson)) { + if (isset($SelectedSalesPerson)) { //editing an existing Sales-person $sql = "SELECT salesmancode, - salesmanname, - smantel, - smanfax, - commissionrate1, - breakpoint, - commissionrate2, - current - FROM salesman - WHERE salesmancode='".$SelectedSaleperson."'"; + salesmanname, + smantel, + smanfax, + commissionrate1, + breakpoint, + commissionrate2, + current + FROM salesman + WHERE salesmancode='".$SelectedSalesPerson."'"; $result = DB_query($sql, $db); $myrow = DB_fetch_array($result); @@ -272,15 +281,20 @@ $_POST['Current'] = $myrow['current']; - echo '<input type=hidden name="SelectedSaleperson" VALUE="' . $SelectedSaleperson . '">'; - echo '<input type=hidden name="SalesmanCode" VALUE="' . $_POST['SalesmanCode'] . '">'; - echo '<table class=selection> <tr><td>' . _('Salesperson code') . ':</td><td>'; - echo $_POST['SalesmanCode'] . '</td></tr>'; + echo '<input type=hidden name="SelectedSalesPerson" value="' . $SelectedSalesPerson . '" />'; + echo '<input type=hidden name="SalesmanCode" value="' . $_POST['SalesmanCode'] . '" />'; + echo '<table class="selection"> + <tr> + <td>' . _('Salesperson code') . ':</td> + <td>' . $_POST['SalesmanCode'] . '</td></tr>'; - } else { //end of if $SelectedSaleperson only do the else when a new record is being entered + } else { //end of if $SelectedSalesPerson only do the else when a new record is being entered - echo '<table class=selection><tr><td>' . _('Salesperson code') . ':</td> - <td><input type="text" '. (in_array('SalesmanCode',$Errors) ? 'class="inputerror"' : '' ) .' name="SalesmanCode" size=3 maxlength=3></td></tr>'; + echo '<table class="selection"> + <tr> + <td>' . _('Salesperson code') . ':</td> + <td><input type="text" '. (in_array('SalesmanCode',$Errors) ? 'class="inputerror"' : '' ) .' name="SalesmanCode" size=3 maxlength=3></td> + </tr>'; } if (!isset($_POST['SalesmanName'])){ $_POST['SalesmanName']=''; @@ -304,14 +318,34 @@ $_POST['Current']=0; } - echo '<tr><td>' . _('Salesperson Name') . ':</td><td><input type="text" '. (in_array('SalesmanName',$Errors) ? 'class="inputerror"' : '' ) .' name="SalesmanName" size=30 maxlength=30 VALUE="' . $_POST['SalesmanName'] . '"></td></tr>'; - echo '<tr><td>' . _('Telephone No') . ':</td><td><input type="text" name="SManTel" size=20 maxlength=20 VALUE="' . $_POST['SManTel'] . '"></td></tr>'; - echo '<tr><td>' . _('Facsimile No') . ':</td><td><input type="text" name="SManFax" size=20 maxlength=20 VALUE="' . $_POST['SManFax'] . '"></td></tr>'; - echo '<tr><td>' . _('Commission Rate 1') . ':</td><td><input type="text" class=number name="CommissionRate1" size=5 maxlength=5 VALUE="' . $_POST['CommissionRate1'] . '"></td></tr>'; - echo '<tr><td>' . _('Breakpoint') . ':</td><td><input type="text" class=number name="Breakpoint" size=6 maxlength=6 VALUE="' . $_POST['Breakpoint'] . '"></td></tr>'; - echo '<tr><td>' . _('Commission Rate 2') . ':</td><td><input type="text" class=number name="CommissionRate2" size=5 maxlength=5 VALUE="' . $_POST['CommissionRate2']. '"></td></tr>'; + echo '<tr> + <td>' . _('Salesperson Name') . ':</td> + <td><input type="text" '. (in_array('SalesmanName',$Errors) ? 'class="inputerror"' : '' ) .' name="SalesmanName" size=30 maxlength=30 value="' . $_POST['SalesmanName'] . '"></td> + </tr>'; + echo '<tr> + <td>' . _('Telephone No') . ':</td> + <td><input type="text" name="SManTel" size=20 maxlength=20 value="' . $_POST['SManTel'] . '"></td> + </tr>'; + echo '<tr> + <td>' . _('Facsimile No') . ':</td> + <td><input type="text" name="SManFax" size=20 maxlength=20 value="' . $_POST['SManFax'] . '"></td> + </tr>'; + echo '<tr> + <td>' . _('Commission Rate 1') . ':</td> + <td><input type="text" class="number" name="CommissionRate1" size="5" maxlength="5" value="' . $_POST['CommissionRate1'] . '"></td> + </tr>'; + echo '<tr> + <td>' . _('Breakpoint') . ':</td> + <td><input type="text" class="number" name="Breakpoint" size="6" maxlength="6" value="' . $_POST['Breakpoint'] . '"></td> + </tr>'; + echo '<tr> + <td>' . _('Commission Rate 2') . ':</td> + <td><input type="text" class="number" name="CommissionRate2" size="5" maxlength="5" value="' . $_POST['CommissionRate2']. '"></td> + </tr>'; - echo '<tr><td>' . _('Current?') . ':</td><td><select name="Current">'; + echo '<tr> + <td>' . _('Current?') . ':</td> + <td><select name="Current">'; if ($_POST['Current']==1){ echo '<option selected value=1>' . _('Yes') . '</option>'; } else { @@ -322,7 +356,8 @@ } else { echo '<option value=0>' . _('No') . '</option>'; } - echo '</selec... [truncated message content] |
From: <dai...@us...> - 2011-09-25 09:15:12
|
Revision: 4706 http://web-erp.svn.sourceforge.net/web-erp/?rev=4706&view=rev Author: daintree Date: 2011-09-25 09:15:03 +0000 (Sun, 25 Sep 2011) Log Message: ----------- number_formats Modified Paths: -------------- trunk/GLAccountReport.php trunk/SalesCategoryPeriodInquiry.php trunk/SalesInquiry.php trunk/SalesPeople.php trunk/SalesTopItemsInquiry.php trunk/SalesTypes.php trunk/SecurityTokens.php trunk/includes/LanguageSetup.php Modified: trunk/GLAccountReport.php =================================================================== --- trunk/GLAccountReport.php 2011-09-25 03:05:27 UTC (rev 4705) +++ trunk/GLAccountReport.php 2011-09-25 09:15:03 UTC (rev 4706) @@ -136,19 +136,8 @@ if ($myrow['periodno']!=$PeriodNo){ if ($PeriodNo!=-9999){ //ie its not the first time around - /*Get the ChartDetails balance b/fwd and the actual movement in the account for the period as recorded in the chart details - need to ensure integrity of transactions to the chart detail movements. Also, for a balance sheet account it is the balance carried forward that is important, not just the transactions*/ - $sql = "SELECT bfwd, - actual, - period - FROM chartdetails - WHERE chartdetails.accountcode='" . $SelectedAccount . "' - AND chartdetails.period='" . $PeriodNo . "'"; - - $ErrMsg = _('The chart details for account') . ' ' . $SelectedAccount . ' ' . _('could not be retrieved'); - $ChartDetailsResult = DB_query($sql,$db,$ErrMsg); - $ChartDetailRow = DB_fetch_array($ChartDetailsResult); - $YPos -=$line_height; - $LeftOvers = $pdf->addTextWrap($Left_Margin,$YPos,150,$FontSize, _('Period Total')); + $YPos -=$line_height; + $LeftOvers = $pdf->addTextWrap($Left_Margin,$YPos,150,$FontSize, _('Period Total')); if ($PeriodTotal < 0 ){ //its a credit balance b/fwd $LeftOvers = $pdf->addTextWrap(210,$YPos,50,$FontSize, locale_money_format(-$PeriodTotal,$_SESSION['CompanyRecord']['decimalplaces']) , 'right'); } else { //its a debit balance b/fwd Modified: trunk/SalesCategoryPeriodInquiry.php =================================================================== --- trunk/SalesCategoryPeriodInquiry.php 2011-09-25 03:05:27 UTC (rev 4705) +++ trunk/SalesCategoryPeriodInquiry.php 2011-09-25 09:15:03 UTC (rev 4706) @@ -15,7 +15,7 @@ $_POST['DateRange']='ThisMonth'; } -echo '<form action="' . $_SERVER['PHP_SELF'] . '" method="post">'; +echo '<form name="form1" action="' . $_SERVER['PHP_SELF'] . '" method="post">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; echo '<table cellpadding=2 class="selection">'; @@ -28,7 +28,7 @@ if ($_POST['DateRange']=='Custom'){ echo 'checked'; } -echo ' /></td> +echo ' onChange="ReloadForm(form1.ShowSales)" /></td> </tr> <tr> <td>' . _('This Week') . ':</td> @@ -36,7 +36,7 @@ if ($_POST['DateRange']=='ThisWeek'){ echo 'checked'; } -echo ' /></td> +echo ' onChange="ReloadForm(form1.ShowSales)" /></td> </tr> <tr> <td>' . _('This Month') . ':</td> @@ -44,7 +44,7 @@ if ($_POST['DateRange']=='ThisMonth'){ echo 'checked'; } -echo ' /></td> +echo ' onChange="ReloadForm(form1.ShowSales)" /></td> </tr> <tr> <td>' . _('This Quarter') . ':</td> @@ -52,9 +52,14 @@ if ($_POST['DateRange']=='ThisQuarter'){ echo 'checked'; } -echo ' /></td> +echo ' onChange="ReloadForm(form1.ShowSales)" /></td> </tr>'; if ($_POST['DateRange']=='Custom'){ + if (!isset($_POST['FromDate'])){ + unset($_POST['ShowSales']); + $_POST['FromDate'] = Date($_SESSION['DefaultDateFormat'],mktime(1,1,1,Date('m')-12,Date('d')+1,Date('Y'))); + $_POST['ToDate'] = Date($_SESSION['DefaultDateFormat']); + } echo '<tr> <td>' . _('Date From') . ':</td> <td><input type="text" class="date" alt="' . $_SESSION['DefaultDateFormat'] . '" name="FromDate" maxlength="10" size="11" value="' . $_POST['FromDate'] . '" /></td> @@ -67,14 +72,10 @@ echo '</table>'; -echo '<br /><div class="centre"><input tabindex=4 type=submit name="ShowSales" value="' . _('Show Sales') . '" />'; +echo '<br /><div class="centre"><input tabindex=4 type="submit" name="ShowSales" value="' . _('Show Sales') . '" />'; echo '</form></div>'; echo '<br />'; -if ($_POST['DateRange']=='Custom' AND !isset($_POST['FromDate']) AND !isset($_POST['ToDate'])){ - //Don't run the report until custom dates entered - unset($_POST['ShowSales']); -} if (isset($_POST['ShowSales'])){ $InputError=0; //assume no input errors now test for errors @@ -154,7 +155,6 @@ $ErrMsg = _('The sales data could not be retrieved because') . ' - ' . DB_error_msg($db); $SalesResult = DB_query($sql,$db,$ErrMsg); - $OrdersResult = DB_query($OrdersSQL,$db,$ErrMsg); echo '<table cellpadding=2 class="selection">'; Modified: trunk/SalesInquiry.php =================================================================== --- trunk/SalesInquiry.php 2011-09-25 03:05:27 UTC (rev 4705) +++ trunk/SalesInquiry.php 2011-09-25 09:15:03 UTC (rev 4706) @@ -26,39 +26,52 @@ } # Part Number operator - either LIKE or = -$PartNumberOp = $_POST['PartNumberOp']; +if (isset($_POST['PartNumberOp'])){ + $PartNumberOp = $_POST['PartNumberOp']; +} else { + $PartNumberOp = '='; +} if (isset($_POST['DebtorNo'])){ $DebtorNo = trim(mb_strtoupper($_POST['DebtorNo'])); } elseif (isset($_GET['DebtorNo'])){ $DebtorNo = trim(mb_strtoupper($_GET['DebtorNo'])); } - -$DebtorNoOp = $_POST['DebtorNoOp']; - +if (isset($_POST['DebtorNoOp'])){ + $DebtorNoOp = $_POST['DebtorNoOp']; +} else { + $DebtorNoOp = '='; +} if (isset($_POST['DebtorName'])){ $DebtorName = trim(mb_strtoupper($_POST['DebtorName'])); } elseif (isset($_GET['DebtorName'])){ $DebtorName = trim(mb_strtoupper($_GET['DebtorName'])); } +if (isset($_POST['DebtorNameOp'])){ + $DebtorNameOp = $_POST['DebtorNameOp']; +} else { + $DebtorNameOp = '='; +} -$DebtorNameOp = $_POST['DebtorNameOp']; - -// Save $_POST['SummaryType'] in $savesummarytype because change $_POST['SummaryType'] when +// Save $_POST['SummaryType'] in $SaveSummaryType because change $_POST['SummaryType'] when // create $sql -$savesummarytype = $_POST['SummaryType']; +if (isset($_POST['SummaryType'])){ + $SaveSummaryType = $_POST['SummaryType']; +} else { + $SaveSummaryType = 'name'; +} if (isset($_POST['submit'])) { - submit($db,$PartNumber,$PartNumberOp,$DebtorNo,$DebtorNoOp,$DebtorName,$DebtorNameOp,$savesummarytype); + submit($db,$PartNumber,$PartNumberOp,$DebtorNo,$DebtorNoOp,$DebtorName,$DebtorNameOp,$SaveSummaryType); } else { display($db); } //####_SUBMIT_SUBMIT_SUBMIT_SUBMIT_SUBMIT_SUBMIT_SUBMIT_SUBMIT_SUBMIT_SUBMIT_SUBMIT_SUBMIT#### -function submit(&$db,$PartNumber,$PartNumberOp,$DebtorNo,$DebtorNoOp,$DebtorName,$DebtorNameOp,$savesummarytype) { +function submit(&$db,$PartNumber,$PartNumberOp,$DebtorNo,$DebtorNoOp,$DebtorName,$DebtorNameOp,$SaveSummaryType) { - //initialize no input errors + //initialise no input errors $InputError = 0; /* actions to take once the user has clicked the submit button @@ -115,8 +128,10 @@ } if (mb_strlen($DebtorNo) > 0) { $WhereDebtorNo = " AND salesorders.debtorno " . $DebtorNoOp . " '" . $DebtorNo . "' "; + } else { + $WhereDebtorNo = ' '; } - + $WhereDebtorName = ' '; if (mb_strlen($DebtorName) > 0 AND $DebtorNameOp == 'LIKE') { $DebtorName = $DebtorName . '%'; @@ -128,9 +143,10 @@ } if (mb_strlen($_POST['OrderNo']) > 0) { $WhereOrderNo = " AND salesorderdetails.orderno = " . " '" . $_POST['OrderNo'] . "' "; + } else { + $WhereOrderNo = " "; } - $WhereLineStatus = ' '; # Had to use IF statement instead of comparing 'linestatus' to $_POST['LineStatus'] #in WHERE clause because the WHERE clause did not recognize @@ -163,7 +179,7 @@ if ($_POST['InvoiceType'] != 'All') { $WhereType = " AND tempstockmoves.type = '" . $_POST['InvoiceType'] . "'"; } - if ($inputError !=1) { + if ($InputError !=1) { $FromDate = FormatDateForSQL($_POST['FromDate']); $ToDate = FormatDateForSQL($_POST['ToDate']); if ($_POST['ReportType'] == 'Detail') { @@ -191,18 +207,18 @@ LEFT JOIN debtorsmaster ON salesorders.debtorno = debtorsmaster.debtorno LEFT JOIN custbranch ON salesorders.branchcode = custbranch.branchcode LEFT JOIN stockmaster ON salesorderdetails.stkcode = stockmaster.stockid - WHERE salesorders.orddate >='$FromDate' - AND salesorders.orddate <='$ToDate' - AND salesorders.quotation = '" . $_POST['OrderType'] . "' - $WherePart - $WhereOrderNo - $WhereDebtorNo - $WhereDebtorName - $WhereLineStatus - $WhereArea - $WhereSalesman - $WhereCategory - ORDER BY " . $_POST['SortBy']; + WHERE salesorders.orddate >='" . $FromDate . "' + AND salesorders.orddate <='" . $ToDate . "' + AND salesorders.quotation = '" . $_POST['OrderType'] . "'" . + $WherePart . + $WhereOrderNo . + $WhereDebtorNo . + $WhereDebtorName . + $WhereLineStatus . + $WhereArea . + $WhereSalesman . + $WhereCategory . + "ORDER BY " . $_POST['SortBy']; } else { // Selects by tempstockmoves.trandate not order date $sql = "SELECT salesorderdetails.orderno, @@ -233,21 +249,21 @@ LEFT JOIN debtorsmaster ON salesorders.debtorno = debtorsmaster.debtorno LEFT JOIN custbranch ON salesorders.branchcode = custbranch.branchcode LEFT JOIN stockmaster ON salesorderdetails.stkcode = stockmaster.stockid - WHERE tempstockmoves.trandate >='$FromDate' - AND tempstockmoves.trandate <='$ToDate' + WHERE tempstockmoves.trandate >='" . $FromDate . "' + AND tempstockmoves.trandate <='" . $ToDate . "' AND tempstockmoves.stockid=salesorderdetails.stkcode AND tempstockmoves.hidemovt=0 - AND salesorders.quotation = '" . $_POST['OrderType'] . "' - $WherePart - $WhereType - $WhereOrderNo - $WhereDebtorNo - $WhereDebtorName - $WhereLineStatus - $WhereArea - $WhereSalesman - $WhereCategory - ORDER BY " . $_POST['SortBy']; + AND salesorders.quotation = '" . $_POST['OrderType'] . "' " . + $WherePart . + $WhereType . + $WhereOrderNo . + $WhereDebtorNo . + $WhereDebtorName . + $WhereLineStatus . + $WhereArea . + $WhereSalesman . + $WhereCategory . + "ORDER BY " . $_POST['SortBy']; } } else { // sql for Summary report @@ -260,7 +276,7 @@ $orderby = 'extprice DESC'; } if ($_POST['DateType'] == 'Order') { - if ($_POST['SummaryType'] == 'extprice' || $_POST['SummaryType'] == 'stkcode') { + if ($_POST['SummaryType'] == 'extprice' OR $_POST['SummaryType'] == 'stkcode') { $sql = "SELECT salesorderdetails.stkcode, SUM(salesorderdetails.quantity) as quantity, SUM(salesorderdetails.qtyinvoiced) as qtyinvoiced, @@ -276,18 +292,18 @@ LEFT JOIN stockcategory ON stockcategory.categoryid = stockmaster.categoryid LEFT JOIN salesman ON salesman.salesmancode = custbranch.salesman LEFT JOIN areas ON areas.areacode = custbranch.area - WHERE salesorders.orddate >='$FromDate' - AND salesorders.orddate <='$ToDate' - AND salesorders.quotation = '" . $_POST['OrderType'] . "' - $WherePart - $WhereOrderNo - $WhereDebtorNo - $WhereDebtorName - $WhereLineStatus - $WhereArea - $WhereSalesman - $WhereCategory - GROUP BY " . $_POST['SummaryType'] . + WHERE salesorders.orddate >='" . $FromDate . "' + AND salesorders.orddate <='" . $ToDate . "' + AND salesorders.quotation = '" . $_POST['OrderType'] . "' " . + $WherePart . + $WhereOrderNo . + $WhereDebtorNo . + $WhereDebtorName . + $WhereLineStatus . + $WhereArea . + $WhereSalesman . + $WhereCategory . + "GROUP BY " . $_POST['SummaryType'] . ",salesorderdetails.stkcode, stockmaster.description, stockmaster.decimalplaces @@ -308,22 +324,22 @@ LEFT JOIN stockcategory ON stockcategory.categoryid = stockmaster.categoryid LEFT JOIN salesman ON salesman.salesmancode = custbranch.salesman LEFT JOIN areas ON areas.areacode = custbranch.area - WHERE salesorders.orddate >='$FromDate' - AND salesorders.orddate <='$ToDate' - AND salesorders.quotation = '" . $_POST['OrderType'] . "' - $WherePart - $WhereOrderNo - $WhereDebtorNo - $WhereDebtorName - $WhereLineStatus - $WhereArea - $WhereSalesman - $WhereCategory - GROUP BY " . $_POST['SummaryType'] . + WHERE salesorders.orddate >='" . $FromDate . "' + AND salesorders.orddate <='" . $ToDate . "' + AND salesorders.quotation = '" . $_POST['OrderType'] . "' " . + $WherePart . + $WhereOrderNo . + $WhereDebtorNo . + $WhereDebtorName . + $WhereLineStatus . + $WhereArea . + $WhereSalesman . + $WhereCategory . + "GROUP BY " . $_POST['SummaryType'] . ",salesorders.debtorno, debtorsmaster.name ORDER BY " . $orderby; - } elseif ($_POST['SummaryType'] == 'debtorno' || $_POST['SummaryType'] == 'name') { + } elseif ($_POST['SummaryType'] == 'debtorno' OR $_POST['SummaryType'] == 'name') { if ($_POST['SummaryType'] == 'name') { $orderby = 'name'; } @@ -341,21 +357,20 @@ LEFT JOIN stockcategory ON stockcategory.categoryid = stockmaster.categoryid LEFT JOIN salesman ON salesman.salesmancode = custbranch.salesman LEFT JOIN areas ON areas.areacode = custbranch.area - WHERE salesorders.orddate >='$FromDate' - AND salesorders.orddate <='$ToDate' - AND salesorders.quotation = '" . $_POST['OrderType'] . "' - $WherePart - $WhereOrderNo - $WhereDebtorNo - $WhereDebtorName - $WhereLineStatus - $WhereArea - $WhereSalesman - $WhereCategory - - GROUP BY debtorsmaster.debtorno" . ' ' . - ",debtorsmaster.name - ORDER BY " . $orderby; + WHERE salesorders.orddate >='" . $FromDate . "' + AND salesorders.orddate <='" . $ToDate . "' + AND salesorders.quotation = '" . $_POST['OrderType'] . "' " . + $WherePart . + $WhereOrderNo . + $WhereDebtorNo . + $WhereDebtorName . + $WhereLineStatus . + $WhereArea . + $WhereSalesman . + $WhereCategory . + "GROUP BY debtorsmaster.debtorno + ,debtorsmaster.name + ORDER BY " . $orderby; } elseif ($_POST['SummaryType'] == 'month') { $sql = "SELECT EXTRACT(YEAR_MONTH from salesorders.orddate) as month, CONCAT(MONTHNAME(salesorders.orddate),' ',YEAR(salesorders.orddate)) as monthname, @@ -371,20 +386,20 @@ LEFT JOIN stockcategory ON stockcategory.categoryid = stockmaster.categoryid LEFT JOIN salesman ON salesman.salesmancode = custbranch.salesman LEFT JOIN areas ON areas.areacode = custbranch.area - WHERE salesorders.orddate >='$FromDate' - AND salesorders.orddate <='$ToDate' - AND salesorders.quotation = '" . $_POST['OrderType'] . "' - $WherePart - $WhereOrderNo - $WhereDebtorNo - $WhereDebtorName - $WhereLineStatus - $WhereArea - $WhereSalesman - $WhereCategory - GROUP BY " . $_POST['SummaryType'] . + WHERE salesorders.orddate >='" . $FromDate . "' + AND salesorders.orddate <='" . $ToDate . "' + AND salesorders.quotation = '" . $_POST['OrderType'] . "'" . + $WherePart . + $WhereOrderNo . + $WhereDebtorNo . + $WhereDebtorName . + $WhereLineStatus . + $WhereArea . + $WhereSalesman . + $WhereCategory . + "GROUP BY " . $_POST['SummaryType'] . ",monthname - ORDER BY " . $orderby; + ORDER BY " . $orderby; } elseif ($_POST['SummaryType'] == 'categoryid') { $sql = "SELECT stockmaster.categoryid, stockcategory.categorydescription, @@ -400,20 +415,20 @@ LEFT JOIN stockcategory ON stockcategory.categoryid = stockmaster.categoryid LEFT JOIN salesman ON salesman.salesmancode = custbranch.salesman LEFT JOIN areas ON areas.areacode = custbranch.area - WHERE salesorders.orddate >='$FromDate' - AND salesorders.orddate <='$ToDate' - AND salesorders.quotation = '" . $_POST['OrderType'] . "' - $WherePart - $WhereOrderNo - $WhereDebtorNo - $WhereDebtorName - $WhereLineStatus - $WhereArea - $WhereSalesman - $WhereCategory - GROUP BY " . $_POST['SummaryType'] . + WHERE salesorders.orddate >='" . $FromDate . "' + AND salesorders.orddate <='" . $ToDate . "' + AND salesorders.quotation = '" . $_POST['OrderType'] . "'" . + $WherePart . + $WhereOrderNo . + $WhereDebtorNo . + $WhereDebtorName . + $WhereLineStatus . + $WhereArea . + $WhereSalesman . + $WhereCategory . + "GROUP BY " . $_POST['SummaryType'] . ",categorydescription - ORDER BY " . $orderby; + ORDER BY " . $orderby; } elseif ($_POST['SummaryType'] == 'salesman') { $sql = "SELECT custbranch.salesman, salesman.salesmanname, @@ -429,20 +444,20 @@ LEFT JOIN stockcategory ON stockcategory.categoryid = stockmaster.categoryid LEFT JOIN salesman ON salesman.salesmancode = custbranch.salesman LEFT JOIN areas ON areas.areacode = custbranch.area - WHERE salesorders.orddate >='$FromDate' - AND salesorders.orddate <='$ToDate' - AND salesorders.quotation = '" . $_POST['OrderType'] . "' - $WherePart - $WhereOrderNo - $WhereDebtorNo - $WhereDebtorName - $WhereLineStatus - $WhereArea - $WhereSalesman - $WhereCategory - GROUP BY " . $_POST['SummaryType'] . + WHERE salesorders.orddate >='" . $FromDate . "' + AND salesorders.orddate <='" . $ToDate . "' + AND salesorders.quotation = '" . $_POST['OrderType'] . "'" . + $WherePart . + $WhereOrderNo . + $WhereDebtorNo . + $WhereDebtorName . + $WhereLineStatus . + $WhereArea . + $WhereSalesman . + $WhereCategory . + "GROUP BY " . $_POST['SummaryType'] . ",salesmanname - ORDER BY " . $orderby; + ORDER BY " . $orderby; } elseif ($_POST['SummaryType'] == 'area') { $sql = "SELECT custbranch.area, areas.areadescription, @@ -458,24 +473,24 @@ LEFT JOIN stockcategory ON stockcategory.categoryid = stockmaster.categoryid LEFT JOIN salesman ON salesman.salesmancode = custbranch.salesman LEFT JOIN areas ON areas.areacode = custbranch.area - WHERE salesorders.orddate >='$FromDate' - AND salesorders.orddate <='$ToDate' - AND salesorders.quotation = '" . $_POST['OrderType'] . "' - $WherePart - $WhereOrderNo - $WhereDebtorNo - $WhereDebtorName - $WhereLineStatus - $WhereArea - $WhereSalesman - $WhereCategory - GROUP BY " . $_POST['SummaryType'] . - ",areas.areadescription - ORDER BY " . $orderby; + WHERE salesorders.orddate >='" . $FromDate . "' + AND salesorders.orddate <='" . $ToDate . "' + AND salesorders.quotation = '" . $_POST['OrderType'] . "' " . + $WherePart . + $WhereOrderNo . + $WhereDebtorNo . + $WhereDebtorName . + $WhereLineStatus . + $WhereArea . + $WhereSalesman . + $WhereCategory . + "GROUP BY " . $_POST['SummaryType'] . + ",areas.areadescription + ORDER BY " . $orderby; } } else { // Selects by tempstockmoves.trandate not order date - if ($_POST['SummaryType'] == 'extprice' || $_POST['SummaryType'] == 'stkcode') { + if ($_POST['SummaryType'] == 'extprice' OR $_POST['SummaryType'] == 'stkcode') { $sql = "SELECT salesorderdetails.stkcode, SUM(salesorderdetails.quantity) as quantity, SUM(salesorderdetails.qtyinvoiced) as qtyinvoiced, @@ -492,23 +507,23 @@ LEFT JOIN stockcategory ON stockcategory.categoryid = stockmaster.categoryid LEFT JOIN salesman ON salesman.salesmancode = custbranch.salesman LEFT JOIN areas ON areas.areacode = custbranch.area - WHERE tempstockmoves.trandate >='$FromDate' - AND tempstockmoves.trandate <='$ToDate' + WHERE tempstockmoves.trandate >='" . $FromDate . "' + AND tempstockmoves.trandate <='" . $ToDate . "' AND tempstockmoves.stockid=salesorderdetails.stkcode AND tempstockmoves.hidemovt=0 - AND salesorders.quotation = '" . $_POST['OrderType'] . "' - $WherePart - $WhereType - $WhereOrderNo - $WhereDebtorNo - $WhereDebtorName - $WhereLineStatus - $WhereArea - $WhereSalesman - $WhereCategory - GROUP BY " . $_POST['SummaryType'] . + AND salesorders.quotation = '" . $_POST['OrderType'] . "'" . + $WherePart . + $WhereType . + $WhereOrderNo . + $WhereDebtorNo . + $WhereDebtorName . + $WhereLineStatus . + $WhereArea . + $WhereSalesman . + $WhereCategory . + "GROUP BY " . $_POST['SummaryType'] . ",stockmaster.description - ORDER BY " . $orderby; + ORDER BY " . $orderby; } elseif ($_POST['SummaryType'] == 'orderno') { $sql = "SELECT salesorderdetails.orderno, salesorders.debtorno, @@ -527,25 +542,25 @@ LEFT JOIN stockcategory ON stockcategory.categoryid = stockmaster.categoryid LEFT JOIN salesman ON salesman.salesmancode = custbranch.salesman LEFT JOIN areas ON areas.areacode = custbranch.area - WHERE tempstockmoves.trandate >='$FromDate' - AND tempstockmoves.trandate <='$ToDate' + WHERE tempstockmoves.trandate >='" . $FromDate . "' + AND tempstockmoves.trandate <='" . $ToDate . "' AND tempstockmoves.stockid=salesorderdetails.stkcode AND tempstockmoves.hidemovt=0 - AND salesorders.quotation = '" . $_POST['OrderType'] . "' - $WherePart - $WhereType - $WhereOrderNo - $WhereDebtorNo - $WhereDebtorName - $WhereLineStatus - $WhereArea - $WhereSalesman - $WhereCategory - GROUP BY " . $_POST['SummaryType'] . + AND salesorders.quotation = '" . $_POST['OrderType'] . "'" . + $WherePart . + $WhereType . + $WhereOrderNo . + $WhereDebtorNo . + $WhereDebtorName . + $WhereLineStatus . + $WhereArea . + $WhereSalesman . + $WhereCategory . + "GROUP BY " . $_POST['SummaryType'] . ",salesorders.debtorno, - debtorsmaster.name - ORDER BY " . $orderby; - } elseif ($_POST['SummaryType'] == 'debtorno' || $_POST['SummaryType'] == 'name') { + debtorsmaster.name + ORDER BY " . $orderby; + } elseif ($_POST['SummaryType'] == 'debtorno' OR $_POST['SummaryType'] == 'name') { if ($_POST['SummaryType'] == 'name') { $orderby = 'name'; } @@ -565,23 +580,23 @@ LEFT JOIN stockcategory ON stockcategory.categoryid = stockmaster.categoryid LEFT JOIN salesman ON salesman.salesmancode = custbranch.salesman LEFT JOIN areas ON areas.areacode = custbranch.area - WHERE tempstockmoves.trandate >='$FromDate' - AND tempstockmoves.trandate <='$ToDate' + WHERE tempstockmoves.trandate >='" . $FromDate . "' + AND tempstockmoves.trandate <='" . $ToDate . "' AND tempstockmoves.stockid=salesorderdetails.stkcode AND tempstockmoves.hidemovt=0 - AND salesorders.quotation = '" . $_POST['OrderType'] . "' - $WherePart - $WhereType - $WhereOrderNo - $WhereDebtorNo - $WhereDebtorName - $WhereLineStatus - $WhereArea - $WhereSalesman - $WhereCategory - GROUP BY debtorsmaster.debtorno" . ' ' . + AND salesorders.quotation = '" . $_POST['OrderType'] . "'" . + $WherePart . + $WhereType . + $WhereOrderNo . + $WhereDebtorNo . + $WhereDebtorName . + $WhereLineStatus . + $WhereArea . + $WhereSalesman . + $WhereCategory . + "GROUP BY debtorsmaster.debtorno" . ' ' . ",debtorsmaster.name - ORDER BY " . $orderby; + ORDER BY " . $orderby; } elseif ($_POST['SummaryType'] == 'month') { $sql = "SELECT EXTRACT(YEAR_MONTH from salesorders.orddate) as month, CONCAT(MONTHNAME(salesorders.orddate),' ',YEAR(salesorders.orddate)) as monthname, @@ -599,21 +614,21 @@ LEFT JOIN stockcategory ON stockcategory.categoryid = stockmaster.categoryid LEFT JOIN salesman ON salesman.salesmancode = custbranch.salesman LEFT JOIN areas ON areas.areacode = custbranch.area - WHERE tempstockmoves.trandate >='$FromDate' - AND tempstockmoves.trandate <='$ToDate' + WHERE tempstockmoves.trandate >='" . $FromDate . "' + AND tempstockmoves.trandate <='" . $ToDate . "' AND tempstockmoves.stockid=salesorderdetails.stkcode AND tempstockmoves.hidemovt=0 - AND salesorders.quotation = '" . $_POST['OrderType'] . "' - $WherePart - $WhereType - $WhereOrderNo - $WhereDebtorNo - $WhereDebtorName - $WhereLineStatus - $WhereArea - $WhereSalesman - $WhereCategory - GROUP BY " . $_POST['SummaryType'] . + AND salesorders.quotation = '" . $_POST['OrderType'] . "'" . + $WherePart . + $WhereType . + $WhereOrderNo . + $WhereDebtorNo . + $WhereDebtorName . + $WhereLineStatus . + $WhereArea . + $WhereSalesman . + $WhereCategory . + "GROUP BY " . $_POST['SummaryType'] . ",monthname ORDER BY " . $orderby; } elseif ($_POST['SummaryType'] == 'categoryid') { @@ -633,21 +648,21 @@ LEFT JOIN stockcategory ON stockcategory.categoryid = stockmaster.categoryid LEFT JOIN salesman ON salesman.salesmancode = custbranch.salesman LEFT JOIN areas ON areas.areacode = custbranch.area - WHERE tempstockmoves.trandate >='$FromDate' - AND tempstockmoves.trandate <='$ToDate' + WHERE tempstockmoves.trandate >='" . $FromDate . "' + AND tempstockmoves.trandate <='" . $ToDate . "' AND tempstockmoves.stockid=salesorderdetails.stkcode AND tempstockmoves.hidemovt=0 - AND salesorders.quotation = '" . $_POST['OrderType'] . "' - $WherePart - $WhereType - $WhereOrderNo - $WhereDebtorNo - $WhereDebtorName - $WhereLineStatus - $WhereArea - $WhereSalesman - $WhereCategory - GROUP BY " . $_POST['SummaryType'] . + AND salesorders.quotation = '" . $_POST['OrderType'] . "'" . + $WherePart . + $WhereType . + $WhereOrderNo . + $WhereDebtorNo . + $WhereDebtorName . + $WhereLineStatus . + $WhereArea . + $WhereSalesman . + $WhereCategory . + "GROUP BY " . $_POST['SummaryType'] . ",categorydescription ORDER BY " . $orderby; } elseif ($_POST['SummaryType'] == 'salesman') { @@ -667,21 +682,21 @@ LEFT JOIN stockcategory ON stockcategory.categoryid = stockmaster.categoryid LEFT JOIN salesman ON salesman.salesmancode = custbranch.salesman LEFT JOIN areas ON areas.areacode = custbranch.area - WHERE tempstockmoves.trandate >='$FromDate' - AND tempstockmoves.trandate <='$ToDate' + WHERE tempstockmoves.trandate >='" . $FromDate . "' + AND tempstockmoves.trandate <='" . $ToDate . "' AND tempstockmoves.stockid=salesorderdetails.stkcode AND tempstockmoves.hidemovt=0 - AND salesorders.quotation = '" . $_POST['OrderType'] . "' - $WherePart - $WhereType - $WhereOrderNo - $WhereDebtorNo - $WhereDebtorName - $WhereLineStatus - $WhereArea - $WhereSalesman - $WhereCategory - GROUP BY " . $_POST['SummaryType'] . + AND salesorders.quotation = '" . $_POST['OrderType'] . "'" . + $WherePart . + $WhereType . + $WhereOrderNo . + $WhereDebtorNo . + $WhereDebtorName . + $WhereLineStatus . + $WhereArea . + $WhereSalesman . + $WhereCategory . + "GROUP BY " . $_POST['SummaryType'] . ",salesmanname ORDER BY " . $orderby; } elseif ($_POST['SummaryType'] == 'area') { @@ -701,21 +716,21 @@ LEFT JOIN stockcategory ON stockcategory.categoryid = stockmaster.categoryid LEFT JOIN salesman ON salesman.salesmancode = custbranch.salesman LEFT JOIN areas ON areas.areacode = custbranch.area - WHERE tempstockmoves.trandate >='$FromDate' - AND tempstockmoves.trandate <='$ToDate' + WHERE tempstockmoves.trandate >='" . $FromDate . "' + AND tempstockmoves.trandate <='" . $ToDate . "' AND tempstockmoves.stockid=salesorderdetails.stkcode AND tempstockmoves.hidemovt=0 - AND salesorders.quotation = '" . $_POST['OrderType'] . "' - $WherePart - $WhereType - $WhereOrderNo - $WhereDebtorNo - $WhereDebtorName - $WhereLineStatus - $WhereArea - $WhereSalesman - $WhereCategory - GROUP BY " . $_POST['SummaryType'] . + AND salesorders.quotation = '" . $_POST['OrderType'] . "'" . + $WherePart . + $WhereType . + $WhereOrderNo . + $WhereDebtorNo . + $WhereDebtorName . + $WhereLineStatus . + $WhereArea . + $WhereSalesman . + $WhereCategory . + "GROUP BY " . $_POST['SummaryType'] . ",areas.areadescription ORDER BY " . $orderby; } @@ -731,7 +746,7 @@ $TotalExtPrice = 0; $TotalInvQty = 0; - // Create array for summary type to display in header. Access it with $savesummarytype + // Create array for summary type to display in header. Access it with $SaveSummaryType $Summary_Array['orderno'] = _('Order Number'); $Summary_Array['stkcode'] = _('Stock Code'); $Summary_Array['extprice'] = _('Extended Price'); @@ -751,7 +766,7 @@ // Display Header info if ($_POST['ReportType'] == 'Summary') { - $SortBy_Display = $Summary_Array[$savesummarytype]; + $SortBy_Display = $Summary_Array[$SaveSummaryType]; } else { $SortBy_Display = $Detail_Array[$_POST['SortBy']]; } @@ -836,8 +851,8 @@ $myrow['name'], $myrow['brname'], locale_number_format($myrow['quantity'],$myrow['decimalplaces']), - locale_number_format($myrow['extcost'],2), - locale_number_format($myrow['extprice'],2), + locale_money_format($myrow['extcost'],$_SESSION['CompanyRecord']['decimalplaces']), + locale_money_format($myrow['extprice'],$_SESSION['CompanyRecord']['decimalplaces']), locale_number_format($myrow['qtyinvoiced'],$myrow['decimalplaces']), $myrow['linestatus'], ConvertSQLDate($myrow['itemdue']), @@ -857,8 +872,8 @@ $myrow['name'], $myrow['brname'], locale_number_format($myrow['qty'],$myrow['decimalplaces']), - locale_number_format($myrow['extcost'],2), - locale_number_format($myrow['extprice'],2), + locale_money_format($myrow['extcost'],$_SESSION['CompanyRecord']['decimalplaces']), + locale_money_format($myrow['extprice'],$_SESSION['CompanyRecord']['decimalplaces']), $myrow['linestatus'], ConvertSQLDate($myrow['trandate']), $myrow['salesman'], @@ -882,8 +897,8 @@ ' ', ' ', locale_number_format($TotalQty,2), - locale_number_format($TotalExtCost,2), - locale_number_format($TotalExtPrice,2), + locale_money_format($TotalExtCost,$_SESSION['CompanyRecord']['decimalplaces']), + locale_money_format($TotalExtPrice,$_SESSION['CompanyRecord']['decimalplaces']), locale_number_format($TotalInvQty,2), ' ', ' ', @@ -899,8 +914,8 @@ ' ', ' ', locale_number_format($TotalQty,2), - locale_number_format($TotalExtCost,2), - locale_number_format($TotalExtPrice,2), + locale_money_format($TotalExtCost,$_SESSION['CompanyRecord']['decimalplaces']), + locale_money_format($TotalExtPrice,$_SESSION['CompanyRecord']['decimalplaces']), ' ', ' ', ' '); @@ -990,8 +1005,8 @@ $myrow[$SummaryType], $myrow[$Description], locale_number_format($DisplayQty,2), - locale_number_format($myrow['extcost'],2), - locale_number_format($myrow['extprice'],2), + locale_money_format($myrow['extcost'],$_SESSION['CompanyRecord']['decimalplaces']), + locale_money_format($myrow['extprice'],$_SESSION['CompanyRecord']['decimalplaces']), locale_number_format($myrow['qtyinvoiced'],2), $column7); @@ -1006,8 +1021,8 @@ _('Totals'), _('Lines - ') . $linectr, locale_number_format($TotalQty,2), - locale_number_format($TotalExtCost,2), - locale_number_format($TotalExtPrice,2), + locale_money_format($TotalExtCost,$_SESSION['CompanyRecord']['decimalplaces']), + locale_money_format($TotalExtPrice,$_SESSION['CompanyRecord']['decimalplaces']), locale_number_format($TotalInvQty,2), ' '); echo '</pre>'; @@ -1029,81 +1044,122 @@ echo '<table>'; - echo '<tr><td>' . _('Report Type') . ':</td>'; - echo '<td><select name="ReportType">'; - echo '<option selected value="Detail">' . _('Detail') . '</option>'; - echo '<option value="Summary">' . _('Summary') . '</option>'; - echo '</select></td><td> </td></tr>'; + echo '<tr> + <td>' . _('Report Type') . ':</td> + <td><select name="ReportType"> + <option selected value="Detail">' . _('Detail') . '</option> + <option value="Summary">' . _('Summary') . '</option> + </select></td> + <td> </td> + </tr>'; - echo '<tr><td>' . _('Order Type') . ':</td>'; - echo '<td><select name="OrderType">'; - echo '<option selected value="0">' . _('Sales Order') . '</option>'; - echo '<option value="1">' . _('Quotation') . '</option>'; - echo '</select></td><td> </td></tr>'; + echo '<tr> + <td>' . _('Order Type') . ':</td> + <td><select name="OrderType"> + <option selected value="0">' . _('Sales Order') . '</option> + <option value="1">' . _('Quotation') . '</option> + </select></td> + <td> </td> + </tr>'; - echo '<tr><td>' . _('Date Type') . ':</td>'; - echo '<td><select name="DateType">'; - echo '<option selected value="Order">' . _('Order Date') . '</option>'; - echo '<option value="Invoice">' . _('Invoice Date') . '</option>'; - echo '</select></td><td> </td></tr>'; + echo '<tr> + <td>' . _('Date Type') . ':</td> + <td><select name="DateType"> + <option selected value="Order">' . _('Order Date') . '</option> + <option value="Invoice">' . _('Invoice Date') . '</option> + </select></td> + <td> </td> + </tr>'; - echo '<tr><td>' . _('Invoice Type') . ':</td>'; - echo '<td><select name="InvoiceType">'; - echo '<option selected value="All">' . _('All') . '</option>'; - echo '<option value="10">' . _('Sales Invoice') . '</option>'; - echo '<option value="11">' . _('Credit Note') . '</option>'; - echo '</select></td><td> </td><td>' . _('Only Applies To Invoice Date Type') . '</td></tr>'; + echo '<tr> + <td>' . _('Invoice Type') . ':</td> + <td><select name="InvoiceType"> + <option selected value="All">' . _('All') . '</option> + <option value="10">' . _('Sales Invoice') . '</option> + <option value="11">' . _('Credit Note') . '</option> + </select></td> + <td> </td> + <td>' . _('Only Applies To Invoice Date Type') . '</td> + </tr>'; echo '<tr> - <td>' . _('Date Range') . ':</td> - <td><input type="text" class="date" alt="' .$_SESSION['DefaultDateFormat'] .'" name="FromDate" size=10 maxlength=10 value="' . $_POST['FromDate'] . '"></td> - <td>' . _('To') . ':</td> - <td><input type="text" class="date" alt="' . $_SESSION['DefaultDateFormat'] . '" name="ToDate" size=10 maxlength=10 value="' . $_POST['ToDate'] . '"></td> - </tr>'; + <td>' . _('Date Range') . ':</td> + <td><input type="text" class="date" alt="' .$_SESSION['DefaultDateFormat'] .'" name="FromDate" size=10 maxlength=10 value="' . $_POST['FromDate'] . '"></td> + <td>' . _('To') . ':</td> + <td><input type="text" class="date" alt="' . $_SESSION['DefaultDateFormat'] . '" name="ToDate" size=10 maxlength=10 value="' . $_POST['ToDate'] . '"></td> + </tr>'; + if (!isset($_POST['PartNumber'])){ + $_POST['PartNumber']=''; + } + echo '<tr> + <td>' . _('Stock Code') . ':</td> + <td><select name="PartNumberOp"> + <option selected value="Equals">' . _('Equals') . '</option> + <option value="LIKE">' . _('Begins With') . '</option> + </select></td> + <td> </td> + <td><input type="text" name="PartNumber" size=20 maxlength=20 value="'. $_POST['PartNumber'] . '"></td> + </tr>'; + if (!isset($_POST['DebtorNo'])){ + $_POST['DebtorNo']=''; + } + echo '<tr> + <td>' . _('Customer Number') . ':</td> + <td><select name="DebtorNoOp"> + <option selected value="Equals">' . _('Equals') . '</option> + <option value="LIKE">' . _('Begins With') . '</option> + </select></td> + <td> </td> + <td><input type="text" name="DebtorNo" size=10 maxlength=10 value="' . $_POST['DebtorNo'] . '"></td> + </tr>'; + if (!isset($_POST['DebtorName'])){ + $_POST['DebtorName']=''; + } + echo '<tr> + <td>' . _('Customer Name') . ':</td> + <td><select name="DebtorNameOp"> + <option selected value="LIKE">' . _('Begins With') . '</option> + <option value="Equals">' . _('Equals') . '</option> + </select></td> + <td> </td> + <td><input type="text" name="DebtorName" size=30 maxlength=30 value="' . $_POST['DebtorName'] .'"></td> + </tr>'; + if (!isset($_POST['OrderNo'])){ + $_POST['OrderNo']=''; + } + echo '<tr> + <td>' . _('Order Number') . ':</td> + <td>' . _('Equals') . '</td> + <td> </td> + <td><input type="text" name="OrderNo" size=10 maxlength=10 value="' . $_POST['OrderNo'] . '" /></td> + </tr>'; - echo '<tr><td>' . _('Stock Code') . ':</td>'; - echo '<td><select name="PartNumberOp">'; - echo '<option selected value="Equals">' . _('Equals') . '</option>'; - echo '<option value="LIKE">' . _('Begins With') . '</option>'; - echo '</select></td><td> </td>'; - echo '<td><input type="text" name="PartNumber" size=20 maxlength=20 value="'. $_POST['PartNumber'] . '"></td></tr>'; + echo '<tr> + <td>' . _('Line Item Status') . ':</td> + <td><select name="LineStatus"> + <option selected value="All">' . _('All') . '</option> + <option value="Completed">' . _('Completed') . '</option> + <option value="Open">' . _('Not Completed') . '</option> + </select></td> + <td> </td> + </tr>'; - echo '<tr><td>' . _('Customer Number') . ':</td>'; - echo '<td><select name="DebtorNoOp">'; - echo '<option selected value="Equals">' . _('Equals') . '</option>'; - echo '<option value="LIKE">' . _('Begins With') . '</option>'; - echo '</select></td><td> </td>'; - echo '<td><input type="text" name="DebtorNo" size=10 maxlength=10 value="' . $_POST['DebtorNo'] . '"></td></tr>'; + echo '<tr> + <td>' . _('Stock Categories') . ':</td> + <td><select name="Category">'; - echo '<tr><td>' . _('Customer Name') . ':</td>'; - echo '<td><select name="DebtorNameOp">'; - echo '<option selected value="LIKE">' . _('Begins With') . '</option>'; - echo '<option value="Equals">' . _('Equals') . '</option>'; - echo '</select></td><td> </td>'; - echo '<td><input type="text" name="DebtorName" size=30 maxlength=30 value="' . $_POST['DebtorName'] .'"></td></tr>'; - - echo '<tr><td>' . _('Order Number') . ':</td>'; - echo '<td>Equals</td><td> </td>'; - echo '<td><input type="text" name="OrderNo" size=10 maxlength=10 value="' . $_POST['OrderNo'] . '" /></td></tr>'; - - echo '<tr><td>' . _('Line Item Status') . ':</td>'; - echo '<td><select name="LineStatus">'; - echo '<option selected value="All">' . _('All') . '</option>'; - echo '<option value="Completed">' . _('Completed') . '</option>'; - echo '<option value="Open">' . _('Not Completed') . '</option>'; - echo '</select></td><td> </td></tr>'; - - echo '<tr><td>' . _('Stock Categories') . ':</td><td><select name="Category">'; - $CategoryResult= DB_query("SELECT categoryid, categorydescription FROM stockcategory",$db); echo '<option selected value="All">' . _('All Categories') . '</option>'; While ($myrow = DB_fetch_array($CategoryResult)){ echo '<option value="' . $myrow['categoryid'] . '">' . $myrow['categorydescription'] . '</option>'; } - echo '</select></td></tr>'; + echo '</select></td> + </tr>'; - echo '<tr><td>' . _('For Sales Man') . ':</td><td><select name="Salesman">'; + echo '<tr> + <td>' . _('For Sales Person') . ':</td> + <td><select name="Salesman">'; $sql="SELECT salesmancode, salesmanname FROM salesman"; $SalesmanResult= DB_query($sql,$db); echo '<option selected value="All">' . _('All Salesmen') . '</option>'; @@ -1113,7 +1169,8 @@ echo '</select></td></tr>'; // Use name='Areas[]' multiple - if want to create an array for Areas and allow multiple selections - echo '<tr><td>' . _('For Sales Areas') . ':</td><td><select name="Area">'; + echo '<tr><td>' . _('For Sales Areas') . ':</td> + <td><select name="Area">'; $AreasResult= DB_query("SELECT areacode, areadescription FROM areas",$db); echo '<option selected value="All">' . _('All Areas') . '</option>'; While ($myrow = DB_fetch_array($AreasResult)){ @@ -1122,42 +1179,49 @@ echo '</select></td></tr>'; echo '<tr><td> </td></tr>'; - echo '<tr><td>' . _('Sort By') . ':</td>'; - echo '<td><select name="SortBy">'; - echo '<option selected value="salesorderdetails.orderno">' . _('Order Number') . '</option>'; - echo '<option value="salesorderdetails.stkcode">' . _('Stock Code') . '</option>'; - echo '<option value="debtorsmaster.debtorno,salesorderdetails.orderno">' . _('Customer Number') . '</option>'; - echo '<option value="debtorsmaster.name,debtorsmaster.debtorno,salesorderdetails.orderno">' . _('Customer Name') . '</option>'; - echo '<option value="tempstockmoves.transno,salesorderdetails.stkcode">' . _('Transaction Number') . '</option>'; - echo '</select></td><td> </td><td>Transaction Number sort only valid for Invoice Date Type</td></tr>'; + echo '<tr> + <td>' . _('Sort By') . ':</td> + <td><select name="SortBy"> + <option selected value="salesorderdetails.orderno">' . _('Order Number') . '</option> + <option value="salesorderdetails.stkcode">' . _('Stock Code') . '</option> + <option value="debtorsmaster.debtorno,salesorderdetails.orderno">' . _('Customer Number') . '</option> + <option value="debtorsmaster.name,debtorsmaster.debtorno,salesorderdetails.orderno">' . _('Customer Name') . '</option> + <option value="tempstockmoves.transno,salesorderdetails.stkcode">' . _('Transaction Number') . '</option> + </select></td> + <td> </td> + <td>' . _('Transaction Number sort only valid for Invoice Date Type') . '</td> + </tr>'; echo '<tr><td> </td></tr> - <tr><td> </td></tr> - <tr><td> </td></tr>'; - + <tr><td> </td></tr> + <tr><td> </td></tr>'; + echo '<tr><td> </td></tr>'; - echo '<tr><td>' . _('Summary Type') . ':</td>'; - echo '<td><select name="SummaryType">'; - echo '<option selected value="orderno">' . _('Order Number') . '</option>'; - echo '<option value="transno">' . _('Transaction Number') . '</option>'; - echo '<option value="stkcode">' . _('Stock Code') . '</option>'; - echo '<option value="extprice">' . _('Extended Price') . '</option>'; - echo '<option value="debtorno">' . _('Customer Number') . '</option>'; - echo '<option value="name">' . _('Customer Name') . '</option>'; - echo '<option value="month">' . _('Month') . '</option>'; - echo '<option value="categoryid">' . _('Stock Category') . '</option>'; - echo '<option value="salesman">' . _('Salesman') . '</option>'; - echo '<option value="area">' . _('Sales Area') . '</option>'; - echo '</select></td><td> </td><td>Transaction Number summary only valid for Invoice Date Type</td></tr>'; + echo '<tr><td>' . _('Summary Type') . ':</td> + <td><select name="SummaryType"> + <option selected value="orderno">' . _('Order Number') . '</option> + <option value="transno">' . _('Transaction Number') . '</option> + <option value="stkcode">' . _('Stock Code') . '</option> + <option value="extprice">' . _('Extended Price') . '</option> + <option value="debtorno">' . _('Customer Number') . '</option> + <option value="name">' . _('Customer Name') . '</option> + <option value="month">' . _('Month') . '</option> + <option value="categoryid">' . _('Stock Category') . '</option> + <option value="salesman">' . _('Salesman') . '</option> + <option value="area">' . _('Sales Area') . '</option> + </select></td> + <td> </td> + <td>' . _('Transaction Number summary only valid for Invoice Date Type') . '</td> + </tr>'; - echo ' - <tr><td> </td></tr> - <tr><td> </td></tr> - <tr><td> </td></tr> - <tr><td> </td> - <td><input type="submit" name="submit" value="' . _('Run Inquiry') . '"></td> - </tr> - </table> + echo '<tr><td> </td></tr> + <tr><td> </td></tr> + <tr><td> </td></tr> + <tr> + <td> </td> + <td><input type="submit" name="submit" value="' . _('Run Inquiry') . '" /></td> + </tr> + </table> <br />'; echo '</form>'; Modified: trunk/SalesPeople.php =================================================================== --- trunk/SalesPeople.php 2011-09-25 03:05:27 UTC (rev 4705) +++ trunk/SalesPeople.php 2011-09-25 09:15:03 UTC (rev 4706) @@ -5,10 +5,10 @@ $title = _('Sales People Maintenance'); include('includes/header.inc'); -if (isset($_GET['SelectedSaleperson'])){ - $SelectedSaleperson =mb_strtoupper($_GET['SelectedSaleperson']); -} elseif(isset($_POST['SelectedSaleperson'])){ - $SelectedSaleperson =mb_strtoupper($_POST['SelectedSaleperson']); +if (isset($_GET['SelectedSalesPerson'])){ + $SelectedSalesPerson =mb_strtoupper($_GET['SelectedSalesPerson']); +} elseif(isset($_POST['SelectedSalesPerson'])){ + $SelectedSalesPerson =mb_strtoupper($_POST['SelectedSalesPerson']); } if (isset($Errors)) { @@ -53,10 +53,14 @@ $InputError = 1; prnMsg(_('The salesperson telephone number must be twenty characters or less long'),'error'); - } elseif (!is_double((double)$_POST['CommissionRate1']) OR !is_double((double) $_POST['CommissionRate2'])) { + } elseif (!is_numeric(filter_number_format($_POST['CommissionRate1'])) + OR !is_numeric(filter_number_format($_POST['CommissionRate2']))) { $InputError = 1; prnMsg(_('The commission rates must be a floating point number'),'error'); - } elseif (!is_double((double)$_POST['Breakpoint'])) { + echo '<br/>Commission Rate 1 = ' . filter_number_format($_POST['CommissionRate1']); + echo '<br/>Commission Rate 2 = ' . filter_number_format($_POST['CommissionRate2']); + echo '<br/>The locale decimal point is ' . $LocaleInfo['decimal_point']; + } elseif (!is_numeric(filter_number_format($_POST['Breakpoint']))) { $InputError = 1; prnMsg(_('The breakpoint should be a floating point number'),'error'); } @@ -80,18 +84,18 @@ $_POST['Current']=0; } - if (isset($SelectedSaleperson) AND $InputError !=1) { + if (isset($SelectedSalesPerson) AND $InputError !=1) { - /*SelectedSaleperson 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*/ + /*SelectedSalesPerson 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*/ $sql = "UPDATE salesman SET salesmanname='" . $_POST['SalesmanName'] . "', - commissionrate1='" . $_POST['CommissionRate1'] . "', + commissionrate1='" . filter_number_format($_POST['CommissionRate1']) . "', smantel='" . $_POST['SManTel'] . "', smanfax='" . $_POST['SManFax'] . "', - breakpoint='" . $_POST['Breakpoint'] . "', - commissionrate2='" . $_POST['CommissionRate2'] . "', + breakpoint='" . filter_number_format($_POST['Breakpoint']) . "', + commissionrate2='" . filter_number_format($_POST['CommissionRate2']) . "', current='" . $_POST['Current'] . "' - WHERE salesmancode = '".$SelectedSaleperson."'"; + WHERE salesmancode = '".$SelectedSalesPerson."'"; $msg = _('Salesperson record for') . ' ' . $_POST['SalesmanName'] . ' ' . _('has been updated'); } elseif ($InputError !=1) { @@ -107,12 +111,12 @@ smanfax, current) VALUES ('" . $_POST['SalesmanCode'] . "', - '" . $_POST['SalesmanName'] . "', - '" . $_POST['CommissionRate1'] . "', - '" . $_POST['CommissionRate2'] . "', - '" . $_POST['Breakpoint'] . "', - '" . $_POST['SManTel'] . "', - '" . $_POST['SManFax'] . "', + '" . DB_escape_string($_POST['SalesmanName']) . "', + '" . filter_number_format($_POST['CommissionRate1']) . "', + '" . filter_number_format($_POST['CommissionRate2']) . "', + '" . filter_number_format($_POST['Breakpoint']) . "', + '" . DB_escape_string($_POST['SManTel']) . "', + '" . DB_escape_string($_POST['SManFax']) . "', '" . $_POST['Current'] . "' )"; @@ -126,7 +130,7 @@ prnMsg($msg , 'success'); - unset($SelectedSalesperson); + unset($SelectedSalesPerson); unset($_POST['SalesmanCode']); unset($_POST['SalesmanName']); unset($_POST['CommissionRate1']); @@ -142,61 +146,63 @@ // PREVENT DELETES IF DEPENDENT RECORDS IN 'DebtorsMaster' - $sql= "SELECT COUNT(*) FROM custbranch WHERE custbranch.salesman='".$SelectedSaleperson."'"; + $sql= "SELECT COUNT(*) FROM custbranch WHERE custbranch.salesman='".$SelectedSalesPerson."'"; $result = DB_query($sql,$db); $myrow = DB_fetch_row($result); if ($myrow[0]>0) { prnMsg(_('Cannot delete this salesperson because branches are set up referring to them') . ' - ' . _('first alter the branches concerned') . '<br />' . _('There are') . ' ' . $myrow[0] . ' ' . _('branches that refer to this salesperson'),'error'); } else { - $sql= "SELECT COUNT(*) FROM salesanalysis WHERE salesanalysis.salesperson='".$SelectedSaleperson."'"; + $sql= "SELECT COUNT(*) FROM salesanalysis WHERE salesanalysis.salesperson='".$SelectedSalesPerson."'"; $result = DB_query($sql,$db); $myrow = DB_fetch_row($result); if ($myrow[0]>0) { prnMsg(_('Cannot delete this salesperson because sales analysis records refer to them') , '<br />' . _('There are') . ' ' . $myrow[0] . ' ' . _('sales analysis records that refer to this salesperson'),'error'); } else { - $sql="DELETE FROM salesman WHERE salesmancode='".$SelectedSaleperson."'"; + $sql="DELETE FROM salesman WHERE salesmancode='". $SelectedSalesPerson."'"; $ErrMsg = _('The salesperson could not be deleted because'); $result = DB_query($sql,$db,$ErrMsg); - prnMsg(_('Salesperson') . ' ' . $SelectedSalesperson . ' ' . _('has been deleted from the database'),'success'); - unset ($SelectedSalesperson); + prnMsg(_('Salesperson') . ' ' . $SelectedSalesPerson . ' ' . _('has been deleted from the database'),'success'); + unset ($SelectedSalesPerson); unset($delete); } } //end if Sales-person used in GL accounts } -if (!isset($SelectedSaleperson)) { +if (!isset($SelectedSalesPerson)) { -/* It could still be the second time the page has been run and a record has been selected for modification - SelectedSaleperson will exist because it was sent with the new call. If its the first time the page has been displayed with no parameters +/* It could still be the second time the page has been run and a record has been selected for modification - SelectedSalesPerson will exist because it was sent with the new call. If its the first time the page has been displayed with no parameters then none of the above are true and the list of Sales-persons will be displayed with links to delete or edit each. These will call the same page again and allow update/input or deletion of the records*/ $sql = "SELECT salesmancode, - salesmanname, - smantel, - smanfax, - commissionrate1, - breakpoint, - commissionrate2, - current - FROM salesman"; + salesmanname, + smantel, + smanfax, + commissionrate1, + breakpoint, + commissionrate2, + current + FROM salesman"; $result = DB_query($sql,$db); - echo '<table class=selection>'; - echo '<tr><th>' . _('Code') . '</th> - <th>' . _('Name') . '</th> - <th>' . _('Telephone') . '</th> - <th>' . _('Facsimile') . '</th> - <th>' . _('Comm Rate 1') . '</th> - <th>' . _('Break') . '</th> - <th>' . _('Comm Rate 2') . '</th> - <th>' . _('Current') . '</th></tr>'; + echo '<table class="selection">'; + echo '<tr> + <th>' . _('Code') . '</th> + <th>' . _('Name') . '</th> + <th>' . _('Telephone') . '</th> + <th>' . _('Facsimile') . '</th> + <th>' . _('Comm Rate 1') . '</th> + <th>' . _('Break') . '</th> + <th>' . _('Comm Rate 2') . '</th> + <th>' . _('Current') . '</th> + </tr>'; $k=0; - while ($myrow=DB_fetch_row($result)) { + while ($myrow=DB_fetch_array($result)) { if ($k==1){ echo '<tr class="EvenTableRows">'; @@ -205,38 +211,41 @@ echo '<tr class="OddTableRows">'; $k++; } - if ($myrow[7] == 1) $ActiveText = _("Yes"); else $ActiveText = _("No"); + if ($myrow[7] == 1) { + $ActiveText = _('Yes'); + } else { + $ActiveText = _('No'); + } - printf(' - <td>%s</td> - <td>%s</td> - <td>%s</td> - <td>%s</td> - <td class=number>%s</td> - <td class=number>%s</td> - <td class=number>%s</td> - <td>%s</td> - <td><a href="%sSelectedSaleperson=%s">'. _('Edit') . '</a></td> - <td><a href="%sSelectedSaleperson=%s&delete=1">' . _('Delete') . '</a></td> - </tr>', - $myrow[0], - $myrow[1], - $myrow[2], - $myrow[3], - $myrow[4], - $myrow[5], - $myrow[6], - $ActiveText, - $_SERVER['PHP_SELF'] . '?' . SID . '&', - $myrow[0], - $_SERVER['PHP_SELF'] . '?' . SID . '&', - $myrow[0]); - + printf('<td>%s</td> + <td>%s</td> + <td>%s</td> + <td>%s</td> + <td class="number">%s</td> + <td class="number">%s</td> + <td class="number">%s</td> + <td>%s</td> + <td><a href="%sSelectedSalesPerson=%s">'. _('Edit') . '</a></td> + <td><a href="%sSelectedSalesPerson=%s&delete=1" onclick="return confirm(\'' . _('Are you sure you wish to delete this sales person?') . '\');">' . _('Delete') . '</a></td> + </tr>', + $myrow['salesmancode'], + $myrow['salesmanname'], + $myrow['smantel'], + $myrow['smanfax'], + locale_number_format($myrow['commissionrate1'],2), + locale_money_format($myrow['breakpoint'],$_SESSION['CompanyRecord']['decimalplaces']), + locale_number_format($myrow['commissionrate2'],2), + $ActiveText, + $_SERVER['PHP_SELF'] . '?', + $myrow['salesmancode'], + $_SERVER['PHP_SELF'] . '?', + $myrow['salesmancode']); + } //END WHILE LIST LOOP echo '</table><br />'; } //end of ifs and buts! -if (isset($SelectedSaleperson)) { +if (isset($SelectedSalesPerson)) { echo '<div class="centre"><a href="' . $_SERVER['PHP_SELF'] . '">' . _('Show All Sales People') . '</a></div>'; } @@ -245,19 +254,19 @@ echo '<form method="post" action="' . $_SERVER['PHP_SELF'] . '">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; - if (isset($SelectedSaleperson)) { + if (isset($SelectedSalesPerson)) { //editing an existing Sales-person $sql = "SELECT salesmancode, - salesmanname, - smantel, - smanfax, - commissionrate1, - breakpoint, - commissionrate2, - current - FROM salesman - WHERE salesmancode='".$SelectedSaleperson."'"; + salesmanname, + smantel, + smanfax, + commissionrate1, + breakpoint, + commissionrate2, + current + FROM salesman + WHERE salesmancode='".$SelectedSalesPerson."'"; $result = DB_query($sql, $db); $myrow = DB_fetch_array($result); @@ -272,15 +281,20 @@ $_POST['Current'] = $myrow['current']; - echo '<input type=hidden name="SelectedSaleperson" VALUE="' . $SelectedSaleperson . '">'; - echo '<input type=hidden name="SalesmanCode" VALUE="' . $_POST['SalesmanCode'] . '">'; - echo '<table class=selection> <tr><td>' . _('Salesperson code') . ':</td><td>'; - echo $_POST['SalesmanCode'] . '</td></tr>'; + echo '<input type=hidden name="SelectedSalesPerson" value="' . $SelectedSalesPerson . '" />'; + echo '<input type=hidden name="SalesmanCode" value="' . $_POST['SalesmanCode'] . '" />'; + echo '<table class="selection"> + <tr> + <td>' . _('Salesperson code') . ':</td> + <td>' . $_POST['SalesmanCode'] . '</td></tr>'; - } else { //end of if $SelectedSaleperson only do the else when a new record is being entered + } else { //end of if $SelectedSalesPerson only do the else when a new record is being entered - echo '<table class=selection><tr><td>' . _('Salesperson code') . ':</td> - <td><input type="text" '. (in_array('SalesmanCode',$Errors) ? 'class="inputerror"' : '' ) .' name="SalesmanCode" size=3 maxlength=3></td></tr>'; + echo '<table class="selection"> + <tr> + <td>' . _('Salesperson code') . ':</td> + <td><input type="text" '. (in_array('SalesmanCode',$Errors) ? 'class="inputerror"' : '' ) .' name="SalesmanCode" size=3 maxlength=3></td> + </tr>'; } if (!isset($_POST['SalesmanName'])){ $_POST['SalesmanName']=''; @@ -304,14 +318,34 @@ $_POST['Current']=0; } - echo '<tr><td>' . _('Salesperson Name') . ':</td><td><input type="text" '. (in_array('SalesmanName',$Errors) ? 'class="inputerror"' : '' ) .' name="SalesmanName" size=30 maxlength=30 VALUE="' . $_POST['SalesmanName'] . '"></td></tr>'; - echo '<tr><td>' . _('Telephone No') . ':</td><td><input type="text" name="SManTel" size=20 maxlength=20 VALUE="' . $_POST['SManTel'] . '"></td></tr>'; - echo '<tr><td>' . _('Facsimile No') . ':</td><td><input type="text" name="SManFax" size=20 maxlength=20 VALUE="' . $_POST['SManFax'] . '"></td></tr>'; - echo '<tr><td>' . _('Commission Rate 1') . ':</td><td><input type="text" class=number name="CommissionRate1" size=5 maxlength=5 VALUE="' . $_POST['CommissionRate1'] . '"></td></tr>'; - echo '<tr><td>' . _('Breakpoint') . ':</td><td><input type="text" class=number name="Breakpoint" size=6 maxlength=6 VALUE="' . $_POST['Breakpoint'] . '"></td></tr>'; - echo '<tr><td>' . _('Commission Rate 2') . ':</td><td><input type="text" class=number name="CommissionRate2" size=5 maxlength=5 VALUE="' . $_POST['CommissionRate2']. '"></td></tr>'; + echo '<tr> + <td>' . _('Salesperson Name') . ':</td> + <td><input type="text" '. (in_array('SalesmanName',$Errors) ? 'class="inputerror"' : '' ) .' name="SalesmanName" size=30 maxlength=30 value="' . $_POST['SalesmanName'] . '"></td> + </tr>'; + echo '<tr> + <td>' . _('Telephone No') . ':</td> + <td><input type="text" name="SManTel" size=20 maxlength=20 value="' . $_POST['SManTel'] . '"></td> + </tr>'; + echo '<tr> + <td>' . _('Facsimile No') . ':</td> + <td><input type="text" name="SManFax" size=20 maxlength=20 value="' . $_POST['SManFax'] . '"></td> + </tr>'; + echo '<tr> + <td>' . _('Commission Rate 1') . ':</td> + <td><input type="text" class="number" name="CommissionRate1" size="5" maxlength="5" value="' . $_POST['CommissionRate1'] . '"></td> + </tr>'; + echo '<tr> + <td>' . _('Breakpoint') . ':</td> + <td><input type="text" class="number" name="Breakpoint" size="6" maxlength="6" value="' . $_POST['Breakpoint'] . '"></td> + </tr>'; + echo '<tr> + <td>' . _('Commission Rate 2') . ':</td> + <td><input type="text" class="number" name="CommissionRate2" size="5" maxlength="5" value="' . $_POST['CommissionRate2']. '"></td> + </tr>'; - echo '<tr><td>' . _('Current?') . ':</td><td><select name="Current">'; + echo '<tr> + <td>' . _('Current?') . ':</td> + <td><select name="Current">'; if ($_POST['Current']==1){ echo '<option selected value=1>' . _('Yes') . '</option>'; } else { @@ -322,7 +356,8 @@ } else { echo '<option value=0>' . _('No') . '</option>'; } - echo '</selec... [truncated message content] |
From: <dai...@us...> - 2011-10-01 06:41:00
|
Revision: 4707 http://web-erp.svn.sourceforge.net/web-erp/?rev=4707&view=rev Author: daintree Date: 2011-10-01 06:40:49 +0000 (Sat, 01 Oct 2011) Log Message: ----------- number_formats Modified Paths: -------------- trunk/AuditTrail.php trunk/GetStockImage.php trunk/PO_Items.php trunk/PrintCustTrans.php trunk/RecurringSalesOrders.php trunk/SelectAsset.php trunk/SelectCompletedOrder.php trunk/SelectCreditItems.php trunk/SelectCustomer.php trunk/SelectGLAccount.php trunk/SelectProduct.php trunk/SelectRecurringSalesOrder.php trunk/SelectSalesOrder.php trunk/doc/Change.log trunk/includes/LanguagesArray.php trunk/includes/footer.inc trunk/index.php Modified: trunk/AuditTrail.php =================================================================== --- trunk/AuditTrail.php 2011-09-25 09:15:03 UTC (rev 4706) +++ trunk/AuditTrail.php 2011-10-01 06:40:49 UTC (rev 4707) @@ -22,6 +22,12 @@ unset($_POST['View']); } +if (isset($_POST['ContainingText'])){ + $ContainingText = trim(mb_strtoupper($_POST['ContainingText'])); +} elseif (isset($_GET['ContainingText'])){ + $ContainingText = trim(mb_strtoupper($_GET['ContainingText'])); +} + // Get list of tables $TableResult = DB_show_tables($db); @@ -63,6 +69,14 @@ } echo '</select></td></tr>'; +if(!isset($_POST['ContainingText'])){ + $_POST['ContainingText']=''; +} +// Show the text +echo '<tr><td>' . _('Containing text') . ':</td>'; +echo '<td><input type="text" name="ContainingText" size=20 maxlength=20 value="'. $_POST['ContainingText'] . '"></td></tr>'; + + echo '</table><br />'; echo '<div class="centre"><input tabindex="5" type="submit" name="View" value="' . _('View') . '"></div>'; echo '</form>'; @@ -122,21 +136,26 @@ $_SESSION['SQLString']['fields'][0] = $Assigment[0]; $_SESSION['SQLString']['values'][0] = $Assigment[1]; } + + if (mb_strlen($ContainingText) > 0) { + $ContainingText = " AND querystring LIKE '%" . $ContainingText . "%' "; + }else{ + $ContainingText = ""; + } if ($_POST['SelectedUser'] == 'ALL') { $sql="SELECT transactiondate, userid, querystring FROM audittrail - WHERE transactiondate - BETWEEN '". $FromDate."' AND '".$ToDate."'"; + WHERE transactiondate BETWEEN '". $FromDate."' AND '".$ToDate."'" . $ContainingText; } else { $sql="SELECT transactiondate, userid, querystring FROM audittrail WHERE userid='".$_POST['SelectedUser']."' - AND transactiondate BETWEEN '".$FromDate."' AND '".$ToDate."'"; + AND transactiondate BETWEEN '".$FromDate."' AND '".$ToDate."'" . $ContainingText; } $result = DB_query($sql,$db); Modified: trunk/GetStockImage.php =================================================================== --- trunk/GetStockImage.php 2011-09-25 09:15:03 UTC (rev 4706) +++ trunk/GetStockImage.php 2011-10-01 06:40:49 UTC (rev 4707) @@ -58,15 +58,7 @@ } $DefaultImage = 'webERPsmall.png'; -// FOR APACHE -if ( $_SERVER['PATH_TRANSLATED'][0] == '/' OR $_SERVER['PATH_TRANSLATED'][0]=='') { - //*nix - $pathsep = '/'; -} else { - //Windows - $pathsep = "\\"; -} -$FilePath = $_SESSION['part_pics_dir'] . $pathsep; +$FilePath = $_SESSION['part_pics_dir'] . '/'; $StockID = trim(mb_strtoupper($_GET['StockID'])); if( isset($_GET['bgcolor']) ) @@ -90,13 +82,15 @@ if( isset($_GET['transcolor'])) { $doTrans = true; $TranspColour = $_GET['transcolor']; +} else { + $doTrans = false; } if( isset($_GET['bevel']) ) { $bevel = $_GET['bevel']; +} else { + $bevel = false; } -if( isset($_GET['useblank']) ) { - $useblank = $_GET['useblank']; -} + if( isset($_GET['fontsize']) ) { $fontsize = $_GET['fontsize']; } else { @@ -104,6 +98,8 @@ } if( isset($_GET['notextbg']) ) { $notextbg = true; +} else { + $notextbg = false; } @@ -157,7 +153,7 @@ } // See if we need to automake this image -if( $automake && !isset($FileName) || $useblank ) { +if( $automake AND !isset($FileName) ) { // Have we got height and width specs if( !isset($width) ) $width = 64; Modified: trunk/PO_Items.php =================================================================== --- trunk/PO_Items.php 2011-09-25 09:15:03 UTC (rev 4706) +++ trunk/PO_Items.php 2011-10-01 06:40:49 UTC (rev 4707) @@ -47,7 +47,7 @@ if (!is_numeric(filter_number_format($_POST['SuppPrice'.$POLine->LineNo]))){ prnMsg(_('The supplier price is expected to be numeric. Please re-enter as a number'),'error'); } else { //ok to update the PO object variables - $_SESSION['PO'.$identifier]->LineItems[$POLine->LineNo]->Price=filter_number_format((filter_number_format($_POST['SuppPrice'.$POLine->LineNo])/filter_number_format($_SESSION['PO'.$identifier]->LineItems[$POLine->LineNo]->ConversionFactor)); + $_SESSION['PO'.$identifier]->LineItems[$POLine->LineNo]->Price=filter_number_format(filter_number_format($_POST['SuppPrice'.$POLine->LineNo])/filter_number_format($_SESSION['PO'.$identifier]->LineItems[$POLine->LineNo]->ConversionFactor)); } $_SESSION['PO'.$identifier]->LineItems[$POLine->LineNo]->ReqDelDate=$_POST['ReqDelDate'.$POLine->LineNo]; } @@ -610,7 +610,7 @@ $ItemCode, 0, /*Serialised */ 0, /*Controlled */ - filter_number_format((filter_number_format($Quantity)*$ConversionFactor), /* Qty */ + filter_number_format($Quantity*$ConversionFactor), /* Qty */ $SupplierDescription, $PurchPrice, $ItemRow['units'], @@ -626,8 +626,7 @@ $SuppliersUnitOfMeasure, $ConversionFactor, $LeadTime, - $SuppliersPartNo - ); + $SuppliersPartNo); } else { //no rows returned by the SQL to get the item prnMsg (_('The item code') . ' ' . $ItemCode . ' ' . _('does not exist in the database and therefore cannot be added to the order'),'error'); if ($debug==1){ @@ -701,9 +700,9 @@ <td>' . $POLine->Units . '</td> <td class="number">' . $DisplayPrice . '</td> <td><input type="text" class="number" name="ConversionFactor' . $POLine->LineNo .'" size="8" value="' . $POLine->ConversionFactor . '"></td> - <td><input type="text" class="number" name="SuppQty' . $POLine->LineNo .'" size="10" value="' . locale_locale_format(round($POLine->Quantity/$POLine->ConversionFactor,$POLine->DecimalPlaces),$POLine->DecimalPlaces) . '"></td> + <td><input type="text" class="number" name="SuppQty' . $POLine->LineNo .'" size="10" value="' . locale_number_format(round($POLine->Quantity/$POLine->ConversionFactor,$POLine->DecimalPlaces),$POLine->DecimalPlaces) . '"></td> <td>' . $POLine->SuppliersUnit . '</td> - <td><input type="text" class="number" name="SuppPrice' . $POLine->LineNo . '" size="10" value="' . locale_money_format(round(($POLine->Price *$POLine->ConversionFactor),$_SESSION['PO'.$identifier]->CurrDecimalPlaces),,$_SESSION['PO'.$identifier]->CurrDecimalPlaces) .'"></td> + <td><input type="text" class="number" name="SuppPrice' . $POLine->LineNo . '" size="10" value="' . locale_money_format(round(($POLine->Price *$POLine->ConversionFactor),$_SESSION['PO'.$identifier]->CurrDecimalPlaces),$_SESSION['PO'.$identifier]->CurrDecimalPlaces) .'"></td> <td class="number">' . $DisplayLineTotal . '</td> <td><input type="text" class="date" alt="' .$_SESSION['DefaultDateFormat'].'" name="ReqDelDate' . $POLine->LineNo.'" size="10" value="' .$POLine->ReqDelDate .'"></td>'; if ($POLine->QtyReceived !=0 AND $POLine->Completed!=1){ Modified: trunk/PrintCustTrans.php =================================================================== --- trunk/PrintCustTrans.php 2011-09-25 09:15:03 UTC (rev 4706) +++ trunk/PrintCustTrans.php 2011-10-01 06:40:49 UTC (rev 4707) @@ -147,7 +147,7 @@ WHERE debtortrans.type=10 AND debtortrans.transno='" . $FromTransNo . "'"; - if (isset($_POST['PrintEDI']) and $_POST['PrintEDI']=='No') { + if (isset($_POST['PrintEDI']) AND $_POST['PrintEDI']=='No') { $sql = $sql . " AND debtorsmaster.ediinvoices=0"; } } else { @@ -200,7 +200,7 @@ WHERE debtortrans.type=11 AND debtortrans.transno='" . $FromTransNo . "'"; - if ($_POST['PrintEDI']=='No') { + if (isset($_POST['PrintEDI']) AND $_POST['PrintEDI']=='No') { $sql = $sql . " AND debtorsmaster.ediinvoices=0"; } } // end else Modified: trunk/RecurringSalesOrders.php =================================================================== --- trunk/RecurringSalesOrders.php 2011-09-25 09:15:03 UTC (rev 4706) +++ trunk/RecurringSalesOrders.php 2011-10-01 06:40:49 UTC (rev 4707) @@ -255,8 +255,6 @@ $ErrMsg = _('The recurring order cannot be added because'); $DbgMsg = _('The SQL that failed was'); $InsertQryResult = DB_query($HeaderSQL,$db,$ErrMsg,$DbgMsg,true); - - echo '<br/>' . $HeaderSQL; $RecurrOrderNo = DB_Last_Insert_ID($db,'recurringsalesorders','recurrorderno'); echo 'xxx'.$RecurrOrderNo; @@ -279,8 +277,6 @@ '" . $StockItem->Narrative . "')"; $Ins_LineItemResult = DB_query($LineItemsSQL,$db,$ErrMsg,$DbgMsg,true); - echo '<br/>' . $LineItemsSQL; - } /* inserted line items into sales order details */ $result = DB_Txn_Commit($db); Modified: trunk/SelectAsset.php =================================================================== --- trunk/SelectAsset.php 2011-09-25 09:15:03 UTC (rev 4706) +++ trunk/SelectAsset.php 2011-10-01 06:40:49 UTC (rev 4707) @@ -12,7 +12,7 @@ $_POST['Select'] = $_GET['AssetID']; } -if (isset($_GET['NewSearch']) or isset($_POST['Next']) or isset($_POST['Previous']) or isset($_POST['Go'])) { +if (isset($_GET['NewSearch']) OR isset($_POST['Next']) OR isset($_POST['Previous']) OR isset($_POST['Go'])) { unset($AssetID); unset($_SESSION['SelectedAsset']); unset($_POST['Select']); @@ -28,13 +28,13 @@ $_POST['AssetCode'] = trim(mb_strtoupper($_POST['AssetCode'])); } // Always show the search facilities -$SQL = 'SELECT categoryid, +$SQL = "SELECT categoryid, categorydescription FROM fixedassetcategories - ORDER BY categorydescription'; + ORDER BY categorydescription"; $result = DB_query($SQL, $db); if (DB_num_rows($result) == 0) { - echo '<p><font size=4 color=red>' . _('Problem Report') . ':</font><br />' . _('There are no asset categories currently defined please use the link below to set them up'); + echo '<p><font size="4" color="red">' . _('Problem Report') . ':</font><br />' . _('There are no asset categories currently defined please use the link below to set them up'); echo '<br /><a href="' . $rootpath . '/FixedAssetCategories.php">' . _('Define Asset Categories') . '</a>'; exit; } @@ -48,7 +48,7 @@ echo '<select name="AssetCategory">'; if (!isset($_POST['AssetCategory'])) { - $_POST['AssetCategory'] = ""; + $_POST['AssetCategory'] = ''; } if ($_POST['AssetCategory']=='ALL'){ echo '<option selected value="ALL">' . _('Any asset category') . '</option>'; @@ -58,9 +58,9 @@ while ($myrow = DB_fetch_array($result)) { if ($myrow['categoryid'] == $_POST['AssetCategory']) { - echo '<option selected VALUE="' . $myrow['categoryid'] . '">' . $myrow['categorydescription']; + echo '<option selected value="' . $myrow['categoryid'] . '">' . $myrow['categorydescription'] . '</option>'; } else { - echo '<option value="' . $myrow['categoryid'] . '">' . $myrow['categorydescription']; + echo '<option value="' . $myrow['categoryid'] . '">' . $myrow['categorydescription'] . '</option>'; } } echo '</select>'; @@ -84,9 +84,9 @@ while ($myrow = DB_fetch_array($result)) { if ($myrow['locationid'] == $_POST['AssetLocation']) { - echo '<option selected VALUE="' . $myrow['locationid'] . '">' . $myrow['locationdescription']; + echo '<option selected value="' . $myrow['locationid'] . '">' . $myrow['locationdescription'] . '</option>'; } else { - echo '<option value="' . $myrow['locationid'] . '">' . $myrow['locationdescription']; + echo '<option value="' . $myrow['locationid'] . '">' . $myrow['locationdescription'] . '</option>'; } } echo '</select>'; @@ -114,12 +114,12 @@ if ($_POST['Keywords'] AND $_POST['AssetCode']) { prnMsg( _('Asset description keywords have been used in preference to the asset code extract entered'), 'info' ); } - $SQL = 'SELECT assetid, + $SQL = "SELECT assetid, description, datepurchased, fixedassetlocations.locationdescription FROM fixedassets INNER JOIN fixedassetlocations - ON fixedassets.assetlocation=fixedassetlocations.locationid '; + ON fixedassets.assetlocation=fixedassetlocations.locationid "; if ($_POST['Keywords']) { //insert wildcard characters in spaces @@ -127,7 +127,7 @@ $SearchString = '%' . str_replace(' ', '%', $_POST['Keywords']) . '%'; if ($_POST['AssetCategory'] == 'ALL') { if ($_POST['AssetLocation']=='ALL'){ - $SQL .= 'WHERE description ' . LIKE . "'" . $SearchString . "' + $SQL .= "WHERE description " . LIKE . "'" . $SearchString . "' ORDER BY fixedassets.assetid"; } else { $SQL .= "WHERE fixedassets.assetlocation='" . $_POST['AssetLocation'] . "' @@ -136,7 +136,7 @@ } } else { if ($_POST['AssetLocation']=='ALL'){ - $SQL .= 'WHERE description ' . LIKE . "'" . $SearchString . "' + $SQL .= "WHERE description " . LIKE . "'" . $SearchString . "' AND assetcategoryid='" . $_POST['AssetCategory'] . "' ORDER BY fixedassets.assetid"; } else { @@ -149,7 +149,7 @@ } elseif (isset($_POST['AssetCode'])) { if ($_POST['AssetCategory'] == 'ALL') { if ($_POST['AssetLocation']=='ALL'){ - $SQL .= 'WHERE fixedassets.assetid ' . LIKE . " '%" . $_POST['AssetCode'] . "%' + $SQL .= "WHERE fixedassets.assetid " . LIKE . " '%" . $_POST['AssetCode'] . "%' ORDER BY fixedassets.assetid"; } else { $SQL .= "WHERE fixedassets.assetlocation='" . $_POST['AssetLocation'] . "' @@ -158,7 +158,7 @@ } } else { if ($_POST['AssetLocation']=='ALL'){ - $SQL .= 'WHERE fixedassets.assetid ' . LIKE . " '%" . $_POST['AssetCode'] . "%' + $SQL .= "WHERE fixedassets.assetid " . LIKE . " '%" . $_POST['AssetCode'] . "%' AND assetcategoryid='" . $_POST['AssetCategory'] . "' ORDER BY fixedassets.assetid"; } else { @@ -199,7 +199,7 @@ /* end query for list of records */ /* display list if there is more than one record */ if (isset($searchresult) AND !isset($_POST['Select'])) { - echo '<form action="FixedAssetItems.php" method=post>'; + echo '<form action="FixedAssetItems.php" method="post">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; $ListCount = DB_num_rows($searchresult); if ($ListCount > 0) { @@ -219,7 +219,7 @@ $_POST['PageOffset'] = $ListPageMax; } if ($ListPageMax > 1) { - echo "<div class='centre'><p> " . $_POST['PageOffset'] . ' ' . _('of') . ' ' . $ListPageMax . ' ' . _('pages') . '. ' . _('Go to Page') . ': '; + echo '<div class="centre"><p> ' . $_POST['PageOffset'] . ' ' . _('of') . ' ' . $ListPageMax . ' ' . _('pages') . '. ' . _('Go to Page') . ': '; echo '<select name="PageOffset">'; $ListPage = 1; while ($ListPage <= $ListPageMax) { Modified: trunk/SelectCompletedOrder.php =================================================================== --- trunk/SelectCompletedOrder.php 2011-09-25 09:15:03 UTC (rev 4706) +++ trunk/SelectCompletedOrder.php 2011-10-01 06:40:49 UTC (rev 4707) @@ -28,9 +28,9 @@ $SelectedStockItem = $_POST['SelectedStockItem']; } if (isset($_GET['OrderNumber'])){ - $OrderNumber = $_GET['OrderNumber']; + $OrderNumber = filter_number_format($_GET['OrderNumber']); } elseif (isset($_POST['OrderNumber'])){ - $OrderNumber = $_POST['OrderNumber']; + $OrderNumber = filter_number_format($_POST['OrderNumber']); } if (isset($_GET['CustomerRef'])){ $CustomerRef = $_GET['CustomerRef']; @@ -43,16 +43,16 @@ $SelectedCustomer = $_POST['SelectedCustomer']; } -if (isset($SelectedStockItem) and $SelectedStockItem==''){ +if (isset($SelectedStockItem) AND $SelectedStockItem==''){ unset($SelectedStockItem); } -if (isset($OrderNumber) and $OrderNumber==''){ +if (isset($OrderNumber) AND $OrderNumber==''){ unset($OrderNumber); } -if (isset($CustomerRef) and $CustomerRef==''){ +if (isset($CustomerRef) AND $CustomerRef==''){ unset($CustomerRef); } -if (isset($SelectedCustomer) and $SelectedCustomer==''){ +if (isset($SelectedCustomer) AND $SelectedCustomer==''){ unset($SelectedCustomer); } if (isset($_POST['ResetPart'])) { @@ -70,23 +70,23 @@ echo _('Customer Ref') . ' - ' . $CustomerRef; if (mb_strlen($_SESSION['UserBranch'])>1){ echo ' ' . _('and for customer') . ': ' . $SelectedCustomer .' ' . _('and') . ' '; - echo '<input type=hidden name="SelectedCustomer" value="' .$SelectedCustomer .'" />'; + echo '<input type="hidden" name="SelectedCustomer" value="' .$SelectedCustomer .'" />'; } } else { if (isset($SelectedCustomer)) { echo _('For customer') . ': ' . $SelectedCustomer .' ' . _('and') . ' '; - echo '<input type=hidden name="SelectedCustomer" value="'.$SelectedCustomer.'" />'; + echo '<input type="hidden" name="SelectedCustomer" value="'.$SelectedCustomer.'" />'; } if (isset($SelectedStockItem)) { $PartString = _('for the part') . ': <b>' . $SelectedStockItem . '</b> ' . _('and') . ' ' . - '<input type=hidden name="SelectedStockItem" value="'.$SelectedStockItem.'" />'; + '<input type="hidden" name="SelectedStockItem" value="'.$SelectedStockItem.'" />'; } } -if (isset($_POST['SearchParts']) and $_POST['SearchParts']!=''){ +if (isset($_POST['SearchParts']) AND $_POST['SearchParts']!=''){ if ($_POST['Keywords']!='' AND $_POST['StockCode']!='') { echo _('Stock description keywords have been used in preference to the Stock code extract entered'); @@ -97,109 +97,121 @@ if (isset($_POST['completed'])) { $SQL = "SELECT stockmaster.stockid, - stockmaster.description, - SUM(locstock.quantity) AS qoh, - SUM(purchorderdetails.quantityord-purchorderdetails.quantityrecd) AS qoo, - stockmaster.units, - SUM(salesorderdetails.quantity - salesorderdetails.qtyinvoiced) AS qdem - FROM (((stockmaster LEFT JOIN salesorderdetails on stockmaster.stockid = salesorderdetails.stkcode) - LEFT JOIN locstock ON stockmaster.stockid=locstock.stockid) - LEFT JOIN purchorderdetails on stockmaster.stockid = purchorderdetails.itemcode) - WHERE salesorderdetails.completed =1 - AND stockmaster.description " . LIKE . " '" . $SearchString. "' - AND stockmaster.categoryid='" . $_POST['StockCat'] . "' - GROUP BY stockmaster.stockid, - stockmaster.description, - stockmaster.units - ORDER BY stockmaster.stockid"; + stockmaster.description, + stockmaster.decimalplaces, + SUM(locstock.quantity) AS qoh, + SUM(purchorderdetails.quantityord-purchorderdetails.quantityrecd) AS qoo, + stockmaster.units, + SUM(salesorderdetails.quantity - salesorderdetails.qtyinvoiced) AS qdem + FROM (((stockmaster LEFT JOIN salesorderdetails on stockmaster.stockid = salesorderdetails.stkcode) + LEFT JOIN locstock ON stockmaster.stockid=locstock.stockid) + LEFT JOIN purchorderdetails on stockmaster.stockid = purchorderdetails.itemcode) + WHERE salesorderdetails.completed =1 + AND stockmaster.description " . LIKE . " '" . $SearchString. "' + AND stockmaster.categoryid='" . $_POST['StockCat'] . "' + GROUP BY stockmaster.stockid, + stockmaster.description, + stockmaster.decimalplaces, + stockmaster.units + ORDER BY stockmaster.stockid"; } else { $SQL = "SELECT stockmaster.stockid, - stockmaster.description, - SUM(locstock.quantity) AS qoh, - SUM(purchorderdetails.quantityord-purchorderdetails.quantityrecd) AS qoo, - stockmaster.units, - SUM(salesorderdetails.quantity - salesorderdetails.qtyinvoiced) AS qdem - FROM (((stockmaster LEFT JOIN salesorderdetails on stockmaster.stockid = salesorderdetails.stkcode) - LEFT JOIN locstock ON stockmaster.stockid=locstock.stockid) - LEFT JOIN purchorderdetails on stockmaster.stockid = purchorderdetails.itemcode) - WHERE stockmaster.description " . LIKE . " '" . $SearchString. "' - AND stockmaster.categoryid='" . $_POST['StockCat'] . "' - GROUP BY stockmaster.stockid, - stockmaster.description, - stockmaster.units - ORDER BY stockmaster.stockid"; + stockmaster.description, + stockmaster.decimalplaces, + SUM(locstock.quantity) AS qoh, + SUM(purchorderdetails.quantityord-purchorderdetails.quantityrecd) AS qoo, + stockmaster.units, + SUM(salesorderdetails.quantity - salesorderdetails.qtyinvoiced) AS qdem + FROM (((stockmaster LEFT JOIN salesorderdetails on stockmaster.stockid = salesorderdetails.stkcode) + LEFT JOIN locstock ON stockmaster.stockid=locstock.stockid) + LEFT JOIN purchorderdetails on stockmaster.stockid = purchorderdetails.itemcode) + WHERE stockmaster.description " . LIKE . " '" . $SearchString. "' + AND stockmaster.categoryid='" . $_POST['StockCat'] . "' + GROUP BY stockmaster.stockid, + stockmaster.description, + stockmaster.decimalplaces, + stockmaster.units + ORDER BY stockmaster.stockid"; } } elseif ($_POST['StockCode']!=''){ if (isset($_POST['completed'])) { $SQL = "SELECT stockmaster.stockid, - stockmaster.description, - SUM(locstock.quantity) AS qoh, - SUM(purchorderdetails.quantityord-purchorderdetails.quantityrecd) AS qoo, - SUM(salesorderdetails.quantity - salesorderdetails.qtyinvoiced) AS qdem, - stockmaster.units - FROM (((stockmaster LEFT JOIN salesorderdetails on stockmaster.stockid = salesorderdetails.stkcode) - LEFT JOIN locstock ON stockmaster.stockid=locstock.stockid) - LEFT JOIN purchorderdetails on stockmaster.stockid = purchorderdetails.itemcode) - WHERE salesorderdetails.completed =1 - AND stockmaster.stockid " . LIKE . " '%" . $_POST['StockCode'] . "%' - AND stockmaster.categoryid='" . $_POST['StockCat'] . "' - GROUP BY stockmaster.stockid, - stockmaster.description, - stockmaster.units - ORDER BY stockmaster.stockid"; + stockmaster.description, + stockmaster.decimalplaces, + SUM(locstock.quantity) AS qoh, + SUM(purchorderdetails.quantityord-purchorderdetails.quantityrecd) AS qoo, + SUM(salesorderdetails.quantity - salesorderdetails.qtyinvoiced) AS qdem, + stockmaster.units + FROM (((stockmaster LEFT JOIN salesorderdetails on stockmaster.stockid = salesorderdetails.stkcode) + LEFT JOIN locstock ON stockmaster.stockid=locstock.stockid) + LEFT JOIN purchorderdetails on stockmaster.stockid = purchorderdetails.itemcode) + WHERE salesorderdetails.completed =1 + AND stockmaster.stockid " . LIKE . " '%" . $_POST['StockCode'] . "%' + AND stockmaster.categoryid='" . $_POST['StockCat'] . "' + GROUP BY stockmaster.stockid, + stockmaster.description, + stockmaster.decimalplaces, + stockmaster.units + ORDER BY stockmaster.stockid"; } else { $SQL = "SELECT stockmaster.stockid, - stockmaster.description, - SUM(locstock.quantity) AS qoh, - SUM(purchorderdetails.quantityord-purchorderdetails.quantityrecd) AS qoo, - SUM(salesorderdetails.quantity - salesorderdetails.qtyinvoiced) AS qdem, - stockmaster.units - FROM (((stockmaster LEFT JOIN salesorderdetails on stockmaster.stockid = salesorderdetails.stkcode) - LEFT JOIN locstock ON stockmaster.stockid=locstock.stockid) - LEFT JOIN purchorderdetails on stockmaster.stockid = purchorderdetails.itemcode) - WHERE stockmaster.stockid " . LIKE . " '%" . $_POST['StockCode'] . "%' - AND stockmaster.categoryid='" . $_POST['StockCat'] . "' - GROUP BY stockmaster.stockid, - stockmaster.description, - stockmaster.units - ORDER BY stockmaster.stockid"; + stockmaster.description, + stockmaster.decimalplaces, + SUM(locstock.quantity) AS qoh, + SUM(purchorderdetails.quantityord-purchorderdetails.quantityrecd) AS qoo, + SUM(salesorderdetails.quantity - salesorderdetails.qtyinvoiced) AS qdem, + stockmaster.units + FROM (((stockmaster LEFT JOIN salesorderdetails on stockmaster.stockid = salesorderdetails.stkcode) + LEFT JOIN locstock ON stockmaster.stockid=locstock.stockid) + LEFT JOIN purchorderdetails on stockmaster.stockid = purchorderdetails.itemcode) + WHERE stockmaster.stockid " . LIKE . " '%" . $_POST['StockCode'] . "%' + AND stockmaster.categoryid='" . $_POST['StockCat'] . "' + GROUP BY stockmaster.stockid, + stockmaster.description, + stockmaster.decimalplaces, + stockmaster.units + ORDER BY stockmaster.stockid"; } } elseif ($_POST['StockCode']=='' AND $_POST['Keywords']=='' AND $_POST['StockCat']!='') { if (isset($_POST['completed'])) { $SQL = "SELECT stockmaster.stockid, - stockmaster.description, - SUM(locstock.quantity) AS qoh, - SUM(purchorderdetails.quantityord-purchorderdetails.quantityrecd) AS qoo, - SUM(salesorderdetails.quantity - salesorderdetails.qtyinvoiced) AS qdem, - stockmaster.units - FROM (((stockmaster LEFT JOIN salesorderdetails on stockmaster.stockid = salesorderdetails.stkcode) - LEFT JOIN locstock ON stockmaster.stockid=locstock.stockid) - LEFT JOIN purchorderdetails on stockmaster.stockid = purchorderdetails.itemcode) - WHERE salesorderdetails.completed=1 - AND stockmaster.categoryid='" . $_POST['StockCat'] . "' - GROUP BY stockmaster.stockid, - stockmaster.description, - stockmaster.units - ORDER BY stockmaster.stockid"; + stockmaster.description, + stockmaster.decimalplaces, + SUM(locstock.quantity) AS qoh, + SUM(purchorderdetails.quantityord-purchorderdetails.quantityrecd) AS qoo, + SUM(salesorderdetails.quantity - salesorderdetails.qtyinvoiced) AS qdem, + stockmaster.units + FROM (((stockmaster LEFT JOIN salesorderdetails on stockmaster.stockid = salesorderdetails.stkcode) + LEFT JOIN locstock ON stockmaster.stockid=locstock.stockid) + LEFT JOIN purchorderdetails on stockmaster.stockid = purchorderdetails.itemcode) + WHERE salesorderdetails.completed=1 + AND stockmaster.categoryid='" . $_POST['StockCat'] . "' + GROUP BY stockmaster.stockid, + stockmaster.description, + stockmaster.decimalplaces, + stockmaster.units + ORDER BY stockmaster.stockid"; } else { $SQL = "SELECT stockmaster.stockid, - stockmaster.description, - SUM(locstock.quantity) AS qoh, - SUM(purchorderdetails.quantityord-purchorderdetails.quantityrecd) AS qoo, - SUM(salesorderdetails.quantity - salesorderdetails.qtyinvoiced) AS qdem, - stockmaster.units - FROM (((stockmaster LEFT JOIN salesorderdetails on stockmaster.stockid = salesorderdetails.stkcode) - LEFT JOIN locstock ON stockmaster.stockid=locstock.stockid) - LEFT JOIN purchorderdetails on stockmaster.stockid = purchorderdetails.itemcode) - WHERE stockmaster.categoryid='" . $_POST['StockCat'] . "' - GROUP BY stockmaster.stockid, - stockmaster.description, - stockmaster.units - ORDER BY stockmaster.stockid"; + stockmaster.description, + stockmaster.decimalplaces, + SUM(locstock.quantity) AS qoh, + SUM(purchorderdetails.quantityord-purchorderdetails.quantityrecd) AS qoo, + SUM(salesorderdetails.quantity - salesorderdetails.qtyinvoiced) AS qdem, + stockmaster.units + FROM (((stockmaster LEFT JOIN salesorderdetails on stockmaster.stockid = salesorderdetails.stkcode) + LEFT JOIN locstock ON stockmaster.stockid=locstock.stockid) + LEFT JOIN purchorderdetails on stockmaster.stockid = purchorderdetails.itemcode) + WHERE stockmaster.categoryid='" . $_POST['StockCat'] . "' + GROUP BY stockmaster.stockid, + stockmaster.description, + stockmaster.decimalplaces, + stockmaster.units + ORDER BY stockmaster.stockid"; } } @@ -225,117 +237,129 @@ if (isset($OrderNumber)) { if (isset($SelectedCustomer)) { $SQL = "SELECT salesorders.orderno, - debtorsmaster.name, - custbranch.brname, - salesorders.customerref, - salesorders.orddate, - salesorders.deliverydate, - salesorders.deliverto, SUM(salesorderdetails.unitprice*salesorderdetails.quantity*(1-salesorderdetails.discountpercent)) AS ordervalue - FROM salesorders, - salesorderdetails, - debtorsmaster, - custbranch - WHERE salesorders.orderno = salesorderdetails.orderno - AND salesorders.branchcode = custbranch.branchcode - AND salesorders.debtorno = debtorsmaster.debtorno - AND debtorsmaster.debtorno = custbranch.debtorno - AND salesorders.debtorno='" . $SelectedCustomer ."' - AND salesorders.orderno='". $OrderNumber ."' - AND salesorders.quotation=0 - AND salesorderdetails.completed".$Completed." - GROUP BY salesorders.orderno, - debtorsmaster.name, - custbranch.brname, - salesorders.customerref, - salesorders.orddate, - salesorders.deliverydate, - salesorders.deliverto - ORDER BY salesorders.orderno"; - } else { //Set order number and SelectedCustomer not set + debtorsmaster.name, + custbranch.brname, + salesorders.customerref, + salesorders.orddate, + salesorders.deliverydate, + salesorders.deliverto, + currencies.decimalplaces AS currdecimalplaces, SUM(salesorderdetails.unitprice*salesorderdetails.quantity*(1-salesorderdetails.discountpercent)) AS ordervalue + FROM salesorders INNER JOIN salesorderdetails + ON salesorders.orderno = salesorderdetails.orderno + INNER JOIN debtorsmaster + ON salesorders.debtorno = debtorsmaster.debtorno + INNER JOIN custbranch + ON salesorders.branchcode = custbranch.branchcode + AND salesorders.debtorno = custbranch.debtorno + INNER JOIN currencies + ON debtorsmaster.currcode = currencies.currabrev + WHERE salesorders.debtorno='" . $SelectedCustomer ."' + AND salesorders.orderno='". $OrderNumber ."' + AND salesorders.quotation=0 + AND salesorderdetails.completed".$Completed." + GROUP BY salesorders.orderno, + debtorsmaster.name, + custbranch.brname, + salesorders.customerref, + salesorders.orddate, + salesorders.deliverydate, + currencies.decimalplaces, + salesorders.deliverto + ORDER BY salesorders.orderno"; + } else { //Set order number and SelectedCustomer not set $SQL = "SELECT salesorders.orderno, - debtorsmaster.name, - custbranch.brname, - salesorders.customerref, - salesorders.orddate, - salesorders.deliverydate, - salesorders.deliverto, SUM(salesorderdetails.unitprice*salesorderdetails.quantity*(1-salesorderdetails.discountpercent)) AS ordervalue - FROM salesorders, - salesorderdetails, - debtorsmaster, - custbranch - WHERE salesorders.orderno = salesorderdetails.orderno - AND salesorders.branchcode = custbranch.branchcode - AND salesorders.debtorno = debtorsmaster.debtorno - AND debtorsmaster.debtorno = custbranch.debtorno - AND salesorders.orderno='". $OrderNumber ."' - AND salesorders.quotation=0 - AND salesorderdetails.completed " . $Completed ." - GROUP BY salesorders.orderno, - debtorsmaster.name, - custbranch.brname, - salesorders.customerref, - salesorders.orddate, - salesorders.deliverydate, - salesorders.deliverto - ORDER BY salesorders.orderno"; - } + debtorsmaster.name, + custbranch.brname, + salesorders.customerref, + salesorders.orddate, + salesorders.deliverydate, + salesorders.deliverto, + currencies.decimalplaces AS currdecimalplaces, SUM(salesorderdetails.unitprice*salesorderdetails.quantity*(1-salesorderdetails.discountpercent)) AS ordervalue + FROM salesorders INNER JOIN salesorderdetails + ON salesorders.orderno = salesorderdetails.orderno + INNER JOIN debtorsmaster + ON salesorders.debtorno = debtorsmaster.debtorno + INNER JOIN custbranch + ON salesorders.branchcode = custbranch.branchcode + AND salesorders.debtorno = custbranch.debtorno + INNER JOIN currencies + ON debtorsmaster.currcode = currencies.currabrev + WHERE salesorders.orderno='". $OrderNumber ."' + AND salesorders.quotation=0 + AND salesorderdetails.completed " . $Completed ." + GROUP BY salesorders.orderno, + debtorsmaster.name, + currencies.decimalplaces, + custbranch.brname, + salesorders.customerref, + salesorders.orddate, + salesorders.deliverydate, + salesorders.deliverto + ORDER BY salesorders.orderno"; + } } elseif (isset($CustomerRef)) { - if (isset($SelectedCustomer)) { + if (isset($SelectedCustomer)) { $SQL = "SELECT salesorders.orderno, - debtorsmaster.name, - custbranch.brname, - salesorders.customerref, - salesorders.orddate, - salesorders.deliverydate, - salesorders.deliverto, SUM(salesorderdetails.unitprice*salesorderdetails.quantity*(1-salesorderdetails.discountpercent)) AS ordervalue - FROM salesorders, - salesorderdetails, - debtorsmaster, - custbranch - WHERE salesorders.orderno = salesorderdetails.orderno - AND salesorders.branchcode = custbranch.branchcode - AND salesorders.debtorno = debtorsmaster.debtorno - AND debtorsmaster.debtorno = custbranch.debtorno - AND salesorders.debtorno='" . $SelectedCustomer ."' - AND salesorders.customerref like '%". $CustomerRef."%' - AND salesorders.quotation=0 - AND salesorderdetails.completed".$Completed." - GROUP BY salesorders.orderno, - debtorsmaster.name, - custbranch.brname, - salesorders.customerref, - salesorders.orddate, - salesorders.deliverydate, - salesorders.deliverto - ORDER BY salesorders.orderno"; - } else { //customer not selected - $SQL = "SELECT salesorders.orderno, - debtorsmaster.name, - custbranch.brname, - salesorders.customerref, - salesorders.orddate, - salesorders.deliverydate, - salesorders.deliverto, SUM(salesorderdetails.unitprice*salesorderdetails.quantity*(1-salesorderdetails.discountpercent)) AS ordervalue - FROM salesorders, - salesorderdetails, - debtorsmaster, - custbranch - WHERE salesorders.orderno = salesorderdetails.orderno - AND salesorders.branchcode = custbranch.branchcode - AND salesorders.debtorno = debtorsmaster.debtorno - AND debtorsmaster.debtorno = custbranch.debtorno - AND salesorders.customerref like '%". $CustomerRef."%' - AND salesorders.quotation=0 - AND salesorderdetails.completed".$Completed." - GROUP BY salesorders.orderno, - debtorsmaster.name, - custbranch.brname, - salesorders.customerref, - salesorders.orddate, - salesorders.deliverydate, - salesorders.deliverto - ORDER BY salesorders.orderno"; - } + debtorsmaster.name, + currencies.decimalplaces AS currdecimalplaces, + custbranch.brname, + salesorders.customerref, + salesorders.orddate, + salesorders.deliverydate, + salesorders.deliverto, SUM(salesorderdetails.unitprice*salesorderdetails.quantity*(1-salesorderdetails.discountpercent)) AS ordervalue + FROM salesorders INNER JOIN salesorderdetails + ON salesorders.orderno = salesorderdetails.orderno + INNER JOIN debtorsmaster + ON salesorders.debtorno = debtorsmaster.debtorno + INNER JOIN custbranch + ON salesorders.branchcode = custbranch.branchcode + AND salesorders.debtorno = custbranch.debtorno + INNER JOIN currencies + ON debtorsmaster.currcode = currencies.currabrev + WHERE salesorders.debtorno='" . $SelectedCustomer ."' + AND salesorders.customerref like '%". $CustomerRef."%' + AND salesorders.quotation=0 + AND salesorderdetails.completed".$Completed." + GROUP BY salesorders.orderno, + debtorsmaster.name, + currencies.decimalplaces + custbranch.brname, + salesorders.customerref, + salesorders.orddate, + salesorders.deliverydate, + salesorders.deliverto + ORDER BY salesorders.orderno"; + } else { //customer not selected + $SQL = "SELECT salesorders.orderno, + debtorsmaster.name, + currencies.decimalplaces AS currdecimalplaces, + custbranch.brname, + salesorders.customerref, + salesorders.orddate, + salesorders.deliverydate, + salesorders.deliverto, SUM(salesorderdetails.unitprice*salesorderdetails.quantity*(1-salesorderdetails.discountpercent)) AS ordervalue + FROM salesorders INNER JOIN salesorderdetails + ON salesorders.orderno = salesorderdetails.orderno + INNER JOIN debtorsmaster + ON salesorders.debtorno = debtorsmaster.debtorno + INNER JOIN custbranch + ON salesorders.branchcode = custbranch.branchcode + AND salesorders.debtorno = custbranch.debtorno + INNER JOIN currencies + ON debtorsmaster.currcode = currencies.currabrev + WHERE salesorders.customerref " . LIKE . " '%". $CustomerRef . "%' + AND salesorders.quotation=0 + AND salesorderdetails.completed" . $Completed . " + GROUP BY salesorders.orderno, + debtorsmaster.name, + currencies.decimalplaces, + custbranch.brname, + salesorders.customerref, + salesorders.orddate, + salesorders.deliverydate, + salesorders.deliverto + ORDER BY salesorders.orderno"; + } } else { $DateAfterCriteria = FormatDateforSQL($_POST['OrdersAfterDate']); @@ -344,118 +368,130 @@ if (isset($SelectedStockItem)) { $SQL = "SELECT salesorders.orderno, - debtorsmaster.name, - custbranch.brname, - salesorders.customerref, - salesorders.orddate, - salesorders.deliverydate, - salesorders.deliverto, SUM(salesorderdetails.unitprice*salesorderdetails.quantity*(1-salesorderdetails.discountpercent)) AS ordervalue - FROM salesorders, - salesorderdetails, - debtorsmaster, - custbranch - WHERE salesorders.orderno = salesorderdetails.orderno - AND salesorders.branchcode = custbranch.branchcode - AND salesorders.debtorno = debtorsmaster.debtorno - AND debtorsmaster.debtorno = custbranch.debtorno - AND salesorderdetails.stkcode='". $SelectedStockItem ."' - AND salesorders.debtorno='" . $SelectedCustomer ."' - AND salesorders.orddate >= '" . $DateAfterCriteria ."' - AND salesorders.quotation=0 - AND salesorderdetails.completed".$Completed." - GROUP BY salesorders.orderno, - debtorsmaster.name, - custbranch.brname, - salesorders.customerref, - salesorders.orddate, - salesorders.deliverydate, - salesorders.deliverto - ORDER BY salesorders.orderno"; + debtorsmaster.name, + currencies.decimalplaces AS currdecimalplaces, + custbranch.brname, + salesorders.customerref, + salesorders.orddate, + salesorders.deliverydate, + salesorders.deliverto, SUM(salesorderdetails.unitprice*salesorderdetails.quantity*(1-salesorderdetails.discountpercent)) AS ordervalue + FROM salesorders INNER JOIN salesorderdetails + ON salesorders.orderno = salesorderdetails.orderno + INNER JOIN debtorsmaster + ON salesorders.debtorno = debtorsmaster.debtorno + INNER JOIN custbranch + ON salesorders.branchcode = custbranch.branchcode + AND salesorders.debtorno = custbranch.debtorno + INNER JOIN currencies + ON debtorsmaster.currcode = currencies.currabrev + WHERE salesorderdetails.stkcode='". $SelectedStockItem ."' + AND salesorders.debtorno='" . $SelectedCustomer ."' + AND salesorders.orddate >= '" . $DateAfterCriteria ."' + AND salesorders.quotation=0 + AND salesorderdetails.completed".$Completed." + GROUP BY salesorders.orderno, + debtorsmaster.name, + currencies.decimalplaces, + custbranch.brname, + salesorders.customerref, + salesorders.orddate, + salesorders.deliverydate, + salesorders.deliverto + ORDER BY salesorders.orderno"; } else { $SQL = "SELECT salesorders.orderno, - debtorsmaster.name, - custbranch.brname, - salesorders.customerref, - salesorders.orddate, - salesorders.deliverto, - salesorders.deliverydate, SUM(salesorderdetails.unitprice*salesorderdetails.quantity*(1-salesorderdetails.discountpercent)) AS ordervalue - FROM salesorders, - salesorderdetails, - debtorsmaster, - custbranch - WHERE salesorders.orderno = salesorderdetails.orderno - AND salesorders.debtorno = debtorsmaster.debtorno - AND salesorders.branchcode = custbranch.branchcode - AND debtorsmaster.debtorno = custbranch.debtorno - AND salesorders.debtorno='" . $SelectedCustomer . "' - AND salesorders.orddate >= '" . $DateAfterCriteria . "' - AND salesorders.quotation=0 - AND salesorderdetails.completed".$Completed." - GROUP BY salesorders.orderno, - debtorsmaster.name, - custbranch.brname, - salesorders.customerref, - salesorders.orddate, - salesorders.deliverydate, - salesorders.deliverto - ORDER BY salesorders.orderno"; + debtorsmaster.name, + currencies.decimalplaces AS currdecimalplaces, + custbranch.brname, + salesorders.customerref, + salesorders.orddate, + salesorders.deliverto, + salesorders.deliverydate, SUM(salesorderdetails.unitprice*salesorderdetails.quantity*(1-salesorderdetails.discountpercent)) AS ordervalue + FROM salesorders INNER JOIN salesorderdetails + ON salesorders.orderno = salesorderdetails.orderno + INNER JOIN debtorsmaster + ON salesorders.debtorno = debtorsmaster.debtorno + INNER JOIN custbranch + ON salesorders.branchcode = custbranch.branchcode + AND salesorders.debtorno = custbranch.debtorno + INNER JOIN currencies + ON debtorsmaster.currcode = currencies.currabrev + WHERE salesorders.debtorno='" . $SelectedCustomer . "' + AND salesorders.orddate >= '" . $DateAfterCriteria . "' + AND salesorders.quotation=0 + AND salesorderdetails.completed".$Completed." + GROUP BY salesorders.orderno, + debtorsmaster.name, + currencies.decimalplaces, + custbranch.brname, + salesorders.customerref, + salesorders.orddate, + salesorders.deliverydate, + salesorders.deliverto + ORDER BY salesorders.orderno"; } } else { //no customer selected if (isset($SelectedStockItem)) { $SQL = "SELECT salesorders.orderno, - debtorsmaster.name, - custbranch.brname, - salesorders.customerref, - salesorders.orddate, - salesorders.deliverto, - salesorders.deliverydate, SUM(salesorderdetails.unitprice*salesorderdetails.quantity*(1-salesorderdetails.discountpercent)) AS ordervalue - FROM salesorders, - salesorderdetails, - debtorsmaster, - custbranch - WHERE salesorders.orderno = salesorderdetails.orderno - AND salesorders.debtorno = debtorsmaster.debtorno - AND salesorders.branchcode = custbranch.branchcode - AND debtorsmaster.debtorno = custbranch.debtorno - AND salesorderdetails.stkcode='". $SelectedStockItem ."' - AND salesorders.orddate >= '" . $DateAfterCriteria . "' - AND salesorders.quotation=0 - AND salesorderdetails.completed".$Completed." - GROUP BY salesorders.orderno, - debtorsmaster.name, - custbranch.brname, - salesorders.customerref, - salesorders.orddate, - salesorders.deliverydate, - salesorders.deliverto - ORDER BY salesorders.orderno"; + debtorsmaster.name, + currencies.decimalplaces AS currdecimalplaces, + custbranch.brname, + salesorders.customerref, + salesorders.orddate, + salesorders.deliverto, + salesorders.deliverydate, SUM(salesorderdetails.unitprice*salesorderdetails.quantity*(1-salesorderdetails.discountpercent)) AS ordervalue + FROM salesorders INNER JOIN salesorderdetails + ON salesorders.orderno = salesorderdetails.orderno + INNER JOIN debtorsmaster + ON salesorders.debtorno = debtorsmaster.debtorno + INNER JOIN custbranch + ON salesorders.branchcode = custbranch.branchcode + AND salesorders.debtorno = custbranch.debtorno + INNER JOIN currencies + ON debtorsmaster.currcode = currencies.currabrev + WHERE salesorderdetails.stkcode='". $SelectedStockItem ."' + AND salesorders.orddate >= '" . $DateAfterCriteria . "' + AND salesorders.quotation=0 + AND salesorderdetails.completed".$Completed." + GROUP BY salesorders.orderno, + debtorsmaster.name, + currencies.decimalplaces, + custbranch.brname, + salesorders.customerref, + salesorders.orddate, + salesorders.deliverydate, + salesorders.deliverto + ORDER BY salesorders.orderno"; } else { $SQL = "SELECT salesorders.orderno, - debtorsmaster.name, - custbranch.brname, - salesorders.customerref, - salesorders.orddate, - salesorders.deliverto, - salesorders.deliverydate, SUM(salesorderdetails.unitprice*salesorderdetails.quantity*(1-salesorderdetails.discountpercent)) AS ordervalue - FROM salesorders, - salesorderdetails, - debtorsmaster, - custbranch - WHERE salesorders.orderno = salesorderdetails.orderno - AND salesorders.debtorno = debtorsmaster.debtorno - AND salesorders.branchcode = custbranch.branchcode - AND debtorsmaster.debtorno = custbranch.debtorno - AND salesorders.orddate >= '".$DateAfterCriteria . "' - AND salesorders.quotation=0 - AND salesorderdetails.completed".$Completed." - GROUP BY salesorders.orderno, - debtorsmaster.name, - custbranch.brname, - salesorders.customerref, - salesorders.orddate, - salesorders.deliverydate, - salesorders.deliverto - ORDER BY salesorders.orderno"; + debtorsmaster.name, + currencies.decimalplaces AS currdecimalplaces, + custbranch.brname, + salesorders.customerref, + salesorders.orddate, + salesorders.deliverto, + salesorders.deliverydate, SUM(salesorderdetails.unitprice*salesorderdetails.quantity*(1-salesorderdetails.discountpercent)) AS ordervalue + FROM salesorders INNER JOIN salesorderdetails + ON salesorders.orderno = salesorderdetails.orderno + INNER JOIN debtorsmaster + ON salesorders.debtorno = debtorsmaster.debtorno + INNER JOIN custbranch + ON salesorders.branchcode = custbranch.branchcode + AND salesorders.debtorno = custbranch.debtorno + INNER JOIN currencies + ON debtorsmaster.currcode = currencies.currabrev + WHERE salesorders.orddate >= '".$DateAfterCriteria . "' + AND salesorders.quotation=0 + AND salesorderdetails.completed".$Completed." + GROUP BY salesorders.orderno, + debtorsmaster.name, + currencies.decimalplaces, + custbranch.brname, + salesorders.customerref, + salesorders.orddate, + salesorders.deliverydate, + salesorders.deliverto + ORDER BY salesorders.orderno"; } } //end selected customer } //end not order number selected @@ -464,7 +500,7 @@ if (DB_error_no($db) !=0) { prnMsg( _('No orders were returned by the SQL because') . ' ' . DB_error_msg($db), 'info'); - echo "<br />$SQL"; + echo '<br /> ' . $SQL; } }//end of which button clicked options @@ -479,16 +515,20 @@ } else { echo '<tr><td></td>'; } - +if (!isset($_POST['OrderNumber'])){ + $_POST['OrderNumber']=''; +} echo '<td>' . _('Order Number') . ':</td> <td><input type="text" name="OrderNumber" maxlength =8 size=9 value ="' . $_POST['OrderNumber'] . '"></td> <td>' . _('for all orders placed after') . ': </td> - <td><input type="text" class="date" alt="' . $_SESSION['DefaultDateFormat'] .'" name="OrdersAfterDate" maxlength =10 size=11 value="' . $_POST['OrdersAfterDate'] . '"></td> - <td><input type="submit" name="SearchOrders" value="' . _('Search Orders') . '"></td></tr>'; + <td><input type="text" class="date" alt="' . $_SESSION['DefaultDateFormat'] .'" name="OrdersAfterDate" maxlength="10" size="11" value="' . $_POST['OrdersAfterDate'] . '" /></td> + <td><input type="submit" name="SearchOrders" value="' . _('Search Orders') . '" /></td> + </tr>'; echo '<tr> <td></td> - <td>' . _('Customer Ref') . ':</td><td><input type="text" name="CustomerRef" maxlength =8 size=9></td> - <td></td><td colspan=2><input type="checkbox" ' . $ShowChecked . ' name="completed" />' . _('Show Completed orders only') . '</td></tr>'; + <td>' . _('Customer Ref') . ':</td><td><input type="text" name="CustomerRef" maxlength="8" size="9" /></td> + <td></td> + <td colspan="2"><input type="checkbox" ' . $ShowChecked . ' name="completed" />' . _('Show Completed orders only') . '</td></tr>'; echo '</table>'; @@ -500,12 +540,13 @@ echo '<br />'; echo '<div class="page_help_text"><font size=1>' . _('To search for sales orders for a specific part use the part selection facilities below') . ' </font></div>'; - echo '<br /><table class=selection>'; + echo '<br /> + <table class="selection">'; echo '<tr><td><font size=1>' . _('Select a stock category') . ':</font>'; echo '<select name="StockCat">'; while ($myrow1 = DB_fetch_array($result1)) { - if (isset($_POST['StockCat']) and $myrow1['categoryid'] == $_POST['StockCat']){ + if (isset($_POST['StockCat']) AND $myrow1['categoryid'] == $_POST['StockCat']){ echo '<option selected value="' . $myrow1['categoryid'] . '">' . $myrow1['categorydescription'] . '</option>'; } else { echo '<option value="'. $myrow1['categoryid'] . '">' . $myrow1['categorydescription'] . '</option>'; @@ -514,15 +555,15 @@ echo '</select>'; echo '<td><font size=1>' . _('Enter text extracts in the description') . ':</font></td>'; - echo '<td><input type="text" name="Keywords" size=20 maxlength=25></td></tr>'; + echo '<td><input type="text" name="Keywords" size="20" maxlength="25"></td></tr>'; echo '<tr><td></td>'; echo '<td><font size=3><b> ' ._('OR') . ' </b></font><font size=1>' . _('Enter extract of the Stock Code') . ':</font></td>'; - echo '<td><input type="text" name="StockCode" size=15 maxlength=18></td>'; + echo '<td><input type="text" name="StockCode" size="15" maxlength="18"></td>'; echo '</tr>'; - echo '<tr><td colspan=4><div class=centre><input type="submit" name="SearchParts" value="' . _('Search Parts Now') . '">'; + echo '<tr><td colspan=4><div class="centre"><input type="submit" name="SearchParts" value="' . _('Search Parts Now') . '" />'; if (count($_SESSION['AllowedPageSecurityTokens'])>1){ - echo '<input type=submit name="ResetPart" value="' . _('Show All') . '"></div>'; + echo '<input type="submit" name="ResetPart" value="' . _('Show All') . '" /></div>'; } echo '</td></tr></table>'; @@ -530,7 +571,8 @@ If (isset($StockItemsResult)) { - echo '<br /><table cellpadding=2 colspan=7 class=selection>'; + echo '<br /> + <table cellpadding="2" colspan="7" class="selection">'; $TableHeadings = '<tr><th>' . _('Code') . '</th> <th>' . _('Description') . '</th> @@ -556,15 +598,15 @@ printf('<td><font size=1><input type="submit" name="SelectedStockItem" value="%s" /></font></td> <td><font size=1>%s</font></td> - <td class=number><font size=1>%s</font></td> - <td class=number><font size=1>%s</font></td> - <td class=number><font size=1>%s</font></td> + <td class="number"><font size=1>%s</font></td> + <td class="number"><font size=1>%s</font></td> + <td class="number"><font size=1>%s</font></td> <td><font size=1>%s</font></td></tr>', $myrow['stockid'], $myrow['description'], - $myrow['qoh'], - $myrow['qoo'], - $myrow['qdem'], + locale_number_format($myrow['qoh'],$myrow['decimalplaces']), + locale_number_format($myrow['qoo'],$myrow['decimalplaces']), + locale_number_format($myrow['qdem'],$myrow['decimalplaces']), $myrow['units']); //end of page full new headings if @@ -580,7 +622,7 @@ /*show a table of the orders returned by the SQL */ - echo '<br /><table cellpadding=2 colspan=6 width=90% class=selection>'; + echo '<br /><table cellpadding="2" colspan="6" width="90%" class="selection">'; $tableheader = '<tr><th>' . _('Order') . ' #</th> <th>' . _('Customer') . '</th> @@ -609,7 +651,7 @@ $ViewPage = $rootpath . '/OrderDetails.php?OrderNumber=' . $myrow['orderno']; $FormatedDelDate = ConvertSQLDate($myrow['deliverydate']); $FormatedOrderDate = ConvertSQLDate($myrow['orddate']); - $FormatedOrderValue = locale_number_format($myrow['ordervalue'],2); + $FormatedOrderValue = locale_money_format($myrow['ordervalue'],$myrow['currdecimalplaces']); printf('<td><a href="%s">%s</a></td> <td>%s</td> @@ -618,7 +660,7 @@ <td>%s</td> <td>%s</td> <td>%s</td> - <td class=number>%s</td> + <td class="number">%s</td> </tr>', $ViewPage, $myrow['orderno'], @@ -635,7 +677,6 @@ //end of while loop echo '</table>'; - } echo '</form>'; Modified: trunk/SelectCreditItems.php =================================================================== --- trunk/SelectCreditItems.php 2011-09-25 09:15:03 UTC (rev 4706) +++ trunk/SelectCreditItems.php 2011-10-01 06:40:49 UTC (rev 4707) @@ -125,7 +125,7 @@ if (isset($_POST['JustSelectedACustomer']) AND !isset($SelectedCustomer)){ /*Need to figure out the number of the form variable that the user clicked on */ - for ($i=1;$i<count($_POST);$i++){ //loop through the returned customers + for ($i=1; $i < count($_POST); $i++){ //loop through the returned customers if(isset($_POST['SubmitCustomerSelection'.$i])){ break; } @@ -215,16 +215,19 @@ _('Search') . '" alt="" />' . ' ' . _('Select Customer For Credit Note').'</p>'; echo '<table cellpadding="3" colspan="4" class="selection">'; - echo '<tr><th colspan="5"><font size="3" color="navy"><b> ' . _('Customer Selection') . '</b></font></th></tr>'; - echo '<tr>'; - echo '<td><font size="1">' . _('Enter text in the customer name') . ':</font></td>'; - echo '<td><input type="text" name="Keywords" size="20" maxlength="25" /></td>'; - echo '<td><font size="3"><b>' . _('OR') . '</b></font></td>'; - echo '<td><font size="1">' . _('Enter text extract in the customer code') . ':</font></td>'; - echo '<td><input type="text" name="CustCode" size="15" maxlength="18" /></td>'; - echo '</tr>'; - echo '</table>'; - echo '<br /><div class="centre"><input type="submit" name="SearchCust" value="' . _('Search Now') . '"></div>'; + echo '<tr><th colspan="5"><font size="3" color="navy"><b> ' . _('Customer Selection') .'</b></font></th></tr>'; + echo '<tr> + <td><font size="1">' . _('Enter text in the customer name') . ':</font></td> + <td><input type="text" name="Keywords" size="20" maxlength="25" /></td> + <td><font size="3"><b>' . _('OR') . '</b></font></td> + <td><font size="1">' . _('Enter text extract in the customer code') . ':</font></td> + <td><input type="text" name="CustCode" size="15" maxlength="18" /></td> + </tr>'; + echo '</table> + <br /> + <div class="centre"> + <input type="submit" name="SearchCust" value="' . _('Search Now') . '" /> + </div>'; if (isset($result_CustSelect)) { @@ -252,19 +255,19 @@ echo '<tr class="OddTableRows">'; $k=1; } - echo '<form action="' . $_SERVER['PHP_SELF'] . '?identifier='.$identifier . '" name="SelectParts" method="post">'; - echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; + if ($LastCustomer != $myrow['name']) { echo '<td>'.$myrow['name'].'</td>'; } else { echo '<td></td>'; } - echo '<td><input tabindex='.($j+5).' type=submit name="SubmitCustomerSelection' . $j .'" value="' . htmlentities($myrow['brname'], ENT_QUOTES,'UTF-8'). '"></td> - <input type="hidden" name="SelectedCustomer' . $j .'" value="'.$myrow['debtorno'].'"><input type="hidden" name="SelectedBranch' . $j .'" value="'. $myrow['branchcode'].'" /> - <td>'.$myrow['contactname'].'</td> - <td>'.$myrow['phoneno'].'</td> - <td>'.$myrow['faxno'].'</td> - </tr>'; + echo '<td><input tabindex='.($j+5).' type="submit" name="SubmitCustomerSelection' . $j .'" value="' . htmlentities($myrow['brname'], ENT_QUOTES,'UTF-8'). '"></td> + <input type="hidden" name="SelectedCustomer' . $j .'" value="'.$myrow['debtorno'].'"> + <input type="hidden" name="SelectedBranch' . $j .'" value="'. $myrow['branchcode'].'" /> + <td>'.$myrow['contactname'].'</td> + <td>'.$myrow['phoneno'].'</td> + <td>'.$myrow['faxno'].'</td> + </tr>'; $LastCustomer=$myrow['name']; $j++; //end of page full new headings if @@ -395,7 +398,7 @@ /*Always do the stuff below if not looking for a customerid Set up the form for the credit note display and entry*/ - echo '<form action="' . $_SERVER['PHP_SELF'] . '?identifier='.$identifier . '" method="post">'; + echo '<form name="MainForm" action="' . $_SERVER['PHP_SELF'] . '?identifier='.$identifier . '" method="post">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; @@ -409,10 +412,13 @@ $QuickEntryCode = 'part_' . $i; $QuickEntryQty = 'qty_' . $i; $i++; - } while (!is_numeric($_POST[$QuickEntryQty]) AND $_POST[$QuickEntryQty] <=0 AND mb_strlen($_POST[$QuickEntryCode])!=0 AND $i<=$QuickEntires); + } while (!is_numeric(filter_number_format($_POST[$QuickEntryQty])) + AND filter_number_format($_POST[$QuickEntryQty]) <=0 + AND mb_strlen($_POST[$QuickEntryCode])!=0 + AND $i<=$QuickEntires); $_POST['NewItem'] = trim($_POST[$QuickEntryCode]); - $NewItemQty = trim($_POST[$QuickEntryQty]); + $NewItemQty = filter_number_format($_POST[$QuickEntryQty]); if (mb_strlen($_POST['NewItem'])==0){ break; /* break out of the loop if nothing in the quick entry fields*/ @@ -425,7 +431,7 @@ /* do a loop round the items on the credit note to see that the item is not already on this credit note */ - if ($_SESSION['SO_AllowSameItemMultipleTimes']==0 && strcasecmp($OrderItem->StockID, $_POST['NewItem']) == 0) { + if ($_SESSION['SO_AllowSameItemMultipleTimes']==0 AND strcasecmp($OrderItem->StockID, $_POST['NewItem']) == 0) { $AlreadyOnThisCredit = 1; prnMsg($_POST['NewItem'] . ' ' . _('is already on this credit - the system will not allow the same item on the credit note more than once. However you can change the quantity credited of the existing line if necessary'),'warn'); } @@ -509,10 +515,11 @@ } if (isset($_POST['ChargeFreightCost'])){ - $_SESSION['CreditItems'.$identifier]->FreightCost = $_POST['ChargeFreightCost']; + $_SESSION['CreditItems'.$identifier]->FreightCost = filter_number_format($_POST['ChargeFreightCost']); } - if (isset($_POST['Location']) AND $_POST['Location'] != $_SESSION['CreditItems'.$identifier]->Location){ + if (isset($_POST['Location']) + AND $_POST['Location'] != $_SESSION['CreditItems'.$identifier]->Location){ $_SESSION['CreditItems'.$identifier]->Location = $_POST['Location']; @@ -530,11 +537,11 @@ if (isset($_POST['Quantity_' . $LineItem->LineNumber])){ - $Quantity = $_POST['Quantity_' . $LineItem->LineNumber]; + $Quantity = filter_number_format($_POST['Quantity_' . $LineItem->LineNumber]); $Narrative = $_POST['Narrative_' . $LineItem->LineNumber]; if (isset($_POST['Price_' . $LineItem->LineNumber])){ - if (isset($_POST['Gross']) and $_POST['Gross']==True){ + if (isset($_POST['Gross']) AND $_POST['Gross']==True){ $TaxTotalPercent =0; foreach ($LineItem->Taxes AS $Tax) { if ($Tax->TaxOnTax ==1){ @@ -545,14 +552,14 @@ } $Price = round($_POST['Price_' . $LineItem->LineNumber]/($TaxTotalP... [truncated message content] |
From: <dai...@us...> - 2011-10-01 06:41:00
|
Revision: 4707 http://web-erp.svn.sourceforge.net/web-erp/?rev=4707&view=rev Author: daintree Date: 2011-10-01 06:40:49 +0000 (Sat, 01 Oct 2011) Log Message: ----------- number_formats Modified Paths: -------------- trunk/AuditTrail.php trunk/GetStockImage.php trunk/PO_Items.php trunk/PrintCustTrans.php trunk/RecurringSalesOrders.php trunk/SelectAsset.php trunk/SelectCompletedOrder.php trunk/SelectCreditItems.php trunk/SelectCustomer.php trunk/SelectGLAccount.php trunk/SelectProduct.php trunk/SelectRecurringSalesOrder.php trunk/SelectSalesOrder.php trunk/doc/Change.log trunk/includes/LanguagesArray.php trunk/includes/footer.inc trunk/index.php Modified: trunk/AuditTrail.php =================================================================== --- trunk/AuditTrail.php 2011-09-25 09:15:03 UTC (rev 4706) +++ trunk/AuditTrail.php 2011-10-01 06:40:49 UTC (rev 4707) @@ -22,6 +22,12 @@ unset($_POST['View']); } +if (isset($_POST['ContainingText'])){ + $ContainingText = trim(mb_strtoupper($_POST['ContainingText'])); +} elseif (isset($_GET['ContainingText'])){ + $ContainingText = trim(mb_strtoupper($_GET['ContainingText'])); +} + // Get list of tables $TableResult = DB_show_tables($db); @@ -63,6 +69,14 @@ } echo '</select></td></tr>'; +if(!isset($_POST['ContainingText'])){ + $_POST['ContainingText']=''; +} +// Show the text +echo '<tr><td>' . _('Containing text') . ':</td>'; +echo '<td><input type="text" name="ContainingText" size=20 maxlength=20 value="'. $_POST['ContainingText'] . '"></td></tr>'; + + echo '</table><br />'; echo '<div class="centre"><input tabindex="5" type="submit" name="View" value="' . _('View') . '"></div>'; echo '</form>'; @@ -122,21 +136,26 @@ $_SESSION['SQLString']['fields'][0] = $Assigment[0]; $_SESSION['SQLString']['values'][0] = $Assigment[1]; } + + if (mb_strlen($ContainingText) > 0) { + $ContainingText = " AND querystring LIKE '%" . $ContainingText . "%' "; + }else{ + $ContainingText = ""; + } if ($_POST['SelectedUser'] == 'ALL') { $sql="SELECT transactiondate, userid, querystring FROM audittrail - WHERE transactiondate - BETWEEN '". $FromDate."' AND '".$ToDate."'"; + WHERE transactiondate BETWEEN '". $FromDate."' AND '".$ToDate."'" . $ContainingText; } else { $sql="SELECT transactiondate, userid, querystring FROM audittrail WHERE userid='".$_POST['SelectedUser']."' - AND transactiondate BETWEEN '".$FromDate."' AND '".$ToDate."'"; + AND transactiondate BETWEEN '".$FromDate."' AND '".$ToDate."'" . $ContainingText; } $result = DB_query($sql,$db); Modified: trunk/GetStockImage.php =================================================================== --- trunk/GetStockImage.php 2011-09-25 09:15:03 UTC (rev 4706) +++ trunk/GetStockImage.php 2011-10-01 06:40:49 UTC (rev 4707) @@ -58,15 +58,7 @@ } $DefaultImage = 'webERPsmall.png'; -// FOR APACHE -if ( $_SERVER['PATH_TRANSLATED'][0] == '/' OR $_SERVER['PATH_TRANSLATED'][0]=='') { - //*nix - $pathsep = '/'; -} else { - //Windows - $pathsep = "\\"; -} -$FilePath = $_SESSION['part_pics_dir'] . $pathsep; +$FilePath = $_SESSION['part_pics_dir'] . '/'; $StockID = trim(mb_strtoupper($_GET['StockID'])); if( isset($_GET['bgcolor']) ) @@ -90,13 +82,15 @@ if( isset($_GET['transcolor'])) { $doTrans = true; $TranspColour = $_GET['transcolor']; +} else { + $doTrans = false; } if( isset($_GET['bevel']) ) { $bevel = $_GET['bevel']; +} else { + $bevel = false; } -if( isset($_GET['useblank']) ) { - $useblank = $_GET['useblank']; -} + if( isset($_GET['fontsize']) ) { $fontsize = $_GET['fontsize']; } else { @@ -104,6 +98,8 @@ } if( isset($_GET['notextbg']) ) { $notextbg = true; +} else { + $notextbg = false; } @@ -157,7 +153,7 @@ } // See if we need to automake this image -if( $automake && !isset($FileName) || $useblank ) { +if( $automake AND !isset($FileName) ) { // Have we got height and width specs if( !isset($width) ) $width = 64; Modified: trunk/PO_Items.php =================================================================== --- trunk/PO_Items.php 2011-09-25 09:15:03 UTC (rev 4706) +++ trunk/PO_Items.php 2011-10-01 06:40:49 UTC (rev 4707) @@ -47,7 +47,7 @@ if (!is_numeric(filter_number_format($_POST['SuppPrice'.$POLine->LineNo]))){ prnMsg(_('The supplier price is expected to be numeric. Please re-enter as a number'),'error'); } else { //ok to update the PO object variables - $_SESSION['PO'.$identifier]->LineItems[$POLine->LineNo]->Price=filter_number_format((filter_number_format($_POST['SuppPrice'.$POLine->LineNo])/filter_number_format($_SESSION['PO'.$identifier]->LineItems[$POLine->LineNo]->ConversionFactor)); + $_SESSION['PO'.$identifier]->LineItems[$POLine->LineNo]->Price=filter_number_format(filter_number_format($_POST['SuppPrice'.$POLine->LineNo])/filter_number_format($_SESSION['PO'.$identifier]->LineItems[$POLine->LineNo]->ConversionFactor)); } $_SESSION['PO'.$identifier]->LineItems[$POLine->LineNo]->ReqDelDate=$_POST['ReqDelDate'.$POLine->LineNo]; } @@ -610,7 +610,7 @@ $ItemCode, 0, /*Serialised */ 0, /*Controlled */ - filter_number_format((filter_number_format($Quantity)*$ConversionFactor), /* Qty */ + filter_number_format($Quantity*$ConversionFactor), /* Qty */ $SupplierDescription, $PurchPrice, $ItemRow['units'], @@ -626,8 +626,7 @@ $SuppliersUnitOfMeasure, $ConversionFactor, $LeadTime, - $SuppliersPartNo - ); + $SuppliersPartNo); } else { //no rows returned by the SQL to get the item prnMsg (_('The item code') . ' ' . $ItemCode . ' ' . _('does not exist in the database and therefore cannot be added to the order'),'error'); if ($debug==1){ @@ -701,9 +700,9 @@ <td>' . $POLine->Units . '</td> <td class="number">' . $DisplayPrice . '</td> <td><input type="text" class="number" name="ConversionFactor' . $POLine->LineNo .'" size="8" value="' . $POLine->ConversionFactor . '"></td> - <td><input type="text" class="number" name="SuppQty' . $POLine->LineNo .'" size="10" value="' . locale_locale_format(round($POLine->Quantity/$POLine->ConversionFactor,$POLine->DecimalPlaces),$POLine->DecimalPlaces) . '"></td> + <td><input type="text" class="number" name="SuppQty' . $POLine->LineNo .'" size="10" value="' . locale_number_format(round($POLine->Quantity/$POLine->ConversionFactor,$POLine->DecimalPlaces),$POLine->DecimalPlaces) . '"></td> <td>' . $POLine->SuppliersUnit . '</td> - <td><input type="text" class="number" name="SuppPrice' . $POLine->LineNo . '" size="10" value="' . locale_money_format(round(($POLine->Price *$POLine->ConversionFactor),$_SESSION['PO'.$identifier]->CurrDecimalPlaces),,$_SESSION['PO'.$identifier]->CurrDecimalPlaces) .'"></td> + <td><input type="text" class="number" name="SuppPrice' . $POLine->LineNo . '" size="10" value="' . locale_money_format(round(($POLine->Price *$POLine->ConversionFactor),$_SESSION['PO'.$identifier]->CurrDecimalPlaces),$_SESSION['PO'.$identifier]->CurrDecimalPlaces) .'"></td> <td class="number">' . $DisplayLineTotal . '</td> <td><input type="text" class="date" alt="' .$_SESSION['DefaultDateFormat'].'" name="ReqDelDate' . $POLine->LineNo.'" size="10" value="' .$POLine->ReqDelDate .'"></td>'; if ($POLine->QtyReceived !=0 AND $POLine->Completed!=1){ Modified: trunk/PrintCustTrans.php =================================================================== --- trunk/PrintCustTrans.php 2011-09-25 09:15:03 UTC (rev 4706) +++ trunk/PrintCustTrans.php 2011-10-01 06:40:49 UTC (rev 4707) @@ -147,7 +147,7 @@ WHERE debtortrans.type=10 AND debtortrans.transno='" . $FromTransNo . "'"; - if (isset($_POST['PrintEDI']) and $_POST['PrintEDI']=='No') { + if (isset($_POST['PrintEDI']) AND $_POST['PrintEDI']=='No') { $sql = $sql . " AND debtorsmaster.ediinvoices=0"; } } else { @@ -200,7 +200,7 @@ WHERE debtortrans.type=11 AND debtortrans.transno='" . $FromTransNo . "'"; - if ($_POST['PrintEDI']=='No') { + if (isset($_POST['PrintEDI']) AND $_POST['PrintEDI']=='No') { $sql = $sql . " AND debtorsmaster.ediinvoices=0"; } } // end else Modified: trunk/RecurringSalesOrders.php =================================================================== --- trunk/RecurringSalesOrders.php 2011-09-25 09:15:03 UTC (rev 4706) +++ trunk/RecurringSalesOrders.php 2011-10-01 06:40:49 UTC (rev 4707) @@ -255,8 +255,6 @@ $ErrMsg = _('The recurring order cannot be added because'); $DbgMsg = _('The SQL that failed was'); $InsertQryResult = DB_query($HeaderSQL,$db,$ErrMsg,$DbgMsg,true); - - echo '<br/>' . $HeaderSQL; $RecurrOrderNo = DB_Last_Insert_ID($db,'recurringsalesorders','recurrorderno'); echo 'xxx'.$RecurrOrderNo; @@ -279,8 +277,6 @@ '" . $StockItem->Narrative . "')"; $Ins_LineItemResult = DB_query($LineItemsSQL,$db,$ErrMsg,$DbgMsg,true); - echo '<br/>' . $LineItemsSQL; - } /* inserted line items into sales order details */ $result = DB_Txn_Commit($db); Modified: trunk/SelectAsset.php =================================================================== --- trunk/SelectAsset.php 2011-09-25 09:15:03 UTC (rev 4706) +++ trunk/SelectAsset.php 2011-10-01 06:40:49 UTC (rev 4707) @@ -12,7 +12,7 @@ $_POST['Select'] = $_GET['AssetID']; } -if (isset($_GET['NewSearch']) or isset($_POST['Next']) or isset($_POST['Previous']) or isset($_POST['Go'])) { +if (isset($_GET['NewSearch']) OR isset($_POST['Next']) OR isset($_POST['Previous']) OR isset($_POST['Go'])) { unset($AssetID); unset($_SESSION['SelectedAsset']); unset($_POST['Select']); @@ -28,13 +28,13 @@ $_POST['AssetCode'] = trim(mb_strtoupper($_POST['AssetCode'])); } // Always show the search facilities -$SQL = 'SELECT categoryid, +$SQL = "SELECT categoryid, categorydescription FROM fixedassetcategories - ORDER BY categorydescription'; + ORDER BY categorydescription"; $result = DB_query($SQL, $db); if (DB_num_rows($result) == 0) { - echo '<p><font size=4 color=red>' . _('Problem Report') . ':</font><br />' . _('There are no asset categories currently defined please use the link below to set them up'); + echo '<p><font size="4" color="red">' . _('Problem Report') . ':</font><br />' . _('There are no asset categories currently defined please use the link below to set them up'); echo '<br /><a href="' . $rootpath . '/FixedAssetCategories.php">' . _('Define Asset Categories') . '</a>'; exit; } @@ -48,7 +48,7 @@ echo '<select name="AssetCategory">'; if (!isset($_POST['AssetCategory'])) { - $_POST['AssetCategory'] = ""; + $_POST['AssetCategory'] = ''; } if ($_POST['AssetCategory']=='ALL'){ echo '<option selected value="ALL">' . _('Any asset category') . '</option>'; @@ -58,9 +58,9 @@ while ($myrow = DB_fetch_array($result)) { if ($myrow['categoryid'] == $_POST['AssetCategory']) { - echo '<option selected VALUE="' . $myrow['categoryid'] . '">' . $myrow['categorydescription']; + echo '<option selected value="' . $myrow['categoryid'] . '">' . $myrow['categorydescription'] . '</option>'; } else { - echo '<option value="' . $myrow['categoryid'] . '">' . $myrow['categorydescription']; + echo '<option value="' . $myrow['categoryid'] . '">' . $myrow['categorydescription'] . '</option>'; } } echo '</select>'; @@ -84,9 +84,9 @@ while ($myrow = DB_fetch_array($result)) { if ($myrow['locationid'] == $_POST['AssetLocation']) { - echo '<option selected VALUE="' . $myrow['locationid'] . '">' . $myrow['locationdescription']; + echo '<option selected value="' . $myrow['locationid'] . '">' . $myrow['locationdescription'] . '</option>'; } else { - echo '<option value="' . $myrow['locationid'] . '">' . $myrow['locationdescription']; + echo '<option value="' . $myrow['locationid'] . '">' . $myrow['locationdescription'] . '</option>'; } } echo '</select>'; @@ -114,12 +114,12 @@ if ($_POST['Keywords'] AND $_POST['AssetCode']) { prnMsg( _('Asset description keywords have been used in preference to the asset code extract entered'), 'info' ); } - $SQL = 'SELECT assetid, + $SQL = "SELECT assetid, description, datepurchased, fixedassetlocations.locationdescription FROM fixedassets INNER JOIN fixedassetlocations - ON fixedassets.assetlocation=fixedassetlocations.locationid '; + ON fixedassets.assetlocation=fixedassetlocations.locationid "; if ($_POST['Keywords']) { //insert wildcard characters in spaces @@ -127,7 +127,7 @@ $SearchString = '%' . str_replace(' ', '%', $_POST['Keywords']) . '%'; if ($_POST['AssetCategory'] == 'ALL') { if ($_POST['AssetLocation']=='ALL'){ - $SQL .= 'WHERE description ' . LIKE . "'" . $SearchString . "' + $SQL .= "WHERE description " . LIKE . "'" . $SearchString . "' ORDER BY fixedassets.assetid"; } else { $SQL .= "WHERE fixedassets.assetlocation='" . $_POST['AssetLocation'] . "' @@ -136,7 +136,7 @@ } } else { if ($_POST['AssetLocation']=='ALL'){ - $SQL .= 'WHERE description ' . LIKE . "'" . $SearchString . "' + $SQL .= "WHERE description " . LIKE . "'" . $SearchString . "' AND assetcategoryid='" . $_POST['AssetCategory'] . "' ORDER BY fixedassets.assetid"; } else { @@ -149,7 +149,7 @@ } elseif (isset($_POST['AssetCode'])) { if ($_POST['AssetCategory'] == 'ALL') { if ($_POST['AssetLocation']=='ALL'){ - $SQL .= 'WHERE fixedassets.assetid ' . LIKE . " '%" . $_POST['AssetCode'] . "%' + $SQL .= "WHERE fixedassets.assetid " . LIKE . " '%" . $_POST['AssetCode'] . "%' ORDER BY fixedassets.assetid"; } else { $SQL .= "WHERE fixedassets.assetlocation='" . $_POST['AssetLocation'] . "' @@ -158,7 +158,7 @@ } } else { if ($_POST['AssetLocation']=='ALL'){ - $SQL .= 'WHERE fixedassets.assetid ' . LIKE . " '%" . $_POST['AssetCode'] . "%' + $SQL .= "WHERE fixedassets.assetid " . LIKE . " '%" . $_POST['AssetCode'] . "%' AND assetcategoryid='" . $_POST['AssetCategory'] . "' ORDER BY fixedassets.assetid"; } else { @@ -199,7 +199,7 @@ /* end query for list of records */ /* display list if there is more than one record */ if (isset($searchresult) AND !isset($_POST['Select'])) { - echo '<form action="FixedAssetItems.php" method=post>'; + echo '<form action="FixedAssetItems.php" method="post">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; $ListCount = DB_num_rows($searchresult); if ($ListCount > 0) { @@ -219,7 +219,7 @@ $_POST['PageOffset'] = $ListPageMax; } if ($ListPageMax > 1) { - echo "<div class='centre'><p> " . $_POST['PageOffset'] . ' ' . _('of') . ' ' . $ListPageMax . ' ' . _('pages') . '. ' . _('Go to Page') . ': '; + echo '<div class="centre"><p> ' . $_POST['PageOffset'] . ' ' . _('of') . ' ' . $ListPageMax . ' ' . _('pages') . '. ' . _('Go to Page') . ': '; echo '<select name="PageOffset">'; $ListPage = 1; while ($ListPage <= $ListPageMax) { Modified: trunk/SelectCompletedOrder.php =================================================================== --- trunk/SelectCompletedOrder.php 2011-09-25 09:15:03 UTC (rev 4706) +++ trunk/SelectCompletedOrder.php 2011-10-01 06:40:49 UTC (rev 4707) @@ -28,9 +28,9 @@ $SelectedStockItem = $_POST['SelectedStockItem']; } if (isset($_GET['OrderNumber'])){ - $OrderNumber = $_GET['OrderNumber']; + $OrderNumber = filter_number_format($_GET['OrderNumber']); } elseif (isset($_POST['OrderNumber'])){ - $OrderNumber = $_POST['OrderNumber']; + $OrderNumber = filter_number_format($_POST['OrderNumber']); } if (isset($_GET['CustomerRef'])){ $CustomerRef = $_GET['CustomerRef']; @@ -43,16 +43,16 @@ $SelectedCustomer = $_POST['SelectedCustomer']; } -if (isset($SelectedStockItem) and $SelectedStockItem==''){ +if (isset($SelectedStockItem) AND $SelectedStockItem==''){ unset($SelectedStockItem); } -if (isset($OrderNumber) and $OrderNumber==''){ +if (isset($OrderNumber) AND $OrderNumber==''){ unset($OrderNumber); } -if (isset($CustomerRef) and $CustomerRef==''){ +if (isset($CustomerRef) AND $CustomerRef==''){ unset($CustomerRef); } -if (isset($SelectedCustomer) and $SelectedCustomer==''){ +if (isset($SelectedCustomer) AND $SelectedCustomer==''){ unset($SelectedCustomer); } if (isset($_POST['ResetPart'])) { @@ -70,23 +70,23 @@ echo _('Customer Ref') . ' - ' . $CustomerRef; if (mb_strlen($_SESSION['UserBranch'])>1){ echo ' ' . _('and for customer') . ': ' . $SelectedCustomer .' ' . _('and') . ' '; - echo '<input type=hidden name="SelectedCustomer" value="' .$SelectedCustomer .'" />'; + echo '<input type="hidden" name="SelectedCustomer" value="' .$SelectedCustomer .'" />'; } } else { if (isset($SelectedCustomer)) { echo _('For customer') . ': ' . $SelectedCustomer .' ' . _('and') . ' '; - echo '<input type=hidden name="SelectedCustomer" value="'.$SelectedCustomer.'" />'; + echo '<input type="hidden" name="SelectedCustomer" value="'.$SelectedCustomer.'" />'; } if (isset($SelectedStockItem)) { $PartString = _('for the part') . ': <b>' . $SelectedStockItem . '</b> ' . _('and') . ' ' . - '<input type=hidden name="SelectedStockItem" value="'.$SelectedStockItem.'" />'; + '<input type="hidden" name="SelectedStockItem" value="'.$SelectedStockItem.'" />'; } } -if (isset($_POST['SearchParts']) and $_POST['SearchParts']!=''){ +if (isset($_POST['SearchParts']) AND $_POST['SearchParts']!=''){ if ($_POST['Keywords']!='' AND $_POST['StockCode']!='') { echo _('Stock description keywords have been used in preference to the Stock code extract entered'); @@ -97,109 +97,121 @@ if (isset($_POST['completed'])) { $SQL = "SELECT stockmaster.stockid, - stockmaster.description, - SUM(locstock.quantity) AS qoh, - SUM(purchorderdetails.quantityord-purchorderdetails.quantityrecd) AS qoo, - stockmaster.units, - SUM(salesorderdetails.quantity - salesorderdetails.qtyinvoiced) AS qdem - FROM (((stockmaster LEFT JOIN salesorderdetails on stockmaster.stockid = salesorderdetails.stkcode) - LEFT JOIN locstock ON stockmaster.stockid=locstock.stockid) - LEFT JOIN purchorderdetails on stockmaster.stockid = purchorderdetails.itemcode) - WHERE salesorderdetails.completed =1 - AND stockmaster.description " . LIKE . " '" . $SearchString. "' - AND stockmaster.categoryid='" . $_POST['StockCat'] . "' - GROUP BY stockmaster.stockid, - stockmaster.description, - stockmaster.units - ORDER BY stockmaster.stockid"; + stockmaster.description, + stockmaster.decimalplaces, + SUM(locstock.quantity) AS qoh, + SUM(purchorderdetails.quantityord-purchorderdetails.quantityrecd) AS qoo, + stockmaster.units, + SUM(salesorderdetails.quantity - salesorderdetails.qtyinvoiced) AS qdem + FROM (((stockmaster LEFT JOIN salesorderdetails on stockmaster.stockid = salesorderdetails.stkcode) + LEFT JOIN locstock ON stockmaster.stockid=locstock.stockid) + LEFT JOIN purchorderdetails on stockmaster.stockid = purchorderdetails.itemcode) + WHERE salesorderdetails.completed =1 + AND stockmaster.description " . LIKE . " '" . $SearchString. "' + AND stockmaster.categoryid='" . $_POST['StockCat'] . "' + GROUP BY stockmaster.stockid, + stockmaster.description, + stockmaster.decimalplaces, + stockmaster.units + ORDER BY stockmaster.stockid"; } else { $SQL = "SELECT stockmaster.stockid, - stockmaster.description, - SUM(locstock.quantity) AS qoh, - SUM(purchorderdetails.quantityord-purchorderdetails.quantityrecd) AS qoo, - stockmaster.units, - SUM(salesorderdetails.quantity - salesorderdetails.qtyinvoiced) AS qdem - FROM (((stockmaster LEFT JOIN salesorderdetails on stockmaster.stockid = salesorderdetails.stkcode) - LEFT JOIN locstock ON stockmaster.stockid=locstock.stockid) - LEFT JOIN purchorderdetails on stockmaster.stockid = purchorderdetails.itemcode) - WHERE stockmaster.description " . LIKE . " '" . $SearchString. "' - AND stockmaster.categoryid='" . $_POST['StockCat'] . "' - GROUP BY stockmaster.stockid, - stockmaster.description, - stockmaster.units - ORDER BY stockmaster.stockid"; + stockmaster.description, + stockmaster.decimalplaces, + SUM(locstock.quantity) AS qoh, + SUM(purchorderdetails.quantityord-purchorderdetails.quantityrecd) AS qoo, + stockmaster.units, + SUM(salesorderdetails.quantity - salesorderdetails.qtyinvoiced) AS qdem + FROM (((stockmaster LEFT JOIN salesorderdetails on stockmaster.stockid = salesorderdetails.stkcode) + LEFT JOIN locstock ON stockmaster.stockid=locstock.stockid) + LEFT JOIN purchorderdetails on stockmaster.stockid = purchorderdetails.itemcode) + WHERE stockmaster.description " . LIKE . " '" . $SearchString. "' + AND stockmaster.categoryid='" . $_POST['StockCat'] . "' + GROUP BY stockmaster.stockid, + stockmaster.description, + stockmaster.decimalplaces, + stockmaster.units + ORDER BY stockmaster.stockid"; } } elseif ($_POST['StockCode']!=''){ if (isset($_POST['completed'])) { $SQL = "SELECT stockmaster.stockid, - stockmaster.description, - SUM(locstock.quantity) AS qoh, - SUM(purchorderdetails.quantityord-purchorderdetails.quantityrecd) AS qoo, - SUM(salesorderdetails.quantity - salesorderdetails.qtyinvoiced) AS qdem, - stockmaster.units - FROM (((stockmaster LEFT JOIN salesorderdetails on stockmaster.stockid = salesorderdetails.stkcode) - LEFT JOIN locstock ON stockmaster.stockid=locstock.stockid) - LEFT JOIN purchorderdetails on stockmaster.stockid = purchorderdetails.itemcode) - WHERE salesorderdetails.completed =1 - AND stockmaster.stockid " . LIKE . " '%" . $_POST['StockCode'] . "%' - AND stockmaster.categoryid='" . $_POST['StockCat'] . "' - GROUP BY stockmaster.stockid, - stockmaster.description, - stockmaster.units - ORDER BY stockmaster.stockid"; + stockmaster.description, + stockmaster.decimalplaces, + SUM(locstock.quantity) AS qoh, + SUM(purchorderdetails.quantityord-purchorderdetails.quantityrecd) AS qoo, + SUM(salesorderdetails.quantity - salesorderdetails.qtyinvoiced) AS qdem, + stockmaster.units + FROM (((stockmaster LEFT JOIN salesorderdetails on stockmaster.stockid = salesorderdetails.stkcode) + LEFT JOIN locstock ON stockmaster.stockid=locstock.stockid) + LEFT JOIN purchorderdetails on stockmaster.stockid = purchorderdetails.itemcode) + WHERE salesorderdetails.completed =1 + AND stockmaster.stockid " . LIKE . " '%" . $_POST['StockCode'] . "%' + AND stockmaster.categoryid='" . $_POST['StockCat'] . "' + GROUP BY stockmaster.stockid, + stockmaster.description, + stockmaster.decimalplaces, + stockmaster.units + ORDER BY stockmaster.stockid"; } else { $SQL = "SELECT stockmaster.stockid, - stockmaster.description, - SUM(locstock.quantity) AS qoh, - SUM(purchorderdetails.quantityord-purchorderdetails.quantityrecd) AS qoo, - SUM(salesorderdetails.quantity - salesorderdetails.qtyinvoiced) AS qdem, - stockmaster.units - FROM (((stockmaster LEFT JOIN salesorderdetails on stockmaster.stockid = salesorderdetails.stkcode) - LEFT JOIN locstock ON stockmaster.stockid=locstock.stockid) - LEFT JOIN purchorderdetails on stockmaster.stockid = purchorderdetails.itemcode) - WHERE stockmaster.stockid " . LIKE . " '%" . $_POST['StockCode'] . "%' - AND stockmaster.categoryid='" . $_POST['StockCat'] . "' - GROUP BY stockmaster.stockid, - stockmaster.description, - stockmaster.units - ORDER BY stockmaster.stockid"; + stockmaster.description, + stockmaster.decimalplaces, + SUM(locstock.quantity) AS qoh, + SUM(purchorderdetails.quantityord-purchorderdetails.quantityrecd) AS qoo, + SUM(salesorderdetails.quantity - salesorderdetails.qtyinvoiced) AS qdem, + stockmaster.units + FROM (((stockmaster LEFT JOIN salesorderdetails on stockmaster.stockid = salesorderdetails.stkcode) + LEFT JOIN locstock ON stockmaster.stockid=locstock.stockid) + LEFT JOIN purchorderdetails on stockmaster.stockid = purchorderdetails.itemcode) + WHERE stockmaster.stockid " . LIKE . " '%" . $_POST['StockCode'] . "%' + AND stockmaster.categoryid='" . $_POST['StockCat'] . "' + GROUP BY stockmaster.stockid, + stockmaster.description, + stockmaster.decimalplaces, + stockmaster.units + ORDER BY stockmaster.stockid"; } } elseif ($_POST['StockCode']=='' AND $_POST['Keywords']=='' AND $_POST['StockCat']!='') { if (isset($_POST['completed'])) { $SQL = "SELECT stockmaster.stockid, - stockmaster.description, - SUM(locstock.quantity) AS qoh, - SUM(purchorderdetails.quantityord-purchorderdetails.quantityrecd) AS qoo, - SUM(salesorderdetails.quantity - salesorderdetails.qtyinvoiced) AS qdem, - stockmaster.units - FROM (((stockmaster LEFT JOIN salesorderdetails on stockmaster.stockid = salesorderdetails.stkcode) - LEFT JOIN locstock ON stockmaster.stockid=locstock.stockid) - LEFT JOIN purchorderdetails on stockmaster.stockid = purchorderdetails.itemcode) - WHERE salesorderdetails.completed=1 - AND stockmaster.categoryid='" . $_POST['StockCat'] . "' - GROUP BY stockmaster.stockid, - stockmaster.description, - stockmaster.units - ORDER BY stockmaster.stockid"; + stockmaster.description, + stockmaster.decimalplaces, + SUM(locstock.quantity) AS qoh, + SUM(purchorderdetails.quantityord-purchorderdetails.quantityrecd) AS qoo, + SUM(salesorderdetails.quantity - salesorderdetails.qtyinvoiced) AS qdem, + stockmaster.units + FROM (((stockmaster LEFT JOIN salesorderdetails on stockmaster.stockid = salesorderdetails.stkcode) + LEFT JOIN locstock ON stockmaster.stockid=locstock.stockid) + LEFT JOIN purchorderdetails on stockmaster.stockid = purchorderdetails.itemcode) + WHERE salesorderdetails.completed=1 + AND stockmaster.categoryid='" . $_POST['StockCat'] . "' + GROUP BY stockmaster.stockid, + stockmaster.description, + stockmaster.decimalplaces, + stockmaster.units + ORDER BY stockmaster.stockid"; } else { $SQL = "SELECT stockmaster.stockid, - stockmaster.description, - SUM(locstock.quantity) AS qoh, - SUM(purchorderdetails.quantityord-purchorderdetails.quantityrecd) AS qoo, - SUM(salesorderdetails.quantity - salesorderdetails.qtyinvoiced) AS qdem, - stockmaster.units - FROM (((stockmaster LEFT JOIN salesorderdetails on stockmaster.stockid = salesorderdetails.stkcode) - LEFT JOIN locstock ON stockmaster.stockid=locstock.stockid) - LEFT JOIN purchorderdetails on stockmaster.stockid = purchorderdetails.itemcode) - WHERE stockmaster.categoryid='" . $_POST['StockCat'] . "' - GROUP BY stockmaster.stockid, - stockmaster.description, - stockmaster.units - ORDER BY stockmaster.stockid"; + stockmaster.description, + stockmaster.decimalplaces, + SUM(locstock.quantity) AS qoh, + SUM(purchorderdetails.quantityord-purchorderdetails.quantityrecd) AS qoo, + SUM(salesorderdetails.quantity - salesorderdetails.qtyinvoiced) AS qdem, + stockmaster.units + FROM (((stockmaster LEFT JOIN salesorderdetails on stockmaster.stockid = salesorderdetails.stkcode) + LEFT JOIN locstock ON stockmaster.stockid=locstock.stockid) + LEFT JOIN purchorderdetails on stockmaster.stockid = purchorderdetails.itemcode) + WHERE stockmaster.categoryid='" . $_POST['StockCat'] . "' + GROUP BY stockmaster.stockid, + stockmaster.description, + stockmaster.decimalplaces, + stockmaster.units + ORDER BY stockmaster.stockid"; } } @@ -225,117 +237,129 @@ if (isset($OrderNumber)) { if (isset($SelectedCustomer)) { $SQL = "SELECT salesorders.orderno, - debtorsmaster.name, - custbranch.brname, - salesorders.customerref, - salesorders.orddate, - salesorders.deliverydate, - salesorders.deliverto, SUM(salesorderdetails.unitprice*salesorderdetails.quantity*(1-salesorderdetails.discountpercent)) AS ordervalue - FROM salesorders, - salesorderdetails, - debtorsmaster, - custbranch - WHERE salesorders.orderno = salesorderdetails.orderno - AND salesorders.branchcode = custbranch.branchcode - AND salesorders.debtorno = debtorsmaster.debtorno - AND debtorsmaster.debtorno = custbranch.debtorno - AND salesorders.debtorno='" . $SelectedCustomer ."' - AND salesorders.orderno='". $OrderNumber ."' - AND salesorders.quotation=0 - AND salesorderdetails.completed".$Completed." - GROUP BY salesorders.orderno, - debtorsmaster.name, - custbranch.brname, - salesorders.customerref, - salesorders.orddate, - salesorders.deliverydate, - salesorders.deliverto - ORDER BY salesorders.orderno"; - } else { //Set order number and SelectedCustomer not set + debtorsmaster.name, + custbranch.brname, + salesorders.customerref, + salesorders.orddate, + salesorders.deliverydate, + salesorders.deliverto, + currencies.decimalplaces AS currdecimalplaces, SUM(salesorderdetails.unitprice*salesorderdetails.quantity*(1-salesorderdetails.discountpercent)) AS ordervalue + FROM salesorders INNER JOIN salesorderdetails + ON salesorders.orderno = salesorderdetails.orderno + INNER JOIN debtorsmaster + ON salesorders.debtorno = debtorsmaster.debtorno + INNER JOIN custbranch + ON salesorders.branchcode = custbranch.branchcode + AND salesorders.debtorno = custbranch.debtorno + INNER JOIN currencies + ON debtorsmaster.currcode = currencies.currabrev + WHERE salesorders.debtorno='" . $SelectedCustomer ."' + AND salesorders.orderno='". $OrderNumber ."' + AND salesorders.quotation=0 + AND salesorderdetails.completed".$Completed." + GROUP BY salesorders.orderno, + debtorsmaster.name, + custbranch.brname, + salesorders.customerref, + salesorders.orddate, + salesorders.deliverydate, + currencies.decimalplaces, + salesorders.deliverto + ORDER BY salesorders.orderno"; + } else { //Set order number and SelectedCustomer not set $SQL = "SELECT salesorders.orderno, - debtorsmaster.name, - custbranch.brname, - salesorders.customerref, - salesorders.orddate, - salesorders.deliverydate, - salesorders.deliverto, SUM(salesorderdetails.unitprice*salesorderdetails.quantity*(1-salesorderdetails.discountpercent)) AS ordervalue - FROM salesorders, - salesorderdetails, - debtorsmaster, - custbranch - WHERE salesorders.orderno = salesorderdetails.orderno - AND salesorders.branchcode = custbranch.branchcode - AND salesorders.debtorno = debtorsmaster.debtorno - AND debtorsmaster.debtorno = custbranch.debtorno - AND salesorders.orderno='". $OrderNumber ."' - AND salesorders.quotation=0 - AND salesorderdetails.completed " . $Completed ." - GROUP BY salesorders.orderno, - debtorsmaster.name, - custbranch.brname, - salesorders.customerref, - salesorders.orddate, - salesorders.deliverydate, - salesorders.deliverto - ORDER BY salesorders.orderno"; - } + debtorsmaster.name, + custbranch.brname, + salesorders.customerref, + salesorders.orddate, + salesorders.deliverydate, + salesorders.deliverto, + currencies.decimalplaces AS currdecimalplaces, SUM(salesorderdetails.unitprice*salesorderdetails.quantity*(1-salesorderdetails.discountpercent)) AS ordervalue + FROM salesorders INNER JOIN salesorderdetails + ON salesorders.orderno = salesorderdetails.orderno + INNER JOIN debtorsmaster + ON salesorders.debtorno = debtorsmaster.debtorno + INNER JOIN custbranch + ON salesorders.branchcode = custbranch.branchcode + AND salesorders.debtorno = custbranch.debtorno + INNER JOIN currencies + ON debtorsmaster.currcode = currencies.currabrev + WHERE salesorders.orderno='". $OrderNumber ."' + AND salesorders.quotation=0 + AND salesorderdetails.completed " . $Completed ." + GROUP BY salesorders.orderno, + debtorsmaster.name, + currencies.decimalplaces, + custbranch.brname, + salesorders.customerref, + salesorders.orddate, + salesorders.deliverydate, + salesorders.deliverto + ORDER BY salesorders.orderno"; + } } elseif (isset($CustomerRef)) { - if (isset($SelectedCustomer)) { + if (isset($SelectedCustomer)) { $SQL = "SELECT salesorders.orderno, - debtorsmaster.name, - custbranch.brname, - salesorders.customerref, - salesorders.orddate, - salesorders.deliverydate, - salesorders.deliverto, SUM(salesorderdetails.unitprice*salesorderdetails.quantity*(1-salesorderdetails.discountpercent)) AS ordervalue - FROM salesorders, - salesorderdetails, - debtorsmaster, - custbranch - WHERE salesorders.orderno = salesorderdetails.orderno - AND salesorders.branchcode = custbranch.branchcode - AND salesorders.debtorno = debtorsmaster.debtorno - AND debtorsmaster.debtorno = custbranch.debtorno - AND salesorders.debtorno='" . $SelectedCustomer ."' - AND salesorders.customerref like '%". $CustomerRef."%' - AND salesorders.quotation=0 - AND salesorderdetails.completed".$Completed." - GROUP BY salesorders.orderno, - debtorsmaster.name, - custbranch.brname, - salesorders.customerref, - salesorders.orddate, - salesorders.deliverydate, - salesorders.deliverto - ORDER BY salesorders.orderno"; - } else { //customer not selected - $SQL = "SELECT salesorders.orderno, - debtorsmaster.name, - custbranch.brname, - salesorders.customerref, - salesorders.orddate, - salesorders.deliverydate, - salesorders.deliverto, SUM(salesorderdetails.unitprice*salesorderdetails.quantity*(1-salesorderdetails.discountpercent)) AS ordervalue - FROM salesorders, - salesorderdetails, - debtorsmaster, - custbranch - WHERE salesorders.orderno = salesorderdetails.orderno - AND salesorders.branchcode = custbranch.branchcode - AND salesorders.debtorno = debtorsmaster.debtorno - AND debtorsmaster.debtorno = custbranch.debtorno - AND salesorders.customerref like '%". $CustomerRef."%' - AND salesorders.quotation=0 - AND salesorderdetails.completed".$Completed." - GROUP BY salesorders.orderno, - debtorsmaster.name, - custbranch.brname, - salesorders.customerref, - salesorders.orddate, - salesorders.deliverydate, - salesorders.deliverto - ORDER BY salesorders.orderno"; - } + debtorsmaster.name, + currencies.decimalplaces AS currdecimalplaces, + custbranch.brname, + salesorders.customerref, + salesorders.orddate, + salesorders.deliverydate, + salesorders.deliverto, SUM(salesorderdetails.unitprice*salesorderdetails.quantity*(1-salesorderdetails.discountpercent)) AS ordervalue + FROM salesorders INNER JOIN salesorderdetails + ON salesorders.orderno = salesorderdetails.orderno + INNER JOIN debtorsmaster + ON salesorders.debtorno = debtorsmaster.debtorno + INNER JOIN custbranch + ON salesorders.branchcode = custbranch.branchcode + AND salesorders.debtorno = custbranch.debtorno + INNER JOIN currencies + ON debtorsmaster.currcode = currencies.currabrev + WHERE salesorders.debtorno='" . $SelectedCustomer ."' + AND salesorders.customerref like '%". $CustomerRef."%' + AND salesorders.quotation=0 + AND salesorderdetails.completed".$Completed." + GROUP BY salesorders.orderno, + debtorsmaster.name, + currencies.decimalplaces + custbranch.brname, + salesorders.customerref, + salesorders.orddate, + salesorders.deliverydate, + salesorders.deliverto + ORDER BY salesorders.orderno"; + } else { //customer not selected + $SQL = "SELECT salesorders.orderno, + debtorsmaster.name, + currencies.decimalplaces AS currdecimalplaces, + custbranch.brname, + salesorders.customerref, + salesorders.orddate, + salesorders.deliverydate, + salesorders.deliverto, SUM(salesorderdetails.unitprice*salesorderdetails.quantity*(1-salesorderdetails.discountpercent)) AS ordervalue + FROM salesorders INNER JOIN salesorderdetails + ON salesorders.orderno = salesorderdetails.orderno + INNER JOIN debtorsmaster + ON salesorders.debtorno = debtorsmaster.debtorno + INNER JOIN custbranch + ON salesorders.branchcode = custbranch.branchcode + AND salesorders.debtorno = custbranch.debtorno + INNER JOIN currencies + ON debtorsmaster.currcode = currencies.currabrev + WHERE salesorders.customerref " . LIKE . " '%". $CustomerRef . "%' + AND salesorders.quotation=0 + AND salesorderdetails.completed" . $Completed . " + GROUP BY salesorders.orderno, + debtorsmaster.name, + currencies.decimalplaces, + custbranch.brname, + salesorders.customerref, + salesorders.orddate, + salesorders.deliverydate, + salesorders.deliverto + ORDER BY salesorders.orderno"; + } } else { $DateAfterCriteria = FormatDateforSQL($_POST['OrdersAfterDate']); @@ -344,118 +368,130 @@ if (isset($SelectedStockItem)) { $SQL = "SELECT salesorders.orderno, - debtorsmaster.name, - custbranch.brname, - salesorders.customerref, - salesorders.orddate, - salesorders.deliverydate, - salesorders.deliverto, SUM(salesorderdetails.unitprice*salesorderdetails.quantity*(1-salesorderdetails.discountpercent)) AS ordervalue - FROM salesorders, - salesorderdetails, - debtorsmaster, - custbranch - WHERE salesorders.orderno = salesorderdetails.orderno - AND salesorders.branchcode = custbranch.branchcode - AND salesorders.debtorno = debtorsmaster.debtorno - AND debtorsmaster.debtorno = custbranch.debtorno - AND salesorderdetails.stkcode='". $SelectedStockItem ."' - AND salesorders.debtorno='" . $SelectedCustomer ."' - AND salesorders.orddate >= '" . $DateAfterCriteria ."' - AND salesorders.quotation=0 - AND salesorderdetails.completed".$Completed." - GROUP BY salesorders.orderno, - debtorsmaster.name, - custbranch.brname, - salesorders.customerref, - salesorders.orddate, - salesorders.deliverydate, - salesorders.deliverto - ORDER BY salesorders.orderno"; + debtorsmaster.name, + currencies.decimalplaces AS currdecimalplaces, + custbranch.brname, + salesorders.customerref, + salesorders.orddate, + salesorders.deliverydate, + salesorders.deliverto, SUM(salesorderdetails.unitprice*salesorderdetails.quantity*(1-salesorderdetails.discountpercent)) AS ordervalue + FROM salesorders INNER JOIN salesorderdetails + ON salesorders.orderno = salesorderdetails.orderno + INNER JOIN debtorsmaster + ON salesorders.debtorno = debtorsmaster.debtorno + INNER JOIN custbranch + ON salesorders.branchcode = custbranch.branchcode + AND salesorders.debtorno = custbranch.debtorno + INNER JOIN currencies + ON debtorsmaster.currcode = currencies.currabrev + WHERE salesorderdetails.stkcode='". $SelectedStockItem ."' + AND salesorders.debtorno='" . $SelectedCustomer ."' + AND salesorders.orddate >= '" . $DateAfterCriteria ."' + AND salesorders.quotation=0 + AND salesorderdetails.completed".$Completed." + GROUP BY salesorders.orderno, + debtorsmaster.name, + currencies.decimalplaces, + custbranch.brname, + salesorders.customerref, + salesorders.orddate, + salesorders.deliverydate, + salesorders.deliverto + ORDER BY salesorders.orderno"; } else { $SQL = "SELECT salesorders.orderno, - debtorsmaster.name, - custbranch.brname, - salesorders.customerref, - salesorders.orddate, - salesorders.deliverto, - salesorders.deliverydate, SUM(salesorderdetails.unitprice*salesorderdetails.quantity*(1-salesorderdetails.discountpercent)) AS ordervalue - FROM salesorders, - salesorderdetails, - debtorsmaster, - custbranch - WHERE salesorders.orderno = salesorderdetails.orderno - AND salesorders.debtorno = debtorsmaster.debtorno - AND salesorders.branchcode = custbranch.branchcode - AND debtorsmaster.debtorno = custbranch.debtorno - AND salesorders.debtorno='" . $SelectedCustomer . "' - AND salesorders.orddate >= '" . $DateAfterCriteria . "' - AND salesorders.quotation=0 - AND salesorderdetails.completed".$Completed." - GROUP BY salesorders.orderno, - debtorsmaster.name, - custbranch.brname, - salesorders.customerref, - salesorders.orddate, - salesorders.deliverydate, - salesorders.deliverto - ORDER BY salesorders.orderno"; + debtorsmaster.name, + currencies.decimalplaces AS currdecimalplaces, + custbranch.brname, + salesorders.customerref, + salesorders.orddate, + salesorders.deliverto, + salesorders.deliverydate, SUM(salesorderdetails.unitprice*salesorderdetails.quantity*(1-salesorderdetails.discountpercent)) AS ordervalue + FROM salesorders INNER JOIN salesorderdetails + ON salesorders.orderno = salesorderdetails.orderno + INNER JOIN debtorsmaster + ON salesorders.debtorno = debtorsmaster.debtorno + INNER JOIN custbranch + ON salesorders.branchcode = custbranch.branchcode + AND salesorders.debtorno = custbranch.debtorno + INNER JOIN currencies + ON debtorsmaster.currcode = currencies.currabrev + WHERE salesorders.debtorno='" . $SelectedCustomer . "' + AND salesorders.orddate >= '" . $DateAfterCriteria . "' + AND salesorders.quotation=0 + AND salesorderdetails.completed".$Completed." + GROUP BY salesorders.orderno, + debtorsmaster.name, + currencies.decimalplaces, + custbranch.brname, + salesorders.customerref, + salesorders.orddate, + salesorders.deliverydate, + salesorders.deliverto + ORDER BY salesorders.orderno"; } } else { //no customer selected if (isset($SelectedStockItem)) { $SQL = "SELECT salesorders.orderno, - debtorsmaster.name, - custbranch.brname, - salesorders.customerref, - salesorders.orddate, - salesorders.deliverto, - salesorders.deliverydate, SUM(salesorderdetails.unitprice*salesorderdetails.quantity*(1-salesorderdetails.discountpercent)) AS ordervalue - FROM salesorders, - salesorderdetails, - debtorsmaster, - custbranch - WHERE salesorders.orderno = salesorderdetails.orderno - AND salesorders.debtorno = debtorsmaster.debtorno - AND salesorders.branchcode = custbranch.branchcode - AND debtorsmaster.debtorno = custbranch.debtorno - AND salesorderdetails.stkcode='". $SelectedStockItem ."' - AND salesorders.orddate >= '" . $DateAfterCriteria . "' - AND salesorders.quotation=0 - AND salesorderdetails.completed".$Completed." - GROUP BY salesorders.orderno, - debtorsmaster.name, - custbranch.brname, - salesorders.customerref, - salesorders.orddate, - salesorders.deliverydate, - salesorders.deliverto - ORDER BY salesorders.orderno"; + debtorsmaster.name, + currencies.decimalplaces AS currdecimalplaces, + custbranch.brname, + salesorders.customerref, + salesorders.orddate, + salesorders.deliverto, + salesorders.deliverydate, SUM(salesorderdetails.unitprice*salesorderdetails.quantity*(1-salesorderdetails.discountpercent)) AS ordervalue + FROM salesorders INNER JOIN salesorderdetails + ON salesorders.orderno = salesorderdetails.orderno + INNER JOIN debtorsmaster + ON salesorders.debtorno = debtorsmaster.debtorno + INNER JOIN custbranch + ON salesorders.branchcode = custbranch.branchcode + AND salesorders.debtorno = custbranch.debtorno + INNER JOIN currencies + ON debtorsmaster.currcode = currencies.currabrev + WHERE salesorderdetails.stkcode='". $SelectedStockItem ."' + AND salesorders.orddate >= '" . $DateAfterCriteria . "' + AND salesorders.quotation=0 + AND salesorderdetails.completed".$Completed." + GROUP BY salesorders.orderno, + debtorsmaster.name, + currencies.decimalplaces, + custbranch.brname, + salesorders.customerref, + salesorders.orddate, + salesorders.deliverydate, + salesorders.deliverto + ORDER BY salesorders.orderno"; } else { $SQL = "SELECT salesorders.orderno, - debtorsmaster.name, - custbranch.brname, - salesorders.customerref, - salesorders.orddate, - salesorders.deliverto, - salesorders.deliverydate, SUM(salesorderdetails.unitprice*salesorderdetails.quantity*(1-salesorderdetails.discountpercent)) AS ordervalue - FROM salesorders, - salesorderdetails, - debtorsmaster, - custbranch - WHERE salesorders.orderno = salesorderdetails.orderno - AND salesorders.debtorno = debtorsmaster.debtorno - AND salesorders.branchcode = custbranch.branchcode - AND debtorsmaster.debtorno = custbranch.debtorno - AND salesorders.orddate >= '".$DateAfterCriteria . "' - AND salesorders.quotation=0 - AND salesorderdetails.completed".$Completed." - GROUP BY salesorders.orderno, - debtorsmaster.name, - custbranch.brname, - salesorders.customerref, - salesorders.orddate, - salesorders.deliverydate, - salesorders.deliverto - ORDER BY salesorders.orderno"; + debtorsmaster.name, + currencies.decimalplaces AS currdecimalplaces, + custbranch.brname, + salesorders.customerref, + salesorders.orddate, + salesorders.deliverto, + salesorders.deliverydate, SUM(salesorderdetails.unitprice*salesorderdetails.quantity*(1-salesorderdetails.discountpercent)) AS ordervalue + FROM salesorders INNER JOIN salesorderdetails + ON salesorders.orderno = salesorderdetails.orderno + INNER JOIN debtorsmaster + ON salesorders.debtorno = debtorsmaster.debtorno + INNER JOIN custbranch + ON salesorders.branchcode = custbranch.branchcode + AND salesorders.debtorno = custbranch.debtorno + INNER JOIN currencies + ON debtorsmaster.currcode = currencies.currabrev + WHERE salesorders.orddate >= '".$DateAfterCriteria . "' + AND salesorders.quotation=0 + AND salesorderdetails.completed".$Completed." + GROUP BY salesorders.orderno, + debtorsmaster.name, + currencies.decimalplaces, + custbranch.brname, + salesorders.customerref, + salesorders.orddate, + salesorders.deliverydate, + salesorders.deliverto + ORDER BY salesorders.orderno"; } } //end selected customer } //end not order number selected @@ -464,7 +500,7 @@ if (DB_error_no($db) !=0) { prnMsg( _('No orders were returned by the SQL because') . ' ' . DB_error_msg($db), 'info'); - echo "<br />$SQL"; + echo '<br /> ' . $SQL; } }//end of which button clicked options @@ -479,16 +515,20 @@ } else { echo '<tr><td></td>'; } - +if (!isset($_POST['OrderNumber'])){ + $_POST['OrderNumber']=''; +} echo '<td>' . _('Order Number') . ':</td> <td><input type="text" name="OrderNumber" maxlength =8 size=9 value ="' . $_POST['OrderNumber'] . '"></td> <td>' . _('for all orders placed after') . ': </td> - <td><input type="text" class="date" alt="' . $_SESSION['DefaultDateFormat'] .'" name="OrdersAfterDate" maxlength =10 size=11 value="' . $_POST['OrdersAfterDate'] . '"></td> - <td><input type="submit" name="SearchOrders" value="' . _('Search Orders') . '"></td></tr>'; + <td><input type="text" class="date" alt="' . $_SESSION['DefaultDateFormat'] .'" name="OrdersAfterDate" maxlength="10" size="11" value="' . $_POST['OrdersAfterDate'] . '" /></td> + <td><input type="submit" name="SearchOrders" value="' . _('Search Orders') . '" /></td> + </tr>'; echo '<tr> <td></td> - <td>' . _('Customer Ref') . ':</td><td><input type="text" name="CustomerRef" maxlength =8 size=9></td> - <td></td><td colspan=2><input type="checkbox" ' . $ShowChecked . ' name="completed" />' . _('Show Completed orders only') . '</td></tr>'; + <td>' . _('Customer Ref') . ':</td><td><input type="text" name="CustomerRef" maxlength="8" size="9" /></td> + <td></td> + <td colspan="2"><input type="checkbox" ' . $ShowChecked . ' name="completed" />' . _('Show Completed orders only') . '</td></tr>'; echo '</table>'; @@ -500,12 +540,13 @@ echo '<br />'; echo '<div class="page_help_text"><font size=1>' . _('To search for sales orders for a specific part use the part selection facilities below') . ' </font></div>'; - echo '<br /><table class=selection>'; + echo '<br /> + <table class="selection">'; echo '<tr><td><font size=1>' . _('Select a stock category') . ':</font>'; echo '<select name="StockCat">'; while ($myrow1 = DB_fetch_array($result1)) { - if (isset($_POST['StockCat']) and $myrow1['categoryid'] == $_POST['StockCat']){ + if (isset($_POST['StockCat']) AND $myrow1['categoryid'] == $_POST['StockCat']){ echo '<option selected value="' . $myrow1['categoryid'] . '">' . $myrow1['categorydescription'] . '</option>'; } else { echo '<option value="'. $myrow1['categoryid'] . '">' . $myrow1['categorydescription'] . '</option>'; @@ -514,15 +555,15 @@ echo '</select>'; echo '<td><font size=1>' . _('Enter text extracts in the description') . ':</font></td>'; - echo '<td><input type="text" name="Keywords" size=20 maxlength=25></td></tr>'; + echo '<td><input type="text" name="Keywords" size="20" maxlength="25"></td></tr>'; echo '<tr><td></td>'; echo '<td><font size=3><b> ' ._('OR') . ' </b></font><font size=1>' . _('Enter extract of the Stock Code') . ':</font></td>'; - echo '<td><input type="text" name="StockCode" size=15 maxlength=18></td>'; + echo '<td><input type="text" name="StockCode" size="15" maxlength="18"></td>'; echo '</tr>'; - echo '<tr><td colspan=4><div class=centre><input type="submit" name="SearchParts" value="' . _('Search Parts Now') . '">'; + echo '<tr><td colspan=4><div class="centre"><input type="submit" name="SearchParts" value="' . _('Search Parts Now') . '" />'; if (count($_SESSION['AllowedPageSecurityTokens'])>1){ - echo '<input type=submit name="ResetPart" value="' . _('Show All') . '"></div>'; + echo '<input type="submit" name="ResetPart" value="' . _('Show All') . '" /></div>'; } echo '</td></tr></table>'; @@ -530,7 +571,8 @@ If (isset($StockItemsResult)) { - echo '<br /><table cellpadding=2 colspan=7 class=selection>'; + echo '<br /> + <table cellpadding="2" colspan="7" class="selection">'; $TableHeadings = '<tr><th>' . _('Code') . '</th> <th>' . _('Description') . '</th> @@ -556,15 +598,15 @@ printf('<td><font size=1><input type="submit" name="SelectedStockItem" value="%s" /></font></td> <td><font size=1>%s</font></td> - <td class=number><font size=1>%s</font></td> - <td class=number><font size=1>%s</font></td> - <td class=number><font size=1>%s</font></td> + <td class="number"><font size=1>%s</font></td> + <td class="number"><font size=1>%s</font></td> + <td class="number"><font size=1>%s</font></td> <td><font size=1>%s</font></td></tr>', $myrow['stockid'], $myrow['description'], - $myrow['qoh'], - $myrow['qoo'], - $myrow['qdem'], + locale_number_format($myrow['qoh'],$myrow['decimalplaces']), + locale_number_format($myrow['qoo'],$myrow['decimalplaces']), + locale_number_format($myrow['qdem'],$myrow['decimalplaces']), $myrow['units']); //end of page full new headings if @@ -580,7 +622,7 @@ /*show a table of the orders returned by the SQL */ - echo '<br /><table cellpadding=2 colspan=6 width=90% class=selection>'; + echo '<br /><table cellpadding="2" colspan="6" width="90%" class="selection">'; $tableheader = '<tr><th>' . _('Order') . ' #</th> <th>' . _('Customer') . '</th> @@ -609,7 +651,7 @@ $ViewPage = $rootpath . '/OrderDetails.php?OrderNumber=' . $myrow['orderno']; $FormatedDelDate = ConvertSQLDate($myrow['deliverydate']); $FormatedOrderDate = ConvertSQLDate($myrow['orddate']); - $FormatedOrderValue = locale_number_format($myrow['ordervalue'],2); + $FormatedOrderValue = locale_money_format($myrow['ordervalue'],$myrow['currdecimalplaces']); printf('<td><a href="%s">%s</a></td> <td>%s</td> @@ -618,7 +660,7 @@ <td>%s</td> <td>%s</td> <td>%s</td> - <td class=number>%s</td> + <td class="number">%s</td> </tr>', $ViewPage, $myrow['orderno'], @@ -635,7 +677,6 @@ //end of while loop echo '</table>'; - } echo '</form>'; Modified: trunk/SelectCreditItems.php =================================================================== --- trunk/SelectCreditItems.php 2011-09-25 09:15:03 UTC (rev 4706) +++ trunk/SelectCreditItems.php 2011-10-01 06:40:49 UTC (rev 4707) @@ -125,7 +125,7 @@ if (isset($_POST['JustSelectedACustomer']) AND !isset($SelectedCustomer)){ /*Need to figure out the number of the form variable that the user clicked on */ - for ($i=1;$i<count($_POST);$i++){ //loop through the returned customers + for ($i=1; $i < count($_POST); $i++){ //loop through the returned customers if(isset($_POST['SubmitCustomerSelection'.$i])){ break; } @@ -215,16 +215,19 @@ _('Search') . '" alt="" />' . ' ' . _('Select Customer For Credit Note').'</p>'; echo '<table cellpadding="3" colspan="4" class="selection">'; - echo '<tr><th colspan="5"><font size="3" color="navy"><b> ' . _('Customer Selection') . '</b></font></th></tr>'; - echo '<tr>'; - echo '<td><font size="1">' . _('Enter text in the customer name') . ':</font></td>'; - echo '<td><input type="text" name="Keywords" size="20" maxlength="25" /></td>'; - echo '<td><font size="3"><b>' . _('OR') . '</b></font></td>'; - echo '<td><font size="1">' . _('Enter text extract in the customer code') . ':</font></td>'; - echo '<td><input type="text" name="CustCode" size="15" maxlength="18" /></td>'; - echo '</tr>'; - echo '</table>'; - echo '<br /><div class="centre"><input type="submit" name="SearchCust" value="' . _('Search Now') . '"></div>'; + echo '<tr><th colspan="5"><font size="3" color="navy"><b> ' . _('Customer Selection') .'</b></font></th></tr>'; + echo '<tr> + <td><font size="1">' . _('Enter text in the customer name') . ':</font></td> + <td><input type="text" name="Keywords" size="20" maxlength="25" /></td> + <td><font size="3"><b>' . _('OR') . '</b></font></td> + <td><font size="1">' . _('Enter text extract in the customer code') . ':</font></td> + <td><input type="text" name="CustCode" size="15" maxlength="18" /></td> + </tr>'; + echo '</table> + <br /> + <div class="centre"> + <input type="submit" name="SearchCust" value="' . _('Search Now') . '" /> + </div>'; if (isset($result_CustSelect)) { @@ -252,19 +255,19 @@ echo '<tr class="OddTableRows">'; $k=1; } - echo '<form action="' . $_SERVER['PHP_SELF'] . '?identifier='.$identifier . '" name="SelectParts" method="post">'; - echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; + if ($LastCustomer != $myrow['name']) { echo '<td>'.$myrow['name'].'</td>'; } else { echo '<td></td>'; } - echo '<td><input tabindex='.($j+5).' type=submit name="SubmitCustomerSelection' . $j .'" value="' . htmlentities($myrow['brname'], ENT_QUOTES,'UTF-8'). '"></td> - <input type="hidden" name="SelectedCustomer' . $j .'" value="'.$myrow['debtorno'].'"><input type="hidden" name="SelectedBranch' . $j .'" value="'. $myrow['branchcode'].'" /> - <td>'.$myrow['contactname'].'</td> - <td>'.$myrow['phoneno'].'</td> - <td>'.$myrow['faxno'].'</td> - </tr>'; + echo '<td><input tabindex='.($j+5).' type="submit" name="SubmitCustomerSelection' . $j .'" value="' . htmlentities($myrow['brname'], ENT_QUOTES,'UTF-8'). '"></td> + <input type="hidden" name="SelectedCustomer' . $j .'" value="'.$myrow['debtorno'].'"> + <input type="hidden" name="SelectedBranch' . $j .'" value="'. $myrow['branchcode'].'" /> + <td>'.$myrow['contactname'].'</td> + <td>'.$myrow['phoneno'].'</td> + <td>'.$myrow['faxno'].'</td> + </tr>'; $LastCustomer=$myrow['name']; $j++; //end of page full new headings if @@ -395,7 +398,7 @@ /*Always do the stuff below if not looking for a customerid Set up the form for the credit note display and entry*/ - echo '<form action="' . $_SERVER['PHP_SELF'] . '?identifier='.$identifier . '" method="post">'; + echo '<form name="MainForm" action="' . $_SERVER['PHP_SELF'] . '?identifier='.$identifier . '" method="post">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; @@ -409,10 +412,13 @@ $QuickEntryCode = 'part_' . $i; $QuickEntryQty = 'qty_' . $i; $i++; - } while (!is_numeric($_POST[$QuickEntryQty]) AND $_POST[$QuickEntryQty] <=0 AND mb_strlen($_POST[$QuickEntryCode])!=0 AND $i<=$QuickEntires); + } while (!is_numeric(filter_number_format($_POST[$QuickEntryQty])) + AND filter_number_format($_POST[$QuickEntryQty]) <=0 + AND mb_strlen($_POST[$QuickEntryCode])!=0 + AND $i<=$QuickEntires); $_POST['NewItem'] = trim($_POST[$QuickEntryCode]); - $NewItemQty = trim($_POST[$QuickEntryQty]); + $NewItemQty = filter_number_format($_POST[$QuickEntryQty]); if (mb_strlen($_POST['NewItem'])==0){ break; /* break out of the loop if nothing in the quick entry fields*/ @@ -425,7 +431,7 @@ /* do a loop round the items on the credit note to see that the item is not already on this credit note */ - if ($_SESSION['SO_AllowSameItemMultipleTimes']==0 && strcasecmp($OrderItem->StockID, $_POST['NewItem']) == 0) { + if ($_SESSION['SO_AllowSameItemMultipleTimes']==0 AND strcasecmp($OrderItem->StockID, $_POST['NewItem']) == 0) { $AlreadyOnThisCredit = 1; prnMsg($_POST['NewItem'] . ' ' . _('is already on this credit - the system will not allow the same item on the credit note more than once. However you can change the quantity credited of the existing line if necessary'),'warn'); } @@ -509,10 +515,11 @@ } if (isset($_POST['ChargeFreightCost'])){ - $_SESSION['CreditItems'.$identifier]->FreightCost = $_POST['ChargeFreightCost']; + $_SESSION['CreditItems'.$identifier]->FreightCost = filter_number_format($_POST['ChargeFreightCost']); } - if (isset($_POST['Location']) AND $_POST['Location'] != $_SESSION['CreditItems'.$identifier]->Location){ + if (isset($_POST['Location']) + AND $_POST['Location'] != $_SESSION['CreditItems'.$identifier]->Location){ $_SESSION['CreditItems'.$identifier]->Location = $_POST['Location']; @@ -530,11 +537,11 @@ if (isset($_POST['Quantity_' . $LineItem->LineNumber])){ - $Quantity = $_POST['Quantity_' . $LineItem->LineNumber]; + $Quantity = filter_number_format($_POST['Quantity_' . $LineItem->LineNumber]); $Narrative = $_POST['Narrative_' . $LineItem->LineNumber]; if (isset($_POST['Price_' . $LineItem->LineNumber])){ - if (isset($_POST['Gross']) and $_POST['Gross']==True){ + if (isset($_POST['Gross']) AND $_POST['Gross']==True){ $TaxTotalPercent =0; foreach ($LineItem->Taxes AS $Tax) { if ($Tax->TaxOnTax ==1){ @@ -545,14 +552,14 @@ } $Price = round($_POST['Price_' . $LineItem->LineNumber]/($TaxTotalP... [truncated message content] |
From: <dai...@us...> - 2011-10-02 09:17:01
|
Revision: 4708 http://web-erp.svn.sourceforge.net/web-erp/?rev=4708&view=rev Author: daintree Date: 2011-10-02 09:16:51 +0000 (Sun, 02 Oct 2011) Log Message: ----------- number_formats Modified Paths: -------------- trunk/AgedDebtors.php trunk/AgedSuppliers.php trunk/BankReconciliation.php trunk/ConfirmDispatchControlled_Invoice.php trunk/ConfirmDispatch_Invoice.php trunk/CounterSales.php trunk/Credit_Invoice.php trunk/DeliveryDetails.php trunk/GLAccountReport.php trunk/Numbers/Words/lang.bg.php trunk/Numbers/Words/lang.fr.php trunk/Numbers/Words/lang.fr_BE.php trunk/PDFBankingSummary.php trunk/PDFChequeListing.php trunk/PDFCustTransListing.php trunk/PDFCustomerList.php trunk/PDFLowGP.php trunk/PDFPickingList.php trunk/PDFPriceList.php trunk/PDFPrintLabel.php trunk/PDFQuotation.php trunk/PDFQuotationPortrait.php trunk/PDFReceipt.php trunk/PDFRemittanceAdvice.php trunk/PDFSuppTransListing.php trunk/PDFTopItems.php trunk/POReport.php trunk/PO_AuthorisationLevels.php trunk/PO_Items.php trunk/PO_OrderDetails.php trunk/PO_PDFPurchOrder.php trunk/PO_SelectPurchOrder.php trunk/PcAssignCashToTab.php trunk/PcAuthorizeExpenses.php trunk/PcClaimExpensesFromTab.php trunk/PcReportTab.php trunk/PricesByCost.php trunk/PrintCheque.php trunk/PrintCustStatements.php trunk/PrintCustTrans.php trunk/PrintCustTransPortrait.php trunk/PurchData.php trunk/RecurringSalesOrders.php trunk/ReverseGRN.php trunk/SMTPServer.php trunk/SalesByTypePeriodInquiry.php trunk/SalesCategoryPeriodInquiry.php trunk/SalesInquiry.php trunk/SalesPeople.php trunk/SalesTopItemsInquiry.php trunk/SelectCompletedOrder.php trunk/SelectCreditItems.php trunk/SelectCustomer.php trunk/SelectOrderItems.php trunk/SelectProduct.php trunk/SelectRecurringSalesOrder.php trunk/SelectSalesOrder.php trunk/SelectSupplier.php trunk/SelectWorkOrder.php trunk/ShipmentCosting.php trunk/Shipments.php trunk/SpecialOrder.php trunk/StockAdjustments.php trunk/doc/Change.log trunk/includes/DefineCartClass.php trunk/includes/DefineSpecialOrderClass.php trunk/includes/LanguageSetup.php trunk/includes/LanguagesArray.php trunk/includes/MiscFunctions.php trunk/includes/SelectOrderItems_IntoCart.inc trunk/includes/phplot/phplot.php trunk/includes/session.inc trunk/includes/tcpdf/tcpdf.php Added Paths: ----------- trunk/css/aguapop/ trunk/css/aguapop/README.txt trunk/css/aguapop/default.css trunk/css/aguapop/default.css_large trunk/css/aguapop/footer.inc.NEW trunk/css/aguapop/images/ trunk/css/aguapop/images/Graphique-32.png trunk/css/aguapop/images/allocation.png trunk/css/aguapop/images/ar.png trunk/css/aguapop/images/back.png trunk/css/aguapop/images/bank.png trunk/css/aguapop/images/bar.png trunk/css/aguapop/images/body_bg.png trunk/css/aguapop/images/button_bg.png trunk/css/aguapop/images/company.png trunk/css/aguapop/images/contract.png trunk/css/aguapop/images/currency.png trunk/css/aguapop/images/customer.png trunk/css/aguapop/images/error.png trunk/css/aguapop/images/folder_add.png trunk/css/aguapop/images/footer.png trunk/css/aguapop/images/gl.png trunk/css/aguapop/images/group_add.png trunk/css/aguapop/images/input.png trunk/css/aguapop/images/input_bg.png trunk/css/aguapop/images/inputh.png trunk/css/aguapop/images/inputhtxt.png trunk/css/aguapop/images/inputtxt.png trunk/css/aguapop/images/inquireies.png trunk/css/aguapop/images/inventory.png trunk/css/aguapop/images/magnifier.png trunk/css/aguapop/images/maintenance.png trunk/css/aguapop/images/money_add.png trunk/css/aguapop/images/money_delete.png trunk/css/aguapop/images/note_add.png trunk/css/aguapop/images/pdf.png trunk/css/aguapop/images/preview.png trunk/css/aguapop/images/printer.png trunk/css/aguapop/images/reports.png trunk/css/aguapop/images/sales.png trunk/css/aguapop/images/stripe.png trunk/css/aguapop/images/supplier.png trunk/css/aguapop/images/tab_bg.png trunk/css/aguapop/images/top.png trunk/css/aguapop/images/top_bg.png trunk/css/aguapop/images/transactions.png trunk/css/aguapop/images/user.png trunk/css/aguapop/images/x-mail-distribution-list.png trunk/css/aguapop/login.css Modified: trunk/AgedDebtors.php =================================================================== --- trunk/AgedDebtors.php 2011-10-01 06:40:49 UTC (rev 4707) +++ trunk/AgedDebtors.php 2011-10-02 09:16:51 UTC (rev 4708) @@ -291,11 +291,11 @@ while ($AgedAnalysis = DB_fetch_array($CustomerResult,$db)){ $DecimalPlaces = $AgedAnalysis['decimalplaces']; - $DisplayDue = locale_money_format($AgedAnalysis['due']-$AgedAnalysis['overdue1'],$DecimalPlaces); - $DisplayCurrent = locale_money_format($AgedAnalysis['balance']-$AgedAnalysis['due'],$DecimalPlaces); - $DisplayBalance = locale_money_format($AgedAnalysis['balance'],$DecimalPlaces); - $DisplayOverdue1 = locale_money_format($AgedAnalysis['overdue1']-$AgedAnalysis['overdue2'],$DecimalPlaces); - $DisplayOverdue2 = locale_money_format($AgedAnalysis['overdue2'],$DecimalPlaces); + $DisplayDue = locale_number_format($AgedAnalysis['due']-$AgedAnalysis['overdue1'],$DecimalPlaces); + $DisplayCurrent = locale_number_format($AgedAnalysis['balance']-$AgedAnalysis['due'],$DecimalPlaces); + $DisplayBalance = locale_number_format($AgedAnalysis['balance'],$DecimalPlaces); + $DisplayOverdue1 = locale_number_format($AgedAnalysis['overdue1']-$AgedAnalysis['overdue2'],$DecimalPlaces); + $DisplayOverdue2 = locale_number_format($AgedAnalysis['overdue2'],$DecimalPlaces); $TotBal += $AgedAnalysis['balance']; $TotDue += ($AgedAnalysis['due']-$AgedAnalysis['overdue1']); @@ -384,11 +384,11 @@ $DisplayTranDate = ConvertSQLDate($DetailTrans['trandate']); $LeftOvers = $pdf->addTextWrap($Left_Margin+125,$YPos,75,$FontSize,$DisplayTranDate,'left'); - $DisplayDue = locale_money_format($DetailTrans['due']-$DetailTrans['overdue1'],$DecimalPlaces); - $DisplayCurrent = locale_money_format($DetailTrans['balance']-$DetailTrans['due'],$DecimalPlaces); - $DisplayBalance = locale_money_format($DetailTrans['balance'],$DecimalPlaces); - $DisplayOverdue1 = locale_money_format($DetailTrans['overdue1']-$DetailTrans['overdue2'],$DecimalPlaces); - $DisplayOverdue2 = locale_money_format($DetailTrans['overdue2'],$DecimalPlaces); + $DisplayDue = locale_number_format($DetailTrans['due']-$DetailTrans['overdue1'],$DecimalPlaces); + $DisplayCurrent = locale_number_format($DetailTrans['balance']-$DetailTrans['due'],$DecimalPlaces); + $DisplayBalance = locale_number_format($DetailTrans['balance'],$DecimalPlaces); + $DisplayOverdue1 = locale_number_format($DetailTrans['overdue1']-$DetailTrans['overdue2'],$DecimalPlaces); + $DisplayOverdue2 = locale_number_format($DetailTrans['overdue2'],$DecimalPlaces); $LeftOvers = $pdf->addTextWrap(220,$YPos,60,$FontSize,$DisplayBalance,'right'); $LeftOvers = $pdf->addTextWrap(280,$YPos,60,$FontSize,$DisplayCurrent,'right'); @@ -418,11 +418,11 @@ $pdf->line($Page_Width-$Right_Margin, $YPos+10 ,220, $YPos+10); } - $DisplayTotBalance = locale_money_format($TotBal,$DecimalPlaces); - $DisplayTotDue = locale_money_format($TotDue,$DecimalPlaces); - $DisplayTotCurrent = locale_money_format($TotCurr,$DecimalPlaces); - $DisplayTotOverdue1 = locale_money_format($TotOD1,$DecimalPlaces); - $DisplayTotOverdue2 = locale_money_format($TotOD2,$DecimalPlaces); + $DisplayTotBalance = locale_number_format($TotBal,$DecimalPlaces); + $DisplayTotDue = locale_number_format($TotDue,$DecimalPlaces); + $DisplayTotCurrent = locale_number_format($TotCurr,$DecimalPlaces); + $DisplayTotOverdue1 = locale_number_format($TotOD1,$DecimalPlaces); + $DisplayTotOverdue2 = locale_number_format($TotOD2,$DecimalPlaces); $LeftOvers = $pdf->addTextWrap(220,$YPos,60,$FontSize,$DisplayTotBalance,'right'); $LeftOvers = $pdf->addTextWrap(280,$YPos,60,$FontSize,$DisplayTotCurrent,'right'); Modified: trunk/AgedSuppliers.php =================================================================== --- trunk/AgedSuppliers.php 2011-10-01 06:40:49 UTC (rev 4707) +++ trunk/AgedSuppliers.php 2011-10-02 09:16:51 UTC (rev 4708) @@ -126,11 +126,11 @@ While ($AgedAnalysis = DB_fetch_array($SupplierResult,$db)){ - $DisplayDue = locale_money_format($AgedAnalysis['due']-$AgedAnalysis['overdue1'],2); - $DisplayCurrent = locale_money_format($AgedAnalysis['balance']-$AgedAnalysis['due'],2); - $DisplayBalance = locale_money_format($AgedAnalysis['balance'],2); - $DisplayOverdue1 = locale_money_format($AgedAnalysis['overdue1']-$AgedAnalysis['overdue2'],2); - $DisplayOverdue2 = locale_money_format($AgedAnalysis['overdue2'],2); + $DisplayDue = locale_number_format($AgedAnalysis['due']-$AgedAnalysis['overdue1'],2); + $DisplayCurrent = locale_number_format($AgedAnalysis['balance']-$AgedAnalysis['due'],2); + $DisplayBalance = locale_number_format($AgedAnalysis['balance'],2); + $DisplayOverdue1 = locale_number_format($AgedAnalysis['overdue1']-$AgedAnalysis['overdue2'],2); + $DisplayOverdue2 = locale_number_format($AgedAnalysis['overdue2'],2); $TotBal += $AgedAnalysis['balance']; $TotDue += ($AgedAnalysis['due']-$AgedAnalysis['overdue1']); @@ -204,11 +204,11 @@ $DisplayTranDate = ConvertSQLDate($DetailTrans['trandate']); $LeftOvers = $pdf->addTextWrap($Left_Margin+105,$YPos,70,$FontSize,$DisplayTranDate,'left'); - $DisplayDue = locale_money_format($DetailTrans['due']-$DetailTrans['overdue1'],2); - $DisplayCurrent = locale_money_format($DetailTrans['balance']-$DetailTrans['due'],2); - $DisplayBalance = locale_money_format($DetailTrans['balance'],2); - $DisplayOverdue1 = locale_money_format($DetailTrans['overdue1']-$DetailTrans['overdue2'],2); - $DisplayOverdue2 = locale_money_format($DetailTrans['overdue2'],2); + $DisplayDue = locale_number_format($DetailTrans['due']-$DetailTrans['overdue1'],2); + $DisplayCurrent = locale_number_format($DetailTrans['balance']-$DetailTrans['due'],2); + $DisplayBalance = locale_number_format($DetailTrans['balance'],2); + $DisplayOverdue1 = locale_number_format($DetailTrans['overdue1']-$DetailTrans['overdue2'],2); + $DisplayOverdue2 = locale_number_format($DetailTrans['overdue2'],2); $LeftOvers = $pdf->addTextWrap(220,$YPos,60,$FontSize,$DisplayBalance,'right'); $LeftOvers = $pdf->addTextWrap(280,$YPos,60,$FontSize,$DisplayCurrent,'right'); @@ -238,11 +238,11 @@ $pdf->line($Page_Width-$Right_Margin, $YPos+10 ,220, $YPos+10); } - $DisplayTotBalance = locale_money_format($TotBal,2); - $DisplayTotDue = locale_money_format($TotDue,2); - $DisplayTotCurrent = locale_money_format($TotCurr,2); - $DisplayTotOverdue1 = locale_money_format($TotOD1,2); - $DisplayTotOverdue2 = locale_money_format($TotOD2,2); + $DisplayTotBalance = locale_number_format($TotBal,2); + $DisplayTotDue = locale_number_format($TotDue,2); + $DisplayTotCurrent = locale_number_format($TotCurr,2); + $DisplayTotOverdue1 = locale_number_format($TotOD1,2); + $DisplayTotOverdue2 = locale_number_format($TotOD2,2); $LeftOvers = $pdf->addTextWrap(220,$YPos,60,$FontSize,$DisplayTotBalance,'right'); $LeftOvers = $pdf->addTextWrap(280,$YPos,60,$FontSize,$DisplayTotCurrent,'right'); Modified: trunk/BankReconciliation.php =================================================================== --- trunk/BankReconciliation.php 2011-10-01 06:40:49 UTC (rev 4707) +++ trunk/BankReconciliation.php 2011-10-02 09:16:51 UTC (rev 4708) @@ -42,7 +42,7 @@ $CalculatedBalance = filter_number_format($_POST['DoExchangeDifference']); - $ExchangeDifference = filter_number_format(($CalculatedBalance - $_POST['BankStatementBalance'])/$CurrencyRow['rate']); + $ExchangeDifference = ($CalculatedBalance - filter_number_format($_POST['BankStatementBalance']))/$CurrencyRow['rate']; include ('includes/SQL_CommonFunctions.inc'); $ExDiffTransNo = GetNextTransNo(36,$db); @@ -89,7 +89,7 @@ $result = DB_query($SQL,$db,$ErrMsg,$DbgMsg,true); $result = DB_Txn_Commit($db); - prnMsg(_('Exchange difference of') . ' ' . locale_money_format($ExchangeDifference,$_SESSION['CompanyRecord']['decimalplaces']) . ' ' . _('has been posted'),'success'); + prnMsg(_('Exchange difference of') . ' ' . locale_number_format($ExchangeDifference,$_SESSION['CompanyRecord']['decimalplaces']) . ' ' . _('has been posted'),'success'); } //end if the bank statement balance was numeric } @@ -173,7 +173,7 @@ echo ' (' . $CurrencyRow['currcode'] . ' @ ' . $CurrencyRow['rate'] .')'; } echo '</b></td> - <td valign=bottom class="number"><b>' . locale_money_format($Balance*$CurrencyRow['rate'],$CurrencyRow['currdecimalplaces']) . '</b></td></tr>'; + <td valign=bottom class="number"><b>' . locale_number_format($Balance*$CurrencyRow['rate'],$CurrencyRow['currdecimalplaces']) . '</b></td></tr>'; $SQL = "SELECT amount/exrate AS amt, amountcleared, @@ -231,8 +231,8 @@ $myrow['typename'], $myrow['transno'], $myrow['ref'], - locale_money_format($myrow['amt'],$CurrencyRow['currdecimalplaces']), - locale_money_format($myrow['outstanding'],$CurrencyRow['currdecimalplaces'])); + locale_number_format($myrow['amt'],$CurrencyRow['currdecimalplaces']), + locale_number_format($myrow['outstanding'],$CurrencyRow['currdecimalplaces'])); $TotalUnpresentedCheques +=$myrow['outstanding']; @@ -243,9 +243,9 @@ } } //end of while loop - $TotalUnpresentedCheques = filter_number_format($TotalUnpresentedCheques); + echo '<tr></tr> - <tr class=EvenTableRows><td colspan=6>' . _('Total of all unpresented cheques') . '</td><td class="number">' . locale_money_format($TotalUnpresentedCheques,$CurrencyRow['currdecimalplaces']) . '</td></tr>'; + <tr class=EvenTableRows><td colspan=6>' . _('Total of all unpresented cheques') . '</td><td class="number">' . locale_number_format($TotalUnpresentedCheques,$CurrencyRow['currdecimalplaces']) . '</td></tr>'; $SQL = "SELECT amount/exrate AS amt, amountcleared, @@ -303,8 +303,8 @@ $myrow['typename'], $myrow['transno'], $myrow['ref'], - locale_money_format($myrow['amt'],$CurrencyRow['currdecimalplaces']), - locale_money_format($myrow['outstanding'],$CurrencyRow['currdecimalplaces']) ); + locale_number_format($myrow['amt'],$CurrencyRow['currdecimalplaces']), + locale_number_format($myrow['outstanding'],$CurrencyRow['currdecimalplaces']) ); $TotalUnclearedDeposits +=$myrow['outstanding']; @@ -318,13 +318,13 @@ echo '<tr></tr> <tr class=EvenTableRows> <td colspan=6>' . _('Total of all uncleared deposits') . '</td> - <td class="number">' . locale_money_format($TotalUnclearedDeposits,$CurrencyRow['currdecimalplaces']) . '</td> + <td class="number">' . locale_number_format($TotalUnclearedDeposits,$CurrencyRow['currdecimalplaces']) . '</td> </tr>'; - $FXStatementBalance = filter_number_format(($Balance*$CurrencyRow['rate']) - $TotalUnpresentedCheques -$TotalUnclearedDeposits); + $FXStatementBalance = ($Balance*$CurrencyRow['rate'] - $TotalUnpresentedCheques -$TotalUnclearedDeposits); echo '<tr></tr> <tr class=EvenTableRows> <td colspan=6><b>' . _('Bank statement balance should be') . ' (' . $CurrencyRow['currcode'] . ')</b></td> - <td class="number">' . locale_money_format($FXStatementBalance,$CurrencyRow['currdecimalplaces']) . '</td></tr>'; + <td class="number">' . locale_number_format($FXStatementBalance,$CurrencyRow['currdecimalplaces']) . '</td></tr>'; if (isset($_POST['DoExchangeDifference'])){ echo '<input type="hidden" name="DoExchangeDifference" value=' . $FXStatementBalance . ' />'; Modified: trunk/ConfirmDispatchControlled_Invoice.php =================================================================== --- trunk/ConfirmDispatchControlled_Invoice.php 2011-10-01 06:40:49 UTC (rev 4707) +++ trunk/ConfirmDispatchControlled_Invoice.php 2011-10-02 09:16:51 UTC (rev 4708) @@ -69,7 +69,7 @@ /*TotalQuantity set inside this include file from the sum of the bundles of the item selected for dispatch */ -$_SESSION['Items']->LineItems[$LineNo]->QtyDispatched = filter_number_format($TotalQuantity); +$_SESSION['Items']->LineItems[$LineNo]->QtyDispatched = $TotalQuantity; include('includes/footer.inc'); exit; Modified: trunk/ConfirmDispatch_Invoice.php =================================================================== --- trunk/ConfirmDispatch_Invoice.php 2011-10-01 06:40:49 UTC (rev 4707) +++ trunk/ConfirmDispatch_Invoice.php 2011-10-02 09:16:51 UTC (rev 4708) @@ -212,7 +212,7 @@ } foreach ($_SESSION['Items']->FreightTaxes as $FreightTaxLine) { if (isset($_POST['FreightTaxRate' . $FreightTaxLine->TaxCalculationOrder])){ - $_SESSION['Items']->FreightTaxes[$FreightTaxLine->TaxCalculationOrder]->TaxRate = filter_number_format(filter_number_format($_POST['FreightTaxRate' . $FreightTaxLine->TaxCalculationOrder])/100); + $_SESSION['Items']->FreightTaxes[$FreightTaxLine->TaxCalculationOrder]->TaxRate = filter_number_format($_POST['FreightTaxRate' . $FreightTaxLine->TaxCalculationOrder])/100; } } @@ -220,14 +220,14 @@ if (sizeOf($Itm->SerialItems) > 0) { $_SESSION['Items']->LineItems[$Itm->LineNumber]->QtyDispatched = 0; //initialise QtyDispatched foreach ($Itm->SerialItems as $SerialItem) { //calculate QtyDispatched from bundle quantities - $_SESSION['Items']->LineItems[$Itm->LineNumber]->QtyDispatched += filter_number_format($SerialItem->BundleQty); + $_SESSION['Items']->LineItems[$Itm->LineNumber]->QtyDispatched += $SerialItem->BundleQty; } } else if (is_numeric($_POST[$Itm->LineNumber . '_QtyDispatched' ]) AND filter_number_format($_POST[$Itm->LineNumber . '_QtyDispatched']) <= ($_SESSION['Items']->LineItems[$Itm->LineNumber]->Quantity - $_SESSION['Items']->LineItems[$Itm->LineNumber]->QtyInv)){ $_SESSION['Items']->LineItems[$Itm->LineNumber]->QtyDispatched = filter_number_format($_POST[$Itm->LineNumber . '_QtyDispatched']); } foreach ($Itm->Taxes as $TaxLine) { if (isset($_POST[$Itm->LineNumber . $TaxLine->TaxCalculationOrder . '_TaxRate'])){ - $_SESSION['Items']->LineItems[$Itm->LineNumber]->Taxes[$TaxLine->TaxCalculationOrder]->TaxRate = filter_number_format(filter_number_format($_POST[$Itm->LineNumber . $TaxLine->TaxCalculationOrder . '_TaxRate'])/100); + $_SESSION['Items']->LineItems[$Itm->LineNumber]->Taxes[$TaxLine->TaxCalculationOrder]->TaxRate = filter_number_format($_POST[$Itm->LineNumber . $TaxLine->TaxCalculationOrder . '_TaxRate'])/100; } } } //end foreach lineitem @@ -323,8 +323,8 @@ } } $DisplayDiscountPercent = locale_number_format($LnItm->DiscountPercent*100,2) . '%'; - $DisplayLineNetTotal = locale_money_format($LineTotal,$_SESSION['Items']->CurrDecimalPlaces); - $DisplayPrice = locale_money_format($LnItm->Price,$_SESSION['Items']->CurrDecimalPlaces); + $DisplayLineNetTotal = locale_number_format($LineTotal,$_SESSION['Items']->CurrDecimalPlaces); + $DisplayPrice = locale_number_format($LnItm->Price,$_SESSION['Items']->CurrDecimalPlaces); echo '<td class="number">'.$DisplayPrice.'</td> <td class="number">'.$DisplayDiscountPercent.'</td> <td class="number">'.$DisplayLineNetTotal.'</td>'; @@ -356,8 +356,7 @@ if (isset($_POST['ProcessInvoice'])) { echo $Tax->TaxRate*100; } else { - echo '<input type="text" class="number" name="' . $LnItm->LineNumber . $Tax->TaxCalculationOrder . - '_TaxRate" maxlength=4 size=4 value="' . $Tax->TaxRate*100 . '">'; + echo '<input type="text" class="number" name="' . $LnItm->LineNumber . $Tax->TaxCalculationOrder . '_TaxRate" maxlength="4" size="4" value="' . $Tax->TaxRate*100 . '" />'; } $i++; if ($Tax->TaxOnTax ==1){ @@ -373,11 +372,12 @@ $TaxTotal += $TaxLineTotal; - $DisplayTaxAmount = locale_money_format($TaxLineTotal ,$_SESSION['Items']->CurrDecimalPlaces); + $DisplayTaxAmount = locale_number_format($TaxLineTotal ,$_SESSION['Items']->CurrDecimalPlaces); - $DisplayGrossLineTotal = locale_money_format($LineTotal+ $TaxLineTotal,$_SESSION['Items']->CurrDecimalPlaces); + $DisplayGrossLineTotal = locale_number_format($LineTotal+ $TaxLineTotal,$_SESSION['Items']->CurrDecimalPlaces); - echo '<td class="number">'.$DisplayTaxAmount.'</td><td class="number">'.$DisplayGrossLineTotal.'</td>'; + echo '<td class="number">'.$DisplayTaxAmount.'</td> + <td class="number">'.$DisplayGrossLineTotal.'</td>'; if ($LnItm->Controlled==1){ if (!isset($_POST['ProcessInvoice'])) { @@ -445,11 +445,11 @@ echo '<tr> <td colspan="5" class="number">' . _('Order Freight Cost'). '</td> - <td class="number">' . $_SESSION['Old_FreightCost'] . '</td>'; + <td class="number">' . locale_number_format($_SESSION['Old_FreightCost'],$_SESSION['Items']->CurrDecimalPlaces) . '</td>'; if ($_SESSION['DoFreightCalc']==True){ echo '<td colspan="2" class="number">' ._('Recalculated Freight Cost'). '</td> - <td class="number">' . $FreightCost . '</td>'; + <td class="number">' . locale_number_format($FreightCost,$_SESSION['Items']->CurrDecimalPlaces) . '</td>'; } else { // echo '<td colspan="1"></td>'; } @@ -464,9 +464,9 @@ } else { echo '<td colspan="2" class="number">'. _('Charge Freight Cost inc Tax').'</td>'; if (isset($_POST['ProcessInvoice'])) { - echo '<td class="number">' . $_SESSION['Items']->FreightCost . '</td>'; + echo '<td class="number">' . locale_number_format($_SESSION['Items']->FreightCost,$_SESSION['Items']->CurrDecimalPlaces) . '</td>'; } else { - echo '<td class="number"><input tabindex='.$j.' type="text" class="number" size="10" maxlength="12" name="ChargeFreightCost" value="' . $_SESSION['Items']->FreightCost . '" /></td>'; + echo '<td class="number"><input tabindex='.$j.' type="text" class="number" size="10" maxlength="12" name="ChargeFreightCost" value="' . locale_number_format($_SESSION['Items']->FreightCost,$_SESSION['Items']->CurrDecimalPlaces) . '" /></td>'; } $_POST['ChargeFreightCost'] = $_SESSION['Items']->FreightCost; } @@ -496,7 +496,7 @@ echo $FreightTaxLine->TaxRate * 100 ; } else { echo '<input type="text" class="number" name="FreightTaxRate' . $FreightTaxLine->TaxCalculationOrder . - '" maxlength="4" size="4" value="' . $FreightTaxLine->TaxRate * 100 . '" />'; + '" maxlength="4" size="4" value="' . locale_number_format($FreightTaxLine->TaxRate * 100,$_SESSION['Items']->CurrDecimalPlaces) . '" />'; } if ($FreightTaxLine->TaxOnTax ==1){ @@ -511,13 +511,13 @@ } echo '</td>'; -echo '<td class="number">' . locale_money_format($FreightTaxTotal,$_SESSION['Items']->CurrDecimalPlaces) . '</td> - <td class="number">' . locale_money_format($FreightTaxTotal+ $_POST['ChargeFreightCost'],$_SESSION['Items']->CurrDecimalPlaces) . '</td> +echo '<td class="number">' . locale_number_format($FreightTaxTotal,$_SESSION['Items']->CurrDecimalPlaces) . '</td> + <td class="number">' . locale_number_format($FreightTaxTotal+ $_POST['ChargeFreightCost'],$_SESSION['Items']->CurrDecimalPlaces) . '</td> </tr>'; $TaxTotal += $FreightTaxTotal; -$DisplaySubTotal = locale_money_format(($_SESSION['Items']->total + $_POST['ChargeFreightCost']),$_SESSION['Items']->CurrDecimalPlaces); +$DisplaySubTotal = locale_number_format(($_SESSION['Items']->total + $_POST['ChargeFreightCost']),$_SESSION['Items']->CurrDecimalPlaces); /* round the totals to avoid silly entries */ @@ -529,8 +529,8 @@ <td colspan="10" class="number">' . _('Invoice Totals'). '</td> <td class="number:><hr><b>'.$DisplaySubTotal.'</b><hr></td> <td colspan="2"></td> - <td class="number"><hr><b>' . locale_money_format($TaxTotal,$_SESSION['Items']->CurrDecimalPlaces) . '</b><hr></td> - <td class="number"><hr><b>' . locale_money_format($TaxTotal+($_SESSION['Items']->total + $_POST['ChargeFreightCost']),$_SESSION['Items']->CurrDecimalPlaces) . '</b><hr></td> + <td class="number"><hr><b>' . locale_number_format($TaxTotal,$_SESSION['Items']->CurrDecimalPlaces) . '</b><hr></td> + <td class="number"><hr><b>' . locale_number_format($TaxTotal+($_SESSION['Items']->total + $_POST['ChargeFreightCost']),$_SESSION['Items']->CurrDecimalPlaces) . '</b><hr></td> </tr>'; if (! isset($_POST['DispatchDate']) OR ! Is_Date($_POST['DispatchDate'])){ @@ -764,10 +764,10 @@ '', '" . $_SESSION['Items']->DefaultSalesType . "', '" . $_SESSION['ProcessingOrder'] . "', - '" . filter_number_format($_SESSION['Items']->total) . "', - '" . filter_number_format($TaxTotal) . "', + '" . $_SESSION['Items']->total . "', + '" . $TaxTotal . "', '" . filter_number_format($_POST['ChargeFreightCost']) . "', - '" . filter_number_format($_SESSION['CurrencyRate']) . "', + '" . $_SESSION['CurrencyRate'] . "', '" . DB_escape_string($_POST['InvoiceText']) . "', '" . $_SESSION['Items']->ShipVia . "', '" . DB_escape_string($_POST['Consignment']) . "' )"; @@ -786,7 +786,7 @@ taxamount) VALUES ('" . $DebtorTransID . "', '" . $TaxAuthID . "', - '" . filter_number_format($TaxAmount/$_SESSION['CurrencyRate']) . "')"; + '" . $TaxAmount/$_SESSION['CurrencyRate'] . "')"; $ErrMsg =_('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The debtor transaction taxes records could not be inserted because'); $DbgMsg = _('The following SQL to insert the debtor transaction taxes record was used'); @@ -816,7 +816,7 @@ if ($_POST['BOPolicy']=='CAN'){ $SQL = "UPDATE salesorderdetails - SET quantity = quantity - " . filter_number_format($OrderLine->Quantity - $OrderLine->QtyDispatched) . " + SET quantity = quantity - " . ($OrderLine->Quantity - $OrderLine->QtyDispatched) . " WHERE orderno = '" . $_SESSION['ProcessingOrder'] . " ' AND stkcode = '" . $OrderLine->StockID . "'"; @@ -838,7 +838,7 @@ '" . $_SESSION['ProcessingOrder'] . "', '" . $InvoiceNo . "', '" . $OrderLine->StockID . "', - '" . filter_number_format($OrderLine->Quantity - $OrderLine->QtyDispatched) . "', + '" . $OrderLine->Quantity - $OrderLine->QtyDispatched . "', '" . $_SESSION['Items']->DebtorNo . "', '" . $_SESSION['Items']->Branch . "', 'CAN')"; @@ -866,7 +866,7 @@ '" . $_SESSION['ProcessingOrder'] . "', '" . $InvoiceNo . "', '" . $OrderLine->StockID . "', - '" . filter_number_format($OrderLine->Quantity - $OrderLine->QtyDispatched) . "', + '" . $OrderLine->Quantity - $OrderLine->QtyDispatched . "', '" . $_SESSION['Items']->DebtorNo . "', '" . $_SESSION['Items']->Branch . "', 'BO' @@ -884,14 +884,14 @@ // Test above to see if the line is completed or not if ($OrderLine->QtyDispatched>=($OrderLine->Quantity - $OrderLine->QtyInv) OR $_POST['BOPolicy']=='CAN'){ $SQL = "UPDATE salesorderdetails - SET qtyinvoiced = qtyinvoiced + " . filter_number_format($OrderLine->QtyDispatched) . ", + SET qtyinvoiced = qtyinvoiced + " . $OrderLine->QtyDispatched . ", actualdispatchdate = '" . $DefaultDispatchDate . "', completed=1 WHERE orderno = '" . $_SESSION['ProcessingOrder'] . "' AND orderlineno = '" . $OrderLine->LineNumber . "'"; } else { $SQL = "UPDATE salesorderdetails - SET qtyinvoiced = qtyinvoiced + " . filter_number_format($OrderLine->QtyDispatched) . ", + SET qtyinvoiced = qtyinvoiced + " . $OrderLine->QtyDispatched . ", actualdispatchdate = '" . $DefaultDispatchDate . "' WHERE orderno = '" . $_SESSION['ProcessingOrder'] . "' AND orderlineno = '" . $OrderLine->LineNumber . "'"; @@ -931,7 +931,7 @@ $QtyOnHandPrior = 0; } - $SQL = "UPDATE locstock SET quantity = locstock.quantity - " . filter_number_format($OrderLine->QtyDispatched) . " + $SQL = "UPDATE locstock SET quantity = locstock.quantity - " . $OrderLine->QtyDispatched . " WHERE locstock.stockid = '" . $OrderLine->StockID . "' AND loccode = '" . $_SESSION['Items']->Location . "'"; @@ -1003,10 +1003,10 @@ '" . $_SESSION['Items']->Branch . "', '" . $PeriodNo . "', '" . _('Assembly') . ': ' . $OrderLine->StockID . ' ' . _('Order') . ': ' . $_SESSION['ProcessingOrder'] . "', - '" . filter_number_format(-$AssParts['quantity'] * $OrderLine->QtyDispatched) . "', + '" . -$AssParts['quantity'] * $OrderLine->QtyDispatched . "', '" . $AssParts['standard'] . "', 0, - '" . filter_number_format($QtyOnHandPrior - $AssParts['quantity'] * $OrderLine->QtyDispatched) . "' )"; + '" . ($QtyOnHandPrior - $AssParts['quantity'] * $OrderLine->QtyDispatched) . "' )"; $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('Stock movement records for the assembly components of'). ' '. $OrderLine->StockID . ' ' . _('could not be inserted because'); $DbgMsg = _('The following SQL to insert the assembly components stock movement records was used'); @@ -1014,7 +1014,7 @@ $SQL = "UPDATE locstock - SET quantity = locstock.quantity - " . filter_number_format($AssParts['quantity'] * $OrderLine->QtyDispatched) . " + SET quantity = locstock.quantity - " . ($AssParts['quantity'] * $OrderLine->QtyDispatched) . " WHERE locstock.stockid = '" . $AssParts['component'] . "' AND loccode = '" . $_SESSION['Items']->Location . "'"; @@ -1057,13 +1057,13 @@ '" . $DefaultDispatchDate . "', '" . $_SESSION['Items']->DebtorNo . "', '" . $_SESSION['Items']->Branch . "', - '" . filter_number_format($LocalCurrencyPrice) . "', + '" . $LocalCurrencyPrice . "', '" . $PeriodNo . "', '" . $_SESSION['ProcessingOrder'] . "', - '" . filter_number_format(-$OrderLine->QtyDispatched) . "', - '" . filter_number_format($OrderLine->DiscountPercent) . "', - '" . filter_number_format($OrderLine->StandardCost) . "', - '" . filter_number_format($QtyOnHandPrior - $OrderLine->QtyDispatched) . "', + '" . -$OrderLine->QtyDispatched . "', + '" . $OrderLine->DiscountPercent . "', + '" . $OrderLine->StandardCost . "', + '" . ($QtyOnHandPrior - $OrderLine->QtyDispatched) . "', '" . DB_escape_string($OrderLine->Narrative) . "' )"; } else { // its an assembly or dummy and assemblies/dummies always have nil stock (by definition they are made up at the time of dispatch so new qty on hand will be nil @@ -1091,12 +1091,12 @@ '" . $DefaultDispatchDate . "', '" . $_SESSION['Items']->DebtorNo . "', '" . $_SESSION['Items']->Branch . "', - '" . filter_number_format($LocalCurrencyPrice) . "', + '" . $LocalCurrencyPrice . "', '" . $PeriodNo . "', '" . $_SESSION['ProcessingOrder'] . "', - '" . filter_number_format(-$OrderLine->QtyDispatched) . "', - '" . filter_number_format($OrderLine->DiscountPercent) . "', - '" . filter_number_format($OrderLine->StandardCost) . "', + '" . -$OrderLine->QtyDispatched . "', + '" . $OrderLine->DiscountPercent . "', + '" . $OrderLine->StandardCost . "', '" . DB_escape_string($OrderLine->Narrative) . "')"; } @@ -1118,7 +1118,7 @@ taxontax) VALUES ('" . $StkMoveNo . "', '" . $Tax->TaxAuthID . "', - '" . filter_number_format($Tax->TaxRate) . "', + '" . $Tax->TaxRate . "', '" . $Tax->TaxCalculationOrder . "', '" . $Tax->TaxOnTax . "')"; @@ -1134,7 +1134,7 @@ foreach($OrderLine->SerialItems as $Item){ /*We need to add the StockSerialItem record and the StockSerialMoves as well */ - $SQL = "UPDATE stockserialitems SET quantity= quantity - " . filter_number_format($Item->BundleQty) . " + $SQL = "UPDATE stockserialitems SET quantity= quantity - " . $Item->BundleQty . " WHERE stockid='" . $OrderLine->StockID . "' AND loccode='" . $_SESSION['Items']->Location . "' AND serialno='" . DB_escape_string($Item->BundleRef) . "'"; @@ -1152,7 +1152,7 @@ VALUES ('" . $StkMoveNo . "', '" . $OrderLine->StockID . "', '" . DB_escape_string($Item->BundleRef) . "', - '" . filter_number_format(-$Item->BundleQty) . "')"; + '" . -$Item->BundleQty . "')"; $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The serial stock movement record could not be inserted because'); $DbgMsg = _('The following SQL to insert the serial stock movement records was used'); @@ -1203,10 +1203,10 @@ if ($myrow[0]>0){ /*Update the existing record that already exists */ - $SQL = "UPDATE salesanalysis SET amt=amt+" . filter_number_format($OrderLine->Price * $OrderLine->QtyDispatched / $_SESSION['CurrencyRate']) . ", - cost=cost+" . filter_number_format($OrderLine->StandardCost * $OrderLine->QtyDispatched) . ", - qty=qty +" . filter_number_format($OrderLine->QtyDispatched) . ", - disc=disc+" . filter_number_format($OrderLine->DiscountPercent * $OrderLine->Price * $OrderLine->QtyDispatched / $_SESSION['CurrencyRate']) . " + $SQL = "UPDATE salesanalysis SET amt=amt+" . ($OrderLine->Price * $OrderLine->QtyDispatched / $_SESSION['CurrencyRate']) . ", + cost=cost+" . ($OrderLine->StandardCost * $OrderLine->QtyDispatched) . ", + qty=qty +" . $OrderLine->QtyDispatched . ", + disc=disc+" . ($OrderLine->DiscountPercent * $OrderLine->Price * $OrderLine->QtyDispatched / $_SESSION['CurrencyRate']) . " WHERE salesanalysis.area='" . $myrow[5] . "' AND salesanalysis.salesperson='" . $myrow[8] . "' AND typeabbrev ='" . $_SESSION['Items']->DefaultSalesType . "' @@ -1234,12 +1234,12 @@ stkcategory ) SELECT '" . $_SESSION['Items']->DefaultSalesType . "', '" . $PeriodNo . "', - '" . filter_number_format($OrderLine->Price * $OrderLine->QtyDispatched / $_SESSION['CurrencyRate']) . "', - '" . filter_number_format($OrderLine->StandardCost * $OrderLine->QtyDispatched) . "', + '" . ($OrderLine->Price * $OrderLine->QtyDispatched / $_SESSION['CurrencyRate']) . "', + '" . ($OrderLine->StandardCost * $OrderLine->QtyDispatched) . "', '" . $_SESSION['Items']->DebtorNo . "', '" . $_SESSION['Items']->Branch . "', - '" . filter_number_format($OrderLine->QtyDispatched) . "', - '" . filter_number_format($OrderLine->DiscountPercent * $OrderLine->Price * $OrderLine->QtyDispatched / $_SESSION['CurrencyRate']) . "', + '" . ($OrderLine->QtyDispatched) . "', + '" . ($OrderLine->DiscountPercent * $OrderLine->Price * $OrderLine->QtyDispatched / $_SESSION['CurrencyRate']) . "', '" . $OrderLine->StockID . "', custbranch.area, 1, @@ -1276,7 +1276,7 @@ '" . $PeriodNo . "', '" . GetCOGSGLAccount($Area, $OrderLine->StockID, $_SESSION['Items']->DefaultSalesType, $db) . "', '" . $_SESSION['Items']->DebtorNo . " - " . $OrderLine->StockID . " x " . $OrderLine->QtyDispatched . " @ " . $OrderLine->StandardCost . "', - '" . filter_number_format($OrderLine->StandardCost * $OrderLine->QtyDispatched) . "')"; + '" . ($OrderLine->StandardCost * $OrderLine->QtyDispatched) . "')"; $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The cost of sales GL posting could not be inserted because'); $DbgMsg = _('The following SQL to insert the GLTrans record was used'); @@ -1299,7 +1299,7 @@ '" . $PeriodNo . "', '" . $StockGLCode['stockact'] . "', '" . $_SESSION['Items']->DebtorNo . " - " . $OrderLine->StockID . " x " . $OrderLine->QtyDispatched . " @ " . $OrderLine->StandardCost . "', - '" . filter_number_format(-$OrderLine->StandardCost * $OrderLine->QtyDispatched) . "')"; + '" . (-$OrderLine->StandardCost * $OrderLine->QtyDispatched) . "')"; $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The stock side of the cost of sales GL posting could not be inserted because'); $DbgMsg = _('The following SQL to insert the GLTrans record was used'); @@ -1326,7 +1326,7 @@ '" . $PeriodNo . "', '" . $SalesGLAccounts['salesglcode'] . "', '" . $_SESSION['Items']->DebtorNo . " - " . $OrderLine->StockID . " x " . $OrderLine->QtyDispatched . " @ " . $OrderLine->Price . "', - '" . filter_number_format(-$OrderLine->Price * $OrderLine->QtyDispatched/$_SESSION['CurrencyRate']) . "')"; + '" . (-$OrderLine->Price * $OrderLine->QtyDispatched/$_SESSION['CurrencyRate']) . "')"; $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The sales GL posting could not be inserted because'); $DbgMsg = '<br />' ._('The following SQL to insert the GLTrans record was used'); @@ -1348,7 +1348,7 @@ '" . $PeriodNo . "', '" . $SalesGLAccounts['discountglcode'] . "', '" . $_SESSION['Items']->DebtorNo . " - " . $OrderLine->StockID . " @ " . ($OrderLine->DiscountPercent * 100) . "%', - '" . filter_number_format($OrderLine->Price * $OrderLine->QtyDispatched * $OrderLine->DiscountPercent/$_SESSION['CurrencyRate']) . "')"; + '" . ($OrderLine->Price * $OrderLine->QtyDispatched * $OrderLine->DiscountPercent/$_SESSION['CurrencyRate']) . "')"; $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The sales discount GL posting could not be inserted because'); $DbgMsg = _('The following SQL to insert the GLTrans record was used'); @@ -1394,7 +1394,7 @@ '" . $PeriodNo . "', '" . $DisposalRow['accumdepnact'] . "', '" . $_SESSION['Items']->DebtorNo . ' - ' . $OrderLine->StockID . ' ' . _('disposal') . "', - '" . filter_number_format(-$DisposalRow['accumdpen']) . "')"; + '" . -$DisposalRow['accumdpen'] . "')"; $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The reversal of accumulated depreciation GL posting on disposal could not be inserted because'); $DbgMsg = _('The following SQL to insert the GLTrans record was used'); @@ -1416,7 +1416,7 @@ '" . $PeriodNo . "', '" . $DisposalRow['costact'] . "', '" . $_SESSION['Items']->DebtorNo . " - " . $OrderLine->StockID . ' ' . _('disposal') . "', - '" . filter_number_format(-$DisposalRow['cost']) . "')"; + '" . -$DisposalRow['cost'] . "')"; $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The reversal of asset cost on dispoal GL posting could not be inserted because'); $DbgMsg = _('The following SQL to insert the GLTrans record was used'); @@ -1438,7 +1438,7 @@ '" . $PeriodNo . "', '" . $DisposalRow['disposalact'] . "', '" . $_SESSION['Items']->DebtorNo . " - " . $OrderLine->StockID . ' ' . _('disposal') . "', - '" . filter_number_format($DisposalRow['cost']-$DisposalRow['accumdepn']) . "')"; + '" . ($DisposalRow['cost']-$DisposalRow['accumdepn']) . "')"; $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The disposal net book value GL posting could not be inserted because'); $DbgMsg = '<br />' ._('The following SQL to insert the GLTrans record was used'); @@ -1460,7 +1460,7 @@ '" . $PeriodNo . "', '" . $DisposalRow['disposalact'] . "', '" . $_SESSION['Items']->DebtorNo . " - " . $OrderLine->StockID . ' ' . _('disposal') . "', - '" . filter_number_format(-$OrderLine->Price * $OrderLine->QtyDispatched* (1 - $OrderLine->DiscountPercent)/$_SESSION['CurrencyRate']) . "')"; + '" . (-$OrderLine->Price * $OrderLine->QtyDispatched* (1 - $OrderLine->DiscountPercent)/$_SESSION['CurrencyRate']) . "')"; $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The disposal proceeds GL posting could not be inserted because'); $DbgMsg = '<br />' ._('The following SQL to insert the GLTrans record was used'); @@ -1488,14 +1488,14 @@ '" . $PeriodNo . "', '" . Date('Y-m-d') . "', 'disposal', - '" . filter_number_format($OrderLine->Price * $OrderLine->QtyDispatched* (1 - $OrderLine->DiscountPercent)/$_SESSION['CurrencyRate']) . "', + '" . ($OrderLine->Price * $OrderLine->QtyDispatched* (1 - $OrderLine->DiscountPercent)/$_SESSION['CurrencyRate']) . "', '" . $DefaultDispatchDate . "')"; $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The fixed asset transaction could not be inserted because'); $DbgMsg = '<br />' ._('The following SQL to insert the fixed asset transaction record was used'); $Result = DB_query($SQL,$db,$ErrMsg,$DbgMsg,true); $SQL = "UPDATE fixedassets - SET disposalproceeds ='" . filter_number_format($OrderLine->Price * $OrderLine->QtyDispatched* (1 - $OrderLine->DiscountPercent)/$_SESSION['CurrencyRate']) . "', + SET disposalproceeds ='" . ($OrderLine->Price * $OrderLine->QtyDispatched* (1 - $OrderLine->DiscountPercent)/$_SESSION['CurrencyRate']) . "', disposaldate ='" . $DefaultDispatchDate . "' WHERE assetid ='" . $AssetNumber . "'"; @@ -1526,7 +1526,7 @@ '" . $PeriodNo . "', '" . $_SESSION['CompanyRecord']['debtorsact'] . "', '" . $_SESSION['Items']->DebtorNo . "', - '" . filter_number_format(($_SESSION['Items']->total + $_SESSION['Items']->FreightCost + $TaxTotal)/$_SESSION['CurrencyRate']) . "')"; + '" . (($_SESSION['Items']->total + $_SESSION['Items']->FreightCost + $TaxTotal)/$_SESSION['CurrencyRate']) . "')"; $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The total debtor GL posting could not be inserted because'); $DbgMsg = _('The following SQL to insert the total debtors control GLTrans record was used'); @@ -1551,7 +1551,7 @@ '" . $PeriodNo . "', '" . $_SESSION['CompanyRecord']['freightact'] . "', '" . $_SESSION['Items']->DebtorNo . "', - '" . filter_number_format(-($_SESSION['Items']->FreightCost)/$_SESSION['CurrencyRate']) . "')"; + '" . (-$_SESSION['Items']->FreightCost/$_SESSION['CurrencyRate']) . "')"; $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The freight GL posting could not be inserted because'); $DbgMsg = _('The following SQL to insert the GLTrans record was used'); @@ -1573,7 +1573,7 @@ '" . $PeriodNo . "', '" . $TaxGLCodes[$TaxAuthID] . "', '" . $_SESSION['Items']->DebtorNo . "', - '" . filter_number_format(-$TaxAmount/$_SESSION['CurrencyRate']) . "')"; + '" . (-$TaxAmount/$_SESSION['CurrencyRate']) . "')"; $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The tax GL posting could not be inserted because'); $DbgMsg = _('The following SQL to insert the GLTrans record was used'); Modified: trunk/CounterSales.php =================================================================== --- trunk/CounterSales.php 2011-10-01 06:40:49 UTC (rev 4707) +++ trunk/CounterSales.php 2011-10-02 09:16:51 UTC (rev 4708) @@ -15,6 +15,8 @@ include('includes/SQL_CommonFunctions.inc'); include('includes/GetSalesTransGLCodes.inc'); +$AlreadyWarnedAboutCredit = false; + if (empty($_GET['identifier'])) { $identifier=date('U'); } else { @@ -36,7 +38,8 @@ if (isset($_POST['SelectingOrderItems'])){ foreach ($_POST as $FormVariable => $Quantity) { if (mb_strpos($FormVariable,'OrderQty')!==false) { - $NewItemArray[$_POST['StockID' . mb_substr($FormVariable,8)]] = filter_number_format(trim($Quantity)); + $NewItemArray[$_POST['StockID' . mb_substr($FormVariable,8)]] = filter_number_format($Quantity); + echo '<br/> The quantitiy entered was ' . filter_number_format($Quantity) . ' the quantity for ' . $_POST['StockID' . mb_substr($FormVariable,8)] . ' unfiltered was: ' . $Quantity; } } } @@ -483,12 +486,12 @@ foreach ($_SESSION['Items'.$identifier]->LineItems as $OrderLine) { if (isset($_POST['Quantity_' . $OrderLine->LineNumber])){ - + $Quantity = filter_number_format($_POST['Quantity_' . $OrderLine->LineNumber]); if (abs($OrderLine->Price - filter_number_format($_POST['Price_' . $OrderLine->LineNumber]))>0.01){ $Price = filter_number_format($_POST['Price_' . $OrderLine->LineNumber]); - $_POST['GPPercent_' . $OrderLine->LineNumber] = filter_number_format((($Price*(1-(filter_number_format($_POST['Discount_' . $OrderLine->LineNumber])/100))) - $OrderLine->StandardCost*$ExRate)/($Price *(1-filter_number_format($_POST['Discount_' . $OrderLine->LineNumber]))/100)); + $_POST['GPPercent_' . $OrderLine->LineNumber] = (($Price*(1-(filter_number_format($_POST['Discount_' . $OrderLine->LineNumber])/100))) - $OrderLine->StandardCost*$ExRate)/($Price *(1-filter_number_format($_POST['Discount_' . $OrderLine->LineNumber]))/100); } else if (abs($OrderLine->GPPercent - filter_number_format($_POST['GPPercent_' . $OrderLine->LineNumber]))>=0.001) { //then do a recalculation of the price at this new GP Percentage $Price = ($OrderLine->StandardCost*$ExRate)/(1 -((filter_number_format($_POST['GPPercent_' . $OrderLine->LineNumber]) + filter_number_format($_POST['Discount_' . $OrderLine->LineNumber]))/100)); @@ -518,7 +521,7 @@ $_SESSION['Items'.$identifier]->update_cart_item($OrderLine->LineNumber, $Quantity, $Price, - filter_number_format($DiscountPercentage/100), + $DiscountPercentage/100, $Narrative, 'Yes', /*Update DB */ $_POST['ItemDue_' . $OrderLine->LineNumber], @@ -769,16 +772,16 @@ echo '<td><a target="_blank" href="' . $rootpath . '/StockStatus.php?identifier='.$identifier . '&StockID=' . $OrderLine->StockID . '&DebtorNo=' . $_SESSION['Items'.$identifier]->DebtorNo . '">' . $OrderLine->StockID . '</a></td> <td>' . $OrderLine->ItemDescription . '</td>'; - echo '<td><input class="number" tabindex="2" type="text" name="Quantity_' . $OrderLine->LineNumber . '" size="6" maxlength="6" value="' . $OrderLine->Quantity . '" />'; + echo '<td><input class="number" tabindex="2" type="text" name="Quantity_' . $OrderLine->LineNumber . '" size="6" maxlength="6" value="' . locale_number_format($OrderLine->Quantity,$OrderLine->DecimalPlaces) . '" />'; echo '</td> - <td class="number">' . $OrderLine->QOHatLoc . '</td> + <td class="number">' . locale_number_format($OrderLine->QOHatLoc,$OrderLine->DecimalPlaces) . '</td> <td>' . $OrderLine->Units . '</td>'; - echo '<td><input class="number" type="text" name="Price_' . $OrderLine->LineNumber . '" size="16" maxlength="16" value="' . $OrderLine->Price . '" /></td> - <td><input class="number" type="text" name="Discount_' . $OrderLine->LineNumber . '" size="5" maxlength="4" value="' . ($OrderLine->DiscountPercent * 100) . '" /></td> - <td><input class="number" type="text" name="GPPercent_' . $OrderLine->LineNumber . '" size="3" maxlength="40" value="' . $OrderLine->GPPercent . '" /></td>'; - echo '<td class="number">' . locale_money_format($SubTotal,$_SESSION['Items'.$identifier]->CurrDecimalPlaces) . '</td>'; + echo '<td><input class="number" type="text" name="Price_' . $OrderLine->LineNumber . '" size="16" maxlength="16" value="' . locale_number_format($OrderLine->Price,$_SESSION['Items'.$identifier]->CurrDecimalPlaces) . '" /></td> + <td><input class="number" type="text" name="Discount_' . $OrderLine->LineNumber . '" size="5" maxlength="4" value="' . locale_number_format(($OrderLine->DiscountPercent * 100),2) . '" /></td> + <td><input class="number" type="text" name="GPPercent_' . $OrderLine->LineNumber . '" size="3" maxlength="40" value="' . locale_number_format($OrderLine->GPPercent,2) . '" /></td>'; + echo '<td class="number">' . locale_number_format($SubTotal,$_SESSION['Items'.$identifier]->CurrDecimalPlaces) . '</td>'; $LineDueDate = $OrderLine->ItemDue; if (!Is_Date($OrderLine->ItemDue)){ $LineDueDate = DateAdd (Date($_SESSION['DefaultDateFormat']),'d', $_SESSION['Items'.$identifier]->DeliveryDays); @@ -804,8 +807,8 @@ $TaxTotal += $TaxLineTotal; $_SESSION['Items'.$identifier]->TaxTotals=$TaxTotals; $_SESSION['Items'.$identifier]->TaxGLCodes=$TaxGLCodes; - echo '<td class="number">' . locale_money_format($TaxLineTotal ,$_SESSION['Items'.$identifier]->CurrDecimalPlaces) . '</td>'; - echo '<td class="number">' . locale_money_format($SubTotal + $TaxLineTotal ,$_SESSION['Items'.$identifier]->CurrDecimalPlaces) . '</td>'; + echo '<td class="number">' . locale_number_format($TaxLineTotal ,$_SESSION['Items'.$identifier]->CurrDecimalPlaces) . '</td>'; + echo '<td class="number">' . locale_number_format($SubTotal + $TaxLineTotal ,$_SESSION['Items'.$identifier]->CurrDecimalPlaces) . '</td>'; echo '<td><a href="' . $_SERVER['PHP_SELF'] . '?identifier='.$identifier . '&Delete=' . $OrderLine->LineNumber . '" onclick="return confirm(\'' . _('Are You Sure?') . '\');">' . _('Delete') . '</a></td></tr>'; if ($_SESSION['AllowOrderLineItemNarrative'] == 1){ @@ -822,9 +825,9 @@ } /* end of loop around items */ echo '<tr class="EvenTableRows"><td colspan="8" class="number"><b>' . _('Total') . '</b></td> - <td class="number">' . locale_money_format(($_SESSION['Items'.$identifier]->total),$_SESSION['Items'.$identifier]->CurrDecimalPlaces) . '</td> - <td class="number">' . locale_money_format($TaxTotal,$_SESSION['Items'.$identifier]->CurrDecimalPlaces) . '</td> - <td class="number">' . locale_money_format(($_SESSION['Items'.$identifier]->total+$TaxTotal),$_SESSION['Items'.$identifier]->CurrDecimalPlaces) . '</td> + <td class="number">' . locale_number_format(($_SESSION['Items'.$identifier]->total),$_SESSION['Items'.$identifier]->CurrDecimalPlaces) . '</td> + <td class="number">' . locale_number_format($TaxTotal,$_SESSION['Items'.$identifier]->CurrDecimalPlaces) . '</td> + <td class="number">' . locale_number_format(($_SESSION['Items'.$identifier]->total+$TaxTotal),$_SESSION['Items'.$identifier]->CurrDecimalPlaces) . '</td> </tr> </table>'; echo '<input type="hidden" name="TaxTotal" value="'.$TaxTotal.'" />'; @@ -1889,7 +1892,7 @@ '" . $BankAccountExRate . "', '" . $DefaultDispatchDate . "', '" . $_POST['PaymentMethod'] . "', - '" . filter_number_format(filter_number_format($_POST['AmountPaid']) * $BankAccountExRate) . "', + '" . filter_number_format($_POST['AmountPaid']) * $BankAccountExRate . "', '" . $_SESSION['Items'.$identifier]->DefaultCurrency . "')"; $DbgMsg = _('The SQL that failed to insert the bank account transaction was'); Modified: trunk/Credit_Invoice.php =================================================================== --- trunk/Credit_Invoice.php 2011-10-01 06:40:49 UTC (rev 4707) +++ trunk/Credit_Invoice.php 2011-10-02 09:16:51 UTC (rev 4708) @@ -293,11 +293,11 @@ $j=0; //row counter foreach ($_SESSION['CreditItems']->LineItems as $LnItm) { - $LineTotal =(filter_number_format($LnItm->QtyDispatched) * filter_number_format($LnItm->Price) * (1 - filter_number_format($LnItm->DiscountPercent))); + $LineTotal = $LnItm->QtyDispatched * $LnItm->Price * (1 - $LnItm->DiscountPercent); if (!isset($_POST['ProcessCredit'])) { $_SESSION['CreditItems']->total += $LineTotal; - $_SESSION['CreditItems']->totalVolume += (filter_number_format($LnItm->QtyDispatched) * filter_number_format($LnItm->Volume)); - $_SESSION['CreditItems']->totalWeight += (filter_number_format($LnItm->QtyDispatched) * filter_number_format($LnItm->Weight)); + $_SESSION['CreditItems']->totalVolume += ($LnItm->QtyDispatched * $LnItm->Volume); + $_SESSION['CreditItems']->totalWeight += ($LnItm->QtyDispatched * $LnItm->Weight); if ($k==1){ $RowStarter = 'class="EvenTableRows"'; @@ -323,7 +323,7 @@ } - $DisplayLineTotal = locale_money_format($LineTotal,$_SESSION['CreditItems']->CurrDecimalPlaces); + $DisplayLineTotal = locale_number_format($LineTotal,$_SESSION['CreditItems']->CurrDecimalPlaces); $j++; echo '<td><input tabindex=' . $j . ' type="text" class="number" name="Price_' . $LnItm->LineNumber . '" maxlength=12 size=6 value=' . $LnItm->Price . '></td> @@ -370,8 +370,8 @@ } $TaxTotal += $TaxLineTotal; - $DisplayTaxAmount = locale_money_format($TaxLineTotal ,$_SESSION['CreditItems']->CurrDecimalPlaces); - $DisplayGrossLineTotal = locale_money_format($LineTotal+ $TaxLineTotal,$_SESSION['CreditItems']->CurrDecimalPlaces); + $DisplayTaxAmount = locale_number_format($TaxLineTotal ,$_SESSION['CreditItems']->CurrDecimalPlaces); + $DisplayGrossLineTotal = locale_number_format($LineTotal+ $TaxLineTotal,$_SESSION['CreditItems']->CurrDecimalPlaces); if (!isset($_POST['ProcessCredit'])) { echo '</td>'; @@ -392,7 +392,7 @@ if (!isset($_POST['ProcessCredit'])) { echo '<tr> <td colspan="3" class="number">' . _('Freight cost charged on invoice') . '</td> - <td class="number">' . locale_money_format($_SESSION['Old_FreightCost'],$_SESSION['CreditItems']->CurrDecimalPlaces) . '</td> + <td class="number">' . locale_number_format($_SESSION['Old_FreightCost'],$_SESSION['CreditItems']->CurrDecimalPlaces) . '</td> <td></td> <td colspan="2" class="number">' . _('Credit Freight Cost') . '</td> <td><input tabindex='.$j.' type="text" class="number" size="6" maxlength="6" name="ChargeFreightCost" value="' . $_SESSION['CreditItems']->FreightCost . '"></td>'; @@ -432,21 +432,21 @@ } if (!isset($_POST['ProcessCredit'])) { echo '</td>'; - echo '<td class="number">' . locale_money_format($FreightTaxTotal,$_SESSION['CreditItems']->CurrDecimalPlaces) . '</td> - <td class="number">' . locale_money_format($FreightTaxTotal+ $_SESSION['CreditItems']->FreightCost,$_SESSION['CreditItems']->CurrDecimalPlaces) . '</td> + echo '<td class="number">' . locale_number_format($FreightTaxTotal,$_SESSION['CreditItems']->CurrDecimalPlaces) . '</td> + <td class="number">' . locale_number_format($FreightTaxTotal+ $_SESSION['CreditItems']->FreightCost,$_SESSION['CreditItems']->CurrDecimalPlaces) . '</td> </tr>'; } $TaxTotal += $FreightTaxTotal; -$DisplayTotal = locale_money_format($_SESSION['CreditItems']->total + $_SESSION['CreditItems']->FreightCost,$_SESSION['CreditItems']->CurrDecimalPlaces); +$DisplayTotal = locale_number_format($_SESSION['CreditItems']->total + $_SESSION['CreditItems']->FreightCost,$_SESSION['CreditItems']->CurrDecimalPlaces); if (!isset($_POST['ProcessCredit'])) { echo '<tr> <td colspan="7" class="number">' . _('Credit Totals') . '</td> <td class="number"><hr><b>' . $DisplayTotal . '</b><hr></td> <td colspan=2></td> - <td class="number"><hr><b>' . locale_money_format($TaxTotal,$_SESSION['CreditItems']->CurrDecimalPlaces) . '<hr></td> - <td class="number"><hr><b>' . locale_money_format($TaxTotal+($_SESSION['CreditItems']->total + $_SESSION['CreditItems']->FreightCost),$_SESSION['CreditItems']->CurrDecimalPlaces) . '</b><hr></td> + <td class="number"><hr><b>' . locale_number_format($TaxTotal,$_SESSION['CreditItems']->CurrDecimalPlaces) . '<hr></td> + <td class="number"><hr><b>' . locale_number_format($TaxTotal+($_SESSION['CreditItems']->total + $_SESSION['CreditItems']->FreightCost),$_SESSION['CreditItems']->CurrDecimalPlaces) . '</b><hr></td> </tr></table>'; } $DefaultDispatchDate = Date($_SESSION['DefaultDateFormat']); @@ -530,7 +530,7 @@ /*Now need to update the invoice DebtorTrans record for the amount to be allocated and if the invoice is now settled*/ $SQL = "UPDATE debtortrans - SET alloc = alloc + " . filter_number_format($Allocate_amount) . ", + SET alloc = alloc + " . $Allocate_amount . ", settled='" . $SettledInvoice . "' WHERE transno = '" . $_SESSION['ProcessingCredit'] . "' AND type=10"; @@ -568,12 +568,12 @@ 'Inv-" . $_SESSION['ProcessingCredit'] . "', '" . $_SESSION['CreditItems']->DefaultSalesType . "', '" . $_SESSION['CreditItems']->OrderNo . "', - '" . -filter_number_format($_SESSION['CreditItems']->total) . "', - '" . -filter_number_format($TaxTotal) . "', - '" . -filter_number_format($_SESSION['CreditItems']->FreightCost) . "', + '" . -$_SESSION['CreditItems']->total . "', + '" . -$TaxTotal . "', + '" . -$_SESSION['CreditItems']->FreightCost . "', '" . $_SESSION['CurrencyRate'] . "', '" . DB_escape_string($_POST['CreditText']) . "', - '" . -filter_number_format($Allocate_amount) . "', + '" . -$Allocate_amount . "', '" . $Settled . "')"; $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The customer credit note transaction could not be added to the database because'); @@ -591,7 +591,7 @@ taxamount) VALUES ('" . $CreditTransID . "', '" . $TaxAuthID . "', - '" . -filter_number_format($TaxAmount/$_SESSION['CurrencyRate']) . "')"; + '" . -$TaxAmount/$_SESSION['CurrencyRate'] . "')"; $ErrMsg =_('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The debtor transaction taxes records could not be inserted because'); $DbgMsg = _('The following SQL to insert the debtor transaction taxes record was used'); @@ -604,7 +604,7 @@ transid_allocfrom, transid_allocto, datealloc) - VALUES ('" . filter_number_format($Allocate_amount) . "', + VALUES ('" . $Allocate_amount . "', '" . $CreditTransID . "', '" . $_SESSION['CreditItems']->TransID . "', '" . Date('Y-m-d') . "')"; @@ -653,7 +653,7 @@ /* some want this some do not */ $SQL = "UPDATE salesorderdetails - SET qtyinvoiced = qtyinvoiced - " . filter_number_format($CreditLine->QtyDispatched) . ", + SET qtyinvoiced = qtyinvoiced - " . $CreditLine->QtyDispatched . ", completed=0 WHERE orderno = '" . $_SESSION['CreditItems']->OrderNo . "' AND stkcode = '" . $CreditLine->StockID . "' @@ -668,7 +668,7 @@ if ($MBFlag=='B' OR $MBFlag=='M') { $SQL = "UPDATE locstock - SET locstock.quantity = locstock.quantity + " . filter_number_format($CreditLine->QtyDispatched) . " + SET locstock.quantity = locstock.quantity + " . $CreditLine->QtyDispatched . " WHERE locstock.stockid = '" . $CreditLine->StockID . "' AND loccode = '" . $_SESSION['CreditItems']->Location . "'"; @@ -751,10 +751,10 @@ '" . $_SESSION['CreditItems']->Branch . "', '" . $PeriodNo . "', '" . _('Ex Inv') . ': ' . $_SESSION['ProcessingCredit'] . ' ' . _('Assembly') . ': ' . $CreditLine->StockID . "', - '" . filter_number_format($AssParts['quantity'] * $CreditLine->QtyDispatched) . "', + '" . $AssParts['quantity'] * $CreditLine->QtyDispatched . "', '" . $AssParts['standard'] . "', 0, - '" . filter_number_format($QtyOnHandPrior + ($AssParts['quantity'] * filter_number_format($CreditLine->QtyDispatched))) . "' + '" . $QtyOnHandPrior + ($AssParts['quantity'] * $CreditLine->QtyDispatched) . "' )"; } else { @@ -779,7 +779,7 @@ '" . $_SESSION[... [truncated message content] |
From: <dai...@us...> - 2011-10-02 09:17:02
|
Revision: 4708 http://web-erp.svn.sourceforge.net/web-erp/?rev=4708&view=rev Author: daintree Date: 2011-10-02 09:16:51 +0000 (Sun, 02 Oct 2011) Log Message: ----------- number_formats Modified Paths: -------------- trunk/AgedDebtors.php trunk/AgedSuppliers.php trunk/BankReconciliation.php trunk/ConfirmDispatchControlled_Invoice.php trunk/ConfirmDispatch_Invoice.php trunk/CounterSales.php trunk/Credit_Invoice.php trunk/DeliveryDetails.php trunk/GLAccountReport.php trunk/Numbers/Words/lang.bg.php trunk/Numbers/Words/lang.fr.php trunk/Numbers/Words/lang.fr_BE.php trunk/PDFBankingSummary.php trunk/PDFChequeListing.php trunk/PDFCustTransListing.php trunk/PDFCustomerList.php trunk/PDFLowGP.php trunk/PDFPickingList.php trunk/PDFPriceList.php trunk/PDFPrintLabel.php trunk/PDFQuotation.php trunk/PDFQuotationPortrait.php trunk/PDFReceipt.php trunk/PDFRemittanceAdvice.php trunk/PDFSuppTransListing.php trunk/PDFTopItems.php trunk/POReport.php trunk/PO_AuthorisationLevels.php trunk/PO_Items.php trunk/PO_OrderDetails.php trunk/PO_PDFPurchOrder.php trunk/PO_SelectPurchOrder.php trunk/PcAssignCashToTab.php trunk/PcAuthorizeExpenses.php trunk/PcClaimExpensesFromTab.php trunk/PcReportTab.php trunk/PricesByCost.php trunk/PrintCheque.php trunk/PrintCustStatements.php trunk/PrintCustTrans.php trunk/PrintCustTransPortrait.php trunk/PurchData.php trunk/RecurringSalesOrders.php trunk/ReverseGRN.php trunk/SMTPServer.php trunk/SalesByTypePeriodInquiry.php trunk/SalesCategoryPeriodInquiry.php trunk/SalesInquiry.php trunk/SalesPeople.php trunk/SalesTopItemsInquiry.php trunk/SelectCompletedOrder.php trunk/SelectCreditItems.php trunk/SelectCustomer.php trunk/SelectOrderItems.php trunk/SelectProduct.php trunk/SelectRecurringSalesOrder.php trunk/SelectSalesOrder.php trunk/SelectSupplier.php trunk/SelectWorkOrder.php trunk/ShipmentCosting.php trunk/Shipments.php trunk/SpecialOrder.php trunk/StockAdjustments.php trunk/doc/Change.log trunk/includes/DefineCartClass.php trunk/includes/DefineSpecialOrderClass.php trunk/includes/LanguageSetup.php trunk/includes/LanguagesArray.php trunk/includes/MiscFunctions.php trunk/includes/SelectOrderItems_IntoCart.inc trunk/includes/phplot/phplot.php trunk/includes/session.inc trunk/includes/tcpdf/tcpdf.php Added Paths: ----------- trunk/css/aguapop/ trunk/css/aguapop/README.txt trunk/css/aguapop/default.css trunk/css/aguapop/default.css_large trunk/css/aguapop/footer.inc.NEW trunk/css/aguapop/images/ trunk/css/aguapop/images/Graphique-32.png trunk/css/aguapop/images/allocation.png trunk/css/aguapop/images/ar.png trunk/css/aguapop/images/back.png trunk/css/aguapop/images/bank.png trunk/css/aguapop/images/bar.png trunk/css/aguapop/images/body_bg.png trunk/css/aguapop/images/button_bg.png trunk/css/aguapop/images/company.png trunk/css/aguapop/images/contract.png trunk/css/aguapop/images/currency.png trunk/css/aguapop/images/customer.png trunk/css/aguapop/images/error.png trunk/css/aguapop/images/folder_add.png trunk/css/aguapop/images/footer.png trunk/css/aguapop/images/gl.png trunk/css/aguapop/images/group_add.png trunk/css/aguapop/images/input.png trunk/css/aguapop/images/input_bg.png trunk/css/aguapop/images/inputh.png trunk/css/aguapop/images/inputhtxt.png trunk/css/aguapop/images/inputtxt.png trunk/css/aguapop/images/inquireies.png trunk/css/aguapop/images/inventory.png trunk/css/aguapop/images/magnifier.png trunk/css/aguapop/images/maintenance.png trunk/css/aguapop/images/money_add.png trunk/css/aguapop/images/money_delete.png trunk/css/aguapop/images/note_add.png trunk/css/aguapop/images/pdf.png trunk/css/aguapop/images/preview.png trunk/css/aguapop/images/printer.png trunk/css/aguapop/images/reports.png trunk/css/aguapop/images/sales.png trunk/css/aguapop/images/stripe.png trunk/css/aguapop/images/supplier.png trunk/css/aguapop/images/tab_bg.png trunk/css/aguapop/images/top.png trunk/css/aguapop/images/top_bg.png trunk/css/aguapop/images/transactions.png trunk/css/aguapop/images/user.png trunk/css/aguapop/images/x-mail-distribution-list.png trunk/css/aguapop/login.css Modified: trunk/AgedDebtors.php =================================================================== --- trunk/AgedDebtors.php 2011-10-01 06:40:49 UTC (rev 4707) +++ trunk/AgedDebtors.php 2011-10-02 09:16:51 UTC (rev 4708) @@ -291,11 +291,11 @@ while ($AgedAnalysis = DB_fetch_array($CustomerResult,$db)){ $DecimalPlaces = $AgedAnalysis['decimalplaces']; - $DisplayDue = locale_money_format($AgedAnalysis['due']-$AgedAnalysis['overdue1'],$DecimalPlaces); - $DisplayCurrent = locale_money_format($AgedAnalysis['balance']-$AgedAnalysis['due'],$DecimalPlaces); - $DisplayBalance = locale_money_format($AgedAnalysis['balance'],$DecimalPlaces); - $DisplayOverdue1 = locale_money_format($AgedAnalysis['overdue1']-$AgedAnalysis['overdue2'],$DecimalPlaces); - $DisplayOverdue2 = locale_money_format($AgedAnalysis['overdue2'],$DecimalPlaces); + $DisplayDue = locale_number_format($AgedAnalysis['due']-$AgedAnalysis['overdue1'],$DecimalPlaces); + $DisplayCurrent = locale_number_format($AgedAnalysis['balance']-$AgedAnalysis['due'],$DecimalPlaces); + $DisplayBalance = locale_number_format($AgedAnalysis['balance'],$DecimalPlaces); + $DisplayOverdue1 = locale_number_format($AgedAnalysis['overdue1']-$AgedAnalysis['overdue2'],$DecimalPlaces); + $DisplayOverdue2 = locale_number_format($AgedAnalysis['overdue2'],$DecimalPlaces); $TotBal += $AgedAnalysis['balance']; $TotDue += ($AgedAnalysis['due']-$AgedAnalysis['overdue1']); @@ -384,11 +384,11 @@ $DisplayTranDate = ConvertSQLDate($DetailTrans['trandate']); $LeftOvers = $pdf->addTextWrap($Left_Margin+125,$YPos,75,$FontSize,$DisplayTranDate,'left'); - $DisplayDue = locale_money_format($DetailTrans['due']-$DetailTrans['overdue1'],$DecimalPlaces); - $DisplayCurrent = locale_money_format($DetailTrans['balance']-$DetailTrans['due'],$DecimalPlaces); - $DisplayBalance = locale_money_format($DetailTrans['balance'],$DecimalPlaces); - $DisplayOverdue1 = locale_money_format($DetailTrans['overdue1']-$DetailTrans['overdue2'],$DecimalPlaces); - $DisplayOverdue2 = locale_money_format($DetailTrans['overdue2'],$DecimalPlaces); + $DisplayDue = locale_number_format($DetailTrans['due']-$DetailTrans['overdue1'],$DecimalPlaces); + $DisplayCurrent = locale_number_format($DetailTrans['balance']-$DetailTrans['due'],$DecimalPlaces); + $DisplayBalance = locale_number_format($DetailTrans['balance'],$DecimalPlaces); + $DisplayOverdue1 = locale_number_format($DetailTrans['overdue1']-$DetailTrans['overdue2'],$DecimalPlaces); + $DisplayOverdue2 = locale_number_format($DetailTrans['overdue2'],$DecimalPlaces); $LeftOvers = $pdf->addTextWrap(220,$YPos,60,$FontSize,$DisplayBalance,'right'); $LeftOvers = $pdf->addTextWrap(280,$YPos,60,$FontSize,$DisplayCurrent,'right'); @@ -418,11 +418,11 @@ $pdf->line($Page_Width-$Right_Margin, $YPos+10 ,220, $YPos+10); } - $DisplayTotBalance = locale_money_format($TotBal,$DecimalPlaces); - $DisplayTotDue = locale_money_format($TotDue,$DecimalPlaces); - $DisplayTotCurrent = locale_money_format($TotCurr,$DecimalPlaces); - $DisplayTotOverdue1 = locale_money_format($TotOD1,$DecimalPlaces); - $DisplayTotOverdue2 = locale_money_format($TotOD2,$DecimalPlaces); + $DisplayTotBalance = locale_number_format($TotBal,$DecimalPlaces); + $DisplayTotDue = locale_number_format($TotDue,$DecimalPlaces); + $DisplayTotCurrent = locale_number_format($TotCurr,$DecimalPlaces); + $DisplayTotOverdue1 = locale_number_format($TotOD1,$DecimalPlaces); + $DisplayTotOverdue2 = locale_number_format($TotOD2,$DecimalPlaces); $LeftOvers = $pdf->addTextWrap(220,$YPos,60,$FontSize,$DisplayTotBalance,'right'); $LeftOvers = $pdf->addTextWrap(280,$YPos,60,$FontSize,$DisplayTotCurrent,'right'); Modified: trunk/AgedSuppliers.php =================================================================== --- trunk/AgedSuppliers.php 2011-10-01 06:40:49 UTC (rev 4707) +++ trunk/AgedSuppliers.php 2011-10-02 09:16:51 UTC (rev 4708) @@ -126,11 +126,11 @@ While ($AgedAnalysis = DB_fetch_array($SupplierResult,$db)){ - $DisplayDue = locale_money_format($AgedAnalysis['due']-$AgedAnalysis['overdue1'],2); - $DisplayCurrent = locale_money_format($AgedAnalysis['balance']-$AgedAnalysis['due'],2); - $DisplayBalance = locale_money_format($AgedAnalysis['balance'],2); - $DisplayOverdue1 = locale_money_format($AgedAnalysis['overdue1']-$AgedAnalysis['overdue2'],2); - $DisplayOverdue2 = locale_money_format($AgedAnalysis['overdue2'],2); + $DisplayDue = locale_number_format($AgedAnalysis['due']-$AgedAnalysis['overdue1'],2); + $DisplayCurrent = locale_number_format($AgedAnalysis['balance']-$AgedAnalysis['due'],2); + $DisplayBalance = locale_number_format($AgedAnalysis['balance'],2); + $DisplayOverdue1 = locale_number_format($AgedAnalysis['overdue1']-$AgedAnalysis['overdue2'],2); + $DisplayOverdue2 = locale_number_format($AgedAnalysis['overdue2'],2); $TotBal += $AgedAnalysis['balance']; $TotDue += ($AgedAnalysis['due']-$AgedAnalysis['overdue1']); @@ -204,11 +204,11 @@ $DisplayTranDate = ConvertSQLDate($DetailTrans['trandate']); $LeftOvers = $pdf->addTextWrap($Left_Margin+105,$YPos,70,$FontSize,$DisplayTranDate,'left'); - $DisplayDue = locale_money_format($DetailTrans['due']-$DetailTrans['overdue1'],2); - $DisplayCurrent = locale_money_format($DetailTrans['balance']-$DetailTrans['due'],2); - $DisplayBalance = locale_money_format($DetailTrans['balance'],2); - $DisplayOverdue1 = locale_money_format($DetailTrans['overdue1']-$DetailTrans['overdue2'],2); - $DisplayOverdue2 = locale_money_format($DetailTrans['overdue2'],2); + $DisplayDue = locale_number_format($DetailTrans['due']-$DetailTrans['overdue1'],2); + $DisplayCurrent = locale_number_format($DetailTrans['balance']-$DetailTrans['due'],2); + $DisplayBalance = locale_number_format($DetailTrans['balance'],2); + $DisplayOverdue1 = locale_number_format($DetailTrans['overdue1']-$DetailTrans['overdue2'],2); + $DisplayOverdue2 = locale_number_format($DetailTrans['overdue2'],2); $LeftOvers = $pdf->addTextWrap(220,$YPos,60,$FontSize,$DisplayBalance,'right'); $LeftOvers = $pdf->addTextWrap(280,$YPos,60,$FontSize,$DisplayCurrent,'right'); @@ -238,11 +238,11 @@ $pdf->line($Page_Width-$Right_Margin, $YPos+10 ,220, $YPos+10); } - $DisplayTotBalance = locale_money_format($TotBal,2); - $DisplayTotDue = locale_money_format($TotDue,2); - $DisplayTotCurrent = locale_money_format($TotCurr,2); - $DisplayTotOverdue1 = locale_money_format($TotOD1,2); - $DisplayTotOverdue2 = locale_money_format($TotOD2,2); + $DisplayTotBalance = locale_number_format($TotBal,2); + $DisplayTotDue = locale_number_format($TotDue,2); + $DisplayTotCurrent = locale_number_format($TotCurr,2); + $DisplayTotOverdue1 = locale_number_format($TotOD1,2); + $DisplayTotOverdue2 = locale_number_format($TotOD2,2); $LeftOvers = $pdf->addTextWrap(220,$YPos,60,$FontSize,$DisplayTotBalance,'right'); $LeftOvers = $pdf->addTextWrap(280,$YPos,60,$FontSize,$DisplayTotCurrent,'right'); Modified: trunk/BankReconciliation.php =================================================================== --- trunk/BankReconciliation.php 2011-10-01 06:40:49 UTC (rev 4707) +++ trunk/BankReconciliation.php 2011-10-02 09:16:51 UTC (rev 4708) @@ -42,7 +42,7 @@ $CalculatedBalance = filter_number_format($_POST['DoExchangeDifference']); - $ExchangeDifference = filter_number_format(($CalculatedBalance - $_POST['BankStatementBalance'])/$CurrencyRow['rate']); + $ExchangeDifference = ($CalculatedBalance - filter_number_format($_POST['BankStatementBalance']))/$CurrencyRow['rate']; include ('includes/SQL_CommonFunctions.inc'); $ExDiffTransNo = GetNextTransNo(36,$db); @@ -89,7 +89,7 @@ $result = DB_query($SQL,$db,$ErrMsg,$DbgMsg,true); $result = DB_Txn_Commit($db); - prnMsg(_('Exchange difference of') . ' ' . locale_money_format($ExchangeDifference,$_SESSION['CompanyRecord']['decimalplaces']) . ' ' . _('has been posted'),'success'); + prnMsg(_('Exchange difference of') . ' ' . locale_number_format($ExchangeDifference,$_SESSION['CompanyRecord']['decimalplaces']) . ' ' . _('has been posted'),'success'); } //end if the bank statement balance was numeric } @@ -173,7 +173,7 @@ echo ' (' . $CurrencyRow['currcode'] . ' @ ' . $CurrencyRow['rate'] .')'; } echo '</b></td> - <td valign=bottom class="number"><b>' . locale_money_format($Balance*$CurrencyRow['rate'],$CurrencyRow['currdecimalplaces']) . '</b></td></tr>'; + <td valign=bottom class="number"><b>' . locale_number_format($Balance*$CurrencyRow['rate'],$CurrencyRow['currdecimalplaces']) . '</b></td></tr>'; $SQL = "SELECT amount/exrate AS amt, amountcleared, @@ -231,8 +231,8 @@ $myrow['typename'], $myrow['transno'], $myrow['ref'], - locale_money_format($myrow['amt'],$CurrencyRow['currdecimalplaces']), - locale_money_format($myrow['outstanding'],$CurrencyRow['currdecimalplaces'])); + locale_number_format($myrow['amt'],$CurrencyRow['currdecimalplaces']), + locale_number_format($myrow['outstanding'],$CurrencyRow['currdecimalplaces'])); $TotalUnpresentedCheques +=$myrow['outstanding']; @@ -243,9 +243,9 @@ } } //end of while loop - $TotalUnpresentedCheques = filter_number_format($TotalUnpresentedCheques); + echo '<tr></tr> - <tr class=EvenTableRows><td colspan=6>' . _('Total of all unpresented cheques') . '</td><td class="number">' . locale_money_format($TotalUnpresentedCheques,$CurrencyRow['currdecimalplaces']) . '</td></tr>'; + <tr class=EvenTableRows><td colspan=6>' . _('Total of all unpresented cheques') . '</td><td class="number">' . locale_number_format($TotalUnpresentedCheques,$CurrencyRow['currdecimalplaces']) . '</td></tr>'; $SQL = "SELECT amount/exrate AS amt, amountcleared, @@ -303,8 +303,8 @@ $myrow['typename'], $myrow['transno'], $myrow['ref'], - locale_money_format($myrow['amt'],$CurrencyRow['currdecimalplaces']), - locale_money_format($myrow['outstanding'],$CurrencyRow['currdecimalplaces']) ); + locale_number_format($myrow['amt'],$CurrencyRow['currdecimalplaces']), + locale_number_format($myrow['outstanding'],$CurrencyRow['currdecimalplaces']) ); $TotalUnclearedDeposits +=$myrow['outstanding']; @@ -318,13 +318,13 @@ echo '<tr></tr> <tr class=EvenTableRows> <td colspan=6>' . _('Total of all uncleared deposits') . '</td> - <td class="number">' . locale_money_format($TotalUnclearedDeposits,$CurrencyRow['currdecimalplaces']) . '</td> + <td class="number">' . locale_number_format($TotalUnclearedDeposits,$CurrencyRow['currdecimalplaces']) . '</td> </tr>'; - $FXStatementBalance = filter_number_format(($Balance*$CurrencyRow['rate']) - $TotalUnpresentedCheques -$TotalUnclearedDeposits); + $FXStatementBalance = ($Balance*$CurrencyRow['rate'] - $TotalUnpresentedCheques -$TotalUnclearedDeposits); echo '<tr></tr> <tr class=EvenTableRows> <td colspan=6><b>' . _('Bank statement balance should be') . ' (' . $CurrencyRow['currcode'] . ')</b></td> - <td class="number">' . locale_money_format($FXStatementBalance,$CurrencyRow['currdecimalplaces']) . '</td></tr>'; + <td class="number">' . locale_number_format($FXStatementBalance,$CurrencyRow['currdecimalplaces']) . '</td></tr>'; if (isset($_POST['DoExchangeDifference'])){ echo '<input type="hidden" name="DoExchangeDifference" value=' . $FXStatementBalance . ' />'; Modified: trunk/ConfirmDispatchControlled_Invoice.php =================================================================== --- trunk/ConfirmDispatchControlled_Invoice.php 2011-10-01 06:40:49 UTC (rev 4707) +++ trunk/ConfirmDispatchControlled_Invoice.php 2011-10-02 09:16:51 UTC (rev 4708) @@ -69,7 +69,7 @@ /*TotalQuantity set inside this include file from the sum of the bundles of the item selected for dispatch */ -$_SESSION['Items']->LineItems[$LineNo]->QtyDispatched = filter_number_format($TotalQuantity); +$_SESSION['Items']->LineItems[$LineNo]->QtyDispatched = $TotalQuantity; include('includes/footer.inc'); exit; Modified: trunk/ConfirmDispatch_Invoice.php =================================================================== --- trunk/ConfirmDispatch_Invoice.php 2011-10-01 06:40:49 UTC (rev 4707) +++ trunk/ConfirmDispatch_Invoice.php 2011-10-02 09:16:51 UTC (rev 4708) @@ -212,7 +212,7 @@ } foreach ($_SESSION['Items']->FreightTaxes as $FreightTaxLine) { if (isset($_POST['FreightTaxRate' . $FreightTaxLine->TaxCalculationOrder])){ - $_SESSION['Items']->FreightTaxes[$FreightTaxLine->TaxCalculationOrder]->TaxRate = filter_number_format(filter_number_format($_POST['FreightTaxRate' . $FreightTaxLine->TaxCalculationOrder])/100); + $_SESSION['Items']->FreightTaxes[$FreightTaxLine->TaxCalculationOrder]->TaxRate = filter_number_format($_POST['FreightTaxRate' . $FreightTaxLine->TaxCalculationOrder])/100; } } @@ -220,14 +220,14 @@ if (sizeOf($Itm->SerialItems) > 0) { $_SESSION['Items']->LineItems[$Itm->LineNumber]->QtyDispatched = 0; //initialise QtyDispatched foreach ($Itm->SerialItems as $SerialItem) { //calculate QtyDispatched from bundle quantities - $_SESSION['Items']->LineItems[$Itm->LineNumber]->QtyDispatched += filter_number_format($SerialItem->BundleQty); + $_SESSION['Items']->LineItems[$Itm->LineNumber]->QtyDispatched += $SerialItem->BundleQty; } } else if (is_numeric($_POST[$Itm->LineNumber . '_QtyDispatched' ]) AND filter_number_format($_POST[$Itm->LineNumber . '_QtyDispatched']) <= ($_SESSION['Items']->LineItems[$Itm->LineNumber]->Quantity - $_SESSION['Items']->LineItems[$Itm->LineNumber]->QtyInv)){ $_SESSION['Items']->LineItems[$Itm->LineNumber]->QtyDispatched = filter_number_format($_POST[$Itm->LineNumber . '_QtyDispatched']); } foreach ($Itm->Taxes as $TaxLine) { if (isset($_POST[$Itm->LineNumber . $TaxLine->TaxCalculationOrder . '_TaxRate'])){ - $_SESSION['Items']->LineItems[$Itm->LineNumber]->Taxes[$TaxLine->TaxCalculationOrder]->TaxRate = filter_number_format(filter_number_format($_POST[$Itm->LineNumber . $TaxLine->TaxCalculationOrder . '_TaxRate'])/100); + $_SESSION['Items']->LineItems[$Itm->LineNumber]->Taxes[$TaxLine->TaxCalculationOrder]->TaxRate = filter_number_format($_POST[$Itm->LineNumber . $TaxLine->TaxCalculationOrder . '_TaxRate'])/100; } } } //end foreach lineitem @@ -323,8 +323,8 @@ } } $DisplayDiscountPercent = locale_number_format($LnItm->DiscountPercent*100,2) . '%'; - $DisplayLineNetTotal = locale_money_format($LineTotal,$_SESSION['Items']->CurrDecimalPlaces); - $DisplayPrice = locale_money_format($LnItm->Price,$_SESSION['Items']->CurrDecimalPlaces); + $DisplayLineNetTotal = locale_number_format($LineTotal,$_SESSION['Items']->CurrDecimalPlaces); + $DisplayPrice = locale_number_format($LnItm->Price,$_SESSION['Items']->CurrDecimalPlaces); echo '<td class="number">'.$DisplayPrice.'</td> <td class="number">'.$DisplayDiscountPercent.'</td> <td class="number">'.$DisplayLineNetTotal.'</td>'; @@ -356,8 +356,7 @@ if (isset($_POST['ProcessInvoice'])) { echo $Tax->TaxRate*100; } else { - echo '<input type="text" class="number" name="' . $LnItm->LineNumber . $Tax->TaxCalculationOrder . - '_TaxRate" maxlength=4 size=4 value="' . $Tax->TaxRate*100 . '">'; + echo '<input type="text" class="number" name="' . $LnItm->LineNumber . $Tax->TaxCalculationOrder . '_TaxRate" maxlength="4" size="4" value="' . $Tax->TaxRate*100 . '" />'; } $i++; if ($Tax->TaxOnTax ==1){ @@ -373,11 +372,12 @@ $TaxTotal += $TaxLineTotal; - $DisplayTaxAmount = locale_money_format($TaxLineTotal ,$_SESSION['Items']->CurrDecimalPlaces); + $DisplayTaxAmount = locale_number_format($TaxLineTotal ,$_SESSION['Items']->CurrDecimalPlaces); - $DisplayGrossLineTotal = locale_money_format($LineTotal+ $TaxLineTotal,$_SESSION['Items']->CurrDecimalPlaces); + $DisplayGrossLineTotal = locale_number_format($LineTotal+ $TaxLineTotal,$_SESSION['Items']->CurrDecimalPlaces); - echo '<td class="number">'.$DisplayTaxAmount.'</td><td class="number">'.$DisplayGrossLineTotal.'</td>'; + echo '<td class="number">'.$DisplayTaxAmount.'</td> + <td class="number">'.$DisplayGrossLineTotal.'</td>'; if ($LnItm->Controlled==1){ if (!isset($_POST['ProcessInvoice'])) { @@ -445,11 +445,11 @@ echo '<tr> <td colspan="5" class="number">' . _('Order Freight Cost'). '</td> - <td class="number">' . $_SESSION['Old_FreightCost'] . '</td>'; + <td class="number">' . locale_number_format($_SESSION['Old_FreightCost'],$_SESSION['Items']->CurrDecimalPlaces) . '</td>'; if ($_SESSION['DoFreightCalc']==True){ echo '<td colspan="2" class="number">' ._('Recalculated Freight Cost'). '</td> - <td class="number">' . $FreightCost . '</td>'; + <td class="number">' . locale_number_format($FreightCost,$_SESSION['Items']->CurrDecimalPlaces) . '</td>'; } else { // echo '<td colspan="1"></td>'; } @@ -464,9 +464,9 @@ } else { echo '<td colspan="2" class="number">'. _('Charge Freight Cost inc Tax').'</td>'; if (isset($_POST['ProcessInvoice'])) { - echo '<td class="number">' . $_SESSION['Items']->FreightCost . '</td>'; + echo '<td class="number">' . locale_number_format($_SESSION['Items']->FreightCost,$_SESSION['Items']->CurrDecimalPlaces) . '</td>'; } else { - echo '<td class="number"><input tabindex='.$j.' type="text" class="number" size="10" maxlength="12" name="ChargeFreightCost" value="' . $_SESSION['Items']->FreightCost . '" /></td>'; + echo '<td class="number"><input tabindex='.$j.' type="text" class="number" size="10" maxlength="12" name="ChargeFreightCost" value="' . locale_number_format($_SESSION['Items']->FreightCost,$_SESSION['Items']->CurrDecimalPlaces) . '" /></td>'; } $_POST['ChargeFreightCost'] = $_SESSION['Items']->FreightCost; } @@ -496,7 +496,7 @@ echo $FreightTaxLine->TaxRate * 100 ; } else { echo '<input type="text" class="number" name="FreightTaxRate' . $FreightTaxLine->TaxCalculationOrder . - '" maxlength="4" size="4" value="' . $FreightTaxLine->TaxRate * 100 . '" />'; + '" maxlength="4" size="4" value="' . locale_number_format($FreightTaxLine->TaxRate * 100,$_SESSION['Items']->CurrDecimalPlaces) . '" />'; } if ($FreightTaxLine->TaxOnTax ==1){ @@ -511,13 +511,13 @@ } echo '</td>'; -echo '<td class="number">' . locale_money_format($FreightTaxTotal,$_SESSION['Items']->CurrDecimalPlaces) . '</td> - <td class="number">' . locale_money_format($FreightTaxTotal+ $_POST['ChargeFreightCost'],$_SESSION['Items']->CurrDecimalPlaces) . '</td> +echo '<td class="number">' . locale_number_format($FreightTaxTotal,$_SESSION['Items']->CurrDecimalPlaces) . '</td> + <td class="number">' . locale_number_format($FreightTaxTotal+ $_POST['ChargeFreightCost'],$_SESSION['Items']->CurrDecimalPlaces) . '</td> </tr>'; $TaxTotal += $FreightTaxTotal; -$DisplaySubTotal = locale_money_format(($_SESSION['Items']->total + $_POST['ChargeFreightCost']),$_SESSION['Items']->CurrDecimalPlaces); +$DisplaySubTotal = locale_number_format(($_SESSION['Items']->total + $_POST['ChargeFreightCost']),$_SESSION['Items']->CurrDecimalPlaces); /* round the totals to avoid silly entries */ @@ -529,8 +529,8 @@ <td colspan="10" class="number">' . _('Invoice Totals'). '</td> <td class="number:><hr><b>'.$DisplaySubTotal.'</b><hr></td> <td colspan="2"></td> - <td class="number"><hr><b>' . locale_money_format($TaxTotal,$_SESSION['Items']->CurrDecimalPlaces) . '</b><hr></td> - <td class="number"><hr><b>' . locale_money_format($TaxTotal+($_SESSION['Items']->total + $_POST['ChargeFreightCost']),$_SESSION['Items']->CurrDecimalPlaces) . '</b><hr></td> + <td class="number"><hr><b>' . locale_number_format($TaxTotal,$_SESSION['Items']->CurrDecimalPlaces) . '</b><hr></td> + <td class="number"><hr><b>' . locale_number_format($TaxTotal+($_SESSION['Items']->total + $_POST['ChargeFreightCost']),$_SESSION['Items']->CurrDecimalPlaces) . '</b><hr></td> </tr>'; if (! isset($_POST['DispatchDate']) OR ! Is_Date($_POST['DispatchDate'])){ @@ -764,10 +764,10 @@ '', '" . $_SESSION['Items']->DefaultSalesType . "', '" . $_SESSION['ProcessingOrder'] . "', - '" . filter_number_format($_SESSION['Items']->total) . "', - '" . filter_number_format($TaxTotal) . "', + '" . $_SESSION['Items']->total . "', + '" . $TaxTotal . "', '" . filter_number_format($_POST['ChargeFreightCost']) . "', - '" . filter_number_format($_SESSION['CurrencyRate']) . "', + '" . $_SESSION['CurrencyRate'] . "', '" . DB_escape_string($_POST['InvoiceText']) . "', '" . $_SESSION['Items']->ShipVia . "', '" . DB_escape_string($_POST['Consignment']) . "' )"; @@ -786,7 +786,7 @@ taxamount) VALUES ('" . $DebtorTransID . "', '" . $TaxAuthID . "', - '" . filter_number_format($TaxAmount/$_SESSION['CurrencyRate']) . "')"; + '" . $TaxAmount/$_SESSION['CurrencyRate'] . "')"; $ErrMsg =_('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The debtor transaction taxes records could not be inserted because'); $DbgMsg = _('The following SQL to insert the debtor transaction taxes record was used'); @@ -816,7 +816,7 @@ if ($_POST['BOPolicy']=='CAN'){ $SQL = "UPDATE salesorderdetails - SET quantity = quantity - " . filter_number_format($OrderLine->Quantity - $OrderLine->QtyDispatched) . " + SET quantity = quantity - " . ($OrderLine->Quantity - $OrderLine->QtyDispatched) . " WHERE orderno = '" . $_SESSION['ProcessingOrder'] . " ' AND stkcode = '" . $OrderLine->StockID . "'"; @@ -838,7 +838,7 @@ '" . $_SESSION['ProcessingOrder'] . "', '" . $InvoiceNo . "', '" . $OrderLine->StockID . "', - '" . filter_number_format($OrderLine->Quantity - $OrderLine->QtyDispatched) . "', + '" . $OrderLine->Quantity - $OrderLine->QtyDispatched . "', '" . $_SESSION['Items']->DebtorNo . "', '" . $_SESSION['Items']->Branch . "', 'CAN')"; @@ -866,7 +866,7 @@ '" . $_SESSION['ProcessingOrder'] . "', '" . $InvoiceNo . "', '" . $OrderLine->StockID . "', - '" . filter_number_format($OrderLine->Quantity - $OrderLine->QtyDispatched) . "', + '" . $OrderLine->Quantity - $OrderLine->QtyDispatched . "', '" . $_SESSION['Items']->DebtorNo . "', '" . $_SESSION['Items']->Branch . "', 'BO' @@ -884,14 +884,14 @@ // Test above to see if the line is completed or not if ($OrderLine->QtyDispatched>=($OrderLine->Quantity - $OrderLine->QtyInv) OR $_POST['BOPolicy']=='CAN'){ $SQL = "UPDATE salesorderdetails - SET qtyinvoiced = qtyinvoiced + " . filter_number_format($OrderLine->QtyDispatched) . ", + SET qtyinvoiced = qtyinvoiced + " . $OrderLine->QtyDispatched . ", actualdispatchdate = '" . $DefaultDispatchDate . "', completed=1 WHERE orderno = '" . $_SESSION['ProcessingOrder'] . "' AND orderlineno = '" . $OrderLine->LineNumber . "'"; } else { $SQL = "UPDATE salesorderdetails - SET qtyinvoiced = qtyinvoiced + " . filter_number_format($OrderLine->QtyDispatched) . ", + SET qtyinvoiced = qtyinvoiced + " . $OrderLine->QtyDispatched . ", actualdispatchdate = '" . $DefaultDispatchDate . "' WHERE orderno = '" . $_SESSION['ProcessingOrder'] . "' AND orderlineno = '" . $OrderLine->LineNumber . "'"; @@ -931,7 +931,7 @@ $QtyOnHandPrior = 0; } - $SQL = "UPDATE locstock SET quantity = locstock.quantity - " . filter_number_format($OrderLine->QtyDispatched) . " + $SQL = "UPDATE locstock SET quantity = locstock.quantity - " . $OrderLine->QtyDispatched . " WHERE locstock.stockid = '" . $OrderLine->StockID . "' AND loccode = '" . $_SESSION['Items']->Location . "'"; @@ -1003,10 +1003,10 @@ '" . $_SESSION['Items']->Branch . "', '" . $PeriodNo . "', '" . _('Assembly') . ': ' . $OrderLine->StockID . ' ' . _('Order') . ': ' . $_SESSION['ProcessingOrder'] . "', - '" . filter_number_format(-$AssParts['quantity'] * $OrderLine->QtyDispatched) . "', + '" . -$AssParts['quantity'] * $OrderLine->QtyDispatched . "', '" . $AssParts['standard'] . "', 0, - '" . filter_number_format($QtyOnHandPrior - $AssParts['quantity'] * $OrderLine->QtyDispatched) . "' )"; + '" . ($QtyOnHandPrior - $AssParts['quantity'] * $OrderLine->QtyDispatched) . "' )"; $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('Stock movement records for the assembly components of'). ' '. $OrderLine->StockID . ' ' . _('could not be inserted because'); $DbgMsg = _('The following SQL to insert the assembly components stock movement records was used'); @@ -1014,7 +1014,7 @@ $SQL = "UPDATE locstock - SET quantity = locstock.quantity - " . filter_number_format($AssParts['quantity'] * $OrderLine->QtyDispatched) . " + SET quantity = locstock.quantity - " . ($AssParts['quantity'] * $OrderLine->QtyDispatched) . " WHERE locstock.stockid = '" . $AssParts['component'] . "' AND loccode = '" . $_SESSION['Items']->Location . "'"; @@ -1057,13 +1057,13 @@ '" . $DefaultDispatchDate . "', '" . $_SESSION['Items']->DebtorNo . "', '" . $_SESSION['Items']->Branch . "', - '" . filter_number_format($LocalCurrencyPrice) . "', + '" . $LocalCurrencyPrice . "', '" . $PeriodNo . "', '" . $_SESSION['ProcessingOrder'] . "', - '" . filter_number_format(-$OrderLine->QtyDispatched) . "', - '" . filter_number_format($OrderLine->DiscountPercent) . "', - '" . filter_number_format($OrderLine->StandardCost) . "', - '" . filter_number_format($QtyOnHandPrior - $OrderLine->QtyDispatched) . "', + '" . -$OrderLine->QtyDispatched . "', + '" . $OrderLine->DiscountPercent . "', + '" . $OrderLine->StandardCost . "', + '" . ($QtyOnHandPrior - $OrderLine->QtyDispatched) . "', '" . DB_escape_string($OrderLine->Narrative) . "' )"; } else { // its an assembly or dummy and assemblies/dummies always have nil stock (by definition they are made up at the time of dispatch so new qty on hand will be nil @@ -1091,12 +1091,12 @@ '" . $DefaultDispatchDate . "', '" . $_SESSION['Items']->DebtorNo . "', '" . $_SESSION['Items']->Branch . "', - '" . filter_number_format($LocalCurrencyPrice) . "', + '" . $LocalCurrencyPrice . "', '" . $PeriodNo . "', '" . $_SESSION['ProcessingOrder'] . "', - '" . filter_number_format(-$OrderLine->QtyDispatched) . "', - '" . filter_number_format($OrderLine->DiscountPercent) . "', - '" . filter_number_format($OrderLine->StandardCost) . "', + '" . -$OrderLine->QtyDispatched . "', + '" . $OrderLine->DiscountPercent . "', + '" . $OrderLine->StandardCost . "', '" . DB_escape_string($OrderLine->Narrative) . "')"; } @@ -1118,7 +1118,7 @@ taxontax) VALUES ('" . $StkMoveNo . "', '" . $Tax->TaxAuthID . "', - '" . filter_number_format($Tax->TaxRate) . "', + '" . $Tax->TaxRate . "', '" . $Tax->TaxCalculationOrder . "', '" . $Tax->TaxOnTax . "')"; @@ -1134,7 +1134,7 @@ foreach($OrderLine->SerialItems as $Item){ /*We need to add the StockSerialItem record and the StockSerialMoves as well */ - $SQL = "UPDATE stockserialitems SET quantity= quantity - " . filter_number_format($Item->BundleQty) . " + $SQL = "UPDATE stockserialitems SET quantity= quantity - " . $Item->BundleQty . " WHERE stockid='" . $OrderLine->StockID . "' AND loccode='" . $_SESSION['Items']->Location . "' AND serialno='" . DB_escape_string($Item->BundleRef) . "'"; @@ -1152,7 +1152,7 @@ VALUES ('" . $StkMoveNo . "', '" . $OrderLine->StockID . "', '" . DB_escape_string($Item->BundleRef) . "', - '" . filter_number_format(-$Item->BundleQty) . "')"; + '" . -$Item->BundleQty . "')"; $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The serial stock movement record could not be inserted because'); $DbgMsg = _('The following SQL to insert the serial stock movement records was used'); @@ -1203,10 +1203,10 @@ if ($myrow[0]>0){ /*Update the existing record that already exists */ - $SQL = "UPDATE salesanalysis SET amt=amt+" . filter_number_format($OrderLine->Price * $OrderLine->QtyDispatched / $_SESSION['CurrencyRate']) . ", - cost=cost+" . filter_number_format($OrderLine->StandardCost * $OrderLine->QtyDispatched) . ", - qty=qty +" . filter_number_format($OrderLine->QtyDispatched) . ", - disc=disc+" . filter_number_format($OrderLine->DiscountPercent * $OrderLine->Price * $OrderLine->QtyDispatched / $_SESSION['CurrencyRate']) . " + $SQL = "UPDATE salesanalysis SET amt=amt+" . ($OrderLine->Price * $OrderLine->QtyDispatched / $_SESSION['CurrencyRate']) . ", + cost=cost+" . ($OrderLine->StandardCost * $OrderLine->QtyDispatched) . ", + qty=qty +" . $OrderLine->QtyDispatched . ", + disc=disc+" . ($OrderLine->DiscountPercent * $OrderLine->Price * $OrderLine->QtyDispatched / $_SESSION['CurrencyRate']) . " WHERE salesanalysis.area='" . $myrow[5] . "' AND salesanalysis.salesperson='" . $myrow[8] . "' AND typeabbrev ='" . $_SESSION['Items']->DefaultSalesType . "' @@ -1234,12 +1234,12 @@ stkcategory ) SELECT '" . $_SESSION['Items']->DefaultSalesType . "', '" . $PeriodNo . "', - '" . filter_number_format($OrderLine->Price * $OrderLine->QtyDispatched / $_SESSION['CurrencyRate']) . "', - '" . filter_number_format($OrderLine->StandardCost * $OrderLine->QtyDispatched) . "', + '" . ($OrderLine->Price * $OrderLine->QtyDispatched / $_SESSION['CurrencyRate']) . "', + '" . ($OrderLine->StandardCost * $OrderLine->QtyDispatched) . "', '" . $_SESSION['Items']->DebtorNo . "', '" . $_SESSION['Items']->Branch . "', - '" . filter_number_format($OrderLine->QtyDispatched) . "', - '" . filter_number_format($OrderLine->DiscountPercent * $OrderLine->Price * $OrderLine->QtyDispatched / $_SESSION['CurrencyRate']) . "', + '" . ($OrderLine->QtyDispatched) . "', + '" . ($OrderLine->DiscountPercent * $OrderLine->Price * $OrderLine->QtyDispatched / $_SESSION['CurrencyRate']) . "', '" . $OrderLine->StockID . "', custbranch.area, 1, @@ -1276,7 +1276,7 @@ '" . $PeriodNo . "', '" . GetCOGSGLAccount($Area, $OrderLine->StockID, $_SESSION['Items']->DefaultSalesType, $db) . "', '" . $_SESSION['Items']->DebtorNo . " - " . $OrderLine->StockID . " x " . $OrderLine->QtyDispatched . " @ " . $OrderLine->StandardCost . "', - '" . filter_number_format($OrderLine->StandardCost * $OrderLine->QtyDispatched) . "')"; + '" . ($OrderLine->StandardCost * $OrderLine->QtyDispatched) . "')"; $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The cost of sales GL posting could not be inserted because'); $DbgMsg = _('The following SQL to insert the GLTrans record was used'); @@ -1299,7 +1299,7 @@ '" . $PeriodNo . "', '" . $StockGLCode['stockact'] . "', '" . $_SESSION['Items']->DebtorNo . " - " . $OrderLine->StockID . " x " . $OrderLine->QtyDispatched . " @ " . $OrderLine->StandardCost . "', - '" . filter_number_format(-$OrderLine->StandardCost * $OrderLine->QtyDispatched) . "')"; + '" . (-$OrderLine->StandardCost * $OrderLine->QtyDispatched) . "')"; $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The stock side of the cost of sales GL posting could not be inserted because'); $DbgMsg = _('The following SQL to insert the GLTrans record was used'); @@ -1326,7 +1326,7 @@ '" . $PeriodNo . "', '" . $SalesGLAccounts['salesglcode'] . "', '" . $_SESSION['Items']->DebtorNo . " - " . $OrderLine->StockID . " x " . $OrderLine->QtyDispatched . " @ " . $OrderLine->Price . "', - '" . filter_number_format(-$OrderLine->Price * $OrderLine->QtyDispatched/$_SESSION['CurrencyRate']) . "')"; + '" . (-$OrderLine->Price * $OrderLine->QtyDispatched/$_SESSION['CurrencyRate']) . "')"; $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The sales GL posting could not be inserted because'); $DbgMsg = '<br />' ._('The following SQL to insert the GLTrans record was used'); @@ -1348,7 +1348,7 @@ '" . $PeriodNo . "', '" . $SalesGLAccounts['discountglcode'] . "', '" . $_SESSION['Items']->DebtorNo . " - " . $OrderLine->StockID . " @ " . ($OrderLine->DiscountPercent * 100) . "%', - '" . filter_number_format($OrderLine->Price * $OrderLine->QtyDispatched * $OrderLine->DiscountPercent/$_SESSION['CurrencyRate']) . "')"; + '" . ($OrderLine->Price * $OrderLine->QtyDispatched * $OrderLine->DiscountPercent/$_SESSION['CurrencyRate']) . "')"; $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The sales discount GL posting could not be inserted because'); $DbgMsg = _('The following SQL to insert the GLTrans record was used'); @@ -1394,7 +1394,7 @@ '" . $PeriodNo . "', '" . $DisposalRow['accumdepnact'] . "', '" . $_SESSION['Items']->DebtorNo . ' - ' . $OrderLine->StockID . ' ' . _('disposal') . "', - '" . filter_number_format(-$DisposalRow['accumdpen']) . "')"; + '" . -$DisposalRow['accumdpen'] . "')"; $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The reversal of accumulated depreciation GL posting on disposal could not be inserted because'); $DbgMsg = _('The following SQL to insert the GLTrans record was used'); @@ -1416,7 +1416,7 @@ '" . $PeriodNo . "', '" . $DisposalRow['costact'] . "', '" . $_SESSION['Items']->DebtorNo . " - " . $OrderLine->StockID . ' ' . _('disposal') . "', - '" . filter_number_format(-$DisposalRow['cost']) . "')"; + '" . -$DisposalRow['cost'] . "')"; $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The reversal of asset cost on dispoal GL posting could not be inserted because'); $DbgMsg = _('The following SQL to insert the GLTrans record was used'); @@ -1438,7 +1438,7 @@ '" . $PeriodNo . "', '" . $DisposalRow['disposalact'] . "', '" . $_SESSION['Items']->DebtorNo . " - " . $OrderLine->StockID . ' ' . _('disposal') . "', - '" . filter_number_format($DisposalRow['cost']-$DisposalRow['accumdepn']) . "')"; + '" . ($DisposalRow['cost']-$DisposalRow['accumdepn']) . "')"; $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The disposal net book value GL posting could not be inserted because'); $DbgMsg = '<br />' ._('The following SQL to insert the GLTrans record was used'); @@ -1460,7 +1460,7 @@ '" . $PeriodNo . "', '" . $DisposalRow['disposalact'] . "', '" . $_SESSION['Items']->DebtorNo . " - " . $OrderLine->StockID . ' ' . _('disposal') . "', - '" . filter_number_format(-$OrderLine->Price * $OrderLine->QtyDispatched* (1 - $OrderLine->DiscountPercent)/$_SESSION['CurrencyRate']) . "')"; + '" . (-$OrderLine->Price * $OrderLine->QtyDispatched* (1 - $OrderLine->DiscountPercent)/$_SESSION['CurrencyRate']) . "')"; $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The disposal proceeds GL posting could not be inserted because'); $DbgMsg = '<br />' ._('The following SQL to insert the GLTrans record was used'); @@ -1488,14 +1488,14 @@ '" . $PeriodNo . "', '" . Date('Y-m-d') . "', 'disposal', - '" . filter_number_format($OrderLine->Price * $OrderLine->QtyDispatched* (1 - $OrderLine->DiscountPercent)/$_SESSION['CurrencyRate']) . "', + '" . ($OrderLine->Price * $OrderLine->QtyDispatched* (1 - $OrderLine->DiscountPercent)/$_SESSION['CurrencyRate']) . "', '" . $DefaultDispatchDate . "')"; $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The fixed asset transaction could not be inserted because'); $DbgMsg = '<br />' ._('The following SQL to insert the fixed asset transaction record was used'); $Result = DB_query($SQL,$db,$ErrMsg,$DbgMsg,true); $SQL = "UPDATE fixedassets - SET disposalproceeds ='" . filter_number_format($OrderLine->Price * $OrderLine->QtyDispatched* (1 - $OrderLine->DiscountPercent)/$_SESSION['CurrencyRate']) . "', + SET disposalproceeds ='" . ($OrderLine->Price * $OrderLine->QtyDispatched* (1 - $OrderLine->DiscountPercent)/$_SESSION['CurrencyRate']) . "', disposaldate ='" . $DefaultDispatchDate . "' WHERE assetid ='" . $AssetNumber . "'"; @@ -1526,7 +1526,7 @@ '" . $PeriodNo . "', '" . $_SESSION['CompanyRecord']['debtorsact'] . "', '" . $_SESSION['Items']->DebtorNo . "', - '" . filter_number_format(($_SESSION['Items']->total + $_SESSION['Items']->FreightCost + $TaxTotal)/$_SESSION['CurrencyRate']) . "')"; + '" . (($_SESSION['Items']->total + $_SESSION['Items']->FreightCost + $TaxTotal)/$_SESSION['CurrencyRate']) . "')"; $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The total debtor GL posting could not be inserted because'); $DbgMsg = _('The following SQL to insert the total debtors control GLTrans record was used'); @@ -1551,7 +1551,7 @@ '" . $PeriodNo . "', '" . $_SESSION['CompanyRecord']['freightact'] . "', '" . $_SESSION['Items']->DebtorNo . "', - '" . filter_number_format(-($_SESSION['Items']->FreightCost)/$_SESSION['CurrencyRate']) . "')"; + '" . (-$_SESSION['Items']->FreightCost/$_SESSION['CurrencyRate']) . "')"; $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The freight GL posting could not be inserted because'); $DbgMsg = _('The following SQL to insert the GLTrans record was used'); @@ -1573,7 +1573,7 @@ '" . $PeriodNo . "', '" . $TaxGLCodes[$TaxAuthID] . "', '" . $_SESSION['Items']->DebtorNo . "', - '" . filter_number_format(-$TaxAmount/$_SESSION['CurrencyRate']) . "')"; + '" . (-$TaxAmount/$_SESSION['CurrencyRate']) . "')"; $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The tax GL posting could not be inserted because'); $DbgMsg = _('The following SQL to insert the GLTrans record was used'); Modified: trunk/CounterSales.php =================================================================== --- trunk/CounterSales.php 2011-10-01 06:40:49 UTC (rev 4707) +++ trunk/CounterSales.php 2011-10-02 09:16:51 UTC (rev 4708) @@ -15,6 +15,8 @@ include('includes/SQL_CommonFunctions.inc'); include('includes/GetSalesTransGLCodes.inc'); +$AlreadyWarnedAboutCredit = false; + if (empty($_GET['identifier'])) { $identifier=date('U'); } else { @@ -36,7 +38,8 @@ if (isset($_POST['SelectingOrderItems'])){ foreach ($_POST as $FormVariable => $Quantity) { if (mb_strpos($FormVariable,'OrderQty')!==false) { - $NewItemArray[$_POST['StockID' . mb_substr($FormVariable,8)]] = filter_number_format(trim($Quantity)); + $NewItemArray[$_POST['StockID' . mb_substr($FormVariable,8)]] = filter_number_format($Quantity); + echo '<br/> The quantitiy entered was ' . filter_number_format($Quantity) . ' the quantity for ' . $_POST['StockID' . mb_substr($FormVariable,8)] . ' unfiltered was: ' . $Quantity; } } } @@ -483,12 +486,12 @@ foreach ($_SESSION['Items'.$identifier]->LineItems as $OrderLine) { if (isset($_POST['Quantity_' . $OrderLine->LineNumber])){ - + $Quantity = filter_number_format($_POST['Quantity_' . $OrderLine->LineNumber]); if (abs($OrderLine->Price - filter_number_format($_POST['Price_' . $OrderLine->LineNumber]))>0.01){ $Price = filter_number_format($_POST['Price_' . $OrderLine->LineNumber]); - $_POST['GPPercent_' . $OrderLine->LineNumber] = filter_number_format((($Price*(1-(filter_number_format($_POST['Discount_' . $OrderLine->LineNumber])/100))) - $OrderLine->StandardCost*$ExRate)/($Price *(1-filter_number_format($_POST['Discount_' . $OrderLine->LineNumber]))/100)); + $_POST['GPPercent_' . $OrderLine->LineNumber] = (($Price*(1-(filter_number_format($_POST['Discount_' . $OrderLine->LineNumber])/100))) - $OrderLine->StandardCost*$ExRate)/($Price *(1-filter_number_format($_POST['Discount_' . $OrderLine->LineNumber]))/100); } else if (abs($OrderLine->GPPercent - filter_number_format($_POST['GPPercent_' . $OrderLine->LineNumber]))>=0.001) { //then do a recalculation of the price at this new GP Percentage $Price = ($OrderLine->StandardCost*$ExRate)/(1 -((filter_number_format($_POST['GPPercent_' . $OrderLine->LineNumber]) + filter_number_format($_POST['Discount_' . $OrderLine->LineNumber]))/100)); @@ -518,7 +521,7 @@ $_SESSION['Items'.$identifier]->update_cart_item($OrderLine->LineNumber, $Quantity, $Price, - filter_number_format($DiscountPercentage/100), + $DiscountPercentage/100, $Narrative, 'Yes', /*Update DB */ $_POST['ItemDue_' . $OrderLine->LineNumber], @@ -769,16 +772,16 @@ echo '<td><a target="_blank" href="' . $rootpath . '/StockStatus.php?identifier='.$identifier . '&StockID=' . $OrderLine->StockID . '&DebtorNo=' . $_SESSION['Items'.$identifier]->DebtorNo . '">' . $OrderLine->StockID . '</a></td> <td>' . $OrderLine->ItemDescription . '</td>'; - echo '<td><input class="number" tabindex="2" type="text" name="Quantity_' . $OrderLine->LineNumber . '" size="6" maxlength="6" value="' . $OrderLine->Quantity . '" />'; + echo '<td><input class="number" tabindex="2" type="text" name="Quantity_' . $OrderLine->LineNumber . '" size="6" maxlength="6" value="' . locale_number_format($OrderLine->Quantity,$OrderLine->DecimalPlaces) . '" />'; echo '</td> - <td class="number">' . $OrderLine->QOHatLoc . '</td> + <td class="number">' . locale_number_format($OrderLine->QOHatLoc,$OrderLine->DecimalPlaces) . '</td> <td>' . $OrderLine->Units . '</td>'; - echo '<td><input class="number" type="text" name="Price_' . $OrderLine->LineNumber . '" size="16" maxlength="16" value="' . $OrderLine->Price . '" /></td> - <td><input class="number" type="text" name="Discount_' . $OrderLine->LineNumber . '" size="5" maxlength="4" value="' . ($OrderLine->DiscountPercent * 100) . '" /></td> - <td><input class="number" type="text" name="GPPercent_' . $OrderLine->LineNumber . '" size="3" maxlength="40" value="' . $OrderLine->GPPercent . '" /></td>'; - echo '<td class="number">' . locale_money_format($SubTotal,$_SESSION['Items'.$identifier]->CurrDecimalPlaces) . '</td>'; + echo '<td><input class="number" type="text" name="Price_' . $OrderLine->LineNumber . '" size="16" maxlength="16" value="' . locale_number_format($OrderLine->Price,$_SESSION['Items'.$identifier]->CurrDecimalPlaces) . '" /></td> + <td><input class="number" type="text" name="Discount_' . $OrderLine->LineNumber . '" size="5" maxlength="4" value="' . locale_number_format(($OrderLine->DiscountPercent * 100),2) . '" /></td> + <td><input class="number" type="text" name="GPPercent_' . $OrderLine->LineNumber . '" size="3" maxlength="40" value="' . locale_number_format($OrderLine->GPPercent,2) . '" /></td>'; + echo '<td class="number">' . locale_number_format($SubTotal,$_SESSION['Items'.$identifier]->CurrDecimalPlaces) . '</td>'; $LineDueDate = $OrderLine->ItemDue; if (!Is_Date($OrderLine->ItemDue)){ $LineDueDate = DateAdd (Date($_SESSION['DefaultDateFormat']),'d', $_SESSION['Items'.$identifier]->DeliveryDays); @@ -804,8 +807,8 @@ $TaxTotal += $TaxLineTotal; $_SESSION['Items'.$identifier]->TaxTotals=$TaxTotals; $_SESSION['Items'.$identifier]->TaxGLCodes=$TaxGLCodes; - echo '<td class="number">' . locale_money_format($TaxLineTotal ,$_SESSION['Items'.$identifier]->CurrDecimalPlaces) . '</td>'; - echo '<td class="number">' . locale_money_format($SubTotal + $TaxLineTotal ,$_SESSION['Items'.$identifier]->CurrDecimalPlaces) . '</td>'; + echo '<td class="number">' . locale_number_format($TaxLineTotal ,$_SESSION['Items'.$identifier]->CurrDecimalPlaces) . '</td>'; + echo '<td class="number">' . locale_number_format($SubTotal + $TaxLineTotal ,$_SESSION['Items'.$identifier]->CurrDecimalPlaces) . '</td>'; echo '<td><a href="' . $_SERVER['PHP_SELF'] . '?identifier='.$identifier . '&Delete=' . $OrderLine->LineNumber . '" onclick="return confirm(\'' . _('Are You Sure?') . '\');">' . _('Delete') . '</a></td></tr>'; if ($_SESSION['AllowOrderLineItemNarrative'] == 1){ @@ -822,9 +825,9 @@ } /* end of loop around items */ echo '<tr class="EvenTableRows"><td colspan="8" class="number"><b>' . _('Total') . '</b></td> - <td class="number">' . locale_money_format(($_SESSION['Items'.$identifier]->total),$_SESSION['Items'.$identifier]->CurrDecimalPlaces) . '</td> - <td class="number">' . locale_money_format($TaxTotal,$_SESSION['Items'.$identifier]->CurrDecimalPlaces) . '</td> - <td class="number">' . locale_money_format(($_SESSION['Items'.$identifier]->total+$TaxTotal),$_SESSION['Items'.$identifier]->CurrDecimalPlaces) . '</td> + <td class="number">' . locale_number_format(($_SESSION['Items'.$identifier]->total),$_SESSION['Items'.$identifier]->CurrDecimalPlaces) . '</td> + <td class="number">' . locale_number_format($TaxTotal,$_SESSION['Items'.$identifier]->CurrDecimalPlaces) . '</td> + <td class="number">' . locale_number_format(($_SESSION['Items'.$identifier]->total+$TaxTotal),$_SESSION['Items'.$identifier]->CurrDecimalPlaces) . '</td> </tr> </table>'; echo '<input type="hidden" name="TaxTotal" value="'.$TaxTotal.'" />'; @@ -1889,7 +1892,7 @@ '" . $BankAccountExRate . "', '" . $DefaultDispatchDate . "', '" . $_POST['PaymentMethod'] . "', - '" . filter_number_format(filter_number_format($_POST['AmountPaid']) * $BankAccountExRate) . "', + '" . filter_number_format($_POST['AmountPaid']) * $BankAccountExRate . "', '" . $_SESSION['Items'.$identifier]->DefaultCurrency . "')"; $DbgMsg = _('The SQL that failed to insert the bank account transaction was'); Modified: trunk/Credit_Invoice.php =================================================================== --- trunk/Credit_Invoice.php 2011-10-01 06:40:49 UTC (rev 4707) +++ trunk/Credit_Invoice.php 2011-10-02 09:16:51 UTC (rev 4708) @@ -293,11 +293,11 @@ $j=0; //row counter foreach ($_SESSION['CreditItems']->LineItems as $LnItm) { - $LineTotal =(filter_number_format($LnItm->QtyDispatched) * filter_number_format($LnItm->Price) * (1 - filter_number_format($LnItm->DiscountPercent))); + $LineTotal = $LnItm->QtyDispatched * $LnItm->Price * (1 - $LnItm->DiscountPercent); if (!isset($_POST['ProcessCredit'])) { $_SESSION['CreditItems']->total += $LineTotal; - $_SESSION['CreditItems']->totalVolume += (filter_number_format($LnItm->QtyDispatched) * filter_number_format($LnItm->Volume)); - $_SESSION['CreditItems']->totalWeight += (filter_number_format($LnItm->QtyDispatched) * filter_number_format($LnItm->Weight)); + $_SESSION['CreditItems']->totalVolume += ($LnItm->QtyDispatched * $LnItm->Volume); + $_SESSION['CreditItems']->totalWeight += ($LnItm->QtyDispatched * $LnItm->Weight); if ($k==1){ $RowStarter = 'class="EvenTableRows"'; @@ -323,7 +323,7 @@ } - $DisplayLineTotal = locale_money_format($LineTotal,$_SESSION['CreditItems']->CurrDecimalPlaces); + $DisplayLineTotal = locale_number_format($LineTotal,$_SESSION['CreditItems']->CurrDecimalPlaces); $j++; echo '<td><input tabindex=' . $j . ' type="text" class="number" name="Price_' . $LnItm->LineNumber . '" maxlength=12 size=6 value=' . $LnItm->Price . '></td> @@ -370,8 +370,8 @@ } $TaxTotal += $TaxLineTotal; - $DisplayTaxAmount = locale_money_format($TaxLineTotal ,$_SESSION['CreditItems']->CurrDecimalPlaces); - $DisplayGrossLineTotal = locale_money_format($LineTotal+ $TaxLineTotal,$_SESSION['CreditItems']->CurrDecimalPlaces); + $DisplayTaxAmount = locale_number_format($TaxLineTotal ,$_SESSION['CreditItems']->CurrDecimalPlaces); + $DisplayGrossLineTotal = locale_number_format($LineTotal+ $TaxLineTotal,$_SESSION['CreditItems']->CurrDecimalPlaces); if (!isset($_POST['ProcessCredit'])) { echo '</td>'; @@ -392,7 +392,7 @@ if (!isset($_POST['ProcessCredit'])) { echo '<tr> <td colspan="3" class="number">' . _('Freight cost charged on invoice') . '</td> - <td class="number">' . locale_money_format($_SESSION['Old_FreightCost'],$_SESSION['CreditItems']->CurrDecimalPlaces) . '</td> + <td class="number">' . locale_number_format($_SESSION['Old_FreightCost'],$_SESSION['CreditItems']->CurrDecimalPlaces) . '</td> <td></td> <td colspan="2" class="number">' . _('Credit Freight Cost') . '</td> <td><input tabindex='.$j.' type="text" class="number" size="6" maxlength="6" name="ChargeFreightCost" value="' . $_SESSION['CreditItems']->FreightCost . '"></td>'; @@ -432,21 +432,21 @@ } if (!isset($_POST['ProcessCredit'])) { echo '</td>'; - echo '<td class="number">' . locale_money_format($FreightTaxTotal,$_SESSION['CreditItems']->CurrDecimalPlaces) . '</td> - <td class="number">' . locale_money_format($FreightTaxTotal+ $_SESSION['CreditItems']->FreightCost,$_SESSION['CreditItems']->CurrDecimalPlaces) . '</td> + echo '<td class="number">' . locale_number_format($FreightTaxTotal,$_SESSION['CreditItems']->CurrDecimalPlaces) . '</td> + <td class="number">' . locale_number_format($FreightTaxTotal+ $_SESSION['CreditItems']->FreightCost,$_SESSION['CreditItems']->CurrDecimalPlaces) . '</td> </tr>'; } $TaxTotal += $FreightTaxTotal; -$DisplayTotal = locale_money_format($_SESSION['CreditItems']->total + $_SESSION['CreditItems']->FreightCost,$_SESSION['CreditItems']->CurrDecimalPlaces); +$DisplayTotal = locale_number_format($_SESSION['CreditItems']->total + $_SESSION['CreditItems']->FreightCost,$_SESSION['CreditItems']->CurrDecimalPlaces); if (!isset($_POST['ProcessCredit'])) { echo '<tr> <td colspan="7" class="number">' . _('Credit Totals') . '</td> <td class="number"><hr><b>' . $DisplayTotal . '</b><hr></td> <td colspan=2></td> - <td class="number"><hr><b>' . locale_money_format($TaxTotal,$_SESSION['CreditItems']->CurrDecimalPlaces) . '<hr></td> - <td class="number"><hr><b>' . locale_money_format($TaxTotal+($_SESSION['CreditItems']->total + $_SESSION['CreditItems']->FreightCost),$_SESSION['CreditItems']->CurrDecimalPlaces) . '</b><hr></td> + <td class="number"><hr><b>' . locale_number_format($TaxTotal,$_SESSION['CreditItems']->CurrDecimalPlaces) . '<hr></td> + <td class="number"><hr><b>' . locale_number_format($TaxTotal+($_SESSION['CreditItems']->total + $_SESSION['CreditItems']->FreightCost),$_SESSION['CreditItems']->CurrDecimalPlaces) . '</b><hr></td> </tr></table>'; } $DefaultDispatchDate = Date($_SESSION['DefaultDateFormat']); @@ -530,7 +530,7 @@ /*Now need to update the invoice DebtorTrans record for the amount to be allocated and if the invoice is now settled*/ $SQL = "UPDATE debtortrans - SET alloc = alloc + " . filter_number_format($Allocate_amount) . ", + SET alloc = alloc + " . $Allocate_amount . ", settled='" . $SettledInvoice . "' WHERE transno = '" . $_SESSION['ProcessingCredit'] . "' AND type=10"; @@ -568,12 +568,12 @@ 'Inv-" . $_SESSION['ProcessingCredit'] . "', '" . $_SESSION['CreditItems']->DefaultSalesType . "', '" . $_SESSION['CreditItems']->OrderNo . "', - '" . -filter_number_format($_SESSION['CreditItems']->total) . "', - '" . -filter_number_format($TaxTotal) . "', - '" . -filter_number_format($_SESSION['CreditItems']->FreightCost) . "', + '" . -$_SESSION['CreditItems']->total . "', + '" . -$TaxTotal . "', + '" . -$_SESSION['CreditItems']->FreightCost . "', '" . $_SESSION['CurrencyRate'] . "', '" . DB_escape_string($_POST['CreditText']) . "', - '" . -filter_number_format($Allocate_amount) . "', + '" . -$Allocate_amount . "', '" . $Settled . "')"; $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The customer credit note transaction could not be added to the database because'); @@ -591,7 +591,7 @@ taxamount) VALUES ('" . $CreditTransID . "', '" . $TaxAuthID . "', - '" . -filter_number_format($TaxAmount/$_SESSION['CurrencyRate']) . "')"; + '" . -$TaxAmount/$_SESSION['CurrencyRate'] . "')"; $ErrMsg =_('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The debtor transaction taxes records could not be inserted because'); $DbgMsg = _('The following SQL to insert the debtor transaction taxes record was used'); @@ -604,7 +604,7 @@ transid_allocfrom, transid_allocto, datealloc) - VALUES ('" . filter_number_format($Allocate_amount) . "', + VALUES ('" . $Allocate_amount . "', '" . $CreditTransID . "', '" . $_SESSION['CreditItems']->TransID . "', '" . Date('Y-m-d') . "')"; @@ -653,7 +653,7 @@ /* some want this some do not */ $SQL = "UPDATE salesorderdetails - SET qtyinvoiced = qtyinvoiced - " . filter_number_format($CreditLine->QtyDispatched) . ", + SET qtyinvoiced = qtyinvoiced - " . $CreditLine->QtyDispatched . ", completed=0 WHERE orderno = '" . $_SESSION['CreditItems']->OrderNo . "' AND stkcode = '" . $CreditLine->StockID . "' @@ -668,7 +668,7 @@ if ($MBFlag=='B' OR $MBFlag=='M') { $SQL = "UPDATE locstock - SET locstock.quantity = locstock.quantity + " . filter_number_format($CreditLine->QtyDispatched) . " + SET locstock.quantity = locstock.quantity + " . $CreditLine->QtyDispatched . " WHERE locstock.stockid = '" . $CreditLine->StockID . "' AND loccode = '" . $_SESSION['CreditItems']->Location . "'"; @@ -751,10 +751,10 @@ '" . $_SESSION['CreditItems']->Branch . "', '" . $PeriodNo . "', '" . _('Ex Inv') . ': ' . $_SESSION['ProcessingCredit'] . ' ' . _('Assembly') . ': ' . $CreditLine->StockID . "', - '" . filter_number_format($AssParts['quantity'] * $CreditLine->QtyDispatched) . "', + '" . $AssParts['quantity'] * $CreditLine->QtyDispatched . "', '" . $AssParts['standard'] . "', 0, - '" . filter_number_format($QtyOnHandPrior + ($AssParts['quantity'] * filter_number_format($CreditLine->QtyDispatched))) . "' + '" . $QtyOnHandPrior + ($AssParts['quantity'] * $CreditLine->QtyDispatched) . "' )"; } else { @@ -779,7 +779,7 @@ '" . $_SESSION[... [truncated message content] |
From: <dai...@us...> - 2011-10-02 09:51:40
|
Revision: 4710 http://web-erp.svn.sourceforge.net/web-erp/?rev=4710&view=rev Author: daintree Date: 2011-10-02 09:51:33 +0000 (Sun, 02 Oct 2011) Log Message: ----------- number_formats Modified Paths: -------------- trunk/Numbers/Words/lang.bg.php trunk/Numbers/Words/lang.fr.php trunk/Numbers/Words/lang.fr_BE.php trunk/includes/phplot/phplot.php trunk/includes/tcpdf/tcpdf.php Modified: trunk/Numbers/Words/lang.bg.php =================================================================== --- trunk/Numbers/Words/lang.bg.php 2011-10-02 09:45:55 UTC (rev 4709) +++ trunk/Numbers/Words/lang.bg.php 2011-10-02 09:51:33 UTC (rev 4710) @@ -318,7 +318,7 @@ return $ret; } else - return explode(' ', locale_number_format($num, 0, '', ' ')); // a faster version for integers + return explode(' ', number_format($num, 0, '', ' ')); // a faster version for integers } // }}} Modified: trunk/Numbers/Words/lang.fr.php =================================================================== --- trunk/Numbers/Words/lang.fr.php 2011-10-02 09:45:55 UTC (rev 4709) +++ trunk/Numbers/Words/lang.fr.php 2011-10-02 09:51:33 UTC (rev 4710) @@ -271,7 +271,7 @@ return $ret; } else - return explode(' ', locale_number_format($num, 0, '', ' ')); // a faster version for integers + return explode(' ', number_format($num, 0, '', ' ')); // a faster version for integers } // }}} Modified: trunk/Numbers/Words/lang.fr_BE.php =================================================================== --- trunk/Numbers/Words/lang.fr_BE.php 2011-10-02 09:45:55 UTC (rev 4709) +++ trunk/Numbers/Words/lang.fr_BE.php 2011-10-02 09:51:33 UTC (rev 4710) @@ -275,7 +275,7 @@ return $ret; } else - return explode(' ', locale_number_format($num, 0, '', ' ')); // a faster version for integers + return explode(' ', number_format($num, 0, '', ' ')); // a faster version for integers } // }}} Modified: trunk/includes/phplot/phplot.php =================================================================== --- trunk/includes/phplot/phplot.php 2011-10-02 09:45:55 UTC (rev 4709) +++ trunk/includes/phplot/phplot.php 2011-10-02 09:51:33 UTC (rev 4710) @@ -2377,11 +2377,11 @@ /* * Format a floating-point number. - * This is like PHP's locale_number_format, but uses class variables for separators. + * This is like PHP's number_format, but uses class variables for separators. * The separators will default to locale-specific values, if available. * Note: This method should be 'protected', but is called from test script(s). */ - function locale_number_format($number, $decimals=0) + function number_format($number, $decimals=0) { if (!isset($this->decimal_point) || !isset($this->thousands_sep)) { // Load locale-specific values from environment, unless disabled: @@ -2399,7 +2399,7 @@ $this->thousands_sep = ','; } } - return locale_number_format($number, $decimals, $this->decimal_point, $this->thousands_sep); + return number_format($number, $decimals, $this->decimal_point, $this->thousands_sep); } /* @@ -3596,7 +3596,7 @@ break; case 'data': $which_lab = $format['prefix'] - . $this->locale_number_format($which_lab, $format['precision']) + . $this->number_format($which_lab, $format['precision']) . $this->data_units_text // Obsolete . $format['suffix']; break; @@ -4533,7 +4533,7 @@ else $slicecol = $this->ndx_data_dark_colors[$color_index]; - $label_txt = $this->locale_number_format(($val / $total * 100), $precision) . '%'; + $label_txt = $this->number_format(($val / $total * 100), $precision) . '%'; $val = 360 * ($val / $total); // NOTE that imagefilledarc measures angles CLOCKWISE (go figure why), Modified: trunk/includes/tcpdf/tcpdf.php =================================================================== --- trunk/includes/tcpdf/tcpdf.php 2011-10-02 09:45:55 UTC (rev 4709) +++ trunk/includes/tcpdf/tcpdf.php 2011-10-02 09:51:33 UTC (rev 4710) @@ -11772,7 +11772,7 @@ * @since 4.2.005 (2008-11-06) */ protected function formatPageNumber($num) { - return locale_number_format((float)$num, 0, '', '.'); + return number_format((float)$num, 0, '', '.'); } /** @@ -11784,7 +11784,7 @@ * @see addTOC() */ protected function formatTOCPageNumber($num) { - return locale_number_format((float)$num, 0, '', '.'); + return number_format((float)$num, 0, '', '.'); } /** This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dai...@us...> - 2011-10-02 09:51:40
|
Revision: 4710 http://web-erp.svn.sourceforge.net/web-erp/?rev=4710&view=rev Author: daintree Date: 2011-10-02 09:51:33 +0000 (Sun, 02 Oct 2011) Log Message: ----------- number_formats Modified Paths: -------------- trunk/Numbers/Words/lang.bg.php trunk/Numbers/Words/lang.fr.php trunk/Numbers/Words/lang.fr_BE.php trunk/includes/phplot/phplot.php trunk/includes/tcpdf/tcpdf.php Modified: trunk/Numbers/Words/lang.bg.php =================================================================== --- trunk/Numbers/Words/lang.bg.php 2011-10-02 09:45:55 UTC (rev 4709) +++ trunk/Numbers/Words/lang.bg.php 2011-10-02 09:51:33 UTC (rev 4710) @@ -318,7 +318,7 @@ return $ret; } else - return explode(' ', locale_number_format($num, 0, '', ' ')); // a faster version for integers + return explode(' ', number_format($num, 0, '', ' ')); // a faster version for integers } // }}} Modified: trunk/Numbers/Words/lang.fr.php =================================================================== --- trunk/Numbers/Words/lang.fr.php 2011-10-02 09:45:55 UTC (rev 4709) +++ trunk/Numbers/Words/lang.fr.php 2011-10-02 09:51:33 UTC (rev 4710) @@ -271,7 +271,7 @@ return $ret; } else - return explode(' ', locale_number_format($num, 0, '', ' ')); // a faster version for integers + return explode(' ', number_format($num, 0, '', ' ')); // a faster version for integers } // }}} Modified: trunk/Numbers/Words/lang.fr_BE.php =================================================================== --- trunk/Numbers/Words/lang.fr_BE.php 2011-10-02 09:45:55 UTC (rev 4709) +++ trunk/Numbers/Words/lang.fr_BE.php 2011-10-02 09:51:33 UTC (rev 4710) @@ -275,7 +275,7 @@ return $ret; } else - return explode(' ', locale_number_format($num, 0, '', ' ')); // a faster version for integers + return explode(' ', number_format($num, 0, '', ' ')); // a faster version for integers } // }}} Modified: trunk/includes/phplot/phplot.php =================================================================== --- trunk/includes/phplot/phplot.php 2011-10-02 09:45:55 UTC (rev 4709) +++ trunk/includes/phplot/phplot.php 2011-10-02 09:51:33 UTC (rev 4710) @@ -2377,11 +2377,11 @@ /* * Format a floating-point number. - * This is like PHP's locale_number_format, but uses class variables for separators. + * This is like PHP's number_format, but uses class variables for separators. * The separators will default to locale-specific values, if available. * Note: This method should be 'protected', but is called from test script(s). */ - function locale_number_format($number, $decimals=0) + function number_format($number, $decimals=0) { if (!isset($this->decimal_point) || !isset($this->thousands_sep)) { // Load locale-specific values from environment, unless disabled: @@ -2399,7 +2399,7 @@ $this->thousands_sep = ','; } } - return locale_number_format($number, $decimals, $this->decimal_point, $this->thousands_sep); + return number_format($number, $decimals, $this->decimal_point, $this->thousands_sep); } /* @@ -3596,7 +3596,7 @@ break; case 'data': $which_lab = $format['prefix'] - . $this->locale_number_format($which_lab, $format['precision']) + . $this->number_format($which_lab, $format['precision']) . $this->data_units_text // Obsolete . $format['suffix']; break; @@ -4533,7 +4533,7 @@ else $slicecol = $this->ndx_data_dark_colors[$color_index]; - $label_txt = $this->locale_number_format(($val / $total * 100), $precision) . '%'; + $label_txt = $this->number_format(($val / $total * 100), $precision) . '%'; $val = 360 * ($val / $total); // NOTE that imagefilledarc measures angles CLOCKWISE (go figure why), Modified: trunk/includes/tcpdf/tcpdf.php =================================================================== --- trunk/includes/tcpdf/tcpdf.php 2011-10-02 09:45:55 UTC (rev 4709) +++ trunk/includes/tcpdf/tcpdf.php 2011-10-02 09:51:33 UTC (rev 4710) @@ -11772,7 +11772,7 @@ * @since 4.2.005 (2008-11-06) */ protected function formatPageNumber($num) { - return locale_number_format((float)$num, 0, '', '.'); + return number_format((float)$num, 0, '', '.'); } /** @@ -11784,7 +11784,7 @@ * @see addTOC() */ protected function formatTOCPageNumber($num) { - return locale_number_format((float)$num, 0, '', '.'); + return number_format((float)$num, 0, '', '.'); } /** This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dai...@us...> - 2011-10-05 05:19:17
|
Revision: 4711 http://web-erp.svn.sourceforge.net/web-erp/?rev=4711&view=rev Author: daintree Date: 2011-10-05 05:19:10 +0000 (Wed, 05 Oct 2011) Log Message: ----------- number_format Modified Paths: -------------- trunk/PO_AuthorisationLevels.php trunk/PO_AuthoriseMyOrders.php trunk/PO_OrderDetails.php trunk/PO_PDFPurchOrder.php Modified: trunk/PO_AuthorisationLevels.php =================================================================== --- trunk/PO_AuthorisationLevels.php 2011-10-02 09:51:33 UTC (rev 4710) +++ trunk/PO_AuthorisationLevels.php 2011-10-05 05:19:10 UTC (rev 4711) @@ -119,13 +119,15 @@ $ErrMsg = _('The authentication details cannot be retrieved because'); $Result=DB_query($sql,$db,$ErrMsg); -echo '<table class="selection"><tr> +echo '<table class="selection"> + <tr> <th>' . _('User ID') . '</th> <th>' . _('User Name') . '</th> <th>' . _('Currency') . '</th> <th>' . _('Create Order') . '</th> <th>' . _('Can Release') . '<br />'. _('Invoices').'</th> - <th>' . _('Authority Level') . '</th></tr>'; + <th>' . _('Authority Level') . '</th> + </tr>'; while ($myrow=DB_fetch_array($Result)) { if ($myrow['cancreate']==0) { Modified: trunk/PO_AuthoriseMyOrders.php =================================================================== --- trunk/PO_AuthoriseMyOrders.php 2011-10-02 09:51:33 UTC (rev 4710) +++ trunk/PO_AuthoriseMyOrders.php 2011-10-05 05:19:10 UTC (rev 4711) @@ -20,13 +20,13 @@ if (mb_substr($key,0,6)=='status') { $OrderNo=mb_substr($key,6); $Status=$_POST['status'.$OrderNo]; - $Comment=date($_SESSION['DefaultDateFormat']).' - '._('Authorised by').' '.'<a href="mailto:' . $EmailRow['email'].'">'.$_SESSION['UserID'].'</a> + $Comment=date($_SESSION['DefaultDateFormat']).' - '._('Authorised by').' <a href="mailto:' . $EmailRow['email'].'">'.$_SESSION['UserID'].'</a> <br />' . $_POST['comment']; $sql="UPDATE purchorders SET status='".$Status."', stat_comment='".$Comment."', allowprint=1 - WHERE orderno='".filter_number_format($OrderNo)."'"; + WHERE orderno='". $OrderNo."'"; $result=DB_query($sql, $db); } } @@ -74,8 +74,8 @@ $AuthLevel=$myauthrow['authlevel']; $OrderValueSQL="SELECT sum(unitprice*quantityord) as ordervalue - FROM purchorderdetails - WHERE orderno='".$myrow['orderno'] . "'"; + FROM purchorderdetails + WHERE orderno='".$myrow['orderno'] . "'"; $OrderValueResult=DB_query($OrderValueSQL, $db); $MyOrderValueRow=DB_fetch_array($OrderValueResult); @@ -127,7 +127,7 @@ <td>'.$LineRow['description'].'</td> <td class="number">'.locale_number_format($LineRow['quantityord'],$DecimalPlaces).'</td> <td>'.$myrow['currcode'].'</td> - <td class="number">'.locale_number_format($LineRow['unitprice'],$myrow['decimalplaces']).'</td> + <td class="number">'.locale_number_format($LineRow['unitprice'],$myrow['currdecimalplaces']).'</td> <td class="number">'.locale_number_format($LineRow['unitprice']*$LineRow['quantityord'],$myrow['currdecimalplaces']).'</td> </tr>'; } // end while order line detail @@ -136,6 +136,5 @@ } //end while header loop echo '</table>'; echo '<br /><div class="centre"><input type="submit" name="UpdateAll" value="' . _('Update'). '"></form>'; - include('includes/footer.inc'); ?> \ No newline at end of file Modified: trunk/PO_OrderDetails.php =================================================================== --- trunk/PO_OrderDetails.php 2011-10-02 09:51:33 UTC (rev 4710) +++ trunk/PO_OrderDetails.php 2011-10-05 05:19:10 UTC (rev 4711) @@ -57,7 +57,7 @@ ON suppliers.currcode = currencies.currabrev LEFT JOIN www_users ON purchorders.initiator=www_users.userid - WHERE purchorders.orderno = '" . filter_number_format($_GET['OrderNo']) ."'"; + WHERE purchorders.orderno = '" . $_GET['OrderNo'] ."'"; $GetOrdHdrResult = DB_query($OrderHeaderSQL,$db, $ErrMsg); @@ -132,16 +132,16 @@ $ErrMsg = _('The line items of the purchase order could not be retrieved'); $LineItemsSQL = "SELECT purchorderdetails.*, stockmaster.decimalplaces - FROM purchorderdetails + FROM purchorderdetails LEFT JOIN stockmaster ON purchorderdetails.itemcode=stockmaster.stockid - WHERE purchorderdetails.orderno = '" . filter_number_format($_GET['OrderNo']) ."'"; + WHERE purchorderdetails.orderno = '" . $_GET['OrderNo'] ."'"; $LineItemsResult = db_query($LineItemsSQL,$db, $ErrMsg); echo '<table colspan="8" class="selection" cellpadding="0">'; -echo '<tr><th colspan=8><font size=3 color=navy>'. _('Order Line Details'). '</font></th></tr>'; +echo '<tr><th colspan="8"><font size="3" color="navy">'. _('Order Line Details'). '</font></th></tr>'; echo '<tr> <th>' . _('Item Code'). '</td> <th>' . _('Item Description'). '</td> Modified: trunk/PO_PDFPurchOrder.php =================================================================== --- trunk/PO_PDFPurchOrder.php 2011-10-02 09:51:33 UTC (rev 4710) +++ trunk/PO_PDFPurchOrder.php 2011-10-05 05:19:10 UTC (rev 4711) @@ -339,7 +339,7 @@ dateprinted = '" . Date('Y-m-d') . "', status = 'Printed', stat_comment = '" . DB_escape_string($StatusComment) . "' - WHERE purchorders.orderno = '" . filter_number_format($OrderNo) ."'"; + WHERE purchorders.orderno = '" . $OrderNo ."'"; $result = DB_query($sql,$db); } include('includes/footer.inc'); @@ -353,8 +353,11 @@ } echo '<br /><br />'; echo '<input type=hidden name="OrderNo" value="'. $OrderNo. '">'; - echo '<table><tr><td>'. _('Print or Email the Order'). '</td><td> - <select name="PrintOrEmail">'; + echo '<table> + <tr> + <td>'. _('Print or Email the Order'). '</td> + <td><select name="PrintOrEmail">'; + if (!isset($_POST['PrintOrEmail'])){ $_POST['PrintOrEmail'] = 'Print'; } @@ -389,7 +392,7 @@ suppliercontacts.email FROM suppliercontacts INNER JOIN purchorders ON suppliercontacts.supplierid=purchorders.supplierno - WHERE purchorders.orderno='".filter_number_format($OrderNo)."'"; + WHERE purchorders.orderno='". $OrderNo ."'"; $ContactsResult=DB_query($SQL,$db, $ErrMsg); if (DB_num_rows($ContactsResult)>0){ echo '<tr><td>'. _('Email to') .':</td><td><select name="EmailTo">'; @@ -412,8 +415,12 @@ } else { echo '</table>'; } - echo '<br /><div class="centre"><input type="submit" name="DoIt" value="' . _('OK') . '"></div>'; - echo '</form>'; + echo '<br /> + <div class="centre"> + <input type="submit" name="DoIt" value="' . _('OK') . '" /> + </div> + </form>'; + include('includes/footer.inc'); } ?> \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dai...@us...> - 2011-10-05 05:19:17
|
Revision: 4711 http://web-erp.svn.sourceforge.net/web-erp/?rev=4711&view=rev Author: daintree Date: 2011-10-05 05:19:10 +0000 (Wed, 05 Oct 2011) Log Message: ----------- number_format Modified Paths: -------------- trunk/PO_AuthorisationLevels.php trunk/PO_AuthoriseMyOrders.php trunk/PO_OrderDetails.php trunk/PO_PDFPurchOrder.php Modified: trunk/PO_AuthorisationLevels.php =================================================================== --- trunk/PO_AuthorisationLevels.php 2011-10-02 09:51:33 UTC (rev 4710) +++ trunk/PO_AuthorisationLevels.php 2011-10-05 05:19:10 UTC (rev 4711) @@ -119,13 +119,15 @@ $ErrMsg = _('The authentication details cannot be retrieved because'); $Result=DB_query($sql,$db,$ErrMsg); -echo '<table class="selection"><tr> +echo '<table class="selection"> + <tr> <th>' . _('User ID') . '</th> <th>' . _('User Name') . '</th> <th>' . _('Currency') . '</th> <th>' . _('Create Order') . '</th> <th>' . _('Can Release') . '<br />'. _('Invoices').'</th> - <th>' . _('Authority Level') . '</th></tr>'; + <th>' . _('Authority Level') . '</th> + </tr>'; while ($myrow=DB_fetch_array($Result)) { if ($myrow['cancreate']==0) { Modified: trunk/PO_AuthoriseMyOrders.php =================================================================== --- trunk/PO_AuthoriseMyOrders.php 2011-10-02 09:51:33 UTC (rev 4710) +++ trunk/PO_AuthoriseMyOrders.php 2011-10-05 05:19:10 UTC (rev 4711) @@ -20,13 +20,13 @@ if (mb_substr($key,0,6)=='status') { $OrderNo=mb_substr($key,6); $Status=$_POST['status'.$OrderNo]; - $Comment=date($_SESSION['DefaultDateFormat']).' - '._('Authorised by').' '.'<a href="mailto:' . $EmailRow['email'].'">'.$_SESSION['UserID'].'</a> + $Comment=date($_SESSION['DefaultDateFormat']).' - '._('Authorised by').' <a href="mailto:' . $EmailRow['email'].'">'.$_SESSION['UserID'].'</a> <br />' . $_POST['comment']; $sql="UPDATE purchorders SET status='".$Status."', stat_comment='".$Comment."', allowprint=1 - WHERE orderno='".filter_number_format($OrderNo)."'"; + WHERE orderno='". $OrderNo."'"; $result=DB_query($sql, $db); } } @@ -74,8 +74,8 @@ $AuthLevel=$myauthrow['authlevel']; $OrderValueSQL="SELECT sum(unitprice*quantityord) as ordervalue - FROM purchorderdetails - WHERE orderno='".$myrow['orderno'] . "'"; + FROM purchorderdetails + WHERE orderno='".$myrow['orderno'] . "'"; $OrderValueResult=DB_query($OrderValueSQL, $db); $MyOrderValueRow=DB_fetch_array($OrderValueResult); @@ -127,7 +127,7 @@ <td>'.$LineRow['description'].'</td> <td class="number">'.locale_number_format($LineRow['quantityord'],$DecimalPlaces).'</td> <td>'.$myrow['currcode'].'</td> - <td class="number">'.locale_number_format($LineRow['unitprice'],$myrow['decimalplaces']).'</td> + <td class="number">'.locale_number_format($LineRow['unitprice'],$myrow['currdecimalplaces']).'</td> <td class="number">'.locale_number_format($LineRow['unitprice']*$LineRow['quantityord'],$myrow['currdecimalplaces']).'</td> </tr>'; } // end while order line detail @@ -136,6 +136,5 @@ } //end while header loop echo '</table>'; echo '<br /><div class="centre"><input type="submit" name="UpdateAll" value="' . _('Update'). '"></form>'; - include('includes/footer.inc'); ?> \ No newline at end of file Modified: trunk/PO_OrderDetails.php =================================================================== --- trunk/PO_OrderDetails.php 2011-10-02 09:51:33 UTC (rev 4710) +++ trunk/PO_OrderDetails.php 2011-10-05 05:19:10 UTC (rev 4711) @@ -57,7 +57,7 @@ ON suppliers.currcode = currencies.currabrev LEFT JOIN www_users ON purchorders.initiator=www_users.userid - WHERE purchorders.orderno = '" . filter_number_format($_GET['OrderNo']) ."'"; + WHERE purchorders.orderno = '" . $_GET['OrderNo'] ."'"; $GetOrdHdrResult = DB_query($OrderHeaderSQL,$db, $ErrMsg); @@ -132,16 +132,16 @@ $ErrMsg = _('The line items of the purchase order could not be retrieved'); $LineItemsSQL = "SELECT purchorderdetails.*, stockmaster.decimalplaces - FROM purchorderdetails + FROM purchorderdetails LEFT JOIN stockmaster ON purchorderdetails.itemcode=stockmaster.stockid - WHERE purchorderdetails.orderno = '" . filter_number_format($_GET['OrderNo']) ."'"; + WHERE purchorderdetails.orderno = '" . $_GET['OrderNo'] ."'"; $LineItemsResult = db_query($LineItemsSQL,$db, $ErrMsg); echo '<table colspan="8" class="selection" cellpadding="0">'; -echo '<tr><th colspan=8><font size=3 color=navy>'. _('Order Line Details'). '</font></th></tr>'; +echo '<tr><th colspan="8"><font size="3" color="navy">'. _('Order Line Details'). '</font></th></tr>'; echo '<tr> <th>' . _('Item Code'). '</td> <th>' . _('Item Description'). '</td> Modified: trunk/PO_PDFPurchOrder.php =================================================================== --- trunk/PO_PDFPurchOrder.php 2011-10-02 09:51:33 UTC (rev 4710) +++ trunk/PO_PDFPurchOrder.php 2011-10-05 05:19:10 UTC (rev 4711) @@ -339,7 +339,7 @@ dateprinted = '" . Date('Y-m-d') . "', status = 'Printed', stat_comment = '" . DB_escape_string($StatusComment) . "' - WHERE purchorders.orderno = '" . filter_number_format($OrderNo) ."'"; + WHERE purchorders.orderno = '" . $OrderNo ."'"; $result = DB_query($sql,$db); } include('includes/footer.inc'); @@ -353,8 +353,11 @@ } echo '<br /><br />'; echo '<input type=hidden name="OrderNo" value="'. $OrderNo. '">'; - echo '<table><tr><td>'. _('Print or Email the Order'). '</td><td> - <select name="PrintOrEmail">'; + echo '<table> + <tr> + <td>'. _('Print or Email the Order'). '</td> + <td><select name="PrintOrEmail">'; + if (!isset($_POST['PrintOrEmail'])){ $_POST['PrintOrEmail'] = 'Print'; } @@ -389,7 +392,7 @@ suppliercontacts.email FROM suppliercontacts INNER JOIN purchorders ON suppliercontacts.supplierid=purchorders.supplierno - WHERE purchorders.orderno='".filter_number_format($OrderNo)."'"; + WHERE purchorders.orderno='". $OrderNo ."'"; $ContactsResult=DB_query($SQL,$db, $ErrMsg); if (DB_num_rows($ContactsResult)>0){ echo '<tr><td>'. _('Email to') .':</td><td><select name="EmailTo">'; @@ -412,8 +415,12 @@ } else { echo '</table>'; } - echo '<br /><div class="centre"><input type="submit" name="DoIt" value="' . _('OK') . '"></div>'; - echo '</form>'; + echo '<br /> + <div class="centre"> + <input type="submit" name="DoIt" value="' . _('OK') . '" /> + </div> + </form>'; + include('includes/footer.inc'); } ?> \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dai...@us...> - 2011-10-05 07:26:15
|
Revision: 4712 http://web-erp.svn.sourceforge.net/web-erp/?rev=4712&view=rev Author: daintree Date: 2011-10-05 07:26:06 +0000 (Wed, 05 Oct 2011) Log Message: ----------- number_formats Modified Paths: -------------- trunk/PDFBankingSummary.php trunk/PDFChequeListing.php trunk/PDFCustTransListing.php trunk/PDFCustomerList.php trunk/PDFDeliveryDifferences.php trunk/PDFGrn.php trunk/PDFLowGP.php trunk/PDFOrderStatus.php trunk/PDFOrdersInvoiced.php trunk/PDFPeriodStockTransListing.php trunk/PDFPickingList.php trunk/PDFPriceList.php trunk/PDFPrintLabel.php trunk/PDFQuotation.php trunk/PDFQuotationPortrait.php trunk/PDFReceipt.php trunk/PDFRemittanceAdvice.php trunk/PDFStockCheckComparison.php trunk/PDFStockLocTransfer.php trunk/PDFStockNegatives.php trunk/PDFStockTransfer.php trunk/PDFSuppTransListing.php trunk/PDFTopItems.php trunk/POReport.php trunk/PO_Header.php trunk/PO_SelectOSPurchOrder.php trunk/PO_SelectPurchOrder.php trunk/PageSecurity.php trunk/PaymentAllocations.php trunk/PaymentTerms.php trunk/PcAssignCashToTab.php trunk/PcAuthorizeExpenses.php trunk/PcClaimExpensesFromTab.php trunk/PcTabs.php trunk/Prices.php trunk/TopItems.php trunk/doc/INSTALL.txt trunk/doc/Manual/ManualCreatingNewSystem.html trunk/doc/Manual/ManualIntroduction.html trunk/includes/GetConfig.php Modified: trunk/PDFBankingSummary.php =================================================================== --- trunk/PDFBankingSummary.php 2011-10-05 05:19:10 UTC (rev 4711) +++ trunk/PDFBankingSummary.php 2011-10-05 07:26:06 UTC (rev 4712) @@ -32,8 +32,14 @@ while ($myrow=DB_fetch_array($result)) { echo '<option value="'.$myrow['transno'].'">'._('Batch') .' '. $myrow['transno'].' - '.ConvertSqlDate($myrow['transdate']).'</option>'; } - echo '</select></td></tr></table>'; - echo '<br /><div class="centre"><input type="submit" name="EnterBatchNo" value="' . _('Create PDF') . '"></div></form>'; + echo '</select></td> + </tr> + </table>'; + echo '<br /> + <div class="centre"> + <input type="submit" name="EnterBatchNo" value="' . _('Create PDF') . '"> + </div> + </form>'; include ('includes/footer.inc'); exit; @@ -41,21 +47,21 @@ if (isset($_POST['BatchNo']) and $_POST['BatchNo']!='') { $SQL= "SELECT bankaccountname, - bankaccountnumber, - ref, - transdate, - banktranstype, - bankact, - banktrans.exrate, - banktrans.functionalexrate, - banktrans.currcode, - currencies.decimalplaces AS currdecimalplaces - FROM bankaccounts INNER JOIN banktrans - ON bankaccounts.accountcode=banktrans.bankact - INNER JOIN currencies - ON bankaccounts.currcode=currencies.currabrev - WHERE banktrans.transno='" . $_POST['BatchNo'] . "' - AND banktrans.type=12"; + bankaccountnumber, + ref, + transdate, + banktranstype, + bankact, + banktrans.exrate, + banktrans.functionalexrate, + banktrans.currcode, + currencies.decimalplaces AS currdecimalplaces + FROM bankaccounts INNER JOIN banktrans + ON bankaccounts.accountcode=banktrans.bankact + INNER JOIN currencies + ON bankaccounts.currcode=currencies.currabrev + WHERE banktrans.transno='" . $_POST['BatchNo'] . "' + AND banktrans.type=12"; $ErrMsg = _('An error occurred getting the header information about the receipt batch number') . ' ' . $_POST['BatchNo']; $DbgMsg = _('The SQL used to get the receipt header information that failed was'); Modified: trunk/PDFChequeListing.php =================================================================== --- trunk/PDFChequeListing.php 2011-10-05 05:19:10 UTC (rev 4711) +++ trunk/PDFChequeListing.php 2011-10-05 07:26:06 UTC (rev 4712) @@ -26,17 +26,17 @@ echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/money_add.png" title="' . $title . '" alt="" />' . ' ' . $title . '</p>'; - if ($InputError==1){ - prnMsg($msg,'error'); - } + if ($InputError==1){ + prnMsg($msg,'error'); + } echo '<form method="post" action="' . $_SERVER['PHP_SELF'] . '">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; - echo '<table class=selection> - <tr> + echo '<table class="selection"> + <tr> <td>' . _('Enter the date from which cheques are to be listed') . ':</td> - <td><input type="text" name="FromDate" maxlength="10" size="10" class=date alt="' . $_SESSION['DefaultDateFormat'] . '" value="' . Date($_SESSION['DefaultDateFormat']) . '"></td> + <td><input type="text" name="FromDate" maxlength="10" size="10" class="date" alt="' . $_SESSION['DefaultDateFormat'] . '" value="' . Date($_SESSION['DefaultDateFormat']) . '" /></td> </tr>'; echo '<tr><td>' . _('Enter the date to which cheques are to be listed') . ':</td> <td><input type="text" name="ToDate" maxlength="10" size="10" class=date alt="' . $_SESSION['DefaultDateFormat'] . '" value="' . Date($_SESSION['DefaultDateFormat']) . '"></td> @@ -56,14 +56,18 @@ echo '</select></td></tr>'; - echo '<tr><td>' . _('Email the report off') . ':</td> - <td><select name="Email">'; - echo '<option selected value="No">' . _('No') . '</option>'; - echo '<option value="Yes">' . _('Yes') . '</option>'; - echo '</select></td> + echo '<tr> + <td>' . _('Email the report off') . ':</td> + <td><select name="Email"> + <option selected value="No">' . _('No') . '</option> + <option value="Yes">' . _('Yes') . '</option> + </select></td> </tr> </table> - <br /><div class="centre"><input type=submit name="Go" value="' . _('Create PDF') . '"></div>'; + <br /> + <div class="centre"> + <input type=submit name="Go" value="' . _('Create PDF') . '"> + </div>'; include('includes/footer.inc'); exit; Modified: trunk/PDFCustTransListing.php =================================================================== --- trunk/PDFCustTransListing.php 2011-10-05 05:19:10 UTC (rev 4711) +++ trunk/PDFCustTransListing.php 2011-10-05 07:26:06 UTC (rev 4712) @@ -17,8 +17,10 @@ $title = _('Customer Transaction Listing'); include ('includes/header.inc'); - echo '<div class="centre"><p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/transactions.png" title="' . $title . '" alt="">' . ' ' - . _('Customer Transaction Listing').'</p>'; + echo '<div class="centre"> + <p class="page_title_text"> + <img src="'.$rootpath.'/css/'.$theme.'/images/transactions.png" title="' . $title . '" alt="">' . ' ' . _('Customer Transaction Listing'). + '</p>'; if ($InputError==1){ prnMsg($msg,'error'); @@ -27,24 +29,25 @@ echo '<form method="post" action="' . $_SERVER['PHP_SELF'] . '">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; echo '<table class="selection"> - <tr> + <tr> <td>' . _('Enter the date for which the transactions are to be listed') . ':</td> <td><input type="text" name="Date" maxlength="10" size="10" class=date alt="' . $_SESSION['DefaultDateFormat'] . '" value="' . Date($_SESSION['DefaultDateFormat']) . '"></td> </tr>'; - echo '<tr><td>' . _('Transaction type') . '</td><td>'; + echo '<tr><td>' . _('Transaction type') . '</td> + <td><select name="TransType"> + <option value=10>' . _('Invoices') . '</option> + <option value=11>' . _('Credit Notes') . '</option> + <option value=12>' . _('Receipts') . '</option> + </select></td> + </tr>'; - echo '<select name="TransType">'; - - echo '<option value=10>' . _('Invoices') . '</option>'; - echo '<option value=11>' . _('Credit Notes') . '</option>'; - echo '<option value=12>' . _('Receipts') . '</option>'; - - echo '</select></td></tr>'; - echo '</select></td></tr> </table> - <br /><div class="centre"><input type="submit" name="Go" value="' . _('Create PDF') . '"></div>'; + <br /> + <div class="centre"> + <input type="submit" name="Go" value="' . _('Create PDF') . '"> + </div>'; include('includes/footer.inc'); exit; Modified: trunk/PDFCustomerList.php =================================================================== --- trunk/PDFCustomerList.php 2011-10-05 05:19:10 UTC (rev 4711) +++ trunk/PDFCustomerList.php 2011-10-05 07:26:06 UTC (rev 4712) @@ -28,141 +28,141 @@ if (in_array('All', $_POST['Areas'])){ if (in_array('All', $_POST['SalesPeople'])){ - $SQL = 'SELECT debtorsmaster.debtorno, - debtorsmaster.name, - debtorsmaster.address1, - debtorsmaster.address2, - debtorsmaster.address3, - debtorsmaster.address4, - debtorsmaster.address5, - debtorsmaster.address6, - debtorsmaster.salestype, - custbranch.branchcode, - custbranch.brname, - custbranch.braddress1, - custbranch.braddress2, - custbranch.braddress3, - custbranch.braddress4, - custbranch.braddress5, - custbranch.braddress6, - custbranch.contactname, - custbranch.phoneno, - custbranch.faxno, - custbranch.email, - custbranch.area, - custbranch.salesman, - areas.areadescription, - salesman.salesmanname - FROM debtorsmaster INNER JOIN custbranch - ON debtorsmaster.debtorno=custbranch.debtorno - INNER JOIN areas - ON custbranch.area = areas.areacode - INNER JOIN salesman - ON custbranch.salesman=salesman.salesmancode - ORDER BY area, - salesman, - debtorsmaster.debtorno, - custbranch.branchcode'; + $SQL = "SELECT debtorsmaster.debtorno, + debtorsmaster.name, + debtorsmaster.address1, + debtorsmaster.address2, + debtorsmaster.address3, + debtorsmaster.address4, + debtorsmaster.address5, + debtorsmaster.address6, + debtorsmaster.salestype, + custbranch.branchcode, + custbranch.brname, + custbranch.braddress1, + custbranch.braddress2, + custbranch.braddress3, + custbranch.braddress4, + custbranch.braddress5, + custbranch.braddress6, + custbranch.contactname, + custbranch.phoneno, + custbranch.faxno, + custbranch.email, + custbranch.area, + custbranch.salesman, + areas.areadescription, + salesman.salesmanname + FROM debtorsmaster INNER JOIN custbranch + ON debtorsmaster.debtorno=custbranch.debtorno + INNER JOIN areas + ON custbranch.area = areas.areacode + INNER JOIN salesman + ON custbranch.salesman=salesman.salesmancode + ORDER BY area, + salesman, + debtorsmaster.debtorno, + custbranch.branchcode"; } else { /* there are a range of salesfolk selected need to build the where clause */ - $SQL = 'SELECT debtorsmaster.debtorno, - debtorsmaster.name, - debtorsmaster.address1, - debtorsmaster.address2, - debtorsmaster.address3, - debtorsmaster.address4, - debtorsmaster.address5, - debtorsmaster.address6, - debtorsmaster.salestype, - custbranch.branchcode, - custbranch.brname, - custbranch.braddress1, - custbranch.braddress2, - custbranch.braddress3, - custbranch.braddress4, - custbranch.braddress5, - custbranch.braddress6, - custbranch.contactname, - custbranch.phoneno, - custbranch.faxno, - custbranch.email, - custbranch.area, - custbranch.salesman, - areas.areadescription, - salesman.salesmanname - FROM debtorsmaster INNER JOIN custbranch - ON debtorsmaster.debtorno=custbranch.debtorno - INNER JOIN areas - ON custbranch.area = areas.areacode - INNER JOIN salesman - ON custbranch.salesman=salesman.salesmancode - WHERE ('; + $SQL = "SELECT debtorsmaster.debtorno, + debtorsmaster.name, + debtorsmaster.address1, + debtorsmaster.address2, + debtorsmaster.address3, + debtorsmaster.address4, + debtorsmaster.address5, + debtorsmaster.address6, + debtorsmaster.salestype, + custbranch.branchcode, + custbranch.brname, + custbranch.braddress1, + custbranch.braddress2, + custbranch.braddress3, + custbranch.braddress4, + custbranch.braddress5, + custbranch.braddress6, + custbranch.contactname, + custbranch.phoneno, + custbranch.faxno, + custbranch.email, + custbranch.area, + custbranch.salesman, + areas.areadescription, + salesman.salesmanname + FROM debtorsmaster INNER JOIN custbranch + ON debtorsmaster.debtorno=custbranch.debtorno + INNER JOIN areas + ON custbranch.area = areas.areacode + INNER JOIN salesman + ON custbranch.salesman=salesman.salesmancode + WHERE ("; $i=0; foreach ($_POST['SalesPeople'] as $Salesperson){ if ($i>0){ - $SQL .= ' OR '; + $SQL .= " OR "; } $i++; $SQL .= "custbranch.salesman='" . $Salesperson ."'"; } - $SQL .=') ORDER BY area, + $SQL .=") ORDER BY area, salesman, debtorsmaster.debtorno, - custbranch.branchcode'; + custbranch.branchcode"; } /*end if SalesPeople =='All' */ } else { /* not all sales areas has been selected so need to build the where clause */ if (in_array('All', $_POST['SalesPeople'])){ - $SQL = 'SELECT debtorsmaster.debtorno, - debtorsmaster.name, - debtorsmaster.address1, - debtorsmaster.address2, - debtorsmaster.address3, - debtorsmaster.address4, - debtorsmaster.address5, - debtorsmaster.address6, - debtorsmaster.salestype, - custbranch.branchcode, - custbranch.brname, - custbranch.braddress1, - custbranch.braddress2, - custbranch.braddress3, - custbranch.braddress4, - custbranch.braddress5, - custbranch.braddress6, - custbranch.contactname, - custbranch.phoneno, - custbranch.faxno, - custbranch.email, - custbranch.area, - custbranch.salesman, - areas.areadescription, - salesman.salesmanname - FROM debtorsmaster INNER JOIN custbranch - ON debtorsmaster.debtorno=custbranch.debtorno - INNER JOIN areas - ON custbranch.area = areas.areacode - INNER JOIN salesman - ON custbranch.salesman=salesman.salesmancode - WHERE ('; - + $SQL = "SELECT debtorsmaster.debtorno, + debtorsmaster.name, + debtorsmaster.address1, + debtorsmaster.address2, + debtorsmaster.address3, + debtorsmaster.address4, + debtorsmaster.address5, + debtorsmaster.address6, + debtorsmaster.salestype, + custbranch.branchcode, + custbranch.brname, + custbranch.braddress1, + custbranch.braddress2, + custbranch.braddress3, + custbranch.braddress4, + custbranch.braddress5, + custbranch.braddress6, + custbranch.contactname, + custbranch.phoneno, + custbranch.faxno, + custbranch.email, + custbranch.area, + custbranch.salesman, + areas.areadescription, + salesman.salesmanname + FROM debtorsmaster INNER JOIN custbranch + ON debtorsmaster.debtorno=custbranch.debtorno + INNER JOIN areas + ON custbranch.area = areas.areacode + INNER JOIN salesman + ON custbranch.salesman=salesman.salesmancode + WHERE ("; + $i=0; foreach ($_POST['Areas'] as $Area){ if ($i>0){ - $SQL .= ' OR '; + $SQL .= " OR "; } $i++; $SQL .= "custbranch.area='" . $Area ."'"; } - $SQL .= ') ORDER BY custbranch.area, + $SQL .= ") ORDER BY custbranch.area, custbranch.salesman, debtorsmaster.debtorno, - custbranch.branchcode'; + custbranch.branchcode"; } else { /* there are a range of salesfolk selected need to build the where clause */ - $SQL = 'SELECT debtorsmaster.debtorno, + $SQL = "SELECT debtorsmaster.debtorno, debtorsmaster.name, debtorsmaster.address1, debtorsmaster.address2, @@ -193,32 +193,32 @@ ON custbranch.area = areas.areacode INNER JOIN salesman ON custbranch.salesman=salesman.salesmancode - WHERE ('; + WHERE ("; $i=0; foreach ($_POST['Areas'] as $Area){ if ($i>0){ - $SQL .= ' OR '; + $SQL .= " OR "; } $i++; $SQL .= "custbranch.area='" . $Area ."'"; } - $SQL .= ') AND ('; + $SQL .= ") AND ("; $i=0; foreach ($_POST['SalesPeople'] as $Salesperson){ if ($i>0){ - $SQL .= ' OR '; + $SQL .= " OR "; } $i++; $SQL .= "custbranch.salesman='" . $Salesperson ."'"; } - $SQL .=') ORDER BY custbranch.area, + $SQL .=") ORDER BY custbranch.area, custbranch.salesman, debtorsmaster.debtorno, - custbranch.branchcode'; + custbranch.branchcode"; } /*end if Salesfolk =='All' */ } /* end if not all sales areas was selected */ @@ -261,11 +261,11 @@ since the date entered */ $SQL = "SELECT SUM((ovamount+ovfreight+ovdiscount)/rate) AS turnover - FROM debtortrans - WHERE debtorno='" . $Customers['debtorno'] . "' - AND branchcode='" . $Customers['branchcode'] . "' - AND (type=10 or type=11) - AND trandate >='" . FormatDateForSQL($_POST['ActivitySince']). "'"; + FROM debtortrans + WHERE debtorno='" . $Customers['debtorno'] . "' + AND branchcode='" . $Customers['branchcode'] . "' + AND (type=10 or type=11) + AND trandate >='" . FormatDateForSQL($_POST['ActivitySince']). "'"; $ActivityResult = DB_query($SQL, $db, _('Could not retrieve the activity of the branch because'), _('The failed SQL was')); $ActivityRow = DB_fetch_row($ActivityResult); @@ -382,10 +382,10 @@ } echo '</select></td></tr>'; - echo '<tr><td>' . _('For Sales folk'). ':</td><td><select name=SalesPeople[] multiple>'; + echo '<tr><td>' . _('For Sales folk'). ':</td> + <td><select name=SalesPeople[] multiple> + <option selected value="All">'. _('All sales folk') . '</option>'; - echo '<option selected value="All">'. _('All sales folk'); - $sql = "SELECT salesmancode, salesmanname FROM salesman"; $SalesFolkResult = DB_query($sql,$db); @@ -394,20 +394,28 @@ } echo '</select></td></tr>'; - echo '<tr><td>' . _('Level Of Activity'). ':</td><td><select name="Activity">'; + echo '<tr><td>' . _('Level Of Activity'). ':</td> + <td><select name="Activity"> + <option selected value="All">'. _('All customers') . '</option> + <option value="GreaterThan">'. _('Sales Greater Than') . '</option> + <option value="LessThan">'. _('Sales Less Than') . '</option> + </select></td> + <td>'; - echo '<option selected value="All">'. _('All customers') . '</option>'; - echo '<option value="GreaterThan">'. _('Sales Greater Than') . '</option>'; - echo '<option value="LessThan">'. _('Sales Less Than') . '</option>'; - echo '</select></td><td>'; + echo '<input type="text" class="number" name="ActivityAmount" size="8" maxlength="8" value=0></td> + </tr>'; - echo '<input type="text" class=number name="ActivityAmount" size=8 maxlength=8 value=0></td></tr>'; - $DefaultActivitySince = Date($_SESSION['DefaultDateFormat'], Mktime(0,0,0,Date('m')-6,0,Date('y'))); - echo '<tr><td>' . _('Activity Since'). ':</td> - <td><input type="text" class=date alt="'.$_SESSION['DefaultDateFormat'].'" name="ActivitySince" size=10 maxlength=10 value="' . $DefaultActivitySince . '"></td></tr>'; + echo '<tr> + <td>' . _('Activity Since'). ':</td> + <td><input type="text" class=date alt="'.$_SESSION['DefaultDateFormat'].'" name="ActivitySince" size="10" maxlength="10" value="' . $DefaultActivitySince . '"></td> + </tr>'; - echo '</table><br /><div class="centre"><input type=Submit Name="PrintPDF" Value="'. _('Print PDF'). '"></div>'; + echo '</table> + <br /> + <div class="centre"> + <input type=Submit Name="PrintPDF" value="'. _('Print PDF'). '"> + </div>'; include('includes/footer.inc'); Modified: trunk/PDFDeliveryDifferences.php =================================================================== --- trunk/PDFDeliveryDifferences.php 2011-10-05 05:19:10 UTC (rev 4711) +++ trunk/PDFDeliveryDifferences.php 2011-10-05 07:26:06 UTC (rev 4712) @@ -26,30 +26,39 @@ echo '<form method="post" action="' . $_SERVER['PHP_SELF'] . '">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; - echo '<table class=selection> + echo '<table class="selection"> <tr> <td>' . _('Enter the date from which variances between orders and deliveries are to be listed') . ':</td> - <td><input type="text" class="date" alt="' . $_SESSION['DefaultDateFormat']. '" name="FromDate" maxlength="10" size="10" value="' . Date($_SESSION['DefaultDateFormat'], Mktime(0,0,0,Date('m')-1,0,Date('y'))) . '"></td> + <td><input type="text" class="date" alt="' . $_SESSION['DefaultDateFormat']. '" name="FromDate" maxlength="10" size="10" value="' . Date($_SESSION['DefaultDateFormat'], Mktime(0,0,0,Date('m')-1,0,Date('y'))) . '" /></td> </tr>'; - echo '<tr> - <td>' . _('Enter the date to which variances between orders and deliveries are to be listed') . ':</td><td><input type="text" class="date" alt="' . $_SESSION['DefaultDateFormat']. '" name="ToDate" maxlength="10" size="10" value="' . Date($_SESSION['DefaultDateFormat']) . '"></td> + echo '<tr> + <td>' . _('Enter the date to which variances between orders and deliveries are to be listed') . ':</td><td><input type="text" class="date" alt="' . $_SESSION['DefaultDateFormat']. '" name="ToDate" maxlength="10" size="10" value="' . Date($_SESSION['DefaultDateFormat']) . '" /></td> </tr>'; - echo '<tr><td>' . _('Inventory Category') . '</td><td>'; + echo '<tr> + <td>' . _('Inventory Category') . '</td> + <td>'; - $sql = "SELECT categorydescription, categoryid FROM stockcategory WHERE stocktype<>'D' AND stocktype<>'L'"; - $result = DB_query($sql,$db); + $sql = "SELECT categorydescription, + categoryid + FROM stockcategory + WHERE stocktype<>'D' + AND stocktype<>'L'"; + + $result = DB_query($sql,$db); - echo '<select name="CategoryID">'; - echo '<option selected value="All">' . _('Over All Categories') . '</option>'; + echo '<select name="CategoryID"> + <option selected value="All">' . _('Over All Categories') . '</option>'; while ($myrow=DB_fetch_array($result)){ echo '<option value="' . $myrow['categoryid'] . '">' . $myrow['categorydescription'] . '</option>'; } - echo '</select></td></tr>'; + echo '</select></td> + </tr>'; - echo '<tr><td>' . _('Inventory Location') . ':</td> + echo '<tr> + <td>' . _('Inventory Location') . ':</td> <td><select name="Location"> <option selected value="All">' . _('All Locations') . '</option>'; @@ -59,16 +68,18 @@ } echo '</select></td></tr>'; - echo '<tr><td>' . _('Email the report off') . ':</td> + echo '<tr> + <td>' . _('Email the report off') . ':</td> <td><select name="Email"> <option selected value="No">' . _('No') . '</option> <option value="Yes">' . _('Yes') . '</option> - </select> - </td> + </select></td> </tr> </table> <br /> - <div class="centre"><input type="submit" name="Go" value="' . _('Create PDF') . '"></div>'; + <div class="centre"> + <input type="submit" name="Go" value="' . _('Create PDF') . '"> + </div>'; if ($InputError==1){ prnMsg($msg,'error'); @@ -84,6 +95,7 @@ orderdeliverydifferenceslog.orderno, orderdeliverydifferenceslog.stockid, stockmaster.description, + stockmaster.decimalplaces, quantitydiff, trandate, orderdeliverydifferenceslog.debtorno, @@ -100,6 +112,7 @@ orderdeliverydifferenceslog.orderno, orderdeliverydifferenceslog.stockid, stockmaster.description, + stockmaster.decimalplaces, quantitydiff, trandate, orderdeliverydifferenceslog.debtorno, @@ -117,6 +130,7 @@ orderdeliverydifferenceslog.orderno, orderdeliverydifferenceslog.stockid, stockmaster.description, + stockmaster.decimalplaces, quantitydiff, trandate, orderdeliverydifferenceslog.debtorno, @@ -138,6 +152,7 @@ orderdeliverydifferenceslog.orderno, orderdeliverydifferenceslog.stockid, stockmaster.description, + stockmaster.decimalplaces, quantitydiff, trandate, orderdeliverydifferenceslog.debtorno, @@ -162,7 +177,7 @@ include('includes/header.inc'); prnMsg( _('An error occurred getting the variances between deliveries and orders'),'error'); if ($debug==1){ - prnMsg( _('The SQL used to get the variances between deliveries and orders that failed was') . "<br />$SQL",'error'); + prnMsg( _('The SQL used to get the variances between deliveries and orders that failed was') . '<br />' . $SQL,'error'); } include ('includes/footer.inc'); exit; @@ -195,7 +210,7 @@ $LeftOvers = $pdf->addTextWrap($Left_Margin+40,$YPos,40,$FontSize,$myrow['orderno'], 'left'); $LeftOvers = $pdf->addTextWrap($Left_Margin+80,$YPos,200,$FontSize,$myrow['stockid'] . ' - ' . $myrow['description'], 'left'); - $LeftOvers = $pdf->addTextWrap($Left_Margin+280,$YPos,50,$FontSize,locale_number_format($myrow['quantitydiff']), 'right'); + $LeftOvers = $pdf->addTextWrap($Left_Margin+280,$YPos,50,$FontSize,locale_number_format($myrow['quantitydiff'],$myrow['decimalplaces']), 'right'); $LeftOvers = $pdf->addTextWrap($Left_Margin+335,$YPos,50,$FontSize,$myrow['debtorno'], 'left'); $LeftOvers = $pdf->addTextWrap($Left_Margin+385,$YPos,50,$FontSize,$myrow['branch'], 'left'); $LeftOvers = $pdf->addTextWrap($Left_Margin+435,$YPos,50,$FontSize,ConvertSQLDate($myrow['trandate']), 'left'); Modified: trunk/PDFGrn.php =================================================================== --- trunk/PDFGrn.php 2011-10-05 05:19:10 UTC (rev 4711) +++ trunk/PDFGrn.php 2011-10-05 07:26:06 UTC (rev 4712) @@ -54,7 +54,7 @@ ON grns.podetailitem=purchorderdetails.podetailitem LEFT JOIN stockmaster ON grns.itemcode=stockmaster.stockid - WHERE grnbatch='".filter_number_format($GRNNo)."'"; + WHERE grnbatch='". $GRNNo ."'"; $GRNResult=DB_query($sql, $db); $NoOfGRNs = DB_num_rows($GRNResult); @@ -69,7 +69,7 @@ suppliers.address6 FROM grns INNER JOIN suppliers ON grns.supplierid=suppliers.supplierid - WHERE grnbatch='".filter_number_format($GRNNo)."'"; + WHERE grnbatch='". $GRNNo ."'"; $SuppResult = DB_query($sql,$db,_('Could not get the supplier of the selected GRN')); $SuppRow = DB_fetch_array($SuppResult); } @@ -88,7 +88,7 @@ $DecimalPlaces=2; } if (is_numeric($myrow['conversionfactor']) AND $myrow['conversionfactor'] !=0){ - $SuppliersQuantity=locale_number_format(filter_number_format($myrow['qtyrecd']/$myrow['conversionfactor']),$DecimalPlaces); + $SuppliersQuantity=locale_number_format($myrow['qtyrecd']/$myrow['conversionfactor'],$DecimalPlaces); } else { $SuppliersQuantity=locale_number_format($myrow['qtyrecd'],$DecimalPlaces); } Modified: trunk/PDFLowGP.php =================================================================== --- trunk/PDFLowGP.php 2011-10-05 05:19:10 UTC (rev 4711) +++ trunk/PDFLowGP.php 2011-10-05 07:26:06 UTC (rev 4712) @@ -47,7 +47,7 @@ ON stockmoves.debtorno=debtorsmaster.debtorno WHERE stockmoves.trandate >= '" . FormatDateForSQL($_POST['FromDate']) . "' AND stockmoves.trandate <= '" . FormatDateForSQL($_POST['ToDate']) . "' - AND ((stockmoves.price*(1-stockmoves.discountpercent)) - (stockmaster.materialcost + stockmaster.labourcost + stockmaster.overheadcost))/(stockmoves.price*(1-stockmoves.discountpercent)) <=" . filter_number_format(filter_number_format($_POST['GPMin'])/100) . " + AND ((stockmoves.price*(1-stockmoves.discountpercent)) - (stockmaster.materialcost + stockmaster.labourcost + stockmaster.overheadcost))/(stockmoves.price*(1-stockmoves.discountpercent)) <=" . $_POST['GPMin']/100 . " ORDER BY stockmaster.stockid"; $LowGPSalesResult = DB_query($SQL,$db,'','',false,false); @@ -129,21 +129,21 @@ echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; echo '<tr><td>' . _('Sales Made From') . ' (' . _('in the format') . ' ' . $_SESSION['DefaultDateFormat'] . '):</td> - <td><input type="text" class="date" alt="' . $_SESSION['DefaultDateFormat'] . '" name="FromDate" size=10 maxlength="10" value="' . $_POST['FromDate'] . '"></td> + <td><input type="text" class="date" alt="' . $_SESSION['DefaultDateFormat'] . '" name="FromDate" size=10 maxlength="10" value="' . $_POST['FromDate'] . '" /></td> </tr>'; echo '<tr><td>' . _('Sales Made To') . ' (' . _('in the format') . ' ' . $_SESSION['DefaultDateFormat'] . '):</td> - <td><input type="text" class="date" alt="' . $_SESSION['DefaultDateFormat'] . '" name="ToDate" size="10" maxlength="10" value="' . $_POST['ToDate'] . '"></td> + <td><input type="text" class="date" alt="' . $_SESSION['DefaultDateFormat'] . '" name="ToDate" size="10" maxlength="10" value="' . $_POST['ToDate'] . '" /></td> </tr>'; echo '<tr><td>' . _('Show sales with GP') . '%' . _('below') . ':</td> - <td><input type="text" class="number" name="GPMin" maxlength="3" size="3" value="' . $_POST['GPMin'] . '"></td> + <td><input type="text" class="number" name="GPMin" maxlength="3" size="3" value="' . $_POST['GPMin'] . '" /></td> </tr>'; echo '</table> <br /> <div class="centre"> - <input type="submit" name="PrintPDF" value="' . _('Print PDF') . '"> + <input type="submit" name="PrintPDF" value="' . _('Print PDF') . '" /> </div>'; } include('includes/footer.inc'); Modified: trunk/PDFOrderStatus.php =================================================================== --- trunk/PDFOrderStatus.php 2011-10-05 05:19:10 UTC (rev 4711) +++ trunk/PDFOrderStatus.php 2011-10-05 07:26:06 UTC (rev 4712) @@ -34,7 +34,7 @@ echo '<table class="selection"> <tr> <td>' . _('Enter the date from which orders are to be listed') . ':</td> - <td><input type="text" class="date" alt="' . $_SESSION['DefaultDateFormat'] . '" name="FromDate" maxlength=10 size=10 value="' . Date($_SESSION['DefaultDateFormat'], Mktime(0,0,0,Date('m'),Date('d')-1,Date('y'))) . '"></td> + <td><input type="text" class="date" alt="' . $_SESSION['DefaultDateFormat'] . '" name="FromDate" maxlength=10 size=10 value="' . Date($_SESSION['DefaultDateFormat'], Mktime(0,0,0,Date('m'),Date('d')-1,Date('y'))) . '" /></td> </tr>'; echo '<tr><td>' . _('Enter the date to which orders are to be listed') . ':</td><td>'; echo '<input type="text" class="date" alt="' . $_SESSION['DefaultDateFormat'] . '" name="ToDate" maxlength=10 size=10 value="' . Date($_SESSION['DefaultDateFormat']) . '"></td></tr>'; Modified: trunk/PDFOrdersInvoiced.php =================================================================== --- trunk/PDFOrdersInvoiced.php 2011-10-05 05:19:10 UTC (rev 4711) +++ trunk/PDFOrdersInvoiced.php 2011-10-05 07:26:06 UTC (rev 4712) @@ -290,7 +290,7 @@ if($OrderNo != $myrow['orderno']){ if ($AccumOrderTotal !=0){ $LeftOvers = $pdf->addTextWrap($Left_Margin+250,$YPos,120,$FontSize,_('Total Invoiced for order') . ' ' . $OrderNo , 'left'); - $LeftOvers = $pdf->addTextWrap($Left_Margin+360,$YPos,80,$FontSize,locale_number_format(filter_number_format($AccumOrderTotal),$_SESSION['CompanyRecord']['decimalplaces']), 'right'); + $LeftOvers = $pdf->addTextWrap($Left_Margin+360,$YPos,80,$FontSize,locale_number_format($AccumOrderTotal,$_SESSION['CompanyRecord']['decimalplaces']), 'right'); $YPos -= ($line_height); $AccumOrderTotal =0; } @@ -395,7 +395,7 @@ while ($InvRow=DB_fetch_array($InvoicesResult)){ - $ValueInvoiced = filter_number_format($InvRow['price']*$InvRow['quantity']); + $ValueInvoiced = $InvRow['price']*$InvRow['quantity']; $LeftOvers = $pdf->addTextWrap($Left_Margin+150,$YPos,90,$FontSize,$InvRow['typename'] . ' ' . $InvRow['transno'], 'left'); $LeftOvers = $pdf->addTextWrap($Left_Margin+240,$YPos,60,$FontSize,locale_number_format($InvRow['quantity'],$myrow['decimalplaces']), 'right'); @@ -424,7 +424,7 @@ $YPos -= ($line_height); $LeftOvers = $pdf->addTextWrap($Left_Margin+260,$YPos,100,$FontSize,_('GRAND TOTAL INVOICED'), 'right'); -$LeftOvers = $pdf->addTextWrap($Left_Margin+360,$YPos,80,$FontSize,locale_number_format(filter_number_format($AccumTotalInv),$_SESSION['CompanyRecord']['decimalplaces']), 'right'); +$LeftOvers = $pdf->addTextWrap($Left_Margin+360,$YPos,80,$FontSize,locale_number_format($AccumTotalInv,$_SESSION['CompanyRecord']['decimalplaces']), 'right'); $YPos -= ($line_height); $pdf->OutputD($_SESSION['DatabaseName'] . '_OrdersInvoiced_' . date('Y-m-d') . '.pdf'); Modified: trunk/PDFPeriodStockTransListing.php =================================================================== --- trunk/PDFPeriodStockTransListing.php 2011-10-05 05:19:10 UTC (rev 4711) +++ trunk/PDFPeriodStockTransListing.php 2011-10-05 07:26:06 UTC (rev 4712) @@ -46,16 +46,18 @@ <option value=17>' . _('Stock Adjustment').'</option> <option value=25>' . _('Purchase Order Delivery').'</option> <option value=26>' . _('Work Order Receipt').'</option> - <option value=28>' . _('Work Order Issue').'</option>'; + <option value=28>' . _('Work Order Issue').'</option> + </select></td> + </tr>'; - echo '</select></td></tr>'; - $sql = "SELECT loccode, locationname FROM locations"; $resultStkLocs = DB_query($sql, $db); - echo '<tr><td>' . _('For Stock Location') . ':</td> - <td><select name="StockLocation">'; - echo '<option value="All">' . _('All') . '</option>'; + echo '<tr> + <td>' . _('For Stock Location') . ':</td> + <td><select name="StockLocation"> + <option value="All">' . _('All') . '</option>'; + while ($myrow=DB_fetch_array($resultStkLocs)){ if (isset($_POST['StockLocation']) AND $_POST['StockLocation']!='All'){ if ($myrow['loccode'] == $_POST['StockLocation']){ Modified: trunk/PDFPickingList.php =================================================================== --- trunk/PDFPickingList.php 2011-10-05 05:19:10 UTC (rev 4711) +++ trunk/PDFPickingList.php 2011-10-05 07:26:06 UTC (rev 4712) @@ -12,13 +12,13 @@ $title = _('Picking Lists Not Enabled'); include('includes/header.inc'); echo '<br />'; - prnMsg( _('The system is not configured for picking lists. Please consult your system administrator.'), 'info'); + prnMsg( _('The system is not configured for picking lists. A configuration parameter is required where picking slips are required. Please consult your system administrator.'), 'info'); include('includes/footer.inc'); exit; } /* Show selection screen if we have no orders to work with */ -if ((!isset($_GET['TransNo']) or $_GET['TransNo']=="") and !isset($_POST['TransDate'])){ +if ((!isset($_GET['TransNo']) or $_GET['TransNo']=='') and !isset($_POST['TransDate'])){ $title = _('Select Picking Lists'); include('includes/header.inc'); $sql="SELECT loccode, @@ -28,17 +28,24 @@ echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/sales.png" title="' . _('Search') . '" alt="" />' . ' ' . $title.'</p><br />'; echo '<form action="' . $_SERVER['PHP_SELF'] . '" method="post" name="form">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; - echo '<table class="selection"><tr>'; - echo '<td>'._('Create picking lists for all deliveries to be made on').' : '.'</td>'; - echo '<td><input type="text" class="date" alt="'.$_SESSION['DefaultDateFormat'].'" name="TransDate" maxlength=10 size=11 value='.date($_SESSION['DefaultDateFormat'], mktime(date('m'),date('Y'),date('d')+1)).'></td></tr>'; + echo '<table class="selection"> + <tr> + <td>'._('Create picking lists for all deliveries to be made on').' : '.'</td> + <td><input type="text" class="date" alt="'.$_SESSION['DefaultDateFormat'].'" name="TransDate" maxlength="10" size="11" value="'.date($_SESSION['DefaultDateFormat'], mktime(date('m'),date('Y'),date('d')+1)).'" /></td> + </tr>'; echo '<tr><td>'._('From Warehouse').' : '.'</td> <td><select name="loccode">'; while ($myrow=DB_fetch_array($result)) { echo '<option value='.$myrow['loccode'].'>'.$myrow['locationname'].'</option>'; } - echo '</select></td></tr>'; - echo '</table>'; - echo '<br /><div class="centre"><input type="submit" name="Process" value="' . _('Print Picking Lists') . '"></div></form>'; + echo '</select></td> + </tr> + </table>'; + echo '<br /> + <div class="centre"> + <input type="submit" name="Process" value="' . _('Print Picking Lists') . '"> + </div> + </form>'; include('includes/footer.inc'); exit(); } @@ -46,7 +53,7 @@ /*retrieve the order details from the database to print */ $ErrMsg = _('There was a problem retrieving the order header details from the database'); -if (!isset($_POST['TransDate']) and $_GET['TransNo'] != 'Preview') { +if (!isset($_POST['TransDate']) AND $_GET['TransNo'] != 'Preview') { /* If there is no transaction date set, then it must be for a single order */ $sql = "SELECT salesorders.debtorno, salesorders.orderno, @@ -80,7 +87,7 @@ WHERE salesorders.debtorno=debtorsmaster.debtorno AND salesorders.shipvia=shippers.shipper_id AND salesorders.fromstkloc=locations.loccode - AND salesorders.orderno='" . filter_number_format($_GET['TransNo'])."'"; + AND salesorders.orderno='" . $_GET['TransNo']."'"; } else if (isset($_POST['TransDate']) OR (isset($_GET['TransNo']) AND $_GET['TransNo'] != 'Preview')) { /* We are printing picking lists for all orders on a day */ @@ -117,22 +124,26 @@ AND salesorders.shipvia=shippers.shipper_id AND salesorders.fromstkloc=locations.loccode AND salesorders.fromstkloc='".$_POST['loccode']."' - AND salesorders.deliverydate='" . FormatDateForSQL($_POST['TransDate'])."'"; + AND salesorders.deliverydate<='" . FormatDateForSQL($_POST['TransDate'])."'"; } if (isset($_POST['TransDate']) OR (isset($_GET['TransNo']) AND $_GET['TransNo'] != 'Preview')) { $result=DB_query($sql,$db, $ErrMsg); - + /*if there are no rows, there's a problem. */ if (DB_num_rows($result)==0){ $title = _('Print Picking List Error'); include('includes/header.inc'); echo '<br />'; prnMsg( _('Unable to Locate any orders for this criteria '), 'info'); - echo '<br /><table class="selection"><tr><td> - <a href="'. $rootpath . '/PDFPickingList.php">' . _('Enter Another Date') . '</a> - </td></tr></table><br />'; + echo '<br /> + <table class="selection"> + <tr> + <td><a href="'. $rootpath . '/PDFPickingList.php">' . _('Enter Another Date') . '</a></td> + </tr> + </table> + <br />'; include('includes/footer.inc'); exit(); } @@ -207,10 +218,10 @@ /* Are there any picking lists for this order already */ $sql="SELECT COUNT(orderno) FROM pickinglists - WHERE orderno='" . filter_number_format($OrdersToPick[$i]['orderno']) . "'"; - $countresult=DB_query($sql, $db); - $count=DB_fetch_row($countresult); - if ($count[0]==0) { + WHERE orderno='" . $OrdersToPick[$i]['orderno'] . "'"; + $CountResult=DB_query($sql, $db); + $Count=DB_fetch_row($CountResult); + if ($Count[0]==0) { /* There are no previous picking lists for this order */ $sql = "SELECT salesorderdetails.stkcode, stockmaster.description, @@ -223,7 +234,7 @@ FROM salesorderdetails INNER JOIN stockmaster ON salesorderdetails.stkcode=stockmaster.stockid - WHERE salesorderdetails.orderno='" . filer_locale_number_format($OrdersToPick[$i]['orderno']) ."'"; + WHERE salesorderdetails.orderno='" . $OrdersToPick[$i]['orderno'] ."'"; } else { /* There are previous picking lists for this order so * need to take those quantities into account @@ -245,22 +256,25 @@ ON salesorderdetails.orderno=pickinglists.orderno LEFT JOIN pickinglistdetails ON pickinglists.pickinglistno=pickinglistdetails.pickinglistno - WHERE salesorderdetails.orderno='" . filter_number_format($OrdersToPick[$i]['orderno']) ."' + WHERE salesorderdetails.orderno='" . $OrdersToPick[$i]['orderno'] ."' AND salesorderdetails.orderlineno=pickinglistdetails.orderlineno"; } - $lineresult=DB_query($sql,$db, $ErrMsg); + $LineResult=DB_query($sql,$db, $ErrMsg); } - if ((isset($_GET['TransNo']) and $_GET['TransNo'] == 'Preview') or (isset($lineresult) and DB_num_rows($lineresult)>0)){ + if ((isset($_GET['TransNo']) + AND $_GET['TransNo'] == 'Preview') + OR (isset($LineResult) + AND DB_num_rows($LineResult)>0)){ /*Yes there are line items to start the ball rolling with a page header */ include('includes/PDFPickingListHeader.inc'); if (isset($_POST['TransDate']) or (isset($_GET['TransNo']) and $_GET['TransNo'] != 'Preview')) { - $LinesToShow=DB_num_rows($lineresult); + $LinesToShow=DB_num_rows($LineResult); $PickingListNo = GetNextTransNo(19, $db); $sql="INSERT INTO pickinglists VALUES ( '" . $PickingListNo ."', - '" . filter_number_format($OrdersToPick[$i]['orderno'])."', + '" . $OrdersToPick[$i]['orderno']."', '" . FormatDateForSQL($_POST['TransDate'])."', '" . date('Y-m-d')."', '0000-00-00')"; @@ -274,6 +288,7 @@ while ($Lines<$LinesToShow){ if (isset($_GET['TransNo']) and $_GET['TransNo'] == 'Preview') { $myrow2['stkcode']=str_pad('',10,'x'); + $myrow2['decimalplaces']=2; $DisplayQty='XXXX.XX'; $DisplayPrevDel='XXXX.XX'; $DisplayQtySupplied='XXXX.XX'; @@ -281,23 +296,23 @@ $myrow2['narrative']=str_pad('',18,'x'); $itemdesc = $myrow2['description'] . ' - ' . $myrow2['narrative']; } else { - $myrow2=DB_fetch_array($lineresult); - if ($count[0]==0) { + $myrow2=DB_fetch_array($LineResult); + if ($Count[0]==0) { $myrow2['qtyexpected']=0; $myrow2['qtypicked']=0; } $DisplayQty = locale_number_format($myrow2['quantity'],$myrow2['decimalplaces']); $DisplayPrevDel = locale_number_format($myrow2['qtyinvoiced'],$myrow2['decimalplaces']); - $DisplayQtySupplied = locale_number_format(filer_locale_number_format($myrow2['quantity'] - $myrow2['qtyinvoiced']-$myrow2['qtyexpected']-$myrow2['qtypicked']),$myrow2['decimalplaces']); + $DisplayQtySupplied = locale_number_format($myrow2['quantity'] - $myrow2['qtyinvoiced']-$myrow2['qtyexpected']-$myrow2['qtypicked'],$myrow2['decimalplaces']); $itemdesc = $myrow2['description'] . ' - ' . $myrow2['narrative']; $sql="INSERT INTO pickinglistdetails VALUES( '" . $PickingListNo ."', '" . $Lines."', '" . $myrow2['orderlineno']."', - '" . filter_number_format($DisplayQtySupplied) ."', + '" . $DisplayQtySupplied ."', 0)"; - $lineresult=DB_query($sql, $db); + $LineResult=DB_query($sql, $db); } $ListCount ++; Modified: trunk/PDFPriceList.php =================================================================== --- trunk/PDFPriceList.php 2011-10-05 05:19:10 UTC (rev 4711) +++ trunk/PDFPriceList.php 2011-10-05 07:26:06 UTC (rev 4712) @@ -181,7 +181,7 @@ $LeftOvers = $pdf->addTextWrap($Left_Margin+80+47+47+130,$YPos,150,$FontSize,$DisplayUnitPrice, 'right'); if ($PriceList['price']!=0){ - $DisplayGPPercent = (int)filter_number_format((($PriceList['price']-$PriceList['standardcost'])*100/$PriceList['price'])) . '%'; + $DisplayGPPercent = locale_number_format((($PriceList['price']-$PriceList['standardcost'])*100/$PriceList['price']),1) . '%'; } else { $DisplayGPPercent = 0; } Modified: trunk/PDFPrintLabel.php =================================================================== --- trunk/PDFPrintLabel.php 2011-10-05 05:19:10 UTC (rev 4711) +++ trunk/PDFPrintLabel.php 2011-10-05 07:26:06 UTC (rev 4712) @@ -10,12 +10,13 @@ $MsgErr=null; $DecimalPlaces=2; $pdf= null; +/* The variable $AllLabels is the global variable that contains the list */ +$AllLabels = getXMLFile(LABELS_FILE); +/* of all the label objects defined until now. In case of a fresh +installation or an empty XML labels file it holds a NULL value. - $AllLabels = //!< The variable $AllLabels is the global variable that contains the list - getXMLFile(LABELS_FILE); //!< of all the label objects defined until now. In case of a fresh - //!< installation or an empty XML labels file it holds a NULL value. - -// If there is no label templates, the user could select to set up a new one +If there is no label templates, the user could select to set up a new one +*/ if ($AllLabels==null) { abortMsg( _('There isn\'t any label template to select for printing. Click') . @@ -345,11 +346,12 @@ $obj = $label->dimensions; $unit = (string)$obj->Unit; - if ( array_key_exists($unit , $scales) ) + if ( array_key_exists($unit , $scales) ) { $factor = $scales[$unit]; - else + } else { abortMsg( _('Unit not defined in scale operation! Correct the template') ); - + } + $dims = array(); foreach ($DimensionTags as $iTag=>$tag) { if ($tag['type']=='n') // it is a data numeric Modified: trunk/PDFQuotation.php =================================================================== --- trunk/PDFQuotation.php 2011-10-05 05:19:10 UTC (rev 4711) +++ trunk/PDFQuotation.php 2011-10-05 07:26:06 UTC (rev 4712) @@ -7,19 +7,32 @@ //Get Out if we have no order number to work with If (!isset($_GET['QuotationNo']) || $_GET['QuotationNo']==""){ - $title = _('Select Quotation To Print'); - include('includes/header.inc'); - echo '<div class="centre"><br /><br /><br />'; - prnMsg( _('Select a Quotation to Print before calling this page') , 'error'); - echo '<br /><br /><br /><table class="table_index"><tr><td class="menu_group_item"> - <li><a href="'. $rootpath . '/SelectSalesOrder.php?'. SID .'&Quotations=Quotes_Only">' . _('Quotations') . '</a></li> - </td></tr></table></div><br /><br /><br />'; - include('includes/footer.inc'); - exit(); + $title = _('Select Quotation To Print'); + include('includes/header.inc'); + echo '<div class="centre"> + <br /> + <br /> + <br />'; + prnMsg( _('Select a Quotation to Print before calling this page') , 'error'); + echo '<br /> + <br /> + <br /> + <table class="table_index"> + <tr> + <td class="menu_group_item"> + <a href="'. $rootpath . '/SelectSalesOrder.php?Quotations=Quotes_Only">' . _('Quotations') . '</a></td> + </tr> + </table> + </div> + <br /> + <br /> + <br />'; + include('includes/footer.inc'); + exit(); } /*retrieve the order details from the database to print */ -$ErrMsg = _('There was a problem retrieving the quotation header details for Order Number') . ' ' . filter_number_format($_GET['QuotationNo']) . ' ' . _('from the database'); +$ErrMsg = _('There was a problem retrieving the quotation header details for Order Number') . ' ' . $_GET['QuotationNo'] . ' ' . _('from the database'); $sql = "SELECT salesorders.customerref, salesorders.comments, @@ -55,7 +68,7 @@ INNER JOIN currencies ON debtorsmaster.currcode=currencies.currabrev WHERE salesorders.quotation=1 - AND salesorders.orderno='" . filter_number_format($_GET['QuotationNo']) ."'"; + AND salesorders.orderno='" . $_GET['QuotationNo'] ."'"; $result=DB_query($sql,$db, $ErrMsg); @@ -63,15 +76,18 @@ if (DB_num_rows($result)==0){ $title = _('Print Quotation Error'); include('includes/header.inc'); - echo '<div class="centre"><br /><br /><br />'; - prnMsg( _('Unable to Locate Quotation Number') . ' : ' . filter_number_format($_GET['QuotationNo']) . ' ', 'error'); + echo '<div class="centre"> + <br /> + <br /> + <br />'; + prnMsg( _('Unable to Locate Quotation Number') . ' : ' . $_GET['QuotationNo'] . ' ', 'error'); echo '<br /> <br /> <br /> <table class="table_index"> <tr> <td class="menu_group_item"> - <ul><li><a href="'. $rootpath . '/SelectSalesOrder.php?Quotations=Quotes_Only">' . _('Outstanding Quotations') . '</a></li></ul> + <a href="'. $rootpath . '/SelectSalesOrder.php?Quotations=Quotes_Only">' . _('Outstanding Quotations') . '</a> </td> </tr> </table> @@ -116,7 +132,7 @@ stockmaster.decimalplaces FROM salesorderdetails INNER JOIN stockmaster ON salesorderdetails.stkcode=stockmaster.stockid - WHERE salesorderdetails.orderno='" . filter_number_format($_GET['QuotationNo']) . "'"; + WHERE salesorderdetails.orderno='" . $_GET['QuotationNo'] . "'"; $result=DB_query($sql,$db, $ErrMsg); @@ -147,7 +163,7 @@ $DisplayPrevDel = locale_number_format($myrow2['qtyinvoiced'],$myrow2['decimalplaces']); $DisplayPrice = locale_number_format($myrow2['unitprice'],$myrow['currdecimalplaces']); $DisplayDiscount = locale_number_format($myrow2['discountpercent']*100,2) . '%'; - $SubTot = filter_number_format($myrow2['unitprice']*$myrow2['quantity']*(1-$myrow2['discountpercent'])); + $SubTot = $myrow2['unitprice']*$myrow2['quantity']*(1-$myrow2['discountpercent']); $TaxProv = $myrow['taxprovinceid']; $TaxCat = $myrow2['taxcatid']; $Branch = $myrow['branchcode']; @@ -169,11 +185,11 @@ $TaxClass = 100 * $myrow4['taxrate']; } - $DisplayTaxClass = $TaxClass . "%"; - $TaxAmount = filter_number_format((($SubTot/100)*(100+$TaxClass))-$SubTot); + $DisplayTaxClass = $TaxClass . '%'; + $TaxAmount = (($SubTot/100)*(100+$TaxClass))-$SubTot; $DisplayTaxAmount = locale_number_format($TaxAmount,$myrow['currdecimalplaces']); - $LineTotal = filter_number_format($SubTot + $TaxAmount); + $LineTotal = $SubTot + $TaxAmount; $DisplayTotal = locale_number_format($LineTotal,$myrow['currdecimalplaces']); $FontSize=10; Modified: trunk/PDFQuotationPortrait.php =================================================================== --- trunk/PDFQuotationPortrait.php 2011-10-05 05:19:10 UTC (rev 4711) +++ trunk/PDFQuotationPortrait.php 2011-10-05 07:26:06 UTC (rev 4712) @@ -70,7 +70,7 @@ INNER JOIN currencies ON debtorsmaster.currcode=currencies.currabrev WHERE salesorders.quotation=1 - AND salesorders.orderno='" . filter_number_format($_GET['QuotationNo']) ."'"; + AND salesorders.orderno='" . $_GET['QuotationNo'] ."'"; $result=DB_query($sql,$db, $ErrMsg); @@ -82,7 +82,7 @@ <br /> <br /> <br />'; - prnMsg( _('Unable to Locate Quotation Number') . ' : ' . filter_number_format($_GET['QuotationNo']) . ' ', 'error'); + prnMsg( _('Unable to Locate Quotation Number') . ' : ' . $_GET['QuotationNo'] . ' ', 'error'); echo '<br /> <br /> <br /> @@ -111,7 +111,7 @@ $PaperSize = 'A4'; include('includes/PDFStarter.php'); $pdf->addInfo('Title', _('Customer Quotation') ); -$pdf->addInfo('Subject', _('Quotation') . ' ' . filter_number_format($_GET['QuotationNo'])); +$pdf->addInfo('Subject', _('Quotation') . ' ' . $_GET['QuotationNo']); $FontSize=12; $PageNumber = 1; $line_height=24; @@ -163,7 +163,7 @@ $DisplayPrevDel = locale_number_format($myrow2['qtyinvoiced'],$myrow2['decimalplaces']); $DisplayPrice = locale_number_format($myrow2['unitprice'],$myrow['currdecimalplaces']); $DisplayDiscount = locale_number_format($myrow2['discountpercent']*100,2) . '%'; - $SubTot = filter_number_format($myrow2['unitprice']*$myrow2['quantity']*(1-$myrow2['discountpercent'])); + $SubTot = $myrow2['unitprice']*$myrow2['quantity']*(1-$myrow2['discountpercent']); $TaxProv = $myrow['taxprovinceid']; $TaxCat = $myrow2['taxcatid']; $Branch = $myrow['branchcode']; @@ -186,7 +186,7 @@ } $DisplayTaxClass = $TaxClass . "%"; - $TaxAmount = filter_number_fomat((($SubTot/100)*(100+$TaxClass))-$SubTot); + $TaxAmount = (($SubTot/100)*(100+$TaxClass))-$SubTot; $DisplayTaxAmount = locale_number_format($TaxAmount,$myrow['currdecimalplaces']); $LineTotal = $SubTot + $TaxAmount; Modified: trunk/PDFReceipt.php =================================================================== --- trunk/PDFReceipt.php 2011-10-05 05:19:10 UTC (rev 4711) +++ trunk/PDFReceipt.php 2011-10-05 07:26:06 UTC (rev 4712) @@ -57,7 +57,7 @@ FROM debtortrans WHERE type=12 AND transno='".$_GET['BatchNumber']."' - AND id='". filter_number_format($StartReceiptNumber-1+$_GET['ReceiptNumber']) ."'"; + AND id='". $StartReceiptNumber-1+$_GET['ReceiptNumber'] ."'"; $result=DB_query($sql, $db); $myrow=DB_fetch_array($result); $DebtorNo=$myrow['debtorno']; @@ -70,7 +70,7 @@ WHERE currabrev=(SELECT currcode FROM banktrans WHERE type=12 - AND transno='" . filter_number_format($_GET['BatchNumber'])."')"; + AND transno='" . $_GET['BatchNumber']."')"; $result=DB_query($sql, $db); $myrow=DB_fetch_array($result); $Currency=$myrow['currency']; @@ -116,5 +116,5 @@ $LeftOvers = $pdf->addTextWrap(50,$YPos,300,$FontSize,'______________________________________________________________________________'); -$pdf->Output('Receipt-'.filter_number_format($_GET['ReceiptNumber']), 'I'); +$pdf->Output('Receipt-'.$_GET['ReceiptNumber'], 'I'); ?> \ No newline at end of file Modified: trunk/PDFRemittanceAdvice.php =================================================================== --- trunk/PDFRemittanceAdvice.php 2011-10-05 05:19:10 UTC (rev 4711) +++ trunk/PDFRemittanceAdvice.php 2011-10-05 07:26:06 UTC (rev 4712) @@ -145,10 +145,14 @@ } else { $DefaultToCriteria = $_POST['ToCriteria']; } - echo '<tr><td>' . _('From Supplier Code') . ':</font></td> - <td><input type="text" maxlength="6" size="7" name="FromCriteria" value="' . $DefaultFromCriteria . '"></td></tr>'; - echo '<tr><td>' . _('To Supplier Code') . ':</td> - <td><input type="text" maxlength="6" size="7" name="ToCriteria" value="' . $DefaultToCriteria . '"></td></tr>'; + echo '<tr> + <td>' . _('From Supplier Code') . ':</font></td> + <td><input type="text" maxlength="6" size="7" name="FromCriteria" value="' . $DefaultFromCriteria . '" /></td> + </tr>'; + echo '<tr> + <td>' . _('To Supplier Code') . ':</td> + <td><input type="text" maxlength="6" size="7" name="ToCriteria" value="' . $DefaultToCriteria . '" /></td> + </tr>'; if (!isset($_POST['PaymentDate'])){ $DefaultDate = Date($_SESSION['DefaultDateFormat'], Mktime(0,0,0,Date('m')+1,0 ,Date('y'))); @@ -156,19 +160,19 @@ $DefaultDate = $_POST['PaymentDate']; } - echo '<tr><td>' . _('Date Of Payment') . ':</td> - <td><input type="text" class="date" alt="'.$_SESSION['DefaultDateFormat'].'" name="PaymentDate" maxlength="11" size="12" value="' . $DefaultDate . '" /></td> - </tr>'; + echo '<tr> + <td>' . _('Date Of Payment') . ':</td> + <td><input type="text" class="date" alt="'.$_SESSION['DefaultDateFormat'].'" name="PaymentDate" maxlength="11" size="12" value="' . $DefaultDate . '" /></td> + </tr>'; - echo '</table><div class="centre"><input type=Submit Name="PrintPDF" Value="' . _('Print PDF') . '"></div>'; + echo '</table> + <div class="centre"> + <input type=Submit Name="PrintPDF" Value="' . _('Print PDF') . '"> + </div>'; include ('includes/footer.inc'); } /*end of else not PrintPDF */ - - - - function PageHeader(){ global $pdf; global $PageNumber; Modified: trunk/PDFStockCheckComparison.php =================================================================== --- trunk/PDFStockCheckComparison.php 2011-10-05 05:19:10 UTC (rev 4711) +++ trunk/PDFStockCheckComparison.php 2011-10-05 07:26:06 UTC (rev 4712) @@ -20,12 +20,13 @@ if ($_POST['ReportOrClose']=='ReportAndClose'){ $sql = "SELECT stockcheckfreeze.stockid, - stockcheckfreeze.loccode, - qoh, - materialcost+labourcost+overheadcost AS standardcost - FROM stockmaster INNER JOIN stockcheckfreeze + stockcheckfreeze.loccode, + qoh, + materialcost+labourcost+overheadcost AS standardcost + FROM stockmaster INNER JOIN stockcheckfreeze ON stockcheckfreeze.stockid=stockmaster.stockid - ORDER BY stockcheckfreeze.loccode, stockcheckfreeze.stockid"; + ORDER BY stockcheckfreeze.loccode, + stockcheckfreeze.stockid"; $StockChecks = DB_query($sql, $db,'','',false,false); if (DB_error_no($db) !=0) { @@ -49,9 +50,9 @@ $sql = "SELECT SUM(stockcounts.qtycounted) AS totcounted, COUNT(stockcounts.stockid) AS noofcounts - FROM stockcounts - WHERE stockcounts.stockid='" . $myrow['stockid'] . "' - AND stockcounts.loccode='" . $myrow['loccode'] . "'"; + FROM stockcounts + WHERE stockcounts.stockid='" . $myrow['stockid'] . "' + AND stockcounts.loccode='" . $myrow['loccode'] . "'"; $StockCounts = DB_query($sql, $db); if (DB_error_no($db) !=0) { @@ -70,7 +71,7 @@ $StkCountResult = DB_query($sql,$db); $StkCountRow = DB_fetch_array($StkCountResult); - $StockQtyDifference = filter_number_format($StkCountRow['totcounted'] - $myrow['qoh']); + $StockQtyDifference = $StkCountRow['totcounted'] - $myrow['qoh']; if ($_POST['ZeroCounts']=='Leave' AND $StkCountRow['noofcounts']==0){ $StockQtyDifference =0; @@ -112,7 +113,7 @@ '" . $PeriodNo . "', '" . _('Inventory Check') . "', '" . $StockQtyDifference . "', - '" . filter_number_format($QtyOnHandPrior + $StockQtyDifference) . "' + '" . $QtyOnHandPrior + $StockQtyDifference . "' )"; $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The stock movement record cannot be inserted because'); @@ -145,7 +146,7 @@ '" . $SQLAdjustmentDate . "', '" . $PeriodNo . "', '" . $StockGLCodes['adjglact'] . "', - '" . filter_number_format($myrow['standardcost'] * -($StockQtyDifference)) . "', + '" . $myrow['standardcost'] * -($StockQtyDifference) . "', '" . $myrow['stockid'] . " x " . $StockQtyDifference . " @ " . $myrow['standardcost'] . " - " . _('Inventory Check') . "')"; $Result = DB_query($SQL,$db, $ErrMsg, $DbgMsg, true); @@ -164,14 +165,13 @@ '" . $SQLAdjustmentDate . "', '" . $PeriodNo . "', '" . $StockGLCodes['stockact'] . "', - '" . filter_number_format($myrow['standardcost'] * $StockQtyDifference) . "', + '" . $myrow['standardcost'] * $StockQtyDifference . "', '" . $myrow['stockid'] . " x " . $StockQtyDifference . " @ " . $myrow['standardcost'] . " - " . _('Inventory Check') . "')"; $Result = DB_query($SQL,$db, $ErrMsg, $DbgMsg, true); } //END INSERT GL TRANS $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('Unable to COMMIT transaction while adjusting stock in StockCheckAdjustmet report'); - $SQL = "COMMIT"; - $Result = DB_query($SQL,$db, $ErrMsg,'',true); + DB_Txn_Commit($db); } // end if $StockQtyDifference !=0 Modified: trunk/PDFStockLocTransfer.php =================================================================== --- trunk/PDFStockLocTransfer.php 2011-10-05 05:19:10 UTC (rev 4711) +++ trunk/PDFStockLocTransfer.php 2011-10-05 07:26:06 UTC (rev 4712) @@ -8,7 +8,7 @@ include('includes/PDFStarter.php'); if (isset($_POST['TransferNo'])) { - $_GET['TransferNo']=filter_number_format($_POST['TransferNo']); + $_GET['TransferNo']=$_POST['TransferNo']; } if (!isset($_GET['TransferNo'])){ @@ -16,16 +16,19 @@ include ('includes/header.inc'); echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/maintenance.png" title="' . _('Search') . '" alt="" />' . ' ' . _('Reprint transfer docket').'</p><br />'; - echo '<form method="POST" action="' . $_SERVER['PHP_SELF'] . '">'; + echo '<form method="post" action="' . $_SERVER['PHP_SELF'] . '">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; - echo '<table><tr><td>'._('Transfer docket to reprint').'</td>'; - echo '<td><input type="text" class="number" size="10" name="TransferNo"></td></tr></table>'; - echo '<div class="centre"><input type="submit" name="Print" value="' . _('Print') .'">'; + echo '<table> + <tr> + <td>'._('Transfer docket to reprint').'</td> + <td><input type="text" class="number" size="10" name="TransferNo" /></td> + </tr> + </table>'; + echo '<div class="centre"> + <input type="submit" name="Print" value="' . _('Print') .'">'; include ('includes/footer.inc'); exit; -} else { - $_GET['TransferNo'] = filter_number_format($_GET['TransferNo']); -} +} $pdf->addInfo('Title', _('Inventory Location Transfer BOL') ); $pdf->addInfo('Subject', _('Inventory Location Transfer BOL') . ' # ' . $_GET['TransferNo']); @@ -43,12 +46,13 @@ loctransfers.shiploc, locations.locationname as shiplocname, ... [truncated message content] |