Lines 277-283
if ($op eq 'add_form') {
Link Here
|
277 |
my $toggle = 0; |
277 |
my $toggle = 0; |
278 |
my @loop; |
278 |
my @loop; |
279 |
my $period_total = 0; |
279 |
my $period_total = 0; |
280 |
my ( $period_alloc_total, $base_spent_total ); |
280 |
my ( $period_alloc_total, $base_spent_total, $base_ordered_total ); |
281 |
|
281 |
|
282 |
#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 ? |
282 |
#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 ? |
283 |
|
283 |
|
Lines 304-309
if ($op eq 'add_form') {
Link Here
|
304 |
# adds to total - only if budget is a 'top-level' budget |
304 |
# adds to total - only if budget is a 'top-level' budget |
305 |
$period_alloc_total += $budget->{'budget_amount_total'} if $budget->{'depth'} == 0; |
305 |
$period_alloc_total += $budget->{'budget_amount_total'} if $budget->{'depth'} == 0; |
306 |
$base_spent_total += $budget->{'budget_spent'}; |
306 |
$base_spent_total += $budget->{'budget_spent'}; |
|
|
307 |
$base_ordered_total += $budget->{budget_ordered}; |
307 |
$budget->{'budget_remaining'} = $budget->{'budget_amount'} - $budget->{'total_levels_spent'}; |
308 |
$budget->{'budget_remaining'} = $budget->{'budget_amount'} - $budget->{'total_levels_spent'}; |
308 |
|
309 |
|
309 |
# if amount == 0 dont display... |
310 |
# if amount == 0 dont display... |
Lines 313-324
if ($op eq 'add_form') {
Link Here
|
313 |
|
314 |
|
314 |
$budget->{'remaining_pos'} = 1 if $budget->{'budget_remaining'} > 0; |
315 |
$budget->{'remaining_pos'} = 1 if $budget->{'budget_remaining'} > 0; |
315 |
$budget->{'remaining_neg'} = 1 if $budget->{'budget_remaining'} < 0; |
316 |
$budget->{'remaining_neg'} = 1 if $budget->{'budget_remaining'} < 0; |
316 |
for (grep {/total_levels_spent|budget_spent|budget_amount|budget_remaining|budget_unalloc/} keys %$budget){ |
317 |
for (grep {/total_levels_spent|budget_spent|budget_ordered|budget_amount|budget_remaining|budget_unalloc/} keys %$budget){ |
317 |
$budget->{$_} = $num->format_price( $budget->{$_} ) if defined($budget->{$_}) |
318 |
$budget->{$_} = $num->format_price( $budget->{$_} ) if defined($budget->{$_}) |
318 |
} |
319 |
} |
319 |
|
320 |
|
320 |
# Value of budget_spent equals 0 instead of undefined value |
321 |
# Value of budget_spent equals 0 instead of undefined value |
321 |
$budget->{"budget_spent"} = $num->format_price(0) unless defined($budget->{"budget_spent"}); |
322 |
$budget->{"budget_spent"} = $num->format_price(0) unless defined($budget->{"budget_spent"}); |
|
|
323 |
$budget->{budget_ordered} = $num->format_price(0) unless defined($budget->{"budget_ordered"}); |
322 |
|
324 |
|
323 |
my $borrower = &GetMember( borrowernumber=>$budget->{budget_owner_id} ); |
325 |
my $borrower = &GetMember( borrowernumber=>$budget->{budget_owner_id} ); |
324 |
$budget->{"budget_owner_name"} = $borrower->{'firstname'} . ' ' . $borrower->{'surname'}; |
326 |
$budget->{"budget_owner_name"} = $borrower->{'firstname'} . ' ' . $borrower->{'surname'}; |
Lines 357-368
if ($op eq 'add_form') {
Link Here
|
357 |
$base_spent_total = $num->format_price($base_spent_total); |
359 |
$base_spent_total = $num->format_price($base_spent_total); |
358 |
} |
360 |
} |
359 |
|
361 |
|
|
|
362 |
if ($base_ordered_total) { |
363 |
$base_ordered_total = $num->format_price($base_ordered_total); |
364 |
} |
365 |
|
360 |
$template->param( |
366 |
$template->param( |
361 |
else => 1, |
367 |
else => 1, |
362 |
budget => \@loop, |
368 |
budget => \@loop, |
363 |
budget_period_total => $budget_period_total, |
369 |
budget_period_total => $budget_period_total, |
364 |
period_alloc_total => $period_alloc_total, |
370 |
period_alloc_total => $period_alloc_total, |
365 |
base_spent_total => $base_spent_total, |
371 |
base_spent_total => $base_spent_total, |
|
|
372 |
base_ordered_total => $base_ordered_total, |
366 |
branchloop => \@branchloop2, |
373 |
branchloop => \@branchloop2, |
367 |
); |
374 |
); |
368 |
|
375 |
|