[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Fmsystem-commits] [11157] property: refactor summation on condition sur
From: |
Sigurd Nes |
Subject: |
[Fmsystem-commits] [11157] property: refactor summation on condition survey |
Date: |
Fri, 07 Jun 2013 09:23:08 +0000 |
Revision: 11157
http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=11157
Author: sigurdne
Date: 2013-06-07 09:23:07 +0000 (Fri, 07 Jun 2013)
Log Message:
-----------
property: refactor summation on condition survey
Modified Paths:
--------------
trunk/property/inc/class.bocondition_survey.inc.php
trunk/property/inc/class.socondition_survey.inc.php
Modified: trunk/property/inc/class.bocondition_survey.inc.php
===================================================================
--- trunk/property/inc/class.bocondition_survey.inc.php 2013-06-07 08:33:54 UTC
(rev 11156)
+++ trunk/property/inc/class.bocondition_survey.inc.php 2013-06-07 09:23:07 UTC
(rev 11157)
@@ -318,10 +318,10 @@
$i=0;
foreach ($data as $entry)
{
- $i = $entry['building_part'] . '_' .
$entry['cat_id'];
+ $i = $entry['building_part'] . '_' .
$entry['category'];
$values[$i]['building_part'] =
$entry['building_part'];
- $values[$i]['category'] =
$this->get_category_name($entry['cat_id']);
+ $values[$i]['category'] = $entry['category'];
$diff = $entry['year'] - date('Y');
if($diff < 0)
Modified: trunk/property/inc/class.socondition_survey.inc.php
===================================================================
--- trunk/property/inc/class.socondition_survey.inc.php 2013-06-07 08:33:54 UTC
(rev 11156)
+++ trunk/property/inc/class.socondition_survey.inc.php 2013-06-07 09:23:07 UTC
(rev 11157)
@@ -495,12 +495,12 @@
$table = 'fm_request';
$condition_survey_id = (int)$id;
- $sql = "SELECT category as cat_id,
left(building_part,1) as building_part_,"
+ $sql = "SELECT left(building_part,1) as building_part_,"
. " sum(amount_investment) as investment
,sum(amount_operation) as operation,"
. " recommended_year as year"
." FROM {$table}"
." WHERE condition_survey_id={$condition_survey_id}"
- ." GROUP BY building_part_ ,category, year ORDER BY
building_part_";
+ ." GROUP BY building_part_ , year ORDER BY
building_part_";
$this->_db->query($sql,__LINE__,__FILE__);
@@ -512,13 +512,41 @@
$values[] = array
(
'building_part' =>
$this->_db->f('building_part_'),
- 'amount' =>
$amount,
+ 'amount_investment' =>
$this->_db->f('investment'),
+ 'amount_operation' =>
$this->_db->f('operation'),
'year' =>
$this->_db->f('year'),
- 'cat_id' =>
$this->_db->f('cat_id'),
);
}
- return $values;
+ $lang_operation = lang('operation');
+ $lang_investment = lang('investment');
+
+ $return = array();
+ foreach ($values as $entry)
+ {
+ if ($entry['amount_investment'])
+ {
+ $return[] = array
+ (
+ 'building_part' =>
$entry['building_part'],
+ 'amount' =>
$entry['amount_investment'],
+ 'year' =>
$entry['year'],
+ 'category' =>
$lang_investment,
+ );
+ }
+ if ($entry['amount_operation'])
+ {
+ $return[] = array
+ (
+ 'building_part' =>
$entry['building_part'],
+ 'amount' =>
$entry['amount_operation'],
+ 'year' =>
$entry['year'],
+ 'category' =>
$lang_operation,
+ );
+ }
+ }
+
+ return $return;
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Fmsystem-commits] [11157] property: refactor summation on condition survey,
Sigurd Nes <=