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 ***********************************************************************/
13 // ----------------------------------------------------------------
17 // Title: Dimension Summary
18 // ----------------------------------------------------------------
21 include_once($path_to_root . "/includes/session.inc");
22 include_once($path_to_root . "/includes/date_functions.inc");
23 include_once($path_to_root . "/includes/data_checks.inc");
24 include_once($path_to_root . "/gl/includes/gl_db.inc");
26 //----------------------------------------------------------------------------------------------------
28 // trial_inquiry_controls();
29 print_dimension_summary();
31 function getTransactions($from, $to)
36 WHERE reference >= '$from'
37 AND reference <= '$to'
41 return db_query($sql,"No transactions were returned");
47 $date = begin_fiscalyear($date);
50 $sql = "SELECT SUM(amount) AS Balance
53 WHERE (dimension_id = '$dim' OR dimension2_id = '$dim')
54 AND tran_date >= '$date'";
56 $TransResult = db_query($sql,"No transactions were returned");
57 if (db_num_rows($TransResult) == 1)
59 $DemandRow = db_fetch_row($TransResult);
60 $balance = $DemandRow[0];
68 //----------------------------------------------------------------------------------------------------
70 function print_dimension_summary()
74 $fromdim = $_POST['PARAM_0'];
75 $todim = $_POST['PARAM_1'];
76 $showbal = $_POST['PARAM_2'];
77 $comments = $_POST['PARAM_3'];
78 $destination = $_POST['PARAM_4'];
81 include_once($path_to_root . "/reporting/includes/excel_report.inc");
82 $filename = "DimensionSummary.xml";
86 include_once($path_to_root . "/reporting/includes/pdf_report.inc");
87 $filename = "DimensionSummary.pdf";
90 $cols = array(0, 50, 210, 250, 320, 395, 465, 515);
92 $headers = array(_('Reference'), _('Name'), _('Type'), _('Date'), _('Due Date'), _('Closed'), _('YTD'));
94 $aligns = array('left', 'left', 'left', 'left', 'left', 'left', 'right');
96 $params = array( 0 => $comments,
97 1 => array('text' => _('Dimension'), 'from' => $fromdim, 'to' => $todim));
99 $rep = new FrontReport(_('Dimension Summary'), $filename, user_pagesize());
102 $rep->Info($params, $cols, $headers, $aligns);
105 $res = getTransactions($fromdim, $todim);
106 while ($trans=db_fetch($res))
108 $rep->TextCol(0, 1, $trans['reference']);
109 $rep->TextCol(1, 2, $trans['name']);
110 $rep->TextCol(2, 3, $trans['type_']);
111 $rep->DateCol(3, 4, $trans['date_'], true);
112 $rep->DateCol(4, 5, $trans['due_date'], true);
113 if ($trans['closed'])
117 $rep->TextCol(5, 6, $str);
120 $balance = getYTD($trans['id']);
121 $rep->AmountCol(6, 7, $balance, 0);
125 $rep->Line($rep->row);