From: <dai...@us...> - 2011-10-14 06:08:17
|
Revision: 4719 http://web-erp.svn.sourceforge.net/web-erp/?rev=4719&view=rev Author: daintree Date: 2011-10-14 06:08:10 +0000 (Fri, 14 Oct 2011) Log Message: ----------- number_formats Modified Paths: -------------- trunk/FixedAssetRegister.php trunk/SelectGLAccount.php trunk/StockCostUpdate.php trunk/StockDispatch.php trunk/StockLocMovements.php trunk/StockLocStatus.php trunk/reportwriter/WriteForm.inc Modified: trunk/FixedAssetRegister.php =================================================================== --- trunk/FixedAssetRegister.php 2011-10-11 09:10:13 UTC (rev 4718) +++ trunk/FixedAssetRegister.php 2011-10-14 06:08:10 UTC (rev 4719) @@ -4,7 +4,7 @@ $title = _('Fixed Asset Register'); $csv_output = ''; // Reports being generated in HTML, PDF and CSV/EXCEL format -if (isset($_POST['submit']) or isset($_POST['pdf']) or isset($_POST['csv'])) { +if (isset($_POST['submit']) OR isset($_POST['pdf']) OR isset($_POST['csv'])) { if (isset($_POST['pdf'])) { $PaperSize = 'A4_Landscape'; include ('includes/PDFStarter.php'); @@ -213,11 +213,11 @@ header('Location: ' .$_SESSION['reports_dir'] . '/FixedAssetRegister_' . Date('Y-m-d') .'.csv'); } else { - echo '<input type=hidden name="FromDate" value="' . $_POST['FromDate'] . '">'; - echo '<input type=hidden name="ToDate" value=' . $_POST['ToDate'] . '>'; - echo '<input type=hidden name="AssetCategory" value=' . $_POST['AssetCategory'] . '>'; - echo '<input type=hidden name="AssetID" value=' . $_POST['AssetID'] . '>'; - echo '<input type=hidden name="AssetLocation" value=' . $_POST['AssetLocation'] . '>'; + echo '<input type="hidden" name="FromDate" value="' . $_POST['FromDate'] . '" />'; + echo '<input type="hidden" name="ToDate" value=' . $_POST['ToDate'] . '>'; + echo '<input type="hidden" name="AssetCategory" value="' . $_POST['AssetCategory'] . '" />'; + echo '<input type="hidden" name="AssetID" value="' . $_POST['AssetID'] . '" />'; + echo '<input type="hidden" name="AssetLocation" value="' . $_POST['AssetLocation'] . '" />'; //Total Values echo '<tr><th style="vertical-align:top" colspan="5">' . _('TOTAL') . '</th>'; echo '<th style="text-align:right">' . locale_number_format($TotalCostBfwd, $_SESSION['CompanyRecord']['decimalplaces']) . '</th>'; @@ -229,8 +229,8 @@ echo '<th style="text-align:right">' . locale_number_format($TotalNBV, $_SESSION['CompanyRecord']['decimalplaces']) . '</th>'; echo '<th style="text-align:right">' . locale_number_format($TotalDisposals, $_SESSION['CompanyRecord']['decimalplaces']) . '</th></tr>'; echo '</table>'; - echo '<br /><div class="centre"><input type="Submit" name="pdf" value="' . _('Print as a pdf') . '"> '; - echo '<input type="Submit" name="csv" value="' . _('Print as CSV') . '"></div></form>'; + echo '<br /><div class="centre"><input type="Submit" name="pdf" value="' . _('Print as a pdf') . '" /> '; + echo '<input type="submit" name="csv" value="' . _('Print as CSV') . '" /></div></form>'; } } else { include ('includes/header.inc'); @@ -283,16 +283,16 @@ $_POST['ToDate'] = date($_SESSION['DefaultDateFormat']); } - echo '<tr><th>' . _(' From Date') . '</th><td><input type="text" class="date" alt="' . $_SESSION['DefaultDateFormat'] . '" name="FromDate" maxlength=10 size=11 value="' . $_POST['FromDate'] . '"></td>'; + echo '<tr><th>' . _(' From Date') . '</th><td><input type="text" class="date" alt="' . $_SESSION['DefaultDateFormat'] . '" name="FromDate" maxlength=10 size=11 value="' . $_POST['FromDate'] . '" /></td>'; echo '</tr>'; - echo '<tr><th>' . _('To Date ') . '</th><td><input type="text" class="date" alt="' . $_SESSION['DefaultDateFormat'] . '" name="ToDate" maxlength="10" size="11" value="' . $_POST['ToDate'] . '"></td> + echo '<tr><th>' . _('To Date ') . '</th><td><input type="text" class="date" alt="' . $_SESSION['DefaultDateFormat'] . '" name="ToDate" maxlength="10" size="11" value="' . $_POST['ToDate'] . '" /></td> </tr> </table> <br />'; - + echo '<div class="centre"><input type="submit" name="submit" value="' . _('Show Assets') . '"> '; - echo '<input type="Submit" name="pdf" value="' . _('Print as a pdf') . '"> '; - echo '<input type="Submit" name = "csv" value= "' . _('Print as CSV') . '"></div>'; + echo '<input type="submit" name="pdf" value="' . _('Print as a pdf') . '" /> '; + echo '<input type="Submit" name = "csv" value= "' . _('Print as CSV') . '" /></div>'; echo '</form>'; } include ('includes/footer.inc'); Modified: trunk/SelectGLAccount.php =================================================================== --- trunk/SelectGLAccount.php 2011-10-11 09:10:13 UTC (rev 4718) +++ trunk/SelectGLAccount.php 2011-10-14 06:08:10 UTC (rev 4719) @@ -111,11 +111,11 @@ while ($myrow=DB_fetch_array($result)) { - printf("<tr><td><font size=1><input type=submit name='Select' VALUE='%s'</font></td> + printf('<tr><td><font size=1><input type="submit" name="Select" value="%s" /></font></td> <td><font size=1>%s</font></td> <td><font size=1>%s</font></td> <td><font size=1>%s</font></td> - </tr>", + </tr>', $myrow['accountcode'], $myrow['accountname'], $myrow['group_'], Modified: trunk/StockCostUpdate.php =================================================================== --- trunk/StockCostUpdate.php 2011-10-11 09:10:13 UTC (rev 4718) +++ trunk/StockCostUpdate.php 2011-10-14 06:08:10 UTC (rev 4719) @@ -55,7 +55,7 @@ DB_free_result($OldResult); $OldCost = $_POST['OldMaterialCost'] + $_POST['OldLabourCost'] + $_POST['OldOverheadCost']; - $NewCost =$_POST['MaterialCost'] + $_POST['LabourCost'] + $_POST['OverheadCost']; + $NewCost = filter_number_format($_POST['MaterialCost']) + filter_number_format($_POST['LabourCost']) + filter_number_format($_POST['OverheadCost']); $result = DB_query("SELECT * FROM stockmaster WHERE stockid='" . $StockID . "'",$db); $myrow = DB_fetch_row($result); @@ -66,9 +66,9 @@ $Result = DB_Txn_Begin($db); ItemCostUpdateGL($db, $StockID, $NewCost, $OldCost, $_POST['QOH']); - $SQL = "UPDATE stockmaster SET materialcost='" . $_POST['MaterialCost'] . "', - labourcost='" . $_POST['LabourCost'] . "', - overheadcost='" . $_POST['OverheadCost'] . "', + $SQL = "UPDATE stockmaster SET materialcost='" . filter_number_format($_POST['MaterialCost']) . "', + labourcost='" . filter_number_format($_POST['LabourCost']) . "', + overheadcost='" . filter_number_format($_POST['OverheadCost']) . "', lastcost='" . $OldCost . "', lastcostupdate ='" . Date('Y-m-d')."' WHERE stockid='" . $StockID . "'"; @@ -116,15 +116,15 @@ $myrow = DB_fetch_array($result); -echo '<form action="' . $_SERVER['PHP_SELF'] . '?'. SID .'" method=post>'; +echo '<form action="' . $_SERVER['PHP_SELF'] . '" method="post">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; -echo '<table cellpadding=2 class=selection>'; -echo '<tr><th colspan=2>' . _('Item Code') . ':<input type="text" name="StockID" value="' . $StockID . '" 1 maxlength=20>'; -echo '<input type="submit" name="Show" value="' . _('Show Cost Details') . '"></th></tr>'; -echo '<tr><th colspan=2><font color=navy size=2>' . $StockID . ' - ' . $myrow['description'] . '</font></th></tr>'; -echo '<tr><th colspan=2><font color=navy size=2>'. _('Total Quantity On Hand') . ': ' . $myrow['totalqoh'] . ' ' . $myrow['units'] .'</font></th></tr>'; -echo '<tr><th colspan=2><font color=navy size=2>'. _('Last Cost update on') . ': ' . ConvertSQLDate($myrow['lastcostupdate']) .'</font></th></tr>'; +echo '<table cellpadding="2" class="selection">'; +echo '<tr><th colspan="2">' . _('Item Code') . ':<input type="text" name="StockID" value="' . $StockID . '" maxlength="20" />'; +echo '<input type="submit" name="Show" value="' . _('Show Cost Details') . '" /></th></tr>'; +echo '<tr><th colspan="2"><font color="navy" size="2">' . $StockID . ' - ' . $myrow['description'] . '</font></th></tr>'; +echo '<tr><th colspan="2"><font color="navy" size="2">'. _('Total Quantity On Hand') . ': ' . $myrow['totalqoh'] . ' ' . $myrow['units'] .'</font></th></tr>'; +echo '<tr><th colspan="2"><font color="navy" size="2">'. _('Last Cost update on') . ': ' . ConvertSQLDate($myrow['lastcostupdate']) .'</font></th></tr>'; if (($myrow['mbflag']=='D' AND $myrow['stocktype'] != 'L') OR $myrow['mbflag']=='A' @@ -142,10 +142,10 @@ exit; } -echo '<input type=hidden name="OldMaterialCost" value="' . $myrow['materialcost'] .'">'; -echo '<input type=hidden name="OldLabourCost" value="' . $myrow['labourcost'] .'">'; -echo '<input type=hidden name="OldOverheadCost" value="' . $myrow['overheadcost'] .'">'; -echo '<input type=hidden name="QOH" value="' . $myrow['totalqoh'] .'">'; +echo '<input type="hidden" name="OldMaterialCost" value="' . $myrow['materialcost'] .'" />'; +echo '<input type="hidden" name="OldLabourCost" value="' . $myrow['labourcost'] .'" />'; +echo '<input type="hidden" name="OldOverheadCost" value="' . $myrow['overheadcost'] .'" />'; +echo '<input type="hidden" name="QOH" value="' . $myrow['totalqoh'] .'" />'; echo '<tr><td>' . _('Last Cost') .':</td> <td class="number">' . locale_number_format($myrow['lastcost'],$_SESSION['CompanyRecord']['decimalplaces']) . '</td></tr>'; @@ -163,22 +163,27 @@ </tr>'; echo '<tr> <td>' . _('Standard Labour Cost Per Unit') . ':</td> - <td class="number"><input type="text" class="number" name="LabourCost" value=' . $myrow['labourcost'] . '></td> + <td class="number"><input type="text" class="number" name="LabourCost" value="' . locale_number_format($myrow['labourcost'],4) . '" /></td> </tr>'; echo '<tr> <td>' . _('Standard Overhead Cost Per Unit') . ':</td> - <td class="number"><input type="text" class="number" name="OverheadCost" value=' . $myrow['overheadcost'] . '></td> + <td class="number"><input type="text" class="number" name="OverheadCost" value="' . locale_number_format($myrow['overheadcost'],4) . '" /></td> </tr>'; } elseif ($myrow['mbflag']=='B' OR $myrow['mbflag']=='D') { echo '<tr> <td>' . _('Standard Cost') .':</td> - <td class="number"><input type="text" class="number" name="MaterialCost" value=' . $myrow['materialcost'] . '></td> + <td class="number"><input type="text" class="number" name="MaterialCost" value="' . locale_number_format($myrow['materialcost'],4) . '" /></td> </tr>'; } else { echo '<input type="hidden" name="LabourCost" value=0>'; echo '<input type="hidden" name="OverheadCost" value=0>'; } - echo '</table><br /><div class="centre"><input type="submit" name="UpdateData" value="' . _('Update') . '"><br /><br />'; + echo '</table> + <br /> + <div class="centre"> + <input type="submit" name="UpdateData" value="' . _('Update') . '" /> + <br /> + <br />'; } if ($myrow['mbflag']!='D'){ echo '<div class="centre"><a href="' . $rootpath . '/StockStatus.php?StockID=' . $StockID . '>' . _('Show Stock Status') . '</a>'; @@ -187,6 +192,7 @@ echo '<br /><a href="' . $rootpath . '/SelectSalesOrder.php?SelectedStockItem=' . $StockID . '">' . _('Search Outstanding Sales Orders') . '</a>'; echo '<br /><a href="' . $rootpath . '/SelectCompletedOrder.php?SelectedStockItem=' . $StockID . '">' . _('Search Completed Sales Orders') . '</a></div>'; } -echo '</form></div>'; +echo '</form> + </div>'; include('includes/footer.inc'); ?> \ No newline at end of file Modified: trunk/StockDispatch.php =================================================================== --- trunk/StockDispatch.php 2011-10-11 09:10:13 UTC (rev 4718) +++ trunk/StockDispatch.php 2011-10-14 06:08:10 UTC (rev 4719) @@ -10,7 +10,7 @@ If (isset($_POST['PrintPDF'])) { include('includes/PDFStarter.php'); - if (!is_numeric($_POST['Percent'])) { + if (!is_numeric(filter_number_format($_POST['Percent']))) { $_POST['Percent'] = 0; } @@ -63,7 +63,7 @@ stockmaster.serialised, stockmaster.controlled, ROUND((locstock.reorderlevel - locstock.quantity) * - (1 + (" . $_POST['Percent'] . "/100))) + (1 + (" . filter_number_format($_POST['Percent']) . "/100))) as neededqty, (fromlocstock.quantity - fromlocstock.reorderlevel) as available, fromlocstock.reorderlevel as fromreorderlevel, @@ -89,9 +89,10 @@ $title = _('Stock Dispatch - Problem Report'); include('includes/header.inc'); prnMsg( _('The Stock Dispatch report 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>'; + echo '<br /> + <a href="' .$rootpath . '/index.php">' . _('Back to the menu') . '</a>'; if ($debug==1){ - echo "<br />$sql"; + echo '<br />' . $sql; } include('includes/footer.inc'); exit; @@ -101,7 +102,8 @@ include('includes/header.inc'); echo '<br />'; prnMsg( _('The stock dispatch did not have any items to list'),'warn'); - echo "<br /><a href='" .$rootpath .'/index.php?' . SID . "'>" . _('Back to the menu') . '</a>'; + echo '<br /> + <a href="' .$rootpath .'/index.php">' . _('Back to the menu') . '</a>'; include('includes/footer.inc'); exit; } @@ -226,7 +228,9 @@ $result = DB_query($sql, $db); $myrow = DB_fetch_array($result); $DefaultLocation = $myrow['defaultlocation']; - echo '<br/><form action=' . $_SERVER['PHP_SELF'] . " method='post'><table class=selection>"; + echo '<br/> + <form action="' . $_SERVER['PHP_SELF'] . '" method="post"> + <table class="selection">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; $sql = "SELECT loccode, locationname @@ -235,8 +239,14 @@ if (!isset($_POST['FromLocation'])) { $_POST['FromLocation']=$DefaultLocation; } - echo '<table class=selection><tr><td>' . _('Dispatch Percent') . ':</td><td><input type ="text" name="Percent" class="number" size="8" value=0>'; - echo '<tr><td>' . _('From Stock Location') . ':</td><td><select name="FromLocation"> '; + echo '<table class="selection"> + <tr> + <td>' . _('Dispatch Percent') . ':</td> + <td><input type ="text" name="Percent" class="number" size="8" value="0" /> + </tr>'; + echo '<tr> + <td>' . _('From Stock Location') . ':</td> + <td><select name="FromLocation"> '; while ($myrow=DB_fetch_array($resultStkLocs)){ if ($myrow['loccode'] == $_POST['FromLocation']){ echo '<option selected Value="' . $myrow['loccode'] . '">' . $myrow['locationname'] . '</option>'; @@ -244,22 +254,26 @@ echo '<option Value="' . $myrow['loccode'] . '">' . $myrow['locationname'] . '</option>'; } } - echo '</select></td></tr>'; + echo '</select></td> + </tr>'; DB_data_seek($resultStkLocs,0); if (!isset($_POST['ToLocation'])) { $_POST['ToLocation']=$DefaultLocation; } - echo '<tr><td>' . _('To Stock Location') . ':</td><td><select name="ToLocation"> '; + echo '<tr> + <td>' . _('To Stock Location') . ':</td> + <td><select name="ToLocation"> '; while ($myrow=DB_fetch_array($resultStkLocs)){ if ($myrow['loccode'] == $_POST['ToLocation']){ - echo '<option selected Value="' . $myrow['loccode'] . '">' . $myrow['locationname'] . '</option>'; + echo '<option selected value="' . $myrow['loccode'] . '">' . $myrow['locationname'] . '</option>'; } else { - echo '<option Value="' . $myrow['loccode'] . '">' . $myrow['locationname'] . '</option>'; + echo '<option value="' . $myrow['loccode'] . '">' . $myrow['locationname'] . '</option>'; } } - echo '</select></td></tr>'; + 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> @@ -274,7 +288,9 @@ // Define StockCat with 'name="StockCat[ ]" multiple' so can select more than one // Also have to change way define $WhereCategory for WHERE clause - echo '<tr><td>' . _('In Stock Category') . ':</td><td><select name="StockCat">'; + echo '<tr> + <td>' . _('In Stock Category') . ':</td> + <td><select name="StockCat">'; if (!isset($_POST['StockCat'])){ $_POST['StockCat']='All'; } @@ -305,14 +321,17 @@ echo '<option value="simple">' . _('Simple') . '</option>'; echo '</select></td><td> </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'); } /*end of else not PrintPDF */ - function PrintHeader(&$pdf,&$YPos,&$PageNumber,$Page_Height,$Top_Margin,$Left_Margin, $Page_Width,$Right_Margin,$Trf_ID,$FromLocation,$ToLocation,$template) { Modified: trunk/StockLocMovements.php =================================================================== --- trunk/StockLocMovements.php 2011-10-11 09:10:13 UTC (rev 4718) +++ trunk/StockLocMovements.php 2011-10-14 06:08:10 UTC (rev 4719) @@ -7,29 +7,30 @@ include('includes/header.inc'); -echo '<form action="' . $_SERVER['PHP_SELF'] . '" method=post>'; +echo '<form action="' . $_SERVER['PHP_SELF'] . '" method="post">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; echo '<p class="page_title_text"><img src="' . $rootpath . '/css/' . $theme . '/images/magnifier.png" title="' . _('Search') . '" alt="" />' . ' ' . $title.'</p>'; -echo '<table class=selection><tr><td>'; -echo ' ' . _('From Stock Location') . ':<select name="StockLocation"> '; +echo '<table class="selection"> + <tr> + <td> ' . _('From Stock Location') . ':<select name="StockLocation"> '; $sql = "SELECT loccode, locationname FROM locations"; $resultStkLocs = DB_query($sql,$db); while ($myrow=DB_fetch_array($resultStkLocs)){ if (isset($_POST['StockLocation']) AND $_POST['StockLocation']!='All'){ if ($myrow['loccode'] == $_POST['StockLocation']){ - echo '<option selected Value="' . $myrow['loccode'] . '">' . $myrow['locationname'] . '</option>'; + echo '<option selected value="' . $myrow['loccode'] . '">' . $myrow['locationname'] . '</option>'; } else { - echo '<option Value="' . $myrow['loccode'] . '">' . $myrow['locationname'] . '</option>'; + echo '<option value="' . $myrow['loccode'] . '">' . $myrow['locationname'] . '</option>'; } } elseif ($myrow['loccode']==$_SESSION['UserStockLocation']){ - echo '<option selected Value="' . $myrow['loccode'] . '">' . $myrow['locationname'] . '</option>'; + echo '<option selected value="' . $myrow['loccode'] . '">' . $myrow['locationname'] . '</option>'; $_POST['StockLocation']=$myrow['loccode']; } else { - echo '<option Value="' . $myrow['loccode'] . '">' . $myrow['locationname'] . '</option>'; + echo '<option value="' . $myrow['loccode'] . '">' . $myrow['locationname'] . '</option>'; } } @@ -41,53 +42,59 @@ if (!isset($_POST['AfterDate']) OR !Is_Date($_POST['AfterDate'])){ $_POST['AfterDate'] = Date($_SESSION['DefaultDateFormat'], Mktime(0,0,0,Date('m')-1,Date('d'),Date('y'))); } -echo ' ' . _('Show Movements before') . ': <input type="text" name="BeforeDate" size=12 maxlength=12 Value="' . $_POST['BeforeDate'] . '">'; -echo ' ' . _('But after') . ': <input type=TEXT name="AfterDate" size=12 maxlength=12 Value="' . $_POST['AfterDate'] . '">'; -echo '</td></tr></table><br />'; -echo '<div class=centre><input type=submit name="ShowMoves" VALUE="' . _('Show Stock Movements') . '"></div><br />'; +echo ' ' . _('Show Movements before') . ': <input type="text" name="BeforeDate" size="12" maxlength="12" value="' . $_POST['BeforeDate'] . '" />'; +echo ' ' . _('But after') . ': <input type="text" name="AfterDate" size="12" maxlength="12" value="' . $_POST['AfterDate'] . '" />'; +echo '</td> + </tr> + </table> + <br />'; +echo '<div class="centre"> + <input type="submit" name="ShowMoves" value="' . _('Show Stock Movements') . '" /> + </div> + <br />'; $SQLBeforeDate = FormatDateForSQL($_POST['BeforeDate']); $SQLAfterDate = FormatDateForSQL($_POST['AfterDate']); $sql = "SELECT stockmoves.stockid, - systypes.typename, - stockmoves.type, - stockmoves.transno, - stockmoves.trandate, - stockmoves.debtorno, - stockmoves.branchcode, - stockmoves.qty, - stockmoves.reference, - stockmoves.price, - stockmoves.discountpercent, - stockmoves.newqoh, - stockmaster.decimalplaces - FROM stockmoves - INNER JOIN systypes ON stockmoves.type=systypes.typeid - INNER JOIN stockmaster ON stockmoves.stockid=stockmaster.stockid - WHERE stockmoves.loccode='" . $_POST['StockLocation'] . "' - AND stockmoves.trandate >= '". $SQLAfterDate . "' - AND stockmoves.trandate <= '" . $SQLBeforeDate . "' - AND hidemovt=0 - ORDER BY stkmoveno DESC"; + systypes.typename, + stockmoves.type, + stockmoves.transno, + stockmoves.trandate, + stockmoves.debtorno, + stockmoves.branchcode, + stockmoves.qty, + stockmoves.reference, + stockmoves.price, + stockmoves.discountpercent, + stockmoves.newqoh, + stockmaster.decimalplaces + FROM stockmoves + INNER JOIN systypes ON stockmoves.type=systypes.typeid + INNER JOIN stockmaster ON stockmoves.stockid=stockmaster.stockid + WHERE stockmoves.loccode='" . $_POST['StockLocation'] . "' + AND stockmoves.trandate >= '". $SQLAfterDate . "' + AND stockmoves.trandate <= '" . $SQLBeforeDate . "' + AND hidemovt=0 + ORDER BY stkmoveno DESC"; $ErrMsg = _('The stock movements for the selected criteria could not be retrieved because'); $MovtsResult = DB_query($sql, $db,$ErrMsg); echo '<table cellpadding=5 cellspacing="4 "class="selection">'; $tableheader = '<tr> - <th>' . _('Item Code') . '</th> - <th>' . _('Type') . '</th> - <th>' . _('Trans No') . '</th> - <th>' . _('Date') . '</th> - <th>' . _('Customer') . '</th> - <th>' . _('Quantity') . '</th> - <th>' . _('Reference') . '</th> - <th>' . _('Price') . '</th> - <th>' . _('Discount') . '</th> - <th>' . _('Quantity on Hand') . '</th> - </tr>'; + <th>' . _('Item Code') . '</th> + <th>' . _('Type') . '</th> + <th>' . _('Trans No') . '</th> + <th>' . _('Date') . '</th> + <th>' . _('Customer') . '</th> + <th>' . _('Quantity') . '</th> + <th>' . _('Reference') . '</th> + <th>' . _('Price') . '</th> + <th>' . _('Discount') . '</th> + <th>' . _('Quantity on Hand') . '</th> + </tr>'; echo $tableheader; $j = 1; @@ -111,11 +118,11 @@ <td>%s</td> <td>%s</td> <td>%s</td> - <td class=number>%s</td> + <td class="number">%s</td> <td>%s</td> - <td class=number>%s</td> - <td class=number>%s</td> - <td class=number>%s</td> + <td class="number">%s</td> + <td class="number">%s</td> + <td class="number">%s</td> </tr>', mb_strtoupper($myrow['stockid']), mb_strtoupper($myrow['stockid']), Modified: trunk/StockLocStatus.php =================================================================== --- trunk/StockLocStatus.php 2011-10-11 09:10:13 UTC (rev 4718) +++ trunk/StockLocStatus.php 2011-10-14 06:08:10 UTC (rev 4719) @@ -19,14 +19,16 @@ echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; $sql = "SELECT loccode, - locationname - FROM locations"; + locationname + FROM locations"; $resultStkLocs = DB_query($sql,$db); -echo '<p class="page_title_text"><img src="' . $rootpath . '/css/' . $theme . '/images/magnifier.png" title="' . _('Search') . - '" alt="" />' . ' ' . $title.'</p>'; +echo '<p class="page_title_text"> + <img src="' . $rootpath . '/css/' . $theme . '/images/magnifier.png" title="' . _('Search') . + '" alt="" />' . ' ' . $title.' + </p>'; -echo '<table class=selection> +echo '<table class="selection"> <tr><td>' . _('From Stock Location') . ':</td> <td><select name="StockLocation"> '; while ($myrow=DB_fetch_array($resultStkLocs)){ @@ -45,9 +47,9 @@ } echo '</select></td></tr>'; -$SQL="SELECT categoryid, - categorydescription - FROM stockcategory +$SQL="SELECT categoryid, + categorydescription + FROM stockcategory ORDER BY categorydescription"; $result1 = DB_query($SQL,$db); if (DB_num_rows($result1)==0){ @@ -84,22 +86,27 @@ $_POST['BelowReorderQuantity']='All'; } if ($_POST['BelowReorderQuantity']=='All'){ - echo '<option selected value="All">' . _('All') . '</option>'; - echo '<option value="Below">' . _('Only Items Below Re-order Quantity') . '</option>'; - echo '<option value="NotZero">' . _('Only items where stock is available') . '</option>'; + echo '<option selected value="All">' . _('All') . '</option> + <option value="Below">' . _('Only Items Below Re-order Quantity') . '</option> + <option value="NotZero">' . _('Only items where stock is available') . '</option>'; } else if ($_POST['BelowReorderQuantity']=='Below') { - echo '<option value="All">' . _('All') . '</option>'; - echo '<option selected value="Below">' . _('Only Items Below Re-order Quantity') . '</option>'; - echo '<option value="NotZero">' . _('Only items where stock is available') . '</option>'; + echo '<option value="All">' . _('All') . '</option> + <option selected value="Below">' . _('Only Items Below Re-order Quantity') . '</option> + <option value="NotZero">' . _('Only items where stock is available') . '</option>'; } else { - echo '<option value="All">' . _('All') . '</option>'; - echo '<option value="Below">' . _('Only Items Below Re-order Quantity') . '</option>'; - echo '<option selected value="NotZero">' . _('Only items where stock is available') . '</option>'; + echo '<option value="All">' . _('All') . '</option> + <option value="Below">' . _('Only Items Below Re-order Quantity') . '</option> + <option selected value="NotZero">' . _('Only items where stock is available') . '</option>'; } -echo '</td></tr></table>'; +echo '</td> + </tr> + </table>'; -echo '<br /><div class="centre"><input type=submit name="ShowStatus" value="' . _('Show Stock Status') . '"></div>'; +echo '<br /> + <div class="centre"> + <input type="submit" name="ShowStatus" value="' . _('Show Stock Status') . '" /> + </div>'; if (isset($_POST['ShowStatus'])){ @@ -142,21 +149,21 @@ ORDER BY locstock.stockid"; } - $ErrMsg = _('The stock held at each location cannot be retrieved because'); $DbgMsg = _('The SQL that failed was'); $LocStockResult = DB_query($sql, $db, $ErrMsg, $DbgMsg); - echo '<br /><table cellpadding=5 cellspacing=4 class="selection">'; + echo '<br /> + <table cellpadding="5" cellspacing="4" class="selection">'; $tableheader = '<tr> - <th>' . _('StockID') . '</th> - <th>' . _('Description') . '</th> - <th>' . _('Quantity On Hand') . '</th> - <th>' . _('Re-Order Level') . '</th> - <th>' . _('Demand') . '</th> - <th>' . _('Available') . '</th> - <th>' . _('On Order') . '</th> + <th>' . _('StockID') . '</th> + <th>' . _('Description') . '</th> + <th>' . _('Quantity On Hand') . '</th> + <th>' . _('Re-Order Level') . '</th> + <th>' . _('Demand') . '</th> + <th>' . _('Available') . '</th> + <th>' . _('On Order') . '</th> </tr>'; echo $tableheader; $j = 1; @@ -167,12 +174,11 @@ $StockID = $myrow['stockid']; $sql = "SELECT SUM(salesorderdetails.quantity-salesorderdetails.qtyinvoiced) AS dem - FROM salesorderdetails, - salesorders - WHERE salesorders.orderno = salesorderdetails.orderno - AND salesorders.fromstkloc='" . $myrow['loccode'] . "' - AND salesorderdetails.completed=0 - AND salesorderdetails.stkcode='" . $StockID . "'"; + FROM salesorderdetails INNER JOIN salesorders + ON salesorders.orderno = salesorderdetails.orderno + WHERE salesorders.fromstkloc='" . $myrow['loccode'] . "' + AND salesorderdetails.completed=0 + AND salesorderdetails.stkcode='" . $StockID . "'"; $ErrMsg = _('The demand for this product from') . ' ' . $myrow['loccode'] . ' ' . _('cannot be retrieved because'); $DemandResult = DB_query($sql,$db,$ErrMsg); @@ -185,17 +191,16 @@ } //Also need to add in the demand as a component of an assembly items if this items has any assembly parents. - $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'] . "' + $sql = "SELECT SUM((salesorderdetails.quantity-salesorderdetails.qtyinvoiced)*bom.quantity) AS dem + FROM salesorderdetails INNER JOIN salesorders + ON salesorders.orderno = salesorderdetails.orderno + INNER JOIN bom + ON salesorderdetails.stkcode=bom.parent + INNER JOIN stockmaster + ON stockmaster.stockid=bom.parent + WHERE salesorders.fromstkloc='" . $myrow['loccode'] . "' AND salesorderdetails.quantity-salesorderdetails.qtyinvoiced > 0 AND bom.component='" . $StockID . "' - AND stockmaster.stockid=bom.parent AND stockmaster.mbflag='A'"; $ErrMsg = _('The demand for this product from') . ' ' . $myrow['loccode'] . ' ' . _('cannot be retrieved because'); @@ -206,10 +211,11 @@ $DemandQty += $DemandRow[0]; } $sql = "SELECT SUM((woitems.qtyreqd-woitems.qtyrecd)*bom.quantity) AS dem - FROM workorders, woitems, bom - WHERE woitems.wo = workorders.wo - AND woitems.stockid = bom.parent - AND workorders.closed=0 + FROM workorders INNER JOIN woitems + ON woitems.wo = workorders.wo + INNER JOIN bom + ON woitems.stockid = bom.parent + WHERE workorders.closed=0 AND bom.component = '". $StockID . "' AND workorders.loccode='". $myrow['loccode'] ."'"; $DemandResult = DB_query($sql,$db, $ErrMsg); @@ -253,23 +259,23 @@ $k=1; } printf('<td><a target="_blank" href="' . $rootpath . '/StockStatus.php?StockID=%s">%s</a></td> - <td>%s</td> - <td class=number>%s</td> - <td class=number>%s</td> - <td class=number>%s</td> - <td class=number><a target="_blank" href="' . $rootpath . 'SelectProduct.php?StockID=%s">%s</a></td> - <td class=number>%s</td> - </tr>', - mb_strtoupper($myrow['stockid']), - mb_strtoupper($myrow['stockid']), - $myrow['description'], - locale_number_format($myrow['quantity'],$myrow['decimalplaces']), - locale_number_format($myrow['reorderlevel'],$myrow['decimalplaces']), - locale_number_format($DemandQty,$myrow['decimalplaces']), - mb_strtoupper($myrow['stockid']), - locale_number_format($myrow['quantity'] - $DemandQty,$myrow['decimalplaces']), - locale_number_format($QOO,$myrow['decimalplaces'])); - + <td>%s</td> + <td class="number">%s</td> + <td class="number">%s</td> + <td class="number">%s</td> + <td class="number"><a target="_blank" href="' . $rootpath . 'SelectProduct.php?StockID=%s">%s</a></td> + <td class="number">%s</td> + </tr>', + mb_strtoupper($myrow['stockid']), + mb_strtoupper($myrow['stockid']), + $myrow['description'], + locale_number_format($myrow['quantity'],$myrow['decimalplaces']), + locale_number_format($myrow['reorderlevel'],$myrow['decimalplaces']), + locale_number_format($DemandQty,$myrow['decimalplaces']), + mb_strtoupper($myrow['stockid']), + locale_number_format($myrow['quantity'] - $DemandQty,$myrow['decimalplaces']), + locale_number_format($QOO,$myrow['decimalplaces'])); + if ($myrow['serialised'] ==1){ /*The line is a serialised item*/ echo '<td><a target="_blank" href="' . $rootpath . '/StockSerialItems.php?Serialised=Yes&Location=' . $myrow['loccode'] . '&StockID=' . $StockID . '">' . _('Serial Numbers') . '</a></td></tr>'; @@ -285,31 +291,28 @@ $k=1; } printf('<td><a target="_blank" href="' . $rootpath . '/StockStatus.php?StockID=%s">%s</a></td> - <td>%s</td> - <td class=number>%s</td> - <td class=number>%s</td> - <td class=number>%s</td> - <td class=number><a target="_blank" href="' . $rootpath . 'SelectProduct.php?StockID=%s">%s</a></td> - <td class=number>%s</td>', - mb_strtoupper($myrow['stockid']), - mb_strtoupper($myrow['stockid']), - $myrow['description'], - locale_number_format($myrow['quantity'],$myrow['decimalplaces']), - locale_number_format($myrow['reorderlevel'],$myrow['decimalplaces']), - locale_number_format($DemandQty,$myrow['decimalplaces']), - mb_strtoupper($myrow['stockid']), - locale_number_format($myrow['quantity'] - $DemandQty,$myrow['decimalplaces']), - locale_number_format($QOO,$myrow['decimalplaces'])); + <td>%s</td> + <td class="number">%s</td> + <td class="number">%s</td> + <td class="number">%s</td> + <td class="number"><a target="_blank" href="' . $rootpath . 'SelectProduct.php?StockID=%s">%s</a></td> + <td class="number">%s</td>', + mb_strtoupper($myrow['stockid']), + mb_strtoupper($myrow['stockid']), + $myrow['description'], + locale_number_format($myrow['quantity'],$myrow['decimalplaces']), + locale_number_format($myrow['reorderlevel'],$myrow['decimalplaces']), + locale_number_format($DemandQty,$myrow['decimalplaces']), + mb_strtoupper($myrow['stockid']), + locale_number_format($myrow['quantity'] - $DemandQty,$myrow['decimalplaces']), + locale_number_format($QOO,$myrow['decimalplaces'])); if ($myrow['serialised'] ==1){ /*The line is a serialised item*/ - echo '<td><a target="_blank" href="' . $rootpath . '/StockSerialItems.php?' . SID . '&Serialised=Yes&Location=' . $myrow['loccode'] . '&StockID=' . $StockID . '">' . _('Serial Numbers') . '</a></td></tr>'; + echo '<td><a target="_blank" href="' . $rootpath . '/StockSerialItems.php?Serialised=Yes&Location=' . $myrow['loccode'] . '&StockID=' . $StockID . '">' . _('Serial Numbers') . '</a></td></tr>'; } elseif ($myrow['controlled']==1){ - echo '<td><a target="_blank" href="' . $rootpath . '/StockSerialItems.php?' . SID . '&Location=' . $myrow['loccode'] . '&StockID=' . $StockID . '">' . _('Batches') . '</a></td></tr>'; + echo '<td><a target="_blank" href="' . $rootpath . '/StockSerialItems.php?Location=' . $myrow['loccode'] . '&StockID=' . $StockID . '">' . _('Batches') . '</a></td></tr>'; } - } - - - //end of page full new headings if + } //end of page full new headings if } //end of if BelowOrderQuantity or all items } //end of while loop Modified: trunk/reportwriter/WriteForm.inc =================================================================== --- trunk/reportwriter/WriteForm.inc 2011-10-11 09:10:13 UTC (rev 4718) +++ trunk/reportwriter/WriteForm.inc 2011-10-14 06:08:10 UTC (rev 4719) @@ -289,9 +289,9 @@ case "uc": return mb_strtoupper($strData); case "lc": return strtolower($strData); case "neg": return -$strData; - case "rnd2d": return locale_number_format($strData, 2); - case "dlr": return '$ '.locale_number_format($strData, 2); - case "euro": return chr(128).' '.locale_number_format($strData, 2); // assumes standard FPDF fonts + case "rnd2d": return locale_number_format($strData, $_SESSION['CompanyRecord']['decimalplaces']); + case "dlr": return '$ '.locale_number_format($strData, $_SESSION['CompanyRecord']['decimalplaces']); + case "euro": return chr(128).' '.locale_number_format($strData, $_SESSION['CompanyRecord']['decimalplaces']); // assumes standard FPDF fonts default: return $strData; // do nothing if Process not recognized } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |