9d74b06b84f5ae82647a48b114b294f8505d4b42
[fa-stable.git] / dimensions / view / view_dimension.php
1 <?php
2 /**********************************************************************
3     Copyright (C) FrontAccounting, LLC.
4         Released under the terms of the GNU General Public License, GPL, 
5         as published by the Free Software Foundation, either version 3 
6         of the License, or (at your option) any later version.
7     This program is distributed in the hope that it will be useful,
8     but WITHOUT ANY WARRANTY; without even the implied warranty of
9     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
10     See the License here <http://www.gnu.org/licenses/gpl-3.0.html>.
11 ***********************************************************************/
12 $page_security = 10;
13 $path_to_root="../..";
14
15 include_once($path_to_root . "/includes/session.inc");
16
17 $js = "";
18 if ($use_date_picker)
19         $js .= get_js_date_picker();
20 page(_("View Dimension"), true, false, "", $js);
21
22 include_once($path_to_root . "/includes/date_functions.inc");
23 include_once($path_to_root . "/includes/data_checks.inc");
24
25 include_once($path_to_root . "/dimensions/includes/dimensions_db.inc");
26 include_once($path_to_root . "/dimensions/includes/dimensions_ui.inc");
27
28 //-------------------------------------------------------------------------------------------------
29
30 if (isset($_GET['trans_no']) && $_GET['trans_no'] != "")
31 {
32         $id = $_GET['trans_no'];
33 }
34
35 if (isset($_POST['Show']))
36 {
37         $id = $_POST['trans_no'];
38 }
39
40
41 display_heading(systypes::name(systypes::dimension()) . " # " . $id);
42
43 br(1);
44 $myrow = get_dimension($id);
45
46 if (strlen($myrow[0]) == 0)
47 {
48         echo _("The dimension number sent is not valid.");
49     exit;
50 }
51
52 start_table($table_style);
53
54 $th = array(_("#"), _("Reference"), _("Name"), _("Type"), _("Date"), _("Due Date"));
55 table_header($th);
56
57 start_row();
58 label_cell($myrow["id"]);
59 label_cell($myrow["reference"]);
60 label_cell($myrow["name"]);
61 label_cell($myrow["type_"]);
62 label_cell(sql2date($myrow["date_"]));
63 label_cell(sql2date($myrow["due_date"]));
64 end_row();
65
66 comments_display_row(systypes::dimension(), $id);
67
68 end_table();
69
70 if ($myrow["closed"] == true)
71 {
72         display_note(_("This dimension is closed."));
73 }
74
75 start_form();
76
77 start_table("class='tablestyle_noborder'");
78 start_row();
79
80 if (!isset($_POST['TransFromDate']))
81         $_POST['TransFromDate'] = begin_fiscalyear();
82 if (!isset($_POST['TransToDate']))
83         $_POST['TransToDate'] = Today();
84 date_cells(_("from:"), 'TransFromDate');
85 date_cells(_("to:"), 'TransToDate');
86 submit_cells('Show',_("Show"), '', false, 'default');
87
88 end_row();
89
90 end_table();
91 hidden('trans_no', $id);
92 end_form();
93
94 display_dimension_balance($id, $_POST['TransFromDate'], $_POST['TransToDate']);
95
96 br(1);
97
98 end_page(true);
99
100 ?>