[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Fmsystem-commits] [10169] property: more on budget
From: |
Sigurd Nes |
Subject: |
[Fmsystem-commits] [10169] property: more on budget |
Date: |
Tue, 09 Oct 2012 10:48:55 +0000 |
Revision: 10169
http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=10169
Author: sigurdne
Date: 2012-10-09 10:48:54 +0000 (Tue, 09 Oct 2012)
Log Message:
-----------
property: more on budget
Modified Paths:
--------------
trunk/property/inc/class.soproject.inc.php
trunk/property/inc/class.uiproject.inc.php
trunk/property/js/yahoo/project.edit.js
Modified: trunk/property/inc/class.soproject.inc.php
===================================================================
--- trunk/property/inc/class.soproject.inc.php 2012-10-09 10:32:41 UTC (rev
10168)
+++ trunk/property/inc/class.soproject.inc.php 2012-10-09 10:48:54 UTC (rev
10169)
@@ -1194,9 +1194,13 @@
'account_group' =>
$project['b_account_id'],
'contact_id' =>
$project['contact_id'],
'inherit_location' =>
$project['inherit_location'],
- 'periodization_id' =>
$project['budget_periodization'],
);
+ if(isset($project['budget_periodization']) &&
$project['budget_periodization'])
+ {
+ $value_set['periodization_id'] =
$project['budget_periodization'];
+ }
+
$data_attribute =
$this->custom->prepare_for_db('fm_project', $values_attribute, $project['id']);
if(isset($data_attribute['value_set']))
@@ -1733,74 +1737,86 @@
}
- $config = CreateObject('phpgwapi.config','property');
- $config->read();
- $tax = 1+(($config->config_data['fm_tax'])/100);
+ if(!$_use_periodization)
+ {
+ $config =
CreateObject('phpgwapi.config','property');
+ $config->read();
+ $tax = 1+(($config->config_data['fm_tax'])/100);
- $sql = "SELECT fm_workorder.id, sum(calculation) as
calculation, sum(budget) as budget, sum(contract_sum) as contract_sum,
fm_workorder.addition, start_date"
- . " FROM fm_workorder"
- . " {$this->join} fm_workorder_status ON
fm_workorder.status = fm_workorder_status.id"
- . " WHERE project_id = {$project_id} AND
(fm_workorder_status.closed IS NULL OR fm_workorder_status.closed != 1)"
- . " GROUP BY fm_workorder.id,
fm_workorder.start_date,fm_workorder.addition ORDER BY start_date ASC";
- $this->db->query($sql,__LINE__,__FILE__);
+ $sql = "SELECT fm_workorder.id,
sum(calculation) as calculation, sum(budget) as budget, sum(contract_sum) as
contract_sum, fm_workorder.addition, start_date"
+ . " FROM fm_workorder"
+ . " {$this->join} fm_workorder_status ON
fm_workorder.status = fm_workorder_status.id"
+ . " WHERE project_id = {$project_id} AND
(fm_workorder_status.closed IS NULL OR fm_workorder_status.closed != 1)"
+ . " GROUP BY fm_workorder.id,
fm_workorder.start_date,fm_workorder.addition ORDER BY start_date ASC";
+ $this->db->query($sql,__LINE__,__FILE__);
-
- while ($this->db->next_record())
- {
- $_found = false;
- $_start_date = $this->db->f('start_date');
- $_order_period = date('Ym', $_start_date);
-
- $year = date('Y');
-
- if($_use_periodization)
+ while ($this->db->next_record())
{
- $periode = $_order_period;
- if(isset($project_budget[$periode]))
+ $_found = false;
+ $_start_date =
$this->db->f('start_date');
+ $_order_period = date('Ym',
$_start_date);
+
+ $year = date('Y');
+
+ if($_use_periodization)
{
- $_found = true;
- }
- }
-
- if(!$_found) //move to current
- {
- $check_months = array(0, date('m'));
- foreach ($check_months as $i)
- {
- $periode = $year .
sprintf("%02s", $i);
+ $periode = $_order_period;
if(isset($project_budget[$periode]))
{
$_found = true;
- break;
}
}
- }
+
+ if(!$_found) //move to current
+ {
+ $check_months = array(0,
date('m'));
+ foreach ($check_months as $i)
+ {
+ $periode = $year .
sprintf("%02s", $i);
+
if(isset($project_budget[$periode]))
+ {
+ $_found = true;
+ break;
+ }
+ }
+ }
- if(!$_found)
- {
- $periode = date('Ym');
+ if(!$_found)
+ {
+ $periode = date('Ym');
+ }
+
+ if(abs($this->db->f('contract_sum')) >
0)
+ {
+ $_amount =
$this->db->f('contract_sum') * ( 1 + ((int)$this->db->f('addition')/100));
+ }
+ else
if(abs($this->db->f('calculation')) > 0)
+ {
+ $_amount =
$this->db->f('calculation') * $tax;
+ }
+ else if(abs($this->db->f('budget')) > 0)
+ {
+ $_amount =
$this->db->f('budget');
+ }
+ else
+ {
+ $_amount = 0;
+ }
+
+
$orders[$periode][$this->db->f('id')]['amount'] = $_amount;
}
+ unset($periode);
+ }
+ else
+ {
- if(abs($this->db->f('contract_sum')) > 0)
+ //FIXME
+ foreach ($project_order_amount as $periode =>
$_amount)
{
- $_amount = $this->db->f('contract_sum')
* ( 1 + ((int)$this->db->f('addition')/100));
+ $orders[$periode][] = array('amount' =>
$_amount);
}
- else if(abs($this->db->f('calculation')) > 0)
- {
- $_amount = $this->db->f('calculation')
* $tax;
- }
- else if(abs($this->db->f('budget')) > 0)
- {
- $_amount = $this->db->f('budget');
- }
- else
- {
- $_amount = 0;
- }
- $orders[$periode][$this->db->f('id')]['amount']
= $_amount;
}
- unset($periode);
$sort_period = array();
$values = array();
@@ -1930,7 +1946,9 @@
$month = substr( $entry['period'], 4, 2 );
$entry['month'] = $month == '00' ? '' : $month;
$entry['diff'] = $entry['budget'] -
$entry['sum_orders'] - $entry['actual_cost'];
- // $entry['deviation'] = $entry['budget'] -
$entry['actual_cost'];
+ $deviation = $entry['budget'] -
$entry['actual_cost'];
+ $entry['deviation'] = $deviation;
+ $entry['deviation_percent'] =
$deviation/$entry['budget'] * 100;
$entry['closed'] =
$closed_period[$entry['period']];
}
Modified: trunk/property/inc/class.uiproject.inc.php
===================================================================
--- trunk/property/inc/class.uiproject.inc.php 2012-10-09 10:32:41 UTC (rev
10168)
+++ trunk/property/inc/class.uiproject.inc.php 2012-10-09 10:48:54 UTC (rev
10169)
@@ -1718,9 +1718,10 @@
array('key' =>
'month','label'=>lang('month'),'sortable'=>false,'resizeable'=>true),
array('key' =>
'budget','label'=>lang('budget'),'sortable'=>false,'resizeable'=>true,'formatter'=>'FormatterAmount0'),
array('key' => 'sum_orders','label'=>lang('sum
orders'),'sortable'=>false,'resizeable'=>true,'formatter'=>'FormatterAmount0'),
-
array('key' =>
'actual_cost','label'=>lang('actual
cost'),'sortable'=>false,'resizeable'=>true,'formatter'=>'FormatterAmount2'),
-
array('key' =>
'diff','label'=>lang('difference'),'sortable'=>false,'resizeable'=>true,'formatter'=>'FormatterAmount2'),
-
// array('key' =>
'deviation','label'=>lang('deviation'),'sortable'=>false,'resizeable'=>true,'formatter'=>'FormatterAmount2'),
+
array('key' =>
'actual_cost','label'=>lang('actual
cost'),'sortable'=>false,'resizeable'=>true,'formatter'=>'FormatterAmount0'),
+
array('key' =>
'diff','label'=>lang('difference'),'sortable'=>false,'resizeable'=>true,'formatter'=>'FormatterAmount0'),
+
array('key' =>
'deviation','label'=>lang('deviation'),'sortable'=>false,'resizeable'=>true,'formatter'=>'FormatterAmount0'),
+
array('key' =>
'deviation_percent','label'=>lang('deviation') . '::' .
lang('percent'),'sortable'=>false,'resizeable'=>true,'formatter'=>'FormatterAmount2'),
array('key' =>
'closed','label'=>lang('closed'),'sortable'=>false,'resizeable'=>true,'formatter'=>'FormatterCenter'),
array('key' => 'closed_orig','hidden' => true),
array('key' =>
'delete_year','label'=>lang('Delete'),'sortable'=>false,'resizeable'=>true,'formatter'=>'FormatterCenter')))
Modified: trunk/property/js/yahoo/project.edit.js
===================================================================
--- trunk/property/js/yahoo/project.edit.js 2012-10-09 10:32:41 UTC (rev
10168)
+++ trunk/property/js/yahoo/project.edit.js 2012-10-09 10:48:54 UTC (rev
10169)
@@ -95,9 +95,9 @@
//call getTotalSum(name of column) in property.js
tmp_sum1 = getTotalSum('budget',0,paginator,datatable);
tmp_sum2 = getTotalSum('sum_orders',0,paginator,datatable);
- tmp_sum3 = getTotalSum('actual_cost',2,paginator,datatable);
- tmp_sum4 = getTotalSum('diff',2,paginator,datatable);
- // tmp_sum5 = getTotalSum('deviation',2,paginator,datatable);
+ tmp_sum3 = getTotalSum('actual_cost',0,paginator,datatable);
+ tmp_sum4 = getTotalSum('diff',0,paginator,datatable);
+ tmp_sum5 = getTotalSum('deviation',0,paginator,datatable);
if(typeof(tableYUI0)=='undefined')
{
@@ -118,8 +118,8 @@
td_sum(tmp_sum2);
td_sum(tmp_sum3);
td_sum(tmp_sum4);
-// td_sum(tmp_sum5);
- td_empty(3);
+ td_sum(tmp_sum5);
+ td_empty(4);
myfoot = tableYUI0.createTFoot();
myfoot.setAttribute("id","myfoot");
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Fmsystem-commits] [10169] property: more on budget,
Sigurd Nes <=