X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=bin%2Fmozilla%2Fca.pl;h=1d431916ad2fa3e2b36fc2af1b7d552572761e41;hb=dd88b40826189b57d3b816320d645f1517b020d2;hp=dc36b9766864f3d136d8b6049f6abbda2426f6fb;hpb=8c94b0eaaf4e1b3717f36a755d71d848abcb21a5;p=kivitendo-erp.git
diff --git a/bin/mozilla/ca.pl b/bin/mozilla/ca.pl
index dc36b9766..1d431916a 100644
--- a/bin/mozilla/ca.pl
+++ b/bin/mozilla/ca.pl
@@ -349,6 +349,9 @@ $checked>
. qq|
|
+
+ | . $locale->text('Subtotal') . qq| |
+
$jsscript
|
@@ -365,6 +368,20 @@ $jsscript
$lxdebug->leave_sub();
}
+sub format_debit_credit {
+ $lxdebug->enter_sub();
+
+ my $dc = shift;
+
+ my $formatted_dc = $form->format_amount(\%myconfig, abs($dc), 2) . ' ';
+ $formatted_dc .= ($dc > 0) ? $locale->text('Credit (one letter abbreviation)') : $locale->text('Debit (one letter abbreviation)');
+
+ $lxdebug->leave_sub();
+
+ return $formatted_dc;
+}
+
+
sub list_transactions {
$lxdebug->enter_sub();
@@ -475,12 +492,9 @@ sub list_transactions {
CA->all_transactions(\%myconfig, \%$form);
- print(STDERR "EB: $form->{beginning_balance}\n");
- my $saldo_old = ($form->{saldo_old} > 0) ? $form->format_amount(\%myconfig, $form->{saldo_old}, 2) . " H" : $form->format_amount(\%myconfig, abs($form->{saldo_old}) , 2) . " S";
-
- my $eb_string = ($form->{beginning_balance} > 0) ? $form->format_amount(\%myconfig, $form->{beginning_balance}, 2) . " H" : $form->format_amount(\%myconfig, abs($form->{beginning_balance}), 2) . " S";
- print(STDERR "EB: $eb_string\n");
+ my $saldo_old = format_debit_credit($form->{saldo_old});
+ my $eb_string = format_debit_credit($form->{beginning_balance});
my @options;
if ($form->{department}) {
@@ -521,6 +535,13 @@ sub list_transactions {
'ustkonto' => { 'text' => $locale->text('USt-Konto'), },
'ustrate' => { 'text' => $locale->text('Satz %'), },
);
+
+ my @hidden_variables = qw(accno fromdate todate description accounttype l_heading subtotal department projectnumber project_id sort);
+
+ my $link = build_std_url('action=list_transactions', grep { $form->{$_} } @hidden_variables);
+
+ $form->{callback} = $link . '&sort=' . E($form->{sort});
+
my %column_alignment = map { $_ => 'right' } qw(debit credit);
@custom_headers = ();
@@ -542,9 +563,9 @@ sub list_transactions {
];
# Zeile 2:
push @custom_headers, [
- { 'text' => $locale->text('Date'), },
- { 'text' => $locale->text('Reference'), },
- { 'text' => $locale->text('Description'), },
+ { 'text' => $locale->text('Date'), 'link' => $link . "&sort=transdate", },
+ { 'text' => $locale->text('Reference'), 'link' => $link . "&sort=reference", },
+ { 'text' => $locale->text('Description'), 'link' => $link . "&sort=description", },
{ 'text' => $locale->text('Gegenkonto'), },
{ 'text' => $locale->text('Debit'), },
{ 'text' => $locale->text('Credit'), },
@@ -554,12 +575,7 @@ sub list_transactions {
- my @hidden_variables = qw(accno fromdate todate description accounttype l_heading l_subtotal department projectnumber project_id sort);
-
- my $link = build_std_url('action=list_transactions', grep { $form->{$_} } @hidden_variables);
- map { $column_defs{$_}->{link} = $link . "&sort=$_" } qw(transdate reference description);
- $form->{callback} = $link . '&sort=' . E($form->{sort});
my $report = SL::ReportGenerator->new(\%myconfig, $form);
$report->set_custom_headers(@custom_headers);
@@ -597,11 +613,21 @@ sub list_transactions {
$ca->{$_} = $form->format_amount(\%myconfig, $ca->{$_}, 2) if ($ca->{$_} != 0);
}
+ my $do_subtotal = 0;
+ if (($form->{subtotal})
+ && (($idx == scalar @{ $form->{CA} } - 1)
+ || ($ca->{$form->{sort}} ne $form->{CA}->[$idx + 1]->{$form->{sort}}))) {
+ $do_subtotal = 1;
+ }
my $row = { };
$ca->{ustrate} = $form->format_amount(\%myconfig, $ca->{ustrate} * 100, 2) if ($ca->{ustrate} != 0);
+ if ($ca->{memo} ne "") {
+ $ca->{description} .= " \n " . $ca->{memo};
+ }
+
foreach my $gegenkonto (@{ $ca->{GEGENKONTO} }) {
@@ -620,27 +646,28 @@ sub list_transactions {
}
if ($ca->{index} ne $previous_index) {
- $report->add_data($row_set) if ($row_set);
+# $report->add_data($row_set) if ($row_set);
- $row_set = [ ];
+# $row_set = [ ];
$previous_index = $ca->{index};
$row->{reference}->{link} = build_std_url("script=$ca->{module}.pl", 'action=edit', 'id=' . E($ca->{id}), 'callback');
- } else {
+ } elsif ($ca->{index} eq $previous_index) {
map { $row->{$_}->{data} = '' } qw(reference description);
$row->{transdate}->{data} = '' if ($form->{sort} eq 'transdate');
}
+ my $row_set = [];
+
push @{ $row_set }, $row;
- if (($form->{l_subtotal} eq 'Y')
- && (($idx == scalar @{ $form->{CA} } - 1)
- || ($ca->{$form->{sort}} ne $form->{CA}->[$idx + 1]->{$form->{sort}}))) {
- $report->add_data(create_subtotal_row(\%subtotals, \@columns, \%column_alignment, 'listsubtotal'));
- }
+ push @{ $row_set }, create_subtotal_row(\%subtotals, \@columns, \%column_alignment, 'listsubtotal') if ($do_subtotal);
+
$idx++;
+ $report->add_data($row_set);
+
}
$report->add_data($row_set) if ($row_set);
@@ -682,7 +709,7 @@ sub list_transactions {
};
$report->add_data($row);
- my $saldo_new = ($form->{saldo_new} > 0) ? $form->format_amount(\%myconfig, $form->{saldo_new}, 2) . " H" : $form->format_amount(\%myconfig, abs($form->{saldo_new}) , 2) . " S";
+ my $saldo_new = format_debit_credit($form->{saldo_new});
my $row = {
'transdate' => {
'data' => "",