From: Rolf Fluehmann Date: Fri, 4 Apr 2014 10:27:01 +0000 (+0200) Subject: adjustments Erfolgsrechnung X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=f8c8ad09f3ad7be25b7fa5e3b4506785fd0f48f1;p=kivitendo-erp.git adjustments Erfolgsrechnung --- diff --git a/SL/Form.pm b/SL/Form.pm index 22d5d1a31..35050a0c7 100644 --- a/SL/Form.pm +++ b/SL/Form.pm @@ -850,7 +850,7 @@ sub format_amount { return $amount; } -sub format_amount_unit { +sub format_amount_units { $main::lxdebug->enter_sub(); my $self = shift; diff --git a/SL/RP.pm b/SL/RP.pm index b5f35e5db..dd006e22d 100644 --- a/SL/RP.pm +++ b/SL/RP.pm @@ -1895,13 +1895,15 @@ sub erfolgsrechnung { accounts => get_accounts_ch($category), ); foreach my $account (@{$category{accounts}}) { - $account->{total} = 0; - $account->{total} += ($account->{category} eq $category ? 1 : -1) * $_ foreach (@{get_amounts_ch($account->{id}, $fromdate, $todate)}); - $category{total} = $account->{total}; + $account->{total} += ($account->{category} eq $category ? 1 : -1) * get_total_ch($account->{id}, $fromdate, $todate); + $category{total} += $account->{total}; + $account->{total} = $form->format_amount($myconfig, $form->parse_amount($myconfig, $account->{total}), 2); } $form->{total} += $category{total}; + $category{total} = $form->format_amount($myconfig, $form->parse_amount($myconfig, $category{total}), 2); push(@{$form->{categories}}, \%category); } + $form->{total} = $form->format_amount($myconfig, $form->parse_amount($myconfig, $form->{total}), 2); $main::lxdebug->leave_sub(); return {}; @@ -1938,10 +1940,11 @@ sub get_accounts_ch { return $accounts; } -sub get_amounts_ch { +sub get_total_ch { $main::lxdebug->enter_sub(); my ($chart_id, $fromdate, $todate) = @_; + my $total = 0; my $query = qq| SELECT amount FROM acc_trans @@ -1949,10 +1952,10 @@ sub get_amounts_ch { AND transdate >= $fromdate AND transdate <= $todate |; - my $amounts = _query($query); + $total += $_->{amount} foreach (_query($query)); $main::lxdebug->leave_sub(); - return $amounts; + return $total; } sub _query {return selectall_hashref_query($::form, $::form->get_standard_dbh, $_[0]);} diff --git a/menus/erp_ch.ini b/menus/erp_ch.ini index 33519f299..01a44645e 100644 --- a/menus/erp_ch.ini +++ b/menus/erp_ch.ini @@ -391,6 +391,12 @@ module=rp.pl action=report report=erfolgsrechnung +[Reports--Income Statement] +ACCESS=report +module=rp.pl +action=report +report=income_statement + [Reports--BWA] ACCESS=report module=rp.pl