fmsystem-commits
[Top][All Lists]
Advanced

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

[Fmsystem-commits] [15911] Property: revising economic-reporting/calc


From: sigurdne
Subject: [Fmsystem-commits] [15911] Property: revising economic-reporting/calc
Date: Sun, 30 Oct 2016 14:08:14 +0000 (UTC)

Revision: 15911
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=15911
Author:   sigurdne
Date:     2016-10-30 14:08:14 +0000 (Sun, 30 Oct 2016)
Log Message:
-----------
Property: revising economic-reporting/calc

Modified Paths:
--------------
    branches/Version-1_0-branch/property/inc/class.soproject.inc.php
    branches/Version-1_0-branch/property/inc/class.soworkorder.inc.php

Modified: branches/Version-1_0-branch/property/inc/class.soproject.inc.php
===================================================================
--- branches/Version-1_0-branch/property/inc/class.soproject.inc.php    
2016-10-28 12:32:18 UTC (rev 15910)
+++ branches/Version-1_0-branch/property/inc/class.soproject.inc.php    
2016-10-30 14:08:14 UTC (rev 15911)
@@ -2140,7 +2140,6 @@
                        $closed_period                   = array();
                        $active_period                   = array();
                        $project_budget                  = array();
-                       $project_total_budget    = 0;
 
                        $sql = "SELECT fm_project_budget.year, 
fm_project_budget.month, fm_project_budget.budget,"
                        . " fm_project_budget.closed, fm_project_budget.active, 
sum(combined_cost) AS order_amount, project_type_id"
@@ -2185,12 +2184,13 @@
 
                        $soworkorder = CreateObject('property.soworkorder');
 
-                       $order_budget = array();
+                       $order_budgets = array();
                        foreach($_order_list as $_order_id)
                        {
                                $order_budgets[$_order_id] = 
$soworkorder->get_budget($_order_id);
                        }
 
+                       $_orders = array();
                        foreach($order_budgets as $_order_id => $order_budget)
                        {
 
@@ -2266,7 +2266,7 @@
                        unset($_budget);
                        unset($period);
 
-                       if(isset($_orders) && $_orders)
+                       if (!empty($_orders))
                        {
                                foreach($_orders as $period => $_budget)
                                {
@@ -2349,8 +2349,8 @@
 
                                $entry['deviation_acc'] = abs($deviation) > 0 ? 
$deviation_acc : 0;
 
-                               $entry['deviation_percent_period']       = 
$corretion * $deviation / $entry['budget'] * 100;
-                               $entry['deviation_percent_acc']          = 
$corretion * $entry['deviation_acc'] / $total_sum * 100;
+                               $entry['deviation_percent_period'] =  
abs($entry['budget']) > 0 ? ($corretion * $deviation / $entry['budget'] * 100) 
: 0;
+                               $entry['deviation_percent_acc'] = 
abs($total_sum) > 0 ? ($corretion * $entry['deviation_acc'] / $total_sum * 100) 
: 0;
                                $entry['closed']                                
         = $closed_period[$entry['period']];
                                $entry['active']                                
         = $active_period[$entry['period']];
                        }

Modified: branches/Version-1_0-branch/property/inc/class.soworkorder.inc.php
===================================================================
--- branches/Version-1_0-branch/property/inc/class.soworkorder.inc.php  
2016-10-28 12:32:18 UTC (rev 15910)
+++ branches/Version-1_0-branch/property/inc/class.soworkorder.inc.php  
2016-10-30 14:08:14 UTC (rev 15911)
@@ -1977,7 +1977,7 @@
                        {
                                if($entry['periodization'])
                                {
-                                       $periodization_start = 
$entry['periodization_start'] ? $entry['periodization_start'] : 
$entry['periodization'];
+                                       $periodization_start = 
$entry['periodization_start'] ? $entry['periodization_start'] : 
$entry['periode'];
 
                                        $periodization_start_year        = 
(int) substr($periodization_start, 0, 4);
                                        $periodization_start_month       = 
(int) substr($periodization_start, -2);
@@ -2390,18 +2390,16 @@
                                        $budget_acc              = 0;
                                }
 
+                               $_diff_start    = abs($entry['budget']) > 0 ? 
$entry['budget'] : $entry['sum_orders'];
+                               $entry['diff']  = $_diff_start - 
$entry['sum_oblications'] - $entry['actual_cost'];
                                if (abs($entry['actual_cost']) > 0 ||  
$entry['period'] < date('Ym'))
                                {
-                                       $_diff_start    = abs($entry['budget']) 
> 0 ? $entry['budget'] : $entry['sum_orders'];
-                                       $entry['diff']  = $_diff_start - 
$entry['sum_oblications'] - $entry['actual_cost'];
-
                                        $_deviation             = 
$entry['budget'] - $entry['actual_cost'];
                                        $deviation              = $_deviation;
                                        $deviation_acc += $deviation;
                                }
                                else
                                {
-                                       $entry['diff']   = 0;
                                        $deviation               = 0;
                                }
 
@@ -2416,8 +2414,8 @@
                                $entry['budget_acc'] = $budget_acc;
                                $entry['deviation_acc'] = abs($deviation) > 0 ? 
$deviation_acc : 0;
 
-                               $entry['deviation_percent_period'] = $deviation 
/ $entry['budget'] * 100;
-                               $entry['deviation_percent_acc'] = 
$entry['deviation_acc'] / $budget_acc * 100;
+                               $entry['deviation_percent_period'] = 
abs($entry['budget']) > 0 ? ($deviation / $entry['budget'] * 100) : 0;
+                               $entry['deviation_percent_acc'] = 
abs($budget_acc) > 0 ? ($entry['deviation_acc'] / $budget_acc * 100) : 0;
 
                                $entry['closed'] = 
isset($closed_period[$entry['period']]) && $closed_period[$entry['period']];
                                $entry['fictive'] = 
isset($fictive_period[$entry['period']]) && $fictive_period[$entry['period']];




reply via email to

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