From: <tim...@us...> - 2010-07-11 16:58:26
|
Revision: 3604 http://web-erp.svn.sourceforge.net/web-erp/?rev=3604&view=rev Author: tim_schofield Date: 2010-07-11 16:58:19 +0000 (Sun, 11 Jul 2010) Log Message: ----------- Fix conversion factor bug, layout changes, sql quoting fixed Modified Paths: -------------- trunk/GoodsReceived.php trunk/PO_Header.php trunk/PO_Items.php trunk/doc/Change.log.html trunk/includes/DefinePOClass.php trunk/includes/PO_ReadInOrder.inc Modified: trunk/GoodsReceived.php =================================================================== --- trunk/GoodsReceived.php 2010-07-11 16:57:46 UTC (rev 3603) +++ trunk/GoodsReceived.php 2010-07-11 16:58:19 UTC (rev 3604) @@ -29,7 +29,7 @@ } elseif (isset($_GET['PONumber']) AND !isset($_POST['Update'])) { /*Update only occurs if the user hits the button to refresh the data and recalc the value of goods recd*/ - $_GET['ModifyOrderNumber'] = $_GET['PONumber']; + $_GET['ModifyOrderNumber'] = (int)$_GET['PONumber']; include('includes/PO_ReadInOrder.inc'); } elseif (isset($_POST['Update']) OR isset($_POST['ProcessGoodsReceived'])) { @@ -45,7 +45,7 @@ } } -$statussql='SELECT status FROM purchorders WHERE orderno='.$_SESSION['PO']->OrderNo; +$statussql="SELECT status FROM purchorders WHERE orderno='".$_SESSION['PO']->OrderNo . "'"; $statusresult=DB_query($statussql, $db); $mystatusrow=DB_fetch_array($statusresult); $Status=$mystatusrow['status']; @@ -60,31 +60,44 @@ /* Always display quantities received and recalc balance for all items on the order */ -echo '<div class="centre"><p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/supplier.png" title="' . _('Receive') . '" alt="">' . ' ' . _('Receive Purchase Order') . ''; +echo '<div class="centre"><p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/supplier.png" title="' . + _('Receive') . '" alt="">' . ' ' . _('Receive Purchase Order') . ''; -echo ' : '. $_SESSION['PO']->OrderNo .' '. _('from'). ' ' . $_SESSION['PO']->SupplierName . ' </U></b></font></div><br>'; +echo ' : '. $_SESSION['PO']->OrderNo .' '. _('from'). ' ' . $_SESSION['PO']->SupplierName . ' </u></b></font></div>'; echo '<form action="' . $_SERVER['PHP_SELF'] . '?' . SID . '" method=post>'; -echo '<table cellpadding=2 colspan=7 border=0> -<tr><th>' . _('Item Code') . '</th> - <th>' . _('Description') . '</th> - <th>' . _('Quantity') . '<br>' . _('Ordered') . '</th> - <th>' . _('Units') . '</th> - <th>' . _('Already Received') . '</th> - <th>' . _('This Delivery') . '<br>' . _('Quantity') . '</th>'; +if (!isset($_POST['ProcessGoodsReceived'])) { + if (!isset($_POST['DefaultReceivedDate'])){ + $_POST['DefaultReceivedDate'] = Date($_SESSION['DefaultDateFormat']); + } -if ($_SESSION['ShowValueOnGRN']==1) { - echo '<th>' . _('Price') . '</th><th>' . _('Total Value') . '<br>' . _('Received') . '</th>'; + echo '<table class=selection><tr><td>'. _('Date Goods/Service Received'). ':</td><td><input type=text class=date alt="'. + $_SESSION['DefaultDateFormat'] .'" maxlength=10 size=10 onChange="return isDate(this, this.value, '."'". + $_SESSION['DefaultDateFormat']."'".')" name=DefaultReceivedDate value="' . $_POST['DefaultReceivedDate'] . + '"></td></tr></table><br>'; + + echo '<table cellpadding=2 class=selection> + <tr><th>' . _('Item Code') . '</th> + <th>' . _('Description') . '</th> + <th>' . _('Quantity') . '<br>' . _('Ordered') . '</th> + <th>' . _('Units') . '</th> + <th>' . _('Already Received') . '</th> + <th>' . _('This Delivery') . '<br>' . _('Quantity') . '</th>'; + + if ($_SESSION['ShowValueOnGRN']==1) { + echo '<th>' . _('Price') . '</th><th>' . _('Total Value') . '<br>' . _('Received') . '</th>'; + } + + echo '<td> </td> + </tr>'; + /*show the line items on the order with the quantity being received for modification */ + + $_SESSION['PO']->total = 0; } -echo '<td> </td> - </tr>'; -/*show the line items on the order with the quantity being received for modification */ - -$_SESSION['PO']->total = 0; $k=0; //row colour counter -if (count($_SESSION['PO']->LineItems)>0){ +if (count($_SESSION['PO']->LineItems)>0 and !isset($_POST['ProcessGoodsReceived'])){ foreach ($_SESSION['PO']->LineItems as $LnItm) { if ($k==1){ @@ -112,16 +125,16 @@ $DisplayLineTotal = number_format($LineTotal,2); $DisplayPrice = number_format($LnItm->Price,2); - $uomsql='SELECT unitsofmeasure.unitname, + $uomsql="SELECT unitsofmeasure.unitname, conversionfactor, suppliersuom, max(effectivefrom) FROM purchdata LEFT JOIN unitsofmeasure ON purchdata.suppliersuom=unitsofmeasure.unitid - WHERE supplierno="'.$_SESSION['PO']->SupplierID.'" - AND stockid="'.$LnItm->StockID.'" - GROUP BY unitsofmeasure.unitname'; + WHERE supplierno='".$_SESSION['PO']->SupplierID."' + AND stockid='".$LnItm->StockID."' + GROUP BY unitsofmeasure.unitname"; $uomresult=DB_query($uomsql, $db); if (DB_num_rows($uomresult)>0) { @@ -138,12 +151,12 @@ } //Now Display LineItem - echo '<td><font size=2>' . $LnItm->StockID . '</font></td>'; - echo '<td><font size=2>' . $LnItm->ItemDescription . '</td>'; - echo '<td class=number><font size=2>' . $DisplayQtyOrd . '</td>'; - echo '<td><font size=2>' . $LnItm->uom . '</td>'; - echo '<td class=number><font size=2>' . $DisplayQtyRec . '</td>'; - echo '<td class=number><font size=2>'; + echo '<td>' . $LnItm->StockID . '</td>'; + echo '<td>' . $LnItm->ItemDescription . '</td>'; + echo '<td class=number>' . $DisplayQtyOrd . '</td>'; + echo '<td>' . $LnItm->uom . '</td>'; + echo '<td class=number>' . $DisplayQtyRec . '</td>'; + echo '<td class=number>'; if ($LnItm->Controlled == 1) { @@ -154,8 +167,8 @@ } if ($_SESSION['ShowValueOnGRN']==1) { - echo '<td class=number><font size=2>' . $DisplayPrice . '</td>'; - echo '<td class=number><font size=2>' . $DisplayLineTotal . '</font></td>'; + echo '<td class=number>' . $DisplayPrice . '</td>'; + echo '<td class=number>' . $DisplayLineTotal . '</td>'; } @@ -171,17 +184,17 @@ echo '</tr>'; }//foreach(LineItem) echo "<script>defaultControl(document.forms[0].RecvQty_$LnItm->LineNo);</script>"; -}//If count(LineItems) > 0 - $DisplayTotal = number_format($_SESSION['PO']->total,2); if ($_SESSION['ShowValueOnGRN']==1) { echo '<tr><td colspan=7 class=number><b>' . _('Total value of goods received'). '</b></td> - <td class=number><font size=2><b>'. $DisplayTotal. '</b></font></td> + <td class=number><b>'. $DisplayTotal. '</b></td> </tr></table>'; } else { echo '</table>'; } +}//If count(LineItems) > 0 + $SomethingReceived = 0; if (count($_SESSION['PO']->LineItems)>0){ foreach ($_SESSION['PO']->LineItems as $OrderLine) { @@ -257,7 +270,7 @@ /*Now need to check that the order details are the same as they were when they were read into the Items array. If they've changed then someone else must have altered them */ // Otherwise if you try to fullfill item quantities separately will give error. - $SQL = 'SELECT itemcode, + $SQL = "SELECT itemcode, glcode, quantityord, quantityrecd, @@ -265,9 +278,9 @@ shiptref, jobref FROM purchorderdetails - WHERE orderno=' . (int) $_SESSION['PO']->OrderNo . ' + WHERE orderno='" . (int) $_SESSION['PO']->OrderNo . "' AND completed=0 - ORDER BY podetailitem'; + ORDER BY podetailitem"; $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('Could not check that the details of the purchase order had not been changed by another user because'). ':'; $DbgMsg = _('The following SQL to retrieve the purchase order details was used'); @@ -382,16 +395,16 @@ if ($OrderLine->ReceiveQty >= ($OrderLine->Quantity - $OrderLine->QtyReceived)){ $SQL = "UPDATE purchorderdetails SET - quantityrecd = quantityrecd + " . $OrderLine->ReceiveQty . ", - stdcostunit=" . $_SESSION['PO']->LineItems[$OrderLine->LineNo]->StandardCost . ", + quantityrecd = quantityrecd + '" . $OrderLine->ReceiveQty . "', + stdcostunit='" . $_SESSION['PO']->LineItems[$OrderLine->LineNo]->StandardCost . "', completed=1 - WHERE podetailitem = " . $OrderLine->PODetailRec; + WHERE podetailitem = '" . $OrderLine->PODetailRec . "'"; } else { $SQL = "UPDATE purchorderdetails SET - quantityrecd = quantityrecd + " . $OrderLine->ReceiveQty . ", - stdcostunit=" . $_SESSION['PO']->LineItems[$OrderLine->LineNo]->StandardCost . ", + quantityrecd = quantityrecd + '" . $OrderLine->ReceiveQty . "', + stdcostunit='" . $_SESSION['PO']->LineItems[$OrderLine->LineNo]->StandardCost . "', completed=0 - WHERE podetailitem = " . $OrderLine->PODetailRec; + WHERE podetailitem = '" . $OrderLine->PODetailRec . "'"; } $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The purchase order detail record could not be updated with the quantity received because'); @@ -415,14 +428,14 @@ qtyrecd, supplierid, stdcostunit) - VALUES (" . $GRN . ", - " . $OrderLine->PODetailRec . ", + VALUES ('" . $GRN . "', + '" . $OrderLine->PODetailRec . "', '" . $OrderLine->StockID . "', '" . $OrderLine->ItemDescription . "', '" . $_POST['DefaultReceivedDate'] . "', - " . $OrderLine->ReceiveQty . ", + '" . $OrderLine->ReceiveQty . "', '" . $_SESSION['PO']->SupplierID . "', - " . $CurrentStandardCost *$conversionfactor. ')'; + '" . $CurrentStandardCost *$OrderLine->ConversionFactor. "')"; $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('A GRN record could not be inserted') . '. ' . _('This receipt of goods has not been processed because'); $DbgMsg = _('The following SQL to insert the GRN record was used'); @@ -447,10 +460,10 @@ $QtyOnHandPrior = 0; } - $sql='SELECT conversionfactor + $sql="SELECT conversionfactor FROM purchdata - WHERE supplierno="'.$_SESSION['PO']->SupplierID.'" - AND stockid="'.$OrderLine->StockID.'"'; + WHERE supplierno='".$_SESSION['PO']->SupplierID."' + AND stockid='".$OrderLine->StockID."'"; $result=DB_query($sql, $db); if (DB_num_rows($result)>0) { $myrow=DB_fetch_array($result); @@ -461,7 +474,7 @@ $OrderLine->ReceiveQty=$OrderLine->ReceiveQty*$conversionfactor; $SQL = "UPDATE locstock - SET quantity = locstock.quantity + " . $OrderLine->ReceiveQty . " + SET quantity = locstock.quantity + '" . $OrderLine->ReceiveQty . "' WHERE locstock.stockid = '" . $OrderLine->StockID . "' AND loccode = '" . $_SESSION['PO']->Location . "'"; @@ -483,16 +496,19 @@ qty, standardcost, newqoh) - VALUES ('" . $OrderLine->StockID . "', + VALUES ( + '" . $OrderLine->StockID . "', 25, - " . $GRN . ", '" . $_SESSION['PO']->Location . "', + '" . $GRN . "', + '" . $_SESSION['PO']->Location . "', '" . $_POST['DefaultReceivedDate'] . "', - " . $LocalCurrencyPrice / $conversionfactor . ", - " . $PeriodNo . ", + '" . $LocalCurrencyPrice / $conversionfactor . "', + '" . $PeriodNo . "', '" . $_SESSION['PO']->SupplierID . " (" . $_SESSION['PO']->SupplierName . ") - " .$_SESSION['PO']->OrderNo . "', - " . $OrderLine->ReceiveQty . ", - " . $_SESSION['PO']->LineItems[$OrderLine->LineNo]->StandardCost . ", - " . ($QtyOnHandPrior + $OrderLine->ReceiveQty) . ")"; + '" . $OrderLine->ReceiveQty . "', + '" . $_SESSION['PO']->LineItems[$OrderLine->LineNo]->StandardCost . "', + '" . ($QtyOnHandPrior + $OrderLine->ReceiveQty) . "' + )"; $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('stock movement records could not be inserted because'); $DbgMsg = _('The following SQL to insert the stock movement records was used'); @@ -519,9 +535,9 @@ if (trim($Item->BundleRef) != ""){ if ($AlreadyExistsRow[0]>0){ if ($OrderLine->Serialised == 1) { - $SQL = 'UPDATE stockserialitems SET quantity = ' . $Item->BundleQty . ' '; + $SQL = "UPDATE stockserialitems SET quantity = '" . $Item->BundleQty . " "; } else { - $SQL = 'UPDATE stockserialitems SET quantity = quantity + ' . $Item->BundleQty . ' '; + $SQL = "UPDATE stockserialitems SET quantity = quantity + '" . $Item->BundleQty . " "; } $SQL .= "WHERE stockid='" . $OrderLine->StockID . "' AND loccode = '" . $_SESSION['PO']->Location . "' @@ -536,7 +552,7 @@ '" . $_SESSION['PO']->Location . "', '" . $Item->BundleRef . "', '', - " . $Item->BundleQty . ")"; + '" . $Item->BundleQty . "')"; } $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The serial stock item record could not be inserted because'); @@ -544,21 +560,24 @@ $Result = DB_query($SQL, $db, $ErrMsg, $DbgMsg, true); /*Update fixed asset details */ - $sql='select stocktype from stockcategory - left join stockmaster on - stockcategory.categoryid=stockmaster.categoryid - where stockmaster.stockid="'.$OrderLine->StockID.'"'; + $sql="SELECT stocktype + FROM stockcategory + LEFT JOIN stockmaster + ON stockcategory.categoryid=stockmaster.categoryid + WHERE stockmaster.stockid='".$OrderLine->StockID."'"; $result=DB_query($sql, $db); $myrow=DB_fetch_array($result); if ($myrow['stocktype']=='A') { $SQL = "INSERT INTO assetmanager - VALUES (NULL, + VALUES ( + NULL, '" . $OrderLine->StockID . "', '" . $Item->BundleRef . "', '', - ".$Item->BundleQty*$OrderLine->Price.", - 0,'". - $_POST['DefaultReceivedDate']."',0)"; + '".$Item->BundleQty*$OrderLine->Price."', + 0, + '". $_POST['DefaultReceivedDate']."', + 0)"; $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The serial stock item record could not be inserted because'); $DbgMsg = _('The following SQL to insert the serial stock item records was used'); $Result = DB_query($SQL, $db, $ErrMsg, $DbgMsg, true); @@ -571,10 +590,12 @@ stockid, serialno, moveqty) - VALUES (" . $StkMoveNo . ", + VALUES ( + '" . $StkMoveNo . "', '" . $OrderLine->StockID . "', '" . $Item->BundleRef . "', - " . $Item->BundleQty . ")"; + '" . $Item->BundleQty . "' + )"; $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The serial stock movement record could not be inserted because'); $DbgMsg = _('The following SQL to insert the serial stock movement records was used'); $Result = DB_query($SQL, $db, $ErrMsg, $DbgMsg, true); @@ -595,13 +616,17 @@ account, narrative, amount) - VALUES (25, - " . $GRN . ", + VALUES ( + 25, + '" . $GRN . "', '" . $_POST['DefaultReceivedDate'] . "', - " . $PeriodNo . ", - " . $OrderLine->GLCode . ", - 'PO: " . $_SESSION['PO']->OrderNo . " " . $_SESSION['PO']->SupplierID . " - " . $OrderLine->StockID . " - " . $OrderLine->ItemDescription . " x " . $OrderLine->ReceiveQty . " @ " . number_format($CurrentStandardCost,2) . "', - " . $CurrentStandardCost * $OrderLine->ReceiveQty . ")"; + '" . $PeriodNo . "', + '" . $OrderLine->GLCode . "', + 'PO: " . $_SESSION['PO']->OrderNo . " " . $_SESSION['PO']->SupplierID . " - " . $OrderLine->StockID + . " - " . $OrderLine->ItemDescription . " x " . $OrderLine->ReceiveQty . " @ " . + number_format($CurrentStandardCost,2) . "', + '" . $CurrentStandardCost * $OrderLine->ReceiveQty . "' + )"; $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The purchase GL posting could not be inserted because'); $DbgMsg = _('The following SQL to insert the purchase GLTrans record was used'); @@ -619,12 +644,15 @@ narrative, amount) VALUES (25, - " . $GRN . ", + '" . $GRN . "', '" . $_POST['DefaultReceivedDate'] . "', - " . $PeriodNo . ", - " . $_SESSION['CompanyRecord']['grnact'] . ", '" . - _('PO') . ': ' . $_SESSION['PO']->OrderNo . ' ' . $_SESSION['PO']->SupplierID . ' - ' . $OrderLine->StockID . ' - ' . $OrderLine->ItemDescription . ' x ' . $OrderLine->ReceiveQty . ' @ ' . number_format($UnitCost,2) . "', - " . -$UnitCost * $OrderLine->ReceiveQty . ")"; + '" . $PeriodNo . "', + '" . $_SESSION['CompanyRecord']['grnact'] . "', + '" . _('PO') . ': ' . $_SESSION['PO']->OrderNo . ' ' . $_SESSION['PO']->SupplierID . ' - ' . + $OrderLine->StockID . ' - ' . $OrderLine->ItemDescription . ' x ' . + $OrderLine->ReceiveQty . ' @ ' . number_format($UnitCost,2) . "', + '" . -$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'); $DbgMsg = _('The following SQL to insert the GRN Suspense GLTrans record was used'); @@ -633,16 +661,18 @@ } /* end of if GL and stock integrated and standard cost !=0 */ } /*Quantity received is != 0 */ } /*end of OrderLine loop */ - $completedsql='SELECT SUM(completed) as completedlines, + $completedsql="SELECT SUM(completed) as completedlines, COUNT(podetailitem) as alllines FROM purchorderdetails - WHERE orderno='.$_SESSION['PO']->OrderNo; + WHERE orderno='".$_SESSION['PO']->OrderNo . "'"; $completedresult=DB_query($completedsql,$db); $mycompletedrow=DB_fetch_array($completedresult); $status=$mycompletedrow['alllines']-$mycompletedrow['completedlines']; if ($status==0) { - $sql='SELECT stat_comment FROM purchorders WHERE orderno='.$_SESSION['PO']->OrderNo; + $sql="SELECT stat_comment + FROM purchorders + WHERE orderno='".$_SESSION['PO']->OrderNo . "'"; $result=DB_query($sql,$db); $myrow=DB_fetch_array($result); $comment=$myrow['stat_comment']; @@ -651,7 +681,7 @@ $sql="UPDATE purchorders SET status='" . PurchOrder::STATUS_COMPLITED . "', stat_comment='".$StatusComment."' - WHERE orderno=".$_SESSION['PO']->OrderNo; + WHERE orderno='".$_SESSION['PO']->OrderNo . "'"; $result=DB_query($sql,$db); } @@ -662,27 +692,23 @@ unset($_SESSION['PO']); unset($_POST['ProcessGoodsReceived']); - echo '<br>'. _('GRN number'). ' '. $GRN .' '. _('has been processed').'<br>'; + echo '<br><div class=centre>'. _('GRN number'). ' '. $GRN .' '. _('has been processed').'<br>'; echo '<br><a href=PDFGrn.php?GRNNo='.$GRN .'&PONo='.$PONo.'>'. _('Print this Goods Received Note (GRN)').'</a><br><br>'; - echo "<a href='$rootpath/PO_SelectOSPurchOrder.php?" . SID . "'>" . _('Select a different purchase order for receiving goods against'). '</a>'; + echo "<a href='" . $rootpath . "/PO_SelectOSPurchOrder.php?" . SID . "'>" . + _('Select a different purchase order for receiving goods against'). '</a></div>'; /*end of process goods received entry */ include('includes/footer.inc'); exit; } else { /*Process Goods received not set so show a link to allow mod of line items on order and allow input of date goods received*/ - echo "<br><div class='centre'><a href='$rootpath/PO_Items.php?=" . SID . "'>" . _('Modify Order Items'). '</a></div>'; + echo "<br><div class='centre'><a href='" . $rootpath . "/PO_Items.php?=" . SID . "'>" . _('Modify Order Items'). '</a></div>'; - if (!isset($_POST['DefaultReceivedDate'])){ - $_POST['DefaultReceivedDate'] = Date($_SESSION['DefaultDateFormat']); - } - echo '<table><tr><td>'. _('Date Goods/Service Received'). ':</td><td><input type=text class=date alt="'.$_SESSION['DefaultDateFormat'] .'" maxlength=10 size=10 onChange="return isDate(this, this.value, '."'".$_SESSION['DefaultDateFormat']."'".')" name=DefaultReceivedDate value="' . $_POST['DefaultReceivedDate'] . '"></td></tr>'; - - echo '</table><br><div class="centre"><input type=submit name=Update Value=' . _('Update') . '><p>'; + echo '<br><div class="centre"><input type=submit name=Update Value=' . _('Update') . '><p>'; echo '<input type=submit name="ProcessGoodsReceived" Value="' . _('Process Goods Received') . '"></div>'; } echo '</form>'; include('includes/footer.inc'); -?> +?> \ No newline at end of file Modified: trunk/PO_Header.php =================================================================== --- trunk/PO_Header.php 2010-07-11 16:57:46 UTC (rev 3603) +++ trunk/PO_Header.php 2010-07-11 16:58:19 UTC (rev 3604) @@ -385,7 +385,7 @@ if (strlen($_POST['Keywords'])>0) { //insert wildcard characters in spaces $SearchString = '%' . str_replace(' ', '%', $_POST['Keywords']) . '%'; - + $SQL = "SELECT suppliers.supplierid, suppliers.suppname, suppliers.address1, @@ -724,13 +724,16 @@ $sql='SELECT price, suppliersuom, - suppliers_partno + suppliers_partno, + conversionfactor FROM purchdata WHERE supplierno="'.$_GET['SelectedSupplier'] .'" AND stockid="'.$purch_item.'" '; $result=DB_query($sql, $db); $purchdatarow=DB_fetch_array($result); - + if (!isset($purchdatarow['conversionfactor'])) { + $purchdatarow['conversionfactor']=1; + } $sql='SELECT stockact FROM stockcategory @@ -759,6 +762,7 @@ $stockmasterrow['decimalplaces'], $purch_item, $purchdatarow['suppliersuom'], + $purchdatarow['conversionfactor'], $purchdatarow['suppliers_partno'], $Qty*$purchdatarow['price'], '', Modified: trunk/PO_Items.php =================================================================== --- trunk/PO_Items.php 2010-07-11 16:57:46 UTC (rev 3603) +++ trunk/PO_Items.php 2010-07-11 16:58:19 UTC (rev 3604) @@ -696,6 +696,7 @@ $_POST['itemno'], $_POST['uom'], $_POST['suppliers_partno'], + 1, $_POST['subtotal_amount'], $_POST['package'], $_POST['pcunit'], @@ -814,6 +815,7 @@ $myrow['decimalplaces'], $ItemCode, $myrow['unitname'], + $myrow['conversionfactor'], $myrow['suppliers_partno'], $Quantity*$myrow['price'], $myrow['leadtime'], @@ -846,6 +848,7 @@ 0, $ItemCode, $myrow['units'], + 1, '', 0, 0, Modified: trunk/doc/Change.log.html =================================================================== --- trunk/doc/Change.log.html 2010-07-11 16:57:46 UTC (rev 3603) +++ trunk/doc/Change.log.html 2010-07-11 16:58:19 UTC (rev 3604) @@ -1,5 +1,6 @@ <p><font SIZE=4 COLOR=BLUE><b>webERP Change Log</b></font></p> <p></p> +<p>11/07/10 Tim: Goods Receiving - Fix conversion factor bug, layout changes, sql quoting fixed</p> <p>11/07/10 Tim: DefineCartClass.php - Fix typo in variable declaration</p> <p>10/07/10 Tim: StockTransfers - Bug fixes, correctly round the decimal places, fix sql quoting errors and layout changes</p> <p>10/07/10 Tim: Bulk Transfers - Bug fixes, correctly round the decimal places, fix sql quoting errors and layout changes</p> Modified: trunk/includes/DefinePOClass.php =================================================================== --- trunk/includes/DefinePOClass.php 2010-07-11 16:57:46 UTC (rev 3603) +++ trunk/includes/DefinePOClass.php 2010-07-11 16:58:19 UTC (rev 3604) @@ -96,6 +96,7 @@ $DecimalPlaces=2, $itemno, $uom, + $ConversionFactor, $leadtime, $suppliers_partno, $subtotal_amount, @@ -128,6 +129,7 @@ $DecimalPlaces, $itemno, $uom, + $ConversionFactor, $leadtime, $suppliers_partno, $subtotal_amount, @@ -155,6 +157,7 @@ $JobRef , $itemno, $uom, + $ConversionFactor, $suppliers_partno, $subtotal_amount, $package, @@ -175,6 +178,7 @@ $this->LineItems[$LineNo]->JobRef = $JobRef; $this->LineItems[$LineNo]->itemno = $itemno; $this->LineItems[$LineNo]->uom = $uom; + $this->LineItems[$LineNo]->ConversionFactor = $ConversionFactor; $this->LineItems[$LineNo]->suppliers_partno = $suppliers_partno; $this->LineItems[$LineNo]->subtotal_amount = $subtotal_amount; $this->LineItems[$LineNo]->package = $package; @@ -244,6 +248,7 @@ Var $JobRef; Var $itemno; Var $uom; + var $ConversionFactor; Var $suppliers_partno; Var $subtotal_amount; Var $leadtime; @@ -280,6 +285,7 @@ $DecimalPlaces, $itemno, $uom, + $ConversionFactor, $suppliers_partno, $subtotal_amount, $leadtime, @@ -309,6 +315,7 @@ $this->JobRef = $JobRef; $this->itemno = $itemno; $this->uom = $uom; + $this->ConversionFactor = $ConversionFactor; $this->suppliers_partno = $suppliers_partno; $this->subtotal_amount = $subtotal_amount; $this->leadtime = $leadtime; Modified: trunk/includes/PO_ReadInOrder.inc =================================================================== --- trunk/includes/PO_ReadInOrder.inc 2010-07-11 16:57:46 UTC (rev 3603) +++ trunk/includes/PO_ReadInOrder.inc 2010-07-11 16:58:19 UTC (rev 3604) @@ -196,7 +196,8 @@ $date=DB_fetch_row($dateresult); if ($date[0]!='') { $sql='SELECT unitsofmeasure.unitname, - suppliers_partno + suppliers_partno, + conversionfactor FROM purchdata LEFT JOIN unitsofmeasure ON purchdata.suppliersuom=unitsofmeasure.unitid @@ -209,6 +210,7 @@ $sql='SELECT units as unitname, stockid as suppliers_partno FROM stockmaster WHERE stockid="'.$StockID.'"'; $purchdataresult=DB_query($sql, $db); $myrow2=DB_fetch_array($purchdataresult); + $myrow2['conversionfactor']=1; } $_SESSION['PO'.$identifier]->add_to_order($_SESSION['PO'.$identifier]->LinesOnOrder+1, @@ -230,6 +232,7 @@ $myrow['decimalplaces'], $myrow['itemno'], $myrow2['unitname'], + $myrow2['conversionfactor'], $myrow2['suppliers_partno'], $myrow['subtotal_amount'], 0, This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |