From: <dai...@us...> - 2011-06-28 10:12:34
|
Revision: 4609 http://web-erp.svn.sourceforge.net/web-erp/?rev=4609&view=rev Author: daintree Date: 2011-06-28 10:12:27 +0000 (Tue, 28 Jun 2011) Log Message: ----------- Modified Paths: -------------- trunk/MRPDemands.php trunk/PrintCustOrder_generic.php trunk/doc/Change.log Modified: trunk/MRPDemands.php =================================================================== --- trunk/MRPDemands.php 2011-06-27 10:30:19 UTC (rev 4608) +++ trunk/MRPDemands.php 2011-06-28 10:12:27 UTC (rev 4609) @@ -103,8 +103,9 @@ $k++; } $tabindex=$j+4; - echo "<td><input tabindex='".$tabindex."' type=submit name='StockID' value='".$myrow['stockid']."'</td> - <td>".$myrow['description']."</td></tr>"; + echo '<td><input tabindex="' . $tabindex . '" type=submit name="StockID" value="' . $myrow['stockid'] .'"</td> + <td>' . $myrow['description'] . '</td> + </tr>'; $j++; } //end of while loop @@ -212,7 +213,7 @@ $result = DB_query($sql,$db,_('The update/addition of the MRP demand record failed because')); prnMsg($msg,'success'); - echo '<br>'; + echo '<br />'; unset ($_POST['MRPDemandtype']); unset ($_POST['Quantity']); unset ($_POST['StockID']); @@ -225,7 +226,7 @@ } // End of function submit() -function delete(&$db,$DemandID,$demandtype,$StockID) { //####DELETE_DELETE_DELETE_DELETE_DELETE_DELETE_#### +function delete(&$db,$DemandID,$DemandType,$StockID) { //####DELETE_DELETE_DELETE_DELETE_DELETE_DELETE_#### // If wanted to have a Confirm routine before did actually deletion, could check if // deletion = "yes"; if it did, display link that redirects back to this page @@ -234,8 +235,8 @@ // This deletes an individual record by DemandID if called from a listall that shows // edit/delete or deletes all of a particular demand type if press Delete Demand Type button. $where = " "; - if ($demandtype) { - $where = " WHERE mrpdemandtype ='" . $demandtype . "'"; + if ($DemandType) { + $where = " WHERE mrpdemandtype ='" . $DemandType . "'"; } if ($DemandID) { $where = " WHERE demandid ='" . $DemandID . "'"; @@ -246,7 +247,7 @@ if ($DemandID) { prnMsg(_('The MRP demand record for') .' '. $StockID .' '. _('has been deleted'),'succes'); } else { - prnMsg(_('All records for demand type') .' '. $demandtype .' ' . _('have been deleted'),'succes'); + prnMsg(_('All records for demand type') .' '. $DemandType .' ' . _('have been deleted'),'succes'); } unset ($DemandID); unset ($StockID); @@ -255,7 +256,7 @@ } // End of function delete() -function listall(&$db,$part,$demandtype) {//####LISTALL_LISTALL_LISTALL_LISTALL_LISTALL_LISTALL_LISTALL_#### +function listall(&$db,$part,$DemandType) {//####LISTALL_LISTALL_LISTALL_LISTALL_LISTALL_LISTALL_LISTALL_#### // List all mrpdemands records, with anchors to Edit or Delete records if hit List All anchor // Lists some in hit List Selection submit button, and uses part number if it is entered or @@ -264,33 +265,34 @@ echo '<form action="' . $_SERVER['PHP_SELF'] .'" method="post">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; $where = " "; - if ($demandtype) { - $where = " WHERE mrpdemandtype ='" . $demandtype . "'"; + if ($DemandType) { + $where = " WHERE mrpdemandtype ='" . $DemandType . "'"; } if ($part) { $where = " WHERE mrpdemands.stockid ='" . $part . "'"; } // If part is entered, it overrides demandtype - $sql = 'SELECT mrpdemands.demandid, + $sql = "SELECT mrpdemands.demandid, mrpdemands.stockid, mrpdemands.mrpdemandtype, mrpdemands.quantity, mrpdemands.duedate, stockmaster.description - FROM mrpdemands - LEFT JOIN stockmaster on mrpdemands.stockid = stockmaster.stockid' . - $where . ' ORDER BY mrpdemands.stockid, mrpdemands.duedate'; - //echo "<br/>sql is $sql<br/>"; + FROM mrpdemands + LEFT JOIN stockmaster on mrpdemands.stockid = stockmaster.stockid" . + $where . " ORDER BY mrpdemands.stockid, mrpdemands.duedate"; + $ErrMsg = _('The SQL to find the parts selected failed with the message'); $result = DB_query($sql,$db,$ErrMsg); - echo "<table class=selection> - <tr bgcolor =#800000><th>" . _('Part Number') . "</th> - <th>" . _('Description') . "</th> - <th>" . _('Demand Type') . "</th> - <th>" . _('Quantity') . "</th> - <th>" . _('Due Date') . "</th> - </tr>"; + echo '<table class="selection"> + <tr bgcolor =#800000> + <th>' . _('Part Number') . '</th> + <th>' . _('Description') . '</th> + <th>' . _('Demand Type') . '</th> + <th>' . _('Quantity') . '</th> + <th>' . _('Due Date') . '</th> + </tr>'; $ctr = 0; while ($myrow = DB_fetch_row($result)) { $displaydate = ConvertSQLDate($myrow[4]); @@ -300,8 +302,8 @@ <td>' . $myrow[2] . '</td> <td>' . $myrow[3] . '</td> <td>' . $displaydate . '</td> - <td><a href="' .$_SERVER['PHP_SELF'] .'DemandID=' . $myrow[0] . '&StockID=' . $myrow[1] . '">' . _('Edit') . '</td> - <td><a href="' . $_SERVER['PHP_SELF'] . 'DemandID=' . $myrow[0] . '&StockID=' . $myrow[1].'&delete=yes">' . _('Delete') .'</td> + <td><a href="' .$_SERVER['PHP_SELF'] .'?DemandID=' . $myrow[0] . '&StockID=' . $myrow[1] . '">' . _('Edit') . '</td> + <td><a href="' . $_SERVER['PHP_SELF'] . '?DemandID=' . $myrow[0] . '&StockID=' . $myrow[1].'&delete=yes" onclick="return confirm(\'' . _('Are you sure you wish to delete this demand?') . '\');">' . _('Delete') .'</td> </tr>'; } @@ -378,15 +380,21 @@ $_POST['Duedate']=' '; } - echo '<tr><td>' . _('Quantity') . ":</td><td><input type='Text' name='Quantity' class=number size=6 - maxlength=6 value=" . $_POST['Quantity'] . '></td></tr><tr><td>' . _('Due Date') . ":</td> - <td><input type='Text' class=date alt='".$_SESSION['DefaultDateFormat']."' name='Duedate' size=12 - maxlength=12 value=" . $_POST['Duedate'] . '></td></tr>'; + echo '<tr><td>' . _('Quantity') . ':</td> + <td><input type="text" name="Quantity" class="number" size="6" maxlength="6" value=' . $_POST['Quantity'] . '></td> + </tr> + <tr> + <td>' . _('Due Date') . ':</td> + <td><input type="text" class="date" alt="' . $_SESSION['DefaultDateFormat'] . '" name="Duedate" size="12" maxlength="12" value="' . $_POST['Duedate'] . '"></td> + </tr>'; // Generate selections for Demand Type - echo '<tr><td>' . _('Demand Type') . "</td><td><select name='MRPDemandtype'>"; - $sql = 'SELECT mrpdemandtype, + echo '<tr> + <td>' . _('Demand Type') . '</td> + <td><select name="MRPDemandtype">'; + + $sql = "SELECT mrpdemandtype, description - FROM mrpdemandtypes'; + FROM mrpdemandtypes"; $result = DB_query($sql,$db); while ($myrow = DB_fetch_array($result)) { if (isset($_POST['MRPDemandtype']) and $myrow['mrpdemandtype']==$_POST['MRPDemandtype']) { @@ -399,18 +407,18 @@ echo '</select></td></tr>'; echo '</table>'; - echo '<br><div class=centre><input type="submit" name="submit" value="' . _('Enter Information') . '">  '; + echo '<br /> + <div class=centre><input type="submit" name="submit" value="' . _('Enter Information') . '">  '; echo '<input type="submit" name="listsome" value="' . _('List Selection') . '">  '; - echo '<input type="Submit" name="deletesome" value="' . _('Delete Demand Type') . '">'; + echo '<input type="submit" name="deletesome" value="' . _('Delete Demand Type') . '">'; // If mrpdemand record exists, display option to delete it if ((isset($DemandID)) AND (DB_num_rows($result) > 0)) { - echo '<br/><br/><a href=" ' . $_SERVER['PHP_SELF'] . '?&delete=yes&StockID='.$StockID.'&DemandID=' . $DemandID . '">' . _('Or Delete Record') ; + echo '<br/><br/><a href=" ' . $_SERVER['PHP_SELF'] . '?delete=yes&StockID='.$StockID.'&DemandID=' . $DemandID . '" onclick="return confirm(\'' . _('Are you sure you wish to delete this demand?') . '\');">' . _('Or Delete Record') ; } } echo '</form>'; } // End of function display() - include('includes/footer.inc'); ?> \ No newline at end of file Modified: trunk/PrintCustOrder_generic.php =================================================================== --- trunk/PrintCustOrder_generic.php 2011-06-27 10:30:19 UTC (rev 4608) +++ trunk/PrintCustOrder_generic.php 2011-06-28 10:12:27 UTC (rev 4609) @@ -2,7 +2,6 @@ /* $Id$*/ -/* $Revision: 1.20 $ */ include('includes/session.inc'); include('includes/SQL_CommonFunctions.inc'); @@ -10,16 +9,27 @@ //Get Out if we have no order number to work with If (!isset($_GET['TransNo']) OR $_GET['TransNo']==""){ - $title = _('Select Order To Print'); - include('includes/header.inc'); - echo '<div class=centre><br /><br /><br />'; - prnMsg( _('Select an Order Number to Print before calling this page') , 'error'); - echo '<br /><br /><br /><table class="table_index"><tr><td class="menu_group_item"> - <li><a href="'. $rootpath . '/SelectSalesOrder.php?">' . _('Outstanding Sales Orders') . '</a></li> - <li><a href="'. $rootpath . '/SelectCompletedOrder.php">' . _('Completed Sales Orders') . '</a></li> - </td></tr></table></div><br /><br /><br />'; - include('includes/footer.inc'); - exit(); + $title = _('Select Order To Print'); + include('includes/header.inc'); + echo '<div class=centre><br /><br /><br />'; + prnMsg( _('Select an Order Number to Print before calling this page') , 'error'); + echo '<br /> + <br /> + <br /> + <table class="table_index"> + <tr> + <td class="menu_group_item"> + <li><a href="'. $rootpath . '/SelectSalesOrder.php?">' . _('Outstanding Sales Orders') . '</a></li> + <li><a href="'. $rootpath . '/SelectCompletedOrder.php">' . _('Completed Sales Orders') . '</a></li> + </td> + </tr> + </table> + </div> + <br /> + <br /> + <br />'; + include('includes/footer.inc'); + exit(); } /*retrieve the order details from the database to print */ @@ -27,50 +37,62 @@ $sql = "SELECT salesorders.debtorno, salesorders.customerref, - salesorders.comments, - salesorders.orddate, - salesorders.deliverto, - salesorders.deladd1, - salesorders.deladd2, - salesorders.deladd3, - salesorders.deladd4, - salesorders.deladd5, - salesorders.deladd6, - salesorders.deliverblind, - debtorsmaster.name, - debtorsmaster.address1, - debtorsmaster.address2, - debtorsmaster.address3, - debtorsmaster.address4, - debtorsmaster.address5, - debtorsmaster.address6, - shippers.shippername, - salesorders.printedpackingslip, - salesorders.datepackingslipprinted, - locations.locationname - FROM salesorders, - debtorsmaster, - shippers, - locations - WHERE salesorders.debtorno=debtorsmaster.debtorno - AND salesorders.shipvia=shippers.shipper_id - AND salesorders.fromstkloc=locations.loccode - AND salesorders.orderno='" . $_GET['TransNo'] . "'"; - + salesorders.comments, + salesorders.orddate, + salesorders.deliverto, + salesorders.deladd1, + salesorders.deladd2, + salesorders.deladd3, + salesorders.deladd4, + salesorders.deladd5, + salesorders.deladd6, + salesorders.deliverblind, + debtorsmaster.name, + debtorsmaster.address1, + debtorsmaster.address2, + debtorsmaster.address3, + debtorsmaster.address4, + debtorsmaster.address5, + debtorsmaster.address6, + shippers.shippername, + salesorders.printedpackingslip, + salesorders.datepackingslipprinted, + locations.locationname + FROM salesorders, + debtorsmaster, + shippers, + locations + WHERE salesorders.debtorno=debtorsmaster.debtorno + AND salesorders.shipvia=shippers.shipper_id + AND salesorders.fromstkloc=locations.loccode + AND salesorders.orderno='" . $_GET['TransNo'] . "'"; + $result=DB_query($sql,$db, $ErrMsg); //If there are no rows, there's a problem. if (DB_num_rows($result)==0){ - $title = _('Print Packing Slip Error'); - include('includes/header.inc'); - echo '<div class=centre><br /><br /><br />'; - prnMsg( _('Unable to Locate Order Number') . ' : ' . $_GET['TransNo'] . ' ', 'error'); - echo '<br /><br /><br /><table class="table_index"><tr><td class="menu_group_item"> - <li><a href="'. $rootpath . '/SelectSalesOrder.php">' . _('Outstanding Sales Orders') . '</a></li> - <li><a href="'. $rootpath . '/SelectCompletedOrder.php">' . _('Completed Sales Orders') . '</a></li> - </td></tr></table></div><br /><br /><br />'; - include('includes/footer.inc'); - exit(); + $title = _('Print Packing Slip Error'); + include('includes/header.inc'); + echo '<div class=centre><br /><br /><br />'; + prnMsg( _('Unable to Locate Order Number') . ' : ' . $_GET['TransNo'] . ' ', 'error'); + echo '<br /> + <br /> + <br /> + <table class="table_index"> + <tr> + <td class="menu_group_item"> + <li><a href="'. $rootpath . '/SelectSalesOrder.php">' . _('Outstanding Sales Orders') . '</a></li> + <li><a href="'. $rootpath . '/SelectCompletedOrder.php">' . _('Completed Sales Orders') . '</a></li> + </td> + </tr> + </table> + </div> + <br /> + <br /> + <br />'; + + include('includes/footer.inc'); + exit(); } elseif (DB_num_rows($result)==1){ /*There is only one order header returned - thats good! */ $myrow = DB_fetch_array($result); @@ -90,10 +112,18 @@ echo '<br /><br /><br />'; echo _('Or select another Order Number to Print'); - echo '<table class="table_index"><tr><td class="menu_group_item"> + echo '<table class="table_index"> + <tr> + <td class="menu_group_item"> <li><a href="'. $rootpath . '/SelectSalesOrder.php">' . _('Outstanding Sales Orders') . '</a></li> <li><a href="'. $rootpath . '/SelectCompletedOrder.php">' . _('Completed Sales Orders') . '</a></li> - </td></tr></table></div><br /><br /><br />'; + </td> + </tr> + </table> + </div> + <br /> + <br /> + <br />'; include('includes/footer.inc'); exit; @@ -102,9 +132,9 @@ /*retrieve the order details from the database to print */ -/* Then there's an order to print and its not been printed already (or its been flagged for reprinting/ge_Width=807; -) +/* Then there's an order to print and its not been printed already (or its been flagged for reprinting) LETS GO */ + $PaperSize = 'A4_Landscape'; include('includes/PDFStarter.php'); //$pdf->selectFont('./fonts/Helvetica.afm'); @@ -119,22 +149,24 @@ for ($i=1;$i<=2;$i++){ /*Print it out twice one copy for customer and one for office */ if ($i==2){ - $PageNumber = 1; + $PageNumber = 1; $pdf->newPage(); } /* Now ... Has the order got any line items still outstanding to be invoiced */ - $ErrMsg = _('There was a problem retrieving the order header details for Order Number') . ' ' . + $ErrMsg = _('There was a problem retrieving the order details for Order Number') . ' ' . $_GET['TransNo'] . ' ' . _('from the database'); $sql = "SELECT salesorderdetails.stkcode, - stockmaster.description, - salesorderdetails.quantity, - salesorderdetails.qtyinvoiced, - salesorderdetails.unitprice, - salesorderdetails.narrative - FROM salesorderdetails INNER JOIN stockmaster - ON salesorderdetails.stkcode=stockmaster.stockid - WHERE salesorderdetails.orderno='" . $_GET['TransNo'] . "'"; + stockmaster.description, + salesorderdetails.quantity, + salesorderdetails.qtyinvoiced, + salesorderdetails.unitprice, + salesorderdetails.narrative, + stockmaster.mbflag, + stockmaster.decimalplaces + FROM salesorderdetails INNER JOIN stockmaster + ON salesorderdetails.stkcode=stockmaster.stockid + WHERE salesorderdetails.orderno='" . $_GET['TransNo'] . "'"; $result=DB_query($sql,$db, $ErrMsg); if (DB_num_rows($result)>0){ @@ -144,26 +176,56 @@ while ($myrow2=DB_fetch_array($result)){ $ListCount ++; + + $DisplayQty = number_format($myrow2['quantity'],$myrow2['decimalplaces']); + $DisplayPrevDel = number_format($myrow2['qtyinvoiced'],$myrow2['decimalplaces']); + $DisplayQtySupplied = number_format($myrow2['quantity'] - $myrow2['qtyinvoiced'],$myrow2['decimalplaces']); - $DisplayQty = number_format($myrow2['quantity'],2); - $DisplayPrevDel = number_format($myrow2['qtyinvoiced'],2); - $DisplayQtySupplied = number_format($myrow2['quantity'] - $myrow2['qtyinvoiced'],2); - $LeftOvers = $pdf->addTextWrap($XPos,$YPos,127,$FontSize,$myrow2['stkcode']); $LeftOvers = $pdf->addTextWrap(147,$YPos,255,$FontSize,$myrow2['description']); $LeftOvers = $pdf->addTextWrap(400,$YPos,85,$FontSize,$DisplayQty,'right'); $LeftOvers = $pdf->addTextWrap(503,$YPos,85,$FontSize,$DisplayQtySupplied,'right'); $LeftOvers = $pdf->addTextWrap(602,$YPos,85,$FontSize,$DisplayPrevDel,'right'); - + if ($YPos-$line_height <= 50){ /* We reached the end of the page so finsih off the page and start a newy */ $PageNumber++; include ('includes/PDFOrderPageHeader_generic.inc'); } //end if need a new page headed up - else{ + else { /*increment a line down for the next line item */ $YPos -= ($line_height); } + if ($myrow2['mbflag']=='A'){ + /*Then its an assembly item - need to explode into it's components for packing list purposes */ + $sql = "SELECT bom.component, + bom.quantity, + stockmaster.description, + stockmaster.decimalplaces + FROM bom INNER JOIN stockmaster + ON bom.component=stockmaster.stockid + WHERE bom.parent='" . $myrow2['stkcode'] . "'"; + $ErrMsg = _('Could not retrieve the components of the ordered assembly item'); + $AssemblyResult = DB_query($sql,$db,$ErrMsg); + $LeftOvers = $pdf->addTextWrap($XPos,$YPos,150,$FontSize, _('Assembly Components:-')); + $YPos -= ($line_height); + /*Loop around all the components of the assembly and list the quantity supplied */ + while ($ComponentRow=DB_fetch_array($AssemblyResult)){ + $DisplayQtySupplied = number_format($ComponentRow['quantity']*($myrow2['quantity'] - $myrow2['qtyinvoiced']),$ComponentRow['decimalplaces']); + $LeftOvers = $pdf->addTextWrap($XPos,$YPos,127,$FontSize,$ComponentRow['component']); + $LeftOvers = $pdf->addTextWrap(147,$YPos,255,$FontSize,$ComponentRow['description']); + $LeftOvers = $pdf->addTextWrap(503,$YPos,85,$FontSize,$DisplayQtySupplied,'right'); + if ($YPos-$line_height <= 50){ + /* We reached the end of the page so finsih off the page and start a newy */ + $PageNumber++; + include ('includes/PDFOrderPageHeader_generic.inc'); + } //end if need a new page headed up + else{ + /*increment a line down for the next line item */ + $YPos -= ($line_height); + } + } //loop around all the components of the assembly + } } //end while there are line items to print out } /*end if there are order details to show on the order*/ @@ -172,18 +234,21 @@ } /*end for loop to print the whole lot twice */ -if ($ListCount == 0) { //UldisN - $title = _('Print Packing Slip Error'); - include('includes/header.inc'); - echo '<p>'. _('There were no outstanding items on the order to deliver') . '. ' . _('A packing slip cannot be printed'). - '<br /><a href="' . $rootpath . '/SelectSalesOrder.php">'. _('Print Another Packing Slip/Order'). - '</a>' . '<br />'. '<a href="' . $rootpath . '/index.php">' . _('Back to the menu') . '</a>'; - include('includes/footer.inc'); +if ($ListCount == 0) { + $title = _('Print Packing Slip Error'); + include('includes/header.inc'); + echo '<p>'. _('There were no outstanding items on the order to deliver') . '. ' . _('A packing slip cannot be printed'). + '<br /><a href="' . $rootpath . '/SelectSalesOrder.php">'. _('Print Another Packing Slip/Order'). + '</a> + <br /><a href="' . $rootpath . '/index.php">' . _('Back to the menu') . '</a>'; + include('includes/footer.inc'); exit; } else { - $pdf->OutputD($_SESSION['DatabaseName'] . '_PackingSlip_' . date('Y-m-d') . '.pdf');//UldisN - $pdf->__destruct(); //UldisN - $sql = "UPDATE salesorders SET printedpackingslip=1, datepackingslipprinted='" . Date('Y-m-d') . "' WHERE salesorders.orderno='" .$_GET['TransNo'] . "'"; + $pdf->OutputD($_SESSION['DatabaseName'] . '_PackingSlip_' . date('Y-m-d') . '.pdf'); + $pdf->__destruct(); + $sql = "UPDATE salesorders SET printedpackingslip=1, + datepackingslipprinted='" . Date('Y-m-d') . "' + WHERE salesorders.orderno='" .$_GET['TransNo'] . "'"; $result = DB_query($sql,$db); } Modified: trunk/doc/Change.log =================================================================== --- trunk/doc/Change.log 2011-06-27 10:30:19 UTC (rev 4608) +++ trunk/doc/Change.log 2011-06-28 10:12:27 UTC (rev 4609) @@ -1,6 +1,8 @@ webERP Change Log -27/6/11 Exson: MRP>php fixed modulus arithmetic that prevented suggesting production quantities where the quantity was less than 1 - the calculation using PanSize should round up to the nearest whole unit to manufacture +28/6/11 Phil: Make assembly items explode into components on packing slips PrintCustOrder_generic.php +28/6/11 Exson: MRPDemands.php links missing ? now fixed - script fixed for quoting variable name CamelCasing +27/6/11 Exson: MRP.php fixed modulus arithmetic that prevented suggesting production quantities where the quantity was less than 1 - the calculation using PanSize should round up to the nearest whole unit to manufacture 26/6/11 Phil: Fixed reference to $_POST['StockID'] in WorkOrderCosting.php when updating the new weighted average cost 26/6/11 Phil: Went back to no number_formatting on PurchData.php 26/6/11 Phil: Went back to no number_formatting on PO_Items.php price and quantity - Brian May still reporting issues This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |