From: <tim...@us...> - 2010-12-22 14:35:49
|
Revision: 4219 http://web-erp.svn.sourceforge.net/web-erp/?rev=4219&view=rev Author: tim_schofield Date: 2010-12-22 14:35:42 +0000 (Wed, 22 Dec 2010) Log Message: ----------- $Message Modified Paths: -------------- trunk/SelectOrderItems.php trunk/css/jelly/default.css trunk/includes/session.inc Modified: trunk/SelectOrderItems.php =================================================================== --- trunk/SelectOrderItems.php 2010-12-22 14:34:48 UTC (rev 4218) +++ trunk/SelectOrderItems.php 2010-12-22 14:35:42 UTC (rev 4219) @@ -949,6 +949,85 @@ $DbgMsg = _('The sql that was used to determine if the part being ordered was a kitset or not was '); $KitResult = DB_query($sql, $db,$ErrMsg,$DbgMsg); + if (isset($_POST['AssetDisposalEntered'])){ //its an asset being disposed of + if ($_POST['AssetToDisposeOf'] == 'NoAssetSelected'){ //don't do anything unless an asset is disposed of + prnMsg(_('No asset was selected to dispose of. No assets have been added to this customer order'),'warn'); + } else { //need to add the asset to the order + /*First need to create a stock ID to hold the asset and record the sale - as only stock items can be sold + * and before that we need to add a disposal stock category - if not already created + * first off get the details about the asset being disposed of */ + $AssetDetailsResult = DB_query('SELECT fixedassets.description, + fixedassets.longdescription, + fixedassets.barcode, + fixedassetcategories.costact + FROM fixedassetcategories INNER JOIN fixedassets + ON fixedassetcategories.categoryid=fixedassets.assetcategoryid + WHERE fixedassets.assetid="' . $_POST['AssetToDisposeOf'] . '"',$db); + $AssetRow = DB_fetch_array($AssetCatDetailsResult); + + $AssetCategoryResult = DB_query('SELECT categoryid FROM stockcategory WHERE categoryid="ASSETS"',$db); + if (DB_num_rows($AssetCategoryResult)==0){ + /*Although asset GL posting will come from the asset category - we should set the GL codes to something sensible + * based on the category of the asset under review at the moment - this may well change for any other assets sold subsequentely */ + + /*OK now we can insert the stock category for this asset */ + $InsertAssetStockCatResult = DB_query('INSERT INTO stockcategory ( categoryid, + categorydescription, + stockact) + VALUES ("ASSETS", + "' . _('Asset Disposals') . '", + "' . $AssetRow['costact'] . '")',$db); + } + + /*First check to see that it doesn't exist already assets are of the format "ASSET-" . $AssetID + */ + $TestAssetExistsAlreadyResult = DB_query('SELECT stockid FROM stockmaster WHERE stockid ="ASSET-' . $_POST['AssetToDisposeOf'] . '"',$db); + if (DB_num_rows($TestAssetExistsAlreadyResult)==1){ //then it exists already ... bum + $j=1; + while (DB_num_rows($TestAssetExistsAlreadyResult)==1) { + $TestAssetExistsAlreadyResult = DB_query('SELECT stockid FROM stockmaster WHERE stockid ="ASSET-' . $_POST['AssetToDisposeOf'] . '-' . $j . '"',$db); + $j++; + } + $AssetStockID = 'ASSET-' . $_POST['AssetToDisposeOf'] . '-' . $j; + } else { + $AssetStockID = 'ASSET-' . $_POST['AssetToDisposeOf']; + } + /* Perhaps ought to check that the asset exists already as a stock item first */ + + /*OK now we can insert the item for this asset */ + $InsertAssetAsStockItemResult = DB_query('INSERT INTO stockmaster ( stockid, + description, + categoryid, + longdescription, + mbflag, + controlled, + serialised, + taxcatid) + VALUES ("' . $AssetStockID . '", + "' . $AssetRow['description'] . '", + "' . $AssetRow['longdescription'] . '", + "ASSETS", + "B", + "0", + "0", + "' . $_SESSION['DefaultTaxCategory'] . '")' , $db); + /*not forgetting the location records too */ + $InsertStkLocRecsResult = DB_query('INSERT INTO locstock (loccode, + stockid) + SELECT loccode, "' . $AssetStockID . '" FROM locations',$db); + /*Now the asset has been added to the stock master we can add it to the sales order */ + $NewItemDue = date($_SESSION['DefaultDateFormat']); + if (isset($_POST['POLine']){ + $NewPOLine = $_POST['POLine']; + } else { + $NewPOLine = 0; + } + $NewItem = $AssetStockID; + include('includes/SelectOrderItems_IntoCart.inc'); + } + + + } if (DB_num_rows($KitResult)==0){ prnMsg( _('The item code') . ' ' . $NewItem . ' ' . _('could not be retrieved from the database and has not been added to the order'),'warn'); @@ -1692,8 +1771,8 @@ // Find the quantity on works orders $sql = "SELECT SUM(woitems.qtyreqd - woitems.qtyrecd) AS dedm - FROM woitems - WHERE stockid='" . $myrow['stockid'] ."'"; + FROM woitems + WHERE stockid='" . $myrow['stockid'] ."'"; $ErrMsg = _('The order details for this product cannot be retrieved because'); $WoResult = db_query($sql,$db,$ErrMsg); Modified: trunk/css/jelly/default.css =================================================================== --- trunk/css/jelly/default.css 2010-12-22 14:34:48 UTC (rev 4218) +++ trunk/css/jelly/default.css 2010-12-22 14:35:42 UTC (rev 4219) @@ -34,7 +34,7 @@ /*links before selection */ a { font-family: Arial, Verdana, Helvetica, sans-serif; - font-size: 12px; + font-size: 10px; font-weight: normal; text-decoration: none; color: #0000FF; @@ -66,7 +66,7 @@ /*table detail items default format */ td { font-family: Arial, Verdana, Helvetica, sans-serif; - font-size: 12px; + font-size: 10px; text-align:left; } @@ -119,7 +119,7 @@ th { font-weight: normal; background: #ccc; - font-size: 12px; + font-size: 10px; color: #330000; text-align: center; } @@ -127,7 +127,7 @@ th.number { font-weight: normal; background: #ccc; - font-size: 12px; + font-size: 10px; color: #330000; text-align: right; } @@ -147,7 +147,7 @@ font-family: Verdana, Arial, Helvetica; padding-top: 1px; padding-bottom: 1px; - font-size: 12px; + font-size: 10px; TEXT-ALIGN:center; } @@ -213,7 +213,7 @@ color:#000; border: 0px 0px 1px 1px #000 dashed; font-family: Arial, Verdana, Helvetica, sans-serif; - font-size: 12px; + font-size: 10px; } input.number{ @@ -234,7 +234,7 @@ select {background:#eee; color:#111; font-family: Arial, Verdana, Helvetica, sans-serif; - font-size: 12px; + font-size: 10px; } font.good { @@ -305,7 +305,7 @@ color:#000; border: 0px 0px 1px 1px #000 dashed; font-family: Arial, Verdana, Helvetica, sans-serif; - font-size: 12px; + font-size: 10px; } textarea:hover{ background: url(images/inputhtxt.png) #eee; @@ -367,7 +367,7 @@ width: 100%; margin: 0px; padding: 0px; - font-size: 12px; + font-size: 10px; } /* Main page heading with quick menu within */ @@ -394,7 +394,7 @@ .quick_menu_left { background: none; font-family: Arial, Verdana, Helvetica, sans-serif; - font-size: 12px; + font-size: 10px; font-weight: bold; border: none; white-space: nowrap; @@ -464,12 +464,12 @@ } .system_menu_tabs a { - font-size: 12px; + font-size: 10px; color: black; } .system_menu_tabs a:hover { - font-size: 12px; + font-size: 10px; color: black; } @@ -536,7 +536,7 @@ span.main_menu_nolink { font-family: Arial, Verdana, Helvetica, sans-serif; - font-size: 12px; + font-size: 10px; font-weight: bold; color: #fff; text-decoration: none; @@ -582,7 +582,7 @@ .menu_group_headers_text { font-family: Arial, Verdana, Helvetica, sans-serif; - font-size: 12px; + font-size: 10px; font-weight: bold; color: black; } @@ -610,7 +610,7 @@ padding-top: 2px; padding-bottom: 2px; font-weight: bold; - font-size: 12px; + font-size: 10px; color: black; TEXT-ALIGN:center; } @@ -655,7 +655,7 @@ span.menu_group_nolink { font-family: Arial, Verdana, Helvetica, sans-serif; - font-size: 12px; + font-size: 10px; font-weight: normal; color: #777777; text-decoration: none; Modified: trunk/includes/session.inc =================================================================== --- trunk/includes/session.inc 2010-12-22 14:34:48 UTC (rev 4218) +++ trunk/includes/session.inc 2010-12-22 14:35:42 UTC (rev 4219) @@ -12,7 +12,7 @@ header('Location:' . $rootpath . '/install/index.php'); } include($PathPrefix . 'config.php'); -$DBVersion=47; +$DBVersion=48; if (isset($SessionSavePath)){ session_save_path($SessionSavePath); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |