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['freight_act'],
48 $_POST['default_sales_act'],
49 $_POST['default_sales_discount_act'],
50 $_POST['default_prompt_payment_act'],
51 $_POST['default_inventory_act'],
52 $_POST['default_cogs_act'],
53 $_POST['default_adj_act'],
54 $_POST['default_inv_sales_act'],
55 $_POST['default_assembly_act'],
56 check_value('allow_negative_stock'),
57 input_num('po_over_receive'),
58 input_num('po_over_charge'),
59 $_POST['past_due_days'],
60 $_POST['default_credit_limit'],
61 $_POST['default_workorder_required'],
62 $_POST['default_dim_required']);
64 display_notification(_("The general GL setup has been updated."));
66 } /* end of if submit */
68 //-------------------------------------------------------------------------------------------------
71 start_table("class='tablestyle'");
73 $myrow = get_company_prefs();
75 $_POST['debtors_act'] = $myrow["debtors_act"];
76 $_POST['creditors_act'] = $myrow["creditors_act"];
77 $_POST['freight_act'] = $myrow["freight_act"];
78 $_POST['pyt_discount_act'] = $myrow["pyt_discount_act"];
80 $_POST['default_sales_act'] = $myrow["default_sales_act"];
81 $_POST['default_sales_discount_act'] = $myrow["default_sales_discount_act"];
82 $_POST['default_prompt_payment_act'] = $myrow["default_prompt_payment_act"];
84 $_POST['default_inventory_act'] = $myrow["default_inventory_act"];
85 $_POST['default_cogs_act'] = $myrow["default_cogs_act"];
86 $_POST['default_adj_act'] = $myrow["default_adj_act"];
87 $_POST['default_inv_sales_act'] = $myrow['default_inv_sales_act'];
88 $_POST['default_assembly_act'] = $myrow['default_assembly_act'];
90 $_POST['allow_negative_stock'] = $myrow['allow_negative_stock'];
92 $_POST['po_over_receive'] = percent_format($myrow['po_over_receive']);
93 $_POST['po_over_charge'] = percent_format($myrow['po_over_charge']);
94 $_POST['past_due_days'] = $myrow['past_due_days'];
96 $_POST['default_credit_limit'] = $myrow['default_credit_limit'];
98 $_POST['default_workorder_required'] = $myrow['default_workorder_required'];
99 $_POST['default_dim_required'] = $myrow['default_dim_required'];
104 table_section_title(_("General GL"));
106 // Not used in FA2.0.
107 //gl_all_accounts_list_row(_("Retained Earning Clearing Account:"), 'retained_earnings_act', $_POST['retained_earnings_act']);
108 // Not used in FA2.0.
109 //gl_all_accounts_list_row(_("Payroll Account:"), 'payroll_act', $_POST['payroll_act']);
111 text_row(_("Past Due Days Interval:"), 'past_due_days', $_POST['past_due_days'], 6, 6, '', "", _("days"));
114 table_section_title(_("Customers and Sales"));
116 text_row(_("Default Credit Limit:"), 'default_credit_limit', $_POST['default_credit_limit'], 12, 12);
118 // Not used in FA2.0.
119 //gl_all_accounts_list_row(_("Sales Exchange Variances Account:"), 'exchange_diff_act', $_POST['exchange_diff_act']);
121 gl_all_accounts_list_row(_("Shipping Charged Account:"), 'freight_act', $_POST['freight_act']);
125 table_section_title(_("Customers and Sales Defaults"));
126 // default for customer branch
127 gl_all_accounts_list_row(_("Receivable Account:"), 'debtors_act');
129 gl_all_accounts_list_row(_("Sales Account:"), 'default_sales_act', null,
130 false, false, false, true);
132 gl_all_accounts_list_row(_("Sales Discount Account:"), 'default_sales_discount_act');
134 gl_all_accounts_list_row(_("Prompt Payment Discount Account:"), 'default_prompt_payment_act');
138 table_section_title(_("Suppliers and Purchasing"));
140 percent_row(_("Delivery Over-Receive Allowance:"), 'po_over_receive');
142 percent_row(_("Invoice Over-Charge Allowance:"), 'po_over_charge');
143 // Not used in FA2.0.
144 //gl_all_accounts_list_row(_("Purchases Exchange Variances Account:"), 'purch_exchange_diff_act', $_POST['purch_exchange_diff_act']);
145 // Not used in FA2.0.
146 //gl_all_accounts_list_row(_("Goods Received Clearing Account:"), 'grn_act', $_POST['grn_act']);
148 table_section_title(_("Suppliers and Purchasing Defaults"));
150 gl_all_accounts_list_row(_("Payable Account:"), 'creditors_act', $_POST['creditors_act']);
152 gl_all_accounts_list_row(_("Purchase Discount Account:"), 'pyt_discount_act', $_POST['pyt_discount_act']);
156 table_section_title(_("Inventory"));
158 check_row(_("Allow Negative Inventory:"), 'allow_negative_stock', null);
160 table_section_title(_("Items Defaults"));
161 gl_all_accounts_list_row(_("Sales Account:"), 'default_inv_sales_act', $_POST['default_inv_sales_act']);
163 gl_all_accounts_list_row(_("Inventory Account:"), 'default_inventory_act', $_POST['default_inventory_act']);
164 // this one is default for items and suppliers (purchase account)
165 gl_all_accounts_list_row(_("C.O.G.S. Account:"), 'default_cogs_act', $_POST['default_cogs_act']);
167 gl_all_accounts_list_row(_("Inventory Adjustments Account:"), 'default_adj_act', $_POST['default_adj_act']);
169 gl_all_accounts_list_row(_("Item Assembly Costs Account:"), 'default_assembly_act', $_POST['default_assembly_act']);
173 table_section_title(_("Manufacturing Defaults"));
175 text_row(_("Work Order Required By After:"), 'default_workorder_required', $_POST['default_workorder_required'], 6, 6, '', "", _("days"));
179 table_section_title(_("Dimension Defaults"));
181 text_row(_("Dimension Required By After:"), 'default_dim_required', $_POST['default_dim_required'], 6, 6, '', "", _("days"));
187 submit_center('submit', _("Update"));
191 //-------------------------------------------------------------------------------------------------