Lines 235-241
if ($op eq 'add_form') {
Link Here
|
235 |
my $toggle = 0; |
235 |
my $toggle = 0; |
236 |
my @loop; |
236 |
my @loop; |
237 |
my $period_total = 0; |
237 |
my $period_total = 0; |
238 |
my ( $period_alloc_total, $base_spent_total ); |
238 |
my ( $period_alloc_total, $base_spent_total, $base_ordered_total ); |
239 |
|
239 |
|
240 |
#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 ? |
240 |
#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 ? |
241 |
|
241 |
|
Lines 283-288
if ($op eq 'add_form') {
Link Here
|
283 |
# adds to total - only if budget is a 'top-level' budget |
283 |
# adds to total - only if budget is a 'top-level' budget |
284 |
$period_alloc_total += $budget->{'budget_amount_total'} if $budget->{'depth'} == 0; |
284 |
$period_alloc_total += $budget->{'budget_amount_total'} if $budget->{'depth'} == 0; |
285 |
$base_spent_total += $budget->{'budget_spent'}; |
285 |
$base_spent_total += $budget->{'budget_spent'}; |
|
|
286 |
$base_ordered_total += $budget->{budget_ordered}; |
286 |
$budget->{'budget_remaining'} = $budget->{'budget_amount'} - $budget->{'total_levels_spent'}; |
287 |
$budget->{'budget_remaining'} = $budget->{'budget_amount'} - $budget->{'total_levels_spent'}; |
287 |
|
288 |
|
288 |
# if amount == 0 dont display... |
289 |
# if amount == 0 dont display... |
Lines 290-301
if ($op eq 'add_form') {
Link Here
|
290 |
|
291 |
|
291 |
$budget->{'remaining_pos'} = 1 if $budget->{'budget_remaining'} > 0; |
292 |
$budget->{'remaining_pos'} = 1 if $budget->{'budget_remaining'} > 0; |
292 |
$budget->{'remaining_neg'} = 1 if $budget->{'budget_remaining'} < 0; |
293 |
$budget->{'remaining_neg'} = 1 if $budget->{'budget_remaining'} < 0; |
293 |
for (grep {/total_levels_spent|budget_spent|budget_amount|budget_remaining|budget_unalloc/} keys %$budget){ |
294 |
for (grep {/total_levels_spent|budget_spent|budget_ordered|budget_amount|budget_remaining|budget_unalloc/} keys %$budget){ |
294 |
$budget->{$_} = $num->format_price( $budget->{$_} ) if defined($budget->{$_}) |
295 |
$budget->{$_} = $num->format_price( $budget->{$_} ) if defined($budget->{$_}) |
295 |
} |
296 |
} |
296 |
|
297 |
|
297 |
# Value of budget_spent equals 0 instead of undefined value |
298 |
# Value of budget_spent equals 0 instead of undefined value |
298 |
$budget->{"budget_spent"} = $num->format_price(0) unless defined($budget->{"budget_spent"}); |
299 |
$budget->{"budget_spent"} = $num->format_price(0) unless defined($budget->{"budget_spent"}); |
|
|
300 |
$budget->{budget_ordered} = $num->format_price(0) unless defined($budget->{"budget_ordered"}); |
299 |
|
301 |
|
300 |
my $borrower = &GetMember( borrowernumber=>$budget->{budget_owner_id} ); |
302 |
my $borrower = &GetMember( borrowernumber=>$budget->{budget_owner_id} ); |
301 |
$budget->{"budget_owner_name"} = $borrower->{'firstname'} . ' ' . $borrower->{'surname'}; |
303 |
$budget->{"budget_owner_name"} = $borrower->{'firstname'} . ' ' . $borrower->{'surname'}; |
Lines 331-336
if ($op eq 'add_form') {
Link Here
|
331 |
budget_period_total => $budget_period_total, |
333 |
budget_period_total => $budget_period_total, |
332 |
period_alloc_total => $num->format_price($period_alloc_total), |
334 |
period_alloc_total => $num->format_price($period_alloc_total), |
333 |
base_spent_total => $num->format_price($base_spent_total), |
335 |
base_spent_total => $num->format_price($base_spent_total), |
|
|
336 |
base_ordered_total => $num->format_price($base_ordered_total), |
334 |
branchloop => \@branchloop2, |
337 |
branchloop => \@branchloop2, |
335 |
); |
338 |
); |
336 |
|
339 |
|