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: List of Journal Entries
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");
25 include_once($path_to_root . "/includes/ui/ui_view.inc");
27 //----------------------------------------------------------------------------------------------------
29 print_list_of_journal_entries();
31 //----------------------------------------------------------------------------------------------------
33 function print_list_of_journal_entries()
37 $from = $_POST['PARAM_0'];
38 $to = $_POST['PARAM_1'];
39 $systype = $_POST['PARAM_2'];
40 $comments = $_POST['PARAM_3'];
41 $destination = $_POST['PARAM_4'];
43 include_once($path_to_root . "/reporting/includes/excel_report.inc");
45 include_once($path_to_root . "/reporting/includes/pdf_report.inc");
47 $dec = user_price_dec();
49 $cols = array(0, 100, 240, 300, 400, 460, 520, 580);
51 $headers = array(_('Type/Account'), _('Account Name'), _('Date/Dim.'),
52 _('Person/Item/Memo'), _('Debit'), _('Credit'));
54 $aligns = array('left', 'left', 'left', 'left', 'right', 'right');
56 $params = array( 0 => $comments,
57 1 => array('text' => _('Period'), 'from' => $from,'to' => $to),
58 2 => array('text' => _('Type'), 'from' => systypes::name($systype),
61 $rep = new FrontReport(_('List of Journal Entries'), "JournalEntries", user_pagesize());
64 $rep->Info($params, $cols, $headers, $aligns);
70 $trans = get_gl_transactions($from, $to, -1, null, 0, 0, $systype);
73 while ($myrow=db_fetch($trans))
75 if ($type != $myrow['type'] || $typeno != $myrow['type_no'])
79 $rep->Line($rep->row + 4);
82 $typeno = $myrow['type_no'];
83 $type = $myrow['type'];
84 $TransName = systypes::name($myrow['type']);
85 $rep->TextCol(0, 2, $TransName . " # " . $myrow['type_no']);
86 $rep->DateCol(2, 3, $myrow['tran_date'], true);
87 $coms = payment_person_types::person_name($myrow["person_type_id"],$myrow["person_id"]);
88 $memo = get_comments_string($myrow['type'], $myrow['type_no']);
90 $coms .= ($coms!= "")?"/":"" . $memo;
91 $rep->TextCol(3, 6, $coms);
94 $rep->TextCol(0, 1, $myrow['account']);
95 $rep->TextCol(1, 2, $myrow['account_name']);
96 $dim_str = get_dimension_string($myrow['dimension_id']);
97 $dim_str2 = get_dimension_string($myrow['dimension2_id']);
99 $dim_str .= "/".$dim_str2;
100 $rep->TextCol(2, 3, $dim_str);
101 $rep->TextCol(3, 4, $myrow['memo_']);
102 if ($myrow['amount'] > 0.0)
103 $rep->AmountCol(4, 5, abs($myrow['amount']), $dec);
105 $rep->AmountCol(5, 6, abs($myrow['amount']), $dec);
108 $rep->Line($rep->row + 4);