Partial (inventory related) include files cleanup.
[fa-stable.git] / manufacturing / work_order_entry.php
index b9cfcba0442e653e9ca6ae5bf7c700cd939ffd73..ccc2635e3ecb86dbb458e85f10862d21df4182d0 100644 (file)
@@ -15,14 +15,13 @@ $path_to_root = "..";
 include_once($path_to_root . "/includes/session.inc");
 
 include_once($path_to_root . "/includes/date_functions.inc");
-include_once($path_to_root . "/includes/manufacturing.inc");
 include_once($path_to_root . "/includes/data_checks.inc");
 
 include_once($path_to_root . "/manufacturing/includes/manufacturing_db.inc");
 include_once($path_to_root . "/manufacturing/includes/manufacturing_ui.inc");
 
 $js = "";
-if ($use_popup_windows)
+if ($SysPrefs->use_popup_windows)
        $js .= get_js_open_window(900, 500);
 if (user_use_date_picker())
        $js .= get_js_date_picker();
@@ -424,24 +423,23 @@ else
     date_row(_("Date") . ":", 'date_', '', true);
        hidden('RequDate', '');
 
-       $sql = "SELECT DISTINCT account_code FROM ".TB_PREF."bank_accounts";
-       $rs = db_query($sql,"could not get bank accounts");
-       $r = db_fetch_row($rs);
+       $bank_act = get_default_bank_account();
        if (!isset($_POST['Labour']))
        {
                $_POST['Labour'] = price_format(0);
-               $_POST['cr_lab_acc'] = $r[0];
+               $_POST['cr_lab_acc'] = $bank_act['account_code'];
        }
+
        amount_row($wo_cost_types[WO_LABOUR], 'Labour');
        gl_all_accounts_list_row(_("Credit Labour Account"), 'cr_lab_acc', null);
        if (!isset($_POST['Costs']))
        {
                $_POST['Costs'] = price_format(0);
-               $_POST['cr_acc'] = $r[0];
+               $_POST['cr_acc'] = $bank_act['account_code'];
        }
        amount_row($wo_cost_types[WO_OVERHEAD], 'Costs');
        gl_all_accounts_list_row(_("Credit Overhead Account"), 'cr_acc', null);
-       
+
 }
 
 if (get_post('released'))
@@ -472,4 +470,3 @@ else
 end_form();
 end_page();
 
-?>
\ No newline at end of file