@@ -224,37 +224,37 @@ |
||
| 224 | 224 | /** |
| 225 | 225 | * |
| 226 | 226 | */ |
| 227 | - public function getGasesDistributionAction() |
|
| 228 | - { |
|
| 229 | - $params = $this->params()->fromRoute(); |
|
| 227 | + public function getGasesDistributionAction() |
|
| 228 | + { |
|
| 229 | + $params = $this->params()->fromRoute(); |
|
| 230 | 230 | |
| 231 | - $ano = (int)$params['ano']; |
|
| 231 | + $ano = (int)$params['ano']; |
|
| 232 | 232 | |
| 233 | - $response = []; |
|
| 233 | + $response = []; |
|
| 234 | 234 | |
| 235 | - $sql = 'SELECT e.gas_id, g.nombre, g.color, sum(e.valor) as total |
|
| 235 | + $sql = 'SELECT e.gas_id, g.nombre, g.color, sum(e.valor) as total |
|
| 236 | 236 | FROM emision e |
| 237 | 237 | LEFT JOIN gas g ON (e.gas_id = g.id) |
| 238 | 238 | where e.ano = ? GROUP BY e.gas_id ORDER BY total DESC'; |
| 239 | 239 | |
| 240 | - $parameters = [ |
|
| 240 | + $parameters = [ |
|
| 241 | 241 | $ano, |
| 242 | 242 | ]; |
| 243 | 243 | |
| 244 | - $statement = $this->db->createStatement($sql, $parameters); |
|
| 244 | + $statement = $this->db->createStatement($sql, $parameters); |
|
| 245 | 245 | |
| 246 | - $results = $statement->execute(); |
|
| 246 | + $results = $statement->execute(); |
|
| 247 | 247 | |
| 248 | - $response['gases'][] = 'x'; |
|
| 249 | - $response['valores'][] = 'Gases'; |
|
| 248 | + $response['gases'][] = 'x'; |
|
| 249 | + $response['valores'][] = 'Gases'; |
|
| 250 | 250 | |
| 251 | - while ($a = $results->next()) { |
|
| 252 | - $response['gases'][] = (strpos($a['nombre'], ',')) ? '"'.$a['nombre'].'"' : $a['nombre']; |
|
| 253 | - $response['valores'][] = round($a['total']); |
|
| 254 | - $response['colores'][] = $a['color']; |
|
| 255 | - } |
|
| 256 | - return new JsonModel($response); |
|
| 257 | - } |
|
| 251 | + while ($a = $results->next()) { |
|
| 252 | + $response['gases'][] = (strpos($a['nombre'], ',')) ? '"'.$a['nombre'].'"' : $a['nombre']; |
|
| 253 | + $response['valores'][] = round($a['total']); |
|
| 254 | + $response['colores'][] = $a['color']; |
|
| 255 | + } |
|
| 256 | + return new JsonModel($response); |
|
| 257 | + } |
|
| 258 | 258 | |
| 259 | 259 | public function getSectoralGasesDistributionAction() |
| 260 | 260 | { |
@@ -113,7 +113,7 @@ |
||
| 113 | 113 | 'factories' => [ |
| 114 | 114 | Controller\DistributionReportController::class => Factory\DistributionReportControllerFactory::class, |
| 115 | 115 | Controller\EvolutionReportController::class => Factory\EvolutionReportControllerFactory::class, |
| 116 | - Controller\IndicatorsReportController::class => Factory\IndicatorsReportControllerFactory::class, |
|
| 116 | + Controller\IndicatorsReportController::class => Factory\IndicatorsReportControllerFactory::class, |
|
| 117 | 117 | ], |
| 118 | 118 | ], |
| 119 | 119 | 'view_manager' => [ |
@@ -24,4 +24,4 @@ |
||
| 24 | 24 | ], |
| 25 | 25 | ], |
| 26 | 26 | ]; |
| 27 | - |
|
| 28 | 27 | \ No newline at end of file |
| 28 | + |
|
| 29 | 29 | \ No newline at end of file |