fmsystem-commits
[Top][All Lists]
Advanced

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

[Fmsystem-commits] [9736] property: calculation


From: Sigurd Nes
Subject: [Fmsystem-commits] [9736] property: calculation
Date: Wed, 04 Jul 2012 12:28:38 +0000

Revision: 9736
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=9736
Author:   sigurdne
Date:     2012-07-04 12:28:38 +0000 (Wed, 04 Jul 2012)
Log Message:
-----------
property: calculation

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

Modified: trunk/property/inc/class.soproject.inc.php
===================================================================
--- trunk/property/inc/class.soproject.inc.php  2012-07-04 12:27:01 UTC (rev 
9735)
+++ trunk/property/inc/class.soproject.inc.php  2012-07-04 12:28:38 UTC (rev 
9736)
@@ -1621,7 +1621,6 @@
                                $orders[$year][$this->db->f('id')]['amount'] = 
$_amount;
                        }
 
-
                        $sort_year = array();
                        $values = array();
 
@@ -1634,21 +1633,30 @@
                                $project_budget[$this->db->f('year')] = 
(int)$this->db->f('budget');
                        }
                        
+//_debug_array($orders);die();
                        foreach ($project_budget as $year => $budget)
                        {
+                               $_sum_orders = 0;
+                               $_actual_cost = 0;
+
                                if(isset($orders[$year]))
                                {
-                                       
-                                       $_sum_orders = 0;
-                                       $_actual_cost= 0;
-
                                        foreach ($orders[$year] as $order_id => 
$order)
                                        {
                                                $_sum_orders += 
$order['amount'];
-                                               $_sum_orders -= 
$order['actual_cost'];
+                       //                      $_sum_orders -= 
$order['actual_cost'];
 
                                                if($budget > 0)
                                                {
+                                                       
if($order['actual_cost'] > 0)
+                                                       {
+                                                               $_sum_orders -= 
$order['actual_cost'];
+                                                       }
+                                                       else
+                                                       {
+                                                               $_sum_orders += 
$order['actual_cost'];                                                  
+                                                       }
+
                                                        $_sum_orders = 
$_sum_orders > 0 ? $_sum_orders : 0;
                                                }
                                                else // income
@@ -1660,13 +1668,7 @@
                                        }
 
                                        unset($orders[$year]);
-
                                }
-                               else
-                               {
-                                       $_sum_orders = 0;
-                                       $_actual_cost = 0;
-                               }
 
                                $values[] = array
                                (
@@ -1679,7 +1681,7 @@
 
                                $sort_year[] = $year;
                        }
-
+//_debug_array($values);die();
                        unset($order);
                        unset($order_id);
                        unset($year);




reply via email to

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