From: <Ex...@us...> - 2012-02-15 04:46:25
|
Revision: 4899 http://web-erp.svn.sourceforge.net/web-erp/?rev=4899&view=rev Author: ExsonQu Date: 2012-02-15 04:46:19 +0000 (Wed, 15 Feb 2012) Log Message: ----------- Fix bug that missing GLtrans records while directly input stock Code while do stock adjustment and round amount for gltrans and add EnsureGLEntriesBalance check. Modified Paths: -------------- trunk/StockAdjustments.php Modified: trunk/StockAdjustments.php =================================================================== --- trunk/StockAdjustments.php 2012-02-14 20:40:12 UTC (rev 4898) +++ trunk/StockAdjustments.php 2012-02-15 04:46:19 UTC (rev 4899) @@ -49,6 +49,36 @@ $_SESSION['Adjustment']->StockID = trim(mb_strtoupper($_POST['StockID'])); $StockID = trim(mb_strtoupper($_POST['StockID'])); } + //Get item data + $result = DB_query("SELECT description, + controlled, + serialised, + decimalplaces, + perishable + FROM stockmaster + WHERE stockid=' " . $_SESSION['Adjustment']->StockID . "'",$db); + $myrow = DB_fetch_array($result); + $_SESSION['Adjustment']->ItemDescription = $myrow['description']; + $_SESSION['Adjustment']->Controlled = $myrow['controlled']; + $_SESSION['Adjustment']->Serialised = $myrow['serialised']; + $_SESSION['Adjustment']->DecimalPlaces = $myrow['decimalplaces']; + DB_free_result($result); + + $sql="SELECT materialcost, + labourcost, + overheadcost, + units, + decimalplaces + FROM stockmaster + WHERE stockid='".$_SESSION['Adjustment']->StockID . "'"; + + $result=DB_query($sql, $db); + $myrow=DB_fetch_array($result); + $_SESSION['Adjustment']->PartUnit=$myrow['units']; + $_SESSION['Adjustment']->StandardCost=$myrow['materialcost']+$myrow['labourcost']+$myrow['overheadcost']; + $DecimalPlaces = $myrow['decimalplaces']; + DB_free_result($result); + $_SESSION['Adjustment']->tag = $_POST['tag']; $_SESSION['Adjustment']->Narrative = $_POST['Narrative']; $_SESSION['Adjustment']->StockLocation = $_POST['StockLocation']; @@ -272,7 +302,7 @@ '" . $SQLAdjustmentDate . "', '" . $PeriodNo . "', '" . $StockGLCodes['adjglact'] . "', - '" . $_SESSION['Adjustment']->StandardCost * -($_SESSION['Adjustment']->Quantity) . "', + '" . round($_SESSION['Adjustment']->StandardCost * -($_SESSION['Adjustment']->Quantity), $_SESSION['CompanyRecord']['decimalplaces']) . "', '" . $_SESSION['Adjustment']->StockID . " x " . $_SESSION['Adjustment']->Quantity . " @ " . $_SESSION['Adjustment']->StandardCost . " " . $_SESSION['Adjustment']->Narrative . "', '" . $_SESSION['Adjustment']->tag . "' @@ -295,7 +325,7 @@ '" . $SQLAdjustmentDate . "', '" . $PeriodNo . "', '" . $StockGLCodes['stockact'] . "', - '" . $_SESSION['Adjustment']->StandardCost * $_SESSION['Adjustment']->Quantity . "', + '" . round($_SESSION['Adjustment']->StandardCost * $_SESSION['Adjustment']->Quantity,$_SESSION['CompanyRecord']['decimalplaces']) . "', '" . $_SESSION['Adjustment']->StockID . " x " . $_SESSION['Adjustment']->Quantity . " @ " . $_SESSION['Adjustment']->StandardCost . " " . $_SESSION['Adjustment']->Narrative . "', '" . $_SESSION['Adjustment']->tag . "' )"; @@ -304,6 +334,8 @@ $DbgMsg = _('The following SQL to insert the GL entries was used'); $Result = DB_query($SQL,$db, $ErrMsg, $DbgMsg,true); } + + EnsureGLEntriesBalance(17, $AdjustmentNumber,$db); $Result = DB_Txn_Commit($db); @@ -334,7 +366,6 @@ $StockID = $_SESSION['Adjustment']->StockID; $Controlled = $_SESSION['Adjustment']->Controlled; $Quantity = $_SESSION['Adjustment']->Quantity; - $sql="SELECT materialcost, labourcost, overheadcost, This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <Ex...@us...> - 2012-02-15 04:46:26
|
Revision: 4899 http://web-erp.svn.sourceforge.net/web-erp/?rev=4899&view=rev Author: ExsonQu Date: 2012-02-15 04:46:19 +0000 (Wed, 15 Feb 2012) Log Message: ----------- Fix bug that missing GLtrans records while directly input stock Code while do stock adjustment and round amount for gltrans and add EnsureGLEntriesBalance check. Modified Paths: -------------- trunk/StockAdjustments.php Modified: trunk/StockAdjustments.php =================================================================== --- trunk/StockAdjustments.php 2012-02-14 20:40:12 UTC (rev 4898) +++ trunk/StockAdjustments.php 2012-02-15 04:46:19 UTC (rev 4899) @@ -49,6 +49,36 @@ $_SESSION['Adjustment']->StockID = trim(mb_strtoupper($_POST['StockID'])); $StockID = trim(mb_strtoupper($_POST['StockID'])); } + //Get item data + $result = DB_query("SELECT description, + controlled, + serialised, + decimalplaces, + perishable + FROM stockmaster + WHERE stockid=' " . $_SESSION['Adjustment']->StockID . "'",$db); + $myrow = DB_fetch_array($result); + $_SESSION['Adjustment']->ItemDescription = $myrow['description']; + $_SESSION['Adjustment']->Controlled = $myrow['controlled']; + $_SESSION['Adjustment']->Serialised = $myrow['serialised']; + $_SESSION['Adjustment']->DecimalPlaces = $myrow['decimalplaces']; + DB_free_result($result); + + $sql="SELECT materialcost, + labourcost, + overheadcost, + units, + decimalplaces + FROM stockmaster + WHERE stockid='".$_SESSION['Adjustment']->StockID . "'"; + + $result=DB_query($sql, $db); + $myrow=DB_fetch_array($result); + $_SESSION['Adjustment']->PartUnit=$myrow['units']; + $_SESSION['Adjustment']->StandardCost=$myrow['materialcost']+$myrow['labourcost']+$myrow['overheadcost']; + $DecimalPlaces = $myrow['decimalplaces']; + DB_free_result($result); + $_SESSION['Adjustment']->tag = $_POST['tag']; $_SESSION['Adjustment']->Narrative = $_POST['Narrative']; $_SESSION['Adjustment']->StockLocation = $_POST['StockLocation']; @@ -272,7 +302,7 @@ '" . $SQLAdjustmentDate . "', '" . $PeriodNo . "', '" . $StockGLCodes['adjglact'] . "', - '" . $_SESSION['Adjustment']->StandardCost * -($_SESSION['Adjustment']->Quantity) . "', + '" . round($_SESSION['Adjustment']->StandardCost * -($_SESSION['Adjustment']->Quantity), $_SESSION['CompanyRecord']['decimalplaces']) . "', '" . $_SESSION['Adjustment']->StockID . " x " . $_SESSION['Adjustment']->Quantity . " @ " . $_SESSION['Adjustment']->StandardCost . " " . $_SESSION['Adjustment']->Narrative . "', '" . $_SESSION['Adjustment']->tag . "' @@ -295,7 +325,7 @@ '" . $SQLAdjustmentDate . "', '" . $PeriodNo . "', '" . $StockGLCodes['stockact'] . "', - '" . $_SESSION['Adjustment']->StandardCost * $_SESSION['Adjustment']->Quantity . "', + '" . round($_SESSION['Adjustment']->StandardCost * $_SESSION['Adjustment']->Quantity,$_SESSION['CompanyRecord']['decimalplaces']) . "', '" . $_SESSION['Adjustment']->StockID . " x " . $_SESSION['Adjustment']->Quantity . " @ " . $_SESSION['Adjustment']->StandardCost . " " . $_SESSION['Adjustment']->Narrative . "', '" . $_SESSION['Adjustment']->tag . "' )"; @@ -304,6 +334,8 @@ $DbgMsg = _('The following SQL to insert the GL entries was used'); $Result = DB_query($SQL,$db, $ErrMsg, $DbgMsg,true); } + + EnsureGLEntriesBalance(17, $AdjustmentNumber,$db); $Result = DB_Txn_Commit($db); @@ -334,7 +366,6 @@ $StockID = $_SESSION['Adjustment']->StockID; $Controlled = $_SESSION['Adjustment']->Controlled; $Quantity = $_SESSION['Adjustment']->Quantity; - $sql="SELECT materialcost, labourcost, overheadcost, This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dai...@us...> - 2012-02-20 09:46:05
|
Revision: 4936 http://web-erp.svn.sourceforge.net/web-erp/?rev=4936&view=rev Author: daintree Date: 2012-02-20 09:45:54 +0000 (Mon, 20 Feb 2012) Log Message: ----------- review Modified Paths: -------------- trunk/StockAdjustments.php Modified: trunk/StockAdjustments.php =================================================================== --- trunk/StockAdjustments.php 2012-02-20 09:24:43 UTC (rev 4935) +++ trunk/StockAdjustments.php 2012-02-20 09:45:54 UTC (rev 4936) @@ -10,83 +10,79 @@ include('includes/header.inc'); include('includes/SQL_CommonFunctions.inc'); +if (empty($_GET['identifier'])) { + /*unique session identifier to ensure that there is no conflict with other adjustment sessions on the same machine */ + $identifier=date('U'); +} else { + $identifier=$_GET['identifier']; +} + if (isset($_GET['NewAdjustment'])){ - unset($_SESSION['Adjustment']); - $_SESSION['Adjustment'] = new StockAdjustment(); + unset($_SESSION['Adjustment' . $identifier]); + $_SESSION['Adjustment' . $identifier] = new StockAdjustment(); } -if (!isset($_SESSION['Adjustment'])){ - $_SESSION['Adjustment'] = new StockAdjustment(); +if (!isset($_SESSION['Adjustment' . $identifier])){ + $_SESSION['Adjustment' . $identifier] = new StockAdjustment(); } $NewAdjustment = false; if (isset($_GET['StockID'])){ + $NewAdjustment = true; $StockID = trim(mb_strtoupper($_GET['StockID'])); - $_SESSION['Adjustment']->StockID = trim(mb_strtoupper($StockID)); +} elseif (isset($_POST['StockID'])){ + if($_POST['StockID'] != $_SESSION['Adjustment' . $identifier]->StockID){ + $NewAdjustment = true; + $StockID = trim(mb_strtoupper($_POST['StockID'])); + } +} +if ($NewAdjustment==true){ + + $_SESSION['Adjustment' . $identifier]->StockID = trim(mb_strtoupper($StockID)); $result = DB_query("SELECT description, controlled, serialised, decimalplaces, - perishable + perishable, + materialcost+labourcost+overheadcost AS totalcost, + units FROM stockmaster - WHERE stockid='" . $_SESSION['Adjustment']->StockID . "'",$db); + WHERE stockid='" . $_SESSION['Adjustment' . $identifier]->StockID . "'",$db); $myrow = DB_fetch_array($result); - $_SESSION['Adjustment']->ItemDescription = $myrow['description']; - $_SESSION['Adjustment']->Controlled = $myrow['controlled']; - $_SESSION['Adjustment']->Serialised = $myrow['serialised']; - $_SESSION['Adjustment']->DecimalPlaces = $myrow['decimalplaces']; - $_SESSION['Adjustment']->SerialItems = array(); - if (!isset($_SESSION['Adjustment']->Quantity) OR !is_numeric($_SESSION['Adjustment']->Quantity)){ - $_SESSION['Adjustment']->Quantity=0; + $_SESSION['Adjustment' . $identifier]->ItemDescription = $myrow['description']; + $_SESSION['Adjustment' . $identifier]->Controlled = $myrow['controlled']; + $_SESSION['Adjustment' . $identifier]->Serialised = $myrow['serialised']; + $_SESSION['Adjustment' . $identifier]->DecimalPlaces = $myrow['decimalplaces']; + $_SESSION['Adjustment' . $identifier]->SerialItems = array(); + if (!isset($_SESSION['Adjustment' . $identifier]->Quantity) OR !is_numeric($_SESSION['Adjustment' . $identifier]->Quantity)){ + $_SESSION['Adjustment' . $identifier]->Quantity=0; } - $NewAdjustment = true; -} elseif (isset($_POST['StockID'])){ - if(isset($_POST['StockID']) - AND $_POST['StockID'] != $_SESSION['Adjustment']->StockID){ - - $NewAdjustment = true; - $_SESSION['Adjustment']->StockID = trim(mb_strtoupper($_POST['StockID'])); - $StockID = trim(mb_strtoupper($_POST['StockID'])); - } - //Get item data - $result = DB_query("SELECT description, - controlled, - serialised, - decimalplaces, - perishable - FROM stockmaster - WHERE stockid=' " . $_SESSION['Adjustment']->StockID . "'",$db); - $myrow = DB_fetch_array($result); - $_SESSION['Adjustment']->ItemDescription = $myrow['description']; - $_SESSION['Adjustment']->Controlled = $myrow['controlled']; - $_SESSION['Adjustment']->Serialised = $myrow['serialised']; - $_SESSION['Adjustment']->DecimalPlaces = $myrow['decimalplaces']; - DB_free_result($result); - $sql="SELECT materialcost, - labourcost, - overheadcost, - units, - decimalplaces - FROM stockmaster - WHERE stockid='".$_SESSION['Adjustment']->StockID . "'"; - - $result=DB_query($sql, $db); - $myrow=DB_fetch_array($result); - $_SESSION['Adjustment']->PartUnit=$myrow['units']; - $_SESSION['Adjustment']->StandardCost=$myrow['materialcost']+$myrow['labourcost']+$myrow['overheadcost']; + $_SESSION['Adjustment' . $identifier]->PartUnit=$myrow['units']; + $_SESSION['Adjustment' . $identifier]->StandardCost=$myrow['totalcost']; $DecimalPlaces = $myrow['decimalplaces']; DB_free_result($result); - $_SESSION['Adjustment']->tag = $_POST['tag']; - $_SESSION['Adjustment']->Narrative = $_POST['Narrative']; - $_SESSION['Adjustment']->StockLocation = $_POST['StockLocation']; + +} //end if it's a new adjustment +if (isset($_POST['tag'])){ + $_SESSION['Adjustment' . $identifier]->tag = $_POST['tag']; +} +if (isset($_POST['Narrative'])){ + $_SESSION['Adjustment' . $identifier]->Narrative = $_POST['Narrative']; +} +if (isset($_POST['StockLocation'])){ + $_SESSION['Adjustment' . $identifier]->StockLocation = $_POST['StockLocation']; +} +if (isset($_POST['Quantity'])){ if ($_POST['Quantity']=='' OR !is_numeric(filter_number_format($_POST['Quantity']))){ $_POST['Quantity']=0; } - $_SESSION['Adjustment']->Quantity = filter_number_format($_POST['Quantity']); +} else { + $_POST['Quantity']=0; } +$_SESSION['Adjustment' . $identifier]->Quantity = filter_number_format($_POST['Quantity']); echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/supplier.png" title="' . _('Inventory Adjustment') . '" alt="" />' . ' ' . _('Inventory Adjustment') . '</p>'; @@ -128,29 +124,29 @@ if (isset($_POST['EnterAdjustment']) AND $_POST['EnterAdjustment']!= ''){ $InputError = false; /*Start by hoping for the best */ - $result = DB_query("SELECT * FROM stockmaster WHERE stockid='" . $_SESSION['Adjustment']->StockID . "'",$db); + $result = DB_query("SELECT * FROM stockmaster WHERE stockid='" . $_SESSION['Adjustment' . $identifier]->StockID . "'",$db); $myrow = DB_fetch_row($result); if (DB_num_rows($result)==0) { prnMsg( _('The entered item code does not exist'),'error'); $InputError = true; - } elseif (!is_numeric($_SESSION['Adjustment']->Quantity)){ + } elseif (!is_numeric($_SESSION['Adjustment' . $identifier]->Quantity)){ prnMsg( _('The quantity entered must be numeric'),'error'); $InputError = true; - } elseif ($_SESSION['Adjustment']->Quantity==0){ + } elseif ($_SESSION['Adjustment' . $identifier]->Quantity==0){ prnMsg( _('The quantity entered cannot be zero') . '. ' . _('There would be no adjustment to make'),'error'); $InputError = true; - } elseif ($_SESSION['Adjustment']->Controlled==1 AND count($_SESSION['Adjustment']->SerialItems)==0) { + } elseif ($_SESSION['Adjustment' . $identifier]->Controlled==1 AND count($_SESSION['Adjustment' . $identifier]->SerialItems)==0) { prnMsg( _('The item entered is a controlled item that requires the detail of the serial numbers or batch references to be adjusted to be entered'),'error'); $InputError = true; } if ($_SESSION['ProhibitNegativeStock']==1){ $SQL = "SELECT quantity FROM locstock - WHERE stockid='" . $_SESSION['Adjustment']->StockID . "' - AND loccode='" . $_SESSION['Adjustment']->StockLocation . "'"; + WHERE stockid='" . $_SESSION['Adjustment' . $identifier]->StockID . "' + AND loccode='" . $_SESSION['Adjustment' . $identifier]->StockLocation . "'"; $CheckNegResult=DB_query($SQL,$db); $CheckNegRow = DB_fetch_array($CheckNegResult); - if ($CheckNegRow['quantity']+$_SESSION['Adjustment']->Quantity <0){ + if ($CheckNegRow['quantity']+$_SESSION['Adjustment' . $identifier]->Quantity <0){ $InputError=true; prnMsg(_('The system parameters are set to prohibit negative stocks. Processing this stock adjustment would result in negative stock at this location. This adjustment will not be processed.'),'error'); } @@ -169,8 +165,8 @@ // Need to get the current location quantity will need it later for the stock movement $SQL="SELECT locstock.quantity FROM locstock - WHERE locstock.stockid='" . $_SESSION['Adjustment']->StockID . "' - AND loccode= '" . $_SESSION['Adjustment']->StockLocation . "'"; + WHERE locstock.stockid='" . $_SESSION['Adjustment' . $identifier]->StockID . "' + AND loccode= '" . $_SESSION['Adjustment' . $identifier]->StockLocation . "'"; $Result = DB_query($SQL, $db); if (DB_num_rows($Result)==1){ $LocQtyRow = DB_fetch_row($Result); @@ -190,15 +186,15 @@ qty, newqoh) VALUES ( - '" . $_SESSION['Adjustment']->StockID . "', + '" . $_SESSION['Adjustment' . $identifier]->StockID . "', 17, '" . $AdjustmentNumber . "', - '" . $_SESSION['Adjustment']->StockLocation . "', + '" . $_SESSION['Adjustment' . $identifier]->StockLocation . "', '" . $SQLAdjustmentDate . "', '" . $PeriodNo . "', - '" . $_SESSION['Adjustment']->Narrative ."', - '" . $_SESSION['Adjustment']->Quantity . "', - '" . ($QtyOnHandPrior + $_SESSION['Adjustment']->Quantity) . "' + '" . $_SESSION['Adjustment' . $identifier]->Narrative ."', + '" . $_SESSION['Adjustment' . $identifier]->Quantity . "', + '" . ($QtyOnHandPrior + $_SESSION['Adjustment' . $identifier]->Quantity) . "' )"; @@ -211,16 +207,16 @@ /*Insert the StockSerialMovements and update the StockSerialItems for controlled items*/ - if ($_SESSION['Adjustment']->Controlled ==1){ - foreach($_SESSION['Adjustment']->SerialItems as $Item){ + if ($_SESSION['Adjustment' . $identifier]->Controlled ==1){ + foreach($_SESSION['Adjustment' . $identifier]->SerialItems as $Item){ /*We need to add or update the StockSerialItem record and The StockSerialMoves as well */ /*First need to check if the serial items already exists or not */ $SQL = "SELECT COUNT(*) FROM stockserialitems - WHERE stockid='" . $_SESSION['Adjustment']->StockID . "' - AND loccode='" . $_SESSION['Adjustment']->StockLocation . "' + WHERE stockid='" . $_SESSION['Adjustment' . $identifier]->StockID . "' + AND loccode='" . $_SESSION['Adjustment' . $identifier]->StockLocation . "' AND serialno='" . $Item->BundleRef . "'"; $ErrMsg = _('Unable to determine if the serial item exists'); $Result = DB_query($SQL,$db,$ErrMsg); @@ -229,8 +225,8 @@ if ($SerialItemExistsRow[0]==1){ $SQL = "UPDATE stockserialitems SET quantity= quantity + " . $Item->BundleQty . " - WHERE stockid='" . $_SESSION['Adjustment']->StockID . "' - AND loccode='" . $_SESSION['Adjustment']->StockLocation . "' + WHERE stockid='" . $_SESSION['Adjustment' . $identifier]->StockID . "' + AND loccode='" . $_SESSION['Adjustment' . $identifier]->StockLocation . "' AND serialno='" . $Item->BundleRef . "'"; $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The serial stock item record could not be updated because'); @@ -244,8 +240,8 @@ qualitytext, quantity, expirationdate) - VALUES ('" . $_SESSION['Adjustment']->StockID . "', - '" . $_SESSION['Adjustment']->StockLocation . "', + VALUES ('" . $_SESSION['Adjustment' . $identifier]->StockID . "', + '" . $_SESSION['Adjustment' . $identifier]->StockLocation . "', '" . $Item->BundleRef . "', '', '" . $Item->BundleQty . "', @@ -264,7 +260,7 @@ serialno, moveqty) VALUES ('" . $StkMoveNo . "', - '" . $_SESSION['Adjustment']->StockID . "', + '" . $_SESSION['Adjustment' . $identifier]->StockID . "', '" . $Item->BundleRef . "', '" . $Item->BundleQty . "')"; $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The serial stock movement record could not be inserted because'); @@ -276,18 +272,18 @@ - $SQL = "UPDATE locstock SET quantity = quantity + '" . $_SESSION['Adjustment']->Quantity . "' - WHERE stockid='" . $_SESSION['Adjustment']->StockID . "' - AND loccode='" . $_SESSION['Adjustment']->StockLocation . "'"; + $SQL = "UPDATE locstock SET quantity = quantity + '" . $_SESSION['Adjustment' . $identifier]->Quantity . "' + WHERE stockid='" . $_SESSION['Adjustment' . $identifier]->StockID . "' + AND loccode='" . $_SESSION['Adjustment' . $identifier]->StockLocation . "'"; $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' ._('The location stock record could not be updated because'); $DbgMsg = _('The following SQL to update the stock record was used'); $Result = DB_query($SQL, $db, $ErrMsg, $DbgMsg, true); - if ($_SESSION['CompanyRecord']['gllink_stock']==1 AND $_SESSION['Adjustment']->StandardCost > 0){ + if ($_SESSION['CompanyRecord']['gllink_stock']==1 AND $_SESSION['Adjustment' . $identifier]->StandardCost > 0){ - $StockGLCodes = GetStockGLCode($_SESSION['Adjustment']->StockID,$db); + $StockGLCodes = GetStockGLCode($_SESSION['Adjustment' . $identifier]->StockID,$db); $SQL = "INSERT INTO gltrans (type, typeno, @@ -302,10 +298,10 @@ '" . $SQLAdjustmentDate . "', '" . $PeriodNo . "', '" . $StockGLCodes['adjglact'] . "', - '" . round($_SESSION['Adjustment']->StandardCost * -($_SESSION['Adjustment']->Quantity), $_SESSION['CompanyRecord']['decimalplaces']) . "', - '" . $_SESSION['Adjustment']->StockID . " x " . $_SESSION['Adjustment']->Quantity . " @ " . - $_SESSION['Adjustment']->StandardCost . " " . $_SESSION['Adjustment']->Narrative . "', - '" . $_SESSION['Adjustment']->tag . "' + '" . round($_SESSION['Adjustment' . $identifier]->StandardCost * -($_SESSION['Adjustment' . $identifier]->Quantity), $_SESSION['CompanyRecord']['decimalplaces']) . "', + '" . $_SESSION['Adjustment' . $identifier]->StockID . " x " . $_SESSION['Adjustment' . $identifier]->Quantity . " @ " . + $_SESSION['Adjustment' . $identifier]->StandardCost . " " . $_SESSION['Adjustment' . $identifier]->Narrative . "', + '" . $_SESSION['Adjustment' . $identifier]->tag . "' )"; $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The general ledger transaction entries could not be added because'); @@ -325,9 +321,9 @@ '" . $SQLAdjustmentDate . "', '" . $PeriodNo . "', '" . $StockGLCodes['stockact'] . "', - '" . round($_SESSION['Adjustment']->StandardCost * $_SESSION['Adjustment']->Quantity,$_SESSION['CompanyRecord']['decimalplaces']) . "', - '" . $_SESSION['Adjustment']->StockID . " x " . $_SESSION['Adjustment']->Quantity . " @ " . $_SESSION['Adjustment']->StandardCost . " " . $_SESSION['Adjustment']->Narrative . "', - '" . $_SESSION['Adjustment']->tag . "' + '" . round($_SESSION['Adjustment' . $identifier]->StandardCost * $_SESSION['Adjustment' . $identifier]->Quantity,$_SESSION['CompanyRecord']['decimalplaces']) . "', + '" . $_SESSION['Adjustment' . $identifier]->StockID . " x " . $_SESSION['Adjustment' . $identifier]->Quantity . " @ " . $_SESSION['Adjustment' . $identifier]->StandardCost . " " . $_SESSION['Adjustment' . $identifier]->Narrative . "', + '" . $_SESSION['Adjustment' . $identifier]->tag . "' )"; $Errmsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The general ledger transaction entries could not be added because'); @@ -339,16 +335,16 @@ $Result = DB_Txn_Commit($db); - $ConfirmationText = _('A stock adjustment for'). ' ' . $_SESSION['Adjustment']->StockID . ' - ' . $_SESSION['Adjustment']->ItemDescription . ' '._('has been created from location').' ' . $_SESSION['Adjustment']->StockLocation .' '. _('for a quantity of') . ' ' . locale_number_format($_SESSION['Adjustment']->Quantity,$_SESSION['Adjustment']->DecimalPlaces) ; + $ConfirmationText = _('A stock adjustment for'). ' ' . $_SESSION['Adjustment' . $identifier]->StockID . ' - ' . $_SESSION['Adjustment' . $identifier]->ItemDescription . ' '._('has been created from location').' ' . $_SESSION['Adjustment' . $identifier]->StockLocation .' '. _('for a quantity of') . ' ' . locale_number_format($_SESSION['Adjustment' . $identifier]->Quantity,$_SESSION['Adjustment' . $identifier]->DecimalPlaces) ; prnMsg( $ConfirmationText,'success'); if ($_SESSION['InventoryManagerEmail']!=''){ $ConfirmationText = $ConfirmationText . ' ' . _('by user') . ' ' . $_SESSION['UserID'] . ' ' . _('at') . ' ' . Date('Y-m-d H:i:s'); - $EmailSubject = _('Stock adjustment for'). ' ' . $_SESSION['Adjustment']->StockID; + $EmailSubject = _('Stock adjustment for'). ' ' . $_SESSION['Adjustment' . $identifier]->StockID; mail($_SESSION['InventoryManagerEmail'],$EmailSubject,$ConfirmationText); } - unset ($_SESSION['Adjustment']); + unset ($_SESSION['Adjustment' . $identifier]); } /* end if there was no input error */ }/* end if the user hit enter the adjustment */ @@ -357,15 +353,15 @@ echo '<form action="'. htmlspecialchars($_SERVER['PHP_SELF']) . '" method=post>'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; -if (!isset($_SESSION['Adjustment'])) { +if (!isset($_SESSION['Adjustment' . $identifier])) { $StockID=''; $Controlled= 0; $Quantity = 0; $DecimalPlaces =2; } else { - $StockID = $_SESSION['Adjustment']->StockID; - $Controlled = $_SESSION['Adjustment']->Controlled; - $Quantity = $_SESSION['Adjustment']->Quantity; + $StockID = $_SESSION['Adjustment' . $identifier]->StockID; + $Controlled = $_SESSION['Adjustment' . $identifier]->Controlled; + $Quantity = $_SESSION['Adjustment' . $identifier]->Quantity; $sql="SELECT materialcost, labourcost, overheadcost, @@ -376,8 +372,8 @@ $result=DB_query($sql, $db); $myrow=DB_fetch_array($result); - $_SESSION['Adjustment']->PartUnit=$myrow['units']; - $_SESSION['Adjustment']->StandardCost=$myrow['materialcost']+$myrow['labourcost']+$myrow['overheadcost']; + $_SESSION['Adjustment' . $identifier]->PartUnit=$myrow['units']; + $_SESSION['Adjustment' . $identifier]->StandardCost=$myrow['materialcost']+$myrow['labourcost']+$myrow['overheadcost']; $DecimalPlaces = $myrow['decimalplaces']; } echo '<br /> @@ -406,9 +402,9 @@ echo '</td> <td><input type="submit" name="CheckCode" value="'._('Check Part').'" /></td> </tr>'; -if (isset($_SESSION['Adjustment']) AND mb_strlen($_SESSION['Adjustment']->ItemDescription)>1){ +if (isset($_SESSION['Adjustment' . $identifier]) AND mb_strlen($_SESSION['Adjustment' . $identifier]->ItemDescription)>1){ echo '<tr> - <td colspan="3"><font color="blue" size="3">' . $_SESSION['Adjustment']->ItemDescription . ' ('._('In Units of').' ' . $_SESSION['Adjustment']->PartUnit . ' ) - ' . _('Unit Cost').' = ' . locale_number_format($_SESSION['Adjustment']->StandardCost,4) . '</font></td> + <td colspan="3"><font color="blue" size="3">' . $_SESSION['Adjustment' . $identifier]->ItemDescription . ' ('._('In Units of').' ' . $_SESSION['Adjustment' . $identifier]->PartUnit . ' ) - ' . _('Unit Cost').' = ' . locale_number_format($_SESSION['Adjustment' . $identifier]->StandardCost,4) . '</font></td> </tr>'; } @@ -418,8 +414,8 @@ $sql = "SELECT loccode, locationname FROM locations"; $resultStkLocs = DB_query($sql,$db); while ($myrow=DB_fetch_array($resultStkLocs)){ - if (isset($_SESSION['Adjustment']->StockLocation)){ - if ($myrow['loccode'] == $_SESSION['Adjustment']->StockLocation){ + if (isset($_SESSION['Adjustment' . $identifier]->StockLocation)){ + if ($myrow['loccode'] == $_SESSION['Adjustment' . $identifier]->StockLocation){ echo '<option selected="selected" value="' . $myrow['loccode'] . '">' . $myrow['locationname'] . '</option>'; } else { echo '<option value="' . $myrow['loccode'] . '">' . $myrow['locationname'] . '</option>'; @@ -433,8 +429,8 @@ } echo '</select></td></tr>'; -if (isset($_SESSION['Adjustment']) AND !isset($_SESSION['Adjustment']->Narrative)) { - $_SESSION['Adjustment']->Narrative = ''; +if (isset($_SESSION['Adjustment' . $identifier]) AND !isset($_SESSION['Adjustment' . $identifier]->Narrative)) { + $_SESSION['Adjustment' . $identifier]->Narrative = ''; $Narrative =''; } else { $Narrative =''; @@ -449,11 +445,11 @@ echo '<td>'; if ($Controlled==1){ - if ($_SESSION['Adjustment']->StockLocation == ''){ - $_SESSION['Adjustment']->StockLocation = $_SESSION['UserStockLocation']; + if ($_SESSION['Adjustment' . $identifier]->StockLocation == ''){ + $_SESSION['Adjustment' . $identifier]->StockLocation = $_SESSION['UserStockLocation']; } - echo '<input type="hidden" name="Quantity" value="' . $_SESSION['Adjustment']->Quantity . '" /> - '.locale_number_format($_SESSION['Adjustment']->Quantity,$DecimalPlaces) .' + echo '<input type="hidden" name="Quantity" value="' . $_SESSION['Adjustment' . $identifier]->Quantity . '" /> + '.locale_number_format($_SESSION['Adjustment' . $identifier]->Quantity,$DecimalPlaces) .' [<a href="'.$rootpath.'/StockAdjustmentsControlled.php?AdjType=REMOVE">'._('Remove').'</a>] [<a href="'.$rootpath.'/StockAdjustmentsControlled.php?AdjType=ADD">'._('Add').'</a>]'; } else { @@ -473,7 +469,7 @@ $result=DB_query($SQL,$db); echo '<option value="0">0 - ' . _('None') . '</option>'; while ($myrow=DB_fetch_array($result)){ - if (isset($_SESSION['Adjustment']->tag) AND $_SESSION['Adjustment']->tag==$myrow['tagref']){ + if (isset($_SESSION['Adjustment' . $identifier]->tag) AND $_SESSION['Adjustment' . $identifier]->tag==$myrow['tagref']){ echo '<option selected="selected" value="' . $myrow['tagref'] . '">' . $myrow['tagref'].' - ' .$myrow['tagdescription'] . '</option>'; } else { echo '<option value="' . $myrow['tagref'] . '">' . $myrow['tagref'].' - ' .$myrow['tagdescription']. '</option>'; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dai...@us...> - 2012-02-20 09:46:06
|
Revision: 4936 http://web-erp.svn.sourceforge.net/web-erp/?rev=4936&view=rev Author: daintree Date: 2012-02-20 09:45:54 +0000 (Mon, 20 Feb 2012) Log Message: ----------- review Modified Paths: -------------- trunk/StockAdjustments.php Modified: trunk/StockAdjustments.php =================================================================== --- trunk/StockAdjustments.php 2012-02-20 09:24:43 UTC (rev 4935) +++ trunk/StockAdjustments.php 2012-02-20 09:45:54 UTC (rev 4936) @@ -10,83 +10,79 @@ include('includes/header.inc'); include('includes/SQL_CommonFunctions.inc'); +if (empty($_GET['identifier'])) { + /*unique session identifier to ensure that there is no conflict with other adjustment sessions on the same machine */ + $identifier=date('U'); +} else { + $identifier=$_GET['identifier']; +} + if (isset($_GET['NewAdjustment'])){ - unset($_SESSION['Adjustment']); - $_SESSION['Adjustment'] = new StockAdjustment(); + unset($_SESSION['Adjustment' . $identifier]); + $_SESSION['Adjustment' . $identifier] = new StockAdjustment(); } -if (!isset($_SESSION['Adjustment'])){ - $_SESSION['Adjustment'] = new StockAdjustment(); +if (!isset($_SESSION['Adjustment' . $identifier])){ + $_SESSION['Adjustment' . $identifier] = new StockAdjustment(); } $NewAdjustment = false; if (isset($_GET['StockID'])){ + $NewAdjustment = true; $StockID = trim(mb_strtoupper($_GET['StockID'])); - $_SESSION['Adjustment']->StockID = trim(mb_strtoupper($StockID)); +} elseif (isset($_POST['StockID'])){ + if($_POST['StockID'] != $_SESSION['Adjustment' . $identifier]->StockID){ + $NewAdjustment = true; + $StockID = trim(mb_strtoupper($_POST['StockID'])); + } +} +if ($NewAdjustment==true){ + + $_SESSION['Adjustment' . $identifier]->StockID = trim(mb_strtoupper($StockID)); $result = DB_query("SELECT description, controlled, serialised, decimalplaces, - perishable + perishable, + materialcost+labourcost+overheadcost AS totalcost, + units FROM stockmaster - WHERE stockid='" . $_SESSION['Adjustment']->StockID . "'",$db); + WHERE stockid='" . $_SESSION['Adjustment' . $identifier]->StockID . "'",$db); $myrow = DB_fetch_array($result); - $_SESSION['Adjustment']->ItemDescription = $myrow['description']; - $_SESSION['Adjustment']->Controlled = $myrow['controlled']; - $_SESSION['Adjustment']->Serialised = $myrow['serialised']; - $_SESSION['Adjustment']->DecimalPlaces = $myrow['decimalplaces']; - $_SESSION['Adjustment']->SerialItems = array(); - if (!isset($_SESSION['Adjustment']->Quantity) OR !is_numeric($_SESSION['Adjustment']->Quantity)){ - $_SESSION['Adjustment']->Quantity=0; + $_SESSION['Adjustment' . $identifier]->ItemDescription = $myrow['description']; + $_SESSION['Adjustment' . $identifier]->Controlled = $myrow['controlled']; + $_SESSION['Adjustment' . $identifier]->Serialised = $myrow['serialised']; + $_SESSION['Adjustment' . $identifier]->DecimalPlaces = $myrow['decimalplaces']; + $_SESSION['Adjustment' . $identifier]->SerialItems = array(); + if (!isset($_SESSION['Adjustment' . $identifier]->Quantity) OR !is_numeric($_SESSION['Adjustment' . $identifier]->Quantity)){ + $_SESSION['Adjustment' . $identifier]->Quantity=0; } - $NewAdjustment = true; -} elseif (isset($_POST['StockID'])){ - if(isset($_POST['StockID']) - AND $_POST['StockID'] != $_SESSION['Adjustment']->StockID){ - - $NewAdjustment = true; - $_SESSION['Adjustment']->StockID = trim(mb_strtoupper($_POST['StockID'])); - $StockID = trim(mb_strtoupper($_POST['StockID'])); - } - //Get item data - $result = DB_query("SELECT description, - controlled, - serialised, - decimalplaces, - perishable - FROM stockmaster - WHERE stockid=' " . $_SESSION['Adjustment']->StockID . "'",$db); - $myrow = DB_fetch_array($result); - $_SESSION['Adjustment']->ItemDescription = $myrow['description']; - $_SESSION['Adjustment']->Controlled = $myrow['controlled']; - $_SESSION['Adjustment']->Serialised = $myrow['serialised']; - $_SESSION['Adjustment']->DecimalPlaces = $myrow['decimalplaces']; - DB_free_result($result); - $sql="SELECT materialcost, - labourcost, - overheadcost, - units, - decimalplaces - FROM stockmaster - WHERE stockid='".$_SESSION['Adjustment']->StockID . "'"; - - $result=DB_query($sql, $db); - $myrow=DB_fetch_array($result); - $_SESSION['Adjustment']->PartUnit=$myrow['units']; - $_SESSION['Adjustment']->StandardCost=$myrow['materialcost']+$myrow['labourcost']+$myrow['overheadcost']; + $_SESSION['Adjustment' . $identifier]->PartUnit=$myrow['units']; + $_SESSION['Adjustment' . $identifier]->StandardCost=$myrow['totalcost']; $DecimalPlaces = $myrow['decimalplaces']; DB_free_result($result); - $_SESSION['Adjustment']->tag = $_POST['tag']; - $_SESSION['Adjustment']->Narrative = $_POST['Narrative']; - $_SESSION['Adjustment']->StockLocation = $_POST['StockLocation']; + +} //end if it's a new adjustment +if (isset($_POST['tag'])){ + $_SESSION['Adjustment' . $identifier]->tag = $_POST['tag']; +} +if (isset($_POST['Narrative'])){ + $_SESSION['Adjustment' . $identifier]->Narrative = $_POST['Narrative']; +} +if (isset($_POST['StockLocation'])){ + $_SESSION['Adjustment' . $identifier]->StockLocation = $_POST['StockLocation']; +} +if (isset($_POST['Quantity'])){ if ($_POST['Quantity']=='' OR !is_numeric(filter_number_format($_POST['Quantity']))){ $_POST['Quantity']=0; } - $_SESSION['Adjustment']->Quantity = filter_number_format($_POST['Quantity']); +} else { + $_POST['Quantity']=0; } +$_SESSION['Adjustment' . $identifier]->Quantity = filter_number_format($_POST['Quantity']); echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/supplier.png" title="' . _('Inventory Adjustment') . '" alt="" />' . ' ' . _('Inventory Adjustment') . '</p>'; @@ -128,29 +124,29 @@ if (isset($_POST['EnterAdjustment']) AND $_POST['EnterAdjustment']!= ''){ $InputError = false; /*Start by hoping for the best */ - $result = DB_query("SELECT * FROM stockmaster WHERE stockid='" . $_SESSION['Adjustment']->StockID . "'",$db); + $result = DB_query("SELECT * FROM stockmaster WHERE stockid='" . $_SESSION['Adjustment' . $identifier]->StockID . "'",$db); $myrow = DB_fetch_row($result); if (DB_num_rows($result)==0) { prnMsg( _('The entered item code does not exist'),'error'); $InputError = true; - } elseif (!is_numeric($_SESSION['Adjustment']->Quantity)){ + } elseif (!is_numeric($_SESSION['Adjustment' . $identifier]->Quantity)){ prnMsg( _('The quantity entered must be numeric'),'error'); $InputError = true; - } elseif ($_SESSION['Adjustment']->Quantity==0){ + } elseif ($_SESSION['Adjustment' . $identifier]->Quantity==0){ prnMsg( _('The quantity entered cannot be zero') . '. ' . _('There would be no adjustment to make'),'error'); $InputError = true; - } elseif ($_SESSION['Adjustment']->Controlled==1 AND count($_SESSION['Adjustment']->SerialItems)==0) { + } elseif ($_SESSION['Adjustment' . $identifier]->Controlled==1 AND count($_SESSION['Adjustment' . $identifier]->SerialItems)==0) { prnMsg( _('The item entered is a controlled item that requires the detail of the serial numbers or batch references to be adjusted to be entered'),'error'); $InputError = true; } if ($_SESSION['ProhibitNegativeStock']==1){ $SQL = "SELECT quantity FROM locstock - WHERE stockid='" . $_SESSION['Adjustment']->StockID . "' - AND loccode='" . $_SESSION['Adjustment']->StockLocation . "'"; + WHERE stockid='" . $_SESSION['Adjustment' . $identifier]->StockID . "' + AND loccode='" . $_SESSION['Adjustment' . $identifier]->StockLocation . "'"; $CheckNegResult=DB_query($SQL,$db); $CheckNegRow = DB_fetch_array($CheckNegResult); - if ($CheckNegRow['quantity']+$_SESSION['Adjustment']->Quantity <0){ + if ($CheckNegRow['quantity']+$_SESSION['Adjustment' . $identifier]->Quantity <0){ $InputError=true; prnMsg(_('The system parameters are set to prohibit negative stocks. Processing this stock adjustment would result in negative stock at this location. This adjustment will not be processed.'),'error'); } @@ -169,8 +165,8 @@ // Need to get the current location quantity will need it later for the stock movement $SQL="SELECT locstock.quantity FROM locstock - WHERE locstock.stockid='" . $_SESSION['Adjustment']->StockID . "' - AND loccode= '" . $_SESSION['Adjustment']->StockLocation . "'"; + WHERE locstock.stockid='" . $_SESSION['Adjustment' . $identifier]->StockID . "' + AND loccode= '" . $_SESSION['Adjustment' . $identifier]->StockLocation . "'"; $Result = DB_query($SQL, $db); if (DB_num_rows($Result)==1){ $LocQtyRow = DB_fetch_row($Result); @@ -190,15 +186,15 @@ qty, newqoh) VALUES ( - '" . $_SESSION['Adjustment']->StockID . "', + '" . $_SESSION['Adjustment' . $identifier]->StockID . "', 17, '" . $AdjustmentNumber . "', - '" . $_SESSION['Adjustment']->StockLocation . "', + '" . $_SESSION['Adjustment' . $identifier]->StockLocation . "', '" . $SQLAdjustmentDate . "', '" . $PeriodNo . "', - '" . $_SESSION['Adjustment']->Narrative ."', - '" . $_SESSION['Adjustment']->Quantity . "', - '" . ($QtyOnHandPrior + $_SESSION['Adjustment']->Quantity) . "' + '" . $_SESSION['Adjustment' . $identifier]->Narrative ."', + '" . $_SESSION['Adjustment' . $identifier]->Quantity . "', + '" . ($QtyOnHandPrior + $_SESSION['Adjustment' . $identifier]->Quantity) . "' )"; @@ -211,16 +207,16 @@ /*Insert the StockSerialMovements and update the StockSerialItems for controlled items*/ - if ($_SESSION['Adjustment']->Controlled ==1){ - foreach($_SESSION['Adjustment']->SerialItems as $Item){ + if ($_SESSION['Adjustment' . $identifier]->Controlled ==1){ + foreach($_SESSION['Adjustment' . $identifier]->SerialItems as $Item){ /*We need to add or update the StockSerialItem record and The StockSerialMoves as well */ /*First need to check if the serial items already exists or not */ $SQL = "SELECT COUNT(*) FROM stockserialitems - WHERE stockid='" . $_SESSION['Adjustment']->StockID . "' - AND loccode='" . $_SESSION['Adjustment']->StockLocation . "' + WHERE stockid='" . $_SESSION['Adjustment' . $identifier]->StockID . "' + AND loccode='" . $_SESSION['Adjustment' . $identifier]->StockLocation . "' AND serialno='" . $Item->BundleRef . "'"; $ErrMsg = _('Unable to determine if the serial item exists'); $Result = DB_query($SQL,$db,$ErrMsg); @@ -229,8 +225,8 @@ if ($SerialItemExistsRow[0]==1){ $SQL = "UPDATE stockserialitems SET quantity= quantity + " . $Item->BundleQty . " - WHERE stockid='" . $_SESSION['Adjustment']->StockID . "' - AND loccode='" . $_SESSION['Adjustment']->StockLocation . "' + WHERE stockid='" . $_SESSION['Adjustment' . $identifier]->StockID . "' + AND loccode='" . $_SESSION['Adjustment' . $identifier]->StockLocation . "' AND serialno='" . $Item->BundleRef . "'"; $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The serial stock item record could not be updated because'); @@ -244,8 +240,8 @@ qualitytext, quantity, expirationdate) - VALUES ('" . $_SESSION['Adjustment']->StockID . "', - '" . $_SESSION['Adjustment']->StockLocation . "', + VALUES ('" . $_SESSION['Adjustment' . $identifier]->StockID . "', + '" . $_SESSION['Adjustment' . $identifier]->StockLocation . "', '" . $Item->BundleRef . "', '', '" . $Item->BundleQty . "', @@ -264,7 +260,7 @@ serialno, moveqty) VALUES ('" . $StkMoveNo . "', - '" . $_SESSION['Adjustment']->StockID . "', + '" . $_SESSION['Adjustment' . $identifier]->StockID . "', '" . $Item->BundleRef . "', '" . $Item->BundleQty . "')"; $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The serial stock movement record could not be inserted because'); @@ -276,18 +272,18 @@ - $SQL = "UPDATE locstock SET quantity = quantity + '" . $_SESSION['Adjustment']->Quantity . "' - WHERE stockid='" . $_SESSION['Adjustment']->StockID . "' - AND loccode='" . $_SESSION['Adjustment']->StockLocation . "'"; + $SQL = "UPDATE locstock SET quantity = quantity + '" . $_SESSION['Adjustment' . $identifier]->Quantity . "' + WHERE stockid='" . $_SESSION['Adjustment' . $identifier]->StockID . "' + AND loccode='" . $_SESSION['Adjustment' . $identifier]->StockLocation . "'"; $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' ._('The location stock record could not be updated because'); $DbgMsg = _('The following SQL to update the stock record was used'); $Result = DB_query($SQL, $db, $ErrMsg, $DbgMsg, true); - if ($_SESSION['CompanyRecord']['gllink_stock']==1 AND $_SESSION['Adjustment']->StandardCost > 0){ + if ($_SESSION['CompanyRecord']['gllink_stock']==1 AND $_SESSION['Adjustment' . $identifier]->StandardCost > 0){ - $StockGLCodes = GetStockGLCode($_SESSION['Adjustment']->StockID,$db); + $StockGLCodes = GetStockGLCode($_SESSION['Adjustment' . $identifier]->StockID,$db); $SQL = "INSERT INTO gltrans (type, typeno, @@ -302,10 +298,10 @@ '" . $SQLAdjustmentDate . "', '" . $PeriodNo . "', '" . $StockGLCodes['adjglact'] . "', - '" . round($_SESSION['Adjustment']->StandardCost * -($_SESSION['Adjustment']->Quantity), $_SESSION['CompanyRecord']['decimalplaces']) . "', - '" . $_SESSION['Adjustment']->StockID . " x " . $_SESSION['Adjustment']->Quantity . " @ " . - $_SESSION['Adjustment']->StandardCost . " " . $_SESSION['Adjustment']->Narrative . "', - '" . $_SESSION['Adjustment']->tag . "' + '" . round($_SESSION['Adjustment' . $identifier]->StandardCost * -($_SESSION['Adjustment' . $identifier]->Quantity), $_SESSION['CompanyRecord']['decimalplaces']) . "', + '" . $_SESSION['Adjustment' . $identifier]->StockID . " x " . $_SESSION['Adjustment' . $identifier]->Quantity . " @ " . + $_SESSION['Adjustment' . $identifier]->StandardCost . " " . $_SESSION['Adjustment' . $identifier]->Narrative . "', + '" . $_SESSION['Adjustment' . $identifier]->tag . "' )"; $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The general ledger transaction entries could not be added because'); @@ -325,9 +321,9 @@ '" . $SQLAdjustmentDate . "', '" . $PeriodNo . "', '" . $StockGLCodes['stockact'] . "', - '" . round($_SESSION['Adjustment']->StandardCost * $_SESSION['Adjustment']->Quantity,$_SESSION['CompanyRecord']['decimalplaces']) . "', - '" . $_SESSION['Adjustment']->StockID . " x " . $_SESSION['Adjustment']->Quantity . " @ " . $_SESSION['Adjustment']->StandardCost . " " . $_SESSION['Adjustment']->Narrative . "', - '" . $_SESSION['Adjustment']->tag . "' + '" . round($_SESSION['Adjustment' . $identifier]->StandardCost * $_SESSION['Adjustment' . $identifier]->Quantity,$_SESSION['CompanyRecord']['decimalplaces']) . "', + '" . $_SESSION['Adjustment' . $identifier]->StockID . " x " . $_SESSION['Adjustment' . $identifier]->Quantity . " @ " . $_SESSION['Adjustment' . $identifier]->StandardCost . " " . $_SESSION['Adjustment' . $identifier]->Narrative . "', + '" . $_SESSION['Adjustment' . $identifier]->tag . "' )"; $Errmsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The general ledger transaction entries could not be added because'); @@ -339,16 +335,16 @@ $Result = DB_Txn_Commit($db); - $ConfirmationText = _('A stock adjustment for'). ' ' . $_SESSION['Adjustment']->StockID . ' - ' . $_SESSION['Adjustment']->ItemDescription . ' '._('has been created from location').' ' . $_SESSION['Adjustment']->StockLocation .' '. _('for a quantity of') . ' ' . locale_number_format($_SESSION['Adjustment']->Quantity,$_SESSION['Adjustment']->DecimalPlaces) ; + $ConfirmationText = _('A stock adjustment for'). ' ' . $_SESSION['Adjustment' . $identifier]->StockID . ' - ' . $_SESSION['Adjustment' . $identifier]->ItemDescription . ' '._('has been created from location').' ' . $_SESSION['Adjustment' . $identifier]->StockLocation .' '. _('for a quantity of') . ' ' . locale_number_format($_SESSION['Adjustment' . $identifier]->Quantity,$_SESSION['Adjustment' . $identifier]->DecimalPlaces) ; prnMsg( $ConfirmationText,'success'); if ($_SESSION['InventoryManagerEmail']!=''){ $ConfirmationText = $ConfirmationText . ' ' . _('by user') . ' ' . $_SESSION['UserID'] . ' ' . _('at') . ' ' . Date('Y-m-d H:i:s'); - $EmailSubject = _('Stock adjustment for'). ' ' . $_SESSION['Adjustment']->StockID; + $EmailSubject = _('Stock adjustment for'). ' ' . $_SESSION['Adjustment' . $identifier]->StockID; mail($_SESSION['InventoryManagerEmail'],$EmailSubject,$ConfirmationText); } - unset ($_SESSION['Adjustment']); + unset ($_SESSION['Adjustment' . $identifier]); } /* end if there was no input error */ }/* end if the user hit enter the adjustment */ @@ -357,15 +353,15 @@ echo '<form action="'. htmlspecialchars($_SERVER['PHP_SELF']) . '" method=post>'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; -if (!isset($_SESSION['Adjustment'])) { +if (!isset($_SESSION['Adjustment' . $identifier])) { $StockID=''; $Controlled= 0; $Quantity = 0; $DecimalPlaces =2; } else { - $StockID = $_SESSION['Adjustment']->StockID; - $Controlled = $_SESSION['Adjustment']->Controlled; - $Quantity = $_SESSION['Adjustment']->Quantity; + $StockID = $_SESSION['Adjustment' . $identifier]->StockID; + $Controlled = $_SESSION['Adjustment' . $identifier]->Controlled; + $Quantity = $_SESSION['Adjustment' . $identifier]->Quantity; $sql="SELECT materialcost, labourcost, overheadcost, @@ -376,8 +372,8 @@ $result=DB_query($sql, $db); $myrow=DB_fetch_array($result); - $_SESSION['Adjustment']->PartUnit=$myrow['units']; - $_SESSION['Adjustment']->StandardCost=$myrow['materialcost']+$myrow['labourcost']+$myrow['overheadcost']; + $_SESSION['Adjustment' . $identifier]->PartUnit=$myrow['units']; + $_SESSION['Adjustment' . $identifier]->StandardCost=$myrow['materialcost']+$myrow['labourcost']+$myrow['overheadcost']; $DecimalPlaces = $myrow['decimalplaces']; } echo '<br /> @@ -406,9 +402,9 @@ echo '</td> <td><input type="submit" name="CheckCode" value="'._('Check Part').'" /></td> </tr>'; -if (isset($_SESSION['Adjustment']) AND mb_strlen($_SESSION['Adjustment']->ItemDescription)>1){ +if (isset($_SESSION['Adjustment' . $identifier]) AND mb_strlen($_SESSION['Adjustment' . $identifier]->ItemDescription)>1){ echo '<tr> - <td colspan="3"><font color="blue" size="3">' . $_SESSION['Adjustment']->ItemDescription . ' ('._('In Units of').' ' . $_SESSION['Adjustment']->PartUnit . ' ) - ' . _('Unit Cost').' = ' . locale_number_format($_SESSION['Adjustment']->StandardCost,4) . '</font></td> + <td colspan="3"><font color="blue" size="3">' . $_SESSION['Adjustment' . $identifier]->ItemDescription . ' ('._('In Units of').' ' . $_SESSION['Adjustment' . $identifier]->PartUnit . ' ) - ' . _('Unit Cost').' = ' . locale_number_format($_SESSION['Adjustment' . $identifier]->StandardCost,4) . '</font></td> </tr>'; } @@ -418,8 +414,8 @@ $sql = "SELECT loccode, locationname FROM locations"; $resultStkLocs = DB_query($sql,$db); while ($myrow=DB_fetch_array($resultStkLocs)){ - if (isset($_SESSION['Adjustment']->StockLocation)){ - if ($myrow['loccode'] == $_SESSION['Adjustment']->StockLocation){ + if (isset($_SESSION['Adjustment' . $identifier]->StockLocation)){ + if ($myrow['loccode'] == $_SESSION['Adjustment' . $identifier]->StockLocation){ echo '<option selected="selected" value="' . $myrow['loccode'] . '">' . $myrow['locationname'] . '</option>'; } else { echo '<option value="' . $myrow['loccode'] . '">' . $myrow['locationname'] . '</option>'; @@ -433,8 +429,8 @@ } echo '</select></td></tr>'; -if (isset($_SESSION['Adjustment']) AND !isset($_SESSION['Adjustment']->Narrative)) { - $_SESSION['Adjustment']->Narrative = ''; +if (isset($_SESSION['Adjustment' . $identifier]) AND !isset($_SESSION['Adjustment' . $identifier]->Narrative)) { + $_SESSION['Adjustment' . $identifier]->Narrative = ''; $Narrative =''; } else { $Narrative =''; @@ -449,11 +445,11 @@ echo '<td>'; if ($Controlled==1){ - if ($_SESSION['Adjustment']->StockLocation == ''){ - $_SESSION['Adjustment']->StockLocation = $_SESSION['UserStockLocation']; + if ($_SESSION['Adjustment' . $identifier]->StockLocation == ''){ + $_SESSION['Adjustment' . $identifier]->StockLocation = $_SESSION['UserStockLocation']; } - echo '<input type="hidden" name="Quantity" value="' . $_SESSION['Adjustment']->Quantity . '" /> - '.locale_number_format($_SESSION['Adjustment']->Quantity,$DecimalPlaces) .' + echo '<input type="hidden" name="Quantity" value="' . $_SESSION['Adjustment' . $identifier]->Quantity . '" /> + '.locale_number_format($_SESSION['Adjustment' . $identifier]->Quantity,$DecimalPlaces) .' [<a href="'.$rootpath.'/StockAdjustmentsControlled.php?AdjType=REMOVE">'._('Remove').'</a>] [<a href="'.$rootpath.'/StockAdjustmentsControlled.php?AdjType=ADD">'._('Add').'</a>]'; } else { @@ -473,7 +469,7 @@ $result=DB_query($SQL,$db); echo '<option value="0">0 - ' . _('None') . '</option>'; while ($myrow=DB_fetch_array($result)){ - if (isset($_SESSION['Adjustment']->tag) AND $_SESSION['Adjustment']->tag==$myrow['tagref']){ + if (isset($_SESSION['Adjustment' . $identifier]->tag) AND $_SESSION['Adjustment' . $identifier]->tag==$myrow['tagref']){ echo '<option selected="selected" value="' . $myrow['tagref'] . '">' . $myrow['tagref'].' - ' .$myrow['tagdescription'] . '</option>'; } else { echo '<option value="' . $myrow['tagref'] . '">' . $myrow['tagref'].' - ' .$myrow['tagdescription']. '</option>'; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <Ex...@us...> - 2012-03-07 08:18:45
|
Revision: 5050 http://web-erp.svn.sourceforge.net/web-erp/?rev=5050&view=rev Author: ExsonQu Date: 2012-03-07 08:18:36 +0000 (Wed, 07 Mar 2012) Log Message: ----------- 7/3/2012 Exson: Fixed that serialised items cannot be processed in StockAdjustments.php. Reported by Soujiro Modified Paths: -------------- trunk/StockAdjustments.php Modified: trunk/StockAdjustments.php =================================================================== --- trunk/StockAdjustments.php 2012-03-07 07:49:41 UTC (rev 5049) +++ trunk/StockAdjustments.php 2012-03-07 08:18:36 UTC (rev 5050) @@ -82,7 +82,9 @@ } else { $_POST['Quantity']=0; } -$_SESSION['Adjustment' . $identifier]->Quantity = filter_number_format($_POST['Quantity']); +if($_POST['Quantity'] != 0){//To prevent from serilised quantity changing to zero + $_SESSION['Adjustment' . $identifier]->Quantity = filter_number_format($_POST['Quantity']); +} echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/supplier.png" title="' . _('Inventory Adjustment') . '" alt="" />' . ' ' . _('Inventory Adjustment') . '</p>'; @@ -350,7 +352,7 @@ }/* end if the user hit enter the adjustment */ -echo '<form action="'. htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8') . '" method=post>'; +echo '<form action="'. htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8') . '?identifier='.$identifier.'" method=post>'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; if (!isset($_SESSION['Adjustment' . $identifier])) { @@ -450,8 +452,8 @@ } echo '<input type="hidden" name="Quantity" value="' . $_SESSION['Adjustment' . $identifier]->Quantity . '" /> '.locale_number_format($_SESSION['Adjustment' . $identifier]->Quantity,$DecimalPlaces) .' - [<a href="'.$rootpath.'/StockAdjustmentsControlled.php?AdjType=REMOVE">'._('Remove').'</a>] - [<a href="'.$rootpath.'/StockAdjustmentsControlled.php?AdjType=ADD">'._('Add').'</a>]'; + [<a href="'.$rootpath.'/StockAdjustmentsControlled.php?AdjType=REMOVE?identifier='.$identifier.'">'._('Remove').'</a>] + [<a href="'.$rootpath.'/StockAdjustmentsControlled.php?AdjType=ADD?identifier='.$identifier.'">'._('Add').'</a>]'; } else { echo '<input type="text" class="number" name="Quantity" size="12" maxlength="12" value="' . locale_number_format($Quantity,$DecimalPlaces) . '" />'; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <Ex...@us...> - 2012-03-07 08:18:45
|
Revision: 5050 http://web-erp.svn.sourceforge.net/web-erp/?rev=5050&view=rev Author: ExsonQu Date: 2012-03-07 08:18:36 +0000 (Wed, 07 Mar 2012) Log Message: ----------- 7/3/2012 Exson: Fixed that serialised items cannot be processed in StockAdjustments.php. Reported by Soujiro Modified Paths: -------------- trunk/StockAdjustments.php Modified: trunk/StockAdjustments.php =================================================================== --- trunk/StockAdjustments.php 2012-03-07 07:49:41 UTC (rev 5049) +++ trunk/StockAdjustments.php 2012-03-07 08:18:36 UTC (rev 5050) @@ -82,7 +82,9 @@ } else { $_POST['Quantity']=0; } -$_SESSION['Adjustment' . $identifier]->Quantity = filter_number_format($_POST['Quantity']); +if($_POST['Quantity'] != 0){//To prevent from serilised quantity changing to zero + $_SESSION['Adjustment' . $identifier]->Quantity = filter_number_format($_POST['Quantity']); +} echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/supplier.png" title="' . _('Inventory Adjustment') . '" alt="" />' . ' ' . _('Inventory Adjustment') . '</p>'; @@ -350,7 +352,7 @@ }/* end if the user hit enter the adjustment */ -echo '<form action="'. htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8') . '" method=post>'; +echo '<form action="'. htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8') . '?identifier='.$identifier.'" method=post>'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; if (!isset($_SESSION['Adjustment' . $identifier])) { @@ -450,8 +452,8 @@ } echo '<input type="hidden" name="Quantity" value="' . $_SESSION['Adjustment' . $identifier]->Quantity . '" /> '.locale_number_format($_SESSION['Adjustment' . $identifier]->Quantity,$DecimalPlaces) .' - [<a href="'.$rootpath.'/StockAdjustmentsControlled.php?AdjType=REMOVE">'._('Remove').'</a>] - [<a href="'.$rootpath.'/StockAdjustmentsControlled.php?AdjType=ADD">'._('Add').'</a>]'; + [<a href="'.$rootpath.'/StockAdjustmentsControlled.php?AdjType=REMOVE?identifier='.$identifier.'">'._('Remove').'</a>] + [<a href="'.$rootpath.'/StockAdjustmentsControlled.php?AdjType=ADD?identifier='.$identifier.'">'._('Add').'</a>]'; } else { echo '<input type="text" class="number" name="Quantity" size="12" maxlength="12" value="' . locale_number_format($Quantity,$DecimalPlaces) . '" />'; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dai...@us...> - 2012-06-26 10:07:20
|
Revision: 5461 http://web-erp.svn.sourceforge.net/web-erp/?rev=5461&view=rev Author: daintree Date: 2012-06-26 10:07:10 +0000 (Tue, 26 Jun 2012) Log Message: ----------- Bob fix Modified Paths: -------------- trunk/StockAdjustments.php Modified: trunk/StockAdjustments.php =================================================================== --- trunk/StockAdjustments.php 2012-06-26 06:44:04 UTC (rev 5460) +++ trunk/StockAdjustments.php 2012-06-26 10:07:10 UTC (rev 5461) @@ -455,7 +455,7 @@ } echo '<input type="hidden" name="Quantity" value="' . $_SESSION['Adjustment' . $identifier]->Quantity . '" /> '.locale_number_format($_SESSION['Adjustment' . $identifier]->Quantity,$DecimalPlaces) .' - [<a href="'.$rootpath.'/StockAdjustmentsControlled.php?AdjType=REMOVE?&dentifier='.$identifier.'">'._('Remove').'</a>] + [<a href="'.$rootpath.'/StockAdjustmentsControlled.php?AdjType=REMOVE&dentifier='.$identifier.'">'._('Remove').'</a>] [<a href="'.$rootpath.'/StockAdjustmentsControlled.php?AdjType=ADD&identifier='.$identifier.'">'._('Add').'</a>]'; } else { echo '<input type="text" class="number" name="Quantity" size="12" maxlength="12" value="' . locale_number_format($Quantity,$DecimalPlaces) . '" />'; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dai...@us...> - 2012-06-26 10:07:21
|
Revision: 5461 http://web-erp.svn.sourceforge.net/web-erp/?rev=5461&view=rev Author: daintree Date: 2012-06-26 10:07:10 +0000 (Tue, 26 Jun 2012) Log Message: ----------- Bob fix Modified Paths: -------------- trunk/StockAdjustments.php Modified: trunk/StockAdjustments.php =================================================================== --- trunk/StockAdjustments.php 2012-06-26 06:44:04 UTC (rev 5460) +++ trunk/StockAdjustments.php 2012-06-26 10:07:10 UTC (rev 5461) @@ -455,7 +455,7 @@ } echo '<input type="hidden" name="Quantity" value="' . $_SESSION['Adjustment' . $identifier]->Quantity . '" /> '.locale_number_format($_SESSION['Adjustment' . $identifier]->Quantity,$DecimalPlaces) .' - [<a href="'.$rootpath.'/StockAdjustmentsControlled.php?AdjType=REMOVE?&dentifier='.$identifier.'">'._('Remove').'</a>] + [<a href="'.$rootpath.'/StockAdjustmentsControlled.php?AdjType=REMOVE&dentifier='.$identifier.'">'._('Remove').'</a>] [<a href="'.$rootpath.'/StockAdjustmentsControlled.php?AdjType=ADD&identifier='.$identifier.'">'._('Add').'</a>]'; } else { echo '<input type="text" class="number" name="Quantity" size="12" maxlength="12" value="' . locale_number_format($Quantity,$DecimalPlaces) . '" />'; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ex...@us...> - 2013-05-12 13:52:23
|
Revision: 5958 http://sourceforge.net/p/web-erp/reponame/5958 Author: exsonqu Date: 2013-05-12 13:52:20 +0000 (Sun, 12 May 2013) Log Message: ----------- 12/5/2013 Exson: Make the smtp mail available for StockAdjustments.php. Modified Paths: -------------- trunk/StockAdjustments.php Modified: trunk/StockAdjustments.php =================================================================== --- trunk/StockAdjustments.php 2013-05-12 13:43:04 UTC (rev 5957) +++ trunk/StockAdjustments.php 2013-05-12 13:52:20 UTC (rev 5958) @@ -347,7 +347,16 @@ if ($_SESSION['InventoryManagerEmail']!=''){ $ConfirmationText = $ConfirmationText . ' ' . _('by user') . ' ' . $_SESSION['UserID'] . ' ' . _('at') . ' ' . Date('Y-m-d H:i:s'); $EmailSubject = _('Stock adjustment for'). ' ' . $_SESSION['Adjustment' . $identifier]->StockID; - mail($_SESSION['InventoryManagerEmail'],$EmailSubject,$ConfirmationText); + if($_SESSION['SmtpSetting']==0){ + mail($_SESSION['InventoryManagerEmail'],$EmailSubject,$ConfirmationText); + }else{ + include('includes/htmlMimeMail.php'); + $mail = new htmlMimeMail(); + $mail->setSubject($EmailSubject); + $mail->setText($ConfirmationText); + $result = SendmailBySmtp($mail,array($_SESSION['InventoryManagerEmail'])); + } + } unset ($_SESSION['Adjustment' . $identifier]); |
From: <ex...@us...> - 2013-12-27 03:42:42
|
Revision: 6520 http://sourceforge.net/p/web-erp/reponame/6520 Author: exsonqu Date: 2013-12-27 03:42:39 +0000 (Fri, 27 Dec 2013) Log Message: ----------- 27/12/13 Thumb: Fixed the stock location will loss problem when move to StockAdjustmentsControlled.php interface in StockAdjustments.php. Modified Paths: -------------- trunk/StockAdjustments.php Modified: trunk/StockAdjustments.php =================================================================== --- trunk/StockAdjustments.php 2013-12-26 18:45:22 UTC (rev 6519) +++ trunk/StockAdjustments.php 2013-12-27 03:42:39 UTC (rev 6520) @@ -77,8 +77,24 @@ if (isset($_POST['Narrative'])){ $_SESSION['Adjustment' . $identifier]->Narrative = $_POST['Narrative']; } + +$sql = "SELECT loccode, locationname FROM locations"; +$resultStkLocs = DB_query($sql,$db); +$LocationList=array(); +while ($myrow=DB_fetch_array($resultStkLocs)){ + $LocationList[$myrow['loccode']]=$myrow['locationname']; +} + if (isset($_POST['StockLocation'])){ $_SESSION['Adjustment' . $identifier]->StockLocation = $_POST['StockLocation']; +}else{ + if(empty($_SESSION['Adjustment' . $identifier]->StockLocation)){ + if(empty($_SESSION['UserStockLocation'])){ + $_SESSION['Adjustment' . $identifier]->StockLocation=key(reset($LocationList)); + }else{ + $_SESSION['Adjustment' . $identifier]->StockLocation=$_SESSION['UserStockLocation']; + } + } } if (isset($_POST['Quantity'])){ if ($_POST['Quantity']=='' OR !is_numeric(filter_number_format($_POST['Quantity']))){ @@ -90,6 +106,9 @@ if($_POST['Quantity'] != 0){//To prevent from serilised quantity changing to zero $_SESSION['Adjustment' . $identifier]->Quantity = filter_number_format($_POST['Quantity']); } +if(isset($_GET['OldIdentifier'])){ + $_SESSION['Adjustment'.$identifier]->StockLocation=$_SESSION['Adjustment'.$_GET['OldIdentifier']]->StockLocation; +} echo '<p class="page_title_text"><img src="'.$RootPath.'/css/'.$Theme.'/images/supplier.png" title="' . _('Inventory Adjustment') . '" alt="" />' . ' ' . _('Inventory Adjustment') . '</p>'; @@ -120,7 +139,7 @@ echo '<tr> <td>' . $myrow[0] . '</td> <td>' . $myrow[1] . '</td> - <td><a href="StockAdjustments.php?StockID='.$myrow[0].'&Description='.$myrow[1].'">' . _('Adjust') . '</a> + <td><a href="StockAdjustments.php?StockID='.$myrow[0].'&Description='.$myrow[1].'&OldIdentifier='.$identifier.'">' . _('Adjust') . '</a> </tr>'; } echo '</table>'; @@ -285,7 +304,6 @@ $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' ._('The location stock record could not be updated because'); $DbgMsg = _('The following SQL to update the stock record was used'); - $Result = DB_query($SQL, $db, $ErrMsg, $DbgMsg, true); if ($_SESSION['CompanyRecord']['gllink_stock']==1 AND $_SESSION['Adjustment' . $identifier]->StandardCost > 0){ @@ -424,23 +442,13 @@ </tr>'; } -echo '<tr><td>' . _('Adjustment to Stock At Location').':</td> - <td><select name="StockLocation"> '; - -$sql = "SELECT loccode, locationname FROM locations"; -$resultStkLocs = DB_query($sql,$db); -while ($myrow=DB_fetch_array($resultStkLocs)){ - if (isset($_SESSION['Adjustment' . $identifier]->StockLocation)){ - if ($myrow['loccode'] == $_SESSION['Adjustment' . $identifier]->StockLocation){ - echo '<option selected="selected" value="' . $myrow['loccode'] . '">' . $myrow['locationname'] . '</option>'; - } else { - echo '<option value="' . $myrow['loccode'] . '">' . $myrow['locationname'] . '</option>'; - } - } elseif ($myrow['loccode']==$_SESSION['UserStockLocation']){ - echo '<option selected="selected" value="' . $myrow['loccode'] . '">' . $myrow['locationname'] . '</option>'; - $_POST['StockLocation']=$myrow['loccode']; +echo '<tr><td>'. _('Adjustment to Stock At Location').':</td> + <td><select name="StockLocation" onchange="submit();"> '; +foreach ($LocationList as $Loccode=>$Locationname){ + if ($Loccode == $_SESSION['Adjustment' . $identifier]->StockLocation){ + echo '<option selected="selected" value="' . $Loccode . '">' . $Locationname . '</option>'; } else { - echo '<option value="' . $myrow['loccode'] . '">' . $myrow['locationname'] . '</option>'; + echo '<option value="' . $Loccode . '">' . $Locationname . '</option>'; } } |
From: <ex...@us...> - 2014-06-20 17:55:51
|
Revision: 6762 http://sourceforge.net/p/web-erp/reponame/6762 Author: exsonqu Date: 2014-06-20 17:55:43 +0000 (Fri, 20 Jun 2014) Log Message: ----------- 21/06/14 Exson: Add location check in StockAdjustments.php to prevent from users selecting controlled items based on one location but changed the location before submit it to server which make serial not exist check absolutely failed. Modified Paths: -------------- trunk/StockAdjustments.php Modified: trunk/StockAdjustments.php =================================================================== --- trunk/StockAdjustments.php 2014-06-19 14:56:16 UTC (rev 6761) +++ trunk/StockAdjustments.php 2014-06-20 17:55:43 UTC (rev 6762) @@ -86,6 +86,9 @@ } if (isset($_POST['StockLocation'])){ + if($_SESSION['Adjustment' . $identifier]->StockLocation != $_POST['StockLocation']){/* User has changed the stock location, so the serial no must be validated again */ + $_SESSION['Adjustment' . $identifier]->SerialItems = array(); + } $_SESSION['Adjustment' . $identifier]->StockLocation = $_POST['StockLocation']; }else{ if(empty($_SESSION['Adjustment' . $identifier]->StockLocation)){ @@ -105,6 +108,9 @@ } if($_POST['Quantity'] != 0){//To prevent from serilised quantity changing to zero $_SESSION['Adjustment' . $identifier]->Quantity = filter_number_format($_POST['Quantity']); + if(count($_SESSION['Adjustment' . $identifier]->SerialItems) == 0 AND $_SESSION['Adjustment' . $identifier]->Controlled == 1 ){/* There is no quantity available for controlled items */ + $_SESSION['Adjustment' . $identifier]->Quantity = 0; + } } if(isset($_GET['OldIdentifier'])){ $_SESSION['Adjustment'.$identifier]->StockLocation=$_SESSION['Adjustment'.$_GET['OldIdentifier']]->StockLocation; |
From: <ex...@us...> - 2015-04-26 02:56:10
|
Revision: 7278 http://sourceforge.net/p/web-erp/reponame/7278 Author: exsonqu Date: 2015-04-26 02:56:08 +0000 (Sun, 26 Apr 2015) Log Message: ----------- 26/04/15 Exson: Add adjustment reason to the mail text and fixed the notice noise in StockAdjustments.php. Modified Paths: -------------- trunk/StockAdjustments.php Modified: trunk/StockAdjustments.php =================================================================== --- trunk/StockAdjustments.php 2015-04-26 02:44:26 UTC (rev 7277) +++ trunk/StockAdjustments.php 2015-04-26 02:56:08 UTC (rev 7278) @@ -367,8 +367,8 @@ EnsureGLEntriesBalance(17, $AdjustmentNumber,$db); $Result = DB_Txn_Commit(); - - $ConfirmationText = _('A stock adjustment for'). ' ' . $_SESSION['Adjustment' . $identifier]->StockID . ' - ' . $_SESSION['Adjustment' . $identifier]->ItemDescription . ' '._('has been created from location').' ' . $_SESSION['Adjustment' . $identifier]->StockLocation .' '. _('for a quantity of') . ' ' . locale_number_format($_SESSION['Adjustment' . $identifier]->Quantity,$_SESSION['Adjustment' . $identifier]->DecimalPlaces) ; + $AdjustReason = $_SESSION['Adjustment' . $identifier]->Narrative? _('Narrative') . ' ' . $_SESSION['Adjustment' . $identifier]->Narrative:''; + $ConfirmationText = _('A stock adjustment for'). ' ' . $_SESSION['Adjustment' . $identifier]->StockID . ' - ' . $_SESSION['Adjustment' . $identifier]->ItemDescription . ' '._('has been created from location').' ' . $_SESSION['Adjustment' . $identifier]->StockLocation .' '. _('for a quantity of') . ' ' . locale_number_format($_SESSION['Adjustment' . $identifier]->Quantity,$_SESSION['Adjustment' . $identifier]->DecimalPlaces) . ' ' . $AdjustReason; prnMsg( $ConfirmationText,'success'); if ($_SESSION['InventoryManagerEmail']!=''){ @@ -454,7 +454,7 @@ echo '<tr><td>'. _('Adjustment to Stock At Location').':</td> <td><select name="StockLocation" onchange="submit();"> '; foreach ($LocationList as $Loccode=>$Locationname){ - if ($Loccode == $_SESSION['Adjustment' . $identifier]->StockLocation){ + if (isset($_SESSION['Adjustment'.$identifier]->StockLocation) AND $Loccode == $_SESSION['Adjustment' . $identifier]->StockLocation){ echo '<option selected="selected" value="' . $Loccode . '">' . $Locationname . '</option>'; } else { echo '<option value="' . $Loccode . '">' . $Locationname . '</option>'; @@ -536,4 +536,4 @@ </div> </form>'; include('includes/footer.inc'); -?> \ No newline at end of file +?> |