$comments, 1 => array('text' => _('Period'),'from' => $from, 'to' => $to), 2 => array('text' => _('Dimension')." 1", 'from' => get_dimension_string($dimension), 'to' => ''), 3 => array('text' => _('Dimension')." 2", 'from' => get_dimension_string($dimension2), 'to' => '')); } else if ($dim == 1) { $params = array( 0 => $comments, 1 => array('text' => _('Period'),'from' => $from, 'to' => $to), 2 => array('text' => _('Dimension'), 'from' => get_dimension_string($dimension), 'to' => '')); } else { $params = array( 0 => $comments, 1 => array('text' => _('Period'),'from' => $from, 'to' => $to)); } $rep = new FrontReport(_('Trial Balance'), "TrialBalance.pdf", user_pagesize()); $rep->Font(); $rep->Info($params, $cols, $headers, $aligns, $cols2, $headers2, $aligns2); $rep->Header(); $accounts = get_gl_accounts(); while ($account=db_fetch($accounts)) { if (is_account_balancesheet($account["account_code"])) $begin = ""; else { if ($from < $begin) $begin = add_days($from, -1); else $begin = add_days(begin_fiscalyear(), -1); } $prev_balance = get_gl_balance_from_to($begin, $from, $account["account_code"], $dimension, $dimension2); $curr_balance = get_gl_trans_from_to($from, $to, $account["account_code"], $dimension, $dimension2); if ($zero == 0 && !$prev_balance && !$curr_balance) continue; $rep->TextCol(0, 1, $account['account_code']); $rep->TextCol(1, 2, $account['account_name']); if ($prev_balance > 0.0) $rep->TextCol(2, 3, number_format2(abs($prev_balance), $dec)); else $rep->TextCol(3, 4, number_format2(abs($prev_balance), $dec)); if ($curr_balance > 0.0) $rep->TextCol(4, 5, number_format2(abs($curr_balance), $dec)); else $rep->TextCol(5, 6, number_format2(abs($curr_balance), $dec)); if ($curr_balance + $prev_balance > 0.0) $rep->TextCol(6, 7, number_format2(abs($curr_balance + $prev_balance), $dec)); else $rep->TextCol(7, 8, number_format2(abs($curr_balance + $prev_balance), $dec)); $rep->NewLine(); if ($rep->row < $rep->bottomMargin + $rep->lineHeight) { $rep->Line($rep->row - 2); $rep->Header(); } } $rep->Line($rep->row); $rep->End(); } ?>