Unstable release 2.
[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         }
26         if ($input_error != 1)
27         {
28                 update_company_setup($_POST['coy_name'], $_POST['coy_no'], $_POST['gst_no'], $_POST['tax_prd'], $_POST['tax_last'],
29                         $_POST['postal_address'], $_POST['phone'], $_POST['fax'], $_POST['email'], $_POST['coy_logo'], $_POST['domicile'],
30                         $_POST['use_dimension'], $_POST['custom1_name'], $_POST['custom2_name'], $_POST['custom3_name'],
31                         $_POST['custom1_value'], $_POST['custom2_value'], $_POST['custom3_value'],
32                         $_POST['curr_default'], $_POST['f_year'], check_value('no_item_list'), check_value('no_customer_list'),
33                         check_value('no_supplier_list'));
34
35                 display_notification_centered(_("Company setup has been updated."));
36         }
37
38 } /* end of if submit */
39
40 //---------------------------------------------------------------------------------------------
41
42
43 start_form();
44
45 $myrow = get_company_prefs();
46
47 $_POST['coy_name'] = $myrow["coy_name"];
48 $_POST['gst_no'] = $myrow["gst_no"];
49 $_POST['tax_prd'] = $myrow["tax_prd"];
50 $_POST['tax_last'] = $myrow["tax_last"];
51 $_POST['coy_no']  = $myrow["coy_no"];
52 $_POST['postal_address']  = $myrow["postal_address"];
53 $_POST['phone']  = $myrow["phone"];
54 $_POST['fax']  = $myrow["fax"];
55 $_POST['email']  = $myrow["email"];
56 $_POST['coy_logo']  = $myrow["coy_logo"];
57 $_POST['domicile']  = $myrow["domicile"];
58 $_POST['use_dimension']  = $myrow["use_dimension"];
59 $_POST['no_item_list']  = $myrow["no_item_list"];
60 $_POST['no_customer_list']  = $myrow["no_customer_list"];
61 $_POST['no_supplier_list']  = $myrow["no_supplier_list"];
62 $_POST['custom1_name']  = $myrow["custom1_name"];
63 $_POST['custom2_name']  = $myrow["custom2_name"];
64 $_POST['custom3_name']  = $myrow["custom3_name"];
65 $_POST['custom1_value']  = $myrow["custom1_value"];
66 $_POST['custom2_value']  = $myrow["custom2_value"];
67 $_POST['custom3_value']  = $myrow["custom3_value"];
68 $_POST['curr_default']  = $myrow["curr_default"];
69 $_POST['f_year']  = $myrow["f_year"];
70
71 start_table($table_style2);
72
73 text_row_ex(_("Name (to appear on reports):"), 'coy_name', 42, 50);
74 text_row_ex(_("Official Company Number:"), 'coy_no', 25);
75 text_row_ex(_("Tax Authority Reference:"), 'gst_no', 25);
76
77 text_row_ex(_("Tax Periods:"), 'tax_prd', 10, 10, null, null, _('Months.'));
78 text_row_ex(_("Tax Last Period:"), 'tax_last', 10, 10, null, null, _('Months back.'));
79
80 currencies_list_row(_("Home Currency:"), 'curr_default', $_POST['curr_default']);
81 fiscalyears_list_row(_("Fiscal Year:"), 'f_year', $_POST['f_year']);
82
83 textarea_row(_("Address:"), 'postal_address', $_POST['postal_address'], 35, 5);
84
85 text_row_ex(_("Telephone Number:"), 'phone', 25, 55);
86 text_row_ex(_("Facsimile Number:"), 'fax', 25);
87 text_row_ex(_("Email Address:"), 'email', 25, 55);
88 text_row_ex(_("Company Logo:"), 'coy_logo', 25, 55);
89 text_row_ex(_("Domicile:"), 'domicile', 25, 55);
90
91 number_list_row(_("Use Dimensions:"), 'use_dimension', null, 0, 2);
92
93 check_row(_("No Item List"), 'no_item_list', $_POST['no_item_list']);
94 check_row(_("No Customer List"), 'no_customer_list', $_POST['no_customer_list']);
95 check_row(_("No Supplier List"), 'no_supplier_list', $_POST['no_supplier_list']);
96
97 start_row();
98 end_row();
99 label_row(_("Custom Field Name"), _("Custom Field Value"));
100
101 start_row();
102 text_cells(null, 'custom1_name', $_POST['custom1_name'], 25, 25);
103 text_cells(null, 'custom1_value', $_POST['custom1_value'], 30, 30);
104 end_row();
105
106 start_row();
107 text_cells(null, 'custom2_name', $_POST['custom2_name'], 25, 25);
108 text_cells(null, 'custom2_value', $_POST['custom2_value'], 30, 30);
109 end_row();
110
111 start_row();
112 text_cells(null, 'custom3_name', $_POST['custom3_name'], 25, 25);
113 text_cells(null, 'custom3_value', $_POST['custom3_value'], 30, 30);
114 end_row();
115
116 end_table(1);
117
118 submit_center('submit', _("Update"));
119
120 end_form(2);
121 //-------------------------------------------------------------------------------------------------
122
123 end_page();
124
125 ?>