Removed finally unimplemented freight cost field in Purchasing.
[fa-stable.git] / inventory / manage / item_categories.php
index d63354d1a8971309a493b97af4565a56f2f8989b..dfa0a786ff63bd4d6055a1d5845da730c3724890 100644 (file)
@@ -15,14 +15,18 @@ include($path_to_root . "/includes/session.inc");
 
 if (isset($_GET['FixedAsset'])) {
   $page_security = 'SA_ASSETCATEGORY';
-  $help_context = "FA Item Categories";
+  $help_context = "Fixed Assets Categories";
   $_POST['mb_flag'] = 'F';
 }
 else {
   $help_context = "Item Categories";
 }
 
-page(_($help_context));
+$js = "";
+if ($SysPrefs->use_popup_windows && $SysPrefs->use_popup_search)
+       $js .= get_js_open_window(900, 500);
+
+page(_($help_context), false, false, "", $js);
 
 include_once($path_to_root . "/includes/ui.inc");
 
@@ -51,9 +55,9 @@ if ($Mode=='ADD_ITEM' || $Mode=='UPDATE_ITEM')
                    update_item_category($selected_id, $_POST['description'],
                                $_POST['tax_type_id'],  $_POST['sales_account'], 
                                $_POST['cogs_account'], $_POST['inventory_account'], 
-                               $_POST['adjustment_account'], $_POST['assembly_account'],
+                               $_POST['adjustment_account'], $_POST['wip_account'],
                                $_POST['units'], $_POST['mb_flag'],     $_POST['dim1'], $_POST['dim2'],
-                               check_value('no_sale'), check_value('no_purchase'));
+                               check_value('no_sale'), check_value('no_purchase'), $_POST['vat_category']);
                        display_notification(_('Selected item category has been updated'));
        } 
        else 
@@ -61,9 +65,9 @@ if ($Mode=='ADD_ITEM' || $Mode=='UPDATE_ITEM')
                    add_item_category($_POST['description'],
                                $_POST['tax_type_id'],  $_POST['sales_account'], 
                                $_POST['cogs_account'], $_POST['inventory_account'], 
-                               $_POST['adjustment_account'], $_POST['assembly_account'], 
+                               $_POST['adjustment_account'], $_POST['wip_account'], 
                                $_POST['units'], $_POST['mb_flag'],     $_POST['dim1'], 
-                               $_POST['dim2'], check_value('no_sale'), check_value('no_purchase'));
+                               $_POST['dim2'], check_value('no_sale'), check_value('no_purchase'), $_POST['vat_category']);
                        display_notification(_('New item category has been added'));
        }
                $Mode = 'RESET';
@@ -114,7 +118,7 @@ if ($fixed_asset) {
                _("Asset Account"), _("Deprecation Cost Account"),
                _("Depreciation/Disposal Account"), "", "");
 } else {
-       $th = array(_("Name"), _("Tax type"), _("Units"), _("Type"), _("Sales Act"),
+       $th = array(_("Name"), _("Tax type"), _("Units"), _("VAT Category"), _("Type"), _("Sales Act"),
                _("Inventory Account"), _("COGS Account"), _("Adjustment Account"),
                _("Assembly Account"), "", "");
 }
@@ -131,14 +135,16 @@ while ($myrow = db_fetch($result))
        label_cell($myrow["description"]);
        label_cell($myrow["tax_name"]);
        label_cell($myrow["dflt_units"], "align=center");
-       if (!$fixed_asset)
+       if (!$fixed_asset) {
+               label_cell($vat_categories[$myrow["vat_category"]]);
                label_cell($stock_types[$myrow["dflt_mb_flag"]]);
+       }
        label_cell($myrow["dflt_sales_act"], "align=center");
        label_cell($myrow["dflt_inventory_act"], "align=center");
        label_cell($myrow["dflt_cogs_act"], "align=center");
        label_cell($myrow["dflt_adjustment_act"], "align=center");
        if (!$fixed_asset)
-               label_cell($myrow["dflt_assembly_act"], "align=center");
+               label_cell($myrow["dflt_wip_act"], "align=center");
        inactive_control_cell($myrow["category_id"], $myrow["inactive"], 'stock_category', 'category_id');
        edit_button_cell("Edit".$myrow["category_id"], _("Edit"));
        delete_button_cell("Delete".$myrow["category_id"], _("Delete"));
@@ -166,13 +172,14 @@ if ($selected_id != -1)
                $_POST['cogs_account']  = $myrow["dflt_cogs_act"];
                $_POST['inventory_account']  = $myrow["dflt_inventory_act"];
                $_POST['adjustment_account']  = $myrow["dflt_adjustment_act"];
-               $_POST['assembly_account']  = $myrow["dflt_assembly_act"];
+               $_POST['wip_account']  = $myrow["dflt_wip_act"];
                $_POST['units']  = $myrow["dflt_units"];
                $_POST['mb_flag']  = $myrow["dflt_mb_flag"];
                $_POST['dim1']  = $myrow["dflt_dim1"];
                $_POST['dim2']  = $myrow["dflt_dim2"];
                $_POST['no_sale']  = $myrow["dflt_no_sale"];
                $_POST['no_purchase']  = $myrow["dflt_no_purchase"];
+               $_POST['vat_category']  = $myrow["vat_category"];
        } 
        hidden('selected_id', $selected_id);
        hidden('category_id');
@@ -196,8 +203,8 @@ if ($selected_id != -1)
        if (get_post('adjustment_account') == "")
                $_POST['adjustment_account'] = $company_record["default_adj_act"];
 
-       if (get_post('assembly_account') == "")
-               $_POST['assembly_account'] = $company_record["default_assembly_act"];
+       if (get_post('wip_account') == "")
+               $_POST['wip_account'] = $company_record["default_wip_act"];
 
 }
 
@@ -214,6 +221,11 @@ else
 
 stock_units_list_row(_("Units of Measure:"), 'units', null);
 
+if (is_fixed_asset($_POST['mb_flag']))
+  hidden('vat_category', VC_ASSETS);
+else
+  vat_category_list_row(_("VAT category:"), 'vat_category',null, true, false, $selected_id!=-1);
+
 if (is_fixed_asset($_POST['mb_flag'])) 
        hidden('no_sale', 0);
 else
@@ -244,9 +256,9 @@ else
 }
 
 if (is_manufactured($_POST['mb_flag']))
-       gl_all_accounts_list_row(_("Item Assembly Costs Account:"), 'assembly_account', $_POST['assembly_account']);
+       gl_all_accounts_list_row(_("Item Assembly Costs Account:"), 'wip_account', $_POST['wip_account']);
 else
-       hidden('assembly_account', $_POST['assembly_account']);
+       hidden('wip_account', $_POST['wip_account']);
 
 $dim = get_company_pref('use_dimension');
 if ($dim >= 1)