From: <tim...@us...> - 2010-09-23 10:53:38
|
Revision: 3757 http://web-erp.svn.sourceforge.net/web-erp/?rev=3757&view=rev Author: tim_schofield Date: 2010-09-23 10:53:32 +0000 (Thu, 23 Sep 2010) Log Message: ----------- SQL quoting corrections and layout changes and improvements Modified Paths: -------------- trunk/ReorderLevel.php trunk/doc/Change.log.html Modified: trunk/ReorderLevel.php =================================================================== --- trunk/ReorderLevel.php 2010-09-23 10:42:37 UTC (rev 3756) +++ trunk/ReorderLevel.php 2010-09-23 10:53:32 UTC (rev 3757) @@ -31,8 +31,8 @@ if ($_POST['StockLocation'] != 'All') { $wherelocation = " AND locstock.loccode='" . $_POST['StockLocation'] . "' "; } - - $sql = 'SELECT locstock.stockid, + + $sql = "SELECT locstock.stockid, stockmaster.description, locstock.loccode, locations.locationname, @@ -41,16 +41,16 @@ stockmaster.decimalplaces, stockmaster.serialised, stockmaster.controlled - FROM locstock, - stockmaster, + FROM locstock, + stockmaster, locations - WHERE locstock.stockid=stockmaster.stockid ' . - $wherelocation . + WHERE locstock.stockid=stockmaster.stockid " . + $wherelocation . "AND locstock.loccode=locations.loccode AND locstock.reorderlevel > locstock.quantity AND (stockmaster.mbflag='B' OR stockmaster.mbflag='M') " . - $wherecategory . ' ORDER BY locstock.loccode,locstock.stockid'; - + $wherecategory . " ORDER BY locstock.loccode,locstock.stockid"; + $result = DB_query($sql,$db,'','',false,true); if (DB_error_no($db) !=0) { @@ -81,18 +81,18 @@ // 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 + $fill = ''; + $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(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); + $shortage = $myrow['reorderlevel'] - $myrow['quantity']; + $pdf->addTextWrap(470,$YPos,50,$FontSize,number_format($shortage, + $myrow['decimalplaces']),'right',0,$fill); - $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(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); - $shortage = $myrow['reorderlevel'] - $myrow['quantity']; - $pdf->addTextWrap(470,$YPos,50,$FontSize,number_format($shortage, - $myrow['decimalplaces']),'right',0,$fill); - if ($YPos < $Bottom_Margin + $line_height){ PrintHeader($pdf,$YPos,$PageNumber,$Page_Height,$Top_Margin,$Left_Margin,$Page_Width, $Right_Margin,$catdescription); @@ -106,24 +106,24 @@ FROM locstock, stockmaster WHERE locstock.quantity > 0 AND locstock.quantity > reorderlevel - AND locstock.stockid = stockmaster.stockid + AND locstock.stockid = stockmaster.stockid AND locstock.stockid ='" . $myrow['stockid'] . "' AND locstock.loccode !='" . $myrow['loccode'] . "'"; $otherresult = DB_query($sql2,$db,'','',false,true); While ($myrow2 = DB_fetch_array($otherresult,$db)){ $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(310,$YPos,60,$FontSize,$myrow2['loccode'],'left',0,$fill); $pdf->addTextWrap(370,$YPos,50,$FontSize,number_format($myrow2['quantity'], $myrow2['decimalplaces']),'right',0,$fill); $pdf->addTextWrap(420,$YPos,50,$FontSize,number_format($myrow2['reorderlevel'], $myrow2['decimalplaces']),'right',0,$fill); - + if ($YPos < $Bottom_Margin + $line_height){ PrintHeader($pdf,$YPos,$PageNumber,$Page_Height,$Top_Margin,$Left_Margin,$Page_Width, $Right_Margin,$catdescription); @@ -163,20 +163,20 @@ $pdf->OutputI($_SESSION['DatabaseName'] . '_ReOrderLevel_' . date('Y-m-d') . '.pdf');//UldisN $pdf->__destruct(); //UldisN } - + } else { /*The option to print PDF was not hit so display form */ $title=_('Reorder Level Reporting'); include('includes/header.inc'); -echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/inventory.png" title="' . _('Inventory') . '" alt="">' . ' ' . _('Inventory Reorder Level Report') . ''; -echo '<div class="page_help_text">' . _('Use this report to display the reorder levels for Inventory items in different categories.') . '</div><br>'; + echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/inventory.png" title="' . _('Inventory') . '" alt="" />' . ' ' . _('Inventory Reorder Level Report') . '</p>'; + echo '<div class="page_help_text">' . _('Use this report to display the reorder levels for Inventory items in different categories.') . '</div><br>'; echo '</br></br><form action=' . $_SERVER['PHP_SELF'] . " method='post'><table>"; $sql = "SELECT loccode, locationname FROM locations"; - $resultStkLocs = DB_query($sql,$db); - echo '<table><tr><td>' . _('From Stock Location') . ':</td><td><select name="StockLocation"> '; + $resultStkLocs = DB_query($sql,$db); + echo '<table class=selection><tr><td>' . _('From Stock Location') . ':</td><td><select name="StockLocation"> '; if (!isset($_POST['StockLocation'])){ $_POST['StockLocation']='All'; } @@ -191,10 +191,10 @@ } else { echo '<option Value="' . $myrow['loccode'] . '">' . $myrow['locationname']; } - } + } 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> @@ -205,7 +205,7 @@ include ('includes/footer.inc'); exit; } - + echo '<tr><td>' . _('In Stock Category') . ':</td><td><select name="StockCat">'; if (!isset($_POST['StockCat'])){ $_POST['StockCat']='All'; @@ -223,7 +223,7 @@ } } 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'); @@ -239,13 +239,13 @@ $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,_('Reorder Level Report')); - $pdf->addTextWrap($Page_Width-$Right_Margin-150,$YPos,160,$FontSize,_('Printed') . ': ' . + + $pdf->addTextWrap($Left_Margin,$YPos,150,$FontSize,_('Reorder Level 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')); @@ -255,10 +255,10 @@ $pdf->addTextWrap($Left_Margin,$YPos,50,$FontSize,_('Location')); $pdf->addTextWrap(95,$YPos,50,$FontSize,$_POST['StockLocation']); $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'); @@ -273,4 +273,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-09-23 10:42:37 UTC (rev 3756) +++ trunk/doc/Change.log.html 2010-09-23 10:53:32 UTC (rev 3757) @@ -1,5 +1,6 @@ <p><font SIZE=4 COLOR=BLUE><b>webERP Change Log</b></font></p> <p></p> +<p>23/09/10 Tim: ReorderLevel.php - SQL quoting corrections and layout changes and improvements</p> <p>23/09/10 Tim: RecurringSalesOrdersProcess.php - SQL quoting corrections</p> <p>23/09/10 Tim: RecurringSalesOrders.php - SQL quoting corrections and layout changes and improvements</p> <p>23/09/10 Tim: DateFunctions.inc - mktime() function without paramaeters is now deprecated, replaced with time()</p> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |