Changed service items to use cogs account instead of inventory account.
authorJoe Hunt <joe.hunt.consulting@gmail.com>
Sun, 17 May 2009 22:05:43 +0000 (22:05 +0000)
committerJoe Hunt <joe.hunt.consulting@gmail.com>
Sun, 17 May 2009 22:05:43 +0000 (22:05 +0000)
CHANGELOG.txt
inventory/manage/items.php

index dd2cca421c38acd279fd9455fdcbfd3423980188..d5a63682eb608cae707dfe73e7b8d37bb2e7991c 100644 (file)
@@ -19,6 +19,10 @@ Legend:
 ! -> Note
 $ -> Affected files
 
+17-May-2009 Joe Hunt
+! Changed service items to use cogs account instead of inventory account.
+$ /inventory/manage/items.php
+
 16-May-2009 Joe Hunt
 # [0000133] Removed buggy & obsolete hotkey support in pager_link()
 $ /includes/ui/db_pager_view.inc
index 8a465010881f54d374b1c876671b6f7ee61ffaee..112e1b2cd22eed2f26c37268dd2c7d0374e927ed 100644 (file)
@@ -39,6 +39,9 @@ if (list_updated('stock_id')) {
        $Ajax->activate('details');
        $Ajax->activate('controls');
 }
+if (list_updated('category_id') || list_updated('mb_flag')) {
+       $Ajax->activate('details');
+}
 $upload_file = "";
 if (isset($_FILES['pic']) && $_FILES['pic']['name'] != '') 
 {
@@ -297,7 +300,7 @@ if ($new_item)
        $company_record = get_company_prefs();
 
     if (!isset($_POST['inventory_account']) || $_POST['inventory_account'] == "")
-       $_POST['inventory_account'] = $company_record["default_inventory_act"];
+               $_POST['inventory_account'] = $company_record["default_inventory_act"];
 
     if (!isset($_POST['cogs_account']) || $_POST['cogs_account'] == "")
        $_POST['cogs_account'] = $company_record["default_cogs_act"];
@@ -311,6 +314,8 @@ if ($new_item)
        if (!isset($_POST['assembly_account']) || $_POST['assembly_account'] == "")
                $_POST['assembly_account'] = $company_record["default_assembly_act"];
 
+       if (list_updated('mb_flag') && is_service($_POST['mb_flag']))
+               $_POST['inventory_account'] = $company_record["default_cogs_act"];
 } 
 else 
 { // Must be modifying an existing item
@@ -372,15 +377,15 @@ table_section_title(_("GL Accounts"));
 
 gl_all_accounts_list_row(_("Sales Account:"), 'sales_account', $_POST['sales_account']);
 
-gl_all_accounts_list_row(_("Inventory Account:"), 'inventory_account', $_POST['inventory_account']);
-
 if (!is_service($_POST['mb_flag'])) 
 {
+       gl_all_accounts_list_row(_("Inventory Account:"), 'inventory_account', $_POST['inventory_account']);
        gl_all_accounts_list_row(_("C.O.G.S. Account:"), 'cogs_account', $_POST['cogs_account']);
        gl_all_accounts_list_row(_("Inventory Adjustments Account:"), 'adjustment_account', $_POST['adjustment_account']);
 }
 else 
 {
+       gl_all_accounts_list_row(_("C.O.G.S. Account:"), 'inventory_account', $_POST['inventory_account']);
        hidden('cogs_account', $_POST['cogs_account']);
        hidden('adjustment_account', $_POST['adjustment_account']);
 }