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