Replaced the global variables for table styles to defined CSS classes.
[fa-stable.git] / dimensions / includes / dimensions_ui.inc
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 include_once($path_to_root . "/includes/ui.inc");
13
14 //--------------------------------------------------------------------------------------
15
16 function display_dimension_balance($id, $from, $to)
17 {
18         global $path_to_root;
19
20         $result = get_dimension_balance_all($id, $from, $to);
21
22     if (db_num_rows($result) == 0)
23     {
24         display_note(_("There are no transactions for this dimension for the selected period."));
25     }
26     else
27     {
28                 display_heading2(_("Balance for this Dimension"));
29                 br();
30                 start_table(TABLESTYLE);
31                 $th = array(_("Account"), _("Debit"), _("Credit"));
32                 table_header($th);
33
34         $total = $k = 0;
35         while ($myrow = db_fetch($result))
36         {
37                         alt_table_row_color($k);
38
39                         label_cell($myrow["account"]." ".$myrow['account_name']);
40                         display_debit_or_credit_cells($myrow["amt"]);
41                         $total += $myrow["amt"];
42                         end_row();
43                 }
44                 start_row();
45                 label_cell("<b>"._("Balance")."</b>");
46                 if ($total >= 0)
47                 {
48                         amount_cell($total, true);
49                         label_cell("");
50                 }
51                 else
52                 {
53                         label_cell("");
54                         amount_cell(abs($total), true);
55                 }
56                 end_row();
57
58                 end_table();
59     }
60 }
61
62 //--------------------------------------------------------------------------------------
63
64 ?>