|
From: <ice...@us...> - 2013-08-27 01:45:01
|
Revision: 6294
http://sourceforge.net/p/web-erp/reponame/6294
Author: icedlava
Date: 2013-08-27 01:44:57 +0000 (Tue, 27 Aug 2013)
Log Message:
-----------
Fix rounding error in supplier unit price when less than 1
Modified Paths:
--------------
trunk/GoodsReceived.php
trunk/PO_Items.php
trunk/SuppCreditGRNs.php
trunk/SuppInvGRNs.php
Modified: trunk/GoodsReceived.php
===================================================================
--- trunk/GoodsReceived.php 2013-08-26 11:41:20 UTC (rev 6293)
+++ trunk/GoodsReceived.php 2013-08-27 01:44:57 UTC (rev 6294)
@@ -151,7 +151,11 @@
$DisplayQtyOrd = locale_number_format($LnItm->Quantity,$LnItm->DecimalPlaces);
$DisplayQtyRec = locale_number_format($LnItm->QtyReceived,$LnItm->DecimalPlaces);
$DisplayLineTotal = locale_number_format($LineTotal,$_SESSION['PO'.$identifier]->CurrDecimalPlaces);
- $DisplayPrice = locale_number_format($LnItm->Price,$_SESSION['PO'.$identifier]->CurrDecimalPlaces);
+ if ($LnItm->Price > 1) {
+ $DisplayPrice = locale_number_format($LnItm->Price,$_SESSION['PO'.$identifier]->CurrDecimalPlaces);
+ } else {
+ $DisplayPrice = locale_number_format($LnItm->Price,4);
+ }
//Now Display LineItem
@@ -172,7 +176,7 @@
echo '<input type="hidden" name="RecvQty_' . $LnItm->LineNo . '" value="' . locale_number_format($LnItm->ReceiveQty,$LnItm->DecimalPlaces) . '" /><a href="GoodsReceivedControlled.php?identifier=' . $identifier . '&LineNo=' . $LnItm->LineNo . '">' . locale_number_format($LnItm->ReceiveQty,$LnItm->DecimalPlaces) . '</a></td>';
} else {
- echo '<input type="text" class="number" name="RecvQty_' . $LnItm->LineNo . '" pattern="(?:^\d{1,3}(?:\.?\d{3})*(?:,\d{1,})?$)|(?:^\d{1,3}(?:,?\d{3})*(?:\.\d{1,})?$)|(?:^\d{1,3}(?:\s?\d{3})*(?:\.\d{1,})?$)|(?:^\d{1,3}(?:\s?\d{3})*(?:,\d{1,})?$)|(?:^(\d{1,2},)?(\d{2},)*(\d{3})(\.\d+)?|(\d{1,3})(\.\d+)?$)" title="' . _('Enter the quantity to receive against this order line as a number') . '"
+ echo '<input type="text" class="number" name="RecvQty_' . $LnItm->LineNo . '" pattern="(?:^\d{1,3}(?:\.?\d{3})*(?:,\d{1,})?$)|(?:^\d{1,3}(?:,?\d{3})*(?:\.\d{1,})?$)|(?:^\d{1,3}(?:\s?\d{3})*(?:\.\d{1,})?$)|(?:^\d{1,3}(?:\s?\d{3})*(?:,\d{1,})?$)|(?:^(\d{1,2},)?(\d{2},)*(\d{3})(\.\d+)?|(\d{1,3})(\.\d+)?$)" title="' . _('Enter the quantity to receive against this order line as a number') . '"
maxlength="10" size="10" value="' . locale_number_format(round($LnItm->ReceiveQty,$LnItm->DecimalPlaces),$LnItm->DecimalPlaces) . '" /></td>';
}
echo '<td><input type="checkbox" name="Complete_'. $LnItm->LineNo . '"';
@@ -662,12 +666,12 @@
narrative,
amount)
VALUES (
- 25,'" .
- $GRN . "','" .
- $_POST['DefaultReceivedDate'] . "','" .
- $PeriodNo . "','" .
- $OrderLine->GLCode . "','" .
- _('PO') . $_SESSION['PO'.$identifier]->OrderNo . ': ' . $_SESSION['PO'.$identifier]->SupplierID . ' - ' . $OrderLine->StockID . ' - ' . DB_escape_string($OrderLine->ItemDescription) . ' x ' . $OrderLine->ReceiveQty . " @ " . locale_number_format($CurrentStandardCost,$_SESSION['CompanyRecord']['decimalplaces']) . "','" .
+ 25,'" .
+ $GRN . "','" .
+ $_POST['DefaultReceivedDate'] . "','" .
+ $PeriodNo . "','" .
+ $OrderLine->GLCode . "','" .
+ _('PO') . $_SESSION['PO'.$identifier]->OrderNo . ': ' . $_SESSION['PO'.$identifier]->SupplierID . ' - ' . $OrderLine->StockID . ' - ' . DB_escape_string($OrderLine->ItemDescription) . ' x ' . $OrderLine->ReceiveQty . " @ " . locale_number_format($CurrentStandardCost,$_SESSION['CompanyRecord']['decimalplaces']) . "','" .
$CurrentStandardCost * $OrderLine->ReceiveQty . "')";
$ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The purchase GL posting could not be inserted because');
@@ -684,12 +688,12 @@
account,
narrative,
amount)
- VALUES (25,'" .
- $GRN . "','" .
- $_POST['DefaultReceivedDate'] . "','" .
- $PeriodNo . "','" .
- $_SESSION['CompanyRecord']['grnact'] . "','" .
- _('PO') . $_SESSION['PO'.$identifier]->OrderNo . ': ' . $_SESSION['PO'.$identifier]->SupplierID . ' - ' . $OrderLine->StockID . ' - ' . DB_escape_string($OrderLine->ItemDescription) . ' x ' . $OrderLine->ReceiveQty . ' @ ' . locale_number_format($UnitCost,$_SESSION['CompanyRecord']['decimalplaces']) . "','" .
+ VALUES (25,'" .
+ $GRN . "','" .
+ $_POST['DefaultReceivedDate'] . "','" .
+ $PeriodNo . "','" .
+ $_SESSION['CompanyRecord']['grnact'] . "','" .
+ _('PO') . $_SESSION['PO'.$identifier]->OrderNo . ': ' . $_SESSION['PO'.$identifier]->SupplierID . ' - ' . $OrderLine->StockID . ' - ' . DB_escape_string($OrderLine->ItemDescription) . ' x ' . $OrderLine->ReceiveQty . ' @ ' . locale_number_format($UnitCost,$_SESSION['CompanyRecord']['decimalplaces']) . "','" .
-$UnitCost * $OrderLine->ReceiveQty . "')";
$ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The GRN suspense side of the GL posting could not be inserted because');
Modified: trunk/PO_Items.php
===================================================================
--- trunk/PO_Items.php 2013-08-26 11:41:20 UTC (rev 6293)
+++ trunk/PO_Items.php 2013-08-27 01:44:57 UTC (rev 6294)
@@ -739,8 +739,10 @@
// This should help display where item-price is a fraction
if ($POLine->Price > 1) {
$DisplayPrice = locale_number_format($POLine->Price,$_SESSION['PO'.$identifier]->CurrDecimalPlaces);
+ $SuppPrice = locale_number_format(round(($POLine->Price *$POLine->ConversionFactor),$_SESSION['PO'.$identifier]->CurrDecimalPlaces),$_SESSION['PO'.$identifier]->CurrDecimalPlaces);
} else {
$DisplayPrice = locale_number_format($POLine->Price,4);
+ $SuppPrice = locale_number_format(round(($POLine->Price *$POLine->ConversionFactor),4),4);
}
if ($k==1){
@@ -759,7 +761,7 @@
<td><input type="text" class="number" name="ConversionFactor' . $POLine->LineNo .'" size="8" value="' . locale_number_format($POLine->ConversionFactor,'Variable') . '" /></td>
<td><input type="text" class="number" name="SuppQty' . $POLine->LineNo .'" size="10" value="' . locale_number_format(round($POLine->Quantity/$POLine->ConversionFactor,$POLine->DecimalPlaces),$POLine->DecimalPlaces) . '" /></td>
<td>' . $POLine->SuppliersUnit . '</td>
- <td><input type="text" class="number" name="SuppPrice' . $POLine->LineNo . '" size="10" value="' . locale_number_format(round(($POLine->Price *$POLine->ConversionFactor),$_SESSION['PO'.$identifier]->CurrDecimalPlaces),$_SESSION['PO'.$identifier]->CurrDecimalPlaces) .'" /></td>
+ <td><input type="text" class="number" name="SuppPrice' . $POLine->LineNo . '" size="10" value="' . $SuppPrice .'" /></td>
<td class="number">' . $DisplayLineTotal . '</td>
<td><input type="text" class="date" alt="' .$_SESSION['DefaultDateFormat'].'" name="ReqDelDate' . $POLine->LineNo.'" size="10" value="' .$POLine->ReqDelDate .'" /></td>';
if ($POLine->QtyReceived !=0 AND $POLine->Completed!=1){
Modified: trunk/SuppCreditGRNs.php
===================================================================
--- trunk/SuppCreditGRNs.php 2013-08-26 11:41:20 UTC (rev 6293)
+++ trunk/SuppCreditGRNs.php 2013-08-27 01:44:57 UTC (rev 6294)
@@ -101,13 +101,18 @@
$i=0;
foreach ($_SESSION['SuppTrans']->GRNs as $EnteredGRN){
+ if ($EnteredGRN->ChgPrice > 1) {
+ $DisplayPrice = locale_number_format($EnteredGRN->ChgPrice,$_SESSION['SuppTrans']->CurrDecimalPlaces);
+ } else {
+ $DisplayPrice = locale_number_format($EnteredGRN->ChgPrice,4);
+ }
echo '<tr>
<td>' . $EnteredGRN->GRNNo . '</td>
<td>' . $EnteredGRN->ItemCode . '</td>
<td>' . $EnteredGRN->ItemDescription . '</td>
<td class="number">' . locale_number_format($EnteredGRN->This_QuantityInv,$EnteredGRN->DecimalPlaces) . '</td>
- <td class="number">' . locale_number_format($EnteredGRN->ChgPrice,$_SESSION['SuppTrans']->CurrDecimalPlaces) . '</td>
+ <td class="number">' . $DisplayPrice . '</td>
<td class="number">' . locale_number_format($EnteredGRN->ChgPrice * $EnteredGRN->This_QuantityInv,$_SESSION['SuppTrans']->CurrDecimalPlaces) . '</td>
<td><a href="' . htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8') . '?Delete=' . $EnteredGRN->GRNNo . '">' . _('Delete') . '</a></td>
</tr>';
@@ -215,6 +220,13 @@
if ($myrow['decimalplaces']==''){
$myrow['decimalplaces'] =2;
}
+
+ if ($Price > 1) {
+ $DisplayPrice = locale_number_format($Price,$_SESSION['SuppTrans']->CurrDecimalPlaces);
+ } else {
+ $DisplayPrice = locale_number_format($Price,4);
+ }
+
echo '<tr>
<td><input type="submit" name="GRNNo" value="' . $myrow['grnno'] . '" /></td>
<td>' . $myrow['orderno'] . '</td>
@@ -224,7 +236,7 @@
<td class="number">' . locale_number_format($myrow['qtyrecd'],$myrow['decimalplaces']) . '</td>
<td class="number">' . locale_number_format($myrow['quantityinv'],$myrow['decimalplaces']) . '</td>
<td class="number">' . locale_number_format($myrow['qtyrecd'] - $myrow['quantityinv'],$myrow['decimalplaces']) . '</td>
- <td class="number">' . locale_number_format($Price,$_SESSION['SuppTrans']->CurrDecimalPlaces) . '</td>
+ <td class="number">' . $DisplayPrice . '</td>
<td class="number">' . locale_number_format($Price*($myrow['qtyrecd'] - $myrow['quantityinv']),$_SESSION['SuppTrans']->CurrDecimalPlaces) . '</td>
</tr>';
$i++;
@@ -289,12 +301,17 @@
if ($myrow['decimalplaces']==''){
$myrow['decimalplaces'] =2;
}
+ if ($Price > 1) {
+ $DisplayPrice = locale_number_format($Price,$_SESSION['SuppTrans']->CurrDecimalPlaces);
+ } else {
+ $DisplayPrice = locale_number_format($Price,4);
+ }
echo '<tr>
<td>' . $_POST['GRNNo'] . '</td>
<td>' . $myrow['itemcode'] . ' ' . $myrow['itemdescription'] . '</td>
<td class="number">' . locale_number_format($myrow['qtyostdg'],$myrow['decimalplaces']) . '</td>
<td><input type="text" class="number" name="This_QuantityCredited" value="' . locale_number_format($myrow['qtyostdg'],$myrow['decimalplaces']) . '" size="11" maxlength="10" /></td>
- <td class="number">' . locale_number_format($Price,$_SESSION['SuppTrans']->CurrDecimalPlaces) . '</td>
+ <td class="number">' . $DisplayPrice . '</td>
<td><input type="text" class="number" name="ChgPrice" value="' . locale_number_format($Price,$_SESSION['SuppTrans']->CurrDecimalPlaces) . '" size="11" maxlength="10" /></td>
</tr>
</table>';
Modified: trunk/SuppInvGRNs.php
===================================================================
--- trunk/SuppInvGRNs.php 2013-08-26 11:41:20 UTC (rev 6293)
+++ trunk/SuppInvGRNs.php 2013-08-27 01:44:57 UTC (rev 6294)
@@ -135,13 +135,17 @@
$i=0;
foreach ($_SESSION['SuppTrans']->GRNs as $EnteredGRN){
-
+ if ($EnteredGRN->ChgPrice > 1) {
+ $DisplayPrice = locale_number_format($EnteredGRN->ChgPrice,$_SESSION['SuppTrans']->CurrDecimalPlaces);
+ } else {
+ $DisplayPrice = locale_number_format($EnteredGRN->ChgPrice,4);
+ }
echo '<tr>
<td>' . $EnteredGRN->GRNNo . '</td>
<td>' . $EnteredGRN->ItemCode . '</td>
<td>' . $EnteredGRN->ItemDescription . '</td>
<td class="number">' . locale_number_format($EnteredGRN->This_QuantityInv,'Variable') . '</td>
- <td class="number">' . locale_number_format($EnteredGRN->ChgPrice,$_SESSION['SuppTrans']->CurrDecimalPlaces) . '</td>
+ <td class="number">' . $DisplayPrice . '</td>
<td class="number">' . locale_number_format($EnteredGRN->ChgPrice * $EnteredGRN->This_QuantityInv,$_SESSION['SuppTrans']->CurrDecimalPlaces) . '</td>
<td><a href="' . htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8') . '?Modify=' . $EnteredGRN->GRNNo . '">'. _('Modify') . '</a></td>
<td><a href="' . htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8') . '?Delete=' . $EnteredGRN->GRNNo . '">' . _('Delete') . '</a></td>
@@ -149,7 +153,7 @@
$TotalValueCharged = $TotalValueCharged + ($EnteredGRN->ChgPrice * $EnteredGRN->This_QuantityInv);
-
+
}
echo '</tbody><tr>
@@ -341,7 +345,7 @@
<td class="number">' . locale_number_format($GRNTmp->OrderPrice,$_SESSION['SuppTrans']->CurrDecimalPlaces) . '</td>
<td class="number">' . locale_number_format($GRNTmp->OrderPrice * ($GRNTmp->QtyRecd - $GRNTmp->Prev_QuantityInv),$_SESSION['SuppTrans']->CurrDecimalPlaces) . '</td>
</tr></tbody>';
-
+
}
echo '</table>';
echo '<br />
|