From: <tim...@us...> - 2010-07-11 20:59:37
|
Revision: 3606 http://web-erp.svn.sourceforge.net/web-erp/?rev=3606&view=rev Author: tim_schofield Date: 2010-07-11 20:59:31 +0000 (Sun, 11 Jul 2010) Log Message: ----------- Layout changes, sql quoting fixed Modified Paths: -------------- trunk/InventoryPlanningPrefSupplier.php trunk/doc/Change.log.html Modified: trunk/InventoryPlanningPrefSupplier.php =================================================================== --- trunk/InventoryPlanningPrefSupplier.php 2010-07-11 20:59:10 UTC (rev 3605) +++ trunk/InventoryPlanningPrefSupplier.php 2010-07-11 20:59:31 UTC (rev 3606) @@ -10,7 +10,7 @@ $Counter++; } $Average = $Total/$Counter; - + $TotalDifferenceSquared =0; foreach ($Data as $Element){ $TotalDifferenceSquared += (($Element-$Average) * ($Element-$Average)); @@ -20,7 +20,7 @@ function NewPageHeader () { global $PageNumber, - $pdf, + $pdf, $YPos, $Page_Height, $Page_Width, @@ -30,7 +30,7 @@ $Right_Margin, $SupplierName, $line_height; - + /*PDF page header for inventory planning report */ if ($PageNumber > 1){ @@ -46,7 +46,7 @@ $FontSize=10; - $ReportTitle = _('Preferred Supplier Inventory Plan') . ' ' . $SupplerName; + $ReportTitle = _('Preferred Supplier Inventory Plan'); if ($_POST['Location']=='All'){ @@ -149,9 +149,9 @@ /*Now figure out the inventory data to report for the category range under review need QOH, QOO, QDem, Sales Mth -1, Sales Mth -2, Sales Mth -3, Sales Mth -4*/ - + if ($_POST['Location']=='All'){ - + $SQL = "SELECT stockmaster.description, stockmaster.eoq, locstock.stockid, @@ -168,17 +168,17 @@ AND (stockmaster.mbflag='B' OR stockmaster.mbflag='M') AND purchdata.stockid=stockmaster.stockid AND purchdata.preferred=1 - GROUP BY + GROUP BY purchdata.supplierno, stockmaster.description, stockmaster.eoq, locstock.stockid ORDER BY purchdata.supplierno, - stockmaster.stockid"; - + stockmaster.stockid"; + } else { - - $SQL = "SELECT + + $SQL = "SELECT stockmaster.description, stockmaster.eoq, purchdata.supplierno, @@ -197,9 +197,9 @@ AND locstock.loccode = '" . $_POST['Location'] . "' AND purchdata.preferred=1 ORDER BY purchdata.supplierno, - stockmaster.stockid"; - + stockmaster.stockid"; + } $InventoryResult = DB_query($SQL, $db, '', '', false, false); $ListCount = DB_num_rows($InventoryResult); @@ -215,7 +215,7 @@ include('includes/footer.inc'); exit; } - + NewPageHeader(); $SupplierID = ''; @@ -246,23 +246,23 @@ if ($_POST['Location']=='All'){ - $SQL = 'SELECT SUM(CASE WHEN (prd>=' . $Period_1 . ' OR - prd<=' . $Period_4 . ') THEN -qty ELSE 0 END) AS 4mthtotal, - SUM(CASE WHEN prd=' . $Period_1 . ' THEN -qty ELSE 0 END) AS prd1, - SUM(CASE WHEN prd=' . $Period_2 . ' THEN -qty ELSE 0 END) AS prd2, - SUM(CASE WHEN prd=' . $Period_3 . ' THEN -qty ELSE 0 END) AS prd3, - SUM(CASE WHEN prd=' . $Period_4 . " THEN -qty ELSE 0 END) AS prd4 + $SQL = "SELECT SUM(CASE WHEN (prd>='" . $Period_1 . "' OR + prd<='" . $Period_4 . "') THEN -qty ELSE 0 END) AS 4mthtotal, + SUM(CASE WHEN prd='" . $Period_1 . "' THEN -qty ELSE 0 END) AS prd1, + SUM(CASE WHEN prd='" . $Period_2 . "' THEN -qty ELSE 0 END) AS prd2, + SUM(CASE WHEN prd='" . $Period_3 . "' THEN -qty ELSE 0 END) AS prd3, + SUM(CASE WHEN prd='" . $Period_4 . "' THEN -qty ELSE 0 END) AS prd4 FROM stockmoves WHERE stockid='" . $InventoryPlan['stockid'] . "' AND (type=10 OR type=11) AND stockmoves.hidemovt=0"; } else { - $SQL = 'SELECT SUM(CASE WHEN (prd>=' . $Period_1 . ' OR - prd<=' . $Period_4 . ') THEN -qty ELSE 0 END) AS 4mthtotal, - SUM(CASE WHEN prd=' . $Period_1 . ' THEN -qty ELSE 0 END) AS prd1, - SUM(CASE WHEN prd=' . $Period_2 . ' THEN -qty ELSE 0 END) AS prd2, - SUM(CASE WHEN prd=' . $Period_3 . ' THEN -qty ELSE 0 END) AS prd3, - SUM(CASE WHEN prd=' . $Period_4 . " THEN -qty ELSE 0 END) AS prd4 + $SQL = "SELECT SUM(CASE WHEN (prd>='" . $Period_1 . "' OR + prd<='" . $Period_4 . "') THEN -qty ELSE 0 END) AS 4mthtotal, + SUM(CASE WHEN prd='" . $Period_1 . "' THEN -qty ELSE 0 END) AS prd1, + SUM(CASE WHEN prd='" . $Period_2 . "' THEN -qty ELSE 0 END) AS prd2, + SUM(CASE WHEN prd='" . $Period_3 . "' THEN -qty ELSE 0 END) AS prd3, + SUM(CASE WHEN prd='" . $Period_4 . "' THEN -qty ELSE 0 END) AS prd4 FROM stockmoves WHERE stockid='" . $InventoryPlan['stockid'] . "' AND stockmoves.loccode ='" . $_POST['Location'] . "' @@ -401,18 +401,18 @@ $LeftOvers = $pdf->addTextWrap(100, $YPos, 150,6,$InventoryPlan['description'],'left'); $AverageOfLast4Months = $SalesRow['4mthtotal']/4; $LeftOvers = $pdf->addTextWrap(251, $YPos, 50,$FontSize,number_format($AverageOfLast4Months,1),'right'); - + $MaxMthSales = Max($SalesRow['prd1'], $SalesRow['prd2'], $SalesRow['prd3'], $SalesRow['prd4']); $LeftOvers = $pdf->addTextWrap(309, $YPos, 50,$FontSize,number_format($MaxMthSales,0),'right'); - + $Quantities = array($SalesRow['prd1'], $SalesRow['prd2'], $SalesRow['prd3'], $SalesRow['prd4']); $StandardDeviation = standard_deviation($Quantities); $LeftOvers = $pdf->addTextWrap(359, $YPos, 50,$FontSize,number_format($StandardDeviation,2),'right'); - + $LeftOvers = $pdf->addTextWrap(409, $YPos, 50,$FontSize,number_format($InventoryPlan['monthsleadtime'],1),'right'); - + $RequiredStockInSupplyChain = $AverageOfLast4Months * ($_POST['NumberMonthsHolding']+$InventoryPlan['monthsleadtime']); - + $LeftOvers = $pdf->addTextWrap(456, $YPos, 50,$FontSize,number_format($RequiredStockInSupplyChain,0),'right'); $LeftOvers = $pdf->addTextWrap(597, $YPos, 40,$FontSize,number_format($InventoryPlan['qoh'],0),'right'); $LeftOvers = $pdf->addTextWrap(638, $YPos, 40,$FontSize,number_format($TotalDemand,0),'right'); @@ -456,12 +456,13 @@ $title=_('Preferred Supplier Inventory Planning'); include('includes/header.inc'); - - echo "<form action='" . $_SERVER['PHP_SELF'] . '?' . SID . "' method='POST'><table>"; + echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/inventory.png" title="' . _('Search') . '" alt="">' . ' ' . $title.'<br>'; + echo "<form action='" . $_SERVER['PHP_SELF'] . '?' . SID . "' method='POST'><table class=selection>"; + echo '<tr><td>' . _('For Inventory in Location') . ':</td><td><select name="Location">'; - $sql = 'SELECT loccode, locationname FROM locations'; + $sql = "SELECT loccode, locationname FROM locations"; $LocnResult=DB_query($sql,$db); echo '<option Value="All">' . _('All Locations'); @@ -473,7 +474,7 @@ echo '<tr><td>' . _('Months Buffer Stock to Hold') . ':</td> <td><select name="NumberMonthsHolding">'; - + if (!isset($_POST['NumberMonthsHolding'])){ $_POST['NumberMonthsHolding']=1; } @@ -499,8 +500,8 @@ } echo '</select></td></tr>'; - echo '</table><div class="centre"><input type=submit Name="PrintPDF" Value="' . _('Print PDF') . '"></div>'; + echo '</table><br><div class="centre"><input type=submit Name="PrintPDF" Value="' . _('Print PDF') . '"></div>'; include('includes/footer.inc'); } /*end of else not PrintPDF */ -?> +?> \ No newline at end of file Modified: trunk/doc/Change.log.html =================================================================== --- trunk/doc/Change.log.html 2010-07-11 20:59:10 UTC (rev 3605) +++ trunk/doc/Change.log.html 2010-07-11 20:59:31 UTC (rev 3606) @@ -1,5 +1,6 @@ <p><font SIZE=4 COLOR=BLUE><b>webERP Change Log</b></font></p> <p></p> +<p>11/07/10 Tim: InventoryPlanningPrefSupplier.php - Layout changes, sql quoting fixed</p> <p>11/07/10 Tim: InventoryPlanning.php - Layout changes, sql quoting fixed</p> <p>11/07/10 Tim: Goods Receiving - Fix conversion factor bug, layout changes, sql quoting fixed</p> <p>11/07/10 Tim: DefineCartClass.php - Fix typo in variable declaration</p> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <tim...@us...> - 2010-07-11 20:59:56
|
Revision: 3607 http://web-erp.svn.sourceforge.net/web-erp/?rev=3607&view=rev Author: tim_schofield Date: 2010-07-11 20:59:50 +0000 (Sun, 11 Jul 2010) Log Message: ----------- Bug fixes, layout changes, sql quoting fixed Modified Paths: -------------- trunk/InventoryQuantities.php trunk/doc/Change.log.html Modified: trunk/InventoryQuantities.php =================================================================== --- trunk/InventoryQuantities.php 2010-07-11 20:59:31 UTC (rev 3606) +++ trunk/InventoryQuantities.php 2010-07-11 20:59:50 UTC (rev 3607) @@ -27,9 +27,9 @@ $myrow = DB_fetch_row($result); $catdescription = $myrow[1]; } - + if ($_POST['Selection'] == 'All') { - $sql = 'SELECT locstock.stockid, + $sql = "SELECT locstock.stockid, stockmaster.description, locstock.loccode, locations.locationname, @@ -38,19 +38,19 @@ stockmaster.decimalplaces, stockmaster.serialised, stockmaster.controlled - FROM locstock, - stockmaster, + FROM locstock, + stockmaster, locations - WHERE locstock.stockid=stockmaster.stockid ' . - "AND locstock.loccode=locations.loccode + WHERE locstock.stockid=stockmaster.stockid + AND locstock.loccode=locations.loccode AND locstock.quantity <> 0 AND (stockmaster.mbflag='B' OR stockmaster.mbflag='M') " . - $wherecategory . ' ORDER BY locstock.stockid,locstock.loccode'; + $wherecategory . " ORDER BY locstock.stockid,locstock.loccode"; } else { // sql to only select parts in more than one location // The SELECT statement at the beginning of the WHERE clause limits the selection to // parts with quantity in more than one location - $sql = 'SELECT locstock.stockid, + $sql = "SELECT locstock.stockid, stockmaster.description, locstock.loccode, locations.locationname, @@ -59,22 +59,22 @@ stockmaster.decimalplaces, stockmaster.serialised, stockmaster.controlled - FROM locstock, - stockmaster, + FROM locstock, + stockmaster, locations - WHERE (SELECT count(*) + WHERE (SELECT count(*) FROM locstock WHERE stockmaster.stockid = locstock.stockid AND locstock.quantity <> 0 - GROUP BY locstock.stockid) > 1 - AND locstock.stockid=stockmaster.stockid ' . - "AND locstock.loccode=locations.loccode + GROUP BY locstock.stockid) > 1 + AND locstock.stockid=stockmaster.stockid + AND locstock.loccode=locations.loccode AND locstock.quantity <> 0 AND (stockmaster.mbflag='B' OR stockmaster.mbflag='M') " . - $wherecategory . ' ORDER BY locstock.stockid,locstock.loccode'; + $wherecategory . " ORDER BY locstock.stockid,locstock.loccode"; } - - + + $result = DB_query($sql,$db,'','',false,true); if (DB_error_no($db) !=0) { @@ -110,20 +110,19 @@ } else { $YPos -=($line_height); } - + // Parameters for addTextWrap are defined in /includes/class.pdf.php // 1) X position 2) Y position 3) Width // 4) Height 5) Text 6) Alignment 7) Border 8) Fill - True to use SetFillColor // and False to set to transparent - $pdf->addTextWrap(50,$YPos,100,$FontSize,$myrow['stockid'],'',0,$fill); - $pdf->addTextWrap(150,$YPos,150,$FontSize,$myrow['description'],'',0,$fill); - $pdf->addTextWrap(310,$YPos,60,$FontSize,$myrow['loccode'],'left',0,$fill); + $pdf->addTextWrap(50,$YPos,100,$FontSize,$myrow['stockid'],'',0); + $pdf->addTextWrap(150,$YPos,150,$FontSize,$myrow['description'],'',0); + $pdf->addTextWrap(310,$YPos,60,$FontSize,$myrow['loccode'],'left',0); $pdf->addTextWrap(370,$YPos,50,$FontSize,number_format($myrow['quantity'], - $myrow['decimalplaces']),'right',0,$fill); - $pdf->addTextWrap(420,$YPos,50,$FontSize,number_format($myrow['ReorderLevel'], - $myrow['decimalplaces']),'right',0,$fill); - $pdf->addTextWrap(480,$YPos,60,$FontSize,$myrow['loccount'],'left',0,$fill); + $myrow['decimalplaces']),'right',0); + $pdf->addTextWrap(420,$YPos,50,$FontSize,number_format($myrow['reorderlevel'], + $myrow['decimalplaces']),'right',0); if ($YPos < $Bottom_Margin + $line_height){ PrintHeader($pdf,$YPos,$PageNumber,$Page_Height,$Top_Margin,$Left_Margin,$Page_Width, @@ -136,7 +135,7 @@ $Right_Margin,$catdescription); } /*Print out the grand totals */ - + $pdf->OutputD($_SESSION['DatabaseName'] . '_Inventory_Quantities_' . Date('Y-m-d') . '.pdf'); $pdf->__destruct(); } else { /*The option to print PDF was not hit so display form */ @@ -148,13 +147,13 @@ echo '</br></br><form action=' . $_SERVER['PHP_SELF'] . " method='post'><table>"; - echo '<table><tr><td>'; + echo '<table class=selection><tr><td>'; echo '<tr><td>' . _('Selection') . ":</td><td><select name='Selection'>"; echo "<option selected value='All'>" . _('All'); echo "<option value='Multiple'>" . _('Only Parts With Multiple Locations'); echo '</select></td></tr>'; - - $SQL='SELECT categoryid, categorydescription FROM stockcategory ORDER BY categorydescription'; + + $SQL="SELECT categoryid, categorydescription FROM stockcategory ORDER BY categorydescription"; $result1 = DB_query($SQL,$db); if (DB_num_rows($result1)==0){ echo '</table></td></tr> @@ -165,7 +164,7 @@ include ('includes/footer.inc'); exit; } - + echo '<tr><td>' . _('In Stock Category') . ':</td><td><select name="StockCat">'; if (!isset($_POST['StockCat'])){ $_POST['StockCat']='All'; @@ -183,7 +182,7 @@ } } echo '</select></td></tr>'; - echo "</table></br><div class='centre'><input type=submit name='PrintPDF' value='" . _('Print PDF') . "'></div>"; + echo "</table><p><div class='centre'><input type=submit name='PrintPDF' value='" . _('Print PDF') . "'></div>"; include('includes/footer.inc'); @@ -199,23 +198,23 @@ $line_height=12; $FontSize=9; $YPos= $Page_Height-$Top_Margin; - + $pdf->addTextWrap($Left_Margin,$YPos,300,$FontSize,$_SESSION['CompanyRecord']['coyname']); - + $YPos -=$line_height; - - $pdf->addTextWrap($Left_Margin,$YPos,150,$FontSize,_('Inventory Quantities Report')); - $pdf->addTextWrap($Page_Width-$Right_Margin-150,$YPos,160,$FontSize,_('Printed') . ': ' . + + $pdf->addTextWrap($Left_Margin,$YPos,150,$FontSize,_('Inventory Quantities Report')); + $pdf->addTextWrap($Page_Width-$Right_Margin-150,$YPos,160,$FontSize,_('Printed') . ': ' . Date($_SESSION['DefaultDateFormat']) . ' ' . _('Page') . ' ' . $PageNumber,'left'); $YPos -= $line_height; $pdf->addTextWrap($Left_Margin,$YPos,50,$FontSize,_('Category')); $pdf->addTextWrap(95,$YPos,50,$FontSize,$_POST['StockCat']); $pdf->addTextWrap(160,$YPos,150,$FontSize,$catdescription,'left'); $YPos -=(2*$line_height); - + /*set up the headings */ $Xpos = $Left_Margin+1; - + $pdf->addTextWrap(50,$YPos,100,$FontSize,_('Part Number'), 'left'); $pdf->addTextWrap(150,$YPos,150,$FontSize,_('Description'), 'left'); $pdf->addTextWrap(310,$YPos,60,$FontSize,_('Location'), 'left'); @@ -229,4 +228,4 @@ // $YPos =$YPos - (2*$line_height); $PageNumber++; } // End of PrintHeader() function -?> +?> \ No newline at end of file Modified: trunk/doc/Change.log.html =================================================================== --- trunk/doc/Change.log.html 2010-07-11 20:59:31 UTC (rev 3606) +++ trunk/doc/Change.log.html 2010-07-11 20:59:50 UTC (rev 3607) @@ -1,5 +1,6 @@ <p><font SIZE=4 COLOR=BLUE><b>webERP Change Log</b></font></p> <p></p> +<p>11/07/10 Tim: InventoryPlanningPrefSupplier.php - Bug fixes, layout changes, sql quoting fixed</p> <p>11/07/10 Tim: InventoryPlanningPrefSupplier.php - Layout changes, sql quoting fixed</p> <p>11/07/10 Tim: InventoryPlanning.php - Layout changes, sql quoting fixed</p> <p>11/07/10 Tim: Goods Receiving - Fix conversion factor bug, layout changes, sql quoting fixed</p> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <tim...@us...> - 2010-07-11 21:00:24
|
Revision: 3608 http://web-erp.svn.sourceforge.net/web-erp/?rev=3608&view=rev Author: tim_schofield Date: 2010-07-11 21:00:18 +0000 (Sun, 11 Jul 2010) Log Message: ----------- Layout changes Modified Paths: -------------- trunk/InventoryValuation.php trunk/doc/Change.log.html Modified: trunk/InventoryValuation.php =================================================================== --- trunk/InventoryValuation.php 2010-07-11 20:59:50 UTC (rev 3607) +++ trunk/InventoryValuation.php 2010-07-11 21:00:18 UTC (rev 3608) @@ -6,7 +6,7 @@ $PageSecurity = 2; include('includes/session.inc'); -If (isset($_POST['PrintPDF']) +if (isset($_POST['PrintPDF']) AND isset($_POST['FromCriteria']) AND strlen($_POST['FromCriteria'])>=1 AND isset($_POST['ToCriteria']) @@ -20,7 +20,7 @@ $PageNumber=1; $line_height=12; - /*Now figure out the inventory data to report for the category range under review */ + /*Now figure out the inventory data to report for the category range under review */ if ($_POST['Location']=='All'){ $SQL = "SELECT stockmaster.categoryid, stockcategory.categorydescription, @@ -78,7 +78,7 @@ prnMsg( _('The inventory valuation could not be retrieved by the SQL because') . ' ' . DB_error_msg($db),'error'); echo "<br><a href='" .$rootpath .'/index.php?' . SID . "'>" . _('Back to the menu') . '</a>'; if ($debug==1){ - echo "<br>$SQL"; + echo "<br>$SQL"; } include('includes/footer.inc'); exit; @@ -87,19 +87,19 @@ $title = _('Print Inventory Valuation Error'); include('includes/header.inc'); prnMsg(_('There were no items with any value to print out for the location specified'),'info'); - echo "<br><a href='$rootpath/index.php?" . SID . "'>" . _('Back to the menu') . '</a>'; + echo "<br><a href='" . $rootpath . "/index.php?" . SID . "'>" . _('Back to the menu') . '</a>'; include('includes/footer.inc'); - exit; - } + exit; + } include ('includes/PDFInventoryValnPageHeader.inc'); - $Tot_Val=0; + $Tot_Val=0; $Category = ''; $CatTot_Val=0; - $CatTot_Qty=0; + $CatTot_Qty=0; - While ($InventoryValn = DB_fetch_array($InventoryResult,$db)){ + while ($InventoryValn = DB_fetch_array($InventoryResult,$db)){ if ($Category!=$InventoryValn['categoryid']){ $FontSize=10; @@ -116,9 +116,9 @@ $DisplayCatTotVal = number_format($CatTot_Val,2); $DisplayCatTotQty = number_format($CatTot_Qty,0); - $LeftOvers = $pdf->addTextWrap(500,$YPos,60,$FontSize,$DisplayCatTotVal, 'right'); - $LeftOvers = $pdf->addTextWrap(380,$YPos,60,$FontSize,$DisplayCatTotQty, 'right'); - $YPos -=$line_height; + $LeftOvers = $pdf->addTextWrap(500,$YPos,60,$FontSize,$DisplayCatTotVal, 'right'); + $LeftOvers = $pdf->addTextWrap(380,$YPos,60,$FontSize,$DisplayCatTotQty, 'right'); + $YPos -=$line_height; If ($_POST['DetailedReport']=='Yes'){ /*draw a line under the CATEGORY TOTAL*/ @@ -126,7 +126,7 @@ $YPos -=(2*$line_height); } $CatTot_Val=0; - $CatTot_Qty=0; + $CatTot_Qty=0; } $LeftOvers = $pdf->addTextWrap($Left_Margin,$YPos,260-$Left_Margin,$FontSize,$InventoryValn['categoryid'] . ' - ' . $InventoryValn['categorydescription']); $Category = $InventoryValn['categoryid']; @@ -137,7 +137,7 @@ $YPos -=$line_height; $FontSize=8; - $LeftOvers = $pdf->addTextWrap($Left_Margin,$YPos,100,$FontSize,$InventoryValn['stockid']); + $LeftOvers = $pdf->addTextWrap($Left_Margin,$YPos,100,$FontSize,$InventoryValn['stockid']); $LeftOvers = $pdf->addTextWrap(170,$YPos,220,$FontSize,$InventoryValn['description']); $DisplayUnitCost = number_format($InventoryValn['unitcost'],2); $DisplayQtyOnHand = number_format($InventoryValn['qtyonhand'],0); @@ -151,7 +151,7 @@ } $Tot_Val += $InventoryValn['itemtotal']; $CatTot_Val += $InventoryValn['itemtotal']; - $CatTot_Qty += $InventoryValn['qtyonhand']; + $CatTot_Qty += $InventoryValn['qtyonhand']; if ($YPos < $Bottom_Margin + $line_height){ include('includes/PDFInventoryValnPageHeader.inc'); @@ -166,9 +166,9 @@ $LeftOvers = $pdf->addTextWrap($Left_Margin,$YPos,260-$Left_Margin,$FontSize, _('Total for') . ' ' . $Category . ' - ' . $CategoryName, 'left'); } $DisplayCatTotVal = number_format($CatTot_Val,2); - $LeftOvers = $pdf->addTextWrap(500,$YPos,60,$FontSize,$DisplayCatTotVal, 'right'); + $LeftOvers = $pdf->addTextWrap(500,$YPos,60,$FontSize,$DisplayCatTotVal, 'right'); $DisplayCatTotQty = number_format($CatTot_Qty,0); - $LeftOvers = $pdf->addTextWrap(380,$YPos,60,$FontSize,$DisplayCatTotQty, 'right'); + $LeftOvers = $pdf->addTextWrap(380,$YPos,60,$FontSize,$DisplayCatTotQty, 'right'); If ($_POST['DetailedReport']=='Yes'){ /*draw a line under the CATEGORY TOTAL*/ @@ -184,7 +184,7 @@ /*Print out the grand totals */ $LeftOvers = $pdf->addTextWrap(80,$YPos,260-$Left_Margin,$FontSize,_('Grand Total Value'), 'right'); $DisplayTotalVal = number_format($Tot_Val,2); - $LeftOvers = $pdf->addTextWrap(500,$YPos,60,$FontSize,$DisplayTotalVal, 'right'); + $LeftOvers = $pdf->addTextWrap(500,$YPos,60,$FontSize,$DisplayTotalVal, 'right'); $pdf->OutputD($_SESSION['DatabaseName'] . '_Inventory_Valuation_' . Date('Y-m-d') . '.pdf'); $pdf->__destruct(); @@ -198,8 +198,10 @@ if (empty($_POST['FromCriteria']) or empty($_POST['ToCriteria'])) { /*if $FromCriteria is not set then show a form to allow input */ + echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/inventory.png" title="' . + _('Inventory') . '" alt="">' . ' ' . $title . ''; - echo '<form action=' . $_SERVER['PHP_SELF'] . " method='POST'><table>"; + echo '<form action=' . $_SERVER['PHP_SELF'] . " method='POST'><table class=selection>"; echo '<tr><td>' . _('From Inventory Category Code') . ':</font></td><td><select name=FromCriteria>'; @@ -227,8 +229,8 @@ echo "<option value='All'>" . _('All Locations'); while ($myrow=DB_fetch_array($LocnResult)){ - echo "<option Value='" . $myrow['loccode'] . "'>" . $myrow['locationname']; - } + echo "<option Value='" . $myrow['loccode'] . "'>" . $myrow['locationname']; + } echo '</select></td></tr>'; echo '<tr><td>' . _('Summary or Detailed Report') . ":</td><td><select name='DetailedReport'>"; @@ -236,10 +238,10 @@ echo "<option Value='Yes'>" . _('Detailed Report'); echo '</select></td></tr>'; - echo "</table><div class='centre'><input type=Submit Name='PrintPDF' Value='" . _('Print PDF') . "'></div>"; + echo "</table><br><div class='centre'><input type=Submit Name='PrintPDF' Value='" . _('Print PDF') . "'></div>"; } include('includes/footer.inc'); } /*end of else not PrintPDF */ -?> +?> \ No newline at end of file Modified: trunk/doc/Change.log.html =================================================================== --- trunk/doc/Change.log.html 2010-07-11 20:59:50 UTC (rev 3607) +++ trunk/doc/Change.log.html 2010-07-11 21:00:18 UTC (rev 3608) @@ -1,5 +1,6 @@ <p><font SIZE=4 COLOR=BLUE><b>webERP Change Log</b></font></p> <p></p> +<p>11/07/10 Tim: InventoryValuation.php - Layout changes</p> <p>11/07/10 Tim: InventoryPlanningPrefSupplier.php - Bug fixes, layout changes, sql quoting fixed</p> <p>11/07/10 Tim: InventoryPlanningPrefSupplier.php - Layout changes, sql quoting fixed</p> <p>11/07/10 Tim: InventoryPlanning.php - Layout changes, sql quoting fixed</p> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <tim...@us...> - 2010-07-12 09:02:09
|
Revision: 3609 http://web-erp.svn.sourceforge.net/web-erp/?rev=3609&view=rev Author: tim_schofield Date: 2010-07-12 09:02:03 +0000 (Mon, 12 Jul 2010) Log Message: ----------- Correct conversion factor bug Modified Paths: -------------- trunk/PDFGrn.php trunk/doc/Change.log.html Modified: trunk/PDFGrn.php =================================================================== --- trunk/PDFGrn.php 2010-07-11 21:00:18 UTC (rev 3608) +++ trunk/PDFGrn.php 2010-07-12 09:02:03 UTC (rev 3609) @@ -91,6 +91,7 @@ $uomresult=DB_query($sql, $db); $uomrow=DB_fetch_array($uomresult); $units=$uomrow['units']; + $myrow2['conversionfactor']=1; } else { $units=$myrow2['unitname']; } Modified: trunk/doc/Change.log.html =================================================================== --- trunk/doc/Change.log.html 2010-07-11 21:00:18 UTC (rev 3608) +++ trunk/doc/Change.log.html 2010-07-12 09:02:03 UTC (rev 3609) @@ -1,5 +1,6 @@ <p><font SIZE=4 COLOR=BLUE><b>webERP Change Log</b></font></p> <p></p> +<p>12/07/10 Tim: PDFGrn.php - Correct conversion factor bug</p> <p>11/07/10 Tim: InventoryValuation.php - Layout changes</p> <p>11/07/10 Tim: InventoryPlanningPrefSupplier.php - Bug fixes, layout changes, sql quoting fixed</p> <p>11/07/10 Tim: InventoryPlanningPrefSupplier.php - Layout changes, sql quoting fixed</p> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <tim...@us...> - 2010-07-12 18:38:33
|
Revision: 3610 http://web-erp.svn.sourceforge.net/web-erp/?rev=3610&view=rev Author: tim_schofield Date: 2010-07-12 18:38:26 +0000 (Mon, 12 Jul 2010) Log Message: ----------- Bug Fixes, Layout changes, sql quoting corrections Modified Paths: -------------- trunk/Locations.php trunk/doc/Change.log.html Modified: trunk/Locations.php =================================================================== --- trunk/Locations.php 2010-07-12 09:02:03 UTC (rev 3609) +++ trunk/Locations.php 2010-07-12 18:38:26 UTC (rev 3610) @@ -18,7 +18,7 @@ } if (isset($_POST['submit'])) { - + $_POST['Managed']='off'; //initialise no input errors assumed initially before we test $InputError = 0; @@ -40,10 +40,11 @@ $arr = explode('-',$_POST['CashSaleCustomer']); $DebtorNo = $arr[0]; $Branch = $arr[1]; - - $sql = "SELECT * FROM custbranch WHERE debtorno='" . $DebtorNo . "' - AND branchcode='" . $Branch . "'"; - + + $sql = "SELECT * FROM custbranch + WHERE debtorno='" . $DebtorNo . "' + AND branchcode='" . $Branch . "'"; + // echo $sql; $result = DB_query($sql,$db); if (DB_num_rows($result)==0){ @@ -52,8 +53,8 @@ } } } //end of checking the customer - branch code entered - + if (isset($SelectedLocation) AND $InputError !=1) { /* Set the managed field to 1 if it is checked, otherwise 0 */ @@ -76,10 +77,10 @@ fax='" . $_POST['Fax'] . "', email='" . $_POST['Email'] . "', contact='" . $_POST['Contact'] . "', - taxprovinceid = " . $_POST['TaxProvince'] . ", + taxprovinceid = '" . $_POST['TaxProvince'] . "', cashsalecustomer ='" . $_POST['CashSaleCustomer'] . "', - managed = " . $_POST['Managed'] . " - WHERE loccode = '$SelectedLocation'"; + managed = '" . $_POST['Managed'] . "' + WHERE loccode = '" . $SelectedLocation . "'"; $ErrMsg = _('An error occurred updating the') . ' ' . $SelectedLocation . ' ' . _('location record because'); $DbgMsg = _('The SQL used to update the location record was'); @@ -146,13 +147,13 @@ '" . $_POST['Fax'] . "', '" . $_POST['Email'] . "', '" . $_POST['Contact'] . "', - " . $_POST['TaxProvince'] . ", + '" . $_POST['TaxProvince'] . "', '" . $_POST['CashSaleCustomer'] . "', - " . $_POST['Managed'] . " + '" . $_POST['Managed'] . "' )"; $ErrMsg = _('An error occurred inserting the new location record because'); - $Dbgmsg = _('The SQL used to insert the location record was'); + $DbgMsg = _('The SQL used to insert the location record was'); $result = DB_query($sql,$db,$ErrMsg,$DbgMsg); prnMsg( _('The new location record has been added'),'success'); @@ -174,7 +175,7 @@ $DbgMsg = _('The SQL used to insert the new stock location records was'); $result = DB_query($sql,$db,$ErrMsg, $DbgMsg); - echo '<br>........ ' . _('and new stock locations inserted for all existing stock items for the new location'); + prnMsg ('........ ' . _('and new stock locations inserted for all existing stock items for the new location'), 'success'); unset($_POST['LocCode']); unset($_POST['LocationName']); unset($_POST['DelAdd1']); @@ -197,31 +198,31 @@ /* Go through the tax authorities for all Locations deleting or adding TaxAuthRates records as necessary */ - $result = DB_query('SELECT COUNT(taxid) FROM taxauthorities',$db); + $result = DB_query("SELECT COUNT(taxid) FROM taxauthorities",$db); $NoTaxAuths =DB_fetch_row($result); - $DispTaxProvincesResult = DB_query('SELECT taxprovinceid FROM locations',$db); - $TaxCatsResult = DB_query('SELECT taxcatid FROM taxcategories',$db); + $DispTaxProvincesResult = DB_query("SELECT taxprovinceid FROM locations",$db); + $TaxCatsResult = DB_query("SELECT taxcatid FROM taxcategories",$db); if (DB_num_rows($TaxCatsResult) > 0 ) { // This will only work if there are levels else we get an error on seek. while ($myrow=DB_fetch_row($DispTaxProvincesResult)){ /*Check to see there are TaxAuthRates records set up for this TaxProvince */ - $NoTaxRates = DB_query('SELECT taxauthority FROM taxauthrates WHERE dispatchtaxprovince=' . $myrow[0], $db); + $NoTaxRates = DB_query("SELECT taxauthority FROM taxauthrates WHERE dispatchtaxprovince='" . $myrow[0] . "'", $db); if (DB_num_rows($NoTaxRates) < $NoTaxAuths[0]){ /*First off delete any tax authoritylevels already existing */ - $DelTaxAuths = DB_query('DELETE FROM taxauthrates WHERE dispatchtaxprovince=' . $myrow[0],$db); + $DelTaxAuths = DB_query("DELETE FROM taxauthrates WHERE dispatchtaxprovince='" . $myrow[0] . "'",$db); /*Now add the new TaxAuthRates required */ while ($CatRow = DB_fetch_row($TaxCatsResult)){ - $sql = 'INSERT INTO taxauthrates (taxauthority, + $sql = "INSERT INTO taxauthrates (taxauthority, dispatchtaxprovince, taxcatid) SELECT taxid, - ' . $myrow[0] . ', - ' . $CatRow[0] . ' - FROM taxauthorities'; + '" . $myrow[0] . "', + '" . $CatRow[0] . "' + FROM taxauthorities"; $InsTaxAuthRates = DB_query($sql,$db); } @@ -237,7 +238,7 @@ $CancelDelete = 0; // PREVENT DELETES IF DEPENDENT RECORDS - $sql= "SELECT COUNT(*) FROM salesorders WHERE fromstkloc='$SelectedLocation'"; + $sql= "SELECT COUNT(*) FROM salesorders WHERE fromstkloc='". $SelectedLocation . "'"; $result = DB_query($sql,$db); $myrow = DB_fetch_row($result); if ($myrow[0]>0) { @@ -245,7 +246,7 @@ prnMsg( _('Cannot delete this location because sales orders have been created delivering from this location'),'warn'); echo _('There are') . ' ' . $myrow[0] . ' ' . _('sales orders with this Location code'); } else { - $sql= "SELECT COUNT(*) FROM stockmoves WHERE stockmoves.loccode='$SelectedLocation'"; + $sql= "SELECT COUNT(*) FROM stockmoves WHERE stockmoves.loccode='" . $SelectedLocation . "'"; $result = DB_query($sql,$db); $myrow = DB_fetch_row($result); if ($myrow[0]>0) { @@ -254,7 +255,7 @@ echo '<br>' . _('There are') . ' ' . $myrow[0] . ' ' . _('stock movements with this Location code'); } else { - $sql= "SELECT COUNT(*) FROM locstock WHERE locstock.loccode='$SelectedLocation' AND locstock.quantity !=0"; + $sql= "SELECT COUNT(*) FROM locstock WHERE locstock.loccode='". $SelectedLocation . "' AND locstock.quantity !=0"; $result = DB_query($sql,$db); $myrow = DB_fetch_row($result); if ($myrow[0]>0) { @@ -262,7 +263,7 @@ prnMsg(_('Cannot delete this location because location stock records exist that use this location and have a quantity on hand not equal to 0'),'warn'); echo '<br> ' . _('There are') . ' ' . $myrow[0] . ' ' . _('stock items with stock on hand at this location code'); } else { - $sql= "SELECT COUNT(*) FROM www_users WHERE www_users.defaultlocation='$SelectedLocation'"; + $sql= "SELECT COUNT(*) FROM www_users WHERE www_users.defaultlocation='" . $SelectedLocation . "'"; $result = DB_query($sql,$db); $myrow = DB_fetch_row($result); if ($myrow[0]>0) { @@ -270,7 +271,7 @@ prnMsg(_('Cannot delete this location because it is the default location for a user') . '. ' . _('The user record must be modified first'),'warn'); echo '<br> ' . _('There are') . ' ' . $myrow[0] . ' ' . _('users using this location as their default location'); } else { - $sql= "SELECT COUNT(*) FROM bom WHERE bom.loccode='$SelectedLocation'"; + $sql= "SELECT COUNT(*) FROM bom WHERE bom.loccode='" . $SelectedLocation . "'"; $result = DB_query($sql,$db); $myrow = DB_fetch_row($result); if ($myrow[0]>0) { @@ -278,7 +279,7 @@ prnMsg(_('Cannot delete this location because it is the default location for a bill of material') . '. ' . _('The bill of materials must be modified first'),'warn'); echo '<br> ' . _('There are') . ' ' . $myrow[0] . ' ' . _('bom components using this location'); } else { - $sql= "SELECT COUNT(*) FROM workcentres WHERE workcentres.location='$SelectedLocation'"; + $sql= "SELECT COUNT(*) FROM workcentres WHERE workcentres.location='" . $SelectedLocation . "'"; $result = DB_query($sql,$db); $myrow = DB_fetch_row($result); if ($myrow[0]>0) { @@ -286,7 +287,7 @@ prnMsg( _('Cannot delete this location because it is used by some work centre records'),'warn'); echo '<br>' . _('There are') . ' ' . $myrow[0] . ' ' . _('works centres using this location'); } else { - $sql= "SELECT COUNT(*) FROM workorders WHERE workorders.loccode='$SelectedLocation'"; + $sql= "SELECT COUNT(*) FROM workorders WHERE workorders.loccode='" . $SelectedLocation . "'"; $result = DB_query($sql,$db); $myrow = DB_fetch_row($result); if ($myrow[0]>0) { @@ -294,7 +295,7 @@ prnMsg( _('Cannot delete this location because it is used by some work order records'),'warn'); echo '<br>' . _('There are') . ' ' . $myrow[0] . ' ' . _('work orders using this location'); }else { - $sql= "SELECT COUNT(*) FROM custbranch WHERE custbranch.defaultlocation='$SelectedLocation'"; + $sql= "SELECT COUNT(*) FROM custbranch WHERE custbranch.defaultlocation='" . $SelectedLocation . "'"; $result = DB_query($sql,$db); $myrow = DB_fetch_row($result); if ($myrow[0]>0) { @@ -314,11 +315,11 @@ /* need to figure out if this location is the only one in the same tax province */ $result = DB_query("SELECT taxprovinceid FROM locations WHERE loccode='" . $SelectedLocation . "'",$db); $TaxProvinceRow = DB_fetch_row($result); - $result = DB_query("SELECT COUNT(taxprovinceid) FROM locations WHERE taxprovinceid=" .$TaxProvinceRow[0],$db); + $result = DB_query("SELECT COUNT(taxprovinceid) FROM locations WHERE taxprovinceid='" .$TaxProvinceRow[0] . "'",$db); $TaxProvinceCount = DB_fetch_row($result); if ($TaxProvinceCount[0]==1){ /* if its the only location in this tax authority then delete the appropriate records in TaxAuthLevels */ - $result = DB_query('DELETE FROM taxauthrates WHERE dispatchtaxprovince=' . $TaxProvinceRow[0],$db); + $result = DB_query("DELETE FROM taxauthrates WHERE dispatchtaxprovince='" . $TaxProvinceRow[0] . "'",$db); } $result= DB_query("DELETE FROM locstock WHERE loccode ='" . $SelectedLocation . "'",$db); @@ -348,8 +349,10 @@ if (DB_num_rows($result)==0){ prnMsg (_('There are no locations that match up with a tax province record to display. Check that tax provinces are set up for all dispatch locations'),'error'); } + echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/supplier.png" title="' . + _('Inventory') . '" alt="">' . ' ' . $title . ''; - echo '<table border=1>'; + echo '<table class=selection>'; echo '<tr><th>' . _('Location Code') . '</th> <th>' . _('Location Name') . '</th> <th>' . _('Tax Province') . '</th> @@ -395,27 +398,20 @@ //end of ifs and buts! -?> +echo "<p>"; +if (isset($SelectedLocation)) { + echo '<a href="' . $_SERVER['PHP_SELF'] . '">' . _('Review Records') . '</a>'; +} +echo "<p>"; -<p> -<?php -if (isset($SelectedLocation)) { ?> - <div class="centre"><a href="<?php echo $_SERVER['PHP_SELF'];?>"><?php echo _('REVIEW RECORDS'); ?></a></div> -<?php } ?> - -<p> - - -<?php - - - if (!isset($_GET['delete'])) { echo "<form method='post' action='" . $_SERVER['PHP_SELF'] . '?' . SID . "'>"; if (isset($SelectedLocation)) { //editing an existing Location + echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/supplier.png" title="' . + _('Inventory') . '" alt="">' . ' ' . $title . ''; $sql = "SELECT loccode, locationname, @@ -433,7 +429,7 @@ cashsalecustomer, managed FROM locations - WHERE loccode='$SelectedLocation'"; + WHERE loccode='" . $SelectedLocation . "'"; $result = DB_query($sql, $db); $myrow = DB_fetch_array($result); @@ -457,13 +453,16 @@ echo "<input type=hidden name=SelectedLocation VALUE=" . $SelectedLocation . '>'; echo "<input type=hidden name=LocCode VALUE=" . $_POST['LocCode'] . '>'; - echo '<table> <tr><td>' . _('Location Code') . ':</td><td>'; + echo '<table class=selection>'; + echo '<tr><th colspan=2><font size=3 color=blue>'._('Amend Location details').'</font></th></tr>'; + echo '<tr><td>' . _('Location Code') . ':</td><td>'; echo $_POST['LocCode'] . '</td></tr>'; } else { //end of if $SelectedLocation only do the else when a new record is being entered if (!isset($_POST['LocCode'])) { $_POST['LocCode'] = ''; } - echo '<table><tr><td>' . _('Location Code') . ':</td><td><input type="Text" name="LocCode" value="' . $_POST['LocCode'] . '" size=5 maxlength=5></td></tr>'; + echo '<table class=selection><tr><th colspan=2><font size=3 color=blue>'._('New Location details').'</font></th></tr>'; + echo '<tr><td>' . _('Location Code') . ':</td><td><input type="Text" name="LocCode" value="' . $_POST['LocCode'] . '" size=5 maxlength=5></td></tr>'; } if (!isset($_POST['LocationName'])) { $_POST['LocationName'] = ''; @@ -504,61 +503,57 @@ if (!isset($_POST['Managed'])) { $_POST['Managed'] = 0; } - ?> - <tr><td><?php echo _('Location Name') . ':'; ?></td> - <td><input type="Text" name="LocationName" value="<?php echo $_POST['LocationName']; ?>" size=51 maxlength=50></td></tr> - <tr><td><?php echo _('Contact for deliveries') . ':'; ?></td> - <td><input type="Text" name="Contact" value="<?php echo $_POST['Contact']; ?>" size=31 maxlength=30></td></tr> - <tr><td><?php echo _('Delivery Address 1') . ':'; ?></td> - <td><input type="Text" name="DelAdd1" value="<?php echo $_POST['DelAdd1']; ?>" size=41 maxlength=40></td></tr> - <tr><td><?php echo _('Delivery Address 2') . ':'; ?></td> - <td><input type="Text" name="DelAdd2" value="<?php echo $_POST['DelAdd2']; ?>" size=41 maxlength=40></td></tr> - <tr><td><?php echo _('Delivery Address 3') . ':'; ?></td> - <td><input type="Text" name="DelAdd3" value="<?php echo $_POST['DelAdd3']; ?>" size=41 maxlength=40></td></tr> - <tr><td><?php echo _('Delivery Address 4') . ':'; ?></td> - <td><input type="Text" name="DelAdd4" value="<?php echo $_POST['DelAdd4']; ?>" size=41 maxlength=40></td></tr> - <tr><td><?php echo _('Delivery Address 5') . ':'; ?></td> - <td><input type="Text" name="DelAdd5" value="<?php echo $_POST['DelAdd5']; ?>" size=21 maxlength=20></td></tr> - <tr><td><?php echo _('Delivery Address 6') . ':'; ?></td> - <td><input type="Text" name="DelAdd6" value="<?php echo $_POST['DelAdd6']; ?>" size=16 maxlength=15></td></tr> - <tr><td><?php echo _('Telephone No') . ':'; ?></td> - <td><input type="Text" name="Tel" value="<?php echo $_POST['Tel']; ?>" size=31 maxlength=30></td></tr> - <tr><td><?php echo _('Facsimile No') . ':'; ?></td> - <td><input type="Text" name="Fax" value="<?php echo $_POST['Fax']; ?>" size=31 maxlength=30></td></tr> - <tr><td><?php echo _('Email') . ':'; ?></td> - <td><input type="Text" name="Email" value="<?php echo $_POST['Email']; ?>" size=31 maxlength=55></td></tr> + echo '<tr><td>' . _('Location Name') . ':' . '</td>'; + echo '<td><input type="Text" name="LocationName" value="'. $_POST['LocationName'] . '" size=51 maxlength=50></td></tr>'; + echo '<tr><td>' . _('Contact for deliveries') . ':' . '</td>'; + echo '<td><input type="Text" name="Contact" value="' . $_POST['Contact'] . '" size=31 maxlength=30></td></tr>'; + echo '<tr><td>' . _('Delivery Address 1') . ':' . '</td>'; + echo '<td><input type="Text" name="DelAdd1" value="' . $_POST['DelAdd1'] . '" size=41 maxlength=40></td></tr>'; + echo '<tr><td>' . _('Delivery Address 2') . ':' . '</td>'; + echo '<td><input type="Text" name="DelAdd2" value="' . $_POST['DelAdd2'] . '" size=41 maxlength=40></td></tr>'; + echo '<tr><td>' . _('Delivery Address 3') . ':' . '</td>'; + echo '<td><input type="Text" name="DelAdd3" value="' . $_POST['DelAdd3'] . '" size=41 maxlength=40></td></tr>'; + echo '<tr><td>' . _('Delivery Address 4') . ':' . '</td>'; + echo '<td><input type="Text" name="DelAdd4" value="' . $_POST['DelAdd4'] . '" size=41 maxlength=40></td></tr>'; + echo '<tr><td>' . _('Delivery Address 5') . ':' . '</td>'; + echo '<td><input type="Text" name="DelAdd5" value="' . $_POST['DelAdd5'] . '" size=21 maxlength=20></td></tr>'; + echo '<tr><td>' . _('Delivery Address 6') . ':' . '</td>'; + echo '<td><input type="Text" name="DelAdd6" value="' . $_POST['DelAdd6'] . '" size=16 maxlength=15></td></tr>'; + echo '<tr><td>' . _('Telephone No') . ':' . '</td>'; + echo '<td><input type="Text" name="Tel" value="' . $_POST['Tel'] . '" size=31 maxlength=30></td></tr>'; + echo '<tr><td>' . _('Facsimile No') . ':' . '</td>'; + echo '<td><input type="Text" name="Fax" value="' . $_POST['Fax'] . '" size=31 maxlength=30></td></tr>'; + echo '<tr><td>' . _('Email') . ':' . '</td>'; + echo '<td><input type="Text" name="Email" value="' . $_POST['Email'] . '" size=31 maxlength=55></td></tr>'; - <td><?php echo _('Tax Province') . ':'; ?></td><td><select name='TaxProvince'> + echo '<td>' . _('Tax Province') . ':' . '</td><td><select name="TaxProvince">'; - <?php $TaxProvinceResult = DB_query('SELECT taxprovinceid, taxprovincename FROM taxprovinces',$db); while ($myrow=DB_fetch_array($TaxProvinceResult)){ if ($_POST['TaxProvince']==$myrow['taxprovinceid']){ - echo '<option selected VALUE=' . $myrow['taxprovinceid'] . '>' . $myrow['taxprovincename']; + echo '<option selected value=' . $myrow['taxprovinceid'] . '>' . $myrow['taxprovincename']; } else { - echo '<option VALUE=' . $myrow['taxprovinceid'] . '>' . $myrow['taxprovincename']; + echo '<option value=' . $myrow['taxprovinceid'] . '>' . $myrow['taxprovincename']; } } - ?> - </select></td></tr> - <tr><td><?php echo _('Default Counter Sales Customer') . ':'; ?></td> - <td><input type="Text" name="CashSaleCustomer" value="<?php echo $_POST['CashSaleCustomer']; ?>" size=25 maxlength=23></td></tr> - <?php + echo '</select></td></tr>'; + echo '<tr><td>' . _('Default Counter Sales Customer') . ':' . '</td>'; + echo '<td><input type="Text" name="CashSaleCustomer" value="' . $_POST['CashSaleCustomer'] . + '" size=25 maxlength=23></td></tr>'; /* This functionality is not written yet ... <tr><td><?php echo _('Enable Warehouse Management') . ':'; ?></td> <td><input type='checkbox' name='Managed'<?php if($_POST['Managed'] == 1) echo ' checked';?>></td></tr> */ - ?> - </table> + echo '</table><br>'; - <div class="centre"><input type="Submit" name="submit" value="<?php echo _('Enter Information'); ?>"></div> + echo '<div class="centre"><input type="Submit" name="submit" value="' . _('Enter Information') . '"></div>'; - </form> + echo '</form>'; -<?php } //end if record deleted no point displaying form to add record +} //end if record deleted no point displaying form to add record include('includes/footer.inc'); -?> +?> \ No newline at end of file Modified: trunk/doc/Change.log.html =================================================================== --- trunk/doc/Change.log.html 2010-07-12 09:02:03 UTC (rev 3609) +++ trunk/doc/Change.log.html 2010-07-12 18:38:26 UTC (rev 3610) @@ -1,5 +1,6 @@ <p><font SIZE=4 COLOR=BLUE><b>webERP Change Log</b></font></p> <p></p> +<p>12/07/10 Tim: Locations.php - Bug Fixes, Layout changes, sql quoting corrections</p> <p>12/07/10 Tim: PDFGrn.php - Correct conversion factor bug</p> <p>11/07/10 Tim: InventoryValuation.php - Layout changes</p> <p>11/07/10 Tim: InventoryPlanningPrefSupplier.php - Bug fixes, layout changes, sql quoting fixed</p> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <tim...@us...> - 2010-07-12 18:38:59
|
Revision: 3611 http://web-erp.svn.sourceforge.net/web-erp/?rev=3611&view=rev Author: tim_schofield Date: 2010-07-12 18:38:48 +0000 (Mon, 12 Jul 2010) Log Message: ----------- Layout changes, sql quoting corrections Modified Paths: -------------- trunk/MRP.php trunk/doc/Change.log.html Modified: trunk/MRP.php =================================================================== --- trunk/MRP.php 2010-07-12 18:38:26 UTC (rev 3610) +++ trunk/MRP.php 2010-07-12 18:38:48 UTC (rev 3611) @@ -5,13 +5,13 @@ $PageSecurity=9; include('includes/session.inc'); -$title = _('MRP'); +$title = _('Run MRP Calculation'); include('includes/header.inc'); if (isset($_POST['submit'])) { - if (!$_POST['Leeway'] || !is_numeric($_POST['Leeway'])) { - $_POST['Leeway'] = 0; + if (!$_POST['Leeway'] || !is_numeric($_POST['Leeway'])) { + $_POST['Leeway'] = 0; } // MRP - Create levels table based on bom @@ -58,7 +58,7 @@ $sql = "INSERT INTO tempbom (parent, component, sortpart, level) SELECT bom.parent AS parent, bom.component AS component, CONCAT(bom.parent,'%',bom.component) AS sortpart, - '$lctr' as level + '". $lctr. "' as level FROM bom LEFT JOIN bom as bom2 ON bom.parent = bom2.component WHERE bom2.component IS NULL"; $result = DB_query($sql,$db); @@ -74,7 +74,7 @@ $sql = "INSERT INTO tempbom (parent, component, sortpart, level) SELECT bom.parent AS parent, bom.component AS component, CONCAT(passbom.sortpart,'%',bom.component) AS sortpart, - $lctr as level + '" .$lctr . "' as level FROM bom,passbom WHERE bom.parent = passbom.part"; $result = DB_query($sql,$db); @@ -96,8 +96,8 @@ $sql = 'SELECT COUNT(*) FROM bom - INNER JOIN passbom ON bom.parent = passbom.part - GROUP BY bom.parent'; + INNER JOIN passbom ON bom.parent = passbom.part + GROUP BY bom.parent'; $result = DB_query($sql,$db); $myrow = DB_fetch_row($result); @@ -126,7 +126,7 @@ foreach ($parts as $part) { $ctr++; $newlevel = $level - $ctr; - $sql = "INSERT INTO bomlevels (part, level) VALUES('$part','$newlevel')"; + $sql = "INSERT INTO bomlevels (part, level) VALUES('" . $part . "','" . $newlevel . "')"; $result2 = DB_query($sql,$db); } // End of foreach } //end of while loop @@ -158,9 +158,9 @@ FROM bomlevels INNER JOIN stockmaster ON bomlevels.part = stockmaster.stockid GROUP BY bomlevels.part, - pansize, - shrinkfactor, - stockmaster.eoq'; + pansize, + shrinkfactor, + stockmaster.eoq'; $result = DB_query($sql,$db); $sql = 'ALTER TABLE levels ADD INDEX part(part)'; $result = DB_query($sql,$db); @@ -249,7 +249,7 @@ salesorderdetails.orderno, "1", stkcode - FROM salesorders, salesorderdetails + FROM salesorders, salesorderdetails WHERE salesorders.orderno = salesorderdetails.orderno AND (quantity - qtyinvoiced) > 0 AND salesorderdetails.completed = 0 @@ -303,7 +303,7 @@ $result = DB_query($sql,$db); prnMsg(_('Loading requirements based on mrpdemands'),'info'); flush(); - } + } $sql = 'INSERT INTO mrprequirements (part, daterequired, @@ -366,30 +366,30 @@ purchorderdetails.deliverydate, 0 FROM purchorderdetails, - purchorders + purchorders WHERE purchorderdetails.orderno = purchorders.orderno - AND purchorders.status != "Cancelled" - AND(quantityord - quantityrecd) > 0'; + AND purchorders.status != "Cancelled" + AND(quantityord - quantityrecd) > 0'; $result = DB_query($sql,$db); prnMsg(_('Loading supplies from inventory on hand'),'info'); flush(); // Set date for inventory already onhand to 0000-00-00 so it is first in sort if ($_POST['location'][0] == 'All') { - $whereloc = ' '; + $whereloc = ' '; } elseif (sizeof($_POST['location']) == 1) { - $whereloc = " AND loccode ='" . $_POST['location'][0] . "' "; + $whereloc = " AND loccode ='" . $_POST['location'][0] . "' "; } else { - $whereloc = " AND loccode IN("; - $commactr = 0; - foreach ($_POST['location'] as $key => $value) { - $whereloc .= "'" . $value . "'"; - $commactr++; - if ($commactr < sizeof($_POST['location'])) { - $whereloc .= ","; - } // End of if - } // End of foreach - $whereloc .= ')'; + $whereloc = " AND loccode IN("; + $commactr = 0; + foreach ($_POST['location'] as $key => $value) { + $whereloc .= "'" . $value . "'"; + $commactr++; + if ($commactr < sizeof($_POST['location'])) { + $whereloc .= ","; + } // End of if + } // End of foreach + $whereloc .= ')'; } $sql = 'INSERT INTO mrpsupplies (id, @@ -474,7 +474,7 @@ // part, that serves as a gross requirement for a lower level part, so will read down through // the Bill of Materials to generate those requirements in function LevelNetting(). for ($level = $maxlevel; $level >= $minlevel; $level--) { - $sql = 'SELECT * FROM levels WHERE level = ' . "$level " . ' LIMIT 50000'; //should cover most eventualities!! + $sql = 'SELECT * FROM levels WHERE level = "' . $level .'" LIMIT 50000'; //should cover most eventualities!! prnMsg('</br>------ ' . _('Processing level') .' ' . $level . ' ------','info'); flush(); @@ -500,6 +500,7 @@ // Create entry for location field from $_POST['location'], which is an array // since multiple locations can be selected $commactr = 0; + $locparm=''; foreach ($_POST['location'] as $key => $value) { $locparm .= $value ; $commactr++; @@ -521,17 +522,19 @@ '" . $_POST['eoqflag'] . "', '" . $_POST['usemrpdemands'] . "', '" . $_POST['Leeway'] . "')"; - $result = DB_query($sql,$db); + $result = DB_query($sql,$db); } else { // End of if submit isset - // Display form if submit has not been hit + // Display form if submit has not been hit + echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/inventory.png" title="' . + _('Inventory') . '" alt="">' . ' ' . $title . ''; - // Display parameters from last run - $sql = 'SELECT * FROM mrpparameters'; - $result = DB_query($sql,$db,'','',false,false); - if (DB_error_no($db)==0){ + // Display parameters from last run + $sql = 'SELECT * FROM mrpparameters'; + $result = DB_query($sql,$db,'','',false,false); + if (DB_error_no($db)==0){ - $myrow = DB_fetch_array($result); + $myrow = DB_fetch_array($result); $leeway = $myrow['leeway']; $usemrpdemands = _('No'); @@ -550,47 +553,51 @@ if ($myrow['shrinkageflag'] == 'y') { $useshrinkage = _('Yes'); } - - echo '<table><tr><td>     </td>'; + echo '<table cellpadding=5><tr><td valign=top>'; + echo '<table class=selection>'; + echo '<tr><th colspan=3><font color=blue size=3>'._('Last Run Details').'</font></th></tr>'; + echo '<tr>'; echo '<td>' . _('Last Run Time') . ':  </td><td>' . $myrow['runtime'] . '</td></tr>'; - echo '<td></td><td>' . _('Location') . ':  </td><td>' . $myrow['location'] . '</td></tr>'; - echo '<td></td><td>' . _('Days Leeway') . ':  </td><td>' . $leeway . '</td></tr>'; - echo '<td></td><td>' . _('Use MRP Demands') . ':  </td><td>' . $usemrpdemands . '</td></tr>'; - echo '<td></td><td>' . _('Use EOQ') . ':  </td><td>' . $useeoq . '</td></tr>'; - echo '<td></td><td>' . _('Use Pan Size') . ':  </td><td>' . $usepansize . '</td></tr>'; - echo '<td></td><td>' . _('Use Shrinkage') . ':  </td><td>' . $useshrinkage . '</td></tr>'; - echo '</table>'; + echo '<td>' . _('Location') . ':  </td><td>' . $myrow['location'] . '</td></tr>'; + echo '<td>' . _('Days Leeway') . ':  </td><td>' . $leeway . '</td></tr>'; + echo '<td>' . _('Use MRP Demands') . ':  </td><td>' . $usemrpdemands . '</td></tr>'; + echo '<td>' . _('Use EOQ') . ':  </td><td>' . $useeoq . '</td></tr>'; + echo '<td>' . _('Use Pan Size') . ':  </td><td>' . $usepansize . '</td></tr>'; + echo '<td>' . _('Use Shrinkage') . ':  </td><td>' . $useshrinkage . '</td></tr>'; + echo '</table></td>'; } - echo "<p><form method='post' action='" . $_SERVER['PHP_SELF'] . '?' . SID . "'>"; - echo '<table>'; + echo "<p><form method='post' action='" . $_SERVER['PHP_SELF'] . '?' . SID . "'>"; + echo '<td><table class=selection>'; // Generate selections for Location + echo '<tr><th colspan=3><font color=blue size=3>'._('This Run Details').'</font></th></tr>'; echo '<tr> <td>' . _('Location') . '</td> <td><select name="location[]" multiple> <option value="All" selected>' . _('All') . '</option>'; - $sql = 'SELECT loccode - FROM locations'; + $sql = 'SELECT loccode, + locationname + FROM locations'; $result = DB_query($sql,$db); while ($myrow = DB_fetch_array($result)) { echo '<option value="'; - echo $myrow['loccode'] . '">' . $myrow['loccode'] . '</option>'; + echo $myrow['loccode'] . '">' . $myrow['locationname'] . '</option>'; } //end while loop echo '</select></td></tr>'; if (!isset($leeway)){ $leeway =0; } - echo '<tr><td>' . _('Days Leeway') . ':</td><td><input type="text" name="Leeway" size="4" value=' . $leeway . '>'; - echo '<tr><td>' ._('Use MRP Demands?') . ':</td>'; - echo '<td><input type="checkbox" name="usemrpdemands" value="y" checked></td></tr>'; - echo '<tr><td>' ._('Use EOQ?') . ':</td>'; - echo '<td><input type="checkbox" name="eoqflag" value="y" checked></td></tr>'; - echo '<tr><td>' ._('Use Pan Size?') . ':</td>'; - echo '<td><input type="checkbox" name="pansizeflag" value="y" checked></td></tr>'; - echo '<tr><td>' ._('Use Shrinkage?') . ':</td>'; - echo '<td><input type="checkbox" name="shrinkageflag" value="y" checked></td></tr>'; - echo '</table><div class="centre"></br></br><input type="submit" name="submit" value="' . _('Run MRP') . '"></div>'; - echo '</form>'; + echo '<tr><td>' . _('Days Leeway') . ':</td><td><input type="text" name="Leeway" class=number size="4" value=' . $leeway . '>'; + echo '<tr><td>' ._('Use MRP Demands?') . ':</td>'; + echo '<td><input type="checkbox" name="usemrpdemands" value="y" checked></td></tr>'; + echo '<tr><td>' ._('Use EOQ?') . ':</td>'; + echo '<td><input type="checkbox" name="eoqflag" value="y" checked></td></tr>'; + echo '<tr><td>' ._('Use Pan Size?') . ':</td>'; + echo '<td><input type="checkbox" name="pansizeflag" value="y" checked></td></tr>'; + echo '<tr><td>' ._('Use Shrinkage?') . ':</td>'; + echo '<td><input type="checkbox" name="shrinkageflag" value="y" checked></td></tr>'; + echo '</table></td></tr></table><div class="centre"></br></br><input type="submit" name="submit" value="' . _('Run MRP') . '"></div>'; + echo '</form>'; } // End of Main program logic ------------------------------------------------------- @@ -599,16 +606,16 @@ // Create an array of mrprequirements and an array of mrpsupplies, then read through // them seeing if all requirements are covered by supplies. Create a planned order // for any unmet requirements. Change dates if necessary for the supplies. - //echo '</br>Part is ' . "$part" . '</br>'; + //echo '</br>Part is ' . "$part" . '</br>'; - // Get decimal places from stockmaster for rounding of shrinkage factor - $sql = "SELECT decimalplaces FROM stockmaster WHERE stockid = '" . $part . "'"; + // Get decimal places from stockmaster for rounding of shrinkage factor + $sql = "SELECT decimalplaces FROM stockmaster WHERE stockid = '" . $part . "'"; $result = DB_query($sql,$db); $myrow=DB_fetch_row($result); $decimalplaces = $myrow[0]; - // Load mrprequirements into $requirements array - $sql = "SELECT * FROM mrprequirements WHERE part = '" . "$part" . "' ORDER BY daterequired"; + // Load mrprequirements into $requirements array + $sql = "SELECT * FROM mrprequirements WHERE part = '" .$part. "' ORDER BY daterequired"; $result = DB_query($sql,$db); $requirements = array(); $i = 0; @@ -617,8 +624,8 @@ $i++; } //end of while loop - // Load mrpsupplies into $supplies array - $sql = "SELECT * FROM mrpsupplies WHERE part = '" . "$part" . "' ORDER BY duedate"; + // Load mrpsupplies into $supplies array + $sql = "SELECT * FROM mrpsupplies WHERE part = '" .$part. "' ORDER BY duedate"; $result = DB_query($sql,$db); $supplies = array(); $i = 0; @@ -627,96 +634,96 @@ $i++; } //end of while loop - // Go through all requirements and check if have supplies to cover them - $requirementcount = count($requirements); - $supplycount = count($supplies); - $reqi = 0; //Index for requirements - $supi = 0; // index for supplies - $totalrequirement = 0; - $totalsupply = 0; + // Go through all requirements and check if have supplies to cover them + $requirementcount = count($requirements); + $supplycount = count($supplies); + $reqi = 0; //Index for requirements + $supi = 0; // index for supplies + $totalrequirement = 0; + $totalsupply = 0; - if ($requirementcount > 0 && $supplycount > 0) { - $totalrequirement += $requirements[$reqi]['quantity']; - $totalsupply += $supplies[$supi]['supplyquantity']; - while ($totalrequirement > 0 && $totalsupply > 0) { - $supplies[$supi]['updateflag'] = 1; - // ******** Put leeway calculation in here ******** - $duedate = ConvertSQLDate($supplies[$supi]['duedate']); - $reqdate = ConvertSQLDate($requirements[$reqi]['daterequired']); - $datediff = DateDiff($duedate,$reqdate,'d'); + if ($requirementcount > 0 && $supplycount > 0) { + $totalrequirement += $requirements[$reqi]['quantity']; + $totalsupply += $supplies[$supi]['supplyquantity']; + while ($totalrequirement > 0 && $totalsupply > 0) { + $supplies[$supi]['updateflag'] = 1; + // ******** Put leeway calculation in here ******** + $duedate = ConvertSQLDate($supplies[$supi]['duedate']); + $reqdate = ConvertSQLDate($requirements[$reqi]['daterequired']); + $datediff = DateDiff($duedate,$reqdate,'d'); //if ($supplies[$supi]['duedate'] > $requirements[$reqi]['daterequired']) { if ($datediff > abs($_POST['Leeway'])) { - $sql = "UPDATE mrpsupplies SET mrpdate = '" . $requirements[$reqi]['daterequired'] . - "' WHERE id = '" . $supplies[$supi]['id'] . "' AND duedate = mrpdate"; - $result = DB_query($sql,$db); + $sql = "UPDATE mrpsupplies SET mrpdate = '" . $requirements[$reqi]['daterequired'] . + "' WHERE id = '" . $supplies[$supi]['id'] . "' AND duedate = mrpdate"; + $result = DB_query($sql,$db); } - if ($totalrequirement > $totalsupply) { - $totalrequirement -= $totalsupply; - $requirements[$reqi]['quantity'] -= $totalsupply; - $totalsupply = 0; - $supplies[$supi]['supplyquantity'] = 0; - $supi++; - if ($supplycount > $supi) { - $totalsupply += $supplies[$supi]['supplyquantity']; - } - } else { - $totalsupply -= $totalrequirement; - $supplies[$supi]['supplyquantity'] -= $totalrequirement; - $totalrequirement = 0; - $requirements[$reqi]['quantity'] = 0; - $reqi++; - if ($requirementcount > $reqi) { - $totalrequirement += $requirements[$reqi]['quantity']; - } - } // End of if $totalrequirement > $totalsupply - } // End of while - } // End of if + if ($totalrequirement > $totalsupply) { + $totalrequirement -= $totalsupply; + $requirements[$reqi]['quantity'] -= $totalsupply; + $totalsupply = 0; + $supplies[$supi]['supplyquantity'] = 0; + $supi++; + if ($supplycount > $supi) { + $totalsupply += $supplies[$supi]['supplyquantity']; + } + } else { + $totalsupply -= $totalrequirement; + $supplies[$supi]['supplyquantity'] -= $totalrequirement; + $totalrequirement = 0; + $requirements[$reqi]['quantity'] = 0; + $reqi++; + if ($requirementcount > $reqi) { + $totalrequirement += $requirements[$reqi]['quantity']; + } + } // End of if $totalrequirement > $totalsupply + } // End of while + } // End of if - // When get to this part of code, have gone through all requirements, If there is any - // unmet requirements, create an mrpplannedorder to cover it. Also call the - // CreateLowerLevelRequirement() function to create gross requirements for lower level parts. + // When get to this part of code, have gone through all requirements, If there is any + // unmet requirements, create an mrpplannedorder to cover it. Also call the + // CreateLowerLevelRequirement() function to create gross requirements for lower level parts. - // There is an excess quantity if the eoq is higher than the actual required amount. - // If there is a subsuquent requirement, the excess quantity is subtracted from that - // quantity. For instance, if the first requirement was for 2 and the eoq was 5, there - // would be an excess of 3; if there was another requirement for 3 or less, the excess - // would cover it, so no planned order would have to be created for the second requirement. - $excessqty = 0; - foreach ($requirements as $key => $row) { - $daterequired[$key] = $row['daterequired']; - } - if (count($requirements)) { - array_multisort($daterequired, SORT_ASC, $requirements); - } - foreach($requirements as $requirement) { - // First, inflate requirement if there is a shrinkage factor - // Should the quantity be rounded? - if ($_POST['shrinkageflag'] == 'y' and $shrinkfactor > 0) { - $requirement['quantity'] = ($requirement['quantity'] * 100) / (100 - $shrinkfactor); - $requirement['quantity'] = round($requirement['quantity'],$decimalplaces); - } - if ($excessqty >= $requirement['quantity']) { - $plannedqty = 0; - $excessqty -= $requirement['quantity']; - } else { - $plannedqty = $requirement['quantity'] - $excessqty; - $excessqty = 0; - } - if ($plannedqty > 0) { - if ($_POST['eoqflag'] == 'y' and $eoq > $plannedqty) { - $excessqty = $eoq - $plannedqty; - $plannedqty = $eoq; - } - // Pansize calculation here - // if $plannedqty not evenly divisible by $pansize, calculate as $plannedqty - // divided by $pansize and rounded up to the next highest integer and then - // multiplied by the pansize. For instance, with a planned qty of 17 with a pansize - // of 5, divide 17 by 5 to get 3 with a remainder of 2, which is rounded up to 4 - // and then multiplied by 5 - the pansize - to get 20 - if ($_POST['pansizeflag'] == 'y' and $pansize != 0 and $plannedqty % $pansize != 0) { - $plannedqty = ceil($plannedqty / $pansize) * $pansize; - } + // There is an excess quantity if the eoq is higher than the actual required amount. + // If there is a subsuquent requirement, the excess quantity is subtracted from that + // quantity. For instance, if the first requirement was for 2 and the eoq was 5, there + // would be an excess of 3; if there was another requirement for 3 or less, the excess + // would cover it, so no planned order would have to be created for the second requirement. + $excessqty = 0; + foreach ($requirements as $key => $row) { + $daterequired[$key] = $row['daterequired']; + } + if (count($requirements)) { + array_multisort($daterequired, SORT_ASC, $requirements); + } + foreach($requirements as $requirement) { + // First, inflate requirement if there is a shrinkage factor + // Should the quantity be rounded? + if ($_POST['shrinkageflag'] == 'y' and $shrinkfactor > 0) { + $requirement['quantity'] = ($requirement['quantity'] * 100) / (100 - $shrinkfactor); + $requirement['quantity'] = round($requirement['quantity'],$decimalplaces); + } + if ($excessqty >= $requirement['quantity']) { + $plannedqty = 0; + $excessqty -= $requirement['quantity']; + } else { + $plannedqty = $requirement['quantity'] - $excessqty; + $excessqty = 0; + } + if ($plannedqty > 0) { + if ($_POST['eoqflag'] == 'y' and $eoq > $plannedqty) { + $excessqty = $eoq - $plannedqty; + $plannedqty = $eoq; + } + // Pansize calculation here + // if $plannedqty not evenly divisible by $pansize, calculate as $plannedqty + // divided by $pansize and rounded up to the next highest integer and then + // multiplied by the pansize. For instance, with a planned qty of 17 with a pansize + // of 5, divide 17 by 5 to get 3 with a remainder of 2, which is rounded up to 4 + // and then multiplied by 5 - the pansize - to get 20 + if ($_POST['pansizeflag'] == 'y' and $pansize != 0 and $plannedqty % $pansize != 0) { + $plannedqty = ceil($plannedqty / $pansize) * $pansize; + } $sql = "INSERT INTO mrpplannedorders (id, part, duedate, @@ -736,29 +743,29 @@ $result = DB_query($sql,$db); // If part has lower level components, create requirements for them $sql = "SELECT COUNT(*) FROM bom - WHERE parent ='" . $requirement['part'] . "' - GROUP BY parent"; - $result = DB_query($sql,$db); - $myrow = DB_fetch_row($result); - if ($myrow[0] > 0) { - CreateLowerLevelRequirement($db,$requirement['part'],$requirement['daterequired'], - $plannedqty,$requirement['mrpdemandtype'],$requirement['orderno'], - $requirement['whererequired']); + WHERE parent ='" . $requirement['part'] . "' + GROUP BY parent"; + $result = DB_query($sql,$db); + $myrow = DB_fetch_row($result); + if ($myrow[0] > 0) { + CreateLowerLevelRequirement($db,$requirement['part'],$requirement['daterequired'], + $plannedqty,$requirement['mrpdemandtype'],$requirement['orderno'], + $requirement['whererequired']); } - } // End of if $plannedqty > 0 - } // End of foreach $requirements + } // End of if $plannedqty > 0 + } // End of foreach $requirements // If there are any supplies not used and updateflag is zero, those supplies are not - // necessary, so change date + // necessary, so change date - foreach($supplies as $supply) { - if ($supply['supplyquantity'] > 0 && $supply['updateflag'] == 0) { + foreach($supplies as $supply) { + if ($supply['supplyquantity'] > 0 && $supply['updateflag'] == 0) { $id = $supply['id']; - $sql = "UPDATE mrpsupplies SET mrpdate ='2050-12-31' WHERE id = '$id' - AND ordertype <> 'QOH'"; - $result = DB_query($sql,$db); - } - } + $sql = "UPDATE mrpsupplies SET mrpdate ='2050-12-31' WHERE id = '".$id."' + AND ordertype <> 'QOH'"; + $result = DB_query($sql,$db); + } + } } // End of LevelNetting ------------------------------------------------------- @@ -770,51 +777,51 @@ $toporderno, $whererequired) { // Creates an mrprequirement based on the net requirement from the part above it in the bom - $sql = "SELECT bom.component, - bom.quantity, - levels.leadtime, - levels.eoq - FROM bom - LEFT JOIN levels - ON bom.component = levels.part - WHERE bom.parent = '$toppart' + $sql = "SELECT bom.component, + bom.quantity, + levels.leadtime, + levels.eoq + FROM bom + LEFT JOIN levels + ON bom.component = levels.part + WHERE bom.parent = '".$toppart."' AND effectiveafter <= now() AND effectiveto >= now()"; $resultbom = DB_query($sql,$db); while ($myrow=DB_fetch_array($resultbom)) { - // Calculate required date by subtracting leadtime from top part's required date - $leadtime = $myrow['leadtime']; + // Calculate required date by subtracting leadtime from top part's required date + $leadtime = $myrow['leadtime']; - // Following sql finds daynumber for the top part's required date, subtracts leadtime, and finds - // a valid manufacturing date for the daynumber. There is only one valid manufacturing date - // for each daynumber, but there could be several non-manufacturing dates for the - // same daynumber. MRPCalendar.php maintains the manufacturing calendar. - $calendarsql = "SELECT COUNT(*),cal2.calendardate - FROM mrpcalendar - LEFT JOIN mrpcalendar as cal2 - ON (mrpcalendar.daynumber - $leadtime) = cal2.daynumber - WHERE mrpcalendar.calendardate = '$topdate' - AND cal2.manufacturingflag='1' - GROUP BY cal2.calendardate"; - $resultdate = DB_query($calendarsql,$db); - $myrowdate=DB_fetch_array($resultdate); - $newdate = $myrowdate[1]; - // If can't find date based on manufacturing calendar, use $topdate - if ($myrowdate[0] == 0){ - // Convert $topdate from mysql format to system date format, use that to subtract leadtime - // from it using DateAdd, convert that date back to mysql format - $convertdate = ConvertSQLDate($topdate); - $dateadd = DateAdd($convertdate,"d",($leadtime * -1)); - $newdate = FormatDateForSQL($dateadd); - } + // Following sql finds daynumber for the top part's required date, subtracts leadtime, and finds + // a valid manufacturing date for the daynumber. There is only one valid manufacturing date + // for each daynumber, but there could be several non-manufacturing dates for the + // same daynumber. MRPCalendar.php maintains the manufacturing calendar. + $calendarsql = "SELECT COUNT(*),cal2.calendardate + FROM mrpcalendar + LEFT JOIN mrpcalendar as cal2 + ON (mrpcalendar.daynumber - '".$leadtime."') = cal2.daynumber + WHERE mrpcalendar.calendardate = '".$topdate."' + AND cal2.manufacturingflag='1' + GROUP BY cal2.calendardate"; + $resultdate = DB_query($calendarsql,$db); + $myrowdate=DB_fetch_array($resultdate); + $newdate = $myrowdate[1]; + // If can't find date based on manufacturing calendar, use $topdate + if ($myrowdate[0] == 0){ + // Convert $topdate from mysql format to system date format, use that to subtract leadtime + // from it using DateAdd, convert that date back to mysql format + $convertdate = ConvertSQLDate($topdate); + $dateadd = DateAdd($convertdate,"d",($leadtime * -1)); + $newdate = FormatDateForSQL($dateadd); + } - $component = $myrow['component']; - $extendedquantity = $myrow['quantity'] * $topquantity; + $component = $myrow['component']; + $extendedquantity = $myrow['quantity'] * $topquantity; // Commented out the following lines 8/15/09 because the eoq should be considered in the // LevelNetting() function where $excessqty is calculated -// if ($myrow['eoq'] > $extendedquantity) { -// $extendedquantity = $myrow['eoq']; -// } +// if ($myrow['eoq'] > $extendedquantity) { +// $extendedquantity = $myrow['eoq']; +// } $sql = "INSERT INTO mrprequirements (part, daterequired, @@ -823,13 +830,13 @@ orderno, directdemand, whererequired) - VALUES ('$component', - '$newdate', - '$extendedquantity', - '$topmrpdemandtype', - '$toporderno', + VALUES ('".$component."', + '".$newdate."', + '".$extendedquantity."', + '".$topmrpdemandtype."', + '".$toporderno."', '0', - '$whererequired')"; + '".$whererequired."')"; $result = DB_query($sql,$db); } //end of while loop Modified: trunk/doc/Change.log.html =================================================================== --- trunk/doc/Change.log.html 2010-07-12 18:38:26 UTC (rev 3610) +++ trunk/doc/Change.log.html 2010-07-12 18:38:48 UTC (rev 3611) @@ -1,5 +1,6 @@ <p><font SIZE=4 COLOR=BLUE><b>webERP Change Log</b></font></p> <p></p> +<p>12/07/10 Tim: MRP.php - Layout changes, sql quoting corrections</p> <p>12/07/10 Tim: Locations.php - Bug Fixes, Layout changes, sql quoting corrections</p> <p>12/07/10 Tim: PDFGrn.php - Correct conversion factor bug</p> <p>11/07/10 Tim: InventoryValuation.php - Layout changes</p> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <tim...@us...> - 2010-07-12 20:19:30
|
Revision: 3612 http://web-erp.svn.sourceforge.net/web-erp/?rev=3612&view=rev Author: tim_schofield Date: 2010-07-12 20:19:24 +0000 (Mon, 12 Jul 2010) Log Message: ----------- Layout changes, sql quoting corrections Modified Paths: -------------- trunk/MRPCalendar.php trunk/doc/Change.log.html Modified: trunk/MRPCalendar.php =================================================================== --- trunk/MRPCalendar.php 2010-07-12 18:38:48 UTC (rev 3611) +++ trunk/MRPCalendar.php 2010-07-12 20:19:24 UTC (rev 3612) @@ -18,17 +18,19 @@ $ChangeDate =trim(strtoupper($_GET['ChangeDate'])); } +echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/inventory.png" title="' . + _('Inventory') . '" alt="">' . ' ' . $title . '</p>'; + if (isset($_POST['submit'])) { - submit($db,$ChangeDate); + submit($db,$ChangeDate); } elseif (isset($_POST['update'])) { - update($db,$ChangeDate); + update($db,$ChangeDate); } elseif (isset($_POST['listall'])) { - listall($db); + listall($db); } else { - display($db,$ChangeDate); + display($db,$ChangeDate); } - function submit(&$db,&$ChangeDate) //####SUBMIT_SUBMIT_SUBMIT_SUBMIT_SUBMIT_SUBMIT_SUBMIT_SUBMIT#### { @@ -68,10 +70,10 @@ } - if ($InputError == 1) { + if ($InputError == 1) { display($db,$ChangeDate); return; - } + } $sql = 'DROP TABLE IF EXISTS mrpcalendar'; $result = DB_query($sql,$db); @@ -92,6 +94,7 @@ $daysText = array('Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday'); $ExcludeDays = array($_POST['Sunday'],$_POST['Monday'],$_POST['Tuesday'],$_POST['Wednesday'], $_POST['Thursday'],$_POST['Friday'],$_POST['Saturday']); + $caldate = $convertfromdate; for ($i = 0; $i <= $datediff; $i++) { $dateadd = FormatDateForSQL(DateAdd($caldate,"d",$i)); @@ -141,22 +144,22 @@ // Change manufacturing flag for a date. The value "1" means the date is a manufacturing date. // After change the flag, re-calculate the daynumber for all dates. - $InputError = 0; - $caldate = FormatDateForSQL($ChangeDate); + $InputError = 0; + $caldate = FormatDateForSQL($ChangeDate); $sql="SELECT COUNT(*) FROM mrpcalendar - WHERE calendardate='$caldate' - GROUP BY calendardate"; + WHERE calendardate='$caldate' + GROUP BY calendardate"; $result = DB_query($sql,$db); $myrow = DB_fetch_row($result); if ($myrow[0] < 1 || !Is_Date($ChangeDate)) { - $InputError = 1; + $InputError = 1; prnMsg(_('Invalid Change Date'),'error'); } - if ($InputError == 1) { + if ($InputError == 1) { display($db,$ChangeDate); return; - } + } $sql="SELECT mrpcalendar.* FROM mrpcalendar WHERE calendardate='$caldate'"; $result = DB_query($sql,$db); @@ -165,10 +168,11 @@ if ($myrow[2] == 0) { $newmanufacturingflag = 1; } - $sql = "UPDATE mrpcalendar SET manufacturingflag = '$newmanufacturingflag' - WHERE calendardate = '$caldate'"; + $sql = "UPDATE mrpcalendar SET manufacturingflag = '".$newmanufacturingflag."' + WHERE calendardate = '".$caldate."'"; + $ErrMsg = _('Cannot update the MRP Calendar'); $resultupdate = DB_query($sql,$db,$ErrMsg); - prnMsg(_("The MRP calendar record for $ChangeDate has been updated"),'succes'); + prnMsg(_("The MRP calendar record for $ChangeDate has been updated"),'success'); unset ($ChangeDate); display($db,$ChangeDate); @@ -195,12 +199,12 @@ function listall(&$db) //####LISTALL_LISTALL_LISTALL_LISTALL_LISTALL_LISTALL_LISTALL_#### { // List all records in date range - $fromdate = FormatDateForSQL($_POST['FromDate']); - $todate = FormatDateForSQL($_POST['ToDate']); + $fromdate = FormatDateForSQL($_POST['FromDate']); + $todate = FormatDateForSQL($_POST['ToDate']); $sql = "SELECT calendardate, - daynumber, - manufacturingflag, - DAYNAME(calendardate) as dayname + daynumber, + manufacturingflag, + DAYNAME(calendardate) as dayname FROM mrpcalendar WHERE calendardate >='$fromdate' AND calendardate <='$todate'"; @@ -208,17 +212,17 @@ $ErrMsg = _('The SQL to find the parts selected failed with the message'); $result = DB_query($sql,$db,$ErrMsg); - echo "</br><table border=1> + echo "</br><table class=selection> <tr BGCOLOR =#800000> - <th>" . _('Date') . "</th> + <th>" . _('Date') . "</th> <th>" . _('Manufacturing Date') . "</th> </tr></font>"; - $ctr = 0; + $ctr = 0; while ($myrow = DB_fetch_array($result)) { - $flag = _('Yes'); - if ($myrow['manufacturingflag'] == 0) { - $flag = _('No'); - } + $flag = _('Yes'); + if ($myrow['manufacturingflag'] == 0) { + $flag = _('No'); + } printf("<tr><td>%s</td> <td>%s</td> <td>%s</td> @@ -229,9 +233,9 @@ } //END WHILE LIST LOOP echo '</table>'; - echo '</br></br>'; - unset ($ChangeDate); - display($db,$ChangeDate); + echo '</br></br>'; + unset ($ChangeDate); + display($db,$ChangeDate); @@ -243,74 +247,70 @@ // Display form fields. This function is called the first time // the page is called, and is also invoked at the end of all of the other functions. + if (!isset($_POST['FromDate'])) { + $_POST['FromDate']=date($_SESSION['DefaultDateFormat']); + $_POST['ToDate']=date($_SESSION['DefaultDateFormat']); + } echo "<form action=" . $_SERVER['PHP_SELF'] . "?" . SID ." method=post></br></br>"; - echo '<table>'; + echo '<br><table class=selection>'; - echo '<tr> - <td>' . _('From Date') . ":</td> - <td><input type='Text' class=date alt='".$_SESSION['DefaultDateFormat'] ."' name='FromDate' size=10 maxlength=10 value=" . $_POST['FromDate'] . '></td> - <td>' . _('To Date') . ":</td> - <td><input type='Text' class=date alt='".$_SESSION['DefaultDateFormat'] ."' name='ToDate' size=10 maxlength=10 value=" . $_POST['ToDate'] . '></td> + echo '<tr> + <td>' . _('From Date') . ":</td> + <td><input type='Text' class=date alt='".$_SESSION['DefaultDateFormat'] ."' name='FromDate' size=10 maxlength=10 value=" . $_POST['FromDate'] . '></td></tr> + <tr></tr><td>' . _('To Date') . ":</td> + <td><input type='Text' class=date alt='".$_SESSION['DefaultDateFormat'] ."' name='ToDate' size=10 maxlength=10 value=" . $_POST['ToDate'] . '></td> </tr> <tr><td></td></tr> <tr><td></td></tr> <tr><td>'._('Exclude The Following Days').'</td></tr> - <tr> - <td>' . _('Saturday') . ":</td> - <td><input type='checkbox' name='Saturday' value='Saturday'></td> + <tr> + <td>' . _('Saturday') . ":</td> + <td><input type='checkbox' name='Saturday' value='Saturday'></td> </tr> - <tr> - <td>" . _('Sunday') . ":</td> - <td><input type='checkbox' name='Sunday' value='Sunday'></td> + <tr> + <td>" . _('Sunday') . ":</td> + <td><input type='checkbox' name='Sunday' value='Sunday'></td> </tr> - <tr> - <td>" . _('Monday') . ":</td> - <td><input type='checkbox' name='Monday' value='Monday'></td> + <tr> + <td>" . _('Monday') . ":</td> + <td><input type='checkbox' name='Monday' value='Monday'></td> </tr> - <tr> - <td>" . _('Tuesday') . ":</td> - <td><input type='checkbox' name='Tuesday' value='Tuesday'></td> + <tr> + <td>" . _('Tuesday') . ":</td> + <td><input type='checkbox' name='Tuesday' value='Tuesday'></td> </tr> - <tr> - <td>" . _('Wednesday') . ":</td> - <td><input type='checkbox' name='Wednesday' value='Wednesday'></td> + <tr> + <td>" . _('Wednesday') . ":</td> + <td><input type='checkbox' name='Wednesday' value='Wednesday'></td> </tr> - <tr> - <td>" . _('Thursday') . ":</td> - <td><input type='checkbox' name='Thursday' value='Thursday'></td> + <tr> + <td>" . _('Thursday') . ":</td> + <td><input type='checkbox' name='Thursday' value='Thursday'></td> </tr> - <tr> - <td>" . _('Friday') . ":</td> - <td><input type='checkbox' name='Friday' value='Friday'></td> + <tr> + <td>" . _('Friday') . ":</td> + <td><input type='checkbox' name='Friday' value='Friday'></td> </tr> - <tr></tr><tr></tr> - <tr> - <td></td> - </tr> - <tr> - <td></td> - </tr> - <tr> - <td></td> - <td><input type='submit' name='submit' value='" . _('Create Calendar') . "'></td> - <td></td> - <td><input type='submit' name='listall' value='" . _('List Date Range') . "'></td> - </tr> - </table> - </br>"; + </table><br> + <div class=centre><input type='submit' name='submit' value='" . _('Create Calendar') . "'> + <input type='submit' name='listall' value='" . _('List Date Range') . "'></div>"; -echo '</br></br><hr/>'; -echo '<table>'; +if (!isset($_POST['ChangeDate'])) { + $_POST['ChangeDate']=date($_SESSION['DefaultDateFormat']); +} + +echo '<br><table class=selection>'; echo '<tr> - <td>' . _('Change Date Status') . ":</td> - <td><input type='Text' name='ChangeDate' size=12 maxlength=12 value=" . $_POST['ChangeDate'] . '></td> - </tr></table>'; -echo "</br></br><div class='centre'><input type='submit' name='update' value='" . _('Update') . "'></div>"; + <td>' . _('Change Date Status') . ":</td> + <td><input type='Text' name='ChangeDate' class=date alt='".$_SESSION['DefaultDateFormat'] . + "' size=12 maxlength=12 value=" . $_POST['ChangeDate'] . '></td> + <td><input type="submit" name="update" value="' . _('Update') . '"></td></tr></table>'; +echo "</br></br><div class='centre'></div>"; echo '</form>'; } // End of function display() include('includes/footer.inc'); -?> +?> \ No newline at end of file Modified: trunk/doc/Change.log.html =================================================================== --- trunk/doc/Change.log.html 2010-07-12 18:38:48 UTC (rev 3611) +++ trunk/doc/Change.log.html 2010-07-12 20:19:24 UTC (rev 3612) @@ -1,5 +1,6 @@ <p><font SIZE=4 COLOR=BLUE><b>webERP Change Log</b></font></p> <p></p> +<p>12/07/10 Tim: MRPCalender.php - Layout changes, sql quoting corrections</p> <p>12/07/10 Tim: MRP.php - Layout changes, sql quoting corrections</p> <p>12/07/10 Tim: Locations.php - Bug Fixes, Layout changes, sql quoting corrections</p> <p>12/07/10 Tim: PDFGrn.php - Correct conversion factor bug</p> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <tim...@us...> - 2010-07-12 21:27:43
|
Revision: 3613 http://web-erp.svn.sourceforge.net/web-erp/?rev=3613&view=rev Author: tim_schofield Date: 2010-07-12 21:27:37 +0000 (Mon, 12 Jul 2010) Log Message: ----------- Layout changes, sql quoting corrections Modified Paths: -------------- trunk/MRPCreateDemands.php trunk/doc/Change.log.html Modified: trunk/MRPCreateDemands.php =================================================================== --- trunk/MRPCreateDemands.php 2010-07-12 20:19:24 UTC (rev 3612) +++ trunk/MRPCreateDemands.php 2010-07-12 21:27:37 UTC (rev 3613) @@ -11,7 +11,7 @@ if (isset($_POST['submit'])) { // Create mrpdemands based on sales order history - + $InputError=0; if (isset($_POST['FromDate']) AND !Is_Date($_POST['FromDate'])){ @@ -24,15 +24,15 @@ $InputError=1; unset($_POST['ToDate']); } -if (isset($_POST['FromDate']) and isset($_POST['ToDate']) and - Date1GreaterThanDate2($_POST['FromDate'], $_POST['ToDate'])){ - $msg = _('The date to must be after the date from'); - $InputError=1; - unset($_POST['ToDate']); - unset($_POST['FromoDate']); +if (isset($_POST['FromDate']) and isset($_POST['ToDate']) and + Date1GreaterThanDate2($_POST['FromDate'], $_POST['ToDate'])){ + $msg = _('The date to must be after the date from'); + $InputError=1; + unset($_POST['ToDate']); + unset($_POST['FromoDate']); } if (isset($_POST['DistDate']) AND !Is_Date($_POST['DistDate'])){ - $msg = _('The distribution start date must be specified in the format') . ' ' . + $msg = _('The distribution start date must be specified in the format') . ' ' . $_SESSION['DefaultDateFormat']; $InputError=1; unset($_POST['DistDate']); @@ -44,13 +44,13 @@ $wherecategory = " "; if ($_POST['CategoryID']!='All') { - $wherecategory = " AND stockmaster.categoryid ='" . $_POST['CategoryID'] . "' "; + $wherecategory = " AND stockmaster.categoryid ='" . $_POST['CategoryID'] . "' "; } $wherelocation = " "; if ($_POST['Location']!='All') { - $wherelocation = " AND salesorders.fromstkloc ='" . $_POST['Location'] . "' "; + $wherelocation = " AND salesorders.fromstkloc ='" . $_POST['Location'] . "' "; } - + $sql= "SELECT salesorderdetails.stkcode, SUM(salesorderdetails.quantity) AS totqty, SUM(salesorderdetails.qtyinvoiced) AS totqtyinvoiced, @@ -60,11 +60,11 @@ ON salesorders.orderno = salesorderdetails.orderno INNER JOIN stockmaster ON salesorderdetails.stkcode = stockmaster.stockid - WHERE orddate >='" . FormatDateForSQL($_POST['FromDate']) . - "' AND orddate <='" . FormatDateForSQL($_POST['ToDate']) . + WHERE orddate >='" . FormatDateForSQL($_POST['FromDate']) . + "' AND orddate <='" . FormatDateForSQL($_POST['ToDate']) . "' $wherelocation $wherecategory " - . " GROUP BY salesorderdetails.stkcode"; + . " GROUP BY salesorderdetails.stkcode"; //echo "</br>$sql</br>"; $result = DB_query($sql,$db); // To get the quantity per period, get the whole number amount of the total quantity divided @@ -74,32 +74,32 @@ // in the array $multiplier = $_POST['Multiplier']; if ($_POST['Multiplier'] < 1) { - $multiplier = 1; + $multiplier = 1; } $excludeqty = $_POST['Excludeqty']; if ($_POST['Excludeqty'] < 1) { - $excludeqty = 1; + $excludeqty = 1; } $excludeamt = $_POST['Excludeamt']; if ($_POST['Excludeamt'] < 1) { - $excludeamt = 0; + $excludeamt = 0; } // Create array of dates based on DistDate and adding either weeks or months $FormatedDistdate = FormatDateForSQL($_POST['DistDate']); if (strpos($FormatedDistdate,"/")) { - list($yyyy,$mm,$dd) = explode("/",$FormatedDistdate); + list($yyyy,$mm,$dd) = explode("/",$FormatedDistdate); } else if (strpos($FormatedDistdate,"-")) { - list($yyyy,$mm,$dd) = explode("-",$FormatedDistdate); + list($yyyy,$mm,$dd) = explode("-",$FormatedDistdate); } else if (strpos($FormatedDistdate,".")) { - list($yyyy,$mm,$dd) = explode(".",$FormatedDistdate); + list($yyyy,$mm,$dd) = explode(".",$FormatedDistdate); } $datearray[0] = $FormatedDistdate; // Set first date to valid manufacturing date -$calendarsql = "SELECT COUNT(*),cal2.calendardate - FROM mrpcalendar - LEFT JOIN mrpcalendar as cal2 +$calendarsql = "SELECT COUNT(*),cal2.calendardate + FROM mrpcalendar + LEFT JOIN mrpcalendar as cal2 ON mrpcalendar.daynumber = cal2.daynumber WHERE mrpcalendar.calendardate = '$datearray[0]' AND cal2.manufacturingflag='1' @@ -113,19 +113,19 @@ $date = date("Y-m-d",mktime(0,0,0,$mm,$dd,$yyyy)); for ($i = 1; $i <= ( $_POST['PeriodNumber'] - 1); $i++) { - if ($_POST['Period'] == 'weekly') { - $date = strtotime(date("Y-m-d", strtotime($date)) . " + 1 week"); - } else { - $date = strtotime(date("Y-m-d", strtotime($date)) . " + 1 month"); - } - $datearray[$i] = date("Y-m-d",$date); - // Following sql finds daynumber for the calculated date and finds + if ($_POST['Period'] == 'weekly') { + $date = strtotime(date("Y-m-d", strtotime($date)) . " + 1 week"); + } else { + $date = strtotime(date("Y-m-d", strtotime($date)) . " + 1 month"); + } + $datearray[$i] = date("Y-m-d",$date); + // Following sql finds daynumber for the calculated date and finds // a valid manufacturing date for the daynumber. There is only one valid manufacturing date - // for each daynumber, but there could be several non-manufacturing dates for the + // for each daynumber, but there could be several non-manufacturing dates for the // same daynumber. MRPCalendar.php maintains the manufacturing calendar. - $calendarsql = "SELECT COUNT(*),cal2.calendardate - FROM mrpcalendar - LEFT JOIN mrpcalendar as cal2 + $calendarsql = "SELECT COUNT(*),cal2.calendardate + FROM mrpcalendar + LEFT JOIN mrpcalendar as cal2 ON mrpcalendar.daynumber = cal2.daynumber WHERE mrpcalendar.calendardate = '$datearray[$i]' AND cal2.manufacturingflag='1' @@ -136,7 +136,7 @@ if ($myrowdate[0] != 0){ $datearray[$i] = $myrowdate[1]; } - $date = date("Y-m-d",$date); + $date = date("Y-m-d",$date); } $totalrecords = 0; @@ -167,11 +167,11 @@ VALUES ('" . $myrow['stkcode'] . "', '" . $_POST['MRPDemandtype'] . "', '" . $demandqty . "', - '" . $datearray[$i] . "')"; + '" . $datearray[$i] . "')"; $insertresult = DB_query($sql,$db); $i++; $totalrecords++; - + } // end of foreach for INSERT } // end of if that checks exludeqty, excludeamt @@ -183,59 +183,69 @@ } // End of else to create form - echo '<form action=' . $_SERVER['PHP_SELF'] . '?' . SID .' method="post"><b><br></b>'; - echo '<table>'; - echo '<tr><td>' . _('Demand Type') . ':</td><td><select name="MRPDemandtype">'; - $sql = 'SELECT mrpdemandtype, - description - FROM mrpdemandtypes'; + echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/inventory.png" title="' . + _('Inventory') . '" alt="">' . ' ' . $title . '</p>'; + echo '<form action=' . $_SERVER['PHP_SELF'] . '?' . SID .' method="post"><b><br></b>'; + echo '<table class=selection>'; + echo '<tr><td>' . _('Demand Type') . ':</td><td><select name="MRPDemandtype">'; + $sql = 'SELECT mrpdemandtype, + description + FROM mrpdemandtypes'; $result = DB_query($sql,$db); while ($myrow = DB_fetch_array($result)) { - echo '<option value="'; + echo '<option value="'; echo $myrow['mrpdemandtype'] . '">' . $myrow['mrpdemandtype'] . ' - ' .$myrow['description']; } //end while loop echo '</select></td></tr>'; - echo '<tr><td>' . _('Inventory Category') . ':</td><td><select name="CategoryID">'; - echo '<option selected value="All">' . _('All Stock Categories'); - $sql = 'SELECT categoryid, - categorydescription - FROM stockcategory'; + echo '<tr><td>' . _('Inventory Category') . ':</td><td><select name="CategoryID">'; + echo '<option selected value="All">' . _('All Stock Categories'); + $sql = 'SELECT categoryid, + categorydescription + FROM stockcategory'; $result = DB_query($sql,$db); while ($myrow = DB_fetch_array($result)) { - echo '<option value="'; + echo '<option value="'; echo $myrow['categoryid'] . '">' . $myrow['categoryid'] . ' - ' .$myrow['categorydescription']; } //end while loop echo '</select></td></tr>'; - echo '<tr><td>' . _('Inventory Location') . ':</td><td><select name="Location">'; - echo '<option selected value="All">' . _('All Locations'); + echo '<tr><td>' . _('Inventory Location') . ':</td><td><select name="Location">'; + echo '<option selected value="All">' . _('All Locations'); - $result= DB_query('SELECT loccode, - locationname - FROM locations',$db); - while ($myrow=DB_fetch_array($result)){ - echo '<option value="' . $myrow['loccode'] . '">' . $myrow['locationname']; - } - echo '</select></td></tr>'; - echo '<tr><td>' . _('From Sales Date') . + $result= DB_query('SELECT loccode, + locationname + FROM locations',$db); + while ($myrow=DB_fetch_array($result)){ + echo '<option value="' . $myrow['loccode'] . '">' . $myrow['locationname']; + } + echo '</select></td></tr>'; + if (!isset($_POST['FromDate'])) { + $_POST['FromDate']=date($_SESSION['DefaultDateFormat']); + } + if (!isset($_POST['ToDate'])) { + $_POST['ToDate']=date($_SESSION['DefaultDateFormat']); + } + if (!isset($_POST['DistDate'])) { + $_POST['DistDate']=date($_SESSION['DefaultDateFormat']); + } + echo '<tr><td>' . _('From Sales Date') . ":</td><td><input type ='text' class=date alt='".$_SESSION['DefaultDateFormat']."' name='FromDate' size='10' value='" . $_POST['FromDate'] . "'>"; - echo '<td>' . _('To Sales Date') . - ":</td><td><input type ='text' class=date alt='".$_SESSION['DefaultDateFormat']."' name='ToDate' size='10' value='" . $_POST['ToDate'] . "'></tr>"; - echo '<tr><td>' . _('Start Date For Distribution') . - ":</td><td><input type ='text' class=date alt='".$_SESSION['DefaultDateFormat']."' name='DistDate' size='10' value='" . $_POST['DistDate'] . "'></tr>"; + echo ' '. _('To Sales Date') . + ":<input type ='text' class=date alt='".$_SESSION['DefaultDateFormat']."' name='ToDate' size='10' value='" . $_POST['ToDate'] . "'></tr>"; + echo '<tr><td>' . _('Start Date For Distribution') . + ":</td><td><input type ='text' class=date alt='".$_SESSION['DefaultDateFormat']."' name='DistDate' size='10' value='" . $_POST['DistDate'] . "'></tr>"; echo '<tr><td>' . _('Distribution Period') . ":</td><td><select name='Period'>"; echo "<option selected value='weekly'>" . _('Weekly'); echo "<option value='monthly'>" . _('Monthly'); echo '</select></td></tr>'; - echo '<tr><td>' . _('Number of Periods') . - ":</td><td><input type ='text' class=number name='PeriodNumber' size='4' value='1'>"; - echo '<tr><td>' . _('Exclude Total Quantity Less Than') . - ":</td><td><input type ='text' class=number name='Excludeqty' size='4' value='1'>"; - echo '<tr><td>' . _('Exclude Total Dollars Less Than') . - ":</td><td><input type ='text' class=number name='Excludeamt' size='8' value='0'>"; - echo '<tr><td>' . _('Multiplier') . - ":</td><td><input type ='text' class=number name='Multiplier' size='2'><tr><td></td></tr>"; - echo "<tr><td></td></tr><tr><td></td><td><input type=submit name='submit' value='" . _('Submit') . - "'></td></tr></table>"; + echo '<tr><td>' . _('Number of Periods') . + ":</td><td><input type ='text' class=number name='PeriodNumber' size='4' value='1'>"; + echo '<tr><td>' . _('Exclude Total Quantity Less Than') . + ":</td><td><input type ='text' class=number name='Excludeqty' size='4' value='1'>"; + echo '<tr><td>' . _('Exclude Total Dollars Less Than') . + ":</td><td><input type ='text' class=number name='Excludeamt' size='8' value='0'>"; + echo '<tr><td>' . _('Multiplier') . + ":</td><td><input type ='text' class=number name='Multiplier' size='2' value=1><tr><td></td></tr></table>"; + echo "<br><div class=centre><input type=submit name='submit' value='" . _('Submit') . "'</div>"; include('includes/footer.inc'); ?> \ No newline at end of file Modified: trunk/doc/Change.log.html =================================================================== --- trunk/doc/Change.log.html 2010-07-12 20:19:24 UTC (rev 3612) +++ trunk/doc/Change.log.html 2010-07-12 21:27:37 UTC (rev 3613) @@ -1,5 +1,6 @@ <p><font SIZE=4 COLOR=BLUE><b>webERP Change Log</b></font></p> <p></p> +<p>12/07/10 Tim: MRPCreateDemand.php - Layout changes, sql quoting corrections</p> <p>12/07/10 Tim: MRPCalender.php - Layout changes, sql quoting corrections</p> <p>12/07/10 Tim: MRP.php - Layout changes, sql quoting corrections</p> <p>12/07/10 Tim: Locations.php - Bug Fixes, Layout changes, sql quoting corrections</p> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <tim...@us...> - 2010-07-13 08:40:01
|
Revision: 3615 http://web-erp.svn.sourceforge.net/web-erp/?rev=3615&view=rev Author: tim_schofield Date: 2010-07-13 08:39:55 +0000 (Tue, 13 Jul 2010) Log Message: ----------- Revert formatting changes till I can ascertain why the numbers only function stopped working Modified Paths: -------------- trunk/doc/Change.log.html trunk/javascripts/MiscFunctions.js Modified: trunk/doc/Change.log.html =================================================================== --- trunk/doc/Change.log.html 2010-07-12 21:30:19 UTC (rev 3614) +++ trunk/doc/Change.log.html 2010-07-13 08:39:55 UTC (rev 3615) @@ -1,5 +1,6 @@ <p><font SIZE=4 COLOR=BLUE><b>webERP Change Log</b></font></p> <p></p> +<p>13/07/10 Tim: MiscFunctions.js - Revert formatting changes till I can ascertain why the numbers only function stopped working</p> <p>12/07/10 Tim: MRPCreateDemand.php - Layout changes, sql quoting corrections</p> <p>12/07/10 Tim: MRPCalender.php - Layout changes, sql quoting corrections</p> <p>12/07/10 Tim: MRP.php - Layout changes, sql quoting corrections</p> Modified: trunk/javascripts/MiscFunctions.js =================================================================== --- trunk/javascripts/MiscFunctions.js 2010-07-12 21:30:19 UTC (rev 3614) +++ trunk/javascripts/MiscFunctions.js 2010-07-13 08:39:55 UTC (rev 3615) @@ -1,248 +1,206 @@ function defaultControl(c){ - c.select(); - c.focus(); +c.select(); +c.focus(); } function ReloadForm(fB){ - fB.click(); +fB.click(); } function rTN(event){ - if (event) - k=event.keyCode; - else if (event) - var k=event.which; - else - return true; - var kC=String.fromCharCode(k); - if ((k==null) || (k==0) || (k==8) || (k==9) || (k==13) || (k==27)) - return true; - else if ((("0123456789,.-").indexOf(kC)>-1)) - return true; - else - return false; +if (window.event) k=window.event.keyCode; +else if (event) k=event.which; +else return true; +kC=String.fromCharCode(k); +if ((k==null) || (k==0) || (k==8) || (k==9) || (k==13) || (k==27)) return true; +else if ((("0123456789.-").indexOf(kC)>-1)) return true; +else return false; } function assignComboToInput(c,i){ - i.value=c.value; +i.value=c.value; } function inArray(v,tA,m){ - for (i=0;i<tA.length;i++) - if (v==tA[i].value) - return true; - alert(m); - return false; +for (i=0;i<tA.length;i++) if (v==tA[i].value) return true; +alert(m); +return false; } function isDate(dS,dF){ - var mA; - if (dF == "Y/m/d"){ - mA=dS.match(/^(\d{4})(\/|-|.)(\d{1,2})(\/|-|.)(\d{1,2})$/); - } else { - mA=dS.match(/^(\d{1,2})(\/|-|.)(\d{1,2})(\/|-|.)(\d{4})$/); - } - if (mA==null){ - alert("Please enter the date in the format "+dF); - return false; - } - if ((dF == "d/m/Y") || (dF == "d.m.Y")){ - d = mA[1]; - m = mA[3]; - y = mA[5]; - } else if (dF == "m/d/Y"){ - d = mA[3]; - m = mA[1]; - y = mA[5]; - } else { - d = mA[5]; - m = mA[3]; - y = mA[1]; - } - y=mA[5]; - if (m<1 || m>12){ - alert("Month must be between 1 and 12"); - return false; - } - if (d<1 || d>31){ - alert("Day must be between 1 and 31"); - return false; - } - if ((m==4 || m==6 || m==9 || m==11) && d==31){ - alert("Month "+m+" doesn`t have 31 days"); - return false; - } - if (m==2){ - var isleap=(y%4==0); - if (d>29 || (d==29 && !isleap)){ - alert("February "+y+" doesn`t have "+d+" days"); - return false; - } - } - return true; +var mA=dS.match(/^(\d{1,2})(\/|-|.)(\d{1,2})(\/|-|.)(\d{4})$/); +if (mA==null){ +alert("Please enter the date in the format "+dF); +return false; } - +if (dF=="d/m/Y"){ +d=mA[1]; +m=mA[3]; +}else{ +d=mA[3]; +m=mA[1]; +} +y=mA[5]; +if (m<1 || m>12){ +alert("Month must be between 1 and 12"); +return false; +} +if (d<1 || d>31){ +alert("Day must be between 1 and 31"); +return false; +} +if ((m==4 || m==6 || m==9 || m==11) && d==31){ +alert("Month "+m+" doesn`t have 31 days"); +return false; +} +if (m==2){ +var isleap=(y%4==0); +if (d>29 || (d==29 && !isleap)){ +alert("February "+y+" doesn`t have "+d+" days"); +return false; +} +} +return true; +} function eitherOr(o,t){ - if (o.value!='') - t.value=''; - else if (o.value=='NaN') - o.value=''; +if (o.value!='') t.value=''; +else if (o.value=='NaN') o.value=''; } /*Renier & Louis (in...@ti...) 25.02.2007 Copyright 2004-2007 Tillcor International */ -var days=new Array('Su','Mo','Tu','We','Th','Fr','Sa'); -var months=new Array('Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec'); -var dateDivID="calendar"; - +days=new Array('Su','Mo','Tu','We','Th','Fr','Sa'); +months=new Array('Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec'); +dateDivID="calendar"; function Calendar(md,dF){ - var iF=document.getElementsByName(md).item(0); - var pB=iF; - var x=pB.offsetLeft; - var y=pB.offsetTop+pB.offsetHeight; - var p=pB; - while (p.offsetParent){ - p=p.offsetParent; - x+=p.offsetLeft; - y+=p.offsetTop; - } - var dt=convertDate(iF.value,dF); - var nN=document.createElement("div"); - nN.setAttribute("id",dateDivID); - nN.setAttribute("style","visibility:hidden;"); - document.body.appendChild(nN); - var cD=document.getElementById(dateDivID); - cD.style.position="absolute"; - cD.style.left=x+"px"; - cD.style.top=y+"px"; - cD.style.visibility=(cD.style.visibility=="visible" ? "hidden" : "visible"); - cD.style.display=(cD.style.display=="block" ? "none" : "block"); - cD.style.zIndex=10000; - drawCalendar(md,dt.getFullYear(),dt.getMonth(),dt.getDate(),dF); +iF=document.getElementsByName(md).item(0); +pB=iF; +x=pB.offsetLeft; +y=pB.offsetTop+pB.offsetHeight; +var p=pB; +while (p.offsetParent){ +p=p.offsetParent; +x+=p.offsetLeft; +y+=p.offsetTop; } - +dt=convertDate(iF.value,dF); +nN=document.createElement("div"); +nN.setAttribute("id",dateDivID); +nN.setAttribute("style","visibility:hidden;"); +document.body.appendChild(nN); +cD=document.getElementById(dateDivID); +cD.style.position="absolute"; +cD.style.left=x+"px"; +cD.style.top=y+"px"; +cD.style.visibility=(cD.style.visibility=="visible" ? "hidden" : "visible"); +cD.style.display=(cD.style.display=="block" ? "none" : "block"); +cD.style.zIndex=10000; +drawCalendar(md,dt.getFullYear(),dt.getMonth(),dt.getDate(),dF); +} function drawCalendar(md,y,m,d,dF){ - var tD=new Date(); - if ((m>=0) && (y>0)) - tD=new Date(y,m,1); - else { - d=tD.getDate(); - tD.setDate(1); - } - var TR="<tr>"; - var xTR="</tr>"; - var TD="<td class='dpTD' onMouseOut='this.className=\"dpTD\";' onMouseOver='this.className=\"dpTDHover\";'"; - var xTD="</td>"; - var html="<table class='dpTbl'>"+TR+"<th colspan=3>"+months[tD.getMonth()]+" "+tD.getFullYear()+"</th>"+"<td colspan=2>"+ - getButtonCode(md,tD,-1,"<",dF)+xTD+"<td colspan=2>"+getButtonCode(md,tD,1,">",dF)+xTD+xTR+TR; - for(var i=0;i<days.length;i++) - html+="<th>"+days[i]+"</th>"; - html+=xTR+TR; - for (i=0;i<tD.getDay();i++) - html+=TD+" "+xTD; - do{ - var dN=tD.getDate(); - var TD_onclick=" onclick=\"postDate('"+md+"','"+formatDate(tD,dF)+"');\">"; - if (dN==d) - html+="<td"+TD_onclick+"<div class='dpDayHighlight'>"+dN+"</div>"+xTD; - else - html+=TD+TD_onclick+dN+xTD; - if (tD.getDay()==6) - html+=xTR+TR; - tD.setDate(tD.getDate()+1); - } while (tD.getDate()>1) - if (tD.getDay()>0) - for (i=6;i>tD.getDay();i--) - html+=TD+" "+xTD; - html+="</table>"; - document.getElementById(dateDivID).innerHTML=html; +var tD=new Date(); +if ((m>=0) && (y>0)) tD=new Date(y,m,1); +else{ +d=tD.getDate(); +tD.setDate(1); } +TR="<tr>"; +xTR="</tr>"; +TD="<td class='dpTD' onMouseOut='this.className=\"dpTD\";' onMouseOver='this.className=\"dpTDHover\";'"; +xTD="</td>"; +html="<table class='dpTbl'>"+TR+"<th colspan=3>"+months[tD.getMonth()]+" "+tD.getFullYear()+"</th>"+"<td colspan=2>"+ +getButtonCode(md,tD,-1,"<",dF)+xTD+"<td colspan=2>"+getButtonCode(md,tD,1,">",dF)+xTD+xTR+TR; +for(i=0;i<days.length;i++) html+="<th>"+days[i]+"</th>"; +html+=xTR+TR; +for (i=0;i<tD.getDay();i++) html+=TD+" "+xTD; +do{ +dN=tD.getDate(); +TD_onclick=" onclick=\"postDate('"+md+"','"+formatDate(tD,dF)+"');\">"; +if (dN==d) html+="<td"+TD_onclick+"<div class='dpDayHighlight'>"+dN+"</div>"+xTD; +else html+=TD+TD_onclick+dN+xTD; +if (tD.getDay()==6) html+=xTR+TR; +tD.setDate(tD.getDate()+1); +} while (tD.getDate()>1) +if (tD.getDay()>0) for (i=6;i>tD.getDay();i--) html+=TD+" "+xTD; +html+="</table>"; +document.getElementById(dateDivID).innerHTML=html; +} function getButtonCode(mD,dV,a,lb,dF){ - var nM=(dV.getMonth()+a)%12; - var nY=dV.getFullYear()+parseInt((dV.getMonth()+a)/12,10); - if (nM<0){ - nM+=12; - nY+=-1; - } - return "<button onClick='drawCalendar(\""+mD+"\","+nY+","+nM+","+1+",\""+dF+"\");'>"+lb+"</button>"; +nM=(dV.getMonth()+a)%12; +nY=dV.getFullYear()+parseInt((dV.getMonth()+a)/12,10); +if (nM<0){ +nM+=12; +nY+=-1; } - +return "<button onClick='drawCalendar(\""+mD+"\","+nY+","+nM+","+1+",\""+dF+"\");'>"+lb+"</button>"; +} function formatDate(dV,dF){ - var ds=String(dV.getDate()); - var ms=String(dV.getMonth()+1); - var d=("0"+dV.getDate()).substring(ds.length-1,ds.length+1); - var m=("0"+(dV.getMonth()+1)).substring(ms.length-1,ms.length+1); - var y=dV.getFullYear(); - switch (dF) { - case "d/m/Y": - return d+"/"+m+"/"+y; - case "d.m.Y": - return d+"."+m+"."+y; - case "Y/m/d": - return y+"/"+m+"/"+d; - default : - return m+"/"+d+"/"+y; - } +ds=String(dV.getDate()); +ms=String(dV.getMonth()+1); +d=("0"+dV.getDate()).substring(ds.length-1,ds.length+1); +m=("0"+(dV.getMonth()+1)).substring(ms.length-1,ms.length+1); +y=dV.getFullYear(); +switch (dF) { +case "d/m/Y": +return d+"/"+m+"/"+y; +case "d.m.Y": +return d+"."+m+"."+y; +case "Y/m/d": +return y+"/"+m+"/"+d; +default : +return m+"/"+d+"/"+y; } - +} function convertDate(dS,dF){ - var d,m,y; - if (dF=="d.m.Y") - dA=dS.split(".") - else - var dA=dS.split("/"); - switch (dF){ - case "d/m/Y": - d=parseInt(dA[0],10); - m=parseInt(dA[1],10)-1; - y=parseInt(dA[2],10); - break; - case "d.m.Y": - d=parseInt(dA[0],10); - m=parseInt(dA[1],10)-1; - y=parseInt(dA[2],10); - break; - case "Y/m/d": - d=parseInt(dA[2],10); - m=parseInt(dA[1],10)-1; - y=parseInt(dA[0],10); - break; - default : - d=parseInt(dA[1],10); - m=parseInt(dA[0],10)-1; - y=parseInt(dA[2],10); - break; - } - return new Date(y,m,d); +var d,m,y; +if (dF="d.m.Y") +dA=dS.split(".") +else +dA=dS.split("/"); +switch (dF){ +case "d/m/Y","d.m.Y": +d=parseInt(dA[0],10); +m=parseInt(dA[1],10)-1; +y=parseInt(dA[2],10); +break; +case "Y/m/d": +d=parseInt(dA[2],10); +m=parseInt(dA[1],10)-1; +y=parseInt(dA[0],10); +break; +default : +d=parseInt(dA[1],10); +m=parseInt(dA[0],10)-1; +y=parseInt(dA[2],10); +break; } - +return new Date(y,m,d); +} function postDate(mydate,dS){ - var iF=document.getElementsByName(mydate).item(0); - iF.value=dS; - var cD=document.getElementById(dateDivID); - cD.style.visibility="hidden"; - cD.style.display="none"; - iF.focus(); +var iF=document.getElementsByName(mydate).item(0); +iF.value=dS; +var cD=document.getElementById(dateDivID); +cD.style.visibility="hidden"; +cD.style.display="none"; +iF.focus(); } function clickDate(){ - Calendar(this.name,this.alt); +Calendar(this.name,this.alt); } function changeDate(){ - isDate(this.value,this.alt); +isDate(this.value,this.alt); } function initial(){ - if (document.getElementsByTagName){ - var as=document.getElementsByTagName("a"); - for (var i=0;i<as.length;i++){ - var a=as[i]; - if (a.getAttribute("href") && - a.getAttribute("rel")=="external") - a.target="_blank"; - } - } - var ds=document.getElementsByTagName("input"); - for (i=0;i<ds.length;i++){ - if (ds[i].className=="date"){ - ds[i].onclick=clickDate; - ds[i].onchange=changeDate; - } - if (ds[i].className=="number") - ds[i].onkeypress=rTN; - } +if (document.getElementsByTagName){ +var as=document.getElementsByTagName("a"); +for (i=0;i<as.length;i++){ +var a=as[i]; +if (a.getAttribute("href") && +a.getAttribute("rel")=="external") +a.target="_blank"; +}} +var ds=document.getElementsByTagName("input"); +for (i=0;i<ds.length;i++){ +if (ds[i].className=="date"){ +ds[i].onclick=clickDate; +ds[i].onchange=changeDate; } +if (ds[i].className=="number") ds[i].onkeypress=rTN; +} +} window.onload=initial; \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <tim...@us...> - 2010-07-13 18:11:46
|
Revision: 3616 http://web-erp.svn.sourceforge.net/web-erp/?rev=3616&view=rev Author: tim_schofield Date: 2010-07-13 18:11:40 +0000 (Tue, 13 Jul 2010) Log Message: ----------- Bug fixes, correctly do the workflow, fix sql quoting errors and layout changes Modified Paths: -------------- trunk/MRPDemands.php trunk/doc/Change.log.html Modified: trunk/MRPDemands.php =================================================================== --- trunk/MRPDemands.php 2010-07-13 08:39:55 UTC (rev 3615) +++ trunk/MRPDemands.php 2010-07-13 18:11:40 UTC (rev 3616) @@ -17,34 +17,37 @@ } elseif (isset($_GET['DemandID'])){ $DemandID =$_GET['DemandID']; } - + if (isset($_POST['StockID'])){ $StockID =trim(strtoupper($_POST['StockID'])); } elseif (isset($_GET['StockID'])){ $StockID =trim(strtoupper($_GET['StockID'])); } +echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/inventory.png" title="' . + _('Inventory') . '" alt="">' . ' ' . $title . '</p>'; + if (isset($_POST['Search'])) { - search($db,$StockID); + search($db,$StockID); } elseif (isset($_POST['submit'])) { - submit($db,$StockID,$DemandID); + submit($db,$StockID,$DemandID); } elseif (isset($_GET['delete'])) { - delete($db,$DemandID,""); + delete($db,$DemandID,"",$StockID); } elseif (isset($_POST['deletesome'])) { - delete($db,"",$_POST['MRPDemandtype']); + delete($db,"",$_POST['MRPDemandtype'],$StockID); } elseif (isset($_GET['listall'])) { - listall($db,"",""); + listall($db,"",""); } elseif (isset($_POST['listsome'])) { - listall($db,$StockID,$_POST['MRPDemandtype']); + listall($db,$StockID,$_POST['MRPDemandtype']); } else { - display($db,$StockID,$DemandID); + display($db,$StockID,$DemandID); } function search(&$db,&$StockID) { //####SEARCH_SEARCH_SEARCH_SEARCH_SEARCH_SEARCH_SEARCH_##### // Search by partial part number or description. Display the part number and description from // the stockmaster so user can select one. If the user clicks on a part number -// MRPDemands.php is called again, and it goes to the display() routine. +// MRPDemands.php is called again, and it goes to the display() routine. // Work around to auto select if ($_POST['Keywords']=='' AND $_POST['StockCode']=='') { @@ -59,18 +62,18 @@ if (strlen($_POST['Keywords'])>0) { //insert wildcard characters in spaces $SearchString = '%' . str_replace(' ', '%', $_POST['Keywords']) . '%'; - + $sql = "SELECT stockmaster.stockid, stockmaster.description FROM stockmaster - WHERE stockmaster.description " . LIKE . " '$SearchString' + WHERE stockmaster.description " . LIKE . " '" . $SearchString ."' ORDER BY stockmaster.stockid"; } elseif (strlen($_POST['StockCode'])>0){ $sql = "SELECT stockmaster.stockid, stockmaster.description FROM stockmaster - WHERE stockmaster.stockid " . LIKE . "'%" . $_POST['StockCode'] . "%' + WHERE stockmaster.stockid " . LIKE . "'%" . $_POST['StockCode'] . "%' ORDER BY stockmaster.stockid"; } @@ -80,42 +83,38 @@ } //one of keywords or StockCode was more than a zero length string -// If the SELECT found records, display them -if (DB_num_rows($result) > 0) { -echo "<form action=" . $_SERVER['PHP_SELF'] . "?" . SID ." method=post>"; - echo '<table cellpadding=2 colspan=7 BORDER=1>'; - $TableHeader = '<tr><th>' . _('Code') . '</th> - <th>' . _('Description') . '</th> - </tr>'; - echo $TableHeader; + // If the SELECT found records, display them + if (DB_num_rows($result) > 0) { + echo "<form action=" . $_SERVER['PHP_SELF'] . "?" . SID ." method=post>"; + echo '<table cellpadding=2 colspan=7 class=selection>'; + $TableHeader = '<tr><th>' . _('Code') . '</th> + <th>' . _('Description') . '</th> + </tr>'; + echo $TableHeader; - $j = 1; - $k = 0; //row colour counter - while ($myrow=DB_fetch_array($result)) { - if ($k==1){ - echo '<tr class="EvenTableRows">'; - $k=0; - } else { - echo '<tr class="OddTableRows">'; - $k++; - } - $tabindex=$j+4; - printf("<td><input tabindex='".$tabindex."' type=submit name='StockID' value='%s'</td> - <td>%s</td> - </tr>", - $myrow['stockid'], - $myrow['description'] - ); - $j++; + $j = 1; + $k = 0; //row colour counter + while ($myrow=DB_fetch_array($result)) { + if ($k==1){ + echo '<tr class="EvenTableRows">'; + $k=0; + } else { + echo '<tr class="OddTableRows">'; + $k++; + } + $tabindex=$j+4; + echo "<td><input tabindex='".$tabindex."' type=submit name='StockID' value='".$myrow['stockid']."'</td> + <td>".$myrow['description']."</td></tr>"; + $j++; } //end of while loop echo '</table>'; echo '</form>'; } else { -prnMsg(_('No record found in search'),'error'); -unset ($StockID); -display($db,$StockID,$DemandID); + prnMsg(_('No record found in search'),'error'); + unset ($StockID); + display($db,$StockID,$DemandID); } @@ -139,7 +138,7 @@ if (!is_numeric($_POST['Quantity'])) { $InputError = 1; prnMsg(_('Quantity must be numeric'),'error'); - } + } if ($_POST['Quantity'] <= 0) { $InputError = 1; prnMsg(_('Quantity must be greater than 0'),'error'); @@ -152,14 +151,14 @@ WHERE mrpdemandtype='" . $_POST['MRPDemandtype'] . "'"; $result = DB_query($sql, $db); - if (DB_num_rows($result) == 0){ + if (DB_num_rows($result) == 0){ $InputError = 1; prnMsg(_('Invalid demand type'),'error'); } // Check if valid part number - Had done a Select Count(*), but that returned a 1 in DB_num_rows // even if there was no record. $sql = "SELECT * FROM stockmaster - WHERE stockid='$StockID'"; + WHERE stockid='" . $StockID . "'"; $result = DB_query($sql, $db); if (DB_num_rows($result) == 0){ @@ -167,36 +166,36 @@ prnMsg($StockID . ' ' . _('is not a valid item code'),'error'); unset ($_POST['StockID']); unset($StockID); - } -// Check if part number/demand type/due date combination already exists + } +// Check if part number/demand type/due date combination already exists $sql = "SELECT * FROM mrpdemands - WHERE stockid='$StockID' - AND mrpdemandtype='" . $_POST['MRPDemandtype'] . "'" . - " AND duedate='$FormatedDuedate' - AND demandid <> '$DemandID'"; + WHERE stockid='" . $StockID . "' + AND mrpdemandtype='" . $_POST['MRPDemandtype'] . "' + AND duedate='" . $FormatedDuedate . "' + AND demandid <> '" . $DemandID . "'"; $result = DB_query($sql, $db); - if (DB_num_rows($result) > 0){ + if (DB_num_rows($result) > 0){ $InputError = 1; prnMsg(_('Record already exists for part number/demand type/date'),'error'); } - - if ($InputError !=1){ + + if ($InputError !=1){ $sql = "SELECT COUNT(*) FROM mrpdemands - WHERE demandid='$DemandID' - GROUP BY demandid"; + WHERE demandid='" . $DemandID . "' + GROUP BY demandid"; $result = DB_query($sql, $db); $myrow = DB_fetch_row($result); - + if ($myrow[0]>0) { //If $myrow[0] > 0, it means this is an edit, so do an update $sql = "UPDATE mrpdemands SET quantity = '" . $_POST['Quantity'] . "', mrpdemandtype = '" . trim(strtoupper($_POST['MRPDemandtype'])) . "', duedate = '" . $FormatedDuedate . "' WHERE demandid = '" . $DemandID . "'"; - $msg = _("The MRP demand record has been updated for $StockID"); + $msg = _("The MRP demand record has been updated for").' '.$StockID; } else { - + // If $myrow[0] from SELECT count(*) is zero, this is an entry of a new record $sql = "INSERT INTO mrpdemands (stockid, mrpdemandtype, @@ -205,13 +204,15 @@ VALUES ('" . $StockID . "', '" . trim(strtoupper($_POST['MRPDemandtype'])) . "', '" . $_POST['Quantity'] . "', - '" . $FormatedDuedate . "')"; + '" . $FormatedDuedate . "' + )"; $msg = _('A new MRP demand record has been added to the database for') . ' ' . $StockID; } - + $result = DB_query($sql,$db,_('The update/addition of the MRP demand record failed because')); prnMsg($msg,'success'); + echo '<br>'; unset ($_POST['MRPDemandtype']); unset ($_POST['Quantity']); unset ($_POST['StockID']); @@ -219,37 +220,37 @@ unset ($StockID); unset ($DemandID); } // End of else where DB_num_rows showed there was a valid stockmaster record - + display($db,$StockID,$DemandID); } // End of function submit() -function delete(&$db,$DemandID,$demandtype) { //####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 +// deletion = "yes"; if it did, display link that redirects back to this page // like this - <a href=" ' . $_SERVER['PHP_SELF'] . '?&delete=confirm&StockID=' . "$StockID" . ' "> // that sets delete=confirm. If delete=confirm, do actually deletion. -// This deletes an individual record by DemandID if called from a listall that shows +// 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 ($DemandID) { - $where = ' WHERE demandid =' . "'" . $DemandID . "'"; - } + $where = " "; + if ($demandtype) { + $where = ' WHERE mrpdemandtype =' . "'" . $demandtype . "'"; + } + if ($DemandID) { + $where = ' WHERE demandid =' . "'" . $DemandID . "'"; + } $sql="DELETE FROM mrpdemands - $where"; + $where"; $result = DB_query($sql,$db); if ($DemandID) { - prnMsg(_("The MRP demand record for $StockID has been deleted"),'succes'); + 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); -display($db,$stockID,$DemandID); + unset ($DemandID); + unset ($StockID); + display($db,$stockID,$DemandID); } // End of function delete() @@ -260,64 +261,55 @@ // Lists some in hit List Selection submit button, and uses part number if it is entered or // demandtype -echo '<form action=' . $_SERVER['PHP_SELF'] . '?' . SID .' method=post>'; - $where = " "; - if ($demandtype) { - $where = ' WHERE mrpdemandtype =' . "'" . $demandtype . "'"; - } - if ($part) { - $where = ' WHERE mrpdemands.stockid =' . "'" . $part . "'"; - } - // If part is entered, it overrides demandtype + echo '<form action=' . $_SERVER['PHP_SELF'] . '?' . SID .' method=post>'; + $where = " "; + if ($demandtype) { + $where = ' WHERE mrpdemandtype =' . "'" . $demandtype . "'"; + } + if ($part) { + $where = ' WHERE mrpdemands.stockid =' . "'" . $part . "'"; + } + // If part is entered, it overrides demandtype $sql = 'SELECT mrpdemands.demandid, - mrpdemands.stockid, - mrpdemands.mrpdemandtype, - mrpdemands.quantity, - mrpdemands.duedate, - stockmaster.description + 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/>"; + //echo "<br/>sql is $sql<br/>"; $ErrMsg = _('The SQL to find the parts selected failed with the message'); $result = DB_query($sql,$db,$ErrMsg); - - echo "<table border=1> - <tr BGCOLOR =#800000><th>" . _('Part Number') . "</th> + + 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></font>"; - $ctr = 0; + </tr>"; + $ctr = 0; while ($myrow = DB_fetch_row($result)) { - $displaydate = ConvertSQLDate($myrow[4]); - $ctr++; - printf("<tr><td>%s</td> - <td>%s</td> - <td>%s</td> - <td>%s</td> - <td>%s</td> - <td><a href=\"%s&DemandID=%s\">" . _('Edit') . "</td> - <td><a href=\"%s&DemandID=%s&delete=yes\">" . _('Delete') ."</td> - </tr>", - $myrow[1], - $myrow[5], - $myrow[2], - $myrow[3], - $displaydate, - $_SERVER['PHP_SELF'] . '?' . SID, - $myrow[0], - $_SERVER['PHP_SELF'] . '?' . SID, - $myrow[0]); + $displaydate = ConvertSQLDate($myrow[4]); + $ctr++; + echo "<tr><td>".$myrow[1]."</td> + <td>".$myrow[5]."</td> + <td>".$myrow[2]."</td> + <td>".$myrow[3]."</td> + <td>".$displaydate."</td> + <td><a href=\"".$_SERVER['PHP_SELF'] . '?' . SID."&DemandID=".$myrow[0]."&StockID=".$myrow[1]."\">" . _('Edit') . "</td> + <td><a href=\"".$_SERVER['PHP_SELF'] . '?' . SID."&DemandID=".$myrow[0]."&StockID=".$myrow[1]."&delete=yes\">" . _('Delete') ."</td> + </tr>"; } //END WHILE LIST LOOP - echo '<tr><td>' . _('Number of Records') . "</td><td>$ctr</td></tr>"; + echo '<tr><td>' . _('Number of Records') . "</td><td>".$ctr."</td></tr>"; echo '</table>'; -echo '</form><br/><br/><br/><br/>'; -unset ($StockID); -display($db,$StockID,$DemandID); + echo '</form><br/><br/><br/><br/>'; + unset ($StockID); + display($db,$StockID,$DemandID); } // End of function listall() @@ -327,104 +319,93 @@ // Display Seach fields at top and Entry form below that. This function is called the first time // the page is called, and is also invoked at the end of all of the other functions. // echo "<br/>DISPLAY - DemandID = $DemandID<br/>"; - echo '<form action=' . $_SERVER['PHP_SELF'] . '?' . SID . ' method="post"><b><br></b> -</font><table cellpadding=3 colspan=4> -<tr> - <td><font size=1>' . _('Enter text extracts in the') . ' <b>' . _('description') . '</b>:</font></td> - <td><input tabindex="1" type="Text" name="Keywords" size="20" maxlength="25"></td> - <td><font size=3><b>' . _('OR') . '</b></font></td> - <td><font size=1>' . _('Enter extract of the') . ' <b>' . _('Stock Code') . '</b>:</font></td> - <td><input tabindex="2" type="Text" name="StockCode" size="15" maxlength="20"></td> - <td><font size=3><b>' . _('OR') . '</b></font></td> - <td><a href="'. $_SERVER['PHP_SELF'] . '?&listall=yes>"' . _('List All') .'</a></td> - </tr> - </table> - <div class="centre"> - <input tabindex="3" type="submit" name="Search" value="' . _('Search Now') . '"> - </div>'; - echo '<br/><br/><hr>'; - echo '<br/><br/></b1r><br/><br/>'; - if (isset($DemandID)) { - //editing an existing MRP demand + echo '<form action=' . $_SERVER['PHP_SELF'] . '?' . SID . ' method="post">'; + if (!isset($StockID)) { + echo'</font><table cellpadding=3 colspan=4 class=selection><tr> + <td><font size=1>' . _('Enter text extracts in the') . ' <b>' . _('description') . '</b>:</font></td> + <td><input tabindex="1" type="Text" name="Keywords" size="20" maxlength="25"></td> + <td><font size=3><b>' . _('OR') . '</b></font></td> + <td><font size=1>' . _('Enter extract of the') . ' <b>' . _('Stock Code') . '</b>:</font></td> + <td><input tabindex="2" type="Text" name="StockCode" size="15" maxlength="20"></td> + <td><font size=3><b>' . _('OR') . '</b></font></td> + <td><a href="'. $_SERVER['PHP_SELF'] . '?&listall=yes"><font size=3>' . _('List All Demands') .'</font></a></td></tr> + <tr><td colspan=7><div class="centre"><input tabindex="3" type="submit" name="Search" value="' . _('Search Now') . + '"></div></td></tr></table>'; + } else { + if (isset($DemandID)) { + //editing an existing MRP demand - $sql = "SELECT demandid, - stockid, - mrpdemandtype, - quantity, - duedate - FROM mrpdemands - WHERE demandid='$DemandID'"; - $result = DB_query($sql, $db); - $myrow = DB_fetch_array($result); + $sql = "SELECT demandid, + stockid, + mrpdemandtype, + quantity, + duedate + FROM mrpdemands + WHERE demandid='" . $DemandID . "'"; + $result = DB_query($sql, $db); + $myrow = DB_fetch_array($result); - if (DB_num_rows($result) > 0){ - $_POST['DemandID'] = $myrow['demandid']; - $_POST['StockID'] = $myrow['stockid']; - $_POST['MRPDemandtype'] = $myrow['mrpdemandtype']; - $_POST['Quantity'] = $myrow['quantity']; - $_POST['Duedate'] = ConvertSQLDate($myrow['duedate']); - } + if (DB_num_rows($result) > 0){ + $_POST['DemandID'] = $myrow['demandid']; + $_POST['StockID'] = $myrow['stockid']; + $_POST['MRPDemandtype'] = $myrow['mrpdemandtype']; + $_POST['Quantity'] = $myrow['quantity']; + $_POST['Duedate'] = ConvertSQLDate($myrow['duedate']); + } - echo '<input type="hidden" name="DemandID" value=' . $_POST['DemandID'] . '>'; - echo '<input type="hidden" name="StockID" value="' . $_POST['StockID'] . '">'; - echo '<table><tr><td>' ._('Part Number') . ':</td><td>' . $_POST['StockID'] . '</td></tr>'; + echo '<input type="hidden" name="DemandID" value=' . $_POST['DemandID'] . '>'; + echo '<input type="hidden" name="StockID" value="' . $_POST['StockID'] . '">'; + echo '<table class=selection><tr><td>' ._('Part Number') . ':</td><td>' . $_POST['StockID'] . '</td></tr>'; -} else { - if (!isset($_POST['StockID'])) { - $_POST['StockID'] = ''; - } - echo '<table><tr> - <td>' . _('Part Number') . ':</td> - <td><input type="Text" name="StockID" size=21 maxlength=20 value="' . $_POST['StockID'] . '"></td> - </tr>'; -} + } else { + if (!isset($_POST['StockID'])) { + $_POST['StockID'] = ''; + } + echo '<table class=selection><tr> + <td>' . _('Part Number') . ':</td> + <td><input type="Text" name="StockID" size=21 maxlength=20 value="' . $_POST['StockID'] . '"></td></tr>'; + } -if (!isset($_POST['Quantity'])) { - $_POST['Quantity']=0; -} + if (!isset($_POST['Quantity'])) { + $_POST['Quantity']=0; + } -if (!isset($_POST['Duedate'])) { - $_POST['Duedate']=' '; -} + if (!isset($_POST['Duedate'])) { + $_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>'; -// Generate selections for Demand Type -echo '<tr> - <td>' . _('Demand Type') . "</td> - <td><select name='MRPDemandtype'>"; - $sql = 'SELECT mrpdemandtype, - description - FROM mrpdemandtypes'; -$result = DB_query($sql,$db); -while ($myrow = DB_fetch_array($result)) { - if (isset($_POST['MRPDemandtype']) and $myrow['mrpdemandtype']==$_POST['MRPDemandtype']) { - echo '<option selected value="'; - } else { - echo '<option value="'; + 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, + description + FROM mrpdemandtypes'; + $result = DB_query($sql,$db); + while ($myrow = DB_fetch_array($result)) { + if (isset($_POST['MRPDemandtype']) and $myrow['mrpdemandtype']==$_POST['MRPDemandtype']) { + echo '<option selected value="'; + } else { + echo '<option value="'; + } + echo $myrow['mrpdemandtype'] . '">' . $myrow['mrpdemandtype'] . ' - ' .$myrow['description']; + } //end while loop + echo '</select></td></tr>'; + + echo '</table>'; + 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') . '">'; + // 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 $myrow['mrpdemandtype'] . '">' . $myrow['mrpdemandtype'] . ' - ' .$myrow['description']; -} //end while loop -echo '</select></td></tr><tr><td> </td> <td></td></tr><tr><td> </td> <td></td></tr>'; + echo '</form>'; -echo '<tr><td><input type="submit" name="submit" value="' . _('Enter Information') . '"></td>'; -echo '<td><input type="submit" name="listsome" value="' . _('List Selection') . '">'; -echo '<td><input type="Submit" name="deletesome" value="' . _('Delete Demand Type') . '"></tr>'; -echo '</table><br/><br/><br/><br/>'; -// 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&DemandID=' . $DemandID . '">' . _('Or Delete Record') ; -} - -echo '</form>'; - } // End of function display() Modified: trunk/doc/Change.log.html =================================================================== --- trunk/doc/Change.log.html 2010-07-13 08:39:55 UTC (rev 3615) +++ trunk/doc/Change.log.html 2010-07-13 18:11:40 UTC (rev 3616) @@ -1,5 +1,6 @@ <p><font SIZE=4 COLOR=BLUE><b>webERP Change Log</b></font></p> <p></p> +<p>13/07/10 Tim: MRPDemands.php - Bug fixes, correctly do the workflow, fix sql quoting errors and layout changes</p> <p>13/07/10 Tim: MiscFunctions.js - Revert formatting changes till I can ascertain why the numbers only function stopped working</p> <p>12/07/10 Tim: MRPCreateDemand.php - Layout changes, sql quoting corrections</p> <p>12/07/10 Tim: MRPCalender.php - Layout changes, sql quoting corrections</p> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <tim...@us...> - 2010-07-13 18:12:06
|
Revision: 3617 http://web-erp.svn.sourceforge.net/web-erp/?rev=3617&view=rev Author: tim_schofield Date: 2010-07-13 18:12:00 +0000 (Tue, 13 Jul 2010) Log Message: ----------- Bug fixes, correctly do the workflow, fix sql quoting errors and layout changes Modified Paths: -------------- trunk/MRPDemandTypes.php trunk/doc/Change.log.html Modified: trunk/MRPDemandTypes.php =================================================================== --- trunk/MRPDemandTypes.php 2010-07-13 18:11:40 UTC (rev 3616) +++ trunk/MRPDemandTypes.php 2010-07-13 18:12:00 UTC (rev 3617) @@ -15,6 +15,9 @@ $SelectedDT = trim(strtoupper($_GET['SelectedDT'])); } +echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/inventory.png" title="' . + _('Inventory') . '" alt="">' . ' ' . $title . '</p>'; + if (isset($_POST['submit'])) { //initialise no input errors assumed initially before we test @@ -25,16 +28,16 @@ //first off validate inputs sensible - if (trim(strtoupper($_POST['mrpdemandtype']) == "WO") or + if (trim(strtoupper($_POST['mrpdemandtype']) == "WO") or trim(strtoupper($_POST['mrpdemandtype']) == "SO")) { $InputError = 1; prnMsg(_('The Demand Type is reserved for the system'),'error'); - } + } if (strlen($_POST['mrpdemandtype']) < 1) { $InputError = 1; prnMsg(_('The Demand Type code must be at least 1 character long'),'error'); - } + } if (strlen($_POST['Description'])<3) { $InputError = 1; prnMsg(_('The Demand Type description must be at least 3 characters long'),'error'); @@ -51,8 +54,8 @@ $msg = _('The demand type record has been updated'); } elseif ($InputError !=1) { - //Selected demand type is null cos no item selected on first time round so must be adding a - //record must be submitting new entries in the new work centre form + //Selected demand type is null cos no item selected on first time round so must be adding a + //record must be submitting new entries in the new work centre form $sql = "INSERT INTO mrpdemandtypes (mrpdemandtype, description) @@ -66,6 +69,7 @@ if ($InputError !=1){ $result = DB_query($sql,$db,_('The update/addition of the demand type failed because')); prnMsg($msg,'success'); + echo '<br>'; unset ($_POST['Description']); unset ($_POST['mrpdemandtype']); unset ($SelectedDT); @@ -76,7 +80,7 @@ // PREVENT DELETES IF DEPENDENT RECORDS IN 'MRPDemands' - $sql= "SELECT COUNT(*) FROM mrpdemands + $sql= "SELECT COUNT(*) FROM mrpdemands WHERE mrpdemands.mrpdemandtype='$SelectedDT' GROUP BY mrpdemandtype"; $result = DB_query($sql,$db); @@ -87,13 +91,14 @@ $sql="DELETE FROM mrpdemandtypes WHERE mrpdemandtype='$SelectedDT'"; $result = DB_query($sql,$db); prnMsg(_('The selected demand type record has been deleted'),'succes'); + echo '<br>'; } // end of MRPDemands test } -if (!isset($SelectedDT)) { +if (!isset($SelectedDT) or isset($_GET['delete'])) { -//It could still be the second time the page has been run and a record has been selected -//for modification SelectedDT will exist because it was sent with the new call. If its +//It could still be the second time the page has been run and a record has been selected +//for modification SelectedDT will exist because it was sent with the new call. If its //the first time the page has been displayed with no parameters //then none of the above are true and the list of demand types will be displayed with //links to delete or edit each. These will call the same page again and allow update/input @@ -105,7 +110,7 @@ $result = DB_query($sql,$db); - echo "<table border=1> + echo "<table class=selection> <tr BGCOLOR =#800000><th>" . _('Demand Type') . "</th> <th>" . _('Description') . "</th> </tr></font>"; @@ -130,13 +135,13 @@ //end of ifs and buts! -if (isset($SelectedDT)) { +if (isset($SelectedDT) and !isset($_GET['delete'])) { echo "<div class='centre'><a href='" . $_SERVER['PHP_SELF'] . '?' . SID . "'>" . _('Show all Demand Types') . '</a></div>'; } echo "<p><form method='post' action='" . $_SERVER['PHP_SELF'] . '?' . SID . "'>"; -if (isset($SelectedDT)) { +if (isset($SelectedDT) and !isset($_GET['delete'])) { //editing an existing demand type $sql = "SELECT mrpdemandtype, @@ -152,13 +157,13 @@ echo '<input type=hidden name=SelectedDT value=' . $SelectedDT . '>'; echo "<input type=hidden name=mrpdemandtype value='" . $_POST['mrpdemandtype'] . "'>"; - echo '<table><tr><td>' ._('Demand Type') . ':</td><td>' . $_POST['mrpdemandtype'] . '</td></tr>'; + echo '<table class=selection><tr><td>' ._('Demand Type') . ':</td><td>' . $_POST['mrpdemandtype'] . '</td></tr>'; } else { //end of if $SelectedDT only do the else when a new record is being entered if (!isset($_POST['mrpdemandtype'])) { $_POST['mrpdemandtype'] = ''; } - echo '<table><tr> + echo '<table class=selection><tr> <td>' . _('Demand Type') . ":</td> <td><input type='Text' name='mrpdemandtype' size=6 maxlength=5 value='" . $_POST['mrpdemandtype'] . "'></td> </tr>" ; @@ -173,8 +178,8 @@ </tr> </table>"; -echo "<div class='centre'><input type='Submit' name='submit' value='" . _('Enter Information') . "'></div>"; +echo "<br><div class='centre'><input type='Submit' name='submit' value='" . _('Enter Information') . "'></div>"; echo '</form>'; include('includes/footer.inc'); -?> +?> \ No newline at end of file Modified: trunk/doc/Change.log.html =================================================================== --- trunk/doc/Change.log.html 2010-07-13 18:11:40 UTC (rev 3616) +++ trunk/doc/Change.log.html 2010-07-13 18:12:00 UTC (rev 3617) @@ -1,5 +1,6 @@ <p><font SIZE=4 COLOR=BLUE><b>webERP Change Log</b></font></p> <p></p> +<p>13/07/10 Tim: MRPDemandTypes.php - Bug fixes, correctly do the workflow, fix sql quoting errors and layout changes</p> <p>13/07/10 Tim: MRPDemands.php - Bug fixes, correctly do the workflow, fix sql quoting errors and layout changes</p> <p>13/07/10 Tim: MiscFunctions.js - Revert formatting changes till I can ascertain why the numbers only function stopped working</p> <p>12/07/10 Tim: MRPCreateDemand.php - Layout changes, sql quoting corrections</p> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <tim...@us...> - 2010-07-13 18:12:25
|
Revision: 3618 http://web-erp.svn.sourceforge.net/web-erp/?rev=3618&view=rev Author: tim_schofield Date: 2010-07-13 18:12:18 +0000 (Tue, 13 Jul 2010) Log Message: ----------- Gjergj Sheldija: MiscFunctions.php - Correctly show sourceforge logo only when an internet connection exists Modified Paths: -------------- trunk/doc/Change.log.html trunk/includes/MiscFunctions.php trunk/includes/footer.inc Modified: trunk/doc/Change.log.html =================================================================== --- trunk/doc/Change.log.html 2010-07-13 18:12:00 UTC (rev 3617) +++ trunk/doc/Change.log.html 2010-07-13 18:12:18 UTC (rev 3618) @@ -1,5 +1,6 @@ <p><font SIZE=4 COLOR=BLUE><b>webERP Change Log</b></font></p> <p></p> +<p>13/07/10 Gjergj Sheldija: MiscFunctions.php - Correctly show sourceforge logo only when an internet connection exists</p> <p>13/07/10 Tim: MRPDemandTypes.php - Bug fixes, correctly do the workflow, fix sql quoting errors and layout changes</p> <p>13/07/10 Tim: MRPDemands.php - Bug fixes, correctly do the workflow, fix sql quoting errors and layout changes</p> <p>13/07/10 Tim: MiscFunctions.js - Revert formatting changes till I can ascertain why the numbers only function stopped working</p> Modified: trunk/includes/MiscFunctions.php =================================================================== --- trunk/includes/MiscFunctions.php 2010-07-13 18:12:00 UTC (rev 3617) +++ trunk/includes/MiscFunctions.php 2010-07-13 18:12:18 UTC (rev 3618) @@ -273,7 +273,7 @@ // Either function args, or included file name(s) $msg .= ' ('; foreach( $frame['args'] as $val ) { - + $typ = gettype( $val ); switch( $typ ) { case 'array': @@ -293,15 +293,15 @@ case 'string': $msg .= $val . ', '; break; - + case 'integer': $msg .= sprintf( "%d, ", $val ); break; - + default: $msg .= '<' . gettype( $val ) . '>, '; break; - + } $msg .= ' )'; } @@ -313,4 +313,14 @@ return; } + +function http_file_exists($url) { + $f=@fopen($url,"r"); + if($f) { + fclose($f); + return true; + } + return false; +} + ?> \ No newline at end of file Modified: trunk/includes/footer.inc =================================================================== --- trunk/includes/footer.inc 2010-07-13 18:12:00 UTC (rev 3617) +++ trunk/includes/footer.inc 2010-07-13 18:12:18 UTC (rev 3618) @@ -25,7 +25,7 @@ echo '<tr><td class="footer">webERP ' . _('Copyright') . ' © weberp.org - '.date('Y').'</td></tr>'; - if(file_exists('http://sflogo.sourceforge.net/sflogo.php')) { + if(http_file_exists('http://sflogo.sourceforge.net/sflogo.php')) { echo '<tr><td class="footer"><a href="https://sourceforge.net/projects/web-erp"><img src="http://sflogo.sourceforge.net/sflogo.php?group_id=70949&type=12" width="120" height="30" border="0" alt="Get webERP web-based ERP Accounting at SourceForge.net. Fast, secure and Free Open Source software downloads" /></a></td></tr>'; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <tim...@us...> - 2010-07-13 18:12:46
|
Revision: 3619 http://web-erp.svn.sourceforge.net/web-erp/?rev=3619&view=rev Author: tim_schofield Date: 2010-07-13 18:12:40 +0000 (Tue, 13 Jul 2010) Log Message: ----------- Move version number to config table in database Modified Paths: -------------- trunk/config.distrib.php trunk/doc/Change.log.html trunk/includes/session.inc trunk/sql/mysql/upgrade3.11.1-3.12.sql Modified: trunk/config.distrib.php =================================================================== --- trunk/config.distrib.php 2010-07-13 18:12:18 UTC (rev 3618) +++ trunk/config.distrib.php 2010-07-13 18:12:40 UTC (rev 3619) @@ -13,7 +13,7 @@ // webERP version -$Version = '3.13-rc0 UTF-8 capable'; +// $Version = '3.13-rc0 UTF-8 capable'; // The timezone of the business - this allows the possibility of having // the web-server on a overseas machine but record local time Modified: trunk/doc/Change.log.html =================================================================== --- trunk/doc/Change.log.html 2010-07-13 18:12:18 UTC (rev 3618) +++ trunk/doc/Change.log.html 2010-07-13 18:12:40 UTC (rev 3619) @@ -1,5 +1,6 @@ <p><font SIZE=4 COLOR=BLUE><b>webERP Change Log</b></font></p> <p></p> +<p>13/07/10 Tim: Move version number to config table in database</p> <p>13/07/10 Gjergj Sheldija: MiscFunctions.php - Correctly show sourceforge logo only when an internet connection exists</p> <p>13/07/10 Tim: MRPDemandTypes.php - Bug fixes, correctly do the workflow, fix sql quoting errors and layout changes</p> <p>13/07/10 Tim: MRPDemands.php - Bug fixes, correctly do the workflow, fix sql quoting errors and layout changes</p> Modified: trunk/includes/session.inc =================================================================== --- trunk/includes/session.inc 2010-07-13 18:12:18 UTC (rev 3618) +++ trunk/includes/session.inc 2010-07-13 18:12:40 UTC (rev 3619) @@ -95,7 +95,7 @@ echo '<br /><br /><br />'; prnMsg(_('Your user role does not have any access defined for webERP. There is an error in the security setup for this user account'),'error'); include($PathPrefix . 'includes/footer.inc'); - exit; + exit; case UL_NOTVALID: $demo_text = '<font size="3" color="red"><b>' . _('incorrect password') . '</b></font><br /><b>' . _('The user/password combination') . '<br />' . _('is not a valid user of the system') . '</b>'; @@ -277,13 +277,16 @@ $debug = 0; } function CryptPass( $Password ) { - global $CryptFunction; - if ( $CryptFunction == 'sha1' ) { - return sha1($Password); - } elseif ( $CryptFunction == 'md5' ) { - return md5($Password); + global $CryptFunction; + if ( $CryptFunction == 'sha1' ) { + return sha1($Password); + } elseif ( $CryptFunction == 'md5' ) { + return md5($Password); } else { - return $Password; - } + return $Password; + } } + +$Version = $_SESSION['VersionNumber']; + ?> Modified: trunk/sql/mysql/upgrade3.11.1-3.12.sql =================================================================== --- trunk/sql/mysql/upgrade3.11.1-3.12.sql 2010-07-13 18:12:18 UTC (rev 3618) +++ trunk/sql/mysql/upgrade3.11.1-3.12.sql 2010-07-13 18:12:40 UTC (rev 3619) @@ -278,4 +278,6 @@ INSERT INTO `suppliertype` VALUES(1, 'Default'); ALTER TABLE `suppliers` ADD COLUMN `supptype` tinyint(4) NOT NULL DEFAULT 1 AFTER `address6`; -ALTER TABLE `loctransfers` CHANGE COLUMN `shipqty` `shipqty` double NOT NULL DEFAULT 0.0; \ No newline at end of file +ALTER TABLE `loctransfers` CHANGE COLUMN `shipqty` `shipqty` double NOT NULL DEFAULT 0.0; + +INSERT INTO `config` VALUES ('VersionNumber', '3.12'); \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <tim...@us...> - 2010-07-13 18:13:12
|
Revision: 3620 http://web-erp.svn.sourceforge.net/web-erp/?rev=3620&view=rev Author: tim_schofield Date: 2010-07-13 18:13:04 +0000 (Tue, 13 Jul 2010) Log Message: ----------- Add logo.png file and select png before jpg if present Modified Paths: -------------- trunk/doc/Change.log.html trunk/includes/session.inc Added Paths: ----------- trunk/companies/weberpdemo/logo.png Added: trunk/companies/weberpdemo/logo.png =================================================================== --- trunk/companies/weberpdemo/logo.png (rev 0) +++ trunk/companies/weberpdemo/logo.png 2010-07-13 18:13:04 UTC (rev 3620) @@ -0,0 +1,678 @@ +\x89PNG + + |
From: <tim...@us...> - 2010-07-13 21:38:01
|
Revision: 3621 http://web-erp.svn.sourceforge.net/web-erp/?rev=3621&view=rev Author: tim_schofield Date: 2010-07-13 21:37:55 +0000 (Tue, 13 Jul 2010) Log Message: ----------- Bug fixes, correctly do the workflow, fix sql quoting errors and layout changes Modified Paths: -------------- trunk/MRPPlannedPurchaseOrders.php trunk/doc/Change.log.html Modified: trunk/MRPPlannedPurchaseOrders.php =================================================================== --- trunk/MRPPlannedPurchaseOrders.php 2010-07-13 18:13:04 UTC (rev 3620) +++ trunk/MRPPlannedPurchaseOrders.php 2010-07-13 21:37:55 UTC (rev 3621) @@ -29,9 +29,9 @@ $wheredate = " "; $reportdate = " "; if (is_Date($_POST['cutoffdate'])) { - $formatdate = FormatDateForSQL($_POST['cutoffdate']); - $wheredate = ' AND duedate <= "' . $formatdate . '" '; - $reportdate = _(' Through ') . Format_Date($_POST['cutoffdate']); + $formatdate = FormatDateForSQL($_POST['cutoffdate']); + $wheredate = ' AND duedate <= "' . $formatdate . '" '; + $reportdate = _(' Through ') . Format_Date($_POST['cutoffdate']); } if ($_POST['Consolidation'] == 'None') { $sql = 'SELECT mrpplannedorders.*, @@ -41,64 +41,64 @@ stockmaster.decimalplaces, stockmaster.actualcost, (stockmaster.materialcost + stockmaster.labourcost + - stockmaster.overheadcost ) as computedcost + stockmaster.overheadcost ) as computedcost FROM mrpplannedorders, stockmaster WHERE mrpplannedorders.part = stockmaster.stockid ' . "$wheredate" . ' AND stockmaster.mbflag IN ("B","P") ORDER BY mrpplannedorders.part,mrpplannedorders.duedate'; } elseif ($_POST['Consolidation'] == 'Weekly') { - $sql = 'SELECT mrpplannedorders.part, - SUM(mrpplannedorders.supplyquantity) as supplyquantity, - TRUNCATE(((TO_DAYS(duedate) - TO_DAYS(CURRENT_DATE)) / 7),0) AS weekindex, - MIN(mrpplannedorders.duedate) as duedate, - MIN(mrpplannedorders.mrpdate) as mrpdate, - COUNT(*) AS consolidatedcount, - stockmaster.stockid, + $sql = 'SELECT mrpplannedorders.part, + SUM(mrpplannedorders.supplyquantity) as supplyquantity, + TRUNCATE(((TO_DAYS(duedate) - TO_DAYS(CURRENT_DATE)) / 7),0) AS weekindex, + MIN(mrpplannedorders.duedate) as duedate, + MIN(mrpplannedorders.mrpdate) as mrpdate, + COUNT(*) AS consolidatedcount, + stockmaster.stockid, stockmaster.description, stockmaster.mbflag, stockmaster.decimalplaces, stockmaster.actualcost, (stockmaster.materialcost + stockmaster.labourcost + - stockmaster.overheadcost ) as computedcost + stockmaster.overheadcost ) as computedcost FROM mrpplannedorders, stockmaster WHERE mrpplannedorders.part = stockmaster.stockid ' . "$wheredate" . ' AND stockmaster.mbflag IN ("B","P") GROUP BY mrpplannedorders.part, - weekindex, - stockmaster.stockid, - stockmaster.description, - stockmaster.mbflag, - stockmaster.decimalplaces, - stockmaster.actualcost, + weekindex, + stockmaster.stockid, + stockmaster.description, + stockmaster.mbflag, + stockmaster.decimalplaces, + stockmaster.actualcost, stockmaster.materialcost, stockmaster.labourcost, stockmaster.overheadcost, computedcost ORDER BY mrpplannedorders.part,weekindex'; } else { // This else consolidates by month - $sql = 'SELECT mrpplannedorders.part, - SUM(mrpplannedorders.supplyquantity) as supplyquantity, - EXTRACT(YEAR_MONTH from duedate) AS yearmonth, - MIN(mrpplannedorders.duedate) as duedate, - MIN(mrpplannedorders.mrpdate) as mrpdate, - COUNT(*) AS consolidatedcount, - stockmaster.stockid, + $sql = 'SELECT mrpplannedorders.part, + SUM(mrpplannedorders.supplyquantity) as supplyquantity, + EXTRACT(YEAR_MONTH from duedate) AS yearmonth, + MIN(mrpplannedorders.duedate) as duedate, + MIN(mrpplannedorders.mrpdate) as mrpdate, + COUNT(*) AS consolidatedcount, + stockmaster.stockid, stockmaster.description, stockmaster.mbflag, stockmaster.decimalplaces, stockmaster.actualcost, (stockmaster.materialcost + stockmaster.labourcost + - stockmaster.overheadcost ) as computedcost + stockmaster.overheadcost ) as computedcost FROM mrpplannedorders, stockmaster WHERE mrpplannedorders.part = stockmaster.stockid ' . "$wheredate" . ' AND stockmaster.mbflag IN ("B","P") GROUP BY mrpplannedorders.part, - yearmonth, - stockmaster.stockid, - stockmaster.description, - stockmaster.mbflag, - stockmaster.decimalplaces, - stockmaster.actualcost, + yearmonth, + stockmaster.stockid, + stockmaster.description, + stockmaster.mbflag, + stockmaster.decimalplaces, + stockmaster.actualcost, stockmaster.materialcost, stockmaster.labourcost, stockmaster.overheadcost, @@ -113,7 +113,7 @@ prnMsg( _('The MRP planned purchase orders could not be retrieved by the SQL because') . ' ' . DB_error_msg($db),'error'); echo "<br><a href='" .$rootpath .'/index.php?' . SID . "'>" . _('Back to the menu') . '</a>'; if ($debug==1){ - echo "<br>$sql"; + echo "<br>$sql"; } include('includes/footer.inc'); exit; @@ -128,22 +128,23 @@ } PrintHeader($pdf,$YPos,$PageNumber,$Page_Height,$Top_Margin,$Left_Margin, - $Page_Width,$Right_Margin,$_POST['Consolidation'],$reportdate); + $Page_Width,$Right_Margin,$_POST['Consolidation'],$reportdate); - $Total_Shortage=0; - $Partctr = 0; - $fill = false; - $pdf->SetFillColor(224,235,255); // Defines color to make alternating lines highlighted - $FontSize=8; - $holdpart = " "; - $holddescription = " "; - $holdmbflag = " "; - $holdcost = " "; - $holddecimalplaces = 0; - $totalpartqty = 0; - $totalpartcost = 0; + $Total_Shortage=0; + $Partctr = 0; + $fill = false; + $pdf->SetFillColor(224,235,255); // Defines color to make alternating lines highlighted + $FontSize=8; + $holdpart = " "; + $holddescription = " "; + $holdmbflag = " "; + $holdcost = " "; + $holddecimalplaces = 0; + $totalpartqty = 0; + $totalpartcost = 0; + $Total_Extcost = 0; - While ($myrow = DB_fetch_array($result,$db)){ + while ($myrow = DB_fetch_array($result,$db)){ $YPos -=$line_height; // Use to alternate between lines with transparent and painted background @@ -157,7 +158,7 @@ $pdf->addTextWrap(180,$YPos,50,$FontSize,_('Unit Cost: '),'center',0,$fill); $pdf->addTextWrap(230,$YPos,40,$FontSize,number_format($holdcost,2),'right',0,$fill); $pdf->addTextWrap(270,$YPos,50,$FontSize,number_format($totalpartqty, - $holddecimalplaces),'right',0,$fill); + $holddecimalplaces),'right',0,$fill); $pdf->addTextWrap(320,$YPos,60,$FontSize,number_format($totalpartcost,2),'right',0,$fill); $pdf->addTextWrap(380,$YPos,30,$FontSize,_('M/B: '),'right',0,$fill); $pdf->addTextWrap(410,$YPos,15,$FontSize,$holdmbflag,'right',0,$fill); @@ -165,7 +166,7 @@ list($lastdate,$lastsupplier,$preferredsupplier) = GetPartInfo($db,$holdpart); $displaydate = $lastdate; if (!is_Date($lastdate)) { - $displaydate = " "; + $displaydate = " "; } $YPos -= $line_height; $pdf->addTextWrap(50,$YPos,80,$FontSize,_('Last Purchase Date: '),'left',0,$fill); @@ -190,7 +191,7 @@ $pdf->addTextWrap(150,$YPos,50,$FontSize,$FormatedSupDueDate,'right',0,$fill); $pdf->addTextWrap(200,$YPos,60,$FontSize,$FormatedSupMRPDate,'right',0,$fill); $pdf->addTextWrap(260,$YPos,50,$FontSize,number_format($myrow['supplyquantity'], - $myrow['decimalplaces']),'right',0,$fill); + $myrow['decimalplaces']),'right',0,$fill); $pdf->addTextWrap(310,$YPos,60,$FontSize,number_format($extcost,2),'right',0,$fill); if ($_POST['Consolidation'] == 'None'){ $pdf->addTextWrap(370,$YPos,80,$FontSize,$myrow['ordertype'],'right',0,$fill); @@ -211,20 +212,20 @@ if ($YPos < $Bottom_Margin + $line_height){ PrintHeader($pdf,$YPos,$PageNumber,$Page_Height,$Top_Margin,$Left_Margin,$Page_Width, - $Right_Margin,$_POST['Consolidation'],$reportdate); + $Right_Margin,$_POST['Consolidation'],$reportdate); } } /*end while loop */ // Print summary information for last part $YPos -=$line_height; - $pdf->addTextWrap(40,$YPos,130,$FontSize,$holddescription,'',0,$fill); + $pdf->addTextWrap(40,$YPos,130,$FontSize,$holddescription,'',0,$fill); $pdf->addTextWrap(170,$YPos,50,$FontSize,_('Unit Cost: '),'center',0,$fill); $pdf->addTextWrap(220,$YPos,40,$FontSize,number_format($holdcost,2),'right',0,$fill); $pdf->addTextWrap(260,$YPos,50,$FontSize,number_format($totalpartqty,$holddecimalplaces),'right',0,$fill); $pdf->addTextWrap(310,$YPos,60,$FontSize,number_format($totalpartcost,2),'right',0,$fill); $pdf->addTextWrap(370,$YPos,30,$FontSize,_('M/B: '),'right',0,$fill); $pdf->addTextWrap(400,$YPos,15,$FontSize,$holdmbflag,'right',0,$fill); - // Get and print supplier info for part + // Get and print supplier info for part list($lastdate,$lastsupplier,$preferredsupplier) = GetPartInfo($db,$holdpart); $displaydate = $lastdate; if (!is_Date($lastdate)) { @@ -241,16 +242,16 @@ $YPos -= (2*$line_height); if ($YPos < $Bottom_Margin + $line_height){ - PrintHeader($pdf,$YPos,$PageNumber,$Page_Height,$Top_Margin,$Left_Margin,$Page_Width, - $Right_Margin,$_POST['Consolidation'],$reportdate); + PrintHeader($pdf,$YPos,$PageNumber,$Page_Height,$Top_Margin,$Left_Margin,$Page_Width, + $Right_Margin,$_POST['Consolidation'],$reportdate); // include('includes/MRPPlannedPurchaseOrdersPageHeader.inc'); } /*Print out the grand totals */ - $pdf->addTextWrap($Left_Margin,$YPos,120,$FontSize,_('Number of Purchase Orders: '), 'left'); - $pdf->addTextWrap(150,$YPos,30,$FontSize,$Partctr, 'left'); + $pdf->addTextWrap($Left_Margin,$YPos,120,$FontSize,_('Number of Purchase Orders: '), 'left'); + $pdf->addTextWrap(150,$YPos,30,$FontSize,$Partctr, 'left'); $pdf->addTextWrap(200,$YPos,100,$FontSize,_('Total Extended Cost:'), 'right'); $DisplayTotalVal = number_format($Total_Extcost,2); - $pdf->addTextWrap(310,$YPos,60,$FontSize,$DisplayTotalVal, 'right'); + $pdf->addTextWrap(310,$YPos,60,$FontSize,$DisplayTotalVal, 'right'); $pdf->OutputD($_SESSION['DatabaseName'] . '_MRP_Planned_Purchase_Orders_' . Date('Y-m-d') . '.pdf'); $pdf->__destruct(); @@ -259,8 +260,10 @@ $title=_('MRP Planned Purchase Orders Reporting'); include('includes/header.inc'); + echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/inventory.png" title="' . + _('Inventory') . '" alt="">' . ' ' . $title . '</p>'; - echo '</br></br><form action=' . $_SERVER['PHP_SELF'] . ' method="post"><table>'; + echo '<form action=' . $_SERVER['PHP_SELF'] . ' method="post"><table class=selection>'; echo '<tr><td>' . _('Consolidation') . ':</td><td><select name="Consolidation">'; echo '<option selected value="None">' . _('None') . '</option>'; echo '<option value="Weekly">' . _('Weekly') . '</option>'; @@ -270,15 +273,16 @@ echo '<option selected value="yes">' . _('Print With Alternating Highlighted Lines'); echo '<option value="no">' . _('Plain Print'); echo '</select></td></tr>'; - echo '<tr><td>' . _('Cut Off Date') . ':</td><td><input type ="text" class=date alt="'.$_SESSION['DefaultDateFormat'] .'" name="cutoffdate" size="10" value="'.date($_SESSION['DefaultDateFormat']).'"></tr>'; - echo '</table></br><div class="centre"><input type="submit" name="PrintPDF" value="' . _('Print PDF') . '"></div>'; + echo '<tr><td>' . _('Cut Off Date') . ':</td><td><input type ="text" class=date alt="'.$_SESSION['DefaultDateFormat'] . + '" name="cutoffdate" size="10" value="'.date($_SESSION['DefaultDateFormat']).'"></td></tr>'; + echo '</table><p><div class="centre"><input type="submit" name="PrintPDF" value="' . _('Print PDF') . '"></div></form>'; include('includes/footer.inc'); } /*end of else not PrintPDF */ function PrintHeader(&$pdf,&$YPos,&$PageNumber,$Page_Height,$Top_Margin,$Left_Margin, - $Page_Width,$Right_Margin,$consolidation,$reportdate) { + $Page_Width,$Right_Margin,$consolidation,$reportdate) { /*PDF page header for MRP Planned Work Orders report */ if ($PageNumber>1){ @@ -333,31 +337,35 @@ // Get last purchase order date and supplier for part, and also preferred supplier // Printed when there is a part break $sql = 'SELECT orddate as maxdate, - purchorders.orderno + purchorders.orderno FROM purchorders, purchorderdetails WHERE purchorders.orderno = purchorderdetails.orderno - AND purchorderdetails.itemcode = ' . "'$part' " . - 'order by orddate desc limit 1'; + AND purchorderdetails.itemcode = "'.$part .'" + ORDER BY orddate DESC LIMIT 1'; $result = DB_query($sql,$db); - $myrow = DB_fetch_array($result,$db); - $partinfo[] = ConvertSQLDate($myrow['maxdate']); - $orderno = $myrow['orderno']; - $sql = 'SELECT supplierno + if (DB_num_rows($result)>0) { + $myrow = DB_fetch_array($result,$db); + $partinfo[] = ConvertSQLDate($myrow['maxdate']); + $orderno = $myrow['orderno']; + $sql = 'SELECT supplierno FROM purchorders - WHERE purchorders.orderno = ' . "'$orderno'"; - $result = DB_query($sql,$db); - $myrow = DB_fetch_array($result,$db); - $partinfo[] = $myrow['supplierno']; - $sql = 'SELECT supplierno + WHERE purchorders.orderno = "'.$orderno . '"'; + $result = DB_query($sql,$db); + $myrow = DB_fetch_array($result,$db); + $partinfo[] = $myrow['supplierno']; + $sql = 'SELECT supplierno FROM purchdata - WHERE stockid = ' . "'$part'" . - ' AND preferred="1"'; - $result = DB_query($sql,$db); - $myrow = DB_fetch_array($result,$db); - $partinfo[] = $myrow['supplierno']; - return $partinfo; + WHERE stockid = "' . $part . '" + AND preferred="1"'; + $result = DB_query($sql,$db); + $myrow = DB_fetch_array($result,$db); + $partinfo[] = $myrow['supplierno']; + return $partinfo; + } else { + return array('','',''); + } } -?> +?> \ No newline at end of file Modified: trunk/doc/Change.log.html =================================================================== --- trunk/doc/Change.log.html 2010-07-13 18:13:04 UTC (rev 3620) +++ trunk/doc/Change.log.html 2010-07-13 21:37:55 UTC (rev 3621) @@ -1,5 +1,6 @@ <p><font SIZE=4 COLOR=BLUE><b>webERP Change Log</b></font></p> <p></p> +<p>13/07/10 Tim: MRPPlannedPurchaseOrders.php - Bug fixes, correctly do the workflow, fix sql quoting errors and layout changes</p> <p>13/07/10 Tim: Add logo.png file and select png before jpg if present</p> <p>13/07/10 Tim: Move version number to config table in database</p> <p>13/07/10 Gjergj Sheldija: MiscFunctions.php - Correctly show sourceforge logo only when an internet connection exists</p> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <tim...@us...> - 2010-07-14 10:43:43
|
Revision: 3622 http://web-erp.svn.sourceforge.net/web-erp/?rev=3622&view=rev Author: tim_schofield Date: 2010-07-14 10:43:37 +0000 (Wed, 14 Jul 2010) Log Message: ----------- Fix sql quoting errors and layout changes Modified Paths: -------------- trunk/MRPPlannedWorkOrders.php trunk/doc/Change.log.html Modified: trunk/MRPPlannedWorkOrders.php =================================================================== --- trunk/MRPPlannedWorkOrders.php 2010-07-13 21:37:55 UTC (rev 3621) +++ trunk/MRPPlannedWorkOrders.php 2010-07-14 10:43:37 UTC (rev 3622) @@ -21,9 +21,9 @@ $wheredate = " "; $reportdate = " "; if (is_Date($_POST['cutoffdate'])) { - $formatdate = FormatDateForSQL($_POST['cutoffdate']); - $wheredate = ' AND duedate <= "' . $formatdate . '" '; - $reportdate = _(' Through ') . $_POST['cutoffdate']; + $formatdate = FormatDateForSQL($_POST['cutoffdate']); + $wheredate = ' AND duedate <= "' . $formatdate . '" '; + $reportdate = _(' Through ') . $_POST['cutoffdate']; } if ($_POST['Consolidation'] == 'None') { @@ -33,70 +33,70 @@ stockmaster.mbflag, stockmaster.decimalplaces, stockmaster.actualcost, - (stockmaster.materialcost + stockmaster.labourcost + - stockmaster.overheadcost ) as computedcost + (stockmaster.materialcost + stockmaster.labourcost + + stockmaster.overheadcost ) as computedcost FROM mrpplannedorders, stockmaster WHERE mrpplannedorders.part = stockmaster.stockid ' . "$wheredate" . ' AND stockmaster.mbflag = "M" ORDER BY mrpplannedorders.part,mrpplannedorders.duedate'; } elseif ($_POST['Consolidation'] == 'Weekly') { - $sql = 'SELECT mrpplannedorders.part, - SUM(mrpplannedorders.supplyquantity) as supplyquantity, - TRUNCATE(((TO_DAYS(duedate) - TO_DAYS(CURRENT_DATE)) / 7),0) AS weekindex, - MIN(mrpplannedorders.duedate) as duedate, - MIN(mrpplannedorders.mrpdate) as mrpdate, - COUNT(*) AS consolidatedcount, - stockmaster.stockid, + $sql = 'SELECT mrpplannedorders.part, + SUM(mrpplannedorders.supplyquantity) as supplyquantity, + TRUNCATE(((TO_DAYS(duedate) - TO_DAYS(CURRENT_DATE)) / 7),0) AS weekindex, + MIN(mrpplannedorders.duedate) as duedate, + MIN(mrpplannedorders.mrpdate) as mrpdate, + COUNT(*) AS consolidatedcount, + stockmaster.stockid, stockmaster.description, stockmaster.mbflag, stockmaster.decimalplaces, stockmaster.actualcost, - (stockmaster.materialcost + stockmaster.labourcost + - stockmaster.overheadcost ) as computedcost + (stockmaster.materialcost + stockmaster.labourcost + + stockmaster.overheadcost ) as computedcost FROM mrpplannedorders, stockmaster WHERE mrpplannedorders.part = stockmaster.stockid ' . "$wheredate" . ' AND stockmaster.mbflag = "M" GROUP BY mrpplannedorders.part, - weekindex, - stockmaster.stockid, - stockmaster.description, - stockmaster.mbflag, - stockmaster.decimalplaces, - stockmaster.actualcost, - stockmaster.materialcost, - stockmaster.labourcost, - stockmaster.overheadcost, - computedcost + weekindex, + stockmaster.stockid, + stockmaster.description, + stockmaster.mbflag, + stockmaster.decimalplaces, + stockmaster.actualcost, + stockmaster.materialcost, + stockmaster.labourcost, + stockmaster.overheadcost, + computedcost ORDER BY mrpplannedorders.part,weekindex - '; + '; } else { - $sql = 'SELECT mrpplannedorders.part, - SUM(mrpplannedorders.supplyquantity) as supplyquantity, - EXTRACT(YEAR_MONTH from duedate) AS yearmonth, - MIN(mrpplannedorders.duedate) as duedate, - MIN(mrpplannedorders.mrpdate) as mrpdate, - COUNT(*) AS consolidatedcount, - stockmaster.stockid, + $sql = 'SELECT mrpplannedorders.part, + SUM(mrpplannedorders.supplyquantity) as supplyquantity, + EXTRACT(YEAR_MONTH from duedate) AS yearmonth, + MIN(mrpplannedorders.duedate) as duedate, + MIN(mrpplannedorders.mrpdate) as mrpdate, + COUNT(*) AS consolidatedcount, + stockmaster.stockid, stockmaster.description, stockmaster.mbflag, stockmaster.decimalplaces, stockmaster.actualcost, (stockmaster.materialcost + stockmaster.labourcost + - stockmaster.overheadcost ) as computedcost, + stockmaster.overheadcost ) as computedcost, FROM mrpplannedorders, stockmaster WHERE mrpplannedorders.part = stockmaster.stockid ' . "$wheredate" . ' AND stockmaster.mbflag = "M" GROUP BY mrpplannedorders.part, - yearmonth, - stockmaster.stockid, - stockmaster.description, - stockmaster.mbflag, - stockmaster.decimalplaces, - stockmaster.actualcost, - stockmaster.materialcost, - stockmaster.labourcost, - stockmaster.overheadcost, - computedcost + yearmonth, + stockmaster.stockid, + stockmaster.description, + stockmaster.mbflag, + stockmaster.decimalplaces, + stockmaster.actualcost, + stockmaster.materialcost, + stockmaster.labourcost, + stockmaster.overheadcost, + computedcost ORDER BY mrpplannedorders.part,yearmonth '; }; $result = DB_query($sql,$db,'','',false,true); @@ -107,7 +107,7 @@ prnMsg( _('The MRP planned work orders could not be retrieved by the SQL because') . ' ' . DB_error_msg($db),'error'); echo "<br><a href='" .$rootpath .'/index.php?' . SID . "'>" . _('Back to the menu') . '</a>'; if ($debug==1){ - echo "<br>$sql"; + echo "<br>$sql"; } include('includes/footer.inc'); exit; @@ -123,7 +123,7 @@ - If (isset($_POST['PrintPDF'])) { // Print planned work orders + if (isset($_POST['PrintPDF'])) { // Print planned work orders include('includes/PDFStarter.php'); @@ -150,8 +150,9 @@ $holddecimalplaces = 0; $totalpartqty = 0; $totalpartcost = 0; + $Total_Extcost = 0; - While ($myrow = DB_fetch_array($result,$db)){ + while ($myrow = DB_fetch_array($result,$db)){ $YPos -=$line_height; // Use to alternate between lines with transparent and painted background @@ -244,13 +245,14 @@ $title = _('Review/Convert MRP Planned Work Orders'); include('includes/header.inc'); + echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/inventory.png" title="' . + _('Inventory') . '" alt="">' . ' ' . $title . '</p>'; - echo " - <br /><br /><form action='MRPConvertWorkOrders.php' method='post'>"; - echo "<div class='centre'><h3>Conolidation: " . $_POST['Consolidation'] . "</h3></div>"; - echo "<div class='centre'><h3>Cutoff Date: " . $_POST['cutoffdate'] . "</h3></div>"; - echo "<table><tr> - <th></th> + echo "<form action='MRPConvertWorkOrders.php' method='post'>"; + echo "<table class=selection>"; + echo "<tr><th colspan=9><font size=3 color=blue>Consolidation: " . $_POST['Consolidation'] . + " Cutoff Date: " . $_POST['cutoffdate'] . "</font></th></tr>"; + echo "<tr><th></th> <th>" . _('Code') . "</th> <th>" . _('Description') . "</th> <th>" . _('MRP Date') . "</th> @@ -263,6 +265,7 @@ $totalpartqty = 0; $totalpartcost = 0; + $Total_Extcost = 0; $j=1; //row ID $k=0; //row colour counter While ($myrow = DB_fetch_array($result,$db)){ @@ -290,7 +293,9 @@ printf("\n <td class=number>%s</td>", number_format($myrow['supplyquantity'],$myrow['decimalplaces'])); printf("\n <td class=number>%.2f</td>", number_format($myrow['computedcost'],2)); printf("\n <td class=number>%.2f</td>", number_format($myrow['supplyquantity'] * $myrow['computedcost'],2)); - printf("\n <td class=number>%s</td>", $myrow['consolidatedcount']); + if ($_POST['Consolidation']!='None') { + printf("\n <td class=number>%s</td>", $myrow['consolidatedcount']); + } echo "</tr>"; $j++; @@ -320,8 +325,10 @@ $title=_('MRP Planned Work Orders Reporting'); include('includes/header.inc'); + echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/inventory.png" title="' . + _('Inventory') . '" alt="">' . ' ' . $title . '</p>'; - echo '</br></br><form action=' . $_SERVER['PHP_SELF'] . " method='post'><table>"; + echo '</br></br><form action=' . $_SERVER['PHP_SELF'] . " method='post'><table class=selection>"; echo '<tr><td>' . _('Consolidation') . ":</td><td><select name='Consolidation'>"; echo "<option selected value='None'>" . _('None'); echo "<option value='Weekly'>" . _('Weekly'); @@ -332,14 +339,14 @@ echo "<option value='no'>" . _('Plain Print'); echo '</select></td></tr>'; echo '<tr><td>' . _('Cut Off Date') . ":</td><td><input type ='text' class=date alt='".$_SESSION['DefaultDateFormat'] ."' name='cutoffdate' size='10' value='".date($_SESSION['DefaultDateFormat'])."'></tr>"; - echo "</table></br><div class='centre'><input type=submit name='Review' value='" . _('Review') . "'> <input type=submit name='PrintPDF' value='" . _('Print PDF') . "'></div>"; + echo "</table><p><div class='centre'><input type=submit name='Review' value='" . _('Review') . "'> <input type=submit name='PrintPDF' value='" . _('Print PDF') . "'></div>"; include('includes/footer.inc'); } /*end of else not PrintPDF */ function PrintHeader(&$pdf,&$YPos,&$PageNumber,$Page_Height,$Top_Margin,$Left_Margin, - $Page_Width,$Right_Margin,$consolidation,$reportdate) { + $Page_Width,$Right_Margin,$consolidation,$reportdate) { /*PDF page header for MRP Planned Work Orders report */ if ($PageNumber>1){ @@ -389,4 +396,4 @@ $YPos =$YPos - (2*$line_height); $PageNumber++; } // End of PrintHeader() function -?> +?> \ No newline at end of file Modified: trunk/doc/Change.log.html =================================================================== --- trunk/doc/Change.log.html 2010-07-13 21:37:55 UTC (rev 3621) +++ trunk/doc/Change.log.html 2010-07-14 10:43:37 UTC (rev 3622) @@ -1,5 +1,6 @@ <p><font SIZE=4 COLOR=BLUE><b>webERP Change Log</b></font></p> <p></p> +<p>14/07/10 Tim: MRPPlannedWorkOrders.php - Fix sql quoting errors and layout changes</p> <p>13/07/10 Tim: MRPPlannedPurchaseOrders.php - Bug fixes, correctly do the workflow, fix sql quoting errors and layout changes</p> <p>13/07/10 Tim: Add logo.png file and select png before jpg if present</p> <p>13/07/10 Tim: Move version number to config table in database</p> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <tim...@us...> - 2010-07-15 10:29:31
|
Revision: 3623 http://web-erp.svn.sourceforge.net/web-erp/?rev=3623&view=rev Author: tim_schofield Date: 2010-07-15 10:29:25 +0000 (Thu, 15 Jul 2010) Log Message: ----------- Bug fixes to show decimal places correctly and other fixes, fix sql quoting errors and layout changes Modified Paths: -------------- trunk/PDFStockCheckComparison.php trunk/StockCheck.php trunk/doc/Change.log.html Modified: trunk/PDFStockCheckComparison.php =================================================================== --- trunk/PDFStockCheckComparison.php 2010-07-14 10:43:37 UTC (rev 3622) +++ trunk/PDFStockCheckComparison.php 2010-07-15 10:29:25 UTC (rev 3623) @@ -291,7 +291,7 @@ include('includes/PDFStockComparisonPageHeader.inc'); } } // end of loop printing count information - $LeftOvers = $pdf->addTextWrap($LeftMargin, $YPos, 375-$LeftMargin, $FontSize, _('Total for') . ': ' . $CheckItemRow['stockid'], 'right'); + $LeftOvers = $pdf->addTextWrap($Left_Margin, $YPos, 375-$Left_Margin, $FontSize, _('Total for') . ': ' . $CheckItemRow['stockid'], 'right'); $LeftOvers = $pdf->addTextWrap(375, $YPos, 60, $FontSize, $TotalCount, 'right'); $LeftOvers = $pdf->addTextWrap(485, $YPos, 60, $FontSize, $TotalCount-$CheckItemRow['qoh'], 'right'); } //end of if there are counts to print Modified: trunk/StockCheck.php =================================================================== --- trunk/StockCheck.php 2010-07-14 10:43:37 UTC (rev 3622) +++ trunk/StockCheck.php 2010-07-15 10:29:25 UTC (rev 3623) @@ -22,20 +22,20 @@ $sql = 'TRUNCATE TABLE stockcheckfreeze'; $result = DB_query($sql,$db); $sql = "INSERT INTO stockcheckfreeze (stockid, - loccode, - qoh) - SELECT locstock.stockid, - locstock.loccode, - locstock.quantity - FROM locstock, - stockmaster - WHERE locstock.stockid=stockmaster.stockid and - locstock.loccode='" . $_POST['Location'] . "' AND - stockmaster.categoryid>='" . $_POST['FromCriteria'] . "' AND - stockmaster.categoryid<='" . $_POST['ToCriteria'] . "' AND - stockmaster.mbflag!='A' AND - stockmaster.mbflag!='K' AND - stockmaster.mbflag!='D'"; + loccode, + qoh) + SELECT locstock.stockid, + locstock.loccode, + locstock.quantity + FROM locstock, + stockmaster + WHERE locstock.stockid=stockmaster.stockid and + locstock.loccode='" . $_POST['Location'] . "' AND + stockmaster.categoryid>='" . $_POST['FromCriteria'] . "' AND + stockmaster.categoryid<='" . $_POST['ToCriteria'] . "' AND + stockmaster.mbflag!='A' AND + stockmaster.mbflag!='K' AND + stockmaster.mbflag!='D'"; $result = DB_query($sql, $db,'','',false,false); if (DB_error_no($db) !=0) { @@ -44,7 +44,7 @@ prnMsg(_('The inventory quantities could not be added to the freeze file because') . ' ' . DB_error_msg($db),'error'); echo '<br><a href="' . $rootpath . '/index.php?' . SID . '">' . _('Back to the menu') . '</a>'; if ($debug==1){ - echo '<br>' . $sql; + echo '<br>' . $sql; } include('includes/footer.inc'); exit; @@ -53,10 +53,10 @@ if ($_POST['MakeStkChkData']=='AddUpdate'){ $sql = "DELETE stockcheckfreeze FROM stockcheckfreeze - INNER JOIN stockmaster ON stockcheckfreeze.stockid=stockmaster.stockid - WHERE stockmaster.categoryid >='" . $_POST['FromCriteria'] . "' AND - stockmaster.categoryid<='" . $_POST['ToCriteria'] . "' AND - stockcheckfreeze.loccode='" . $_POST['Location'] . "'"; + INNER JOIN stockmaster ON stockcheckfreeze.stockid=stockmaster.stockid + WHERE stockmaster.categoryid >='" . $_POST['FromCriteria'] . "' AND + stockmaster.categoryid<='" . $_POST['ToCriteria'] . "' AND + stockcheckfreeze.loccode='" . $_POST['Location'] . "'"; $result = DB_query($sql,$db,'','',false,false); if (DB_error_no($db) !=0) { @@ -65,15 +65,15 @@ prnMsg(_('The old quantities could not be deleted from the freeze file because') . ' ' . DB_error_msg($db),'error'); echo '<br><a href="' . $rootpath . '/index.php?' . SID . '">' . _('Back to the menu') . '</a>'; if ($debug==1){ - echo '<br>' . $sql; + echo '<br>' . $sql; } include('includes/footer.inc'); exit; } $sql = "INSERT INTO stockcheckfreeze (stockid, - loccode, - qoh) + loccode, + qoh) SELECT locstock.stockid, loccode , locstock.quantity @@ -82,10 +82,10 @@ WHERE locstock.stockid=stockmaster.stockid AND locstock.loccode='" . $_POST['Location'] . "' AND stockmaster.categoryid>='" . $_POST['FromCriteria'] . "' AND - stockmaster.categoryid<='" . $_POST['ToCriteria'] . "' AND - stockmaster.mbflag!='A' AND - stockmaster.mbflag!='K' AND - stockmaster.mbflag!='D'"; + stockmaster.categoryid<='" . $_POST['ToCriteria'] . "' AND + stockmaster.mbflag!='A' AND + stockmaster.mbflag!='K' AND + stockmaster.mbflag!='D'"; $result = DB_query($sql, $db,'','',false,false); if (DB_error_no($db) !=0) { @@ -94,7 +94,7 @@ prnMsg(_('The inventory quantities could not be added to the freeze file because') . ' ' . DB_error_msg($db),'error'); echo '<br><a href="' . $rootpath . '/index.php?' . SID . '">' . _('Back to the menu') . '</a>'; if ($debug==1){ - echo '<br>' . $sql; + echo '<br>' . $sql; } include('includes/footer.inc'); exit; @@ -109,26 +109,27 @@ } - $SQL = "SELECT stockmaster.categoryid, - stockcheckfreeze.stockid, - stockmaster.description, - stockcategory.categorydescription, - stockcheckfreeze.qoh - FROM stockcheckfreeze, - stockmaster, - stockcategory - WHERE stockcheckfreeze.stockid=stockmaster.stockid AND - stockmaster.categoryid >= '" . $_POST['FromCriteria'] . "' AND - stockmaster.categoryid=stockcategory.categoryid AND - stockmaster.categoryid <= '" . $_POST['ToCriteria'] . "' AND - (stockmaster.mbflag='B' OR mbflag='M') AND - stockcheckfreeze.loccode = '" . $_POST['Location'] . "'"; - if ($_POST['NonZerosOnly']==true){ + $SQL = "SELECT stockmaster.categoryid, + stockcheckfreeze.stockid, + stockmaster.description, + stockmaster.decimalplaces, + stockcategory.categorydescription, + stockcheckfreeze.qoh + FROM stockcheckfreeze, + stockmaster, + stockcategory + WHERE stockcheckfreeze.stockid=stockmaster.stockid AND + stockmaster.categoryid >= '" . $_POST['FromCriteria'] . "' AND + stockmaster.categoryid=stockcategory.categoryid AND + stockmaster.categoryid <= '" . $_POST['ToCriteria'] . "' AND + (stockmaster.mbflag='B' OR mbflag='M') AND + stockcheckfreeze.loccode = '" . $_POST['Location'] . "'"; + if (isset($_POST['NonZerosOnly']) and $_POST['NonZerosOnly']==true){ $SQL .= ' AND stockcheckfreeze.qoh<>0'; } - + $SQL .= ' ORDER BY stockmaster.categoryid, stockmaster.stockid'; - + $InventoryResult = DB_query($SQL,$db,'','',false,false); if (DB_error_no($db) !=0) { @@ -137,7 +138,7 @@ prnMsg( _('The inventory quantities could not be retrieved by the SQL because') . ' ' . DB_error_msg($db),'error'); echo '<br><a href="' . $rootpath . '/index.php?' . SID . '">' . _('Back to the menu') . '</a>'; if ($debug==1){ - echo '<br>' . $SQL; + echo '<br>' . $SQL; } include ('includes/footer.inc'); exit; @@ -171,15 +172,15 @@ $FontSize=10; $YPos -=$line_height; - if ($_POST['ShowInfo']==true){ + if ($_POST['ShowInfo']==true){ $SQL = "SELECT SUM(salesorderdetails.quantity - salesorderdetails.qtyinvoiced) AS qtydemand - FROM salesorderdetails, - salesorders - WHERE salesorderdetails.orderno=salesorders.orderno AND - salesorders.fromstkloc ='" . $_POST['Location'] . "' AND - salesorderdetails.stkcode = '" . $InventoryPlan['StockID'] . "' AND - salesorderdetails.completed = 0"; + FROM salesorderdetails, + salesorders + WHERE salesorderdetails.orderno=salesorders.orderno AND + salesorders.fromstkloc ='" . $_POST['Location'] . "' AND + salesorderdetails.stkcode = '" . $InventoryPlan['stockid'] . "' AND + salesorderdetails.completed = 0"; $DemandResult = DB_query($SQL,$db,'','',false, false); @@ -189,7 +190,7 @@ prnMsg( _('The sales order demand quantities could not be retrieved by the SQL because') . ' ' . DB_error_msg($db), 'error'); echo '<br><a href="' . $rootpath . '/index.php?' . SID . '">' . _('Back to the menu') . '</a>'; if ($debug==1){ - echo '<br>' . $SQL; + echo '<br>' . $SQL; } echo '</body</html>'; exit; @@ -200,18 +201,18 @@ //Also need to add in the demand for components of assembly items $sql = "SELECT SUM((salesorderdetails.quantity-salesorderdetails.qtyinvoiced)*bom.quantity) - AS dem - FROM salesorderdetails, - salesorders, - bom, - stockmaster - WHERE salesorderdetails.stkcode=bom.parent AND - salesorders.orderno = salesorderdetails.orderno AND - salesorders.fromstkloc='" . $myrow['loccode'] . "' AND - salesorderdetails.quantity-salesorderdetails.qtyinvoiced > 0 AND - bom.component='" . $StockID . "' AND - stockmaster.stockid=bom.parent AND - stockmaster.mbflag='A'"; + AS dem + FROM salesorderdetails, + salesorders, + bom, + stockmaster + WHERE salesorderdetails.stkcode=bom.parent AND + salesorders.orderno = salesorderdetails.orderno AND + salesorders.fromstkloc='" . $_POST['Location'] . "' AND + salesorderdetails.quantity-salesorderdetails.qtyinvoiced > 0 AND + bom.component='" . $InventoryPlan['stockid'] . "' AND + stockmaster.stockid=bom.parent AND + stockmaster.mbflag='A'"; $DemandResult = DB_query($sql,$db,'','',false,false); if (DB_error_no($db) !=0) { @@ -221,23 +222,23 @@ } exit; } - + if (DB_num_rows($DemandResult)==1){ $DemandRow = DB_fetch_row($DemandResult); $DemandQty += $DemandRow[0]; } - $LeftOvers = $pdf->addTextWrap(350,$YPos,60,$FontSize,$InventoryPlan['qoh'], 'right'); - $LeftOvers = $pdf->addTextWrap(410,$YPos,60,$FontSize,number_format($DemandQty,0), 'right'); - $LeftOvers = $pdf->addTextWrap(470,$YPos,60,$FontSize,number_format($InventoryPlan['qoh']-$DemandQty,0), 'right'); - + $LeftOvers = $pdf->addTextWrap(350,$YPos,60,$FontSize,number_format($InventoryPlan['qoh'], $InventoryPlan['decimalplaces']), 'right'); + $LeftOvers = $pdf->addTextWrap(410,$YPos,60,$FontSize,number_format($DemandQty,$InventoryPlan['decimalplaces']), 'right'); + $LeftOvers = $pdf->addTextWrap(470,$YPos,60,$FontSize,number_format($InventoryPlan['qoh']-$DemandQty,$InventoryPlan['decimalplaces']), 'right'); + } - + $LeftOvers = $pdf->addTextWrap($Left_Margin,$YPos,150,$FontSize,$InventoryPlan['stockid'], 'left'); $LeftOvers = $pdf->addTextWrap(150,$YPos,200,$FontSize,$InventoryPlan['description'], 'left'); - - + + $pdf->line($Left_Margin, $YPos-2,$Page_Width-$Right_Margin, $YPos-2); if ($YPos < $Bottom_Margin + $line_height){ @@ -254,18 +255,20 @@ $title=_('Stock Check Sheets'); include('includes/header.inc'); - if (strlen($_POST['FromCriteria'])<1 || strlen($_POST['ToCriteria'])<1) { + if (!isset($_POST['FromCriteria']) and !isset($_POST['ToCriteria'])) { /*if $FromCriteria is not set then show a form to allow input */ + echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/printer.png" title="' + . _('print') . '" alt="">' . ' ' . $title.'<br>'; - echo '<form action="' . $_SERVER['PHP_SELF'] . '" method="POST"><table>'; + echo '<form action="' . $_SERVER['PHP_SELF'] . '" method="POST"><table class=selection>'; echo '<tr><td>' . _('From Inventory Category Code') . ':</font></td><td><select name="FromCriteria">'; $sql='SELECT categoryid, categorydescription FROM stockcategory ORDER BY categoryid'; $CatResult= DB_query($sql,$db); While ($myrow = DB_fetch_array($CatResult)){ - echo '<option VALUE="' . $myrow['categoryid'] . '">' . $myrow['categoryid'] . ' - ' . $myrow['categorydescription']; + echo '<option value="' . $myrow['categoryid'] . '">' . $myrow['categoryid'] . ' - ' . $myrow['categorydescription']; } echo '</select></td></tr>'; @@ -284,8 +287,8 @@ $LocnResult=DB_query($sql,$db); while ($myrow=DB_fetch_array($LocnResult)){ - echo '<option Value="' . $myrow['loccode'] . '">' . $myrow['locationname']; - } + echo '<option value="' . $myrow['loccode'] . '">' . $myrow['locationname']; + } echo '</select></td></tr>'; echo '<tr><td>' . _('Action for Stock Check Freeze') . ':</td><td><select name="MakeStkChkData">'; @@ -294,42 +297,42 @@ $_POST['MakeStkChkData'] = 'PrintOnly'; } if ($_POST['MakeStkChkData'] =='New'){ - echo '<option selected VALUE="New">' . _('Make new stock check data file'); + echo '<option selected value="New">' . _('Make new stock check data file'); } else { - echo '<option VALUE="New">' . _('Make new stock check data file'); + echo '<option value="New">' . _('Make new stock check data file'); } if ($_POST['MakeStkChkData'] =='AddUpdate'){ - echo '<option selected VALUE="AddUpdate">' . _('Add/update existing stock check file'); + echo '<option selected value="AddUpdate">' . _('Add/update existing stock check file'); } else { echo '<option VALUE="AddUpdate">' . _('Add/update existing stock check file'); } if ($_POST['MakeStkChkData'] =='PrintOnly'){ - echo '<option selected VALUE="PrintOnly">' . _('Print Stock Check Sheets Only'); + echo '<option selected value="PrintOnly">' . _('Print Stock Check Sheets Only'); } else { - echo '<option VALUE="PrintOnly">' . _('Print Stock Check Sheets Only'); + echo '<option value="PrintOnly">' . _('Print Stock Check Sheets Only'); } echo '</select></td></tr>'; - + echo '<tr><td>' . _('Show system quantity on sheets') . ':</td><td>'; - - if ($_POST['ShowInfo'] == false){ - echo '<input type=CHECKBOX name="ShowInfo" VALUE=FALSE>'; + + if (isset($_POST['ShowInfo']) and $_POST['ShowInfo'] == false){ + echo '<input type=CHECKBOX name="ShowInfo" VALUE=FALSE>'; } else { - echo '<input type=CHECKBOX name="ShowInfo" VALUE=TRUE>'; + echo '<input type=CHECKBOX name="ShowInfo" VALUE=TRUE>'; } echo '</td></tr>'; - + echo '<tr><td>' . _('Only print items with non zero quantities') . ':</td><td>'; - if ($_POST['NonZerosOnly'] == false){ - echo '<input type=CHECKBOX name="NonZerosOnly" VALUE=FALSE>'; + if (isset($_POST['NonZerosOnly']) and $_POST['NonZerosOnly'] == false){ + echo '<input type=CHECKBOX name="NonZerosOnly" VALUE=FALSE>'; } else { - echo '<input type=CHECKBOX name="NonZerosOnly" VALUE=TRUE>'; + echo '<input type=CHECKBOX name="NonZerosOnly" VALUE=TRUE>'; } - - echo '</td></tr></table><div class="centre"><input type=Submit Name="PrintPDF" Value="' . _('Print and Process') . '"></div></form>'; + + echo '</td></tr></table><br><div class="centre"><input type=Submit Name="PrintPDF" Value="' . _('Print and Process') . '"></div></form>'; } include('includes/footer.inc'); - + } /*end of else not PrintPDF */ -?> +?> \ No newline at end of file Modified: trunk/doc/Change.log.html =================================================================== --- trunk/doc/Change.log.html 2010-07-14 10:43:37 UTC (rev 3622) +++ trunk/doc/Change.log.html 2010-07-15 10:29:25 UTC (rev 3623) @@ -1,5 +1,6 @@ <p><font SIZE=4 COLOR=BLUE><b>webERP Change Log</b></font></p> <p></p> +<p>15/07/10 Tim: StockCheck.php - Bug fixes to show decimal places correctly and other fixes, fix sql quoting errors and layout changes</p> <p>14/07/10 Tim: MRPPlannedWorkOrders.php - Fix sql quoting errors and layout changes</p> <p>13/07/10 Tim: MRPPlannedPurchaseOrders.php - Bug fixes, correctly do the workflow, fix sql quoting errors and layout changes</p> <p>13/07/10 Tim: Add logo.png file and select png before jpg if present</p> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <tim...@us...> - 2010-07-15 21:53:31
|
Revision: 3624 http://web-erp.svn.sourceforge.net/web-erp/?rev=3624&view=rev Author: tim_schofield Date: 2010-07-15 21:53:24 +0000 (Thu, 15 Jul 2010) Log Message: ----------- Change report to show tag name in the heading Modified Paths: -------------- trunk/GLTagProfit_Loss.php trunk/doc/Change.log.html Added Paths: ----------- trunk/includes/PDFTagProfitAndLossPageHeader.inc Modified: trunk/GLTagProfit_Loss.php =================================================================== --- trunk/GLTagProfit_Loss.php 2010-07-15 10:29:25 UTC (rev 3623) +++ trunk/GLTagProfit_Loss.php 2010-07-15 21:53:24 UTC (rev 3624) @@ -116,6 +116,10 @@ } else if (isset($_POST['PrintPDF'])) { + $tagsql="SELECT tagdescription FROM tags WHERE tagref='".$_POST['tag']."'"; + $tagresult=DB_query($tagsql, $db); + $tagrow=DB_fetch_array($tagresult); + $Tag=$tagrow['tagdescription']; include('includes/PDFStarter.php'); $pdf->addInfo('Title', _('Income and Expenditure') ); $pdf->addInfo('Subject', _('Income and Expenditure') ); @@ -186,7 +190,7 @@ exit; } - include('includes/PDFProfitAndLossPageHeader.inc'); + include('includes/PDFTagProfitAndLossPageHeader.inc'); $Section = ''; $SectionPrdActual = 0; @@ -201,7 +205,7 @@ // Print heading if at end of page if ($YPos < ($Bottom_Margin)){ - include('includes/PDFProfitAndLossPageHeader.inc'); + include('includes/PDFTagProfitAndLossPageHeader.inc'); } if ($myrow['groupname'] != $ActGrp){ @@ -229,7 +233,7 @@ $Level--; // Print heading if at end of page if ($YPos < ($Bottom_Margin + (2*$line_height))){ - include('includes/PDFProfitAndLossPageHeader.inc'); + include('includes/PDFTagProfitAndLossPageHeader.inc'); } } //end of loop //still need to print out the group total for the same level @@ -254,7 +258,7 @@ // Print heading if at end of page if ($YPos < ($Bottom_Margin +(2 * $line_height))){ - include('includes/PDFProfitAndLossPageHeader.inc'); + include('includes/PDFTagProfitAndLossPageHeader.inc'); } if ($myrow['sectioninaccounts'] != $Section){ @@ -296,6 +300,8 @@ } } $SectionPrdActual = 0; + $SectionPrdBudget = 0; + $SectionPrdLY = 0; $Section = $myrow['sectioninaccounts']; @@ -370,7 +376,7 @@ $Level--; // Print heading if at end of page if ($YPos < ($Bottom_Margin + (2*$line_height))){ - include('includes/PDFProfitAndLossPageHeader.inc'); + include('includes/PDFTagProfitAndLossPageHeader.inc'); } } //still need to print out the group total for the same level @@ -393,7 +399,7 @@ } // Print heading if at end of page if ($YPos < ($Bottom_Margin + (2*$line_height))){ - include('includes/PDFProfitAndLossPageHeader.inc'); + include('includes/PDFTagProfitAndLossPageHeader.inc'); } if ($Section != ''){ Modified: trunk/doc/Change.log.html =================================================================== --- trunk/doc/Change.log.html 2010-07-15 10:29:25 UTC (rev 3623) +++ trunk/doc/Change.log.html 2010-07-15 21:53:24 UTC (rev 3624) @@ -1,5 +1,6 @@ <p><font SIZE=4 COLOR=BLUE><b>webERP Change Log</b></font></p> <p></p> +<p>15/07/10 Tim: GLTagProfit_Loss.php - Change report to show tag name in the heading</p> <p>15/07/10 Tim: StockCheck.php - Bug fixes to show decimal places correctly and other fixes, fix sql quoting errors and layout changes</p> <p>14/07/10 Tim: MRPPlannedWorkOrders.php - Fix sql quoting errors and layout changes</p> <p>13/07/10 Tim: MRPPlannedPurchaseOrders.php - Bug fixes, correctly do the workflow, fix sql quoting errors and layout changes</p> Added: trunk/includes/PDFTagProfitAndLossPageHeader.inc =================================================================== --- trunk/includes/PDFTagProfitAndLossPageHeader.inc (rev 0) +++ trunk/includes/PDFTagProfitAndLossPageHeader.inc 2010-07-15 21:53:24 UTC (rev 3624) @@ -0,0 +1,39 @@ +<?php + /* + * PDF page header for the profit and loss report. + * Suren Naidu 28/08/2005 + * + */ +/* $Id$*/ + + $PageNumber++; + if ($PageNumber>1){ + $pdf->newPage(); + } + + $FontSize = 8; + $YPos = $Page_Height - $Top_Margin; + $pdf->addText($Left_Margin,$YPos,$FontSize,$_SESSION['CompanyRecord']['coyname']); + + $YPos -= $line_height; + $FontSize =10; + $pdf->setFont('','B'); + $Heading = _('Profit and loss for the ') . $NumberOfMonths . _(' months to ') . _('and including ') . $PeriodToDate; + $Heading1 = _('Transactions for tag') . ': '.$_POST['tag'].' - '.$Tag; + $pdf->addText($Left_Margin, $YPos, $FontSize, $Heading); + $pdf->addText($Left_Margin, $YPos-$line_height, $FontSize, $Heading1); + + $FontSize = 8; + $pdf->setFont('',''); + $pdf->addText($Page_Width-$Right_Margin-120,$YPos,$FontSize, + _('Printed'). ': ' . Date($_SESSION['DefaultDateFormat']) + . ' '. _('Page'). ' ' . $PageNumber); + + $YPos -= (3 * $line_height); + $LeftOvers = $pdf->addTextWrap($Left_Margin,$YPos,60,$FontSize,_('Account')); + $LeftOvers = $pdf->addTextWrap($Left_Margin+60,$YPos,100,$FontSize,_('Account Name')); + $LeftOvers = $pdf->addTextWrap($Left_Margin+310,$YPos,70,$FontSize,_('Period Actual'),'right'); + $LeftOvers = $pdf->addTextWrap($Left_Margin+370,$YPos,70,$FontSize,_('Period Budget'),'right'); + $LeftOvers = $pdf->addTextWrap($Left_Margin+430,$YPos,70,$FontSize,_('Last Year'),'right'); + $YPos -= (3 * $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. |
From: <tim...@us...> - 2010-07-17 19:24:21
|
Revision: 3625 http://web-erp.svn.sourceforge.net/web-erp/?rev=3625&view=rev Author: tim_schofield Date: 2010-07-17 19:24:14 +0000 (Sat, 17 Jul 2010) Log Message: ----------- Correctly show item category properties, layout changes, quoting of sql, and deal with images correctly Modified Paths: -------------- trunk/Stocks.php trunk/doc/Change.log.html Modified: trunk/Stocks.php =================================================================== --- trunk/Stocks.php 2010-07-15 21:53:24 UTC (rev 3624) +++ trunk/Stocks.php 2010-07-17 19:24:14 UTC (rev 3625) @@ -32,10 +32,12 @@ <?php echo '<a href="' . $rootpath . '/SelectProduct.php?' . SID . '">' . _('Back to Items') . '</a><br>' . "\n"; +echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/inventory.png" title="' + . _('Stock') . '" alt="">' . ' ' . $title . '</p>'; if (isset($_FILES['ItemPicture']) AND $_FILES['ItemPicture']['name'] !='') { - $result = $_FILES['ItemPicture']['error']; + $result = $_FILES['ItemPicture']['error']; $UploadTheFile = 'Yes'; //Assume all is well to start off with $filename = $_SESSION['part_pics_dir'] . '/' . $StockID . '.jpg'; @@ -48,7 +50,7 @@ $UploadTheFile ='No'; } elseif ( $_FILES['ItemPicture']['type'] == "text/plain" ) { //File Type Check prnMsg( _('Only graphics files can be uploaded'),'warn'); - $UploadTheFile ='No'; + $UploadTheFile ='No'; } elseif (file_exists($filename)){ prnMsg(_('Attempting to overwrite an existing item image'),'warn'); $result = unlink($filename); @@ -210,14 +212,14 @@ $sql = "SELECT mbflag, controlled, serialised - FROM stockmaster WHERE stockid = '$StockID'"; + FROM stockmaster WHERE stockid = '".$StockID."'"; $MBFlagResult = DB_query($sql,$db); $myrow = DB_fetch_row($MBFlagResult); $OldMBFlag = $myrow[0]; $OldControlled = $myrow[1]; $OldSerialised = $myrow[2]; - $sql = "SELECT SUM(locstock.quantity) FROM locstock WHERE stockid='$StockID'"; + $sql = "SELECT SUM(locstock.quantity) FROM locstock WHERE stockid='".$StockID."'"; $result = DB_query($sql,$db); $stkqtychk = DB_fetch_row($result); @@ -238,7 +240,7 @@ if ($_POST['MBFlag']=='K') { $sql = "SELECT quantity-qtyinvoiced FROM salesorderdetails - WHERE stkcode = '$StockID' + WHERE stkcode = '".$StockID."' AND completed=0"; $result = DB_query($sql,$db); @@ -253,7 +255,7 @@ $sql = "SELECT quantityord-quantityrecd FROM purchorderdetails - WHERE itemcode = '$StockID' + WHERE itemcode = '".$StockID."' AND completed=0"; $result = DB_query($sql,$db); @@ -266,7 +268,7 @@ /*now check that if it was a Manufactured, Kitset, Phantom or Assembly and is being changed to a purchased or dummy - that no BOM exists */ if (($OldMBFlag=='M' OR $OldMBFlag =='K' OR $OldMBFlag=='A' OR $OldMBFlag=='G') AND ($_POST['MBFlag']=='B' OR $_POST['MBFlag']=='D')) { - $sql = "SELECT COUNT(*) FROM bom WHERE parent = '$StockID'"; + $sql = "SELECT COUNT(*) FROM bom WHERE parent = '".$StockID."'"; $result = DB_query($sql,$db); $ChkBOM = DB_fetch_row($result); if ($ChkBOM[0]!=0){ @@ -277,7 +279,7 @@ /*now check that if it was Manufac, Phantom or Purchased and is being changed to assembly or kitset, it is not a component on an existing BOM */ if (($OldMBFlag=='M' OR $OldMBFlag =='B' OR $OldMBFlag=='D' OR $OldMBFlag=='G') AND ($_POST['MBFlag']=='A' OR $_POST['MBFlag']=='K')) { - $sql = "SELECT COUNT(*) FROM bom WHERE component = '$StockID'"; + $sql = "SELECT COUNT(*) FROM bom WHERE component = '".$StockID."'"; $result = DB_query($sql,$db); $ChkBOM = DB_fetch_row($result); if ($ChkBOM[0]!=0){ @@ -303,25 +305,25 @@ $sql = "UPDATE stockmaster SET longdescription='" . $_POST['LongDescription'] . "', description='" . $_POST['Description'] . "', - discontinued=" . $_POST['Discontinued'] . ", - controlled=" . $_POST['Controlled'] . ", - serialised=" . $_POST['Serialised'].", - perishable=" . $_POST['Perishable'].", + discontinued='" . $_POST['Discontinued'] . "', + controlled='" . $_POST['Controlled'] . "', + serialised='" . $_POST['Serialised']."', + perishable='" . $_POST['Perishable']."', categoryid='" . $_POST['CategoryID'] . "', units='" . $_POST['Units'] . "', mbflag='" . $_POST['MBFlag'] . "', - eoq=" . $_POST['EOQ'] . ", - volume=" . $_POST['Volume'] . ", - kgs=" . $_POST['KGS'] . ", + eoq='" . $_POST['EOQ'] . "', + volume='" . $_POST['Volume'] . "', + kgs='" . $_POST['KGS'] . "', barcode='" . $_POST['BarCode'] . "', discountcategory='" . $_POST['DiscountCategory'] . "', - taxcatid=" . $_POST['TaxCat'] . ", - decimalplaces=" . $_POST['DecimalPlaces'] . ", + taxcatid='" . $_POST['TaxCat'] . "', + decimalplaces='" . $_POST['DecimalPlaces'] . "', appendfile='" . $_POST['ItemPDF'] . "', - shrinkfactor=" . $_POST['ShrinkFactor'] . ", - pansize=" . $_POST['Pansize'] . ", - nextserialno=" . $_POST['NextSerialNo'] . " - WHERE stockid='$StockID'"; + shrinkfactor='" . $_POST['ShrinkFactor'] . "', + pansize='" . $_POST['Pansize'] . "', + nextserialno='" . $_POST['NextSerialNo'] . "' + WHERE stockid='".$StockID."'"; $ErrMsg = _('The stock item could not be updated because'); $DbgMsg = _('The SQL that was used to update the stock item and failed was'); @@ -346,11 +348,12 @@ stkcatpropid, value) VALUES ('" . $StockID . "', - " . $_POST['PropID' . $i] . ", + '" . $_POST['PropID' . $i] . "', '" . $_POST['PropValue' . $i] . "')", $db); } //end of loop around properties defined for the category prnMsg( _('Stock Item') . ' ' . $StockID . ' ' . _('has been updated'), 'success'); + echo '<br>'; } } else { //it is a NEW part @@ -381,26 +384,26 @@ appendfile, shrinkfactor, pansize) - VALUES ('$StockID', + VALUES ('".$StockID."', '" . $_POST['Description'] . "', '" . $_POST['LongDescription'] . "', '" . $_POST['CategoryID'] . "', '" . $_POST['Units'] . "', '" . $_POST['MBFlag'] . "', - " . $_POST['EOQ'] . ", - " . $_POST['Discontinued'] . ", - " . $_POST['Controlled'] . ", - " . $_POST['Serialised']. ", - " . $_POST['Perishable']. ", - " . $_POST['Volume'] . ", - " . $_POST['KGS'] . ", + '" . $_POST['EOQ'] . "', + '" . $_POST['Discontinued'] . "', + '" . $_POST['Controlled'] . "', + '" . $_POST['Serialised']. "', + '" . $_POST['Perishable']. "', + '" . $_POST['Volume'] . "', + '" . $_POST['KGS'] . "', '" . $_POST['BarCode'] . "', '" . $_POST['DiscountCategory'] . "', - " . $_POST['TaxCat'] . ", - " . $_POST['DecimalPlaces']. ", + '" . $_POST['TaxCat'] . "', + '" . $_POST['DecimalPlaces']. "', '" . $_POST['ItemPDF']. "', - " . $_POST['ShrinkFactor'] . ", - " . $_POST['Pansize'] . " + '" . $_POST['ShrinkFactor'] . "', + '" . $_POST['Pansize'] . "' )"; $ErrMsg = _('The item could not be added because'); @@ -421,6 +424,7 @@ if (DB_error_no($db) ==0) { prnMsg( _('New Item') .' ' . "<a href='SelectProduct.php?StockID=$StockID'>$StockID</a>" . ' '. _('has been added to the database'),'success'); unset($_POST['LongDescription']); + echo '<br>'; unset($_POST['Description']); unset($_POST['EOQ']); // Leave Category ID set for ease of batch entry @@ -458,7 +462,7 @@ // PREVENT DELETES IF DEPENDENT RECORDS IN 'StockMoves' - $sql= "SELECT COUNT(*) FROM stockmoves WHERE stockid='$StockID'"; + $sql= "SELECT COUNT(*) FROM stockmoves WHERE stockid='".$StockID."'"; $result = DB_query($sql,$db); $myrow = DB_fetch_row($result); if ($myrow[0]>0) { @@ -467,7 +471,7 @@ echo '<br>' . _('There are') . ' ' . $myrow[0] . ' ' . _('stock movements that refer to this item'); } else { - $sql= "SELECT COUNT(*) FROM bom WHERE component='$StockID'"; + $sql= "SELECT COUNT(*) FROM bom WHERE component='".$StockID."'"; $result = DB_query($sql,$db); $myrow = DB_fetch_row($result); if ($myrow[0]>0) { @@ -475,7 +479,7 @@ prnMsg( _('Cannot delete this item record because there are bills of material that require this part as a component'),'warn'); echo '<br>' . _('There are') . ' ' . $myrow[0] . ' ' . _('bills of material that require this part as a component'); } else { - $sql= "SELECT COUNT(*) FROM salesorderdetails WHERE stkcode='$StockID'"; + $sql= "SELECT COUNT(*) FROM salesorderdetails WHERE stkcode='".$StockID."'"; $result = DB_query($sql,$db); $myrow = DB_fetch_row($result); if ($myrow[0]>0) { @@ -483,7 +487,7 @@ prnMsg( _('Cannot delete this item record because there are existing sales orders for this part'),'warn'); echo '<br>' . _('There are') . ' ' . $myrow[0] . ' ' . _('sales order items against this part'); } else { - $sql= "SELECT COUNT(*) FROM salesanalysis WHERE stockid='$StockID'"; + $sql= "SELECT COUNT(*) FROM salesanalysis WHERE stockid='".$StockID."'"; $result = DB_query($sql,$db); $myrow = DB_fetch_row($result); if ($myrow[0]>0) { @@ -491,7 +495,7 @@ prnMsg(_('Cannot delete this item because sales analysis records exist for it'),'warn'); echo '<br>' . _('There are') . ' ' . $myrow[0] . ' ' . _('sales analysis records against this part'); } else { - $sql= "SELECT COUNT(*) FROM purchorderdetails WHERE itemcode='$StockID'"; + $sql= "SELECT COUNT(*) FROM purchorderdetails WHERE itemcode='".$StockID."'"; $result = DB_query($sql,$db); $myrow = DB_fetch_row($result); if ($myrow[0]>0) { @@ -499,7 +503,7 @@ prnMsg(_('Cannot delete this item because there are existing purchase order items for it'),'warn'); echo '<br>' . _('There are') . ' ' . $myrow[0] . ' ' . _('purchase order item record relating to this part'); } else { - $sql = "SELECT SUM(quantity) AS qoh FROM locstock WHERE stockid='$StockID'"; + $sql = "SELECT SUM(quantity) AS qoh FROM locstock WHERE stockid='".$StockID."'"; $result = DB_query($sql,$db); $myrow = DB_fetch_row($result); if ($myrow[0]!=0) { @@ -517,18 +521,18 @@ $result = DB_Txn_Begin($db); /*Deletes LocStock records*/ - $sql ="DELETE FROM locstock WHERE stockid='$StockID'"; + $sql ="DELETE FROM locstock WHERE stockid='".$StockID."'"; $result=DB_query($sql,$db,_('Could not delete the location stock records because'),'',true); /*Deletes Price records*/ - $sql ="DELETE FROM prices WHERE stockid='$StockID'"; + $sql ="DELETE FROM prices WHERE stockid='".$StockID."'"; $result=DB_query($sql,$db,_('Could not delete the prices for this stock record because'),'',true); /*and cascade deletes in PurchData */ - $sql ="DELETE FROM purchdata WHERE stockid='$StockID'"; + $sql ="DELETE FROM purchdata WHERE stockid='".$StockID."'"; $result=DB_query($sql,$db,_('Could not delete the purchasing data because'),'',true); /*and cascade delete the bill of material if any */ - $sql = "DELETE FROM bom WHERE parent='$StockID'"; + $sql = "DELETE FROM bom WHERE parent='".$StockID."'"; $result=DB_query($sql,$db,_('Could not delete the bill of material because'),'',true); - $sql="DELETE FROM stockmaster WHERE stockid='$StockID'"; + $sql="DELETE FROM stockmaster WHERE stockid='".$StockID."'"; $result=DB_query($sql,$db, _('Could not delete the item record'),'',true); $result = DB_Txn_Commit($db); @@ -538,6 +542,7 @@ '<br>. . .' . _('and any bill of material that may have been set up for the part') . '<br> . . . .' . _('and any purchasing data that may have been set up for the part') . '<br> . . . . .' . _('and any prices that may have been set up for the part'),'success'); + echo '<br>'; unset($_POST['LongDescription']); unset($_POST['Description']); unset($_POST['EOQ']); @@ -556,8 +561,8 @@ unset($_POST['TaxCat']); unset($_POST['DecimalPlaces']); unset($_POST['ItemPDF']); + unset($_SESSION['SelectedStockItem']); unset($StockID); - unset($_SESSION['SelectedStockItem']); //echo "<meta http-equiv='Refresh' content='0; url=" . $rootpath . '/SelectProduct.php?' . SID ."'>"; @@ -565,8 +570,8 @@ } -echo '<form name="ItemForm" enctype="multipart/form-data" method="post" action="' . $_SERVER['PHP_SELF'] . '?' .SID .'"><table> - <tr><td><table>'. "\n"; // Nested table +echo '<form name="ItemForm" enctype="multipart/form-data" method="post" action="' . $_SERVER['PHP_SELF'] . '?' .SID .'"><table class=selection> + <tr><td>'. "\n"; // Nested table if (!isset($StockID) or $StockID=='') { @@ -599,7 +604,7 @@ appendfile, nextserialno FROM stockmaster - WHERE stockid = '$StockID'"; + WHERE stockid = '".$StockID."'"; $result = DB_query($sql, $db); $myrow = DB_fetch_array($result); @@ -620,7 +625,7 @@ $_POST['DiscountCategory'] = $myrow['discountcategory']; $_POST['TaxCat'] = $myrow['taxcatid']; $_POST['DecimalPlaces'] = $myrow['decimalplaces']; - $_POST['ItemPDF'] = $myrow['appendfile']; + $_POST['ItemPDF'] = $myrow['appendfile']; $_POST['NextSerialNo'] = $myrow['nextserialno']; echo '<tr><td>' . _('Item Code') . ':</td><td>'.$StockID.'</td></tr>'. "\n"; @@ -655,7 +660,7 @@ } if ($handle = opendir($dir)) { $mydir = "<select name=".$select_name.">\n"; - $mydir .= '<option VALUE=0>none'; + $mydir .= '<option value=0>none'; if (isset($_POST['ItemPDF'])) { $curr_val = $_POST['ItemPDF']; } else { @@ -669,7 +674,7 @@ sort($files); foreach ($files as $val) { if (is_file($dir.$val)) { - $mydir .= '<option VALUE='.$val; + $mydir .= '<option value='.$val; $mydir .= ($val == $curr_val) ? ' selected>' : '>'; $mydir .= $val."\n"; $teller++; @@ -685,7 +690,27 @@ echo '<tr><td>' . _('PDF attachment (.pdf)') . ':' . "\n</td><td>" . select_files('companies/' . $_SESSION['DatabaseName'] .'/pdf_append//','' , 'ItemPDF', $_POST['ItemPDF'], '60') . '</td></tr>'. "\n"; // Add image upload for New Item - by Ori -echo '<tr><td>'. _('Image File (.jpg)') . ':</td><td><input type="file" id="ItemPicture" name="ItemPicture"></td></tr>'; +echo '<tr><td>'. _('Image File (.jpg)') . ':</td><td><input type="file" id="ItemPicture" name="ItemPicture"></td>'; + + if (function_exists('imagecreatefromjpg')){ + $StockImgLink = '<img src="GetStockImage.php?SID&automake=1&textcolor=FFFFFF&bgcolor=CCCCCC'. + '&StockID='.urlencode($StockID). + '&text='. + '&width=64'. + '&height=64'. + '" >'; +} else { + if( isset($StockID) and file_exists($_SESSION['part_pics_dir'] . '/' .$StockID.'.jpg') ) { + $StockImgLink = '<img src="' . $_SESSION['part_pics_dir'] . '/' .$StockID.'.jpg" >'; + } else { + $StockImgLink = _('No Image'); + } +} + +if ($StockImgLink!=_('No Image')) { + echo '</td><td>' . _('Image') . '<br>'.$StockImgLink . '</td></tr>'; +} + // EOR Add Image upload for New Item - by Ori echo '<tr><td>' . _('Category') . ':</td><td><select name="CategoryID" onChange="ReloadForm(ItemForm.UpdateCategories)">'; @@ -697,36 +722,40 @@ while ($myrow=DB_fetch_array($result)){ if (!isset($_POST['CategoryID']) or $myrow['categoryid']==$_POST['CategoryID']){ - echo '<option selected VALUE="'. $myrow['categoryid'] . '">' . $myrow['categorydescription']; + echo '<option selected value="'. $myrow['categoryid'] . '">' . $myrow['categorydescription']; } else { - echo '<option VALUE="'. $myrow['categoryid'] . '">' . $myrow['categorydescription']; + echo '<option value="'. $myrow['categoryid'] . '">' . $myrow['categorydescription']; } + $Category=$myrow['categoryid']; } +if (!isset($_POST['CategoryID'])) { + $_POST['CategoryID']=$Category; +} + echo '</select><a target="_blank" href="'. $rootpath . '/StockCategories.php?' . SID . '">' . _('Add or Modify Stock Categories') . '</a></td></tr>'; - if (!isset($_POST['EOQ']) or $_POST['EOQ']==''){ - $_POST['EOQ']=0; + $_POST['EOQ']=0; } if (!isset($_POST['Volume']) or $_POST['Volume']==''){ - $_POST['Volume']=0; + $_POST['Volume']=0; } if (!isset($_POST['KGS']) or $_POST['KGS']==''){ - $_POST['KGS']=0; + $_POST['KGS']=0; } if (!isset($_POST['Controlled']) or $_POST['Controlled']==''){ - $_POST['Controlled']=0; + $_POST['Controlled']=0; } if (!isset($_POST['Serialised']) or $_POST['Serialised']=='' || $_POST['Controlled']==0){ - $_POST['Serialised']=0; + $_POST['Serialised']=0; } if (!isset($_POST['DecimalPlaces']) or $_POST['DecimalPlaces']==''){ $_POST['DecimalPlaces']=0; } if (!isset($_POST['Discontinued']) or $_POST['Discontinued']==''){ - $_POST['Discontinued']=0; + $_POST['Discontinued']=0; } if (!isset($_POST['Pansize'])) { $_POST['Pansize']=0; @@ -755,11 +784,11 @@ $UOMrow['unitname']=_('each'); } while( $UOMrow = DB_fetch_array($UOMResult) ) { - if (isset($_POST['Units']) and $_POST['Units']==$UOMrow['unitname']){ - echo '<option selected value="' . $UOMrow['unitname'] . '">' . $UOMrow['unitname'] . '</option>'; - } else { - echo '<option value="' . $UOMrow['unitname'] . '">' . $UOMrow['unitname'] . '</option>'; - } + if (isset($_POST['Units']) and $_POST['Units']==$UOMrow['unitname']){ + echo '<option selected value="' . $UOMrow['unitname'] . '">' . $UOMrow['unitname'] . '</option>'; + } else { + echo '<option value="' . $UOMrow['unitname'] . '">' . $UOMrow['unitname'] . '</option>'; + } } echo '</select></td></tr>'; @@ -817,7 +846,7 @@ if ($_POST['Controlled']==0){ echo '<option selected value=0>' . _('No Control') . '</option>'; } else { - echo '<option value=0>' . _('No Control') . '</option>'; + echo '<option value=0>' . _('No Control') . '</option>'; } if ($_POST['Controlled']==1){ echo '<option selected value=1>' . _('Controlled'). '</option>'; @@ -829,14 +858,14 @@ echo '<tr><td>' . _('Serialised') . ':</td><td><select ' . (in_array('Serialised',$Errors) ? 'class="selecterror"' : '' ) .' name="Serialised">'; if ($_POST['Serialised']==0){ - echo '<Option selected value=0>' . _('No'). '</option>'; + echo '<Option selected value=0>' . _('No'). '</option>'; } else { - echo '<option value=0>' . _('No'). '</option>'; + echo '<option value=0>' . _('No'). '</option>'; } if ($_POST['Serialised']==1){ - echo '<option selected value=1>' . _('Yes') . '</option>'; + echo '<option selected value=1>' . _('Yes') . '</option>'; } else { - echo '<option value=1>' . _('Yes'). '</option>'; + echo '<option value=1>' . _('Yes'). '</option>'; } echo '</select><i>' . _('Note') . ', ' . _('this has no effect if the item is not Controlled') . '</i></td></tr>'; @@ -844,19 +873,19 @@ echo '<tr><td>' . _('Next Serial No (>0 for auto numbering)') . ':</td><td><input ' . (in_array('NextSerialNo',$Errors) ? 'class="inputerror"' : '' ) .' type="text" name="NextSerialNo" size=15 maxlength=15 value="' . $_POST['NextSerialNo'] . '"><td></tr>'; } else { echo '<input type="hidden" name="NextSerialNo" value="0">'; -} +} echo '<tr><td>' . _('Perishable') . ':</td><td><select name="Perishable">'; if (!isset($_POST['Perishable']) or $_POST['Perishable']==0){ - echo '<option selected value=0>' . _('No'). '</option>'; + echo '<option selected value=0>' . _('No'). '</option>'; } else { - echo '<option value=0>' . _('No'). '</option>'; + echo '<option value=0>' . _('No'). '</option>'; } if (isset($_POST['Perishable']) and $_POST['Perishable']==1){ - echo '<option selected value=1>' . _('Yes'). '</option>'; + echo '<option selected value=1>' . _('Yes'). '</option>'; } else { - echo '<option value=1>' . _('Yes'). '</option>'; + echo '<option value=1>' . _('Yes'). '</option>'; } echo '</select></td></tr>'; @@ -895,36 +924,20 @@ echo '</select></td></tr>'; echo '<tr> - <td>' . _('Pan Size') . ':</td> - <td><input type="Text" class="number" name="Pansize" size="6" maxlength="6" value=' . $_POST['Pansize'] . '></td> - </tr> - <tr> - <td>' . _('Shrinkage Factor') . ':</td> - <td><input type="Text" class="number" name="ShrinkFactor" size="6" maxlength="6" value=' . $_POST['ShrinkFactor'] . '></td> + <td>' . _('Pan Size') . ':</td> + <td><input type="Text" class="number" name="Pansize" size="6" maxlength="6" value=' . $_POST['Pansize'] . '></td> + </tr> + <tr> + <td>' . _('Shrinkage Factor') . ':</td> + <td><input type="Text" class="number" name="ShrinkFactor" size="6" maxlength="6" value=' . $_POST['ShrinkFactor'] . '></td> </tr>'; +echo '</table><div class="centre">'; - if (function_exists('imagecreatefrompng')){ - $StockImgLink = '<img src="GetStockImage.php?SID&automake=1&textcolor=FFFFFF&bgcolor=CCCCCC'. - '&StockID='.urlencode($StockID). - '&text='. - '&width=64'. - '&height=64'. - '" >'; -} else { - if( isset($StockID) and file_exists($_SESSION['part_pics_dir'] . '/' .$StockID.'.jpg') ) { - $StockImgLink = '<img src="' . $_SESSION['part_pics_dir'] . '/' .$StockID.'.jpg" >'; - } else { - $StockImgLink = _('No Image'); - } -} - -echo '</table></td><td>' . _('Image') . '<br>'.$StockImgLink . '</td></tr></table><div class="centre">'; - if (!isset($_POST['CategoryID'])) { $_POST['CategoryID'] = ''; } -echo '<table><tr><th colspan="2">' . _('Item Category Properties') . '</th></tr>'; + $sql = "SELECT stkcatpropid, label, controltype, @@ -938,16 +951,24 @@ $PropertyCounter = 0; $PropertyWidth = array(); +echo '<br><table class=selection>'; +if (DB_num_rows($PropertiesResult)>0) { + echo '<tr><th colspan="2">' . _('Item Category Properties') . '</th></tr>'; +} + while ($PropertyRow=DB_fetch_array($PropertiesResult)){ - $PropValResult = DB_query("SELECT value FROM + if (isset($StockID)) { + $PropValResult = DB_query("SELECT value FROM stockitemproperties WHERE stockid='" . $StockID . "' - AND stkcatpropid =" . $PropertyRow['stkcatpropid'], + AND stkcatpropid ='" . $PropertyRow['stkcatpropid']."'", $db); - $PropValRow = DB_fetch_row($PropValResult); - $PropertyValue = $PropValRow[0]; - + $PropValRow = DB_fetch_row($PropValResult); + $PropertyValue = $PropValRow[0]; + } else { + $PropertyValue = ''; + } echo '<input type="hidden" name="PropID' . $PropertyCounter . '" value=' .$PropertyRow['stkcatpropid'] .'>'; echo '<tr><td>' . $PropertyRow['label'] . '</td> @@ -979,8 +1000,9 @@ echo '<input type="hidden" name="PropType' . $PropertyCounter .'" value=' . $PropertyRow['controltype'] . '>'; echo '</td></tr>'; $PropertyCounter++; + unset($StockID); } //end loop round properties for the item category -echo '</table>'; +echo '</table><br>'; echo '<input type="hidden" name="PropertyCounter" value=' . $PropertyCounter . '>'; if (isset($New)) { @@ -1000,4 +1022,4 @@ echo '</form></div>'; include('includes/footer.inc'); -?> +?> \ No newline at end of file Modified: trunk/doc/Change.log.html =================================================================== --- trunk/doc/Change.log.html 2010-07-15 21:53:24 UTC (rev 3624) +++ trunk/doc/Change.log.html 2010-07-17 19:24:14 UTC (rev 3625) @@ -1,5 +1,6 @@ <p><font SIZE=4 COLOR=BLUE><b>webERP Change Log</b></font></p> <p></p> +<p>17/07/10 Tim: Stocks.php - Correctly show item category properties, layout changes, quoting of sql, and deal with images correctly</p> <p>15/07/10 Tim: GLTagProfit_Loss.php - Change report to show tag name in the heading</p> <p>15/07/10 Tim: StockCheck.php - Bug fixes to show decimal places correctly and other fixes, fix sql quoting errors and layout changes</p> <p>14/07/10 Tim: MRPPlannedWorkOrders.php - Fix sql quoting errors and layout changes</p> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <tim...@us...> - 2010-07-17 19:24:44
|
Revision: 3626 http://web-erp.svn.sourceforge.net/web-erp/?rev=3626&view=rev Author: tim_schofield Date: 2010-07-17 19:24:37 +0000 (Sat, 17 Jul 2010) Log Message: ----------- Allow stock item search and selection, bug fixes, sql quoting and layout changes Modified Paths: -------------- trunk/MRPReport.php trunk/doc/Change.log.html Modified: trunk/MRPReport.php =================================================================== --- trunk/MRPReport.php 2010-07-17 19:24:14 UTC (rev 3625) +++ trunk/MRPReport.php 2010-07-17 19:24:37 UTC (rev 3626) @@ -8,29 +8,34 @@ $PageSecurity = 2; include('includes/session.inc'); -If (isset($_POST['PrintPDF']) AND $_POST['Part']!='') { +if (isset($_POST['Select'])) { + $_POST['Part']=$_POST['Select']; + $_POST['PrintPDF']='Yes'; +} +if (isset($_POST['PrintPDF']) AND $_POST['Part']!='') { + include('includes/PDFStarter.php'); $pdf->addInfo('Title',_('MRP Report')); $pdf->addInfo('Subject',_('MRP Report')); - $FontSize=9; + $FontSize=9; $PageNumber=1; $line_height=10 ; - // Load mrprequirements into $requirements array - // Use weekindex to assign supplies, requirements, and planned orders to weekly buckets - $sql = "SELECT mrprequirements.*, - TRUNCATE(((TO_DAYS(daterequired) - TO_DAYS(CURRENT_DATE)) / 7),0) AS weekindex, - TO_DAYS(daterequired) - TO_DAYS(CURRENT_DATE) AS datediff - FROM mrprequirements - WHERE part = '" . $_POST['Part'] . - "' ORDER BY daterequired,whererequired"; + // Load mrprequirements into $requirements array + // Use weekindex to assign supplies, requirements, and planned orders to weekly buckets + $sql = "SELECT mrprequirements.*, + TRUNCATE(((TO_DAYS(daterequired) - TO_DAYS(CURRENT_DATE)) / 7),0) AS weekindex, + TO_DAYS(daterequired) - TO_DAYS(CURRENT_DATE) AS datediff + FROM mrprequirements + WHERE part = '" . $_POST['Part'] ."' + ORDER BY daterequired,whererequired"; $result = DB_query($sql,$db,'','',False,False); if (DB_error_no($db) !=0) { - $errors = 1; - $holddb = $db; - $title = _('Print MRP Report Error'); + $errors = 1; + $holddb = $db; + $title = _('Print MRP Report Error'); include('includes/header.inc'); prnMsg(_('The MRP calculation must be run before this report will have any output. MRP requires set up of many parameters, including, EOQ, lead times, minimums, bills of materials, demand types, master schedule etc'),'error'); echo "<br><a href='$rootpath/index.php?" . SID . "'>" . _('Back to the menu') . '</a>'; @@ -39,9 +44,9 @@ } if (DB_num_rows($result) == 0) { - $errors = 1; - $holddb = $db; - $title = _('Print MRP Report Warning'); + $errors = 1; + $holddb = $db; + $title = _('Print MRP Report Warning'); include('includes/header.inc'); prnMsg(_('The MRP calculation must be run before this report will have any output. MRP requires set up of many parameters, including, EOQ, lead times, minimums, bills of materials, demand types, master schedule, etc'), 'warn'); echo "<br><a href='$rootpath/index.php?" . SID . "'>" . _('Back to the menu') . '</a>'; @@ -51,6 +56,9 @@ $requirements = array(); $weeklyreq = array(); + for ($i=0;$i<28;$i++) { + $weeklyreq[$i]=0; + } $pastduereq = 0; $futurereq = 0; $grossreq = 0; @@ -59,410 +67,416 @@ array_push($requirements,$myrow); $grossreq += $myrow['quantity']; if ($myrow['datediff'] < 0) { - $pastduereq += $myrow['quantity']; + $pastduereq += $myrow['quantity']; } elseif ($myrow['weekindex'] > 27) { - $futurereq += $myrow['quantity']; + $futurereq += $myrow['quantity']; } else { $weeklyreq[$myrow['weekindex']] += $myrow['quantity']; } } //end of while loop - // Load mrpsupplies into $supplies array - $sql = "SELECT mrpsupplies.*, - TRUNCATE(((TO_DAYS(duedate) - TO_DAYS(CURRENT_DATE)) / 7),0) AS weekindex, - TO_DAYS(duedate) - TO_DAYS(CURRENT_DATE) AS datediff - FROM mrpsupplies WHERE part = '" . $_POST['Part'] . "' ORDER BY mrpdate"; + // Load mrpsupplies into $supplies array + $sql = "SELECT mrpsupplies.*, + TRUNCATE(((TO_DAYS(duedate) - TO_DAYS(CURRENT_DATE)) / 7),0) AS weekindex, + TO_DAYS(duedate) - TO_DAYS(CURRENT_DATE) AS datediff + FROM mrpsupplies WHERE part = '" . $_POST['Part'] . "' ORDER BY mrpdate"; $result = DB_query($sql,$db,'','',false,true); if (DB_error_no($db) !=0) { - $errors = 1; - $holddb = $db; + $errors = 1; + $holddb = $db; } $supplies = array(); $weeklysup = array(); + for ($i=0;$i<28;$i++) { + $weeklysup[$i]=0; + } $pastduesup = 0; $futuresup = 0; $qoh = 0; // Get quantity on Hand to display $openord = 0; while ($myrow=DB_fetch_array($result)) { - if ($myrow['ordertype'] == 'QOH') { - $qoh += $myrow['supplyquantity']; - } else { - $openord += $myrow['supplyquantity']; - if ($myrow['datediff'] < 0) { - $pastduesup += $myrow['supplyquantity']; - } elseif ($myrow['weekindex'] > 27) { - $futuresup += $myrow['supplyquantity']; - } else { - $weeklysup[$myrow['weekindex']] += $myrow['supplyquantity']; - } - } - array_push($supplies,$myrow); + if ($myrow['ordertype'] == 'QOH') { + $qoh += $myrow['supplyquantity']; + } else { + $openord += $myrow['supplyquantity']; + if ($myrow['datediff'] < 0) { + $pastduesup += $myrow['supplyquantity']; + } elseif ($myrow['weekindex'] > 27) { + $futuresup += $myrow['supplyquantity']; + } else { + $weeklysup[$myrow['weekindex']] += $myrow['supplyquantity']; + } + } + array_push($supplies,$myrow); } //end of while loop - $sql = "SELECT mrpplannedorders.*, - TRUNCATE(((TO_DAYS(duedate) - TO_DAYS(CURRENT_DATE)) / 7),0) AS weekindex, - TO_DAYS(duedate) - TO_DAYS(CURRENT_DATE) AS datediff - FROM mrpplannedorders WHERE part = '" . $_POST['Part'] . "' ORDER BY mrpdate"; + $sql = "SELECT mrpplannedorders.*, + TRUNCATE(((TO_DAYS(duedate) - TO_DAYS(CURRENT_DATE)) / 7),0) AS weekindex, + TO_DAYS(duedate) - TO_DAYS(CURRENT_DATE) AS datediff + FROM mrpplannedorders WHERE part = '" . $_POST['Part'] . "' ORDER BY mrpdate"; $result = DB_query($sql,$db,'','',false,true); if (DB_error_no($db) !=0) { - $errors = 1; - $holddb = $db; + $errors = 1; + $holddb = $db; } - + // Fields for Order Due weekly buckets based on planned orders $weeklyplan = array(); + for ($i=0;$i<28;$i++) { + $weeklyplan[$i]=0; + } $pastdueplan = 0; $futureplan = 0; while ($myrow=DB_fetch_array($result)) { array_push($supplies,$myrow); if ($myrow['datediff'] < 0) { - $pastdueplan += $myrow['supplyquantity']; + $pastdueplan += $myrow['supplyquantity']; } elseif ($myrow['weekindex'] > 27) { - $futureplan += $myrow['supplyquantity']; + $futureplan += $myrow['supplyquantity']; } else { $weeklyplan[$myrow['weekindex']] += $myrow['supplyquantity']; } } //end of while loop - // The following sorts the $supplies array by mrpdate. Have to sort because are loading - // mrpsupplies and mrpplannedorders into same array - foreach ($supplies as $key => $row) { - $mrpdate[$key] = $row['mrpdate']; - } - - if ($errors !=0) { - $title = _('MRP Report') . ' - ' . _('Problem Report'); - include('includes/header.inc'); - prnMsg( _('The MRP Report could not be retrieved by the SQL because') . ' ' . DB_error_msg($holddb),'error'); - echo "<br><a href='" .$rootpath .'/index.php?' . SID . "'>" . _('Back to the menu') . '</a>'; - if ($debug==1){ - echo "<br>$sql"; - } - include('includes/footer.inc'); - exit; + // The following sorts the $supplies array by mrpdate. Have to sort because are loading + // mrpsupplies and mrpplannedorders into same array + foreach ($supplies as $key => $row) { + $mrpdate[$key] = $row['mrpdate']; + } + + if (isset($errors)) { + $title = _('MRP Report') . ' - ' . _('Problem Report'); + include('includes/header.inc'); + prnMsg( _('The MRP Report could not be retrieved by the SQL because') . ' ' . DB_error_msg($holddb),'error'); + echo "<br><a href='" .$rootpath .'/index.php?' . SID . "'>" . _('Back to the menu') . '</a>'; + if ($debug==1){ + echo "<br>$sql"; + } + include('includes/footer.inc'); + exit; } - - if (count($supplies)) { - array_multisort($mrpdate, SORT_ASC, $supplies); - } + + if (count($supplies)) { + array_multisort($mrpdate, SORT_ASC, $supplies); + } PrintHeader($pdf,$YPos,$PageNumber,$Page_Height,$Top_Margin,$Left_Margin,$Page_Width, - $Right_Margin); + $Right_Margin); - $fill = false; - $pdf->SetFillColor(224,235,255); // Defines color to make alternating lines highlighted - - // Get and display part information - $sql = "SELECT levels.*, - stockmaster.description, - stockmaster.lastcost, - stockmaster.decimalplaces, - stockmaster.mbflag - FROM levels - LEFT JOIN stockmaster - ON levels.part = stockmaster.stockid - WHERE part = '" . $_POST['Part'] . "'"; + $fill = false; + $pdf->SetFillColor(224,235,255); // Defines color to make alternating lines highlighted + + // Get and display part information + $sql = "SELECT levels.*, + stockmaster.description, + stockmaster.lastcost, + stockmaster.decimalplaces, + stockmaster.mbflag + FROM levels + LEFT JOIN stockmaster + ON levels.part = stockmaster.stockid + WHERE part = '" . $_POST['Part'] . "'"; $result = DB_query($sql,$db,'','',false,true); $myrow=DB_fetch_array($result); - $pdf->addTextWrap($Left_Margin,$YPos,35,$FontSize,_('Part:'),''); + $pdf->addTextWrap($Left_Margin,$YPos,35,$FontSize,_('Part:'),''); $pdf->addTextWrap(70,$YPos,100,$FontSize,$myrow['part'],''); $pdf->addTextWrap(245,$YPos,40,$FontSize,_('EOQ:'),'right'); $pdf->addTextWrap(285,$YPos,45,$FontSize,number_format($myrow['eoq'],$myrow['decimalplaces']),'right'); $pdf->addTextWrap(360,$YPos,50,$FontSize,_('On Hand:'),'right'); $pdf->addTextWrap(410,$YPos,50,$FontSize,number_format($qoh,$myrow['decimalplaces']),'right'); $YPos -=$line_height; - $pdf->addTextWrap($Left_Margin,$YPos,30,$FontSize,_('Desc:'),''); + $pdf->addTextWrap($Left_Margin,$YPos,30,$FontSize,_('Desc:'),''); $pdf->addTextWrap(70,$YPos,150,$FontSize,$myrow['description'],''); $pdf->addTextWrap(245,$YPos,40,$FontSize,_('Pan Size:'),'right'); $pdf->addTextWrap(285,$YPos,45,$FontSize,number_format($myrow['pansize'],$myrow['decimalplaces']),'right'); $pdf->addTextWrap(360,$YPos,50,$FontSize,_('On Order:'),'right'); $pdf->addTextWrap(410,$YPos,50,$FontSize,number_format($openord,$myrow['decimalplaces']),'right'); $YPos -=$line_height; - $pdf->addTextWrap($Left_Margin,$YPos,30,$FontSize,'M/B:',''); + $pdf->addTextWrap($Left_Margin,$YPos,30,$FontSize,'M/B:',''); $pdf->addTextWrap(70,$YPos,150,$FontSize,$myrow['mbflag'],''); - $pdf->addTextWrap(225,$YPos,60,$FontSize,'Shrinkage:','right'); + $pdf->addTextWrap(225,$YPos,60,$FontSize,'Shrinkage:','right'); $pdf->addTextWrap(300,$YPos,30,$FontSize,number_format($myrow['shrinkfactor'],$myrow['decimalplaces']),'right'); $pdf->addTextWrap(360,$YPos,50,$FontSize,_('Gross Req:'),'right'); $pdf->addTextWrap(410,$YPos,50,$FontSize,number_format($grossreq,$myrow['decimalplaces']),'right'); $YPos -=$line_height; - $pdf->addTextWrap(225,$YPos,60,$FontSize,'Lead Time:','right'); + $pdf->addTextWrap(225,$YPos,60,$FontSize,'Lead Time:','right'); $pdf->addTextWrap(300,$YPos,30,$FontSize,$myrow['leadtime'],'right'); $pdf->addTextWrap(360,$YPos,50,$FontSize,_('Last Cost:'),'right'); - $pdf->addTextWrap(410,$YPos,50,$FontSize,number_format($myrow['lastcost'],2),'right'); + $pdf->addTextWrap(410,$YPos,50,$FontSize,number_format($myrow['lastcost'],2),'right'); $YPos -= (2*$line_height); - - // Calculate fields for prjected available weekly buckets - $pastdueavail = ($qoh + $pastduesup + $pastdueplan) - $pastduereq; - $weeklyavail = array(); - $weeklyavail[0] = ($pastdueavail + $weeklysup[0] + $weeklyplan[0]) - $weeklyreq[0]; - for ($i = 1; $i < 28; $i++) { - $weeklyavail[$i] = ($weeklyavail[$i - 1] + $weeklysup[$i] + $weeklyplan[$i]) - $weeklyreq[$i]; - } - $futureavail = ($weeklyavail[27] + $futuresup + $futureplan) - $futurereq; - - // Headers for Weekly Buckets - $FontSize =7; - $dateformat = $_SESSION['DefaultDateFormat']; - $today = date("$dateformat"); - $pdf->addTextWrap($Left_Margin+40,$YPos,45,$FontSize,_('Past Due'),'right'); - $pdf->addTextWrap(130,$YPos,45,$FontSize,$today,'right'); - $pdf->addTextWrap(175,$YPos,45,$FontSize,DateAdd($today,"w",1),'right'); - $pdf->addTextWrap(220,$YPos,45,$FontSize,DateAdd($today,"w",2),'right'); - $pdf->addTextWrap(265,$YPos,45,$FontSize,DateAdd($today,"w",3),'right'); - $pdf->addTextWrap(310,$YPos,45,$FontSize,DateAdd($today,"w",4),'right'); - $pdf->addTextWrap(355,$YPos,45,$FontSize,DateAdd($today,"w",5),'right'); - $pdf->addTextWrap(400,$YPos,45,$FontSize,DateAdd($today,"w",6),'right'); - $pdf->addTextWrap(445,$YPos,45,$FontSize,DateAdd($today,"w",7),'right'); - $pdf->addTextWrap(490,$YPos,45,$FontSize,DateAdd($today,"w",8),'right'); - $YPos -=$line_height; - - $pdf->addTextWrap($Left_Margin,$YPos,40,$FontSize,_('Gross Reqts')); - $pdf->addTextWrap($Left_Margin+40,$YPos,45,$FontSize,number_format($pastduereq,0),'right'); - $pdf->addTextWrap(130,$YPos,45,$FontSize,number_format($weeklyreq[0],0),'right'); - $pdf->addTextWrap(175,$YPos,45,$FontSize,number_format($weeklyreq[1],0),'right'); - $pdf->addTextWrap(220,$YPos,45,$FontSize,number_format($weeklyreq[2],0),'right'); - $pdf->addTextWrap(265,$YPos,45,$FontSize,number_format($weeklyreq[3],0),'right'); - $pdf->addTextWrap(310,$YPos,45,$FontSize,number_format($weeklyreq[4],0),'right'); - $pdf->addTextWrap(355,$YPos,45,$FontSize,number_format($weeklyreq[5],0),'right'); - $pdf->addTextWrap(400,$YPos,45,$FontSize,number_format($weeklyreq[6],0),'right'); - $pdf->addTextWrap(445,$YPos,45,$FontSize,number_format($weeklyreq[7],0),'right'); - $pdf->addTextWrap(490,$YPos,45,$FontSize,number_format($weeklyreq[8],0),'right'); - $YPos -=$line_height; - $pdf->addTextWrap($Left_Margin,$YPos,40,$FontSize,_('Open Order')); - $pdf->addTextWrap($Left_Margin+40,$YPos,45,$FontSize,number_format($pastduesup,0),'right'); - $pdf->addTextWrap(130,$YPos,45,$FontSize,number_format($weeklysup[0],0),'right'); - $pdf->addTextWrap(175,$YPos,45,$FontSize,number_format($weeklysup[1],0),'right'); - $pdf->addTextWrap(220,$YPos,45,$FontSize,number_format($weeklysup[2],0),'right'); - $pdf->addTextWrap(265,$YPos,45,$FontSize,number_format($weeklysup[3],0),'right'); - $pdf->addTextWrap(310,$YPos,45,$FontSize,number_format($weeklysup[4],0),'right'); - $pdf->addTextWrap(355,$YPos,45,$FontSize,number_format($weeklysup[5],0),'right'); - $pdf->addTextWrap(400,$YPos,45,$FontSize,number_format($weeklysup[6],0),'right'); - $pdf->addTextWrap(445,$YPos,45,$FontSize,number_format($weeklysup[7],0),'right'); - $pdf->addTextWrap(490,$YPos,45,$FontSize,number_format($weeklysup[8],0),'right'); - $YPos -=$line_height; - $pdf->addTextWrap($Left_Margin,$YPos,40,$FontSize,_('Planned')); - $pdf->addTextWrap($Left_Margin+40,$YPos,45,$FontSize,number_format($pastdueplan,0),'right'); - $pdf->addTextWrap(130,$YPos,45,$FontSize,number_format($weeklyplan[0],0),'right'); - $pdf->addTextWrap(175,$YPos,45,$FontSize,number_format($weeklyplan[1],0),'right'); - $pdf->addTextWrap(220,$YPos,45,$FontSize,number_format($weeklyplan[2],0),'right'); - $pdf->addTextWrap(265,$YPos,45,$FontSize,number_format($weeklyplan[3],0),'right'); - $pdf->addTextWrap(310,$YPos,45,$FontSize,number_format($weeklyplan[4],0),'right'); - $pdf->addTextWrap(355,$YPos,45,$FontSize,number_format($weeklyplan[5],0),'right'); - $pdf->addTextWrap(400,$YPos,45,$FontSize,number_format($weeklyplan[6],0),'right'); - $pdf->addTextWrap(445,$YPos,45,$FontSize,number_format($weeklyplan[7],0),'right'); - $pdf->addTextWrap(490,$YPos,45,$FontSize,number_format($weeklyplan[8],0),'right'); - $YPos -=$line_height; - $pdf->addTextWrap($Left_Margin,$YPos,40,$FontSize,_('Proj Avail')); - $pdf->addTextWrap($Left_Margin+40,$YPos,45,$FontSize,number_format($pastdueavail,0),'right'); - $pdf->addTextWrap(130,$YPos,45,$FontSize,number_format($weeklyavail[0],0),'right'); - $pdf->addTextWrap(175,$YPos,45,$FontSize,number_format($weeklyavail[1],0),'right'); - $pdf->addTextWrap(220,$YPos,45,$FontSize,number_format($weeklyavail[2],0),'right'); - $pdf->addTextWrap(265,$YPos,45,$FontSize,number_format($weeklyavail[3],0),'right'); - $pdf->addTextWrap(310,$YPos,45,$FontSize,number_format($weeklyavail[4],0),'right'); - $pdf->addTextWrap(355,$YPos,45,$FontSize,number_format($weeklyavail[5],0),'right'); - $pdf->addTextWrap(400,$YPos,45,$FontSize,number_format($weeklyavail[6],0),'right'); - $pdf->addTextWrap(445,$YPos,45,$FontSize,number_format($weeklyavail[7],0),'right'); - $pdf->addTextWrap(490,$YPos,45,$FontSize,number_format($weeklyavail[8],0),'right'); - $YPos -= 2 * $line_height; - // Second Group of Weeks - $pdf->addTextWrap($Left_Margin+40,$YPos,45,$FontSize,DateAdd($today,"w",9),'right'); - $pdf->addTextWrap(130,$YPos,45,$FontSize,DateAdd($today,"w",10),'right'); - $pdf->addTextWrap(175,$YPos,45,$FontSize,DateAdd($today,"w",11),'right'); - $pdf->addTextWrap(220,$YPos,45,$FontSize,DateAdd($today,"w",12),'right'); - $pdf->addTextWrap(265,$YPos,45,$FontSize,DateAdd($today,"w",13),'right'); - $pdf->addTextWrap(310,$YPos,45,$FontSize,DateAdd($today,"w",14),'right'); - $pdf->addTextWrap(355,$YPos,45,$FontSize,DateAdd($today,"w",15),'right'); - $pdf->addTextWrap(400,$YPos,45,$FontSize,DateAdd($today,"w",16),'right'); - $pdf->addTextWrap(445,$YPos,45,$FontSize,DateAdd($today,"w",17),'right'); - $pdf->addTextWrap(490,$YPos,45,$FontSize,DateAdd($today,"w",18),'right'); - $YPos -=$line_height; - - $pdf->addTextWrap($Left_Margin,$YPos,40,$FontSize,_('Gross Reqts')); - $pdf->addTextWrap($Left_Margin+40,$YPos,45,$FontSize,number_format($weeklyreq[9],0),'right'); - $pdf->addTextWrap(130,$YPos,45,$FontSize,number_format($weeklyreq[10],0),'right'); - $pdf->addTextWrap(175,$YPos,45,$FontSize,number_format($weeklyreq[11],0),'right'); - $pdf->addTextWrap(220,$YPos,45,$FontSize,number_format($weeklyreq[12],0),'right'); - $pdf->addTextWrap(265,$YPos,45,$FontSize,number_format($weeklyreq[13],0),'right'); - $pdf->addTextWrap(310,$YPos,45,$FontSize,number_format($weeklyreq[14],0),'right'); - $pdf->addTextWrap(355,$YPos,45,$FontSize,number_format($weeklyreq[15],0),'right'); - $pdf->addTextWrap(400,$YPos,45,$FontSize,number_format($weeklyreq[16],0),'right'); - $pdf->addTextWrap(445,$YPos,45,$FontSize,number_format($weeklyreq[17],0),'right'); - $pdf->addTextWrap(490,$YPos,45,$FontSize,number_format($weeklyreq[18],0),'right'); - $YPos -=$line_height; - $pdf->addTextWrap($Left_Margin,$YPos,40,$FontSize,_('Open Order')); - $pdf->addTextWrap($Left_Margin+40,$YPos,45,$FontSize,number_format($weeklysup[9],0),'right'); - $pdf->addTextWrap(130,$YPos,45,$FontSize,number_format($weeklysup[10],0),'right'); - $pdf->addTextWrap(175,$YPos,45,$FontSize,number_format($weeklysup[11],0),'right'); - $pdf->addTextWrap(220,$YPos,45,$FontSize,number_format($weeklysup[12],0),'right'); - $pdf->addTextWrap(265,$YPos,45,$FontSize,number_format($weeklysup[13],0),'right'); - $pdf->addTextWrap(310,$YPos,45,$FontSize,number_format($weeklysup[14],0),'right'); - $pdf->addTextWrap(355,$YPos,45,$FontSize,number_format($weeklysup[15],0),'right'); - $pdf->addTextWrap(400,$YPos,45,$FontSize,number_format($weeklysup[16],0),'right'); - $pdf->addTextWrap(445,$YPos,45,$FontSize,number_format($weeklysup[17],0),'right'); - $pdf->addTextWrap(490,$YPos,45,$FontSize,number_format($weeklysup[18],0),'right'); - $YPos -=$line_height; - $pdf->addTextWrap($Left_Margin,$YPos,40,$FontSize,_('Planned')); - $pdf->addTextWrap($Left_Margin+40,$YPos,45,$FontSize,number_format($weeklyplan[9],0),'right'); - $pdf->addTextWrap(130,$YPos,45,$FontSize,number_format($weeklyplan[10],0),'right'); - $pdf->addTextWrap(175,$YPos,45,$FontSize,number_format($weeklyplan[11],0),'right'); - $pdf->addTextWrap(220,$YPos,45,$FontSize,number_format($weeklyplan[12],0),'right'); - $pdf->addTextWrap(265,$YPos,45,$FontSize,number_format($weeklyplan[13],0),'right'); - $pdf->addTextWrap(310,$YPos,45,$FontSize,number_format($weeklyplan[14],0),'right'); - $pdf->addTextWrap(355,$YPos,45,$FontSize,number_format($weeklyplan[15],0),'right'); - $pdf->addTextWrap(400,$YPos,45,$FontSize,number_format($weeklyplan[16],0),'right'); - $pdf->addTextWrap(445,$YPos,45,$FontSize,number_format($weeklyplan[17],0),'right'); - $pdf->addTextWrap(490,$YPos,45,$FontSize,number_format($weeklyplan[18],0),'right'); - $YPos -=$line_height; - $pdf->addTextWrap($Left_Margin,$YPos,40,$FontSize,_('Proj Avail')); - $pdf->addTextWrap($Left_Margin+40,$YPos,45,$FontSize,number_format($weeklyavail[9],0),'right'); - $pdf->addTextWrap(130,$YPos,45,$FontSize,number_format($weeklyavail[10],0),'right'); - $pdf->addTextWrap(175,$YPos,45,$FontSize,number_format($weeklyavail[11],0),'right'); - $pdf->addTextWrap(220,$YPos,45,$FontSize,number_format($weeklyavail[12],0),'right'); - $pdf->addTextWrap(265,$YPos,45,$FontSize,number_format($weeklyavail[13],0),'right'); - $pdf->addTextWrap(310,$YPos,45,$FontSize,number_format($weeklyavail[14],0),'right'); - $pdf->addTextWrap(355,$YPos,45,$FontSize,number_format($weeklyavail[15],0),'right'); - $pdf->addTextWrap(400,$YPos,45,$FontSize,number_format($weeklyavail[16],0),'right'); - $pdf->addTextWrap(445,$YPos,45,$FontSize,number_format($weeklyavail[17],0),'right'); - $pdf->addTextWrap(490,$YPos,45,$FontSize,number_format($weeklyavail[18],0),'right'); - $YPos -= 2 * $line_height; + // Calculate fields for prjected available weekly buckets + $pastdueavail = ($qoh + $pastduesup + $pastdueplan) - $pastduereq; + $weeklyavail = array(); + $weeklyavail[0] = ($pastdueavail + $weeklysup[0] + $weeklyplan[0]) - $weeklyreq[0]; + for ($i = 1; $i < 28; $i++) { + $weeklyavail[$i] = ($weeklyavail[$i - 1] + $weeklysup[$i] + $weeklyplan[$i]) - $weeklyreq[$i]; + } + $futureavail = ($weeklyavail[27] + $futuresup + $futureplan) - $futurereq; - // Third Group of Weeks - $pdf->addTextWrap($Left_Margin+40,$YPos,45,$FontSize,DateAdd($today,"w",19),'right'); - $pdf->addTextWrap(130,$YPos,45,$FontSize,DateAdd($today,"w",20),'right'); - $pdf->addTextWrap(175,$YPos,45,$FontSize,DateAdd($today,"w",21),'right'); - $pdf->addTextWrap(220,$YPos,45,$FontSize,DateAdd($today,"w",22),'right'); - $pdf->addTextWrap(265,$YPos,45,$FontSize,DateAdd($today,"w",23),'right'); - $pdf->addTextWrap(310,$YPos,45,$FontSize,DateAdd($today,"w",24),'right'); - $pdf->addTextWrap(355,$YPos,45,$FontSize,DateAdd($today,"w",25),'right'); - $pdf->addTextWrap(400,$YPos,45,$FontSize,DateAdd($today,"w",26),'right'); - $pdf->addTextWrap(445,$YPos,45,$FontSize,DateAdd($today,"w",27),'right'); - $pdf->addTextWrap(490,$YPos,45,$FontSize,"Future",'right'); - $YPos -=$line_height; - - $pdf->addTextWrap($Left_Margin,$YPos,40,$FontSize,_('Gross Reqts')); - $pdf->addTextWrap($Left_Margin+40,$YPos,45,$FontSize,number_format($weeklyreq[19],0),'right'); - $pdf->addTextWrap(130,$YPos,45,$FontSize,number_format($weeklyreq[20],0),'right'); - $pdf->addTextWrap(175,$YPos,45,$FontSize,number_format($weeklyreq[21],0),'right'); - $pdf->addTextWrap(220,$YPos,45,$FontSize,number_format($weeklyreq[22],0),'right'); - $pdf->addTextWrap(265,$YPos,45,$FontSize,number_format($weeklyreq[23],0),'right'); - $pdf->addTextWrap(310,$YPos,45,$FontSize,number_format($weeklyreq[24],0),'right'); - $pdf->addTextWrap(355,$YPos,45,$FontSize,number_format($weeklyreq[25],0),'right'); - $pdf->addTextWrap(400,$YPos,45,$FontSize,number_format($weeklyreq[26],0),'right'); - $pdf->addTextWrap(445,$YPos,45,$FontSize,number_format($weeklyreq[27],0),'right'); - $pdf->addTextWrap(490,$YPos,45,$FontSize,number_format($futurereq,0),'right'); - $YPos -=$line_height; - $pdf->addTextWrap($Left_Margin,$YPos,40,$FontSize,_('Open Order')); - $pdf->addTextWrap($Left_Margin+40,$YPos,45,$FontSize,number_format($weeklysup[19],0),'right'); - $pdf->addTextWrap(130,$YPos,45,$FontSize,number_format($weeklysup[20],0),'right'); - $pdf->addTextWrap(175,$YPos,45,$FontSize,number_format($weeklysup[21],0),'right'); - $pdf->addTextWrap(220,$YPos,45,$FontSize,number_format($weeklysup[22],0),'right'); - $pdf->addTextWrap(265,$YPos,45,$FontSize,number_format($weeklysup[23],0),'right'); - $pdf->addTextWrap(310,$YPos,45,$FontSize,number_format($weeklysup[24],0),'right'); - $pdf->addTextWrap(355,$YPos,45,$FontSize,number_format($weeklysup[25],0),'right'); - $pdf->addTextWrap(400,$YPos,45,$FontSize,number_format($weeklysup[26],0),'right'); - $pdf->addTextWrap(445,$YPos,45,$FontSize,number_format($weeklysup[27],0),'right'); - $pdf->addTextWrap(490,$YPos,45,$FontSize,number_format($futuresup,0),'right'); - $YPos -=$line_height; - $pdf->addTextWrap($Left_Margin,$YPos,40,$FontSize,_('Planned')); - $pdf->addTextWrap($Left_Margin+40,$YPos,45,$FontSize,number_format($weeklyplan[19],0),'right'); - $pdf->addTextWrap(130,$YPos,45,$FontSize,number_format($weeklyplan[20],0),'right'); - $pdf->addTextWrap(175,$YPos,45,$FontSize,number_format($weeklyplan[21],0),'right'); - $pdf->addTextWrap(220,$YPos,45,$FontSize,number_format($weeklyplan[22],0),'right'); - $pdf->addTextWrap(265,$YPos,45,$FontSize,number_format($weeklyplan[23],0),'right'); - $pdf->addTextWrap(310,$YPos,45,$FontSize,number_format($weeklyplan[24],0),'right'); - $pdf->addTextWrap(355,$YPos,45,$FontSize,number_format($weeklyplan[25],0),'right'); - $pdf->addTextWrap(400,$YPos,45,$FontSize,number_format($weeklyplan[26],0),'right'); - $pdf->addTextWrap(445,$YPos,45,$FontSize,number_format($weeklyplan[27],0),'right'); - $pdf->addTextWrap(490,$YPos,45,$FontSize,number_format($futureplan,0),'right'); - $YPos -=$line_height; - $pdf->addTextWrap($Left_Margin,$YPos,40,$FontSize,_('Proj Avail')); - $pdf->addTextWrap($Left_Margin+40,$YPos,45,$FontSize,number_format($weeklyavail[19],0),'right'); - $pdf->addTextWrap(130,$YPos,45,$FontSize,number_format($weeklyavail[20],0),'right'); - $pdf->addTextWrap(175,$YPos,45,$FontSize,number_format($weeklyavail[21],0),'right'); - $pdf->addTextWrap(220,$YPos,45,$FontSize,number_format($weeklyavail[22],0),'right'); - $pdf->addTextWrap(265,$YPos,45,$FontSize,number_format($weeklyavail[23],0),'right'); - $pdf->addTextWrap(310,$YPos,45,$FontSize,number_format($weeklyavail[24],0),'right'); - $pdf->addTextWrap(355,$YPos,45,$FontSize,number_format($weeklyavail[25],0),'right'); - $pdf->addTextWrap(400,$YPos,45,$FontSize,number_format($weeklyavail[26],0),'right'); - $pdf->addTextWrap(445,$YPos,45,$FontSize,number_format($weeklyavail[27],0),'right'); - $pdf->addTextWrap(490,$YPos,45,$FontSize,number_format($futureavail,0),'right'); - $YPos -=$line_height; - - // Headers for Demand/Supply Sections - $YPos -= (2*$line_height); - $pdf->addTextWrap($Left_Margin,$YPos,265,$FontSize,'D E M A N D','center'); - $pdf->addTextWrap(290,$YPos,260,$FontSize,'S U P P L Y','center'); - $YPos -=$line_height; - - $pdf->addTextWrap($Left_Margin,$YPos,55,$FontSize,_('Dem Type')); + // Headers for Weekly Buckets + $FontSize =7; + $dateformat = $_SESSION['DefaultDateFormat']; + $today = date("$dateformat"); + $pdf->addTextWrap($Left_Margin+40,$YPos,45,$FontSize,_('Past Due'),'right'); + $pdf->addTextWrap(130,$YPos,45,$FontSize,$today,'right'); + $pdf->addTextWrap(175,$YPos,45,$FontSize,DateAdd($today,"w",1),'right'); + $pdf->addTextWrap(220,$YPos,45,$FontSize,DateAdd($today,"w",2),'right'); + $pdf->addTextWrap(265,$YPos,45,$FontSize,DateAdd($today,"w",3),'right'); + $pdf->addTextWrap(310,$YPos,45,$FontSize,DateAdd($today,"w",4),'right'); + $pdf->addTextWrap(355,$YPos,45,$FontSize,DateAdd($today,"w",5),'right'); + $pdf->addTextWrap(400,$YPos,45,$FontSize,DateAdd($today,"w",6),'right'); + $pdf->addTextWrap(445,$YPos,45,$FontSize,DateAdd($today,"w",7),'right'); + $pdf->addTextWrap(490,$YPos,45,$FontSize,DateAdd($today,"w",8),'right'); + $YPos -=$line_height; + + $pdf->addTextWrap($Left_Margin,$YPos,40,$FontSize,_('Gross Reqts')); + $pdf->addTextWrap($Left_Margin+40,$YPos,45,$FontSize,number_format($pastduereq,0),'right'); + $pdf->addTextWrap(130,$YPos,45,$FontSize,number_format($weeklyreq[0],0),'right'); + $pdf->addTextWrap(175,$YPos,45,$FontSize,number_format($weeklyreq[1],0),'right'); + $pdf->addTextWrap(220,$YPos,45,$FontSize,number_format($weeklyreq[2],0),'right'); + $pdf->addTextWrap(265,$YPos,45,$FontSize,number_format($weeklyreq[3],0),'right'); + $pdf->addTextWrap(310,$YPos,45,$FontSize,number_format($weeklyreq[4],0),'right'); + $pdf->addTextWrap(355,$YPos,45,$FontSize,number_format($weeklyreq[5],0),'right'); + $pdf->addTextWrap(400,$YPos,45,$FontSize,number_format($weeklyreq[6],0),'right'); + $pdf->addTextWrap(445,$YPos,45,$FontSize,number_format($weeklyreq[7],0),'right'); + $pdf->addTextWrap(490,$YPos,45,$FontSize,number_format($weeklyreq[8],0),'right'); + $YPos -=$line_height; + $pdf->addTextWrap($Left_Margin,$YPos,40,$FontSize,_('Open Order')); + $pdf->addTextWrap($Left_Margin+40,$YPos,45,$FontSize,number_format($pastduesup,0),'right'); + $pdf->addTextWrap(130,$YPos,45,$FontSize,number_format($weeklysup[0],0),'right'); + $pdf->addTextWrap(175,$YPos,45,$FontSize,number_format($weeklysup[1],0),'right'); + $pdf->addTextWrap(220,$YPos,45,$FontSize,number_format($weeklysup[2],0),'right'); + $pdf->addTextWrap(265,$YPos,45,$FontSize,number_format($weeklysup[3],0),'right'); + $pdf->addTextWrap(310,$YPos,45,$FontSize,number_format($weeklysup[4],0),'right'); + $pdf->addTextWrap(355,$YPos,45,$FontSize,number_format($weeklysup[5],0),'right'); + $pdf->addTextWrap(400,$YPos,45,$FontSize,number_format($weeklysup[6],0),'right'); + $pdf->addTextWrap(445,$YPos,45,$FontSize,number_format($weeklysup[7],0),'right'); + $pdf->addTextWrap(490,$YPos,45,$FontSize,number_format($weeklysup[8],0),'right'); + $YPos -=$line_height; + $pdf->addTextWrap($Left_Margin,$YPos,40,$FontSize,_('Planned')); + $pdf->addTextWrap($Left_Margin+40,$YPos,45,$FontSize,number_format($pastdueplan,0),'right'); + $pdf->addTextWrap(130,$YPos,45,$FontSize,number_format($weeklyplan[0],0),'right'); + $pdf->addTextWrap(175,$YPos,45,$FontSize,number_format($weeklyplan[1],0),'right'); + $pdf->addTextWrap(220,$YPos,45,$FontSize,number_format($weeklyplan[2],0),'right'); + $pdf->addTextWrap(265,$YPos,45,$FontSize,number_format($weeklyplan[3],0),'right'); + $pdf->addTextWrap(310,$YPos,45,$FontSize,number_format($weeklyplan[4],0),'right'); + $pdf->addTextWrap(355,$YPos,45,$FontSize,number_format($weeklyplan[5],0),'right'); + $pdf->addTextWrap(400,$YPos,45,$FontSize,number_format($weeklyplan[6],0),'right'); + $pdf->addTextWrap(445,$YPos,45,$FontSize,number_format($weeklyplan[7],0),'right'); + $pdf->addTextWrap(490,$YPos,45,$FontSize,number_format($weeklyplan[8],0),'right'); + $YPos -=$line_height; + $pdf->addTextWrap($Left_Margin,$YPos,40,$FontSize,_('Proj Avail')); + $pdf->addTextWrap($Left_Margin+40,$YPos,45,$FontSize,number_format($pastdueavail,0),'right'); + $pdf->addTextWrap(130,$YPos,45,$FontSize,number_format($weeklyavail[0],0),'right'); + $pdf->addTextWrap(175,$YPos,45,$FontSize,number_format($weeklyavail[1],0),'right'); + $pdf->addTextWrap(220,$YPos,45,$FontSize,number_format($weeklyavail[2],0),'right'); + $pdf->addTextWrap(265,$YPos,45,$FontSize,number_format($weeklyavail[3],0),'right'); + $pdf->addTextWrap(310,$YPos,45,$FontSize,number_format($weeklyavail[4],0),'right'); + $pdf->addTextWrap(355,$YPos,45,$FontSize,number_format($weeklyavail[5],0),'right'); + $pdf->addTextWrap(400,$YPos,45,$FontSize,number_format($weeklyavail[6],0),'right'); + $pdf->addTextWrap(445,$YPos,45,$FontSize,number_format($weeklyavail[7],0),'right'); + $pdf->addTextWrap(490,$YPos,45,$FontSize,number_format($weeklyavail[8],0),'right'); + $YPos -= 2 * $line_height; + + // Second Group of Weeks + $pdf->addTextWrap($Left_Margin+40,$YPos,45,$FontSize,DateAdd($today,"w",9),'right'); + $pdf->addTextWrap(130,$YPos,45,$FontSize,DateAdd($today,"w",10),'right'); + $pdf->addTextWrap(175,$YPos,45,$FontSize,DateAdd($today,"w",11),'right'); + $pdf->addTextWrap(220,$YPos,45,$FontSize,DateAdd($today,"w",12),'right'); + $pdf->addTextWrap(265,$YPos,45,$FontSize,DateAdd($today,"w",13),'right'); + $pdf->addTextWrap(310,$YPos,45,$FontSize,DateAdd($today,"w",14),'right'); + $pdf->addTextWrap(355,$YPos,45,$FontSize,DateAdd($today,"w",15),'right'); + $pdf->addTextWrap(400,$YPos,45,$FontSize,DateAdd($today,"w",16),'right'); + $pdf->addTextWrap(445,$YPos,45,$FontSize,DateAdd($today,"w",17),'right'); + $pdf->addTextWrap(490,$YPos,45,$FontSize,DateAdd($today,"w",18),'right'); + $YPos -=$line_height; + + $pdf->addTextWrap($Left_Margin,$YPos,40,$FontSize,_('Gross Reqts')); + $pdf->addTextWrap($Left_Margin+40,$YPos,45,$FontSize,number_format($weeklyreq[9],0),'right'); + $pdf->addTextWrap(130,$YPos,45,$FontSize,number_format($weeklyreq[10],0),'right'); + $pdf->addTextWrap(175,$YPos,45,$FontSize,number_format($weeklyreq[11],0),'right'); + $pdf->addTextWrap(220,$YPos,45,$FontSize,number_format($weeklyreq[12],0),'right'); + $pdf->addTextWrap(265,$YPos,45,$FontSize,number_format($weeklyreq[13],0),'right'); + $pdf->addTextWrap(310,$YPos,45,$FontSize,number_format($weeklyreq[14],0),'right'); + $pdf->addTextWrap(355,$YPos,45,$FontSize,number_format($weeklyreq[15],0),'right'); + $pdf->addTextWrap(400,$YPos,45,$FontSize,number_format($weeklyreq[16],0),'right'); + $pdf->addTextWrap(445,$YPos,45,$FontSize,number_format($weeklyreq[17],0),'right'); + $pdf->addTextWrap(490,$YPos,45,$FontSize,number_format($weeklyreq[18],0),'right'); + $YPos -=$line_height; + $pdf->addTextWrap($Left_Margin,$YPos,40,$FontSize,_('Open Order')); + $pdf->addTextWrap($Left_Margin+40,$YPos,45,$FontSize,number_format($weeklysup[9],0),'right'); + $pdf->addTextWrap(130,$YPos,45,$FontSize,number_format($weeklysup[10],0),'right'); + $pdf->addTextWrap(175,$YPos,45,$FontSize,number_format($weeklysup[11],0),'right'); + $pdf->addTextWrap(220,$YPos,45,$FontSize,number_format($weeklysup[12],0),'right'); + $pdf->addTextWrap(265,$YPos,45,$FontSize,number_format($weeklysup[13],0),'right'); + $pdf->addTextWrap(310,$YPos,45,$FontSize,number_format($weeklysup[14],0),'right'); + $pdf->addTextWrap(355,$YPos,45,$FontSize,number_format($weeklysup[15],0),'right'); + $pdf->addTextWrap(400,$YPos,45,$FontSize,number_format($weeklysup[16],0),'right'); + $pdf->addTextWrap(445,$YPos,45,$FontSize,number_format($weeklysup[17],0),'right'); + $pdf->addTextWrap(490,$YPos,45,$FontSize,number_format($weeklysup[18],0),'right'); + $YPos -=$line_height; + $pdf->addTextWrap($Left_Margin,$YPos,40,$FontSize,_('Planned')); + $pdf->addTextWrap($Left_Margin+40,$YPos,45,$FontSize,number_format($weeklyplan[9],0),'right'); + $pdf->addTextWrap(130,$YPos,45,$FontSize,number_format($weeklyplan[10],0),'right'); + $pdf->addTextWrap(175,$YPos,45,$FontSize,number_format($weeklyplan[11],0),'right'); + $pdf->addTextWrap(220,$YPos,45,$FontSize,number_format($weeklyplan[12],0),'right'); + $pdf->addTextWrap(265,$YPos,45,$FontSize,number_format($weeklyplan[13],0),'right'); + $pdf->addTextWrap(310,$YPos,45,$FontSize,number_format($weeklyplan[14],0),'right'); + $pdf->addTextWrap(355,$YPos,45,$FontSize,number_format($weeklyplan[15],0),'right'); + $pdf->addTextWrap(400,$YPos,45,$FontSize,number_format($weeklyplan[16],0),'right'); + $pdf->addTextWrap(445,$YPos,45,$FontSize,number_format($weeklyplan[17],0),'right'); + $pdf->addTextWrap(490,$YPos,45,$FontSize,number_format($weeklyplan[18],0),'right'); + $YPos -=$line_height; + $pdf->addTextWrap($Left_Margin,$YPos,40,$FontSize,_('Proj Avail')); + $pdf->addTextWrap($Left_Margin+40,$YPos,45,$FontSize,number_format($weeklyavail[9],0),'right'); + $pdf->addTextWrap(130,$YPos,45,$FontSize,number_format($weeklyavail[10],0),'right'); + $pdf->addTextWrap(175,$YPos,45,$FontSize,number_format($weeklyavail[11],0),'right'); + $pdf->addTextWrap(220,$YPos,45,$FontSize,number_format($weeklyavail[12],0),'right'); + $pdf->addTextWrap(265,$YPos,45,$FontSize,number_format($weeklyavail[13],0),'right'); + $pdf->addTextWrap(310,$YPos,45,$FontSize,number_format($weeklyavail[14],0),'right'); + $pdf->addTextWrap(355,$YPos,45,$FontSize,number_format($weeklyavail[15],0),'right'); + $pdf->addTextWrap(400,$YPos,45,$FontSize,number_format($weeklyavail[16],0),'right'); + $pdf->addTextWrap(445,$YPos,45,$FontSize,number_format($weeklyavail[17],0),'right'); + $pdf->addTextWrap(490,$YPos,45,$FontSize,number_format($weeklyavail[18],0),'right'); + $YPos -= 2 * $line_height; + + // Third Group of Weeks + $pdf->addTextWrap($Left_Margin+40,$YPos,45,$FontSize,DateAdd($today,"w",19),'right'); + $pdf->addTextWrap(130,$YPos,45,$FontSize,DateAdd($today,"w",20),'right'); + $pdf->addTextWrap(175,$YPos,45,$FontSize,DateAdd($today,"w",21),'right'); + $pdf->addTextWrap(220,$YPos,45,$FontSize,DateAdd($today,"w",22),'right'); + $pdf->addTextWrap(265,$YPos,45,$FontSize,DateAdd($today,"w",23),'right'); + $pdf->addTextWrap(310,$YPos,45,$FontSize,DateAdd($today,"w",24),'right'); + $pdf->addTextWrap(355,$YPos,45,$FontSize,DateAdd($today,"w",25),'right'); + $pdf->addTextWrap(400,$YPos,45,$FontSize,DateAdd($today,"w",26),'right'); + $pdf->addTextWrap(445,$YPos,45,$FontSize,DateAdd($today,"w",27),'right'); + $pdf->addTextWrap(490,$YPos,45,$FontSize,"Future",'right'); + $YPos -=$line_height; + + $pdf->addTextWrap($Left_Margin,$YPos,40,$FontSize,_('Gross Reqts')); + $pdf->addTextWrap($Left_Margin+40,$YPos,45,$FontSize,number_format($weeklyreq[19],0),'right'); + $pdf->addTextWrap(130,$YPos,45,$FontSize,number_format($weeklyreq[20],0),'right'); + $pdf->addTextWrap(175,$YPos,45,$FontSize,number_format($weeklyreq[21],0),'right'); + $pdf->addTextWrap(220,$YPos,45,$FontSize,number_format($weeklyreq[22],0),'right'); + $pdf->addTextWrap(265,$YPos,45,$FontSize,number_format($weeklyreq[23],0),'right'); + $pdf->addTextWrap(310,$YPos,45,$FontSize,number_format($weeklyreq[24],0),'right'); + $pdf->addTextWrap(355,$YPos,45,$FontSize,number_format($weeklyreq[25],0),'right'); + $pdf->addTextWrap(400,$YPos,45,$FontSize,number_format($weeklyreq[26],0),'right'); + $pdf->addTextWrap(445,$YPos,45,$FontSize,number_format($weeklyreq[27],0),'right'); + $pdf->addTextWrap(490,$YPos,45,$FontSize,number_format($futurereq,0),'right'); + $YPos -=$line_height; + $pdf->addTextWrap($Left_Margin,$YPos,40,$FontSize,_('Open Order')); + $pdf->addTextWrap($Left_Margin+40,$YPos,45,$FontSize,number_format($weeklysup[19],0),'right'); + $pdf->addTextWrap(130,$YPos,45,$FontSize,number_format($weeklysup[20],0),'right'); + $pdf->addTextWrap(175,$YPos,45,$FontSize,number_format($weeklysup[21],0),'right'); + $pdf->addTextWrap(220,$YPos,45,$FontSize,number_format($weeklysup[22],0),'right'); + $pdf->addTextWrap(265,$YPos,45,$FontSize,number_format($weeklysup[23],0),'right'); + $pdf->addTextWrap(310,$YPos,45,$FontSize,number_format($weeklysup[24],0),'right'); + $pdf->addTextWrap(355,$YPos,45,$FontSize,number_format($weeklysup[25],0),'right'); + $pdf->addTextWrap(400,$YPos,45,$FontSize,number_format($weeklysup[26],0),'right'); + $pdf->addTextWrap(445,$YPos,45,$FontSize,number_format($weeklysup[27],0),'right'); + $pdf->addTextWrap(490,$YPos,45,$FontSize,number_format($futuresup,0),'right'); + $YPos -=$line_height; + $pdf->addTextWrap($Left_Margin,$YPos,40,$FontSize,_('Planned')); + $pdf->addTextWrap($Left_Margin+40,$YPos,45,$FontSize,number_format($weeklyplan[19],0),'right'); + $pdf->addTextWrap(130,$YPos,45,$FontSize,number_format($weeklyplan[20],0),'right'); + $pdf->addTextWrap(175,$YPos,45,$FontSize,number_format($weeklyplan[21],0),'right'); + $pdf->addTextWrap(220,$YPos,45,$FontSize,number_format($weeklyplan[22],0),'right'); + $pdf->addTextWrap(265,$YPos,45,$FontSize,number_format($weeklyplan[23],0),'right'); + $pdf->addTextWrap(310,$YPos,45,$FontSize,number_format($weeklyplan[24],0),'right'); + $pdf->addTextWrap(355,$YPos,45,$FontSize,number_format($weeklyplan[25],0),'right'); + $pdf->addTextWrap(400,$YPos,45,$FontSize,number_format($weeklyplan[26],0),'right'); + $pdf->addTextWrap(445,$YPos,45,$FontSize,number_format($weeklyplan[27],0),'right'); + $pdf->addTextWrap(490,$YPos,45,$FontSize,number_format($futureplan,0),'right'); + $YPos -=$line_height; + $pdf->addTextWrap($Left_Margin,$YPos,40,$FontSize,_('Proj Avail')); + $pdf->addTextWrap($Left_Margin+40,$YPos,45,$FontSize,number_format($weeklyavail[19],0),'right'); + $pdf->addTextWrap(130,$YPos,45,$FontSize,number_format($weeklyavail[20],0),'right'); + $pdf->addTextWrap(175,$YPos,45,$FontSize,number_format($weeklyavail[21],0),'right'); + $pdf->addTextWrap(220,$YPos,45,$FontSize,number_format($weeklyavail[22],0),'right'); + $pdf->addTextWrap(265,$YPos,45,$FontSize,number_format($weeklyavail[23],0),'right'); + $pdf->addTextWrap(310,$YPos,45,$FontSize,number_format($weeklyavail[24],0),'right'); + $pdf->addTextWrap(355,$YPos,45,$FontSize,number_format($weeklyavail[25],0),'right'); + $pdf->addTextWrap(400,$YPos,45,$FontSize,number_format($weeklyavail[26],0),'right'); + $pdf->addTextWrap(445,$YPos,45,$FontSize,number_format($weeklyavail[27],0),'right'); + $pdf->addTextWrap(490,$YPos,45,$FontSize,number_format($futureavail,0),'right'); + $YPos -=$line_height; + + // Headers for Demand/Supply Sections + $YPos -= (2*$line_height); + $pdf->addTextWrap($Left_Margin,$YPos,265,$FontSize,'D E M A N D','center'); + $pdf->addTextWrap(290,$YPos,260,$FontSize,'S U P P L Y','center'); + $YPos -=$line_height; + + $pdf->addTextWrap($Left_Margin,$YPos,55,$FontSize,_('Dem Type')); $pdf->addTextWrap(80,$YPos,90,$FontSize,_('Where Required')); $pdf->addTextWrap(170,$YPos,30,$FontSize,_('Order'),''); $pdf->addTextWrap(200,$YPos,40,$FontSize,_('Quantity'),'right'); $pdf->addTextWrap(240,$YPos,50,$FontSize,_('Due Date'),'right'); - + $pdf->addTextWrap(310,$YPos,45,$FontSize,_('Order No.'),''); $pdf->addTextWrap(355,$YPos,35,$FontSize,_('Sup Type'),''); $pdf->addTextWrap(390,$YPos,25,$FontSize,_('For'),''); $pdf->addTextWrap(415,$YPos,40,$FontSize,_('Quantity'),'right'); $pdf->addTextWrap(455,$YPos,50,$FontSize,_('Due Date'),'right'); $pdf->addTextWrap(505,$YPos,50,$FontSize,_('MRP Date'),'right'); - - // Details for Demand/Supply Sections - $i = 0; - While (strlen($supplies[$i]['part']) > 1 || strlen($requirements[$i]['part']) > 1){ + // Details for Demand/Supply Sections + $i = 0; + while ((isset($supplies[$i]) and strlen($supplies[$i]['part'])) > 1 or (isset($requirements[$i]) and strlen($requirements[$i]['part']) > 1)){ + $YPos -=$line_height; $FontSize=7; - - // Use to alternate between lines with transparent and painted background + + /* Use to alternate between lines with transparent and painted background if ($_POST['Fill'] == 'yes'){ - $fill=!$fill; + $fill=!$fill; } - + */ // Parameters for addTextWrap are defined in /includes/class.pdf.php // 1) X position 2) Y position 3) Width // 4) Height 5) Text To Display 6) Alignment 7) Border 8) Fill - True to use SetFillColor // and False to set for transparent - if (strlen($requirements[$i]['part']) > 1) { + if (isset($requirements[$i]['part']) and strlen($requirements[$i]['part']) > 1) { $FormatedReqDueDate = ConvertSQLDate($requirements[$i]['daterequired']); - $pdf->addTextWrap($Left_Margin,$YPos,55,$FontSize,$requirements[$i]['mrpdemandtype'],''); + $pdf->addTextWrap($Left_Margin,$YPos,55,$FontSize,$requirements[$i]['mrpdemandtype'],''); $pdf->addTextWrap(80,$YPos,90,$FontSize,$requirements[$i]['whererequired'],''); $pdf->addTextWrap(170,$YPos,30,$FontSize,$requirements[$i]['orderno'],''); $pdf->addTextWrap(200,$YPos,40,$FontSize,number_format($requirements[$i]['quantity'], - $myrow['decimalplaces']),'right'); + $myrow['decimalplaces']),'right'); $pdf->addTextWrap(240,$YPos,50,$FontSize,$FormatedReqDueDate,'right'); - } + } if (strlen($supplies[$i]['part']) > 1) { - $suptype = $supplies[$i]['ordertype']; - // If ordertype is not QOH,PO,or WO, it is an MRP generated planned order and the - // ordertype is actually the demandtype that caused the planned order - if ($suptype == 'QOH' || $suptype == 'PO' || $suptype == 'WO') { - $displaytype = $suptype; - $fortype = " "; - } else { - $displaytype = 'Planned'; - $fortype = $suptype; - } + $suptype = $supplies[$i]['ordertype']; + // If ordertype is not QOH,PO,or WO, it is an MRP generated planned order and the + // ordertype is actually the demandtype that caused the planned order + if ($suptype == 'QOH' || $suptype == 'PO' || $suptype == 'WO') { + $displaytype = $suptype; + $fortype = " "; + } else { + $displaytype = 'Planned'; + $fortype = $suptype; + } $FormatedSupDueDate = ConvertSQLDate($supplies[$i]['duedate']); $FormatedSupMRPDate = ConvertSQLDate($supplies[$i]['mrpdate']); // Order no is meaningless for QOH and REORD ordertypes - if ($suptype == "QOH" || $suptype == "REORD") { - $pdf->addTextWrap(310,$YPos,45,$FontSize," ",''); + if ($suptype == "QOH" || $suptype == "REORD") { + $pdf->addTextWrap(310,$YPos,45,$FontSize," ",''); } else { - $pdf->addTextWrap(310,$YPos,45,$FontSize,$supplies[$i]['orderno'],''); + $pdf->addTextWrap(310,$YPos,45,$FontSize,$supplies[$i]['orderno'],''); } $pdf->addTextWrap(355,$YPos,35,$FontSize,$displaytype,''); $pdf->addTextWrap(390,$YPos,25,$FontSize,$fortype,''); $pdf->addTextWrap(415,$YPos,40,$FontSize,number_format($supplies[$i]['supplyquantity'], - $myrow['decimalplaces']),'right'); + $myrow['decimalplaces']),'right'); $pdf->addTextWrap(455,$YPos,50,$FontSize,$FormatedSupDueDate,'right'); $pdf->addTextWrap(505,$YPos,50,$FontSize,$FormatedSupMRPDate,'right'); - } - + } + if ($YPos < $Bottom_Margin + $line_height){ PrintHeader($pdf,$YPos,$PageNumber,$Page_Height,$Top_Margin,$Left_Margin,$Page_Width, - $Right_Margin); + $Right_Margin); } - $i++; + $i++; } /*end while loop */ $FontSize =8; @@ -470,7 +484,7 @@ if ($YPos < $Bottom_Margin + $line_height){ PrintHeader($pdf,$YPos,$PageNumber,$Page_Height,$Top_Margin,$Left_Margin,$Page_Width, - $Right_Margin); + $Right_Margin); } /* UldisN $pdfcode = $pdf->output(); @@ -494,8 +508,8 @@ $pdf->Output('MRPReport.pdf', 'I'); } */ - $pdf->OutputD($_SESSION['DatabaseName'] . '_MRPReport_' . date('Y-m-d').'.pdf');//UldisN - $pdf->__destruct(); //UldisN + $pdf->OutputD($_SESSION['DatabaseName'] . '_MRPReport_' . date('Y-m-d').'.pdf');//UldisN + $pdf->__destruct(); //UldisN } else { /*The option to print PDF was not hit so display form */ @@ -505,19 +519,292 @@ if (isset($_POST['PrintPDF'])) { prnMsg(_('This report shows the MRP calculation for a specific item - a part code must be selected'),'warn'); } + // Always show the search facilities + $SQL = 'SELECT categoryid, + categorydescription + FROM stockcategory + ORDER BY categorydescription'; + $result1 = DB_query($SQL, $db); + if (DB_num_rows($result1) == 0) { + echo '<p><font size=4 color=red>' . _('Problem Report') . ':</font><br>' . _('There are no stock categories currently defined please use the link below to set them up'); + echo '<br><a href="' . $rootpath . '/StockCategories.php?' . SID . '">' . _('Define Stock Categories') . '</a>'; + exit; + } - echo '</br></br><form action=' . $_SERVER['PHP_SELF'] . " method='post'><table>"; - echo '<tr><td>' . _('Part') . ":</td>"; - echo "<td><input type ='text' name='Part' size='20'>"; - echo "</table></br><div class='centre'><input type=submit name='PrintPDF' value='" . _('Print PDF') . "'></div>"; + echo '<form action="' . $_SERVER['PHP_SELF'] . '?' . SID . '" method=post>'; + echo '<p class="page_title_text"><img src="' . $rootpath . '/css/' . $theme . '/images/magnifier.png" title="' . _('Search') . '" alt="">' . ' ' . _('Search for Inventory Items'); + echo '<table class=selection><tr>'; + echo '<td>' . _('In Stock Category') . ':'; + echo '<select name="StockCat">'; + if (!isset($_POST['StockCat'])) { + $_POST['StockCat'] = ""; + } + if ($_POST['StockCat'] == "All") { + echo '<option selected value="All">' . _('All'); + } else { + echo '<option value="All">' . _('All'); + } + while ($myrow1 = DB_fetch_array($result1)) { + if ($myrow1['categoryid'] == $_POST['StockCat']) { + echo '<option selected VALUE="' . $myrow1['categoryid'] . '">' . $myrow1['categorydescription']; + } else { + echo '<option value="' . $myrow1['categoryid'] . '">' . $myrow1['categorydescription']; + } + } + echo '</select>'; + echo '<td>' . _('Enter partial') . '<b> ' . _('Description') . '</b>:</td><td>'; + if (isset($_POST['Keywords'])) { + echo '<input type="text" name="Keywords" value="' . $_POST['Keywords'] . '" size=20 maxlength=25>'; + } else { + echo '<input type="text" name="Keywords" size=20 maxlength=25>'; + } + echo '</td></tr><tr><td></td>'; + echo '<td><font size 3><b>' . _('OR') . ' ' . '</b></font>' . _('Enter partial') . ' <b>' . _('Stock Code') . '</b>:</td>'; + echo '<td>'; + if (isset($_POST['StockCode'])) { + echo '<input type="text" name="StockCode" value="' . $_POST['StockCode'] . '" size=15 maxlength=18>'; + } else { + echo '<input type="text" name="StockCode" size=15 maxlength=18>'; + } + echo '</td></tr></table><br>'; + echo '<div class="centre"><input type=submit name="Search" value="' . _('Search Now') . '"></div><br></form>'; + echo '<script type="text/javascript">defaultControl(document.forms[0].StockCode);</script>'; + echo '</form>'; + if (!isset($_POST['Search'])) { + include('includes/footer.inc'); + } +} /*end of else not PrintPDF */ +// query for list of record(s) +if(isset($_POST['Go']) OR isset($_POST['Next']) OR isset($_POST['Previous'])) { + $_POST['Search']='Search'; +} +if (isset($_POST['Search']) OR isset($_POST['Go']) OR isset($_POST['Next']) OR isset($_POST['Previous'])) { + if (!isset($_POST['Go']) AND !isset($_POST['Next']) AND !isset($_POST['Previous'])) { + // if Search then set to first page + $_POST['PageOffset'] = 1; + } + if ($_POST['Keywords'] AND $_POST['StockCode']) { + $msg = _('Stock description keywords have been used in preference to the Stock code extract entered'); + } + if ($_POST['Keywords']) { + //insert wildcard characters in spaces + $_POST['Keywords'] = strtoupper($_POST['Keywords']); + $SearchString = '%' . str_replace(' ', '%', $_POST['Keywords']) . '%'; + if ($_POST['StockCat'] == 'All') { + $SQL = "SELECT stockmaster.stockid, + stockmaster.description, + SUM(locstock.quantity) AS qoh, + stockmaster.units, + stockmaster.mbflag, + stockmaster.decimalplaces + FROM stockmaster, + locstock + WHERE stockmaster.stockid=locstock.stockid + AND stockmaster.description " . LIKE . " '".$SearchString."' + GROUP BY stockmaster.stockid, + stockmaster.description, + stockmaster.units, + stockmaster.mbflag, + stockmaster.decimalplaces + ORDER BY stockmaster.stockid"; + } else { + $SQL = "SELECT stockmaster.stockid, + stockmaster.description, + SUM(locstock.quantity) AS qoh, + stockmaster.units, + stockmaster.mbflag, + stockmaster.decimalplaces + FROM stockmaster, + locstock + WHERE stockmaster.stockid=locstock.stockid + AND description " . LIKE . " '".$SearchString."' + AND categoryid='" . $_POST['StockCat'] . "' + GROUP BY stockmaster.stockid, + stockmaster.description, + stockmaster.units, + stockmaster.mbflag, + stockmaster.decimalplaces + ORDER BY stockmaster.stockid"; + } + } elseif (isset($_POST['StockCode'])) { + $_POST['StockCode'] = strtoupper($_POST['StockCode']); + if ($_POST['StockCat'] == 'All') { + $SQL = "SELECT stockmaster.stockid, + stockmaster.description, + stockmaster.mbflag, + SUM(locstock.quantity) AS qoh, + stockmaster.units, + stockmaster.decimalplaces + FROM stockmaster, + locstock + WHERE stockmaster.stockid=locstock.stockid + AND stockmaster.stockid " . LIKE . " '%" . $_POST['StockCode'] . "%' + GROUP BY stockmaster.stockid, + stockmaster.description, + stockmaster.units, + stockmaster.mbflag, + stockmaster.decimalplaces + ORDER BY stockmaster.stockid"; + } else { + $SQL = "SELECT stockmaster.stockid, + stockmaster.description, + stockmaster.mbflag, + sum(locstock.quantity) as qoh, + stockmaster.units, + stockmaster.decimalplaces + FROM stockmaster, + locstock + WHERE stockmaster.stockid=locstock.stockid + AND stockmaster.stockid " . LIKE . " '%" . $_POST['StockCode'] . "%' + AND categoryid='" . $_POST['StockCat'] . "' + GROUP BY stockmaster.stockid, + stockmaster.description, + stockmaster.units, + stockmaster.mbflag, + stockmaster.decimalplaces + ORDER BY stockmaster.stockid"; + } + } elseif (!isset($_POST['StockCode']) AND !isset($_POST['Keywords'])) { + if ($_POST['StockCat'] == 'All') { + $SQL = "SELECT stockmaster.stockid, + stockmaster.description, + stockmaster.mbflag, + SUM(locstock.quantity) AS qoh, + stockmaster.units, + stockmaster.decimalplaces + FROM stockmaster, + locstock + WHERE stockmaster.stockid=locstock.stockid + GROUP BY stockmaster.stockid, + stockmaster.description, + stockmaster.units, + stockmaster.mbflag, + stockmaster.decimalplaces + ORDER BY stockmaster.stockid"; + } else { + $SQL = "SELECT stockmaster.stockid, + stockmaster.description, + stockmaster.mbflag, + SUM(locstock.quantity) AS qoh, + stockmaster.units, + stockmaster.decimalplaces + FROM stockmaster, + locstock + WHERE stockmaster.stockid=locstock.stockid + AND categoryid='" . $_POST['StockCat'] . "' + GROUP BY stockmaster.stockid, + stockmaster.description, + stockmaster.units, + stockmaster.mbflag, + stockmaster.decimalplaces + ORDER BY stockmaster.stockid"; + } + } + $ErrMsg = _('No stock items were returned by the SQL because'); + $DbgMsg = _('The SQL that returned an error was'); + $searchresult = DB_query($SQL, $db, $ErrMsg, $DbgMsg); + if (DB_num_rows($searchresult) == 0) { + prnMsg(_('No stock items were returned by this search please re-enter alternative criteria to try again'), 'info'); + } + unset($_POST['Search']); +} +/* end query for list of records */ +/* display list if there is more than one record */ +if (isset($searchresult) AND !isset($_POST['Select'])) { + echo '<form action="' . $_SERVER['PHP_SELF'] . '?' . SID . '" method=post>'; + $ListCount = DB_num_rows($searchresult); + if ($ListCount > 0) { + // If the user hit the search button and there is more than one item to show + $ListPageMax = ceil($ListCount / $_SESSION['DisplayRecordsMax']); + if (isset($_POST['Next'])) { + if ($_POST['PageOffset'] < $ListPageMax) { + $_POST['PageOffset'] = $_POST['PageOffset'] + 1; + } + } + if (isset($_POST['Previous'])) { + if ($_POST['PageOffset'] > 1) { + $_POST['PageOffset'] = $_POST['PageOffset'] - 1; + } + } + if ($_POST['PageOffset'] > $ListPageMax) { + $_POST['PageOffset'] = $ListPageMax; + } + if ($ListPageMax > 1) { + echo "<div class='centre'><p> " . $_POST['PageOffset'] . ' ' . _('of') . ' ' . $ListPageMax . ' ' . _('pages') . '. ' . _('Go to Page') . ': '; + echo '<select name="PageOffset">'; + $ListPage = 1; + while ($ListPage <= $ListPageMax) { + if ($ListPage == $_POST['PageOffset']) { + echo '<option value=' . $ListPage . ' selected>' . $ListPage . '</option>'; + } else { + echo '<option value=' . $ListPage . '>' . $ListPage . '</option>'; + } + $ListPage++; + } + echo '</select> + <input type=submit name="Go" value="' . _('Go') . '"> + <input type=submit name="Previous" value="' . _('Previous') . '"> + <input type=submit name="Next" value="' . _('Next') . '">'; + echo '<input type=hidden name=Keywords value="'.$_POST['Keywords'].'">'; + echo '<input type=hidden name=StockCat value="'.$_POST['StockCat'].'">'; + echo '<input type=hidden name=StockCode value="'.$_POST['StockCode'].'">'; +// echo '<input type=hidden name=Search value="Search">'; + echo '<p></div>'; + } + echo '<table cellpadding=2 colspan=7>'; + $tableheader = '<tr> + <th>' . _('Code') . '</th> + <th>' . _('Description') . '</th> + <th>' . _('Total Qty On Hand') . '</th> + <th>' . _('Units') . '</th> + <th>' . _('Stock Status') . '</th> + </tr>'; + echo $tableheader; + $j = 1; + $k = 0; //row counter to determine background colour + $RowIndex = 0; + if (DB_num_rows($searchresult) <> 0) { + DB_data_seek($searchresult, ($_POST['PageOffset'] - 1) * $_SESSION['DisplayRecordsMax']); + } + while (($myrow = DB_fetch_array($searchresult)) AND ($RowIndex <> $_SESSION['DisplayRecordsMax'])) { + if ($k == 1) { + echo '<tr class="EvenTableRows">'; + $k = 0; + } else { + echo '<tr class="OddTableRows">'; + $k++; + } + if ($myrow['mbflag'] == 'D') { + $qoh = 'N/A'; + } else { + $qoh = number_format($myrow["qoh"], $myrow['decimalplaces']); + } + echo "<td><input type=submit name='Select' value='".$myrow['stockid']."'></td> + <td>".$myrow['description']."</td> + <td class='number'>".$qoh."</td> + <td>".$myrow['units']."</td> + <td><a target='_blank' href='" . $rootpath . "/StockStatus.php?" . SID . "&StockID=".$myrow['stockid']."'>" . _('View') . "</a></td> + </tr>"; + $j++; + if ($j == 20 AND ($RowIndex + 1 != $_SESSION['DisplayRecordsMax'])) { + $j = 1; + echo $tableheader; + } + $RowIndex = $RowIndex + 1; + //end of page full new headings if + } + //end of while loop + echo '</table></form><br>'; + } + include('includes/footer.inc'); +} +/* end display list if there is more than one record */ -} /*end of else not PrintPDF */ - function PrintHeader(&$pdf,&$YPos,&$PageNumber,$Page_Height,$Top_Margin,$Left_Margin, - $Page_Width,$Right_Margin) { + $Page_Width,$Right_Margin) { $line_height=12; @@ -534,8 +821,8 @@ $YPos -=$line_height; $pdf->addTextWrap($Left_Margin,$YPos,300,$FontSize,_('MRP Report')); -$pdf->addTextWrap($Page_Width-$Right_Margin-110,$YPos,160,$FontSize,_('Printed') . ': ' . - Date($_SESSION['DefaultDateFormat']) . ' ' . _('Page') . ' ' . $PageNumber,'left'); +$pdf->addTextWrap($Page_Width-$Right_Margin-110,$YPos,160,$FontSize,_('Printed') . ': ' . + Date($_SESSION['DefaultDateFormat']) . ' ' . _('Page') . ' ' . $PageNumber,'left'); $YPos -=(2*$line_height); @@ -549,4 +836,4 @@ } // End of PrintHeader function -?> +?> \ No newline at end of file Modified: trunk/doc/Change.log.html =================================================================== --- trunk/doc/Change.log.html 2010-07-17 19:24:14 UTC (rev 3625) +++ trunk/doc/Change.log.html 2010-07-17 19:24:37 UTC (rev 3626) @@ -1,5 +1,6 @@ <p><font SIZE=4 COLOR=BLUE><b>webERP Change Log</b></font></p> <p></p> +<p>17/07/10 Tim: MRPReport.php - Allow stock item search and selection, bug fixes, sql quoting and layout changes</p> <p>17/07/10 Tim: Stocks.php - Correctly show item category properties, layout changes, quoting of sql, and deal with images correctly</p> <p>15/07/10 Tim: GLTagProfit_Loss.php - Change report to show tag name in the heading</p> <p>15/07/10 Tim: StockCheck.php - Bug fixes to show decimal places correctly and other fixes, fix sql quoting errors and layout changes</p> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <tim...@us...> - 2010-07-17 19:25:02
|
Revision: 3627 http://web-erp.svn.sourceforge.net/web-erp/?rev=3627&view=rev Author: tim_schofield Date: 2010-07-17 19:24:56 +0000 (Sat, 17 Jul 2010) Log Message: ----------- SQL quoting and layout changes Modified Paths: -------------- trunk/MRPReschedules.php trunk/doc/Change.log.html Modified: trunk/MRPReschedules.php =================================================================== --- trunk/MRPReschedules.php 2010-07-17 19:24:37 UTC (rev 3626) +++ trunk/MRPReschedules.php 2010-07-17 19:24:56 UTC (rev 3627) @@ -29,17 +29,17 @@ $line_height=12; /*Find mrpsupplies records where the duedate is not the same as the mrpdate */ - $selecttype = " "; - if ($_POST['Selection'] != 'All') { - $selecttype = " AND ordertype = '" . $_POST['Selection'] . "'"; - } + $selecttype = " "; + if ($_POST['Selection'] != 'All') { + $selecttype = " AND ordertype = '" . $_POST['Selection'] . "'"; + } $sql = "SELECT mrpsupplies.*, - stockmaster.description, - stockmaster.decimalplaces - FROM mrpsupplies,stockmaster - WHERE mrpsupplies.part = stockmaster.stockid AND duedate <> mrpdate - $selecttype - ORDER BY mrpsupplies.part"; + stockmaster.description, + stockmaster.decimalplaces + FROM mrpsupplies,stockmaster + WHERE mrpsupplies.part = stockmaster.stockid AND duedate <> mrpdate + $selecttype + ORDER BY mrpsupplies.part"; $result = DB_query($sql,$db,'','',false,true); if (DB_error_no($db) !=0) { @@ -48,7 +48,7 @@ prnMsg( _('The MRP reschedules could not be retrieved by the SQL because') . ' ' . DB_error_msg($db),'error'); echo "<br><a href='" .$rootpath .'/index.php?' . SID . "'>" . _('Back to the menu') . '</a>'; if ($debug==1){ - echo "<br>$sql"; + echo "<br>$sql"; } include('includes/footer.inc'); exit; @@ -60,17 +60,17 @@ prnMsg( _('No MRP reschedule retrieved'), 'warn'); echo "<br><a href='" .$rootpath .'/index.php?' . SID . "'>" . _('Back to the menu') . '</a>'; if ($debug==1){ - echo "<br>$sql"; + echo "<br>$sql"; } include('includes/footer.inc'); exit; } PrintHeader($pdf,$YPos,$PageNumber,$Page_Height,$Top_Margin,$Left_Margin,$Page_Width, - $Right_Margin); - $Tot_Val=0; - $fill = false; - $pdf->SetFillColor(224,235,255); + $Right_Margin); + $Tot_Val=0; + $fill = false; + $pdf->SetFillColor(224,235,255); While ($myrow = DB_fetch_array($result,$db)){ $YPos -=$line_height; @@ -84,7 +84,7 @@ // Use to alternate between lines with transparent and painted background if ($_POST['Fill'] == 'yes'){ - $fill=!$fill; + $fill=!$fill; } // Parameters for addTextWrap are defined in /includes/class.pdf.php @@ -96,13 +96,13 @@ $pdf->addTextWrap(330,$YPos,50,$FontSize,$myrow['orderno'],'right',0,$fill); $pdf->addTextWrap(380,$YPos,30,$FontSize,$myrow['ordertype'],'right',0,$fill); $pdf->addTextWrap(410,$YPos,50,$FontSize,number_format($myrow['supplyquantity'], - $myrow['decimalplaces']),'right',0,$fill); + $myrow['decimalplaces']),'right',0,$fill); $pdf->addTextWrap(460,$YPos,55,$FontSize,$FormatedDueDate,'right',0,$fill); $pdf->addTextWrap(515,$YPos,50,$FontSize,$FormatedMRPDate,'right',0,$fill); if ($YPos < $Bottom_Margin + $line_height){ PrintHeader($pdf,$YPos,$PageNumber,$Page_Height,$Top_Margin,$Left_Margin,$Page_Width, - $Right_Margin); + $Right_Margin); } } /*end while loop */ @@ -112,12 +112,12 @@ if ($YPos < $Bottom_Margin + $line_height){ PrintHeader($pdf,$YPos,$PageNumber,$Page_Height,$Top_Margin,$Left_Margin,$Page_Width, - $Right_Margin); + $Right_Margin); } /*Print out the grand totals */ //$pdf->addTextWrap(80,$YPos,260-$Left_Margin,$FontSize,_('Grand Total Value'), 'right'); //$DisplayTotalVal = number_format($Tot_Val,2); - //$pdf->addTextWrap(500,$YPos,60,$FontSize,$DisplayTotalVal, 'right'); + //$pdf->addTextWrap(500,$YPos,60,$FontSize,$DisplayTotalVal, 'right'); /* UldisN $pdfcode = $pdf->output(); $len = strlen($pdfcode); @@ -140,25 +140,29 @@ $pdf->Output('MRPRescedules.pdf', 'I'); } */ - $pdf->OutputD($_SESSION['DatabaseName'] . '_MRPReschedules_' . date('Y-m-d').'.pdf');//UldisN - $pdf->__destruct(); //UldisN + $pdf->OutputD($_SESSION['DatabaseName'] . '_MRPReschedules_' . date('Y-m-d').'.pdf');//UldisN + $pdf->__destruct(); //UldisN } else { /*The option to print PDF was not hit so display form */ $title=_('MRP Reschedule Reporting'); include('includes/header.inc'); - echo '</br></br><form action=' . $_SERVER['PHP_SELF'] . " method='post'><table>"; + echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/inventory.png" title="' + . _('Stock') . '" alt="">' . ' ' . $title . '</p>'; + + echo '</br></br><form action=' . $_SERVER['PHP_SELF'] . " method='post'><table class=selection>"; echo '<tr><td>' . _('Print Option') . ":</td><td><select name='Fill'>"; echo "<option selected value='yes'>" . _('Print With Alternating Highlighted Lines'); echo "<option value='no'>" . _('Plain Print'); echo '</select></td></tr>'; echo '<tr><td>' . _('Selection') . ":</td><td><select name='Selection'>"; - echo "<option selected value='All'>" . _('All'); - echo "<option value='WO'>" . _('Work Orders Only'); - echo "<option value='PO'>" . _('Purchase Orders Only'); + echo "<option selected value='All'>" . _('All')."</option>"; + echo "<option value='WO'>" . _('Work Orders Only')."</option>"; + echo "<option value='PO'>" . _('Purchase Orders Only')."</option>"; echo '</select></td></tr>'; - echo "</table></br></br><div class='centre'><input type=submit name='PrintPDF' value='" . _('Print PDF') . "'></div>"; + echo "</table><br>"; + echo "<div class='centre'><input type=submit name='PrintPDF' value='" . _('Print PDF') . "'></div>"; include('includes/footer.inc'); @@ -166,7 +170,7 @@ function PrintHeader(&$pdf,&$YPos,&$PageNumber,$Page_Height,$Top_Margin,$Left_Margin, - $Page_Width,$Right_Margin) { + $Page_Width,$Right_Margin) { $line_height=12; /*PDF page header for MRP Reschedule report */ @@ -183,7 +187,7 @@ $pdf->addTextWrap($Left_Margin,$YPos,300,$FontSize,_('MRP Reschedule Report')); $pdf->addTextWrap($Page_Width-$Right_Margin-115,$YPos,160,$FontSize,_('Printed') . ': ' . - Date($_SESSION['DefaultDateFormat']) . ' ' . _('Page') . ' ' . $PageNumber); + Date($_SESSION['DefaultDateFormat']) . ' ' . _('Page') . ' ' . $PageNumber); $YPos -=$line_height; $pdf->addTextWrap($Left_Margin,$YPos,70,$FontSize,_('Selection:')); $pdf->addTextWrap(90,$YPos,15,$FontSize,$_POST['Selection']); Modified: trunk/doc/Change.log.html =================================================================== --- trunk/doc/Change.log.html 2010-07-17 19:24:37 UTC (rev 3626) +++ trunk/doc/Change.log.html 2010-07-17 19:24:56 UTC (rev 3627) @@ -1,5 +1,6 @@ <p><font SIZE=4 COLOR=BLUE><b>webERP Change Log</b></font></p> <p></p> +<p>17/07/10 Tim: MRPReschedules.php - SQL quoting and layout changes</p> <p>17/07/10 Tim: MRPReport.php - Allow stock item search and selection, bug fixes, sql quoting and layout changes</p> <p>17/07/10 Tim: Stocks.php - Correctly show item category properties, layout changes, quoting of sql, and deal with images correctly</p> <p>15/07/10 Tim: GLTagProfit_Loss.php - Change report to show tag name in the heading</p> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <tim...@us...> - 2010-07-17 19:25:30
|
Revision: 3628 http://web-erp.svn.sourceforge.net/web-erp/?rev=3628&view=rev Author: tim_schofield Date: 2010-07-17 19:25:23 +0000 (Sat, 17 Jul 2010) Log Message: ----------- SQL quoting and layout changes Modified Paths: -------------- trunk/MRPShortages.php trunk/doc/Change.log.html Modified: trunk/MRPShortages.php =================================================================== --- trunk/MRPShortages.php 2010-07-17 19:24:56 UTC (rev 3627) +++ trunk/MRPShortages.php 2010-07-17 19:25:23 UTC (rev 3628) @@ -19,12 +19,12 @@ exit; } -If (isset($_POST['PrintPDF'])) { +if (isset($_POST['PrintPDF'])) { include('includes/PDFStarter.php'); $pdf->addInfo('Title',_('MRP Shortages Report')); $pdf->addInfo('Subject',_('MRP Shortages')); - $FontSize=9; + $FontSize=9; $PageNumber=1; $line_height=12; @@ -35,7 +35,7 @@ $sql = 'CREATE TEMPORARY TABLE demandtotal ( part char(20), demand double, - KEY `PART` (`part`))'; + KEY `PART` (`part`))'; $result = DB_query($sql,$db,_('Create of demandtotal failed because')); $sql = 'INSERT INTO demandtotal @@ -43,14 +43,14 @@ demand) SELECT part, SUM(quantity) as demand - FROM mrprequirements - GROUP BY part'; + FROM mrprequirements + GROUP BY part'; $result = DB_query($sql,$db); $sql = 'CREATE TEMPORARY TABLE supplytotal ( part char(20), supply double, - KEY `PART` (`part`))'; + KEY `PART` (`part`))'; $result = DB_query($sql,$db,_('Create of supplytotal failed because')); /* 21/03/2010: Ricard modification to allow items with total supply = 0 be included in the report */ @@ -60,12 +60,12 @@ supply) SELECT stockid, 0 - FROM stockmaster'; + FROM stockmaster'; $result = DB_query($sql,$db); $sql = 'UPDATE supplytotal SET supply = (SELECT SUM(mrpsupplies.supplyquantity) - FROM mrpsupplies + FROM mrpsupplies WHERE supplytotal.part = mrpsupplies.part AND mrpsupplies.supplyquantity > 0)'; $result = DB_query($sql,$db); @@ -79,21 +79,21 @@ // show demand for the lower level parts that the upper level part generates. See MRP.php for // more notes - Decided not to exclude derived demand so using $sql, not $sqlexclude $sqlexclude = "SELECT stockmaster.stockid, - stockmaster.description, - stockmaster.mbflag, - stockmaster.actualcost, - stockmaster.decimalplaces, - (stockmaster.materialcost + stockmaster.labourcost + - stockmaster.overheadcost ) as computedcost, - demandtotal.demand, - supplytotal.supply, - (demandtotal.demand - supplytotal.supply) * - (stockmaster.materialcost + stockmaster.labourcost + - stockmaster.overheadcost ) as extcost - FROM stockmaster - LEFT JOIN demandtotal ON stockmaster.stockid = demandtotal.part - LEFT JOIN supplytotal ON stockmaster.stockid = supplytotal.part - GROUP BY stockmaster.stockid, + stockmaster.description, + stockmaster.mbflag, + stockmaster.actualcost, + stockmaster.decimalplaces, + (stockmaster.materialcost + stockmaster.labourcost + + stockmaster.overheadcost ) as computedcost, + demandtotal.demand, + supplytotal.supply, + (demandtotal.demand - supplytotal.supply) * + (stockmaster.materialcost + stockmaster.labourcost + + stockmaster.overheadcost ) as extcost + FROM stockmaster + LEFT JOIN demandtotal ON stockmaster.stockid = demandtotal.part + LEFT JOIN supplytotal ON stockmaster.stockid = supplytotal.part + GROUP BY stockmaster.stockid, stockmaster.description, stockmaster.mbflag, stockmaster.actualcost, @@ -101,24 +101,24 @@ supplytotal.supply, demandtotal.demand, extcost - HAVING demand > supply - ORDER BY " . $_POST['Sort']; + HAVING demand > supply + ORDER BY '" . $_POST['Sort']."'"; $sql = "SELECT stockmaster.stockid, - stockmaster.description, - stockmaster.mbflag, - stockmaster.actualcost, - stockmaster.decimalplaces, - (stockmaster.materialcost + stockmaster.labourcost + - stockmaster.overheadcost ) as computedcost, - demandtotal.demand, - supplytotal.supply, + stockmaster.description, + stockmaster.mbflag, + stockmaster.actualcost, + stockmaster.decimalplaces, + (stockmaster.materialcost + stockmaster.labourcost + + stockmaster.overheadcost ) as computedcost, + demandtotal.demand, + supplytotal.supply, (demandtotal.demand - supplytotal.supply) * (stockmaster.materialcost + stockmaster.labourcost + stockmaster.overheadcost ) as extcost - FROM stockmaster - LEFT JOIN demandtotal ON stockmaster.stockid = demandtotal.part - LEFT JOIN supplytotal ON stockmaster.stockid = supplytotal.part - GROUP BY stockmaster.stockid, + FROM stockmaster + LEFT JOIN demandtotal ON stockmaster.stockid = demandtotal.part + LEFT JOIN supplytotal ON stockmaster.stockid = supplytotal.part + GROUP BY stockmaster.stockid, stockmaster.description, stockmaster.mbflag, stockmaster.actualcost, @@ -130,7 +130,7 @@ supplytotal.supply, demandtotal.demand HAVING demandtotal.demand > supplytotal.supply - ORDER BY " . $_POST['Sort'] . $sortorder; + ORDER BY '" . $_POST['Sort'] . "'"; $result = DB_query($sql,$db,'','',false,true); if (DB_error_no($db) !=0) { @@ -139,7 +139,7 @@ prnMsg( _('The MRP shortages could not be retrieved by the SQL because') . ' ' . DB_error_msg($db),'error'); echo "</br><a href='" .$rootpath .'/index.php?' . SID . "'>" . _('Back to the menu') . '</a>'; if ($debug==1){ - echo "</br>$sql"; + echo "</br>$sql"; } include('includes/footer.inc'); exit; @@ -151,21 +151,21 @@ prnMsg( _('No MRP shortages retrieved'), 'warn'); echo "</br><a href='" .$rootpath .'/index.php?' . SID . "'>" . _('Back to the menu') . '</a>'; if ($debug==1){ - echo "</br>$sql"; + echo "</br>$sql"; } include('includes/footer.inc'); exit; } PrintHeader($pdf,$YPos,$PageNumber,$Page_Height,$Top_Margin,$Left_Margin,$Page_Width, - $Right_Margin); + $Right_Margin); - $Total_Shortage=0; - $Partctr = 0; - $fill = false; - $pdf->SetFillColor(224,235,255); // Defines color to make alternating lines highlighted - While ($myrow = DB_fetch_array($result,$db)){ - if ($myrow['demand'] > $myrow['supply']) { + $Total_Shortage=0; + $Partctr = 0; + $fill = false; + $pdf->SetFillColor(224,235,255); // Defines color to make alternating lines highlighted + while ($myrow = DB_fetch_array($result,$db)){ + if ($myrow['demand'] > $myrow['supply']) { $YPos -=$line_height; $FontSize=8; @@ -185,11 +185,11 @@ $pdf->addTextWrap(280,$YPos,25,$FontSize,$myrow['mbflag'],'right',0,$fill); $pdf->addTextWrap(305,$YPos,55,$FontSize,number_format($myrow['computedcost'],2),'right',0,$fill); $pdf->addTextWrap(360,$YPos,50,$FontSize,number_format($myrow['supply'], - $myrow['decimalplaces']),'right',0,$fill); + $myrow['decimalplaces']),'right',0,$fill); $pdf->addTextWrap(410,$YPos,50,$FontSize,number_format($myrow['demand'], - $myrow['decimalplaces']),'right',0,$fill); + $myrow['decimalplaces']),'right',0,$fill); $pdf->addTextWrap(460,$YPos,50,$FontSize,number_format($shortage, - $myrow['decimalplaces']),'right',0,$fill); + $myrow['decimalplaces']),'right',0,$fill); $pdf->addTextWrap(510,$YPos,60,$FontSize,number_format($myrow['extcost'],2),'right',0,$fill); $Total_Shortage += $myrow['extcost']; @@ -197,7 +197,7 @@ if ($YPos < $Bottom_Margin + $line_height){ PrintHeader($pdf,$YPos,$PageNumber,$Page_Height,$Top_Margin,$Left_Margin,$Page_Width, - $Right_Margin); + $Right_Margin); } } @@ -208,14 +208,14 @@ if ($YPos < $Bottom_Margin + $line_height){ PrintHeader($pdf,$YPos,$PageNumber,$Page_Height,$Top_Margin,$Left_Margin,$Page_Width, - $Right_Margin); + $Right_Margin); } /*Print out the grand totals */ - $pdf->addTextWrap($Left_Margin,$YPos,120,$FontSize,_('Number of Parts: '), 'left'); - $pdf->addTextWrap(150,$YPos,30,$FontSize,$Partctr, 'left'); + $pdf->addTextWrap($Left_Margin,$YPos,120,$FontSize,_('Number of Parts: '), 'left'); + $pdf->addTextWrap(150,$YPos,30,$FontSize,$Partctr, 'left'); $pdf->addTextWrap(300,$YPos,180,$FontSize,_('Total Extended Shortage:'), 'right'); $DisplayTotalVal = number_format($Total_Shortage,2); - $pdf->addTextWrap(510,$YPos,60,$FontSize,$DisplayTotalVal, 'right'); + $pdf->addTextWrap(510,$YPos,60,$FontSize,$DisplayTotalVal, 'right'); /* UldisN $pdfcode = $pdf->output(); $len = strlen($pdfcode); @@ -238,23 +238,27 @@ $pdf->Output('MRPShortages.pdf', 'I'); } */ - $pdf->OutputD($_SESSION['DatabaseName'] . '_MRPShortages_' . date('Y-m-d').'.pdf');//UldisN - $pdf->__destruct(); //UldisN + $pdf->OutputD($_SESSION['DatabaseName'] . '_MRPShortages_' . date('Y-m-d').'.pdf');//UldisN + $pdf->__destruct(); //UldisN } else { /*The option to print PDF was not hit so display form */ $title=_('MRP Shortages Reporting'); include('includes/header.inc'); - echo '</br></br><form action=' . $_SERVER['PHP_SELF'] . " method='post'><table>"; + echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/inventory.png" title="' + . _('Stock') . '" alt="">' . ' ' . $title . '</p>'; + + echo '<form action=' . $_SERVER['PHP_SELF'] . " method='post'>"; + echo "<table class=selection>"; echo '<tr><td>' . _('Sort') . ":</td><td><select name='Sort'>"; - echo "<option selected value='extcost'>" . _('Extended Shortage Dollars'); - echo "<option value='stockid'>" . _('Part Number'); + echo "<option selected value='extcost'>" . _('Extended Shortage Dollars')."</option>"; + echo "<option value='stockid'>" . _('Part Number')."</option>"; echo '</select></td></tr>'; echo '<tr><td>' . _('Print Option') . ":</td><td><select name='Fill'>"; - echo "<option selected value='yes'>" . _('Print With Alternating Highlighted Lines'); - echo "<option value='no'>" . _('Plain Print'); + echo "<option selected value='yes'>" . _('Print With Alternating Highlighted Lines')."</option>"; + echo "<option value='no'>" . _('Plain Print')."</option>"; echo '</select></td></tr>'; - echo "</table></br><div class='centre'><input type=submit name='PrintPDF' value='" . _('Print PDF') . "'></div>"; + echo "</table><br><div class='centre'><input type=submit name='PrintPDF' value='" . _('Print PDF') . "'></div>"; include('includes/footer.inc'); @@ -262,7 +266,7 @@ function PrintHeader(&$pdf,&$YPos,&$PageNumber,$Page_Height,$Top_Margin,$Left_Margin, - $Page_Width,$Right_Margin) { + $Page_Width,$Right_Margin) { $line_height=12; /*PDF page header for MRP Shortages report */ @@ -279,11 +283,11 @@ $pdf->addTextWrap($Left_Margin,$YPos,300,$FontSize,_('MRP Shortages Report')); $pdf->addTextWrap($Page_Width-$Right_Margin-110,$YPos,160,$FontSize,_('Printed') . ': ' . - Date($_SESSION['DefaultDateFormat']) . ' ' . _('Page') . ' ' . $PageNumber,'left'); + Date($_SESSION['DefaultDateFormat']) . ' ' . _('Page') . ' ' . $PageNumber,'left'); $YPos -=(2*$line_height); -/*Draw a rectangle to put the headings in */ +/*Draw a rectangle to put the headings in */ //$pdf->line($Left_Margin, $YPos+$line_height,$Page_Width-$Right_Margin, $YPos+$line_height); //$pdf->line($Left_Margin, $YPos+$line_height,$Left_Margin, $YPos- $line_height); @@ -307,4 +311,4 @@ $PageNumber++; } // End of PrintHeader function -?> +?> \ No newline at end of file Modified: trunk/doc/Change.log.html =================================================================== --- trunk/doc/Change.log.html 2010-07-17 19:24:56 UTC (rev 3627) +++ trunk/doc/Change.log.html 2010-07-17 19:25:23 UTC (rev 3628) @@ -1,5 +1,6 @@ <p><font SIZE=4 COLOR=BLUE><b>webERP Change Log</b></font></p> <p></p> +<p>17/07/10 Tim: MRPShortages.php - SQL quoting and layout changes</p> <p>17/07/10 Tim: MRPReschedules.php - SQL quoting and layout changes</p> <p>17/07/10 Tim: MRPReport.php - Allow stock item search and selection, bug fixes, sql quoting and layout changes</p> <p>17/07/10 Tim: Stocks.php - Correctly show item category properties, layout changes, quoting of sql, and deal with images correctly</p> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <tim...@us...> - 2010-07-17 19:25:52
|
Revision: 3629 http://web-erp.svn.sourceforge.net/web-erp/?rev=3629&view=rev Author: tim_schofield Date: 2010-07-17 19:25:46 +0000 (Sat, 17 Jul 2010) Log Message: ----------- SQL quoting and provide confirmation message at the end Modified Paths: -------------- trunk/OffersReceived.php trunk/doc/Change.log.html Modified: trunk/OffersReceived.php =================================================================== --- trunk/OffersReceived.php 2010-07-17 19:25:23 UTC (rev 3628) +++ trunk/OffersReceived.php 2010-07-17 19:25:46 UTC (rev 3629) @@ -8,12 +8,12 @@ include('includes/SQL_CommonFunctions.inc'); if (isset($_POST['supplierid'])) { - $sql='SELECT suppname, + $sql="SELECT suppname, email, currcode, paymentterms FROM suppliers - WHERE supplierid="'.$_POST['supplierid'].'"'; + WHERE supplierid='".$_POST['supplierid']."'"; $result = DB_query($sql, $db); $myrow=DB_fetch_array($result); $SupplierName=$myrow['suppname']; @@ -23,7 +23,7 @@ } if (!isset($_POST['supplierid'])) { - $sql='SELECT DISTINCT + $sql="SELECT DISTINCT offers.supplierid, suppliers.suppname FROM offers @@ -31,9 +31,9 @@ ON offers.currcode=purchorderauth.currabrev LEFT JOIN suppliers ON suppliers.supplierid=offers.supplierid - WHERE purchorderauth.userid="'.$_SESSION['UserID'].'" - AND offers.expirydate>"'.date('Y-m-d').'" - AND purchorderauth.cancreate=0'; + WHERE purchorderauth.userid='".$_SESSION['UserID']."' + AND offers.expirydate>'".date('Y-m-d')."' + AND purchorderauth.cancreate=0"; $result=DB_query($sql, $db); if (DB_num_rows($result)==0) { prnMsg(_('There are no offers outstanding that you are authorised to deal with'), 'information'); @@ -55,7 +55,7 @@ } if (!isset($_POST['submit']) and isset($_POST['supplierid'])) { - $sql = 'SELECT offers.offerid, + $sql = "SELECT offers.offerid, offers.tenderid, offers.supplierid, suppliers.suppname, @@ -74,10 +74,10 @@ ON suppliers.supplierid=offers.supplierid LEFT JOIN stockmaster ON stockmaster.stockid=offers.stockid - WHERE purchorderauth.userid="'.$_SESSION['UserID'].'" - AND offers.expirydate>"'.date('Y-m-d').'" - AND offers.supplierid="'.$_POST['supplierid'].'" - ORDER BY offerid'; + WHERE purchorderauth.userid='".$_SESSION['UserID']."' + AND offers.expirydate>'".date('Y-m-d')."' + AND offers.supplierid='".$_POST['supplierid']."' + ORDER BY offerid"; $result=DB_query($sql, $db); echo "<form method='post' action=" . $_SERVER['PHP_SELF'] . '?' . SID . '>'; @@ -156,7 +156,7 @@ $myrow=DB_fetch_array($result); $Rate=$myrow['rate']; $OrderNo = GetNextTransNo(18, $db); - $sql='INSERT INTO purchorders ( + $sql="INSERT INTO purchorders ( orderno, supplierno, orddate, @@ -168,19 +168,19 @@ stat_comment, paymentterms) VALUES ( - '.$OrderNo.', - "'.$_POST['supplierid'].'", - "'.date('Y-m-d').'", - '.$Rate.', - "'.$_SESSION['UserID'].'", - "'.$_SESSION['DefaultFactoryLocation'].'", - "'.date('Y-m-d').'", - "'._('Pending').'", - "'._('Automatically generated from tendering system').'", - "'.$PaymentTerms.'")'; + '".$OrderNo."', + '".$_POST['supplierid']."', + '".date('Y-m-d')."', + '".$Rate."', + '".$_SESSION['UserID']."', + '".$_SESSION['DefaultFactoryLocation']."', + '".date('Y-m-d')."', + '"._('Pending')."', + '"._('Automatically generated from tendering system')."', + '".$PaymentTerms."')"; DB_query($sql, $db); foreach ($accepts as $AcceptID) { - $sql='SELECT offers.quantity, + $sql="SELECT offers.quantity, offers.price, offers.uom, stockmaster.description, @@ -188,12 +188,12 @@ FROM offers LEFT JOIN stockmaster ON offers.stockid=stockmaster.stockid - WHERE offerid='.$AcceptID; + WHERE offerid='".$AcceptID."'"; $result= DB_query($sql, $db); $myrow=DB_fetch_array($result); $MailText.=$myrow['description']."\t"._('Quantity').' '.$myrow['quantity']."\t"._('Price').' '. number_Format($myrow['price'])."\n"; - $sql='INSERT INTO purchorderdetails ( + $sql="INSERT INTO purchorderdetails ( orderno, itemcode, deliverydate, @@ -204,15 +204,15 @@ itemno, uom) VALUES ( - '.$OrderNo.', - "'.$myrow['stockid'].'", - "'.date('Y-m-d').'", - "'.$myrow['description'].'", - '.$myrow['price'].', - '.$myrow['price'].', - '.$myrow['quantity'].', - "'.$myrow['stockid'].'", - "'.$myrow['uom'].'")'; + '".$OrderNo."', + '".$myrow['stockid']."', + '".date('Y-m-d')."', + '".$myrow['description']."', + '".$myrow['price']."', + '".$myrow['price']."', + '".$myrow['quantity']."', + '".$myrow['stockid']."', + '".$myrow['uom']."')"; $result=DB_query($sql, $db); $sql='DELETE FROM offers WHERE offerid="'.$AcceptID.'"'; $result=DB_query($sql, $db); @@ -231,13 +231,13 @@ $_SESSION['CompanyRecord']['coyname']."\n"; $MailText.=_('The following offers you made have been rejected')."\n\n"; foreach ($rejects as $RejectID) { - $sql='SELECT offers.quantity, + $sql="SELECT offers.quantity, offers.price, stockmaster.description FROM offers LEFT JOIN stockmaster ON offers.stockid=stockmaster.stockid - WHERE offerid='.$RejectID; + WHERE offerid='".$RejectID."'"; $result= DB_query($sql, $db); $myrow=DB_fetch_array($result); $MailText.=$myrow['description']."\t"._('Quantity').' '.$myrow['quantity']."\t"._('Price').' '. @@ -253,6 +253,7 @@ prnMsg(_('The rejected offers from').' '.$SupplierName.' '._('have been removed from the system and an email sent to') .' '.$Email, 'success'); } + prnMsg(_('All offers have been processed, and emails sent where appropriate'), 'success'); } include('includes/footer.inc'); Modified: trunk/doc/Change.log.html =================================================================== --- trunk/doc/Change.log.html 2010-07-17 19:25:23 UTC (rev 3628) +++ trunk/doc/Change.log.html 2010-07-17 19:25:46 UTC (rev 3629) @@ -1,5 +1,6 @@ <p><font SIZE=4 COLOR=BLUE><b>webERP Change Log</b></font></p> <p></p> +<p>17/07/10 Tim: OffersReceived.php - SQL quoting and provide confirmation message at the end</p> <p>17/07/10 Tim: MRPShortages.php - SQL quoting and layout changes</p> <p>17/07/10 Tim: MRPReschedules.php - SQL quoting and layout changes</p> <p>17/07/10 Tim: MRPReport.php - Allow stock item search and selection, bug fixes, sql quoting and layout changes</p> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <tim...@us...> - 2010-07-17 19:26:13
|
Revision: 3630 http://web-erp.svn.sourceforge.net/web-erp/?rev=3630&view=rev Author: tim_schofield Date: 2010-07-17 19:26:07 +0000 (Sat, 17 Jul 2010) Log Message: ----------- SQL quoting and layout changes Modified Paths: -------------- trunk/OrderDetails.php trunk/SelectCompletedOrder.php trunk/doc/Change.log.html Modified: trunk/OrderDetails.php =================================================================== --- trunk/OrderDetails.php 2010-07-17 19:25:46 UTC (rev 3629) +++ trunk/OrderDetails.php 2010-07-17 19:26:07 UTC (rev 3630) @@ -7,6 +7,8 @@ /* Session started in header.inc for password checking and authorisation level check */ include('includes/session.inc'); +$_GET['OrderNumber']=(int)$_GET['OrderNumber']; + if (isset($_GET['OrderNumber'])) { $title = _('Reviewing Sales Order Number') . ' ' . $_GET['OrderNumber']; } else { @@ -19,7 +21,7 @@ include('includes/header.inc'); -$OrderHeaderSQL = 'SELECT +$OrderHeaderSQL = "SELECT salesorders.debtorno, debtorsmaster.name, salesorders.branchcode, @@ -46,73 +48,77 @@ debtorsmaster WHERE salesorders.debtorno = debtorsmaster.debtorno - AND salesorders.orderno = ' . $_GET['OrderNumber']; + AND salesorders.orderno = '" . $_GET['OrderNumber'] . "'"; $ErrMsg = _('The order cannot be retrieved because'); $DbgMsg = _('The SQL that failed to get the order header was'); $GetOrdHdrResult = DB_query($OrderHeaderSQL,$db, $ErrMsg, $DbgMsg); if (DB_num_rows($GetOrdHdrResult)==1) { + echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/supplier.png" title="' . + _('Order Details') . '" alt="">' . ' ' . $title . '</p>'; $myrow = DB_fetch_array($GetOrdHdrResult); - echo '<br><br><table bgcolor="#CCCCCC">'; + echo '<table class=selection>'; + echo '<tr><th colspan=4><font color=blue>'._('Order Header Details For Order No').' '.$_GET['OrderNumber'].'</font></th></tr>'; echo '<tr> - <th>' . _('Customer Code') . ':</th> - <td class="EvenTableRows"><font color=BLUE><b><a href="' . $rootpath . '/SelectCustomer.php?Select=' . $myrow['debtorno'] . '">' . $myrow['debtorno'] . '</a></b></td> - <th>' . _('Customer Name') . ':</th><td bgcolor="#CCCCCC"><font color=BLUE><b>' . $myrow['name'] . '</b></td> + <th style="text-align: left">' . _('Customer Code') . ':</th> + <td class="OddTableRows"><font><a href="' . $rootpath . '/SelectCustomer.php?Select=' . $myrow['debtorno'] . '">' . $myrow['debtorno'] . '</a></td> + <th style="text-align: left">' . _('Customer Name') . ':</th><td><font>' . $myrow['name'] . '</td> </tr>'; echo '<tr> - <th>' . _('Customer Reference') . ':</th> - <td class="EvenTableRows"><font color=BLUE><b>' . $myrow['customerref'] . '</font></b></td> - <th>' . _('Deliver To') . ':</th><td bgcolor="#CCCCCC"><font color=BLUE><b>' . $myrow['deliverto'] . '</b></td> + <th style="text-align: left">' . _('Customer Reference') . ':</th> + <td class="OddTableRows"><font>' . $myrow['customerref'] . '</font></td> + <th style="text-align: left">' . _('Deliver To') . ':</th><td><font>' . $myrow['deliverto'] . '</td> </tr>'; echo '<tr> - <th>' . _('Ordered On') . ':</th> - <td class="EvenTableRows"><font color=BLUE><b>' . ConvertSQLDate($myrow['orddate']) . '</font></b></td> - <th>' . _('Delivery Address 1') . ':</th> - <td class="EvenTableRows"><font color=BLUE><b>' . $myrow['deladd1'] . '</font></b></td> + <th style="text-align: left">' . _('Ordered On') . ':</th> + <td class="OddTableRows"><font>' . ConvertSQLDate($myrow['orddate']) . '</font></td> + <th style="text-align: left">' . _('Delivery Address 1') . ':</th> + <td class="OddTableRows"><font>' . $myrow['deladd1'] . '</font></td> </tr>'; echo '<tr> - <th>' . _('Requested Delivery') . ':</th> - <td class="EvenTableRows"><font color=BLUE><b>' . ConvertSQLDate($myrow['deliverydate']) . '</font></b></td> - <th>' . _('Delivery Address 2') . ':</th> - <td class="EvenTableRows"><font color=BLUE><b>' . $myrow['deladd2'] . '</font></b></td> + <th style="text-align: left">' . _('Requested Delivery') . ':</th> + <td class="OddTableRows"><font>' . ConvertSQLDate($myrow['deliverydate']) . '</font></td> + <th style="text-align: left">' . _('Delivery Address 2') . ':</th> + <td class="OddTableRows"><font>' . $myrow['deladd2'] . '</font></td> </tr>'; echo '<tr> - <th>' . _('Order Currency') . ':</th> - <td class="EvenTableRows"><font color=BLUE><b>' . $myrow['currcode'] . '</font></b></td> - <th>' . _('Delivery Address 3') . ':</th> - <td class="EvenTableRows"><font color=BLUE><b>' . $myrow['deladd3'] . '</font></b></td> + <th style="text-align: left"h>' . _('Order Currency') . ':</th> + <td class="OddTableRows"><font>' . $myrow['currcode'] . '</font></td> + <th style="text-align: left">' . _('Delivery Address 3') . ':</th> + <td class="OddTableRows"><font>' . $myrow['deladd3'] . '</font></td> </tr>'; echo '<tr> - <th>' . _('Deliver From Location') . ':</th> - <td class="EvenTableRows"><font color=BLUE><b>' . $myrow['fromstkloc'] . '</font></b></td> - <th>' . _('Delivery Address 4') . ':</th> - <td class="EvenTableRows"><font color=BLUE><b>' . $myrow['deladd4'] . '</font></b></td> + <th style="text-align: left">' . _('Deliver From Location') . ':</th> + <td class="OddTableRows"><font>' . $myrow['fromstkloc'] . '</font></td> + <th style="text-align: left">' . _('Delivery Address 4') . ':</th> + <td class="OddTableRows"><font>' . $myrow['deladd4'] . '</font></td> </tr>'; echo '<tr> - <th>' . _('Telephone') . ':</th> - <td class="EvenTableRows"><font color=BLUE><b>' . $myrow['contactphone'] . '</font></b></td> - <th>' . _('Delivery Address 5') . ':</th> - <td class="EvenTableRows"><font color=BLUE><b>' . $myrow['deladd5'] . '</font></b></td> + <th style="text-align: left">' . _('Telephone') . ':</th> + <td class="OddTableRows"><font>' . $myrow['contactphone'] . '</font></td> + <th style="text-align: left">' . _('Delivery Address 5') . ':</th> + <td class="OddTableRows"><font>' . $myrow['deladd5'] . '</font></td> </tr>'; echo '<tr> - <th>' . _('Email') . ':</th> - <td class="EvenTableRows"><font color=BLUE><b><a href="mailto:' . $myrow['contactemail'] . '">' . $myrow['contactemail'] . '</a></font></b></td> - <th>' . _('Delivery Address 6') . ':</th> - <td class="EvenTableRows"><font color=BLUE><b>' . $myrow['deladd6'] . '</font></b></td> + <th style="text-align: left">' . _('Email') . ':</th> + <td class="OddTableRows"><font><a href="mailto:' . $myrow['contactemail'] . '">' . $myrow['contactemail'] . '</a></font></td> + <th style="text-align: left">' . _('Delivery Address 6') . ':</th> + <td class="OddTableRows"><font>' . $myrow['deladd6'] . '</font></td> </tr>'; echo '<tr> - <th>' . _('Freight Cost') . ':</th> - <td class="EvenTableRows"><font color=BLUE><b>' . $myrow['freightcost'] . '</font></b></td> + <th style="text-align: left">' . _('Freight Cost') . ':</th> + <td class="OddTableRows"><font>' . $myrow['freightcost'] . '</font></td> </tr>'; - echo '</table><div class="centre">'; - echo _('Comments'). ': ' . $myrow['comments'] . '<br></div>'; + echo '<tr><th style="text-align: left">'._('Comments'). ': '; + echo '</th><td colspan=3>'.$myrow['comments'] . '</td></tr>'; + echo '</table>'; } /*Now get the line items */ - $LineItemsSQL = 'SELECT + $LineItemsSQL = "SELECT stkcode, stockmaster.description, stockmaster.volume, @@ -129,21 +135,21 @@ actualdispatchdate, qtyinvoiced FROM salesorderdetails, stockmaster - WHERE salesorderdetails.stkcode = stockmaster.stockid AND orderno =' . $_GET['OrderNumber']; + WHERE salesorderdetails.stkcode = stockmaster.stockid AND orderno ='" . $_GET['OrderNumber'] . "'"; $ErrMsg = _('The line items of the order cannot be retrieved because'); $DbgMsg = _('The SQL used to retrieve the line items, that failed was'); $LineItemsResult = db_query($LineItemsSQL,$db, $ErrMsg, $DbgMsg); - + if (db_num_rows($LineItemsResult)>0) { - + $OrderTotal = 0; $OrderTotalVolume = 0; $OrderTotalWeight = 0; - echo '<br><div class="centre"><b>' . _('Line Details') . '</div></b> - <table cellpadding=2 colspan=9 border=1> - <tr> + echo '<br><table cellpadding=2 colspan=9 class=selection>'; + echo '<tr><th colspan=9><font color=blue>'._('Order Line Details For Order No').' '.$_GET['OrderNumber'].'</font></th></tr>'; + echo '<tr> <th>' . _('Item Code') . '</th> <th>' . _('Item Description') . '</th> <th>' . _('Quantity') . '</th> @@ -181,23 +187,23 @@ <td class=number>' . number_format($myrow['qtyinvoiced'],2) . '</td> <td>' . $DisplayActualDeliveryDate . '</td> </tr>'; - + $OrderTotal = $OrderTotal + $myrow['quantity'] * $myrow['unitprice'] * (1 - $myrow['discountpercent']); $OrderTotalVolume = $OrderTotalVolume + $myrow['quantity'] * $myrow['volume']; $OrderTotalWeight = $OrderTotalWeight + $myrow['quantity'] * $myrow['kgs']; - + } $DisplayTotal = number_format($OrderTotal,2); $DisplayVolume = number_format($OrderTotalVolume,2); $DisplayWeight = number_format($OrderTotalWeight,2); - + echo '<tr> <td colspan=5 class=number><b>' . _('TOTAL Excl Tax/Freight') . '</b></td> <td colspan=2 class=number>' . $DisplayTotal . '</td> </tr> </table>'; - - echo '<table border=1> + + echo '<br><table class=selection> <tr> <td>' . _('Total Weight') . ':</td> <td>' . $DisplayWeight . '</td> @@ -206,6 +212,6 @@ </tr> </table>'; } - + include('includes/footer.inc'); -?> +?> \ No newline at end of file Modified: trunk/SelectCompletedOrder.php =================================================================== --- trunk/SelectCompletedOrder.php 2010-07-17 19:25:46 UTC (rev 3629) +++ trunk/SelectCompletedOrder.php 2010-07-17 19:26:07 UTC (rev 3630) @@ -10,7 +10,8 @@ include('includes/header.inc'); -echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/magnifier.png" title="' . _('Search') . '" alt="">' . ' ' . _('Search Sales Orders') . '</p>'; +echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/magnifier.png" title="' . _('Search') . + '" alt="">' . ' ' . _('Search Sales Orders') . '</p>'; echo "<form action='" . $_SERVER['PHP_SELF'] . '?' . SID ."' method=post>"; @@ -60,18 +61,20 @@ } 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>'; + echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/sales.png" title="' . _('Sales Order') . + '" alt="">' . ' ' . _('Order Number') . ' - ' . $OrderNumber . '</p>'; } elseif (isset($CustomerRef)) { echo _('Customer Ref') . ' - ' . $CustomerRef; } else { if (isset($SelectedCustomer)) { echo _('For customer') . ': ' . $SelectedCustomer .' ' . _('and') . ' '; - echo "<input type=hidden name='SelectedCustomer' value='$SelectedCustomer'>"; + echo "<input type=hidden name='SelectedCustomer' value='".$SelectedCustomer."'>"; } if (isset($SelectedStockItem)) { - echo _('for the part') . ': ' . $SelectedStockItem . ' ' . _('and') . ' ' ."<input type=hidden name='SelectedStockItem' value='$SelectedStockItem'>"; + $PartString = _('for the part') . ': <b>' . $SelectedStockItem . '</b> ' . _('and') . ' ' . + "<input type=hidden name='SelectedStockItem' value='".$SelectedStockItem."'>"; } } @@ -97,7 +100,7 @@ LEFT JOIN locstock ON stockmaster.stockid=locstock.stockid) LEFT JOIN purchorderdetails on stockmaster.stockid = purchorderdetails.itemcode) WHERE salesorderdetails.completed =1 - AND stockmaster.description " . LIKE . "'$SearchString' + AND stockmaster.description LIKE '" . $SearchString. "' AND stockmaster.categoryid='" . $_POST['StockCat'] . "' GROUP BY stockmaster.stockid, stockmaster.description, @@ -113,7 +116,7 @@ FROM (((stockmaster LEFT JOIN salesorderdetails on stockmaster.stockid = salesorderdetails.stkcode) LEFT JOIN locstock ON stockmaster.stockid=locstock.stockid) LEFT JOIN purchorderdetails on stockmaster.stockid = purchorderdetails.itemcode) - WHERE stockmaster.description " . LIKE . "'$SearchString' + WHERE stockmaster.description LIKE '" . $SearchString. "' AND stockmaster.categoryid='" . $_POST['StockCat'] . "' GROUP BY stockmaster.stockid, stockmaster.description, @@ -134,7 +137,7 @@ LEFT JOIN locstock ON stockmaster.stockid=locstock.stockid) LEFT JOIN purchorderdetails on stockmaster.stockid = purchorderdetails.itemcode) WHERE salesorderdetails.completed =1 - AND stockmaster.stockid " . LIKE . " '%" . $_POST['StockCode'] . "%' + AND stockmaster.stockid LIKE '%" . $_POST['StockCode'] . "%' AND stockmaster.categoryid='" . $_POST['StockCat'] . "' GROUP BY stockmaster.stockid, stockmaster.description, @@ -150,7 +153,7 @@ FROM (((stockmaster LEFT JOIN salesorderdetails on stockmaster.stockid = salesorderdetails.stkcode) LEFT JOIN locstock ON stockmaster.stockid=locstock.stockid) LEFT JOIN purchorderdetails on stockmaster.stockid = purchorderdetails.itemcode) - WHERE stockmaster.stockid " . LIKE . " '%" . $_POST['StockCode'] . "%' + WHERE stockmaster.stockid LIKE '%" . $_POST['StockCode'] . "%' AND stockmaster.categoryid='" . $_POST['StockCat'] . "' GROUP BY stockmaster.stockid, stockmaster.description, @@ -230,7 +233,7 @@ AND salesorders.branchcode = custbranch.branchcode AND salesorders.debtorno = debtorsmaster.debtorno AND debtorsmaster.debtorno = custbranch.debtorno - AND salesorders.orderno=". $OrderNumber ." + AND salesorders.orderno='". $OrderNumber ."' AND salesorders.quotation=0 AND salesorderdetails.completed".$completed." GROUP BY salesorders.orderno, @@ -377,7 +380,7 @@ AND salesorders.debtorno = debtorsmaster.debtorno AND salesorders.branchcode = custbranch.branchcode AND debtorsmaster.debtorno = custbranch.debtorno - AND salesorders.orddate >= '$DateAfterCriteria' + AND salesorders.orddate >= '".$DateAfterCriteria . "' AND salesorders.quotation=0 AND salesorderdetails.completed".$completed." GROUP BY salesorders.orderno, @@ -405,11 +408,18 @@ $_POST['OrdersAfterDate'] = Date($_SESSION['DefaultDateFormat'],Mktime(0,0,0,Date('m')-2,Date('d'),Date('Y'))); } echo "<table class=selection>"; + +if (isset($PartString)) { + echo "<tr><td>".$PartString."</td>"; +} else { + echo "<tr><td></td>"; +} + if (!isset($OrderNumber) or $OrderNumber==''){ - echo '<tr><td>' . _('Order Number') . ':</td><td>' . "<input type='text' name='OrderNumber' maxlength =8 size=9></td><td>" . _('for all orders placed after') . + 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>' . _('Customer Ref') . ':</td><td>' . "<input type='text' name='CustomerRef' maxlength =8 size=9></td> + 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>'; @@ -418,7 +428,7 @@ $SQL='SELECT categoryid, categorydescription FROM stockcategory ORDER BY categorydescription'; $result1 = DB_query($SQL,$db); - echo '<hr>'; + 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 '<tr><td><font size=1>' . _('Select a stock category') . ':</font>'; @@ -450,7 +460,7 @@ If (isset($StockItemsResult)) { - echo '<table cellpadding=2 colspan=7 border=2>'; + echo '<br><table cellpadding=2 colspan=7 class=selection>'; $TableHeadings = "<tr><th>" . _('Code') . "</th>" . "<th>" . _('Description') . "</th>" . @@ -500,7 +510,7 @@ /*show a table of the orders returned by the SQL */ - echo '<table cellpadding=2 colspan=6 width=100%>'; + echo '<br><table cellpadding=2 colspan=6 width=90% class=selection>'; $tableheader = "<tr><th>" . _('Order') . " #</th> <th>" . _('Customer') . "</th> @@ -531,7 +541,7 @@ $FormatedOrderDate = ConvertSQLDate($myrow['orddate']); $FormatedOrderValue = number_format($myrow['ordervalue'],2); - printf("<td><a target='_blank' href='%s'>%s</a></td> + printf("<td><a href='%s'>%s</a></td> <td>%s</td> <td>%s</td> <td>%s</td> @@ -561,4 +571,4 @@ echo '</form>'; include('includes/footer.inc'); -?> +?> \ No newline at end of file Modified: trunk/doc/Change.log.html =================================================================== --- trunk/doc/Change.log.html 2010-07-17 19:25:46 UTC (rev 3629) +++ trunk/doc/Change.log.html 2010-07-17 19:26:07 UTC (rev 3630) @@ -1,5 +1,7 @@ <p><font SIZE=4 COLOR=BLUE><b>webERP Change Log</b></font></p> <p></p> +<p>17/07/10 Tim: SelectCompletedOrder.php - SQL quoting and layout changes</p> +<p>17/07/10 Tim: OrderDetails.php - SQL quoting and layout changes</p> <p>17/07/10 Tim: OffersReceived.php - SQL quoting and provide confirmation message at the end</p> <p>17/07/10 Tim: MRPShortages.php - SQL quoting and layout changes</p> <p>17/07/10 Tim: MRPReschedules.php - SQL quoting and layout changes</p> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <tim...@us...> - 2010-07-17 20:19:33
|
Revision: 3631 http://web-erp.svn.sourceforge.net/web-erp/?rev=3631&view=rev Author: tim_schofield Date: 2010-07-17 20:19:27 +0000 (Sat, 17 Jul 2010) Log Message: ----------- SQL quoting and layout changes Modified Paths: -------------- trunk/OutstandingGRNs.php trunk/doc/Change.log.html trunk/includes/PDFOstdgGRNsPageHeader.inc Modified: trunk/OutstandingGRNs.php =================================================================== --- trunk/OutstandingGRNs.php 2010-07-17 19:26:07 UTC (rev 3630) +++ trunk/OutstandingGRNs.php 2010-07-17 20:19:27 UTC (rev 3631) @@ -16,12 +16,12 @@ include('includes/PDFStarter.php'); $pdf->addInfo('Title',_('Outstanding GRNs Report')); $pdf->addInfo('Subject',_('Outstanding GRNs Valuation')); - $FontSize=10; + $FontSize=10; $PageNumber=1; $line_height=12; $Left_Margin=30; - /*Now figure out the data to report for the criteria under review */ + /*Now figure out the data to report for the criteria under review */ $SQL = "SELECT grnno, orderno, @@ -42,7 +42,7 @@ AND qtyrecd-quantityinv <>0 AND grns.supplierid >='" . $_POST['FromCriteria'] . "' AND grns.supplierid <='" . $_POST['ToCriteria'] . "' - ORDER BY supplierid, + ORDER BY supplierid, grnno"; $GRNsResult = DB_query($SQL,$db,'','',false,false); @@ -53,7 +53,7 @@ prnMsg(_('The outstanding GRNs valuation details could not be retrieved by the SQL because') . ' - ' . DB_error_msg($db),'error'); echo "<br><a href='" .$rootpath ."/index.php?" . SID . "'>" . _('Back to the menu') . '</a>'; if ($debug==1){ - echo "<br>$SQL"; + echo "<br>".$SQL; } include('includes/footer.inc'); exit; @@ -65,7 +65,7 @@ prnMsg(_('No outstanding GRNs valuation details retrieved'), 'warn'); echo "<br><a href='" .$rootpath ."/index.php?" . SID . "'>" . _('Back to the menu') . '</a>'; if ($debug==1){ - echo "<br>$SQL"; + echo "<br>$SQL"; } include('includes/footer.inc'); exit; @@ -97,7 +97,7 @@ } $YPos -=$line_height; - $LeftOvers = $pdf->addTextWrap(30,$YPos,40,$FontSize,$GRNs['grnno']); + $LeftOvers = $pdf->addTextWrap(32,$YPos,40,$FontSize,$GRNs['grnno']); $LeftOvers = $pdf->addTextWrap(70,$YPos,40,$FontSize,$GRNs['orderno']); $LeftOvers = $pdf->addTextWrap(110,$YPos,200,$FontSize,$GRNs['itemcode'] . ' - ' . $GRNs['itemdescription']); $DisplayStdCost = number_format($GRNs['stdcostunit'],2); @@ -146,14 +146,14 @@ $pdfcode = $pdf->output(); $len = strlen($pdfcode); - if ($len<=20){ + if ($len<=20){ $title = _('Outstanding GRNs Valuation Error'); include('includes/header.inc'); prnMsg(_('There were no GRNs with any value to print out for the specified supplier range'),'info'); echo "<br><a href='$rootpath/index.php?" . SID . "'>" . _('Back to the menu') . '</a>'; include('includes/footer.inc'); exit; - } else { + } else { header('Content-type: application/pdf'); header('Content-Length: ' . $len); header('Content-Disposition: inline; filename=OSGRNsValuation.pdf'); @@ -162,26 +162,29 @@ header('Pragma: public'); $pdf->Output('OutstandingGRNs.pdf','I'); - } + } */ - $pdf->OutputD($_SESSION['DatabaseName'] . '_OSGRNsValuation_' . date('Y-m-d').'.pdf');//UldisN - $pdf->__destruct(); //UldisN + $pdf->OutputD($_SESSION['DatabaseName'] . '_OSGRNsValuation_' . date('Y-m-d').'.pdf');//UldisN + $pdf->__destruct(); //UldisN } else { /*The option to print PDF was not hit */ $title=_('Outstanding GRNs Report'); include('includes/header.inc'); - echo '<form action=' . $_SERVER['PHP_SELF'] . " method='POST'><table>"; + echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/magnifier.png" title="' . _('Search') . + '" alt="">' . ' ' . $title . '</p>'; + echo '<form action=' . $_SERVER['PHP_SELF'] . " method='POST'><table class=selection>"; + echo '<tr><td>' . _('From Supplier Code') . ":</td> - <td><input type=TEXT name='FromCriteria' VALUE='0'></td></tr>"; + <td><input type=text name='FromCriteria' value='0'></td></tr>"; echo '<tr><td>' . _('To Supplier Code'). ":</td> - <td><input type=TEXT name='ToCriteria' VALUE='zzzzzzz'></td></tr>"; + <td><input type=text name='ToCriteria' value='zzzzzzz'></td></tr>"; - echo "</table><div class='centre'><input type=Submit Name='PrintPDF' Value='" . _('Print PDF') . "'></div>"; + echo "</table><br><div class='centre'><input type=Submit Name='PrintPDF' Value='" . _('Print PDF') . "'></div>"; include('includes/footer.inc'); } /*end of else not PrintPDF */ -?> +?> \ No newline at end of file Modified: trunk/doc/Change.log.html =================================================================== --- trunk/doc/Change.log.html 2010-07-17 19:26:07 UTC (rev 3630) +++ trunk/doc/Change.log.html 2010-07-17 20:19:27 UTC (rev 3631) @@ -1,5 +1,6 @@ <p><font SIZE=4 COLOR=BLUE><b>webERP Change Log</b></font></p> <p></p> +<p>17/07/10 Tim: OutstandingGRNs.php - SQL quoting and layout changes</p> <p>17/07/10 Tim: SelectCompletedOrder.php - SQL quoting and layout changes</p> <p>17/07/10 Tim: OrderDetails.php - SQL quoting and layout changes</p> <p>17/07/10 Tim: OffersReceived.php - SQL quoting and provide confirmation message at the end</p> Modified: trunk/includes/PDFOstdgGRNsPageHeader.inc =================================================================== --- trunk/includes/PDFOstdgGRNsPageHeader.inc 2010-07-17 19:26:07 UTC (rev 3630) +++ trunk/includes/PDFOstdgGRNsPageHeader.inc 2010-07-17 20:19:27 UTC (rev 3631) @@ -24,10 +24,16 @@ $pdf->line($Left_Margin, $YPos+10,$Page_Width-$Right_Margin, $YPos+10); $pdf->line($Page_Width-$Right_Margin, $YPos-$line_height,$Page_Width-$Right_Margin, $YPos+10); +/*Draw a rectangle to put the details in */ + +$pdf->line($Left_Margin, $Page_Height-$YPos-$line_height,$Page_Width-$Right_Margin, $Page_Height-$YPos-$line_height); +$pdf->line($Left_Margin, $Page_Height-$YPos-$line_height,$Left_Margin, $YPos+10); +$pdf->line($Page_Width-$Right_Margin, $Page_Height-$YPos-$line_height,$Page_Width-$Right_Margin, $YPos+10); + /*set up the headings */ $Xpos = $Left_Margin+1; -$LeftOvers = $pdf->addTextWrap(30,$YPos,40,$FontSize,_('GRN'), 'centre'); +$LeftOvers = $pdf->addTextWrap(32,$YPos,40,$FontSize,_('GRN'), 'centre'); $LeftOvers = $pdf->addTextWrap(70,$YPos,40,$FontSize,_('Order') . ' #', 'centre'); $LeftOvers = $pdf->addTextWrap(110,$YPos,200,$FontSize,_('Item') . ' / ' . _('Description'), 'centre'); $LeftOvers = $pdf->addTextWrap(310,$YPos,50,$FontSize,_('Qty Recd'), 'centre'); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |