From 0e0765649bd710648d19c14d2ac4a65e3f1bea59 Mon Sep 17 00:00:00 2001 From: Julian Maurice Date: Fri, 13 Apr 2012 10:40:35 +0200 Subject: [PATCH 1/2] Bug 7308: Show ordered amount in aqbudgets.pl MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Cédric Vita --- C4/Budgets.pm | 1 + admin/aqbudgets.pl | 11 +++++++++-- koha-tmpl/intranet-tmpl/prog/en/modules/admin/aqbudgets.tt | 3 +++ 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/C4/Budgets.pm b/C4/Budgets.pm index 7b553e6..1005aeb 100644 --- a/C4/Budgets.pm +++ b/C4/Budgets.pm @@ -587,6 +587,7 @@ sub GetBudgetHierarchy { $r->{'budget_name_indent'} = $moo; $r->{'budget_spent'} = GetBudgetSpent( $r->{'budget_id'} ); + $r->{budget_ordered} = GetBudgetOrdered( $r->{budget_id} ); $r->{'budget_amount_total'} = $r->{'budget_amount'}; diff --git a/admin/aqbudgets.pl b/admin/aqbudgets.pl index c5f99e3..bc2331d 100755 --- a/admin/aqbudgets.pl +++ b/admin/aqbudgets.pl @@ -277,7 +277,7 @@ if ($op eq 'add_form') { my $toggle = 0; my @loop; my $period_total = 0; - my ( $period_alloc_total, $base_spent_total ); + my ( $period_alloc_total, $base_spent_total, $base_ordered_total ); #This Looks WEIRD to me : should budgets be filtered in such a way ppl who donot own it would not see the amount spent on the budget by others ? @@ -304,6 +304,7 @@ if ($op eq 'add_form') { # adds to total - only if budget is a 'top-level' budget $period_alloc_total += $budget->{'budget_amount_total'} if $budget->{'depth'} == 0; $base_spent_total += $budget->{'budget_spent'}; + $base_ordered_total += $budget->{budget_ordered}; $budget->{'budget_remaining'} = $budget->{'budget_amount'} - $budget->{'total_levels_spent'}; # if amount == 0 dont display... @@ -313,12 +314,13 @@ if ($op eq 'add_form') { $budget->{'remaining_pos'} = 1 if $budget->{'budget_remaining'} > 0; $budget->{'remaining_neg'} = 1 if $budget->{'budget_remaining'} < 0; - for (grep {/total_levels_spent|budget_spent|budget_amount|budget_remaining|budget_unalloc/} keys %$budget){ + for (grep {/total_levels_spent|budget_spent|budget_ordered|budget_amount|budget_remaining|budget_unalloc/} keys %$budget){ $budget->{$_} = $num->format_price( $budget->{$_} ) if defined($budget->{$_}) } # Value of budget_spent equals 0 instead of undefined value $budget->{"budget_spent"} = $num->format_price(0) unless defined($budget->{"budget_spent"}); + $budget->{budget_ordered} = $num->format_price(0) unless defined($budget->{"budget_ordered"}); my $borrower = &GetMember( borrowernumber=>$budget->{budget_owner_id} ); $budget->{"budget_owner_name"} = $borrower->{'firstname'} . ' ' . $borrower->{'surname'}; @@ -357,12 +359,17 @@ if ($op eq 'add_form') { $base_spent_total = $num->format_price($base_spent_total); } + if ($base_ordered_total) { + $base_ordered_total = $num->format_price($base_ordered_total); + } + $template->param( else => 1, budget => \@loop, budget_period_total => $budget_period_total, period_alloc_total => $period_alloc_total, base_spent_total => $base_spent_total, + base_ordered_total => $base_ordered_total, branchloop => \@branchloop2, ); diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/aqbudgets.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/aqbudgets.tt index af0f086..23d5166 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/aqbudgets.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/aqbudgets.tt @@ -228,6 +228,7 @@ Fund name Total
allocated Base-level
allocated + Base-level
ordered Base-level
spent Total sublevels
spent Base-level
remaining @@ -240,6 +241,7 @@ Period allocated [% IF ( budget_period_total ) %][% budget_period_total %][% END %] [% period_alloc_total %] [% base_alloc_total %] + [% base_ordered_total %] [% base_spent_total %] [% base_spent_total %] [% base_remaining_total %] @@ -260,6 +262,7 @@ [% budge.budget_name %] [% budge.budget_amount_total %] [% budge.budget_amount %] + [% budge.budget_ordered %] [% budge.budget_spent %] [% budge.total_levels_spent %] [% IF ( budge.remaining_pos ) %] -- 1.7.10.4