|
From: <te...@us...> - 2014-09-11 09:35:06
|
Revision: 6875
http://sourceforge.net/p/web-erp/reponame/6875
Author: tehonu
Date: 2014-09-11 09:34:57 +0000 (Thu, 11 Sep 2014)
Log Message:
-----------
Added flag "Used for WO Productions" in locations table. On WO related scripts, show only the locations with this flag set to 1
Modified Paths:
--------------
trunk/Locations.php
trunk/SelectWorkOrder.php
trunk/WOCanBeProducedNow.php
trunk/WorkOrderEntry.php
trunk/sql/mysql/upgrade4.11-4.12.sql
Modified: trunk/Locations.php
===================================================================
--- trunk/Locations.php 2014-09-11 02:32:16 UTC (rev 6874)
+++ trunk/Locations.php 2014-09-11 09:34:57 UTC (rev 6875)
@@ -71,7 +71,8 @@
cashsalecustomer ='" . $_POST['CashSaleCustomer'] . "',
cashsalebranch ='" . $_POST['CashSaleBranch'] . "',
managed = '" . $_POST['Managed'] . "',
- internalrequest = '" . $_POST['InternalRequest'] . "'
+ internalrequest = '" . $_POST['InternalRequest'] . "',
+ usedforwo = '" . $_POST['UsedForWO'] . "'
WHERE loccode = '" . $SelectedLocation . "'";
$ErrMsg = _('An error occurred updating the') . ' ' . $SelectedLocation . ' ' . _('location record because');
@@ -98,6 +99,7 @@
unset($SelectedLocation);
unset($_POST['Contact']);
unset($_POST['InternalRequest']);
+ unset($_POST['UsedForWO']);
} elseif ($InputError !=1) {
@@ -116,6 +118,13 @@
$_POST['InternalRequest'] = 0;
}
+ /* Set the usedToWO field to 1 if it is checked, otherwise 0 */
+ if($_POST['UsedForWO'] == 'Yes') {
+ $_POST['UsedForWO'] = 1;
+ } else {
+ $_POST['UsedForWO'] = 0;
+ }
+
/*SelectedLocation is null cos no item selected on first time round so must be adding a record must be submitting new entries in the new Location form */
$sql = "INSERT INTO locations (loccode,
@@ -134,7 +143,8 @@
cashsalecustomer,
cashsalebranch,
managed,
- internalrequest)
+ internalrequest,
+ usedforwo)
VALUES ('" . $_POST['LocCode'] . "',
'" . $_POST['LocationName'] . "',
'" . $_POST['DelAdd1'] ."',
@@ -151,7 +161,8 @@
'" . $_POST['CashSaleCustomer'] . "',
'" . $_POST['CashSaleBranch'] . "',
'" . $_POST['Managed'] . "',
- '" . $_POST['InternalRequest'] . "')";
+ '" . $_POST['InternalRequest'] ."',
+ '" . $_POST['UsedForWO'] . "')";
$ErrMsg = _('An error occurred inserting the new location record because');
$DbgMsg = _('The SQL used to insert the location record was');
@@ -212,6 +223,7 @@
unset($SelectedLocation);
unset($_POST['Contact']);
unset($_POST['InternalRequest']);
+ unset($_POST['UsedForWO']);
}
@@ -470,7 +482,8 @@
cashsalecustomer,
cashsalebranch,
managed,
- internalrequest
+ internalrequest,
+ usedforwo
FROM locations
WHERE loccode='" . $SelectedLocation . "'";
@@ -494,6 +507,7 @@
$_POST['CashSaleBranch'] = $myrow['cashsalebranch'];
$_POST['Managed'] = $myrow['managed'];
$_POST['InternalRequest'] = $myrow['internalrequest'];
+ $_POST['UsedForWO'] = $myrow['usedforwo'];
echo '<input type="hidden" name="SelectedLocation" value="' . $SelectedLocation . '" />';
@@ -652,7 +666,23 @@
} else {
echo '<option value="0">' . _('No') . '</option>';
}
+ echo '</tr>';
+ echo '<tr>
+ <td>' . _('Use for Work Order Productions?') . ':</td>
+ <td><select name="UsedForWO">';
+ if ($_POST['UsedForWO']==1){
+ echo '<option selected="selected" value="1">' . _('Yes') . '</option>';
+ } else {
+ echo '<option value="1">' . _('Yes') . '</option>';
+ }
+ if ($_POST['UsedForWO']==0){
+ echo '<option selected="selected" value="0">' . _('No') . '</option>';
+ } else {
+ echo '<option value="0">' . _('No') . '</option>';
+ }
+ echo '</tr>';
+
/*
This functionality is not written yet ...
<tr><td><?php echo _('Enable Warehouse Management') . ':'; ?></td>
Modified: trunk/SelectWorkOrder.php
===================================================================
--- trunk/SelectWorkOrder.php 2014-09-11 02:32:16 UTC (rev 6874)
+++ trunk/SelectWorkOrder.php 2014-09-11 09:34:57 UTC (rev 6875)
@@ -133,7 +133,11 @@
echo _('Work Order number') . ': <input type="text" name="WO" autofocus="autofocus" maxlength="8" size="9" /> ' . _('Processing at') . ':<select name="StockLocation"> ';
$sql = "SELECT locations.loccode, locationname FROM locations
- INNER JOIN locationusers ON locationusers.loccode=locations.loccode AND locationusers.userid='" . $_SESSION['UserID'] . "' AND locationusers.canview=1";
+ INNER JOIN locationusers
+ ON locationusers.loccode=locations.loccode
+ AND locationusers.userid='" . $_SESSION['UserID'] . "'
+ AND locationusers.canview=1
+ WHERE locations.usedforwo = 1";
$resultStkLocs = DB_query($sql,$db);
Modified: trunk/WOCanBeProducedNow.php
===================================================================
--- trunk/WOCanBeProducedNow.php 2014-09-11 02:32:16 UTC (rev 6874)
+++ trunk/WOCanBeProducedNow.php 2014-09-11 09:34:57 UTC (rev 6875)
@@ -226,7 +226,8 @@
INNER JOIN locationusers
ON locationusers.loccode=locations.loccode
AND locationusers.userid='" . $_SESSION['UserID'] . "'
- AND locationusers.canview=1";
+ AND locationusers.canview=1
+ WHERE locations.usedforwo = 1";
$LocnResult=DB_query($sql,$db);
Modified: trunk/WorkOrderEntry.php
===================================================================
--- trunk/WorkOrderEntry.php 2014-09-11 02:32:16 UTC (rev 6874)
+++ trunk/WorkOrderEntry.php 2014-09-11 09:34:57 UTC (rev 6875)
@@ -113,7 +113,7 @@
INNER JOIN stockcategory
ON stockmaster.categoryid=stockcategory.categoryid
WHERE (stockcategory.stocktype='F' OR stockcategory.stocktype='M')
- AND stockmaster.description " . LIKE . " '$SearchString'
+ AND stockmaster.description " . LIKE . " '" . $SearchString . "'
AND stockmaster.discontinued=0
AND mbflag='M'
ORDER BY stockmaster.stockid";
@@ -565,8 +565,12 @@
echo '<tr><td class="label">' . _('Work Order Reference') . ':</td><td>' . $_POST['WO'] . '</td></tr>';
echo '<tr><td class="label">' . _('Factory Location') .':</td>
<td><select name="StockLocation" onChange="ReloadForm(form1.submit)">';
-$LocResult = DB_query("SELECT locations.loccode,locationname FROM locations
- INNER JOIN locationusers ON locationusers.loccode=locations.loccode AND locationusers.userid='" . $_SESSION['UserID'] . "' AND locationusers.canupd=1",$db);
+$LocResult = DB_query("SELECT locations.loccode,locationname
+ FROM locations
+ INNER JOIN locationusers
+ ON locationusers.loccode=locations.loccode AND locationusers.userid='" . $_SESSION['UserID'] . "'
+ AND locationusers.canupd=1
+ WHERE locations.usedforwo = 1",$db);
while ($LocRow = DB_fetch_array($LocResult)){
if ($_POST['StockLocation']==$LocRow['loccode']){
echo '<option selected="True" value="' . $LocRow['loccode'] .'">' . $LocRow['locationname'] . '</option>';
Modified: trunk/sql/mysql/upgrade4.11-4.12.sql
===================================================================
--- trunk/sql/mysql/upgrade4.11-4.12.sql 2014-09-11 02:32:16 UTC (rev 6874)
+++ trunk/sql/mysql/upgrade4.11-4.12.sql 2014-09-11 09:34:57 UTC (rev 6875)
@@ -80,6 +80,7 @@
INSERT INTO `scripts` ( `script` , `pagesecurity` , `description` ) VALUES ('WOCanBeProducedNow.php', '4', 'List of WO items that can be produced with available stock in location');
INSERT INTO `scripts` ( `script` , `pagesecurity` , `description` ) VALUES ('PrintWOItemSlip.php', '4', 'PDF WO Item production Slip ');
+ALTER TABLE `locations` ADD `usedforwo` TINYINT( 4 ) NOT NULL DEFAULT '1' AFTER `internalrequest`;
UPDATE config SET confvalue='4.12' WHERE confname='VersionNumber';
|