From: <dai...@us...> - 2011-10-16 00:17:36
|
Revision: 4721 http://web-erp.svn.sourceforge.net/web-erp/?rev=4721&view=rev Author: daintree Date: 2011-10-16 00:17:27 +0000 (Sun, 16 Oct 2011) Log Message: ----------- number_formats Modified Paths: -------------- trunk/StockLocTransfer.php trunk/StockLocTransferReceive.php trunk/StockMovements.php trunk/StockQuantityByDate.php trunk/StockReorderLevel.php trunk/StockSerialItemResearch.php trunk/StockSerialItems.php trunk/StockStatus.php trunk/StockTransferControlled.php trunk/StockTransfers.php trunk/StockUsage.php trunk/StockUsageGraph.php trunk/Stocks.php trunk/SuppContractChgs.php trunk/SuppCreditGRNs.php trunk/SuppFixedAssetChgs.php trunk/SuppInvGRNs.php trunk/SuppLoginSetup.php trunk/SuppPaymentRun.php trunk/SuppPriceList.php trunk/SuppShiptChgs.php trunk/SuppTransGLAnalysis.php trunk/SupplierCredit.php trunk/WWW_Users.php trunk/doc/Change.log trunk/includes/LanguagesArray.php trunk/includes/OutputSerialItems.php trunk/includes/phplot/ChangeLog trunk/includes/phplot/NEWS.txt trunk/includes/phplot/README.txt trunk/includes/phplot/contrib/color_range.example.php trunk/includes/phplot/contrib/color_range.php trunk/includes/phplot/contrib/color_range.test1.php trunk/includes/phplot/contrib/color_range.test2.php trunk/includes/phplot/contrib/prune_labels.example.php trunk/includes/phplot/contrib/prune_labels.php trunk/includes/phplot/contrib/prune_labels.test.php trunk/includes/phplot/phplot.php trunk/includes/phplot/rgb.inc.php trunk/index.php Modified: trunk/StockLocTransfer.php =================================================================== --- trunk/StockLocTransfer.php 2011-10-14 06:11:13 UTC (rev 4720) +++ trunk/StockLocTransfer.php 2011-10-16 00:17:27 UTC (rev 4721) @@ -25,7 +25,7 @@ } $ErrorMessage=''; for ($i=$_POST['LinesCounter']-10;$i<$_POST['LinesCounter'];$i++){ - if (isset($_POST['StockID' . $i]) and $_POST['StockID' . $i]!=''){ + if (isset($_POST['StockID' . $i]) AND $_POST['StockID' . $i]!=''){ $_POST['StockID' . $i]=trim(mb_strtoupper($_POST['StockID' . $i])); $result = DB_query("SELECT COUNT(stockid) FROM stockmaster WHERE stockid='" . $_POST['StockID' . $i] . "'",$db); $myrow = DB_fetch_row($result); @@ -35,12 +35,12 @@ $_POST['LinesCounter'] -= 10; } DB_free_result( $result ); - if (!is_numeric($_POST['StockQTY' . $i])){ + if (!is_numeric(filter_number_format($_POST['StockQTY' . $i]))){ $InputError = True; $ErrorMessage .= _('The quantity entered of'). ' ' . $_POST['StockQTY' . $i] . ' '. _('for part code'). ' ' . $_POST['StockID' . $i] . ' '. _('is not numeric') . '. ' . _('The quantity entered for transfers is expected to be numeric').'<br />'; $_POST['LinesCounter'] -= 10; } - if ($_POST['StockQTY' . $i] <= 0){ + if (filter_number_format($_POST['StockQTY' . $i]) <= 0){ $InputError = True; $ErrorMessage .= _('The quantity entered for').' '. $_POST['StockID' . $i] . ' ' . _('is less than or equal to 0') . '. ' . _('Please correct this or remove the item').'<br />'; $_POST['LinesCounter'] -= 10; @@ -53,7 +53,7 @@ $db); $myrow = DB_fetch_row($result); - if ($myrow[0] < $_POST['StockQTY' . $i]){ + if ($myrow[0] < filter_number_format($_POST['StockQTY' . $i])){ $InputError = True; $ErrorMessage .= _('The part code entered of'). ' ' . $_POST['StockID' . $i] . ' '. _('does not have enough stock available for transfer.') . '.<br />'; $_POST['LinesCounter'] -= 10; @@ -94,7 +94,7 @@ recloc) VALUES ('" . $_POST['Trf_ID'] . "', '" . $_POST['StockID' . $i] . "', - '" . round($_POST['StockQTY' . $i], $DecimalRow['decimalplaces']) . "', + '" . round(filter_number_format($_POST['StockQTY' . $i]), $DecimalRow['decimalplaces']) . "', '" . Date('Y-m-d') . "', '" . $_POST['FromStockLocation'] ."', '" . $_POST['ToStockLocation'] . "')"; @@ -136,8 +136,9 @@ echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; echo '<table class="selection">'; - echo '<tr><th colspan=4><input type=hidden name="Trf_ID" value="' . $Trf_ID . '"><font size=3 color=blue>'. - _('Inventory Location Transfer Shipment Reference').' # '. $Trf_ID. '</font></th></tr>'; + echo '<tr> + <th colspan="4"><input type="hidden" name="Trf_ID" value="' . $Trf_ID . '" /><font size="3" color="blue">'. _('Inventory Location Transfer Shipment Reference').' # '. $Trf_ID. '</font></th> + </tr>'; $sql = "SELECT loccode, locationname FROM locations"; $resultStkLocs = DB_query($sql,$db); @@ -197,8 +198,8 @@ $k++; echo '<tr> - <td><input type="text" name="StockID' . $i .'" size="21" maxlength="20" value="' . $_POST['StockID' . $i] . '"></td> - <td><input type="text" name="StockQTY' . $i .'" size="10" maxlength="10" class="number" value="' . $_POST['StockQTY' . $i] . '"></td> + <td><input type="text" name="StockID' . $i .'" size="21" maxlength="20" value="' . $_POST['StockID' . $i] . '" /></td> + <td><input type="text" name="StockQTY' . $i .'" size="10" maxlength="10" class="number" value="' . locale_number_format($_POST['StockQTY' . $i],'Variable') . '" /></td> </tr>'; } }else { @@ -215,20 +216,24 @@ $_POST['StockQTY' . $i]=0; } echo '<tr> - <td><input type="text" name="StockID' . $i .'" size=21 maxlength=20 value="' . $_POST['StockID' . $i] . '"></td> - <td><input type="text" name="StockQTY' . $i .'" size=10 maxlength=10 class="number" value="' . $_POST['StockQTY' . $i] . '"></td> + <td><input type="text" name="StockID' . $i .'" size="21" maxlength="20" value="' . $_POST['StockID' . $i] . '" /></td> + <td><input type="text" name="StockQTY' . $i .'" size="10" maxlength="10" class="number" value="' . locale_number_format($_POST['StockQTY' . $i]) . '" /></td> </tr>'; $i++; } - echo '</table><br /><div class="centre"> - <input type="hidden" name="LinesCounter" value='. $i .'> - <input type=submit name="EnterMoreItems" value="'. _('Add More Items'). '"> - <input type="submit" name="Submit" value="'. _('Create Transfer Shipment'). '"><br />'; + echo '</table> + <br /> + <div class="centre"> + <input type="hidden" name="LinesCounter" value="'. $i .'" /> + <input type=submit name="EnterMoreItems" value="'. _('Add More Items'). '" /> + <input type="submit" name="Submit" value="'. _('Create Transfer Shipment'). '" /> + <br />'; echo '<script type="text/javascript">defaultControl(document.forms[0].StockID0);</script>'; - echo '</form></div>'; + echo '</form> + </div>'; include('includes/footer.inc'); } ?> \ No newline at end of file Modified: trunk/StockLocTransferReceive.php =================================================================== --- trunk/StockLocTransferReceive.php 2011-10-14 06:11:13 UTC (rev 4720) +++ trunk/StockLocTransferReceive.php 2011-10-16 00:17:27 UTC (rev 4721) @@ -29,7 +29,7 @@ foreach ($_SESSION['Transfer']->TransferItem AS $TrfLine) { if (is_numeric(filter_number_format($_POST['Qty' . $i]))){ /*Update the quantity received from the inputs */ - $_SESSION['Transfer']->TransferItem[$i]->Quantity= filter_number_format($_POST['Qty' . $i]); + $_SESSION['Transfer']->TransferItem[$i]->Quantity= round(filter_number_format($_POST['Qty' . $i]),$_SESSION['Transfer']->TransferItem[$i]->DecimalPlaces); } else { prnMsg(_('The quantity entered for'). ' ' . $TrfLine->StockID . ' '. _('is not numeric') . '. ' . _('All quantities must be numeric'),'error'); $InputError = True; @@ -47,7 +47,7 @@ } else { $_SESSION['Transfer']->TransferItem[$i]->CancelBalance=0; } - $TotalQuantity += filter_number_format($TrfLine->Quantity); + $TotalQuantity += $TrfLine->Quantity; $i++; } /*end loop to validate and update the SESSION['Transfer'] data */ if ($TotalQuantity < 0){ @@ -95,8 +95,8 @@ '" . $SQLTransferDate . "', '" . $PeriodNo . "', '" . _('To') . ' ' . $_SESSION['Transfer']->StockLocationToName . "', - '" . filter_number_format(round(-$TrfLine->Quantity, $TrfLine->DecimalPlaces)) . "', - '" . filter_number_format(round($QtyOnHandPrior - $TrfLine->Quantity, $TrfLine->DecimalPlaces)) . "' + '" . round(-$TrfLine->Quantity, $TrfLine->DecimalPlaces) . "', + '" . round($QtyOnHandPrior - $TrfLine->Quantity, $TrfLine->DecimalPlaces) . "' )"; $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The stock movement record cannot be inserted because'); @@ -127,7 +127,7 @@ if ($SerialItemExistsRow[0]==1){ $SQL = "UPDATE stockserialitems SET - quantity= quantity - " . filter_number_format($Item->BundleQty) . " + quantity= quantity - " . $Item->BundleQty . " WHERE stockid='" . $TrfLine->StockID . "' AND loccode='" . $_SESSION['Transfer']->StockLocationFrom . "' @@ -145,7 +145,7 @@ VALUES ('" . $TrfLine->StockID . "', '" . $_SESSION['Transfer']->StockLocationFrom . "', '" . DB_escape_string($Item->BundleRef) . "', - '" . -filter_number_format($Item->BundleQty) . "')"; + '" . -$Item->BundleQty . "')"; $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The serial stock item for the stock being transferred out of the existing location could not be inserted because'); $DbgMsg = _('The following SQL to update the serial stock item record was used'); @@ -164,7 +164,7 @@ '" . $StkMoveNo . "', '" . $TrfLine->StockID . "', '" . DB_escape_string($Item->BundleRef) . "', - '" . -filter_number_format($Item->BundleQty) . "' + '" . -$Item->BundleQty . "' )"; $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The serial stock movement record could not be inserted because'); $DbgMsg = _('The following SQL to insert the serial stock movement records was used'); @@ -207,8 +207,8 @@ '" . $SQLTransferDate . "', '" . $PeriodNo . "', '" . _('From') . ' ' . $_SESSION['Transfer']->StockLocationFromName ."', - '" . filter_number_format(round($TrfLine->Quantity, $TrfLine->DecimalPlaces)) . "', - '" . filter_number_format(round($QtyOnHandPrior + $TrfLine->Quantity, $TrfLine->DecimalPlaces)) . "' + '" . round($TrfLine->Quantity, $TrfLine->DecimalPlaces) . "', + '" . round($QtyOnHandPrior + $TrfLine->Quantity, $TrfLine->DecimalPlaces) . "' )"; $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The stock movement record for the incoming stock cannot be added because'); @@ -241,7 +241,7 @@ if ($SerialItemExistsRow[0]==1){ $SQL = "UPDATE stockserialitems SET - quantity= quantity + '" . filter_number_format($Item->BundleQty) . "' + quantity= quantity + '" . $Item->BundleQty . "' WHERE stockid='" . $TrfLine->StockID . "' AND loccode='" . $_SESSION['Transfer']->StockLocationTo . "' @@ -259,7 +259,7 @@ VALUES ('" . $TrfLine->StockID . "', '" . $_SESSION['Transfer']->StockLocationTo . "', '" . DB_escape_string($Item->BundleRef) . "', - '" . filter_number_format($Item->BundleQty) . "')"; + '" . $Item->BundleQty . "')"; $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The serial stock item record for the stock coming in could not be added because'); $DbgMsg = _('The following SQL to update the serial stock item record was used'); @@ -277,7 +277,7 @@ VALUES (" . $StkMoveNo . ", '" . $TrfLine->StockID . "', '" . DB_escape_string($Item->BundleRef) . "', - '" . filter_number_format($Item->BundleQty) . "')"; + '" . $Item->BundleQty . "')"; $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The serial stock movement record could not be inserted because'); $DbgMsg = _('The following SQL to insert the serial stock movement records was used'); $Result = DB_query($SQL, $db, $ErrMsg, $DbgMsg, true); @@ -286,7 +286,7 @@ } /*end if the transfer item is a controlled item */ $SQL = "UPDATE locstock - SET quantity = quantity - '" . filter_number_format(round($TrfLine->Quantity, $TrfLine->DecimalPlaces)) . "' + SET quantity = quantity - '" . round($TrfLine->Quantity, $TrfLine->DecimalPlaces) . "' WHERE stockid='" . $TrfLine->StockID . "' AND loccode='" . $_SESSION['Transfer']->StockLocationFrom . "'"; @@ -295,7 +295,7 @@ $Result = DB_query($SQL, $db, $ErrMsg, $DbgMsg, true); $SQL = "UPDATE locstock - SET quantity = quantity + '" . filter_number_format(round($TrfLine->Quantity, $TrfLine->DecimalPlaces)) . "' + SET quantity = quantity + '" . round($TrfLine->Quantity, $TrfLine->DecimalPlaces) . "' WHERE stockid='" . $TrfLine->StockID . "' AND loccode='" . $_SESSION['Transfer']->StockLocationTo . "'"; @@ -306,13 +306,13 @@ prnMsg(_('A stock transfer for item code'). ' - ' . $TrfLine->StockID . ' ' . $TrfLine->ItemDescription . ' '. _('has been created from').' ' . $_SESSION['Transfer']->StockLocationFromName . ' '. _('to'). ' ' . $_SESSION['Transfer']->StockLocationToName . ' ' . _('for a quantity of'). ' '. $TrfLine->Quantity,'success'); if ($TrfLine->CancelBalance==1){ - $sql = "UPDATE loctransfers SET recqty = recqty + '". filter_number_format(round($TrfLine->Quantity, $TrfLine->DecimalPlaces)) . "', - shipqty = recqty + '". filter_number_format(round($TrfLine->Quantity, $TrfLine->DecimalPlaces)) . "', + $sql = "UPDATE loctransfers SET recqty = recqty + '". round($TrfLine->Quantity, $TrfLine->DecimalPlaces) . "', + shipqty = recqty + '". round($TrfLine->Quantity, $TrfLine->DecimalPlaces) . "', recdate = '".date('Y-m-d H:i:s'). "' WHERE reference = '". $_SESSION['Transfer']->TrfID . "' AND stockid = '". $TrfLine->StockID."'"; } else { - $sql = "UPDATE loctransfers SET recqty = recqty + '". filter_number_format(round($TrfLine->Quantity, $TrfLine->DecimalPlaces)) . "', + $sql = "UPDATE loctransfers SET recqty = recqty + '". round($TrfLine->Quantity, $TrfLine->DecimalPlaces) . "', recdate = '".date('Y-m-d H:i:s'). "' WHERE reference = '". $_SESSION['Transfer']->TrfID . "' AND stockid = '". $TrfLine->StockID."'"; @@ -419,17 +419,19 @@ echo '<br /> <table class="selection">'; - echo '<tr><th colspan="7"><font size=3 color=blue>' . _('Location Transfer Reference'). ' #' . $_SESSION['Transfer']->TrfID . ' '. _('from').' ' . $_SESSION['Transfer']->StockLocationFromName . ' '. _('to'). ' ' . $_SESSION['Transfer']->StockLocationToName . '</font></th></tr>'; + echo '<tr> + <th colspan="7"><font size="3" color="blue">' . _('Location Transfer Reference'). ' #' . $_SESSION['Transfer']->TrfID . ' '. _('from').' ' . $_SESSION['Transfer']->StockLocationFromName . ' '. _('to'). ' ' . $_SESSION['Transfer']->StockLocationToName . '</font></th> + </tr>'; $tableheader = '<tr> - <th>'. _('Item Code') . '</th> - <th>'. _('Item Description'). '</th> - <th>'. _('Quantity Dispatched'). '</th> - <th>'. _('Quantity Received'). '</th> - <th>'. _('Quantity To Receive'). '</th> - <th>'. _('Units'). '</th> - <th>'. _('Cancel Balance') . '</th> - </tr>'; + <th>'. _('Item Code') . '</th> + <th>'. _('Item Description'). '</th> + <th>'. _('Quantity Dispatched'). '</th> + <th>'. _('Quantity Received'). '</th> + <th>'. _('Quantity To Receive'). '</th> + <th>'. _('Units'). '</th> + <th>'. _('Cancel Balance') . '</th> + </tr>'; echo $tableheader; $k=0; @@ -445,30 +447,33 @@ echo '<td>' . $TrfLine->StockID . '</td> <td>' . $TrfLine->ItemDescription . '</td>'; - echo '<td class=number>' . locale_number_format($TrfLine->ShipQty, $TrfLine->DecimalPlaces) . '</td>'; + echo '<td class="number">' . locale_number_format($TrfLine->ShipQty, $TrfLine->DecimalPlaces) . '</td>'; if (isset($_POST['Qty' . $i]) AND is_numeric(filter_number_format($_POST['Qty' . $i]))){ - $_SESSION['Transfer']->TransferItem[$i]->Quantity= filter_number_format($_POST['Qty' . $i]); - $Qty = filter_number_format($_POST['Qty' . $i]); + + $_SESSION['Transfer']->TransferItem[$i]->Quantity= round(filter_number_format($_POST['Qty' . $i]),$TrfLine->DecimalPlaces); + + $Qty = round(filter_number_format($_POST['Qty' . $i]),$TrfLine->DecimalPlaces); + } else if ($TrfLine->Controlled==1) { if (sizeOf($TrfLine->SerialItems)==0) { $Qty = 0; } else { - $Qty = filter_number_format($TrfLine->Quantity); + $Qty = $TrfLine->Quantity; } } else { - $Qty = filter_number_format($TrfLine->Quantity); + $Qty = $TrfLine->Quantity; } - echo '<td class=number>' . locale_number_format($TrfLine->PrevRecvQty, $TrfLine->DecimalPlaces) . '</td>'; + echo '<td class="number">' . locale_number_format($TrfLine->PrevRecvQty, $TrfLine->DecimalPlaces) . '</td>'; if ($TrfLine->Controlled==1){ - echo '<td class=number><input type=hidden name="Qty' . $i . '" value="' . $Qty . '"><a href="' . $rootpath .'/StockTransferControlled.php?TransferItem=' . $i . '">' . $Qty . '</a></td>'; + echo '<td class="number"><input type="hidden" name="Qty' . $i . '" value="' . locale_number_format($Qty,$TrfLine->DecimalPlaces) . '" /><a href="' . $rootpath .'/StockTransferControlled.php?TransferItem=' . $i . '">' . $Qty . '</a></td>'; } else { - echo '<td><input type="text" class="number" name="Qty' . $i . '" maxlength=10 class="number" size=auto value="' . $Qty . '"></td>'; + echo '<td><input type="text" class="number" name="Qty' . $i . '" maxlength="10" class="number" size="auto" value="' . locale_number_format($Qty,$TrfLine->DecimalPlaces) . '" /></td>'; } echo '<td>' . $TrfLine->PartUnit . '</td>'; - echo '<td><input type="checkbox" name="CancelBalance' . $i . '" value=1></td>'; + echo '<td><input type="checkbox" name="CancelBalance' . $i . '" value=1 /></td>'; if ($TrfLine->Controlled==1){ @@ -484,9 +489,13 @@ $i++; /* the array of TransferItem s is indexed numerically and i matches the index no */ } /*end of foreach TransferItem */ - echo '</table><br /> - <div class="centre"><input type="submit" name="ProcessTransfer" value="'. _('Process Inventory Transfer'). '"><br /> - </form></div>'; + echo '</table> + <br /> + <div class="centre"> + <input type="submit" name="ProcessTransfer" value="'. _('Process Inventory Transfer'). '"> + <br /> + </div> + </form>'; echo '<a href="'.$_SERVER['PHP_SELF']. '?NewTransfer=true">'. _('Select A Different Transfer').'</a>'; } else { /*Not $_SESSION['Transfer'] set */ @@ -498,20 +507,26 @@ $LocResult = DB_query("SELECT locationname, loccode FROM locations",$db); - echo '<table class=selection>'; - echo '<tr><td>'. _('Select Location Receiving Into'). ':</td><td>'; + echo '<table class="selection">'; + echo '<tr> + <td>'. _('Select Location Receiving Into'). ':</td> + <td>'; echo '<select name="RecLocation" onChange="ReloadForm(form1.RefreshTransferList)">'; if (!isset($_POST['RecLocation'])){ $_POST['RecLocation'] = $_SESSION['UserStockLocation']; } while ($myrow=DB_fetch_array($LocResult)){ if ($myrow['loccode'] == $_POST['RecLocation']){ - 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><input type=submit name="RefreshTransferList" value="' . _('Refresh Transfer List') . '"></td></tr></table><p>'; + echo '</select> + <input type="submit" name="RefreshTransferList" value="' . _('Refresh Transfer List') . '"></td> + </tr> + </table> + <p />'; $sql = "SELECT DISTINCT reference, locations.locationname as trffromloc, @@ -527,7 +542,7 @@ $LocResult = DB_query($LocSql,$db); $LocRow = DB_fetch_array($LocResult); echo '<table class="selection">'; - echo '<tr><th colspan="4"><font size="3" color=blue>'._('Pending Transfers Into').' '.$LocRow['locationname'].'</font></th></tr>'; + echo '<tr><th colspan="4"><font size="3" color="blue">'._('Pending Transfers Into').' '.$LocRow['locationname'].'</font></th></tr>'; echo '<tr> <th>'. _('Transfer Ref'). '</th> <th>'. _('Transfer From'). '</th> @@ -543,9 +558,10 @@ $k++; } echo '<td class="number">' . $myrow['reference'] . '</td> - <td>' . $myrow['trffromloc'] . '</td> - <td>' . ConvertSQLDate($myrow['shipdate']) . '</td> - <td><a href="' . $_SERVER['PHP_SELF'] . '?Trf_ID=' . $myrow['reference'] . '">'. _('Receive'). '</a></td></tr>'; + <td>' . $myrow['trffromloc'] . '</td> + <td>' . ConvertSQLDate($myrow['shipdate']) . '</td> + <td><a href="' . $_SERVER['PHP_SELF'] . '?Trf_ID=' . $myrow['reference'] . '">'. _('Receive'). '</a></td> + </tr>'; } echo '</table>'; } else if (!isset($_POST['ProcessTransfer'])) { Modified: trunk/StockMovements.php =================================================================== --- trunk/StockMovements.php 2011-10-14 06:11:13 UTC (rev 4720) +++ trunk/StockMovements.php 2011-10-16 00:17:27 UTC (rev 4721) @@ -27,8 +27,9 @@ if (!isset($_POST['AfterDate']) OR !Is_Date($_POST['AfterDate'])){ $_POST['AfterDate'] = Date($_SESSION['DefaultDateFormat'], Mktime(0,0,0,Date('m')-3,Date('d'),Date('y'))); } -echo '<br /><table cellpadding=2 class=selection>'; -echo '<tr><th colspan=10>' . _('Stock Code') . ':<input type="text" name="StockID" size=21 value="' . $StockID . '" maxlength=20>'; +echo '<br /> + <table class="selection">'; +echo '<tr><th colspan="10">' . _('Stock Code') . ':<input type="text" name="StockID" size=21 value="' . $StockID . '" maxlength="20" />'; echo ' ' . _('From Stock Location') . ':<select name="StockLocation"> '; @@ -50,36 +51,37 @@ } } -echo '</select></th></tr>'; -echo '<tr><th colspan=10>' . _('Show Movements before') . ': <input type="text" name="BeforeDate" class="date" alt="'.$_SESSION['DefaultDateFormat'].'" size="12" maxlength="12" VALUE="' . $_POST['BeforeDate'] . '">'; -echo ' ' . _('But after') . ': <input type="text" name="AfterDate" class="date" alt="'.$_SESSION['DefaultDateFormat'].'" size="12" maxlength="12" VALUE="' . $_POST['AfterDate'] . '">'; -echo ' <input type="submit" name="ShowMoves" value="' . _('Show Stock Movements') . '"></th></tr>'; +echo '</select></th> + </tr>'; +echo '<tr> + <th colspan="10">' . _('Show Movements before') . ': <input type="text" name="BeforeDate" class="date" alt="'.$_SESSION['DefaultDateFormat'].'" size="12" maxlength="12" value="' . $_POST['BeforeDate'] . '" /> ' . _('But after') . ': <input type="text" name="AfterDate" class="date" alt="'.$_SESSION['DefaultDateFormat'].'" size="12" maxlength="12" value="' . $_POST['AfterDate'] . '" /><input type="submit" name="ShowMoves" value="' . _('Show Stock Movements') . '" /></th> + </tr>'; $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.stockid = '" . $StockID . "' - 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.stockid = '" . $StockID . "' + AND stockmoves.trandate <= '" . $SQLBeforeDate . "' + AND hidemovt=0 + ORDER BY stkmoveno DESC"; $ErrMsg = _('The stock movements for the selected criteria could not be retrieved because') . ' - '; $DbgMsg = _('The SQL that failed was') . ' '; @@ -87,17 +89,17 @@ $MovtsResult = DB_query($sql, $db, $ErrMsg, $DbgMsg); $tableheader = '<tr> - <th>' . _('Type') . '</th> - <th>' . _('Number') . '</th> - <th>' . _('Date') . '</th> - <th>' . _('Customer') . '</th> - <th>' . _('Branch') . '</th> - <th>' . _('Quantity') . '</th> - <th>' . _('Reference') . '</th> - <th>' . _('Price') . '</th> - <th>' . _('Discount') . '</th> - <th>' . _('New Qty') . '</th> - </tr>'; + <th>' . _('Type') . '</th> + <th>' . _('Number') . '</th> + <th>' . _('Date') . '</th> + <th>' . _('Customer') . '</th> + <th>' . _('Branch') . '</th> + <th>' . _('Quantity') . '</th> + <th>' . _('Reference') . '</th> + <th>' . _('Price') . '</th> + <th>' . _('Discount') . '</th> + <th>' . _('New Qty') . '</th> + </tr>'; echo $tableheader; @@ -123,11 +125,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>', $rootpath, $myrow['transno'], @@ -136,10 +138,9 @@ $DisplayTranDate, $myrow['debtorno'], $myrow['branchcode'], - locale_number_format($myrow['qty'], - $myrow['decimalplaces']), + locale_number_format($myrow['qty'],$myrow['decimalplaces']), $myrow['reference'], - locale_number_format($myrow['price'],2), + locale_number_format($myrow['price'],$_SESSION['CompanyRecord']['decimalplaces']), locale_number_format($myrow['discountpercent']*100,2), locale_number_format($myrow['newqoh'],$myrow['decimalplaces'])); @@ -150,11 +151,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>', $rootpath, $myrow['transno'], @@ -171,26 +172,26 @@ } else { printf('<td>%s</td> - <td>%s</td> - <td>%s</td> - <td>%s</td> - <td>%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> - </tr>', - $myrow['typename'], - $myrow['transno'], - $DisplayTranDate, - $myrow['debtorno'], - $myrow['branchcode'], - locale_number_format($myrow['qty'],$myrow['decimalplaces']), - $myrow['reference'], - locale_number_format($myrow['price'],$_SESSION['CompanyRecord']['decimalplaces']), - locale_number_format($myrow['discountpercent']*100,2), - locale_number_format($myrow['newqoh'],$myrow['decimalplaces'])); + <td>%s</td> + <td>%s</td> + <td>%s</td> + <td>%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> + </tr>', + $myrow['typename'], + $myrow['transno'], + $DisplayTranDate, + $myrow['debtorno'], + $myrow['branchcode'], + locale_number_format($myrow['qty'],$myrow['decimalplaces']), + $myrow['reference'], + locale_number_format($myrow['price'],$_SESSION['CompanyRecord']['decimalplaces']), + locale_number_format($myrow['discountpercent']*100,2), + locale_number_format($myrow['newqoh'],$myrow['decimalplaces'])); } //end of page full new headings if } Modified: trunk/StockQuantityByDate.php =================================================================== --- trunk/StockQuantityByDate.php 2011-10-14 06:11:13 UTC (rev 4720) +++ trunk/StockQuantityByDate.php 2011-10-16 00:17:27 UTC (rev 4721) @@ -6,19 +6,22 @@ $title = _('Stock On Hand By Date'); include('includes/header.inc'); -echo '<p Class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/inventory.png" title="' . _('Inventory') . -'" alt="" /><b>' . $title. '</b></p>'; +echo '<p class="page_title_text"> + <img src="'.$rootpath.'/css/'.$theme.'/images/inventory.png" title="' . _('Inventory') . +'" alt="" /><b>' . $title. '</b> + </p>'; -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'] . '" />'; $sql = "SELECT categoryid, categorydescription FROM stockcategory"; $resultStkLocs = DB_query($sql, $db); -echo '<table class=selection><tr>'; -echo '<td>' . _('For Stock Category') . ':</td> - <td><select name="StockCategory"> '; -echo '<option value="All">' . _('All') . '</option>'; +echo '<table class="selection"> + <tr> + <td>' . _('For Stock Category') . ':</td> + <td><select name="StockCategory"> + <option value="All">' . _('All') . '</option>'; while ($myrow=DB_fetch_array($resultStkLocs)){ if (isset($_POST['StockCategory']) AND $_POST['StockCategory']!='All'){ @@ -60,9 +63,15 @@ } echo '<td>' . _('On-Hand On Date') . ':</td> - <td><input type="text" class="date" alt="' . $_SESSION['DefaultDateFormat'] . '" name="OnHandDate" size=12 maxlength=12 value="' . $_POST['OnHandDate'] . '"></td></tr>'; -echo '<tr><td colspan=6><div class="centre"><input type=submit name="ShowStatus" value="' . _('Show Stock Status') .'"></div></td></tr></table>'; -echo '</form>'; + <td><input type="text" class="date" alt="' . $_SESSION['DefaultDateFormat'] . '" name="OnHandDate" size="12" maxlength="12" value="' . $_POST['OnHandDate'] . '" /></td></tr>'; +echo '<tr> + <td colspan="6"> + <div class="centre"> + <input type=submit name="ShowStatus" value="' . _('Show Stock Status') .'" /> + </div></td> + </tr> + </table> + </form>'; $TotalQuantity = 0; @@ -89,12 +98,14 @@ $SQLOnHandDate = FormatDateForSQL($_POST['OnHandDate']); - echo '<br /><table cellpadding=5 cellspacing=1 class=selection>'; + echo '<br /> + <table class="selection">'; $tableheader = '<tr> - <th>' . _('Item Code') . '</th> - <th>' . _('Description') . '</th> - <th>' . _('Quantity On Hand') . '</th></tr>'; + <th>' . _('Item Code') . '</th> + <th>' . _('Description') . '</th> + <th>' . _('Quantity On Hand') . '</th> + </tr>'; echo $tableheader; while ($myrows=DB_fetch_array($StockResult)) { @@ -128,16 +139,16 @@ if($NumRows == 0){ printf('<td><a target="_blank" href="' . $rootpath . '/StockStatus.php?%s">%s</td> - <td>%s</td> - <td class="number">%s</td>', - 'StockID=' . mb_strtoupper($myrows['stockid']), - mb_strtoupper($myrows['stockid']), - $myrows['description'], - 0); + <td>%s</td> + <td class="number">%s</td>', + 'StockID=' . mb_strtoupper($myrows['stockid']), + mb_strtoupper($myrows['stockid']), + $myrows['description'], + 0); } else { printf('<td><a target="_blank" href="' . $rootpath . '/StockStatus.php?%s">%s</td> <td>%s</td> - <td class=number>%s</td>', + <td class="number">%s</td>', 'StockID=' . mb_strtoupper($myrows['stockid']), mb_strtoupper($myrows['stockid']), $myrows['description'], @@ -154,7 +165,9 @@ } }//end of while loop - echo '<tr><td>' . _('Total Quantity') . ': ' . $TotalQuantity . '</td></tr> + echo '<tr> + <td>' . _('Total Quantity') . ': ' . $TotalQuantity . '</td> + </tr> </table>'; } Modified: trunk/StockReorderLevel.php =================================================================== --- trunk/StockReorderLevel.php 2011-10-14 06:11:13 UTC (rev 4720) +++ trunk/StockReorderLevel.php 2011-10-16 00:17:27 UTC (rev 4721) @@ -14,8 +14,9 @@ echo '<a href="' . $rootpath . '/SelectProduct.php">' . _('Back to Items') . '</a>'; -echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/inventory.png" title="' . _('Inventory') . -'" alt="" /><b>' . $title. '</b></p>'; +echo '<p class="page_title_text"> + <img src="'.$rootpath.'/css/'.$theme.'/images/inventory.png" title="' . _('Inventory') . '" alt="" /><b>' . $title. '</b> + </p>'; $result = DB_query("SELECT description, units FROM stockmaster WHERE stockid='" . $StockID . "'", $db); $myrow = DB_fetch_row($result); @@ -24,32 +25,35 @@ echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; $sql = "SELECT locstock.loccode, - locations.locationname, - locstock.quantity, - locstock.reorderlevel, - stockmaster.decimalplaces - FROM locstock INNER JOIN locations - ON locstock.loccode=locations.loccode - INNER JOIN stockmaster - ON locstock.stockid=stockmaster.stockid - WHERE locstock.stockid = '" . $StockID . "' - ORDER BY locstock.loccode"; + locations.locationname, + locstock.quantity, + locstock.reorderlevel, + stockmaster.decimalplaces + FROM locstock INNER JOIN locations + ON locstock.loccode=locations.loccode + INNER JOIN stockmaster + ON locstock.stockid=stockmaster.stockid + WHERE locstock.stockid = '" . $StockID . "' + ORDER BY locstock.loccode"; $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 '<table cellpadding="2" class="selection">'; -echo '<tr><th colspan="3">' . _('Stock Code') . ':<input type="text" name="StockID" size="21" value="' . $StockID . '" maxlength="20">'; -echo '<input type="submit" name="Show" value="' . _('Show Re-Order Levels') . '"></th></tr>'; -echo '<tr><th colspan=3><font color=BLUE size=3><b>' . $StockID . ' - ' . $myrow[0] . '</b> (' . _('In Units of') . ' ' . $myrow[1] . ')</font></th></tr>'; +echo '<table class="selection">'; +echo '<tr> + <th colspan="3">' . _('Stock Code') . ':<input type="text" name="StockID" size="21" value="' . $StockID . '" maxlength="20" /><input type="submit" name="Show" value="' . _('Show Re-Order Levels') . '" /></th> + </tr>'; +echo '<tr> + <th colspan="3"><font color="blue" size="3"><b>' . $StockID . ' - ' . $myrow[0] . '</b> (' . _('In Units of') . ' ' . $myrow[1] . ')</font></th> + </tr>'; $TableHeader = '<tr> - <th>' . _('Location') . '</th> - <th>' . _('Quantity On Hand') . '</th> - <th>' . _('Re-Order Level') . '</th> - </tr>'; + <th>' . _('Location') . '</th> + <th>' . _('Quantity On Hand') . '</th> + <th>' . _('Re-Order Level') . '</th> + </tr>'; echo $TableHeader; $j = 1; @@ -65,10 +69,12 @@ $k=1; } - if (isset($_POST['UpdateData']) AND is_numeric($_POST[$myrow['loccode']]) AND $_POST[$myrow['loccode']]>=0){ + if (isset($_POST['UpdateData']) + AND is_numeric(filter_number_format($_POST[$myrow['loccode']])) + AND $_POST[$myrow['loccode']]>=0){ $myrow['reorderlevel'] = $_POST[$myrow['loccode']]; - $sql = "UPDATE locstock SET reorderlevel = '" . $_POST[$myrow['loccode']] . "' + $sql = "UPDATE locstock SET reorderlevel = '" . filter_number_format($_POST[$myrow['loccode']]) . "' WHERE stockid = '" . $StockID . "' AND loccode = '" . $myrow['loccode'] ."'"; $UpdateReorderLevel = DB_query($sql, $db); @@ -76,12 +82,12 @@ } printf('<td>%s</td> - <td class="number">%s</td> - <td><input type="text" class="number" name="%s" maxlength="10" size="10" value="%s" /></td>', - $myrow['locationname'], - locale_number_format($myrow['quantity'],$myrow['decimalplaces']), - $myrow['loccode'], - $myrow['reorderlevel']); + <td class="number">%s</td> + <td><input type="text" class="number" name="%s" maxlength="10" size="10" value="%s" /></td>', + $myrow['locationname'], + locale_number_format($myrow['quantity'],$myrow['decimalplaces']), + $myrow['loccode'], + $myrow['reorderlevel']); $j++; If ($j == 12){ $j=1; @@ -92,12 +98,18 @@ //end of while loop echo '</table> - <br /><div class="centre"><input type="submit" name="UpdateData" value="' . _('Update') . '" /><br /><br />'; + <br /> + <div class="centre"> + <input type="submit" name="UpdateData" value="' . _('Update') . '" /> + <br /> + <br />'; + echo '<a href="' . $rootpath . '/StockMovements.php?StockID=' . $StockID . '">' . _('Show Stock Movements') . '</a>'; echo '<br /><a href="' . $rootpath . '/StockUsage.php?StockID=' . $StockID . '">' . _('Show Stock Usage') . '</a>'; 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>'; -echo '</div></form>'; +echo '</div> + </form>'; include('includes/footer.inc'); ?> \ No newline at end of file Modified: trunk/StockSerialItemResearch.php =================================================================== --- trunk/StockSerialItemResearch.php 2011-10-14 06:11:13 UTC (rev 4720) +++ trunk/StockSerialItemResearch.php 2011-10-16 00:17:27 UTC (rev 4721) @@ -1,49 +1,50 @@ <?php /* $Id$*/ -//$PageSecurity = 3; - include('includes/session.inc'); $title = _('Serial Item Research'); include('includes/header.inc'); -echo '<p Class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/inventory.png" title="' . _('Inventory') . -'" alt="" /><b>' . $title. '</b></p>'; +echo '<p class="page_title_text"> + <img src="'.$rootpath.'/css/'.$theme.'/images/inventory.png" title="' . _('Inventory') . +'" alt="" /><b>' . $title. '</b> + </p>'; //validate the submission if (isset($_POST['serialno'])) { - $SN = trim($_POST['serialno']); + $SerialNo = trim($_POST['serialno']); } elseif(isset($_GET['serialno'])) { - $SN = trim($_GET['serialno']); + $SerialNo = trim($_GET['serialno']); } else { - $SN = ''; + $SerialNo = ''; } -$SN = $SN; + echo '<div class="centre"> <br /> -<form name=SNRESEARCH method=post action="' . $_SERVER['PHP_SELF'] .'">'; +<form name="SerialNoResearch" method="post" action="' . $_SERVER['PHP_SELF'] .'">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; -echo _('Serial Number') .': <input ID="serialno" name="serialno" size=21 maxlength=20 VALUE="'. $SN . '"> -<input type=submit name=submit></div><br /> +echo _('Serial Number') .': <input ID="serialno" name="serialno" size="21" maxlength="20" value="'. $SerialNo . '" /> <input type="submit" name="submit" /> +</div> +<br /> </form>'; -echo "<SCRIPT> -document.getElementById('serialno').focus(); -</SCRIPT>"; +echo '<SCRIPT> +document.getElementById("serialno").focus(); +</SCRIPT>'; -if ($SN!='') { +if ($SerialNo!='') { //the point here is to allow a semi fuzzy search, but still keep someone from killing the db server - if (mb_strstr($SN,'%')){ - while(mb_strstr($SN,'%%')) { - $SN = str_replace('%%','%',$SN); + if (mb_strstr($SerialNo,'%')){ + while(mb_strstr($SerialNo,'%%')) { + $SerialNo = str_replace('%%','%',$SerialNo); } - if (mb_strlen($SN) < 11){ - $SN = str_replace('%','',$SN); + if (mb_strlen($SerialNo) < 11){ + $SerialNo = str_replace('%','',$SerialNo); prnMsg('You can not use LIKE with short numbers. It has been removed.','warn'); } } @@ -60,55 +61,56 @@ ON sm.type=st.typeid INNER JOIN locations l on sm.loccode = l.loccode - WHERE ssi.serialno like '$SN' + WHERE ssi.serialno " . LIKE . " '" . $SerialNo . "' ORDER BY stkmoveno"; $result = DB_query($SQL,$db); if (DB_num_rows($result) == 0){ - prnMsg( _('No History found for Serial Number'). ': <b>'.$SN.'</b>' , 'warn'); + prnMsg( _('No History found for Serial Number'). ': <b>'.$SerialNo.'</b>' , 'warn'); } else { - echo '<h4>'. _('Details for Serial Item').': <b>'.$SN.'</b><br />'. _('Length').'='.mb_strlen($SN).'</h4>'; - echo '<table class=selection>'; - echo "<tr><th>" . _('StockID') . "</th> - <th>" . _('CurInvQty') . "</th> - <th>" . _('Move Qty') . "</th> - <th>" . _('Move Type') . "</th> - <th>" . _('Trans #') . "</th> - <th>" . _('Location') . "</th> - <th>" . _('Date') . "</th> - <th>" . _('DebtorNo') . "</th> - <th>" . _('Branch') . "</th> - <th>" . _('Move Ref') . "</th> - <th>" . _('Total Move Qty') . "</th> - </tr>"; + echo '<h4>'. _('Details for Serial Item').': <b>'.$SerialNo.'</b><br />'. _('Length').'='.mb_strlen($SerialNo).'</h4>'; + echo '<table class="selection">'; + echo '<tr> + <th>' . _('StockID') . '</th> + <th>' . _('CurInvQty') . '</th> + <th>' . _('Move Qty') . '</th> + <th>' . _('Move Type') . '</th> + <th>' . _('Trans #') . '</th> + <th>' . _('Location') . '</th> + <th>' . _('Date') . '</th> + <th>' . _('DebtorNo') . '</th> + <th>' . _('Branch') . '</th> + <th>' . _('Move Ref') . '</th> + <th>' . _('Total Move Qty') . '</th> + </tr>'; while ($myrow=DB_fetch_row($result)) { - printf("<tr> - <td>%s<br />%s</td> - <td class=number>%s</td> - <td class=number>%s</td> - <td>%s (%s)</td> - <td class=number>%s</td> - <td>%s - %s</td> - <td>%s </td> - <td>%s </td> - <td>%s </td> - <td>%s </td> - <td class=number>%s</td> - </tr>", - $myrow[1], - $myrow[0], - $myrow[2], - $myrow[3], - $myrow[5], $myrow[4], - $myrow[6], - $myrow[7], $myrow[8], - $myrow[9], - $myrow[10], - $myrow[11], - $myrow[12], - $myrow[13] - ); + printf('<tr> + <td>%s<br />%s</td> + <td class="number">%s</td> + <td class="number">%s</td> + <td>%s (%s)</td> + <td class="number">%s</td> + <td>%s - %s</td> + <td>%s </td> + <td>%s </td> + <td>%s </td> + <td>%s </td> + <td class="number">%s</td> + </tr>', + $myrow[1], + $myrow[0], + $myrow[2], + $myrow[3], + $myrow[5], $myrow[4], + $myrow[6], + $myrow[7], $myrow[8], + $myrow[9], + $myrow[10], + $myrow[11], + $myrow[12], + $myrow[13] + ); } //END WHILE LIST LOOP echo '</table>'; } // ELSE THERE WHERE ROWS Modified: trunk/StockSerialItems.php =================================================================== --- trunk/StockSerialItems.php 2011-10-14 06:11:13 UTC (rev 4720) +++ trunk/StockSerialItems.php 2011-10-16 00:17:27 UTC (rev 4721) @@ -5,8 +5,10 @@ $title = _('Stock Of Controlled Items'); include('includes/header.inc'); -echo '<p Class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/inventory.png" title="' . _('Inventory') . -'" alt="" /><b>' . $title. '</b></p>'; +echo '<p class="page_title_text"> + <img src="'.$rootpath.'/css/'.$theme.'/images/inventory.png" title="' . _('Inventory') . +'" alt="" /><b>' . $title. '</b> + </p>'; if (isset($_GET['StockID'])){ if (ContainsIllegalCharacters ($_GET['StockID'])){ @@ -70,50 +72,52 @@ $ErrMsg = _('The serial numbers/batches held cannot be retrieved because'); $LocStockResult = DB_query($sql, $db, $ErrMsg); -echo '<table cellpadding=2 class="selection">'; +echo '<table class="selection">'; if ($Serialised==1){ - echo '<tr><th colspan="5"><font color=navy size=2>' . _('Serialised items in') . ' '; + echo '<tr><th colspan="5"><font color="navy" size="2">' . _('Serialised items in') . ' '; } else { - echo '<tr><th colspan="11"><font color=navy size=2>' . _('Controlled items in') . ' '; + echo '<tr><th colspan="11"><font color="navy" size="2">' . _('Controlled items in') . ' '; } echo $myrow[0]. '</font></th></tr>'; -echo '<tr><th colspan="11"><font color=navy size=2>' . $StockID .'-'. $Description .'</b> (' . _('In units of') . ' ' . $UOM . ')</font></th></tr>'; +echo '<tr> + <th colspan="11"><font color="navy" size="2">' . $StockID .'-'. $Description .'</b> (' . _('In units of') . ' ' . $UOM . ')</font></th> + </tr>'; if ($Serialised == 1){ $tableheader = '<tr> - <th>' . _('Serial Number') . '</th> - <th></th> - <th>' . _('Serial Number') . '</th> - <th></th> - <th>' . _('Serial Number') . '</th> - </tr>'; + <th>' . _('Serial Number') . '</th> + <th></th> + <th>' . _('Serial Number') . '</th> + <th></th> + <th>' . _('Serial Number') . '</th> + </tr>'; } else if ($Serialised == 0 and $Perishable==0){ $tableheader = '<tr> - <th>' . _('Batch/Bundle Ref') . '</th> - <th>' . _('Quantity On Hand') . '</th> - <th></th> - <th>' . _('Batch/Bundle Ref') . '</th> - <th>' . _('Quantity On Hand') . '</th> - <th></th> - <th>' . _('Batch/Bundle Ref') . '</th> - <th>' . _('Quantity On Hand') . '</th> - </tr>'; + <th>' . _('Batch/Bundle Ref') . '</th> + <th>' . _('Quantity On Hand') . '</th> + <th></th> + <th>' . _('Batch/Bundle Ref') . '</th> + <th>' . _('Quantity On Hand') . '</th> + <th></th> + <th>' . _('Batch/Bundle Ref') . '</th> + <th>' . _('Quantity On Hand') . '</th> + </tr>'; } else if ($Serialised == 0 and $Perishable==1){ $tableheader = '<tr> - <th>' . _('Batch/Bundle Ref') . '</th> - <th>' . _('Quantity On Hand') . '</th> - <th>' . _('Expiry Date') . '</th> - <th></th> - <th>' . _('Batch/Bundle Ref') . '</th> - <th>' . _('Quantity On Hand') . '</th> - <th>' . _('Expiry Date') . '</th> - <th></th> - <th>' . _('Batch/Bundle Ref') . '</th> - <th>' . _('Quantity On Hand') . '</th> - <th>' . _('Expiry Date') . '</th> - </tr>'; + <th>' . _('Batch/Bundle Ref') . '</th> + <th>' . _('Quantity On Hand') . '</th> + <th>' . _('Expiry Date') . '</th> + <th></th> + <th>' . _('Batch/Bundle Ref') . '</th> + <th>' . _('Quantity On Hand') . '</th> + <th>' . _('Expiry Date') . '</th> + <th></th> + <th>' . _('Batch/Bundle Ref') . '</th> + <th>' . _('Quantity On Hand') . '</th> + <th>' . _('Expiry Date') . '</th> + </tr>'; } echo $tableheader; $TotalQuantity =0; Modified: trunk/StockStatus.php =================================================================== --- trunk/StockStatus.php 2011-10-14 06:11:13 UTC (rev 4720) +++ trunk/StockStatus.php 2011-10-16 00:17:27 UTC (rev 4721) @@ -22,27 +22,25 @@ //echo "<a href='" . $rootpath . '/SelectProduct.php?' . SID . "'>" . _('Back to Items') . '</a><br />'; $result = DB_query("SELECT description, - units, - mbflag, - decimalplaces, - serialised, - controlled - FROM - stockmaster - WHERE - stockid='".$StockID."'", - $db, - _('Could not retrieve the requested item'), - _('The SQL used to retrieve the items was')); + units, + mbflag, + decimalplaces, + serialised, + controlled + FROM stockmaster + WHERE stockid='".$StockID."'", + $db, + _('Could not retrieve the requested item'), + _('The SQL used to retrieve the items was')); -$myrow = DB_fetch_row($result); +$myrow = DB_fetch_array($result); -$DecimalPlaces = $myrow[3]; -$Serialised = $myrow[4]; -$Controlled = $myrow[5]; +$DecimalPlaces = $myrow['decimalplaces']; +$Serialised = $myrow['serialised']; +$Controlled = $myrow['controlled']; echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/inventory.png" title="' . _('Inventory') . - '" alt="" /><b>' . ' ' . $StockID . ' - ' . $myrow['0'] . ' : ' . _('in units of') . ' : ' . $myrow[1] . '</b></p>'; + '" alt="" /><b>' . ' ' . $StockID . ' - ' . $myrow['description'] . ' : ' . _('in units of') . ' : ' . $myrow['units'] . '</b></p>'; $Its_A_KitSet_Assembly_Or_Dummy =False; if ($myrow[2]=='K'){ @@ -56,43 +54,43 @@ prnMsg( _('This is an dummy part and cannot have a stock holding') . ', ' . _('only the total quantity on outstanding sales orders is shown'),'info'); } -echo '<form action="' . $_SERVER['PHP_SELF'] . '?'. SID . '" method="post">'; +echo '<form action="' . $_SERVER['PHP_SELF'] . '" method="post">'; echo '<div class="centre"><input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; echo _('Stock Code') . ':<input type="text" name="StockID" size="21" value="' . $StockID . '" maxlength="20" />'; -echo ' <input type="submit" name="ShowStatus" VALUE="' . _('Show Stock Status') . '" /></div>'; +echo ' <input type="submit" name="ShowStatus" value="' . _('Show Stock Status') . '" /></div>'; $sql = "SELECT locstock.loccode, - locations.locationname, - locstock.quantity, - locstock.reorderlevel, - locations.managed - FROM locstock, - locations - WHERE locstock.loccode=locations.loccode AND - locstock.stockid = '" . $StockID . "' - ORDER BY locstock.loccode"; + locations.locationname, + locstock.quantity, + locstock.reorderlevel, + locations.managed + FROM locstock INNER JOIN locations + ON locstock.loccode=locations.loccode + WHERE locstock.stockid = '" . $StockID . "' + ORDER BY locstock.loccode"; $ErrMsg = _('The stock held at each location cannot be retrieved because'); $DbgMsg = _('The SQL that was used to update the stock item and failed was'); $LocStockResult = DB_query($sql, $db, $ErrMsg, $DbgMsg); -echo '<br /><table cellpadding="2" class="selection">'; +echo '<br /> + <table class="selection">'; if ($Its_A_KitSet_Assembly_Or_Dummy == True){ $tableheader = '<tr> - <th>' . _('Location') . '</th> - <th>' . _('Demand') . '</th> - </tr>'; + <th>' . _('Location') . '</th> + <th>' . _('Demand') . '</th> + </tr>'; } else { $tableheader = '<tr> - <th>' . _('Location') . '</th> - <th>' . _('Quantity On Hand') . '</th> - <th>' . _('Re-Order Level') . '</th> - <th>' . _('Demand') . '</th> - <th>' . _('Available') . '</th> - <th>' . _('On Order') . '</th> - </tr>'; + <th>' . _('Location') . '</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; @@ -109,13 +107,12 @@ } $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 - salesorders.quotation=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 salesorders.quotation=0 + AND salesorderdetails.stkcode='" . $StockID . "'"; $ErrMsg = _('The demand for this product from') . ' ' . $myrow['loccode'] . ' ' . _('cannot be retrieved because'); $DemandResult = DB_query($sql,$db,$ErrMsg,$DbgMsg); @@ -129,17 +126,17 @@ //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'] . "' AND - salesorderdetails.quantity-salesorderdetails.qtyinvoiced > 0 AND - bom.component='" . $StockID . "' AND stockmaster.stockid=bom.parent AND - stockmaster.mbflag='A' - AND salesorders.quotation=0"; + 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.mbflag='A' + AND salesorders.quotation=0"; $ErrMsg = _('The demand for this product from') . ' ' . $myrow['loccode'] . ' ' . _('cannot be retrieved because'); $DemandResult = DB_query($sql,$db,$ErrMsg,$DbgMsg); @@ -152,14 +149,14 @@ //Also the demand for the item as a component of works orders $sql = "SELECT SUM(qtypu*(woitems.qtyreqd - woitems.qtyrecd)) AS woqtydemo - FROM woitems INNER JOIN worequirements - ON woitems.stockid=worequirements.parentstockid - INNER JOIN workorders - ON woitems.wo=workorders.wo - AND woitems.wo=worequirements.wo - WHERE workorders.loccode='" . $myrow['loccode'] . "' - AND worequirements.stockid='" . $StockID . "' - AND workorders.closed=0"; + FROM woitems INNER JOIN worequirements + ON woitems.stockid=worequirements.parentstockid + INNER JOIN workorders + ON woitems.wo=workorders.wo + AND woitems.wo=worequirements.wo + WHERE workorders.loccode='" . $myrow['loccode'] . "' + AND worequirements.stockid='" . $StockID . "' + AND workorders.closed=0"; $ErrMsg = _('The workorder component demand for this product from') . ' ' . $myrow['loccode'] . ' ' . _('cannot be retrieved because'); $DemandResult = DB_query($sql,$db,$ErrMsg,$DbgMsg); @@ -173,16 +170,14 @@ $sql="SELECT SUM(purchorderdetails.quantityord*(CASE WHEN purchdata.conversionfactor IS NULL THEN 1 ELSE purchdata.conversionfactor END) - purchorderdetails.quantityrecd*(CASE WHEN purchdata.conversionfactor IS NULL THEN 1 ELSE purchdata.conversionfactor END)) - FROM purchorders - LEFT JOIN purchorderdetails - ON purchorders.orderno=purchorderdetails.orderno - LEFT JOIN purchdata - ON purchorders.supplierno=purchdata.supplierno - AND purchorderdetails.itemcode=purchdata.stockid - WHERE purchorderdetails.itemcode='" . $StockID . "' - AND purchorders.intostocklocation='" . $myrow['loccode'] . "' - AND (purchorders.status<>'Cancelled' - AND purchorders.status<>'Pending')"; + FROM purchorders LEFT JOIN purchorderdetails + ON purchorders.orderno=purchorderdetails.orderno + LEFT JOIN purchdata ON purchorders.supplierno=purchdata.supplierno + AND purchorderdetails.itemcode=purchdata.stockid + WHERE purchorderdetails.itemcode='" . $StockID . "' + AND purchorders.intostocklocation='" . $myrow['loccode'] . "' + AND (purchorders.status<>'Cancelled' + AND purchorders.status<>'Pending')"; $ErrMsg = _('The quantity on order for this product to be received into') . ' ' . $myrow['loccode'] . ' ' . _('cannot be retrieved because'); $QOOResult = DB_query($sql,$db,$ErrMsg, $DbgMsg); @@ -211,33 +206,32 @@ echo '<td>' . $myrow['locationname'] . '</td>'; printf('<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>', - locale_number_format($myrow['quantity'], $DecimalPlaces), - locale_number_format($myrow['reorderlevel'], $DecimalPlaces), - locale_number_format($DemandQty, $DecimalPlaces), - locale_number_format($myrow['quantity'] - $DemandQty, $DecimalPlaces), - locale_number_format($QOO, $DecimalPlaces) - ); + <td class="number">%s</td> + <td class="number">%s</td> + <td class="number">%s</td> + <td class="number">%s</td></tr>', + locale_number_format($myrow['quantity'], $DecimalPlaces), + locale_number_format($myrow['reorderlevel'], $DecimalPlaces), + locale_number_format($DemandQty, $DecimalPlaces), + locale_number_format($myrow['quantity'] - $DemandQty, $DecimalPlaces), + locale_number_format($QOO, $DecimalPlaces) + ); if ($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 ($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>'; } } else { /* It must be a dummy, assembly or kitset part */ printf('<td>%s</td> - <td class="number">%s</td> - </tr>', - $myrow['locationname'], - locale_number_format($DemandQty, $DecimalPlaces) - ); + <td class="number">%s</td> + </tr>', + $myrow['locationname'], + locale_number_format($DemandQty, $DecimalPlaces)); } //end of page full new headings if } @@ -268,13 +262,14 @@ /* only show pricing history for sales invoices - type=10 */ $ErrMsg = _('The stock movements for the selected criteria could not be retrieved because') . ' - '; - $DbgMsg = _('The SQL that failed was') . ' '; + $DbgMsg = _('The SQL that failed was'); $MovtsResult = DB_query($sql, $db, $ErrMsg, $DbgMsg); $k=1; while ($myrow=DB_fetch_array($MovtsResult)) { - if ($LastPrice != $myrow['price'] OR $LastDiscount != $myrow['discount']) { /* consolidate price history for records with same price/discount */ + if ($LastPrice != $myrow['price'] + OR $LastDiscount != $myrow['discount']) { /* consolidate price history for records with same price/discount */ if (isset($qty)) { $DateRange=ConvertSQLDate($FromDate); if ($FromDate != $ToDate) { @@ -305,19 +300,22 @@ $PriceHistory[] = array($DateRange, $qty, $LastPrice, $LastDiscount); } if (isset($PriceHistory)) { - echo '<br /><table cellpadding="4" class="selection">'; - echo '<tr><th colspan=4><font color=navy size=2>' . _('Pricing history for sales of') . ' ' . $StockID . ' ' . _('to') . ' ' . $DebtorNo . '</font></th></tr>'; - $tableheader = "<tr> - <th>" . _('Date Range') . "</th> - <th>" . _('Quantity') . "</th> - <th>" . _('Price') . "</th> - <th>" . _('Discount') . "</th> - </tr>"; - + echo '<br /> + <table class="selection">'; + echo '<tr> + <th colspan="4"><font color="navy" size="2">' . _('Pricing history for sales of') . ' ' . $StockID . ' ' . _('to') . ' ' . $DebtorNo . '</font></th> + </tr>'; + $tableheader = '<tr> + <th>' . _('Date Range') . '</th> + <th>' . _('Quantity') . '</th> + <th>' . _('Price') . '</th> + <th>' . _('Discount') . '</th> + </tr>'; + $j = 0; $k = 0; //row colour counter - foreach($PriceHistory as $ph) { + foreach($PriceHistory as $PreviousPrice) { $j--; if ($j < 0 ){ $j = 11; @@ -333,15 +331,14 @@ } printf('<td>%s</td> - <td class="number">%s</td> - <td class="number">%s... [truncated message content] |