From: Moritz Bunkus Date: Mon, 18 Jun 2007 12:53:12 +0000 (+0000) Subject: Umstellung der Liste der Zahlungsein- und -ausgänge auf die Verwendung von ReportGene... X-Git-Tag: release-2.4.3^2~104 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=c7581445ed0a428842ae3e74ab0542cb9c0d3932;p=kivitendo-erp.git Umstellung der Liste der Zahlungsein- und -ausgänge auf die Verwendung von ReportGenerator. --- diff --git a/bin/mozilla/rp.pl b/bin/mozilla/rp.pl index a5f9a72bc..4cb742d0b 100644 --- a/bin/mozilla/rp.pl +++ b/bin/mozilla/rp.pl @@ -2252,192 +2252,107 @@ sub list_payments { RP->payments(\%myconfig, \%$form); - @columns = - $form->sort_columns(qw(transdate reference name paid source memo)); - - # construct href - $account = $form->escape($form->{account}); - $title = $form->escape($form->{title}); - $department = $form->escape($form->{department}); - $form->{paymentaccounts} =~ s/ /%20/g; - $reference = $form->escape($form->{reference}); - $source = $form->escape($form->{source}); - $memo = $form->escape($form->{memo}); + my @hidden_variables = qw(account title department reference source memo fromdate todate + fx_transaction db prepayment paymentaccounts sort); - $href = - "$form->{script}?action=list_payments&login=$form->{login}&password=$form->{password}&fromdate=$form->{fromdate}&todate=$form->{todate}&fx_transaction=$form->{fx_transaction}&db=$form->{db}&prepayment=$form->{prepayment}&title=$title&account=$account&department=$department&paymentaccounts=$form->{paymentaccounts}&reference=$reference&source=$source&memo=$memo"; + my $href = build_std_url('action=list_payments', grep { $form->{$_} } @hidden_variables); + $form->{callback} = $href; - # construct callback - $account = $form->escape($form->{account}, 1); - $title = $form->escape($form->{title}, 1); - $department = $form->escape($form->{department}, 1); - $reference = $form->escape($form->{reference}, 1); - $source = $form->escape($form->{source}, 1); - $memo = $form->escape($form->{memo}, 1); - - $form->{callback} = - "$form->{script}?action=list_payments&login=$form->{login}&password=$form->{password}&fromdate=$form->{fromdate}&todate=$form->{todate}&fx_transaction=$form->{fx_transaction}&db=$form->{db}&prepayment=$form->{prepayment}&title=$title&account=$account&department=$department&paymentaccounts=$form->{paymentaccounts}&reference=$reference&source=$source&memo=$memo&sort=$form->{sort}"; - $callback = $form->escape($form->{callback}); + my @columns = qw(transdate invnumber name paid source memo); + my %column_defs = ( + 'name' => { 'text' => $locale->text('Description'), }, + 'invnumber' => { 'text' => $locale->text('Reference'), }, + 'transdate' => { 'text' => $locale->text('Date'), }, + 'paid' => { 'text' => $locale->text('Amount'), }, + 'source' => { 'text' => $locale->text('Source'), }, + 'memo' => { 'text' => $locale->text('Memo'), }, + ); + my %column_alignment = ('paid' => 'right'); - $column_header{name} = - "" - . $locale->text('Description') - . ""; - $column_header{reference} = - "" - . $locale->text('Reference') - . ""; - $column_header{transdate} = - "" - . $locale->text('Date') - . ""; - $column_header{paid} = - "" . $locale->text('Amount') . ""; - $column_header{source} = - "" - . $locale->text('Source') - . ""; - $column_header{memo} = - "" - . $locale->text('Memo') - . ""; + map { $column_defs{$_}->{link} = $href . "&sort=$_" } grep { $_ ne 'paid' } @columns; + my @options; if ($form->{fromdate}) { - $option .= "\n
" if ($option); - $option .= - $locale->text('From') . " " - . $locale->date(\%myconfig, $form->{fromdate}, 1); + push @options, $locale->text('From') . " " . $locale->date(\%myconfig, $form->{fromdate}, 1); } if ($form->{todate}) { - $option .= "\n
" if ($option); - $option .= - $locale->text('bis') . " " - . $locale->date(\%myconfig, $form->{todate}, 1); + push @options, $locale->text('bis') . " " . $locale->date(\%myconfig, $form->{todate}, 1); } - @column_index = @columns; - $colspan = $#column_index + 1; + my $report = SL::ReportGenerator->new(\%myconfig, $form); - $form->header; + my $attachment_basename = $form->{db} eq 'ar' ? $locale->text('list_of_receipts') : $locale->text('list_of_payments'); - print qq| - + $report->set_options('top_info_text' => join("\n", @options), + 'output_format' => 'HTML', + 'title' => $form->{title}, + 'attachment_basename' => $attachment_basename . strftime('_%Y%m%d', localtime time), + 'std_column_visibility' => 1, + ); + $report->set_options_from_form(); - - - - - - - - - - - - - - -
$form->{title}
$option
- - -|; + $report->set_columns(%column_defs); + $report->set_column_order(@columns); - map { print "\n$column_header{$_}" } @column_index; + $report->set_export_options('list_payments', @hidden_variables); - print qq| - -|; + $report->set_sort_indicator($form->{sort}, 1); - foreach $ref (sort { $a->{accno} cmp $b->{accno} } @{ $form->{PR} }) { + my $total_paid = 0; + foreach my $ref (sort { $a->{accno} cmp $b->{accno} } @{ $form->{PR} }) { next unless @{ $form->{ $ref->{id} } }; - print qq| - - - -|; + $report->add_control({ 'type' => 'colspan_data', 'data' => "$ref->{accno}--$ref->{description}" }); - foreach $payment (@{ $form->{ $ref->{id} } }) { + my $subtotal_paid = 0; - $module = $payment->{module}; + foreach my $payment (@{ $form->{ $ref->{id} } }) { + my $module = $payment->{module}; $module = 'is' if ($payment->{invoice} && $payment->{module} eq 'ar'); $module = 'ir' if ($payment->{invoice} && $payment->{module} eq 'ap'); - $href = - qq|${module}.pl?action=edit&id=$payment->{id}&login=$form->{login}&password=$form->{password}&callback=$callback|; + my $link = build_std_url("module=${module}.pl", 'action=edit', 'id=' . E($payment->{id}), 'callback'); - $column_data{name} = ""; - $column_data{reference} = - qq||; - $column_data{transdate} = ""; - $column_data{paid} = - ""; - $column_data{source} = ""; - $column_data{memo} = ""; + $subtotal_paid += $payment->{paid}; + $total_paid += $payment->{paid}; - $subtotalpaid += $payment->{paid}; - $totalpaid += $payment->{paid}; + $payment->{paid} = $form->format_amount(\%myconfig, $payment->{paid}, 2); - $i++; - $i %= 2; - print qq| - -|; - - map { print "\n$column_data{$_}" } @column_index; + my $row = { }; - print qq| - -|; + foreach my $column (@columns) { + $row->{$column} = { + 'data' => $payment->{$column}, + 'align' => $column_alignment{$column}, + }; + } + $report->add_data($row); } - # print subtotals - map { $column_data{$_} = "" } @column_index; - - $column_data{paid} = - ""; - - print qq| - -|; - - map { print "\n$column_data{$_}" } @column_index; - - print qq| - -|; - - $subtotalpaid = 0; + my $row = { map { $_ => { 'class' => 'listsubtotal' } } @columns }; + $row->{paid} = { + 'data' => $form->format_amount(\%myconfig, $subtotal_paid, 2), + 'align' => 'right', + 'class' => 'listsubtotal', + }; + $report->add_data($row); } - # print total - map { $column_data{$_} = "" } @column_index; - - $column_data{paid} = - ""; + $report->add_separator(); - print qq| - -|; + my $row = { map { $_ => { 'class' => 'listtotal' } } @columns }; + $row->{paid} = { + 'data' => $form->format_amount(\%myconfig, $total_paid, 2), + 'align' => 'right', + 'class' => 'listtotal', + }; - map { print "\n$column_data{$_}" } @column_index; + $report->add_data($row); - print qq| - - -
$ref->{accno}--$ref->{description}
$payment->{name} $payment->{invnumber}$payment->{transdate} " - . $form->format_amount(\%myconfig, $payment->{paid}, 2, " ") - . "$payment->{source} $payment->{memo} 
 " - . $form->format_amount(\%myconfig, $subtotalpaid, 2, " ") . "
 " - . $form->format_amount(\%myconfig, $totalpaid, 2, " ") . "
-

- - - -|; + $report->generate_with_headers(); $lxdebug->leave_sub(); } diff --git a/locale/de/all b/locale/de/all index 2826bf42e..8450e454f 100644 --- a/locale/de/all +++ b/locale/de/all @@ -1296,6 +1296,8 @@ aktualisieren wollen?', 'lead deleted!' => 'Kundenquelle gelöscht', 'lead saved!' => 'Kundenquelle geichert', 'list' => 'auflisten', + 'list_of_payments' => 'zahlungsausgaenge', + 'list_of_receipts' => 'zahlungseingaenge', 'localhost' => 'lokaler Rechner', 'logout' => 'abmelden', 'mark as paid' => 'als bezahlt markieren', diff --git a/locale/de/rp b/locale/de/rp index 776b38ab9..7e343e64f 100644 --- a/locale/de/rp +++ b/locale/de/rp @@ -187,6 +187,8 @@ $self->{texts} = { 'debug' => 'Debug', 'for Period' => 'für den Zeitraum', 'invoice' => 'Rechnung', + 'list_of_payments' => 'zahlungsausgaenge', + 'list_of_receipts' => 'zahlungseingaenge', 'no' => 'nein', 'packing_list' => 'Versandliste', 'pick_list' => 'Entnahmeliste',