|
From: <dai...@us...> - 2011-01-30 05:16:10
|
Revision: 4479
http://web-erp.svn.sourceforge.net/web-erp/?rev=4479&view=rev
Author: daintree
Date: 2011-01-30 05:16:03 +0000 (Sun, 30 Jan 2011)
Log Message:
-----------
Purch order stuff goods received etc
Modified Paths:
--------------
trunk/GoodsReceived.php
trunk/PDFGrn.php
trunk/PO_PDFPurchOrder.php
trunk/doc/Change.log.html
trunk/includes/DefinePOClass.php
Modified: trunk/GoodsReceived.php
===================================================================
--- trunk/GoodsReceived.php 2011-01-30 03:56:30 UTC (rev 4478)
+++ trunk/GoodsReceived.php 2011-01-30 05:16:03 UTC (rev 4479)
@@ -81,12 +81,21 @@
'"></td></tr></table><br>';
echo '<table cellpadding=2 class=selection>
+ <tr><th colspan="2"></th>
+ <th align="centre" colspan="3"><b>' . _('Supplier Units') . '</b></th>
+ <th></th>
+ <th align="centre" colspan="5"><b>' . _('Our Units') . '</b></th>
+ </tr>
<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>';
+ <th>' . _('Already') . '<br />' . _('Received') . '</th>
+ <th>' . _('Conversion') . '<br />' . _('Factor') . '</th>
+ <th>' . _('Quantity') . '<br>' . _('Ordered') . '</th>
+ <th>' . _('Units') . '</th>
+ <th>' . _('Already') . '<br />' . _('Received') . '</th>
+ <th>' . _('This Delivery') . '<br />' . _('Quantity') . '</th>';
if ($_SESSION['ShowValueOnGRN']==1) {
echo '<th>' . _('Price') . '</th><th>' . _('Total Value') . '<br>' . _('Received') . '</th>';
@@ -125,41 +134,23 @@
$LineTotal = ($LnItm->ReceiveQty * $LnItm->Price );
$_SESSION['PO'.$identifier]->Total = $_SESSION['PO'.$identifier]->Total + $LineTotal;
+ $DisplaySupplierQtyOrd = number_format($LnItm->Quantity/$LnItm->ConversionFactor,$LnItm->DecimalPlaces);
+ $DisplaySupplierQtyRec = number_format($LnItm->QtyReceived/$LnItm->ConversionFactor,$LnItm->DecimalPlaces);
$DisplayQtyOrd = number_format($LnItm->Quantity,$LnItm->DecimalPlaces);
$DisplayQtyRec = number_format($LnItm->QtyReceived,$LnItm->DecimalPlaces);
$DisplayLineTotal = number_format($LineTotal,2);
$DisplayPrice = number_format($LnItm->Price,2);
- $SupplierUomSQL="SELECT unitsofmeasure.unitname,
- conversionfactor,
- suppliersuom,
- max(effectivefrom)
- FROM purchdata
- LEFT JOIN unitsofmeasure
- ON purchdata.suppliersuom=unitsofmeasure.unitid
- WHERE supplierno='".$_SESSION['PO'.$identifier]->SupplierID."'
- AND stockid='".$LnItm->StockID."'
- GROUP BY unitsofmeasure.unitname";
- $SupplierUOMResult=DB_query($SupplierUomSQL, $db);
- if (DB_num_rows($SupplierUOMResult)>0) {
- $SupplierUOMRow=DB_fetch_array($SupplierUOMResult);
- if (strlen($SupplierUOMRow['unitname'])>0) {
- $Uom=$SupplierUOMRow['unitname'];
- } else {
- $Uom=$LnItm->Units;
- }
- $ConversionFactor=$SupplierUOMRow['conversionfactor'];
- } else { //using our units throughout
- $Uom=$LnItm->Units;
- $ConversionFactor=1;
- }
-
//Now Display LineItem
echo '<td>' . $LnItm->StockID . '</td>';
echo '<td>' . $LnItm->ItemDescription . '</td>';
+ echo '<td class=number>' . $DisplaySupplierQtyOrd . '</td>';
+ echo '<td>' . $LnItm->SuppliersUnit . '</td>';
+ echo '<td class=number>' . $DisplaySupplierQtyRec . '</td>';
+ echo '<td class=number>' . $LnItm->ConversionFactor . '</td>';
echo '<td class=number>' . $DisplayQtyOrd . '</td>';
- echo '<td>' . $LnItm->uom . '</td>';
+ echo '<td>' . $LnItm->Units . '</td>';
echo '<td class=number>' . $DisplayQtyRec . '</td>';
echo '<td class=number>';
@@ -191,7 +182,7 @@
echo "<script>defaultControl(document.forms[0].RecvQty_$LnItm->LineNo);</script>";
$DisplayTotal = number_format($_SESSION['PO'.$identifier]->Total,2);
if ($_SESSION['ShowValueOnGRN']==1) {
- echo '<tr><td colspan=7 class=number><b>' . _('Total value of goods received'). '</b></td>
+ echo '<tr><td colspan="11" class=number><b>' . _('Total value of goods received'). '</b></td>
<td class=number><b>'. $DisplayTotal. '</b></td>
</tr></table>';
} else {
@@ -675,7 +666,7 @@
if ($_SESSION['PO'.$identifier]->AllLinesReceived()==1) { //all lines on the purchase order are now completed
- $StatusComment=date($_SESSION['DefaultDateFormat']) .' - ' . _('Order Completed') .'<br />' . $_SESSION['PO'.$identifier]->StatusComment;
+ $StatusComment=date($_SESSION['DefaultDateFormat']) .' - ' . _('Order Completed') .'<br />' . $_SESSION['PO'.$identifier]->StatusComments;
$sql="UPDATE purchorders
SET status='Completed',
stat_comment='" . $StatusComment . "'
Modified: trunk/PDFGrn.php
===================================================================
--- trunk/PDFGrn.php 2011-01-30 03:56:30 UTC (rev 4478)
+++ trunk/PDFGrn.php 2011-01-30 05:16:03 UTC (rev 4479)
@@ -2,14 +2,11 @@
/* $Id$*/
-/* $Revision: 1.5 $ */
-
-//$PageSecurity = 2;
+//$PageSecurity = 2; Now comes from DB - read in from session
include('includes/session.inc');
+include('includes/DefinePOClass.php');
-if (isset($_POST['GRNNo'])) {
- $GRNNo=$_POST['GRNNo'];
-} else if (isset($_GET['GRNNo'])) {
+if (isset($_GET['GRNNo'])) {
$GRNNo=$_GET['GRNNo'];
} else {
$GRNNo='';
@@ -29,105 +26,62 @@
$pdf->addInfo('Title', _('Goods Received Note') );
if ($GRNNo=='Preview') {
- $ListCount = 1; // UldisN
+ $ListCount = 1;
} else {
$sql="SELECT grns.itemcode,
grns.grnno,
grns.deliverydate,
grns.itemdescription,
grns.qtyrecd,
- grns.supplierid
+ grns.supplierid,
+ grns.podetailitem
FROM grns
WHERE grnbatch='".$GRNNo."'";
- $result=DB_query($sql, $db);
- $ListCount = DB_num_rows($result); // UldisN
-
- include('includes/PDFGrnHeader.inc');
+ $GRNResult=DB_query($sql, $db);
+ $NoOfGRNs = DB_num_rows($GRNResult);
+ if ($NoOfGRNs>0){
+ $_GET['ModifyOrderNumber'] = (int)$_GET['PONo'];
+ $identifier=date('U');
+ include('includes/PO_ReadInOrder.inc'); //Read the PO in
+ include('includes/PDFGrnHeader.inc');
+ }
}
-$counter=1;
+$i=1;
$YPos=$FormDesign->Data->y;
-while ($counter<=$ListCount) {
+while ($i<=$NoOfGRNs) {
if ($GRNNo=='Preview') {
$StockID=str_pad('',10,'x');
$Date='1/1/1900';
$Description=str_pad('',30,'x');
- $Quantity='XXXXX.XX';
+ $SuppliersQuantity='XXXXX.XX';
+ $OurUnitsQuantity='XXXXX.XX';
$Supplier=str_pad('',25,'x');
+ $Units = str_pad('',10,'x');
+ $SupplierUnits =str_pad('',10,'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='".$myrow['itemcode']."'";
- $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'];
- $myrow2['conversionfactor']=1;
- } 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."'";
- $supplierresult=DB_query($sql, $db);
- $suppliermyrow=DB_fetch_array($supplierresult);
- $Supplier=$suppliermyrow[0];
+ $myrow = DB_fetch_array($GRNResult);
+ $LineNo = $_SESSION['PO'.$identifier]->GetLineNoFromPODetailItem($myrow['podetailitem']);
+ echo '<br />The podetailitem is ' . $myrow['podetailitem'] . '<br />Got the line number it is: ' . $LineNo;
+ $StockID=$myrow['itemcode'];
+ $GRNNo=$myrow['grnno'];
+ $Date=ConvertSQLDate($myrow['deliverydate']);
+ $Description=$myrow['itemdescription'];
+ $SuppliersQuantity=number_format($myrow['qtyrecd']/$_SESSION['PO' . $identifier]->LineItems[$LineNo]->ConversionFactor,$_SESSION['PO' . $identifier]->LineItems[$LineNo]->DecimalPlaces);
+ $OurUnitsQuantity=number_format($myrow['qtyrecd'],$_SESSION['PO' . $identifier]->LineItems[$LineNo]->DecimalPlaces);
+ $SupplierID=$myrow['supplierid'];
+ $Units = $_SESSION['PO' . $identifier]->LineItems[$LineNo]->Units;
+ $SuppliersUnit = $_SESSION['PO' . $identifier]->LineItems[$LineNo]->SuppliersUnit;
+ $Supplier = $_SESSION['PO' . $identifier]->SupplierName;
}
-
$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, 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');
+ $LeftOvers = $pdf->addTextWrap($FormDesign->Data->Column4->x,$Page_Height-$YPos,$FormDesign->Data->Column4->Length,$FormDesign->Data->Column4->FontSize, $SuppliersQuantity, 'right');
+ $LeftOvers = $pdf->addTextWrap($FormDesign->Data->Column5->x,$Page_Height-$YPos,$FormDesign->Data->Column5->Length,$FormDesign->Data->Column5->FontSize, $SuppliersUnit, 'left');
+ $LeftOvers = $pdf->addTextWrap($FormDesign->Data->Column6->x,$Page_Height-$YPos,$FormDesign->Data->Column6->Length,$FormDesign->Data->Column6->FontSize, $OurUnitsQuantity, 'right');
+ $LeftOvers = $pdf->addTextWrap($FormDesign->Data->Column7->x,$Page_Height-$YPos,$FormDesign->Data->Column7->Length,$FormDesign->Data->Column7->FontSize, $Units, 'left');
$YPos += $line_height;
- $counter++;
+ $i++;
if ($YPos >= $FormDesign->LineAboveFooter->starty){
/* We reached the end of the page so finsih off the page and start a newy */
$PageNumber++;
@@ -140,10 +94,10 @@
$LeftOvers = $pdf->addText($FormDesign->SignedFor->x,$Page_Height-$FormDesign->SignedFor->y,$FormDesign->SignedFor->FontSize, _('Signed for ').'______________________');
-if ($ListCount == 0) { //UldisN
+if ($NoOfGRNs == 0) {
$title = _('GRN Error');
include('includes/header.inc');
- prnMsg(_('There were no GRN to print'),'warn');
+ prnMsg(_('There were no GRNs to print'),'warn');
echo '<br><a href="'.$rootpath.'/index.php?' . SID . '">'. _('Back to the menu').'</a>';
include('includes/footer.inc');
exit;
Modified: trunk/PO_PDFPurchOrder.php
===================================================================
--- trunk/PO_PDFPurchOrder.php 2011-01-30 03:56:30 UTC (rev 4478)
+++ trunk/PO_PDFPurchOrder.php 2011-01-30 05:16:03 UTC (rev 4479)
@@ -37,11 +37,13 @@
}
$title = _('Print Purchase Order Number').' '. $OrderNo;
-if ($_POST['PrintOrEmail']=='Email' AND ! IsEmailAddress($_POST['EmailTo'])){
- include('includes/header.inc');
- prnMsg( _('The email address entered does not appear to be valid. No emails have been sent.'),'warn');
- include('includes/footer.inc');
- exit;
+if (isset($_POST['PrintOrEmail']) ){
+ if ($_POST['PrintOrEmail'] =='Email' AND ! IsEmailAddress($_POST['EmailTo'])){
+ include('includes/header.inc');
+ prnMsg( _('The email address entered does not appear to be valid. No emails have been sent.'),'warn');
+ include('includes/footer.inc');
+ exit;
+ }
}
$ViewingOnly = 0;
if (isset($_GET['ViewingOnly']) AND $_GET['ViewingOnly']!='') {
Modified: trunk/doc/Change.log.html
===================================================================
--- trunk/doc/Change.log.html 2011-01-30 03:56:30 UTC (rev 4478)
+++ trunk/doc/Change.log.html 2011-01-30 05:16:03 UTC (rev 4479)
@@ -1,5 +1,7 @@
<p>/<font SIZE=4 COLOR=BLUE><b>webERP Change Log</b></font></p
<p></p>
+<p>30/1/11: Phil GoodsReceived.php rework for supplier units and conversion factor etc now in PO class</p>
+<p>30/1/11: Phil PDFGrn.php rework for supplier units and conversion factor etc now in PO class</p>
<p>30/1/11:Exson changed PDFLowGP report remove % from gettext string</p>
<p>29/1/11:Tim fix reportwriter with tcpdf using parent::__construct rather than $this->Cpdf( </p>
<p>24/1/11:Phil Depreciation fixes - SelectAsset by description fix</p>
Modified: trunk/includes/DefinePOClass.php
===================================================================
--- trunk/includes/DefinePOClass.php 2011-01-30 03:56:30 UTC (rev 4478)
+++ trunk/includes/DefinePOClass.php 2011-01-30 05:16:03 UTC (rev 4479)
@@ -226,6 +226,15 @@
return 0; //nowt received
}
+ function GetLineNoFromPODetailItem($PODetailItem){
+ foreach ($this->LineItems as $OrderedItems) {
+ if ($OrderedItems->PODetailRec ==$PODetailItem){
+ return $OrderedItems->LineNo;
+ }
+ }
+ return false; //PODetailItem not on the order
+ }
+
} /* end of class defintion */
Class LineDetails {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|