fmsystem-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Fmsystem-commits] [10746] property: budget handling


From: Sigurd Nes
Subject: [Fmsystem-commits] [10746] property: budget handling
Date: Mon, 04 Feb 2013 11:34:36 +0000

Revision: 10746
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=10746
Author:   sigurdne
Date:     2013-02-04 11:34:35 +0000 (Mon, 04 Feb 2013)
Log Message:
-----------
property: budget handling

Modified Paths:
--------------
    trunk/property/inc/class.soproject.inc.php

Modified: trunk/property/inc/class.soproject.inc.php
===================================================================
--- trunk/property/inc/class.soproject.inc.php  2013-02-04 08:21:33 UTC (rev 
10745)
+++ trunk/property/inc/class.soproject.inc.php  2013-02-04 11:34:35 UTC (rev 
10746)
@@ -2282,6 +2282,7 @@
                                        'sum_orders'                    => 
array_sum($_sum_orders),
                                        'sum_oblications'               => 
array_sum($_sum_oblications),
                                        'actual_cost'                   => 
$_actual_cost,
+                                       'deviation_acc'                 => 0
                                );
 
                                $sort_period[] = $period;
@@ -2343,6 +2344,7 @@
                                        'sum_orders'                    => 
array_sum($_sum_orders),
                                        'sum_oblications'               => 
array_sum($_sum_oblications),
                                        'actual_cost'                   => 
$_actual_cost,
+                                       'deviation_acc'                 => 0
                                );
 
                                $sort_period[] = $period;
@@ -2354,6 +2356,8 @@
                        }
 
 
+                       $deviation_acc = 0;
+                       $budget_acc = 0;
                        foreach ($values as &$entry)
                        {
                                $entry['year'] = substr( $entry['period'], 0, 4 
);
@@ -2371,14 +2375,15 @@
                                $_deviation = $entry['budget'] - 
$entry['actual_cost'];
                                $deviation = abs($entry['actual_cost']) > 0 ? 
$_deviation : 0;
                                $entry['deviation_period'] = $deviation;
-                               $entry['deviation_acc'] += $deviation;
+                               $budget_acc +=$entry['budget'];
+                               $deviation_acc += $deviation;
+                               $entry['deviation_acc'] = abs($deviation) > 0 ? 
$deviation_acc : 0;
                                $entry['deviation_percent_period'] = 
$deviation/$entry['budget'] * 100;
-                               $entry['deviation_percent_acc'] = 
$entry['deviation_acc']/$entry['budget'] * 100;
+                               $entry['deviation_percent_acc'] = 
$entry['deviation_acc']/$budget_acc * 100;
                                $entry['closed'] = 
$closed_period[$entry['period']];
                                $entry['active'] = 
$active_period[$entry['period']];
                        }
 
-//_debug_array( $values);die();
                        return $values;
                }
 




reply via email to

[Prev in Thread] Current Thread [Next in Thread]