# NOTE: Postgres is really picky about the order of implicit CROSS
# JOINs with ',' if you alias the tables and want to use the
# alias later in another JOIN. the alias you want to use has to
# NOTE: Postgres is really picky about the order of implicit CROSS
# JOINs with ',' if you alias the tables and want to use the
# alias later in another JOIN. the alias you want to use has to
qq|SELECT a.id, a.invnumber, c.name, ac.transdate, | .
qq| a.invoice, ac.amount, 'ar' as module | .
qq|FROM acc_trans ac, customer c, ar a | .
$dpt_join .
qq|WHERE | . $where . $dpt_where . $project .
qq|SELECT a.id, a.invnumber, c.name, ac.transdate, | .
qq| a.invoice, ac.amount, 'ar' as module | .
qq|FROM acc_trans ac, customer c, ar a | .
$dpt_join .
qq|WHERE | . $where . $dpt_where . $project .
- qq| AND ac.chart_id = ? | .
- qq| AND ac.trans_id = a.id | .
- qq| AND a.customer_id = c.id | .
+ qq| AND ac.chart_id = ? | .
+ qq| AND NOT a.storno | .
+ qq| AND ac.trans_id = a.id | .
+ qq| AND a.customer_id = c.id | .
qq|SELECT a.id, a.invnumber, v.name, ac.transdate, | .
qq| a.invoice, ac.amount, 'ap' as module | .
qq|FROM acc_trans ac, vendor v, ap a | .
$dpt_join .
qq|WHERE | . $where . $dpt_where . $project .
qq|SELECT a.id, a.invnumber, v.name, ac.transdate, | .
qq| a.invoice, ac.amount, 'ap' as module | .
qq|FROM acc_trans ac, vendor v, ap a | .
$dpt_join .
qq|WHERE | . $where . $dpt_where . $project .
- qq| AND ac.chart_id = ? | .
- qq| AND ac.trans_id = a.id | .
- qq| AND a.vendor_id = v.id |;
+ qq| AND ac.chart_id = ? | .
+ qq| AND ac.trans_id = a.id | .
+ qq| AND NOT a.storno | .
+ qq| AND a.vendor_id = v.id |;
push(@values,
@where_values, @department_values, @project_values, $id,
push(@values,
@where_values, @department_values, @project_values, $id,
$sth = prepare_execute_query($form, $dbh, $query, @values);
$form->{CA} = [];
$sth = prepare_execute_query($form, $dbh, $query, @values);
$form->{CA} = [];