Added WIP account in GL setup.
authorJanusz Dobrowolski <janusz@frontaccounting.eu>
Wed, 23 Dec 2015 22:54:22 +0000 (23:54 +0100)
committerJanusz Dobrowolski <janusz@frontaccounting.eu>
Sat, 9 Jan 2016 10:57:28 +0000 (11:57 +0100)
admin/gl_setup.php
includes/data_checks.inc
manufacturing/search_work_orders.php
manufacturing/work_order_add_finished.php
manufacturing/work_order_issue.php
sql/en_US-demo.sql
sql/en_US-new.sql

index 07f70b7b713ee188a2fde356eed680b530a1ad8d..13d1a3326539c260e886632dc6f8c3f8d4a4f5b6 100644 (file)
@@ -83,7 +83,8 @@ if (isset($_POST['submit']) && can_process())
                'no_zero_lines_amount', 'show_po_item_codes', 'accounts_alpha', 'loc_notification', 'print_invoice_no',
                'allow_negative_prices', 'print_item_images_on_quote', 
                'allow_negative_stock'=> 0, 'accumulate_shipping'=> 0,
-               'po_over_receive' => 0.0, 'po_over_charge' => 0.0, 'default_credit_limit'=>0.0
+               'po_over_receive' => 0.0, 'po_over_charge' => 0.0, 'default_credit_limit'=>0.0,
+               'wip_act'
 )));
 
        display_notification(_("The general GL setup has been updated."));
@@ -147,6 +148,7 @@ $_POST['allow_negative_prices'] = $myrow['allow_negative_prices'];
 $_POST['print_item_images_on_quote'] = $myrow['print_item_images_on_quote'];
 $_POST['default_loss_on_asset_disposal_act'] = $myrow['default_loss_on_asset_disposal_act'];
 $_POST['depreciation_period'] = $myrow['depreciation_period'];
+$_POST['wip_act'] = $myrow['wip_act'];
 
 //---------------
 
@@ -267,6 +269,8 @@ table_section_title(_("Manufacturing Defaults"));
 
 text_row(_("Work Order Required By After:"), 'default_workorder_required', $_POST['default_workorder_required'], 6, 6, '', "", _("days"));
 
+gl_all_accounts_list_row(_("Work In Progress Account:"), 'wip_act', $_POST['wip_act']);
+
 //----------------
 
 end_outer_table(1);
index 7cc5586d4652e6c370109a3c668aebad75a47fee..765a59dfd8df9d939fb14c44d342272860c86ba9 100644 (file)
@@ -153,8 +153,8 @@ function check_db_has_sales_people($msg)
     {
        display_error($msg, true);
        end_page();
-       exit;   
-    }  
+       exit;
+    }
 }
 
 function db_has_sales_areas()
@@ -674,3 +674,19 @@ function check_reference($reference, $trans_type, $trans_no=0, $context=null, $l
        }
        return true;
 }
+
+function check_sys_pref($name, $msg, $empty = '')
+{
+       global $path_to_root;
+
+       if (get_company_pref($name) === $empty)
+       {
+               display_error(menu_link("/admin/gl_setup.php", $msg), true);
+               display_footer_exit();
+       }
+}
+
+function check_wip_account()
+{
+       check_sys_pref('wip_act', _("You have to set Work In Progress Account in GL Setup before you can use this function."));
+}
index f848a763ad31d1c000adb808c7942e66b678c9d6..1c407b6487eb81087249a0dcd10bdcd2280db564 100644 (file)
@@ -165,8 +165,8 @@ $cols = array(
        _("Required By") => array('type'=>'date', 'ord'=>''),
        array('insert'=>true, 'fun'=> 'edit_link'),
        array('insert'=>true, 'fun'=> 'release_link'),
-       array('insert'=>true, 'fun'=> 'produce_link'),
        array('insert'=>true, 'fun'=> 'costs_link'),
+       array('insert'=>true, 'fun'=> 'produce_link'),
        array('insert'=>true, 'fun'=> 'view_gl_link')
 );
 
index 757f304ce4128df7f2b5befe80179412ad462adf..717faf0902471ba5b638de30721fc9a7dc78bd02 100644 (file)
@@ -27,6 +27,8 @@ if (user_use_date_picker())
        $js .= get_js_date_picker();
 page(_($help_context = "Produce or Unassemble Finished Items From Work Order"), false, false, "", $js);
 
+check_wip_account();
+
 if (isset($_GET['trans_no']) && $_GET['trans_no'] != "")
 {
        $_POST['selected_id'] = $_GET['trans_no'];
index 025a91258c2dcfb7f76c398c90927b23c7ea9951..f0505296a0453d7d622b9aba151fd78f90d6de4b 100644 (file)
@@ -30,6 +30,7 @@ if (user_use_date_picker())
 
 page(_($help_context = "Issue Items to Work Order"), false, false, "", $js);
 
+check_wip_account();
 //-----------------------------------------------------------------------------------------------
 
 if (isset($_GET['AddedID'])) 
index a9c8fbd189ecfbce64f82a8328f0a7eea8775433..36b006c8f5cee26a41cf9508ad23982d947bff21 100644 (file)
@@ -2173,6 +2173,7 @@ INSERT INTO `0_sys_prefs` VALUES ('default_loss_on_asset_disposal_act', 'glsetup
 INSERT INTO `0_sys_prefs` VALUES ('depreciation_period', 'glsetup.company', 'tinyint', '1', '1');
 INSERT INTO `0_sys_prefs` VALUES ('use_manufacturing','setup.company', 'tinyint', 1, '1');
 INSERT INTO `0_sys_prefs` VALUES ('use_fixed_assets','setup.company', 'tinyint', 1, '1');
+INSERT INTO `0_sys_prefs` VALUES ('wip_act', 'glsetup.manuf', 'varchar', '15', '1530');
 
 
 -- --------------------------------------------------------
index a0607e84bd913e3b3f8d81d70b7ad1c25fbb6ef1..46efaf0fd8a6cf56be1d2127c80a9625724d307d 100644 (file)
@@ -1897,6 +1897,7 @@ INSERT INTO `0_sys_prefs` VALUES ('default_loss_on_asset_disposal_act', 'glsetup
 INSERT INTO `0_sys_prefs` VALUES ('depreciation_period', 'glsetup.company', 'tinyint', '1', '1');
 INSERT INTO `0_sys_prefs` VALUES ('use_manufacturing','setup.company', 'tinyint', 1, '1');
 INSERT INTO `0_sys_prefs` VALUES ('use_fixed_assets','setup.company', 'tinyint', 1, '1');
+INSERT INTO `0_sys_prefs` VALUES ('wip_act', 'glsetup.manuf', 'varchar', '15', '1530');
 
 -- --------------------------------------------------------