[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Fmsystem-commits] [10583] property: More on condition survey
From: |
Sigurd Nes |
Subject: |
[Fmsystem-commits] [10583] property: More on condition survey |
Date: |
Mon, 10 Dec 2012 19:31:09 +0000 |
Revision: 10583
http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=10583
Author: sigurdne
Date: 2012-12-10 19:31:08 +0000 (Mon, 10 Dec 2012)
Log Message:
-----------
property: More on condition survey
Modified Paths:
--------------
trunk/phpgwapi/js/yahoo/common.js
trunk/phpgwapi/js/yahoo/datatable.js
trunk/property/inc/class.bocondition_survey.inc.php
trunk/property/inc/class.socondition_survey.inc.php
trunk/property/inc/class.uicondition_survey.inc.php
Modified: trunk/phpgwapi/js/yahoo/common.js
===================================================================
--- trunk/phpgwapi/js/yahoo/common.js 2012-12-10 14:28:47 UTC (rev 10582)
+++ trunk/phpgwapi/js/yahoo/common.js 2012-12-10 19:31:08 UTC (rev 10583)
@@ -15,6 +15,16 @@
return config;
};
+/*
+
+ YAHOO.portico.FormatterAmount0 = function(elCell, oRecord, oColumn,
oData)
+ {
+alert('hei');
+// var amount = YAHOO.util.Number.format(oData, {decimalPlaces:0,
decimalSeparator:",", thousandsSeparator:" "});
+ elCell.innerHTML = "<div align=\"right\">ee"+amount+"</div>";
+ }
+*/
+
/** Hook widgets to translations **/
YAHOO.portico.js_alias_method_chain(YAHOO.widget.Calendar, 'init', 'i18n',
function(id, container, config) {
YAHOO.portico.lang('Calendar', config);
Modified: trunk/phpgwapi/js/yahoo/datatable.js
===================================================================
--- trunk/phpgwapi/js/yahoo/datatable.js 2012-12-10 14:28:47 UTC (rev
10582)
+++ trunk/phpgwapi/js/yahoo/datatable.js 2012-12-10 19:31:08 UTC (rev
10583)
@@ -102,6 +102,13 @@
/* Inline editor from 'rental'*/
+ var highlightEditableCell = function(oArgs) {
+ var elCell = oArgs.target;
+ if(YAHOO.util.Dom.hasClass(elCell, "yui-dt-editable")) {
+ myDataTable.highlightCell(elCell);
+ }
+ };
+
myDataTable.editor_action = YAHOO.portico.editor_action;
// Handle mouseover and click events for inline editing
@@ -338,7 +345,10 @@
}
- myDataTable.subscribe("rowMouseoverEvent",
myDataTable.onEventHighlightRow);
+ if(!myDataTable.editor_action)
+ {
+ myDataTable.subscribe("rowMouseoverEvent",
myDataTable.onEventHighlightRow);
+ }
myDataTable.subscribe("rowMouseoutEvent",
myDataTable.onEventUnhighlightRow);
@@ -536,12 +546,6 @@
};
- var highlightEditableCell = function(oArgs) {
- var elCell = oArgs.target;
- if(YAHOO.util.Dom.hasClass(elCell, "yui-dt-editable")) {
- myDataTable.highlightCell(elCell);
- }
- };
Modified: trunk/property/inc/class.bocondition_survey.inc.php
===================================================================
--- trunk/property/inc/class.bocondition_survey.inc.php 2012-12-10 14:28:47 UTC
(rev 10582)
+++ trunk/property/inc/class.bocondition_survey.inc.php 2012-12-10 19:31:08 UTC
(rev 10583)
@@ -309,23 +309,56 @@
$data = $this->so->get_summation($id);
$values =array();
+ $i=0;
foreach ($data as $entry)
{
-
$values[$entry['building_part']][$entry['cat_id']][$entry['year']] +=
$entry['amount'];
+ $i = $entry['building_part'];
+
+ $values[$i]['building_part'] =
$entry['building_part'];
+ $values[$i]['category'] =
$this->get_category_name($entry['cat_id']);
+
+ $diff = $entry['year'] - date('Y');
+ if($diff < 0)
+ {
+ $period = 1;
+ }
+ else
+ {
+ $period = ceil($diff/5) +1;
+ $period = $period < 6 ? $period : 6;
+ }
+
+ for ($j = 1; $j < 7 ; $j++ )
+ {
+ if($j == $period)
+ {
+ $values[$i]["period_{$j}"] +=
$entry['amount'];
+ $values[$i]['sum'] +=
$entry['amount'];
+ }
+ else
+ {
+ $values[$i]["period_{$j}"] +=
0;
+ }
+ }
- // $entry['category'] =
$this->get_category_name($entry['cat_id']);
+ $i++;
}
-_debug_array($values);
+//_debug_array($values);
return $values;
}
function get_category_name($cat_id)
{
- $category = $this->cats->return_single($cat_id);
- return $category[0]['name'];
+ static $category_name = array();
+
+ if(!isset($category_name[$cat_id]))
+ {
+ $category = $this->cats->return_single($cat_id);
+ $category_name[$cat_id] = $category[0]['name'];
+ }
+ return $category_name[$cat_id];
}
-
public function delete($id)
{
try
Modified: trunk/property/inc/class.socondition_survey.inc.php
===================================================================
--- trunk/property/inc/class.socondition_survey.inc.php 2012-12-10 14:28:47 UTC
(rev 10582)
+++ trunk/property/inc/class.socondition_survey.inc.php 2012-12-10 19:31:08 UTC
(rev 10583)
@@ -308,7 +308,13 @@
//_debug_array($survey);
$this->_db->transaction_begin();
-
+/*
+ kategorier:
+ 13 => D - Drift
+ 202 => Kombinasjon
+ 14 => U - Investering
+ 12 => V - Planlagt
+*/
foreach ($import_data as $entry)
{
if( ctype_digit($entry['condition_degree']) &&
$entry['condition_degree'] > 0 && strlen($entry['building_part']) > 2)
@@ -354,7 +360,10 @@
$table = 'fm_request';
$condition_survey_id = (int)$id;
- $sql = "SELECT category as cat_id,
building_part,fm_request_planning.amount, fm_request_planning.date FROM
{$table} {$this->_join} fm_request_planning ON fm_request_planning.request_id =
{$table}.id WHERE condition_survey_id={$condition_survey_id}";
+ $sql = "SELECT category as cat_id,
left(building_part,1) as building_part_, sum(fm_request_planning.amount) as
amount , EXTRACT(YEAR from to_timestamp(fm_request_planning.date) ) as year"
+ ." FROM {$table} {$this->_join} fm_request_planning ON
fm_request_planning.request_id = {$table}.id"
+ ." WHERE condition_survey_id={$condition_survey_id}"
+ ." GROUP BY building_part_ ,category, year ORDER BY
building_part_";
$this->_db->query($sql,__LINE__,__FILE__);
@@ -363,9 +372,9 @@
{
$values[] = array
(
- 'building_part' =>
$this->_db->f('building_part'),
+ 'building_part' =>
$this->_db->f('building_part_'),
'amount' =>
$this->_db->f('amount'),
- 'year' =>
date('Y', $this->_db->f('date')),
+ 'year' =>
$this->_db->f('year'),//date('Y', $this->_db->f('date')),
'cat_id' =>
$this->_db->f('cat_id'),
);
}
Modified: trunk/property/inc/class.uicondition_survey.inc.php
===================================================================
--- trunk/property/inc/class.uicondition_survey.inc.php 2012-12-10 14:28:47 UTC
(rev 10582)
+++ trunk/property/inc/class.uicondition_survey.inc.php 2012-12-10 19:31:08 UTC
(rev 10583)
@@ -385,13 +385,13 @@
(
array('key' =>
'building_part','label'=>lang('building
part'),'sortable'=>false,'resizeable'=>true),
array('key' =>
'category','label'=>lang('category'),'sortable'=>true,'resizeable'=>true),
- array('key' => 'period_1','label'=>lang('year')
. ':: < 1' ,'sortable'=>false,'resizeable'=>true),
- array('key' => 'period_1','label'=>lang('year')
. ':: 1 - 5' ,'sortable'=>false,'resizeable'=>true),
- array('key' => 'period_1','label'=>lang('year')
. ':: 6 - 10' ,'sortable'=>false,'resizeable'=>true),
- array('key' => 'period_1','label'=>lang('year')
. ':: 11 - 15' ,'sortable'=>false,'resizeable'=>true),
- array('key' => 'period_1','label'=>lang('year')
. ':: 16 - 20' ,'sortable'=>false,'resizeable'=>true),
- array('key' => 'period_1','label'=>lang('year')
. ':: 21 +' ,'sortable'=>false,'resizeable'=>true),
- array('key' =>
'sum','label'=>lang('sum'),'sortable'=>false,'resizeable'=>true),
+ array('key' => 'period_1','label'=>lang('year')
. ':: < 1'
,'sortable'=>false,'resizeable'=>true,'formatter'=>'YAHOO.portico.formatLink'),
+ array('key' => 'period_2','label'=>lang('year')
. ':: 1 - 5'
,'sortable'=>false,'resizeable'=>true,'formatter'=>'YAHOO.portico.FormatterAmount0'),
+ array('key' => 'period_3','label'=>lang('year')
. ':: 6 - 10'
,'sortable'=>false,'resizeable'=>true,'formatter'=>'YAHOO.portico.FormatterAmount0'),
+ array('key' => 'period_4','label'=>lang('year')
. ':: 11 - 15'
,'sortable'=>false,'resizeable'=>true,'formatter'=>'YAHOO.portico.FormatterAmount0'),
+ array('key' => 'period_5','label'=>lang('year')
. ':: 16 - 20'
,'sortable'=>false,'resizeable'=>true,'formatter'=>'YAHOO.portico.FormatterAmount0'),
+ array('key' => 'period_6','label'=>lang('year')
. ':: 21 +'
,'sortable'=>false,'resizeable'=>true,'formatter'=>'YAHOO.portico.FormatterAmount0'),
+ array('key' =>
'sum','label'=>lang('sum'),'sortable'=>false,'resizeable'=>true,'formatter'=>'YAHOO.portico.FormatterAmount0'),
);
$datatable_def[] = array
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Fmsystem-commits] [10583] property: More on condition survey,
Sigurd Nes <=