Automatic calculation of not set item prices from home currency and base price list...
[fa-stable.git] / admin / company_preferences.php
1 <?php
2
3 $page_security =10;
4 $path_to_root="..";
5 include($path_to_root . "/includes/session.inc");
6
7 page(_("Company Setup"));
8
9 include_once($path_to_root . "/includes/date_functions.inc");
10 include_once($path_to_root . "/includes/ui.inc");
11
12 include_once($path_to_root . "/admin/db/company_db.inc");
13
14 //-------------------------------------------------------------------------------------------------
15
16 if (isset($_POST['submit']) && $_POST['submit'] != "")
17 {
18
19         $input_error = 0;
20
21         if (strlen($_POST['coy_name'])==0)
22         {
23                 $input_error = 1;
24                 display_error(_("The company name must be entered."));
25                 set_focus('coy_name');
26         }
27         if ($input_error != 1)
28         {
29                 update_company_setup($_POST['coy_name'], $_POST['coy_no'], $_POST['gst_no'], $_POST['tax_prd'], $_POST['tax_last'],
30                         $_POST['postal_address'], $_POST['phone'], $_POST['fax'], $_POST['email'], $_POST['coy_logo'], $_POST['domicile'],
31                         $_POST['use_dimension'], $_POST['custom1_name'], $_POST['custom2_name'], $_POST['custom3_name'],
32                         $_POST['custom1_value'], $_POST['custom2_value'], $_POST['custom3_value'],
33                         $_POST['curr_default'], $_POST['f_year'], check_value('no_item_list'), check_value('no_customer_list'),
34                         check_value('no_supplier_list'), $_POST['base_sales']);
35
36                 display_notification_centered(_("Company setup has been updated."));
37         }
38
39 } /* end of if submit */
40
41 //---------------------------------------------------------------------------------------------
42
43
44 start_form();
45
46 $myrow = get_company_prefs();
47
48 $_POST['coy_name'] = $myrow["coy_name"];
49 $_POST['gst_no'] = $myrow["gst_no"];
50 $_POST['tax_prd'] = $myrow["tax_prd"];
51 $_POST['tax_last'] = $myrow["tax_last"];
52 $_POST['coy_no']  = $myrow["coy_no"];
53 $_POST['postal_address']  = $myrow["postal_address"];
54 $_POST['phone']  = $myrow["phone"];
55 $_POST['fax']  = $myrow["fax"];
56 $_POST['email']  = $myrow["email"];
57 $_POST['coy_logo']  = $myrow["coy_logo"];
58 $_POST['domicile']  = $myrow["domicile"];
59 $_POST['use_dimension']  = $myrow["use_dimension"];
60 $_POST['base_sales']  = $myrow["base_sales"];
61 $_POST['no_item_list']  = $myrow["no_item_list"];
62 $_POST['no_customer_list']  = $myrow["no_customer_list"];
63 $_POST['no_supplier_list']  = $myrow["no_supplier_list"];
64 $_POST['custom1_name']  = $myrow["custom1_name"];
65 $_POST['custom2_name']  = $myrow["custom2_name"];
66 $_POST['custom3_name']  = $myrow["custom3_name"];
67 $_POST['custom1_value']  = $myrow["custom1_value"];
68 $_POST['custom2_value']  = $myrow["custom2_value"];
69 $_POST['custom3_value']  = $myrow["custom3_value"];
70 $_POST['curr_default']  = $myrow["curr_default"];
71 $_POST['f_year']  = $myrow["f_year"];
72
73 start_table($table_style2);
74
75 text_row_ex(_("Name (to appear on reports):"), 'coy_name', 42, 50);
76 text_row_ex(_("Official Company Number:"), 'coy_no', 25);
77 text_row_ex(_("Tax Authority Reference:"), 'gst_no', 25);
78
79 text_row_ex(_("Tax Periods:"), 'tax_prd', 10, 10, null, null, _('Months.'));
80 text_row_ex(_("Tax Last Period:"), 'tax_last', 10, 10, null, null, _('Months back.'));
81
82 currencies_list_row(_("Home Currency:"), 'curr_default', $_POST['curr_default']);
83 fiscalyears_list_row(_("Fiscal Year:"), 'f_year', $_POST['f_year']);
84
85 textarea_row(_("Address:"), 'postal_address', $_POST['postal_address'], 35, 5);
86
87 text_row_ex(_("Telephone Number:"), 'phone', 25, 55);
88 text_row_ex(_("Facsimile Number:"), 'fax', 25);
89 text_row_ex(_("Email Address:"), 'email', 25, 55);
90 text_row_ex(_("Company Logo:"), 'coy_logo', 25, 55);
91 text_row_ex(_("Domicile:"), 'domicile', 25, 55);
92
93 number_list_row(_("Use Dimensions:"), 'use_dimension', null, 0, 2);
94 sales_types_list_row(_("Base for auto price calculations:"), 'base_sales', $_POST['base_sales'], false,
95     _('No base price list') );
96
97 check_row(_("No Item List"), 'no_item_list', $_POST['no_item_list']);
98 check_row(_("No Customer List"), 'no_customer_list', $_POST['no_customer_list']);
99 check_row(_("No Supplier List"), 'no_supplier_list', $_POST['no_supplier_list']);
100
101 start_row();
102 end_row();
103 label_row(_("Custom Field Name"), _("Custom Field Value"));
104
105 start_row();
106 text_cells(null, 'custom1_name', $_POST['custom1_name'], 25, 25);
107 text_cells(null, 'custom1_value', $_POST['custom1_value'], 30, 30);
108 end_row();
109
110 start_row();
111 text_cells(null, 'custom2_name', $_POST['custom2_name'], 25, 25);
112 text_cells(null, 'custom2_value', $_POST['custom2_value'], 30, 30);
113 end_row();
114
115 start_row();
116 text_cells(null, 'custom3_name', $_POST['custom3_name'], 25, 25);
117 text_cells(null, 'custom3_value', $_POST['custom3_value'], 30, 30);
118 end_row();
119
120 end_table(1);
121
122 submit_center('submit', _("Update"));
123
124 end_form(2);
125 //-------------------------------------------------------------------------------------------------
126
127 end_page();
128
129 ?>