$form->{todate} = $form->current_date($myconfig) unless ($form->{todate});
my $todate = conv_dateq($form->{todate});
+ my $fromdate = conv_dateq($form->{fromdate});
+
+ my $fromwhere = ($form->{fromdate} ne "") ? " AND (transdate >= (date $fromdate)) " : "";
my $where = " 1 = 1 ";
my ($name, $null);
AND (${arap}.storno IS FALSE)
AND (${arap}.${ct}_id = ${ct}.id)
AND (${ct}.id = ?)
- AND (transdate <= (date $todate))
+ AND (transdate <= (date $todate) $fromwhere )
ORDER BY ctid, transdate, invnumber |;
WHERE $where
AND (a.${ct_id} = ct.id)
AND ((a.paid != a.amount) OR ((a.datepaid > $todate) AND (datepaid is NOT NULL)))
- AND (a.transdate <= $todate)
+ AND (a.transdate <= $todate $fromwhere)
ORDER BY ct.name|;
my $sth = prepare_execute_query($form, $dbh, $query);
$value_2 = "";
$trigger_2 = "trigger2";
} elsif (($form->{report} eq "ar_aging") || ($form->{report} eq "ap_aging")) {
- $name_1 = "";
- $id_1 = "";
- $value_1 = "";
- $trigger_1 = "";
+ $name_1 = "fromdate";
+ $id_1 = "fromdate";
+ $value_1 = "$form->{fromdate}";
+ $trigger_1 = "trigger1";
$name_2 = "todate";
$id_2 = "todate";
$value_2 = "";
<td>$vc</td>
</tr>
<tr>
- <th align=right>| . $locale->text('Bis') . qq|</th>
- <td>
- $button1
- $button1_2
+ <td align=left colspan=4>| . $locale->text('From') . qq|
+ $button1
+ $button1_2
+ | . $locale->text('Bis') . qq|
+ $button2
+ $button2_2
</td>
</tr>
<input type=hidden name=type value=statement>
sub aging {
$lxdebug->enter_sub();
- print(STDERR "Bin in Aging\n");
+
$auth->assert('general_ledger');
my $report = SL::ReportGenerator->new(\%myconfig, $form);
$form->{title} = sprintf($locale->text('Ap aging on %s'), $form->{todate});
}
- push @options, $locale->text('for Period') . " " . $locale->text('Bis') . " " . $locale->date(\%myconfig, $form->{todate}, 1);
+ if ($form->{fromdate}) {
+ push @options, $locale->text('for Period') . " " . $locale->text('From') . " " .$locale->date(\%myconfig, $form->{fromdate}, 1) . " " . $locale->text('Bis') . " " . $locale->date(\%myconfig, $form->{todate}, 1);
+ } else {
+ push @options, $locale->text('for Period') . " " . $locale->text('Bis') . " " . $locale->date(\%myconfig, $form->{todate}, 1);
+ }
my $attachment_basename = $form->{ct} eq 'customer' ? $locale->text('ar_aging_list') : $locale->text('ap_aging_list');