$main::lxdebug->leave_sub();
}
+sub get_storno {
+ $main::lxdebug->enter_sub();
+ my ($self, $dbh, $form) = @_;
+ my $query = qq|SELECT invnumber FROM $form->{arap} WHERE invnumber LIKE "Storno zu "|;
+ my $sth = $dbh->prepare($query);
+ while(my $ref = $sth->fetchrow_hashref()) {
+ $ref->{invnumer} =~ s/Storno zu //g;
+ $form->{storno}{$ref->{invnumber}} = 1;
+ }
+ $main::lxdebug->leave_sub();
+}
+
sub aging {
$main::lxdebug->enter_sub();
$form->{todate} = $form->current_date($myconfig) unless ($form->{todate});
- my $where = "1 = 1";
+ my $where = " 1 = 1 ";
my ($name, $null);
if ($form->{"$form->{ct}_id"}) {
WHERE $form->{arap}.curr = exchangerate.curr
AND exchangerate.transdate = $form->{arap}.transdate) AS exchangerate
FROM $form->{arap}, $form->{ct}
- WHERE paid != amount
+ WHERE paid != amount
+ AND $form->{arap}.storno IS FALSE
AND $form->{arap}.$form->{ct}_id = $form->{ct}.id
AND $form->{ct}.id = $id
AND (
WHERE $form->{arap}.curr = exchangerate.curr
AND exchangerate.transdate = $form->{arap}.transdate) AS exchangerate
FROM $form->{arap}, $form->{ct}
- WHERE paid != amount
+ WHERE paid != amount
+ AND $form->{arap}.storno IS FALSE
AND $form->{arap}.$form->{ct}_id = $form->{ct}.id
AND $form->{ct}.id = $id
AND (
WHERE $form->{arap}.curr = exchangerate.curr
AND exchangerate.transdate = $form->{arap}.transdate) AS exchangerate
FROM $form->{arap}, $form->{ct}
- WHERE paid != amount
+ WHERE paid != amount
+ AND $form->{arap}.storno IS FALSE
AND $form->{arap}.$form->{ct}_id = $form->{ct}.id
AND $form->{ct}.id = $id
AND (
WHERE $form->{arap}.curr = exchangerate.curr
AND exchangerate.transdate = $form->{arap}.transdate) AS exchangerate
FROM $form->{arap}, $form->{ct}
- WHERE paid != amount
+ WHERE paid != amount
+ AND $form->{arap}.storno IS FALSE
AND $form->{arap}.$form->{ct}_id = $form->{ct}.id
AND $form->{ct}.id = $id
AND transdate < (date '$form->{todate}' - interval '90 days')