[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Fmsystem-commits] [10656] Property: update accounting reporting
From: |
Sigurd Nes |
Subject: |
[Fmsystem-commits] [10656] Property: update accounting reporting |
Date: |
Wed, 09 Jan 2013 20:53:19 +0000 |
Revision: 10656
http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=10656
Author: sigurdne
Date: 2013-01-09 20:53:17 +0000 (Wed, 09 Jan 2013)
Log Message:
-----------
Property: update accounting reporting
Modified Paths:
--------------
trunk/property/inc/class.boproject.inc.php
trunk/property/inc/class.soproject.inc.php
trunk/property/inc/class.uiproject.inc.php
trunk/property/js/yahoo/project.index.js
Modified: trunk/property/inc/class.boproject.inc.php
===================================================================
--- trunk/property/inc/class.boproject.inc.php 2013-01-09 12:14:51 UTC (rev
10655)
+++ trunk/property/inc/class.boproject.inc.php 2013-01-09 20:53:17 UTC (rev
10656)
@@ -38,6 +38,7 @@
var $start;
var $query;
var $filter;
+ var $filter_year;
var $sort;
var $order;
var $cat_id;
@@ -73,6 +74,7 @@
$sort =
phpgw::get_var('sort');
$order =
phpgw::get_var('order');
$filter =
phpgw::get_var('filter', 'int');
+ $filter_year =
phpgw::get_var('filter_year', 'string', 'REQUEST', 'all');
$cat_id =
phpgw::get_var('cat_id', 'int');
$status_id =
phpgw::get_var('status_id');
$user_id =
phpgw::get_var('user_id', 'int');
@@ -101,6 +103,10 @@
{
$this->filter = $filter;
}
+ if(isset($_POST['filter_year']) ||
isset($_GET['filter_year']))
+ {
+ $this->filter_year = $filter_year;
+ }
if(isset($_POST['cat_id']) || isset($_GET['cat_id']))
{
$this->cat_id = $cat_id;
@@ -447,7 +453,7 @@
'filter' => $this->filter,'cat_id' =>
$this->cat_id,'status_id' => $this->status_id,'wo_hour_cat_id' =>
$this->wo_hour_cat_id,
'start_date'=>$start_date,'end_date'=>$end_date,'allrows'=>isset($data['allrows'])
? $data['allrows'] : '','dry_run' => $data['dry_run'],
'district_id' => $this->district_id, 'criteria'
=> $this->get_criteria($this->criteria_id),
- 'project_type_id' =>
$this->project_type_id));
+ 'project_type_id' =>
$this->project_type_id, 'filter_year' => $this->filter_year));
$this->total_records = $this->so->total_records;
@@ -906,4 +912,9 @@
{
return $this->so->get_periodizations_with_outline();
}
+ public function get_filter_year_list($selected)
+ {
+ $values = $this->so->get_filter_year_list();
+ return $this->bocommon->select_list($selected, $values);
+ }
}
Modified: trunk/property/inc/class.soproject.inc.php
===================================================================
--- trunk/property/inc/class.soproject.inc.php 2013-01-09 12:14:51 UTC (rev
10655)
+++ trunk/property/inc/class.soproject.inc.php 2013-01-09 20:53:17 UTC (rev
10656)
@@ -121,6 +121,7 @@
$dry_run = isset($data['dry_run']) ?
$data['dry_run'] : '';
$criteria = isset($data['criteria']) &&
$data['criteria'] ? $data['criteria'] : array();
$project_type_id = $data['project_type_id'] ?
(int)$data['project_type_id']:0;
+ $filter_year = isset($data['filter_year']) ?
$data['filter_year'] : '';
$sql = $this->bocommon->fm_cache('sql_project_' .
!!$wo_hour_cat_id);
@@ -689,13 +690,36 @@
. " GROUP BY fm_workorder.id, budget,
combined_cost, billable_hours, closed";
*/
- $sql_workder = 'SELECT
fm_workorder.id, budget, combined_cost, billable_hours, closed, actual_cost,
pending_cost'//, contract_sum, addition, calculation, budget'
- . " FROM fm_workorder"
- . " {$this->join} fm_workorder_status
ON fm_workorder.status = fm_workorder_status.id"
- . " {$this->left_join}
fm_orders_pending_cost_view ON fm_workorder.id =
fm_orders_pending_cost_view.order_id"
- . " WHERE project_id =
'{$project['project_id']}' {$sql_workder_date_filter}";
+
+ if ($filter_year && $filter_year !=
'all')
+ {
+ $_year_arr = array();
+ for ($i=1;$i<14;$i++)
+ {
+ $_year_arr[] =
sprintf("%04s%02s", $filter_year, $i);
+ }
+
+ $sql_filter_period = 'AND
periode IN (' . implode(',', $_year_arr) . ')';
+
+ $sql_workder = 'SELECT
fm_workorder.id, budget, combined_cost, billable_hours, closed,
sum(fm_orders_paid_or_pending_view.amount) AS actual_cost'
+ . " FROM fm_workorder"
+ . " {$this->join}
fm_workorder_status ON fm_workorder.status = fm_workorder_status.id"
+ . " {$this->left_join}
fm_orders_paid_or_pending_view ON (fm_workorder.id =
fm_orders_paid_or_pending_view.order_id {$sql_filter_period})"
+ . " WHERE project_id =
'{$project['project_id']}' {$sql_workder_date_filter} "
+ . " GROUP BY fm_workorder.id,
budget, combined_cost, billable_hours, closed";
//_debug_array($sql_workder);
+ }
+ else
+ {
+ $sql_workder = 'SELECT
fm_workorder.id, budget, combined_cost, billable_hours, closed, actual_cost,
pending_cost'//, contract_sum, addition, calculation, budget'
+ . " FROM fm_workorder"
+ . " {$this->join}
fm_workorder_status ON fm_workorder.status = fm_workorder_status.id"
+ . " {$this->left_join}
fm_orders_pending_cost_view ON fm_workorder.id =
fm_orders_pending_cost_view.order_id"
+ . " WHERE project_id =
'{$project['project_id']}' {$sql_workder_date_filter}";
+ }
+//_debug_array($sql_workder);
+
$this->db->query($sql_workder,__LINE__,__FILE__);
$_obligation = 0;
@@ -708,7 +732,18 @@
if(!$this->db->f('closed'))
{
//$test[] = $this->db->f('id');
- $_obligation =
$_combined_cost - $_actual_cost;
+
+ if ($filter_year &&
$filter_year != 'all')
+ {
+ if($filter_year
== date('Y'))
+ {
+
$_obligation = $_combined_cost - $_actual_cost;
+ }
+ }
+ else
+ {
+ $_obligation =
$_combined_cost - $_actual_cost;
+ }
if((int)$this->db->f('budget') >= 0)
{
if($_obligation
< 0)
@@ -2760,4 +2795,31 @@
return $values;
}
+
+ public function get_filter_year_list()
+ {
+ $sql = 'SELECT min(start_date) AS start_date FROM
fm_project WHERE start_date <> 0';
+ $this->db->query($sql,__LINE__,__FILE__);
+ if($this->db->next_record())
+ {
+ $start_year =
date('Y',$this->db->f('start_date'));
+ }
+ else
+ {
+ $start_year = date('Y');
+ }
+ $end_year = date('Y') + 1;
+ $year_list = array();
+ for ($i=$start_year;$i< $end_year ;$i++)
+ {
+ $year_list[] = array
+ (
+ 'id' => $i,
+ 'name' => $i
+ );
+ }
+ $year_list = array_reverse($year_list);
+
+ return $year_list;
+ }
}
Modified: trunk/property/inc/class.uiproject.inc.php
===================================================================
--- trunk/property/inc/class.uiproject.inc.php 2013-01-09 12:14:51 UTC (rev
10655)
+++ trunk/property/inc/class.uiproject.inc.php 2013-01-09 20:53:17 UTC (rev
10656)
@@ -100,6 +100,7 @@
$this->user_id = $this->bo->user_id;
$this->criteria_id =
$this->bo->criteria_id;
$this->project_type_id = $this->bo->project_type_id;
+ $this->filter_year =
$this->bo->filter_year;
}
function save_sessiondata()
@@ -231,10 +232,11 @@
."cat_id:'{$this->cat_id}',"
."user_id:'{$this->user_id}',"
."criteria_id:'{$this->criteria_id}',"
-
."project_type_id:':{$this->project_type_id}',"
+
."project_type_id:'{$this->project_type_id}',"
."wo_hour_cat_id:'{$this->wo_hour_cat_id}',"
."second_display:1,"
- ."status_id:'{$this->status_id}'";
+ ."status_id:'{$this->status_id}',"
+ ."filter_year:'{$this->filter_year}'";
$datatable['config']['allow_allrows'] = false;
@@ -280,10 +282,13 @@
$default_value = array
('id'=>'','name'=>lang('no criteria'));
array_unshift
($values_combo_box[5],$default_value);
- $values_combo_box[6] =
$this->bo->get_user_list($this->filter);
- array_unshift
($values_combo_box[6],array('id'=>$GLOBALS['phpgw_info']['user']['account_id'],'name'=>lang('mine
projects')));
+ $values_combo_box[6] =
$this->bo->get_filter_year_list($this->filter_year);
+ array_unshift ($values_combo_box[6],array
('id'=>'all','name'=> lang('all') . ' ' . lang('year')));
+
+ $values_combo_box[7] =
$this->bo->get_user_list($this->filter);
+ array_unshift
($values_combo_box[7],array('id'=>$GLOBALS['phpgw_info']['user']['account_id'],'name'=>lang('mine
projects')));
$default_value = array
('id'=>'','name'=>lang('no user'));
- array_unshift
($values_combo_box[6],$default_value);
+ array_unshift
($values_combo_box[7],$default_value);
$datatable['actions']['form'] = array
@@ -297,7 +302,8 @@
'district_id'
=> $this->district_id,
'part_of_town_id' => $this->part_of_town_id,
'lookup'
=> $lookup,
- 'cat_id'
=> $this->cat_id
+ 'cat_id'
=> $this->cat_id,
+ 'filter_year'
=> $this->filter_year
)
),
'fields' => array
@@ -357,28 +363,27 @@
'type'
=> 'button',
'style'
=> 'filter',
'tab_index' => 6
- ),/*
+ ),
array
- ( //boton
USER
- 'id' =>
'btn_user_id',
- 'name'
=> 'user_id',
- 'value'
=> lang('User'),
+ ( //boton
filter_year
+ 'id' =>
'btn_filter_year',
+ 'name'
=> 'filter_year',
+ 'value'
=> lang('year'),
'type'
=> 'button',
'style'
=> 'filter',
-
'tab_index' => 6
- ),*/
- array
- (
//boton USER
-
// 'id' => 'btn_user_id',
-
'id' => 'sel_filter', // testing traditional listbox for long list
-
'name' => 'filter',
-
'value' => lang('User'),
-
'type' => 'select',
-
'style' => 'filter',
-
'values' => $values_combo_box[6],
-
'onchange'=> 'onChangeSelect("filter");',
-
'tab_index' => 7
- ),
+
'tab_index' => 7
+ ),
+ array
+ (
+ 'id' =>
'sel_filter',
+ 'name'
=> 'filter',
+ 'value'
=> lang('User'),
+ 'type'
=> 'select',
+ 'style'
=> 'filter',
+
'values' => $values_combo_box[7],
+
'onchange'=> 'onChangeSelect("filter");',
+
'tab_index' => 8
+ ),
//for link
"columns", next to Export button
array
(
@@ -390,21 +395,21 @@
'menuaction' => 'property.uiproject.columns'
))."','','width=300,height=600,scrollbars=1')",
'value'
=> lang('columns'),
-
'tab_index' => 13
+
'tab_index' => 14
),
array
(
'type'
=> 'button',
'id'
=> 'btn_export',
'value'
=> lang('download'),
-
'tab_index' => 12
+
'tab_index' => 13
),
array
(
'type'
=> 'button',
'id'
=> 'btn_new',
'value'
=> lang('add'),
-
'tab_index' => 11
+
'tab_index' => 12
),
array
( //hidden
start_date
@@ -432,7 +437,7 @@
'menuaction' => 'property.uiproject.date_search')
)."','','width=350,height=250')",
'value'
=> lang('Date search'),
-
'tab_index' => 10
+
'tab_index' => 11
),
// FIXME test
on lightbox for date search
/*
@@ -451,7 +456,7 @@
'name'
=> 'search',
'value'
=> lang('search'),
'type'
=> 'button',
-
'tab_index' => 9
+
'tab_index' => 10
),
array
( // TEXT INPUT
@@ -461,7 +466,7 @@
'type'
=> 'text',
'onkeypress' => 'return pulsar(event)',
'size'
=> 28,
-
'tab_index' => 8
+
'tab_index' => 9
),
),
'hidden_value' => array
@@ -495,12 +500,12 @@
( //div values
combo_box_5
'id' =>
'values_combo_box_5',
'value'
=> $this->bocommon->select2String($values_combo_box[5])
- )/*,
+ ),
array
- ( //div values
combo_box_5
- 'id' =>
'values_combo_box_5',
- 'value'
=> $this->bocommon->select2String($values_combo_box[5])
- )*/
+ ( //div values
combo_box_6
+ 'id' =>
'values_combo_box_6',
+ 'value'
=> $this->bocommon->select2String($values_combo_box[6])
+ )
)
)
)
Modified: trunk/property/js/yahoo/project.index.js
===================================================================
--- trunk/property/js/yahoo/project.index.js 2013-01-09 12:14:51 UTC (rev
10655)
+++ trunk/property/js/yahoo/project.index.js 2013-01-09 20:53:17 UTC (rev
10656)
@@ -2,15 +2,15 @@
// Declaration of location.index vars
//--------------------------------------------------------
//define SelectButton
- var oMenuButton_0, oMenuButton_1, oMenuButton_2, oMenuButton_3,
oMenuButton_4, oMenuButton_5;
+ var oMenuButton_0, oMenuButton_1, oMenuButton_2, oMenuButton_3,
oMenuButton_4, oMenuButton_5, oMenuButton_6;
var selectsButtons = [
{order:0,
var_URL:'project_type_id',name:'btn_project_type',style:'districtbutton',dependiente:''},
{order:1,
var_URL:'district_id',name:'btn_district_id',style:'districtbutton',dependiente:''},
{order:2,
var_URL:'cat_id',name:'btn_cat_id',style:'categorybutton',dependiente:''},
{order:3,
var_URL:'status_id',name:'btn_status_id',style:'districtbutton',dependiente:''},
- {order:4,
var_URL:'wo_hour_cat_id',name:'btn_hour_category_id',style:'partOFTownbutton',dependiente:''},
-// {order:4, var_URL:'filter',
name:'btn_user_id',style:'ownerIdbutton',dependiente:''},
- {order:5, var_URL:'criteria_id',
name:'btn_criteria_id',style:'criteriabutton',dependiente:''}
+ {order:4,
var_URL:'wo_hour_cat_id',name:'btn_hour_category_id',style:'districtbutton',dependiente:''},
+ {order:5, var_URL:'criteria_id',
name:'btn_criteria_id',style:'criteriabutton',dependiente:''},
+ {order:6, var_URL:'filter_year',
name:'btn_filter_year',style:'districtbutton',dependiente:''}
];
// define buttons
@@ -124,14 +124,12 @@
oMenuButton_5.set("label", ("<em>" +
array_options[5][index][1] + "</em>"));
}
-/*
- //user
- index =
locate_in_array_options(4,"value",path_values.user_id);
+ //filter_year
+ index =
locate_in_array_options(6,"value",path_values.filter_year);
if(index)
{
- oMenuButton_4.set("label", ("<em>" +
array_options[4][index][1] + "</em>"));
+ oMenuButton_6.set("label", ("<em>" +
array_options[6][index][1] + "</em>"));
}
-*/
//focus initial
//--focus for txt_query---
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Fmsystem-commits] [10656] Property: update accounting reporting,
Sigurd Nes <=