[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Fmsystem-commits] [8763] property: project budgetting
From: |
Sigurd Nes |
Subject: |
[Fmsystem-commits] [8763] property: project budgetting |
Date: |
Thu, 02 Feb 2012 12:08:41 +0000 |
Revision: 8763
http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=8763
Author: sigurdne
Date: 2012-02-02 12:08:33 +0000 (Thu, 02 Feb 2012)
Log Message:
-----------
property: project budgetting
Modified Paths:
--------------
trunk/property/inc/class.soproject.inc.php
Modified: trunk/property/inc/class.soproject.inc.php
===================================================================
--- trunk/property/inc/class.soproject.inc.php 2012-02-02 12:04:19 UTC (rev
8762)
+++ trunk/property/inc/class.soproject.inc.php 2012-02-02 12:08:33 UTC (rev
8763)
@@ -587,8 +587,6 @@
$project_list = array();
-
-
$count_cols_return=count($cols_return);
while ($this->db->next_record())
@@ -617,16 +615,48 @@
$project['query_location']['loc' .
($m+1)]=implode("-", array_slice($location, 0, ($m+1)));
}
- $sql_workder = 'SELECT
sum(fm_workorder.combined_cost) as combined_cost,'
- . ' (sum(fm_workorder.act_mtrl_cost) +
sum(fm_workorder.act_vendor_cost)) as actual_cost,'
- . ' sum(fm_workorder.billable_hours) as
billable_hours'
- . " FROM fm_workorder WHERE project_id =
'{$project['project_id']}'";
+ $project['combined_cost'] = 0;
+ $project['actual_cost'] = 0;
+ $project['billable_hours'] = 0;
+
+ $sql_workder = 'SELECT
paid_percent,contract_sum, calculation, budget,'
+ . ' (fm_workorder.act_mtrl_cost +
fm_workorder.act_vendor_cost) as actual_cost,'
+ . ' billable_hours,closed'
+ . " FROM fm_workorder {$this->join}
fm_workorder_status ON fm_workorder.status = fm_workorder_status.id"
+ . " WHERE project_id =
'{$project['project_id']}'";
+
$this->db->query($sql_workder);
- $this->db->next_record();
- $project['combined_cost'] =
(int)$this->db->f('combined_cost');
- $project['actual_cost'] =
(int)$this->db->f('actual_cost');
- $project['billable_hours'] =
(int)$this->db->f('billable_hours');
+ while ($this->db->next_record())
+ {
+ $paid_percent =
(int)$this->db->f('paid_percent');
+ if($this->db->f('closed'))
+ {
+ $_sum = 0;
+ }
+ else if($this->db->f('contract_sum') >
0)
+ {
+ $_sum =
$this->db->f('contract_sum');
+ }
+ else if($this->db->f('calculation') > 0)
+ {
+ $_sum =
$this->db->f('calculation');
+ }
+ else if($this->db->f('budget') > 0)
+ {
+ $_sum = $this->db->f('budget');
+ }
+ else
+ {
+ $_sum = 0;
+ }
+
+ $_sum = $_sum * (100 -
$paid_percent)/100;
+
+ $project['combined_cost'] +=
$_sum;
+ $project['actual_cost'] +=
(int)$this->db->f('actual_cost');
+ $project['billable_hours'] +=
(int)$this->db->f('billable_hours');
+ }
}
return $project_list;
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Fmsystem-commits] [8763] property: project budgetting,
Sigurd Nes <=