fmsystem-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Fmsystem-commits] [16562]


From: nelson . guerra
Subject: [Fmsystem-commits] [16562]
Date: Sat, 8 Apr 2017 18:35:50 -0400 (EDT)

Revision: 16562
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=16562
Author:   nelson224
Date:     2017-04-08 18:35:50 -0400 (Sat, 08 Apr 2017)
Log Message:
-----------


Modified Paths:
--------------
    branches/dev-syncromind-2/property/inc/class.soreport.inc.php

Modified: branches/dev-syncromind-2/property/inc/class.soreport.inc.php
===================================================================
--- branches/dev-syncromind-2/property/inc/class.soreport.inc.php       
2017-04-08 22:30:54 UTC (rev 16561)
+++ branches/dev-syncromind-2/property/inc/class.soreport.inc.php       
2017-04-08 22:35:50 UTC (rev 16562)
@@ -194,26 +194,41 @@
                {
                        $id = (int)$id;
                        
-                       $values = $this->read_single($id);
-                       $dataset = 
$this->read_single_dataset($values['dataset_id']);
+                       $definition = $this->read_single($id);
+                       $dataset = 
$this->read_single_dataset($definition['dataset_id']);
                        
-                       $definition = json_decode($values['report_definition'], 
true);
+                       $jsonB = json_decode($definition['report_definition'], 
true);
                        
-                       $columns = implode(',', $definition['group']);
+                       $columns = implode(',', $jsonB['group']);
                        $agregates = array();
-                       foreach ($definition['aggregate'] as $c => $v)
+                       foreach ($jsonB['aggregate'] as $c => $v)
                        {
-                               $agregates[] = 
$definition['cbo_aggregate'][$v]."(".$v.") AS 
".$definition['txt_aggregate'][$v];
+                               $agregates[] = 
$jsonB['cbo_aggregate'][$v]."(".$v.") AS ".$jsonB['txt_aggregate'][$v];
                        }
                        $func_agregates = implode(',', $agregates);
-                       if (count($definition['order']))
+                       if (count($jsonB['order']))
                        {
-                               $order = implode(',', $definition['order']);
+                               $order = implode(',', $jsonB['order']);
                        }
                        
                        $sql = "SELECT ".$columns.",".$func_agregates." FROM 
".$dataset['view_name']." GROUP BY ".$columns;
                        
-                       return $sql;
+                       $this->db->query($sql, __LINE__, __FILE__);
+
+                       $resultado = array_merge(array_values($jsonB['group']), 
array_values($jsonB['txt_aggregate']));
+                       
+                       $values = array();
+                       while ($this->db->next_record())
+                       {
+                               $value = array();
+                               foreach ($resultado as $column)
+                               {
+                                       $value[$column] = $this->db->f($column);
+                               }
+                               $values[] = $value;
+                       }
+                       
+                       return $values;
                }
                
                function read_single_dataset ( $id, $values = array() )




reply via email to

[Prev in Thread] Current Thread [Next in Thread]