[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Fmsystem-commits] [10713] property: bulk update budget
From: |
Sigurd Nes |
Subject: |
[Fmsystem-commits] [10713] property: bulk update budget |
Date: |
Thu, 24 Jan 2013 20:54:41 +0000 |
Revision: 10713
http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=10713
Author: sigurdne
Date: 2013-01-24 20:54:40 +0000 (Thu, 24 Jan 2013)
Log Message:
-----------
property: bulk update budget
Modified Paths:
--------------
trunk/property/inc/class.soproject.inc.php
trunk/property/inc/class.uiproject.inc.php
trunk/property/setup/phpgw_no.lang
Modified: trunk/property/inc/class.soproject.inc.php
===================================================================
--- trunk/property/inc/class.soproject.inc.php 2013-01-24 14:44:35 UTC (rev
10712)
+++ trunk/property/inc/class.soproject.inc.php 2013-01-24 20:54:40 UTC (rev
10713)
@@ -2620,13 +2620,13 @@
}
}
- $sql_budget = "SELECT DISTINCT year, active FROM
fm_{$type}_budget WHERE ";
+ $sql_budget = "SELECT DISTINCT year, active,
sum(budget) as budget FROM fm_{$type}_budget WHERE ";
switch($type)
{
case 'project':
- $sql_budget .= 'project_id = %d ORDER
BY year';
+ $sql_budget .= 'project_id = %d GROUP
BY year, active ORDER BY year';
if($closed_orders)
{
@@ -2637,17 +2637,17 @@
$status_table = 'fm_project_status';
$title_field = 'fm_project.name as
title';
$this->_update_status_project($execute,
$status_new, $ids);
- $sql = "SELECT DISTINCT {$table}.id,
$status_table.descr as status
,{$title_field},{$table}.start_date,{$table}.project_type_id, count(project_id)
as num_open FROM {$table}"
+ $sql = "SELECT DISTINCT
{$table}.id,{$status_table}.closed, {$status_table}.descr as status
,{$title_field},{$table}.start_date,{$table}.project_type_id, count(project_id)
as num_open FROM {$table}"
. " {$this->join} {$status_table} ON
{$table}.status = {$status_table}.id "
. " {$this->left_join}
fm_open_workorder_view ON {$table}.id = fm_open_workorder_view.project_id "
. " WHERE ({$table}.start_date >
{$start_date} AND {$table}.start_date < {$end_date} OR {$table}.start_date IS
NULL) {$filter}"
- . " GROUP BY {$table}.id,
$status_table.descr ,{$table}.name, {$table}.start_date,project_type_id"
+ . " GROUP BY {$table}.id,
{$status_table}.closed, {$status_table}.descr ,{$table}.name,
{$table}.start_date,project_type_id"
. " ORDER BY {$table}.id DESC";
break;
case 'workorder':
- $sql_budget .= 'order_id = %d ORDER BY
year';
+ $sql_budget .= 'order_id = %d GROUP BY
year, active ORDER BY year';
$table = 'fm_workorder';
$status_table = 'fm_workorder_status';
@@ -2664,7 +2664,8 @@
}
$this->_update_status_workorder($execute, $status_new, $ids);
- $sql = "SELECT {$table}.id, project_id,
$status_table.descr as status ,{$title_field},{$table}.start_date
{$actual_cost},project_type_id"
+ $sql = "SELECT {$table}.id,
project_id,{$status_table}.closed, {$status_table}.descr as status
,{$title_field},{$table}.start_date {$actual_cost},"
+ . " project_type_id, continuous"
. " FROM {$table} {$join_method}"
. " WHERE ({$table}.start_date >
{$start_date} AND {$table}.start_date < {$end_date} {$filter}) OR
{$table}.start_date is NULL"
. " ORDER BY {$table}.id DESC";
@@ -2690,11 +2691,14 @@
(
'id' =>
$this->db->f('id'),
'project_id' =>
$this->db->f('project_id'),
+ 'closed' =>
$this->db->f('closed'),
'title' =>
htmlspecialchars_decode($this->db->f('title',true)),
'status' =>
$this->db->f('status',true),
'actual_cost' =>
(float)$this->db->f('actual_cost'),
'start_date' =>
$GLOBALS['phpgw']->common->show_date($this->db->f('start_date'),$dateformat),
'num_open' =>
(int)$this->db->f('num_open'),
+ 'project_type_id' =>
$this->db->f('project_type_id'),
+ 'continuous' =>
$this->db->f('continuous') ? X : '',
'project_type' =>
$project_types[$this->db->f('project_type_id')],
);
}
@@ -2708,9 +2712,11 @@
while ($this->db->next_record())
{
- $budget[] = $this->db->f('year') . '['
. $this->db->f('active') . ']';
+ $_active = $this->db->f('active') ? X :
0;
+ $_budget =
number_format((int)$this->db->f('budget'), 0, ',', '.');
+ $budget[] = $this->db->f('year') . "
[{$_active}/ {$_budget}]";
}
- $entry['budget'] = implode(';', $budget);
+ $entry['budget'] = implode(' ;', $budget);
}
return $values;
Modified: trunk/property/inc/class.uiproject.inc.php
===================================================================
--- trunk/property/inc/class.uiproject.inc.php 2013-01-24 14:44:35 UTC (rev
10712)
+++ trunk/property/inc/class.uiproject.inc.php 2013-01-24 20:54:40 UTC (rev
10713)
@@ -2278,6 +2278,52 @@
$list =
$this->bo->bulk_update_status($start_date, $end_date, $status_filter,
$status_new, $execute, $type,
$user_id,$ids,$paid,$closed_orders,$ecodimb,$transfer_budget);
}
+ foreach ($list as &$entry)
+ {
+ $_obligation = '';
+ $entry['new_budget'] = '';
+
+ if($entry['project_type_id'] != 3)
+ {
+ $_obligation = 0;
+
+ if(!$entry['closed'] && $type ==
'project')
+ {
+ $_budget_arr =
$this->bo->get_budget($entry['id']);
+ foreach($_budget_arr as
$_budget_entry)
+ {
+
if($_budget_entry['active'])
+ {
+ $_obligation +=
$_budget_entry['sum_oblications'];
+ }
+ }
+
+ $_obligation =
round($_obligation);
+
+ $entry['new_budget'] = "<input
type='text' name='values[new_budget][{$entry['id']}]' value='{$_obligation}'
title=''>";
+ }
+
+ if(!$entry['closed'] && $type ==
'workorder')
+ {
+ $_budget_arr =
execMethod('property.soworkorder.get_budget', $entry['id']);
+ foreach($_budget_arr as
$_budget_entry)
+ {
+
if($_budget_entry['active'])
+ {
+ $_obligation +=
$_budget_entry['sum_oblications'];
+ }
+ }
+
+ $_obligation =
round($_obligation);
+
+ $entry['new_budget'] = "<input
type='text' name='values[new_budget][{$entry['id']}]' value='{$_obligation}'
title=''>";
+ }
+
+
+ }
+ $entry['obligation'] = $_obligation;
+ }
+
$total_records = count($list);
$datavalues[0] = array
(
@@ -2303,6 +2349,8 @@
array('key' =>
'num_open','label'=>lang('open'),'sortable'=>true,'resizeable'=>true
,'formatter'=>'FormatterRight'),
array('key' =>
'project_type','label'=>lang('project
type'),'sortable'=>false,'resizeable'=>true),
array('key' =>
'budget','label'=>lang('budget'),'sortable'=>false,'resizeable'=>true),
+
array('key' =>
'obligation','label'=>lang('obligation'),'sortable'=>false,'resizeable'=>true),
+
array('key' =>
'new_budget','label'=>lang('new'),'sortable'=>false,'resizeable'=>true),
array('key' => 'select','label'=>
lang('select'),
'sortable'=>false,'resizeable'=>false,'formatter'=>'myFormatterCheck','width'=>30)
))
);
@@ -2319,6 +2367,9 @@
array('key' =>
'status','label'=>lang('status'),'sortable'=>true,'resizeable'=>true),
array('key' =>
'project_type','label'=>lang('project
type'),'sortable'=>false,'resizeable'=>true),
array('key' =>
'budget','label'=>lang('budget'),'sortable'=>false,'resizeable'=>true),
+
array('key' =>
'obligation','label'=>lang('obligation'),'sortable'=>false,'resizeable'=>true),
+
array('key' =>
'continuous','label'=>lang('continuous'),'sortable'=>false,'resizeable'=>true),
+
array('key' =>
'new_budget','label'=>lang('new'),'sortable'=>false,'resizeable'=>true),
array('key' =>
'actual_cost','label'=>lang('actual cost'),'sortable'=>true,'resizeable'=>true
,'formatter'=>'FormatterRight'),
array('key' => 'select','label'=>
lang('select'),
'sortable'=>false,'resizeable'=>false,'formatter'=>'myFormatterCheck','width'=>30)
))
Modified: trunk/property/setup/phpgw_no.lang
===================================================================
--- trunk/property/setup/phpgw_no.lang 2013-01-24 14:44:35 UTC (rev 10712)
+++ trunk/property/setup/phpgw_no.lang 2013-01-24 20:54:40 UTC (rev 10713)
@@ -1163,6 +1163,7 @@
num property no Num
number property no Nummer
obligations property no Regnskap
+obligation property no Forpliktet
of property no av
on behalf of assigned property no På vegne av tildelt
on behalf of assigned - vacation mode property no På vegne av
tildelt - feriemodus
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Fmsystem-commits] [10713] property: bulk update budget,
Sigurd Nes <=