From: Janusz Dobrowolski Date: Wed, 23 Dec 2015 22:54:22 +0000 (+0100) Subject: Added WIP account in GL setup. X-Git-Tag: v2.4.2~19^2~76 X-Git-Url: https://delta.frontaccounting.com/gitweb/?a=commitdiff_plain;h=ab8f88b77c9a7e687e10b08d2fe04409a701d1ac;p=fa-stable.git Added WIP account in GL setup. --- diff --git a/admin/gl_setup.php b/admin/gl_setup.php index 07f70b7b..13d1a332 100644 --- a/admin/gl_setup.php +++ b/admin/gl_setup.php @@ -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); diff --git a/includes/data_checks.inc b/includes/data_checks.inc index 7cc5586d..765a59df 100644 --- a/includes/data_checks.inc +++ b/includes/data_checks.inc @@ -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.")); +} diff --git a/manufacturing/search_work_orders.php b/manufacturing/search_work_orders.php index f848a763..1c407b64 100644 --- a/manufacturing/search_work_orders.php +++ b/manufacturing/search_work_orders.php @@ -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') ); diff --git a/manufacturing/work_order_add_finished.php b/manufacturing/work_order_add_finished.php index 757f304c..717faf09 100644 --- a/manufacturing/work_order_add_finished.php +++ b/manufacturing/work_order_add_finished.php @@ -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']; diff --git a/manufacturing/work_order_issue.php b/manufacturing/work_order_issue.php index 025a9125..f0505296 100644 --- a/manufacturing/work_order_issue.php +++ b/manufacturing/work_order_issue.php @@ -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'])) diff --git a/sql/en_US-demo.sql b/sql/en_US-demo.sql index a9c8fbd1..36b006c8 100644 --- a/sql/en_US-demo.sql +++ b/sql/en_US-demo.sql @@ -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'); -- -------------------------------------------------------- diff --git a/sql/en_US-new.sql b/sql/en_US-new.sql index a0607e84..46efaf0f 100644 --- a/sql/en_US-new.sql +++ b/sql/en_US-new.sql @@ -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'); -- --------------------------------------------------------