[Weberp-svn] SF.net SVN: weberp:[8079] trunk
Brought to you by:
sotandeka,
tim_schofield
From: <tim...@us...> - 2011-09-04 22:09:37
|
Revision: 8079 http://weberp.svn.sourceforge.net/weberp/?rev=8079&view=rev Author: tim_schofield Date: 2011-09-04 22:09:30 +0000 (Sun, 04 Sep 2011) Log Message: ----------- Correctly show the locale number formats Modified Paths: -------------- trunk/SuppInvGRNs.php trunk/includes/DefineSuppTransClass.php Modified: trunk/SuppInvGRNs.php =================================================================== --- trunk/SuppInvGRNs.php 2011-09-04 22:09:19 UTC (rev 8078) +++ trunk/SuppInvGRNs.php 2011-09-04 22:09:30 UTC (rev 8079) @@ -53,6 +53,9 @@ $InputError=False; $Hold=False; + $_POST['This_QuantityInv'] = filter_number_input($_POST['This_QuantityInv']); + $_POST['QtyRecd'] = filter_number_input($_POST['QtyRecd']); + $_POST['Prev_QuantityInv'] = filter_number_input($_POST['Prev_QuantityInv']); if ($_POST['This_QuantityInv'] >= ($_POST['QtyRecd'] - $_POST['Prev_QuantityInv'])){ $Complete = True; } else { @@ -69,6 +72,7 @@ $InputError = True; prnMsg(_('The price charged in the suppliers currency is either not numeric or negative') . '. ' . _('The goods received cannot be invoiced at this price'),'error'); } elseif ($_SESSION['Check_Price_Charged_vs_Order_Price'] == True) { + $_POST['ChgPrice'] = filter_number_input($_POST['ChgPrice']); if ($_POST['ChgPrice']/$_POST['OrderPrice'] > (1+ ($_SESSION['OverChargeProportion'] / 100))){ prnMsg(_('The price being invoiced is more than the purchase order price by more than') . ' ' . $_SESSION['OverChargeProportion'] . '%. ' . _('The system is set up to prohibit this so will put this invoice on hold until it is authorised'),'warn'); @@ -79,20 +83,22 @@ if ($InputError==False){ // $_SESSION['SuppTrans']->Remove_GRN_From_Trans($_POST['GRNNumber']); $_SESSION['SuppTrans']->Modify_GRN_To_Trans($_POST['GRNNumber'], - $_POST['PODetailItem'], - $_POST['ItemCode'], - $_POST['ItemDescription'], - $_POST['QtyRecd'], - $_POST['Prev_QuantityInv'], - $_POST['This_QuantityInv'], - $_POST['OrderPrice'], - $_POST['ChgPrice'], - $Complete, - $_POST['StdCostUnit'], - $_POST['ShiptRef'], - $_POST['JobRef'], - $_POST['GLCode'], - $Hold); + $_POST['PODetailItem'], + $_POST['ItemCode'], + $_POST['ItemDescription'], + $_POST['QtyRecd'], + $_POST['Prev_QuantityInv'], + $_POST['This_QuantityInv'], + $_POST['OrderPrice'], + $_POST['ChgPrice'], + $Complete, + $_POST['StdCostUnit'], + $_POST['ShiptRef'], + $_POST['JobRef'], + $_POST['GLCode'], + $Hold, + 0, + $_POST['DecimalPlaces']); } } @@ -125,9 +131,9 @@ echo '<tr><td>' . $EnteredGRN->GRNNo . '</td> <td>' . $EnteredGRN->ItemCode . '</td> <td>' . $EnteredGRN->ItemDescription . '</td> - <td class="number">' . number_format($EnteredGRN->This_QuantityInv,2) . '</td> - <td class="number">' . number_format($EnteredGRN->ChgPrice,2) . '</td> - <td class="number">' . number_format($EnteredGRN->ChgPrice * $EnteredGRN->This_QuantityInv,2) . '</td> + <td class="number">' . stock_number_format($EnteredGRN->This_QuantityInv,$EnteredGRN->DecimalPlaces) . '</td> + <td class="number">' . currency_number_format($EnteredGRN->ChgPrice,$_SESSION['SuppTrans']->CurrCode) . '</td> + <td class="number">' . currency_number_format($EnteredGRN->ChgPrice * $EnteredGRN->This_QuantityInv,$_SESSION['SuppTrans']->CurrCode) . '</td> <td><a href="' . $_SERVER['PHP_SELF'] . '?Modify=' . $EnteredGRN->GRNNo . '">'. _('Modify') . '</a></td> <td><a href="' . $_SERVER['PHP_SELF'] . '?Delete=' . $EnteredGRN->GRNNo . '">' . _('Delete') . '</a></td> </tr>'; @@ -152,25 +158,29 @@ /* Now get all the outstanding GRNs for this supplier from the database*/ $SQL = "SELECT grnbatch, - grnno, - purchorderdetails.orderno, - purchorderdetails.unitprice, - grns.itemcode, - grns.deliverydate, - grns.itemdescription, - grns.qtyrecd, - grns.quantityinv, - grns.stdcostunit, - purchorderdetails.glcode, - purchorderdetails.shiptref, - purchorderdetails.jobref, - purchorderdetails.podetailitem, - purchorderdetails.assetid - FROM grns INNER JOIN purchorderdetails - ON grns.podetailitem=purchorderdetails.podetailitem - WHERE grns.supplierid ='" . $_SESSION['SuppTrans']->SupplierID . "' - AND grns.qtyrecd - grns.quantityinv > 0 - ORDER BY grns.grnno"; + grnno, + purchorderdetails.orderno, + purchorderdetails.unitprice, + grns.itemcode, + grns.deliverydate, + grns.itemdescription, + grns.qtyrecd, + grns.quantityinv, + grns.stdcostunit, + purchorderdetails.glcode, + purchorderdetails.shiptref, + purchorderdetails.jobref, + purchorderdetails.podetailitem, + purchorderdetails.assetid, + stockmaster.decimalplaces + FROM grns + INNER JOIN purchorderdetails + ON grns.podetailitem=purchorderdetails.podetailitem + INNER JOIN stockmaster + ON grns.itemcode=stockmaster.stockid + WHERE grns.supplierid ='" . $_SESSION['SuppTrans']->SupplierID . "' + AND grns.qtyrecd - grns.quantityinv > 0 + ORDER BY grns.grnno"; $GRNResults = DB_query($SQL,$db); if (DB_num_rows($GRNResults)==0){ @@ -212,12 +222,13 @@ $myrow['jobref'], $myrow['glcode'], $myrow['orderno'], - $myrow['assetid']); + $myrow['assetid'], + 0, + $myrow['decimalplaces']); } } } - //if (isset($_POST['GRNNo']) AND $_POST['GRNNo']!=''){ if (isset($_GET['Modify'])){ $GRNNo = $_GET['Modify']; @@ -237,10 +248,10 @@ echo '<tr> <td>' . $GRNTmp->GRNNo . '</td> <td>' . $GRNTmp->ItemCode . ' ' . $GRNTmp->ItemDescription . '</td> - <td class="number">' . number_format($GRNTmp->QtyRecd - $GRNTmp->Prev_QuantityInv,2) . '</td> - <td><input type="text" class="number" name="This_QuantityInv" value="' . $GRNTmp->This_QuantityInv . '" size="11" maxlength="10" /></td> - <td class="number">' . $GRNTmp->OrderPrice . '</td> - <td><input type="text" class="number" name="ChgPrice" value="' . $GRNTmp->ChgPrice . '" size="11" maxlength="10" /></td> + <td class="number">' . stock_number_format($GRNTmp->QtyRecd - $GRNTmp->Prev_QuantityInv, $GRNTmp->DecimalPlaces) . '</td> + <td><input type="text" class="number" name="This_QuantityInv" value="' . stock_number_format($GRNTmp->This_QuantityInv, $GRNTmp->DecimalPlaces) . '" size="11" maxlength="10" /></td> + <td class="number">' . currency_number_format($GRNTmp->OrderPrice, $_SESSION['SuppTrans']->CurrCode) . '</td> + <td><input type="text" class="number" name="ChgPrice" value="' . currency_number_format($GRNTmp->ChgPrice, $_SESSION['SuppTrans']->CurrCode) . '" size="11" maxlength="10" /></td> </tr>'; echo '</table>'; @@ -248,12 +259,11 @@ echo '<input type="hidden" name='ShiptRef' Value='' />"; echo "Unfortunately, the shipment that this purchase order line item was allocated to has been closed - if you add this item to the transaction then no shipments will not be updated. If you wish to allocate the order line item to a different shipment the order must be modified first."; } else { */ - echo '<input type="hidden" name="ShiptRef" value="' . $GRNTmp->ShiptRef . '" />'; + echo '<input type="hidden" name="ShiptRef" value="' . $GRNTmp->ShiptRef . '" />'; // } echo '<div class="centre"><p><input type="submit" name="ModifyGRN" value="' . _('Modify Line') . '" /></p></div>'; - echo '<input type="hidden" name="GRNNumber" value="' . $GRNTmp->GRNNo . '" />'; echo '<input type="hidden" name="ItemCode" value="' . $GRNTmp->ItemCode . '" />'; echo '<input type="hidden" name="ItemDescription" value="' . $GRNTmp->ItemDescription . '" />'; @@ -265,8 +275,8 @@ echo '<input type="hidden" name="GLCode" value="' . $GRNTmp->GLCode . '" />'; echo '<input type="hidden" name="PODetailItem" value="' . $GRNTmp->PODetailItem . '" />'; echo '<input type="hidden" name="AssetID" value="' . $GRNTmp->AssetID . '" />'; -} -else { + echo '<input type="hidden" name="DecimalPlaces" value="' . $GRNTmp->DecimalPlaces . '" />'; +} else { if (count( $_SESSION['SuppTransTmp']->GRNs)>0){ /*if there are any outstanding GRNs then */ echo '<table cellpadding="1" colspan="7" class="selection">'; echo '<tr><th colspan="10"><font size="3" color="navy">' . _('Goods Received Yet to be Invoiced From') . ' ' . $_SESSION['SuppTrans']->SupplierName.'</font></th></tr>'; @@ -283,42 +293,34 @@ <th>' . _('Line Value in') . ' ' . $_SESSION['SuppTrans']->CurrCode . '</th> </tr>'; - $i = 0; $POs = array(); + echo $tableheader; foreach ($_SESSION['SuppTransTmp']->GRNs as $GRNTmp){ - $_SESSION['SuppTransTmp']->GRNs[$GRNTmp->GRNNo]->This_QuantityInv = $GRNTmp->QtyRecd - $GRNTmp->Prev_QuantityInv; + $_SESSION['SuppTransTmp']->GRNs[$GRNTmp->GRNNo]->This_QuantityInv = $GRNTmp->QtyRecd - $GRNTmp->Prev_QuantityInv; - if (isset($POs[$GRNTmp->PONo]) and $POs[$GRNTmp->PONo] != $GRNTmp->PONo) { - $POs[$GRNTmp->PONo] = $GRNTmp->PONo; - echo '<tr><td><input type="submit" name="AddPOToTrans" value="' . $GRNTmp->PONo . '" /></td><td colspan="3" />' . _('Add Whole PO to Invoice') . '</td></tr>'; - $i = 0; + if (isset($POs[$GRNTmp->PONo]) and $POs[$GRNTmp->PONo] != $GRNTmp->PONo) { + $POs[$GRNTmp->PONo] = $GRNTmp->PONo; + echo '<tr><td><input type="submit" name="AddPOToTrans" value="' . $GRNTmp->PONo . '" /></td><td colspan="3" />' . _('Add Whole PO to Invoice') . '</td></tr>'; } - if ($i == 0){ - echo $tableheader; + if (isset($_POST['SelectAll'])) { + echo '<tr><td><input type="checkbox" checked name="GRNNo_' . $GRNTmp->GRNNo . '" /></td>'; + } else { + echo '<tr><td><input type="checkbox" name="GRNNo_' . $GRNTmp->GRNNo . '" /></td>'; + } + echo '<td>' . $GRNTmp->GRNNo . '</td> + <td>' . $GRNTmp->PONo . '</td> + <td>' . $GRNTmp->ItemCode . '</td> + <td>' . $GRNTmp->ItemDescription . '</td> + <td class="number">' . stock_number_format($GRNTmp->QtyRecd,$GRNTmp->DecimalPlaces) . '</td> + <td class="number">' . stock_number_format($GRNTmp->Prev_QuantityInv,$GRNTmp->DecimalPlaces) . '</td> + <td class="number">' . stock_number_format(($GRNTmp->QtyRecd - $GRNTmp->Prev_QuantityInv),$GRNTmp->DecimalPlaces) . '</td> + <td class="number">' . currency_number_format($GRNTmp->OrderPrice, $_SESSION['SuppTrans']->CurrCode) . '</td> + <td class="number">' . currency_number_format($GRNTmp->OrderPrice * ($GRNTmp->QtyRecd - $GRNTmp->Prev_QuantityInv),$_SESSION['SuppTrans']->CurrCode) . '</td> + </tr>'; } - if (isset($_POST['SelectAll'])) { - echo '<tr><td><input type="checkbox" checked name="GRNNo_' . $GRNTmp->GRNNo . '" /></td>'; - } else { - echo '<tr><td><input type="checkbox" name="GRNNo_' . $GRNTmp->GRNNo . '" /></td>'; - } - echo '<td>' . $GRNTmp->GRNNo . '</td> - <td>' . $GRNTmp->PONo . '</td> - <td>' . $GRNTmp->ItemCode . '</td> - <td>' . $GRNTmp->ItemDescription . '</td> - <td class="number">' . $GRNTmp->QtyRecd . '</td> - <td class="number">' . $GRNTmp->Prev_QuantityInv . '</td> - <td class="number">' . ($GRNTmp->QtyRecd - $GRNTmp->Prev_QuantityInv) . '</td> - <td class="number">' . $GRNTmp->OrderPrice . '</td> - <td class="number">' . number_format($GRNTmp->OrderPrice * ($GRNTmp->QtyRecd - $GRNTmp->Prev_QuantityInv),2) . '</td> - </tr>'; - $i++; - if ($i>15){ - $i=0; - } - } echo '</table>'; - echo '<br /><div class="centre"><input type="submit" name="SelectAll" Value="' . _('Select All') . '" />'; + echo '<br /><div class="centre"><input type="submit" name="SelectAll" value="' . _('Select All') . '" />'; echo '<input type="submit" name="DeSelectAll" value="' . _('Deselect All') . '" />'; echo '<br /><input type="submit" name="AddGRNToTrans" value="' . _('Add to Invoice') . '" /></div>'; } Modified: trunk/includes/DefineSuppTransClass.php =================================================================== --- trunk/includes/DefineSuppTransClass.php 2011-09-04 22:09:19 UTC (rev 8078) +++ trunk/includes/DefineSuppTransClass.php 2011-09-04 22:09:30 UTC (rev 8079) @@ -100,6 +100,7 @@ $GLCode, $PONo, $AssetID=0, + $Hold=0, $DecimalPlaces=2){ if ($This_QuantityInv!=0 AND isset($This_QuantityInv)){ @@ -119,7 +120,8 @@ $GLCode, $PONo, $AssetID, - $DecimalPlaces=2); + $Hold, + $DecimalPlaces); Return 1; } Return 0; @@ -140,12 +142,12 @@ $JobRef, $GLCode, $Hold, - $PONo, $AssetID=0, $DecimalPlaces=2){ if ($This_QuantityInv!=0 and isset($This_QuantityInv)){ - $this->GRNs[$GRNNo]->Modify($PODetailItem, + $this->GRNs[$GRNNo]->Modify($GRNNo, + $PODetailItem, $ItemCode, $ItemDescription, $QtyRecd, @@ -158,6 +160,7 @@ $ShiptRef, $JobRef, $GLCode, + $DecimalPlaces, $Hold ); Return 1; } @@ -301,9 +304,8 @@ $PONo, $AssetID, $Hold=0, - $DecimalPlaces=2){ + $DecimalPlaces){ - /* Constructor function to add a new GRNs object with passed params */ $this->GRNNo = $GRNNo; $this->PODetailItem = $PODetailItem; @@ -325,7 +327,8 @@ $this->DecimalPlaces = $DecimalPlaces; } - function Modify ($PODetailItem, + function Modify ($GRNNo, + $PODetailItem, $ItemCode, $ItemDescription, $QtyRecd, @@ -338,6 +341,7 @@ $ShiptRef, $JobRef, $GLCode, + $DecimalPlaces, $Hold){ /* Modify function to edit a GRNs object with passed params */ @@ -353,6 +357,7 @@ $this->StdCostUnit = $StdCostUnit; $this->ShiptRef = $ShiptRef; $this->JobRef = $JobRef; + $this->DecimalPlaces = $DecimalPlaces; $this->Hold = $Hold; $this->GLCode = $GLCode; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |