From: <dai...@us...> - 2011-03-03 09:13:19
|
Revision: 4501 http://web-erp.svn.sourceforge.net/web-erp/?rev=4501&view=rev Author: daintree Date: 2011-03-03 09:13:12 +0000 (Thu, 03 Mar 2011) Log Message: ----------- Tim launchpad revisions to 4441 excluding price units stuff Modified Paths: -------------- trunk/ConfirmDispatchControlled_Invoice.php trunk/ConfirmDispatch_Invoice.php trunk/DeliveryDetails.php trunk/GoodsReceived.php trunk/GoodsReceivedControlled.php trunk/SelectCompletedOrder.php trunk/SelectCustomer.php trunk/SelectSupplier.php trunk/StockCheck.php trunk/StockSerialItems.php trunk/SupplierCredit.php trunk/Suppliers.php trunk/doc/Change.log.html trunk/includes/Add_SerialItems.php trunk/includes/Add_SerialItemsOut.php trunk/includes/DefineSerialItems.php trunk/includes/InputSerialItems.php trunk/includes/InputSerialItemsKeyed.php trunk/includes/PDFStockCheckPageHeader.inc Modified: trunk/ConfirmDispatchControlled_Invoice.php =================================================================== --- trunk/ConfirmDispatchControlled_Invoice.php 2011-02-27 09:18:42 UTC (rev 4500) +++ trunk/ConfirmDispatchControlled_Invoice.php 2011-03-03 09:13:12 UTC (rev 4501) @@ -66,7 +66,7 @@ $InOutModifier=1; $ShowExisting=false; -include ('includes/InputSerialItems.php'); +include ('includes/OutputSerialItems.php'); /*TotalQuantity set inside this include file from the sum of the bundles of the item selected for dispatch */ Modified: trunk/ConfirmDispatch_Invoice.php =================================================================== --- trunk/ConfirmDispatch_Invoice.php 2011-02-27 09:18:42 UTC (rev 4500) +++ trunk/ConfirmDispatch_Invoice.php 2011-03-03 09:13:12 UTC (rev 4501) @@ -219,18 +219,24 @@ } foreach ($_SESSION['Items']->LineItems as $Itm) { - if (is_numeric($_POST[$Itm->LineNumber . '_QtyDispatched' ])AND $_POST[$Itm->LineNumber . '_QtyDispatched'] <= ($_SESSION['Items']->LineItems[$Itm->LineNumber]->Quantity - $_SESSION['Items']->LineItems[$Itm->LineNumber]->QtyInv)){ + if (sizeOf($Itm->SerialItems) > 0) { + $_SESSION['Items']->LineItems[$Itm->LineNumber]->QtyDispatched = 0; //initialise QtyDispatched + foreach ($Itm->SerialItems as $SerialItem) { //calculate QtyDispatched from bundle quantities + $_SESSION['Items']->LineItems[$Itm->LineNumber]->QtyDispatched += $SerialItem->BundleQty; + } + } else if (is_numeric($_POST[$Itm->LineNumber . '_QtyDispatched' ])AND $_POST[$Itm->LineNumber . '_QtyDispatched'] <= ($_SESSION['Items']->LineItems[$Itm->LineNumber]->Quantity - $_SESSION['Items']->LineItems[$Itm->LineNumber]->QtyInv)){ $_SESSION['Items']->LineItems[$Itm->LineNumber]->QtyDispatched = $_POST[$Itm->LineNumber . '_QtyDispatched']; } + + foreach ($Itm->Taxes as $TaxLine) { if (isset($_POST[$Itm->LineNumber . $TaxLine->TaxCalculationOrder . '_TaxRate'])){ $_SESSION['Items']->LineItems[$Itm->LineNumber]->Taxes[$TaxLine->TaxCalculationOrder]->TaxRate = $_POST[$Itm->LineNumber . $TaxLine->TaxCalculationOrder . '_TaxRate']/100; } } + } //end foreach lineitem - } - } /* Always display dispatch quantities and recalc freight for items being dispatched */ @@ -382,15 +388,15 @@ echo '<td class="number">'.$DisplayTaxAmount.'</td><td class="number">'.$DisplayGrossLineTotal.'</td>'; if ($LnItm->Controlled==1){ - - echo '<td><a href="' . $rootpath . '/ConfirmDispatchControlled_Invoice.php?' . SID . '&LineNo='. $LnItm->LineNumber.'">'; - - if ($LnItm->Serialised==1){ - echo _("Enter Serial Numbers"); - } else { /*Just batch/roll/lot control */ - echo _('Enter Batch/Roll/Lot #'); + if (!isset($_POST['ProcessInvoice'])) { + echo '<td><a href="' . $rootpath . '/ConfirmDispatchControlled_Invoice.php?' . SID . '&LineNo='. $LnItm->LineNumber.'">'; + if ($LnItm->Serialised==1){ + echo _('Enter Serial Numbers'); + } else { /*Just batch/roll/lot control */ + echo _('Enter Batch/Roll/Lot #'); + } + echo '</a></td>'; } - echo '</a></td>'; } echo '</tr>'; if (strlen($LnItm->Narrative)>1){ @@ -717,7 +723,7 @@ /*Start an SQL transaction */ -DB_Txn_Begin($db); + DB_Txn_Begin($db); if ($DefaultShipVia != $_SESSION['Items']->ShipVia){ $SQL = "UPDATE custbranch Modified: trunk/DeliveryDetails.php =================================================================== --- trunk/DeliveryDetails.php 2011-02-27 09:18:42 UTC (rev 4500) +++ trunk/DeliveryDetails.php 2011-03-03 09:13:12 UTC (rev 4501) @@ -580,8 +580,8 @@ } else { /*link to print the quotation */ - echo '<br><table class=selection><tr><td><img src="'.$rootpath.'/css/'.$theme.'/images/reports.png" title="' . _('Order') . '" alt=""></td><td>' . ' ' . '<a href="' . $rootpath . '/PDFQuotation.php?identifier='.$identifier . '&QuotationNo=' . $OrderNo . '">'. _('Print Quotation') .'</a></td></tr></table>'; - + echo '<br><table class=selection><tr><td><img src="'.$rootpath.'/css/'.$theme.'/images/reports.png" title="' . _('Order') . '" alt=""></td><td>' . ' ' . '<a href="' . $rootpath . '/PDFQuotation.php?' . SID .'identifier='.$identifier . '&QuotationNo=' . $OrderNo . '">'. _('Print Quotation (Landscape)') .'</a></td></tr></table>'; + echo '<br><table class=selection><tr><td><img src="'.$rootpath.'/css/'.$theme.'/images/reports.png" title="' . _('Order') . '" alt=""></td><td>' . ' ' . '<a href="' . $rootpath . '/PDFQuotationPortrait.php?' . SID .'identifier='.$identifier . '&QuotationNo=' . $OrderNo . '">'. _('Print Quotation (Portrait)') .'</a></td></tr></table>'; } echo '<br><table class=selection><tr><td><img src="'.$rootpath.'/css/'.$theme.'/images/sales.png" title="' . _('Order') . '" alt=""></td><td>' . ' ' . '<a href="'. $rootpath .'/SelectOrderItems.php?identifier='.$identifier . '&NewOrder=Yes">'. _('Add Another Sales Order') .'</a></td></tr></table>'; } else { Modified: trunk/GoodsReceived.php =================================================================== --- trunk/GoodsReceived.php 2011-02-27 09:18:42 UTC (rev 4500) +++ trunk/GoodsReceived.php 2011-03-03 09:13:12 UTC (rev 4501) @@ -516,11 +516,13 @@ loccode, serialno, qualitytext, + expirationdate, quantity) VALUES ('" . $OrderLine->StockID . "', '" . $_SESSION['PO'.$identifier]->Location . "', '" . $Item->BundleRef . "', '', + '" . FormatDateForSQL($Item->ExpiryDate) . "', '" . $Item->BundleQty . "')"; } Modified: trunk/GoodsReceivedControlled.php =================================================================== --- trunk/GoodsReceivedControlled.php 2011-02-27 09:18:42 UTC (rev 4500) +++ trunk/GoodsReceivedControlled.php 2011-03-03 09:13:12 UTC (rev 4501) @@ -4,8 +4,6 @@ include('includes/DefinePOClass.php'); include('includes/DefineSerialItems.php'); -//$PageSecurity = 11; - include('includes/session.inc'); $title = _('Receive Controlled Items'); @@ -32,7 +30,7 @@ exit; } -if (isset($_GET['LineNo'])){ +if (isset($_GET['LineNo']) AND $_GET['LineNo']>0){ $LineNo = $_GET['LineNo']; } elseif (isset($_POST['LineNo'])){ $LineNo = $_POST['LineNo']; Modified: trunk/SelectCompletedOrder.php =================================================================== --- trunk/SelectCompletedOrder.php 2011-02-27 09:18:42 UTC (rev 4500) +++ trunk/SelectCompletedOrder.php 2011-03-03 09:13:12 UTC (rev 4501) @@ -64,8 +64,16 @@ if (isset($OrderNumber)) { echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/sales.png" title="' . _('Sales Order') . '" alt="" />' . ' ' . _('Order Number') . ' - ' . $OrderNumber . '</p>'; + if (strlen($_SESSION['UserBranch'])>1){ + echo _('For customer') . ': ' . $SelectedCustomer; + echo "<input type=hidden name='SelectedCustomer' value='".$SelectedCustomer."'>"; + } } elseif (isset($CustomerRef)) { echo _('Customer Ref') . ' - ' . $CustomerRef; + if (strlen($_SESSION['UserBranch'])>1){ + echo ' ' . _('and for customer') . ': ' . $SelectedCustomer .' ' . _('and') . ' '; + echo "<input type=hidden name='SelectedCustomer' value='".$SelectedCustomer."'>"; + } } else { if (isset($SelectedCustomer)) { echo _('For customer') . ': ' . $SelectedCustomer .' ' . _('and') . ' '; @@ -212,13 +220,42 @@ $SelectedStockItem = $myrow[0]; $_POST['SearchOrders']='True'; unset($StockItemsResult); - echo '<br>' . _('For the part') . ': ' . $SelectedStockItem . ' ' . _('and') . " <input type=hidden name='SelectedStockItem' value='$SelectedStockItem'>"; + echo '<br />' . _('For the part') . ': ' . $SelectedStockItem . ' ' . _('and') . " <input type=hidden name='SelectedStockItem' value='$SelectedStockItem'>"; } } } else if (isset($_POST['SearchOrders']) AND Is_Date($_POST['OrdersAfterDate'])==1) { //figure out the SQL required from the inputs available if (isset($OrderNumber)) { + if (isset($SelectedCustomer)) { + $SQL = "SELECT salesorders.orderno, + debtorsmaster.name, + custbranch.brname, + salesorders.customerref, + salesorders.orddate, + salesorders.deliverydate, + salesorders.deliverto, SUM(salesorderdetails.unitprice*salesorderdetails.quantity*(1-salesorderdetails.discountpercent)) AS ordervalue + FROM salesorders, + salesorderdetails, + debtorsmaster, + custbranch + WHERE salesorders.orderno = salesorderdetails.orderno + AND salesorders.branchcode = custbranch.branchcode + AND salesorders.debtorno = debtorsmaster.debtorno + AND debtorsmaster.debtorno = custbranch.debtorno + AND salesorders.debtorno='" . $SelectedCustomer ."' + AND salesorders.orderno='". $OrderNumber ."' + AND salesorders.quotation=0 + AND salesorderdetails.completed".$completed." + GROUP BY salesorders.orderno, + debtorsmaster.name, + custbranch.brname, + salesorders.customerref, + salesorders.orddate, + salesorders.deliverydate, + salesorders.deliverto + ORDER BY salesorders.orderno"; + } else { //Set order number and SelectedCustomer not set $SQL = "SELECT salesorders.orderno, debtorsmaster.name, custbranch.brname, @@ -245,7 +282,9 @@ salesorders.deliverydate, salesorders.deliverto ORDER BY salesorders.orderno"; + } } elseif (isset($CustomerRef)) { + if (isset($SelectedCustomer)) { $SQL = "SELECT salesorders.orderno, debtorsmaster.name, custbranch.brname, @@ -261,6 +300,7 @@ AND salesorders.branchcode = custbranch.branchcode AND salesorders.debtorno = debtorsmaster.debtorno AND debtorsmaster.debtorno = custbranch.debtorno + AND salesorders.debtorno='" . $SelectedCustomer ."' AND salesorders.customerref like '%". $CustomerRef."%' AND salesorders.quotation=0 AND salesorderdetails.completed".$completed." @@ -272,6 +312,34 @@ salesorders.deliverydate, salesorders.deliverto ORDER BY salesorders.orderno"; + } else { //customer not selected + $SQL = "SELECT salesorders.orderno, + debtorsmaster.name, + custbranch.brname, + salesorders.customerref, + salesorders.orddate, + salesorders.deliverydate, + salesorders.deliverto, SUM(salesorderdetails.unitprice*salesorderdetails.quantity*(1-salesorderdetails.discountpercent)) AS ordervalue + FROM salesorders, + salesorderdetails, + debtorsmaster, + custbranch + WHERE salesorders.orderno = salesorderdetails.orderno + AND salesorders.branchcode = custbranch.branchcode + AND salesorders.debtorno = debtorsmaster.debtorno + AND debtorsmaster.debtorno = custbranch.debtorno + AND salesorders.customerref like '%". $CustomerRef."%' + AND salesorders.quotation=0 + AND salesorderdetails.completed".$completed." + GROUP BY salesorders.orderno, + debtorsmaster.name, + custbranch.brname, + salesorders.customerref, + salesorders.orddate, + salesorders.deliverydate, + salesorders.deliverto + ORDER BY salesorders.orderno"; + } } else { $DateAfterCriteria = FormatDateforSQL($_POST['OrdersAfterDate']); @@ -399,8 +467,8 @@ $SalesOrdersResult = DB_query($SQL,$db); if (DB_error_no($db) !=0) { - echo '<br>' . _('No orders were returned by the SQL because') . ' ' . DB_error_msg($db); - echo "<br>$SQL"; + echo '<br />' . _('No orders were returned by the SQL because') . ' ' . DB_error_msg($db); + echo "<br />$SQL"; } }//end of which button clicked options @@ -416,22 +484,22 @@ echo "<tr><td></td>"; } -if (!isset($OrderNumber) or $OrderNumber==''){ - echo '<td>' . _('Order Number') . ':</td><td>' . "<input type='text' name='OrderNumber' maxlength =8 size=9></td><td>" . _('for all orders placed after') . - ": </td><td><input type='text' class='date' alt='".$_SESSION['DefaultDateFormat']."' name='OrdersAfterDate' maxlength =10 size=11 value=" . $_POST['OrdersAfterDate'] . "></td><td>" . - "<input type='submit' name='SearchOrders' value='" . _('Search Orders') . "'></td></tr>"; - echo '<tr><td></td><td>' . _('Customer Ref') . ':</td><td>' . "<input type='text' name='CustomerRef' maxlength =8 size=9></td> +echo '<td>' . _('Order Number') . ':</td> + <td>' . "<input type='text' name='OrderNumber' maxlength =8 size=9 value ='" . $_POST['OrderNumber'] . "'></td> + <td>" . _('for all orders placed after') . ": </td><td><input type='text' class='date' alt='".$_SESSION['DefaultDateFormat']."' name='OrdersAfterDate' maxlength =10 size=11 value=" . $_POST['OrdersAfterDate'] . "></td> + <td>" . "<input type='submit' name='SearchOrders' value='" . _('Search Orders') . "'></td></tr>"; +echo '<tr><td></td><td>' . _('Customer Ref') . ':</td><td>' . "<input type='text' name='CustomerRef' maxlength =8 size=9></td> <td></td><td colspan=2><input type='checkbox' ".$ShowChecked." name='completed' />"._('Show Completed orders only') . "</td></tr>"; -} + echo '</table>'; if (!isset($SelectedStockItem)) { $SQL='SELECT categoryid, categorydescription FROM stockcategory ORDER BY categorydescription'; $result1 = DB_query($SQL,$db); - echo '<br>'; + echo '<br />'; echo '<div class="page_help_text"><font size=1>' . _('To search for sales orders for a specific part use the part selection facilities below') . ' </font></div>'; - echo '<br><table class=selection>'; + echo '<br /><table class=selection>'; echo '<tr><td><font size=1>' . _('Select a stock category') . ':</font>'; echo '<select name="StockCat">'; @@ -461,7 +529,7 @@ If (isset($StockItemsResult)) { - echo '<br><table cellpadding=2 colspan=7 class=selection>'; + echo '<br /><table cellpadding=2 colspan=7 class=selection>'; $TableHeadings = "<tr><th>" . _('Code') . "</th>" . "<th>" . _('Description') . "</th>" . @@ -511,7 +579,7 @@ /*show a table of the orders returned by the SQL */ - echo '<br><table cellpadding=2 colspan=6 width=90% class=selection>'; + echo '<br /><table cellpadding=2 colspan=6 width=90% class=selection>'; $tableheader = "<tr><th>" . _('Order') . " #</th> <th>" . _('Customer') . "</th> Modified: trunk/SelectCustomer.php =================================================================== --- trunk/SelectCustomer.php 2011-02-27 09:18:42 UTC (rev 4500) +++ trunk/SelectCustomer.php 2011-03-03 09:13:12 UTC (rev 4501) @@ -1,6 +1,6 @@ <?php /* $Id$*/ -//$PageSecurity = 2; + include ('includes/session.inc'); $title = _('Search Customers'); include ('includes/header.inc'); @@ -119,8 +119,9 @@ custbranch.phoneno, custbranch.faxno FROM debtorsmaster LEFT JOIN custbranch - ON debtorsmaster.debtorno = custbranch.debtorno, debtortype - WHERE debtorsmaster.typeid = debtortype.typeid"; + ON debtorsmaster.debtorno = custbranch.debtorno + INNER JOIN debtortype + ON debtorsmaster.typeid = debtortype.typeid"; } else { if (strlen($_POST['Keywords']) > 0) { //using the customer name Modified: trunk/SelectSupplier.php =================================================================== --- trunk/SelectSupplier.php 2011-02-27 09:18:42 UTC (rev 4500) +++ trunk/SelectSupplier.php 2011-03-03 09:13:12 UTC (rev 4501) @@ -166,7 +166,7 @@ echo '</td><td valign=top class="select">'; /* Supplier Transactions */ echo "<a href=\"$rootpath/PO_Header.php?" . SID . '&NewOrder=Yes&SupplierID=' . $_SESSION['SupplierID'] . "\">" . _('Enter a Purchase Order for This Supplier') . '</a><br>'; echo "<a href=\"$rootpath/SupplierInvoice.php?" . SID . '&SupplierID=' . $_SESSION['SupplierID'] . "\">" . _('Enter a Suppliers Invoice') . '</a><br>'; - echo "<a href=\"$rootpath/SupplierCredit.php?" . SID . '&SupplierID=' . $_SESSION['SupplierID'] . "\">" . _('Enter a Suppliers Credit Note') . '</a><br>'; + echo "<a href=\"$rootpath/SupplierCredit.php?" . SID . '&SupplierID=' . $_SESSION['SupplierID'] . '&New=True' . "\">" . _('Enter a Suppliers Credit Note') . '</a><br>'; echo "<a href=\"$rootpath/Payments.php?" . SID . '&SupplierID=' . $_SESSION['SupplierID'] . "\">" . _('Enter a Payment to, or Receipt from the Supplier') . '</a><br>'; echo '<br>'; echo "<br><a href='$rootpath/ReverseGRN.php?" . SID . '&SupplierID=' . $_SESSION['SupplierID'] . "'>" . _('Reverse an Outstanding Goods Received Note (GRN)') . '</a>'; Modified: trunk/StockCheck.php =================================================================== --- trunk/StockCheck.php 2011-02-27 09:18:42 UTC (rev 4500) +++ trunk/StockCheck.php 2011-03-03 09:13:12 UTC (rev 4501) @@ -175,8 +175,9 @@ $FontSize=10; $YPos -=$line_height; - if ($_POST['ShowInfo']==true){ + if (isset($_POST['ShowInfo']) and $_POST['ShowInfo']==true){ + $SQL = "SELECT SUM(salesorderdetails.quantity - salesorderdetails.qtyinvoiced) AS qtydemand FROM salesorderdetails, salesorders Modified: trunk/StockSerialItems.php =================================================================== --- trunk/StockSerialItems.php 2011-02-27 09:18:42 UTC (rev 4500) +++ trunk/StockSerialItems.php 2011-03-03 09:13:12 UTC (rev 4501) @@ -1,8 +1,8 @@ <?php /* $Id$*/ -//$PageSecurity = 2; + include('includes/session.inc'); $title = _('Stock Of Controlled Items'); include('includes/header.inc'); @@ -28,21 +28,23 @@ mbflag, decimalplaces, serialised, - controlled + controlled, + perishable FROM stockmaster WHERE stockid='".$StockID."'", $db, _('Could not retrieve the requested item because')); -$myrow = DB_fetch_row($result); +$myrow = DB_fetch_array($result); -$Description = $myrow[0]; -$UOM = $myrow[1]; -$DecimalPlaces = $myrow[3]; -$Serialised = $myrow[4]; -$Controlled = $myrow[5]; +$Description = $myrow['description']; +$UOM = $myrow['units']; +$DecimalPlaces = $myrow['decimalplaces']; +$Serialised = $myrow['serialised']; +$Controlled = $myrow['controlled']; +$Perishable = $myrow['perishable']; -if ($myrow[2]=='K' OR $myrow[2]=='A' OR $myrow[2]=='D'){ +if ($myrow['mbflag']=='K' OR $myrow['mbflag']=='A' OR $myrow['mbflag']=='D'){ prnMsg(_('This item is either a kitset or assembly or a dummy part and cannot have a stock holding') . '. ' . _('This page cannot be displayed') . '. ' . _('Only serialised or controlled items can be displayed in this page'),'error'); include('includes/footer.inc'); @@ -59,7 +61,8 @@ $myrow = DB_fetch_row($result); $sql = "SELECT serialno, - quantity + quantity, + expirationdate FROM stockserialitems WHERE loccode='" . $_GET['Location'] . "' AND stockid = '" . $StockID . "' @@ -72,30 +75,48 @@ echo '<table cellpadding=2 class=selection>'; if ($Serialised==1){ - echo '<tr<th colspan=3><font color=navy size=2>' . _('Serialised items in') . ' '; + echo '<tr><th colspan="5"><font color=navy size=2>' . _('Serialised items in') . ' '; } else { - echo '<tr<th colspan=3><font color=navy size=2>' . _('Controlled items in') . ' '; + echo '<tr><th colspan="11"><font color=navy size=2>' . _('Controlled items in') . ' '; } echo $myrow[0]. '</font></th></tr>'; -echo "<tr><th colspan=3><font color=navy size=2>".$StockID ."-". $Description ."</b> (" . _('In units of') . ' ' . $UOM . ')</font></th></tr>'; +echo "<tr><th colspan=11><font color=navy size=2>".$StockID ."-". $Description ."</b> (" . _('In units of') . ' ' . $UOM . ')</font></th></tr>'; if ($Serialised == 1){ - $tableheader = "<tr> - <th>" . _('Serial Number') . "</th> - <th>" . _('Serial Number') . "</th> - <th>" . _('Serial Number') . "</th> - </tr>"; -} else { - $tableheader = "<tr> - <th>" . _('Batch/Bundle Ref') . "</th> - <th>" . _('Quantity On Hand') . "</th> - <th>" . _('Batch/Bundle Ref') . "</th> - <th>" . _('Quantity On Hand') . "</th> - <th>" . _('Batch/Bundle Ref') . "</th> - <th>" . _('Quantity On Hand') . "</th> + $tableheader = '<tr> + <th>' . _('Serial Number') . '</th> + <th></th> + <th>' . _('Serial Number') . '</th> + <th></th> + <th>' . _('Serial Number') . '</th> + </tr>'; +} else if ($Serialised == 0 and $Perishable==0){ + $tableheader = '<tr> + <th>' . _('Batch/Bundle Ref') . '</th> + <th>' . _('Quantity On Hand') . '</th> + <th></th> + <th>' . _('Batch/Bundle Ref') . '</th> + <th>' . _('Quantity On Hand') . '</th> + <th></th> + <th>' . _('Batch/Bundle Ref') . '</th> + <th>' . _('Quantity On Hand') . '</th> </tr>"; +} else if ($Serialised == 0 and $Perishable==1){ + $tableheader = '<tr> + <th>' . _('Batch/Bundle Ref') . '</th> + <th>' . _('Quantity On Hand') . '</th> + <th>' . _('Expiry Date') . '</th> + <th></th> + <th>' . _('Batch/Bundle Ref') . '</th> + <th>' . _('Quantity On Hand') . '</th> + <th>' . _('Expiry Date') . '</th> + <th></th> + <th>' . _('Batch/Bundle Ref') . '</th> + <th>' . _('Quantity On Hand') . '</th> + <th>' . _('Expiry Date') . '</th> + </tr>'; } echo $tableheader; $TotalQuantity =0; @@ -115,15 +136,17 @@ $TotalQuantity += $myrow['quantity']; if ($Serialised == 1){ - printf('<td>%s</td>', - $myrow['serialno'] - ); - } else { - printf("<td>%s</td> - <td class=number>%s</td>", - $myrow['serialno'], - number_format($myrow['quantity'],$DecimalPlaces) - ); + echo '<td>'.$myrow['serialno'].'/td>'; + echo '<th></th>'; + } else if ($Serialised == 0 and $Perishable==0) { + echo '<td>'.$myrow['serialno'].'</td> + <td class="number">'.number_format($myrow['quantity'],$DecimalPlaces).'</td>'; + echo '<th></th>'; + } else if ($Serialised == 0 and $Perishable==1){ + echo '<td>'.$myrow['serialno'].'</td> + <td class="number">'.number_format($myrow['quantity'],$DecimalPlaces). '</td> + <td>' . ConvertSQLDate($myrow['expirationdate']). '</td>'; + echo '<th></th>'; } $j++; If ($j == 36){ @@ -144,5 +167,4 @@ echo '</form>'; include('includes/footer.inc'); - ?> \ No newline at end of file Modified: trunk/SupplierCredit.php =================================================================== --- trunk/SupplierCredit.php 2011-02-27 09:18:42 UTC (rev 4500) +++ trunk/SupplierCredit.php 2011-03-03 09:13:12 UTC (rev 4501) @@ -35,6 +35,10 @@ //this is available from the menu on this page already //echo "<a href='" . $rootpath . '/SelectSupplier.php?' . SID . "'>" . _('Back to Suppliers') . '</a><br>'; +if (isset($_GET['New'])) { + unset($_SESSION['SuppTrans']); +} + if (!isset($_SESSION['SuppTrans']->SupplierName)) { $sql='SELECT suppname FROM suppliers WHERE supplierid="'.$_GET['SupplierID'].'"'; $result = DB_query($sql,$db); Modified: trunk/Suppliers.php =================================================================== --- trunk/Suppliers.php 2011-02-27 09:18:42 UTC (rev 4500) +++ trunk/Suppliers.php 2011-03-03 09:13:12 UTC (rev 4501) @@ -444,11 +444,11 @@ } if (!isset($_POST['New'])) { - $supptranssql = "SELECT COUNT(supplierno) - FROM supptrans - WHERE supplierno='".$SupplierID ."'"; + $supptranssql = "SELECT supplierno + FROM supptrans + WHERE supplierno='".$SupplierID ."'"; $suppresult = DB_query($supptranssql, $db); - $supptrans = DB_fetch_row($suppresult); + $supptrans = DB_num_rows($suppresult); $suppcurrssql = "SELECT currcode FROM suppliers @@ -481,7 +481,7 @@ WHERE supplierid = '".$SupplierID."'"; } else { if ($suppcurr[0] != $_POST['CurrCode']) { - prnMsg( _('Cannot change currency code as transactions already exist'), info); + prnMsg( _('Cannot change currency code as transactions already exist'), 'info'); } $sql = "UPDATE suppliers SET suppname='" . $_POST['SuppName'] . "', address1='" . $_POST['Address1'] . "', Modified: trunk/doc/Change.log.html =================================================================== --- trunk/doc/Change.log.html 2011-02-27 09:18:42 UTC (rev 4500) +++ trunk/doc/Change.log.html 2011-03-03 09:13:12 UTC (rev 4501) @@ -1,6 +1,9 @@ <p><font SIZE=4 COLOR=BLUE><b>webERP Change Log</b></font></p> <p> -<p>27/2/11: Phil/Tim/Peter launchpad added category option for MRPShortages.php </p> +<p>3/3/11: Exson/Baran/Phil fix to customer login to ensure that other customers orders are not displayed when searching by customer ref or order no</p> +<p>3/3/11: Tim launchpad mods to revision 4441 including change to allow supplier currency to be changed if there are no transactions already against the supplier. Ensure credit note session variable is unset before attempting to create a new credit note from the supplier form. Tim's work to add perisable expiry dates to the serial items logic - affects quite a few scripts. Headings to stock check script even if no quantity is shown. Portrait quotations. Not included change to default delivery date to the date the customer requested - left to be the current day's date. Not included Tim's unit pricing work .. yet launchpad revisions 4442-4447 inclusive</p> +<p>27/2/11: Phil/Tim/Peter launchpad added category option for MRPShortages.php links with matching quotes in WorkOrderEntry</p> +<p>27/2/11: Phil StockUsage.php now totals usage each month even in months where there was none - average now includes months with no usage</p> <p>27/2/11: Phil fix units deletion issue reported by Exson in UnitsOfMeasure.php script - checked for none existant units field in contracts table - removed the check</p> <p>22/2/11: Phil fix PDFTopItems.php for changed variable names - now using CamelCase tried to rework to conform</p> <p>22/2/11: Phil remove options for PDFLanguage that are not unique in WWW_Users.php - make it default to the users settings in the SESSION for UserSettings.php</p> Modified: trunk/includes/Add_SerialItems.php =================================================================== --- trunk/includes/Add_SerialItems.php 2011-02-27 09:18:42 UTC (rev 4500) +++ trunk/includes/Add_SerialItems.php 2011-03-03 09:13:12 UTC (rev 4501) @@ -66,7 +66,7 @@ } if (!$SerialError){ - $LineItem->SerialItems[$NewSerialNo] = new SerialItem ($_POST['SerialNo' . $i], $NewQty); + $LineItem->SerialItems[$NewSerialNo] = new SerialItem ($_POST['SerialNo' . $i], $NewQty, $_POST['ExpiryDate' . $i]); } } } /* end if posted Serialno . i is not blank */ @@ -75,7 +75,8 @@ if (!isset($_POST['Bundles'])) { $_POST['Bundles']=0; } - for ($i=0;$i < count($_POST['Bundles']);$i++){ /*there is an entry in the multi select list box */ + echo count($_POST['Bundles']); + for ($i=0;$i < count($_POST['Bundles'])-1;$i++){ /*there is an entry in the multi select list box */ if ($LineItem->Serialised==1){ /*only if the item is serialised */ $LineItem->SerialItems[$_POST['Bundles'][$i]] = new SerialItem ($_POST['Bundles'][$i], ($InOutModifier>0?1:-1) ); } else { Modified: trunk/includes/Add_SerialItemsOut.php =================================================================== --- trunk/includes/Add_SerialItemsOut.php 2011-02-27 09:18:42 UTC (rev 4500) +++ trunk/includes/Add_SerialItemsOut.php 2011-03-03 09:13:12 UTC (rev 4501) @@ -3,11 +3,10 @@ /*ProcessSerialItems.php takes the posted variables and adds to the SerialItems array in either the cartclass->LineItems->SerialItems or the POClass->LineItems->SerialItems */ - if (isset($_POST['AddBatches'])){ for ($i=0;$i < 10;$i++){ - if(strlen($_POST['SerialNo' . $i])>0){ + if(isset($_POST['SerialNo' . $i]) and strlen($_POST['SerialNo' . $i])>0){ $ExistingBundleQty = ValidBundleRef($StockID, $LocationOut, $_POST['SerialNo' . $i]); if ($ExistingBundleQty >0){ $AddThisBundle = true; @@ -15,30 +14,31 @@ the first entered one - no warning given though ? */ if ($_POST['Qty' . $i] > $ExistingBundleQty){ if ($LineItem->Serialised ==1){ - echo "<BR>" . $_POST['SerialNo' . $i] . " " . _('has already been sold'); + echo "<br />" . $_POST['SerialNo' . $i] . " " . _('has already been sold'); $AddThisBundle = false; } elseif ($ExistingBundleQty==0) { /* and its a batch */ - echo "<BR>There is none of " . $_POST['SerialNo' . $i] . " left."; + echo "<br />There is none of " . $_POST['SerialNo' . $i] . " left."; $AddThisBundle = false; } else { - echo '<BR>' . _('There is only') . ' ' . $ExistingBundleQty . ' ' . _('of') . ' ' . $_POST['SerialNo' . $i] . ' ' . _('remaining') . '. ' . _('The entered quantity will be reduced to the remaining amount left of this batch/bundle/roll'); + echo '<br />' . _('There is only') . ' ' . $ExistingBundleQty . ' ' . _('of') . ' ' . $_POST['SerialNo' . $i] . + ' ' . _('remaining') . '. ' . _('The entered quantity will be reduced to the remaining amount left of this batch/bundle/roll'); $_POST['Qty' . $i] = $ExistingBundleQty; $AddThisBundle = true; } } - if ($AddThisBundle==true){ - $LineItem->SerialItems[$_POST['SerialNo' . $i]] = new SerialItem ($_POST['SerialNo' . $i], $_POST['Qty' . $i]); + if ($AddThisBundle==true and $_POST['Qty' . $i]>0){ + $LineItem->SerialItems[$_POST['SerialNo' . $i]] = new SerialItem ($_POST['SerialNo' . $i], $_POST['Qty' . $i], $_POST['ExpiryDate' . $i]); } } /*end if ExistingBundleQty >0 */ } /* end if posted Serialno . i is not blank */ } /* end of the loop aroung the form input fields */ - for ($i=0;$i < count($_POST['Bundles']);$i++){ /*there is an entry in the multi select list box */ - if ($LineItem->Serialised==1){ /*only if the item is serialised */ - $LineItem->SerialItems[$_POST['Bundles'][$i]] = new SerialItem ($_POST['Bundles'][$i], 1); - } - } +// for ($i=0;$i < count($_POST['Bundles']);$i++){ /*there is an entry in the multi select list box */ +// if ($LineItem->Serialised==1){ /*only if the item is serialised */ +// $LineItem->SerialItems[$_POST['Bundles'][$i]] = new SerialItem ($_POST['Bundles'][$i], 1); +// } +// } } /*end if the user hit the enter button */ @@ -47,4 +47,8 @@ unset($LineItem->SerialItems[$_GET['Delete']]); } +if (isset($_GET['DELETEALL'])){ + $LineItem->SerialItems=array(); +} + ?> Modified: trunk/includes/DefineSerialItems.php =================================================================== --- trunk/includes/DefineSerialItems.php 2011-02-27 09:18:42 UTC (rev 4500) +++ trunk/includes/DefineSerialItems.php 2011-03-03 09:13:12 UTC (rev 4501) @@ -4,10 +4,10 @@ function ValidBundleRef ($StockID, $LocCode, $BundleRef){ global $db; - $SQL = "SELECT quantity - FROM stockserialitems - WHERE stockid='" . $StockID . "' - AND loccode ='" . $LocCode . "' + $SQL = "SELECT quantity + FROM stockserialitems + WHERE stockid='" . $StockID . "' + AND loccode ='" . $LocCode . "' AND serialno='" . $BundleRef . "'"; $Result = DB_query($SQL, $db); if (DB_num_rows($Result)==0){ @@ -22,12 +22,14 @@ var $BundleRef; var $BundleQty; + var $ExpiryDate; //Constructor - function SerialItem($BundleRef, $BundleQty){ + function SerialItem($BundleRef, $BundleQty, $ExpiryDate='0000-00-00'){ $this->BundleRef = $BundleRef; $this->BundleQty = $BundleQty; + $this->ExpiryDate = $ExpiryDate; } }//class SerialItem ?> \ No newline at end of file Modified: trunk/includes/InputSerialItems.php =================================================================== --- trunk/includes/InputSerialItems.php 2011-02-27 09:18:42 UTC (rev 4500) +++ trunk/includes/InputSerialItems.php 2011-03-03 09:13:12 UTC (rev 4501) @@ -88,15 +88,27 @@ '&LineNo=' . $LineNo .'">'. _('Edit'). '</a> | '; $RemoveLink = '<a href="' . $_SERVER['PHP_SELF'] . '?identifier=' . $identifier . '&DELETEALL=YES&StockID=' . $LineItem->StockID . '&LineNo=' . $LineNo .'">'. _('Remove All'). '</a><br></div>'; +$sql="SELECT perishable + FROM stockmaster + WHERE stockid='".$StockID."'"; +$result=DB_query($sql, $db); +$myrow=DB_fetch_array($result); +$Perishable=$myrow['perishable']; if ($LineItem->Serialised==1){ $tableheader .= '<tr> <th>'. _('Serial No').'</th> - </Tr>'; + </tr>'; +} else if ($LineItem->Serialised==0 and $Perishable==1){ + $tableheader = '<tr> + <th>'. _('Batch/Roll/Bundle'). ' #</th> + <th>'. _('Quantity'). '</th> + <th>'. _('Expiry Date'). '</th> + </tr>'; } else { - $tableheader = '<TR> + $tableheader = '<tr> <th>'. _('Batch/Roll/Bundle'). ' #</th> - <th class=tableheader>'. _('Quantity'). '</th> - </tr>'; + <th>'. _('Quantity'). '</th> + </tr>'; } echo $EditLink . $RemoveLink; Modified: trunk/includes/InputSerialItemsKeyed.php =================================================================== --- trunk/includes/InputSerialItemsKeyed.php 2011-02-27 09:18:42 UTC (rev 4500) +++ trunk/includes/InputSerialItemsKeyed.php 2011-03-03 09:13:12 UTC (rev 4501) @@ -47,8 +47,11 @@ echo '<td>' . $Bundle->BundleRef . '</td>'; - if ($LineItem->Serialised==0){ + if ($LineItem->Serialised==0 and $Perishable==0){ echo '<td class=number>' . number_format($Bundle->BundleQty, $LineItem->DecimalPlaces) . '</td>'; + } else if ($LineItem->Serialised==0 and $Perishable==1){ + echo '<td class=number>' . number_format($Bundle->BundleQty, $LineItem->DecimalPlaces) . '</td>'; + echo '<td class=number>' . $Bundle->ExpiryDate . '</td>'; } echo '<td><a href="' . $_SERVER['PHP_SELF'] . '?identifier=' . $identifier . '&Delete=' . $Bundle->BundleRef . '&StockID=' . $LineItem->StockID . '&LineNo=' . $LineNo .'">'. _('Delete'). '</a></td></tr>'; @@ -81,7 +84,7 @@ <input type=hidden name=StockID value="' . $StockID . '"> <input type=hidden name="identifier" value="' . $identifier . '"> <input type=hidden name=EntryType value="KEYED">'; - echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; +echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; if ( isset($_GET['EditControlled']) ) { $EditControlled = isset($_GET['EditControlled'])?$_GET['EditControlled']:false; } elseif ( isset($_POST['EditControlled']) ){ @@ -102,6 +105,9 @@ if ($LineItem->Serialised==1){ echo '<input type=hidden name="Qty' . $StartAddingAt .'" Value=1></TR>'; + } else if ($LineItem->Serialised==0 and $Perishable==1) { + echo '<td><input type=text class="number" name="Qty' . $StartAddingAt .'" size=11 + value="'. number_format($Bundle->BundleQty, $LineItem->DecimalPlaces). '" maxlength=10></tr>'; } else { echo '<td><input type=text class="number" name="Qty' . $StartAddingAt .'" size=11 value="'. number_format($Bundle->BundleQty, $LineItem->DecimalPlaces). '" maxlength=10></tr>'; @@ -120,6 +126,10 @@ if ($LineItem->Serialised==1){ echo '<input type=hidden name="Qty' . ($StartAddingAt+$i) .'" Value=1></tr>'; + } else if ($LineItem->Serialised==0 and $Perishable==1) { + echo '<td><input type=text class="number" name="Qty' . ($StartAddingAt+$i) .'" size=11 maxlength=10></td>'; + echo '<td><input type=text class="date" name="ExpiryDate' . ($StartAddingAt+$i) .'" size=11 + value="" alt="'.$_SESSION['DefaultDateFormat'].'" maxlength=10></td></tr>'; } else { echo '<td><input type=text class="number" name="Qty' . ($StartAddingAt+$i) .'" size=11 maxlength=10></tr>'; } @@ -136,4 +146,4 @@ document.Ga6uF5Wa.SerialNo0.focus(); //]]> </script>'; /*end of nested table */ -?> +?> \ No newline at end of file Modified: trunk/includes/PDFStockCheckPageHeader.inc =================================================================== --- trunk/includes/PDFStockCheckPageHeader.inc 2011-02-27 09:18:42 UTC (rev 4500) +++ trunk/includes/PDFStockCheckPageHeader.inc 2011-03-03 09:13:12 UTC (rev 4501) @@ -28,16 +28,22 @@ $Xpos = $Left_Margin+1; /*draw vertical lines */ -$pdf->line(350, $YPos-$line_height,350, $Bottom_Margin+24); -$pdf->line(415, $YPos-$line_height,415, $Bottom_Margin+24); -$pdf->line(475, $YPos-$line_height,475, $Bottom_Margin+24); +$pdf->line(370, $YPos+$BoxHeight,370, $Bottom_Margin+24); $LeftOvers = $pdf->addTextWrap($Xpos,$YPos,300-$Left_Margin,$FontSize,_('Item'), 'centre'); -if ($_POST['ShowInfo']==true){ +if (isset($_POST['ShowInfo']) and $_POST['ShowInfo']==true){ + /*draw vertical lines */ + $pdf->line(415, $YPos-$line_height,415, $Bottom_Margin+24); + $pdf->line(475, $YPos-$line_height,475, $Bottom_Margin+24); $LeftOvers = $pdf->addTextWrap(341,$YPos,60,$FontSize,_('QOH'), 'centre'); $LeftOvers = $pdf->addTextWrap(341+61,$YPos,80,$FontSize,_('Cust Ords'), 'centre'); $LeftOvers = $pdf->addTextWrap(341+61+61,$YPos,80,$FontSize,_('Available'), 'centre'); - } +} else { + /*draw vertical lines */ + $pdf->line(435, $YPos+$BoxHeight,435, $Bottom_Margin+24); + $LeftOvers = $pdf->addTextWrap(371,$YPos,60,$FontSize,_('Quantity'), 'centre'); + $LeftOvers = $pdf->addTextWrap(341+61+61,$YPos,80,$FontSize,_('Remarks'), 'centre'); +} $FontSize=10; $YPos -=($line_height); ?> \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |