View | Details | Raw Unified | Return to bug 4438
Collapse All | Expand All

(-)a/admin/check_parent_total.pl (-5 / +16 lines)
Lines 62-68 my ($sub_unalloc , $period_sum, $budget_period_unalloc); Link Here
62
if ($parent) {
62
if ($parent) {
63
    my $query = "  SELECT SUM(budget_amount) as sum FROM aqbudgets where budget_parent_id = ? ";
63
    my $query = "  SELECT SUM(budget_amount) as sum FROM aqbudgets where budget_parent_id = ? ";
64
    my $sth   = $dbh->prepare($query);
64
    my $sth   = $dbh->prepare($query);
65
    $sth->execute( $parent->{'budget_id'} );
65
    my @sql_params;
66
    push @sql_params, $parent->{'budget_id'} ;
67
    if ($budget_id){
68
        $query.=qq| and budget_id <> ? |;
69
        push @sql_params,$budget_id;
70
    }
71
    $sth->execute( @sql_params );
66
    my $sum = $sth->fetchrow_hashref;
72
    my $sum = $sth->fetchrow_hashref;
67
    $sth->finish;
73
    $sth->finish;
68
    
74
    
Lines 75-84 if ($parent) { Link Here
75
# ELSE , IF NO PARENT PASSED, THEN CHECK UNALLOCATED FOR PERIOD, IF NOT THEN RETURN 2
81
# ELSE , IF NO PARENT PASSED, THEN CHECK UNALLOCATED FOR PERIOD, IF NOT THEN RETURN 2
76
else {
82
else {
77
    my $query = qq| SELECT SUM(budget_amount) as sum
83
    my $query = qq| SELECT SUM(budget_amount) as sum
78
                FROM aqbudgets WHERE budget_period_id = ? and budget_parent_id IS NULL|;
84
                FROM aqbudgets WHERE budget_period_id = ? and budget_parent_id IS NULL |;
85
    my @sql_params;
86
    push @sql_params, $period_id;
87
    if ($budget_id){
88
        $query.=qq| and budget_id <> ? |;
89
        push @sql_params,$budget_id;
90
    }
79
91
80
    my $sth   = $dbh->prepare($query);
92
    my $sth = $dbh->prepare($query);
81
    $sth->execute(  $period_id  ); 
93
    $sth->execute(@sql_params);
82
    $period_sum = $sth->fetchrow_hashref;
94
    $period_sum = $sth->fetchrow_hashref;
83
    $sth->finish;
95
    $sth->finish;
84
    $budget_period_unalloc = $period->{'budget_period_total'} - $period_sum->{'sum'} if $period->{'budget_period_total'};
96
    $budget_period_unalloc = $period->{'budget_period_total'} - $period_sum->{'sum'} if $period->{'budget_period_total'};
85
- 

Return to bug 4438