4 // ----------------------------------------------------------------
8 // Title: Chart of GL Accounts
9 // ----------------------------------------------------------------
12 include_once($path_to_root . "includes/session.inc");
13 include_once($path_to_root . "includes/date_functions.inc");
14 include_once($path_to_root . "includes/data_checks.inc");
15 include_once($path_to_root . "gl/includes/gl_db.inc");
17 //----------------------------------------------------------------------------------------------------
19 // trial_inquiry_controls();
20 print_Chart_of_Accounts();
22 //----------------------------------------------------------------------------------------------------
24 function print_Chart_of_Accounts()
28 include_once($path_to_root . "reporting/includes/pdf_report.inc");
30 $showbalance = $_POST['PARAM_0'];
31 $comments = $_POST['PARAM_1'];
34 $cols = array(0, 50, 300, 425, 500);
36 $headers = array(_('Account'), _('Account Name'), _('Account Code'), _('Balance'));
38 $aligns = array('left', 'left', 'left', 'right');
40 $params = array(0 => $comments);
42 $rep = new FrontReport(_('Chart of Accounts'), "ChartOfAccounts.pdf", user_pagesize());
45 $rep->Info($params, $cols, $headers, $aligns);
51 $accounts = get_gl_accounts_all();
53 while ($account=db_fetch($accounts))
55 if ($showbalance == 1)
57 $begin = begin_fiscalyear();
58 if (is_account_balancesheet($account["account_code"]))
60 $balance = get_gl_trans_from_to($begin, ToDay(), $account["account_code"], 0);
62 if ($account['AccountTypeName'] != $group)
66 if ($account['AccountClassName'] != $classname)
69 $rep->TextCol(0, 4, $account['AccountClassName']);
71 $rep->row -= ($rep->lineHeight + 4);
73 $group = $account['AccountTypeName'];
74 $rep->TextCol(0, 4, $account['AccountTypeName']);
75 //$rep->Line($rep->row - 4);
76 $rep->row -= ($rep->lineHeight + 4);
78 $classname = $account['AccountClassName'];
80 $rep->TextCol(0, 1, $account['account_code']);
81 $rep->TextCol(1, 2, $account['account_name']);
82 $rep->TextCol(2, 3, $account['account_code2']);
83 if ($showbalance == 1)
84 $rep->TextCol(3, 4, number_format2($balance, $dec));
87 if ($rep->row < $rep->bottomMargin + 3 * $rep->lineHeight)
89 $rep->Line($rep->row - 2);
93 $rep->Line($rep->row);