[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Fmsystem-commits] [10996] Property: budget handling
From: |
Sigurd Nes |
Subject: |
[Fmsystem-commits] [10996] Property: budget handling |
Date: |
Sun, 17 Mar 2013 19:41:06 +0000 |
Revision: 10996
http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=10996
Author: sigurdne
Date: 2013-03-17 19:41:05 +0000 (Sun, 17 Mar 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-03-17 15:59:55 UTC (rev
10995)
+++ trunk/property/inc/class.soproject.inc.php 2013-03-17 19:41:05 UTC (rev
10996)
@@ -133,6 +133,21 @@
$cols = $entity_table . '.location_code';
$cols_return[] = 'location_code';
+ $cols.= ",project_type_id";
+ $cols_return[] =
'project_type_id';
+/*
+ $uicols['input_type'][] = 'hidden';
+ $uicols['name'][] =
'project_type_id';
+ $uicols['descr'][] = '';
+ $uicols['statustext'][] = '';
+ $uicols['exchange'][] = false;
+ $uicols['align'][] = '';
+ $uicols['datatype'][] = '';
+ $uicols['formatter'][] = '';
+ $uicols['classname'][] = '';
+ $uicols['sortable'][] = '';
+*/
+
$cols .= ",$entity_table.id as project_id";
$cols_return[] =
'project_id';
$uicols['input_type'][] = 'text';
@@ -321,7 +336,7 @@
//----- wo_hour_status
$sql =
$this->bocommon->generate_sql(array('entity_table'=>$entity_table,'cols'=>$cols,'cols_return'=>$cols_return,
-
'uicols'=>$uicols,'joinmethod'=>$joinmethod,'paranthesis'=>$paranthesis,'query'=>$query,'force_location'=>true));
+
'uicols'=>$uicols,'joinmethod'=>$joinmethod,'paranthesis'=>$paranthesis,'query'=>$query,'force_location'=>true,'location_level'
=> 2));
$this->bocommon->fm_cache('sql_project_' .
!!$wo_hour_cat_id,$sql);
@@ -728,18 +743,32 @@
$project['obligation'] = 0;
$project['actual_cost'] = 0;
- $workorder_data =
$this->project_workorder_data(array('project_id' => $project['project_id'],
'year' => (int)$filter_year));
+ if($project['project_type_id'] ==
3)//buffer
+ {
+ $buffer_budget =
$this->get_buffer_budget($project['project_id']);
- foreach($workorder_data as $entry)
+ foreach($buffer_budget as
$entry)
+ {
+ $project['budget']
+= $entry['amount_in'];
+ $project['budget']
-= $entry['amount_out'];
+
+ }
+ unset($entry);
+ }
+ else
{
- $project['actual_cost']
+= $entry['actual_cost'];
- $project['combined_cost']
+= $entry['combined_cost'];
- $project['budget']
+= $entry['budget'];
- $project['obligation']
+= $entry['obligation'];
+ $workorder_data =
$this->project_workorder_data(array('project_id' => $project['project_id'],
'year' => (int)$filter_year));
+ foreach($workorder_data as
$entry)
+ {
+ $project['actual_cost']
+= $entry['actual_cost'];
+
$project['combined_cost'] += $entry['combined_cost'];
+ $project['budget']
+= $entry['budget'];
+ $project['obligation']
+= $entry['obligation'];
+ }
+ unset($entry);
+ $_diff_start =
abs($project['budget']) > 0 ? $project['budget'] : $project['combined_cost'];
+ $project['diff'] = $_diff_start
- $project['obligation'] - $project['actual_cost'];
}
-
- $_diff_start = abs($project['budget'])
> 0 ? $project['budget'] : $project['combined_cost'];
- $project['diff'] = $_diff_start -
$project['obligation'] - $project['actual_cost'];
}
//_debug_array($values);
Modified: trunk/property/inc/class.soworkorder.inc.php
===================================================================
--- trunk/property/inc/class.soworkorder.inc.php 2013-03-17 15:59:55 UTC
(rev 10995)
+++ trunk/property/inc/class.soworkorder.inc.php 2013-03-17 19:41:05 UTC
(rev 10996)
@@ -408,7 +408,7 @@
$sql =
$this->bocommon->generate_sql(array('entity_table'=>$entity_table,'location_table'=>$location_table,'cols'=>$cols,'cols_return'=>$cols_return,
'uicols'=>$uicols,'joinmethod'=>$joinmethod,'paranthesis'=>$paranthesis,'query'=>$query,
- 'force_location'=>true, 'no_address' =>
$no_address));
+ 'force_location'=>true, 'no_address' =>
$no_address,'location_level' => 2));
$this->bocommon->fm_cache('sql_workorder'.!!$search_vendor . '_' .
!!$wo_hour_cat_id . '_' . !!$b_group,$sql);
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Fmsystem-commits] [10996] Property: budget handling,
Sigurd Nes <=