5 include($path_to_root . "/includes/session.inc");
7 page(_("System and General GL Setup"));
9 include_once($path_to_root . "/includes/date_functions.inc");
10 include_once($path_to_root . "/includes/ui.inc");
11 include_once($path_to_root . "/includes/data_checks.inc");
13 include_once($path_to_root . "/admin/db/company_db.inc");
15 //-------------------------------------------------------------------------------------------------
17 function can_process()
19 if (!check_num('po_over_receive', 0, 100))
21 display_error(_("The delivery over-receive allowance must be between 0 and 100."));
22 set_focus('po_over_receive');
26 if (!check_num('po_over_charge', 0, 100))
28 display_error(_("The invoice over-charge allowance must be between 0 and 100."));
29 set_focus('po_over_charge');
33 if (!check_num('past_due_days', 0, 100))
35 display_error(_("The past due days interval allowance must be between 0 and 100."));
36 set_focus('past_due_days');
42 //-------------------------------------------------------------------------------------------------
44 if (isset($_POST['submit']) && can_process())
46 update_company_gl_setup($_POST['debtors_act'], $_POST['pyt_discount_act'],
47 $_POST['creditors_act'], $_POST['grn_act'],
48 $_POST['exchange_diff_act'], $_POST['purch_exchange_diff_act'],
49 $_POST['retained_earnings_act'], $_POST['freight_act'],
50 $_POST['default_sales_act'],
51 $_POST['default_sales_discount_act'],
52 $_POST['default_prompt_payment_act'],
53 $_POST['default_inventory_act'],
54 $_POST['default_cogs_act'],
55 $_POST['default_adj_act'],
56 $_POST['default_inv_sales_act'],
57 $_POST['default_assembly_act'], $_POST['payroll_act'],
58 check_value('allow_negative_stock'),
59 input_num('po_over_receive'),
60 input_num('po_over_charge'),
61 $_POST['past_due_days'],
62 $_POST['default_credit_limit'],
63 $_POST['default_workorder_required'],
64 $_POST['default_dim_required']);
66 display_notification(_("The general GL setup has been updated."));
68 } /* end of if submit */
70 //-------------------------------------------------------------------------------------------------
73 start_table("class='tablestyle'");
75 $myrow = get_company_prefs();
77 $_POST['debtors_act'] = $myrow["debtors_act"];
78 $_POST['creditors_act'] = $myrow["creditors_act"];
79 $_POST['grn_act'] = $myrow["grn_act"];
80 $_POST['retained_earnings_act'] = $myrow["retained_earnings_act"];
81 $_POST['freight_act'] = $myrow["freight_act"];
82 $_POST['exchange_diff_act'] = $myrow["exchange_diff_act"];
84 $_POST['purch_exchange_diff_act'] = $myrow["purch_exchange_diff_act"];
85 $_POST['pyt_discount_act'] = $myrow["pyt_discount_act"];
87 $_POST['default_sales_act'] = $myrow["default_sales_act"];
88 $_POST['default_sales_discount_act'] = $myrow["default_sales_discount_act"];
89 $_POST['default_prompt_payment_act'] = $myrow["default_prompt_payment_act"];
91 $_POST['default_inventory_act'] = $myrow["default_inventory_act"];
92 $_POST['default_cogs_act'] = $myrow["default_cogs_act"];
93 $_POST['default_adj_act'] = $myrow["default_adj_act"];
94 $_POST['default_inv_sales_act'] = $myrow['default_inv_sales_act'];
95 $_POST['default_assembly_act'] = $myrow['default_assembly_act'];
96 $_POST['payroll_act'] = $myrow['payroll_act'];
98 $_POST['allow_negative_stock'] = $myrow['allow_negative_stock'];
100 $_POST['po_over_receive'] = percent_format($myrow['po_over_receive']);
101 $_POST['po_over_charge'] = percent_format($myrow['po_over_charge']);
102 $_POST['past_due_days'] = $myrow['past_due_days'];
104 $_POST['default_credit_limit'] = $myrow['default_credit_limit'];
106 $_POST['default_workorder_required'] = $myrow['default_workorder_required'];
107 $_POST['default_dim_required'] = $myrow['default_dim_required'];
114 table_section_title(_("General GL"));
116 gl_all_accounts_list_row(_("Retained Earning Clearing Account:"), 'retained_earnings_act', $_POST['retained_earnings_act']);
117 gl_all_accounts_list_row(_("Payroll Account:"), 'payroll_act', $_POST['payroll_act']);
118 text_row(_("Past Due Days Interval:"), 'past_due_days', $_POST['past_due_days'], 6, 6, '', "", _("days"));
122 table_section_title(_("Customers and Sales"));
124 text_row(_("Default Credit Limit:"), 'default_credit_limit', $_POST['default_credit_limit'], 12, 12);
126 gl_all_accounts_list_row(_("Sales Exchange Variances Account:"), 'exchange_diff_act', $_POST['exchange_diff_act']);
128 gl_all_accounts_list_row(_("Shipping Charged Account:"), 'freight_act', $_POST['freight_act']);
132 table_section_title(_("Customers and Sales Defaults"));
134 gl_all_accounts_list_row(_("Accounts Receivable Account:"), 'debtors_act', $_POST['debtors_act']);
136 gl_all_accounts_list_row(_("Sales Account:"), 'default_sales_act', $_POST['default_sales_act']);
138 gl_all_accounts_list_row(_("Sales Discount Account:"), 'default_sales_discount_act', $_POST['default_sales_discount_act']);
140 gl_all_accounts_list_row(_("Prompt Payment Discount Account:"), 'default_prompt_payment_act', $_POST['default_prompt_payment_act']);
144 table_section_title(_("Suppliers and Purchasing"));
146 percent_row(_("Delivery Over-Receive Allowance:"), 'po_over_receive');
148 percent_row(_("Invoice Over-Charge Allowance:"), 'po_over_charge');
150 gl_all_accounts_list_row(_("Purchases Exchange Variances Account:"), 'purch_exchange_diff_act', $_POST['purch_exchange_diff_act']);
152 gl_all_accounts_list_row(_("Goods Received Clearing Account:"), 'grn_act', $_POST['grn_act']);
154 table_section_title(_("Suppliers and Purchasing Defaults"));
156 gl_all_accounts_list_row(_("Accounts Payable Account:"), 'creditors_act', $_POST['creditors_act']);
158 gl_all_accounts_list_row(_("Purchase Discount Account:"), 'pyt_discount_act', $_POST['pyt_discount_act']);
162 table_section_title(_("Inventory Defaults"));
164 check_row(_("Allow Negative Inventory:"), 'allow_negative_stock', null);
166 gl_all_accounts_list_row(_("Sales Account:"), 'default_inv_sales_act', $_POST['default_inv_sales_act']);
168 gl_all_accounts_list_row(_("Inventory Account:"), 'default_inventory_act', $_POST['default_inventory_act']);
170 gl_all_accounts_list_row(_("C.O.G.S. Account:"), 'default_cogs_act', $_POST['default_cogs_act']);
172 gl_all_accounts_list_row(_("Inventory Adjustments Account:"), 'default_adj_act', $_POST['default_adj_act']);
174 gl_all_accounts_list_row(_("Item Assembly Costs Account:"), 'default_assembly_act', $_POST['default_assembly_act']);
178 table_section_title(_("Manufacturing Defaults"));
180 text_row(_("Default Work Order Required By After:"), 'default_workorder_required', $_POST['default_workorder_required'], 6, 6, '', "", _("days"));
184 table_section_title(_("Dimension Defaults"));
186 text_row(_("Default Dimension Required By After:"), 'default_dim_required', $_POST['default_dim_required'], 6, 6, '', "", _("days"));
192 submit_center('submit', _("Update"));
196 //-------------------------------------------------------------------------------------------------