|
From: <dai...@us...> - 2013-12-07 07:38:55
|
Revision: 6482
http://sourceforge.net/p/web-erp/reponame/6482
Author: daintree
Date: 2013-12-07 07:38:51 +0000 (Sat, 07 Dec 2013)
Log Message:
-----------
Stock counts entered by category
Modified Paths:
--------------
trunk/StockCounts.php
trunk/doc/Change.log
Modified: trunk/StockCounts.php
===================================================================
--- trunk/StockCounts.php 2013-12-07 05:39:13 UTC (rev 6481)
+++ trunk/StockCounts.php 2013-12-07 07:38:51 UTC (rev 6482)
@@ -1,29 +1,27 @@
<?php
/* $Id$*/
-//$PageSecurity = 2;
-
include('includes/session.inc');
$Title = _('Stock Check Sheets Entry');
include('includes/header.inc');
-echo '<form action="' . htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8') . '" method="post">';
+echo '<form name="EnterCountsForm" action="' . htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8') . '" method="post">';
echo '<div>';
echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />';
echo '<p class="page_title_text"><img src="'.$RootPath.'/css/'.$Theme.'/images/inventory.png" title="' .
_('Inventory Adjustment') . '" alt="" />' . ' ' . $Title . '</p>';
-if (!isset($_POST['Action']) and !isset($_GET['Action'])) {
+if (!isset($_POST['Action']) AND !isset($_GET['Action'])) {
$_GET['Action'] = 'Enter';
}
if (isset($_POST['Action'])) {
$_GET['Action'] = $_POST['Action'];
}
-if ($_GET['Action']!='View' and $_GET['Action']!='Enter'){
+if ($_GET['Action']!='View' AND $_GET['Action']!='Enter'){
$_GET['Action'] = 'Enter';
}
@@ -63,7 +61,6 @@
if (mb_strlen($_POST[$StockID])>0){
if (!is_numeric($_POST[$Quantity])){
- prnMsg(_('The quantity entered for line') . ' ' . $i . ' ' . _('is not numeric') . ' - ' . _('this line was for the part code') . ' ' . $_POST[$StockID] . '. ' . _('This line will have to be re-entered'),'warn');
$InputError=True;
}
$SQL = "SELECT stockid FROM stockcheckfreeze WHERE stockid='" . $_POST[$StockID] . "'";
@@ -93,45 +90,105 @@
unset($_POST['EnterCounts']);
} // end of if enter counts button hit
+ $CatsResult = DB_query("SELECT DISTINCT stockcategory.categoryid,
+ categorydescription
+ FROM stockcategory INNER JOIN stockmaster
+ ON stockcategory.categoryid=stockmaster.categoryid
+ INNER JOIN stockcheckfreeze
+ ON stockmaster.stockid=stockcheckfreeze.stockid
+ WHERE stocktype='F'",$db);
- echo '<table cellpadding="2" class="selection">';
- echo '<tr><th colspan="3">' ._('Stock Check Counts at Location') . ':<select name="Location">';
- $sql = 'SELECT loccode, locationname FROM locations';
- $result = DB_query($sql,$db);
+ if (DB_num_rows($CatsResult) ==0) {
+ prnMsg(_('The stock check sheets must be run first to create the stock check. Only once these are created can the stock counts be entered. Currently there is no stock check to enter counts for'),'error');
+ echo '<div class="center"><a href="/' . $RootPath . '/StockCheck.php">' . _('Create New Stock Check') . '</a></div>';
+ } else {
+ echo '<table cellpadding="2" class="selection">';
+ echo '<tr>
+ <th colspan="3">' ._('Stock Check Counts at Location') . ':<select name="Location">';
+ $sql = 'SELECT loccode, locationname FROM locations';
+ $result = DB_query($sql,$db);
+
+ while ($myrow=DB_fetch_array($result)){
+
+ if (isset($_POST['Location']) AND $myrow['loccode']==$_POST['Location']){
+ echo '<option selected="selected" value="' . $myrow['loccode'] . '">' . $myrow['locationname'] . '</option>';
+ } else {
+ echo '<option value="' . $myrow['loccode'] . '">' . $myrow['locationname'] . '</option>';
+ }
+ }
+ echo '</select> <input type="submit" name="EnterByCat" value="' . _('Enter By Category') . '" /><select name="StkCat" onChange="ReloadForm(EnterCountsForm.EnterByCat)" >';
- while ($myrow=DB_fetch_array($result)){
-
- if (isset($_POST['Location']) and $myrow['loccode']==$_POST['Location']){
- echo '<option selected="selected" value="' . $myrow['loccode'] . '">' . $myrow['locationname'] . '</option>';
+ echo '<option value="">' . _('Not Yet Selected') . '</option>';
+
+ while ($myrow=DB_fetch_array($CatsResult)){
+ if ($_POST['StkCat']==$myrow['categoryid']) {
+ echo '<option selected="selected" value="' . $myrow['categoryid'] . '">' . $myrow['categorydescription'] . '</option>';
+ } else {
+ echo '<option value="' . $myrow['categoryid'] . '">' . $myrow['categorydescription'] . '</option>';
+ }
+ }
+ echo '</select></th></tr>';
+
+
+
+ if (isset($_POST['EnterByCat'])){
+
+ $StkCatResult = DB_query("SELECT categorydescription FROM stockcategory WHERE categoryid='" . $_POST['StkCat'] . "'",$db);
+ $StkCatRow = DB_fetch_row($StkCatResult);
+
+ echo '<tr>
+ <th colspan="4">' . _('Entering Counts For Stock Category') . ': ' . $StkCatRow[0] . '</th>
+ </tr>
+ <tr>
+ <th>' . _('Stock Code') . '</th>
+ <th>' . _('Description') . '</th>
+ <th>' . _('Quantity') . '</th>
+ <th>' . _('Reference') . '</th>
+ </tr>';
+ $StkItemsResult = DB_query("SELECT stockcheckfreeze.stockid,
+ description
+ FROM stockcheckfreeze INNER JOIN stockmaster
+ ON stockcheckfreeze.stockid=stockmaster.stockid
+ WHERE categoryid='" . $_POST['StkCat'] . "'
+ ORDER BY stockcheckfreeze.stockid",$db);
+
+ $i=1;
+ while ($StkRow = DB_fetch_array($StkItemsResult)) {
+ echo '<tr>
+ <td><input type="hidden" name="StockID_' . $i . '" value="' . $StkRow['stockid'] . '" />' . $StkRow['stockid'] . '</td>
+ <td>' . $StkRow['description'] . '</td>
+ <td><input type="text" name="Qty_' . $i . '" maxlength="10" size="10" /></td>
+ <td><input type="text" name="Ref_' . $i . '" maxlength="20" size="20" /></td>
+ </tr>';
+ $i++;
+ }
+
} else {
- echo '<option value="' . $myrow['loccode'] . '">' . $myrow['locationname'] . '</option>';
+ echo '<tr>
+ <th>' . _('Bar Code') . '</th>
+ <th>' . _('Stock Code') . '</th>
+ <th>' . _('Quantity') . '</th>
+ <th>' . _('Reference') . '</th>
+ </tr>';
+
+ for ($i=1;$i<=10;$i++){
+
+ echo '<tr>
+ <td><input type="text" name="BarCode_' . $i . '" maxlength="20" size="20" /></td>
+ <td><input type="text" name="StockID_' . $i . '" maxlength="20" size="20" /></td>
+ <td><input type="text" name="Qty_' . $i . '" maxlength="10" size="10" /></td>
+ <td><input type="text" name="Ref_' . $i . '" maxlength="20" size="20" /></td>
+ </tr>';
+
+ }
}
- }
- echo '</select></th></tr>';
- echo '<tr>
- <th>' . _('Bar Code') . '</th>
- <th>' . _('Stock Code') . '</th>
- <th>' . _('Quantity') . '</th>
- <th>' . _('Reference') . '</th>
- </tr>';
-
- for ($i=1;$i<=10;$i++){
-
- echo '<tr>
- <td><input type="text" name="BarCode_' . $i . '" maxlength="20" size="20" /></td>
- <td><input type="text" name="StockID_' . $i . '" maxlength="20" size="20" /></td>
- <td><input type="text" name="Qty_' . $i . '" maxlength="10" size="10" /></td>
- <td><input type="text" name="Ref_' . $i . '" maxlength="20" size="20" /></td>
- </tr>';
-
- }
-
- echo '</table>
- <br />
- <div class="centre">
- <input type="submit" name="EnterCounts" value="' . _('Enter Above Counts') . '" />
- </div>';
-
+
+ echo '</table>
+ <br />
+ <div class="centre">
+ <input type="submit" name="EnterCounts" value="' . _('Enter Above Counts') . '" />
+ </div>';
+ } // there is a stock check to enter counts for
//END OF action=ENTER
} elseif ($_GET['Action']=='View'){
@@ -151,19 +208,19 @@
$result = DB_query($SQL, $db);
echo '<input type="hidden" name="Action" value="View" />';
echo '<table cellpadding="2" class="selection">';
- echo "<tr>
- <th>" . _('Stock Code') . "</th>
- <th>" . _('Location') . "</th>
- <th>" . _('Qty Counted') . "</th>
- <th>" . _('Reference') . "</th>
- <th>" . _('Delete?') . '</th></tr>';
+ echo '<tr>
+ <th>' . _('Stock Code') . '</th>
+ <th>' . _('Location') . '</th>
+ <th>' . _('Qty Counted') . '</th>
+ <th>' . _('Reference') . '</th>
+ <th>' . _('Delete?') . '</th></tr>';
while ($myrow=DB_fetch_array($result)){
- echo "<tr>
- <td>".$myrow['stockid']."</td>
- <td>".$myrow['loccode']."</td>
- <td>".$myrow['qtycounted']."</td>
- <td>".$myrow['reference']."</td>
- <td>";
+ echo '<tr>
+ <td>'.$myrow['stockid'].'</td>
+ <td>'.$myrow['loccode'].'</td>
+ <td>'.$myrow['qtycounted'].'</td>
+ <td>'.$myrow['reference'].'</td>
+ <td>';
echo '<input type="checkbox" name="DEL[' . $myrow['id'] . ']" maxlength="20" size="20" /></td></tr>';
}
@@ -176,4 +233,4 @@
</form>';
include('includes/footer.inc');
-?>
\ No newline at end of file
+?>
Modified: trunk/doc/Change.log
===================================================================
--- trunk/doc/Change.log 2013-12-07 05:39:13 UTC (rev 6481)
+++ trunk/doc/Change.log 2013-12-07 07:38:51 UTC (rev 6482)
@@ -1,5 +1,6 @@
webERP Change Log
+7/12/13 Phil: Allow entry of stock counts by stock category
7/12/13 Phil: Fixed htmlMimeEmail.inc following Tim's submission - removed & value by reference errors
4/12/13 Exson: Alter table stockmoves reference to varchar(100) to make it can meet mysql strict mode requirements when data is more than original 40.
2/12/13 Exson: Fixed the typo in WWW_Users.php. Reported by Thumb.
|