|
From: <te...@us...> - 2012-06-09 03:18:42
|
Revision: 5432
http://web-erp.svn.sourceforge.net/web-erp/?rev=5432&view=rev
Author: tehonu
Date: 2012-06-09 03:18:36 +0000 (Sat, 09 Jun 2012)
Log Message:
-----------
Added lastcategoryupdate field to stockmaster table
Modified Paths:
--------------
trunk/Stocks.php
trunk/sql/mysql/upgrade4.07-4.08.sql
Modified: trunk/Stocks.php
===================================================================
--- trunk/Stocks.php 2012-06-09 02:51:01 UTC (rev 5431)
+++ trunk/Stocks.php 2012-06-09 03:18:36 UTC (rev 5432)
@@ -1,6 +1,6 @@
<?php
-/* $Id$ */
+//* $Id$ */
include('includes/session.inc');
$title = _('Item Maintenance');
@@ -225,7 +225,8 @@
serialised,
materialcost+labourcost+overheadcost AS itemcost,
stockcategory.stockact,
- stockcategory.wipact
+ stockcategory.wipact,
+ stockmaster.categoryid
FROM stockmaster
INNER JOIN stockcategory
ON stockmaster.categoryid=stockcategory.categoryid
@@ -238,6 +239,7 @@
$UnitCost = $myrow[3];
$OldStockAccount = $myrow[4];
$OldWIPAccount = $myrow[5];
+ $OldCategoryId = $myrow[6];
$sql = "SELECT SUM(locstock.quantity)
@@ -364,8 +366,11 @@
controlled='" . $_POST['Controlled'] . "',
serialised='" . $_POST['Serialised']."',
perishable='" . $_POST['Perishable']."',
- categoryid='" . $_POST['CategoryID'] . "',
- units='" . $_POST['Units'] . "',
+ categoryid='" . $_POST['CategoryID'] . "', ";
+ if ($OldCategoryId != $_POST['CategoryID']){
+ $sql = $sql . "lastcategoryupdate='" . date('Y-m-d') . "', ";
+ }
+ $sql = $sql . "units='" . $_POST['Units'] . "',
mbflag='" . $_POST['MBFlag'] . "',
eoq='" . filter_number_format($_POST['EOQ']) . "',
volume='" . filter_number_format($_POST['Volume']) . "',
@@ -507,8 +512,9 @@
DB_Txn_Commit($db);
prnMsg( _('Stock Item') . ' ' . $StockID . ' ' . _('has been updated'), 'success');
echo '<br />';
- }
+ }
+
} else { //it is a NEW part
//but lets be really sure here
$result = DB_query("SELECT stockid
@@ -522,6 +528,7 @@
description,
longdescription,
categoryid,
+ lastcategoryupdate,
units,
mbflag,
eoq,
@@ -541,6 +548,7 @@
'" . $_POST['Description'] . "',
'" . $_POST['LongDescription'] . "',
'" . $_POST['CategoryID'] . "',
+ '" . date('Y-m-d') . "',
'" . $_POST['Units'] . "',
'" . $_POST['MBFlag'] . "',
'" . filter_number_format($_POST['EOQ']) . "',
Modified: trunk/sql/mysql/upgrade4.07-4.08.sql
===================================================================
--- trunk/sql/mysql/upgrade4.07-4.08.sql 2012-06-09 02:51:01 UTC (rev 5431)
+++ trunk/sql/mysql/upgrade4.07-4.08.sql 2012-06-09 03:18:36 UTC (rev 5432)
@@ -122,5 +122,7 @@
INSERT INTO scripts (script, pagesecurity, description) VALUES ('NoSalesItems.php', '2', 'Shows the No Selling (worst) items');
+ALTER TABLE stockmaster ADD lastcategoryupdate DATE NOT NULL DEFAULT '0000-00-00' AFTER categoryid;
+
UPDATE config SET confvalue='4.08' WHERE confname='VersionNumber';
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|