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."));
25 if (!check_num('po_over_charge', 0, 100))
27 display_error(_("The invoice over-charge allowance must be between 0 and 100."));
31 if (!check_num('past_due_days', 0, 100))
33 display_error(_("The past due days interval allowance must be between 0 and 100."));
39 //-------------------------------------------------------------------------------------------------
41 if (isset($_POST['submit']) && can_process())
43 update_company_gl_setup($_POST['debtors_act'], $_POST['pyt_discount_act'],
44 $_POST['creditors_act'], $_POST['grn_act'],
45 $_POST['exchange_diff_act'], $_POST['purch_exchange_diff_act'],
46 $_POST['retained_earnings_act'], $_POST['freight_act'],
47 $_POST['default_sales_act'],
48 $_POST['default_sales_discount_act'],
49 $_POST['default_prompt_payment_act'],
50 $_POST['default_inventory_act'],
51 $_POST['default_cogs_act'],
52 $_POST['default_adj_act'],
53 $_POST['default_inv_sales_act'],
54 $_POST['default_assembly_act'], $_POST['payroll_act'],
55 check_value('allow_negative_stock'),
56 input_num('po_over_receive'),
57 input_num('po_over_charge'),
58 $_POST['past_due_days'],
59 $_POST['default_credit_limit'],
60 $_POST['default_workorder_required'],
61 $_POST['default_dim_required']);
63 display_notification(_("The general GL setup has been updated."));
65 } /* end of if submit */
67 //-------------------------------------------------------------------------------------------------
70 start_table("class='tablestyle'");
72 $myrow = get_company_prefs();
74 $_POST['debtors_act'] = $myrow["debtors_act"];
75 $_POST['creditors_act'] = $myrow["creditors_act"];
76 $_POST['grn_act'] = $myrow["grn_act"];
77 $_POST['retained_earnings_act'] = $myrow["retained_earnings_act"];
78 $_POST['freight_act'] = $myrow["freight_act"];
79 $_POST['exchange_diff_act'] = $myrow["exchange_diff_act"];
81 $_POST['purch_exchange_diff_act'] = $myrow["purch_exchange_diff_act"];
82 $_POST['pyt_discount_act'] = $myrow["pyt_discount_act"];
84 $_POST['default_sales_act'] = $myrow["default_sales_act"];
85 $_POST['default_sales_discount_act'] = $myrow["default_sales_discount_act"];
86 $_POST['default_prompt_payment_act'] = $myrow["default_prompt_payment_act"];
88 $_POST['default_inventory_act'] = $myrow["default_inventory_act"];
89 $_POST['default_cogs_act'] = $myrow["default_cogs_act"];
90 $_POST['default_adj_act'] = $myrow["default_adj_act"];
91 $_POST['default_inv_sales_act'] = $myrow['default_inv_sales_act'];
92 $_POST['default_assembly_act'] = $myrow['default_assembly_act'];
93 $_POST['payroll_act'] = $myrow['payroll_act'];
95 $_POST['allow_negative_stock'] = $myrow['allow_negative_stock'];
97 $_POST['po_over_receive'] = percent_format($myrow['po_over_receive']);
98 $_POST['po_over_charge'] = percent_format($myrow['po_over_charge']);
99 $_POST['past_due_days'] = $myrow['past_due_days'];
101 $_POST['default_credit_limit'] = $myrow['default_credit_limit'];
103 $_POST['default_workorder_required'] = $myrow['default_workorder_required'];
104 $_POST['default_dim_required'] = $myrow['default_dim_required'];
111 table_section_title(_("General GL"));
113 gl_all_accounts_list_row(_("Retained Earning Clearing Account:"), 'retained_earnings_act', $_POST['retained_earnings_act']);
114 gl_all_accounts_list_row(_("Payroll Account:"), 'payroll_act', $_POST['payroll_act']);
115 text_row(_("Past Due Days Interval:"), 'past_due_days', $_POST['past_due_days'], 6, 6, "", _("days"));
119 table_section_title(_("Customers and Sales"));
121 text_row(_("Default Credit Limit:"), 'default_credit_limit', $_POST['default_credit_limit'], 12, 12);
123 gl_all_accounts_list_row(_("Sales Exchange Variances Account:"), 'exchange_diff_act', $_POST['exchange_diff_act']);
125 gl_all_accounts_list_row(_("Shipping Charged Account:"), 'freight_act', $_POST['freight_act']);
129 table_section_title(_("Customers and Sales Defaults"));
131 gl_all_accounts_list_row(_("Accounts Receivable Account:"), 'debtors_act', $_POST['debtors_act']);
133 gl_all_accounts_list_row(_("Sales Account:"), 'default_sales_act', $_POST['default_sales_act']);
135 gl_all_accounts_list_row(_("Sales Discount Account:"), 'default_sales_discount_act', $_POST['default_sales_discount_act']);
137 gl_all_accounts_list_row(_("Prompt Payment Discount Account:"), 'default_prompt_payment_act', $_POST['default_prompt_payment_act']);
141 table_section_title(_("Suppliers and Purchasing"));
143 percent_row(_("Delivery Over-Receive Allowance:"), 'po_over_receive');
145 percent_row(_("Invoice Over-Charge Allowance:"), 'po_over_charge');
147 gl_all_accounts_list_row(_("Purchases Exchange Variances Account:"), 'purch_exchange_diff_act', $_POST['purch_exchange_diff_act']);
149 gl_all_accounts_list_row(_("Goods Received Clearing Account:"), 'grn_act', $_POST['grn_act']);
151 table_section_title(_("Suppliers and Purchasing Defaults"));
153 gl_all_accounts_list_row(_("Accounts Payable Account:"), 'creditors_act', $_POST['creditors_act']);
155 gl_all_accounts_list_row(_("Purchase Discount Account:"), 'pyt_discount_act', $_POST['pyt_discount_act']);
159 table_section_title(_("Inventory Defaults"));
161 check_row(_("Allow Negative Inventory:"), 'allow_negative_stock', null);
163 gl_all_accounts_list_row(_("Sales Account:"), 'default_inv_sales_act', $_POST['default_inv_sales_act']);
165 gl_all_accounts_list_row(_("Inventory Account:"), 'default_inventory_act', $_POST['default_inventory_act']);
167 gl_all_accounts_list_row(_("C.O.G.S. Account:"), 'default_cogs_act', $_POST['default_cogs_act']);
169 gl_all_accounts_list_row(_("Inventory Adjustments Account:"), 'default_adj_act', $_POST['default_adj_act']);
171 gl_all_accounts_list_row(_("Item Assembly Costs Account:"), 'default_assembly_act', $_POST['default_assembly_act']);
175 table_section_title(_("Manufacturing Defaults"));
177 text_row(_("Default Work Order Required By After:"), 'default_workorder_required', $_POST['default_workorder_required'], 6, 6, "", _("days"));
181 table_section_title(_("Dimension Defaults"));
183 text_row(_("Default Dimension Required By After:"), 'default_dim_required', $_POST['default_dim_required'], 6, 6, "", _("days"));
189 submit_center('submit', _("Update"));
193 //-------------------------------------------------------------------------------------------------