fmsystem-commits
[Top][All Lists]
Advanced

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

[Fmsystem-commits] [16559]


From: nelson . guerra
Subject: [Fmsystem-commits] [16559]
Date: Sat, 8 Apr 2017 00:22:42 -0400 (EDT)

Revision: 16559
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=16559
Author:   nelson224
Date:     2017-04-08 00:22:42 -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 04:22:28 UTC (rev 16558)
+++ branches/dev-syncromind-2/property/inc/class.soreport.inc.php       
2017-04-08 04:22:42 UTC (rev 16559)
@@ -190,6 +190,32 @@
                        return $values;
                }
                
+               function read_to_export ( $id )
+               {
+                       $id = (int)$id;
+                       
+                       $values = $this->read_single($id);
+                       $dataset = 
$this->read_single_dataset($values['dataset_id']);
+                       
+                       $definition = json_decode($values['report_definition'], 
true);
+                       
+                       $columns = implode(',', $definition['group']);
+                       $agregates = array();
+                       foreach ($definition['aggregate'] as $c => $v)
+                       {
+                               $agregates[] = 
$definition['cbo_aggregate'][$v]."(".$v.") AS 
".$definition['txt_aggregate'][$v];
+                       }
+                       $func_agregates = implode(',', $agregates);
+                       if (count($definition['order']))
+                       {
+                               $order = implode(',', $definition['order']);
+                       }
+                       
+                       $sql = "SELECT ".$columns.",".$func_agregates." FROM 
".$dataset['view_name']." GROUP BY ".$columns;
+                       
+                       return $sql;
+               }
+               
                function read_single_dataset ( $id, $values = array() )
                {
                        $id = (int)$id;




reply via email to

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