This list is closed, nobody may subscribe to it.
2011 |
Jan
(14) |
Feb
(42) |
Mar
(56) |
Apr
(60) |
May
(54) |
Jun
(48) |
Jul
(74) |
Aug
(52) |
Sep
(68) |
Oct
(64) |
Nov
(42) |
Dec
(62) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2012 |
Jan
(142) |
Feb
(270) |
Mar
(374) |
Apr
(230) |
May
(214) |
Jun
(116) |
Jul
(234) |
Aug
(66) |
Sep
(120) |
Oct
(16) |
Nov
(17) |
Dec
(41) |
2013 |
Jan
(19) |
Feb
(18) |
Mar
(8) |
Apr
(40) |
May
(121) |
Jun
(42) |
Jul
(127) |
Aug
(145) |
Sep
(27) |
Oct
(38) |
Nov
(83) |
Dec
(61) |
2014 |
Jan
(33) |
Feb
(35) |
Mar
(59) |
Apr
(41) |
May
(38) |
Jun
(45) |
Jul
(17) |
Aug
(58) |
Sep
(46) |
Oct
(51) |
Nov
(55) |
Dec
(36) |
2015 |
Jan
(57) |
Feb
(67) |
Mar
(70) |
Apr
(34) |
May
(32) |
Jun
(11) |
Jul
(3) |
Aug
(17) |
Sep
(16) |
Oct
(13) |
Nov
(30) |
Dec
(30) |
2016 |
Jan
(17) |
Feb
(12) |
Mar
(17) |
Apr
(20) |
May
(47) |
Jun
(15) |
Jul
(13) |
Aug
(30) |
Sep
(32) |
Oct
(20) |
Nov
(32) |
Dec
(24) |
2017 |
Jan
(16) |
Feb
|
Mar
(11) |
Apr
(11) |
May
(5) |
Jun
(42) |
Jul
(9) |
Aug
(10) |
Sep
(14) |
Oct
(15) |
Nov
(2) |
Dec
(29) |
2018 |
Jan
(28) |
Feb
(49) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
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-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 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 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-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-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-18 01:22:32
|
Revision: 4695 http://web-erp.svn.sourceforge.net/web-erp/?rev=4695&view=rev Author: daintree Date: 2011-09-18 01:22:23 +0000 (Sun, 18 Sep 2011) Log Message: ----------- number_formats Modified Paths: -------------- trunk/CounterSales.php trunk/Numbers/Words/lang.bg.php trunk/Numbers/Words/lang.fr.php trunk/Numbers/Words/lang.fr_BE.php trunk/PO_Items.php trunk/includes/phplot/phplot.php trunk/includes/tcpdf/tcpdf.php Modified: trunk/CounterSales.php =================================================================== --- trunk/CounterSales.php 2011-09-17 22:43:30 UTC (rev 4694) +++ trunk/CounterSales.php 2011-09-18 01:22:23 UTC (rev 4695) @@ -488,7 +488,7 @@ 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] = (($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] = 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)); } 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)); @@ -509,16 +509,16 @@ if ($Quantity<0 or $Price <0 or $DiscountPercentage >100 or $DiscountPercentage <0){ prnMsg(_('The item could not be updated because you are attempting to set the quantity ordered to less than 0 or the price less than 0 or the discount more than 100% or less than 0%'),'warn'); } else if ($OrderLine->Quantity !=$Quantity - or $OrderLine->Price != $Price - or abs($OrderLine->DiscountPercent -$DiscountPercentage/100) >0.001 - or $OrderLine->Narrative != $Narrative - or $OrderLine->ItemDue != $_POST['ItemDue_' . $OrderLine->LineNumber] - or $OrderLine->POLine != $_POST['POLine_' . $OrderLine->LineNumber]) { + OR $OrderLine->Price != $Price + OR abs($OrderLine->DiscountPercent -$DiscountPercentage/100) >0.001 + OR $OrderLine->Narrative != $Narrative + OR $OrderLine->ItemDue != $_POST['ItemDue_' . $OrderLine->LineNumber] + OR $OrderLine->POLine != $_POST['POLine_' . $OrderLine->LineNumber]) { $_SESSION['Items'.$identifier]->update_cart_item($OrderLine->LineNumber, $Quantity, $Price, - ($DiscountPercentage/100), + filter_number_format($DiscountPercentage/100), $Narrative, 'Yes', /*Update DB */ $_POST['ItemDue_' . $OrderLine->LineNumber], @@ -1889,7 +1889,7 @@ '" . $BankAccountExRate . "', '" . $DefaultDispatchDate . "', '" . $_POST['PaymentMethod'] . "', - '" . (filter_number_format($_POST['AmountPaid']) * $BankAccountExRate) . "', + '" . filter_number_format(filter_number_format($_POST['AmountPaid']) * $BankAccountExRate) . "', '" . $_SESSION['Items'.$identifier]->DefaultCurrency . "')"; $DbgMsg = _('The SQL that failed to insert the bank account transaction was'); Modified: trunk/Numbers/Words/lang.bg.php =================================================================== --- trunk/Numbers/Words/lang.bg.php 2011-09-17 22:43:30 UTC (rev 4694) +++ trunk/Numbers/Words/lang.bg.php 2011-09-18 01:22:23 UTC (rev 4695) @@ -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-09-17 22:43:30 UTC (rev 4694) +++ trunk/Numbers/Words/lang.fr.php 2011-09-18 01:22:23 UTC (rev 4695) @@ -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-09-17 22:43:30 UTC (rev 4694) +++ trunk/Numbers/Words/lang.fr_BE.php 2011-09-18 01:22:23 UTC (rev 4695) @@ -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/PO_Items.php =================================================================== --- trunk/PO_Items.php 2011-09-17 22:43:30 UTC (rev 4694) +++ trunk/PO_Items.php 2011-09-18 01:22:23 UTC (rev 4695) @@ -33,21 +33,21 @@ if (isset($_POST['UpdateLines']) OR isset($_POST['Commit'])) { foreach ($_SESSION['PO'.$identifier]->LineItems as $POLine) { if ($POLine->Deleted == false) { - if (!is_numeric($_POST['ConversionFactor'.$POLine->LineNo])){ + if (!is_numeric(filter_number_format($_POST['ConversionFactor'.$POLine->LineNo]))){ prnMsg(_('The conversion factor is expected to be numeric - the figure which converts from our units to the supplier units. e.g. if the supplier units is a tonne and our unit is a kilogram then the conversion factor that converts our unit to the suppliers unit is 1000'),'error'); $_SESSION['PO'.$identifier]->LineItems[$POLine->LineNo]->ConversionFactor = 1; } else { //a valid number for the conversion factor is entered - $_SESSION['PO'.$identifier]->LineItems[$POLine->LineNo]->ConversionFactor = $_POST['ConversionFactor'.$POLine->LineNo]; + $_SESSION['PO'.$identifier]->LineItems[$POLine->LineNo]->ConversionFactor = filter_number_format($_POST['ConversionFactor'.$POLine->LineNo]); } - if (!is_numeric($_POST['SuppQty'.$POLine->LineNo])){ + if (!is_numeric(filter_number_format($_POST['SuppQty'.$POLine->LineNo]))){ prnMsg(_('The quantity in the supplier units 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]->Quantity=round($_POST['SuppQty'.$POLine->LineNo]*$_SESSION['PO'.$identifier]->LineItems[$POLine->LineNo]->ConversionFactor,$_SESSION['PO'.$identifier]->LineItems[$POLine->LineNo]->DecimalPlaces); + $_SESSION['PO'.$identifier]->LineItems[$POLine->LineNo]->Quantity=filter_number_format(round(filter_number_format($_POST['SuppQty'.$POLine->LineNo])*filter_number_format($_SESSION['PO'.$identifier]->LineItems[$POLine->LineNo]->ConversionFactor),$_SESSION['PO'.$identifier]->LineItems[$POLine->LineNo]->DecimalPlaces)); } - if (!is_numeric($_POST['SuppPrice'.$POLine->LineNo])){ + 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=$_POST['SuppPrice'.$POLine->LineNo]/$_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]; } @@ -166,22 +166,22 @@ '" . $_SESSION['PO'.$identifier]->Initiator . "', '" . $_SESSION['PO'.$identifier]->RequisitionNo . "', '" . $_SESSION['PO'.$identifier]->Location . "', - '" . $_SESSION['PO'.$identifier]->DelAdd1 . "', - '" . $_SESSION['PO'.$identifier]->DelAdd2 . "', - '" . $_SESSION['PO'.$identifier]->DelAdd3 . "', - '" . $_SESSION['PO'.$identifier]->DelAdd4 . "', - '" . $_SESSION['PO'.$identifier]->DelAdd5 . "', - '" . $_SESSION['PO'.$identifier]->DelAdd6 . "', - '" . $_SESSION['PO'.$identifier]->Tel . "', - '" . $_SESSION['PO'.$identifier]->SuppDelAdd1 . "', - '" . $_SESSION['PO'.$identifier]->SuppDelAdd2 . "', - '" . $_SESSION['PO'.$identifier]->SuppDelAdd3 . "', - '" . $_SESSION['PO'.$identifier]->SuppDelAdd4 . "', - '" . $_SESSION['PO'.$identifier]->SuppDelAdd5 . "', - '" . $_SESSION['PO'.$identifier]->SuppDelAdd6 . "', - '" . $_SESSION['PO'.$identifier]->SupplierContact . "', - '" . $_SESSION['PO'.$identifier]->SuppTel. "', - '" . $_SESSION['PO'.$identifier]->Contact . "', + '" . DB_escape_string($_SESSION['PO'.$identifier]->DelAdd1) . "', + '" . DB_escape_string($_SESSION['PO'.$identifier]->DelAdd2) . "', + '" . DB_escape_string($_SESSION['PO'.$identifier]->DelAdd3) . "', + '" . DB_escape_string($_SESSION['PO'.$identifier]->DelAdd4) . "', + '" . DB_escape_string($_SESSION['PO'.$identifier]->DelAdd5) . "', + '" . DB_escape_string($_SESSION['PO'.$identifier]->DelAdd6) . "', + '" . DB_escape_string($_SESSION['PO'.$identifier]->Tel) . "', + '" . DB_escape_string($_SESSION['PO'.$identifier]->SuppDelAdd1) . "', + '" . DB_escape_string($_SESSION['PO'.$identifier]->SuppDelAdd2) . "', + '" . DB_escape_string($_SESSION['PO'.$identifier]->SuppDelAdd3) . "', + '" . DB_escape_string($_SESSION['PO'.$identifier]->SuppDelAdd4) . "', + '" . DB_escape_string($_SESSION['PO'.$identifier]->SuppDelAdd5) . "', + '" . DB_escape_string($_SESSION['PO'.$identifier]->SuppDelAdd6) . "', + '" . DB_escape_string($_SESSION['PO'.$identifier]->SupplierContact) . "', + '" . DB_escape_string($_SESSION['PO'.$identifier]->SuppTel). "', + '" . DB_escape_string($_SESSION['PO'.$identifier]->Contact) . "', '" . $_SESSION['PO'.$identifier]->Version . "', '" . Date('Y-m-d') . "', '" . $_SESSION['PO'.$identifier]->DeliveryBy . "', @@ -198,7 +198,7 @@ /*Insert the purchase order detail records */ foreach ($_SESSION['PO'.$identifier]->LineItems as $POLine) { if ($POLine->Deleted==False) { - $sql = "INSERT INTO purchorderdetails ( orderno, + $sql = "INSERT INTO purchorderdetails (orderno, itemcode, deliverydate, itemdescription, @@ -214,7 +214,7 @@ VALUES ('" . $_SESSION['PO'.$identifier]->OrderNo . "', '" . $POLine->StockID . "', '" . FormatDateForSQL($POLine->ReqDelDate) . "', - '" . $POLine->ItemDescription . "', + '" . DB_escape_string($POLine->ItemDescription) . "', '" . $POLine->GLCode . "', '" . $POLine->Price . "', '" . $POLine->Quantity . "', @@ -254,7 +254,7 @@ /*Update the purchase order header with any changes */ $sql = "UPDATE purchorders SET supplierno = '" . $_SESSION['PO'.$identifier]->SupplierID . "' , - comments='" . $_SESSION['PO'.$identifier]->Comments . "', + comments='" . DB_escape_string($_SESSION['PO'.$identifier]->Comments) . "', rate='" . $_SESSION['PO'.$identifier]->ExRate . "', initiator='" . $_SESSION['PO'.$identifier]->Initiator . "', requisitionno= '" . $_SESSION['PO'.$identifier]->RequisitionNo . "', @@ -263,26 +263,26 @@ deliverydate='" . FormatDateForSQL($_SESSION['PO'.$identifier]->DeliveryDate) . "', revised= '" . Date('Y-m-d') . "', intostocklocation='" . $_SESSION['PO'.$identifier]->Location . "', - deladd1='" . $_SESSION['PO'.$identifier]->DelAdd1 . "', - deladd2='" . $_SESSION['PO'.$identifier]->DelAdd2 . "', - deladd3='" . $_SESSION['PO'.$identifier]->DelAdd3 . "', - deladd4='" . $_SESSION['PO'.$identifier]->DelAdd4 . "', - deladd5='" . $_SESSION['PO'.$identifier]->DelAdd5 . "', - deladd6='" . $_SESSION['PO'.$identifier]->DelAdd6 . "', - deladd6='" . $_SESSION['PO'.$identifier]->Tel . "', - suppdeladdress1='" . $_SESSION['PO'.$identifier]->SuppDelAdd1 . "', - suppdeladdress2='" . $_SESSION['PO'.$identifier]->SuppDelAdd2 . "', - suppdeladdress3='" . $_SESSION['PO'.$identifier]->SuppDelAdd3 . "', - suppdeladdress4='" . $_SESSION['PO'.$identifier]->SuppDelAdd4 . "', - suppdeladdress5='" . $_SESSION['PO'.$identifier]->SuppDelAdd5 . "', - suppdeladdress6='" . $_SESSION['PO'.$identifier]->SuppDelAdd6 . "', - suppliercontact='" . $_SESSION['PO'.$identifier]->SupplierContact . "', - supptel='" . $_SESSION['PO'.$identifier]->SuppTel . "', - contact='" . $_SESSION['PO'.$identifier]->Contact . "', + deladd1='" . DB_escape_string($_SESSION['PO'.$identifier]->DelAdd1) . "', + deladd2='" . DB_escape_string($_SESSION['PO'.$identifier]->DelAdd2) . "', + deladd3='" . DB_escape_string($_SESSION['PO'.$identifier]->DelAdd3) . "', + deladd4='" . DB_escape_string($_SESSION['PO'.$identifier]->DelAdd4) . "', + deladd5='" . DB_escape_string($_SESSION['PO'.$identifier]->DelAdd5) . "', + deladd6='" . DB_escape_string($_SESSION['PO'.$identifier]->DelAdd6) . "', + deladd6='" . DB_escape_string($_SESSION['PO'.$identifier]->Tel) . "', + suppdeladdress1='" . DB_escape_string($_SESSION['PO'.$identifier]->SuppDelAdd1) . "', + suppdeladdress2='" . DB_escape_string($_SESSION['PO'.$identifier]->SuppDelAdd2) . "', + suppdeladdress3='" . DB_escape_string($_SESSION['PO'.$identifier]->SuppDelAdd3) . "', + suppdeladdress4='" . DB_escape_string($_SESSION['PO'.$identifier]->SuppDelAdd4) . "', + suppdeladdress5='" . DB_escape_string($_SESSION['PO'.$identifier]->SuppDelAdd5) . "', + suppdeladdress6='" . DB_escape_string($_SESSION['PO'.$identifier]->SuppDelAdd6) . "', + suppliercontact='" . DB_escape_string($_SESSION['PO'.$identifier]->SupplierContact) . "', + supptel='" . DB_escape_string($_SESSION['PO'.$identifier]->SuppTel) . "', + contact='" . DB_escape_string($_SESSION['PO'.$identifier]->Contact) . "', paymentterms='" . $_SESSION['PO'.$identifier]->PaymentTerms . "', allowprint='" . $_SESSION['PO'.$identifier]->AllowPrintPO . "', status = '" . $_SESSION['PO'.$identifier]->Status . "', - stat_comment = '" . $_SESSION['PO'.$identifier]->StatusComments . "' + stat_comment = '" . DB_escape_string($_SESSION['PO'.$identifier]->StatusComments) . "' WHERE orderno = '" . $_SESSION['PO'.$identifier]->OrderNo ."'"; $ErrMsg = _('The purchase order could not be updated because'); @@ -321,7 +321,7 @@ '" . $_SESSION['PO'.$identifier]->OrderNo . "', '" . $POLine->StockID . "', '" . FormatDateForSQL($POLine->ReqDelDate) . "', - '" . $POLine->ItemDescription . "', + '" . DB_escape_string($POLine->ItemDescription) . "', '" . $POLine->GLCode . "', '" . $POLine->Price . "', '" . $POLine->Quantity . "', @@ -336,14 +336,14 @@ if ($POLine->Quantity==$POLine->QtyReceived){ $sql = "UPDATE purchorderdetails SET itemcode='" . $POLine->StockID . "', deliverydate ='" . FormatDateForSQL($POLine->ReqDelDate) . "', - itemdescription='" . $POLine->ItemDescription . "', + itemdescription='" . DB_escape_string($POLine->ItemDescription) . "', glcode='" . $POLine->GLCode . "', unitprice='" . $POLine->Price . "', quantityord='" . $POLine->Quantity . "', shiptref='" . $POLine->ShiptRef . "', jobref='" . $POLine->JobRef . "', suppliersunit='" . $POLine->SuppliersUnit . "', - suppliers_partno='" . $POLine->Suppliers_PartNo . "', + suppliers_partno='" . DB_escape_string($POLine->Suppliers_PartNo) . "', completed=1, assetid='" . $POLine->AssetID . "', conversionfactor = '" . $POLine->ConversionFactor . "' @@ -351,7 +351,7 @@ } else { $sql = "UPDATE purchorderdetails SET itemcode='" . $POLine->StockID . "', deliverydate ='" . FormatDateForSQL($POLine->ReqDelDate) . "', - itemdescription='" . $POLine->ItemDescription . "', + itemdescription='" . DB_escape_string($POLine->ItemDescription) . "', glcode='" . $POLine->GLCode . "', unitprice='" . $POLine->Price . "', quantityord='" . $POLine->Quantity . "', @@ -407,11 +407,11 @@ if (isset($_POST['EnterLine'])){ /*Inputs from the form directly without selecting a stock item from the search */ $AllowUpdate = true; /*always assume the best */ - if (!is_numeric($_POST['Qty'])){ + if (!is_numeric(filter_number_format($_POST['Qty']))){ $AllowUpdate = false; prnMsg( _('Cannot Enter this order line') . '<br />' . _('The quantity of the order item must be numeric'),'error'); } - if ($_POST['Qty']<0){ + if (filter_number_format($_POST['Qty'])<0){ $AllowUpdate = false; prnMsg( _('Cannot Enter this order line') . '<br />' . _('The quantity of the ordered item entered must be a positive amount'),'error'); } @@ -424,8 +424,6 @@ prnMsg( _('Cannot Enter this order line') . '</b><br />' . _('The date entered must be in the format') . ' ' . $_SESSION['DefaultDateFormat'], 'error'); } -// include ('PO_Chk_ShiptRef_JobRef.php'); - /*It's not a stock item */ /*need to check GL Code is valid if GLLink is active */ @@ -491,9 +489,9 @@ '', 0, /*Serialised */ 0, /*Controlled */ - $_POST['Qty'], + filter_number_format($_POST['Qty']), $_POST['ItemDescription'], - $_POST['Price'], + filter_number_format($_POST['Price']), $_POST['SuppliersUnit'], $_POST['GLCode'], $_POST['ReqDelDate'], @@ -526,7 +524,7 @@ foreach ($_POST as $FormVariableName => $Quantity) { /*The form entity name is of the format NewQtyX where X is the index number that identifies the stock item code held in the hidden StockIDX form variable * */ - if (mb_substr($FormVariableName, 0, 6)=='NewQty' AND $Quantity!=0) { //if the form variable represents a Qty to add to the order + if (mb_substr($FormVariableName, 0, 6)=='NewQty' AND filter_number_format($Quantity)!=0) { //if the form variable represents a Qty to add to the order $ItemCode = $_POST['StockID' . mb_substr($FormVariableName, 6)]; $AlreadyOnThisOrder = 0; @@ -544,7 +542,7 @@ } /* end of the foreach loop to look for preexisting items of the same code */ } } - if ($AlreadyOnThisOrder!=1 AND $Quantity > 0){ + if ($AlreadyOnThisOrder!=1 AND filter_number_format($Quantity) > 0){ $sql = "SELECT description, longdescription, stockid, @@ -588,7 +586,7 @@ $PurchDataResult = DB_query($sql,$db,$ErrMsg,$DbgMsg); if (DB_num_rows($PurchDataResult)>0){ //the purchasing data is set up $PurchRow = DB_fetch_array($PurchDataResult); - $PurchPrice = $PurchRow['price']/$PurchRow['conversionfactor']; + $PurchPrice = filter_number_format($PurchRow['price']/$PurchRow['conversionfactor']); $ConversionFactor = $PurchRow['conversionfactor']; $SupplierDescription = $PurchRow['suppliers_partno'] .' - '; if (mb_strlen($PurchRow['supplierdescription'])>2){ @@ -612,7 +610,7 @@ $ItemCode, 0, /*Serialised */ 0, /*Controlled */ - $Quantity*$ConversionFactor, /* Qty */ + filter_number_format((filter_number_format($Quantity)*$ConversionFactor), /* Qty */ $SupplierDescription, $PurchPrice, $ItemRow['units'], @@ -679,14 +677,14 @@ foreach ($_SESSION['PO'.$identifier]->LineItems as $POLine) { if ($POLine->Deleted==False) { - $LineTotal = $POLine->Quantity * $POLine->Price; - $DisplayLineTotal = locale_number_format($LineTotal,$_SESSION['PO'.$identifier]->CurrDecimalPlaces); + $LineTotal = filter_number_format($POLine->Quantity * $POLine->Price); + $DisplayLineTotal = locale_money_format($LineTotal,$_SESSION['PO'.$identifier]->CurrDecimalPlaces); // Note if the price is greater than 1 use 2 decimal place, if the price is a fraction of 1, use 4 decimal places // This should help display where item-price is a fraction if ($POLine->Price > 1) { - $DisplayPrice = locale_number_format($POLine->Price,$_SESSION['PO'.$identifier]->CurrDecimalPlaces); + $DisplayPrice = locale_money_format($POLine->Price,$_SESSION['PO'.$identifier]->CurrDecimalPlaces); } else { - $DisplayPrice = locale_number_format($POLine->Price,4); + $DisplayPrice = locale_money_format($POLine->Price,4); } if ($k==1){ @@ -703,9 +701,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="' . round($POLine->Quantity/$POLine->ConversionFactor,$POLine->DecimalPlaces) . '"></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>' . $POLine->SuppliersUnit . '</td> - <td><input type="text" class="number" name="SuppPrice' . $POLine->LineNo . '" size="10" value="' . round(($POLine->Price *$POLine->ConversionFactor),$_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){ @@ -718,7 +716,7 @@ } } - $DisplayTotal = locale_number_format($_SESSION['PO'.$identifier]->Total,$_SESSION['PO'.$identifier]->CurrDecimalPlaces); + $DisplayTotal = locale_money_format($_SESSION['PO'.$identifier]->Total,$_SESSION['PO'.$identifier]->CurrDecimalPlaces); echo '<tr><td colspan="9" class="number">' . _('TOTAL') . _(' excluding Tax') . '</td> <td class="number"><b>' . $DisplayTotal . '</b></td> </tr></table>'; @@ -764,13 +762,13 @@ echo'</select><a href="FixedAssetItems.php" target=_blank>'. _('New Fixed Asset') . '</a></td> <tr><td>'._('Quantity to purchase').'</td> - <td><input type="text" class="number" name="Qty" size="10" value="1"></td></tr> + <td><input type="text" class="number" name="Qty" size="10" value="1" /></td></tr> <tr><td>'._('Price per item').'</td> - <td><input type="text" class="number" name="Price" size="10"></td></tr> + <td><input type="text" class="number" name="Price" size="10" /></td></tr> <tr><td>'._('Unit').'</td> - <td><input type="text" name="SuppliersUnit" size="10" value="' . _('each') . '"></td></tr> + <td><input type="text" name="SuppliersUnit" size="10" value="' . _('each') . '" /></td></tr> <tr><td>'._('Delivery Date').'</td> - <td><input type="text" class="date" alt="'.$_SESSION['DefaultDateFormat'].'" name="ReqDelDate" size=11 value="'.$_SESSION['PO'.$identifier]->DeliveryDate .'"></td></tr>'; + <td><input type="text" class="date" alt="'.$_SESSION['DefaultDateFormat'].'" name="ReqDelDate" size=11 value="'.$_SESSION['PO'.$identifier]->DeliveryDate .'" /></td></tr>'; echo '</table>'; echo '<div class="centre"> <input type=submit name="EnterLine" value="Enter Item" /> @@ -1053,15 +1051,15 @@ } echo ' /></td> <td><font size="3"><b>' . _('OR') . ' </b></font>' . _('Enter extract of the Stock Code') . ':</td> - <td><input type="text" name="StockCode" size=15 maxlength=18 value="' . $_POST['StockCode'] . '"></td> + <td><input type="text" name="StockCode" size="15" maxlength="18" value="' . $_POST['StockCode'] . '" /></td> </tr> <tr><td></td> <td><font size=3><b>' . _('OR') . ' </b></font><a target="_blank" href="'.$rootpath.'/Stocks.php">' . _('Create a New Stock Item') . '</a></td></tr> </table> <br /> - <div class="centre"><input type="submit" name="Search" value="' . _('Search Now') . '"> - <input type="submit" name="NonStockOrder" value="' . _('Order a non stock item') . '"> + <div class="centre"><input type="submit" name="Search" value="' . _('Search Now') . '" /> + <input type="submit" name="NonStockOrder" value="' . _('Order a non stock item') . '" /> </div><br />'; $PartsDisplayed =0; @@ -1124,7 +1122,7 @@ <td class="number">' . $ConversionFactor .'</td> <td>' . $OrderUnits . '</td> <td>' . $ImageSource . '</td> - <td><input class="number" type="text" size="6" value="0" name="NewQty' . $j . '"></td> + <td><input class="number" type="text" size="6" value="0" name="NewQty' . $j . '" /></td> <input type="hidden" name="StockID' . $j .'" . value="' . $myrow['stockid'] . '" /> </tr>'; $j++; @@ -1141,7 +1139,7 @@ prnMsg( _('Only the first') . ' ' . $Maximum_Number_Of_Parts_To_Show . ' ' . _('can be displayed') . '. ' . _('Please restrict your search to only the parts required'),'info'); } - echo '<a name="end"></a><br /><div class="centre"><input type="submit" name="NewItem" value="Order some"></div>'; + echo '<a name="end"></a><br /><div class="centre"><input type="submit" name="NewItem" value="Order some" /></div>'; }#end if SearchResults to show echo '</form>'; Modified: trunk/includes/phplot/phplot.php =================================================================== --- trunk/includes/phplot/phplot.php 2011-09-17 22:43:30 UTC (rev 4694) +++ trunk/includes/phplot/phplot.php 2011-09-18 01:22:23 UTC (rev 4695) @@ -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-09-17 22:43:30 UTC (rev 4694) +++ trunk/includes/tcpdf/tcpdf.php 2011-09-18 01:22:23 UTC (rev 4695) @@ -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-09-18 01:22:31
|
Revision: 4695 http://web-erp.svn.sourceforge.net/web-erp/?rev=4695&view=rev Author: daintree Date: 2011-09-18 01:22:23 +0000 (Sun, 18 Sep 2011) Log Message: ----------- number_formats Modified Paths: -------------- trunk/CounterSales.php trunk/Numbers/Words/lang.bg.php trunk/Numbers/Words/lang.fr.php trunk/Numbers/Words/lang.fr_BE.php trunk/PO_Items.php trunk/includes/phplot/phplot.php trunk/includes/tcpdf/tcpdf.php Modified: trunk/CounterSales.php =================================================================== --- trunk/CounterSales.php 2011-09-17 22:43:30 UTC (rev 4694) +++ trunk/CounterSales.php 2011-09-18 01:22:23 UTC (rev 4695) @@ -488,7 +488,7 @@ 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] = (($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] = 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)); } 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)); @@ -509,16 +509,16 @@ if ($Quantity<0 or $Price <0 or $DiscountPercentage >100 or $DiscountPercentage <0){ prnMsg(_('The item could not be updated because you are attempting to set the quantity ordered to less than 0 or the price less than 0 or the discount more than 100% or less than 0%'),'warn'); } else if ($OrderLine->Quantity !=$Quantity - or $OrderLine->Price != $Price - or abs($OrderLine->DiscountPercent -$DiscountPercentage/100) >0.001 - or $OrderLine->Narrative != $Narrative - or $OrderLine->ItemDue != $_POST['ItemDue_' . $OrderLine->LineNumber] - or $OrderLine->POLine != $_POST['POLine_' . $OrderLine->LineNumber]) { + OR $OrderLine->Price != $Price + OR abs($OrderLine->DiscountPercent -$DiscountPercentage/100) >0.001 + OR $OrderLine->Narrative != $Narrative + OR $OrderLine->ItemDue != $_POST['ItemDue_' . $OrderLine->LineNumber] + OR $OrderLine->POLine != $_POST['POLine_' . $OrderLine->LineNumber]) { $_SESSION['Items'.$identifier]->update_cart_item($OrderLine->LineNumber, $Quantity, $Price, - ($DiscountPercentage/100), + filter_number_format($DiscountPercentage/100), $Narrative, 'Yes', /*Update DB */ $_POST['ItemDue_' . $OrderLine->LineNumber], @@ -1889,7 +1889,7 @@ '" . $BankAccountExRate . "', '" . $DefaultDispatchDate . "', '" . $_POST['PaymentMethod'] . "', - '" . (filter_number_format($_POST['AmountPaid']) * $BankAccountExRate) . "', + '" . filter_number_format(filter_number_format($_POST['AmountPaid']) * $BankAccountExRate) . "', '" . $_SESSION['Items'.$identifier]->DefaultCurrency . "')"; $DbgMsg = _('The SQL that failed to insert the bank account transaction was'); Modified: trunk/Numbers/Words/lang.bg.php =================================================================== --- trunk/Numbers/Words/lang.bg.php 2011-09-17 22:43:30 UTC (rev 4694) +++ trunk/Numbers/Words/lang.bg.php 2011-09-18 01:22:23 UTC (rev 4695) @@ -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-09-17 22:43:30 UTC (rev 4694) +++ trunk/Numbers/Words/lang.fr.php 2011-09-18 01:22:23 UTC (rev 4695) @@ -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-09-17 22:43:30 UTC (rev 4694) +++ trunk/Numbers/Words/lang.fr_BE.php 2011-09-18 01:22:23 UTC (rev 4695) @@ -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/PO_Items.php =================================================================== --- trunk/PO_Items.php 2011-09-17 22:43:30 UTC (rev 4694) +++ trunk/PO_Items.php 2011-09-18 01:22:23 UTC (rev 4695) @@ -33,21 +33,21 @@ if (isset($_POST['UpdateLines']) OR isset($_POST['Commit'])) { foreach ($_SESSION['PO'.$identifier]->LineItems as $POLine) { if ($POLine->Deleted == false) { - if (!is_numeric($_POST['ConversionFactor'.$POLine->LineNo])){ + if (!is_numeric(filter_number_format($_POST['ConversionFactor'.$POLine->LineNo]))){ prnMsg(_('The conversion factor is expected to be numeric - the figure which converts from our units to the supplier units. e.g. if the supplier units is a tonne and our unit is a kilogram then the conversion factor that converts our unit to the suppliers unit is 1000'),'error'); $_SESSION['PO'.$identifier]->LineItems[$POLine->LineNo]->ConversionFactor = 1; } else { //a valid number for the conversion factor is entered - $_SESSION['PO'.$identifier]->LineItems[$POLine->LineNo]->ConversionFactor = $_POST['ConversionFactor'.$POLine->LineNo]; + $_SESSION['PO'.$identifier]->LineItems[$POLine->LineNo]->ConversionFactor = filter_number_format($_POST['ConversionFactor'.$POLine->LineNo]); } - if (!is_numeric($_POST['SuppQty'.$POLine->LineNo])){ + if (!is_numeric(filter_number_format($_POST['SuppQty'.$POLine->LineNo]))){ prnMsg(_('The quantity in the supplier units 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]->Quantity=round($_POST['SuppQty'.$POLine->LineNo]*$_SESSION['PO'.$identifier]->LineItems[$POLine->LineNo]->ConversionFactor,$_SESSION['PO'.$identifier]->LineItems[$POLine->LineNo]->DecimalPlaces); + $_SESSION['PO'.$identifier]->LineItems[$POLine->LineNo]->Quantity=filter_number_format(round(filter_number_format($_POST['SuppQty'.$POLine->LineNo])*filter_number_format($_SESSION['PO'.$identifier]->LineItems[$POLine->LineNo]->ConversionFactor),$_SESSION['PO'.$identifier]->LineItems[$POLine->LineNo]->DecimalPlaces)); } - if (!is_numeric($_POST['SuppPrice'.$POLine->LineNo])){ + 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=$_POST['SuppPrice'.$POLine->LineNo]/$_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]; } @@ -166,22 +166,22 @@ '" . $_SESSION['PO'.$identifier]->Initiator . "', '" . $_SESSION['PO'.$identifier]->RequisitionNo . "', '" . $_SESSION['PO'.$identifier]->Location . "', - '" . $_SESSION['PO'.$identifier]->DelAdd1 . "', - '" . $_SESSION['PO'.$identifier]->DelAdd2 . "', - '" . $_SESSION['PO'.$identifier]->DelAdd3 . "', - '" . $_SESSION['PO'.$identifier]->DelAdd4 . "', - '" . $_SESSION['PO'.$identifier]->DelAdd5 . "', - '" . $_SESSION['PO'.$identifier]->DelAdd6 . "', - '" . $_SESSION['PO'.$identifier]->Tel . "', - '" . $_SESSION['PO'.$identifier]->SuppDelAdd1 . "', - '" . $_SESSION['PO'.$identifier]->SuppDelAdd2 . "', - '" . $_SESSION['PO'.$identifier]->SuppDelAdd3 . "', - '" . $_SESSION['PO'.$identifier]->SuppDelAdd4 . "', - '" . $_SESSION['PO'.$identifier]->SuppDelAdd5 . "', - '" . $_SESSION['PO'.$identifier]->SuppDelAdd6 . "', - '" . $_SESSION['PO'.$identifier]->SupplierContact . "', - '" . $_SESSION['PO'.$identifier]->SuppTel. "', - '" . $_SESSION['PO'.$identifier]->Contact . "', + '" . DB_escape_string($_SESSION['PO'.$identifier]->DelAdd1) . "', + '" . DB_escape_string($_SESSION['PO'.$identifier]->DelAdd2) . "', + '" . DB_escape_string($_SESSION['PO'.$identifier]->DelAdd3) . "', + '" . DB_escape_string($_SESSION['PO'.$identifier]->DelAdd4) . "', + '" . DB_escape_string($_SESSION['PO'.$identifier]->DelAdd5) . "', + '" . DB_escape_string($_SESSION['PO'.$identifier]->DelAdd6) . "', + '" . DB_escape_string($_SESSION['PO'.$identifier]->Tel) . "', + '" . DB_escape_string($_SESSION['PO'.$identifier]->SuppDelAdd1) . "', + '" . DB_escape_string($_SESSION['PO'.$identifier]->SuppDelAdd2) . "', + '" . DB_escape_string($_SESSION['PO'.$identifier]->SuppDelAdd3) . "', + '" . DB_escape_string($_SESSION['PO'.$identifier]->SuppDelAdd4) . "', + '" . DB_escape_string($_SESSION['PO'.$identifier]->SuppDelAdd5) . "', + '" . DB_escape_string($_SESSION['PO'.$identifier]->SuppDelAdd6) . "', + '" . DB_escape_string($_SESSION['PO'.$identifier]->SupplierContact) . "', + '" . DB_escape_string($_SESSION['PO'.$identifier]->SuppTel). "', + '" . DB_escape_string($_SESSION['PO'.$identifier]->Contact) . "', '" . $_SESSION['PO'.$identifier]->Version . "', '" . Date('Y-m-d') . "', '" . $_SESSION['PO'.$identifier]->DeliveryBy . "', @@ -198,7 +198,7 @@ /*Insert the purchase order detail records */ foreach ($_SESSION['PO'.$identifier]->LineItems as $POLine) { if ($POLine->Deleted==False) { - $sql = "INSERT INTO purchorderdetails ( orderno, + $sql = "INSERT INTO purchorderdetails (orderno, itemcode, deliverydate, itemdescription, @@ -214,7 +214,7 @@ VALUES ('" . $_SESSION['PO'.$identifier]->OrderNo . "', '" . $POLine->StockID . "', '" . FormatDateForSQL($POLine->ReqDelDate) . "', - '" . $POLine->ItemDescription . "', + '" . DB_escape_string($POLine->ItemDescription) . "', '" . $POLine->GLCode . "', '" . $POLine->Price . "', '" . $POLine->Quantity . "', @@ -254,7 +254,7 @@ /*Update the purchase order header with any changes */ $sql = "UPDATE purchorders SET supplierno = '" . $_SESSION['PO'.$identifier]->SupplierID . "' , - comments='" . $_SESSION['PO'.$identifier]->Comments . "', + comments='" . DB_escape_string($_SESSION['PO'.$identifier]->Comments) . "', rate='" . $_SESSION['PO'.$identifier]->ExRate . "', initiator='" . $_SESSION['PO'.$identifier]->Initiator . "', requisitionno= '" . $_SESSION['PO'.$identifier]->RequisitionNo . "', @@ -263,26 +263,26 @@ deliverydate='" . FormatDateForSQL($_SESSION['PO'.$identifier]->DeliveryDate) . "', revised= '" . Date('Y-m-d') . "', intostocklocation='" . $_SESSION['PO'.$identifier]->Location . "', - deladd1='" . $_SESSION['PO'.$identifier]->DelAdd1 . "', - deladd2='" . $_SESSION['PO'.$identifier]->DelAdd2 . "', - deladd3='" . $_SESSION['PO'.$identifier]->DelAdd3 . "', - deladd4='" . $_SESSION['PO'.$identifier]->DelAdd4 . "', - deladd5='" . $_SESSION['PO'.$identifier]->DelAdd5 . "', - deladd6='" . $_SESSION['PO'.$identifier]->DelAdd6 . "', - deladd6='" . $_SESSION['PO'.$identifier]->Tel . "', - suppdeladdress1='" . $_SESSION['PO'.$identifier]->SuppDelAdd1 . "', - suppdeladdress2='" . $_SESSION['PO'.$identifier]->SuppDelAdd2 . "', - suppdeladdress3='" . $_SESSION['PO'.$identifier]->SuppDelAdd3 . "', - suppdeladdress4='" . $_SESSION['PO'.$identifier]->SuppDelAdd4 . "', - suppdeladdress5='" . $_SESSION['PO'.$identifier]->SuppDelAdd5 . "', - suppdeladdress6='" . $_SESSION['PO'.$identifier]->SuppDelAdd6 . "', - suppliercontact='" . $_SESSION['PO'.$identifier]->SupplierContact . "', - supptel='" . $_SESSION['PO'.$identifier]->SuppTel . "', - contact='" . $_SESSION['PO'.$identifier]->Contact . "', + deladd1='" . DB_escape_string($_SESSION['PO'.$identifier]->DelAdd1) . "', + deladd2='" . DB_escape_string($_SESSION['PO'.$identifier]->DelAdd2) . "', + deladd3='" . DB_escape_string($_SESSION['PO'.$identifier]->DelAdd3) . "', + deladd4='" . DB_escape_string($_SESSION['PO'.$identifier]->DelAdd4) . "', + deladd5='" . DB_escape_string($_SESSION['PO'.$identifier]->DelAdd5) . "', + deladd6='" . DB_escape_string($_SESSION['PO'.$identifier]->DelAdd6) . "', + deladd6='" . DB_escape_string($_SESSION['PO'.$identifier]->Tel) . "', + suppdeladdress1='" . DB_escape_string($_SESSION['PO'.$identifier]->SuppDelAdd1) . "', + suppdeladdress2='" . DB_escape_string($_SESSION['PO'.$identifier]->SuppDelAdd2) . "', + suppdeladdress3='" . DB_escape_string($_SESSION['PO'.$identifier]->SuppDelAdd3) . "', + suppdeladdress4='" . DB_escape_string($_SESSION['PO'.$identifier]->SuppDelAdd4) . "', + suppdeladdress5='" . DB_escape_string($_SESSION['PO'.$identifier]->SuppDelAdd5) . "', + suppdeladdress6='" . DB_escape_string($_SESSION['PO'.$identifier]->SuppDelAdd6) . "', + suppliercontact='" . DB_escape_string($_SESSION['PO'.$identifier]->SupplierContact) . "', + supptel='" . DB_escape_string($_SESSION['PO'.$identifier]->SuppTel) . "', + contact='" . DB_escape_string($_SESSION['PO'.$identifier]->Contact) . "', paymentterms='" . $_SESSION['PO'.$identifier]->PaymentTerms . "', allowprint='" . $_SESSION['PO'.$identifier]->AllowPrintPO . "', status = '" . $_SESSION['PO'.$identifier]->Status . "', - stat_comment = '" . $_SESSION['PO'.$identifier]->StatusComments . "' + stat_comment = '" . DB_escape_string($_SESSION['PO'.$identifier]->StatusComments) . "' WHERE orderno = '" . $_SESSION['PO'.$identifier]->OrderNo ."'"; $ErrMsg = _('The purchase order could not be updated because'); @@ -321,7 +321,7 @@ '" . $_SESSION['PO'.$identifier]->OrderNo . "', '" . $POLine->StockID . "', '" . FormatDateForSQL($POLine->ReqDelDate) . "', - '" . $POLine->ItemDescription . "', + '" . DB_escape_string($POLine->ItemDescription) . "', '" . $POLine->GLCode . "', '" . $POLine->Price . "', '" . $POLine->Quantity . "', @@ -336,14 +336,14 @@ if ($POLine->Quantity==$POLine->QtyReceived){ $sql = "UPDATE purchorderdetails SET itemcode='" . $POLine->StockID . "', deliverydate ='" . FormatDateForSQL($POLine->ReqDelDate) . "', - itemdescription='" . $POLine->ItemDescription . "', + itemdescription='" . DB_escape_string($POLine->ItemDescription) . "', glcode='" . $POLine->GLCode . "', unitprice='" . $POLine->Price . "', quantityord='" . $POLine->Quantity . "', shiptref='" . $POLine->ShiptRef . "', jobref='" . $POLine->JobRef . "', suppliersunit='" . $POLine->SuppliersUnit . "', - suppliers_partno='" . $POLine->Suppliers_PartNo . "', + suppliers_partno='" . DB_escape_string($POLine->Suppliers_PartNo) . "', completed=1, assetid='" . $POLine->AssetID . "', conversionfactor = '" . $POLine->ConversionFactor . "' @@ -351,7 +351,7 @@ } else { $sql = "UPDATE purchorderdetails SET itemcode='" . $POLine->StockID . "', deliverydate ='" . FormatDateForSQL($POLine->ReqDelDate) . "', - itemdescription='" . $POLine->ItemDescription . "', + itemdescription='" . DB_escape_string($POLine->ItemDescription) . "', glcode='" . $POLine->GLCode . "', unitprice='" . $POLine->Price . "', quantityord='" . $POLine->Quantity . "', @@ -407,11 +407,11 @@ if (isset($_POST['EnterLine'])){ /*Inputs from the form directly without selecting a stock item from the search */ $AllowUpdate = true; /*always assume the best */ - if (!is_numeric($_POST['Qty'])){ + if (!is_numeric(filter_number_format($_POST['Qty']))){ $AllowUpdate = false; prnMsg( _('Cannot Enter this order line') . '<br />' . _('The quantity of the order item must be numeric'),'error'); } - if ($_POST['Qty']<0){ + if (filter_number_format($_POST['Qty'])<0){ $AllowUpdate = false; prnMsg( _('Cannot Enter this order line') . '<br />' . _('The quantity of the ordered item entered must be a positive amount'),'error'); } @@ -424,8 +424,6 @@ prnMsg( _('Cannot Enter this order line') . '</b><br />' . _('The date entered must be in the format') . ' ' . $_SESSION['DefaultDateFormat'], 'error'); } -// include ('PO_Chk_ShiptRef_JobRef.php'); - /*It's not a stock item */ /*need to check GL Code is valid if GLLink is active */ @@ -491,9 +489,9 @@ '', 0, /*Serialised */ 0, /*Controlled */ - $_POST['Qty'], + filter_number_format($_POST['Qty']), $_POST['ItemDescription'], - $_POST['Price'], + filter_number_format($_POST['Price']), $_POST['SuppliersUnit'], $_POST['GLCode'], $_POST['ReqDelDate'], @@ -526,7 +524,7 @@ foreach ($_POST as $FormVariableName => $Quantity) { /*The form entity name is of the format NewQtyX where X is the index number that identifies the stock item code held in the hidden StockIDX form variable * */ - if (mb_substr($FormVariableName, 0, 6)=='NewQty' AND $Quantity!=0) { //if the form variable represents a Qty to add to the order + if (mb_substr($FormVariableName, 0, 6)=='NewQty' AND filter_number_format($Quantity)!=0) { //if the form variable represents a Qty to add to the order $ItemCode = $_POST['StockID' . mb_substr($FormVariableName, 6)]; $AlreadyOnThisOrder = 0; @@ -544,7 +542,7 @@ } /* end of the foreach loop to look for preexisting items of the same code */ } } - if ($AlreadyOnThisOrder!=1 AND $Quantity > 0){ + if ($AlreadyOnThisOrder!=1 AND filter_number_format($Quantity) > 0){ $sql = "SELECT description, longdescription, stockid, @@ -588,7 +586,7 @@ $PurchDataResult = DB_query($sql,$db,$ErrMsg,$DbgMsg); if (DB_num_rows($PurchDataResult)>0){ //the purchasing data is set up $PurchRow = DB_fetch_array($PurchDataResult); - $PurchPrice = $PurchRow['price']/$PurchRow['conversionfactor']; + $PurchPrice = filter_number_format($PurchRow['price']/$PurchRow['conversionfactor']); $ConversionFactor = $PurchRow['conversionfactor']; $SupplierDescription = $PurchRow['suppliers_partno'] .' - '; if (mb_strlen($PurchRow['supplierdescription'])>2){ @@ -612,7 +610,7 @@ $ItemCode, 0, /*Serialised */ 0, /*Controlled */ - $Quantity*$ConversionFactor, /* Qty */ + filter_number_format((filter_number_format($Quantity)*$ConversionFactor), /* Qty */ $SupplierDescription, $PurchPrice, $ItemRow['units'], @@ -679,14 +677,14 @@ foreach ($_SESSION['PO'.$identifier]->LineItems as $POLine) { if ($POLine->Deleted==False) { - $LineTotal = $POLine->Quantity * $POLine->Price; - $DisplayLineTotal = locale_number_format($LineTotal,$_SESSION['PO'.$identifier]->CurrDecimalPlaces); + $LineTotal = filter_number_format($POLine->Quantity * $POLine->Price); + $DisplayLineTotal = locale_money_format($LineTotal,$_SESSION['PO'.$identifier]->CurrDecimalPlaces); // Note if the price is greater than 1 use 2 decimal place, if the price is a fraction of 1, use 4 decimal places // This should help display where item-price is a fraction if ($POLine->Price > 1) { - $DisplayPrice = locale_number_format($POLine->Price,$_SESSION['PO'.$identifier]->CurrDecimalPlaces); + $DisplayPrice = locale_money_format($POLine->Price,$_SESSION['PO'.$identifier]->CurrDecimalPlaces); } else { - $DisplayPrice = locale_number_format($POLine->Price,4); + $DisplayPrice = locale_money_format($POLine->Price,4); } if ($k==1){ @@ -703,9 +701,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="' . round($POLine->Quantity/$POLine->ConversionFactor,$POLine->DecimalPlaces) . '"></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>' . $POLine->SuppliersUnit . '</td> - <td><input type="text" class="number" name="SuppPrice' . $POLine->LineNo . '" size="10" value="' . round(($POLine->Price *$POLine->ConversionFactor),$_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){ @@ -718,7 +716,7 @@ } } - $DisplayTotal = locale_number_format($_SESSION['PO'.$identifier]->Total,$_SESSION['PO'.$identifier]->CurrDecimalPlaces); + $DisplayTotal = locale_money_format($_SESSION['PO'.$identifier]->Total,$_SESSION['PO'.$identifier]->CurrDecimalPlaces); echo '<tr><td colspan="9" class="number">' . _('TOTAL') . _(' excluding Tax') . '</td> <td class="number"><b>' . $DisplayTotal . '</b></td> </tr></table>'; @@ -764,13 +762,13 @@ echo'</select><a href="FixedAssetItems.php" target=_blank>'. _('New Fixed Asset') . '</a></td> <tr><td>'._('Quantity to purchase').'</td> - <td><input type="text" class="number" name="Qty" size="10" value="1"></td></tr> + <td><input type="text" class="number" name="Qty" size="10" value="1" /></td></tr> <tr><td>'._('Price per item').'</td> - <td><input type="text" class="number" name="Price" size="10"></td></tr> + <td><input type="text" class="number" name="Price" size="10" /></td></tr> <tr><td>'._('Unit').'</td> - <td><input type="text" name="SuppliersUnit" size="10" value="' . _('each') . '"></td></tr> + <td><input type="text" name="SuppliersUnit" size="10" value="' . _('each') . '" /></td></tr> <tr><td>'._('Delivery Date').'</td> - <td><input type="text" class="date" alt="'.$_SESSION['DefaultDateFormat'].'" name="ReqDelDate" size=11 value="'.$_SESSION['PO'.$identifier]->DeliveryDate .'"></td></tr>'; + <td><input type="text" class="date" alt="'.$_SESSION['DefaultDateFormat'].'" name="ReqDelDate" size=11 value="'.$_SESSION['PO'.$identifier]->DeliveryDate .'" /></td></tr>'; echo '</table>'; echo '<div class="centre"> <input type=submit name="EnterLine" value="Enter Item" /> @@ -1053,15 +1051,15 @@ } echo ' /></td> <td><font size="3"><b>' . _('OR') . ' </b></font>' . _('Enter extract of the Stock Code') . ':</td> - <td><input type="text" name="StockCode" size=15 maxlength=18 value="' . $_POST['StockCode'] . '"></td> + <td><input type="text" name="StockCode" size="15" maxlength="18" value="' . $_POST['StockCode'] . '" /></td> </tr> <tr><td></td> <td><font size=3><b>' . _('OR') . ' </b></font><a target="_blank" href="'.$rootpath.'/Stocks.php">' . _('Create a New Stock Item') . '</a></td></tr> </table> <br /> - <div class="centre"><input type="submit" name="Search" value="' . _('Search Now') . '"> - <input type="submit" name="NonStockOrder" value="' . _('Order a non stock item') . '"> + <div class="centre"><input type="submit" name="Search" value="' . _('Search Now') . '" /> + <input type="submit" name="NonStockOrder" value="' . _('Order a non stock item') . '" /> </div><br />'; $PartsDisplayed =0; @@ -1124,7 +1122,7 @@ <td class="number">' . $ConversionFactor .'</td> <td>' . $OrderUnits . '</td> <td>' . $ImageSource . '</td> - <td><input class="number" type="text" size="6" value="0" name="NewQty' . $j . '"></td> + <td><input class="number" type="text" size="6" value="0" name="NewQty' . $j . '" /></td> <input type="hidden" name="StockID' . $j .'" . value="' . $myrow['stockid'] . '" /> </tr>'; $j++; @@ -1141,7 +1139,7 @@ prnMsg( _('Only the first') . ' ' . $Maximum_Number_Of_Parts_To_Show . ' ' . _('can be displayed') . '. ' . _('Please restrict your search to only the parts required'),'info'); } - echo '<a name="end"></a><br /><div class="centre"><input type="submit" name="NewItem" value="Order some"></div>'; + echo '<a name="end"></a><br /><div class="centre"><input type="submit" name="NewItem" value="Order some" /></div>'; }#end if SearchResults to show echo '</form>'; Modified: trunk/includes/phplot/phplot.php =================================================================== --- trunk/includes/phplot/phplot.php 2011-09-17 22:43:30 UTC (rev 4694) +++ trunk/includes/phplot/phplot.php 2011-09-18 01:22:23 UTC (rev 4695) @@ -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-09-17 22:43:30 UTC (rev 4694) +++ trunk/includes/tcpdf/tcpdf.php 2011-09-18 01:22:23 UTC (rev 4695) @@ -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-09-17 22:43:38
|
Revision: 4694 http://web-erp.svn.sourceforge.net/web-erp/?rev=4694&view=rev Author: daintree Date: 2011-09-17 22:43:30 +0000 (Sat, 17 Sep 2011) Log Message: ----------- number_formats Modified Paths: -------------- trunk/ConfirmDispatch_Invoice.php trunk/PrintCustTrans.php trunk/PrintCustTransPortrait.php trunk/SelectOrderItems.php trunk/StockAdjustments.php trunk/UpgradeDatabase.php trunk/WWW_Users.php trunk/doc/Change.log trunk/includes/Add_SerialItems.php trunk/includes/ConnectDB.inc trunk/includes/InputSerialItems.php trunk/includes/InputSerialItemsKeyed.php trunk/includes/LanguageSetup.php trunk/sql/mysql/upgrade4.05-4.06.sql Modified: trunk/ConfirmDispatch_Invoice.php =================================================================== --- trunk/ConfirmDispatch_Invoice.php 2011-09-17 07:49:08 UTC (rev 4693) +++ trunk/ConfirmDispatch_Invoice.php 2011-09-17 22:43:30 UTC (rev 4694) @@ -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($_POST['FreightTaxRate' . $FreightTaxLine->TaxCalculationOrder]/100); + $_SESSION['Items']->FreightTaxes[$FreightTaxLine->TaxCalculationOrder]->TaxRate = filter_number_format(filter_number_format($_POST['FreightTaxRate' . $FreightTaxLine->TaxCalculationOrder])/100); } } @@ -227,7 +227,7 @@ } 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($_POST[$Itm->LineNumber . $TaxLine->TaxCalculationOrder . '_TaxRate']/100); + $_SESSION['Items']->LineItems[$Itm->LineNumber]->Taxes[$TaxLine->TaxCalculationOrder]->TaxRate = filter_number_format(filter_number_format($_POST[$Itm->LineNumber . $TaxLine->TaxCalculationOrder . '_TaxRate'])/100); } } } //end foreach lineitem @@ -311,15 +311,15 @@ if ($LnItm->Controlled==1){ if (isset($_POST['ProcessInvoice'])) { - echo '<td class="number">' . $LnItm->QtyDispatched . '</td>'; + echo '<td class="number">' . locale_number_format($LnItm->QtyDispatched,$LnItm->DecimalPlaces) . '</td>'; } else { - echo '<td class="number"><input type=hidden name="' . $LnItm->LineNumber . '_QtyDispatched" value="' . $LnItm->QtyDispatched . '"><a href="' . $rootpath .'/ConfirmDispatchControlled_Invoice.php?LineNo='. $LnItm->LineNumber.'">' .$LnItm->QtyDispatched . '</a></td>'; + echo '<td class="number"><input type=hidden name="' . $LnItm->LineNumber . '_QtyDispatched" value="' . $LnItm->QtyDispatched . '"><a href="' . $rootpath .'/ConfirmDispatchControlled_Invoice.php?LineNo='. $LnItm->LineNumber.'">' .locale_number_format($LnItm->QtyDispatched,$LnItm->DecimalPlaces) . '</a></td>'; } } else { if (isset($_POST['ProcessInvoice'])) { - echo '<td class="number">' . $LnItm->QtyDispatched . '</td>'; + echo '<td class="number">' . locale_number_format($LnItm->QtyDispatched,$LnItm->DecimalPlaces) . '</td>'; } else { - echo '<td class="number"><input tabindex="'.$j.'" type="text" class="number" name="' . $LnItm->LineNumber . '_QtyDispatched" maxlength=12 size=12 value="' . $LnItm->QtyDispatched . '"></td>'; + echo '<td class="number"><input tabindex="'.$j.'" type="text" class="number" name="' . $LnItm->LineNumber . '_QtyDispatched" maxlength="12" size="12" value="' . locale_number_format($LnItm->QtyDispatched,$LnItm->DecimalPlaces) . '"></td>'; } } $DisplayDiscountPercent = locale_number_format($LnItm->DiscountPercent*100,2) . '%'; @@ -458,15 +458,15 @@ $_POST['ChargeFreightCost']=0; } if ($_SESSION['Items']->Any_Already_Delivered()==1 and (!isset($_SESSION['Items']->FreightCost) or $_POST['ChargeFreightCost']==0)) { - echo '<td colspan=2 class=number>'. _('Charge Freight Cost inc Tax').'</td> + echo '<td colspan="2" class="number">'. _('Charge Freight Cost inc Tax').'</td> <td><input tabindex='.$j.' type="text" class="number" size="10" maxlength="12" name="ChargeFreightCost" value="0"></td>'; $_SESSION['Items']->FreightCost=0; } else { - echo '<td colspan=2 class=number>'. _('Charge Freight Cost inc Tax').'</td>'; + echo '<td colspan="2" class="number">'. _('Charge Freight Cost inc Tax').'</td>'; if (isset($_POST['ProcessInvoice'])) { echo '<td class="number">' . $_SESSION['Items']->FreightCost . '</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="' . $_SESSION['Items']->FreightCost . '" /></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="' . $FreightTaxLine->TaxRate * 100 . '" />'; } if ($FreightTaxLine->TaxOnTax ==1){ @@ -587,7 +587,7 @@ /*Now look for assembly components that would go negative */ $SQL = "SELECT bom.component, stockmaster.description, - locstock.quantity-(" . filter_number_format($OrderLine->QtyDispatched) . "*bom.quantity) AS qtyleft + locstock.quantity-(" . $OrderLine->QtyDispatched . "*bom.quantity) AS qtyleft FROM bom INNER JOIN locstock ON bom.component=locstock.stockid @@ -612,7 +612,7 @@ if ($NegativesFound){ echo '<div class="centre"> - <input type="submit" name="Update" value="' . _('Update'). '"></div>'; + <input type="submit" name="Update" value="' . _('Update'). '" /></div>'; include('includes/footer.inc'); exit; } @@ -679,7 +679,8 @@ while ($myrow = DB_fetch_array($Result)) { - if ($_SESSION['Items']->LineItems[$myrow['orderlineno']]->Quantity != $myrow['quantity'] OR $_SESSION['Items']->LineItems[$myrow['orderlineno']]->QtyInv != $myrow['qtyinvoiced']) { + if ($_SESSION['Items']->LineItems[$myrow['orderlineno']]->Quantity != $myrow['quantity'] + OR $_SESSION['Items']->LineItems[$myrow['orderlineno']]->QtyInv != $myrow['qtyinvoiced']) { echo '<br />'. _('Orig order for'). ' ' . $myrow['orderlineno'] . ' '. _('has a quantity of'). ' ' . $myrow['quantity'] . ' '. _('and an invoiced qty of'). ' ' . $myrow['qtyinvoiced'] . ' '. _('the session shows quantity of'). ' ' . $_SESSION['Items']->LineItems[$myrow['orderlineno']]->Quantity . ' ' . _('and quantity invoice of'). ' ' . $_SESSION['Items']->LineItems[$myrow['orderlineno']]->QtyInv; Modified: trunk/PrintCustTrans.php =================================================================== --- trunk/PrintCustTrans.php 2011-09-17 07:49:08 UTC (rev 4693) +++ trunk/PrintCustTrans.php 2011-09-17 22:43:30 UTC (rev 4694) @@ -281,8 +281,8 @@ $DisplayDiscount = locale_number_format($myrow2['discountpercent']*100,2) . '%'; $DiscountPrice=$myrow2['fxprice']*(1-$myrow2['discountpercent']); } - $DisplayNet=locale_number_format($myrow2['fxnet'],$myrow['decimalplaces']); - $DisplayPrice=locale_number_format($myrow2['fxprice'],$myrow['decimalplaces']); + $DisplayNet=locale_money_format($myrow2['fxnet'],$myrow['decimalplaces']); + $DisplayPrice=locale_money_format($myrow2['fxprice'],$myrow['decimalplaces']); $DisplayQty=locale_number_format($myrow2['quantity'],$myrow2['decimalplaces']); $LeftOvers = $pdf->addTextWrap($Left_Margin+3,$YPos,95,$FontSize,$myrow2['stockid']); @@ -355,17 +355,17 @@ if ($InvOrCredit=='Invoice') { - $DisplaySubTot = locale_number_format($myrow['ovamount'],$myrow['decimalplaces']); - $DisplayFreight = locale_number_format($myrow['ovfreight'],$myrow['decimalplaces']); - $DisplayTax = locale_number_format($myrow['ovgst'],$myrow['decimalplaces']); - $DisplayTotal = locale_number_format($myrow['ovfreight']+$myrow['ovgst']+$myrow['ovamount'],$myrow['decimalplaces']); + $DisplaySubTot = locale_money_format($myrow['ovamount'],$myrow['decimalplaces']); + $DisplayFreight = locale_money_format($myrow['ovfreight'],$myrow['decimalplaces']); + $DisplayTax = locale_money_format($myrow['ovgst'],$myrow['decimalplaces']); + $DisplayTotal = locale_money_format($myrow['ovfreight']+$myrow['ovgst']+$myrow['ovamount'],$myrow['decimalplaces']); } else { - $DisplaySubTot = locale_number_format(-$myrow['ovamount'],$myrow['decimalplaces']); - $DisplayFreight = locale_number_format(-$myrow['ovfreight'],$myrow['decimalplaces']); - $DisplayTax = locale_number_format(-$myrow['ovgst'],$myrow['decimalplaces']); - $DisplayTotal = locale_number_format(-$myrow['ovfreight']-$myrow['ovgst']-$myrow['ovamount'],$myrow['decimalplaces']); + $DisplaySubTot = locale_money_format(-$myrow['ovamount'],$myrow['decimalplaces']); + $DisplayFreight = locale_money_format(-$myrow['ovfreight'],$myrow['decimalplaces']); + $DisplayTax = locale_money_format(-$myrow['ovgst'],$myrow['decimalplaces']); + $DisplayTotal = locale_money_format(-$myrow['ovfreight']-$myrow['ovgst']-$myrow['ovamount'],$myrow['decimalplaces']); } /* Print out the invoice text entered */ $YPos = $Bottom_Margin+(3*$line_height); @@ -865,9 +865,9 @@ echo $RowStarter; - $DisplayPrice = locale_number_format($myrow2['fxprice'],$myrow['decimalplaces']); + $DisplayPrice = locale_money_format($myrow2['fxprice'],$myrow['decimalplaces']); $DisplayQty = locale_number_format($myrow2['quantity'],$myrow2['decimalplaces']); - $DisplayNet = locale_number_format($myrow2['fxnet'],$myrow['decimalplaces']); + $DisplayNet = locale_money_format($myrow2['fxnet'],$myrow['decimalplaces']); if ($myrow2['discountpercent']==0){ $DisplayDiscount =''; @@ -1005,15 +1005,15 @@ if ($InvOrCredit=='Invoice') { - $DisplaySubTot = locale_number_format($myrow['ovamount'],$myrow['decimalplaces']); - $DisplayFreight = locale_number_format($myrow['ovfreight'],$myrow['decimalplaces']); - $DisplayTax = locale_number_format($myrow['ovgst'],$myrow['decimalplaces']); - $DisplayTotal = locale_number_format($myrow['ovfreight']+$myrow['ovgst']+$myrow['ovamount'],$myrow['decimalplaces']); + $DisplaySubTot = locale_money_format($myrow['ovamount'],$myrow['decimalplaces']); + $DisplayFreight = locale_money_format($myrow['ovfreight'],$myrow['decimalplaces']); + $DisplayTax = locale_money_format($myrow['ovgst'],$myrow['decimalplaces']); + $DisplayTotal = locale_money_format($myrow['ovfreight']+$myrow['ovgst']+$myrow['ovamount'],$myrow['decimalplaces']); } else { - $DisplaySubTot = locale_number_format(-$myrow['ovamount'],$myrow['decimalplaces']); - $DisplayFreight = locale_number_format(-$myrow['ovfreight'],$myrow['decimalplaces']); - $DisplayTax = locale_number_format(-$myrow['ovgst'],$myrow['decimalplaces']); - $DisplayTotal = locale_number_format(-$myrow['ovfreight']-$myrow['ovgst']-$myrow['ovamount'],$myrow['decimalplaces']); + $DisplaySubTot = locale_money_format(-$myrow['ovamount'],$myrow['decimalplaces']); + $DisplayFreight = locale_money_format(-$myrow['ovfreight'],$myrow['decimalplaces']); + $DisplayTax = locale_money_format(-$myrow['ovgst'],$myrow['decimalplaces']); + $DisplayTotal = locale_money_format(-$myrow['ovfreight']-$myrow['ovgst']-$myrow['ovamount'],$myrow['decimalplaces']); } /*Print out the invoice text entered */ Modified: trunk/PrintCustTransPortrait.php =================================================================== --- trunk/PrintCustTransPortrait.php 2011-09-17 07:49:08 UTC (rev 4693) +++ trunk/PrintCustTransPortrait.php 2011-09-17 22:43:30 UTC (rev 4694) @@ -311,8 +311,8 @@ $DisplayDiscount = locale_number_format($myrow2['discountpercent'] * 100, 2) . '%'; $DiscountPrice = $myrow2['fxprice'] * (1 - $myrow2['discountpercent']); } - $DisplayNet = locale_number_format($myrow2['fxnet'],$myrow['decimalplaces']); - $DisplayPrice = locale_number_format($myrow2['fxprice'],$myrow['decimalplaces']); + $DisplayNet = locale_money_format($myrow2['fxnet'],$myrow['decimalplaces']); + $DisplayPrice = locale_money_format($myrow2['fxprice'],$myrow['decimalplaces']); $DisplayQty = locale_number_format($myrow2['quantity'],$myrow2['decimalplaces']); $LeftOvers = $pdf->addTextWrap($Left_Margin+5,$YPos,71,$FontSize,$myrow2['stockid']); @@ -424,15 +424,15 @@ if ($InvOrCredit=='Invoice') { - $DisplaySubTot = locale_number_format($myrow['ovamount'],$myrow['decimalplaces']); - $DisplayFreight = locale_number_format($myrow['ovfreight'],$myrow['decimalplaces']); - $DisplayTax = locale_number_format($myrow['ovgst'],$myrow['decimalplaces']); - $DisplayTotal = locale_number_format($myrow['ovfreight']+$myrow['ovgst']+$myrow['ovamount'],$myrow['decimalplaces']); + $DisplaySubTot = locale_money_format($myrow['ovamount'],$myrow['decimalplaces']); + $DisplayFreight = locale_money_format($myrow['ovfreight'],$myrow['decimalplaces']); + $DisplayTax = locale_money_format($myrow['ovgst'],$myrow['decimalplaces']); + $DisplayTotal = locale_money_format($myrow['ovfreight']+$myrow['ovgst']+$myrow['ovamount'],$myrow['decimalplaces']); } else { - $DisplaySubTot = locale_number_format(-$myrow['ovamount'],$myrow['decimalplaces']); - $DisplayFreight = locale_number_format(-$myrow['ovfreight'],$myrow['decimalplaces']); - $DisplayTax = locale_number_format(-$myrow['ovgst'],$myrow['decimalplaces']); - $DisplayTotal = locale_number_format(-$myrow['ovfreight']-$myrow['ovgst']-$myrow['ovamount'],$myrow['decimalplaces']); + $DisplaySubTot = locale_money_format(-$myrow['ovamount'],$myrow['decimalplaces']); + $DisplayFreight = locale_money_format(-$myrow['ovfreight'],$myrow['decimalplaces']); + $DisplayTax = locale_money_format(-$myrow['ovgst'],$myrow['decimalplaces']); + $DisplayTotal = locale_money_format(-$myrow['ovfreight']-$myrow['ovgst']-$myrow['ovamount'],$myrow['decimalplaces']); } /*Print out the invoice text entered */ $YPos = $Bottom_Margin+(3*$line_height); @@ -891,9 +891,9 @@ echo $RowStarter; - $DisplayPrice =locale_number_format($myrow2['fxprice'],$myrow['decimalplaces']); + $DisplayPrice =locale_money_format($myrow2['fxprice'],$myrow['decimalplaces']); $DisplayQty = locale_number_format($myrow2['quantity'],$myrow2['decimalplaces']); - $DisplayNet = locale_number_format($myrow2['fxnet'],$myrow['decimalplaces']); + $DisplayNet = locale_money_format($myrow2['fxnet'],$myrow['decimalplaces']); if ($myrow2['discountpercent']==0){ $DisplayDiscount =''; @@ -1029,15 +1029,15 @@ if ($InvOrCredit=='Invoice') { - $DisplaySubTot = locale_number_format($myrow['ovamount'],$myrow['decimalplaces']); - $DisplayFreight = locale_number_format($myrow['ovfreight'],$myrow['decimalplaces']); - $DisplayTax = locale_number_format($myrow['ovgst'],$myrow['decimalplaces']); - $DisplayTotal = locale_number_format($myrow['ovfreight']+$myrow['ovgst']+$myrow['ovamount'],$myrow['decimalplaces']); + $DisplaySubTot = locale_money_format($myrow['ovamount'],$myrow['decimalplaces']); + $DisplayFreight = locale_money_format($myrow['ovfreight'],$myrow['decimalplaces']); + $DisplayTax = locale_money_format($myrow['ovgst'],$myrow['decimalplaces']); + $DisplayTotal = locale_money_format($myrow['ovfreight']+$myrow['ovgst']+$myrow['ovamount'],$myrow['decimalplaces']); } else { - $DisplaySubTot = locale_number_format(-$myrow['ovamount'],$myrow['decimalplaces']); - $DisplayFreight = locale_number_format(-$myrow['ovfreight'],$myrow['decimalplaces']); - $DisplayTax = locale_number_format(-$myrow['ovgst'],2); - $DisplayTotal = locale_number_format(-$myrow['ovfreight']-$myrow['ovgst']-$myrow['ovamount'],$myrow['decimalplaces']); + $DisplaySubTot = locale_money_format(-$myrow['ovamount'],$myrow['decimalplaces']); + $DisplayFreight = locale_money_format(-$myrow['ovfreight'],$myrow['decimalplaces']); + $DisplayTax = locale_money_format(-$myrow['ovgst'],2); + $DisplayTotal = locale_money_format(-$myrow['ovfreight']-$myrow['ovgst']-$myrow['ovamount'],$myrow['decimalplaces']); } /*Print out the invoice text entered */ echo '<table class="table1"><tr> Modified: trunk/SelectOrderItems.php =================================================================== --- trunk/SelectOrderItems.php 2011-09-17 07:49:08 UTC (rev 4693) +++ trunk/SelectOrderItems.php 2011-09-17 22:43:30 UTC (rev 4694) @@ -730,10 +730,9 @@ $SQL = "SELECT stockmaster.stockid, stockmaster.description, stockmaster.units - FROM stockmaster, - stockcategory - WHERE stockmaster.categoryid=stockcategory.categoryid - AND (stockcategory.stocktype='F' OR stockcategory.stocktype='D') + FROM stockmaster INNER JOIN stockcategory + ON stockmaster.categoryid=stockcategory.categoryid + WHERE (stockcategory.stocktype='F' OR stockcategory.stocktype='D') AND stockmaster.mbflag <>'G' AND stockmaster.description " . LIKE . " '" . $SearchString . "' AND stockmaster.discontinued=0 @@ -742,9 +741,9 @@ $SQL = "SELECT stockmaster.stockid, stockmaster.description, stockmaster.units - FROM stockmaster, stockcategory - WHERE stockmaster.categoryid=stockcategory.categoryid - AND (stockcategory.stocktype='F' OR stockcategory.stocktype='D') + FROM stockmaster INNER JOIN stockcategory + ON stockmaster.categoryid=stockcategory.categoryid + WHERE (stockcategory.stocktype='F' OR stockcategory.stocktype='D') AND stockmaster.mbflag <>'G' AND stockmaster.discontinued=0 AND stockmaster.description " . LIKE . " '" . $SearchString . "' @@ -761,9 +760,9 @@ $SQL = "SELECT stockmaster.stockid, stockmaster.description, stockmaster.units - FROM stockmaster, stockcategory - WHERE stockmaster.categoryid=stockcategory.categoryid - AND (stockcategory.stocktype='F' OR stockcategory.stocktype='D') + FROM stockmaster INNER JOIN stockcategory + ON stockmaster.categoryid=stockcategory.categoryid + WHERE (stockcategory.stocktype='F' OR stockcategory.stocktype='D') AND stockmaster.stockid " . LIKE . " '" . $SearchString . "' AND stockmaster.mbflag <>'G' AND stockmaster.discontinued=0 @@ -772,9 +771,9 @@ $SQL = "SELECT stockmaster.stockid, stockmaster.description, stockmaster.units - FROM stockmaster, stockcategory - WHERE stockmaster.categoryid=stockcategory.categoryid - AND (stockcategory.stocktype='F' OR stockcategory.stocktype='D') + FROM stockmaster INNER JOIN stockcategory + ON stockmaster.categoryid=stockcategory.categoryid + WHERE (stockcategory.stocktype='F' OR stockcategory.stocktype='D') AND stockmaster.stockid " . LIKE . " '" . $SearchString . "' AND stockmaster.mbflag <>'G' AND stockmaster.discontinued=0 @@ -787,9 +786,9 @@ $SQL = "SELECT stockmaster.stockid, stockmaster.description, stockmaster.units - FROM stockmaster, stockcategory - WHERE stockmaster.categoryid=stockcategory.categoryid - AND (stockcategory.stocktype='F' OR stockcategory.stocktype='D') + FROM stockmaster INNER JOIN stockcategory + ON stockmaster.categoryid=stockcategory.categoryid + WHERE (stockcategory.stocktype='F' OR stockcategory.stocktype='D') AND stockmaster.mbflag <>'G' AND stockmaster.discontinued=0 ORDER BY stockmaster.stockid"; @@ -797,9 +796,9 @@ $SQL = "SELECT stockmaster.stockid, stockmaster.description, stockmaster.units - FROM stockmaster, stockcategory - WHERE stockmaster.categoryid=stockcategory.categoryid - AND (stockcategory.stocktype='F' OR stockcategory.stocktype='D') + FROM stockmaster INNER JOIN stockcategory + ON stockmaster.categoryid=stockcategory.categoryid + WHERE (stockcategory.stocktype='F' OR stockcategory.stocktype='D') AND stockmaster.mbflag <>'G' AND stockmaster.discontinued=0 AND stockmaster.categoryid='" . $_POST['StockCat'] . "' @@ -816,7 +815,7 @@ if (!isset($Offset) or $Offset<0) { $Offset=0; } - $SQL = $SQL . " LIMIT " . $_SESSION['DefaultDisplayRecordsMax'] . " OFFSET " . strval(filter_number_format($_SESSION['DefaultDisplayRecordsMax']*$Offset)); + $SQL = $SQL . " LIMIT " . $_SESSION['DefaultDisplayRecordsMax'] . " OFFSET " . strval($_SESSION['DefaultDisplayRecordsMax']*$Offset); $ErrMsg = _('There is a problem selecting the part records to display because'); $DbgMsg = _('The SQL used to get the part selection was'); @@ -1056,7 +1055,7 @@ if (isset($_POST['Quantity_' . $OrderLine->LineNumber])){ - $Quantity = filter_number_format($_POST['Quantity_' . $OrderLine->LineNumber]); + $Quantity = round(filter_number_format($_POST['Quantity_' . $OrderLine->LineNumber]),$OrderLine->DecimalPlaces); if (ABS($OrderLine->Price - filter_number_format($_POST['Price_' . $OrderLine->LineNumber]))>0.01){ $Price = filter_number_format($_POST['Price_' . $OrderLine->LineNumber]); @@ -1164,7 +1163,7 @@ foreach ($_SESSION['Items'.$identifier]->LineItems as $OrderLine_2) { if ($OrderLine_2->DiscCat==$OrderLine->DiscCat){ $_SESSION['Items'.$identifier]->LineItems[$OrderLine_2->LineNumber]->DiscountPercent = $DiscountMatrixRate; - $_SESSION['Items'.$identifier]->LineItems[$OrderLine_2->LineNumber]->GPPercent = (($_SESSION['Items'.$identifier]->LineItems[$OrderLine_2->LineNumber]->Price*(1-$DiscountMatrixRate)) - $_SESSION['Items'.$identifier]->LineItems[$OrderLine_2->LineNumber]->StandardCost*$ExRate)/($_SESSION['Items'.$identifier]->LineItems[$OrderLine_2->LineNumber]->Price *(1-$DiscountMatrixRate)/100); + $_SESSION['Items'.$identifier]->LineItems[$OrderLine_2->LineNumber]->GPPercent = filter_number_format((($_SESSION['Items'.$identifier]->LineItems[$OrderLine_2->LineNumber]->Price*(1-$DiscountMatrixRate)) - $_SESSION['Items'.$identifier]->LineItems[$OrderLine_2->LineNumber]->StandardCost*$ExRate)/($_SESSION['Items'.$identifier]->LineItems[$OrderLine_2->LineNumber]->Price *(1-$DiscountMatrixRate)/100)); } } } @@ -1292,7 +1291,7 @@ FROM discountmatrix WHERE salestype='" . $_SESSION['Items'.$identifier]->DefaultSalesType . "' AND discountcategory ='" . $OrderLine->DiscCat . "' - AND quantitybreak <= '" . $QuantityOfDiscCat . "'",$db); + AND quantitybreak <= '" . filter_number_format($QuantityOfDiscCat) . "'",$db); $myrow = DB_fetch_row($result); if ($myrow[0] == NULL){ $DiscountMatrixRate = 0; @@ -1365,22 +1364,22 @@ 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=tect name="Quantity_' . $OrderLine->LineNumber . '" size=6 maxlength=6 value=' . $OrderLine->Quantity . '>'; + echo '<td><input class="number" tabindex=2 type=tect name="Quantity_' . $OrderLine->LineNumber . '" size=6 maxlength=6 value=' . locale_number_format($OrderLine->Quantity,$OrderLine->DecimalPlaces) . '>'; if ($QtyRemain != $QtyOrdered){ - echo '<br />'.$OrderLine->QtyInv.' of '.$OrderLine->Quantity.' invoiced'; + echo '<br />'.locale_number_format($OrderLine->QtyInv,$OrderLine->DecimalPlaces) .' of '.locale_number_format($OrderLine->Quantity,$OrderLine->DecimalPlaces).' invoiced'; } echo '</td> - <td class="number">' . $OrderLine->QOHatLoc . '</td> + <td class="number">' . locale_number_format($OrderLine->QOHatLoc,$OrderLine->DecimalPlaces) . '</td> <td>' . $OrderLine->Units . '</td>'; if (in_array(2,$_SESSION['AllowedPageSecurityTokens'])){ /*OK to display with discount if it is an internal user with appropriate permissions */ - 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><input class="number" type="text" name="Price_' . $OrderLine->LineNumber . '" size=16 maxlength=16 value=' . locale_money_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>'; } else { - echo '<td class=number>' . $OrderLine->Price . '</td><td></td>'; - echo '<input type=hidden name="Price_' . $OrderLine->LineNumber . '" value=' . $OrderLine->Price . '>'; + echo '<td class=number>' . locale_money_format($OrderLine->Price,$_SESSION['Items'.$identifier]->CurrDecimalPlaces) . '</td><td></td>'; + echo '<input type=hidden name="Price_' . $OrderLine->LineNumber . '" value=' . locale_money_format($OrderLine->Price,$_SESSION['Items'.$identifier]->CurrDecimalPlaces) . '>'; } if ($_SESSION['Items'.$identifier]->Some_Already_Delivered($OrderLine->LineNumber)){ $RemTxt = _('Clear Remaining'); Modified: trunk/StockAdjustments.php =================================================================== --- trunk/StockAdjustments.php 2011-09-17 07:49:08 UTC (rev 4693) +++ trunk/StockAdjustments.php 2011-09-17 22:43:30 UTC (rev 4694) @@ -36,12 +36,12 @@ $_SESSION['Adjustment']->Serialised = $myrow['serialised']; $_SESSION['Adjustment']->DecimalPlaces = $myrow['decimalplaces']; $_SESSION['Adjustment']->SerialItems = array(); - if (!isset($_SESSION['Adjustment']->Quantity)or !is_numeric($_SESSION['Adjustment']->Quantity)){ + if (!isset($_SESSION['Adjustment']->Quantity) OR !is_numeric($_SESSION['Adjustment']->Quantity)){ $_SESSION['Adjustment']->Quantity=0; } $NewAdjustment = true; } elseif (isset($_POST['StockID'])){ - if(isset($_POST['StockID']) and $_POST['StockID'] != $_SESSION['Adjustment']->StockID){ + if(isset($_POST['StockID']) AND $_POST['StockID'] != $_SESSION['Adjustment']->StockID){ $NewAdjustment = true; $_SESSION['Adjustment']->StockID = trim(mb_strtoupper($_POST['StockID'])); $StockID = trim(mb_strtoupper($_POST['StockID'])); @@ -49,10 +49,10 @@ $_SESSION['Adjustment']->tag = $_POST['tag']; $_SESSION['Adjustment']->Narrative = $_POST['Narrative']; $_SESSION['Adjustment']->StockLocation = $_POST['StockLocation']; - if ($_POST['Quantity']=='' or !is_numeric($_POST['Quantity'])){ + if ($_POST['Quantity']=='' or !is_numeric(filter_number_format($_POST['Quantity']))){ $_POST['Quantity']=0; } - $_SESSION['Adjustment']->Quantity = $_POST['Quantity']; + $_SESSION['Adjustment']->Quantity = filter_number_format($_POST['Quantity']); } echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/supplier.png" title="' . @@ -94,7 +94,7 @@ exit; } -if (isset($_POST['EnterAdjustment']) && $_POST['EnterAdjustment']!= ''){ +if (isset($_POST['EnterAdjustment']) AND $_POST['EnterAdjustment']!= ''){ $InputError = false; /*Start by hoping for the best */ $result = DB_query("SELECT * FROM stockmaster WHERE stockid='" . $_SESSION['Adjustment']->StockID . "'",$db); @@ -149,7 +149,7 @@ $QtyOnHandPrior = 0; } - $SQL = "INSERT INTO stockmoves ( stockid, + $SQL = "INSERT INTO stockmoves (stockid, type, transno, loccode, @@ -175,7 +175,6 @@ $DbgMsg = _('The following SQL to insert the stock movement record was used'); $Result = DB_query($SQL, $db, $ErrMsg, $DbgMsg, true); - /*Get the ID of the StockMove... */ $StkMoveNo = DB_Last_Insert_ID($db,'stockmoves','stkmoveno'); @@ -188,11 +187,10 @@ /*First need to check if the serial items already exists or not */ $SQL = "SELECT COUNT(*) - FROM stockserialitems - WHERE - stockid='" . $_SESSION['Adjustment']->StockID . "' - AND loccode='" . $_SESSION['Adjustment']->StockLocation . "' - AND serialno='" . $Item->BundleRef . "'"; + FROM stockserialitems + WHERE stockid='" . $_SESSION['Adjustment']->StockID . "' + AND loccode='" . $_SESSION['Adjustment']->StockLocation . "' + AND serialno='" . $Item->BundleRef . "'"; $ErrMsg = _('Unable to determine if the serial item exists'); $Result = DB_query($SQL,$db,$ErrMsg); $SerialItemExistsRow = DB_fetch_row($Result); @@ -200,10 +198,9 @@ if ($SerialItemExistsRow[0]==1){ $SQL = "UPDATE stockserialitems SET quantity= quantity + " . $Item->BundleQty . " - WHERE - stockid='" . $_SESSION['Adjustment']->StockID . "' - AND loccode='" . $_SESSION['Adjustment']->StockLocation . "' - AND serialno='" . $Item->BundleRef . "'"; + WHERE stockid='" . $_SESSION['Adjustment']->StockID . "' + AND loccode='" . $_SESSION['Adjustment']->StockLocation . "' + AND serialno='" . $Item->BundleRef . "'"; $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The serial stock item record could not be updated because'); $DbgMsg = _('The following SQL to update the serial stock item record was used'); @@ -308,7 +305,7 @@ $Result = DB_Txn_Commit($db); - $ConfirmationText = _('A stock adjustment for'). ' ' . $_SESSION['Adjustment']->StockID . ' - ' . $_SESSION['Adjustment']->ItemDescription . ' '._('has been created from location').' ' . $_SESSION['Adjustment']->StockLocation .' '. _('for a quantity of') . ' ' . $_SESSION['Adjustment']->Quantity ; + $ConfirmationText = _('A stock adjustment for'). ' ' . $_SESSION['Adjustment']->StockID . ' - ' . $_SESSION['Adjustment']->ItemDescription . ' '._('has been created from location').' ' . $_SESSION['Adjustment']->StockLocation .' '. _('for a quantity of') . ' ' . locale_number_format($_SESSION['Adjustment']->Quantity,$_SESSION['Adjustment']->DecimalPlaces) ; prnMsg( $ConfirmationText,'success'); if ($_SESSION['InventoryManagerEmail']!=''){ @@ -323,22 +320,24 @@ }/* end if the user hit enter the adjustment */ -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'] . '" />'; if (!isset($_SESSION['Adjustment'])) { $StockID=''; $Controlled= 0; $Quantity = 0; + $DecimalPlaces =2; } else { $StockID = $_SESSION['Adjustment']->StockID; $Controlled = $_SESSION['Adjustment']->Controlled; $Quantity = $_SESSION['Adjustment']->Quantity; - $sql="SELECT materialcost, labourcost, overheadcost, units FROM stockmaster WHERE stockid='".$StockID."'"; + $sql="SELECT materialcost, labourcost, overheadcost, units, decimalplaces FROM stockmaster WHERE stockid='".$StockID."'"; $result=DB_query($sql, $db); $myrow=DB_fetch_array($result); $_SESSION['Adjustment']->PartUnit=$myrow['units']; $_SESSION['Adjustment']->StandardCost=$myrow['materialcost']+$myrow['labourcost']+$myrow['overheadcost']; + $DecimalPlaces = $myrow['decimalplaces']; } echo '<br /><table class=selection>'; echo '<tr><th colspan=4><font color=blue size=3>'._('Adjustment Details').'</font></th></tr>'; @@ -359,10 +358,10 @@ echo '<input type="text" name="StockCode" size=21 value="" maxlength=20>'; } echo '</td><td><input type=submit name="CheckCode" VALUE="'._('Check Part').'"></td></tr>'; -if (isset($_SESSION['Adjustment']) and mb_strlen($_SESSION['Adjustment']->ItemDescription)>1){ +if (isset($_SESSION['Adjustment']) AND mb_strlen($_SESSION['Adjustment']->ItemDescription)>1){ echo '<tr><td colspan=3><font color=BLUE size=3>' . $_SESSION['Adjustment']->ItemDescription . ' ('._('In Units of').' ' . $_SESSION['Adjustment']->PartUnit . ' ) - ' . _('Unit Cost').' = ' . - locale_number_format($_SESSION['Adjustment']->StandardCost,4) . '</font></td></tr>'; + locale_money_format($_SESSION['Adjustment']->StandardCost,4) . '</font></td></tr>'; } echo '<tr><td>'. _('Adjustment to Stock At Location').':</td> @@ -373,25 +372,28 @@ while ($myrow=DB_fetch_array($resultStkLocs)){ if (isset($_SESSION['Adjustment']->StockLocation)){ if ($myrow['loccode'] == $_SESSION['Adjustment']->StockLocation){ - echo '<option selected Value="' . $myrow['loccode'] . '">' . $myrow['locationname']; + echo '<option selected value="' . $myrow['loccode'] . '">' . $myrow['locationname']; } else { - echo '<option Value="' . $myrow['loccode'] . '">' . $myrow['locationname']; + echo '<option value="' . $myrow['loccode'] . '">' . $myrow['locationname']; } } elseif ($myrow['loccode']==$_SESSION['UserStockLocation']){ - echo '<option selected Value="' . $myrow['loccode'] . '">' . $myrow['locationname']; + echo '<option selected value="' . $myrow['loccode'] . '">' . $myrow['locationname']; $_POST['StockLocation']=$myrow['loccode']; } else { - echo '<option Value="' . $myrow['loccode'] . '">' . $myrow['locationname']; + echo '<option value="' . $myrow['loccode'] . '">' . $myrow['locationname']; } } echo '</select></td></tr>'; -if (isset($_SESSION['Adjustment']) and !isset($_SESSION['Adjustment']->Narrative)) { +if (isset($_SESSION['Adjustment']) AND !isset($_SESSION['Adjustment']->Narrative)) { $_SESSION['Adjustment']->Narrative = ''; + $Narrative =''; +} else { + $Narrative =''; } echo '<tr><td>'. _('Comments On Why').':</td> - <td><input type="text" name="Narrative" size=32 maxlength=30 value="' . $_SESSION['Adjustment']->Narrative . '"></td></tr>'; + <td><input type="text" name="Narrative" size=32 maxlength=30 value="' . $Narrative . '"></td></tr>'; echo '<tr><td>'._('Adjustment Quantity').':</td>'; @@ -400,26 +402,26 @@ if ($_SESSION['Adjustment']->StockLocation == ''){ $_SESSION['Adjustment']->StockLocation = $_SESSION['UserStockLocation']; } - echo '<input type="HIDDEN" name="Quantity" Value="' . $_SESSION['Adjustment']->Quantity . '"> - '.$_SESSION['Adjustment']->Quantity.' - [<a href="'.$rootpath.'/StockAdjustmentsControlled.php?AdjType=REMOVE&' . SID . '">'._('Remove').'</a>] - [<a href="'.$rootpath.'/StockAdjustmentsControlled.php?AdjType=ADD&' . SID . '">'._('Add').'</a>]'; + echo '<input type="hidden" name="Quantity" value="' . $_SESSION['Adjustment']->Quantity . '"> + '.locale_number_format($_SESSION['Adjustment']->Quantity,$DecimalPlaces) .' + [<a href="'.$rootpath.'/StockAdjustmentsControlled.php?AdjType=REMOVE">'._('Remove').'</a>] + [<a href="'.$rootpath.'/StockAdjustmentsControlled.php?AdjType=ADD">'._('Add').'</a>]'; } else { - echo '<input type="text" class="number" name="Quantity" size=12 maxlength=12 Value="' . $Quantity . '">'; + echo '<input type="text" class="number" name="Quantity" size="12" maxlength="12" value="' . locale_number_format($Quantity,$DecimalPlaces) . '">'; } echo '</td></tr>'; //Select the tag echo '<tr><td>'._('Select Tag').'</td><td><select name="tag">'; -$SQL = 'SELECT tagref, +$SQL = "SELECT tagref, tagdescription FROM tags - ORDER BY tagref'; + ORDER BY tagref"; $result=DB_query($SQL,$db); -echo '<option value=0>0 - None'; +echo '<option value=0>0 - ' . _('None') . '</option>'; while ($myrow=DB_fetch_array($result)){ - if (isset($_SESSION['Adjustment']->tag) and $_SESSION['Adjustment']->tag==$myrow['tagref']){ + if (isset($_SESSION['Adjustment']->tag) AND $_SESSION['Adjustment']->tag==$myrow['tagref']){ echo '<option selected value=' . $myrow['tagref'] . '>' . $myrow['tagref'].' - ' .$myrow['tagdescription'] . '</option>'; } else { echo '<option value=' . $myrow['tagref'] . '>' . $myrow['tagref'].' - ' .$myrow['tagdescription']. '</option>'; @@ -428,7 +430,7 @@ echo '</select></td>'; // End select tag -echo '</table><div class="centre"><br /><input type=submit name="EnterAdjustment" value="'. _('Enter Stock Adjustment'). '"><br />'; +echo '</table><div class="centre"><br /><input type="submit" name="EnterAdjustment" value="'. _('Enter Stock Adjustment'). '"><br />'; if (!isset($_POST['StockLocation'])) { $_POST['StockLocation']=''; Modified: trunk/UpgradeDatabase.php =================================================================== --- trunk/UpgradeDatabase.php 2011-09-17 07:49:08 UTC (rev 4693) +++ trunk/UpgradeDatabase.php 2011-09-17 22:43:30 UTC (rev 4694) @@ -112,6 +112,7 @@ $SQLScripts[] = './sql/mysql/upgrade4.04.5-4.05.sql'; case '4.05': case '4.05.1': + case '4.05.2': $SQLScripts[] = './sql/mysql/upgrade4.05-4.06.sql'; case '4.06': break; Modified: trunk/WWW_Users.php =================================================================== --- trunk/WWW_Users.php 2011-09-17 07:49:08 UTC (rev 4693) +++ trunk/WWW_Users.php 2011-09-17 22:43:30 UTC (rev 4694) @@ -133,13 +133,13 @@ $UpdatePassword = "password='" . CryptPass($_POST['Password']) . "',"; } - $sql = "UPDATE www_users SET realname='" . $_POST['RealName'] . "', - customerid='" . $_POST['Cust'] ."', - phone='" . $_POST['Phone'] ."', - email='" . $_POST['Email'] ."', + $sql = "UPDATE www_users SET realname='" . DB_escape_string($_POST['RealName']) . "', + customerid='" . DB_escape_string($_POST['Cust']) ."', + phone='" . DB_escape_string($_POST['Phone']) ."', + email='" . DB_escape_string($_POST['Email'] ."', " . $UpdatePassword . " - branchcode='" . $_POST['BranchCode'] . "', - supplierid='" . $_POST['SupplierID'] . "', + branchcode='" . DB_escape_string($_POST['BranchCode']) . "', + supplierid='" . DB_escape_string($_POST['SupplierID']) . "', salesman='" . $_POST['Salesman'] . "', pagesize='" . $_POST['PageSize'] . "', fullaccess='" . $_POST['Access'] . "', @@ -171,15 +171,15 @@ theme, language, pdflanguage) - VALUES ('" . $_POST['UserID'] . "', - '" . $_POST['RealName'] ."', - '" . $_POST['Cust'] ."', - '" . $_POST['BranchCode'] ."', - '" . $_POST['SupplierID'] ."', + VALUES ('" . DB_escape_string($_POST['UserID']) . "', + '" . DB_escape_string($_POST['RealName']) ."', + '" . DB_escape_string($_POST['Cust']) ."', + '" . DB_escape_string($_POST['BranchCode']) ."', + '" . DB_escape_string($_POST['SupplierID']) ."', '" . $_POST['Salesman'] . "', '" . CryptPass($_POST['Password']) ."', - '" . $_POST['Phone'] . "', - '" . $_POST['Email'] ."', + '" . DB_escape_string($_POST['Phone']) . "', + '" . DB_escape_string($_POST['Email']) ."', '" . $_POST['PageSize'] ."', '" . $_POST['Access'] . "', '" . $_POST['DefaultLocation'] ."', Modified: trunk/doc/Change.log =================================================================== --- trunk/doc/Change.log 2011-09-17 07:49:08 UTC (rev 4693) +++ trunk/doc/Change.log 2011-09-17 22:43:30 UTC (rev 4694) @@ -1,5 +1,6 @@ webERP Change Log +17/9/11 Phil: Added WindowsLocale element to LanguagesArray.php and modified UserSettings.php and WWW_Users.php to use the new array definition. Also modified includes/LanguageSetup.php to use the windows locale string in the LanguagesArray as required for proper setting of the locale under windows. 17/9/11 Felix Lim: added serialised field into PrintCustTransPortrait.php to reinstate possiblity for printing serialised items on invoice - not possible in landscape version (PrintCustTrans.php) 12/9/11 Phil/Exson/Tom: Change all scripts to allow display and input of numbers in the format of the selected users locale 5/9/11 Phil: Fixed supplier payment exchange rate ... was being calculated incorrectly from functional exchange rate and the exchange rate between the currency of the bank account and currency of payment. Modified: trunk/includes/Add_SerialItems.php =================================================================== --- trunk/includes/Add_SerialItems.php 2011-09-17 07:49:08 UTC (rev 4693) +++ trunk/includes/Add_SerialItems.php 2011-09-17 22:43:30 UTC (rev 4694) @@ -56,17 +56,21 @@ if ($LineItem->Serialised){ $ExistingQty = ValidBundleRef($StockID, $LocationOut, $NewSerialNo); - if ($NewQty == 1 && $ExistingQty != 0){ + if ($NewQty == 1 AND $ExistingQty != 0){ prnMsg( '<a href="'.$rootpath.'/StockSerialItemResearch.php?serialno='. $NewSerialNo . '" target=_blank>'.$NewSerialNo. '</a> : '. _('The Serial Number being added exists with a Quantity that is not Zero (0)!'), 'error' ); $SerialError = true; - } elseif ($NewQty == -1 && $ExistingQty != 1){ + } elseif ($NewQty == -1 AND $ExistingQty != 1){ prnMsg( '<a href="'.$rootpath.'/StockSerialItemResearch.php?serialno='. $NewSerialNo . '" target=_blank>'.$NewSerialNo. '</a> : '. _('The Serial Number being removed exists with a Quantity that is not One (1)!'), 'error'); $SerialError = true; } } - + if (isset($_POST['ExpiryDate' . $i])){ + $ExpiryDate = $_POST['ExpiryDate' . $i]; + } else { + $ExpiryDate ='0000-00-00'; + } if (!$SerialError){ - $LineItem->SerialItems[$NewSerialNo] = new SerialItem ($_POST['SerialNo' . $i], $NewQty, $_POST['ExpiryDate' . $i]); + $LineItem->SerialItems[$NewSerialNo] = new SerialItem ($_POST['SerialNo' . $i], $NewQty, $ExpiryDate); } } } /* end if posted Serialno . i is not blank */ @@ -92,7 +96,7 @@ /******************************************** Add a Sequence of Items and save entries ********************************************/ -if ( isset($_POST['AddSequence']) && $_POST['AddSequence']!='') { +if ( isset($_POST['AddSequence']) AND $_POST['AddSequence']!='') { // do some quick validation $BeginNo = $_POST['BeginNo']; $EndNo = $_POST['EndNo']; @@ -151,7 +155,7 @@ } } else { //for controlled only items, we must receive: BatchID, Qty in a comma delimited file - if($pieces[0] != "" && $pieces[1] != "" && is_numeric($pieces[1]) && $pieces[1] > 0 ){ + if($pieces[0] != "" AND $pieces[1] != "" AND is_numeric($pieces[1]) AND $pieces[1] > 0 ){ /*If the user enters a duplicate batch number the later one over-writes the first entered one - no warning given though ? */ //$LineItem->SerialItems[$pieces[0]] = new SerialItem ($pieces[0], $pieces[1] ); @@ -198,10 +202,10 @@ $SerialError = false; if ($LineItem->Serialised){ $ExistingQty = ValidBundleRef($StockID, $LocationOut, $NewSerialNo); - if ($NewQty == 1 && $ExistingQty != 0){ + if ($NewQty == 1 AND $ExistingQty != 0){ prnMsg( '<a href="'.$rootpath.'/StockSerialItemResearch.php?serialno='. $NewSerialNo . '" target=_blank>'.$NewSerialNo. '</a>: '. _("The Serial Number being added exists with a Quantity that is not Zero (0)!"), 'error' ); $SerialError = true; - } elseif ($NewQty == -1 && $ExistingQty != 1){ + } elseif ($NewQty == -1 AND $ExistingQty != 1){ prnMsg( '<a href="'.$rootpath.'/StockSerialItemResearch.php?serialno='. $NewSerialNo . '" target=_blank>'.$NewSerialNo. '</a> : '. _("The Serial Number being removed exists with a Quantity that is not One (1)!"), 'error'); $SerialError = true; } @@ -248,7 +252,7 @@ } } else { //for controlled only items, we must receive: BatchID, Qty in a comma delimited file - if($Item->BundleRef != "" && $Item->BundleQty != "" && is_numeric($Item->BundleQty) && $Item->BundleQty > 0 ){ + if($Item->BundleRef != "" AND $Item->BundleQty != "" AND is_numeric($Item->BundleQty) AND $Item->BundleQty > 0 ){ /*If the user enters a duplicate batch number the later one over-writes the first entered one - no warning given though ? */ //$LineItem->SerialItems[$pieces[0]] = new SerialItem ($pieces[0], $pieces[1] ); @@ -295,10 +299,10 @@ $SerialError = false; if ($LineItem->Serialised){ $ExistingQty = ValidBundleRef($StockID, $LocationOut, $NewSerialNo); - if ($NewQty == 1 && $ExistingQty != 0){ + if ($NewQty == 1 AND $ExistingQty != 0){ prnMsg( '<a href="'.$rootpath.'/StockSerialItemResearch.php?serialno='. $NewSerialNo . '" target=_blank>'.$NewSerialNo. '</a>: '. _("The Serial Number being added exists with a Quantity that is not Zero (0)!"), 'error' ); $SerialError = true; - } elseif ($NewQty == -1 && $ExistingQty != 1){ + } elseif ($NewQty == -1 AND $ExistingQty != 1){ prnMsg( '<a href="'.$rootpath.'/StockSerialItemResearch.php?serialno='. $NewSerialNo . '" target=_blank>'.$NewSerialNo. '</a> : '. _("The Serial Number being removed exists with a Quantity that is not One (1)!"), 'error'); $SerialError = true; } Modified: trunk/includes/ConnectDB.inc =================================================================== --- trunk/includes/ConnectDB.inc 2011-09-17 07:49:08 UTC (rev 4693) +++ trunk/includes/ConnectDB.inc 2011-09-17 22:43:30 UTC (rev 4694) @@ -4,7 +4,7 @@ * this value is saved in the $_SESSION['Versionumber'] when includes/GetConfig.php is run * if VersionNumber is < $Version then the DB update script is run */ -$Version='4.05.1'; //must update manually every time there is a DB change +$Version='4.05.2'; //must update manually every time there is a DB change require_once ($PathPrefix .'includes/MiscFunctions.php'); Modified: trunk/includes/InputSerialItems.php =================================================================== --- trunk/includes/InputSerialItems.php 2011-09-17 07:49:08 UTC (rev 4693) +++ trunk/includes/InputSerialItems.php 2011-09-17 22:43:30 UTC (rev 4694) @@ -48,7 +48,7 @@ $invalid_imports = 0; $valid = true; -echo '<form method="post" action="' . $_SERVER['PHP_SELF'] . '?identifier=' . $identifier .'" enctype="multipart/form-data" >'; +echo '<form method="post" action="' . $_SERVER['PHP_SELF'] .'" enctype="multipart/form-data" >'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; echo '<input type=hidden name="LineNo" value="' . $LineNo . '">'; echo '<input type=hidden name="StockID" value="'. $StockID. '">'; @@ -84,9 +84,9 @@ global $tableheader; /* Link to clear the list and start from scratch */ -$EditLink = '<br /><div class="centre"><a href="' . $_SERVER['PHP_SELF'] . '?identifier=' . $identifier . '&EditControlled=true&StockID=' . $LineItem->StockID . +$EditLink = '<br /><div class="centre"><a href="' . $_SERVER['PHP_SELF'] . '?EditControlled=true&StockID=' . $LineItem->StockID . '&LineNo=' . $LineNo .'">'. _('Edit'). '</a> | '; -$RemoveLink = '<a href="' . $_SERVER['PHP_SELF'] . '?identifier=' . $identifier . '&DELETEALL=YES&StockID=' . $LineItem->StockID . +$RemoveLink = '<a href="' . $_SERVER['PHP_SELF'] . '?DELETEALL=YES&StockID=' . $LineItem->StockID . '&LineNo=' . $LineNo .'">'. _('Remove All'). '</a><br /></div>'; $sql="SELECT perishable FROM stockmaster Modified: trunk/includes/InputSerialItemsKeyed.php =================================================================== --- trunk/includes/InputSerialItemsKeyed.php 2011-09-17 07:49:08 UTC (rev 4693) +++ trunk/includes/InputSerialItemsKeyed.php 2011-09-17 22:43:30 UTC (rev 4694) @@ -50,13 +50,13 @@ echo '<td>' . $Bundle->BundleRef . '</td>'; if ($LineItem->Serialised==0 and $Perishable==0){ - echo '<td class=number>' . locale_number_format($Bundle->BundleQty, $LineItem->DecimalPlaces) . '</td>'; + echo '<td class="number">' . locale_number_format($Bundle->BundleQty, $LineItem->DecimalPlaces) . '</td>'; } else if ($LineItem->Serialised==0 and $Perishable==1){ - echo '<td class=number>' . locale_number_format($Bundle->BundleQty, $LineItem->DecimalPlaces) . '</td>'; - echo '<td class=number>' . $Bundle->ExpiryDate . '</td>'; + echo '<td class="number">' . locale_number_format($Bundle->BundleQty, $LineItem->DecimalPlaces) . '</td>'; + echo '<td class="number">' . $Bundle->ExpiryDate . '</td>'; } - echo '<td><a href="' . $_SERVER['PHP_SELF'] . '?identifier=' . $identifier . '&Delete=' . $Bundle->BundleRef . '&StockID=' . $LineItem->StockID . '&LineNo=' . $LineNo .'">'. _('Delete'). '</a></td></tr>'; + echo '<td><a href="' . $_SERVER['PHP_SELF'] . '?Delete=' . $Bundle->BundleRef . '&StockID=' . $LineItem->StockID . '&LineNo=' . $LineNo .'">'. _('Delete'). '</a></td></tr>'; $TotalQuantity += $Bundle->BundleQty; } @@ -64,27 +64,26 @@ /*Display the totals and rule off before allowing new entries */ if ($LineItem->Serialised==1){ - echo '<tr><td class=number><B>'. _('Total Quantity'). ': ' . locale_number_format($TotalQuantity,$LineItem->DecimalPlaces) . '</b></td></tr>'; + echo '<tr><td class="number"><B>'. _('Total Quantity'). ': ' . locale_number_format($TotalQuantity,$LineItem->DecimalPlaces) . '</b></td></tr>'; } else { - echo '<tr><td class=number><B>'. _('Total Quantity'). ':</b></td><td class=number><b>' . locale_number_format($TotalQuantity,$LineItem->DecimalPlaces) . '</b></td></tr>'; + echo '<tr><td class="number"><B>'. _('Total Quantity'). ':</b></td><td class="number"><b>' . locale_number_format($TotalQuantity,$LineItem->DecimalPlaces) . '</b></td></tr>'; } /*Close off old table */ -echo '</table></td><td valign=top>'; +echo '</table></td><td valign="top">'; /*Start a new table for the Serial/Batch ref input in one column (as a sub table then the multi select box for selection of existing bundle/serial nos for dispatch if applicable*/ //echo '<TABLE><TR><TD valign=TOP>'; /*in the first column add a table for the input of newies */ -echo '<table class=selection>'; +echo '<table class="selection">'; echo $tableheader; echo '<form action="' . $_SERVER['PHP_SELF'] . '" name="Ga6uF5Wa" method="post"> <input type=hidden name="LineNo" value="' . $LineNo . '"> <input type=hidden name="StockID" value="' . $StockID . '"> - <input type=hidden name="identifier" value="' . $identifier . '"> <input type=hidden name="EntryType" value="KEYED">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; if ( isset($_GET['EditControlled']) ) { Modified: trunk/includes/LanguageSetup.php =================================================================== --- trunk/includes/LanguageSetup.php 2011-09-17 07:49:08 UTC (rev 4693) +++ trunk/includes/LanguageSetup.php 2011-09-17 22:43:30 UTC (rev 4694) @@ -30,7 +30,7 @@ } else { // it's a windows server $Locale = setlocale (LC_ALL, $LanguageArray[$_SESSION['Language']]['WindowsLocale']); } -//$Locale = setlocale (LC_NUMERIC, 'fr_FR.utf8'); +$Locale = setlocale (LC_NUMERIC, 'fr_FR.utf8'); $LocaleInfo = localeconv(); if ($LocaleInfo['mon_decimal_point']==''){ Modified: trunk/sql/mysql/upgrade4.05-4.06.sql =================================================================== --- trunk/sql/mysql/upgrade4.05-4.06.sql 2011-09-17 07:49:08 UTC (rev 4693) +++ trunk/sql/mysql/upgrade4.05-4.06.sql 2011-09-17 22:43:30 UTC (rev 4694) @@ -1,5 +1,5 @@ ALTER TABLE stockmaster DROP lastcurcostdate; ALTER TABLE stockmaster ADD lastcostupdate DATE NOT NULL; INSERT INTO `config` (`confname` ,`confvalue`) -VALUES ('InventoryManagerEmail', 'in...@yo...'); -UPDATE config SET confvalue='4.05.1' WHERE confname='VersionNumber'; \ No newline at end of file +VALUES ('InventoryManagerEmail', ''); +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-17 22:43:38
|
Revision: 4694 http://web-erp.svn.sourceforge.net/web-erp/?rev=4694&view=rev Author: daintree Date: 2011-09-17 22:43:30 +0000 (Sat, 17 Sep 2011) Log Message: ----------- number_formats Modified Paths: -------------- trunk/ConfirmDispatch_Invoice.php trunk/PrintCustTrans.php trunk/PrintCustTransPortrait.php trunk/SelectOrderItems.php trunk/StockAdjustments.php trunk/UpgradeDatabase.php trunk/WWW_Users.php trunk/doc/Change.log trunk/includes/Add_SerialItems.php trunk/includes/ConnectDB.inc trunk/includes/InputSerialItems.php trunk/includes/InputSerialItemsKeyed.php trunk/includes/LanguageSetup.php trunk/sql/mysql/upgrade4.05-4.06.sql Modified: trunk/ConfirmDispatch_Invoice.php =================================================================== --- trunk/ConfirmDispatch_Invoice.php 2011-09-17 07:49:08 UTC (rev 4693) +++ trunk/ConfirmDispatch_Invoice.php 2011-09-17 22:43:30 UTC (rev 4694) @@ -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($_POST['FreightTaxRate' . $FreightTaxLine->TaxCalculationOrder]/100); + $_SESSION['Items']->FreightTaxes[$FreightTaxLine->TaxCalculationOrder]->TaxRate = filter_number_format(filter_number_format($_POST['FreightTaxRate' . $FreightTaxLine->TaxCalculationOrder])/100); } } @@ -227,7 +227,7 @@ } 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($_POST[$Itm->LineNumber . $TaxLine->TaxCalculationOrder . '_TaxRate']/100); + $_SESSION['Items']->LineItems[$Itm->LineNumber]->Taxes[$TaxLine->TaxCalculationOrder]->TaxRate = filter_number_format(filter_number_format($_POST[$Itm->LineNumber . $TaxLine->TaxCalculationOrder . '_TaxRate'])/100); } } } //end foreach lineitem @@ -311,15 +311,15 @@ if ($LnItm->Controlled==1){ if (isset($_POST['ProcessInvoice'])) { - echo '<td class="number">' . $LnItm->QtyDispatched . '</td>'; + echo '<td class="number">' . locale_number_format($LnItm->QtyDispatched,$LnItm->DecimalPlaces) . '</td>'; } else { - echo '<td class="number"><input type=hidden name="' . $LnItm->LineNumber . '_QtyDispatched" value="' . $LnItm->QtyDispatched . '"><a href="' . $rootpath .'/ConfirmDispatchControlled_Invoice.php?LineNo='. $LnItm->LineNumber.'">' .$LnItm->QtyDispatched . '</a></td>'; + echo '<td class="number"><input type=hidden name="' . $LnItm->LineNumber . '_QtyDispatched" value="' . $LnItm->QtyDispatched . '"><a href="' . $rootpath .'/ConfirmDispatchControlled_Invoice.php?LineNo='. $LnItm->LineNumber.'">' .locale_number_format($LnItm->QtyDispatched,$LnItm->DecimalPlaces) . '</a></td>'; } } else { if (isset($_POST['ProcessInvoice'])) { - echo '<td class="number">' . $LnItm->QtyDispatched . '</td>'; + echo '<td class="number">' . locale_number_format($LnItm->QtyDispatched,$LnItm->DecimalPlaces) . '</td>'; } else { - echo '<td class="number"><input tabindex="'.$j.'" type="text" class="number" name="' . $LnItm->LineNumber . '_QtyDispatched" maxlength=12 size=12 value="' . $LnItm->QtyDispatched . '"></td>'; + echo '<td class="number"><input tabindex="'.$j.'" type="text" class="number" name="' . $LnItm->LineNumber . '_QtyDispatched" maxlength="12" size="12" value="' . locale_number_format($LnItm->QtyDispatched,$LnItm->DecimalPlaces) . '"></td>'; } } $DisplayDiscountPercent = locale_number_format($LnItm->DiscountPercent*100,2) . '%'; @@ -458,15 +458,15 @@ $_POST['ChargeFreightCost']=0; } if ($_SESSION['Items']->Any_Already_Delivered()==1 and (!isset($_SESSION['Items']->FreightCost) or $_POST['ChargeFreightCost']==0)) { - echo '<td colspan=2 class=number>'. _('Charge Freight Cost inc Tax').'</td> + echo '<td colspan="2" class="number">'. _('Charge Freight Cost inc Tax').'</td> <td><input tabindex='.$j.' type="text" class="number" size="10" maxlength="12" name="ChargeFreightCost" value="0"></td>'; $_SESSION['Items']->FreightCost=0; } else { - echo '<td colspan=2 class=number>'. _('Charge Freight Cost inc Tax').'</td>'; + echo '<td colspan="2" class="number">'. _('Charge Freight Cost inc Tax').'</td>'; if (isset($_POST['ProcessInvoice'])) { echo '<td class="number">' . $_SESSION['Items']->FreightCost . '</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="' . $_SESSION['Items']->FreightCost . '" /></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="' . $FreightTaxLine->TaxRate * 100 . '" />'; } if ($FreightTaxLine->TaxOnTax ==1){ @@ -587,7 +587,7 @@ /*Now look for assembly components that would go negative */ $SQL = "SELECT bom.component, stockmaster.description, - locstock.quantity-(" . filter_number_format($OrderLine->QtyDispatched) . "*bom.quantity) AS qtyleft + locstock.quantity-(" . $OrderLine->QtyDispatched . "*bom.quantity) AS qtyleft FROM bom INNER JOIN locstock ON bom.component=locstock.stockid @@ -612,7 +612,7 @@ if ($NegativesFound){ echo '<div class="centre"> - <input type="submit" name="Update" value="' . _('Update'). '"></div>'; + <input type="submit" name="Update" value="' . _('Update'). '" /></div>'; include('includes/footer.inc'); exit; } @@ -679,7 +679,8 @@ while ($myrow = DB_fetch_array($Result)) { - if ($_SESSION['Items']->LineItems[$myrow['orderlineno']]->Quantity != $myrow['quantity'] OR $_SESSION['Items']->LineItems[$myrow['orderlineno']]->QtyInv != $myrow['qtyinvoiced']) { + if ($_SESSION['Items']->LineItems[$myrow['orderlineno']]->Quantity != $myrow['quantity'] + OR $_SESSION['Items']->LineItems[$myrow['orderlineno']]->QtyInv != $myrow['qtyinvoiced']) { echo '<br />'. _('Orig order for'). ' ' . $myrow['orderlineno'] . ' '. _('has a quantity of'). ' ' . $myrow['quantity'] . ' '. _('and an invoiced qty of'). ' ' . $myrow['qtyinvoiced'] . ' '. _('the session shows quantity of'). ' ' . $_SESSION['Items']->LineItems[$myrow['orderlineno']]->Quantity . ' ' . _('and quantity invoice of'). ' ' . $_SESSION['Items']->LineItems[$myrow['orderlineno']]->QtyInv; Modified: trunk/PrintCustTrans.php =================================================================== --- trunk/PrintCustTrans.php 2011-09-17 07:49:08 UTC (rev 4693) +++ trunk/PrintCustTrans.php 2011-09-17 22:43:30 UTC (rev 4694) @@ -281,8 +281,8 @@ $DisplayDiscount = locale_number_format($myrow2['discountpercent']*100,2) . '%'; $DiscountPrice=$myrow2['fxprice']*(1-$myrow2['discountpercent']); } - $DisplayNet=locale_number_format($myrow2['fxnet'],$myrow['decimalplaces']); - $DisplayPrice=locale_number_format($myrow2['fxprice'],$myrow['decimalplaces']); + $DisplayNet=locale_money_format($myrow2['fxnet'],$myrow['decimalplaces']); + $DisplayPrice=locale_money_format($myrow2['fxprice'],$myrow['decimalplaces']); $DisplayQty=locale_number_format($myrow2['quantity'],$myrow2['decimalplaces']); $LeftOvers = $pdf->addTextWrap($Left_Margin+3,$YPos,95,$FontSize,$myrow2['stockid']); @@ -355,17 +355,17 @@ if ($InvOrCredit=='Invoice') { - $DisplaySubTot = locale_number_format($myrow['ovamount'],$myrow['decimalplaces']); - $DisplayFreight = locale_number_format($myrow['ovfreight'],$myrow['decimalplaces']); - $DisplayTax = locale_number_format($myrow['ovgst'],$myrow['decimalplaces']); - $DisplayTotal = locale_number_format($myrow['ovfreight']+$myrow['ovgst']+$myrow['ovamount'],$myrow['decimalplaces']); + $DisplaySubTot = locale_money_format($myrow['ovamount'],$myrow['decimalplaces']); + $DisplayFreight = locale_money_format($myrow['ovfreight'],$myrow['decimalplaces']); + $DisplayTax = locale_money_format($myrow['ovgst'],$myrow['decimalplaces']); + $DisplayTotal = locale_money_format($myrow['ovfreight']+$myrow['ovgst']+$myrow['ovamount'],$myrow['decimalplaces']); } else { - $DisplaySubTot = locale_number_format(-$myrow['ovamount'],$myrow['decimalplaces']); - $DisplayFreight = locale_number_format(-$myrow['ovfreight'],$myrow['decimalplaces']); - $DisplayTax = locale_number_format(-$myrow['ovgst'],$myrow['decimalplaces']); - $DisplayTotal = locale_number_format(-$myrow['ovfreight']-$myrow['ovgst']-$myrow['ovamount'],$myrow['decimalplaces']); + $DisplaySubTot = locale_money_format(-$myrow['ovamount'],$myrow['decimalplaces']); + $DisplayFreight = locale_money_format(-$myrow['ovfreight'],$myrow['decimalplaces']); + $DisplayTax = locale_money_format(-$myrow['ovgst'],$myrow['decimalplaces']); + $DisplayTotal = locale_money_format(-$myrow['ovfreight']-$myrow['ovgst']-$myrow['ovamount'],$myrow['decimalplaces']); } /* Print out the invoice text entered */ $YPos = $Bottom_Margin+(3*$line_height); @@ -865,9 +865,9 @@ echo $RowStarter; - $DisplayPrice = locale_number_format($myrow2['fxprice'],$myrow['decimalplaces']); + $DisplayPrice = locale_money_format($myrow2['fxprice'],$myrow['decimalplaces']); $DisplayQty = locale_number_format($myrow2['quantity'],$myrow2['decimalplaces']); - $DisplayNet = locale_number_format($myrow2['fxnet'],$myrow['decimalplaces']); + $DisplayNet = locale_money_format($myrow2['fxnet'],$myrow['decimalplaces']); if ($myrow2['discountpercent']==0){ $DisplayDiscount =''; @@ -1005,15 +1005,15 @@ if ($InvOrCredit=='Invoice') { - $DisplaySubTot = locale_number_format($myrow['ovamount'],$myrow['decimalplaces']); - $DisplayFreight = locale_number_format($myrow['ovfreight'],$myrow['decimalplaces']); - $DisplayTax = locale_number_format($myrow['ovgst'],$myrow['decimalplaces']); - $DisplayTotal = locale_number_format($myrow['ovfreight']+$myrow['ovgst']+$myrow['ovamount'],$myrow['decimalplaces']); + $DisplaySubTot = locale_money_format($myrow['ovamount'],$myrow['decimalplaces']); + $DisplayFreight = locale_money_format($myrow['ovfreight'],$myrow['decimalplaces']); + $DisplayTax = locale_money_format($myrow['ovgst'],$myrow['decimalplaces']); + $DisplayTotal = locale_money_format($myrow['ovfreight']+$myrow['ovgst']+$myrow['ovamount'],$myrow['decimalplaces']); } else { - $DisplaySubTot = locale_number_format(-$myrow['ovamount'],$myrow['decimalplaces']); - $DisplayFreight = locale_number_format(-$myrow['ovfreight'],$myrow['decimalplaces']); - $DisplayTax = locale_number_format(-$myrow['ovgst'],$myrow['decimalplaces']); - $DisplayTotal = locale_number_format(-$myrow['ovfreight']-$myrow['ovgst']-$myrow['ovamount'],$myrow['decimalplaces']); + $DisplaySubTot = locale_money_format(-$myrow['ovamount'],$myrow['decimalplaces']); + $DisplayFreight = locale_money_format(-$myrow['ovfreight'],$myrow['decimalplaces']); + $DisplayTax = locale_money_format(-$myrow['ovgst'],$myrow['decimalplaces']); + $DisplayTotal = locale_money_format(-$myrow['ovfreight']-$myrow['ovgst']-$myrow['ovamount'],$myrow['decimalplaces']); } /*Print out the invoice text entered */ Modified: trunk/PrintCustTransPortrait.php =================================================================== --- trunk/PrintCustTransPortrait.php 2011-09-17 07:49:08 UTC (rev 4693) +++ trunk/PrintCustTransPortrait.php 2011-09-17 22:43:30 UTC (rev 4694) @@ -311,8 +311,8 @@ $DisplayDiscount = locale_number_format($myrow2['discountpercent'] * 100, 2) . '%'; $DiscountPrice = $myrow2['fxprice'] * (1 - $myrow2['discountpercent']); } - $DisplayNet = locale_number_format($myrow2['fxnet'],$myrow['decimalplaces']); - $DisplayPrice = locale_number_format($myrow2['fxprice'],$myrow['decimalplaces']); + $DisplayNet = locale_money_format($myrow2['fxnet'],$myrow['decimalplaces']); + $DisplayPrice = locale_money_format($myrow2['fxprice'],$myrow['decimalplaces']); $DisplayQty = locale_number_format($myrow2['quantity'],$myrow2['decimalplaces']); $LeftOvers = $pdf->addTextWrap($Left_Margin+5,$YPos,71,$FontSize,$myrow2['stockid']); @@ -424,15 +424,15 @@ if ($InvOrCredit=='Invoice') { - $DisplaySubTot = locale_number_format($myrow['ovamount'],$myrow['decimalplaces']); - $DisplayFreight = locale_number_format($myrow['ovfreight'],$myrow['decimalplaces']); - $DisplayTax = locale_number_format($myrow['ovgst'],$myrow['decimalplaces']); - $DisplayTotal = locale_number_format($myrow['ovfreight']+$myrow['ovgst']+$myrow['ovamount'],$myrow['decimalplaces']); + $DisplaySubTot = locale_money_format($myrow['ovamount'],$myrow['decimalplaces']); + $DisplayFreight = locale_money_format($myrow['ovfreight'],$myrow['decimalplaces']); + $DisplayTax = locale_money_format($myrow['ovgst'],$myrow['decimalplaces']); + $DisplayTotal = locale_money_format($myrow['ovfreight']+$myrow['ovgst']+$myrow['ovamount'],$myrow['decimalplaces']); } else { - $DisplaySubTot = locale_number_format(-$myrow['ovamount'],$myrow['decimalplaces']); - $DisplayFreight = locale_number_format(-$myrow['ovfreight'],$myrow['decimalplaces']); - $DisplayTax = locale_number_format(-$myrow['ovgst'],$myrow['decimalplaces']); - $DisplayTotal = locale_number_format(-$myrow['ovfreight']-$myrow['ovgst']-$myrow['ovamount'],$myrow['decimalplaces']); + $DisplaySubTot = locale_money_format(-$myrow['ovamount'],$myrow['decimalplaces']); + $DisplayFreight = locale_money_format(-$myrow['ovfreight'],$myrow['decimalplaces']); + $DisplayTax = locale_money_format(-$myrow['ovgst'],$myrow['decimalplaces']); + $DisplayTotal = locale_money_format(-$myrow['ovfreight']-$myrow['ovgst']-$myrow['ovamount'],$myrow['decimalplaces']); } /*Print out the invoice text entered */ $YPos = $Bottom_Margin+(3*$line_height); @@ -891,9 +891,9 @@ echo $RowStarter; - $DisplayPrice =locale_number_format($myrow2['fxprice'],$myrow['decimalplaces']); + $DisplayPrice =locale_money_format($myrow2['fxprice'],$myrow['decimalplaces']); $DisplayQty = locale_number_format($myrow2['quantity'],$myrow2['decimalplaces']); - $DisplayNet = locale_number_format($myrow2['fxnet'],$myrow['decimalplaces']); + $DisplayNet = locale_money_format($myrow2['fxnet'],$myrow['decimalplaces']); if ($myrow2['discountpercent']==0){ $DisplayDiscount =''; @@ -1029,15 +1029,15 @@ if ($InvOrCredit=='Invoice') { - $DisplaySubTot = locale_number_format($myrow['ovamount'],$myrow['decimalplaces']); - $DisplayFreight = locale_number_format($myrow['ovfreight'],$myrow['decimalplaces']); - $DisplayTax = locale_number_format($myrow['ovgst'],$myrow['decimalplaces']); - $DisplayTotal = locale_number_format($myrow['ovfreight']+$myrow['ovgst']+$myrow['ovamount'],$myrow['decimalplaces']); + $DisplaySubTot = locale_money_format($myrow['ovamount'],$myrow['decimalplaces']); + $DisplayFreight = locale_money_format($myrow['ovfreight'],$myrow['decimalplaces']); + $DisplayTax = locale_money_format($myrow['ovgst'],$myrow['decimalplaces']); + $DisplayTotal = locale_money_format($myrow['ovfreight']+$myrow['ovgst']+$myrow['ovamount'],$myrow['decimalplaces']); } else { - $DisplaySubTot = locale_number_format(-$myrow['ovamount'],$myrow['decimalplaces']); - $DisplayFreight = locale_number_format(-$myrow['ovfreight'],$myrow['decimalplaces']); - $DisplayTax = locale_number_format(-$myrow['ovgst'],2); - $DisplayTotal = locale_number_format(-$myrow['ovfreight']-$myrow['ovgst']-$myrow['ovamount'],$myrow['decimalplaces']); + $DisplaySubTot = locale_money_format(-$myrow['ovamount'],$myrow['decimalplaces']); + $DisplayFreight = locale_money_format(-$myrow['ovfreight'],$myrow['decimalplaces']); + $DisplayTax = locale_money_format(-$myrow['ovgst'],2); + $DisplayTotal = locale_money_format(-$myrow['ovfreight']-$myrow['ovgst']-$myrow['ovamount'],$myrow['decimalplaces']); } /*Print out the invoice text entered */ echo '<table class="table1"><tr> Modified: trunk/SelectOrderItems.php =================================================================== --- trunk/SelectOrderItems.php 2011-09-17 07:49:08 UTC (rev 4693) +++ trunk/SelectOrderItems.php 2011-09-17 22:43:30 UTC (rev 4694) @@ -730,10 +730,9 @@ $SQL = "SELECT stockmaster.stockid, stockmaster.description, stockmaster.units - FROM stockmaster, - stockcategory - WHERE stockmaster.categoryid=stockcategory.categoryid - AND (stockcategory.stocktype='F' OR stockcategory.stocktype='D') + FROM stockmaster INNER JOIN stockcategory + ON stockmaster.categoryid=stockcategory.categoryid + WHERE (stockcategory.stocktype='F' OR stockcategory.stocktype='D') AND stockmaster.mbflag <>'G' AND stockmaster.description " . LIKE . " '" . $SearchString . "' AND stockmaster.discontinued=0 @@ -742,9 +741,9 @@ $SQL = "SELECT stockmaster.stockid, stockmaster.description, stockmaster.units - FROM stockmaster, stockcategory - WHERE stockmaster.categoryid=stockcategory.categoryid - AND (stockcategory.stocktype='F' OR stockcategory.stocktype='D') + FROM stockmaster INNER JOIN stockcategory + ON stockmaster.categoryid=stockcategory.categoryid + WHERE (stockcategory.stocktype='F' OR stockcategory.stocktype='D') AND stockmaster.mbflag <>'G' AND stockmaster.discontinued=0 AND stockmaster.description " . LIKE . " '" . $SearchString . "' @@ -761,9 +760,9 @@ $SQL = "SELECT stockmaster.stockid, stockmaster.description, stockmaster.units - FROM stockmaster, stockcategory - WHERE stockmaster.categoryid=stockcategory.categoryid - AND (stockcategory.stocktype='F' OR stockcategory.stocktype='D') + FROM stockmaster INNER JOIN stockcategory + ON stockmaster.categoryid=stockcategory.categoryid + WHERE (stockcategory.stocktype='F' OR stockcategory.stocktype='D') AND stockmaster.stockid " . LIKE . " '" . $SearchString . "' AND stockmaster.mbflag <>'G' AND stockmaster.discontinued=0 @@ -772,9 +771,9 @@ $SQL = "SELECT stockmaster.stockid, stockmaster.description, stockmaster.units - FROM stockmaster, stockcategory - WHERE stockmaster.categoryid=stockcategory.categoryid - AND (stockcategory.stocktype='F' OR stockcategory.stocktype='D') + FROM stockmaster INNER JOIN stockcategory + ON stockmaster.categoryid=stockcategory.categoryid + WHERE (stockcategory.stocktype='F' OR stockcategory.stocktype='D') AND stockmaster.stockid " . LIKE . " '" . $SearchString . "' AND stockmaster.mbflag <>'G' AND stockmaster.discontinued=0 @@ -787,9 +786,9 @@ $SQL = "SELECT stockmaster.stockid, stockmaster.description, stockmaster.units - FROM stockmaster, stockcategory - WHERE stockmaster.categoryid=stockcategory.categoryid - AND (stockcategory.stocktype='F' OR stockcategory.stocktype='D') + FROM stockmaster INNER JOIN stockcategory + ON stockmaster.categoryid=stockcategory.categoryid + WHERE (stockcategory.stocktype='F' OR stockcategory.stocktype='D') AND stockmaster.mbflag <>'G' AND stockmaster.discontinued=0 ORDER BY stockmaster.stockid"; @@ -797,9 +796,9 @@ $SQL = "SELECT stockmaster.stockid, stockmaster.description, stockmaster.units - FROM stockmaster, stockcategory - WHERE stockmaster.categoryid=stockcategory.categoryid - AND (stockcategory.stocktype='F' OR stockcategory.stocktype='D') + FROM stockmaster INNER JOIN stockcategory + ON stockmaster.categoryid=stockcategory.categoryid + WHERE (stockcategory.stocktype='F' OR stockcategory.stocktype='D') AND stockmaster.mbflag <>'G' AND stockmaster.discontinued=0 AND stockmaster.categoryid='" . $_POST['StockCat'] . "' @@ -816,7 +815,7 @@ if (!isset($Offset) or $Offset<0) { $Offset=0; } - $SQL = $SQL . " LIMIT " . $_SESSION['DefaultDisplayRecordsMax'] . " OFFSET " . strval(filter_number_format($_SESSION['DefaultDisplayRecordsMax']*$Offset)); + $SQL = $SQL . " LIMIT " . $_SESSION['DefaultDisplayRecordsMax'] . " OFFSET " . strval($_SESSION['DefaultDisplayRecordsMax']*$Offset); $ErrMsg = _('There is a problem selecting the part records to display because'); $DbgMsg = _('The SQL used to get the part selection was'); @@ -1056,7 +1055,7 @@ if (isset($_POST['Quantity_' . $OrderLine->LineNumber])){ - $Quantity = filter_number_format($_POST['Quantity_' . $OrderLine->LineNumber]); + $Quantity = round(filter_number_format($_POST['Quantity_' . $OrderLine->LineNumber]),$OrderLine->DecimalPlaces); if (ABS($OrderLine->Price - filter_number_format($_POST['Price_' . $OrderLine->LineNumber]))>0.01){ $Price = filter_number_format($_POST['Price_' . $OrderLine->LineNumber]); @@ -1164,7 +1163,7 @@ foreach ($_SESSION['Items'.$identifier]->LineItems as $OrderLine_2) { if ($OrderLine_2->DiscCat==$OrderLine->DiscCat){ $_SESSION['Items'.$identifier]->LineItems[$OrderLine_2->LineNumber]->DiscountPercent = $DiscountMatrixRate; - $_SESSION['Items'.$identifier]->LineItems[$OrderLine_2->LineNumber]->GPPercent = (($_SESSION['Items'.$identifier]->LineItems[$OrderLine_2->LineNumber]->Price*(1-$DiscountMatrixRate)) - $_SESSION['Items'.$identifier]->LineItems[$OrderLine_2->LineNumber]->StandardCost*$ExRate)/($_SESSION['Items'.$identifier]->LineItems[$OrderLine_2->LineNumber]->Price *(1-$DiscountMatrixRate)/100); + $_SESSION['Items'.$identifier]->LineItems[$OrderLine_2->LineNumber]->GPPercent = filter_number_format((($_SESSION['Items'.$identifier]->LineItems[$OrderLine_2->LineNumber]->Price*(1-$DiscountMatrixRate)) - $_SESSION['Items'.$identifier]->LineItems[$OrderLine_2->LineNumber]->StandardCost*$ExRate)/($_SESSION['Items'.$identifier]->LineItems[$OrderLine_2->LineNumber]->Price *(1-$DiscountMatrixRate)/100)); } } } @@ -1292,7 +1291,7 @@ FROM discountmatrix WHERE salestype='" . $_SESSION['Items'.$identifier]->DefaultSalesType . "' AND discountcategory ='" . $OrderLine->DiscCat . "' - AND quantitybreak <= '" . $QuantityOfDiscCat . "'",$db); + AND quantitybreak <= '" . filter_number_format($QuantityOfDiscCat) . "'",$db); $myrow = DB_fetch_row($result); if ($myrow[0] == NULL){ $DiscountMatrixRate = 0; @@ -1365,22 +1364,22 @@ 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=tect name="Quantity_' . $OrderLine->LineNumber . '" size=6 maxlength=6 value=' . $OrderLine->Quantity . '>'; + echo '<td><input class="number" tabindex=2 type=tect name="Quantity_' . $OrderLine->LineNumber . '" size=6 maxlength=6 value=' . locale_number_format($OrderLine->Quantity,$OrderLine->DecimalPlaces) . '>'; if ($QtyRemain != $QtyOrdered){ - echo '<br />'.$OrderLine->QtyInv.' of '.$OrderLine->Quantity.' invoiced'; + echo '<br />'.locale_number_format($OrderLine->QtyInv,$OrderLine->DecimalPlaces) .' of '.locale_number_format($OrderLine->Quantity,$OrderLine->DecimalPlaces).' invoiced'; } echo '</td> - <td class="number">' . $OrderLine->QOHatLoc . '</td> + <td class="number">' . locale_number_format($OrderLine->QOHatLoc,$OrderLine->DecimalPlaces) . '</td> <td>' . $OrderLine->Units . '</td>'; if (in_array(2,$_SESSION['AllowedPageSecurityTokens'])){ /*OK to display with discount if it is an internal user with appropriate permissions */ - 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><input class="number" type="text" name="Price_' . $OrderLine->LineNumber . '" size=16 maxlength=16 value=' . locale_money_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>'; } else { - echo '<td class=number>' . $OrderLine->Price . '</td><td></td>'; - echo '<input type=hidden name="Price_' . $OrderLine->LineNumber . '" value=' . $OrderLine->Price . '>'; + echo '<td class=number>' . locale_money_format($OrderLine->Price,$_SESSION['Items'.$identifier]->CurrDecimalPlaces) . '</td><td></td>'; + echo '<input type=hidden name="Price_' . $OrderLine->LineNumber . '" value=' . locale_money_format($OrderLine->Price,$_SESSION['Items'.$identifier]->CurrDecimalPlaces) . '>'; } if ($_SESSION['Items'.$identifier]->Some_Already_Delivered($OrderLine->LineNumber)){ $RemTxt = _('Clear Remaining'); Modified: trunk/StockAdjustments.php =================================================================== --- trunk/StockAdjustments.php 2011-09-17 07:49:08 UTC (rev 4693) +++ trunk/StockAdjustments.php 2011-09-17 22:43:30 UTC (rev 4694) @@ -36,12 +36,12 @@ $_SESSION['Adjustment']->Serialised = $myrow['serialised']; $_SESSION['Adjustment']->DecimalPlaces = $myrow['decimalplaces']; $_SESSION['Adjustment']->SerialItems = array(); - if (!isset($_SESSION['Adjustment']->Quantity)or !is_numeric($_SESSION['Adjustment']->Quantity)){ + if (!isset($_SESSION['Adjustment']->Quantity) OR !is_numeric($_SESSION['Adjustment']->Quantity)){ $_SESSION['Adjustment']->Quantity=0; } $NewAdjustment = true; } elseif (isset($_POST['StockID'])){ - if(isset($_POST['StockID']) and $_POST['StockID'] != $_SESSION['Adjustment']->StockID){ + if(isset($_POST['StockID']) AND $_POST['StockID'] != $_SESSION['Adjustment']->StockID){ $NewAdjustment = true; $_SESSION['Adjustment']->StockID = trim(mb_strtoupper($_POST['StockID'])); $StockID = trim(mb_strtoupper($_POST['StockID'])); @@ -49,10 +49,10 @@ $_SESSION['Adjustment']->tag = $_POST['tag']; $_SESSION['Adjustment']->Narrative = $_POST['Narrative']; $_SESSION['Adjustment']->StockLocation = $_POST['StockLocation']; - if ($_POST['Quantity']=='' or !is_numeric($_POST['Quantity'])){ + if ($_POST['Quantity']=='' or !is_numeric(filter_number_format($_POST['Quantity']))){ $_POST['Quantity']=0; } - $_SESSION['Adjustment']->Quantity = $_POST['Quantity']; + $_SESSION['Adjustment']->Quantity = filter_number_format($_POST['Quantity']); } echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/supplier.png" title="' . @@ -94,7 +94,7 @@ exit; } -if (isset($_POST['EnterAdjustment']) && $_POST['EnterAdjustment']!= ''){ +if (isset($_POST['EnterAdjustment']) AND $_POST['EnterAdjustment']!= ''){ $InputError = false; /*Start by hoping for the best */ $result = DB_query("SELECT * FROM stockmaster WHERE stockid='" . $_SESSION['Adjustment']->StockID . "'",$db); @@ -149,7 +149,7 @@ $QtyOnHandPrior = 0; } - $SQL = "INSERT INTO stockmoves ( stockid, + $SQL = "INSERT INTO stockmoves (stockid, type, transno, loccode, @@ -175,7 +175,6 @@ $DbgMsg = _('The following SQL to insert the stock movement record was used'); $Result = DB_query($SQL, $db, $ErrMsg, $DbgMsg, true); - /*Get the ID of the StockMove... */ $StkMoveNo = DB_Last_Insert_ID($db,'stockmoves','stkmoveno'); @@ -188,11 +187,10 @@ /*First need to check if the serial items already exists or not */ $SQL = "SELECT COUNT(*) - FROM stockserialitems - WHERE - stockid='" . $_SESSION['Adjustment']->StockID . "' - AND loccode='" . $_SESSION['Adjustment']->StockLocation . "' - AND serialno='" . $Item->BundleRef . "'"; + FROM stockserialitems + WHERE stockid='" . $_SESSION['Adjustment']->StockID . "' + AND loccode='" . $_SESSION['Adjustment']->StockLocation . "' + AND serialno='" . $Item->BundleRef . "'"; $ErrMsg = _('Unable to determine if the serial item exists'); $Result = DB_query($SQL,$db,$ErrMsg); $SerialItemExistsRow = DB_fetch_row($Result); @@ -200,10 +198,9 @@ if ($SerialItemExistsRow[0]==1){ $SQL = "UPDATE stockserialitems SET quantity= quantity + " . $Item->BundleQty . " - WHERE - stockid='" . $_SESSION['Adjustment']->StockID . "' - AND loccode='" . $_SESSION['Adjustment']->StockLocation . "' - AND serialno='" . $Item->BundleRef . "'"; + WHERE stockid='" . $_SESSION['Adjustment']->StockID . "' + AND loccode='" . $_SESSION['Adjustment']->StockLocation . "' + AND serialno='" . $Item->BundleRef . "'"; $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The serial stock item record could not be updated because'); $DbgMsg = _('The following SQL to update the serial stock item record was used'); @@ -308,7 +305,7 @@ $Result = DB_Txn_Commit($db); - $ConfirmationText = _('A stock adjustment for'). ' ' . $_SESSION['Adjustment']->StockID . ' - ' . $_SESSION['Adjustment']->ItemDescription . ' '._('has been created from location').' ' . $_SESSION['Adjustment']->StockLocation .' '. _('for a quantity of') . ' ' . $_SESSION['Adjustment']->Quantity ; + $ConfirmationText = _('A stock adjustment for'). ' ' . $_SESSION['Adjustment']->StockID . ' - ' . $_SESSION['Adjustment']->ItemDescription . ' '._('has been created from location').' ' . $_SESSION['Adjustment']->StockLocation .' '. _('for a quantity of') . ' ' . locale_number_format($_SESSION['Adjustment']->Quantity,$_SESSION['Adjustment']->DecimalPlaces) ; prnMsg( $ConfirmationText,'success'); if ($_SESSION['InventoryManagerEmail']!=''){ @@ -323,22 +320,24 @@ }/* end if the user hit enter the adjustment */ -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'] . '" />'; if (!isset($_SESSION['Adjustment'])) { $StockID=''; $Controlled= 0; $Quantity = 0; + $DecimalPlaces =2; } else { $StockID = $_SESSION['Adjustment']->StockID; $Controlled = $_SESSION['Adjustment']->Controlled; $Quantity = $_SESSION['Adjustment']->Quantity; - $sql="SELECT materialcost, labourcost, overheadcost, units FROM stockmaster WHERE stockid='".$StockID."'"; + $sql="SELECT materialcost, labourcost, overheadcost, units, decimalplaces FROM stockmaster WHERE stockid='".$StockID."'"; $result=DB_query($sql, $db); $myrow=DB_fetch_array($result); $_SESSION['Adjustment']->PartUnit=$myrow['units']; $_SESSION['Adjustment']->StandardCost=$myrow['materialcost']+$myrow['labourcost']+$myrow['overheadcost']; + $DecimalPlaces = $myrow['decimalplaces']; } echo '<br /><table class=selection>'; echo '<tr><th colspan=4><font color=blue size=3>'._('Adjustment Details').'</font></th></tr>'; @@ -359,10 +358,10 @@ echo '<input type="text" name="StockCode" size=21 value="" maxlength=20>'; } echo '</td><td><input type=submit name="CheckCode" VALUE="'._('Check Part').'"></td></tr>'; -if (isset($_SESSION['Adjustment']) and mb_strlen($_SESSION['Adjustment']->ItemDescription)>1){ +if (isset($_SESSION['Adjustment']) AND mb_strlen($_SESSION['Adjustment']->ItemDescription)>1){ echo '<tr><td colspan=3><font color=BLUE size=3>' . $_SESSION['Adjustment']->ItemDescription . ' ('._('In Units of').' ' . $_SESSION['Adjustment']->PartUnit . ' ) - ' . _('Unit Cost').' = ' . - locale_number_format($_SESSION['Adjustment']->StandardCost,4) . '</font></td></tr>'; + locale_money_format($_SESSION['Adjustment']->StandardCost,4) . '</font></td></tr>'; } echo '<tr><td>'. _('Adjustment to Stock At Location').':</td> @@ -373,25 +372,28 @@ while ($myrow=DB_fetch_array($resultStkLocs)){ if (isset($_SESSION['Adjustment']->StockLocation)){ if ($myrow['loccode'] == $_SESSION['Adjustment']->StockLocation){ - echo '<option selected Value="' . $myrow['loccode'] . '">' . $myrow['locationname']; + echo '<option selected value="' . $myrow['loccode'] . '">' . $myrow['locationname']; } else { - echo '<option Value="' . $myrow['loccode'] . '">' . $myrow['locationname']; + echo '<option value="' . $myrow['loccode'] . '">' . $myrow['locationname']; } } elseif ($myrow['loccode']==$_SESSION['UserStockLocation']){ - echo '<option selected Value="' . $myrow['loccode'] . '">' . $myrow['locationname']; + echo '<option selected value="' . $myrow['loccode'] . '">' . $myrow['locationname']; $_POST['StockLocation']=$myrow['loccode']; } else { - echo '<option Value="' . $myrow['loccode'] . '">' . $myrow['locationname']; + echo '<option value="' . $myrow['loccode'] . '">' . $myrow['locationname']; } } echo '</select></td></tr>'; -if (isset($_SESSION['Adjustment']) and !isset($_SESSION['Adjustment']->Narrative)) { +if (isset($_SESSION['Adjustment']) AND !isset($_SESSION['Adjustment']->Narrative)) { $_SESSION['Adjustment']->Narrative = ''; + $Narrative =''; +} else { + $Narrative =''; } echo '<tr><td>'. _('Comments On Why').':</td> - <td><input type="text" name="Narrative" size=32 maxlength=30 value="' . $_SESSION['Adjustment']->Narrative . '"></td></tr>'; + <td><input type="text" name="Narrative" size=32 maxlength=30 value="' . $Narrative . '"></td></tr>'; echo '<tr><td>'._('Adjustment Quantity').':</td>'; @@ -400,26 +402,26 @@ if ($_SESSION['Adjustment']->StockLocation == ''){ $_SESSION['Adjustment']->StockLocation = $_SESSION['UserStockLocation']; } - echo '<input type="HIDDEN" name="Quantity" Value="' . $_SESSION['Adjustment']->Quantity . '"> - '.$_SESSION['Adjustment']->Quantity.' - [<a href="'.$rootpath.'/StockAdjustmentsControlled.php?AdjType=REMOVE&' . SID . '">'._('Remove').'</a>] - [<a href="'.$rootpath.'/StockAdjustmentsControlled.php?AdjType=ADD&' . SID . '">'._('Add').'</a>]'; + echo '<input type="hidden" name="Quantity" value="' . $_SESSION['Adjustment']->Quantity . '"> + '.locale_number_format($_SESSION['Adjustment']->Quantity,$DecimalPlaces) .' + [<a href="'.$rootpath.'/StockAdjustmentsControlled.php?AdjType=REMOVE">'._('Remove').'</a>] + [<a href="'.$rootpath.'/StockAdjustmentsControlled.php?AdjType=ADD">'._('Add').'</a>]'; } else { - echo '<input type="text" class="number" name="Quantity" size=12 maxlength=12 Value="' . $Quantity . '">'; + echo '<input type="text" class="number" name="Quantity" size="12" maxlength="12" value="' . locale_number_format($Quantity,$DecimalPlaces) . '">'; } echo '</td></tr>'; //Select the tag echo '<tr><td>'._('Select Tag').'</td><td><select name="tag">'; -$SQL = 'SELECT tagref, +$SQL = "SELECT tagref, tagdescription FROM tags - ORDER BY tagref'; + ORDER BY tagref"; $result=DB_query($SQL,$db); -echo '<option value=0>0 - None'; +echo '<option value=0>0 - ' . _('None') . '</option>'; while ($myrow=DB_fetch_array($result)){ - if (isset($_SESSION['Adjustment']->tag) and $_SESSION['Adjustment']->tag==$myrow['tagref']){ + if (isset($_SESSION['Adjustment']->tag) AND $_SESSION['Adjustment']->tag==$myrow['tagref']){ echo '<option selected value=' . $myrow['tagref'] . '>' . $myrow['tagref'].' - ' .$myrow['tagdescription'] . '</option>'; } else { echo '<option value=' . $myrow['tagref'] . '>' . $myrow['tagref'].' - ' .$myrow['tagdescription']. '</option>'; @@ -428,7 +430,7 @@ echo '</select></td>'; // End select tag -echo '</table><div class="centre"><br /><input type=submit name="EnterAdjustment" value="'. _('Enter Stock Adjustment'). '"><br />'; +echo '</table><div class="centre"><br /><input type="submit" name="EnterAdjustment" value="'. _('Enter Stock Adjustment'). '"><br />'; if (!isset($_POST['StockLocation'])) { $_POST['StockLocation']=''; Modified: trunk/UpgradeDatabase.php =================================================================== --- trunk/UpgradeDatabase.php 2011-09-17 07:49:08 UTC (rev 4693) +++ trunk/UpgradeDatabase.php 2011-09-17 22:43:30 UTC (rev 4694) @@ -112,6 +112,7 @@ $SQLScripts[] = './sql/mysql/upgrade4.04.5-4.05.sql'; case '4.05': case '4.05.1': + case '4.05.2': $SQLScripts[] = './sql/mysql/upgrade4.05-4.06.sql'; case '4.06': break; Modified: trunk/WWW_Users.php =================================================================== --- trunk/WWW_Users.php 2011-09-17 07:49:08 UTC (rev 4693) +++ trunk/WWW_Users.php 2011-09-17 22:43:30 UTC (rev 4694) @@ -133,13 +133,13 @@ $UpdatePassword = "password='" . CryptPass($_POST['Password']) . "',"; } - $sql = "UPDATE www_users SET realname='" . $_POST['RealName'] . "', - customerid='" . $_POST['Cust'] ."', - phone='" . $_POST['Phone'] ."', - email='" . $_POST['Email'] ."', + $sql = "UPDATE www_users SET realname='" . DB_escape_string($_POST['RealName']) . "', + customerid='" . DB_escape_string($_POST['Cust']) ."', + phone='" . DB_escape_string($_POST['Phone']) ."', + email='" . DB_escape_string($_POST['Email'] ."', " . $UpdatePassword . " - branchcode='" . $_POST['BranchCode'] . "', - supplierid='" . $_POST['SupplierID'] . "', + branchcode='" . DB_escape_string($_POST['BranchCode']) . "', + supplierid='" . DB_escape_string($_POST['SupplierID']) . "', salesman='" . $_POST['Salesman'] . "', pagesize='" . $_POST['PageSize'] . "', fullaccess='" . $_POST['Access'] . "', @@ -171,15 +171,15 @@ theme, language, pdflanguage) - VALUES ('" . $_POST['UserID'] . "', - '" . $_POST['RealName'] ."', - '" . $_POST['Cust'] ."', - '" . $_POST['BranchCode'] ."', - '" . $_POST['SupplierID'] ."', + VALUES ('" . DB_escape_string($_POST['UserID']) . "', + '" . DB_escape_string($_POST['RealName']) ."', + '" . DB_escape_string($_POST['Cust']) ."', + '" . DB_escape_string($_POST['BranchCode']) ."', + '" . DB_escape_string($_POST['SupplierID']) ."', '" . $_POST['Salesman'] . "', '" . CryptPass($_POST['Password']) ."', - '" . $_POST['Phone'] . "', - '" . $_POST['Email'] ."', + '" . DB_escape_string($_POST['Phone']) . "', + '" . DB_escape_string($_POST['Email']) ."', '" . $_POST['PageSize'] ."', '" . $_POST['Access'] . "', '" . $_POST['DefaultLocation'] ."', Modified: trunk/doc/Change.log =================================================================== --- trunk/doc/Change.log 2011-09-17 07:49:08 UTC (rev 4693) +++ trunk/doc/Change.log 2011-09-17 22:43:30 UTC (rev 4694) @@ -1,5 +1,6 @@ webERP Change Log +17/9/11 Phil: Added WindowsLocale element to LanguagesArray.php and modified UserSettings.php and WWW_Users.php to use the new array definition. Also modified includes/LanguageSetup.php to use the windows locale string in the LanguagesArray as required for proper setting of the locale under windows. 17/9/11 Felix Lim: added serialised field into PrintCustTransPortrait.php to reinstate possiblity for printing serialised items on invoice - not possible in landscape version (PrintCustTrans.php) 12/9/11 Phil/Exson/Tom: Change all scripts to allow display and input of numbers in the format of the selected users locale 5/9/11 Phil: Fixed supplier payment exchange rate ... was being calculated incorrectly from functional exchange rate and the exchange rate between the currency of the bank account and currency of payment. Modified: trunk/includes/Add_SerialItems.php =================================================================== --- trunk/includes/Add_SerialItems.php 2011-09-17 07:49:08 UTC (rev 4693) +++ trunk/includes/Add_SerialItems.php 2011-09-17 22:43:30 UTC (rev 4694) @@ -56,17 +56,21 @@ if ($LineItem->Serialised){ $ExistingQty = ValidBundleRef($StockID, $LocationOut, $NewSerialNo); - if ($NewQty == 1 && $ExistingQty != 0){ + if ($NewQty == 1 AND $ExistingQty != 0){ prnMsg( '<a href="'.$rootpath.'/StockSerialItemResearch.php?serialno='. $NewSerialNo . '" target=_blank>'.$NewSerialNo. '</a> : '. _('The Serial Number being added exists with a Quantity that is not Zero (0)!'), 'error' ); $SerialError = true; - } elseif ($NewQty == -1 && $ExistingQty != 1){ + } elseif ($NewQty == -1 AND $ExistingQty != 1){ prnMsg( '<a href="'.$rootpath.'/StockSerialItemResearch.php?serialno='. $NewSerialNo . '" target=_blank>'.$NewSerialNo. '</a> : '. _('The Serial Number being removed exists with a Quantity that is not One (1)!'), 'error'); $SerialError = true; } } - + if (isset($_POST['ExpiryDate' . $i])){ + $ExpiryDate = $_POST['ExpiryDate' . $i]; + } else { + $ExpiryDate ='0000-00-00'; + } if (!$SerialError){ - $LineItem->SerialItems[$NewSerialNo] = new SerialItem ($_POST['SerialNo' . $i], $NewQty, $_POST['ExpiryDate' . $i]); + $LineItem->SerialItems[$NewSerialNo] = new SerialItem ($_POST['SerialNo' . $i], $NewQty, $ExpiryDate); } } } /* end if posted Serialno . i is not blank */ @@ -92,7 +96,7 @@ /******************************************** Add a Sequence of Items and save entries ********************************************/ -if ( isset($_POST['AddSequence']) && $_POST['AddSequence']!='') { +if ( isset($_POST['AddSequence']) AND $_POST['AddSequence']!='') { // do some quick validation $BeginNo = $_POST['BeginNo']; $EndNo = $_POST['EndNo']; @@ -151,7 +155,7 @@ } } else { //for controlled only items, we must receive: BatchID, Qty in a comma delimited file - if($pieces[0] != "" && $pieces[1] != "" && is_numeric($pieces[1]) && $pieces[1] > 0 ){ + if($pieces[0] != "" AND $pieces[1] != "" AND is_numeric($pieces[1]) AND $pieces[1] > 0 ){ /*If the user enters a duplicate batch number the later one over-writes the first entered one - no warning given though ? */ //$LineItem->SerialItems[$pieces[0]] = new SerialItem ($pieces[0], $pieces[1] ); @@ -198,10 +202,10 @@ $SerialError = false; if ($LineItem->Serialised){ $ExistingQty = ValidBundleRef($StockID, $LocationOut, $NewSerialNo); - if ($NewQty == 1 && $ExistingQty != 0){ + if ($NewQty == 1 AND $ExistingQty != 0){ prnMsg( '<a href="'.$rootpath.'/StockSerialItemResearch.php?serialno='. $NewSerialNo . '" target=_blank>'.$NewSerialNo. '</a>: '. _("The Serial Number being added exists with a Quantity that is not Zero (0)!"), 'error' ); $SerialError = true; - } elseif ($NewQty == -1 && $ExistingQty != 1){ + } elseif ($NewQty == -1 AND $ExistingQty != 1){ prnMsg( '<a href="'.$rootpath.'/StockSerialItemResearch.php?serialno='. $NewSerialNo . '" target=_blank>'.$NewSerialNo. '</a> : '. _("The Serial Number being removed exists with a Quantity that is not One (1)!"), 'error'); $SerialError = true; } @@ -248,7 +252,7 @@ } } else { //for controlled only items, we must receive: BatchID, Qty in a comma delimited file - if($Item->BundleRef != "" && $Item->BundleQty != "" && is_numeric($Item->BundleQty) && $Item->BundleQty > 0 ){ + if($Item->BundleRef != "" AND $Item->BundleQty != "" AND is_numeric($Item->BundleQty) AND $Item->BundleQty > 0 ){ /*If the user enters a duplicate batch number the later one over-writes the first entered one - no warning given though ? */ //$LineItem->SerialItems[$pieces[0]] = new SerialItem ($pieces[0], $pieces[1] ); @@ -295,10 +299,10 @@ $SerialError = false; if ($LineItem->Serialised){ $ExistingQty = ValidBundleRef($StockID, $LocationOut, $NewSerialNo); - if ($NewQty == 1 && $ExistingQty != 0){ + if ($NewQty == 1 AND $ExistingQty != 0){ prnMsg( '<a href="'.$rootpath.'/StockSerialItemResearch.php?serialno='. $NewSerialNo . '" target=_blank>'.$NewSerialNo. '</a>: '. _("The Serial Number being added exists with a Quantity that is not Zero (0)!"), 'error' ); $SerialError = true; - } elseif ($NewQty == -1 && $ExistingQty != 1){ + } elseif ($NewQty == -1 AND $ExistingQty != 1){ prnMsg( '<a href="'.$rootpath.'/StockSerialItemResearch.php?serialno='. $NewSerialNo . '" target=_blank>'.$NewSerialNo. '</a> : '. _("The Serial Number being removed exists with a Quantity that is not One (1)!"), 'error'); $SerialError = true; } Modified: trunk/includes/ConnectDB.inc =================================================================== --- trunk/includes/ConnectDB.inc 2011-09-17 07:49:08 UTC (rev 4693) +++ trunk/includes/ConnectDB.inc 2011-09-17 22:43:30 UTC (rev 4694) @@ -4,7 +4,7 @@ * this value is saved in the $_SESSION['Versionumber'] when includes/GetConfig.php is run * if VersionNumber is < $Version then the DB update script is run */ -$Version='4.05.1'; //must update manually every time there is a DB change +$Version='4.05.2'; //must update manually every time there is a DB change require_once ($PathPrefix .'includes/MiscFunctions.php'); Modified: trunk/includes/InputSerialItems.php =================================================================== --- trunk/includes/InputSerialItems.php 2011-09-17 07:49:08 UTC (rev 4693) +++ trunk/includes/InputSerialItems.php 2011-09-17 22:43:30 UTC (rev 4694) @@ -48,7 +48,7 @@ $invalid_imports = 0; $valid = true; -echo '<form method="post" action="' . $_SERVER['PHP_SELF'] . '?identifier=' . $identifier .'" enctype="multipart/form-data" >'; +echo '<form method="post" action="' . $_SERVER['PHP_SELF'] .'" enctype="multipart/form-data" >'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; echo '<input type=hidden name="LineNo" value="' . $LineNo . '">'; echo '<input type=hidden name="StockID" value="'. $StockID. '">'; @@ -84,9 +84,9 @@ global $tableheader; /* Link to clear the list and start from scratch */ -$EditLink = '<br /><div class="centre"><a href="' . $_SERVER['PHP_SELF'] . '?identifier=' . $identifier . '&EditControlled=true&StockID=' . $LineItem->StockID . +$EditLink = '<br /><div class="centre"><a href="' . $_SERVER['PHP_SELF'] . '?EditControlled=true&StockID=' . $LineItem->StockID . '&LineNo=' . $LineNo .'">'. _('Edit'). '</a> | '; -$RemoveLink = '<a href="' . $_SERVER['PHP_SELF'] . '?identifier=' . $identifier . '&DELETEALL=YES&StockID=' . $LineItem->StockID . +$RemoveLink = '<a href="' . $_SERVER['PHP_SELF'] . '?DELETEALL=YES&StockID=' . $LineItem->StockID . '&LineNo=' . $LineNo .'">'. _('Remove All'). '</a><br /></div>'; $sql="SELECT perishable FROM stockmaster Modified: trunk/includes/InputSerialItemsKeyed.php =================================================================== --- trunk/includes/InputSerialItemsKeyed.php 2011-09-17 07:49:08 UTC (rev 4693) +++ trunk/includes/InputSerialItemsKeyed.php 2011-09-17 22:43:30 UTC (rev 4694) @@ -50,13 +50,13 @@ echo '<td>' . $Bundle->BundleRef . '</td>'; if ($LineItem->Serialised==0 and $Perishable==0){ - echo '<td class=number>' . locale_number_format($Bundle->BundleQty, $LineItem->DecimalPlaces) . '</td>'; + echo '<td class="number">' . locale_number_format($Bundle->BundleQty, $LineItem->DecimalPlaces) . '</td>'; } else if ($LineItem->Serialised==0 and $Perishable==1){ - echo '<td class=number>' . locale_number_format($Bundle->BundleQty, $LineItem->DecimalPlaces) . '</td>'; - echo '<td class=number>' . $Bundle->ExpiryDate . '</td>'; + echo '<td class="number">' . locale_number_format($Bundle->BundleQty, $LineItem->DecimalPlaces) . '</td>'; + echo '<td class="number">' . $Bundle->ExpiryDate . '</td>'; } - echo '<td><a href="' . $_SERVER['PHP_SELF'] . '?identifier=' . $identifier . '&Delete=' . $Bundle->BundleRef . '&StockID=' . $LineItem->StockID . '&LineNo=' . $LineNo .'">'. _('Delete'). '</a></td></tr>'; + echo '<td><a href="' . $_SERVER['PHP_SELF'] . '?Delete=' . $Bundle->BundleRef . '&StockID=' . $LineItem->StockID . '&LineNo=' . $LineNo .'">'. _('Delete'). '</a></td></tr>'; $TotalQuantity += $Bundle->BundleQty; } @@ -64,27 +64,26 @@ /*Display the totals and rule off before allowing new entries */ if ($LineItem->Serialised==1){ - echo '<tr><td class=number><B>'. _('Total Quantity'). ': ' . locale_number_format($TotalQuantity,$LineItem->DecimalPlaces) . '</b></td></tr>'; + echo '<tr><td class="number"><B>'. _('Total Quantity'). ': ' . locale_number_format($TotalQuantity,$LineItem->DecimalPlaces) . '</b></td></tr>'; } else { - echo '<tr><td class=number><B>'. _('Total Quantity'). ':</b></td><td class=number><b>' . locale_number_format($TotalQuantity,$LineItem->DecimalPlaces) . '</b></td></tr>'; + echo '<tr><td class="number"><B>'. _('Total Quantity'). ':</b></td><td class="number"><b>' . locale_number_format($TotalQuantity,$LineItem->DecimalPlaces) . '</b></td></tr>'; } /*Close off old table */ -echo '</table></td><td valign=top>'; +echo '</table></td><td valign="top">'; /*Start a new table for the Serial/Batch ref input in one column (as a sub table then the multi select box for selection of existing bundle/serial nos for dispatch if applicable*/ //echo '<TABLE><TR><TD valign=TOP>'; /*in the first column add a table for the input of newies */ -echo '<table class=selection>'; +echo '<table class="selection">'; echo $tableheader; echo '<form action="' . $_SERVER['PHP_SELF'] . '" name="Ga6uF5Wa" method="post"> <input type=hidden name="LineNo" value="' . $LineNo . '"> <input type=hidden name="StockID" value="' . $StockID . '"> - <input type=hidden name="identifier" value="' . $identifier . '"> <input type=hidden name="EntryType" value="KEYED">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; if ( isset($_GET['EditControlled']) ) { Modified: trunk/includes/LanguageSetup.php =================================================================== --- trunk/includes/LanguageSetup.php 2011-09-17 07:49:08 UTC (rev 4693) +++ trunk/includes/LanguageSetup.php 2011-09-17 22:43:30 UTC (rev 4694) @@ -30,7 +30,7 @@ } else { // it's a windows server $Locale = setlocale (LC_ALL, $LanguageArray[$_SESSION['Language']]['WindowsLocale']); } -//$Locale = setlocale (LC_NUMERIC, 'fr_FR.utf8'); +$Locale = setlocale (LC_NUMERIC, 'fr_FR.utf8'); $LocaleInfo = localeconv(); if ($LocaleInfo['mon_decimal_point']==''){ Modified: trunk/sql/mysql/upgrade4.05-4.06.sql =================================================================== --- trunk/sql/mysql/upgrade4.05-4.06.sql 2011-09-17 07:49:08 UTC (rev 4693) +++ trunk/sql/mysql/upgrade4.05-4.06.sql 2011-09-17 22:43:30 UTC (rev 4694) @@ -1,5 +1,5 @@ ALTER TABLE stockmaster DROP lastcurcostdate; ALTER TABLE stockmaster ADD lastcostupdate DATE NOT NULL; INSERT INTO `config` (`confname` ,`confvalue`) -VALUES ('InventoryManagerEmail', 'in...@yo...'); -UPDATE config SET confvalue='4.05.1' WHERE confname='VersionNumber'; \ No newline at end of file +VALUES ('InventoryManagerEmail', ''); +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: <tim...@us...> - 2011-09-17 07:49:16
|
Revision: 4693 http://web-erp.svn.sourceforge.net/web-erp/?rev=4693&view=rev Author: tim_schofield Date: 2011-09-17 07:49:08 +0000 (Sat, 17 Sep 2011) Log Message: ----------- Corrections to language names Modified Paths: -------------- trunk/includes/LanguagesArray.php Modified: trunk/includes/LanguagesArray.php =================================================================== --- trunk/includes/LanguagesArray.php 2011-09-16 23:15:08 UTC (rev 4692) +++ trunk/includes/LanguagesArray.php 2011-09-17 07:49:08 UTC (rev 4693) @@ -4,7 +4,7 @@ $LanguagesArray['en_US.utf8']['WindowsLocale'] = 'english-us'; $LanguagesArray['en_GB.utf8']['LanguageName'] = _('English British'); $LanguagesArray['en_GB.utf8']['WindowsLocale'] = 'english-uk'; -$LanguagesArray['cz_CZ.utf8']['LanguageName'] = _('Czechoslovakian'); +$LanguagesArray['cz_CZ.utf8']['LanguageName'] = _('Czech'); $LanguagesArray['cz_CZ.utf8']['WindowsLocale'] = 'czech'; $LanguagesArray['de_DE.utf8']['LanguageName'] = _('German'); $LanguagesArray['de_DE.utf8']['WindowsLocale'] = 'german'; @@ -44,7 +44,7 @@ $LanguagesArray['ru_RU.utf8']['WindowsLocale'] = 'russian'; $LanguagesArray['sq_AL.utf8']['LanguageName'] = _('Albanian'); $LanguagesArray['sq_AL.utf8']['WindowsLocale'] = 'english-us'; -$LanguagesArray['sv_SE.utf8']['LanguageName'] = _('Sweedish'); +$LanguagesArray['sv_SE.utf8']['LanguageName'] = _('Swedish'); $LanguagesArray['sv_SE.utf8']['WindowsLocale'] = 'swedish'; $LanguagesArray['sw_KE.utf8']['LanguageName'] = _('Kiswahili'); $LanguagesArray['sw_KE.utf8']['WindowsLocale'] = 'english-us'; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <tim...@us...> - 2011-09-17 07:49:15
|
Revision: 4693 http://web-erp.svn.sourceforge.net/web-erp/?rev=4693&view=rev Author: tim_schofield Date: 2011-09-17 07:49:08 +0000 (Sat, 17 Sep 2011) Log Message: ----------- Corrections to language names Modified Paths: -------------- trunk/includes/LanguagesArray.php Modified: trunk/includes/LanguagesArray.php =================================================================== --- trunk/includes/LanguagesArray.php 2011-09-16 23:15:08 UTC (rev 4692) +++ trunk/includes/LanguagesArray.php 2011-09-17 07:49:08 UTC (rev 4693) @@ -4,7 +4,7 @@ $LanguagesArray['en_US.utf8']['WindowsLocale'] = 'english-us'; $LanguagesArray['en_GB.utf8']['LanguageName'] = _('English British'); $LanguagesArray['en_GB.utf8']['WindowsLocale'] = 'english-uk'; -$LanguagesArray['cz_CZ.utf8']['LanguageName'] = _('Czechoslovakian'); +$LanguagesArray['cz_CZ.utf8']['LanguageName'] = _('Czech'); $LanguagesArray['cz_CZ.utf8']['WindowsLocale'] = 'czech'; $LanguagesArray['de_DE.utf8']['LanguageName'] = _('German'); $LanguagesArray['de_DE.utf8']['WindowsLocale'] = 'german'; @@ -44,7 +44,7 @@ $LanguagesArray['ru_RU.utf8']['WindowsLocale'] = 'russian'; $LanguagesArray['sq_AL.utf8']['LanguageName'] = _('Albanian'); $LanguagesArray['sq_AL.utf8']['WindowsLocale'] = 'english-us'; -$LanguagesArray['sv_SE.utf8']['LanguageName'] = _('Sweedish'); +$LanguagesArray['sv_SE.utf8']['LanguageName'] = _('Swedish'); $LanguagesArray['sv_SE.utf8']['WindowsLocale'] = 'swedish'; $LanguagesArray['sw_KE.utf8']['LanguageName'] = _('Kiswahili'); $LanguagesArray['sw_KE.utf8']['WindowsLocale'] = 'english-us'; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dai...@us...> - 2011-09-16 23:15:15
|
Revision: 4692 http://web-erp.svn.sourceforge.net/web-erp/?rev=4692&view=rev Author: daintree Date: 2011-09-16 23:15:08 +0000 (Fri, 16 Sep 2011) Log Message: ----------- make windows use the correct locale Modified Paths: -------------- trunk/DeliveryDetails.php trunk/PrintCustTrans.php trunk/PrintCustTransPortrait.php trunk/UserSettings.php trunk/WWW_Users.php trunk/doc/Change.log trunk/includes/LanguageSetup.php trunk/includes/LanguagesArray.php Modified: trunk/DeliveryDetails.php =================================================================== --- trunk/DeliveryDetails.php 2011-09-16 10:29:26 UTC (rev 4691) +++ trunk/DeliveryDetails.php 2011-09-16 23:15:08 UTC (rev 4692) @@ -44,7 +44,7 @@ /*store the old freight cost before it is recalculated to ensure that there has been no change - test for change after freight recalculated and get user to re-confirm if changed */ - $OldFreightCost = round(filter_number_format($_POST['FreightCost']),2); + $OldFreightCost = round(filter_number_format($_POST['FreightCost']),$_SESSION['Items'.$identifier]->CurrDecimalPlaces); } @@ -119,7 +119,7 @@ if ($_SESSION['DoFreightCalc']==True){ list ($_POST['FreightCost'], $BestShipper) = CalcFreightCost($_SESSION['Items'.$identifier]->total, $_POST['BrAdd2'], $_POST['BrAdd3'], $_SESSION['Items'.$identifier]->totalVolume, $_SESSION['Items'.$identifier]->totalWeight, $_SESSION['Items'.$identifier]->Location, $db); if ( !empty($BestShipper) ){ - $_POST['FreightCost'] = round(filter_number_format($_POST['FreightCost']),2); + $_POST['FreightCost'] = round(filter_number_format($_POST['FreightCost']),$_SESSION['Items'.$identifier]->CurrDecimalPlaces); $_POST['ShipVia'] = $BestShipper; } else { prnMsg(_($_POST['FreightCost']),'warn'); @@ -183,7 +183,7 @@ $_SESSION['Items'.$identifier]->ConfirmedDate = $_POST['ConfirmedDate']; $_SESSION['Items'.$identifier]->CustRef = $_POST['CustRef']; $_SESSION['Items'.$identifier]->Comments = $_POST['Comments']; - $_SESSION['Items'.$identifier]->FreightCost = round(filter_number_format($_POST['FreightCost']),2); + $_SESSION['Items'.$identifier]->FreightCost = round(filter_number_format($_POST['FreightCost']),$_SESSION['Items'.$identifier]->CurrDecimalPlaces); $_SESSION['Items'.$identifier]->Quotation = $_POST['Quotation']; } else { $_SESSION['Items'.$identifier]->DeliverTo = $_POST['DeliverTo']; @@ -200,13 +200,13 @@ $_SESSION['Items'.$identifier]->ShipVia = $_POST['ShipVia']; $_SESSION['Items'.$identifier]->DeliverBlind = $_POST['DeliverBlind']; $_SESSION['Items'.$identifier]->SpecialInstructions = $_POST['SpecialInstructions']; - $_SESSION['Items'.$identifier]->DeliveryDays = filter_number_format$_POST['DeliveryDays']); + $_SESSION['Items'.$identifier]->DeliveryDays = filter_number_format($_POST['DeliveryDays']); $_SESSION['Items'.$identifier]->DeliveryDate = $_POST['DeliveryDate']; $_SESSION['Items'.$identifier]->QuoteDate = $_POST['QuoteDate']; $_SESSION['Items'.$identifier]->ConfirmedDate = $_POST['ConfirmedDate']; $_SESSION['Items'.$identifier]->CustRef = $_POST['CustRef']; $_SESSION['Items'.$identifier]->Comments = $_POST['Comments']; - $_SESSION['Items'.$identifier]->FreightCost = round(filter_number_format($_POST['FreightCost']),2); + $_SESSION['Items'.$identifier]->FreightCost = round(filter_number_format($_POST['FreightCost']),$_SESSION['Items'.$identifier]->CurrDecimalPlaces); $_SESSION['Items'.$identifier]->Quotation = $_POST['Quotation']; } /*$_SESSION['DoFreightCalc'] is a setting in the config.php file that the user can set to false to turn off freight calculations if necessary */ Modified: trunk/PrintCustTrans.php =================================================================== --- trunk/PrintCustTrans.php 2011-09-16 10:29:26 UTC (rev 4691) +++ trunk/PrintCustTrans.php 2011-09-16 23:15:08 UTC (rev 4692) @@ -231,10 +231,9 @@ stockmoves.narrative, stockmaster.units, stockmaster.decimalplaces - FROM stockmoves, - stockmaster - WHERE stockmoves.stockid = stockmaster.stockid - AND stockmoves.type=10 + FROM stockmoves INNER JOIN stockmaster + ON stockmoves.stockid = stockmaster.stockid + WHERE stockmoves.type=10 AND stockmoves.transno=" . $FromTransNo . " AND stockmoves.show_on_inv_crds=1"; } else { @@ -248,10 +247,9 @@ stockmoves.narrative, stockmaster.units, stockmaster.decimalplaces - FROM stockmoves, - stockmaster - WHERE stockmoves.stockid = stockmaster.stockid - AND stockmoves.type=11 + FROM stockmoves INNER JOIN stockmaster + ON stockmoves.stockid = stockmaster.stockid + WHERE stockmoves.type=11 AND stockmoves.transno=" . $FromTransNo . " AND stockmoves.show_on_inv_crds=1"; } // end else Modified: trunk/PrintCustTransPortrait.php =================================================================== --- trunk/PrintCustTransPortrait.php 2011-09-16 10:29:26 UTC (rev 4691) +++ trunk/PrintCustTransPortrait.php 2011-09-16 23:15:08 UTC (rev 4692) @@ -253,6 +253,7 @@ (stockmoves.price * " . $ExchRate . ") AS fxprice, stockmoves.narrative, stockmaster.controlled, + stockmaster.serialised, stockmaster.units, stockmoves.stkmoveno, stockmaster.decimalplaces @@ -271,6 +272,7 @@ (stockmoves.price * " . $ExchRate . ") AS fxprice, stockmoves.narrative, stockmaster.controlled, + stockmaster.serialised, stockmaster.units, stockmoves.stkmoveno, stockmaster.decimalplaces Modified: trunk/UserSettings.php =================================================================== --- trunk/UserSettings.php 2011-09-16 10:29:26 UTC (rev 4691) +++ trunk/UserSettings.php 2011-09-16 23:15:08 UTC (rev 4692) @@ -5,7 +5,6 @@ include('includes/session.inc'); $title = _('User Settings'); include('includes/header.inc'); -include('includes/LanguagesArray.php'); echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/user.png" title="' . _('User Settings') . '" alt="" />' . ' ' . _('User Settings') . '</p>'; @@ -134,11 +133,11 @@ foreach ($LanguagesArray as $LanguageEntry => $LanguageName){ if (isset($_POST['Language']) AND $_POST['Language'] == $LanguageEntry){ - echo '<option selected value="' . $LanguageEntry . '">' . $LanguageName .'</option>'; + echo '<option selected value="' . $LanguageEntry . '">' . $LanguageName['LanguageName'] .'</option>'; } elseif (!isset($_POST['Language']) AND $LanguageEntry == $DefaultLanguage) { - echo '<option selected value="' . $LanguageEntry . '">' . $LanguageName .'</option>'; + echo '<option selected value="' . $LanguageEntry . '">' . $LanguageName['LanguageName'] .'</option>'; } else { - echo '<option value="' . $LanguageEntry . '">' . $LanguageName .'</option>'; + echo '<option value="' . $LanguageEntry . '">' . $LanguageName['LanguageName'] .'</option>'; } } echo '</select></td></tr>'; Modified: trunk/WWW_Users.php =================================================================== --- trunk/WWW_Users.php 2011-09-16 10:29:26 UTC (rev 4691) +++ trunk/WWW_Users.php 2011-09-16 23:15:08 UTC (rev 4692) @@ -8,7 +8,6 @@ } } include('includes/session.inc'); -include ('includes/LanguagesArray.php'); $ModuleList = array(_('Orders'), _('Receivables'), @@ -84,7 +83,15 @@ $InputError = 1; } */ - + if (!isset($SelectedUser)){ + /* check to ensure the user id is not already entered */ + $result = DB_query("SELECT userid FROM www_users WHERE userid='" . $_POST['UserID'] . "'",$db); + if (DB_num_rows($result)==1){ + $InputError =1; + prnMsg(_('The user ID') . ' ' . $_POST['UserID'] . ' ' . _('already exists and cannot be used again'),'error'); + } + } + if ((mb_strlen($_POST['BranchCode'])>0) AND ($InputError !=1)) { // check that the entered branch is valid for the customer code $sql = "SELECT custbranch.debtorno @@ -113,7 +120,7 @@ $_POST['ModulesAllowed']= $ModulesAllowed; - if ($SelectedUser AND $InputError !=1) { + if (isset($SelectedUser) AND $InputError !=1) { /*SelectedUser 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*/ @@ -388,7 +395,7 @@ } else { //end of if $SelectedUser only do the else when a new record is being entered - echo '<table class=selection> + echo '<table class="selection"> <tr> <td>' . _('User Login') . ':</td> <td><input type="text" name="UserID" size="22" maxlength="20"></td></tr>'; @@ -447,7 +454,7 @@ $result = DB_query($sql,$db); while ($myrow=DB_fetch_array($result)){ - if (isset($_POST['DefaultLocation']) and $myrow['loccode'] == $_POST['DefaultLocation']){ + if (isset($_POST['DefaultLocation']) AND $myrow['loccode'] == $_POST['DefaultLocation']){ echo '<option selected value="' . $myrow['loccode'] . '">' . $myrow['locationname'] .'</option>'; } else { echo '<option Value="' . $myrow['loccode'] . '">' . $myrow['locationname'] .'</option>'; @@ -478,14 +485,14 @@ $sql = "SELECT salesmancode, salesmanname FROM salesman WHERE current = 1"; $result = DB_query($sql,$db); -if ((isset($_POST['Salesman']) and $_POST['Salesman']=='') OR !isset($_POST['Salesman'])){ +if ((isset($_POST['Salesman']) AND $_POST['Salesman']=='') OR !isset($_POST['Salesman'])){ echo '<option selected value="">' . _('Not a salesperson only login') . '</option>'; } else { echo '<option value="">' . _('Not a salesperson only login') . '</option>'; } while ($myrow=DB_fetch_array($result)){ - if (isset($_POST['Salesman']) and $myrow['salesmancode'] == $_POST['Salesman']){ + if (isset($_POST['Salesman']) AND $myrow['salesmancode'] == $_POST['Salesman']){ echo '<option selected value="' . $myrow['salesmancode'] . '">' . $myrow['salesmanname'] . '</option>'; } else { echo '<option value="' . $myrow['salesmancode'] . '">' . $myrow['salesmanname'] . '</option>'; @@ -498,42 +505,42 @@ echo '<tr><td>' . _('Reports Page Size') .':</td> <td><select name="PageSize">'; -if(isset($_POST['PageSize']) and $_POST['PageSize']=='A4'){ +if(isset($_POST['PageSize']) AND $_POST['PageSize']=='A4'){ echo '<option selected value="A4">' . _('A4') .'</option>'; } else { echo '<option value="A4">' . _('A4') . '</option>'; } -if(isset($_POST['PageSize']) and $_POST['PageSize']=='A3'){ +if(isset($_POST['PageSize']) AND $_POST['PageSize']=='A3'){ echo '<option selected value="A3">' . _('A3') .'</option>'; } else { echo '<option value="A3">' . _('A3') .'</option>'; } -if(isset($_POST['PageSize']) and $_POST['PageSize']=='A3_landscape'){ +if(isset($_POST['PageSize']) AND $_POST['PageSize']=='A3_landscape'){ echo '<option selected value="A3_landscape">' . _('A3') . ' ' . _('landscape') .'</option>'; } else { echo '<option value="A3_landscape">' . _('A3') . ' ' . _('landscape') .'</option>'; } -if(isset($_POST['PageSize']) and $_POST['PageSize']=='letter'){ +if(isset($_POST['PageSize']) AND $_POST['PageSize']=='letter'){ echo '<option selected value="letter">' . _('Letter') .'</option>'; } else { echo '<option value="letter">' . _('Letter') .'</option>'; } -if(isset($_POST['PageSize']) and $_POST['PageSize']=='letter_landscape'){ +if(isset($_POST['PageSize']) AND $_POST['PageSize']=='letter_landscape'){ echo '<option selected value="letter_landscape">' . _('Letter') . ' ' . _('landscape') .'</option>'; } else { echo '<option value="letter_landscape">' . _('Letter') . ' ' . _('landscape') .'</option>'; } -if(isset($_POST['PageSize']) and $_POST['PageSize']=='legal'){ +if(isset($_POST['PageSize']) AND $_POST['PageSize']=='legal'){ echo '<option selected value="legal">' . _('Legal') .'</option>'; } else { echo '<option value="legal">' . _('Legal') .'</option>'; } -if(isset($_POST['PageSize']) and $_POST['PageSize']=='legal_landscape'){ +if(isset($_POST['PageSize']) AND $_POST['PageSize']=='legal_landscape'){ echo '<option selected value="legal_landscape">' . _('Legal') . ' ' . _('landscape') .'</option>'; } else { echo '<option value="legal_landscape">' . _('Legal') . ' ' . _('landscape') .'</option>'; @@ -552,9 +559,9 @@ if (is_dir('css/' . $ThemeName) AND $ThemeName != '.' AND $ThemeName != '..' AND $ThemeName != '.svn'){ - if (isset($_POST['Theme']) and $_POST['Theme'] == $ThemeName){ + if (isset($_POST['Theme']) AND $_POST['Theme'] == $ThemeName){ echo '<option selected value="' . $ThemeName . '">' . $ThemeName .'</option>'; - } else if (!isset($_POST['Theme']) and ($_SESSION['DefaultTheme']==$ThemeName)) { + } else if (!isset($_POST['Theme']) AND ($_SESSION['DefaultTheme']==$ThemeName)) { echo '<option selected value="' . $ThemeName . '">' . $ThemeName .'</option>'; } else { echo '<option value="' . $ThemeName . '">' . $ThemeName .'</option>'; @@ -570,12 +577,12 @@ <td><select name="UserLanguage">'; foreach ($LanguagesArray as $LanguageEntry => $LanguageName){ - if (isset($_POST['UserLanguage']) and $_POST['UserLanguage'] == $LanguageEntry){ - echo '<option selected value="' . $LanguageEntry . '">' . $LanguageName .'</option>'; - } elseif (!isset($_POST['UserLanguage']) and $LanguageEntry == $DefaultLanguage) { - echo '<option selected value="' . $LanguageEntry . '">' . $LanguageName .'</option>'; + if (isset($_POST['UserLanguage']) AND $_POST['UserLanguage'] == $LanguageEntry){ + echo '<option selected value="' . $LanguageEntry . '">' . $LanguageName['LanguageName'] .'</option>'; + } elseif (!isset($_POST['UserLanguage']) AND $LanguageEntry == $DefaultLanguage) { + echo '<option selected value="' . $LanguageEntry . '">' . $LanguageName['LanguageName'] .'</option>'; } else { - echo '<option value="' . $LanguageEntry . '">' . $LanguageName .'</option>'; + echo '<option value="' . $LanguageEntry . '">' . $LanguageName['LanguageName'] .'</option>'; } } echo '</select></td></tr>'; Modified: trunk/doc/Change.log =================================================================== --- trunk/doc/Change.log 2011-09-16 10:29:26 UTC (rev 4691) +++ trunk/doc/Change.log 2011-09-16 23:15:08 UTC (rev 4692) @@ -1,6 +1,6 @@ webERP Change Log - +17/9/11 Felix Lim: added serialised field into PrintCustTransPortrait.php to reinstate possiblity for printing serialised items on invoice - not possible in landscape version (PrintCustTrans.php) 12/9/11 Phil/Exson/Tom: Change all scripts to allow display and input of numbers in the format of the selected users locale 5/9/11 Phil: Fixed supplier payment exchange rate ... was being calculated incorrectly from functional exchange rate and the exchange rate between the currency of the bank account and currency of payment. 5/9/11 Phil: GLTransInquiry posted was not retrieved correctly - now fixed Modified: trunk/includes/LanguageSetup.php =================================================================== --- trunk/includes/LanguageSetup.php 2011-09-16 10:29:26 UTC (rev 4691) +++ trunk/includes/LanguageSetup.php 2011-09-16 23:15:08 UTC (rev 4692) @@ -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 @@ -13,7 +13,7 @@ normally the lower case two character country code underscore uppercase 2 character country code does the trick except for en !!*/ -// Specify location of translation tables + If (isset($_POST['Language'])) { $_SESSION['Language'] = $_POST['Language']; $Language = $_POST['Language']; @@ -24,8 +24,14 @@ $Language = $_SESSION['Language']; } -$Locale = setlocale (LC_ALL, $_SESSION['Language']); -$Locale = setlocale (LC_NUMERIC, 'fr_FR.utf8'); +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']; @@ -33,11 +39,9 @@ if ($LocaleInfo['mon_thousands_sep']==''){ $LocaleInfo['mon_thousands_sep']= $LocaleInfo['thousands_sep']; } -if (defined('LC_MESSAGES')){ - $Locale = setlocale (LC_MESSAGES, $_SESSION['Language']); -} + //Turkish seems to be a special case if ($_SESSION['Language']=='tr_TR.utf8') { $Locale = setlocale(LC_CTYPE, 'C'); Modified: trunk/includes/LanguagesArray.php =================================================================== --- trunk/includes/LanguagesArray.php 2011-09-16 10:29:26 UTC (rev 4691) +++ trunk/includes/LanguagesArray.php 2011-09-16 23:15:08 UTC (rev 4692) @@ -1,32 +1,60 @@ <?php $LanguagesArray = array(); -$LanguagesArray['en_US.utf8'] = _('English US'); -$LanguagesArray['en_GB.utf8'] = _('English British'); -$LanguagesArray['cz_CZ.utf8'] = _('Czechoslovakian'); -$LanguagesArray['de_DE.utf8'] = _('German'); -$LanguagesArray['el_GR.utf8'] = _('Greek'); -$LanguagesArray['es_ES.utf8'] = _('Spanish'); -$LanguagesArray['et_EE.utf8'] = _('Estonian'); -$LanguagesArray['fa_IR.utf8'] = _('Arabic'); -$LanguagesArray['fr_FR.utf8'] = _('French'); -$LanguagesArray['hi_IN.utf8'] = _('Hindi'); -$LanguagesArray['hr_HR.utf8'] = _('Hungarian'); -$LanguagesArray['id_ID.utf8'] = _('Indonisian'); -$LanguagesArray['it_IT.utf8'] = _('Italian'); -$LanguagesArray['ja_JP.utf8'] = _('Japanese'); -$LanguagesArray['lv_LV.utf8'] = _('Latvian'); -$LanguagesArray['nl_NL.utf8'] = _('Dutch'); -$LanguagesArray['pl_PL.utf8'] = _('Polish'); -$LanguagesArray['pt_BR.utf8'] = _('Brazilian Portuguese'); -$LanguagesArray['pt_PT.utf8'] = _('Portuguese'); -$LanguagesArray['ro_RO.utf8'] = _('Roumanian'); -$LanguagesArray['ru_RU.utf8'] = _('Russian'); -$LanguagesArray['sq_AL.utf8'] = _('Albanian'); -$LanguagesArray['sv_SE.utf8'] = _('Sweedish'); -$LanguagesArray['sw_KE.utf8'] = _('Kiswahili'); -$LanguagesArray['tr_TR.utf8'] = _('Turkish'); -$LanguagesArray['vi_VN.utf8'] = _('Vietnamese'); -$LanguagesArray['zh_CN.utf8'] = _('Chinese - Simplified'); -$LanguagesArray['zh_HK.utf8'] = _('Chinese - Traditional'); +$LanguagesArray['en_US.utf8']['LanguageName'] = _('English US'); +$LanguagesArray['en_US.utf8']['WindowsLocale'] = 'english-us'; +$LanguagesArray['en_GB.utf8']['LanguageName'] = _('English British'); +$LanguagesArray['en_GB.utf8']['WindowsLocale'] = 'english-uk'; +$LanguagesArray['cz_CZ.utf8']['LanguageName'] = _('Czechoslovakian'); +$LanguagesArray['cz_CZ.utf8']['WindowsLocale'] = 'czech'; +$LanguagesArray['de_DE.utf8']['LanguageName'] = _('German'); +$LanguagesArray['de_DE.utf8']['WindowsLocale'] = 'german'; +$LanguagesArray['el_GR.utf8']['LanguageName'] = _('Greek'); +$LanguagesArray['el_GR.utf8']['WindowsLocale'] = 'greek'; +$LanguagesArray['es_ES.utf8']['LanguageName'] = _('Spanish'); +$LanguagesArray['es_ES.utf8']['WindowsLocale'] = 'spanish'; +$LanguagesArray['et_EE.utf8']['LanguageName'] = _('Estonian'); +$LanguagesArray['et_EE.utf8']['WindowsLocale'] = 'estonian'; +$LanguagesArray['fa_IR.utf8']['LanguageName'] = _('Arabic'); +$LanguagesArray['fa_IR.utf8']['WindowsLocale'] = 'arabic'; +$LanguagesArray['fr_FR.utf8']['LanguageName'] = _('French'); +$LanguagesArray['fr_FR.utf8']['WindowsLocale'] = 'french'; +$LanguagesArray['hi_IN.utf8']['LanguageName'] = _('Hindi'); +$LanguagesArray['hi_IN.utf8']['WindowsLocale'] = 'hindi'; +$LanguagesArray['hr_HR.utf8']['LanguageName'] = _('Hungarian'); +$LanguagesArray['hr_HR.utf8']['WindowsLocale'] = 'hungarian'; +$LanguagesArray['id_ID.utf8']['LanguageName'] = _('Indonisian'); +$LanguagesArray['id_ID.utf8']['WindowsLocale'] = 'indonesian'; +$LanguagesArray['it_IT.utf8']['LanguageName'] = _('Italian'); +$LanguagesArray['it_IT.utf8']['WindowsLocale'] = 'italian'; +$LanguagesArray['ja_JP.utf8']['LanguageName'] = _('Japanese'); +$LanguagesArray['ja_JP.utf8']['WindowsLocale'] = 'japanese'; +$LanguagesArray['lv_LV.utf8']['LanguageName'] = _('Latvian'); +$LanguagesArray['lv_LV.utf8']['WindowsLocale'] = 'latvian'; +$LanguagesArray['nl_NL.utf8']['LanguageName'] = _('Dutch'); +$LanguagesArray['nl_NL.utf8']['WindowsLocale'] = 'dutch'; +$LanguagesArray['pl_PL.utf8']['LanguageName'] = _('Polish'); +$LanguagesArray['pl_PL.utf8']['WindowsLocale'] = 'polish'; +$LanguagesArray['pt_BR.utf8']['LanguageName'] = _('Brazilian Portuguese'); +$LanguagesArray['pt_BR.utf8']['WindowsLocale'] = 'portuguese-brazil'; +$LanguagesArray['pt_PT.utf8']['LanguageName'] = _('Portuguese'); +$LanguagesArray['pt_PT.utf8']['WindowsLocale'] = 'portuguese'; +$LanguagesArray['ro_RO.utf8']['LanguageName'] = _('Romanian'); +$LanguagesArray['ro_RO.utf8']['WindowsLocale'] = 'romanian'; +$LanguagesArray['ru_RU.utf8']['LanguageName'] = _('Russian'); +$LanguagesArray['ru_RU.utf8']['WindowsLocale'] = 'russian'; +$LanguagesArray['sq_AL.utf8']['LanguageName'] = _('Albanian'); +$LanguagesArray['sq_AL.utf8']['WindowsLocale'] = 'english-us'; +$LanguagesArray['sv_SE.utf8']['LanguageName'] = _('Sweedish'); +$LanguagesArray['sv_SE.utf8']['WindowsLocale'] = 'swedish'; +$LanguagesArray['sw_KE.utf8']['LanguageName'] = _('Kiswahili'); +$LanguagesArray['sw_KE.utf8']['WindowsLocale'] = 'english-us'; +$LanguagesArray['tr_TR.utf8']['LanguageName'] = _('Turkish'); +$LanguagesArray['tr_TR.utf8']['WindowsLocale'] = 'turkish'; +$LanguagesArray['vi_VN.utf8']['LanguageName'] = _('Vietnamese'); +$LanguagesArray['vi_VN.utf8']['WindowsLocale'] = 'vietnamese'; +$LanguagesArray['zh_CN.utf8']['LanguageName'] = _('Chinese - Simplified'); +$LanguagesArray['zh_CN.utf8']['WindowsLocale'] = 'chinese-simplified'; +$LanguagesArray['zh_HK.utf8']['LanguageName'] = _('Chinese - Traditional'); +$LanguagesArray['zh_HK.utf8']['WindowsLocale'] = 'chinese-traditional'; asort($LanguagesArray); -?> +?> \ 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-16 23:15:15
|
Revision: 4692 http://web-erp.svn.sourceforge.net/web-erp/?rev=4692&view=rev Author: daintree Date: 2011-09-16 23:15:08 +0000 (Fri, 16 Sep 2011) Log Message: ----------- make windows use the correct locale Modified Paths: -------------- trunk/DeliveryDetails.php trunk/PrintCustTrans.php trunk/PrintCustTransPortrait.php trunk/UserSettings.php trunk/WWW_Users.php trunk/doc/Change.log trunk/includes/LanguageSetup.php trunk/includes/LanguagesArray.php Modified: trunk/DeliveryDetails.php =================================================================== --- trunk/DeliveryDetails.php 2011-09-16 10:29:26 UTC (rev 4691) +++ trunk/DeliveryDetails.php 2011-09-16 23:15:08 UTC (rev 4692) @@ -44,7 +44,7 @@ /*store the old freight cost before it is recalculated to ensure that there has been no change - test for change after freight recalculated and get user to re-confirm if changed */ - $OldFreightCost = round(filter_number_format($_POST['FreightCost']),2); + $OldFreightCost = round(filter_number_format($_POST['FreightCost']),$_SESSION['Items'.$identifier]->CurrDecimalPlaces); } @@ -119,7 +119,7 @@ if ($_SESSION['DoFreightCalc']==True){ list ($_POST['FreightCost'], $BestShipper) = CalcFreightCost($_SESSION['Items'.$identifier]->total, $_POST['BrAdd2'], $_POST['BrAdd3'], $_SESSION['Items'.$identifier]->totalVolume, $_SESSION['Items'.$identifier]->totalWeight, $_SESSION['Items'.$identifier]->Location, $db); if ( !empty($BestShipper) ){ - $_POST['FreightCost'] = round(filter_number_format($_POST['FreightCost']),2); + $_POST['FreightCost'] = round(filter_number_format($_POST['FreightCost']),$_SESSION['Items'.$identifier]->CurrDecimalPlaces); $_POST['ShipVia'] = $BestShipper; } else { prnMsg(_($_POST['FreightCost']),'warn'); @@ -183,7 +183,7 @@ $_SESSION['Items'.$identifier]->ConfirmedDate = $_POST['ConfirmedDate']; $_SESSION['Items'.$identifier]->CustRef = $_POST['CustRef']; $_SESSION['Items'.$identifier]->Comments = $_POST['Comments']; - $_SESSION['Items'.$identifier]->FreightCost = round(filter_number_format($_POST['FreightCost']),2); + $_SESSION['Items'.$identifier]->FreightCost = round(filter_number_format($_POST['FreightCost']),$_SESSION['Items'.$identifier]->CurrDecimalPlaces); $_SESSION['Items'.$identifier]->Quotation = $_POST['Quotation']; } else { $_SESSION['Items'.$identifier]->DeliverTo = $_POST['DeliverTo']; @@ -200,13 +200,13 @@ $_SESSION['Items'.$identifier]->ShipVia = $_POST['ShipVia']; $_SESSION['Items'.$identifier]->DeliverBlind = $_POST['DeliverBlind']; $_SESSION['Items'.$identifier]->SpecialInstructions = $_POST['SpecialInstructions']; - $_SESSION['Items'.$identifier]->DeliveryDays = filter_number_format$_POST['DeliveryDays']); + $_SESSION['Items'.$identifier]->DeliveryDays = filter_number_format($_POST['DeliveryDays']); $_SESSION['Items'.$identifier]->DeliveryDate = $_POST['DeliveryDate']; $_SESSION['Items'.$identifier]->QuoteDate = $_POST['QuoteDate']; $_SESSION['Items'.$identifier]->ConfirmedDate = $_POST['ConfirmedDate']; $_SESSION['Items'.$identifier]->CustRef = $_POST['CustRef']; $_SESSION['Items'.$identifier]->Comments = $_POST['Comments']; - $_SESSION['Items'.$identifier]->FreightCost = round(filter_number_format($_POST['FreightCost']),2); + $_SESSION['Items'.$identifier]->FreightCost = round(filter_number_format($_POST['FreightCost']),$_SESSION['Items'.$identifier]->CurrDecimalPlaces); $_SESSION['Items'.$identifier]->Quotation = $_POST['Quotation']; } /*$_SESSION['DoFreightCalc'] is a setting in the config.php file that the user can set to false to turn off freight calculations if necessary */ Modified: trunk/PrintCustTrans.php =================================================================== --- trunk/PrintCustTrans.php 2011-09-16 10:29:26 UTC (rev 4691) +++ trunk/PrintCustTrans.php 2011-09-16 23:15:08 UTC (rev 4692) @@ -231,10 +231,9 @@ stockmoves.narrative, stockmaster.units, stockmaster.decimalplaces - FROM stockmoves, - stockmaster - WHERE stockmoves.stockid = stockmaster.stockid - AND stockmoves.type=10 + FROM stockmoves INNER JOIN stockmaster + ON stockmoves.stockid = stockmaster.stockid + WHERE stockmoves.type=10 AND stockmoves.transno=" . $FromTransNo . " AND stockmoves.show_on_inv_crds=1"; } else { @@ -248,10 +247,9 @@ stockmoves.narrative, stockmaster.units, stockmaster.decimalplaces - FROM stockmoves, - stockmaster - WHERE stockmoves.stockid = stockmaster.stockid - AND stockmoves.type=11 + FROM stockmoves INNER JOIN stockmaster + ON stockmoves.stockid = stockmaster.stockid + WHERE stockmoves.type=11 AND stockmoves.transno=" . $FromTransNo . " AND stockmoves.show_on_inv_crds=1"; } // end else Modified: trunk/PrintCustTransPortrait.php =================================================================== --- trunk/PrintCustTransPortrait.php 2011-09-16 10:29:26 UTC (rev 4691) +++ trunk/PrintCustTransPortrait.php 2011-09-16 23:15:08 UTC (rev 4692) @@ -253,6 +253,7 @@ (stockmoves.price * " . $ExchRate . ") AS fxprice, stockmoves.narrative, stockmaster.controlled, + stockmaster.serialised, stockmaster.units, stockmoves.stkmoveno, stockmaster.decimalplaces @@ -271,6 +272,7 @@ (stockmoves.price * " . $ExchRate . ") AS fxprice, stockmoves.narrative, stockmaster.controlled, + stockmaster.serialised, stockmaster.units, stockmoves.stkmoveno, stockmaster.decimalplaces Modified: trunk/UserSettings.php =================================================================== --- trunk/UserSettings.php 2011-09-16 10:29:26 UTC (rev 4691) +++ trunk/UserSettings.php 2011-09-16 23:15:08 UTC (rev 4692) @@ -5,7 +5,6 @@ include('includes/session.inc'); $title = _('User Settings'); include('includes/header.inc'); -include('includes/LanguagesArray.php'); echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/user.png" title="' . _('User Settings') . '" alt="" />' . ' ' . _('User Settings') . '</p>'; @@ -134,11 +133,11 @@ foreach ($LanguagesArray as $LanguageEntry => $LanguageName){ if (isset($_POST['Language']) AND $_POST['Language'] == $LanguageEntry){ - echo '<option selected value="' . $LanguageEntry . '">' . $LanguageName .'</option>'; + echo '<option selected value="' . $LanguageEntry . '">' . $LanguageName['LanguageName'] .'</option>'; } elseif (!isset($_POST['Language']) AND $LanguageEntry == $DefaultLanguage) { - echo '<option selected value="' . $LanguageEntry . '">' . $LanguageName .'</option>'; + echo '<option selected value="' . $LanguageEntry . '">' . $LanguageName['LanguageName'] .'</option>'; } else { - echo '<option value="' . $LanguageEntry . '">' . $LanguageName .'</option>'; + echo '<option value="' . $LanguageEntry . '">' . $LanguageName['LanguageName'] .'</option>'; } } echo '</select></td></tr>'; Modified: trunk/WWW_Users.php =================================================================== --- trunk/WWW_Users.php 2011-09-16 10:29:26 UTC (rev 4691) +++ trunk/WWW_Users.php 2011-09-16 23:15:08 UTC (rev 4692) @@ -8,7 +8,6 @@ } } include('includes/session.inc'); -include ('includes/LanguagesArray.php'); $ModuleList = array(_('Orders'), _('Receivables'), @@ -84,7 +83,15 @@ $InputError = 1; } */ - + if (!isset($SelectedUser)){ + /* check to ensure the user id is not already entered */ + $result = DB_query("SELECT userid FROM www_users WHERE userid='" . $_POST['UserID'] . "'",$db); + if (DB_num_rows($result)==1){ + $InputError =1; + prnMsg(_('The user ID') . ' ' . $_POST['UserID'] . ' ' . _('already exists and cannot be used again'),'error'); + } + } + if ((mb_strlen($_POST['BranchCode'])>0) AND ($InputError !=1)) { // check that the entered branch is valid for the customer code $sql = "SELECT custbranch.debtorno @@ -113,7 +120,7 @@ $_POST['ModulesAllowed']= $ModulesAllowed; - if ($SelectedUser AND $InputError !=1) { + if (isset($SelectedUser) AND $InputError !=1) { /*SelectedUser 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*/ @@ -388,7 +395,7 @@ } else { //end of if $SelectedUser only do the else when a new record is being entered - echo '<table class=selection> + echo '<table class="selection"> <tr> <td>' . _('User Login') . ':</td> <td><input type="text" name="UserID" size="22" maxlength="20"></td></tr>'; @@ -447,7 +454,7 @@ $result = DB_query($sql,$db); while ($myrow=DB_fetch_array($result)){ - if (isset($_POST['DefaultLocation']) and $myrow['loccode'] == $_POST['DefaultLocation']){ + if (isset($_POST['DefaultLocation']) AND $myrow['loccode'] == $_POST['DefaultLocation']){ echo '<option selected value="' . $myrow['loccode'] . '">' . $myrow['locationname'] .'</option>'; } else { echo '<option Value="' . $myrow['loccode'] . '">' . $myrow['locationname'] .'</option>'; @@ -478,14 +485,14 @@ $sql = "SELECT salesmancode, salesmanname FROM salesman WHERE current = 1"; $result = DB_query($sql,$db); -if ((isset($_POST['Salesman']) and $_POST['Salesman']=='') OR !isset($_POST['Salesman'])){ +if ((isset($_POST['Salesman']) AND $_POST['Salesman']=='') OR !isset($_POST['Salesman'])){ echo '<option selected value="">' . _('Not a salesperson only login') . '</option>'; } else { echo '<option value="">' . _('Not a salesperson only login') . '</option>'; } while ($myrow=DB_fetch_array($result)){ - if (isset($_POST['Salesman']) and $myrow['salesmancode'] == $_POST['Salesman']){ + if (isset($_POST['Salesman']) AND $myrow['salesmancode'] == $_POST['Salesman']){ echo '<option selected value="' . $myrow['salesmancode'] . '">' . $myrow['salesmanname'] . '</option>'; } else { echo '<option value="' . $myrow['salesmancode'] . '">' . $myrow['salesmanname'] . '</option>'; @@ -498,42 +505,42 @@ echo '<tr><td>' . _('Reports Page Size') .':</td> <td><select name="PageSize">'; -if(isset($_POST['PageSize']) and $_POST['PageSize']=='A4'){ +if(isset($_POST['PageSize']) AND $_POST['PageSize']=='A4'){ echo '<option selected value="A4">' . _('A4') .'</option>'; } else { echo '<option value="A4">' . _('A4') . '</option>'; } -if(isset($_POST['PageSize']) and $_POST['PageSize']=='A3'){ +if(isset($_POST['PageSize']) AND $_POST['PageSize']=='A3'){ echo '<option selected value="A3">' . _('A3') .'</option>'; } else { echo '<option value="A3">' . _('A3') .'</option>'; } -if(isset($_POST['PageSize']) and $_POST['PageSize']=='A3_landscape'){ +if(isset($_POST['PageSize']) AND $_POST['PageSize']=='A3_landscape'){ echo '<option selected value="A3_landscape">' . _('A3') . ' ' . _('landscape') .'</option>'; } else { echo '<option value="A3_landscape">' . _('A3') . ' ' . _('landscape') .'</option>'; } -if(isset($_POST['PageSize']) and $_POST['PageSize']=='letter'){ +if(isset($_POST['PageSize']) AND $_POST['PageSize']=='letter'){ echo '<option selected value="letter">' . _('Letter') .'</option>'; } else { echo '<option value="letter">' . _('Letter') .'</option>'; } -if(isset($_POST['PageSize']) and $_POST['PageSize']=='letter_landscape'){ +if(isset($_POST['PageSize']) AND $_POST['PageSize']=='letter_landscape'){ echo '<option selected value="letter_landscape">' . _('Letter') . ' ' . _('landscape') .'</option>'; } else { echo '<option value="letter_landscape">' . _('Letter') . ' ' . _('landscape') .'</option>'; } -if(isset($_POST['PageSize']) and $_POST['PageSize']=='legal'){ +if(isset($_POST['PageSize']) AND $_POST['PageSize']=='legal'){ echo '<option selected value="legal">' . _('Legal') .'</option>'; } else { echo '<option value="legal">' . _('Legal') .'</option>'; } -if(isset($_POST['PageSize']) and $_POST['PageSize']=='legal_landscape'){ +if(isset($_POST['PageSize']) AND $_POST['PageSize']=='legal_landscape'){ echo '<option selected value="legal_landscape">' . _('Legal') . ' ' . _('landscape') .'</option>'; } else { echo '<option value="legal_landscape">' . _('Legal') . ' ' . _('landscape') .'</option>'; @@ -552,9 +559,9 @@ if (is_dir('css/' . $ThemeName) AND $ThemeName != '.' AND $ThemeName != '..' AND $ThemeName != '.svn'){ - if (isset($_POST['Theme']) and $_POST['Theme'] == $ThemeName){ + if (isset($_POST['Theme']) AND $_POST['Theme'] == $ThemeName){ echo '<option selected value="' . $ThemeName . '">' . $ThemeName .'</option>'; - } else if (!isset($_POST['Theme']) and ($_SESSION['DefaultTheme']==$ThemeName)) { + } else if (!isset($_POST['Theme']) AND ($_SESSION['DefaultTheme']==$ThemeName)) { echo '<option selected value="' . $ThemeName . '">' . $ThemeName .'</option>'; } else { echo '<option value="' . $ThemeName . '">' . $ThemeName .'</option>'; @@ -570,12 +577,12 @@ <td><select name="UserLanguage">'; foreach ($LanguagesArray as $LanguageEntry => $LanguageName){ - if (isset($_POST['UserLanguage']) and $_POST['UserLanguage'] == $LanguageEntry){ - echo '<option selected value="' . $LanguageEntry . '">' . $LanguageName .'</option>'; - } elseif (!isset($_POST['UserLanguage']) and $LanguageEntry == $DefaultLanguage) { - echo '<option selected value="' . $LanguageEntry . '">' . $LanguageName .'</option>'; + if (isset($_POST['UserLanguage']) AND $_POST['UserLanguage'] == $LanguageEntry){ + echo '<option selected value="' . $LanguageEntry . '">' . $LanguageName['LanguageName'] .'</option>'; + } elseif (!isset($_POST['UserLanguage']) AND $LanguageEntry == $DefaultLanguage) { + echo '<option selected value="' . $LanguageEntry . '">' . $LanguageName['LanguageName'] .'</option>'; } else { - echo '<option value="' . $LanguageEntry . '">' . $LanguageName .'</option>'; + echo '<option value="' . $LanguageEntry . '">' . $LanguageName['LanguageName'] .'</option>'; } } echo '</select></td></tr>'; Modified: trunk/doc/Change.log =================================================================== --- trunk/doc/Change.log 2011-09-16 10:29:26 UTC (rev 4691) +++ trunk/doc/Change.log 2011-09-16 23:15:08 UTC (rev 4692) @@ -1,6 +1,6 @@ webERP Change Log - +17/9/11 Felix Lim: added serialised field into PrintCustTransPortrait.php to reinstate possiblity for printing serialised items on invoice - not possible in landscape version (PrintCustTrans.php) 12/9/11 Phil/Exson/Tom: Change all scripts to allow display and input of numbers in the format of the selected users locale 5/9/11 Phil: Fixed supplier payment exchange rate ... was being calculated incorrectly from functional exchange rate and the exchange rate between the currency of the bank account and currency of payment. 5/9/11 Phil: GLTransInquiry posted was not retrieved correctly - now fixed Modified: trunk/includes/LanguageSetup.php =================================================================== --- trunk/includes/LanguageSetup.php 2011-09-16 10:29:26 UTC (rev 4691) +++ trunk/includes/LanguageSetup.php 2011-09-16 23:15:08 UTC (rev 4692) @@ -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 @@ -13,7 +13,7 @@ normally the lower case two character country code underscore uppercase 2 character country code does the trick except for en !!*/ -// Specify location of translation tables + If (isset($_POST['Language'])) { $_SESSION['Language'] = $_POST['Language']; $Language = $_POST['Language']; @@ -24,8 +24,14 @@ $Language = $_SESSION['Language']; } -$Locale = setlocale (LC_ALL, $_SESSION['Language']); -$Locale = setlocale (LC_NUMERIC, 'fr_FR.utf8'); +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']; @@ -33,11 +39,9 @@ if ($LocaleInfo['mon_thousands_sep']==''){ $LocaleInfo['mon_thousands_sep']= $LocaleInfo['thousands_sep']; } -if (defined('LC_MESSAGES')){ - $Locale = setlocale (LC_MESSAGES, $_SESSION['Language']); -} + //Turkish seems to be a special case if ($_SESSION['Language']=='tr_TR.utf8') { $Locale = setlocale(LC_CTYPE, 'C'); Modified: trunk/includes/LanguagesArray.php =================================================================== --- trunk/includes/LanguagesArray.php 2011-09-16 10:29:26 UTC (rev 4691) +++ trunk/includes/LanguagesArray.php 2011-09-16 23:15:08 UTC (rev 4692) @@ -1,32 +1,60 @@ <?php $LanguagesArray = array(); -$LanguagesArray['en_US.utf8'] = _('English US'); -$LanguagesArray['en_GB.utf8'] = _('English British'); -$LanguagesArray['cz_CZ.utf8'] = _('Czechoslovakian'); -$LanguagesArray['de_DE.utf8'] = _('German'); -$LanguagesArray['el_GR.utf8'] = _('Greek'); -$LanguagesArray['es_ES.utf8'] = _('Spanish'); -$LanguagesArray['et_EE.utf8'] = _('Estonian'); -$LanguagesArray['fa_IR.utf8'] = _('Arabic'); -$LanguagesArray['fr_FR.utf8'] = _('French'); -$LanguagesArray['hi_IN.utf8'] = _('Hindi'); -$LanguagesArray['hr_HR.utf8'] = _('Hungarian'); -$LanguagesArray['id_ID.utf8'] = _('Indonisian'); -$LanguagesArray['it_IT.utf8'] = _('Italian'); -$LanguagesArray['ja_JP.utf8'] = _('Japanese'); -$LanguagesArray['lv_LV.utf8'] = _('Latvian'); -$LanguagesArray['nl_NL.utf8'] = _('Dutch'); -$LanguagesArray['pl_PL.utf8'] = _('Polish'); -$LanguagesArray['pt_BR.utf8'] = _('Brazilian Portuguese'); -$LanguagesArray['pt_PT.utf8'] = _('Portuguese'); -$LanguagesArray['ro_RO.utf8'] = _('Roumanian'); -$LanguagesArray['ru_RU.utf8'] = _('Russian'); -$LanguagesArray['sq_AL.utf8'] = _('Albanian'); -$LanguagesArray['sv_SE.utf8'] = _('Sweedish'); -$LanguagesArray['sw_KE.utf8'] = _('Kiswahili'); -$LanguagesArray['tr_TR.utf8'] = _('Turkish'); -$LanguagesArray['vi_VN.utf8'] = _('Vietnamese'); -$LanguagesArray['zh_CN.utf8'] = _('Chinese - Simplified'); -$LanguagesArray['zh_HK.utf8'] = _('Chinese - Traditional'); +$LanguagesArray['en_US.utf8']['LanguageName'] = _('English US'); +$LanguagesArray['en_US.utf8']['WindowsLocale'] = 'english-us'; +$LanguagesArray['en_GB.utf8']['LanguageName'] = _('English British'); +$LanguagesArray['en_GB.utf8']['WindowsLocale'] = 'english-uk'; +$LanguagesArray['cz_CZ.utf8']['LanguageName'] = _('Czechoslovakian'); +$LanguagesArray['cz_CZ.utf8']['WindowsLocale'] = 'czech'; +$LanguagesArray['de_DE.utf8']['LanguageName'] = _('German'); +$LanguagesArray['de_DE.utf8']['WindowsLocale'] = 'german'; +$LanguagesArray['el_GR.utf8']['LanguageName'] = _('Greek'); +$LanguagesArray['el_GR.utf8']['WindowsLocale'] = 'greek'; +$LanguagesArray['es_ES.utf8']['LanguageName'] = _('Spanish'); +$LanguagesArray['es_ES.utf8']['WindowsLocale'] = 'spanish'; +$LanguagesArray['et_EE.utf8']['LanguageName'] = _('Estonian'); +$LanguagesArray['et_EE.utf8']['WindowsLocale'] = 'estonian'; +$LanguagesArray['fa_IR.utf8']['LanguageName'] = _('Arabic'); +$LanguagesArray['fa_IR.utf8']['WindowsLocale'] = 'arabic'; +$LanguagesArray['fr_FR.utf8']['LanguageName'] = _('French'); +$LanguagesArray['fr_FR.utf8']['WindowsLocale'] = 'french'; +$LanguagesArray['hi_IN.utf8']['LanguageName'] = _('Hindi'); +$LanguagesArray['hi_IN.utf8']['WindowsLocale'] = 'hindi'; +$LanguagesArray['hr_HR.utf8']['LanguageName'] = _('Hungarian'); +$LanguagesArray['hr_HR.utf8']['WindowsLocale'] = 'hungarian'; +$LanguagesArray['id_ID.utf8']['LanguageName'] = _('Indonisian'); +$LanguagesArray['id_ID.utf8']['WindowsLocale'] = 'indonesian'; +$LanguagesArray['it_IT.utf8']['LanguageName'] = _('Italian'); +$LanguagesArray['it_IT.utf8']['WindowsLocale'] = 'italian'; +$LanguagesArray['ja_JP.utf8']['LanguageName'] = _('Japanese'); +$LanguagesArray['ja_JP.utf8']['WindowsLocale'] = 'japanese'; +$LanguagesArray['lv_LV.utf8']['LanguageName'] = _('Latvian'); +$LanguagesArray['lv_LV.utf8']['WindowsLocale'] = 'latvian'; +$LanguagesArray['nl_NL.utf8']['LanguageName'] = _('Dutch'); +$LanguagesArray['nl_NL.utf8']['WindowsLocale'] = 'dutch'; +$LanguagesArray['pl_PL.utf8']['LanguageName'] = _('Polish'); +$LanguagesArray['pl_PL.utf8']['WindowsLocale'] = 'polish'; +$LanguagesArray['pt_BR.utf8']['LanguageName'] = _('Brazilian Portuguese'); +$LanguagesArray['pt_BR.utf8']['WindowsLocale'] = 'portuguese-brazil'; +$LanguagesArray['pt_PT.utf8']['LanguageName'] = _('Portuguese'); +$LanguagesArray['pt_PT.utf8']['WindowsLocale'] = 'portuguese'; +$LanguagesArray['ro_RO.utf8']['LanguageName'] = _('Romanian'); +$LanguagesArray['ro_RO.utf8']['WindowsLocale'] = 'romanian'; +$LanguagesArray['ru_RU.utf8']['LanguageName'] = _('Russian'); +$LanguagesArray['ru_RU.utf8']['WindowsLocale'] = 'russian'; +$LanguagesArray['sq_AL.utf8']['LanguageName'] = _('Albanian'); +$LanguagesArray['sq_AL.utf8']['WindowsLocale'] = 'english-us'; +$LanguagesArray['sv_SE.utf8']['LanguageName'] = _('Sweedish'); +$LanguagesArray['sv_SE.utf8']['WindowsLocale'] = 'swedish'; +$LanguagesArray['sw_KE.utf8']['LanguageName'] = _('Kiswahili'); +$LanguagesArray['sw_KE.utf8']['WindowsLocale'] = 'english-us'; +$LanguagesArray['tr_TR.utf8']['LanguageName'] = _('Turkish'); +$LanguagesArray['tr_TR.utf8']['WindowsLocale'] = 'turkish'; +$LanguagesArray['vi_VN.utf8']['LanguageName'] = _('Vietnamese'); +$LanguagesArray['vi_VN.utf8']['WindowsLocale'] = 'vietnamese'; +$LanguagesArray['zh_CN.utf8']['LanguageName'] = _('Chinese - Simplified'); +$LanguagesArray['zh_CN.utf8']['WindowsLocale'] = 'chinese-simplified'; +$LanguagesArray['zh_HK.utf8']['LanguageName'] = _('Chinese - Traditional'); +$LanguagesArray['zh_HK.utf8']['WindowsLocale'] = 'chinese-traditional'; asort($LanguagesArray); -?> +?> \ 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-16 10:29:32
|
Revision: 4691 http://web-erp.svn.sourceforge.net/web-erp/?rev=4691&view=rev Author: daintree Date: 2011-09-16 10:29:26 +0000 (Fri, 16 Sep 2011) Log Message: ----------- number_formats Modified Paths: -------------- trunk/PDFSuppTransListing.php trunk/PDFTopItems.php trunk/PO_AuthorisationLevels.php Modified: trunk/PDFSuppTransListing.php =================================================================== --- trunk/PDFSuppTransListing.php 2011-09-14 09:57:45 UTC (rev 4690) +++ trunk/PDFSuppTransListing.php 2011-09-16 10:29:26 UTC (rev 4691) @@ -26,7 +26,7 @@ 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 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> @@ -59,8 +59,14 @@ trandate, ovamount, ovgst, - transtext - FROM supptrans + transtext, + currcode, + decimalplaces AS currdecimalplaces, + suppname + FROM supptrans INNER JOIN suppliers + ON supptrans.supplierno = suppliers.supplierno + INNER JOIN currencies + ON suppliers.currcode=currencies.currabrev WHERE type='" . $_POST['TransType'] . "' AND date_format(inputdate, '%Y-%m-%d')='".FormatDateForSQL($_POST['Date'])."'"; @@ -97,17 +103,13 @@ include ('includes/PDFSuppTransListingPageHeader.inc'); while ($myrow=DB_fetch_array($result)){ - - $sql="SELECT suppname FROM suppliers WHERE supplierid='" . $myrow['supplierno']."'"; - $supplierresult=DB_query($sql, $db); - $supplierrow=DB_fetch_array($supplierresult); - - $LeftOvers = $pdf->addTextWrap($Left_Margin,$YPos,160,$FontSize,$supplierrow['suppname'], 'left'); + $CurrDecimalPlaces = $myrow['currdecimalplaces']; + $LeftOvers = $pdf->addTextWrap($Left_Margin,$YPos,160,$FontSize,$myrow['suppname'], 'left'); $LeftOvers = $pdf->addTextWrap($Left_Margin+162,$YPos,80,$FontSize,$myrow['suppreference'], 'left'); $LeftOvers = $pdf->addTextWrap($Left_Margin+242,$YPos,70,$FontSize,ConvertSQLDate($myrow['trandate']), 'left'); - $LeftOvers = $pdf->addTextWrap($Left_Margin+312,$YPos,70,$FontSize,locale_number_format($myrow['ovamount'],2), 'right'); - $LeftOvers = $pdf->addTextWrap($Left_Margin+382,$YPos,70,$FontSize,locale_number_format($myrow['ovgst'],2), 'right'); - $LeftOvers = $pdf->addTextWrap($Left_Margin+452,$YPos,70,$FontSize,locale_number_format($myrow['ovamount']+$myrow['ovgst'],2), 'right'); + $LeftOvers = $pdf->addTextWrap($Left_Margin+312,$YPos,70,$FontSize,locale_money_format($myrow['ovamount'],$CurrDecimalPlaces), 'right'); + $LeftOvers = $pdf->addTextWrap($Left_Margin+382,$YPos,70,$FontSize,locale_money_format($myrow['ovgst'],$CurrDecimalPlaces), 'right'); + $LeftOvers = $pdf->addTextWrap($Left_Margin+452,$YPos,70,$FontSize,locale_money_format($myrow['ovamount']+$myrow['ovgst'],$CurrDecimalPlaces), 'right'); $YPos -= ($line_height); $TotalCheques = $TotalCheques - $myrow['ovamount']; @@ -121,10 +123,10 @@ $YPos-=$line_height; -$LeftOvers = $pdf->addTextWrap($Left_Margin+452,$YPos,70,$FontSize,locale_number_format(-$TotalCheques,2), 'right'); +$LeftOvers = $pdf->addTextWrap($Left_Margin+452,$YPos,70,$FontSize,locale_money_format(-$TotalCheques,$CurrDecimalPlaces), 'right'); $LeftOvers = $pdf->addTextWrap($Left_Margin+265,$YPos,300,$FontSize,_('Total') . ' ' . _('Transactions'), 'left'); $ReportFileName = $_SESSION['DatabaseName'] . '_SuppTransListing_' . date('Y-m-d').'.pdf'; $pdf->OutputD($ReportFileName); -$pdf->__destruct(); +$pdf->__destruct(); ?> \ No newline at end of file Modified: trunk/PDFTopItems.php =================================================================== --- trunk/PDFTopItems.php 2011-09-14 09:57:45 UTC (rev 4690) +++ trunk/PDFTopItems.php 2011-09-16 10:29:26 UTC (rev 4691) @@ -40,10 +40,10 @@ AND salesorderdetails.stkcode = stockmaster.stockid AND salesorders.debtorno = debtorsmaster.debtorno AND debtorsmaster.typeid = '" . $_GET['Customers'] . "' - AND salesorderdetails.ActualDispatchDate >= '" . $FromDate . "' + AND salesorderdetails.ActualDispatchDate >= '" . $FromDate . "' GROUP BY salesorderdetails.stkcode ORDER BY " . $_GET['Sequence'] . " DESC - LIMIT " . $_GET['NumberOfTopItems']; + LIMIT " . filter_number_format($_GET['NumberOfTopItems']); } else { //the situation if the customer type selected "All" if ($_GET['Customers'] == 'All') { @@ -58,10 +58,10 @@ AND salesorderdetails.stkcode = stockmaster.stockid AND salesorders.debtorno = debtorsmaster.debtorno AND salesorders.fromstkloc = '" . $_GET['Location'] . "' - AND salesorderdetails.ActualDispatchDate >= '" . $FromDate . "' + AND salesorderdetails.ActualDispatchDate >= '" . $FromDate . "' GROUP BY salesorderdetails.stkcode ORDER BY " . $_GET['Sequence'] . " DESC - LIMIT 0," . $_GET['NumberOfTopItems']; + LIMIT 0," . filter_number_format($_GET['NumberOfTopItems']); } else { //the situation if the location and customer type not selected "All" $SQL = "SELECT salesorderdetails.stkcode, @@ -76,10 +76,10 @@ AND salesorders.debtorno = debtorsmaster.debtorno AND salesorders.fromstkloc = '" . $_GET['Location'] . "' AND debtorsmaster.typeid = '" . $_GET['Customers'] . "' - AND salesorderdetails.actualdispatchdate >= '" . $FromDate . "' + AND salesorderdetails.actualdispatchdate >= '" . $FromDate . "' GROUP BY salesorderdetails.stkcode ORDER BY " . $_GET['Sequence'] . " DESC - LIMIT " . $_GET['NumberOfTopItems']; + LIMIT " . filter_number_format($_GET['NumberOfTopItems']); } } } @@ -97,7 +97,7 @@ $LeftOvers = $pdf->addTextWrap($Left_Margin + 100, $YPos, 100, $FontSize, $myrow['description']); $LeftOvers = $pdf->addTextWrap($Left_Margin + 330, $YPos, 30, $FontSize, locale_number_format($myrow['totalinvoiced'],$myrow['decimalplaces']), 'right'); $LeftOvers = $pdf->addTextWrap($Left_Margin + 370, $YPos, 300 - $Left_Margin, $FontSize, $myrow['units'], 'left'); - $LeftOvers = $pdf->addTextWrap($Left_Margin + 400, $YPos, 70, $FontSize, locale_number_format($myrow['valuesales'], $_SESSION['CompanyRecord']['decimalplaces']), 'right'); + $LeftOvers = $pdf->addTextWrap($Left_Margin + 400, $YPos, 70, $FontSize, locale_money_format($myrow['valuesales'], $_SESSION['CompanyRecord']['decimalplaces']), 'right'); $LeftOvers = $pdf->addTextWrap($Left_Margin + 490, $YPos, 30, $FontSize, locale_number_format($ohRow[0],$myrow['decimalplaces']), 'right'); if (mb_strlen($LeftOvers) > 1) { $LeftOvers = $pdf->addTextWrap($Left_Margin + 1 + 94, $YPos - $line_height, 270, $FontSize, $LeftOvers, 'left'); @@ -112,9 +112,9 @@ /*increment a line down for the next line item */ $YPos-= $line_height; } - + $pdf->OutputD($_SESSION['DatabaseName'] . '_TopItemsListing_' . date('Y-m-d').'.pdf'); - $pdf->__destruct(); + $pdf->__destruct(); } /*end of else not PrintPDF */ -?> +?> \ No newline at end of file Modified: trunk/PO_AuthorisationLevels.php =================================================================== --- trunk/PO_AuthorisationLevels.php 2011-09-14 09:57:45 UTC (rev 4690) +++ trunk/PO_AuthorisationLevels.php 2011-09-16 10:29:26 UTC (rev 4691) @@ -46,7 +46,7 @@ '".$_POST['CurrCode']."', '".$CanCreate."', '".$OffHold."', - '".$_POST['AuthLevel']."')"; + '" . filter_number_format($_POST['AuthLevel'])."')"; $ErrMsg = _('The authentication details cannot be inserted because'); $Result=DB_query($sql,$db,$ErrMsg); } else { @@ -69,10 +69,10 @@ $sql="UPDATE purchorderauth SET cancreate='".$CanCreate."', offhold='".$OffHold."', - authlevel='".$_POST['AuthLevel']."' + authlevel='".filter_number_format($_POST['AuthLevel'])."' WHERE userid='".$_POST['UserID']."' AND currabrev='".$_POST['CurrCode']."'"; - + $ErrMsg = _('The authentication details cannot be updated because'); $Result=DB_query($sql,$db,$ErrMsg); } @@ -111,9 +111,9 @@ purchorderauth.cancreate, purchorderauth.offhold, purchorderauth.authlevel - FROM purchorderauth INNER JOIN www_users + FROM purchorderauth INNER JOIN www_users ON purchorderauth.userid=www_users.userid - INNER JOIN currencies + INNER JOIN currencies ON purchorderauth.currabrev=currencies.currabrev"; $ErrMsg = _('The authentication details cannot be retrieved because'); @@ -187,7 +187,8 @@ $sql="SELECT cancreate, offhold, authlevel, - currency + currency, + decimalplaces FROM purchorderauth INNER JOIN currencies ON purchorderauth.currabrev=currencies.currabrev WHERE userid='".$_GET['UserID']."' @@ -200,7 +201,8 @@ $CanCreate=$myrow['cancreate']; $OffHold=$myrow['offhold']; $AuthLevel=$myrow['authlevel']; - + $CurrDecimalPlaces=$myrow['decimalplaces']; + echo '<tr> <td>'._('Currency').'</td> <td>' . $myrow['currency'] . '</td> @@ -235,7 +237,7 @@ } echo '<tr><td>'._('User can authorise orders up to :').'</td>'; -echo '<td><input type=input name="AuthLevel" size=11 class="number" value="' . $AuthLevel . '"></td</tr>'; +echo '<td><input type=input name="AuthLevel" size=11 class="number" value="' . locale_money_format($AuthLevel,$CurrDecimalPlaces) . '"></td</tr>'; echo '</table>'; if (isset($_GET['Edit'])) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dai...@us...> - 2011-09-16 10:29:32
|
Revision: 4691 http://web-erp.svn.sourceforge.net/web-erp/?rev=4691&view=rev Author: daintree Date: 2011-09-16 10:29:26 +0000 (Fri, 16 Sep 2011) Log Message: ----------- number_formats Modified Paths: -------------- trunk/PDFSuppTransListing.php trunk/PDFTopItems.php trunk/PO_AuthorisationLevels.php Modified: trunk/PDFSuppTransListing.php =================================================================== --- trunk/PDFSuppTransListing.php 2011-09-14 09:57:45 UTC (rev 4690) +++ trunk/PDFSuppTransListing.php 2011-09-16 10:29:26 UTC (rev 4691) @@ -26,7 +26,7 @@ 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 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> @@ -59,8 +59,14 @@ trandate, ovamount, ovgst, - transtext - FROM supptrans + transtext, + currcode, + decimalplaces AS currdecimalplaces, + suppname + FROM supptrans INNER JOIN suppliers + ON supptrans.supplierno = suppliers.supplierno + INNER JOIN currencies + ON suppliers.currcode=currencies.currabrev WHERE type='" . $_POST['TransType'] . "' AND date_format(inputdate, '%Y-%m-%d')='".FormatDateForSQL($_POST['Date'])."'"; @@ -97,17 +103,13 @@ include ('includes/PDFSuppTransListingPageHeader.inc'); while ($myrow=DB_fetch_array($result)){ - - $sql="SELECT suppname FROM suppliers WHERE supplierid='" . $myrow['supplierno']."'"; - $supplierresult=DB_query($sql, $db); - $supplierrow=DB_fetch_array($supplierresult); - - $LeftOvers = $pdf->addTextWrap($Left_Margin,$YPos,160,$FontSize,$supplierrow['suppname'], 'left'); + $CurrDecimalPlaces = $myrow['currdecimalplaces']; + $LeftOvers = $pdf->addTextWrap($Left_Margin,$YPos,160,$FontSize,$myrow['suppname'], 'left'); $LeftOvers = $pdf->addTextWrap($Left_Margin+162,$YPos,80,$FontSize,$myrow['suppreference'], 'left'); $LeftOvers = $pdf->addTextWrap($Left_Margin+242,$YPos,70,$FontSize,ConvertSQLDate($myrow['trandate']), 'left'); - $LeftOvers = $pdf->addTextWrap($Left_Margin+312,$YPos,70,$FontSize,locale_number_format($myrow['ovamount'],2), 'right'); - $LeftOvers = $pdf->addTextWrap($Left_Margin+382,$YPos,70,$FontSize,locale_number_format($myrow['ovgst'],2), 'right'); - $LeftOvers = $pdf->addTextWrap($Left_Margin+452,$YPos,70,$FontSize,locale_number_format($myrow['ovamount']+$myrow['ovgst'],2), 'right'); + $LeftOvers = $pdf->addTextWrap($Left_Margin+312,$YPos,70,$FontSize,locale_money_format($myrow['ovamount'],$CurrDecimalPlaces), 'right'); + $LeftOvers = $pdf->addTextWrap($Left_Margin+382,$YPos,70,$FontSize,locale_money_format($myrow['ovgst'],$CurrDecimalPlaces), 'right'); + $LeftOvers = $pdf->addTextWrap($Left_Margin+452,$YPos,70,$FontSize,locale_money_format($myrow['ovamount']+$myrow['ovgst'],$CurrDecimalPlaces), 'right'); $YPos -= ($line_height); $TotalCheques = $TotalCheques - $myrow['ovamount']; @@ -121,10 +123,10 @@ $YPos-=$line_height; -$LeftOvers = $pdf->addTextWrap($Left_Margin+452,$YPos,70,$FontSize,locale_number_format(-$TotalCheques,2), 'right'); +$LeftOvers = $pdf->addTextWrap($Left_Margin+452,$YPos,70,$FontSize,locale_money_format(-$TotalCheques,$CurrDecimalPlaces), 'right'); $LeftOvers = $pdf->addTextWrap($Left_Margin+265,$YPos,300,$FontSize,_('Total') . ' ' . _('Transactions'), 'left'); $ReportFileName = $_SESSION['DatabaseName'] . '_SuppTransListing_' . date('Y-m-d').'.pdf'; $pdf->OutputD($ReportFileName); -$pdf->__destruct(); +$pdf->__destruct(); ?> \ No newline at end of file Modified: trunk/PDFTopItems.php =================================================================== --- trunk/PDFTopItems.php 2011-09-14 09:57:45 UTC (rev 4690) +++ trunk/PDFTopItems.php 2011-09-16 10:29:26 UTC (rev 4691) @@ -40,10 +40,10 @@ AND salesorderdetails.stkcode = stockmaster.stockid AND salesorders.debtorno = debtorsmaster.debtorno AND debtorsmaster.typeid = '" . $_GET['Customers'] . "' - AND salesorderdetails.ActualDispatchDate >= '" . $FromDate . "' + AND salesorderdetails.ActualDispatchDate >= '" . $FromDate . "' GROUP BY salesorderdetails.stkcode ORDER BY " . $_GET['Sequence'] . " DESC - LIMIT " . $_GET['NumberOfTopItems']; + LIMIT " . filter_number_format($_GET['NumberOfTopItems']); } else { //the situation if the customer type selected "All" if ($_GET['Customers'] == 'All') { @@ -58,10 +58,10 @@ AND salesorderdetails.stkcode = stockmaster.stockid AND salesorders.debtorno = debtorsmaster.debtorno AND salesorders.fromstkloc = '" . $_GET['Location'] . "' - AND salesorderdetails.ActualDispatchDate >= '" . $FromDate . "' + AND salesorderdetails.ActualDispatchDate >= '" . $FromDate . "' GROUP BY salesorderdetails.stkcode ORDER BY " . $_GET['Sequence'] . " DESC - LIMIT 0," . $_GET['NumberOfTopItems']; + LIMIT 0," . filter_number_format($_GET['NumberOfTopItems']); } else { //the situation if the location and customer type not selected "All" $SQL = "SELECT salesorderdetails.stkcode, @@ -76,10 +76,10 @@ AND salesorders.debtorno = debtorsmaster.debtorno AND salesorders.fromstkloc = '" . $_GET['Location'] . "' AND debtorsmaster.typeid = '" . $_GET['Customers'] . "' - AND salesorderdetails.actualdispatchdate >= '" . $FromDate . "' + AND salesorderdetails.actualdispatchdate >= '" . $FromDate . "' GROUP BY salesorderdetails.stkcode ORDER BY " . $_GET['Sequence'] . " DESC - LIMIT " . $_GET['NumberOfTopItems']; + LIMIT " . filter_number_format($_GET['NumberOfTopItems']); } } } @@ -97,7 +97,7 @@ $LeftOvers = $pdf->addTextWrap($Left_Margin + 100, $YPos, 100, $FontSize, $myrow['description']); $LeftOvers = $pdf->addTextWrap($Left_Margin + 330, $YPos, 30, $FontSize, locale_number_format($myrow['totalinvoiced'],$myrow['decimalplaces']), 'right'); $LeftOvers = $pdf->addTextWrap($Left_Margin + 370, $YPos, 300 - $Left_Margin, $FontSize, $myrow['units'], 'left'); - $LeftOvers = $pdf->addTextWrap($Left_Margin + 400, $YPos, 70, $FontSize, locale_number_format($myrow['valuesales'], $_SESSION['CompanyRecord']['decimalplaces']), 'right'); + $LeftOvers = $pdf->addTextWrap($Left_Margin + 400, $YPos, 70, $FontSize, locale_money_format($myrow['valuesales'], $_SESSION['CompanyRecord']['decimalplaces']), 'right'); $LeftOvers = $pdf->addTextWrap($Left_Margin + 490, $YPos, 30, $FontSize, locale_number_format($ohRow[0],$myrow['decimalplaces']), 'right'); if (mb_strlen($LeftOvers) > 1) { $LeftOvers = $pdf->addTextWrap($Left_Margin + 1 + 94, $YPos - $line_height, 270, $FontSize, $LeftOvers, 'left'); @@ -112,9 +112,9 @@ /*increment a line down for the next line item */ $YPos-= $line_height; } - + $pdf->OutputD($_SESSION['DatabaseName'] . '_TopItemsListing_' . date('Y-m-d').'.pdf'); - $pdf->__destruct(); + $pdf->__destruct(); } /*end of else not PrintPDF */ -?> +?> \ No newline at end of file Modified: trunk/PO_AuthorisationLevels.php =================================================================== --- trunk/PO_AuthorisationLevels.php 2011-09-14 09:57:45 UTC (rev 4690) +++ trunk/PO_AuthorisationLevels.php 2011-09-16 10:29:26 UTC (rev 4691) @@ -46,7 +46,7 @@ '".$_POST['CurrCode']."', '".$CanCreate."', '".$OffHold."', - '".$_POST['AuthLevel']."')"; + '" . filter_number_format($_POST['AuthLevel'])."')"; $ErrMsg = _('The authentication details cannot be inserted because'); $Result=DB_query($sql,$db,$ErrMsg); } else { @@ -69,10 +69,10 @@ $sql="UPDATE purchorderauth SET cancreate='".$CanCreate."', offhold='".$OffHold."', - authlevel='".$_POST['AuthLevel']."' + authlevel='".filter_number_format($_POST['AuthLevel'])."' WHERE userid='".$_POST['UserID']."' AND currabrev='".$_POST['CurrCode']."'"; - + $ErrMsg = _('The authentication details cannot be updated because'); $Result=DB_query($sql,$db,$ErrMsg); } @@ -111,9 +111,9 @@ purchorderauth.cancreate, purchorderauth.offhold, purchorderauth.authlevel - FROM purchorderauth INNER JOIN www_users + FROM purchorderauth INNER JOIN www_users ON purchorderauth.userid=www_users.userid - INNER JOIN currencies + INNER JOIN currencies ON purchorderauth.currabrev=currencies.currabrev"; $ErrMsg = _('The authentication details cannot be retrieved because'); @@ -187,7 +187,8 @@ $sql="SELECT cancreate, offhold, authlevel, - currency + currency, + decimalplaces FROM purchorderauth INNER JOIN currencies ON purchorderauth.currabrev=currencies.currabrev WHERE userid='".$_GET['UserID']."' @@ -200,7 +201,8 @@ $CanCreate=$myrow['cancreate']; $OffHold=$myrow['offhold']; $AuthLevel=$myrow['authlevel']; - + $CurrDecimalPlaces=$myrow['decimalplaces']; + echo '<tr> <td>'._('Currency').'</td> <td>' . $myrow['currency'] . '</td> @@ -235,7 +237,7 @@ } echo '<tr><td>'._('User can authorise orders up to :').'</td>'; -echo '<td><input type=input name="AuthLevel" size=11 class="number" value="' . $AuthLevel . '"></td</tr>'; +echo '<td><input type=input name="AuthLevel" size=11 class="number" value="' . locale_money_format($AuthLevel,$CurrDecimalPlaces) . '"></td</tr>'; echo '</table>'; if (isset($_GET['Edit'])) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dai...@us...> - 2011-09-14 09:57:52
|
Revision: 4690 http://web-erp.svn.sourceforge.net/web-erp/?rev=4690&view=rev Author: daintree Date: 2011-09-14 09:57:45 +0000 (Wed, 14 Sep 2011) Log Message: ----------- number_formatting Modified Paths: -------------- trunk/PDFOrdersInvoiced.php Modified: trunk/PDFOrdersInvoiced.php =================================================================== --- trunk/PDFOrdersInvoiced.php 2011-09-14 08:06:45 UTC (rev 4689) +++ trunk/PDFOrdersInvoiced.php 2011-09-14 09:57:45 UTC (rev 4690) @@ -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_money_format(filter_number_format($AccumOrderTotal),$_SESSION['CompanyRecord']['decimalplaces']), 'right'); + $LeftOvers = $pdf->addTextWrap($Left_Margin+360,$YPos,80,$FontSize,locale_number_format(filter_number_format($AccumOrderTotal),$_SESSION['CompanyRecord']['decimalplaces']), 'right'); $YPos -= ($line_height); $AccumOrderTotal =0; } @@ -399,8 +399,8 @@ $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'); - $LeftOvers = $pdf->addTextWrap($Left_Margin+300,$YPos,60,$FontSize,locale_money_format($InvRow['price'],$_SESSION['CompanyRecord']['decimalplaces']), 'right'); - $LeftOvers = $pdf->addTextWrap($Left_Margin+360,$YPos,80,$FontSize,locale_money_format($ValueInvoiced,$_SESSION['CompanyRecord']['decimalplaces']), 'right'); + $LeftOvers = $pdf->addTextWrap($Left_Margin+300,$YPos,60,$FontSize,locale_number_format($InvRow['price'],$_SESSION['CompanyRecord']['decimalplaces']), 'right'); + $LeftOvers = $pdf->addTextWrap($Left_Margin+360,$YPos,80,$FontSize,locale_number_format($ValueInvoiced,$_SESSION['CompanyRecord']['decimalplaces']), 'right'); $YPos -= ($line_height); @@ -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_money_format(filter_number_format($AccumTotalInv),$_SESSION['CompanyRecord']['decimalplaces']), 'right'); +$LeftOvers = $pdf->addTextWrap($Left_Margin+360,$YPos,80,$FontSize,locale_number_format(filter_number_format($AccumTotalInv),$_SESSION['CompanyRecord']['decimalplaces']), 'right'); $YPos -= ($line_height); $pdf->OutputD($_SESSION['DatabaseName'] . '_OrdersInvoiced_' . date('Y-m-d') . '.pdf'); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dai...@us...> - 2011-09-14 09:57:52
|
Revision: 4690 http://web-erp.svn.sourceforge.net/web-erp/?rev=4690&view=rev Author: daintree Date: 2011-09-14 09:57:45 +0000 (Wed, 14 Sep 2011) Log Message: ----------- number_formatting Modified Paths: -------------- trunk/PDFOrdersInvoiced.php Modified: trunk/PDFOrdersInvoiced.php =================================================================== --- trunk/PDFOrdersInvoiced.php 2011-09-14 08:06:45 UTC (rev 4689) +++ trunk/PDFOrdersInvoiced.php 2011-09-14 09:57:45 UTC (rev 4690) @@ -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_money_format(filter_number_format($AccumOrderTotal),$_SESSION['CompanyRecord']['decimalplaces']), 'right'); + $LeftOvers = $pdf->addTextWrap($Left_Margin+360,$YPos,80,$FontSize,locale_number_format(filter_number_format($AccumOrderTotal),$_SESSION['CompanyRecord']['decimalplaces']), 'right'); $YPos -= ($line_height); $AccumOrderTotal =0; } @@ -399,8 +399,8 @@ $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'); - $LeftOvers = $pdf->addTextWrap($Left_Margin+300,$YPos,60,$FontSize,locale_money_format($InvRow['price'],$_SESSION['CompanyRecord']['decimalplaces']), 'right'); - $LeftOvers = $pdf->addTextWrap($Left_Margin+360,$YPos,80,$FontSize,locale_money_format($ValueInvoiced,$_SESSION['CompanyRecord']['decimalplaces']), 'right'); + $LeftOvers = $pdf->addTextWrap($Left_Margin+300,$YPos,60,$FontSize,locale_number_format($InvRow['price'],$_SESSION['CompanyRecord']['decimalplaces']), 'right'); + $LeftOvers = $pdf->addTextWrap($Left_Margin+360,$YPos,80,$FontSize,locale_number_format($ValueInvoiced,$_SESSION['CompanyRecord']['decimalplaces']), 'right'); $YPos -= ($line_height); @@ -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_money_format(filter_number_format($AccumTotalInv),$_SESSION['CompanyRecord']['decimalplaces']), 'right'); +$LeftOvers = $pdf->addTextWrap($Left_Margin+360,$YPos,80,$FontSize,locale_number_format(filter_number_format($AccumTotalInv),$_SESSION['CompanyRecord']['decimalplaces']), 'right'); $YPos -= ($line_height); $pdf->OutputD($_SESSION['DatabaseName'] . '_OrdersInvoiced_' . date('Y-m-d') . '.pdf'); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dai...@us...> - 2011-09-14 08:06:59
|
Revision: 4689 http://web-erp.svn.sourceforge.net/web-erp/?rev=4689&view=rev Author: daintree Date: 2011-09-14 08:06:45 +0000 (Wed, 14 Sep 2011) Log Message: ----------- number_formatting Modified Paths: -------------- trunk/BankReconciliation.php trunk/PDFGrn.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/SelectOrderItems.php trunk/StockTransfers.php trunk/includes/GLPostings.inc trunk/includes/LanguageSetup.php trunk/includes/SQL_CommonFunctions.inc trunk/includes/SelectOrderItems_IntoCart.inc Modified: trunk/BankReconciliation.php =================================================================== --- trunk/BankReconciliation.php 2011-09-12 23:37:53 UTC (rev 4688) +++ trunk/BankReconciliation.php 2011-09-14 08:06:45 UTC (rev 4689) @@ -19,27 +19,26 @@ if (isset($_POST['PostExchangeDifference']) and is_numeric($_POST['DoExchangeDifference'])){ - if (!is_numeric($_POST['BankStatementBalance'])){ + if (!is_numeric(filter_number_format($_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, - decimalplaces + decimalplaces AS currdecimalplaces FROM bankaccounts INNER JOIN currencies ON bankaccounts.currcode=currencies.currabrev WHERE bankaccounts.accountcode = '" . $_POST['BankAccount']."'"; $ErrMsg = _('Could not retrieve the exchange rate for the selected bank account'); $CurrencyResult = DB_query($SQL,$db); - $CurrencyRow = DB_fetch_row($CurrencyResult); - $ExRate = $CurrencyRow[0]; - $BankAccountName = $CurrencyRow[1]; - $CurrDecimalPlaces = $CurrencyRow[2]; - $CalculatedBalance = $_POST['DoExchangeDifference']; + $CurrencyRow = DB_fetch_array($CurrencyResult); + + $CalculatedBalance = filter_number_format($_POST['DoExchangeDifference']); - $ExchangeDifference = ($CalculatedBalance - $_POST['BankStatementBalance'])/$ExRate; + $ExchangeDifference = filter_number_format(($CalculatedBalance - $_POST['BankStatementBalance'])/$CurrencyRow['rate']); include ('includes/SQL_CommonFunctions.inc'); $ExDiffTransNo = GetNextTransNo(36,$db); @@ -62,7 +61,7 @@ '" . FormatDateForSQL($PostingDate) . "', '" . $PeriodNo . "', '" . $_SESSION['CompanyRecord']['exchangediffact'] . "', - '" . $BankAccountName . ' ' . _('reconciliation on') . " " . + '" . $CurrencyRow['bankaccountname'] . ' ' . _('reconciliation on') . " " . Date($_SESSION['DefaultDateFormat']) . "','" . $ExchangeDifference . "')"; $ErrMsg = _('Cannot insert a GL entry for the exchange difference because'); @@ -80,13 +79,13 @@ '" . FormatDateForSQL($PostingDate) . "', '" . $PeriodNo . "', '" . $_POST['BankAccount'] . "', - '" . $BankAccountName . ' ' . _('reconciliation on') . ' ' . Date($_SESSION['DefaultDateFormat']) . "', + '" . $CurrencyRow['bankaccountname'] . ' ' . _('reconciliation on') . ' ' . Date($_SESSION['DefaultDateFormat']) . "', '" . (-$ExchangeDifference) . "')"; $result = DB_query($SQL,$db,$ErrMsg,$DbgMsg,true); $result = DB_Txn_Commit($db); - prnMsg(_('Exchange difference of') . ' ' . locale_number_format($ExchangeDifference,2) . ' ' . _('has been posted'),'success'); + prnMsg(_('Exchange difference of') . ' ' . locale_money_format($ExchangeDifference,$_SESSION['CompanyRecord']['decimalplaces']) . ' ' . _('has been posted'),'success'); } //end if the bank statement balance was numeric } @@ -153,25 +152,24 @@ /* Now need to get the currency of the account and the current table ex rate */ $SQL = "SELECT rate, bankaccounts.currcode, - bankaccounts.bankaccountname + bankaccounts.bankaccountname, + currencies.decimalplaces AS currdecimalplaces FROM bankaccounts INNER JOIN currencies ON bankaccounts.currcode=currencies.currabrev WHERE bankaccounts.accountcode = '" . $_POST['BankAccount']."'"; $ErrMsg = _('Could not retrieve the currency and exchange rate for the selected bank account'); $CurrencyResult = DB_query($SQL,$db); - $CurrencyRow = DB_fetch_row($CurrencyResult); - $ExRate = $CurrencyRow[0]; - $BankCurrCode = $CurrencyRow[1]; - $BankAccountName = $CurrencyRow[2]; + $CurrencyRow = DB_fetch_array($CurrencyResult); + echo '<table class="selection"> - <tr class="EvenTableRows"><td colspan=6><b>' . $BankAccountName . ' ' . _('Balance as at') . ' ' . Date($_SESSION['DefaultDateFormat']); + <tr class="EvenTableRows"><td colspan=6><b>' . $CurrencyRow['bankaccountname'] . ' ' . _('Balance as at') . ' ' . Date($_SESSION['DefaultDateFormat']); - if ($_SESSION['CompanyRecord']['currencydefault']!=$BankCurrCode){ - echo ' (' . $BankCurrCode . ' @ ' . $ExRate .')'; + if ($_SESSION['CompanyRecord']['currencydefault']!=$CurrencyRow['currcode']){ + echo ' (' . $CurrencyRow['currcode'] . ' @ ' . $CurrencyRow['rate'] .')'; } echo '</b></td> - <td valign=bottom class="number"><b>' . locale_number_format($Balance*$ExRate,$CurrDecimalPlaces) . '</b></td></tr>'; + <td valign=bottom class="number"><b>' . locale_money_format($Balance*$CurrencyRow['rate'],$CurrencyRow['currdecimalplaces']) . '</b></td></tr>'; $SQL = "SELECT amount/exrate AS amt, amountcleared, @@ -222,15 +220,15 @@ <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> </tr>', ConvertSQLDate($myrow['transdate']), $myrow['typename'], $myrow['transno'], $myrow['ref'], - locale_number_format($myrow['amt'],$CurrDecimalPlaces), - locale_number_format($myrow['outstanding'],$CurrDecimalPlaces)); + locale_money_format($myrow['amt'],$CurrencyRow['currdecimalplaces']), + locale_money_format($myrow['outstanding'],$CurrencyRow['currdecimalplaces'])); $TotalUnpresentedCheques +=$myrow['outstanding']; @@ -241,20 +239,20 @@ } } //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_number_format($TotalUnpresentedCheques,$CurrDecimalPlaces) . '</td></tr>'; + <tr class=EvenTableRows><td colspan=6>' . _('Total of all unpresented cheques') . '</td><td class="number">' . locale_money_format($TotalUnpresentedCheques,$CurrencyRow['currdecimalplaces']) . '</td></tr>'; $SQL = "SELECT amount/exrate AS amt, amountcleared, - (amount/exrate)-amountcleared as outstanding, + (amount/exrate)-amountcleared AS outstanding, ref, transdate, systypes.typename, transno - FROM banktrans, - systypes - WHERE banktrans.type = systypes.typeid - AND banktrans.bankact='" . $_POST['BankAccount'] . "' + FROM banktrans INNER JOIN systypes + ON banktrans.type = systypes.typeid + WHERE banktrans.bankact='" . $_POST['BankAccount'] . "' AND amount > 0 AND ABS((amount/exrate)-amountcleared)>0.009 ORDER BY transdate"; @@ -264,7 +262,7 @@ $UPChequesResult = DB_query($SQL,$db,$ErrMsg); - echo '<tr><td colspan=6><b>' . _('Less deposits not cleared') . ':</b></td></tr>'; + echo '<tr><td colspan="6"><b>' . _('Less deposits not cleared') . ':</b></td></tr>'; $TableHeader = '<tr> <th>' . _('Date') . '</th> @@ -294,15 +292,15 @@ <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> </tr>', ConvertSQLDate($myrow['transdate']), $myrow['typename'], $myrow['transno'], $myrow['ref'], - locale_number_format($myrow['amt'],$CurrDecimalPlaces), - locale_number_format($myrow['outstanding'],$CurrDecimalPlaces) ); + locale_money_format($myrow['amt'],$CurrencyRow['currdecimalplaces']), + locale_money_format($myrow['outstanding'],$CurrencyRow['currdecimalplaces']) ); $TotalUnclearedDeposits +=$myrow['outstanding']; @@ -316,25 +314,28 @@ echo '<tr></tr> <tr class=EvenTableRows> <td colspan=6>' . _('Total of all uncleared deposits') . '</td> - <td class=number>' . locale_number_format($TotalUnclearedDeposits,$CurrDecimalPlaces) . '</td> + <td class="number">' . locale_money_format($TotalUnclearedDeposits,$CurrencyRow['currdecimalplaces']) . '</td> </tr>'; - $FXStatementBalance = ($Balance*$ExRate) - $TotalUnpresentedCheques -$TotalUnclearedDeposits; + $FXStatementBalance = filter_number_format(($Balance*$CurrencyRow['rate']) - $TotalUnpresentedCheques -$TotalUnclearedDeposits); echo '<tr></tr> <tr class=EvenTableRows> - <td colspan=6><b>' . _('Bank statement balance should be') . ' (' . $BankCurrCode . ')</b></td> - <td class=number>' . locale_number_format($FXStatementBalance,$CurrDecimalPlaces) . '</td></tr>'; + <td colspan=6><b>' . _('Bank statement balance should be') . ' (' . $CurrencyRow['currcode'] . ')</b></td> + <td class="number">' . locale_money_format($FXStatementBalance,$CurrencyRow['currdecimalplaces']) . '</td></tr>'; if (isset($_POST['DoExchangeDifference'])){ - echo '<input type="hidden" name="DoExchangeDifference" value=' . $FXStatementBalance . '>'; - echo '<tr><td colspan=6>' . _('Enter the actual bank statement balance') . ' (' . $BankCurrCode . ')</b></td> - <td class=number><input type="text" name="BankStatementBalance" maxlength=15 size=15 value=' . $_POST['BankStatementBalance'] . '><td></tr>'; + echo '<input type="hidden" name="DoExchangeDifference" value=' . $FXStatementBalance . ' />'; + if (!isset($_POST['BankStatementBalance'])){ + $_POST['BankStatementBalance'] =0; + } + echo '<tr><td colspan=6>' . _('Enter the actual bank statement balance') . ' (' . $CurrencyRow['currcode'] . ')</b></td> + <td class="number"><input type="text" name="BankStatementBalance" maxlength="15" size="15" value=' . locale_number_format($_POST['BankStatementBalance'],$CurrencyRow['currdecimalplaces']) . ' /><td></tr>'; echo '<tr><td colspan=7 align="center"><input type="submit" name="PostExchangeDifference" value="' . _('Calculate and Post Exchange Difference') . '" onclick="return confirm(\'' . _('This will create a general ledger journal to write off the exchange difference in the current balance of the account. It is important that the exchange rate above reflects the current value of the bank account currency') . ' - ' . _('Are You Sure?') . '\');"></td></tr>'; } - if ($_SESSION['CompanyRecord']['currencydefault']!=$BankCurrCode AND !isset($_POST['DoExchangeDifference'])){ + if ($_SESSION['CompanyRecord']['currencydefault']!=$CurrencyRow['currcode'] AND !isset($_POST['DoExchangeDifference'])){ echo '<tr><td colspan=7><hr></td></tr> <tr><td colspan=7>' . _('It is normal for foreign currency accounts to have exchange differences that need to be reflected as the exchange rate varies. This reconciliation is prepared using the exchange rate set up in the currencies table (see the set-up tab). This table must be maintained with the current exchange rate before running the reconciliation. If you wish to create a journal to reflect the exchange difference based on the current exchange rate to correct the reconciliation to the actual bank statement balance click below.') . '</td></tr>'; Modified: trunk/PDFGrn.php =================================================================== --- trunk/PDFGrn.php 2011-09-12 23:37:53 UTC (rev 4688) +++ trunk/PDFGrn.php 2011-09-14 08:06:45 UTC (rev 4689) @@ -54,12 +54,12 @@ ON grns.podetailitem=purchorderdetails.podetailitem LEFT JOIN stockmaster ON grns.itemcode=stockmaster.stockid - WHERE grnbatch='".$GRNNo."'"; - + WHERE grnbatch='".filter_number_format($GRNNo)."'"; + $GRNResult=DB_query($sql, $db); $NoOfGRNs = DB_num_rows($GRNResult); if($NoOfGRNs>0) { //there are GRNs to print - + $sql = "SELECT suppliers.suppname, suppliers.address1, suppliers.address2 , @@ -69,14 +69,14 @@ suppliers.address6 FROM grns INNER JOIN suppliers ON grns.supplierid=suppliers.supplierid - WHERE grnbatch='".$GRNNo."'"; + WHERE grnbatch='".filter_number_format($GRNNo)."'"; $SuppResult = DB_query($sql,$db,_('Could not get the supplier of the selected GRN')); $SuppRow = DB_fetch_array($SuppResult); } } // get data to print if ($NoOfGRNs >0){ include ('includes/PDFGrnHeader.inc'); //head up the page - + $YPos=$FormDesign->Data->y; for ($i=1;$i<=$NoOfGRNs;$i++) { if ($GRNNo!='Preview'){ @@ -88,13 +88,13 @@ $DecimalPlaces=2; } if (is_numeric($myrow['conversionfactor']) AND $myrow['conversionfactor'] !=0){ - $SuppliersQuantity=locale_number_format($myrow['qtyrecd']/$myrow['conversionfactor'],$DecimalPlaces); + $SuppliersQuantity=locale_number_format(filter_number_format($myrow['qtyrecd']/$myrow['conversionfactor']),$DecimalPlaces); } else { $SuppliersQuantity=locale_number_format($myrow['qtyrecd'],$DecimalPlaces); } $OurUnitsQuantity=locale_number_format($myrow['qtyrecd'],$DecimalPlaces); $DeliveryDate = ConvertSQLDate($myrow['deliverydate']); - + $LeftOvers = $pdf->addTextWrap($FormDesign->Data->Column1->x,$Page_Height-$YPos,$FormDesign->Data->Column1->Length,$FormDesign->Data->Column1->FontSize, $myrow['itemcode']); $LeftOvers = $pdf->addTextWrap($FormDesign->Data->Column2->x,$Page_Height-$YPos,$FormDesign->Data->Column2->Length,$FormDesign->Data->Column2->FontSize, $myrow['itemdescription']); $LeftOvers = $pdf->addTextWrap($FormDesign->Data->Column3->x,$Page_Height-$YPos,$FormDesign->Data->Column3->Length,$FormDesign->Data->Column3->FontSize, $DeliveryDate); @@ -114,13 +114,13 @@ $LeftOvers = $pdf->addText($FormDesign->ReceiptDate->x,$Page_Height-$FormDesign->ReceiptDate->y,$FormDesign->ReceiptDate->FontSize, _('Date of Receipt: ') . $DeliveryDate); $LeftOvers = $pdf->addText($FormDesign->SignedFor->x,$Page_Height-$FormDesign->SignedFor->y,$FormDesign->SignedFor->FontSize, _('Signed for ').'______________________'); - $pdf->OutputD($_SESSION['DatabaseName'] . '_GRN_' . date('Y-m-d').'.pdf');//UldisN - $pdf->__destruct(); //UldisN + $pdf->OutputD($_SESSION['DatabaseName'] . '_GRN_' . date('Y-m-d').'.pdf'); + $pdf->__destruct(); } else { //there were not GRNs to print $title = _('GRN Error'); include('includes/header.inc'); prnMsg(_('There were no GRNs to print'),'warn'); - echo '<br /><a href="'.$rootpath.'/index.php?' . SID . '">'. _('Back to the menu').'</a>'; + echo '<br /><a href="'.$rootpath.'/index.php">'. _('Back to the menu').'</a>'; include('includes/footer.inc'); } ?> \ No newline at end of file Modified: trunk/PDFOrdersInvoiced.php =================================================================== --- trunk/PDFOrdersInvoiced.php 2011-09-12 23:37:53 UTC (rev 4688) +++ trunk/PDFOrdersInvoiced.php 2011-09-14 08:06:45 UTC (rev 4689) @@ -211,7 +211,7 @@ stockmaster.description, stockmaster.units, stockmaster.decimalplaces"; - + } elseif ($_POST['CategoryID']!='All' AND $_POST['location']!='All'){ $sql= "SELECT salesorders.orderno, @@ -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($AccumOrderTotal,2), 'right'); + $LeftOvers = $pdf->addTextWrap($Left_Margin+360,$YPos,80,$FontSize,locale_money_format(filter_number_format($AccumOrderTotal),$_SESSION['CompanyRecord']['decimalplaces']), 'right'); $YPos -= ($line_height); $AccumOrderTotal =0; } @@ -395,12 +395,12 @@ while ($InvRow=DB_fetch_array($InvoicesResult)){ - $ValueInvoiced = $InvRow['price']*$InvRow['quantity']; + $ValueInvoiced = filter_number_format($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'); - $LeftOvers = $pdf->addTextWrap($Left_Margin+300,$YPos,60,$FontSize,locale_number_format($InvRow['price'],2), 'right'); - $LeftOvers = $pdf->addTextWrap($Left_Margin+360,$YPos,80,$FontSize,locale_number_format($ValueInvoiced,2), 'right'); + $LeftOvers = $pdf->addTextWrap($Left_Margin+300,$YPos,60,$FontSize,locale_money_format($InvRow['price'],$_SESSION['CompanyRecord']['decimalplaces']), 'right'); + $LeftOvers = $pdf->addTextWrap($Left_Margin+360,$YPos,80,$FontSize,locale_money_format($ValueInvoiced,$_SESSION['CompanyRecord']['decimalplaces']), 'right'); $YPos -= ($line_height); @@ -414,7 +414,6 @@ } - $YPos -= ($line_height); if ($YPos - (2 *$line_height) < $Bottom_Margin){ /*Then set up a new page */ @@ -425,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($AccumTotalInv,2), 'right'); +$LeftOvers = $pdf->addTextWrap($Left_Margin+360,$YPos,80,$FontSize,locale_money_format(filter_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-09-12 23:37:53 UTC (rev 4688) +++ trunk/PDFPeriodStockTransListing.php 2011-09-14 08:06:45 UTC (rev 4689) @@ -1,207 +1,207 @@ -<?php -/* $Id: PDFPeriodStockTransListing.php 4307 2010-12-22 16:06:03Z tim_schofield $*/ - -include('includes/SQL_CommonFunctions.inc'); -include ('includes/session.inc'); - -$InputError=0; -if (isset($_POST['FromDate']) AND !Is_Date($_POST['FromDate'])){ - $msg = _('The date must be specified in the format') . ' ' . $_SESSION['DefaultDateFormat']; - $InputError=1; - unset($_POST['FromDate']); -} - -if (!isset($_POST['FromDate'])){ - - $title = _('Stock 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="">' . ' '. _('Stock Transaction Listing').'</img></p> - </div>'; - - 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">'; - echo '<tr> - <td>' . _('Enter the date from which the transactions 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> - </tr>'; - echo '<tr> - <td>' . _('Enter the date to which the transactions 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> - </tr>'; - - echo '<tr><td>' . _('Transaction type') . '</td><td>'; - - echo '<select name="TransType">'; - - echo '<option value=10>' . _('Sales Invoice').'</option> - <option value=11>' . _('Sales Credit Note').'</option> - <option value=16>' . _('Location Transfer').'</option> - <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>'; - - 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>'; - while ($myrow=DB_fetch_array($resultStkLocs)){ - if (isset($_POST['StockLocation']) AND $_POST['StockLocation']!='All'){ - if ($myrow['loccode'] == $_POST['StockLocation']){ - echo '<option selected value="' . $myrow['loccode'] . '">' . $myrow['locationname'] . '</option>'; - } else { - echo '<option value="' . $myrow['loccode'] . '">' . $myrow['locationname'] . '</option>'; - } - } elseif ($myrow['loccode']==$_SESSION['UserStockLocation']){ - echo '<option selected value="' . $myrow['loccode'] . '">' . $myrow['locationname'] . '</option>'; - $_POST['StockLocation']=$myrow['loccode']; - } else { - echo '<option value="' . $myrow['loccode'] . '">' . $myrow['locationname'] . '</option>'; - } - } - echo '</select></td></tr>'; - - echo '</table> - <br /> - <div class="centre"> - <input type=submit name="Go" value="' . _('Create PDF') . '" /> - </div>'; - - include('includes/footer.inc'); - exit; -} else { - - include('includes/ConnectDB.inc'); -} - - -if ($_POST['StockLocation']=='All') { - $sql= "SELECT stockmoves.type, - stockmoves.stockid, - stockmaster.description, - stockmaster.decimalplaces, - stockmoves.transno, - stockmoves.trandate, - stockmoves.qty, - stockmoves.reference, - stockmoves.narrative, - locations.locationname - FROM stockmoves - LEFT JOIN stockmaster - ON stockmoves.stockid=stockmaster.stockid - LEFT JOIN locations - ON stockmoves.loccode=locations.loccode - WHERE type='" . $_POST['TransType'] . "' - AND date_format(trandate, '%Y-%m-%d')>='".FormatDateForSQL($_POST['FromDate'])."' - AND date_format(trandate, '%Y-%m-%d')<='".FormatDateForSQL($_POST['ToDate'])."'"; -} else { - $sql= "SELECT stockmoves.type, - stockmoves.stockid, - stockmaster.description, - stockmaster.decimalplaces, - stockmoves.transno, - stockmoves.trandate, - stockmoves.qty, - stockmoves.reference, - stockmoves.narrative, - locations.locationname - FROM stockmoves - LEFT JOIN stockmaster - ON stockmoves.stockid=stockmaster.stockid - LEFT JOIN locations - ON stockmoves.loccode=locations.loccode - WHERE type='" . $_POST['TransType'] . "' - AND date_format(trandate, '%Y-%m-%d')>='".FormatDateForSQL($_POST['FromDate'])."' - AND date_format(trandate, '%Y-%m-%d')<='".FormatDateForSQL($_POST['ToDate'])."' - AND stockmoves.loccode='" . $_POST['StockLocation'] . "'"; -} -$result=DB_query($sql,$db,'','',false,false); - -if (DB_error_no($db)!=0){ - $title = _('Transaction Listing'); - include('includes/header.inc'); - prnMsg(_('An error occurred getting the transactions'),'error'); - include('includes/footer.inc'); - exit; -} elseif (DB_num_rows($result) == 0){ - $title = _('Transaction Listing'); - include('includes/header.inc'); - echo '<br />'; - prnMsg (_('There were no transactions found in the database between the dates') . ' ' . $_POST['FromDate'] . ' ' . _('and') . ' '. $_POST['ToDate'] .'<br />' ._('Please try again selecting a different date'), 'info'); - include('includes/footer.inc'); - exit; -} - -include('includes/PDFStarter.php'); - -/*PDFStarter.php has all the variables for page size and width set up depending on the users default preferences for paper size */ - -$pdf->addInfo('Title',_('Stock Transaction Listing')); -$pdf->addInfo('Subject',_('Stock transaction listing from') . ' ' . $_POST['FromDate'] . ' ' . $_POST['ToDate']); -$line_height=12; -$PageNumber = 1; - - -switch ($_POST['TransType']) { - case 10: - $TransType=_('Customer Invoices'); - break; - case 11: - $TransType=_('Customer Credit Notes'); - break; - case 16: - $TransType=_('Location Transfers'); - break; - case 17: - $TransType=_('Stock Adjustments'); - break; - case 25: - $TransType=_('Purchase Order Deliveries'); - break; - case 26: - $TransType=_('Work Order Receipts'); - break; - case 28: - $TransType=_('Work Order Issues'); - break; -} - -include ('includes/PDFPeriodStockTransListingPageHeader.inc'); - -while ($myrow=DB_fetch_array($result)){ - - $LeftOvers = $pdf->addTextWrap($Left_Margin,$YPos,160,$FontSize,$myrow['description'], 'left'); - $LeftOvers = $pdf->addTextWrap($Left_Margin+162,$YPos,80,$FontSize,$myrow['transno'], 'left'); - $LeftOvers = $pdf->addTextWrap($Left_Margin+242,$YPos,70,$FontSize,ConvertSQLDate($myrow['trandate']), 'left'); - $LeftOvers = $pdf->addTextWrap($Left_Margin+312,$YPos,70,$FontSize,locale_number_format($myrow['qty'],$myrow['decimalplaces']), 'right'); - $LeftOvers = $pdf->addTextWrap($Left_Margin+382,$YPos,70,$FontSize,$myrow['locationname'], 'right'); - $LeftOvers = $pdf->addTextWrap($Left_Margin+452,$YPos,70,$FontSize,$myrow['reference'], 'right'); - - $YPos -= ($line_height); - - if ($YPos - (2 *$line_height) < $Bottom_Margin){ - /*Then set up a new page */ - $PageNumber++; - include ('includes/PDFPeriodStockTransListingPageHeader.inc'); - } /*end of new page header */ -} /* end of while there are customer receipts in the batch to print */ - - -$YPos-=$line_height; - -$ReportFileName = $_SESSION['DatabaseName'] . '_StockTransListing_' . date('Y-m-d').'.pdf'; -$pdf->OutputD($ReportFileName); -$pdf->__destruct(); - +<?php +/* $Id: PDFPeriodStockTransListing.php 4307 2010-12-22 16:06:03Z tim_schofield $*/ + +include('includes/SQL_CommonFunctions.inc'); +include ('includes/session.inc'); + +$InputError=0; +if (isset($_POST['FromDate']) AND !Is_Date($_POST['FromDate'])){ + $msg = _('The date must be specified in the format') . ' ' . $_SESSION['DefaultDateFormat']; + $InputError=1; + unset($_POST['FromDate']); +} + +if (!isset($_POST['FromDate'])){ + + $title = _('Stock 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="">' . ' '. _('Stock Transaction Listing').'</img></p> + </div>'; + + 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">'; + echo '<tr> + <td>' . _('Enter the date from which the transactions 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> + </tr>'; + echo '<tr> + <td>' . _('Enter the date to which the transactions 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> + </tr>'; + + echo '<tr><td>' . _('Transaction type') . '</td><td>'; + + echo '<select name="TransType">'; + + echo '<option value=10>' . _('Sales Invoice').'</option> + <option value=11>' . _('Sales Credit Note').'</option> + <option value=16>' . _('Location Transfer').'</option> + <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>'; + + 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>'; + while ($myrow=DB_fetch_array($resultStkLocs)){ + if (isset($_POST['StockLocation']) AND $_POST['StockLocation']!='All'){ + if ($myrow['loccode'] == $_POST['StockLocation']){ + echo '<option selected value="' . $myrow['loccode'] . '">' . $myrow['locationname'] . '</option>'; + } else { + echo '<option value="' . $myrow['loccode'] . '">' . $myrow['locationname'] . '</option>'; + } + } elseif ($myrow['loccode']==$_SESSION['UserStockLocation']){ + echo '<option selected value="' . $myrow['loccode'] . '">' . $myrow['locationname'] . '</option>'; + $_POST['StockLocation']=$myrow['loccode']; + } else { + echo '<option value="' . $myrow['loccode'] . '">' . $myrow['locationname'] . '</option>'; + } + } + echo '</select></td></tr>'; + + echo '</table> + <br /> + <div class="centre"> + <input type="submit" name="Go" value="' . _('Create PDF') . '" /> + </div>'; + + include('includes/footer.inc'); + exit; +} else { + + include('includes/ConnectDB.inc'); +} + + +if ($_POST['StockLocation']=='All') { + $sql= "SELECT stockmoves.type, + stockmoves.stockid, + stockmaster.description, + stockmaster.decimalplaces, + stockmoves.transno, + stockmoves.trandate, + stockmoves.qty, + stockmoves.reference, + stockmoves.narrative, + locations.locationname + FROM stockmoves + LEFT JOIN stockmaster + ON stockmoves.stockid=stockmaster.stockid + LEFT JOIN locations + ON stockmoves.loccode=locations.loccode + WHERE type='" . $_POST['TransType'] . "' + AND date_format(trandate, '%Y-%m-%d')>='".FormatDateForSQL($_POST['FromDate'])."' + AND date_format(trandate, '%Y-%m-%d')<='".FormatDateForSQL($_POST['ToDate'])."'"; +} else { + $sql= "SELECT stockmoves.type, + stockmoves.stockid, + stockmaster.description, + stockmaster.decimalplaces, + stockmoves.transno, + stockmoves.trandate, + stockmoves.qty, + stockmoves.reference, + stockmoves.narrative, + locations.locationname + FROM stockmoves + LEFT JOIN stockmaster + ON stockmoves.stockid=stockmaster.stockid + LEFT JOIN locations + ON stockmoves.loccode=locations.loccode + WHERE type='" . $_POST['TransType'] . "' + AND date_format(trandate, '%Y-%m-%d')>='".FormatDateForSQL($_POST['FromDate'])."' + AND date_format(trandate, '%Y-%m-%d')<='".FormatDateForSQL($_POST['ToDate'])."' + AND stockmoves.loccode='" . $_POST['StockLocation'] . "'"; +} +$result=DB_query($sql,$db,'','',false,false); + +if (DB_error_no($db)!=0){ + $title = _('Transaction Listing'); + include('includes/header.inc'); + prnMsg(_('An error occurred getting the transactions'),'error'); + include('includes/footer.inc'); + exit; +} elseif (DB_num_rows($result) == 0){ + $title = _('Transaction Listing'); + include('includes/header.inc'); + echo '<br />'; + prnMsg (_('There were no transactions found in the database between the dates') . ' ' . $_POST['FromDate'] . ' ' . _('and') . ' '. $_POST['ToDate'] .'<br />' ._('Please try again selecting a different date'), 'info'); + include('includes/footer.inc'); + exit; +} + +include('includes/PDFStarter.php'); + +/*PDFStarter.php has all the variables for page size and width set up depending on the users default preferences for paper size */ + +$pdf->addInfo('Title',_('Stock Transaction Listing')); +$pdf->addInfo('Subject',_('Stock transaction listing from') . ' ' . $_POST['FromDate'] . ' ' . $_POST['ToDate']); +$line_height=12; +$PageNumber = 1; + + +switch ($_POST['TransType']) { + case 10: + $TransType=_('Customer Invoices'); + break; + case 11: + $TransType=_('Customer Credit Notes'); + break; + case 16: + $TransType=_('Location Transfers'); + break; + case 17: + $TransType=_('Stock Adjustments'); + break; + case 25: + $TransType=_('Purchase Order Deliveries'); + break; + case 26: + $TransType=_('Work Order Receipts'); + break; + case 28: + $TransType=_('Work Order Issues'); + break; +} + +include ('includes/PDFPeriodStockTransListingPageHeader.inc'); + +while ($myrow=DB_fetch_array($result)){ + + $LeftOvers = $pdf->addTextWrap($Left_Margin,$YPos,160,$FontSize,$myrow['description'], 'left'); + $LeftOvers = $pdf->addTextWrap($Left_Margin+162,$YPos,80,$FontSize,$myrow['transno'], 'left'); + $LeftOvers = $pdf->addTextWrap($Left_Margin+242,$YPos,70,$FontSize,ConvertSQLDate($myrow['trandate']), 'left'); + $LeftOvers = $pdf->addTextWrap($Left_Margin+312,$YPos,70,$FontSize,locale_number_format($myrow['qty'],$myrow['decimalplaces']), 'right'); + $LeftOvers = $pdf->addTextWrap($Left_Margin+382,$YPos,70,$FontSize,$myrow['locationname'], 'right'); + $LeftOvers = $pdf->addTextWrap($Left_Margin+452,$YPos,70,$FontSize,$myrow['reference'], 'right'); + + $YPos -= ($line_height); + + if ($YPos - (2 *$line_height) < $Bottom_Margin){ + /*Then set up a new page */ + $PageNumber++; + include ('includes/PDFPeriodStockTransListingPageHeader.inc'); + } /*end of new page header */ +} /* end of while there are customer receipts in the batch to print */ + + +$YPos-=$line_height; + +$ReportFileName = $_SESSION['DatabaseName'] . '_StockTransListing_' . date('Y-m-d').'.pdf'; +$pdf->OutputD($ReportFileName); +$pdf->__destruct(); + ?> \ No newline at end of file Modified: trunk/PDFPickingList.php =================================================================== --- trunk/PDFPickingList.php 2011-09-12 23:37:53 UTC (rev 4688) +++ trunk/PDFPickingList.php 2011-09-14 08:06:45 UTC (rev 4689) @@ -21,9 +21,9 @@ if ((!isset($_GET['TransNo']) or $_GET['TransNo']=="") and !isset($_POST['TransDate'])){ $title = _('Select Picking Lists'); include('includes/header.inc'); - $sql='SELECT loccode, + $sql="SELECT loccode, locationname - FROM locations'; + FROM locations"; $result=DB_query($sql, $db); 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">'; @@ -49,78 +49,78 @@ 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, - salesorders.customerref, - salesorders.comments, - salesorders.orddate, - salesorders.deliverto, - salesorders.deladd1, - salesorders.deladd2, - salesorders.deladd3, - salesorders.deladd4, - salesorders.deladd5, - salesorders.deladd6, - salesorders.deliverblind, - 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, - debtorsmaster, - shippers, - locations - WHERE salesorders.debtorno=debtorsmaster.debtorno - AND salesorders.shipvia=shippers.shipper_id - AND salesorders.fromstkloc=locations.loccode - AND salesorders.orderno='" . $_GET['TransNo']."'"; -} else if (isset($_POST['TransDate']) + salesorders.orderno, + salesorders.customerref, + salesorders.comments, + salesorders.orddate, + salesorders.deliverto, + salesorders.deladd1, + salesorders.deladd2, + salesorders.deladd3, + salesorders.deladd4, + salesorders.deladd5, + salesorders.deladd6, + salesorders.deliverblind, + 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, + debtorsmaster, + shippers, + locations + WHERE salesorders.debtorno=debtorsmaster.debtorno + AND salesorders.shipvia=shippers.shipper_id + AND salesorders.fromstkloc=locations.loccode + AND salesorders.orderno='" . filter_number_format($_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 */ $sql = "SELECT salesorders.debtorno, - salesorders.orderno, - salesorders.customerref, - salesorders.comments, - salesorders.orddate, - salesorders.deliverto, - salesorders.deladd1, - salesorders.deladd2, - salesorders.deladd3, - salesorders.deladd4, - salesorders.deladd5, - salesorders.deladd6, - salesorders.deliverblind, - 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, - debtorsmaster, - shippers, - locations - WHERE salesorders.debtorno=debtorsmaster.debtorno - AND salesorders.shipvia=shippers.shipper_id - AND salesorders.fromstkloc=locations.loccode - AND salesorders.fromstkloc='".$_POST['loccode']."' - AND salesorders.deliverydate='" . FormatDateForSQL($_POST['TransDate'])."'"; + salesorders.orderno, + salesorders.customerref, + salesorders.comments, + salesorders.orddate, + salesorders.deliverto, + salesorders.deladd1, + salesorders.deladd2, + salesorders.deladd3, + salesorders.deladd4, + salesorders.deladd5, + salesorders.deladd6, + salesorders.deliverblind, + 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, + debtorsmaster, + shippers, + locations + WHERE salesorders.debtorno=debtorsmaster.debtorno + AND salesorders.shipvia=shippers.shipper_id + AND salesorders.fromstkloc=locations.loccode + AND salesorders.fromstkloc='".$_POST['loccode']."' + AND salesorders.deliverydate='" . FormatDateForSQL($_POST['TransDate'])."'"; } -if (isset($_POST['TransDate']) +if (isset($_POST['TransDate']) OR (isset($_GET['TransNo']) AND $_GET['TransNo'] != 'Preview')) { $result=DB_query($sql,$db, $ErrMsg); @@ -185,7 +185,7 @@ $pdf->addInfo('Title', _('Picking List') ); $pdf->addInfo('Subject', _('Laser Picking List') ); $FontSize=12; -$ListCount = 0; +$ListCount = 0; $Copy=''; $line_height=$FormDesign->LineHeight; @@ -207,44 +207,46 @@ /* Are there any picking lists for this order already */ $sql="SELECT COUNT(orderno) FROM pickinglists - WHERE orderno='" . $OrdersToPick[$i]['orderno'] . "'"; + WHERE orderno='" . filter_number_format($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, - salesorderdetails.orderlineno, - salesorderdetails.quantity, - salesorderdetails.qtyinvoiced, - salesorderdetails.unitprice, - salesorderdetails.narrative - FROM salesorderdetails - INNER JOIN stockmaster - ON salesorderdetails.stkcode=stockmaster.stockid - WHERE salesorderdetails.orderno='" . $OrdersToPick[$i]['orderno'] ."'"; + stockmaster.description, + salesorderdetails.orderlineno, + salesorderdetails.quantity, + salesorderdetails.qtyinvoiced, + salesorderdetails.unitprice, + salesorderdetails.narrative, + stockmaster.decimalplaces + FROM salesorderdetails + INNER JOIN stockmaster + ON salesorderdetails.stkcode=stockmaster.stockid + WHERE salesorderdetails.orderno='" . filer_number_format($OrdersToPick[$i]['orderno']) ."'"; } else { /* There are previous picking lists for this order so * need to take those quantities into account */ $sql = "SELECT salesorderdetails.stkcode, - stockmaster.description, - salesorderdetails.orderlineno, - salesorderdetails.quantity, - salesorderdetails.qtyinvoiced, - SUM(pickinglistdetails.qtyexpected) as qtyexpected, - SUM(pickinglistdetails.qtypicked) as qtypicked, - salesorderdetails.unitprice, - salesorderdetails.narrative - FROM salesorderdetails - INNER JOIN stockmaster - ON salesorderdetails.stkcode=stockmaster.stockid - LEFT JOIN pickinglists - ON salesorderdetails.orderno=pickinglists.orderno - LEFT JOIN pickinglistdetails - ON pickinglists.pickinglistno=pickinglistdetails.pickinglistno - WHERE salesorderdetails.orderno='" . $OrdersToPick[$i]['orderno'] ."' - AND salesorderdetails.orderlineno=pickinglistdetails.orderlineno"; + stockmaster.description, + salesorderdetails.orderlineno, + salesorderdetails.quantity, + salesorderdetails.qtyinvoiced, + SUM(pickinglistdetails.qtyexpected) as qtyexpected, + SUM(pickinglistdetails.qtypicked) as qtypicked, + salesorderdetails.unitprice, + salesorderdetails.narrative, + stockmaster.decimalplaces + FROM salesorderdetails + INNER JOIN stockmaster + ON salesorderdetails.stkcode=stockmaster.stockid + LEFT JOIN pickinglists + ON salesorderdetails.orderno=pickinglists.orderno + LEFT JOIN pickinglistdetails + ON pickinglists.pickinglistno=pickinglistdetails.pickinglistno + WHERE salesorderdetails.orderno='" . filter_number_format($OrdersToPick[$i]['orderno']) ."' + AND salesorderdetails.orderlineno=pickinglistdetails.orderlineno"; } $lineresult=DB_query($sql,$db, $ErrMsg); } @@ -258,7 +260,7 @@ $sql="INSERT INTO pickinglists VALUES ( '" . $PickingListNo ."', - '" . $OrdersToPick[$i]['orderno']."', + '" . filter_number_format($OrdersToPick[$i]['orderno'])."', '" . FormatDateForSQL($_POST['TransDate'])."', '" . date('Y-m-d')."', '0000-00-00')"; @@ -284,16 +286,16 @@ $myrow2['qtyexpected']=0; $myrow2['qtypicked']=0; } - $DisplayQty = locale_number_format($myrow2['quantity'],2); - $DisplayPrevDel = locale_number_format($myrow2['qtyinvoiced'],2); - $DisplayQtySupplied = locale_number_format($myrow2['quantity'] - $myrow2['qtyinvoiced']-$myrow2['qtyexpected']-$myrow2['qtypicked'],2); + $DisplayQty = locale_number_format($myrow2['quantity'],$myrow2['decimalplaces']); + $DisplayPrevDel = locale_number_format($myrow2['qtyinvoiced'],$myrow2['decimalplaces']); + $DisplayQtySupplied = locale_number_format(filer_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']."', - '" . $DisplayQtySupplied."', + '" . filter_number_format($DisplayQtySupplied) ."', 0)"; $lineresult=DB_query($sql, $db); } @@ -327,6 +329,6 @@ exit; } else { $pdf->OutputD($_SESSION['DatabaseName'] . '_PickingLists_' . date('Y-m-d') . '.pdf'); - $pdf->__destruct(); + $pdf->__destruct(); } ?> \ No newline at end of file Modified: trunk/PDFPriceList.php =================================================================== --- trunk/PDFPriceList.php 2011-09-12 23:37:53 UTC (rev 4688) +++ trunk/PDFPriceList.php 2011-09-14 08:06:45 UTC (rev 4689) @@ -1,7 +1,6 @@ <?php -/* $Revision: 1.14 $ */ +/* $Id$*/ -//$PageSecurity = 2; include('includes/session.inc'); If (isset($_POST['PrintPDF']) @@ -27,7 +26,7 @@ include('includes/header.inc'); echo '<br />'; prnMsg( _('The customer must first be selected from the select customer link') . '. ' . _('Re-run the price list once the customer has been selected') ); - echo '<br /><br /><a href="' . $_SERVER['PHP_SELF'] . '?' . SID . '">' . _('Back') . '</a>'; + echo '<br /><br /><a href="' . $_SERVER['PHP_SELF'] . '">' . _('Back') . '</a>'; include('includes/footer.inc'); exit; } @@ -35,7 +34,7 @@ $title = _('Special price List - No Customer Selected'); include('includes/header.inc'); prnMsg(_('The effective date must be entered in the format') . ' ' . $_SESSION['DefaultDateFormat'],'error'); - echo '<br /><br /><a href="' . $_SERVER['PHP_SELF'] . '?' . SID . '">' . _('Back') . '</a>'; + echo '<br /><br /><a href="' . $_SERVER['PHP_SELF'] . '">' . _('Back') . '</a>'; include('includes/footer.inc'); exit; } @@ -50,32 +49,35 @@ $SalesType = $CustNameRow[1]; $SQL = "SELECT prices.typeabbrev, - prices.stockid, - stockmaster.description, - stockmaster.longdescription, - prices.currabrev, - prices.startdate, - prices.enddate, - prices.price, - stockmaster.materialcost+stockmaster.labourcost+stockmaster.overheadcost AS standardcost, - stockmaster.categoryid, - stockcategory.categorydescription, - prices.debtorno, - prices.branchcode, - custbranch.brname - FROM stockmaster, - stockcategory, - prices LEFT JOIN custbranch + prices.stockid, + stockmaster.description, + stockmaster.longdescription, + prices.currabrev, + prices.startdate, + prices.enddate, + prices.price, + stockmaster.materialcost+stockmaster.labourcost+stockmaster.overheadcost AS standardcost, + stockmaster.categoryid, + stockcategory.categorydescription, + prices.debtorno, + prices.branchcode, + custbranch.brname, + currencies.decimalplaces + FROM stockmaster INNER JOIN stockcategory + ON stockmaster.categoryid=stockcategory.categoryid + INNER JOIN prices + ON stockmaster.stockid=prices.stockid + INNER JOIN currencies + ON prices.currabrev=currencies.currabrev + LEFT JOIN custbranch ON prices.debtorno=custbranch.debtorno AND prices.branchcode=custbranch.branchcode - WHERE stockmaster.stockid=prices.stockid - AND stockmaster.categoryid=stockcategory.categoryid - AND prices.typeabbrev = '" . $SalesType . "' + WHERE prices.typeabbrev = '" . $SalesType . "' AND stockmaster.categoryid >= '" . $_POST['FromCriteria'] . "' AND stockmaster.categoryid <= '" . $_POST['ToCriteria'] . "' AND prices.debtorno='" . $_SESSION['CustomerID'] . "' AND prices.startdate<='" . FormatDateForSQL($_POST['EffectiveDate']) . "' - AND (prices.enddate='0000-00-00' OR prices.enddate>'" . FormatDateForSQL($_POST['EffectiveDate']) . "') + AND (prices.enddate='0000-00-00' OR prices.enddate >'" . FormatDateForSQL($_POST['EffectiveDate']) . "') ORDER BY prices.currabrev, stockmaster.categoryid, stockmaster.stockid, @@ -89,31 +91,33 @@ $SalesTypeName = $SalesTypeRow[0]; $SQL = "SELECT prices.typeabbrev, - prices.stockid, - prices.startdate, - prices.enddate, - stockmaster.description, - stockmaster.longdescription, - prices.currabrev, - prices.price, - stockmaster.materialcost+stockmaster.labourcost+stockmaster.overheadcost as standardcost, - stockmaster.categoryid, - stockcategory.categorydescription - FROM prices, - stockmaster, - stockcategory - WHERE stockmaster.stockid=prices.stockid - AND stockmaster.categoryid=stockcategory.categoryid - AND stockmaster.categoryid >= '" . $_POST['FromCriteria'] . "' - AND stockmaster.categoryid <= '" . $_POST['ToCriteria'] . "' - AND prices.typeabbrev='" . $_POST['SalesType'] . "' - AND prices.startdate<='" . FormatDateForSQL($_POST['EffectiveDate']) . "' - AND (prices.enddate='0000-00-00' OR prices.enddate>'" . FormatDateForSQL($_POST['EffectiveDate']) . "') - AND prices.debtorno='' - ORDER BY prices.currabrev, - stockmaster.categoryid, - stockmaster.stockid, - prices.startdate"; + prices.stockid, + prices.startdate, + prices.enddate, + stockmaster.description, + stockmaster.longdescription, + prices.currabrev, + prices.price, + stockmaster.materialcost+stockmaster.labourcost+stockmaster.overheadcost as standardcost, + stockmaster.categoryid, + stockcategory.categorydescription, + currencies.decimalplaces + FROM stockmaster INNER JOIN stockcategory + ON stockmaster.categoryid=stockcategory.categoryid + INNER JOIN prices + ON stockmaster.stockid=prices.stockid + INNER JOIN currencies + ON prices.currabrev=currencies.currabrev + WHERE stockmaster.categoryid >= '" . $_POST['FromCriteria'] . "' + AND stockmaster.categoryid <= '" . $_POST['ToCriteria'] . "' + AND prices.typeabbrev='" . $_POST['SalesType'] . "' + AND prices.startdate<='" . FormatDateForSQL($_POST['EffectiveDate']) . "' + AND (prices.enddate='0000-00-00' OR prices.enddate>'" . FormatDateForSQL($_POST['EffectiveDate']) . "') + AND prices.debtorno='' + ORDER BY prices.currabrev, + stockmaster.categoryid, + stockmaster.stockid, + prices.startdate"; } $PricesResult = DB_query($SQL,$db,'','',false,false); @@ -121,7 +125,7 @@ $title = _('Price List') . ' - ' . _('Problem Report....'); include('includes/header.inc'); prnMsg( _('The Price List could not be retrieved by the SQL because'). ' - ' . DB_error_msg($db), 'error'); - echo '<br /><a href="' .$rootpath .'/index.php?' . SID . '">'. _('Back to the menu'). '</a>'; + echo '<br /><a href="' .$rootpath .'/index.php">'. _('Back to the menu'). '</a>'; if ($debug==1){ prnMsg(_('For debugging purposes the SQL used was:') . $SQL,'error'); } @@ -132,7 +136,7 @@ $title = _('Print Price List Error'); include('includes/header.inc'); prnMsg(_('There were no price details to print out for the customer or category specified'),'warn'); - echo '<br /><a href="'.$_SERVER['PHP_SELF'] .'?' . SID . '">'. _('Back').'</a>'; + echo '<br /><a href="'.$_SERVER['PHP_SELF'] . '">'. _('Back').'</a>'; include('includes/footer.inc'); exit; } @@ -173,11 +177,11 @@ } $LeftOvers = $pdf->addTextWrap($Left_Margin+80+47,$YPos,47,$FontSize,$DisplayEndDate); $LeftOvers = $pdf->addTextWrap($Left_Margin+80+47+47,$YPos,130,$FontSize,$PriceList['description']); - $DisplayUnitPrice = locale_number_format($PriceList['price'],2); + $DisplayUnitPrice = locale_money_format($PriceList['price'],$PriceList['decimalplaces']); $LeftOvers = $pdf->addTextWrap($Left_Margin+80+47+47+130,$YPos,150,$FontSize,$DisplayUnitPrice, 'right'); if ($PriceList['price']!=0){ - $DisplayGPPercent = (int)(($PriceList['price']-$PriceList['standardcost'])*100/$PriceList['price']) . '%'; + $DisplayGPPercent = (int)filter_number_format((($PriceList['price']-$PriceList['standardcost'])*100/$PriceList['price'])) . '%'; } else { $DisplayGPPercent = 0; } @@ -272,28 +276,30 @@ DB_data_seek($CatResult,0); While ($myrow = DB_fetch_array($CatResult)){ - echo '<option VALUE="' . $myrow['categoryid'] . '">' . $myrow['categoryid'] . ' - ' . $myrow['categorydescription']; + echo '<option value="' . $myrow['categoryid'] . '">' . $myrow['categoryid'] . ' - ' . $myrow['categorydescription'] . '</option>'; } echo '</select></td></tr>'; - echo '<tr><td>' . _('For Sales Type/Price List').':</td><td><select name="SalesType">'; - $sql = 'SELECT sales_type, typeabbrev FROM salestypes'; + echo '<tr><td>' . _('For Sales Type/Price List').':</td> + <td><select name="SalesType">'; + $sql = "SELECT sales_type, typeabbrev FROM salestypes"; $SalesTypesResult=DB_query($sql,$db); while ($myrow=DB_fetch_array($SalesTypesResult)){ - echo '<option Value="' . $myrow['typeabbrev'] . '">' . $myrow['sales_type']; + echo '<option Value="' . $myrow['typeabbrev'] . '">' . $myrow['sales_type'] . '</option>'; } echo '</select></td></tr>'; - echo '<tr><td>' . _('Show Gross Profit %') . ':</td><td><select name="ShowGPPercentages">'; - echo '<option selected Value="No">'. _('Prices Only'); - echo '<option Value="Yes">'. _('Show GP % too'); + echo '<tr><td>' . _('Show Gross Profit %') . ':</td> + <td><select name="ShowGPPercentages">'; + echo '<option selected Value="No">'. _('Prices Only') . '</option>'; + echo '<option Value="Yes">'. _('Show GP % too') . '</option>'; echo '</select></td></tr>'; echo '<tr><td>' . _('Price Listing Type'). ':</td><td><select name="CustomerSpecials">'; - echo '<option selected Value="Sales Type Prices">'. _('Default Sales Type Prices'); - echo '<option Value="Customer Special Prices Only">'. _('Customer Special Prices Only'); - echo '<option Value="Full Description">'. _('Full Description'); + echo '<option selected value="Sales Type Prices">'. _('Default Sales Type Prices'); + echo '<option Value="Customer Special Prices Only">'. _('Customer Special Prices Only') . '</option>'; + echo '<option Value="Full Description">'. _('Full Description') . '</option>'; echo '</select></td></tr>'; echo '<tr><td>' . _('Effective As At') . ':</td><td><input type="text" size=11 class="date" alt="' . $_SESSION['DefaultDateFormat'] . '" name="EffectiveDate" value="' . Date($_SESSION['DefaultDateFormat']) . '">'; Modified: trunk/PDFPrintLabel.php =================================================================== --- trunk/PDFPrintLabel.php 2011-09-12 23:37:53 UTC (rev 4688) +++ trunk/PDFPrintLabel.php 2011-09-14 08:06:45 UTC (rev 4689) @@ -243,9 +243,10 @@ return noneButton( _('This category has no items to show') ); } - $txt=array( - _('Code'), _('Description'), _('Price').'<br />('.$_POST['Currency'].')', - _('All') + $txt=array(_('Code'), + _('Description'), + _('Price'). '<br />('.$_POST['Currency'].')', + _('All') ); $ix=0; // The table's header @@ -265,7 +266,7 @@ $ok=true; $odd=true; while ($myrow=DB_fetch_array($result)) { - $price = locale_number_format($myrow['price'],$DecimalPlaces); + $price = locale_money_format($myrow['price'],$DecimalPlaces); $oddEven=$odd?"Odd":"Even"; $odd = !$odd; $html .= <<<ZZZ @@ -307,23 +308,23 @@ } else { $WhereClause = "stockmaster.categoryid='$CategoryID' ORDER BY stockmaster.stockid"; } - + $WhereClause = " stockmaster.discontinued!=1 AND " . $WhereClause; - $sql="SELECT stockmaster.stockid, - stockmaster.description, - stockmaster.longdescription, - stockmaster.barcode, - prices.price - FROM stockmaster LEFT JOIN prices - ON stockmaster.stockid=prices.stockid - AND prices.currabrev = '" . $CurrCode . "' + $sql="SELECT stockmaster.stockid, + stockmaster.description, + stockmaster.longdescription, + stockmaster.barcode, + prices.price + FROM stockmaster LEFT JOIN prices + ON stockmaster.stockid=prices.stockid + AND prices.currabrev = '" . $CurrCode . "' AND prices.typeabbrev= '" . $SalesType . "' AND prices.startdate <= '" . $EffectiveDate . "' - AND (prices.enddate >= '" . $EffectiveDate . "' OR prices.enddate='0000-00-00') + AND (prices.enddate >= '" . $EffectiveDate . "' OR prices.enddate='0000-00-00') AND prices.debtorno='' WHERE " . $WhereClause; - + return DB_query($sql, $db); } @@ -491,7 +492,7 @@ unset($ldescrip); break; case 'price': - $txt = locale_number_format($itemData['price'], $DecimalPlaces). ' '. $Currency; + $txt = locale_money_format($itemData['price'], $DecimalPlaces). ' '. $Currency; // $adj='left'; break; case 'bcode': break; Modified: trunk/PDFQuotation.php =================================================================== --- trunk/PDFQuotation.php 2011-09-12 23:37:53 UTC (rev 4688) +++ trunk/PDFQuotation.php 2011-09-14 08:06:45 UTC (rev 4689) @@ -19,7 +19,7 @@ } /*retrieve the order details from the database to print */ -$ErrMsg = _('There was a problem retrieving the quotation header details for Order Number') . ' ' . $_GET['QuotationNo'] . ' ' . _('from the database'); +$ErrMsg = _('There was a problem retrieving the quotation header details for Order Number') . ' ' . filter_number_format($_GET['QuotationNo']) . ' ' . _('from the database'); $sql = "SELECT salesorders.customerref, salesorders.comments, @@ -44,15 +44,18 @@ salesorders.datepackingslipprinted, salesorders.branchcode, locations.taxprovinceid, - locations.locationname + locations.locationname, + currencies.decimalplaces AS currdecimalplaces FROM salesorders INNER JOIN debtorsmaster ON salesorders.debtorno=debtorsmaster.debtorno - INNER JOIN shippers + INNER JOIN shippers ON salesorders.shipvia=shippers.shipper_id - INNER JOIN locations + INNER JOIN locations ON salesorders.fromstkloc=locations.loccode + INNER JOIN currencies + ON debtorsmaster.currcode=currencies.currabrev WHERE salesorders.quotation=1 - AND salesorders.orderno='" . $_GET['QuotationNo'] ."'"; + AND salesorders.orderno='" . filter_number_format($_GET['QuotationNo']) ."'"; $result=DB_query($sql,$db, $ErrMsg); @@ -61,7 +64,7 @@ $title = _('Print Quotation Error'); include('includes/header.inc'); echo '<div class="centre"><br /><br /><br />'; - prnMsg( _('Unable to Locate Quotation Number') . ' : ' . $_GET['QuotationNo'] . ' ', 'error'); + prnMsg( _('Unable to Locate Quotation Number') . ' : ' . filter_number_format($_GET['QuotationNo']) . ' ', 'error'); echo '<br /> <br /> <br /> @@ -109,14 +112,15 @@ salesorderdetails.unitprice, salesorderdetails.discountpercent, stockmaster.taxcatid, - salesorderdetails.narrative + salesorderdetails.narrative, + stockmaster.decimalplaces FROM salesorderdetails INNER JOIN stockmaster ON salesorderdetails.stkcode=stockmaster.stockid - WHERE salesorderdetails.orderno='" . $_GET['QuotationNo'] . "'"; + WHERE salesorderdetails.orderno='" . filter_number_format($_GET['QuotationNo']) . "'"; $result=DB_query($sql,$db, $ErrMsg); -$ListCount = 0; +$ListCount = 0; if (DB_num_rows($result)>0){ /*Yes there are line items to start the ball rolling with a page header */ @@ -139,26 +143,26 @@ } //end if need a new page headed up - $DisplayQty = locale_number_format($myrow2['quantity'],2); - $DisplayPrevDel = locale_number_format($myrow2['qtyinvoiced'],2); - $DisplayPrice = locale_number_format($myrow2['unitprice'],2); + $DisplayQty = locale_number_format($myrow2['quantity'],$myrow2['decimalplaces']); + $DisplayPrevDel = locale_number_format($myrow2['qtyinvoiced'],$myrow2['decimalplaces']); + $DisplayPrice = locale_money_format($myrow2['unitprice'],$myrow['currdecimalplaces']); $DisplayDiscount = locale_number_format($myrow2['discountpercent']*100,2) . '%'; - $SubTot = $myrow2['unitprice']*$myrow2['quantity']*(1-$myrow2['discountpercent']); + $SubTot = filter_number_format($myrow2['unitprice']*$myrow2['quantity']*(1-$myrow2['... [truncated message content] |
From: <dai...@us...> - 2011-09-14 08:06:54
|
Revision: 4689 http://web-erp.svn.sourceforge.net/web-erp/?rev=4689&view=rev Author: daintree Date: 2011-09-14 08:06:45 +0000 (Wed, 14 Sep 2011) Log Message: ----------- number_formatting Modified Paths: -------------- trunk/BankReconciliation.php trunk/PDFGrn.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/SelectOrderItems.php trunk/StockTransfers.php trunk/includes/GLPostings.inc trunk/includes/LanguageSetup.php trunk/includes/SQL_CommonFunctions.inc trunk/includes/SelectOrderItems_IntoCart.inc Modified: trunk/BankReconciliation.php =================================================================== --- trunk/BankReconciliation.php 2011-09-12 23:37:53 UTC (rev 4688) +++ trunk/BankReconciliation.php 2011-09-14 08:06:45 UTC (rev 4689) @@ -19,27 +19,26 @@ if (isset($_POST['PostExchangeDifference']) and is_numeric($_POST['DoExchangeDifference'])){ - if (!is_numeric($_POST['BankStatementBalance'])){ + if (!is_numeric(filter_number_format($_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, - decimalplaces + decimalplaces AS currdecimalplaces FROM bankaccounts INNER JOIN currencies ON bankaccounts.currcode=currencies.currabrev WHERE bankaccounts.accountcode = '" . $_POST['BankAccount']."'"; $ErrMsg = _('Could not retrieve the exchange rate for the selected bank account'); $CurrencyResult = DB_query($SQL,$db); - $CurrencyRow = DB_fetch_row($CurrencyResult); - $ExRate = $CurrencyRow[0]; - $BankAccountName = $CurrencyRow[1]; - $CurrDecimalPlaces = $CurrencyRow[2]; - $CalculatedBalance = $_POST['DoExchangeDifference']; + $CurrencyRow = DB_fetch_array($CurrencyResult); + + $CalculatedBalance = filter_number_format($_POST['DoExchangeDifference']); - $ExchangeDifference = ($CalculatedBalance - $_POST['BankStatementBalance'])/$ExRate; + $ExchangeDifference = filter_number_format(($CalculatedBalance - $_POST['BankStatementBalance'])/$CurrencyRow['rate']); include ('includes/SQL_CommonFunctions.inc'); $ExDiffTransNo = GetNextTransNo(36,$db); @@ -62,7 +61,7 @@ '" . FormatDateForSQL($PostingDate) . "', '" . $PeriodNo . "', '" . $_SESSION['CompanyRecord']['exchangediffact'] . "', - '" . $BankAccountName . ' ' . _('reconciliation on') . " " . + '" . $CurrencyRow['bankaccountname'] . ' ' . _('reconciliation on') . " " . Date($_SESSION['DefaultDateFormat']) . "','" . $ExchangeDifference . "')"; $ErrMsg = _('Cannot insert a GL entry for the exchange difference because'); @@ -80,13 +79,13 @@ '" . FormatDateForSQL($PostingDate) . "', '" . $PeriodNo . "', '" . $_POST['BankAccount'] . "', - '" . $BankAccountName . ' ' . _('reconciliation on') . ' ' . Date($_SESSION['DefaultDateFormat']) . "', + '" . $CurrencyRow['bankaccountname'] . ' ' . _('reconciliation on') . ' ' . Date($_SESSION['DefaultDateFormat']) . "', '" . (-$ExchangeDifference) . "')"; $result = DB_query($SQL,$db,$ErrMsg,$DbgMsg,true); $result = DB_Txn_Commit($db); - prnMsg(_('Exchange difference of') . ' ' . locale_number_format($ExchangeDifference,2) . ' ' . _('has been posted'),'success'); + prnMsg(_('Exchange difference of') . ' ' . locale_money_format($ExchangeDifference,$_SESSION['CompanyRecord']['decimalplaces']) . ' ' . _('has been posted'),'success'); } //end if the bank statement balance was numeric } @@ -153,25 +152,24 @@ /* Now need to get the currency of the account and the current table ex rate */ $SQL = "SELECT rate, bankaccounts.currcode, - bankaccounts.bankaccountname + bankaccounts.bankaccountname, + currencies.decimalplaces AS currdecimalplaces FROM bankaccounts INNER JOIN currencies ON bankaccounts.currcode=currencies.currabrev WHERE bankaccounts.accountcode = '" . $_POST['BankAccount']."'"; $ErrMsg = _('Could not retrieve the currency and exchange rate for the selected bank account'); $CurrencyResult = DB_query($SQL,$db); - $CurrencyRow = DB_fetch_row($CurrencyResult); - $ExRate = $CurrencyRow[0]; - $BankCurrCode = $CurrencyRow[1]; - $BankAccountName = $CurrencyRow[2]; + $CurrencyRow = DB_fetch_array($CurrencyResult); + echo '<table class="selection"> - <tr class="EvenTableRows"><td colspan=6><b>' . $BankAccountName . ' ' . _('Balance as at') . ' ' . Date($_SESSION['DefaultDateFormat']); + <tr class="EvenTableRows"><td colspan=6><b>' . $CurrencyRow['bankaccountname'] . ' ' . _('Balance as at') . ' ' . Date($_SESSION['DefaultDateFormat']); - if ($_SESSION['CompanyRecord']['currencydefault']!=$BankCurrCode){ - echo ' (' . $BankCurrCode . ' @ ' . $ExRate .')'; + if ($_SESSION['CompanyRecord']['currencydefault']!=$CurrencyRow['currcode']){ + echo ' (' . $CurrencyRow['currcode'] . ' @ ' . $CurrencyRow['rate'] .')'; } echo '</b></td> - <td valign=bottom class="number"><b>' . locale_number_format($Balance*$ExRate,$CurrDecimalPlaces) . '</b></td></tr>'; + <td valign=bottom class="number"><b>' . locale_money_format($Balance*$CurrencyRow['rate'],$CurrencyRow['currdecimalplaces']) . '</b></td></tr>'; $SQL = "SELECT amount/exrate AS amt, amountcleared, @@ -222,15 +220,15 @@ <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> </tr>', ConvertSQLDate($myrow['transdate']), $myrow['typename'], $myrow['transno'], $myrow['ref'], - locale_number_format($myrow['amt'],$CurrDecimalPlaces), - locale_number_format($myrow['outstanding'],$CurrDecimalPlaces)); + locale_money_format($myrow['amt'],$CurrencyRow['currdecimalplaces']), + locale_money_format($myrow['outstanding'],$CurrencyRow['currdecimalplaces'])); $TotalUnpresentedCheques +=$myrow['outstanding']; @@ -241,20 +239,20 @@ } } //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_number_format($TotalUnpresentedCheques,$CurrDecimalPlaces) . '</td></tr>'; + <tr class=EvenTableRows><td colspan=6>' . _('Total of all unpresented cheques') . '</td><td class="number">' . locale_money_format($TotalUnpresentedCheques,$CurrencyRow['currdecimalplaces']) . '</td></tr>'; $SQL = "SELECT amount/exrate AS amt, amountcleared, - (amount/exrate)-amountcleared as outstanding, + (amount/exrate)-amountcleared AS outstanding, ref, transdate, systypes.typename, transno - FROM banktrans, - systypes - WHERE banktrans.type = systypes.typeid - AND banktrans.bankact='" . $_POST['BankAccount'] . "' + FROM banktrans INNER JOIN systypes + ON banktrans.type = systypes.typeid + WHERE banktrans.bankact='" . $_POST['BankAccount'] . "' AND amount > 0 AND ABS((amount/exrate)-amountcleared)>0.009 ORDER BY transdate"; @@ -264,7 +262,7 @@ $UPChequesResult = DB_query($SQL,$db,$ErrMsg); - echo '<tr><td colspan=6><b>' . _('Less deposits not cleared') . ':</b></td></tr>'; + echo '<tr><td colspan="6"><b>' . _('Less deposits not cleared') . ':</b></td></tr>'; $TableHeader = '<tr> <th>' . _('Date') . '</th> @@ -294,15 +292,15 @@ <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> </tr>', ConvertSQLDate($myrow['transdate']), $myrow['typename'], $myrow['transno'], $myrow['ref'], - locale_number_format($myrow['amt'],$CurrDecimalPlaces), - locale_number_format($myrow['outstanding'],$CurrDecimalPlaces) ); + locale_money_format($myrow['amt'],$CurrencyRow['currdecimalplaces']), + locale_money_format($myrow['outstanding'],$CurrencyRow['currdecimalplaces']) ); $TotalUnclearedDeposits +=$myrow['outstanding']; @@ -316,25 +314,28 @@ echo '<tr></tr> <tr class=EvenTableRows> <td colspan=6>' . _('Total of all uncleared deposits') . '</td> - <td class=number>' . locale_number_format($TotalUnclearedDeposits,$CurrDecimalPlaces) . '</td> + <td class="number">' . locale_money_format($TotalUnclearedDeposits,$CurrencyRow['currdecimalplaces']) . '</td> </tr>'; - $FXStatementBalance = ($Balance*$ExRate) - $TotalUnpresentedCheques -$TotalUnclearedDeposits; + $FXStatementBalance = filter_number_format(($Balance*$CurrencyRow['rate']) - $TotalUnpresentedCheques -$TotalUnclearedDeposits); echo '<tr></tr> <tr class=EvenTableRows> - <td colspan=6><b>' . _('Bank statement balance should be') . ' (' . $BankCurrCode . ')</b></td> - <td class=number>' . locale_number_format($FXStatementBalance,$CurrDecimalPlaces) . '</td></tr>'; + <td colspan=6><b>' . _('Bank statement balance should be') . ' (' . $CurrencyRow['currcode'] . ')</b></td> + <td class="number">' . locale_money_format($FXStatementBalance,$CurrencyRow['currdecimalplaces']) . '</td></tr>'; if (isset($_POST['DoExchangeDifference'])){ - echo '<input type="hidden" name="DoExchangeDifference" value=' . $FXStatementBalance . '>'; - echo '<tr><td colspan=6>' . _('Enter the actual bank statement balance') . ' (' . $BankCurrCode . ')</b></td> - <td class=number><input type="text" name="BankStatementBalance" maxlength=15 size=15 value=' . $_POST['BankStatementBalance'] . '><td></tr>'; + echo '<input type="hidden" name="DoExchangeDifference" value=' . $FXStatementBalance . ' />'; + if (!isset($_POST['BankStatementBalance'])){ + $_POST['BankStatementBalance'] =0; + } + echo '<tr><td colspan=6>' . _('Enter the actual bank statement balance') . ' (' . $CurrencyRow['currcode'] . ')</b></td> + <td class="number"><input type="text" name="BankStatementBalance" maxlength="15" size="15" value=' . locale_number_format($_POST['BankStatementBalance'],$CurrencyRow['currdecimalplaces']) . ' /><td></tr>'; echo '<tr><td colspan=7 align="center"><input type="submit" name="PostExchangeDifference" value="' . _('Calculate and Post Exchange Difference') . '" onclick="return confirm(\'' . _('This will create a general ledger journal to write off the exchange difference in the current balance of the account. It is important that the exchange rate above reflects the current value of the bank account currency') . ' - ' . _('Are You Sure?') . '\');"></td></tr>'; } - if ($_SESSION['CompanyRecord']['currencydefault']!=$BankCurrCode AND !isset($_POST['DoExchangeDifference'])){ + if ($_SESSION['CompanyRecord']['currencydefault']!=$CurrencyRow['currcode'] AND !isset($_POST['DoExchangeDifference'])){ echo '<tr><td colspan=7><hr></td></tr> <tr><td colspan=7>' . _('It is normal for foreign currency accounts to have exchange differences that need to be reflected as the exchange rate varies. This reconciliation is prepared using the exchange rate set up in the currencies table (see the set-up tab). This table must be maintained with the current exchange rate before running the reconciliation. If you wish to create a journal to reflect the exchange difference based on the current exchange rate to correct the reconciliation to the actual bank statement balance click below.') . '</td></tr>'; Modified: trunk/PDFGrn.php =================================================================== --- trunk/PDFGrn.php 2011-09-12 23:37:53 UTC (rev 4688) +++ trunk/PDFGrn.php 2011-09-14 08:06:45 UTC (rev 4689) @@ -54,12 +54,12 @@ ON grns.podetailitem=purchorderdetails.podetailitem LEFT JOIN stockmaster ON grns.itemcode=stockmaster.stockid - WHERE grnbatch='".$GRNNo."'"; - + WHERE grnbatch='".filter_number_format($GRNNo)."'"; + $GRNResult=DB_query($sql, $db); $NoOfGRNs = DB_num_rows($GRNResult); if($NoOfGRNs>0) { //there are GRNs to print - + $sql = "SELECT suppliers.suppname, suppliers.address1, suppliers.address2 , @@ -69,14 +69,14 @@ suppliers.address6 FROM grns INNER JOIN suppliers ON grns.supplierid=suppliers.supplierid - WHERE grnbatch='".$GRNNo."'"; + WHERE grnbatch='".filter_number_format($GRNNo)."'"; $SuppResult = DB_query($sql,$db,_('Could not get the supplier of the selected GRN')); $SuppRow = DB_fetch_array($SuppResult); } } // get data to print if ($NoOfGRNs >0){ include ('includes/PDFGrnHeader.inc'); //head up the page - + $YPos=$FormDesign->Data->y; for ($i=1;$i<=$NoOfGRNs;$i++) { if ($GRNNo!='Preview'){ @@ -88,13 +88,13 @@ $DecimalPlaces=2; } if (is_numeric($myrow['conversionfactor']) AND $myrow['conversionfactor'] !=0){ - $SuppliersQuantity=locale_number_format($myrow['qtyrecd']/$myrow['conversionfactor'],$DecimalPlaces); + $SuppliersQuantity=locale_number_format(filter_number_format($myrow['qtyrecd']/$myrow['conversionfactor']),$DecimalPlaces); } else { $SuppliersQuantity=locale_number_format($myrow['qtyrecd'],$DecimalPlaces); } $OurUnitsQuantity=locale_number_format($myrow['qtyrecd'],$DecimalPlaces); $DeliveryDate = ConvertSQLDate($myrow['deliverydate']); - + $LeftOvers = $pdf->addTextWrap($FormDesign->Data->Column1->x,$Page_Height-$YPos,$FormDesign->Data->Column1->Length,$FormDesign->Data->Column1->FontSize, $myrow['itemcode']); $LeftOvers = $pdf->addTextWrap($FormDesign->Data->Column2->x,$Page_Height-$YPos,$FormDesign->Data->Column2->Length,$FormDesign->Data->Column2->FontSize, $myrow['itemdescription']); $LeftOvers = $pdf->addTextWrap($FormDesign->Data->Column3->x,$Page_Height-$YPos,$FormDesign->Data->Column3->Length,$FormDesign->Data->Column3->FontSize, $DeliveryDate); @@ -114,13 +114,13 @@ $LeftOvers = $pdf->addText($FormDesign->ReceiptDate->x,$Page_Height-$FormDesign->ReceiptDate->y,$FormDesign->ReceiptDate->FontSize, _('Date of Receipt: ') . $DeliveryDate); $LeftOvers = $pdf->addText($FormDesign->SignedFor->x,$Page_Height-$FormDesign->SignedFor->y,$FormDesign->SignedFor->FontSize, _('Signed for ').'______________________'); - $pdf->OutputD($_SESSION['DatabaseName'] . '_GRN_' . date('Y-m-d').'.pdf');//UldisN - $pdf->__destruct(); //UldisN + $pdf->OutputD($_SESSION['DatabaseName'] . '_GRN_' . date('Y-m-d').'.pdf'); + $pdf->__destruct(); } else { //there were not GRNs to print $title = _('GRN Error'); include('includes/header.inc'); prnMsg(_('There were no GRNs to print'),'warn'); - echo '<br /><a href="'.$rootpath.'/index.php?' . SID . '">'. _('Back to the menu').'</a>'; + echo '<br /><a href="'.$rootpath.'/index.php">'. _('Back to the menu').'</a>'; include('includes/footer.inc'); } ?> \ No newline at end of file Modified: trunk/PDFOrdersInvoiced.php =================================================================== --- trunk/PDFOrdersInvoiced.php 2011-09-12 23:37:53 UTC (rev 4688) +++ trunk/PDFOrdersInvoiced.php 2011-09-14 08:06:45 UTC (rev 4689) @@ -211,7 +211,7 @@ stockmaster.description, stockmaster.units, stockmaster.decimalplaces"; - + } elseif ($_POST['CategoryID']!='All' AND $_POST['location']!='All'){ $sql= "SELECT salesorders.orderno, @@ -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($AccumOrderTotal,2), 'right'); + $LeftOvers = $pdf->addTextWrap($Left_Margin+360,$YPos,80,$FontSize,locale_money_format(filter_number_format($AccumOrderTotal),$_SESSION['CompanyRecord']['decimalplaces']), 'right'); $YPos -= ($line_height); $AccumOrderTotal =0; } @@ -395,12 +395,12 @@ while ($InvRow=DB_fetch_array($InvoicesResult)){ - $ValueInvoiced = $InvRow['price']*$InvRow['quantity']; + $ValueInvoiced = filter_number_format($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'); - $LeftOvers = $pdf->addTextWrap($Left_Margin+300,$YPos,60,$FontSize,locale_number_format($InvRow['price'],2), 'right'); - $LeftOvers = $pdf->addTextWrap($Left_Margin+360,$YPos,80,$FontSize,locale_number_format($ValueInvoiced,2), 'right'); + $LeftOvers = $pdf->addTextWrap($Left_Margin+300,$YPos,60,$FontSize,locale_money_format($InvRow['price'],$_SESSION['CompanyRecord']['decimalplaces']), 'right'); + $LeftOvers = $pdf->addTextWrap($Left_Margin+360,$YPos,80,$FontSize,locale_money_format($ValueInvoiced,$_SESSION['CompanyRecord']['decimalplaces']), 'right'); $YPos -= ($line_height); @@ -414,7 +414,6 @@ } - $YPos -= ($line_height); if ($YPos - (2 *$line_height) < $Bottom_Margin){ /*Then set up a new page */ @@ -425,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($AccumTotalInv,2), 'right'); +$LeftOvers = $pdf->addTextWrap($Left_Margin+360,$YPos,80,$FontSize,locale_money_format(filter_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-09-12 23:37:53 UTC (rev 4688) +++ trunk/PDFPeriodStockTransListing.php 2011-09-14 08:06:45 UTC (rev 4689) @@ -1,207 +1,207 @@ -<?php -/* $Id: PDFPeriodStockTransListing.php 4307 2010-12-22 16:06:03Z tim_schofield $*/ - -include('includes/SQL_CommonFunctions.inc'); -include ('includes/session.inc'); - -$InputError=0; -if (isset($_POST['FromDate']) AND !Is_Date($_POST['FromDate'])){ - $msg = _('The date must be specified in the format') . ' ' . $_SESSION['DefaultDateFormat']; - $InputError=1; - unset($_POST['FromDate']); -} - -if (!isset($_POST['FromDate'])){ - - $title = _('Stock 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="">' . ' '. _('Stock Transaction Listing').'</img></p> - </div>'; - - 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">'; - echo '<tr> - <td>' . _('Enter the date from which the transactions 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> - </tr>'; - echo '<tr> - <td>' . _('Enter the date to which the transactions 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> - </tr>'; - - echo '<tr><td>' . _('Transaction type') . '</td><td>'; - - echo '<select name="TransType">'; - - echo '<option value=10>' . _('Sales Invoice').'</option> - <option value=11>' . _('Sales Credit Note').'</option> - <option value=16>' . _('Location Transfer').'</option> - <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>'; - - 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>'; - while ($myrow=DB_fetch_array($resultStkLocs)){ - if (isset($_POST['StockLocation']) AND $_POST['StockLocation']!='All'){ - if ($myrow['loccode'] == $_POST['StockLocation']){ - echo '<option selected value="' . $myrow['loccode'] . '">' . $myrow['locationname'] . '</option>'; - } else { - echo '<option value="' . $myrow['loccode'] . '">' . $myrow['locationname'] . '</option>'; - } - } elseif ($myrow['loccode']==$_SESSION['UserStockLocation']){ - echo '<option selected value="' . $myrow['loccode'] . '">' . $myrow['locationname'] . '</option>'; - $_POST['StockLocation']=$myrow['loccode']; - } else { - echo '<option value="' . $myrow['loccode'] . '">' . $myrow['locationname'] . '</option>'; - } - } - echo '</select></td></tr>'; - - echo '</table> - <br /> - <div class="centre"> - <input type=submit name="Go" value="' . _('Create PDF') . '" /> - </div>'; - - include('includes/footer.inc'); - exit; -} else { - - include('includes/ConnectDB.inc'); -} - - -if ($_POST['StockLocation']=='All') { - $sql= "SELECT stockmoves.type, - stockmoves.stockid, - stockmaster.description, - stockmaster.decimalplaces, - stockmoves.transno, - stockmoves.trandate, - stockmoves.qty, - stockmoves.reference, - stockmoves.narrative, - locations.locationname - FROM stockmoves - LEFT JOIN stockmaster - ON stockmoves.stockid=stockmaster.stockid - LEFT JOIN locations - ON stockmoves.loccode=locations.loccode - WHERE type='" . $_POST['TransType'] . "' - AND date_format(trandate, '%Y-%m-%d')>='".FormatDateForSQL($_POST['FromDate'])."' - AND date_format(trandate, '%Y-%m-%d')<='".FormatDateForSQL($_POST['ToDate'])."'"; -} else { - $sql= "SELECT stockmoves.type, - stockmoves.stockid, - stockmaster.description, - stockmaster.decimalplaces, - stockmoves.transno, - stockmoves.trandate, - stockmoves.qty, - stockmoves.reference, - stockmoves.narrative, - locations.locationname - FROM stockmoves - LEFT JOIN stockmaster - ON stockmoves.stockid=stockmaster.stockid - LEFT JOIN locations - ON stockmoves.loccode=locations.loccode - WHERE type='" . $_POST['TransType'] . "' - AND date_format(trandate, '%Y-%m-%d')>='".FormatDateForSQL($_POST['FromDate'])."' - AND date_format(trandate, '%Y-%m-%d')<='".FormatDateForSQL($_POST['ToDate'])."' - AND stockmoves.loccode='" . $_POST['StockLocation'] . "'"; -} -$result=DB_query($sql,$db,'','',false,false); - -if (DB_error_no($db)!=0){ - $title = _('Transaction Listing'); - include('includes/header.inc'); - prnMsg(_('An error occurred getting the transactions'),'error'); - include('includes/footer.inc'); - exit; -} elseif (DB_num_rows($result) == 0){ - $title = _('Transaction Listing'); - include('includes/header.inc'); - echo '<br />'; - prnMsg (_('There were no transactions found in the database between the dates') . ' ' . $_POST['FromDate'] . ' ' . _('and') . ' '. $_POST['ToDate'] .'<br />' ._('Please try again selecting a different date'), 'info'); - include('includes/footer.inc'); - exit; -} - -include('includes/PDFStarter.php'); - -/*PDFStarter.php has all the variables for page size and width set up depending on the users default preferences for paper size */ - -$pdf->addInfo('Title',_('Stock Transaction Listing')); -$pdf->addInfo('Subject',_('Stock transaction listing from') . ' ' . $_POST['FromDate'] . ' ' . $_POST['ToDate']); -$line_height=12; -$PageNumber = 1; - - -switch ($_POST['TransType']) { - case 10: - $TransType=_('Customer Invoices'); - break; - case 11: - $TransType=_('Customer Credit Notes'); - break; - case 16: - $TransType=_('Location Transfers'); - break; - case 17: - $TransType=_('Stock Adjustments'); - break; - case 25: - $TransType=_('Purchase Order Deliveries'); - break; - case 26: - $TransType=_('Work Order Receipts'); - break; - case 28: - $TransType=_('Work Order Issues'); - break; -} - -include ('includes/PDFPeriodStockTransListingPageHeader.inc'); - -while ($myrow=DB_fetch_array($result)){ - - $LeftOvers = $pdf->addTextWrap($Left_Margin,$YPos,160,$FontSize,$myrow['description'], 'left'); - $LeftOvers = $pdf->addTextWrap($Left_Margin+162,$YPos,80,$FontSize,$myrow['transno'], 'left'); - $LeftOvers = $pdf->addTextWrap($Left_Margin+242,$YPos,70,$FontSize,ConvertSQLDate($myrow['trandate']), 'left'); - $LeftOvers = $pdf->addTextWrap($Left_Margin+312,$YPos,70,$FontSize,locale_number_format($myrow['qty'],$myrow['decimalplaces']), 'right'); - $LeftOvers = $pdf->addTextWrap($Left_Margin+382,$YPos,70,$FontSize,$myrow['locationname'], 'right'); - $LeftOvers = $pdf->addTextWrap($Left_Margin+452,$YPos,70,$FontSize,$myrow['reference'], 'right'); - - $YPos -= ($line_height); - - if ($YPos - (2 *$line_height) < $Bottom_Margin){ - /*Then set up a new page */ - $PageNumber++; - include ('includes/PDFPeriodStockTransListingPageHeader.inc'); - } /*end of new page header */ -} /* end of while there are customer receipts in the batch to print */ - - -$YPos-=$line_height; - -$ReportFileName = $_SESSION['DatabaseName'] . '_StockTransListing_' . date('Y-m-d').'.pdf'; -$pdf->OutputD($ReportFileName); -$pdf->__destruct(); - +<?php +/* $Id: PDFPeriodStockTransListing.php 4307 2010-12-22 16:06:03Z tim_schofield $*/ + +include('includes/SQL_CommonFunctions.inc'); +include ('includes/session.inc'); + +$InputError=0; +if (isset($_POST['FromDate']) AND !Is_Date($_POST['FromDate'])){ + $msg = _('The date must be specified in the format') . ' ' . $_SESSION['DefaultDateFormat']; + $InputError=1; + unset($_POST['FromDate']); +} + +if (!isset($_POST['FromDate'])){ + + $title = _('Stock 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="">' . ' '. _('Stock Transaction Listing').'</img></p> + </div>'; + + 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">'; + echo '<tr> + <td>' . _('Enter the date from which the transactions 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> + </tr>'; + echo '<tr> + <td>' . _('Enter the date to which the transactions 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> + </tr>'; + + echo '<tr><td>' . _('Transaction type') . '</td><td>'; + + echo '<select name="TransType">'; + + echo '<option value=10>' . _('Sales Invoice').'</option> + <option value=11>' . _('Sales Credit Note').'</option> + <option value=16>' . _('Location Transfer').'</option> + <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>'; + + 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>'; + while ($myrow=DB_fetch_array($resultStkLocs)){ + if (isset($_POST['StockLocation']) AND $_POST['StockLocation']!='All'){ + if ($myrow['loccode'] == $_POST['StockLocation']){ + echo '<option selected value="' . $myrow['loccode'] . '">' . $myrow['locationname'] . '</option>'; + } else { + echo '<option value="' . $myrow['loccode'] . '">' . $myrow['locationname'] . '</option>'; + } + } elseif ($myrow['loccode']==$_SESSION['UserStockLocation']){ + echo '<option selected value="' . $myrow['loccode'] . '">' . $myrow['locationname'] . '</option>'; + $_POST['StockLocation']=$myrow['loccode']; + } else { + echo '<option value="' . $myrow['loccode'] . '">' . $myrow['locationname'] . '</option>'; + } + } + echo '</select></td></tr>'; + + echo '</table> + <br /> + <div class="centre"> + <input type="submit" name="Go" value="' . _('Create PDF') . '" /> + </div>'; + + include('includes/footer.inc'); + exit; +} else { + + include('includes/ConnectDB.inc'); +} + + +if ($_POST['StockLocation']=='All') { + $sql= "SELECT stockmoves.type, + stockmoves.stockid, + stockmaster.description, + stockmaster.decimalplaces, + stockmoves.transno, + stockmoves.trandate, + stockmoves.qty, + stockmoves.reference, + stockmoves.narrative, + locations.locationname + FROM stockmoves + LEFT JOIN stockmaster + ON stockmoves.stockid=stockmaster.stockid + LEFT JOIN locations + ON stockmoves.loccode=locations.loccode + WHERE type='" . $_POST['TransType'] . "' + AND date_format(trandate, '%Y-%m-%d')>='".FormatDateForSQL($_POST['FromDate'])."' + AND date_format(trandate, '%Y-%m-%d')<='".FormatDateForSQL($_POST['ToDate'])."'"; +} else { + $sql= "SELECT stockmoves.type, + stockmoves.stockid, + stockmaster.description, + stockmaster.decimalplaces, + stockmoves.transno, + stockmoves.trandate, + stockmoves.qty, + stockmoves.reference, + stockmoves.narrative, + locations.locationname + FROM stockmoves + LEFT JOIN stockmaster + ON stockmoves.stockid=stockmaster.stockid + LEFT JOIN locations + ON stockmoves.loccode=locations.loccode + WHERE type='" . $_POST['TransType'] . "' + AND date_format(trandate, '%Y-%m-%d')>='".FormatDateForSQL($_POST['FromDate'])."' + AND date_format(trandate, '%Y-%m-%d')<='".FormatDateForSQL($_POST['ToDate'])."' + AND stockmoves.loccode='" . $_POST['StockLocation'] . "'"; +} +$result=DB_query($sql,$db,'','',false,false); + +if (DB_error_no($db)!=0){ + $title = _('Transaction Listing'); + include('includes/header.inc'); + prnMsg(_('An error occurred getting the transactions'),'error'); + include('includes/footer.inc'); + exit; +} elseif (DB_num_rows($result) == 0){ + $title = _('Transaction Listing'); + include('includes/header.inc'); + echo '<br />'; + prnMsg (_('There were no transactions found in the database between the dates') . ' ' . $_POST['FromDate'] . ' ' . _('and') . ' '. $_POST['ToDate'] .'<br />' ._('Please try again selecting a different date'), 'info'); + include('includes/footer.inc'); + exit; +} + +include('includes/PDFStarter.php'); + +/*PDFStarter.php has all the variables for page size and width set up depending on the users default preferences for paper size */ + +$pdf->addInfo('Title',_('Stock Transaction Listing')); +$pdf->addInfo('Subject',_('Stock transaction listing from') . ' ' . $_POST['FromDate'] . ' ' . $_POST['ToDate']); +$line_height=12; +$PageNumber = 1; + + +switch ($_POST['TransType']) { + case 10: + $TransType=_('Customer Invoices'); + break; + case 11: + $TransType=_('Customer Credit Notes'); + break; + case 16: + $TransType=_('Location Transfers'); + break; + case 17: + $TransType=_('Stock Adjustments'); + break; + case 25: + $TransType=_('Purchase Order Deliveries'); + break; + case 26: + $TransType=_('Work Order Receipts'); + break; + case 28: + $TransType=_('Work Order Issues'); + break; +} + +include ('includes/PDFPeriodStockTransListingPageHeader.inc'); + +while ($myrow=DB_fetch_array($result)){ + + $LeftOvers = $pdf->addTextWrap($Left_Margin,$YPos,160,$FontSize,$myrow['description'], 'left'); + $LeftOvers = $pdf->addTextWrap($Left_Margin+162,$YPos,80,$FontSize,$myrow['transno'], 'left'); + $LeftOvers = $pdf->addTextWrap($Left_Margin+242,$YPos,70,$FontSize,ConvertSQLDate($myrow['trandate']), 'left'); + $LeftOvers = $pdf->addTextWrap($Left_Margin+312,$YPos,70,$FontSize,locale_number_format($myrow['qty'],$myrow['decimalplaces']), 'right'); + $LeftOvers = $pdf->addTextWrap($Left_Margin+382,$YPos,70,$FontSize,$myrow['locationname'], 'right'); + $LeftOvers = $pdf->addTextWrap($Left_Margin+452,$YPos,70,$FontSize,$myrow['reference'], 'right'); + + $YPos -= ($line_height); + + if ($YPos - (2 *$line_height) < $Bottom_Margin){ + /*Then set up a new page */ + $PageNumber++; + include ('includes/PDFPeriodStockTransListingPageHeader.inc'); + } /*end of new page header */ +} /* end of while there are customer receipts in the batch to print */ + + +$YPos-=$line_height; + +$ReportFileName = $_SESSION['DatabaseName'] . '_StockTransListing_' . date('Y-m-d').'.pdf'; +$pdf->OutputD($ReportFileName); +$pdf->__destruct(); + ?> \ No newline at end of file Modified: trunk/PDFPickingList.php =================================================================== --- trunk/PDFPickingList.php 2011-09-12 23:37:53 UTC (rev 4688) +++ trunk/PDFPickingList.php 2011-09-14 08:06:45 UTC (rev 4689) @@ -21,9 +21,9 @@ if ((!isset($_GET['TransNo']) or $_GET['TransNo']=="") and !isset($_POST['TransDate'])){ $title = _('Select Picking Lists'); include('includes/header.inc'); - $sql='SELECT loccode, + $sql="SELECT loccode, locationname - FROM locations'; + FROM locations"; $result=DB_query($sql, $db); 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">'; @@ -49,78 +49,78 @@ 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, - salesorders.customerref, - salesorders.comments, - salesorders.orddate, - salesorders.deliverto, - salesorders.deladd1, - salesorders.deladd2, - salesorders.deladd3, - salesorders.deladd4, - salesorders.deladd5, - salesorders.deladd6, - salesorders.deliverblind, - 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, - debtorsmaster, - shippers, - locations - WHERE salesorders.debtorno=debtorsmaster.debtorno - AND salesorders.shipvia=shippers.shipper_id - AND salesorders.fromstkloc=locations.loccode - AND salesorders.orderno='" . $_GET['TransNo']."'"; -} else if (isset($_POST['TransDate']) + salesorders.orderno, + salesorders.customerref, + salesorders.comments, + salesorders.orddate, + salesorders.deliverto, + salesorders.deladd1, + salesorders.deladd2, + salesorders.deladd3, + salesorders.deladd4, + salesorders.deladd5, + salesorders.deladd6, + salesorders.deliverblind, + 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, + debtorsmaster, + shippers, + locations + WHERE salesorders.debtorno=debtorsmaster.debtorno + AND salesorders.shipvia=shippers.shipper_id + AND salesorders.fromstkloc=locations.loccode + AND salesorders.orderno='" . filter_number_format($_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 */ $sql = "SELECT salesorders.debtorno, - salesorders.orderno, - salesorders.customerref, - salesorders.comments, - salesorders.orddate, - salesorders.deliverto, - salesorders.deladd1, - salesorders.deladd2, - salesorders.deladd3, - salesorders.deladd4, - salesorders.deladd5, - salesorders.deladd6, - salesorders.deliverblind, - 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, - debtorsmaster, - shippers, - locations - WHERE salesorders.debtorno=debtorsmaster.debtorno - AND salesorders.shipvia=shippers.shipper_id - AND salesorders.fromstkloc=locations.loccode - AND salesorders.fromstkloc='".$_POST['loccode']."' - AND salesorders.deliverydate='" . FormatDateForSQL($_POST['TransDate'])."'"; + salesorders.orderno, + salesorders.customerref, + salesorders.comments, + salesorders.orddate, + salesorders.deliverto, + salesorders.deladd1, + salesorders.deladd2, + salesorders.deladd3, + salesorders.deladd4, + salesorders.deladd5, + salesorders.deladd6, + salesorders.deliverblind, + 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, + debtorsmaster, + shippers, + locations + WHERE salesorders.debtorno=debtorsmaster.debtorno + AND salesorders.shipvia=shippers.shipper_id + AND salesorders.fromstkloc=locations.loccode + AND salesorders.fromstkloc='".$_POST['loccode']."' + AND salesorders.deliverydate='" . FormatDateForSQL($_POST['TransDate'])."'"; } -if (isset($_POST['TransDate']) +if (isset($_POST['TransDate']) OR (isset($_GET['TransNo']) AND $_GET['TransNo'] != 'Preview')) { $result=DB_query($sql,$db, $ErrMsg); @@ -185,7 +185,7 @@ $pdf->addInfo('Title', _('Picking List') ); $pdf->addInfo('Subject', _('Laser Picking List') ); $FontSize=12; -$ListCount = 0; +$ListCount = 0; $Copy=''; $line_height=$FormDesign->LineHeight; @@ -207,44 +207,46 @@ /* Are there any picking lists for this order already */ $sql="SELECT COUNT(orderno) FROM pickinglists - WHERE orderno='" . $OrdersToPick[$i]['orderno'] . "'"; + WHERE orderno='" . filter_number_format($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, - salesorderdetails.orderlineno, - salesorderdetails.quantity, - salesorderdetails.qtyinvoiced, - salesorderdetails.unitprice, - salesorderdetails.narrative - FROM salesorderdetails - INNER JOIN stockmaster - ON salesorderdetails.stkcode=stockmaster.stockid - WHERE salesorderdetails.orderno='" . $OrdersToPick[$i]['orderno'] ."'"; + stockmaster.description, + salesorderdetails.orderlineno, + salesorderdetails.quantity, + salesorderdetails.qtyinvoiced, + salesorderdetails.unitprice, + salesorderdetails.narrative, + stockmaster.decimalplaces + FROM salesorderdetails + INNER JOIN stockmaster + ON salesorderdetails.stkcode=stockmaster.stockid + WHERE salesorderdetails.orderno='" . filer_number_format($OrdersToPick[$i]['orderno']) ."'"; } else { /* There are previous picking lists for this order so * need to take those quantities into account */ $sql = "SELECT salesorderdetails.stkcode, - stockmaster.description, - salesorderdetails.orderlineno, - salesorderdetails.quantity, - salesorderdetails.qtyinvoiced, - SUM(pickinglistdetails.qtyexpected) as qtyexpected, - SUM(pickinglistdetails.qtypicked) as qtypicked, - salesorderdetails.unitprice, - salesorderdetails.narrative - FROM salesorderdetails - INNER JOIN stockmaster - ON salesorderdetails.stkcode=stockmaster.stockid - LEFT JOIN pickinglists - ON salesorderdetails.orderno=pickinglists.orderno - LEFT JOIN pickinglistdetails - ON pickinglists.pickinglistno=pickinglistdetails.pickinglistno - WHERE salesorderdetails.orderno='" . $OrdersToPick[$i]['orderno'] ."' - AND salesorderdetails.orderlineno=pickinglistdetails.orderlineno"; + stockmaster.description, + salesorderdetails.orderlineno, + salesorderdetails.quantity, + salesorderdetails.qtyinvoiced, + SUM(pickinglistdetails.qtyexpected) as qtyexpected, + SUM(pickinglistdetails.qtypicked) as qtypicked, + salesorderdetails.unitprice, + salesorderdetails.narrative, + stockmaster.decimalplaces + FROM salesorderdetails + INNER JOIN stockmaster + ON salesorderdetails.stkcode=stockmaster.stockid + LEFT JOIN pickinglists + ON salesorderdetails.orderno=pickinglists.orderno + LEFT JOIN pickinglistdetails + ON pickinglists.pickinglistno=pickinglistdetails.pickinglistno + WHERE salesorderdetails.orderno='" . filter_number_format($OrdersToPick[$i]['orderno']) ."' + AND salesorderdetails.orderlineno=pickinglistdetails.orderlineno"; } $lineresult=DB_query($sql,$db, $ErrMsg); } @@ -258,7 +260,7 @@ $sql="INSERT INTO pickinglists VALUES ( '" . $PickingListNo ."', - '" . $OrdersToPick[$i]['orderno']."', + '" . filter_number_format($OrdersToPick[$i]['orderno'])."', '" . FormatDateForSQL($_POST['TransDate'])."', '" . date('Y-m-d')."', '0000-00-00')"; @@ -284,16 +286,16 @@ $myrow2['qtyexpected']=0; $myrow2['qtypicked']=0; } - $DisplayQty = locale_number_format($myrow2['quantity'],2); - $DisplayPrevDel = locale_number_format($myrow2['qtyinvoiced'],2); - $DisplayQtySupplied = locale_number_format($myrow2['quantity'] - $myrow2['qtyinvoiced']-$myrow2['qtyexpected']-$myrow2['qtypicked'],2); + $DisplayQty = locale_number_format($myrow2['quantity'],$myrow2['decimalplaces']); + $DisplayPrevDel = locale_number_format($myrow2['qtyinvoiced'],$myrow2['decimalplaces']); + $DisplayQtySupplied = locale_number_format(filer_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']."', - '" . $DisplayQtySupplied."', + '" . filter_number_format($DisplayQtySupplied) ."', 0)"; $lineresult=DB_query($sql, $db); } @@ -327,6 +329,6 @@ exit; } else { $pdf->OutputD($_SESSION['DatabaseName'] . '_PickingLists_' . date('Y-m-d') . '.pdf'); - $pdf->__destruct(); + $pdf->__destruct(); } ?> \ No newline at end of file Modified: trunk/PDFPriceList.php =================================================================== --- trunk/PDFPriceList.php 2011-09-12 23:37:53 UTC (rev 4688) +++ trunk/PDFPriceList.php 2011-09-14 08:06:45 UTC (rev 4689) @@ -1,7 +1,6 @@ <?php -/* $Revision: 1.14 $ */ +/* $Id$*/ -//$PageSecurity = 2; include('includes/session.inc'); If (isset($_POST['PrintPDF']) @@ -27,7 +26,7 @@ include('includes/header.inc'); echo '<br />'; prnMsg( _('The customer must first be selected from the select customer link') . '. ' . _('Re-run the price list once the customer has been selected') ); - echo '<br /><br /><a href="' . $_SERVER['PHP_SELF'] . '?' . SID . '">' . _('Back') . '</a>'; + echo '<br /><br /><a href="' . $_SERVER['PHP_SELF'] . '">' . _('Back') . '</a>'; include('includes/footer.inc'); exit; } @@ -35,7 +34,7 @@ $title = _('Special price List - No Customer Selected'); include('includes/header.inc'); prnMsg(_('The effective date must be entered in the format') . ' ' . $_SESSION['DefaultDateFormat'],'error'); - echo '<br /><br /><a href="' . $_SERVER['PHP_SELF'] . '?' . SID . '">' . _('Back') . '</a>'; + echo '<br /><br /><a href="' . $_SERVER['PHP_SELF'] . '">' . _('Back') . '</a>'; include('includes/footer.inc'); exit; } @@ -50,32 +49,35 @@ $SalesType = $CustNameRow[1]; $SQL = "SELECT prices.typeabbrev, - prices.stockid, - stockmaster.description, - stockmaster.longdescription, - prices.currabrev, - prices.startdate, - prices.enddate, - prices.price, - stockmaster.materialcost+stockmaster.labourcost+stockmaster.overheadcost AS standardcost, - stockmaster.categoryid, - stockcategory.categorydescription, - prices.debtorno, - prices.branchcode, - custbranch.brname - FROM stockmaster, - stockcategory, - prices LEFT JOIN custbranch + prices.stockid, + stockmaster.description, + stockmaster.longdescription, + prices.currabrev, + prices.startdate, + prices.enddate, + prices.price, + stockmaster.materialcost+stockmaster.labourcost+stockmaster.overheadcost AS standardcost, + stockmaster.categoryid, + stockcategory.categorydescription, + prices.debtorno, + prices.branchcode, + custbranch.brname, + currencies.decimalplaces + FROM stockmaster INNER JOIN stockcategory + ON stockmaster.categoryid=stockcategory.categoryid + INNER JOIN prices + ON stockmaster.stockid=prices.stockid + INNER JOIN currencies + ON prices.currabrev=currencies.currabrev + LEFT JOIN custbranch ON prices.debtorno=custbranch.debtorno AND prices.branchcode=custbranch.branchcode - WHERE stockmaster.stockid=prices.stockid - AND stockmaster.categoryid=stockcategory.categoryid - AND prices.typeabbrev = '" . $SalesType . "' + WHERE prices.typeabbrev = '" . $SalesType . "' AND stockmaster.categoryid >= '" . $_POST['FromCriteria'] . "' AND stockmaster.categoryid <= '" . $_POST['ToCriteria'] . "' AND prices.debtorno='" . $_SESSION['CustomerID'] . "' AND prices.startdate<='" . FormatDateForSQL($_POST['EffectiveDate']) . "' - AND (prices.enddate='0000-00-00' OR prices.enddate>'" . FormatDateForSQL($_POST['EffectiveDate']) . "') + AND (prices.enddate='0000-00-00' OR prices.enddate >'" . FormatDateForSQL($_POST['EffectiveDate']) . "') ORDER BY prices.currabrev, stockmaster.categoryid, stockmaster.stockid, @@ -89,31 +91,33 @@ $SalesTypeName = $SalesTypeRow[0]; $SQL = "SELECT prices.typeabbrev, - prices.stockid, - prices.startdate, - prices.enddate, - stockmaster.description, - stockmaster.longdescription, - prices.currabrev, - prices.price, - stockmaster.materialcost+stockmaster.labourcost+stockmaster.overheadcost as standardcost, - stockmaster.categoryid, - stockcategory.categorydescription - FROM prices, - stockmaster, - stockcategory - WHERE stockmaster.stockid=prices.stockid - AND stockmaster.categoryid=stockcategory.categoryid - AND stockmaster.categoryid >= '" . $_POST['FromCriteria'] . "' - AND stockmaster.categoryid <= '" . $_POST['ToCriteria'] . "' - AND prices.typeabbrev='" . $_POST['SalesType'] . "' - AND prices.startdate<='" . FormatDateForSQL($_POST['EffectiveDate']) . "' - AND (prices.enddate='0000-00-00' OR prices.enddate>'" . FormatDateForSQL($_POST['EffectiveDate']) . "') - AND prices.debtorno='' - ORDER BY prices.currabrev, - stockmaster.categoryid, - stockmaster.stockid, - prices.startdate"; + prices.stockid, + prices.startdate, + prices.enddate, + stockmaster.description, + stockmaster.longdescription, + prices.currabrev, + prices.price, + stockmaster.materialcost+stockmaster.labourcost+stockmaster.overheadcost as standardcost, + stockmaster.categoryid, + stockcategory.categorydescription, + currencies.decimalplaces + FROM stockmaster INNER JOIN stockcategory + ON stockmaster.categoryid=stockcategory.categoryid + INNER JOIN prices + ON stockmaster.stockid=prices.stockid + INNER JOIN currencies + ON prices.currabrev=currencies.currabrev + WHERE stockmaster.categoryid >= '" . $_POST['FromCriteria'] . "' + AND stockmaster.categoryid <= '" . $_POST['ToCriteria'] . "' + AND prices.typeabbrev='" . $_POST['SalesType'] . "' + AND prices.startdate<='" . FormatDateForSQL($_POST['EffectiveDate']) . "' + AND (prices.enddate='0000-00-00' OR prices.enddate>'" . FormatDateForSQL($_POST['EffectiveDate']) . "') + AND prices.debtorno='' + ORDER BY prices.currabrev, + stockmaster.categoryid, + stockmaster.stockid, + prices.startdate"; } $PricesResult = DB_query($SQL,$db,'','',false,false); @@ -121,7 +125,7 @@ $title = _('Price List') . ' - ' . _('Problem Report....'); include('includes/header.inc'); prnMsg( _('The Price List could not be retrieved by the SQL because'). ' - ' . DB_error_msg($db), 'error'); - echo '<br /><a href="' .$rootpath .'/index.php?' . SID . '">'. _('Back to the menu'). '</a>'; + echo '<br /><a href="' .$rootpath .'/index.php">'. _('Back to the menu'). '</a>'; if ($debug==1){ prnMsg(_('For debugging purposes the SQL used was:') . $SQL,'error'); } @@ -132,7 +136,7 @@ $title = _('Print Price List Error'); include('includes/header.inc'); prnMsg(_('There were no price details to print out for the customer or category specified'),'warn'); - echo '<br /><a href="'.$_SERVER['PHP_SELF'] .'?' . SID . '">'. _('Back').'</a>'; + echo '<br /><a href="'.$_SERVER['PHP_SELF'] . '">'. _('Back').'</a>'; include('includes/footer.inc'); exit; } @@ -173,11 +177,11 @@ } $LeftOvers = $pdf->addTextWrap($Left_Margin+80+47,$YPos,47,$FontSize,$DisplayEndDate); $LeftOvers = $pdf->addTextWrap($Left_Margin+80+47+47,$YPos,130,$FontSize,$PriceList['description']); - $DisplayUnitPrice = locale_number_format($PriceList['price'],2); + $DisplayUnitPrice = locale_money_format($PriceList['price'],$PriceList['decimalplaces']); $LeftOvers = $pdf->addTextWrap($Left_Margin+80+47+47+130,$YPos,150,$FontSize,$DisplayUnitPrice, 'right'); if ($PriceList['price']!=0){ - $DisplayGPPercent = (int)(($PriceList['price']-$PriceList['standardcost'])*100/$PriceList['price']) . '%'; + $DisplayGPPercent = (int)filter_number_format((($PriceList['price']-$PriceList['standardcost'])*100/$PriceList['price'])) . '%'; } else { $DisplayGPPercent = 0; } @@ -272,28 +276,30 @@ DB_data_seek($CatResult,0); While ($myrow = DB_fetch_array($CatResult)){ - echo '<option VALUE="' . $myrow['categoryid'] . '">' . $myrow['categoryid'] . ' - ' . $myrow['categorydescription']; + echo '<option value="' . $myrow['categoryid'] . '">' . $myrow['categoryid'] . ' - ' . $myrow['categorydescription'] . '</option>'; } echo '</select></td></tr>'; - echo '<tr><td>' . _('For Sales Type/Price List').':</td><td><select name="SalesType">'; - $sql = 'SELECT sales_type, typeabbrev FROM salestypes'; + echo '<tr><td>' . _('For Sales Type/Price List').':</td> + <td><select name="SalesType">'; + $sql = "SELECT sales_type, typeabbrev FROM salestypes"; $SalesTypesResult=DB_query($sql,$db); while ($myrow=DB_fetch_array($SalesTypesResult)){ - echo '<option Value="' . $myrow['typeabbrev'] . '">' . $myrow['sales_type']; + echo '<option Value="' . $myrow['typeabbrev'] . '">' . $myrow['sales_type'] . '</option>'; } echo '</select></td></tr>'; - echo '<tr><td>' . _('Show Gross Profit %') . ':</td><td><select name="ShowGPPercentages">'; - echo '<option selected Value="No">'. _('Prices Only'); - echo '<option Value="Yes">'. _('Show GP % too'); + echo '<tr><td>' . _('Show Gross Profit %') . ':</td> + <td><select name="ShowGPPercentages">'; + echo '<option selected Value="No">'. _('Prices Only') . '</option>'; + echo '<option Value="Yes">'. _('Show GP % too') . '</option>'; echo '</select></td></tr>'; echo '<tr><td>' . _('Price Listing Type'). ':</td><td><select name="CustomerSpecials">'; - echo '<option selected Value="Sales Type Prices">'. _('Default Sales Type Prices'); - echo '<option Value="Customer Special Prices Only">'. _('Customer Special Prices Only'); - echo '<option Value="Full Description">'. _('Full Description'); + echo '<option selected value="Sales Type Prices">'. _('Default Sales Type Prices'); + echo '<option Value="Customer Special Prices Only">'. _('Customer Special Prices Only') . '</option>'; + echo '<option Value="Full Description">'. _('Full Description') . '</option>'; echo '</select></td></tr>'; echo '<tr><td>' . _('Effective As At') . ':</td><td><input type="text" size=11 class="date" alt="' . $_SESSION['DefaultDateFormat'] . '" name="EffectiveDate" value="' . Date($_SESSION['DefaultDateFormat']) . '">'; Modified: trunk/PDFPrintLabel.php =================================================================== --- trunk/PDFPrintLabel.php 2011-09-12 23:37:53 UTC (rev 4688) +++ trunk/PDFPrintLabel.php 2011-09-14 08:06:45 UTC (rev 4689) @@ -243,9 +243,10 @@ return noneButton( _('This category has no items to show') ); } - $txt=array( - _('Code'), _('Description'), _('Price').'<br />('.$_POST['Currency'].')', - _('All') + $txt=array(_('Code'), + _('Description'), + _('Price'). '<br />('.$_POST['Currency'].')', + _('All') ); $ix=0; // The table's header @@ -265,7 +266,7 @@ $ok=true; $odd=true; while ($myrow=DB_fetch_array($result)) { - $price = locale_number_format($myrow['price'],$DecimalPlaces); + $price = locale_money_format($myrow['price'],$DecimalPlaces); $oddEven=$odd?"Odd":"Even"; $odd = !$odd; $html .= <<<ZZZ @@ -307,23 +308,23 @@ } else { $WhereClause = "stockmaster.categoryid='$CategoryID' ORDER BY stockmaster.stockid"; } - + $WhereClause = " stockmaster.discontinued!=1 AND " . $WhereClause; - $sql="SELECT stockmaster.stockid, - stockmaster.description, - stockmaster.longdescription, - stockmaster.barcode, - prices.price - FROM stockmaster LEFT JOIN prices - ON stockmaster.stockid=prices.stockid - AND prices.currabrev = '" . $CurrCode . "' + $sql="SELECT stockmaster.stockid, + stockmaster.description, + stockmaster.longdescription, + stockmaster.barcode, + prices.price + FROM stockmaster LEFT JOIN prices + ON stockmaster.stockid=prices.stockid + AND prices.currabrev = '" . $CurrCode . "' AND prices.typeabbrev= '" . $SalesType . "' AND prices.startdate <= '" . $EffectiveDate . "' - AND (prices.enddate >= '" . $EffectiveDate . "' OR prices.enddate='0000-00-00') + AND (prices.enddate >= '" . $EffectiveDate . "' OR prices.enddate='0000-00-00') AND prices.debtorno='' WHERE " . $WhereClause; - + return DB_query($sql, $db); } @@ -491,7 +492,7 @@ unset($ldescrip); break; case 'price': - $txt = locale_number_format($itemData['price'], $DecimalPlaces). ' '. $Currency; + $txt = locale_money_format($itemData['price'], $DecimalPlaces). ' '. $Currency; // $adj='left'; break; case 'bcode': break; Modified: trunk/PDFQuotation.php =================================================================== --- trunk/PDFQuotation.php 2011-09-12 23:37:53 UTC (rev 4688) +++ trunk/PDFQuotation.php 2011-09-14 08:06:45 UTC (rev 4689) @@ -19,7 +19,7 @@ } /*retrieve the order details from the database to print */ -$ErrMsg = _('There was a problem retrieving the quotation header details for Order Number') . ' ' . $_GET['QuotationNo'] . ' ' . _('from the database'); +$ErrMsg = _('There was a problem retrieving the quotation header details for Order Number') . ' ' . filter_number_format($_GET['QuotationNo']) . ' ' . _('from the database'); $sql = "SELECT salesorders.customerref, salesorders.comments, @@ -44,15 +44,18 @@ salesorders.datepackingslipprinted, salesorders.branchcode, locations.taxprovinceid, - locations.locationname + locations.locationname, + currencies.decimalplaces AS currdecimalplaces FROM salesorders INNER JOIN debtorsmaster ON salesorders.debtorno=debtorsmaster.debtorno - INNER JOIN shippers + INNER JOIN shippers ON salesorders.shipvia=shippers.shipper_id - INNER JOIN locations + INNER JOIN locations ON salesorders.fromstkloc=locations.loccode + INNER JOIN currencies + ON debtorsmaster.currcode=currencies.currabrev WHERE salesorders.quotation=1 - AND salesorders.orderno='" . $_GET['QuotationNo'] ."'"; + AND salesorders.orderno='" . filter_number_format($_GET['QuotationNo']) ."'"; $result=DB_query($sql,$db, $ErrMsg); @@ -61,7 +64,7 @@ $title = _('Print Quotation Error'); include('includes/header.inc'); echo '<div class="centre"><br /><br /><br />'; - prnMsg( _('Unable to Locate Quotation Number') . ' : ' . $_GET['QuotationNo'] . ' ', 'error'); + prnMsg( _('Unable to Locate Quotation Number') . ' : ' . filter_number_format($_GET['QuotationNo']) . ' ', 'error'); echo '<br /> <br /> <br /> @@ -109,14 +112,15 @@ salesorderdetails.unitprice, salesorderdetails.discountpercent, stockmaster.taxcatid, - salesorderdetails.narrative + salesorderdetails.narrative, + stockmaster.decimalplaces FROM salesorderdetails INNER JOIN stockmaster ON salesorderdetails.stkcode=stockmaster.stockid - WHERE salesorderdetails.orderno='" . $_GET['QuotationNo'] . "'"; + WHERE salesorderdetails.orderno='" . filter_number_format($_GET['QuotationNo']) . "'"; $result=DB_query($sql,$db, $ErrMsg); -$ListCount = 0; +$ListCount = 0; if (DB_num_rows($result)>0){ /*Yes there are line items to start the ball rolling with a page header */ @@ -139,26 +143,26 @@ } //end if need a new page headed up - $DisplayQty = locale_number_format($myrow2['quantity'],2); - $DisplayPrevDel = locale_number_format($myrow2['qtyinvoiced'],2); - $DisplayPrice = locale_number_format($myrow2['unitprice'],2); + $DisplayQty = locale_number_format($myrow2['quantity'],$myrow2['decimalplaces']); + $DisplayPrevDel = locale_number_format($myrow2['qtyinvoiced'],$myrow2['decimalplaces']); + $DisplayPrice = locale_money_format($myrow2['unitprice'],$myrow['currdecimalplaces']); $DisplayDiscount = locale_number_format($myrow2['discountpercent']*100,2) . '%'; - $SubTot = $myrow2['unitprice']*$myrow2['quantity']*(1-$myrow2['discountpercent']); + $SubTot = filter_number_format($myrow2['unitprice']*$myrow2['quantity']*(1-$myrow2['... [truncated message content] |
From: <fox...@us...> - 2011-09-12 23:37:59
|
Revision: 4688 http://web-erp.svn.sourceforge.net/web-erp/?rev=4688&view=rev Author: foxdeluxe Date: 2011-09-12 23:37:53 +0000 (Mon, 12 Sep 2011) Log Message: ----------- number formatting Modified Paths: -------------- trunk/AgedDebtors.php trunk/AgedSuppliers.php Modified: trunk/AgedDebtors.php =================================================================== --- trunk/AgedDebtors.php 2011-09-12 08:57:11 UTC (rev 4687) +++ trunk/AgedDebtors.php 2011-09-12 23:37:53 UTC (rev 4688) @@ -291,11 +291,11 @@ while ($AgedAnalysis = DB_fetch_array($CustomerResult,$db)){ $DecimalPlaces = $AgedAnalysis['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); + $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); $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_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); + $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); $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_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); + $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); $LeftOvers = $pdf->addTextWrap(220,$YPos,60,$FontSize,$DisplayTotBalance,'right'); $LeftOvers = $pdf->addTextWrap(280,$YPos,60,$FontSize,$DisplayTotCurrent,'right'); @@ -516,4 +516,4 @@ } include('includes/footer.inc'); } /*end of else not PrintPDF */ -?> \ No newline at end of file +?> Modified: trunk/AgedSuppliers.php =================================================================== --- trunk/AgedSuppliers.php 2011-09-12 08:57:11 UTC (rev 4687) +++ trunk/AgedSuppliers.php 2011-09-12 23:37:53 UTC (rev 4688) @@ -126,11 +126,11 @@ While ($AgedAnalysis = DB_fetch_array($SupplierResult,$db)){ - $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'],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); $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_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); + $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); $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_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); + $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); $LeftOvers = $pdf->addTextWrap(220,$YPos,60,$FontSize,$DisplayTotBalance,'right'); $LeftOvers = $pdf->addTextWrap(280,$YPos,60,$FontSize,$DisplayTotCurrent,'right'); @@ -314,4 +314,4 @@ include('includes/footer.inc'); } /*end of else not PrintPDF */ -?> \ 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: <fox...@us...> - 2011-09-12 23:37:59
|
Revision: 4688 http://web-erp.svn.sourceforge.net/web-erp/?rev=4688&view=rev Author: foxdeluxe Date: 2011-09-12 23:37:53 +0000 (Mon, 12 Sep 2011) Log Message: ----------- number formatting Modified Paths: -------------- trunk/AgedDebtors.php trunk/AgedSuppliers.php Modified: trunk/AgedDebtors.php =================================================================== --- trunk/AgedDebtors.php 2011-09-12 08:57:11 UTC (rev 4687) +++ trunk/AgedDebtors.php 2011-09-12 23:37:53 UTC (rev 4688) @@ -291,11 +291,11 @@ while ($AgedAnalysis = DB_fetch_array($CustomerResult,$db)){ $DecimalPlaces = $AgedAnalysis['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); + $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); $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_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); + $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); $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_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); + $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); $LeftOvers = $pdf->addTextWrap(220,$YPos,60,$FontSize,$DisplayTotBalance,'right'); $LeftOvers = $pdf->addTextWrap(280,$YPos,60,$FontSize,$DisplayTotCurrent,'right'); @@ -516,4 +516,4 @@ } include('includes/footer.inc'); } /*end of else not PrintPDF */ -?> \ No newline at end of file +?> Modified: trunk/AgedSuppliers.php =================================================================== --- trunk/AgedSuppliers.php 2011-09-12 08:57:11 UTC (rev 4687) +++ trunk/AgedSuppliers.php 2011-09-12 23:37:53 UTC (rev 4688) @@ -126,11 +126,11 @@ While ($AgedAnalysis = DB_fetch_array($SupplierResult,$db)){ - $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'],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); $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_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); + $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); $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_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); + $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); $LeftOvers = $pdf->addTextWrap(220,$YPos,60,$FontSize,$DisplayTotBalance,'right'); $LeftOvers = $pdf->addTextWrap(280,$YPos,60,$FontSize,$DisplayTotCurrent,'right'); @@ -314,4 +314,4 @@ include('includes/footer.inc'); } /*end of else not PrintPDF */ -?> \ 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-12 08:57:18
|
Revision: 4687 http://web-erp.svn.sourceforge.net/web-erp/?rev=4687&view=rev Author: daintree Date: 2011-09-12 08:57:11 +0000 (Mon, 12 Sep 2011) Log Message: ----------- number_formatting Modified Paths: -------------- trunk/StockTransfers.php Modified: trunk/StockTransfers.php =================================================================== --- trunk/StockTransfers.php 2011-09-12 08:03:20 UTC (rev 4686) +++ trunk/StockTransfers.php 2011-09-12 08:57:11 UTC (rev 4687) @@ -18,7 +18,7 @@ if (isset($_GET['From'])) { $_POST['StockLocationFrom']=$_GET['From']; $_POST['StockLocationTo']=$_GET['To']; - $_POST['Quantity']=$_GET['Quantity']; + $_POST['Quantity']=filter_number_format($_GET['Quantity']); } if (isset($_POST['CheckCode'])) { @@ -27,21 +27,27 @@ '" alt="" />' . ' ' . _('Select Item to Transfer') . '</p>'; if (mb_strlen($_POST['StockText'])>0) { - $sql="SELECT stockid, description from stockmaster where description " . LIKE . " '%" . $_POST['StockText'] . "%'"; + $sql="SELECT stockid, + description + FROM stockmaster + WHERE description " . LIKE . " '%" . $_POST['StockText'] . "%'"; } else { - $sql="SELECT stockid, description from stockmaster where stockid " . LIKE . " '%" . $_POST['StockCode']."%'"; + $sql="SELECT stockid, + description + FROM stockmaster + WHERE stockid " . LIKE . " '%" . $_POST['StockCode']."%'"; } $ErrMsg=_('The stock information cannot be retrieved because'); $DbgMsg=_('The SQL to get the stock description was'); $result = DB_query($sql,$db,$ErrMsg,$DbgMsg); - echo '<table class=selection> + echo '<table class="selection"> <tr><th>'._('Stock Code').'</th> <th>'._('Stock Description').'</th> </tr>'; while ($myrow = DB_fetch_array($result)) { echo '<tr><td>'.$myrow['stockid'].'</td> <td>'.$myrow['description'].'</td> - <td><a href="' . $rootpath . '/StockTransfers.php?StockID='.$myrow['stockid'].'&Description='.$myrow['description'].'&NewTransfer=Yes&Quantity='.$_POST['Quantity'].'&From='.$_POST['StockLocationFrom'].'&To='.$_POST['StockLocationTo'].'">' + <td><a href="' . $rootpath . '/StockTransfers.php?StockID='.$myrow['stockid'].'&Description='.$myrow['description'].'&NewTransfer=Yes&Quantity='. filter_number_format($_POST['Quantity']).'&From='.$_POST['StockLocationFrom'].'&To='.$_POST['StockLocationTo'].'">' ._('Transfer').'</a></td> </tr>'; @@ -61,11 +67,8 @@ if (isset($_GET['StockID'])){ /*carry the stockid through to the form for additional inputs */ - $_POST['StockID'] = trim(mb_strtoupper($_GET['StockID'])); - } elseif (isset($_POST['StockID'])){ /* initiate a new transfer only if the StockID is different to the previous entry */ - if (isset($_SESSION['Transfer']) AND $_POST['StockID'] != $_SESSION['Transfer']->TransferItem[0]->StockID){ unset($_SESSION['Transfer']); $NewTransfer = true; @@ -99,7 +102,7 @@ $myrow = DB_fetch_row($result); $_SESSION['Transfer']->TransferItem[0] = new LineItem ( trim(mb_strtoupper($_POST['StockID'])), $myrow['description'], - $_POST['Quantity'], + filter_number_format($_POST['Quantity']), $myrow['units'], $myrow['controlled'], $myrow['serialised'], @@ -107,27 +110,26 @@ $myrow['decimalplaces']); - $_SESSION['Transfer']->TransferItem[0]->StandardCost = $myrow[3]; + $_SESSION['Transfer']->TransferItem[0]->StandardCost = $myrow['standardcost']; if ($myrow[2]=='D' OR $myrow[2]=='A' OR $myrow[2]=='K'){ prnMsg(_('The part entered is either or a dummy part or an assembly or a kit-set part') . '. ' . _('These parts are not physical parts and no stock holding is maintained for them') . '. ' . _('Stock Transfers are therefore not possible'),'warn'); - echo '.<hr>'; + echo '.<hr />'; echo '<a href="' . $rootpath . '/StockTransfers.php?NewTransfer=Yes">' . _('Enter another Transfer') . '</a>'; unset ($_SESSION['Transfer']); include ('includes/footer.inc'); exit; } } - } if (isset($_POST['Quantity']) AND isset($_SESSION['Transfer']->TransferItem[0]->Controlled) AND $_SESSION['Transfer']->TransferItem[0]->Controlled==0){ - $_SESSION['Transfer']->TransferItem[0]->Quantity = $_POST['Quantity']; + $_SESSION['Transfer']->TransferItem[0]->Quantity = filter_number_format($_POST['Quantity']); } if ( isset($_POST['StockLocationFrom']) AND $_POST['StockLocationFrom']!= $_SESSION['Transfer']->StockLocationFrom ){ $_SESSION['Transfer']->StockLocationFrom = $_POST['StockLocationFrom']; $_SESSION['Transfer']->StockLocationTo = $_POST['StockLocationTo']; - $_SESSION['Transfer']->TransferItem[0]->Quantity=$_POST['Quantity']; + $_SESSION['Transfer']->TransferItem[0]->Quantity=filter_number_format($_POST['Quantity']); $_SESSION['Transfer']->TransferItem[0]->SerialItems=array(); } if ( isset($_POST['StockLocationTo']) ){ @@ -136,8 +138,6 @@ if ( isset($_POST['EnterTransfer']) ){ - - $result = DB_query("SELECT * FROM stockmaster WHERE stockid='" . $_SESSION['Transfer']->TransferItem[0]->StockID ."'",$db); $myrow = DB_fetch_row($result); $InputError = false; @@ -193,25 +193,25 @@ } // Insert the stock movement for the stock going out of the from location $SQL = "INSERT INTO stockmoves (stockid, - type, - transno, - loccode, - trandate, - prd, - reference, - qty, - newqoh) - VALUES ( - '" . $_SESSION['Transfer']->TransferItem[0]->StockID . "', - 16, - '" . $TransferNumber . "', - '" . $_SESSION['Transfer']->StockLocationFrom . "', - '" . $SQLTransferDate . "', - '" . $PeriodNo . "', - 'To " . $_SESSION['Transfer']->StockLocationTo ."', - '" . round(-$_SESSION['Transfer']->TransferItem[0]->Quantity,$_SESSION['Transfer']->TransferItem[0]->DecimalPlaces) . "', - '" . ($QtyOnHandPrior - round($_SESSION['Transfer']->TransferItem[0]->Quantity,$_SESSION['Transfer']->TransferItem[0]->DecimalPlaces)) ."' - )"; + type, + transno, + loccode, + trandate, + prd, + reference, + qty, + newqoh) + VALUES ( + '" . $_SESSION['Transfer']->TransferItem[0]->StockID . "', + 16, + '" . $TransferNumber . "', + '" . $_SESSION['Transfer']->StockLocationFrom . "', + '" . $SQLTransferDate . "', + '" . $PeriodNo . "', + 'To " . $_SESSION['Transfer']->StockLocationTo ."', + '" . filter_number_format(round(-$_SESSION['Transfer']->TransferItem[0]->Quantity,$_SESSION['Transfer']->TransferItem[0]->DecimalPlaces)) . "', + '" . filter_number_format($QtyOnHandPrior - round($_SESSION['Transfer']->TransferItem[0]->Quantity,$_SESSION['Transfer']->TransferItem[0]->DecimalPlaces)) ."' + )"; $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The stock movement record cannot be inserted because'); $DbgMsg = _('The following SQL to insert the stock movement record was used'); @@ -229,11 +229,11 @@ /*First need to check if the serial items already exists or not in the location from */ $SQL = "SELECT COUNT(*) - FROM stockserialitems - WHERE - stockid='" . $_SESSION['Transfer']->TransferItem[0]->StockID . "' - AND loccode='" . $_SESSION['Transfer']->StockLocationFrom . "' - AND serialno='" . $Item->BundleRef . "'"; + FROM stockserialitems + WHERE + stockid='" . $_SESSION['Transfer']->TransferItem[0]->StockID . "' + AND loccode='" . $_SESSION['Transfer']->StockLocationFrom . "' + AND serialno='" . $Item->BundleRef . "'"; $ErrMsg = _('The entered item code does not exist'); $Result = DB_query($SQL,$db,$ErrMsg); @@ -242,7 +242,7 @@ if ($SerialItemExistsRow[0]==1){ $SQL = "UPDATE stockserialitems - SET quantity= quantity - '" . $Item->BundleQty . "', + SET quantity= quantity - '" . filter_number_format($Item->BundleQty) . "', expirationdate='" . FormatDateForSQL($Item->ExpiryDate) . "' WHERE stockid='" . $_SESSION['Transfer']->TransferItem[0]->StockID . "' AND loccode='" . $_SESSION['Transfer']->StockLocationFrom . "' @@ -260,9 +260,9 @@ quantity) VALUES ('" . $_SESSION['Transfer']->TransferItem[0]->StockID . "', '" . $_SESSION['Transfer']->StockLocationFrom . "', - '" . $Item->BundleRef . "', + '" . DB_escape_string($Item->BundleRef) . "', '" . FormatDateForSQL($Item->ExpiryDate) . "', - '" . -$Item->BundleQty . "')"; + '" . filter_number_format(-$Item->BundleQty) . "')"; $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The serial stock item record could not be added because'); $DbgMsg = _('The following SQL to insert the serial stock item record was used'); @@ -280,8 +280,8 @@ VALUES ( '" . $StkMoveNo . "', '" . $_SESSION['Transfer']->TransferItem[0]->StockID . "', - '" . $Item->BundleRef . "', - '" . $Item->BundleQty . "' + '" . DB_escape_string($Item->BundleRef) . "', + '" . filter_number_format($Item->BundleQty) . "' )"; $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The serial stock movement record could not be inserted because'); @@ -325,8 +325,7 @@ '" . $PeriodNo . "', '" . _('From') . " " . $_SESSION['Transfer']->StockLocationFrom . "', '" . $_SESSION['Transfer']->TransferItem[0]->Quantity . "', - '" . ($QtyOnHandPrior + $_SESSION['Transfer']->TransferItem[0]->Quantity) . "' - )"; + '" . filter_number_format(round($QtyOnHandPrior + $_SESSION['Transfer']->TransferItem[0]->Quantity,$_SESSION['Transfer']->TransferItem[0]->DecimalPlaces)) . "')"; $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The stock movement record cannot be inserted because'); $DbgMsg = _('The following SQL to insert the stock movement record was used'); @@ -344,11 +343,10 @@ /*First need to check if the serial items already exists or not in the location from */ $SQL = "SELECT COUNT(*) - FROM stockserialitems - WHERE - stockid='" . $_SESSION['Transfer']->TransferItem[0]->StockID . "' - AND loccode='" . $_SESSION['Transfer']->StockLocationTo . "' - AND serialno='" . $Item->BundleRef . "'"; + FROM stockserialitems + WHERE stockid='" . $_SESSION['Transfer']->TransferItem[0]->StockID . "' + AND loccode='" . $_SESSION['Transfer']->StockLocationTo . "' + AND serialno='" . $Item->BundleRef . "'"; $ErrMsg = _('Could not determine if the serial item exists in the transfer to location'); $Result = DB_query($SQL,$db,$ErrMsg); @@ -357,11 +355,11 @@ if ($SerialItemExistsRow[0]==1){ $SQL = "UPDATE stockserialitems - SET quantity= quantity + '" . $Item->BundleQty . "', - expirationdate='" . FormatDateForSQL($Item->ExpiryDate) . "' + SET quantity= quantity + '" . filter_number_format($Item->BundleQty) . "', + expirationdate='" . FormatDateForSQL($Item->ExpiryDate) . "' WHERE stockid='" . $_SESSION['Transfer']->TransferItem[0]->StockID . "' AND loccode='" . $_SESSION['Transfer']->StockLocationTo . "' - AND serialno='" . $Item->BundleRef . "'"; + AND serialno='" . DB_escape_string($Item->BundleRef) . "'"; $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The serial stock item record could not be updated because'); $DbgMsg = _('The following SQL to update the serial stock item record was used'); @@ -369,16 +367,16 @@ } else { /*Need to insert a new serial item record */ $SQL = "INSERT INTO stockserialitems (stockid, - loccode, - serialno, - expirationdate, - quantity) + loccode, + serialno, + expirationdate, + quantity) VALUES ('" . $_SESSION['Transfer']->TransferItem[0]->StockID . "', - '" . $_SESSION['Transfer']->StockLocationTo . "', - '" . $Item->BundleRef . "', - '" . FormatDateForSQL($Item->ExpiryDate) . "', - '" . $Item->BundleQty . "')"; - + '" . $_SESSION['Transfer']->StockLocationTo . "', + '" . DB_escape_string($Item->BundleRef) . "', + '" . FormatDateForSQL($Item->ExpiryDate) . "', + '" . filter_number_format($Item->BundleQty) . "')"; + $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The serial stock item record could not be added because'); $DbgMsg = _('The following SQL to insert the serial stock item record was used:'); $Result = DB_query($SQL, $db, $ErrMsg, $DbgMsg, true); @@ -393,8 +391,8 @@ moveqty) VALUES ('" . $StkMoveNo . "', '" . $_SESSION['Transfer']->TransferItem[0]->StockID . "', - '" . $Item->BundleRef . "', - '" . $Item->BundleQty . "')"; + '" . DB_escape_string($Item->BundleRef) . "', + '" . filter_number_format($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'); $Result = DB_query($SQL, $db, $ErrMsg, $DbgMsg, true); @@ -403,7 +401,7 @@ } /*end if the transfer item is a controlled item */ - $SQL = "UPDATE locstock SET quantity = quantity - '" . $_SESSION['Transfer']->TransferItem[0]->Quantity . "' + $SQL = "UPDATE locstock SET quantity = quantity - '" . filter_number_format(round($_SESSION['Transfer']->TransferItem[0]->Quantity,$_SESSION['Transfer']->TransferItem[0]->DecimalPlaces)) . "' WHERE stockid='" . $_SESSION['Transfer']->TransferItem[0]->StockID . "' AND loccode='" . $_SESSION['Transfer']->StockLocationFrom . "'"; @@ -412,11 +410,10 @@ $Result = DB_query($SQL,$db,$ErrMsg,$DbgMsg,true); $SQL = "UPDATE locstock - SET quantity = quantity + '" . $_SESSION['Transfer']->TransferItem[0]->Quantity . "' + SET quantity = quantity + '" . filter_number_format(round($_SESSION['Transfer']->TransferItem[0]->Quantity,$_SESSION['Transfer']->TransferItem[0]->DecimalPlaces)) . "' WHERE stockid='" . $_SESSION['Transfer']->TransferItem[0]->StockID . "' AND loccode='" . $_SESSION['Transfer']->StockLocationTo . "'"; - $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'); $Result = DB_query($SQL,$db,$ErrMsg, $DbgMsg, true); @@ -438,22 +435,23 @@ echo '<form action="'. $_SERVER['PHP_SELF'] . '" method=post>'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; - if (!isset($_GET['Description'])) { $_GET['Description']=''; } -echo '<table class=selection><tr><td>'. _('Stock Code'). ':</td><td>'; +echo '<table class="selection"> + <tr><td>'. _('Stock Code'). ':</td><td>'; if (isset($_POST['StockID'])) { - echo '<input type="text" name="StockID" size=21 value="' . $_POST['StockID'] . '" maxlength=20></td></tr>'; + echo '<input type="text" name="StockID" size="21" value="' . $_POST['StockID'] . '" maxlength="20" /></td></tr>'; } else { - echo '<input type="text" name="StockID" size=21 value="" maxlength=20></td></tr>'; + echo '<input type="text" name="StockID" size="21" value="" maxlength="20" /></td></tr>'; } -echo '<tr><td>'. _('Partial Description'). ':</td><td><input type="text" name="StockText" size=21 value="' . - $_GET['Description'] .'"></td><td>'._('Partial Stock Code'). ':</td><td>'; +echo '<tr><td>'. _('Partial Description'). ':</td> + <td><input type="text" name="StockText" size="21" value="' . $_GET['Description'] .'"></td> + <td>'._('Partial Stock Code'). ':</td><td>'; if (isset($_POST['StockID'])) { - echo '<input type="text" name="StockCode" size=21 value="' . $_POST['StockID'] .'" maxlength=20>'; + echo '<input type="text" name="StockCode" size="21" value="' . $_POST['StockID'] .'" maxlength="20" />'; } else { - echo '<input type="text" name="StockCode" size=21 value="" maxlength=20>'; + echo '<input type="text" name="StockCode" size="21" value="" maxlength="20" />'; } echo '</td><td><input type=submit name="CheckCode" value="'._('Check Part').'"></td></tr>'; @@ -461,19 +459,20 @@ echo '<tr><td colspan=3><font color=BLUE size=3>' . $_SESSION['Transfer']->TransferItem[0]->ItemDescription . ' ('._('In Units of').' ' . $_SESSION['Transfer']->TransferItem[0]->PartUnit . ' )</font></td></tr>'; } -echo '<tr><td>' . _('From Stock Location').':</td><td><select name="StockLocationFrom">'; +echo '<tr><td>' . _('From Stock Location').':</td> + <td><select name="StockLocationFrom">'; $sql = "SELECT loccode, locationname FROM locations"; $resultStkLocs = DB_query($sql,$db); while ($myrow=DB_fetch_array($resultStkLocs)){ if (isset($_SESSION['Transfer']->StockLocationFrom)){ if ($myrow['loccode'] == $_SESSION['Transfer']->StockLocationFrom){ - echo '<option selected Value="' . $myrow['loccode'] . '">' . $myrow['locationname'] . '</option>'; + echo '<option selected value="' . $myrow['loccode'] . '">' . $myrow['locationname'] . '</option>'; } else { - echo '<option Value="' . $myrow['loccode'] . '">' . $myrow['locationname'] . '</option>'; + echo '<option value="' . $myrow['loccode'] . '">' . $myrow['locationname'] . '</option>'; } } elseif ($myrow['loccode']==$_SESSION['UserStockLocation']){ - echo '<option selected Value="' . $myrow['loccode'] . '">' . $myrow['locationname'] . '</option>'; + echo '<option selected value="' . $myrow['loccode'] . '">' . $myrow['locationname'] . '</option>'; $_SESSION['Transfer']->StockLocationFrom=$myrow['loccode'] . '</option>'; } else { echo '<option Value="' . $myrow['loccode'] . '">' . $myrow['locationname'] . '</option>'; @@ -482,7 +481,8 @@ echo '</select></td></tr>'; -echo '<tr><td>'. _('To Stock Location').': </td><td><select name="StockLocationTo"> '; +echo '<tr><td>'. _('To Stock Location').': </td> + <td><select name="StockLocationTo"> '; DB_data_seek($resultStkLocs,0); @@ -503,21 +503,19 @@ echo '</select></td></tr>'; - echo '<tr><td>'._('Transfer Quantity').':</td>'; if (isset($_SESSION['Transfer']->TransferItem[0]->Controlled) AND $_SESSION['Transfer']->TransferItem[0]->Controlled==1){ echo '<td class=number><input type=hidden name="Quantity" value=' . $_SESSION['Transfer']->TransferItem[0]->Quantity . '><a href="' . $rootpath .'/StockTransferControlled.php?StockLocationFrom='.$_SESSION['Transfer']->StockLocationFrom.'">' . $_SESSION['Transfer']->TransferItem[0]->Quantity . '</a></td></tr>'; } elseif (isset($_SESSION['Transfer']->TransferItem[0]->Controlled)){ - echo '<td><input type="text" class="number" name="Quantity" size=12 maxlength=12 value=' . $_SESSION['Transfer']->TransferItem[0]->Quantity . '></td></tr>'; + echo '<td><input type="text" class="number" name="Quantity" size="12" maxlength="12" value=' . locale_number_format($_SESSION['Transfer']->TransferItem[0]->Quantity) . '></td></tr>'; } else { - echo '<td><input type="text" class="number" name="Quantity" size=12 maxlength=12 Value="0"></td></tr>'; + echo '<td><input type="text" class="number" name="Quantity" size="12" maxlength="12" value="0"></td></tr>'; } echo '</table><div class="centre"><br /><input type="submit" name="EnterTransfer" value="' . _('Enter Stock Transfer') . '"><br />'; - if (empty($_SESSION['Transfer']->TransferItem[0]->StockID) and isset($_POST['StockID'])) { $StockID=$_POST['StockID']; } else if (isset($_SESSION['Transfer']->TransferItem[0]->StockID)) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |