From: <dai...@us...> - 2011-06-26 01:21:34
|
Revision: 4607 http://web-erp.svn.sourceforge.net/web-erp/?rev=4607&view=rev Author: daintree Date: 2011-06-26 01:21:26 +0000 (Sun, 26 Jun 2011) Log Message: ----------- PurchData no number_format on price - fix cost update in WorkOrderCosting.php Modified Paths: -------------- trunk/PurchData.php trunk/WorkOrderCosting.php trunk/doc/Change.log Modified: trunk/PurchData.php =================================================================== --- trunk/PurchData.php 2011-06-26 00:14:07 UTC (rev 4606) +++ trunk/PurchData.php 2011-06-26 01:21:26 UTC (rev 4607) @@ -37,36 +37,28 @@ $InputError = 1; prnMsg(_('There is no stock item set up enter the stock code or select a stock item using the search page'), 'error'); } - if (!is_numeric(doubleval(str_replace($locale_info['thousands_sep'],'',$_POST['Price'])))) { + if (!is_numeric($_POST['Price'])) { $InputError = 1; unset($_POST['Price']); prnMsg(_('The price entered was not numeric and a number is expected. No changes have been made to the database'), 'error'); - } else { - $_POST['Price'] = doubleval(str_replace($locale_info['thousands_sep'],'',$_POST['Price'])); } if ($_POST['Price'] == 0) { prnMsg(_('The price entered is zero') . ' ' . _('Is this intentional?'), 'warn'); } - if (!is_numeric(doubleval(str_replace($locale_info['thousands_sep'],'',$_POST['LeadTime'])))) { + if (!is_numeric($_POST['LeadTime'])) { $InputError = 1; unset($_POST['LeadTime']); prnMsg(_('The lead time entered was not numeric a number of days is expected no changes have been made to the database'), 'error'); - } else { - $_POST['LeadTime'] = doubleval(str_replace($locale_info['thousands_sep'],'',$_POST['LeadTime'])); } - if (!is_numeric(doubleval(str_replace($locale_info['thousands_sep'],'',$_POST['MinOrderQty'])))) { + if (!is_numeric($_POST['MinOrderQty'])) { $InputError = 1; unset($_POST['MinOrderQty']); prnMsg(_('The minimum order quantity was not numeric and a number is expected no changes have been made to the database'), 'error'); - } else { - $_POST['MinOrderQty'] =doubleval(str_replace($locale_info['thousands_sep'],'',$_POST['MinOrderQty'])); - } - if (!is_numeric(doubleval(str_replace($locale_info['thousands_sep'],'',$_POST['ConversionFactor'])))) { + } + if (!is_numeric($_POST['ConversionFactor'])) { $InputError = 1; unset($_POST['ConversionFactor']); prnMsg(_('The conversion factor entered was not numeric') . ' (' . _('a number is expected') . '). ' . _('The conversion factor is the number which the price must be divided by to get the unit price in our unit of measure') . '. <br />' . _('E.g.') . ' ' . _('The supplier sells an item by the tonne and we hold stock by the kg') . '. ' . _('The suppliers price must be divided by 1000 to get to our cost per kg') . '. ' . _('The conversion factor to enter is 1000') . '. <br /><br />' . _('No changes will be made to the database'), 'error'); - } else { - $_POST['ConversionFactor'] =doubleval(str_replace($locale_info['thousands_sep'],'',$_POST['ConversionFactor'])); } if ($InputError == 0 AND isset($_POST['AddRecord'])) { $sql = "INSERT INTO purchdata (supplierno, @@ -198,36 +190,36 @@ $DisplayPreferred = _('No'); } printf("<td>%s</td> - <td class=number>%s</td> - <td>%s</td> - <td class=number>%s</td> - <td class=number>%s</td> - <td>%s</td> - <td>%s</td> - <td>%s</td> - <td>%s " . _('days') . "</td> - <td>%s</td> - <td><a href='%s?StockID=%s&SupplierID=%s&Edit=1&EffectiveFrom=%s'>" . _('Edit') . "</a></td> - <td><a href='%s?StockID=%s&SupplierID=%s&Delete=1&EffectiveFrom=%s' onclick=\"return confirm('" . _('Are you sure you wish to delete this suppliers price?') . "');\">" . _('Delete') . "</a></td> - </tr>", - $myrow['suppname'], - number_format($myrow['price'], 3), - $myrow['suppliersuom'], - $myrow['conversionfactor'], - number_format($myrow['price']/$myrow['conversionfactor'],2), - $myrow['currcode'], - ConvertSQLDate($myrow['effectivefrom']), - $myrow['minorderqty'], - $myrow['leadtime'], - $DisplayPreferred, - $_SERVER['PHP_SELF'], - $StockID, - $myrow['supplierno'], - $myrow['effectivefrom'], - $_SERVER['PHP_SELF'], - $StockID, - $myrow['supplierno'], - $myrow['effectivefrom']); + <td class=number>%s</td> + <td>%s</td> + <td class=number>%s</td> + <td class=number>%s</td> + <td>%s</td> + <td>%s</td> + <td>%s</td> + <td>%s " . _('days') . "</td> + <td>%s</td> + <td><a href='%s?StockID=%s&SupplierID=%s&Edit=1&EffectiveFrom=%s'>" . _('Edit') . "</a></td> + <td><a href='%s?StockID=%s&SupplierID=%s&Delete=1&EffectiveFrom=%s' onclick=\"return confirm('" . _('Are you sure you wish to delete this suppliers price?') . "');\">" . _('Delete') . "</a></td> + </tr>", + $myrow['suppname'], + number_format($myrow['price'], 3), + $myrow['suppliersuom'], + $myrow['conversionfactor'], + number_format($myrow['price']/$myrow['conversionfactor'],2), + $myrow['currcode'], + ConvertSQLDate($myrow['effectivefrom']), + $myrow['minorderqty'], + $myrow['leadtime'], + $DisplayPreferred, + $_SERVER['PHP_SELF'], + $StockID, + $myrow['supplierno'], + $myrow['effectivefrom'], + $_SERVER['PHP_SELF'], + $StockID, + $myrow['supplierno'], + $myrow['effectivefrom']); } //end of while loop echo '</table><br/>'; if ($CountPreferreds > 1) { @@ -465,7 +457,7 @@ echo '<tr><td>' . _('Currency') . ':</td> <td><input type=hidden name="CurrCode" . value="' . $CurrCode . '">' . $CurrCode . '</td></tr>'; echo '<tr><td>' . _('Price') . ' (' . _('in Supplier Currency') . '):</td> - <td><input type="text" class="number" name="Price" maxlength=12 size=12 value=' . number_format($_POST['Price'], $myrow['decimalplaces']) . '></td></tr>'; + <td><input type="text" class="number" name="Price" maxlength=12 size=12 value=' . round($_POST['Price'], $myrow['decimalplaces']) . '></td></tr>'; echo '<tr><td>' . _('Date Updated') . ':</td> <td><input type="text" class="date" alt="' . $_SESSION['DefaultDateFormat'] . '" name="EffectiveFrom" maxlength=10 size=11 value="' . $_POST['EffectiveFrom'] . '"></td></tr>'; echo '<tr><td>' . _('Our Unit of Measure') . ':</td>'; Modified: trunk/WorkOrderCosting.php =================================================================== --- trunk/WorkOrderCosting.php 2011-06-26 00:14:07 UTC (rev 4606) +++ trunk/WorkOrderCosting.php 2011-06-26 01:21:26 UTC (rev 4607) @@ -27,16 +27,15 @@ } - $ErrMsg = _('Could not retrieve the details of the selected work order'); $WOResult = DB_query("SELECT workorders.loccode, locations.locationname, workorders.requiredby, workorders.startdate, workorders.closed - FROM workorders INNER JOIN locations - ON workorders.loccode=locations.loccode - WHERE workorders.wo='" . $_POST['WO'] . "'", + FROM workorders INNER JOIN locations + ON workorders.loccode=locations.loccode + WHERE workorders.wo='" . $_POST['WO'] . "'", $db, $ErrMsg); @@ -153,13 +152,15 @@ echo '<td>' . $RequirementsRow['stockid'] . '</td> <td>' . $RequirementsRow['description'] . '</td>'; - $IssuesResult = DB_query("SELECT trandate, - qty, - standardcost - FROM stockmoves + $IssuesResult = DB_query("SELECT stockmoves.trandate, + stockmoves.qty, + stockmoves.standardcost, + stockmaster.decimalplaces, + FROM stockmoves INNER JOIN stockmaster + ON stockmoves.stockid = stockmaster.stockid WHERE stockmoves.type=28 - AND reference = '" . $_POST['WO'] . "' - AND stockid = '" . $RequirementsRow['stockid'] . "'", + AND stockmoves.reference = '" . $_POST['WO'] . "' + AND stockmoves.stockid = '" . $RequirementsRow['stockid'] . "'", $db, _('Could not retrieve the issues of the item because:')); $IssueQty =0; @@ -174,7 +175,7 @@ } echo '<td colspan=4></td><td>' . ConvertSQLDate($IssuesRow['trandate']) . '</td> <td class=number>' . number_format(-$IssuesRow['qty'],$RequirementsRow['decimalplaces']) . '</td> - <td class=number>' . number_format(-($IssuesRow['qty']*$IssuesRow['standardcost']),2) . '</td></tr>'; + <td class=number>' . number_format(-($IssuesRow['qty']*$IssuesRow['standardcost']),$IssuesRow['decimalplaces']) . '</td></tr>'; $IssueQty -= $IssuesRow['qty'];// because qty for the stock movement will be negative $IssueCost -= ($IssuesRow['qty']*$IssuesRow['standardcost']); @@ -392,7 +393,7 @@ labourcost=0, overheadcost=0, lastcost='" . $WORow['currcost'] . "' - WHERE stockid='" . $_POST['StockID'] . "'"; + WHERE stockid='" . $WORow['stockid'] . "'"; $ErrMsg = _('The cost details for the stock item could not be updated because'); $DbgMsg = _('The SQL that failed was'); Modified: trunk/doc/Change.log =================================================================== --- trunk/doc/Change.log 2011-06-26 00:14:07 UTC (rev 4606) +++ trunk/doc/Change.log 2011-06-26 01:21:26 UTC (rev 4607) @@ -1,6 +1,9 @@ webERP Change Log -26/6/11 Phil: Went back to no numberformating on PO_Items.php price and quantity - Brian May still reporting issues +26/6/11 Phil: Fixed reference to $_POST['StockID'] in WorkOrderCosting.php when updating the new weighted average cost +26/6/11 Phil: Went back to no number_formatting on PurchData.php +26/6/11 Phil: Went back to no number_formatting on PO_Items.php price and quantity - Brian May still reporting issues +25/6/11 Phil: Made PO_PDFPurchOrder.php have the description of the order item run over several lines where it exceeds the width of the space allowed for it 22/6/11 Phil: Added message to AccountGroups.php to show that child account groups cannot have changes to their account section, their profit and loss or balance sheet and sequence in TB as these properties belong only to parent account groups and are inherited by the kids 23/6/11 Phil: SelectOrderItems.php includes/DefineCartClass.php repaired credit checks 19/6/11 Phil: Credit_Invoice.php typos in quoting changes preventing posting credits on write offs also sql on gl account selection for write off This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |