From: <tim...@us...> - 2010-06-07 19:58:27
|
Revision: 3484 http://web-erp.svn.sourceforge.net/web-erp/?rev=3484&view=rev Author: tim_schofield Date: 2010-06-07 19:58:17 +0000 (Mon, 07 Jun 2010) Log Message: ----------- Various changes to correctly deal with suppliers uom plus layout changes to puirchase orders and goods received notes Modified Paths: -------------- trunk/GoodsReceived.php trunk/PDFGrn.php trunk/PO_Items.php trunk/PO_PDFPurchOrder.php trunk/companies/weberpdemo/FormDesigns/GoodsReceived.xml trunk/companies/weberpdemo/FormDesigns/PurchaseOrder.xml trunk/doc/Change.log.html trunk/includes/DefinePOClass.php trunk/includes/PDFGrnHeader.inc trunk/includes/PO_ReadInOrder.inc Modified: trunk/GoodsReceived.php =================================================================== --- trunk/GoodsReceived.php 2010-06-07 01:06:13 UTC (rev 3483) +++ trunk/GoodsReceived.php 2010-06-07 19:58:17 UTC (rev 3484) @@ -129,15 +129,17 @@ } else { $uom=$LnItm->Units; } + $conversionfactor=$uomrow['conversionfactor']; } else { $uom=$LnItm->Units; + $conversionfactor=1; } //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>' . $uom . '</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>'; @@ -412,7 +414,7 @@ '" . $_POST['DefaultReceivedDate'] . "', " . $OrderLine->ReceiveQty . ", '" . $_SESSION['PO']->SupplierID . "', - " . $CurrentStandardCost . ')'; + " . $CurrentStandardCost *$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'); @@ -477,7 +479,7 @@ 25, " . $GRN . ", '" . $_SESSION['PO']->Location . "', '" . $_POST['DefaultReceivedDate'] . "', - " . $LocalCurrencyPrice . ", + " . $LocalCurrencyPrice / $conversionfactor . ", " . $PeriodNo . ", '" . $_SESSION['PO']->SupplierID . " (" . $_SESSION['PO']->SupplierName . ") - " .$_SESSION['PO']->OrderNo . "', " . $OrderLine->ReceiveQty . ", Modified: trunk/PDFGrn.php =================================================================== --- trunk/PDFGrn.php 2010-06-07 01:06:13 UTC (rev 3483) +++ trunk/PDFGrn.php 2010-06-07 19:58:17 UTC (rev 3484) @@ -28,14 +28,21 @@ include('includes/PDFStarter.php'); $pdf->addInfo('Title', _('Goods Received Note') ); -include('includes/PDFGrnHeader.inc'); - if ($GRNNo=='Preview') { $ListCount = 1; // UldisN } else { - $sql='SELECT itemcode, grnno, deliverydate, itemdescription, qtyrecd, supplierid from grns where grnbatch='.$GRNNo; + $sql='SELECT grns.itemcode, + grns.grnno, + grns.deliverydate, + grns.itemdescription, + grns.qtyrecd, + grns.supplierid + FROM grns + WHERE grnbatch='.$GRNNo; $result=DB_query($sql, $db); $ListCount = DB_num_rows($result); // UldisN + + include('includes/PDFGrnHeader.inc'); } $counter=1; $YPos=$FormDesign->Data->y; @@ -47,15 +54,57 @@ $Quantity='XXXXX.XX'; $Supplier=str_pad('',25,'x'); } else { + $sql='SELECT orddate from purchorders WHERE orderno='.$_GET['PONo']; + $purchorderresult=DB_query($sql, $db); + $purchorderdate=DB_fetch_array($purchorderresult); $myrow=DB_fetch_array($result); + $datesql='SELECT max(effectivefrom) FROM purchdata WHERE supplierno="'.$myrow['supplierid'].'" AND stockid="'.$myrow['itemcode'].'" AND effectivefrom<="'.$purchorderdate[0].'"'; + $dateresult=DB_query($datesql, $db); + $date=DB_fetch_row($dateresult); + if ($date[0]!='') { + $sql='SELECT unitsofmeasure.unitname, + suppliers_partno, + conversionfactor + FROM purchdata + LEFT JOIN unitsofmeasure + ON purchdata.suppliersuom=unitsofmeasure.unitid + WHERE supplierno="'.$myrow['supplierid'].'" + AND stockid="'.$myrow['itemcode'].'" + AND effectivefrom="'.$date[0].'"'; + $purchdataresult=DB_query($sql, $db); + $myrow2=DB_fetch_array($purchdataresult); + } else { + $sql='SELECT units as unitname, stockid as suppliers_partno, 1 as conversionfactor FROM stockmaster WHERE stockid="'.$StockID.'"'; + $purchdataresult=DB_query($sql, $db); + $myrow2=DB_fetch_array($purchdataresult); + } $StockID=$myrow[0]; $GRNNo=$myrow[1]; $Date=ConvertSQLDate($myrow[2]); $Description=$myrow[3]; $Quantity=$myrow[4]; $SupplierID=$myrow[5]; + if ($myrow2['unitname']=='') { + $sql='SELECT units + FROM stockmaster + WHERE stockid="'.$myrow['itemcode'].'"'; + $uomresult=DB_query($sql, $db); + $uomrow=DB_fetch_array($uomresult); + $units=$uomrow['units']; + } else { + $units=$myrow2['unitname']; + } + $sql='SELECT units, + decimalplaces + FROM stockmaster + WHERE stockid="'.$myrow['itemcode'].'"'; + $uomresult=DB_query($sql, $db); + $uomrow=DB_fetch_array($uomresult); + $stockunits=$uomrow['units']; - $sql='select suppname from suppliers where supplierid="'.$SupplierID.'"'; + $sql='SELECT suppname + FROM suppliers + WHERE supplierid="'.$SupplierID.'"'; $supplierresult=DB_query($sql, $db); $suppliermyrow=DB_fetch_array($supplierresult); $Supplier=$suppliermyrow[0]; @@ -64,10 +113,18 @@ $LeftOvers = $pdf->addTextWrap($FormDesign->Data->Column1->x,$Page_Height-$YPos,$FormDesign->Data->Column1->Length,$FormDesign->Data->Column1->FontSize, $StockID); $LeftOvers = $pdf->addTextWrap($FormDesign->Data->Column2->x,$Page_Height-$YPos,$FormDesign->Data->Column2->Length,$FormDesign->Data->Column2->FontSize, $Description); $LeftOvers = $pdf->addTextWrap($FormDesign->Data->Column3->x,$Page_Height-$YPos,$FormDesign->Data->Column3->Length,$FormDesign->Data->Column3->FontSize, $Date); - $LeftOvers = $pdf->addTextWrap($FormDesign->Data->Column4->x,$Page_Height-$YPos,$FormDesign->Data->Column4->Length,$FormDesign->Data->Column4->FontSize, $Supplier); - $LeftOvers = $pdf->addTextWrap($FormDesign->Data->Column5->x,$Page_Height-$YPos,$FormDesign->Data->Column5->Length,$FormDesign->Data->Column5->FontSize, $Quantity); + $LeftOvers = $pdf->addTextWrap($FormDesign->Data->Column4->x,$Page_Height-$YPos,$FormDesign->Data->Column4->Length,$FormDesign->Data->Column4->FontSize, number_format($Quantity,$uomrow['decimalplaces']), 'right'); + $LeftOvers = $pdf->addTextWrap($FormDesign->Data->Column5->x,$Page_Height-$YPos,$FormDesign->Data->Column5->Length,$FormDesign->Data->Column5->FontSize, $units, 'left'); + $LeftOvers = $pdf->addTextWrap($FormDesign->Data->Column6->x,$Page_Height-$YPos,$FormDesign->Data->Column6->Length,$FormDesign->Data->Column6->FontSize, number_format($Quantity*$myrow2['conversionfactor'],$uomrow['decimalplaces']), 'right'); + $LeftOvers = $pdf->addTextWrap($FormDesign->Data->Column7->x,$Page_Height-$YPos,$FormDesign->Data->Column7->Length,$FormDesign->Data->Column7->FontSize, $stockunits, 'left'); $YPos += $line_height; $counter++; + if ($YPos >= $FormDesign->LineAboveFooter->starty){ + /* We reached the end of the page so finsih off the page and start a newy */ + $PageNumber++; + $YPos=$FormDesign->Data->y; + include ('includes/PDFGrnHeader.inc'); + } //end if need a new page headed up } $LeftOvers = $pdf->addText($FormDesign->ReceiptDate->x,$Page_Height-$FormDesign->ReceiptDate->y,$FormDesign->ReceiptDate->FontSize, _('Date of Receipt: ').$Date); Modified: trunk/PO_Items.php =================================================================== --- trunk/PO_Items.php 2010-06-07 01:06:13 UTC (rev 3483) +++ trunk/PO_Items.php 2010-06-07 19:58:17 UTC (rev 3484) @@ -753,12 +753,15 @@ purchdata.conversionfactor, purchdata.supplierdescription, purchdata.suppliersuom, + unitsofmeasure.unitname, purchdata.suppliers_partno, purchdata.leadtime FROM stockcategory, chartmaster, stockmaster LEFT JOIN purchdata ON stockmaster.stockid = purchdata.stockid + LEFT JOIN unitsofmeasure + ON purchdata.suppliersuom=unitsofmeasure.unitid AND purchdata.supplierno = '" . $_SESSION['PO'.$identifier]->SupplierID . "' WHERE chartmaster.accountcode = stockcategory.stockact AND stockcategory.categoryid = stockmaster.categoryid @@ -810,11 +813,12 @@ $myrow['accountname'], $myrow['decimalplaces'], $ItemCode, - $myrow['suppliersuom'], + $myrow['unitname'], $myrow['suppliers_partno'], $Quantity*$myrow['price'], $myrow['leadtime'], '', + 0, $myrow['netweight'], $myrow['kgs'], '', @@ -841,8 +845,8 @@ $myrow['accountname'], 0, $ItemCode, + $myrow['units'], '', - '', 0, 0, '', @@ -850,6 +854,7 @@ 0, 0, 0, + 0, 0 ); } @@ -995,8 +1000,6 @@ echo '<div class=centre><input type=submit name="EnterLine" value="Enter Item"></div>'; } -echo '<hr>'; - /* Now show the stock item selection search stuff below */ if (!isset($_GET['Edit'])) { @@ -1010,7 +1013,7 @@ $DbgMsg = _('The SQL used to retrieve the category details but failed was'); $result1 = DB_query($sql,$db,$ErrMsg,$DbgMsg); - echo '<table><tr><p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/magnifier.png" title="' . + echo '<table class=selection><tr><p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/magnifier.png" title="' . _('Print') . '" alt="">' . ' ' . _('Search For Stock Items') . ''; echo ":</font></tr><tr><td><select name='StockCat'>"; @@ -1057,7 +1060,7 @@ if (isset($SearchResult)) { - echo "<table cellpadding=1 colspan=7 border=1>"; + echo "<table cellpadding=1 colspan=7>"; $tableheader = "<tr> <th>" . _('Code') . "</th> @@ -1090,8 +1093,12 @@ $ImageSource = '<i>'._('No Image').'</i>'; } - $uomsql='SELECT conversionfactor, suppliersuom + $uomsql='SELECT conversionfactor, + suppliersuom, + unitsofmeasure.unitname FROM purchdata + LEFT JOIN unitsofmeasure + ON purchdata.suppliersuom=unitsofmeasure.unitid WHERE supplierno="'.$_SESSION['PO'.$identifier]->SupplierID.'" AND stockid="'.$myrow['stockid'].'"'; @@ -1099,24 +1106,20 @@ if (DB_num_rows($uomresult)>0) { $uomrow=DB_fetch_array($uomresult); if (strlen($uomrow['suppliersuom'])>0) { - $uom=$uomrow['suppliersuom']; + $uom=$uomrow['unitname']; } else { $uom=$myrow['units']; } } else { $uom=$myrow['units']; } - printf("<td>%s</td> - <td>%s</td> - <td>%s</td> - <td>%s</td> - <td><input class='number' type='text' size=6 value=0 name='qty%s'></td> - </tr>", - $myrow['stockid'], - $myrow['description'], - $uom, - $ImageSource, - $myrow['stockid']); + echo "<td>".$myrow['stockid']."</td> + <td>".$myrow['description']."</td> + <td>".$uom."</td> + <td>".$ImageSource."</td> + <td><input class='number' type='text' size=6 value=0 name='qty".$myrow['stockid']."'></td> + <td><input type='hidden' size=6 value=".$uom." name=uom></td> + </tr>"; $PartsDisplayed++; if ($PartsDisplayed == $Maximum_Number_Of_Parts_To_Show){ @@ -1140,4 +1143,4 @@ echo '</form>'; include('includes/footer.inc'); -?> +?> \ No newline at end of file Modified: trunk/PO_PDFPurchOrder.php =================================================================== --- trunk/PO_PDFPurchOrder.php 2010-06-07 01:06:13 UTC (rev 3483) +++ trunk/PO_PDFPurchOrder.php 2010-06-07 19:58:17 UTC (rev 3484) @@ -255,6 +255,7 @@ if ($YPos-$line_height <= $Bottom_Margin){ /* We reached the end of the page so finsih off the page and start a newy */ $PageNumber++; + $YPos=$Page_Height - $FormDesign->Data->y; include ('includes/PO_PDFOrderPageHeader.inc'); } //end if need a new page headed up /*increment a line down for the next line item */ @@ -268,7 +269,7 @@ } //end while there are line items to print out if ($YPos-$line_height <= $Bottom_Margin){ // need to ensure space for totals $PageNumber++; - include ('includes/PO_PDFOrderPageHeader.inc'); + include ('includes/PO_PDFOrderPageHeader.inc'); } //end if need a new page headed up if ($_POST['ShowAmounts']=='Yes'){ $DisplayOrderTotal = number_format($OrderTotal,2); Modified: trunk/companies/weberpdemo/FormDesigns/GoodsReceived.xml =================================================================== --- trunk/companies/weberpdemo/FormDesigns/GoodsReceived.xml 2010-06-07 01:06:13 UTC (rev 3483) +++ trunk/companies/weberpdemo/FormDesigns/GoodsReceived.xml 2010-06-07 19:58:17 UTC (rev 3484) @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> <form name="Goods Received Note"> - <PaperSize name="Paper size">A4</PaperSize> + <PaperSize name="Paper size">A4_Landscape</PaperSize> <LineHeight name="Line height">12</LineHeight> <logo type="image" name="Logo" id="Logo"> <x>20</x> @@ -8,30 +8,65 @@ <width>0</width> <height>60</height> </logo> + <SupplierName type="SimpleText" name="Supplier name" id="SupplierName"> + <FontSize>10</FontSize> + <x>325</x> + <y>30</y> + </SupplierName> + <SupplierAddress1 type="SimpleText" name="Supplier Address1" id="SupplierAddress1"> + <FontSize>10</FontSize> + <x>325</x> + <y>42</y> + </SupplierAddress1> + <SupplierAddress2 type="SimpleText" name="Supplier Address2" id="SupplierAddress2"> + <FontSize>10</FontSize> + <x>325</x> + <y>54</y> + </SupplierAddress2> + <SupplierAddress3 type="SimpleText" name="Supplier Address3" id="SupplierAddress3"> + <FontSize>10</FontSize> + <x>325</x> + <y>66</y> + </SupplierAddress3> + <SupplierAddress4 type="SimpleText" name="Supplier Address4" id="SupplierAddress4"> + <FontSize>10</FontSize> + <x>325</x> + <y>78</y> + </SupplierAddress4> + <SupplierAddress5 type="SimpleText" name="Supplier Address5" id="SupplierAddress5"> + <FontSize>10</FontSize> + <x>325</x> + <y>80</y> + </SupplierAddress5> + <SupplierAddress6 type="SimpleText" name="Supplier Address6" id="SupplierAddress6"> + <FontSize>10</FontSize> + <x>325</x> + <y>92</y> + </SupplierAddress6> <CompanyName type="SimpleText" name="Company name" id="CompanyName"> <FontSize>10</FontSize> - <x>425</x> + <x>625</x> <y>30</y> </CompanyName> <GRNNumber type="SimpleText" name="GRN Number" id="GRNNumber"> <FontSize>10</FontSize> - <x>425</x> + <x>625</x> <y>48</y> </GRNNumber> <OrderNumber type="SimpleText" name="Order Number" id="OrderNumber"> <FontSize>10</FontSize> - <x>425</x> + <x>625</x> <y>66</y> </OrderNumber> <PrintDate type="SimpleText" name="Date Printed" id="PrintDate"> <FontSize>10</FontSize> - <x>425</x> + <x>625</x> <y>84</y> </PrintDate> <HeaderRectangle type="Rectangle" name="Header rectangle" id="HeaderRectangle"> <x>40</x> <y>114</y> - <width>525</width> + <width>772</width> <height>24</height> </HeaderRectangle> <Headings type="ElementArray" name="Column headings"> @@ -47,26 +82,58 @@ </Column2> <Column3 type="SimpleText" name="Heading 3" id="Heading3"> <FontSize>10</FontSize> - <x>291</x> + <x>356</x> <y>126</y> </Column3> - <Column4 type="SimpleText" name="Heading 4" id="Heading4"> + <Column4 type="MultiLineText" name="Heading 4" id="Heading4"> <FontSize>10</FontSize> - <x>391</x> - <y>126</y> + <x>486</x> + <y>136</y> + <Length>100</Length> </Column4> - <Column5 type="SimpleText" name="Heading 5" id="Heading5"> + <Column5 type="MultiLineText" name="Heading 5" id="Heading5"> <FontSize>10</FontSize> - <x>491</x> - <y>126</y> + <x>616</x> + <y>136</y> + <Length>100</Length> </Column5> </Headings> <DataRectangle type="Rectangle" name="Data rectangle" id="DataRectangle"> <x>40</x> <y>138</y> - <width>525</width> - <height>674</height> + <width>772</width> + <height>430</height> </DataRectangle> + <LineAboveFooter type="Line" name="Line Above Footer" id="LineAboveFooter"> + <startx>40</startx> + <starty>530</starty> + <endx>812</endx> + <endy>530</endy> + </LineAboveFooter> + <Column1 type="Line" name="Column 1" id="Column1"> + <startx>114</startx> + <starty>114</starty> + <endx>114</endx> + <endy>530</endy> + </Column1> + <Column3 type="Line" name="Column 3" id="Column3"> + <startx>354</startx> + <starty>114</starty> + <endx>354</endx> + <endy>530</endy> + </Column3> + <Column4 type="Line" name="Column 4" id="Column4"> + <startx>489</startx> + <starty>114</starty> + <endx>489</endx> + <endy>530</endy> + </Column4> + <Column5 type="Line" name="Column 5" id="Column5"> + <startx>616</startx> + <starty>114</starty> + <endx>616</endx> + <endy>530</endy> + </Column5> <Data type="ElementArray" name="Column Data"> <y type="StartLine" name="Y co-ordinate of first data line" id="DataStartLine">156</y> <Column1 type="DataText" name="Column 1" id="Data1"> @@ -81,28 +148,38 @@ </Column2> <Column3 type="DataText" name="Column 3" id="Data3"> <FontSize>10</FontSize> - <x>291</x> + <x>356</x> <Length>85</Length> </Column3> <Column4 type="DataText" name="Column 4" id="Data4"> <FontSize>10</FontSize> - <x>356</x> - <Length>150</Length> + <x>506</x> + <Length>60</Length> </Column4> <Column5 type="DataText" name="Column 5" id="Data5"> <FontSize>10</FontSize> - <x>506</x> + <x>568</x> + <Length>30</Length> + </Column5> + <Column6 type="DataText" name="Column 6" id="Data6"> + <FontSize>10</FontSize> + <x>638</x> <Length>60</Length> - </Column5> + </Column6> + <Column7 type="DataText" name="Column 7" id="Data7"> + <FontSize>10</FontSize> + <x>700</x> + <Length>30</Length> + </Column7> </Data> <ReceiptDate type="SimpleText" name="Date Received" id="ReceiptDate"> <FontSize>10</FontSize> - <x>40</x> - <y>722</y> + <x>300</x> + <y>550</y> </ReceiptDate> <SignedFor type="SimpleText" name="Signed Fror" id="SignedFor"> <FontSize>10</FontSize> - <x>40</x> - <y>760</y> + <x>50</x> + <y>550</y> </SignedFor> </form> Modified: trunk/companies/weberpdemo/FormDesigns/PurchaseOrder.xml =================================================================== --- trunk/companies/weberpdemo/FormDesigns/PurchaseOrder.xml 2010-06-07 01:06:13 UTC (rev 3483) +++ trunk/companies/weberpdemo/FormDesigns/PurchaseOrder.xml 2010-06-07 19:58:17 UTC (rev 3484) @@ -21,7 +21,7 @@ <PageNumber type="SimpleText" name="Page number" id="PageNumber"> <FontSize>10</FontSize> <x>762</x> - <y>70</y> + <y>30</y> </PageNumber> <TaxAuthority type="SimpleText" name="Tax Authority" id="TaxAuthority"> <FontSize>10</FontSize> @@ -79,37 +79,37 @@ <Caption type="SimpleText" name="Caption" id="DeliveryAddressCaption"> <FontSize>12</FontSize> <x>448</x> - <y>154</y> + <y>142</y> </Caption> <Line1 type="SimpleText" name="Line 1" id="DeliveryAddress1"> <FontSize>12</FontSize> <x>448</x> - <y>166</y> + <y>154</y> </Line1> <Line2 type="SimpleText" name="Line 2" id="DeliveryAddress2"> <FontSize>12</FontSize> <x>448</x> - <y>178</y> + <y>166</y> </Line2> <Line3 type="SimpleText" name="Line 3" id="DeliveryAddress3"> <FontSize>12</FontSize> <x>448</x> - <y>190</y> + <y>178</y> </Line3> <Line4 type="SimpleText" name="Line 4" id="DeliveryAddress4"> <FontSize>12</FontSize> <x>448</x> - <y>202</y> + <y>190</y> </Line4> <Line5 type="SimpleText" name="Line 5" id="DeliveryAddress5"> <FontSize>12</FontSize> <x>448</x> - <y>214</y> + <y>202</y> </Line5> <Line6 type="SimpleText" name="Line 6" id="DeliveryAddress6"> <FontSize>12</FontSize> <x>448</x> - <y>226</y> + <y>214</y> </Line6> </DeliveryAddress> <DeliveryAddressBox type="CurvedRectangle" name="Delivery address box" id="DeliveryAddressBox"> @@ -122,44 +122,44 @@ <SupplierName type="SimpleText" name="Supplier name" id="SupplierName"> <FontSize>12</FontSize> <x>41</x> - <y>246</y> + <y>226</y> </SupplierName> <SupplierAddress type="ElementArray" name="Supplier address"> <Line1 type="SimpleText" name="Line 1" id="SupplierAddress1"> <FontSize>12</FontSize> <x>71</x> - <y>262</y> + <y>238</y> </Line1> <Line2 type="SimpleText" name="Line 2" id="SupplierAddress2"> <FontSize>12</FontSize> <x>71</x> - <y>274</y> + <y>250</y> </Line2> <Line3 type="SimpleText" name="Line 3" id="SupplierAddress3"> <FontSize>12</FontSize> <x>71</x> - <y>286</y> + <y>262</y> </Line3> <Line4 type="SimpleText" name="Line 4" id="SupplierAddress4"> <FontSize>12</FontSize> <x>71</x> - <y>298</y> + <y>274</y> </Line4> </SupplierAddress> <OrderDate type="SimpleText" name="Order date" id="OrderDate"> <FontSize>12</FontSize> <x>446</x> - <y>262</y> + <y>250</y> </OrderDate> <Initiator type="SimpleText" name="Order initiator" id="Initiator"> <FontSize>12</FontSize> <x>446</x> - <y>278</y> + <y>264</y> </Initiator> <PaymentTerms type="SimpleText" name="Payment terms" id="PaymentTerms"> <FontSize>12</FontSize> <x>446</x> - <y>290</y> + <y>278</y> </PaymentTerms> <Comments type="MultiLineText" name="Comments" id="Comments"> <FontSize>12</FontSize> @@ -170,7 +170,7 @@ <Currency type="SimpleText" name="Currency text" id="Currency"> <FontSize>12</FontSize> <x>40</x> - <y>312</y> + <y>300</y> </Currency> <HeaderRectangle type="Rectangle" name="Header rectangle" id="HeaderRectangle"> <x>40</x> Modified: trunk/doc/Change.log.html =================================================================== --- trunk/doc/Change.log.html 2010-06-07 01:06:13 UTC (rev 3483) +++ trunk/doc/Change.log.html 2010-06-07 19:58:17 UTC (rev 3484) @@ -1,5 +1,6 @@ <p><font SIZE=4 COLOR=BLUE><b>webERP Change Log</b></font></p> <p></p> +<p>07/06/10 Tim: Various changes to correctly deal with suppliers uom plus layout changes to puirchase orders and goods received notes</p> <p>06/06/10 Zhiguo Yuan: WorkOrderReceive.php - Change to make rollup costs change when more labour or overheadcosts change</p> <p>03/06/10 Phil: Added a bit of error trapping to ensure customer/branch set up when going into CounterSales.php</p> <p>03/06/10 Otandeka: Locations.php used explode function rather than substr function to split the cashsalecustomer to get Branch and Debtorno codes - also changed format to just a hypen between debtorno and branchcode</p> Modified: trunk/includes/DefinePOClass.php =================================================================== --- trunk/includes/DefinePOClass.php 2010-06-07 01:06:13 UTC (rev 3483) +++ trunk/includes/DefinePOClass.php 2010-06-07 19:58:17 UTC (rev 3484) @@ -68,7 +68,7 @@ var $paymentterms; var $contact; var $port; - + function PurchOrder(){ /*Constructor function initialises a new purchase order object */ $this->LineItems = array(); @@ -96,6 +96,7 @@ $DecimalPlaces=2, $itemno, $uom, + $leadtime, $suppliers_partno, $subtotal_amount, $package, @@ -119,14 +120,15 @@ $GLCode, $ReqDelDate, $ShiptRef, + 0, $JobRef, - 0, $QtyInv, $QtyRecd, $GLActName, $DecimalPlaces, $itemno, $uom, + $leadtime, $suppliers_partno, $subtotal_amount, $package, @@ -171,7 +173,7 @@ $this->LineItems[$LineNo]->ReqDelDate = $ReqDelDate; $this->LineItems[$LineNo]->ShiptRef = $ShiptRef; $this->LineItems[$LineNo]->JobRef = $JobRef; - $this->LineItems[$LineNo]->itemno = $itemno; + $this->LineItems[$LineNo]->itemno = $itemno; $this->LineItems[$LineNo]->uom = $uom; $this->LineItems[$LineNo]->suppliers_partno = $suppliers_partno; $this->LineItems[$LineNo]->subtotal_amount = $subtotal_amount; @@ -211,7 +213,7 @@ } return 0; } - + function Order_Value() { $TotalValue=0; foreach ($this->LineItems as $OrderedItems) { @@ -245,6 +247,7 @@ Var $suppliers_partno; Var $subtotal_amount; Var $leadtime; + Var $package; Var $pcunit; Var $nw; Var $gw; @@ -258,35 +261,35 @@ Var $SerialItems; /*An array holding the batch/serial numbers and quantities in each batch*/ function LineDetails ( - $LineNo, - $StockItem, - $Serialised, - $Controlled, - $Qty, - $ItemDescr, - $Prc, - $UOM, - $GLCode, - $ReqDelDate, - $ShiptRef =0, + $LineNo, + $StockItem, + $Serialised, + $Controlled, + $Qty, + $ItemDescr, + $Prc, + $UOM, + $GLCode, + $ReqDelDate, + $ShiptRef =0, $Completed, - $JobRef, - $QtyInv, - $QtyRecd, - $GLActName, + $JobRef, + $QtyInv, + $QtyRecd, + $GLActName, $DecimalPlaces, $itemno, $uom, $suppliers_partno, $subtotal_amount, $leadtime, + $package, $pcunit, $nw, $gw, $cuft, $total_quantity, $total_amount) - { /* Constructor function to add a new LineDetail object with passed params */ @@ -305,7 +308,7 @@ $this->GLCode = $GLCode; $this->JobRef = $JobRef; $this->itemno = $itemno; - $this->uom = $uom; + $this->uom = $uom; $this->suppliers_partno = $suppliers_partno; $this->subtotal_amount = $subtotal_amount; $this->leadtime = $leadtime; Modified: trunk/includes/PDFGrnHeader.inc =================================================================== --- trunk/includes/PDFGrnHeader.inc 2010-06-07 01:06:13 UTC (rev 3483) +++ trunk/includes/PDFGrnHeader.inc 2010-06-07 19:58:17 UTC (rev 3484) @@ -5,8 +5,32 @@ $pdf->newPage(); } +$sql='SELECT suppliers.supplierid, + suppname, + address1, + address2 , + address3, + address4, + address5, + address6 + FROM suppliers + LEFT JOIN grns + ON grns.supplierid=suppliers.supplierid + WHERE grnbatch="'.$GRNNo.'"'; +$supplierresult=DB_query($sql, $db); +$supplierrow=DB_fetch_array($supplierresult); + $pdf->addJpegFromFile($_SESSION['LogoFile'] ,$FormDesign->logo->x,$Page_Height-$FormDesign->logo->y,$FormDesign->logo->width,$FormDesign->logo->height); +$LeftOvers = $pdf->addText($FormDesign->SupplierName->x,$Page_Height-$FormDesign->SupplierName->y,$FormDesign->SupplierName->FontSize,$supplierrow['suppname']); +$LeftOvers = $pdf->addText($FormDesign->SupplierAddress1->x,$Page_Height-$FormDesign->SupplierAddress1->y,$FormDesign->SupplierAddress1->FontSize,$supplierrow['address1']); +$LeftOvers = $pdf->addText($FormDesign->SupplierAddress2->x,$Page_Height-$FormDesign->SupplierAddress2->y,$FormDesign->SupplierAddress2->FontSize,$supplierrow['address2']); +$LeftOvers = $pdf->addText($FormDesign->SupplierAddress3->x,$Page_Height-$FormDesign->SupplierAddress3->y,$FormDesign->SupplierAddress3->FontSize,$supplierrow['address3']); +$LeftOvers = $pdf->addText($FormDesign->SupplierAddress4->x,$Page_Height-$FormDesign->SupplierAddress4->y,$FormDesign->SupplierAddress4->FontSize,$supplierrow['address4']); +$LeftOvers = $pdf->addText($FormDesign->SupplierAddress5->x,$Page_Height-$FormDesign->SupplierAddress5->y,$FormDesign->SupplierAddress5->FontSize,$supplierrow['address5']); +$LeftOvers = $pdf->addText($FormDesign->SupplierAddress6->x,$Page_Height-$FormDesign->SupplierAddress6->y,$FormDesign->SupplierAddress6->FontSize,$supplierrow['address6']); + + $LeftOvers = $pdf->addText($FormDesign->CompanyName->x,$Page_Height-$FormDesign->CompanyName->y,$FormDesign->CompanyName->FontSize,$_SESSION['CompanyRecord']['coyname']); $LeftOvers = $pdf->addText($FormDesign->GRNNumber->x,$Page_Height-$FormDesign->GRNNumber->y,$FormDesign->GRNNumber->FontSize, _('GRN number ').' ' . $GRNNo ); $LeftOvers = $pdf->addText($FormDesign->OrderNumber->x,$Page_Height-$FormDesign->OrderNumber->y,$FormDesign->OrderNumber->FontSize, _('PO number ').' ' . $_GET['PONo'] ); @@ -19,11 +43,18 @@ $LeftOvers = $pdf->addText($FormDesign->Headings->Column1->x,$Page_Height - $FormDesign->Headings->Column1->y, $FormDesign->Headings->Column1->FontSize, _('Item Number')); $LeftOvers = $pdf->addText($FormDesign->Headings->Column2->x,$Page_Height - $FormDesign->Headings->Column2->y, $FormDesign->Headings->Column2->FontSize, _('Description')); $LeftOvers = $pdf->addText($FormDesign->Headings->Column3->x,$Page_Height - $FormDesign->Headings->Column3->y, $FormDesign->Headings->Column3->FontSize, _('Date Recd')); -$LeftOvers = $pdf->addText($FormDesign->Headings->Column4->x,$Page_Height - $FormDesign->Headings->Column4->y, $FormDesign->Headings->Column4->FontSize, _('Supplier')); -$LeftOvers = $pdf->addText($FormDesign->Headings->Column5->x,$Page_Height - $FormDesign->Headings->Column5->y, $FormDesign->Headings->Column5->FontSize, _('Quantity')); +$LeftOvers = $pdf->addTextWrap($FormDesign->Headings->Column4->x,$Page_Height - $FormDesign->Headings->Column4->y, $FormDesign->Headings->Column4->Length, $FormDesign->Headings->Column4->FontSize, _('Supplier Details'), 'right'); +$LeftOvers = $pdf->addTextWrap($FormDesign->Headings->Column5->x,$Page_Height - $FormDesign->Headings->Column5->y, $FormDesign->Headings->Column5->Length, $FormDesign->Headings->Column5->FontSize, _('Stock Details'), 'right'); /*Draw a rectangle to put the data in */ $pdf->Rectangle($FormDesign->DataRectangle->x, $Page_Height - $FormDesign->DataRectangle->y, $FormDesign->DataRectangle->width,$FormDesign->DataRectangle->height); +$pdf->Line($FormDesign->LineAboveFooter->startx, $Page_Height - $FormDesign->LineAboveFooter->starty, $FormDesign->LineAboveFooter->endx,$Page_Height - $FormDesign->LineAboveFooter->endy); + +$pdf->Line($FormDesign->Column1->startx, $Page_Height - $FormDesign->Column1->starty, $FormDesign->Column1->endx,$Page_Height - $FormDesign->Column1->endy); +$pdf->Line($FormDesign->Column3->startx, $Page_Height - $FormDesign->Column3->starty, $FormDesign->Column3->endx,$Page_Height - $FormDesign->Column3->endy); +$pdf->Line($FormDesign->Column4->startx, $Page_Height - $FormDesign->Column4->starty, $FormDesign->Column4->endx,$Page_Height - $FormDesign->Column4->endy); +$pdf->Line($FormDesign->Column5->startx, $Page_Height - $FormDesign->Column5->starty, $FormDesign->Column5->endx,$Page_Height - $FormDesign->Column5->endy); + $PageNumber++; ?> \ No newline at end of file Modified: trunk/includes/PO_ReadInOrder.inc =================================================================== --- trunk/includes/PO_ReadInOrder.inc 2010-06-07 01:06:13 UTC (rev 3483) +++ trunk/includes/PO_ReadInOrder.inc 2010-06-07 19:58:17 UTC (rev 3484) @@ -145,8 +145,6 @@ stockmaster.controlled, stockmaster.serialised, stockmaster.decimalplaces, - purchdata.suppliersuom, - purchdata.suppliers_partno, subtotal_amount, package, pcunit, @@ -154,8 +152,7 @@ gw, cuft, total_quantity, - total_amount, - MAX(purchdata.effectivefrom) + total_amount FROM purchorderdetails LEFT JOIN stockmaster ON purchorderdetails.itemcode=stockmaster.stockid @@ -163,8 +160,6 @@ 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 WHERE purchorderdetails.completed=0 AND purchorderdetails.orderno =" . $_GET['ModifyOrderNumber'] . ' ORDER BY podetailitem'; @@ -182,16 +177,39 @@ } else { $GLCode = $myrow['glcode']; } - if (is_null($myrow['units'])){ + if (is_null($myrow['units'])){ $Units = _('each'); - } else { + } else { $Units = $myrow['units']; - } - if (is_null($myrow['itemcode'])){ + } + if (is_null($myrow['itemcode'])){ $StockID = ''; - } else { + } else { $StockID = $myrow['itemcode']; - } + } + $datesql='SELECT max(effectivefrom) + FROM purchdata + WHERE supplierno="'.$_SESSION['PO'.$identifier]->SupplierID.'" + AND stockid="'.$StockID.'" + AND effectivefrom<="'.$_SESSION['PO'.$identifier]->Orig_OrderDate.'"'; + $dateresult=DB_query($datesql, $db); + $date=DB_fetch_row($dateresult); + if ($date[0]!='') { + $sql='SELECT unitsofmeasure.unitname, + suppliers_partno + FROM purchdata + LEFT JOIN unitsofmeasure + ON purchdata.suppliersuom=unitsofmeasure.unitid + WHERE supplierno="'.$_SESSION['PO'.$identifier]->SupplierID.'" + AND stockid="'.$StockID.'" + AND effectivefrom="'.$date[0].'"'; + $purchdataresult=DB_query($sql, $db); + $myrow2=DB_fetch_array($purchdataresult); + } else { + $sql='SELECT units as unitname, stockid as suppliers_partno FROM stockmaster WHERE stockid="'.$StockID.'"'; + $purchdataresult=DB_query($sql, $db); + $myrow2=DB_fetch_array($purchdataresult); + } $_SESSION['PO'.$identifier]->add_to_order($_SESSION['PO'.$identifier]->LinesOnOrder+1, $StockID, @@ -211,9 +229,10 @@ $myrow['accountname'], $myrow['decimalplaces'], $myrow['itemno'], - $myrow['suppliersuom'], - $myrow['suppliers_partno'], + $myrow2['unitname'], + $myrow2['suppliers_partno'], $myrow['subtotal_amount'], + 0, $myrow['package'], $myrow['pcunit'], $myrow['nw'], This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |