From: <tim...@us...> - 2010-05-05 07:46:59
|
Revision: 3444 http://web-erp.svn.sourceforge.net/web-erp/?rev=3444&view=rev Author: tim_schofield Date: 2010-05-05 07:46:53 +0000 (Wed, 05 May 2010) Log Message: ----------- Zhiguo: PO_ReadInOrder.inc - Correct sql so that only one line per order line appears in the goods received screen Modified Paths: -------------- trunk/doc/Change.log.html trunk/includes/PO_ReadInOrder.inc Modified: trunk/doc/Change.log.html =================================================================== --- trunk/doc/Change.log.html 2010-05-04 13:39:34 UTC (rev 3443) +++ trunk/doc/Change.log.html 2010-05-05 07:46:53 UTC (rev 3444) @@ -1,5 +1,6 @@ <p><font SIZE=4 COLOR=BLUE><b>webERP Change Log</b></font></p> <p></p> +<p>05/05/10 Zhiguo: PO_ReadInOrder.inc - Correct sql so that only one line per order line appears in the goods received screen</p> <p>04/05/10 Tim: SelectProduct.php - Correctly display the product when selected from more than one page.</p> <p>03/05/10 Lindsay: More installer tweaks: better error handling</p> <p>03/05/10 Tim: PurchData.php - Do not show thousands seperator in price field</p> Modified: trunk/includes/PO_ReadInOrder.inc =================================================================== --- trunk/includes/PO_ReadInOrder.inc 2010-05-04 13:39:34 UTC (rev 3443) +++ trunk/includes/PO_ReadInOrder.inc 2010-05-05 07:46:53 UTC (rev 3444) @@ -15,82 +15,82 @@ /*read in all the guff from the selected order into the PO PurchOrder Class variable */ - $OrderHeaderSQL = 'SELECT purchorders.supplierno, - suppliers.suppname, - purchorders.comments, - purchorders.orddate, - purchorders.rate, - purchorders.dateprinted, - purchorders.deladd1, - purchorders.deladd2, - purchorders.deladd3, - purchorders.deladd4, - purchorders.deladd5, - purchorders.deladd6, - purchorders.tel, - purchorders.suppdeladdress1, - purchorders.suppdeladdress2, - purchorders.suppdeladdress3, - purchorders.suppdeladdress4, - purchorders.suppdeladdress5, - purchorders.suppdeladdress6, + $OrderHeaderSQL = 'SELECT purchorders.supplierno, + suppliers.suppname, + purchorders.comments, + purchorders.orddate, + purchorders.rate, + purchorders.dateprinted, + purchorders.deladd1, + purchorders.deladd2, + purchorders.deladd3, + purchorders.deladd4, + purchorders.deladd5, + purchorders.deladd6, + purchorders.tel, + purchorders.suppdeladdress1, + purchorders.suppdeladdress2, + purchorders.suppdeladdress3, + purchorders.suppdeladdress4, + purchorders.suppdeladdress5, + purchorders.suppdeladdress6, purchorders.suppliercontact, purchorders.supptel, purchorders.contact, - purchorders.allowprint, - purchorders.requisitionno, - purchorders.intostocklocation, - purchorders.initiator, - purchorders.version, - purchorders.status, - purchorders.stat_comment, + purchorders.allowprint, + purchorders.requisitionno, + purchorders.intostocklocation, + purchorders.initiator, + purchorders.version, + purchorders.status, + purchorders.stat_comment, purchorders.deliverydate, purchorders.port, suppliers.currcode, locations.managed , purchorders.paymentterms - FROM purchorders + FROM purchorders LEFT JOIN locations ON purchorders.intostocklocation=locations.loccode, - suppliers - WHERE purchorders.supplierno = suppliers.supplierid + suppliers + WHERE purchorders.supplierno = suppliers.supplierid AND purchorders.orderno = ' . $_GET['ModifyOrderNumber']; - $ErrMsg = _('The order cannot be retrieved because'); - $DbgMsg = _('The SQL statement that was used and failed was'); - $GetOrdHdrResult = DB_query($OrderHeaderSQL,$db,$ErrMsg,$DbgMsg); + $ErrMsg = _('The order cannot be retrieved because'); + $DbgMsg = _('The SQL statement that was used and failed was'); + $GetOrdHdrResult = DB_query($OrderHeaderSQL,$db,$ErrMsg,$DbgMsg); if (DB_num_rows($GetOrdHdrResult)==1 and !isset($_SESSION['PO'.$identifier]->OrderNo )) { - $myrow = DB_fetch_array($GetOrdHdrResult); - $_SESSION['PO'.$identifier]->OrderNo = $_GET['ModifyOrderNumber']; - $_SESSION['PO'.$identifier]->SupplierID = $myrow['supplierno']; - $_SESSION['PO'.$identifier]->SupplierName = $myrow['suppname']; - $_SESSION['PO'.$identifier]->CurrCode = $myrow['currcode']; - $_SESSION['PO'.$identifier]->Orig_OrderDate = $myrow['orddate']; - $_SESSION['PO'.$identifier]->AllowPrintPO = $myrow['allowprint']; - $_SESSION['PO'.$identifier]->DatePurchaseOrderPrinted = $myrow['dateprinted']; - $_SESSION['PO'.$identifier]->Comments = $myrow['comments']; - $_SESSION['PO'.$identifier]->ExRate = $myrow['rate']; - $_SESSION['PO'.$identifier]->Location = $myrow['intostocklocation']; - $_SESSION['PO'.$identifier]->Initiator = $myrow['initiator']; - $_SESSION['PO'.$identifier]->RequisitionNo = $myrow['requisitionno']; - $_SESSION['PO'.$identifier]->DelAdd1 = $myrow['deladd1']; - $_SESSION['PO'.$identifier]->DelAdd2 = $myrow['deladd2']; - $_SESSION['PO'.$identifier]->DelAdd3 = $myrow['deladd3']; - $_SESSION['PO'.$identifier]->DelAdd4 = $myrow['deladd4']; - $_SESSION['PO'.$identifier]->DelAdd5 = $myrow['deladd5']; - $_SESSION['PO'.$identifier]->DelAdd6 = $myrow['deladd6']; + $myrow = DB_fetch_array($GetOrdHdrResult); + $_SESSION['PO'.$identifier]->OrderNo = $_GET['ModifyOrderNumber']; + $_SESSION['PO'.$identifier]->SupplierID = $myrow['supplierno']; + $_SESSION['PO'.$identifier]->SupplierName = $myrow['suppname']; + $_SESSION['PO'.$identifier]->CurrCode = $myrow['currcode']; + $_SESSION['PO'.$identifier]->Orig_OrderDate = $myrow['orddate']; + $_SESSION['PO'.$identifier]->AllowPrintPO = $myrow['allowprint']; + $_SESSION['PO'.$identifier]->DatePurchaseOrderPrinted = $myrow['dateprinted']; + $_SESSION['PO'.$identifier]->Comments = $myrow['comments']; + $_SESSION['PO'.$identifier]->ExRate = $myrow['rate']; + $_SESSION['PO'.$identifier]->Location = $myrow['intostocklocation']; + $_SESSION['PO'.$identifier]->Initiator = $myrow['initiator']; + $_SESSION['PO'.$identifier]->RequisitionNo = $myrow['requisitionno']; + $_SESSION['PO'.$identifier]->DelAdd1 = $myrow['deladd1']; + $_SESSION['PO'.$identifier]->DelAdd2 = $myrow['deladd2']; + $_SESSION['PO'.$identifier]->DelAdd3 = $myrow['deladd3']; + $_SESSION['PO'.$identifier]->DelAdd4 = $myrow['deladd4']; + $_SESSION['PO'.$identifier]->DelAdd5 = $myrow['deladd5']; + $_SESSION['PO'.$identifier]->DelAdd6 = $myrow['deladd6']; $_SESSION['PO'.$identifier]->tel = $myrow['tel']; - $_SESSION['PO'.$identifier]->suppDelAdd1 = $myrow['suppdeladdress1']; - $_SESSION['PO'.$identifier]->suppDelAdd2 = $myrow['suppdeladdress2']; - $_SESSION['PO'.$identifier]->suppDelAdd3 = $myrow['suppdeladdress3']; - $_SESSION['PO'.$identifier]->suppDelAdd4 = $myrow['suppdeladdress4']; - $_SESSION['PO'.$identifier]->suppDelAdd5 = $myrow['suppdeladdress5']; - $_SESSION['PO'.$identifier]->suppDelAdd6 = $myrow['suppdeladdress6']; - $_SESSION['PO'.$identifier]->SupplierContact = $myrow['suppliercontact']; - $_SESSION['PO'.$identifier]->supptel= $myrow['supptel']; - $_SESSION['PO'.$identifier]->contact = $myrow['contact']; - $_SESSION['PO'.$identifier]->Managed = $myrow['managed']; + $_SESSION['PO'.$identifier]->suppDelAdd1 = $myrow['suppdeladdress1']; + $_SESSION['PO'.$identifier]->suppDelAdd2 = $myrow['suppdeladdress2']; + $_SESSION['PO'.$identifier]->suppDelAdd3 = $myrow['suppdeladdress3']; + $_SESSION['PO'.$identifier]->suppDelAdd4 = $myrow['suppdeladdress4']; + $_SESSION['PO'.$identifier]->suppDelAdd5 = $myrow['suppdeladdress5']; + $_SESSION['PO'.$identifier]->suppDelAdd6 = $myrow['suppdeladdress6']; + $_SESSION['PO'.$identifier]->SupplierContact = $myrow['suppliercontact']; + $_SESSION['PO'.$identifier]->supptel= $myrow['supptel']; + $_SESSION['PO'.$identifier]->contact = $myrow['contact']; + $_SESSION['PO'.$identifier]->Managed = $myrow['managed']; $_SESSION['PO'.$identifier]->version = $myrow['version']; $_SESSION['PO'.$identifier]->port = $myrow['port']; $_SESSION['PO'.$identifier]->Stat = $myrow['status']; @@ -99,19 +99,19 @@ $_SESSION['ExistingOrder'] = $_SESSION['PO'.$identifier]->OrderNo; $_SESSION['PO'.$identifier]->paymentterms= $myrow['paymentterms']; - $supplierSQL = "SELECT suppliers.supplierid, + $supplierSQL = "SELECT suppliers.supplierid, suppliers.suppname, - suppliers.address1, - suppliers.address2, - suppliers.address3, + suppliers.address1, + suppliers.address2, + suppliers.address3, suppliers.address4, - suppliers.address5, - suppliers.address6, - suppliers.currcode - FROM suppliers + suppliers.address5, + suppliers.address6, + suppliers.currcode + FROM suppliers WHERE suppliers.supplierid='" . $_SESSION['PO'.$identifier]->SupplierID."' ORDER BY suppliers.supplierid"; - + $ErrMsg = _('The searched supplier records requested cannot be retrieved because'); $result_SuppSelect = DB_query($supplierSQL,$db,$ErrMsg); @@ -119,13 +119,13 @@ $myrow=DB_fetch_array($result_SuppSelect); // $_POST['Select'] = $myrow['supplierid']; } elseif (DB_num_rows($result_SuppSelect)==0){ - prnMsg( _('No supplier records contain the selected text') . ' - ' . + prnMsg( _('No supplier records contain the selected text') . ' - ' . _('please alter your search criteria and try again'),'info'); } /*now populate the line PO array with the purchase order details records */ - $LineItemsSQL = 'SELECT podetailitem, + $LineItemsSQL = 'SELECT podetailitem, itemcode, stockmaster.description, purchorderdetails.deliverydate, @@ -155,26 +155,37 @@ cuft, total_quantity, total_amount - FROM purchorderdetails + FROM purchorderdetails LEFT JOIN stockmaster ON purchorderdetails.itemcode=stockmaster.stockid LEFT JOIN purchorders ON purchorders.orderno=purchorderdetails.orderno LEFT JOIN chartmaster ON purchorderdetails.glcode=chartmaster.accountcode - LEFT JOIN purchdata - ON purchdata.stockid=purchorderdetails.itemcode AND purchdata.supplierno=purchorders.supplierno + LEFT JOIN (SELECT purchdata.supplierno, + purchdata.stockid, + purchdata.price, + purchdata.suppliersuom, + purchdata.conversionfactor, + purchdata.supplierdescription, + purchdata.leadtime, + purchdata.preferred, + MAX(purchdata.effectivefrom), + purchdata.suppliers_partno + FROM weberpdemo.purchdata purchdata + GROUP BY purchdata.supplierno, purchdata.stockid) purchdata + ON purchdata.stockid=purchorderdetails.itemcode AND purchdata.supplierno=purchorders.supplierno WHERE purchorderdetails.completed=0 AND purchorderdetails.orderno =' . $_GET['ModifyOrderNumber'] . " ORDER BY podetailitem"; - $ErrMsg = _('The lines on the purchase order cannot be retrieved because'); - $DbgMsg = _('The SQL statement that was used to retrieve the purchase order lines was'); - $LineItemsResult = db_query($LineItemsSQL,$db,$ErrMsg,$DbgMsg); + $ErrMsg = _('The lines on the purchase order cannot be retrieved because'); + $DbgMsg = _('The SQL statement that was used to retrieve the purchase order lines was'); + $LineItemsResult = db_query($LineItemsSQL,$db,$ErrMsg,$DbgMsg); - if (db_num_rows($LineItemsResult) > 0) { + if (db_num_rows($LineItemsResult) > 0) { - while ($myrow=db_fetch_array($LineItemsResult)) { + while ($myrow=db_fetch_array($LineItemsResult)) { if (is_null($myrow['glcode'])){ $GLCode = ''; @@ -221,9 +232,9 @@ $myrow['total_quantity'], $myrow['total_amount']); - $_SESSION['PO'.$identifier]->LineItems[$_SESSION['PO'.$identifier]->LinesOnOrder]->PODetailRec = $myrow['podetailitem']; - $_SESSION['PO'.$identifier]->LineItems[$_SESSION['PO'.$identifier]->LinesOnOrder]->StandardCost = $myrow['stdcostunit']; /*Needed for receiving goods and GL interface */ - } /* line PO from purchase order details */ - } //end is there were lines on the order + $_SESSION['PO'.$identifier]->LineItems[$_SESSION['PO'.$identifier]->LinesOnOrder]->PODetailRec = $myrow['podetailitem']; + $_SESSION['PO'.$identifier]->LineItems[$_SESSION['PO'.$identifier]->LinesOnOrder]->StandardCost = $myrow['stdcostunit']; /*Needed for receiving goods and GL interface */ + } /* line PO from purchase order details */ + } //end is there were lines on the order } // end if there was a header for the order ?> \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |