fmsystem-commits
[Top][All Lists]
Advanced

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

[Fmsystem-commits] [10670] property: budget listing


From: Sigurd Nes
Subject: [Fmsystem-commits] [10670] property: budget listing
Date: Mon, 14 Jan 2013 12:41:23 +0000

Revision: 10670
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=10670
Author:   sigurdne
Date:     2013-01-14 12:41:22 +0000 (Mon, 14 Jan 2013)
Log Message:
-----------
property: budget listing

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-01-14 12:10:52 UTC (rev 
10669)
+++ trunk/property/inc/class.soproject.inc.php  2013-01-14 12:41:22 UTC (rev 
10670)
@@ -1405,6 +1405,11 @@
 
                                        
$this->_update_buffer_budget($project['transfer_target'], date('Y'), 
$project['transfer_amount'], $project['id'],null,$project['transfer_remark']);
 
+                                       $this->db->query("SELECT sum(amount_in) 
AS amount_in, sum(amount_out) AS amount_out FROM fm_project_buffer_budget WHERE 
buffer_project_id = " . (int)$project['transfer_target'],__LINE__,__FILE__);
+                                       $this->db->next_record();
+                                       $new_budget 
=(int)$this->db->f('amount_in') - (int)$this->db->f('amount_out');
+                                       $this->db->query("UPDATE fm_project SET 
budget = {$new_budget} WHERE id = " . 
(int)$project['transfer_target'],__LINE__,__FILE__);
+
                                        if(isset($project['transfer_remark']) 
&& $project['transfer_remark'])
                                        {
                                                
$historylog->add('RM',$project['id'],$project['transfer_remark'], false);
@@ -1814,7 +1819,7 @@
                                $transferred = 
$this->update_budget($from_project, $year, $periodization_id, $amount_in, 
false, 'subtract');
                                if(!$transferred == $amount_in)
                                {
-                                       throw new 
Exception('property_soproject::update_buffer_budget() - failed to transefer the 
full amount');
+                                       throw new 
Exception('property_soproject::update_buffer_budget() - failed to transfer the 
full amount');
                                }
                        }
                }
@@ -1832,7 +1837,7 @@
                                $acc_partial = 0;
 
                                $orig_budget = $this->get_budget($project_id);
-//_debug_array($orig_budget);
+
                                $hit = false;
                                foreach ($orig_budget as $entry)
                                {
@@ -1892,6 +1897,11 @@
 
                                        $this->_update_budget($project_id, 
$year, $month, $budget, $action);                                    
                                }
+                               
+                               if(!$hit)
+                               {
+                                       throw new 
Exception('property_soproject::update_buffer_budget() - found no active budget 
to transfer from');                            
+                               }
 
                                return $acc_partial;
                        }




reply via email to

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