- # get beginning balances
- $query =
- qq|SELECT c.accno, c.category, SUM(ac.amount) AS amount, c.description
- FROM acc_trans ac
- LEFT JOIN chart c ON (ac.chart_id = c.id)
- $dpt_join
- WHERE ((select date_trunc('year', ac.transdate::date)) = (select date_trunc('year', ?::date))) AND ac.ob_transaction $acc_cash_where
- $dpt_where
- $project
- GROUP BY c.accno, c.category, c.description |;
+ if ($options{beginning_balances}) {
+ # get beginning balances
+ $query =
+ qq|SELECT c.accno, c.category, SUM(ac.amount) AS amount, c.description
+ FROM acc_trans ac
+ LEFT JOIN chart c ON (ac.chart_id = c.id)
+ $dpt_join
+ WHERE ((select date_trunc('year', ac.transdate::date)) = (select date_trunc('year', ?::date))) AND ac.ob_transaction $acc_cash_where
+ $dpt_where
+ $project
+ GROUP BY c.accno, c.category, c.description |;