fmsystem-commits
[Top][All Lists]
Advanced

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

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


From: Sigurd Nes
Subject: [Fmsystem-commits] [10937] property: budget handling
Date: Thu, 28 Feb 2013 12:58:49 +0000

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

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

Modified: trunk/property/inc/class.soproject.inc.php
===================================================================
--- trunk/property/inc/class.soproject.inc.php  2013-02-28 10:20:22 UTC (rev 
10936)
+++ trunk/property/inc/class.soproject.inc.php  2013-02-28 12:58:48 UTC (rev 
10937)
@@ -2877,12 +2877,36 @@
                                $this->db->next_record();
                                $paid_last_year = $this->db->f('paid');
 
-                               $subtract = $last_budget - $paid_last_year;
-//_debug_array($subtract);die();
-                               $transferred = $this->update_budget($id, 
$latest_year, $periodization_id, $subtract, false, 'subtract');
+                               $subtract = $last_budget - $paid_last_year;     
                        
+                               $_perform_subtraction = false;
 
-                               $new_budget = $last_budget - $paid_last_year;
+                               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_budget($id, $latest_year, $periodization_id, $subtract, false, 
'subtract');
+                                       $new_budget = $last_budget - 
$paid_last_year;
+                               }
+                               else
+                               {
+                                       $new_budget = 0;
+                               }
+
                                $this->update_budget($id, $year, 
$periodization_id, $new_budget, true, 'update', true);
+                               
                        }
                        else if($project_type_id == 1)//operation
                        {




reply via email to

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