@values = ();
foreach my $id (@id) {
-
+
# 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
$dpt_join .
qq|WHERE | . $where . $dpt_where . $project .
qq| AND ac.chart_id = ? | .
- qq| AND ac.trans_id = a.id | .
qq|UNION | .
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 a.customer_id = c.id | .
qq|UNION | .
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 NOT a.storno | .
+ qq| AND a.vendor_id = v.id |;
push(@values,
@where_values, @department_values, @project_values, $id,
$union = qq|UNION ALL|;
}
- $query .= qq|ORDER BY | . $sortorder;
+ $query .= qq|ORDER BY | . $form->{sort};
$sth = prepare_execute_query($form, $dbh, $query, @values);
$form->{CA} = [];