fmsystem-commits
[Top][All Lists]
Advanced

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

[Fmsystem-commits] [11742] property: Get the percent of used funding


From: Sigurd Nes
Subject: [Fmsystem-commits] [11742] property: Get the percent of used funding
Date: Sun, 23 Feb 2014 19:43:31 +0000

Revision: 11742
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=11742
Author:   sigurdne
Date:     2014-02-23 19:43:30 +0000 (Sun, 23 Feb 2014)
Log Message:
-----------
property: Get the percent of used funding

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

Modified: trunk/property/inc/class.soworkorder.inc.php
===================================================================
--- trunk/property/inc/class.soworkorder.inc.php        2014-02-23 17:47:28 UTC 
(rev 11741)
+++ trunk/property/inc/class.soworkorder.inc.php        2014-02-23 19:43:30 UTC 
(rev 11742)
@@ -1755,7 +1755,34 @@
                        }
                }
 
+               /**
+                * Get the percent of used funding
+                * @param integer $order_id
+                * @return float percent
+               */
+               function get_order_budget_percent($order_id)
+               {
+                       $_sub_budget = 0;
+                       $_sub_actual_cost = 0;
+                       $_sub_oblications = 0;
+                       $percent = 0;
 
+                       $budget = $this->get_budget($order_id);
+                       foreach($budget as $entry)
+                       {
+                               if ($entry['active'] == 1)
+                               {
+                                       $_sub_budget += $entry['budget'];
+                                       $_sub_actual_cost += 
$entry['actual_cost'];
+                                       $_sub_oblications += 
$entry['sum_oblications'];
+                               }
+                               $percent = round((($_sub_actual_cost + 
$_sub_oblications)/$_sub_budget)*100, 1);
+
+                       }
+
+                       return $percent;
+               }
+
                /**
                * Get periodized budget for an order
                * @param integer $order_id




reply via email to

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