From: <tim...@us...> - 2009-11-14 10:31:24
|
Revision: 2996 http://web-erp.svn.sourceforge.net/web-erp/?rev=2996&view=rev Author: tim_schofield Date: 2009-11-14 10:31:14 +0000 (Sat, 14 Nov 2009) Log Message: ----------- Improve direct ordering code and make the EOQ the default quantity when ordered direct Modified Paths: -------------- trunk/PO_Header.php trunk/PO_Items.php trunk/SelectProduct.php Modified: trunk/PO_Header.php =================================================================== --- trunk/PO_Header.php 2009-11-13 19:11:18 UTC (rev 2995) +++ trunk/PO_Header.php 2009-11-14 10:31:14 UTC (rev 2996) @@ -728,10 +728,76 @@ echo '<br><table class="table_index"><tr><td class="menu_group_item">'; /* the link */ - echo '<li><a href="'.$rootpath.'/PO_Items.php?' . SID . 'NewItem=' . $purch_item . "?identifier=".$identifier. '">' . + echo '<li><a href="'.$rootpath.'/PO_Items.php?' . SID . 'NewItem=' . $purch_item . "&identifier=".$identifier. '">' . _('Enter Line Item to this purchase order') . '</a></li>'; /**/ echo "</td></tr></table></div><br>"; + + if (isset($_GET['Quantity'])) { + $Qty=$_GET['Quantity']; + } else { + $Qty=1; + } + + $sql='SELECT + controlled, + serialised, + description, + units , + decimalplaces + FROM stockmaster + WHERE stockid="'.$purch_item.'" '; + $result=DB_query($sql, $db); + $stockmasterrow=DB_fetch_array($result); + + $sql='SELECT + price, + suppliersuom, + suppliers_partno + FROM purchdata + WHERE supplierno="'.$_GET['SelectedSupplier'] .'" + AND stockid="'.$purch_item.'" '; + $result=DB_query($sql, $db); + $purchdatarow=DB_fetch_array($result); + + $sql='SELECT + stockact + FROM stockcategory + LEFT JOIN stockmaster ON stockmaster.categoryid=stockcategory.categoryid + WHERE stockid="'.$purch_item.'" '; + $result=DB_query($sql, $db); + $categoryrow=DB_fetch_array($result); + + $_SESSION['PO'.$identifier]->add_to_order( + 1, + $purch_item, + $stockmasterrow['serialised'], + $stockmasterrow['controlled'], + $Qty, + $stockmasterrow['description'], + $purchdatarow['price'], + $stockmasterrow['units'], + $categoryrow['stockact'], + date($_SESSION['DefaultDateFormat']), + 0, + 0, + '', + 0, + 0, + '', + $stockmasterrow['decimalplaces'], + $purch_item, + $purchdatarow['suppliersuom'], + $purchdatarow['suppliers_partno'], + $Qty*$purchdatarow['price'], + '', + 0, + 0, + 0, + 0, + $Qty, + $Qty*$purchdatarow['price']); + echo "<meta http-equiv='Refresh' content='0; url=" . $rootpath . '/PO_Items.php?' . SID . 'identifier='.$identifier. "'>"; } /*Set up form for entry of order header stuff */ Modified: trunk/PO_Items.php =================================================================== --- trunk/PO_Items.php 2009-11-13 19:11:18 UTC (rev 2995) +++ trunk/PO_Items.php 2009-11-14 10:31:14 UTC (rev 2996) @@ -883,7 +883,7 @@ if (count($_SESSION['PO'.$identifier]->LineItems)>0 and !isset($_GET['Edit'])){ echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/supplier.png" title="' . - _('Purchase Order') . '" alt="">'; + _('Purchase Order') . '" alt=""> '.$_SESSION['PO'.$identifier]->SupplierName; if (isset($_SESSION['PO'.$identifier]->OrderNo)) { echo ' ' . _('Purchase Order') .' '. $_SESSION['PO'.$identifier]->OrderNo ; Modified: trunk/SelectProduct.php =================================================================== --- trunk/SelectProduct.php 2009-11-13 19:11:18 UTC (rev 2995) +++ trunk/SelectProduct.php 2009-11-14 10:31:14 UTC (rev 2996) @@ -800,7 +800,12 @@ while ($SuppRow = DB_fetch_array($SuppResult)) { /**/ // - echo '<a href="' . $rootpath . '/PO_Header.php?' . SID . '&NewOrder=Yes' . '&SelectedSupplier=' . $SuppRow['supplierid'] . '&StockID=' . $StockID . '">' . _('Purchase this Item from') . ' ' . $SuppRow['suppname'] . ' (default)</a><br>'; + if ($myrow['eoq']==0) { + $EOQ=1; + } else { + $EOQ=$myrow['eoq']; + } + echo '<a href="' . $rootpath . '/PO_Header.php?' . SID . '&NewOrder=Yes' . '&SelectedSupplier=' . $SuppRow['supplierid'] . '&StockID=' . $StockID . '&Quantity='.$EOQ.'">' . _('Purchase this Item from') . ' ' . $SuppRow['suppname'] . ' (default)</a><br>'; /**/ } /* end of while */ } /* end of $myrow['mbflag'] == 'B' */ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |