my ($invoice, $arap, $buysell, $ct, $ct_id, $ml);
+ # falls customer ziehen wir die offene forderungsliste
+ # anderfalls für die lieferanten die offenen verbindlichkeitne
if ($form->{ct} eq "customer") {
$invoice = "is";
$arap = "ar";
}
$ct_id = "${ct}_id";
- $form->{todate} = $form->current_date($myconfig) unless ($form->{todate});
- my $todate = conv_dateq($form->{todate});
- my $fromdate = conv_dateq($form->{fromdate});
+ # erweiterung um einen freien zeitraum oder einen stichtag
+ # mit entsprechender altersstrukturliste (s.a. Bug 1842)
+ # eine neue variable an der oberfläche eingeführt, somit ist
+ # todate == freier zeitrau und fordate == stichtag
- my $fromwhere = ($form->{fromdate} ne "") ? " AND (transdate >= (date $fromdate)) " : "";
+ my ($review_of_aging_list, $todate, $fromdate, $fromwhere, $fordate);
+ if ($form->{reporttype} eq 'custom') { # altersstrukturliste
+
+ # explizit rausschmeissen was man für diesen bericht nicht braucht
+ delete $form->{fromdate};
+ delete $form->{todate};
+
+ # an der oberfläche ist das tagesaktuelle datum vorausgewählt
+ # falls es dennoch per Benutzereingabe gelöscht wird, lieber wieder vorbelegen
+ # ferner muss für die spätere DB-Abfrage muss todate gesetzt sein.
+ $form->{fordate} = $form->current_date($myconfig) unless ($form->{fordate});
+ $fordate = conv_dateq($form->{fordate});
+ $todate = $fordate;
+
+ if ($form->{review_of_aging_list}) { # falls die liste leer ist, alles anzeigen
+ if ($form->{review_of_aging_list} =~ m "-") { # .. periode von bis
+ my @period = split(/-/, $form->{review_of_aging_list}); # ... von periode bis periode
+ $review_of_aging_list = " AND $period[0] < (date $fordate) - duedate
+ AND (date $fordate) - duedate < $period[1]";
+ } else {
+ $form->{review_of_aging_list} =~ s/[^0-9]//g; # größer 120 das substitute ist nur für das '>' zeichen
+ $review_of_aging_list = " AND $form->{review_of_aging_list} < (date $fordate) - duedate";
+ }
+ }
+ } else { # freier zeitraum OHNE review_of_aging_list
+ $form->{todate} = $form->current_date($myconfig) unless ($form->{todate});
+ $todate = conv_dateq($form->{todate});
+ $fromdate = conv_dateq($form->{fromdate});
+ $fromwhere = ($form->{fromdate} ne "") ? " AND (transdate >= (date $fromdate)) " : "";
+ }
my $where = " 1 = 1 ";
my ($name, $null);
$where .= qq| AND (a.department_id = | . conv_i($department_id, 'NULL') . qq|)|;
$where_dpt = qq| AND (${arap}.department_id = | . conv_i($department_id, 'NULL') . qq|)|;
}
- my $review_of_aging_list;
- if ($form->{review_of_aging_list}) {
- if ($form->{review_of_aging_list} =~ m "-"){
- my @period = split(/-/, $form->{review_of_aging_list});
- $review_of_aging_list = " AND $period[0] < date_part('days', now() - duedate)
- AND date_part('days', now() - duedate) < $period[1]";
- } else {
- $form->{review_of_aging_list} =~ s/[^0-9]//g;
- $review_of_aging_list = " AND $form->{review_of_aging_list} < date_part('days', now() - duedate)";
- }
- }
-
- my $q_details = qq|
+ my $q_details = qq|
SELECT ${ct}.id AS ctid, ${ct}.name,
street, zipcode, city, country, contact, email,
'Recorded taxkey' => 'Gespeicherter Steuerschlüssel',
'Reference' => 'Referenz',
'Reference / Invoice Number' => 'Referenz / Rechnungsnummer',
+ 'Reference day' => 'Stichtag',
'Reference missing!' => 'Referenz fehlt!',
'Release From Stock' => 'Lagerausgang',
'Remaining' => 'Rest',
'follow_up_list' => 'wiedervorlageliste',
'for' => 'für',
'for Period' => 'für den Zeitraum',
+ 'for date' => 'zum Stichtag',
'found' => 'Gefunden',
'from (time)' => 'von',
'general_ledger_list' => 'buchungsjournal',
<table border="0">
[%- IF selectdepartment %]
<tr>
- <th align=right nowrap>[% 'Department' | $T8 %]</th>
+ <th align="left" nowrap>[% 'Department' | $T8 %]</th>
<td colspan=3><select name=department>[% selectdepartment %]</select></td>
</tr>
[%- END %]
[%- IF is_aging %]
<tr>
- <th align=right>[% label %]</th>
+ <th align=left>[% label %]</th>
<td>[% vc %]</td>
</tr>
+</table>
+<table border="0">
+ <tr>
+ <td colspan=5><hr size=1 noshade></td>
+ </tr>
<tr>
- <td>[% 'Review of Aging list' | $T8 %]</td>
- <td><select name="review_of_aging_list">
+ <th align=left><input name=reporttype class=radio type=radio value="custom" checked><b>[% 'Reference day' | $T8 %]</b> </th>
+ <td align="right" colspan="4">[% 'Review of Aging list' | $T8 %] <select name="review_of_aging_list">
<option></option>
<option>0-30</option>
<option>30-60</option>
<option>60-90</option>
<option>90-120</option>
<option>> 120</option>
- </select>
+ </select> [% 'for date' | $T8 %] [% L.date_tag('fordate', today) %]
</td>
</tr>
<tr>
- <td align=left colspan=4>
+ <td colspan=5><hr size=3 noshade></td>
+ </tr>
+ <tr>
+ <th align=left><input name=reporttype class=radio type=radio value="free"><b>[% 'Free report period' | $T8 %]</b> </th>
+ <td align="right" colspan=4>
[% 'From' | $T8 %] [% L.date_tag('fromdate', fromdate) %]
[% 'Bis' | $T8 %] [% L.date_tag('todate') %]
</td>