|
From: <tu...@us...> - 2018-02-10 00:05:34
|
Revision: 7946
http://sourceforge.net/p/web-erp/reponame/7946
Author: turbopt
Date: 2018-02-10 00:05:31 +0000 (Sat, 10 Feb 2018)
Log Message:
-----------
Paul Becker (PaulT commit): InternalStockRequestFulfill.php: Add controlled stock handling within this script. (Reported in forums: http://www.weberp.org/forum/showthread.php?tid=8086)
Modified Paths:
--------------
trunk/InternalStockRequestFulfill.php
trunk/doc/Change.log
Modified: trunk/InternalStockRequestFulfill.php
===================================================================
--- trunk/InternalStockRequestFulfill.php 2018-02-09 19:48:22 UTC (rev 7945)
+++ trunk/InternalStockRequestFulfill.php 2018-02-10 00:05:31 UTC (rev 7946)
@@ -24,6 +24,8 @@
$Department = $_POST[$RequestID.'Department'.$LineID];
$Tag = $_POST[$RequestID.'Tag'.$LineID];
$RequestedQuantity = filter_number_format($_POST[$RequestID.'RequestedQuantity'.$LineID]);
+ $Controlled = $_POST[$RequestID.'Controlled'.$LineID];
+ $SerialNo = $_POST[$RequestID.'Ser'.$LineID];
if (isset($_POST[$RequestID.'Completed'.$LineID])) {
$Completed=True;
} else {
@@ -93,6 +95,36 @@
/*Get the ID of the StockMove... */
$StkMoveNo = DB_Last_Insert_ID('stockmoves','stkmoveno');
+
+ if ($Controlled == 1) {
+ /*We need to add the StockSerialItem record and the StockSerialMoves as well */
+
+ $SQL = "UPDATE stockserialitems SET quantity= quantity - " . $Quantity . "
+ WHERE stockid='" . $StockID . "'
+ AND loccode='" . $Location . "'
+ AND serialno='" . $SerialNo . "'";
+
+ $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The serial stock item record could not be updated because');
+ $DbgMsg = _('The following SQL to update the serial stock item record was used');
+ $Result = DB_query($SQL, $ErrMsg, $DbgMsg, true);
+
+ /* now insert the serial stock movement */
+
+ $SQL = "INSERT INTO stockserialmoves (stockmoveno,
+ stockid,
+ serialno,
+ moveqty)
+ VALUES ('" . $StkMoveNo . "',
+ '" . $StockID . "',
+ '" . $SerialNo . "',
+ '" . -$Quantity . "')";
+
+ $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, $ErrMsg, $DbgMsg, true);
+ } /*end if the orderline is a controlled item */
+
+
$SQL="UPDATE stockrequestitems
SET qtydelivered=qtydelivered+" . $Quantity . "
WHERE dispatchid='" . $RequestID . "'
@@ -296,7 +328,7 @@
<td>' . $myrow['dispatchid'] . '</td>
<td>' . $myrow['description'] . '</td>
<td>' . $myrow['locationname'] . '</td>
- <td>' . ConvertSQLDate($myrow['despatchdate']) . '</td>
+ <td class="centre">' . ConvertSQLDate($myrow['despatchdate']) . '</td>
<td>' . $myrow['narrative'] . '</td>
</tr>';
$LineSQL="SELECT stockrequestitems.dispatchitemsid,
@@ -306,7 +338,8 @@
stockrequestitems.uom,
stockmaster.description,
stockrequestitems.quantity,
- stockrequestitems.qtydelivered
+ stockrequestitems.qtydelivered,
+ stockmaster.controlled
FROM stockrequestitems
LEFT JOIN stockmaster
ON stockmaster.stockid=stockrequestitems.stockid
@@ -323,6 +356,7 @@
<th>' . _('Quantity') . '<br />' . _('Required') . '</th>
<th>' . _('Quantity') . '<br />' . _('Delivered') . '</th>
<th>' . _('Units') . '</th>
+ <th>' . _('Lot/Batch/Serial') . '</th>
<th>' . _('Completed') . '</th>
<th>' . _('Tag') . '</th>
</tr>';
@@ -331,9 +365,14 @@
echo '<tr>
<td>' . $LineRow['description'] . '</td>
<td class="number">' . locale_number_format($LineRow['quantity']-$LineRow['qtydelivered'],$LineRow['decimalplaces']) . '</td>
- <td class="number"><input type="text" class="number" name="'. $LineRow['dispatchid'] . 'Qty'. $LineRow['dispatchitemsid'] . '" value="'.locale_number_format($LineRow['quantity']-$LineRow['qtydelivered'],$LineRow['decimalplaces']).'" /></td>
- <td>' . $LineRow['uom'] . '</td>
- <td><input type="checkbox" name="'. $LineRow['dispatchid'] . 'Completed'. $LineRow['dispatchitemsid'] . '" /></td>
+ <td class="number"><input type="text" class="number" name="'. $LineRow['dispatchid'] . 'Qty' . $LineRow['dispatchitemsid'] . '" value="'.locale_number_format($LineRow['quantity']-$LineRow['qtydelivered'],$LineRow['decimalplaces']).'" /></td>
+ <td>' . $LineRow['uom'] . '</td>';
+ if ($LineRow['controlled'] == 1) {
+ echo '<td class="number"><input type="text" class="number" name="'. $LineRow['dispatchid'] . 'Ser' . $LineRow['dispatchitemsid'] .'" /></td>';
+ } else {
+ echo '<td>' . _('Stock item is not controlled') . '</td>';
+ }
+ echo '<td class="centre"><input type="checkbox" name="'. $LineRow['dispatchid'] . 'Completed'. $LineRow['dispatchitemsid'] . '" /></td>
<td><select name="'. $LineRow['dispatchid'] . 'Tag'. $LineRow['dispatchitemsid'] . '">';
$SQL = "SELECT tagref,
@@ -357,6 +396,7 @@
echo '<input type="hidden" class="number" name="'. $LineRow['dispatchid'] . 'Location'. $LineRow['dispatchitemsid'] . '" value="'.$_POST['Location'].'" />';
echo '<input type="hidden" class="number" name="'. $LineRow['dispatchid'] . 'RequestedQuantity'. $LineRow['dispatchitemsid'] . '" value="'.locale_number_format($LineRow['quantity']-$LineRow['qtydelivered'],$LineRow['decimalplaces']).'" />';
echo '<input type="hidden" class="number" name="'. $LineRow['dispatchid'] . 'Department'. $LineRow['dispatchitemsid'] . '" value="'.$myrow['description'].'" />';
+ echo '<input type="hidden" class="number" name="'. $LineRow['dispatchid'] . 'Controlled'. $LineRow['dispatchitemsid'] . '" value="'.$LineRow['controlled'].'" />';
} // end while order line detail
echo '</table></td></tr>';
} //end while header loop
Modified: trunk/doc/Change.log
===================================================================
--- trunk/doc/Change.log 2018-02-09 19:48:22 UTC (rev 7945)
+++ trunk/doc/Change.log 2018-02-10 00:05:31 UTC (rev 7946)
@@ -1,5 +1,6 @@
webERP Change Log
+9/2/18 Paul Becker (PaulT commit): InternalStockRequestFulfill.php: Add controlled stock handling within this script. (Reported in forums: http://www.weberp.org/forum/showthread.php?tid=8086)
9/2/18 Tim/PaulT: MRPPlannedPurchaseOrders.php, MRPPlannedWorkOrders.php: Fix conversion factor matter noted by Tim, use DB_table_exists() from commit 7943 to replace table check query, and minor rework to 'missing cell' handling from commit 7939.
9/2/18 PaulT: Replace old method of table row alternating color handing with improved CSS. Also, this change removes some empty/unused properties from a few css file and removes old URL 'SID' references in files already modified for this commit. Due to SVN issues with TestPlanResults.php, this one file will be committed later.
9/2/18 Tim (PaulT commit): ConnectDB_xxxx.inc files: Add function DB_table_exists() function to all DB support files, by Tim suggestion. Note that this function will be used in other files in a future commit.
|