- $form->{title} = $locale->text('Dunning overview');
-
-
-
-
-
- $form->{callback} =
- "$form->{script}?action=show_dunning&login=$form->{login}&password=$form->{password}&customer=$form->{customer}&invnumber=$form->{invnumber}&ordnumber=$form->{ordnumber}&transdatefrom=$form->{transdatefrom}&transdateto=$form->{transdateto}&dunningfrom=$form->{dunningfrom}&dunningto=$form->{dunningto}¬es=$form->{notes}&showold=$form->{showold}&dunning_level=$form->{dunning_level}"
- unless $form->{callback};
-
- @column_index = qw(dunning_description customername invnumber invdate inv_duedate invamount dunning_date next_duedate fee interest );
-
- $column_header{dunning_description} =
- qq|<th class=listheading>|
- . $locale->text('Dunning Level')
- . qq|</th>|;
- $column_header{customername} =
- qq|<th class=listheading>|
- . $locale->text('Customername')
- . qq|</th>|;
- $column_header{invnumber} =
- qq|<th class=listheading>|
- . $locale->text('Invnumber')
- . qq|</th>|;
- $column_header{inv_duedate} =
- qq|<th class=listheading>|
- . $locale->text('Invoice Duedate')
- . qq|</th>|;
- $column_header{dunning_date} =
- qq|<th class=listheading>|
- . $locale->text('Dunning Date')
- . qq|</th>|;
- $column_header{next_duedate} =
- qq|<th class=listheading>|
- . $locale->text('Dunning Duedate')
- . qq|</th>|;
- $column_header{invdate} =
- qq|<th class=listheading>|
- . $locale->text('Invdate')
- . qq|</th>|;
- $column_header{invamount} =
- qq|<th class=listheading>|
- . $locale->text('Amount')
- . qq|</th>|;
- $column_header{fee} =
- qq|<th class=listheading>|
- . $locale->text('Total Fees')
- . qq|</th>|;
- $column_header{interest} =
- qq|<th class=listheading>|
- . $locale->text('Interest')
- . qq|</th>|;
-
- $form->header;
-
-
- print qq|
-<body>
-<script type="text/javascript" src="js/common.js"></script>
-<script type="text/javascript" src="js/dunning.js"></script>
-<form method=post action=$form->{script}>
-
-
-<table width=100%>
- <tr>
- <th class=listtop colspan=10>$form->{title}</th>
- </tr>
- <tr height="5"></tr>
- <tr>|;
- map { print "$column_header{$_}\n" } @column_index;
-
- print qq|
- </tr>
-|;
-
- my %columns = (
- "dunning_duedate" => "next_duedate",
- "duedate" => "inv_duedate",
- "transdate" => "invdate",
- "amount" => "invamount",
- );
+
+ if (!$form->{callback}) {
+ $form->{callback} = build_std_url("action=show_dunning", @filter_field_list);
+ }
+
+ $form->get_lists('printers' => 'printers',
+ 'languages' => 'languages');
+
+ $form->{type} = 'dunning';
+ $form->{PRINT_OPTIONS} = print_options('inline' => 1,
+ 'no_queue' => 1,
+ 'no_postscript' => 1,
+ 'no_html' => 1,
+ 'no_opendocument' => 1,);
+ $form->{title} = $locale->text('Dunning overview');
+
+ my $report = SL::ReportGenerator->new(\%myconfig, $form);
+
+ $report->set_options('std_column_visibility' => 1,
+ 'title' => $form->{title});
+ $report->set_export_options('show_dunning', @filter_field_list);
+
+ my %column_defs = (
+ 'checkbox' => { 'text' => '', 'visible' => 'HTML' },
+ 'dunning_description' => { 'text' => $locale->text('Dunning Level') },
+ 'customername' => { 'text' => $locale->text('Customername') },
+ 'invnumber' => { 'text' => $locale->text('Invnumber') },
+ 'transdate' => { 'text' => $locale->text('Invdate') },
+ 'duedate' => { 'text' => $locale->text('Invoice Duedate') },
+ 'amount' => { 'text' => $locale->text('Amount') },
+ 'dunning_date' => { 'text' => $locale->text('Dunning Date') },
+ 'dunning_duedate' => { 'text' => $locale->text('Dunning Duedate') },
+ 'fee' => { 'text' => $locale->text('Total Fees') },
+ 'interest' => { 'text' => $locale->text('Interest') },
+ );
+
+ $report->set_columns(%column_defs);
+ $report->set_column_order(qw(checkbox dunning_description customername invnumber transdate
+ duedate amount dunning_date dunning_duedate fee interest));
+ $report->set_sort_indicator($form->{sort}, $form->{sortdir});
+
+ my $edit_url = build_std_url('script=is.pl', 'action=edit', 'callback') . '&id=';
+ my $print_url = build_std_url('action=print_dunning', 'format=pdf', 'media=screen') . '&dunning_id=';
+ my $sort_url = build_std_url('action=show_dunning', grep { $form->{$_} } @filter_field_list);
+
+ foreach my $name (qw(dunning_description customername invnumber transdate duedate dunning_date dunning_duedate)) {
+ my $sortdir = $form->{sort} eq $name ? 1 - $form->{sortdir} : $form->{sortdir};
+ $column_defs{$name}->{link} = $sort_url . "&sort=$name&sortdir=$sortdir";
+ }
+
+ my %alignment = map { $_ => 'right' } qw(transdate duedate amount dunning_date dunning_duedate fee interest);
+
+ my ($current_dunning_rows, $previous_dunning_id, $first_row_for_dunning);
+
+ $current_dunning_rows = [];
+ $first_row_for_dunning = 1;
+ $form->{rowcount} = scalar @{ $form->{DUNNINGS} };