fmsystem-commits
[Top][All Lists]
Advanced

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

[Fmsystem-commits] [15825] budget handling


From: sigurdne
Subject: [Fmsystem-commits] [15825] budget handling
Date: Thu, 13 Oct 2016 18:03:49 +0000 (UTC)

Revision: 15825
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=15825
Author:   sigurdne
Date:     2016-10-13 18:03:49 +0000 (Thu, 13 Oct 2016)
Log Message:
-----------
budget handling

Modified Paths:
--------------
    branches/Version-1_0-branch/property/inc/class.soproject.inc.php
    
branches/Version-1_0-branch/property/inc/cron/default/reset_workorder_cached_budget.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-13 14:56:17 UTC (rev 15824)
+++ branches/Version-1_0-branch/property/inc/class.soproject.inc.php    
2016-10-13 18:03:49 UTC (rev 15825)
@@ -1064,8 +1064,15 @@
                                //              $_taxfactor = 1 + 
($_taxcode[(int)$this->db->f('mvakode')]/100);
                                //              $_actual_cost = 
round($actual_cost/$_taxfactor);
 
-                               $_diff_start     = abs($entry['budget']) > 0 ? 
$entry['budget'] : $entry['combined_cost'];
-                               $entry['diff']   = $_diff_start - 
$entry['obligation'] - $entry['actual_cost'];
+                               if($entry['closed'])
+                               {
+                                       $entry['diff'] = 0;
+                               }
+                               else
+                               {
+                                       $_diff_start = abs($entry['budget']) > 
0 ? $entry['budget'] : $entry['combined_cost'];
+                                       $entry['diff'] = $_diff_start - 
$entry['obligation'] - $entry['actual_cost'];                           
+                               }
                        }
 
                        return $values;
@@ -2321,7 +2328,7 @@
                                        $budget_acc              = 0;
                                }
 
-                               if(abs($entry['actual_cost']) > 0 )
+                               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'];

Modified: 
branches/Version-1_0-branch/property/inc/cron/default/reset_workorder_cached_budget.php
===================================================================
--- 
branches/Version-1_0-branch/property/inc/cron/default/reset_workorder_cached_budget.php
     2016-10-13 14:56:17 UTC (rev 15824)
+++ 
branches/Version-1_0-branch/property/inc/cron/default/reset_workorder_cached_budget.php
     2016-10-13 18:03:49 UTC (rev 15825)
@@ -67,6 +67,9 @@
                                
execMethod('property.soworkorder.get_budget',$order_id);
                        }
 
+                       $sql = "UPDATE fm_project_budget SET closed = 1 WHERE 
year =" . date('Y') . ' AND ( month > 0 AND month <= ' . date('n') . ')';
+                       $this->db->query($sql, __LINE__, __FILE__);
+
                        $count_orders = count($orders);
 
                        $this->receipt['message'][] = array('msg' => 
"Rekalkulert budsjett for {$count_orders} løpende bestillinger");




reply via email to

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