fmsystem-commits
[Top][All Lists]
Advanced

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

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


From: Sigurd Nes
Subject: [Fmsystem-commits] [10938] property: budget handling
Date: Thu, 28 Feb 2013 13:04:35 +0000

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

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

Modified: trunk/property/inc/class.soproject.inc.php
===================================================================
--- trunk/property/inc/class.soproject.inc.php  2013-02-28 12:58:48 UTC (rev 
10937)
+++ trunk/property/inc/class.soproject.inc.php  2013-02-28 13:04:34 UTC (rev 
10938)
@@ -2229,7 +2229,7 @@
                                                'sum_oblications'               
=> $_budget['sum_oblications'],
                                                'actual_cost'                   
=> $_budget['actual_cost'],
                                                'deviation_acc'                 
=> 0
-                                       );                              
+                                       );
                                }
                        }
 
@@ -2470,7 +2470,7 @@
                                                        $_delay_period += 
$_sum_oblications[$order_id];
                                                        
$_sum_oblications[$order_id] = 0;
                                                }
-                                               
+
                                                //override if periode is closed
                                                
if(isset($closed_period[$period]) && $closed_period[$period])
                                                {
@@ -2563,7 +2563,7 @@
                                                $_delay_period += 
$_sum_oblications[$order_id];
                                                $_sum_oblications[$order_id] = 
0;
                                        }
-                                               
+
                                        //override if periode is closed
                                        if(isset($closed_period[$period]) && 
$closed_period[$period])
                                        {
@@ -2877,7 +2877,7 @@
                                $this->db->next_record();
                                $paid_last_year = $this->db->f('paid');
 
-                               $subtract = $last_budget - $paid_last_year;     
                        
+                               $subtract = $last_budget - $paid_last_year;
                                $_perform_subtraction = false;
 
                                if($last_budget >= 0)
@@ -2906,7 +2906,7 @@
                                }
 
                                $this->update_budget($id, $year, 
$periodization_id, $new_budget, true, 'update', true);
-                               
+
                        }
                        else if($project_type_id == 1)//operation
                        {

Modified: trunk/property/inc/class.soworkorder.inc.php
===================================================================
--- trunk/property/inc/class.soworkorder.inc.php        2013-02-28 12:58:48 UTC 
(rev 10937)
+++ trunk/property/inc/class.soworkorder.inc.php        2013-02-28 13:04:34 UTC 
(rev 10938)
@@ -2202,12 +2202,36 @@
                                . " WHERE periode > {$latest_year}00 AND 
periode < {$latest_year}13 AND fm_workorder.id = {$id}",__LINE__,__FILE__);
                                $this->db->next_record();
                                $paid_last_year = $this->db->f('paid');
-                               
+
                                $subtract = $last_budget - $paid_last_year;
-       //                      $transferred = $this->_update_order_budget($id, 
$latest_year, $periodization_id, $subtract, $subtract, $subtract, $action = 
'subtract');
-                               $transferred = $this->_update_order_budget($id, 
$latest_year, $periodization_id, $paid_last_year, $paid_last_year, 
$paid_last_year, $action = 'update', true);
 
-                               $new_budget = $last_budget - $paid_last_year;
+                               $_perform_subtraction = false;
+
+                               if($last_budget >= 0)
+                               {
+                                       if($subtract > $last_budget)
+                                       {
+                                               $_perform_subtraction = true;
+                                       }
+                               }
+                               else
+                               {
+                                       if($subtract < $last_budget)
+                                       {
+                                               $_perform_subtraction = true;
+                                       }
+                               }
+
+                               if($_perform_subtraction)
+                               {
+                                       $transferred = 
$this->_update_order_budget($id, $latest_year, $periodization_id, 
$paid_last_year, $paid_last_year, $paid_last_year, $action = 'update', true);
+                                       $new_budget = $last_budget - 
$paid_last_year;
+                               }
+                               else
+                               {
+                                       $new_budget = 0;
+                               }
+
                                $this->_update_order_budget($id, $year, 
$periodization_id, $new_budget, $new_budget, $new_budget, $action = 'update', 
true);
                        }
 //die();




reply via email to

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