@@ -13,50 +13,50 @@ |
||
| 13 | 13 | use Zend\Db\Adapter\AdapterAbstractServiceFactory; |
| 14 | 14 | |
| 15 | 15 | return [ |
| 16 | - 'router' => [ |
|
| 17 | - 'routes' => [ |
|
| 18 | - 'home' => [ |
|
| 19 | - 'type' => Literal::class, |
|
| 20 | - 'options' => [ |
|
| 21 | - 'route' => '/', |
|
| 22 | - 'defaults' => [ |
|
| 23 | - 'controller' => Controller\IndexController::class, |
|
| 24 | - 'action' => 'index', |
|
| 25 | - ], |
|
| 26 | - ], |
|
| 27 | - ], |
|
| 28 | - 'results' => [ |
|
| 29 | - 'type' => Segment::class, |
|
| 30 | - 'options' => [ |
|
| 31 | - 'route' => '/resultados', |
|
| 32 | - 'defaults' => [ |
|
| 33 | - 'controller' => Controller\ResultsController::class, |
|
| 34 | - 'action' => 'index', |
|
| 35 | - ], |
|
| 36 | - ], |
|
| 37 | - ], |
|
| 38 | - ], |
|
| 39 | - ], |
|
| 40 | - 'controllers' => [ |
|
| 41 | - 'factories' => [ |
|
| 42 | - Controller\IndexController::class => InvokableFactory::class, |
|
| 43 | - Controller\ResultsController::class => InvokableFactory::class, |
|
| 44 | - ], |
|
| 45 | - ], |
|
| 46 | - 'view_manager' => [ |
|
| 47 | - 'display_not_found_reason' => true, |
|
| 48 | - 'display_exceptions' => true, |
|
| 49 | - 'doctype' => 'HTML5', |
|
| 50 | - 'not_found_template' => 'error/404', |
|
| 51 | - 'exception_template' => 'error/index', |
|
| 52 | - 'template_map' => [ |
|
| 53 | - 'layout/layout' => __DIR__ . '/../view/layout/layout.phtml', |
|
| 54 | - 'application/index/index' => __DIR__ . '/../view/application/index/index.phtml', |
|
| 55 | - 'error/404' => __DIR__ . '/../view/error/404.phtml', |
|
| 56 | - 'error/index' => __DIR__ . '/../view/error/index.phtml', |
|
| 57 | - ], |
|
| 58 | - 'template_path_stack' => [ |
|
| 59 | - __DIR__ . '/../view', |
|
| 60 | - ], |
|
| 61 | - ], |
|
| 16 | + 'router' => [ |
|
| 17 | + 'routes' => [ |
|
| 18 | + 'home' => [ |
|
| 19 | + 'type' => Literal::class, |
|
| 20 | + 'options' => [ |
|
| 21 | + 'route' => '/', |
|
| 22 | + 'defaults' => [ |
|
| 23 | + 'controller' => Controller\IndexController::class, |
|
| 24 | + 'action' => 'index', |
|
| 25 | + ], |
|
| 26 | + ], |
|
| 27 | + ], |
|
| 28 | + 'results' => [ |
|
| 29 | + 'type' => Segment::class, |
|
| 30 | + 'options' => [ |
|
| 31 | + 'route' => '/resultados', |
|
| 32 | + 'defaults' => [ |
|
| 33 | + 'controller' => Controller\ResultsController::class, |
|
| 34 | + 'action' => 'index', |
|
| 35 | + ], |
|
| 36 | + ], |
|
| 37 | + ], |
|
| 38 | + ], |
|
| 39 | + ], |
|
| 40 | + 'controllers' => [ |
|
| 41 | + 'factories' => [ |
|
| 42 | + Controller\IndexController::class => InvokableFactory::class, |
|
| 43 | + Controller\ResultsController::class => InvokableFactory::class, |
|
| 44 | + ], |
|
| 45 | + ], |
|
| 46 | + 'view_manager' => [ |
|
| 47 | + 'display_not_found_reason' => true, |
|
| 48 | + 'display_exceptions' => true, |
|
| 49 | + 'doctype' => 'HTML5', |
|
| 50 | + 'not_found_template' => 'error/404', |
|
| 51 | + 'exception_template' => 'error/index', |
|
| 52 | + 'template_map' => [ |
|
| 53 | + 'layout/layout' => __DIR__ . '/../view/layout/layout.phtml', |
|
| 54 | + 'application/index/index' => __DIR__ . '/../view/application/index/index.phtml', |
|
| 55 | + 'error/404' => __DIR__ . '/../view/error/404.phtml', |
|
| 56 | + 'error/index' => __DIR__ . '/../view/error/index.phtml', |
|
| 57 | + ], |
|
| 58 | + 'template_path_stack' => [ |
|
| 59 | + __DIR__ . '/../view', |
|
| 60 | + ], |
|
| 61 | + ], |
|
| 62 | 62 | ]; |
@@ -50,13 +50,13 @@ |
||
| 50 | 50 | 'not_found_template' => 'error/404', |
| 51 | 51 | 'exception_template' => 'error/index', |
| 52 | 52 | 'template_map' => [ |
| 53 | - 'layout/layout' => __DIR__ . '/../view/layout/layout.phtml', |
|
| 54 | - 'application/index/index' => __DIR__ . '/../view/application/index/index.phtml', |
|
| 55 | - 'error/404' => __DIR__ . '/../view/error/404.phtml', |
|
| 56 | - 'error/index' => __DIR__ . '/../view/error/index.phtml', |
|
| 53 | + 'layout/layout' => __DIR__.'/../view/layout/layout.phtml', |
|
| 54 | + 'application/index/index' => __DIR__.'/../view/application/index/index.phtml', |
|
| 55 | + 'error/404' => __DIR__.'/../view/error/404.phtml', |
|
| 56 | + 'error/index' => __DIR__.'/../view/error/index.phtml', |
|
| 57 | 57 | ], |
| 58 | 58 | 'template_path_stack' => [ |
| 59 | - __DIR__ . '/../view', |
|
| 59 | + __DIR__.'/../view', |
|
| 60 | 60 | ], |
| 61 | 61 | ], |
| 62 | 62 | ]; |
@@ -13,41 +13,41 @@ |
||
| 13 | 13 | |
| 14 | 14 | class IndexControllerTest extends AbstractHttpControllerTestCase |
| 15 | 15 | { |
| 16 | - public function setUp() |
|
| 17 | - { |
|
| 18 | - // The module configuration should still be applicable for tests. |
|
| 19 | - // You can override configuration here with test case specific values, |
|
| 20 | - // such as sample view templates, path stacks, module_listener_options, |
|
| 21 | - // etc. |
|
| 22 | - $configOverrides = []; |
|
| 23 | - |
|
| 24 | - $this->setApplicationConfig(ArrayUtils::merge( |
|
| 25 | - include __DIR__ . '/../../../../config/application.config.php', |
|
| 26 | - $configOverrides |
|
| 27 | - )); |
|
| 28 | - |
|
| 29 | - parent::setUp(); |
|
| 30 | - } |
|
| 31 | - |
|
| 32 | - public function testIndexActionCanBeAccessed() |
|
| 33 | - { |
|
| 34 | - $this->dispatch('/', 'GET'); |
|
| 35 | - $this->assertResponseStatusCode(200); |
|
| 36 | - $this->assertModuleName('application'); |
|
| 37 | - $this->assertControllerName(IndexController::class); // as specified in router's controller name alias |
|
| 38 | - $this->assertControllerClass('IndexController'); |
|
| 39 | - $this->assertMatchedRouteName('home'); |
|
| 40 | - } |
|
| 41 | - |
|
| 42 | - public function testIndexActionViewModelTemplateRenderedWithinLayout() |
|
| 43 | - { |
|
| 44 | - $this->dispatch('/', 'GET'); |
|
| 45 | - $this->assertQuery('#home-content-wrapper'); |
|
| 46 | - } |
|
| 47 | - |
|
| 48 | - public function testInvalidRouteDoesNotCrash() |
|
| 49 | - { |
|
| 50 | - $this->dispatch('/invalid/route', 'GET'); |
|
| 51 | - $this->assertResponseStatusCode(404); |
|
| 52 | - } |
|
| 16 | + public function setUp() |
|
| 17 | + { |
|
| 18 | + // The module configuration should still be applicable for tests. |
|
| 19 | + // You can override configuration here with test case specific values, |
|
| 20 | + // such as sample view templates, path stacks, module_listener_options, |
|
| 21 | + // etc. |
|
| 22 | + $configOverrides = []; |
|
| 23 | + |
|
| 24 | + $this->setApplicationConfig(ArrayUtils::merge( |
|
| 25 | + include __DIR__ . '/../../../../config/application.config.php', |
|
| 26 | + $configOverrides |
|
| 27 | + )); |
|
| 28 | + |
|
| 29 | + parent::setUp(); |
|
| 30 | + } |
|
| 31 | + |
|
| 32 | + public function testIndexActionCanBeAccessed() |
|
| 33 | + { |
|
| 34 | + $this->dispatch('/', 'GET'); |
|
| 35 | + $this->assertResponseStatusCode(200); |
|
| 36 | + $this->assertModuleName('application'); |
|
| 37 | + $this->assertControllerName(IndexController::class); // as specified in router's controller name alias |
|
| 38 | + $this->assertControllerClass('IndexController'); |
|
| 39 | + $this->assertMatchedRouteName('home'); |
|
| 40 | + } |
|
| 41 | + |
|
| 42 | + public function testIndexActionViewModelTemplateRenderedWithinLayout() |
|
| 43 | + { |
|
| 44 | + $this->dispatch('/', 'GET'); |
|
| 45 | + $this->assertQuery('#home-content-wrapper'); |
|
| 46 | + } |
|
| 47 | + |
|
| 48 | + public function testInvalidRouteDoesNotCrash() |
|
| 49 | + { |
|
| 50 | + $this->dispatch('/invalid/route', 'GET'); |
|
| 51 | + $this->assertResponseStatusCode(404); |
|
| 52 | + } |
|
| 53 | 53 | } |
@@ -22,7 +22,7 @@ |
||
| 22 | 22 | $configOverrides = []; |
| 23 | 23 | |
| 24 | 24 | $this->setApplicationConfig(ArrayUtils::merge( |
| 25 | - include __DIR__ . '/../../../../config/application.config.php', |
|
| 25 | + include __DIR__.'/../../../../config/application.config.php', |
|
| 26 | 26 | $configOverrides |
| 27 | 27 | )); |
| 28 | 28 | |
@@ -12,74 +12,74 @@ |
||
| 12 | 12 | */ |
| 13 | 13 | class IndicatorsReportController extends AbstractRestfulController |
| 14 | 14 | { |
| 15 | - /** |
|
| 16 | - * |
|
| 17 | - */ |
|
| 18 | - private $db; |
|
| 15 | + /** |
|
| 16 | + * |
|
| 17 | + */ |
|
| 18 | + private $db; |
|
| 19 | 19 | |
| 20 | - public function __construct(AdapterInterface $db) |
|
| 21 | - { |
|
| 22 | - $this->db = $db; |
|
| 23 | - } |
|
| 20 | + public function __construct(AdapterInterface $db) |
|
| 21 | + { |
|
| 22 | + $this->db = $db; |
|
| 23 | + } |
|
| 24 | 24 | |
| 25 | - public function getIndicatorAction() |
|
| 26 | - { |
|
| 27 | - $params = $this->params()->fromRoute(); |
|
| 25 | + public function getIndicatorAction() |
|
| 26 | + { |
|
| 27 | + $params = $this->params()->fromRoute(); |
|
| 28 | 28 | |
| 29 | - $indicador_id = (int)$params['indicador_id']; |
|
| 29 | + $indicador_id = (int)$params['indicador_id']; |
|
| 30 | 30 | |
| 31 | - $response = []; |
|
| 31 | + $response = []; |
|
| 32 | 32 | |
| 33 | - // DATOS GENERALES DEL INDICADOR |
|
| 33 | + // DATOS GENERALES DEL INDICADOR |
|
| 34 | 34 | |
| 35 | - $sql = "SELECT * FROM indicador WHERE id = ?"; |
|
| 35 | + $sql = "SELECT * FROM indicador WHERE id = ?"; |
|
| 36 | 36 | |
| 37 | - $params = [ |
|
| 37 | + $params = [ |
|
| 38 | 38 | |
| 39 | - $indicador_id |
|
| 40 | - ]; |
|
| 39 | + $indicador_id |
|
| 40 | + ]; |
|
| 41 | 41 | |
| 42 | - $statement = $this->db->createStatement($sql, $params); |
|
| 43 | - $arrIndicador = $statement->execute(); |
|
| 42 | + $statement = $this->db->createStatement($sql, $params); |
|
| 43 | + $arrIndicador = $statement->execute(); |
|
| 44 | 44 | |
| 45 | - while ($indicador = $arrIndicador->next()) { |
|
| 46 | - $response['indicador'] = $indicador; |
|
| 47 | - break; |
|
| 48 | - } |
|
| 45 | + while ($indicador = $arrIndicador->next()) { |
|
| 46 | + $response['indicador'] = $indicador; |
|
| 47 | + break; |
|
| 48 | + } |
|
| 49 | 49 | |
| 50 | 50 | |
| 51 | - $sql = "SELECT * FROM indicador_valor |
|
| 51 | + $sql = "SELECT * FROM indicador_valor |
|
| 52 | 52 | WHERE indicador_id = ? |
| 53 | 53 | ORDER BY ano ASC"; |
| 54 | 54 | |
| 55 | - $params = [ |
|
| 55 | + $params = [ |
|
| 56 | 56 | |
| 57 | - $indicador_id |
|
| 58 | - ]; |
|
| 57 | + $indicador_id |
|
| 58 | + ]; |
|
| 59 | 59 | |
| 60 | - $statement = $this->db->createStatement($sql, $params); |
|
| 61 | - $arrValores = $statement->execute(); |
|
| 60 | + $statement = $this->db->createStatement($sql, $params); |
|
| 61 | + $arrValores = $statement->execute(); |
|
| 62 | 62 | |
| 63 | - $arrAnos = []; |
|
| 64 | - $arrValor = []; |
|
| 63 | + $arrAnos = []; |
|
| 64 | + $arrValor = []; |
|
| 65 | 65 | |
| 66 | - while ($a = $arrValores->next()) { |
|
| 67 | - // SI EL NOMBRE TIENE UNA COMA LO TENGO QUE PONER ENTRE COMILLAS |
|
| 68 | - $arrAnos[] = $a['ano']; |
|
| 69 | - $arrValor[] = $a['valor']; |
|
| 70 | - } |
|
| 66 | + while ($a = $arrValores->next()) { |
|
| 67 | + // SI EL NOMBRE TIENE UNA COMA LO TENGO QUE PONER ENTRE COMILLAS |
|
| 68 | + $arrAnos[] = $a['ano']; |
|
| 69 | + $arrValor[] = $a['valor']; |
|
| 70 | + } |
|
| 71 | 71 | |
| 72 | - $arrAnos = array_merge(array('x'), $arrAnos); |
|
| 73 | - $response['column_1'] = $arrAnos; |
|
| 72 | + $arrAnos = array_merge(array('x'), $arrAnos); |
|
| 73 | + $response['column_1'] = $arrAnos; |
|
| 74 | 74 | |
| 75 | - $arrValor = array_merge(array($indicador['nombre']), $arrValor); |
|
| 76 | - $response['column_2'] = $arrValor; |
|
| 75 | + $arrValor = array_merge(array($indicador['nombre']), $arrValor); |
|
| 76 | + $response['column_2'] = $arrValor; |
|
| 77 | 77 | |
| 78 | - $response['unidad'] = $indicador['unidad']; |
|
| 79 | - $response['descripcion'] = nl2br($indicador['descripcion']); |
|
| 78 | + $response['unidad'] = $indicador['unidad']; |
|
| 79 | + $response['descripcion'] = nl2br($indicador['descripcion']); |
|
| 80 | 80 | |
| 81 | - $response['colores'] = "#8064a2"; |
|
| 81 | + $response['colores'] = "#8064a2"; |
|
| 82 | 82 | |
| 83 | - return new JsonModel($response); |
|
| 84 | - } |
|
| 83 | + return new JsonModel($response); |
|
| 84 | + } |
|
| 85 | 85 | } |
@@ -26,7 +26,7 @@ |
||
| 26 | 26 | { |
| 27 | 27 | $params = $this->params()->fromRoute(); |
| 28 | 28 | |
| 29 | - $indicador_id = (int)$params['indicador_id']; |
|
| 29 | + $indicador_id = (int) $params['indicador_id']; |
|
| 30 | 30 | |
| 31 | 31 | $response = []; |
| 32 | 32 | |
@@ -12,73 +12,73 @@ discard block |
||
| 12 | 12 | */ |
| 13 | 13 | class DistributionReportController extends AbstractRestfulController |
| 14 | 14 | { |
| 15 | - /** |
|
| 16 | - * |
|
| 17 | - */ |
|
| 18 | - private $db; |
|
| 15 | + /** |
|
| 16 | + * |
|
| 17 | + */ |
|
| 18 | + private $db; |
|
| 19 | 19 | |
| 20 | - public function __construct(AdapterInterface $db) |
|
| 21 | - { |
|
| 22 | - $this->db = $db; |
|
| 23 | - } |
|
| 20 | + public function __construct(AdapterInterface $db) |
|
| 21 | + { |
|
| 22 | + $this->db = $db; |
|
| 23 | + } |
|
| 24 | 24 | |
| 25 | - /** |
|
| 26 | - * DISTRIBUCION DE TODOS LOS SECTORES |
|
| 27 | - */ |
|
| 28 | - public function getWholeSectoralDistributionAction() |
|
| 29 | - { |
|
| 30 | - $params = $this->params()->fromRoute(); |
|
| 25 | + /** |
|
| 26 | + * DISTRIBUCION DE TODOS LOS SECTORES |
|
| 27 | + */ |
|
| 28 | + public function getWholeSectoralDistributionAction() |
|
| 29 | + { |
|
| 30 | + $params = $this->params()->fromRoute(); |
|
| 31 | 31 | |
| 32 | - $ano = (int)$params['ano']; |
|
| 32 | + $ano = (int)$params['ano']; |
|
| 33 | 33 | |
| 34 | - $response = []; |
|
| 34 | + $response = []; |
|
| 35 | 35 | |
| 36 | - $sql = 'SELECT SUM(e.valor) as total, e.sector_id, s.nombre, s.color, s.descripcion |
|
| 36 | + $sql = 'SELECT SUM(e.valor) as total, e.sector_id, s.nombre, s.color, s.descripcion |
|
| 37 | 37 | FROM emision e |
| 38 | 38 | INNER JOIN sector s ON e.sector_id = s.id |
| 39 | 39 | WHERE e.ano = ? |
| 40 | 40 | GROUP BY e.sector_id'; |
| 41 | 41 | |
| 42 | - $parameters = [ |
|
| 43 | - $ano, |
|
| 44 | - ]; |
|
| 42 | + $parameters = [ |
|
| 43 | + $ano, |
|
| 44 | + ]; |
|
| 45 | 45 | |
| 46 | - $statement = $this->db->createStatement($sql, $parameters); |
|
| 46 | + $statement = $this->db->createStatement($sql, $parameters); |
|
| 47 | 47 | |
| 48 | - $results = $statement->execute(); |
|
| 48 | + $results = $statement->execute(); |
|
| 49 | 49 | |
| 50 | - if (!$results->isQueryResult()) { |
|
| 51 | - $this->response->setStatusCode(404); |
|
| 52 | - } |
|
| 50 | + if (!$results->isQueryResult()) { |
|
| 51 | + $this->response->setStatusCode(404); |
|
| 52 | + } |
|
| 53 | 53 | |
| 54 | - $i = 1; |
|
| 54 | + $i = 1; |
|
| 55 | 55 | |
| 56 | - while ($a = $results->next()) { |
|
| 57 | - $response['sector_'.$i][] = $a['nombre']; |
|
| 58 | - $response['sector_'.$i][] = $a['total']; |
|
| 59 | - $response['colores'][] = $a['color']; |
|
| 60 | - $response['descripciones'][] = $a['descripcion']; |
|
| 56 | + while ($a = $results->next()) { |
|
| 57 | + $response['sector_'.$i][] = $a['nombre']; |
|
| 58 | + $response['sector_'.$i][] = $a['total']; |
|
| 59 | + $response['colores'][] = $a['color']; |
|
| 60 | + $response['descripciones'][] = $a['descripcion']; |
|
| 61 | 61 | |
| 62 | - $i++; |
|
| 63 | - } |
|
| 62 | + $i++; |
|
| 63 | + } |
|
| 64 | 64 | |
| 65 | - return new JsonModel($response); |
|
| 66 | - } |
|
| 65 | + return new JsonModel($response); |
|
| 66 | + } |
|
| 67 | 67 | |
| 68 | - /** |
|
| 69 | - * DISTRIBUCION POR SECTOR |
|
| 70 | - */ |
|
| 71 | - public function getSectoralDistributionAction() |
|
| 72 | - { |
|
| 73 | - $params = $this->params()->fromRoute(); |
|
| 68 | + /** |
|
| 69 | + * DISTRIBUCION POR SECTOR |
|
| 70 | + */ |
|
| 71 | + public function getSectoralDistributionAction() |
|
| 72 | + { |
|
| 73 | + $params = $this->params()->fromRoute(); |
|
| 74 | 74 | |
| 75 | - $response = []; |
|
| 76 | - $arrGraphData = []; |
|
| 75 | + $response = []; |
|
| 76 | + $arrGraphData = []; |
|
| 77 | 77 | |
| 78 | - $ano = (int)$params['ano']; |
|
| 79 | - $sector_id = (int)$params['sector_id']; |
|
| 78 | + $ano = (int)$params['ano']; |
|
| 79 | + $sector_id = (int)$params['sector_id']; |
|
| 80 | 80 | |
| 81 | - $sql = 'SELECT SUM(e.valor) as total, a.id, a.nombre |
|
| 81 | + $sql = 'SELECT SUM(e.valor) as total, a.id, a.nombre |
|
| 82 | 82 | FROM emision e |
| 83 | 83 | INNER JOIN sector s ON e.sector_id = s.id |
| 84 | 84 | INNER JOIN actividad a ON a.id = e.actividad_id |
@@ -89,27 +89,27 @@ discard block |
||
| 89 | 89 | GROUP BY a.id |
| 90 | 90 | ORDER BY a.nombre'; |
| 91 | 91 | |
| 92 | - $parameters = [ |
|
| 93 | - $sector_id, |
|
| 94 | - $ano, |
|
| 95 | - ]; |
|
| 92 | + $parameters = [ |
|
| 93 | + $sector_id, |
|
| 94 | + $ano, |
|
| 95 | + ]; |
|
| 96 | 96 | |
| 97 | - $statement = $this->db->createStatement($sql, $parameters); |
|
| 97 | + $statement = $this->db->createStatement($sql, $parameters); |
|
| 98 | 98 | |
| 99 | - $results = $statement->execute(); |
|
| 99 | + $results = $statement->execute(); |
|
| 100 | 100 | |
| 101 | - $totalActividades = 0; |
|
| 101 | + $totalActividades = 0; |
|
| 102 | 102 | |
| 103 | - while ($a = $results->next()) { |
|
| 104 | - $arrActividades = [ |
|
| 105 | - 'label' => $a['nombre'], |
|
| 106 | - 'value' => round($a['total'], 2) |
|
| 107 | - ]; |
|
| 103 | + while ($a = $results->next()) { |
|
| 104 | + $arrActividades = [ |
|
| 105 | + 'label' => $a['nombre'], |
|
| 106 | + 'value' => round($a['total'], 2) |
|
| 107 | + ]; |
|
| 108 | 108 | |
| 109 | - $totalActividades += $a['total']; |
|
| 109 | + $totalActividades += $a['total']; |
|
| 110 | 110 | |
| 111 | - // EN CADA ACTIVIDAD HAGO QUE HACER EL SEARCH DE LA SUBACTIVIDAD |
|
| 112 | - $sql = 'SELECT SUM(e.valor) as total, a.id, a.nombre |
|
| 111 | + // EN CADA ACTIVIDAD HAGO QUE HACER EL SEARCH DE LA SUBACTIVIDAD |
|
| 112 | + $sql = 'SELECT SUM(e.valor) as total, a.id, a.nombre |
|
| 113 | 113 | FROM emision e |
| 114 | 114 | INNER JOIN subactividad a ON a.id = e.subactividad_id |
| 115 | 115 | WHERE 1 |
@@ -120,34 +120,34 @@ discard block |
||
| 120 | 120 | GROUP BY a.id |
| 121 | 121 | ORDER BY a.nombre'; |
| 122 | 122 | |
| 123 | - $parameters = [ |
|
| 124 | - $sector_id, |
|
| 125 | - $a['id'], |
|
| 126 | - $ano, |
|
| 127 | - ]; |
|
| 123 | + $parameters = [ |
|
| 124 | + $sector_id, |
|
| 125 | + $a['id'], |
|
| 126 | + $ano, |
|
| 127 | + ]; |
|
| 128 | 128 | |
| 129 | - $statement = $this->db->createStatement($sql, $parameters); |
|
| 129 | + $statement = $this->db->createStatement($sql, $parameters); |
|
| 130 | 130 | |
| 131 | - $results2 = $statement->execute(); |
|
| 131 | + $results2 = $statement->execute(); |
|
| 132 | 132 | |
| 133 | - if ($results2->isQueryResult()) { |
|
| 134 | - $arrSubactividades = []; |
|
| 133 | + if ($results2->isQueryResult()) { |
|
| 134 | + $arrSubactividades = []; |
|
| 135 | 135 | |
| 136 | - $i = 0; |
|
| 136 | + $i = 0; |
|
| 137 | 137 | |
| 138 | - while ($a2 = $results2->next()) { |
|
| 139 | - $arrSubactividades[$i] = [ |
|
| 140 | - 'label' => $a2['nombre'], |
|
| 141 | - 'value' => round($a2['total'], 2) |
|
| 142 | - ]; |
|
| 138 | + while ($a2 = $results2->next()) { |
|
| 139 | + $arrSubactividades[$i] = [ |
|
| 140 | + 'label' => $a2['nombre'], |
|
| 141 | + 'value' => round($a2['total'], 2) |
|
| 142 | + ]; |
|
| 143 | 143 | |
| 144 | 144 | |
| 145 | - if ($sector_id == 3 || $sector_id == 4) { |
|
| 146 | - continue; |
|
| 147 | - } |
|
| 145 | + if ($sector_id == 3 || $sector_id == 4) { |
|
| 146 | + continue; |
|
| 147 | + } |
|
| 148 | 148 | |
| 149 | - // TODO: ACA EN CADA SUBACTIVIDAD TENDRIA QUE HACER EL SEARCH DE LA CATEGORIA |
|
| 150 | - $sql = 'SELECT SUM(e.valor) as total, a.id, a.nombre |
|
| 149 | + // TODO: ACA EN CADA SUBACTIVIDAD TENDRIA QUE HACER EL SEARCH DE LA CATEGORIA |
|
| 150 | + $sql = 'SELECT SUM(e.valor) as total, a.id, a.nombre |
|
| 151 | 151 | FROM emision e |
| 152 | 152 | INNER JOIN categoria a ON a.id = e.categoria_id |
| 153 | 153 | WHERE 1 |
@@ -159,167 +159,167 @@ discard block |
||
| 159 | 159 | GROUP BY a.id |
| 160 | 160 | ORDER BY a.nombre'; |
| 161 | 161 | |
| 162 | - $parameters = [ |
|
| 163 | - $sector_id, |
|
| 164 | - $a['id'], |
|
| 165 | - $a2['id'], |
|
| 166 | - $ano, |
|
| 167 | - ]; |
|
| 168 | - |
|
| 169 | - $statement = $this->db->createStatement($sql, $parameters); |
|
| 170 | - |
|
| 171 | - $results3 = $statement->execute(); |
|
| 172 | - |
|
| 173 | - if ($results3->isQueryResult()) { |
|
| 174 | - $arrCategorias = []; |
|
| 175 | - |
|
| 176 | - while ($a3 = $results3->next()) { |
|
| 177 | - $arrCategorias[] = [ |
|
| 178 | - 'label'=>$a3['nombre'], |
|
| 179 | - 'value'=>round($a3['total'], 2) |
|
| 180 | - ]; |
|
| 181 | - } |
|
| 182 | - $arrSubactividades[$i]['inner'] = $arrCategorias; |
|
| 183 | - } |
|
| 184 | - $i++; |
|
| 185 | - } |
|
| 186 | - |
|
| 187 | - $arrActividades['inner'] = $arrSubactividades; |
|
| 188 | - } |
|
| 162 | + $parameters = [ |
|
| 163 | + $sector_id, |
|
| 164 | + $a['id'], |
|
| 165 | + $a2['id'], |
|
| 166 | + $ano, |
|
| 167 | + ]; |
|
| 168 | + |
|
| 169 | + $statement = $this->db->createStatement($sql, $parameters); |
|
| 170 | + |
|
| 171 | + $results3 = $statement->execute(); |
|
| 172 | + |
|
| 173 | + if ($results3->isQueryResult()) { |
|
| 174 | + $arrCategorias = []; |
|
| 175 | + |
|
| 176 | + while ($a3 = $results3->next()) { |
|
| 177 | + $arrCategorias[] = [ |
|
| 178 | + 'label'=>$a3['nombre'], |
|
| 179 | + 'value'=>round($a3['total'], 2) |
|
| 180 | + ]; |
|
| 181 | + } |
|
| 182 | + $arrSubactividades[$i]['inner'] = $arrCategorias; |
|
| 183 | + } |
|
| 184 | + $i++; |
|
| 185 | + } |
|
| 186 | + |
|
| 187 | + $arrActividades['inner'] = $arrSubactividades; |
|
| 188 | + } |
|
| 189 | 189 | |
| 190 | - $arrGraphData[] = $arrActividades; |
|
| 191 | - } |
|
| 190 | + $arrGraphData[] = $arrActividades; |
|
| 191 | + } |
|
| 192 | 192 | |
| 193 | 193 | |
| 194 | - $response['graph_data'] = $arrGraphData; |
|
| 195 | - $response['totalActividades'] = $totalActividades; |
|
| 194 | + $response['graph_data'] = $arrGraphData; |
|
| 195 | + $response['totalActividades'] = $totalActividades; |
|
| 196 | 196 | |
| 197 | 197 | |
| 198 | 198 | |
| 199 | - /** |
|
| 200 | - * BUSCO LA INFO DEL SECTOR |
|
| 201 | - */ |
|
| 199 | + /** |
|
| 200 | + * BUSCO LA INFO DEL SECTOR |
|
| 201 | + */ |
|
| 202 | 202 | |
| 203 | - $sql = 'SELECT * FROM sector WHERE id = ?'; |
|
| 203 | + $sql = 'SELECT * FROM sector WHERE id = ?'; |
|
| 204 | 204 | |
| 205 | - $parameters = [ |
|
| 206 | - $sector_id |
|
| 207 | - ]; |
|
| 205 | + $parameters = [ |
|
| 206 | + $sector_id |
|
| 207 | + ]; |
|
| 208 | 208 | |
| 209 | - $statement = $this->db->createStatement($sql, $parameters); |
|
| 209 | + $statement = $this->db->createStatement($sql, $parameters); |
|
| 210 | 210 | |
| 211 | - $results = $statement->execute(); |
|
| 211 | + $results = $statement->execute(); |
|
| 212 | 212 | |
| 213 | - if (!$results->isQueryResult()) { |
|
| 214 | - $this->response->setStatusCode(404); |
|
| 215 | - } |
|
| 213 | + if (!$results->isQueryResult()) { |
|
| 214 | + $this->response->setStatusCode(404); |
|
| 215 | + } |
|
| 216 | 216 | |
| 217 | - while ($arrSector = $results->next()) { |
|
| 218 | - $response['sector'] = $arrSector; |
|
| 219 | - } |
|
| 217 | + while ($arrSector = $results->next()) { |
|
| 218 | + $response['sector'] = $arrSector; |
|
| 219 | + } |
|
| 220 | 220 | |
| 221 | - return new JsonModel($response); |
|
| 222 | - } |
|
| 221 | + return new JsonModel($response); |
|
| 222 | + } |
|
| 223 | 223 | |
| 224 | - /** |
|
| 225 | - * |
|
| 226 | - */ |
|
| 227 | - public function getGasesDistributionAction() |
|
| 228 | - { |
|
| 229 | - $params = $this->params()->fromRoute(); |
|
| 224 | + /** |
|
| 225 | + * |
|
| 226 | + */ |
|
| 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 = [ |
|
| 241 | - $ano, |
|
| 242 | - ]; |
|
| 240 | + $parameters = [ |
|
| 241 | + $ano, |
|
| 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 | - public function getSectoralGasesDistributionAction() |
|
| 260 | - { |
|
| 261 | - $params = $this->params()->fromRoute(); |
|
| 259 | + public function getSectoralGasesDistributionAction() |
|
| 260 | + { |
|
| 261 | + $params = $this->params()->fromRoute(); |
|
| 262 | 262 | |
| 263 | - $ano = (int)$params['ano']; |
|
| 263 | + $ano = (int)$params['ano']; |
|
| 264 | 264 | |
| 265 | - $response = []; |
|
| 265 | + $response = []; |
|
| 266 | 266 | |
| 267 | - // PRIMERA FILA LA DE LOS GASES |
|
| 267 | + // PRIMERA FILA LA DE LOS GASES |
|
| 268 | 268 | |
| 269 | - $sql = 'SELECT g.nombre, sum(e.valor) as total |
|
| 269 | + $sql = 'SELECT g.nombre, sum(e.valor) as total |
|
| 270 | 270 | FROM emision e |
| 271 | 271 | LEFT JOIN gas g ON (e.gas_id = g.id) |
| 272 | 272 | where e.ano = ? GROUP BY e.gas_id ORDER BY total DESC'; |
| 273 | 273 | |
| 274 | - $parameters = [ |
|
| 275 | - $ano, |
|
| 276 | - ]; |
|
| 274 | + $parameters = [ |
|
| 275 | + $ano, |
|
| 276 | + ]; |
|
| 277 | 277 | |
| 278 | - $statement = $this->db->createStatement($sql, $parameters); |
|
| 278 | + $statement = $this->db->createStatement($sql, $parameters); |
|
| 279 | 279 | |
| 280 | - $arrGases = $statement->execute(); |
|
| 280 | + $arrGases = $statement->execute(); |
|
| 281 | 281 | |
| 282 | - $sql = 'SELECT s.nombre |
|
| 282 | + $sql = 'SELECT s.nombre |
|
| 283 | 283 | FROM sector s |
| 284 | 284 | ORDER BY s.nombre'; |
| 285 | 285 | |
| 286 | - $statement = $this->db->createStatement($sql); |
|
| 286 | + $statement = $this->db->createStatement($sql); |
|
| 287 | 287 | |
| 288 | - $arrSectores = $statement->execute(); |
|
| 288 | + $arrSectores = $statement->execute(); |
|
| 289 | 289 | |
| 290 | - $sql = 'SELECT s.nombre as sector, g.nombre as gas, sum(e.valor) as total |
|
| 290 | + $sql = 'SELECT s.nombre as sector, g.nombre as gas, sum(e.valor) as total |
|
| 291 | 291 | FROM emision e |
| 292 | 292 | LEFT JOIN gas g ON (e.gas_id = g.id) |
| 293 | 293 | LEFT JOIN sector s ON (e.sector_id = s.id) |
| 294 | 294 | where e.ano = ? GROUP BY e.gas_id, e.sector_id ORDER BY total DESC'; |
| 295 | 295 | |
| 296 | - $parameters = [ |
|
| 297 | - $ano, |
|
| 298 | - ]; |
|
| 296 | + $parameters = [ |
|
| 297 | + $ano, |
|
| 298 | + ]; |
|
| 299 | 299 | |
| 300 | - $statement = $this->db->createStatement($sql, $parameters); |
|
| 300 | + $statement = $this->db->createStatement($sql, $parameters); |
|
| 301 | 301 | |
| 302 | - $arr = $statement->execute(); |
|
| 302 | + $arr = $statement->execute(); |
|
| 303 | 303 | |
| 304 | - $column = 2; |
|
| 304 | + $column = 2; |
|
| 305 | 305 | |
| 306 | - while ($sector = $arrSectores->next()) { |
|
| 307 | - $response['column_'.$column][] = $sector; |
|
| 306 | + while ($sector = $arrSectores->next()) { |
|
| 307 | + $response['column_'.$column][] = $sector; |
|
| 308 | 308 | |
| 309 | - while ($gas = $arrGases->next()) { |
|
| 310 | - $response['column_'.$column][] = Utils::returnSectorGas($arr, $sector, $gas['nombre']); |
|
| 311 | - } |
|
| 312 | - $column++; |
|
| 313 | - } |
|
| 309 | + while ($gas = $arrGases->next()) { |
|
| 310 | + $response['column_'.$column][] = Utils::returnSectorGas($arr, $sector, $gas['nombre']); |
|
| 311 | + } |
|
| 312 | + $column++; |
|
| 313 | + } |
|
| 314 | 314 | |
| 315 | - $arrReturnGases = ['x']; |
|
| 315 | + $arrReturnGases = ['x']; |
|
| 316 | 316 | |
| 317 | - while ($gas = $arrGases->next()) { |
|
| 318 | - $arrReturnGases[] = $gas['nombre']; |
|
| 319 | - } |
|
| 317 | + while ($gas = $arrGases->next()) { |
|
| 318 | + $arrReturnGases[] = $gas['nombre']; |
|
| 319 | + } |
|
| 320 | 320 | |
| 321 | - $response['column_1'] = $arrReturnGases; |
|
| 321 | + $response['column_1'] = $arrReturnGases; |
|
| 322 | 322 | |
| 323 | - return new JsonModel($response); |
|
| 324 | - } |
|
| 323 | + return new JsonModel($response); |
|
| 324 | + } |
|
| 325 | 325 | } |
@@ -29,7 +29,7 @@ discard block |
||
| 29 | 29 | { |
| 30 | 30 | $params = $this->params()->fromRoute(); |
| 31 | 31 | |
| 32 | - $ano = (int)$params['ano']; |
|
| 32 | + $ano = (int) $params['ano']; |
|
| 33 | 33 | |
| 34 | 34 | $response = []; |
| 35 | 35 | |
@@ -75,8 +75,8 @@ discard block |
||
| 75 | 75 | $response = []; |
| 76 | 76 | $arrGraphData = []; |
| 77 | 77 | |
| 78 | - $ano = (int)$params['ano']; |
|
| 79 | - $sector_id = (int)$params['sector_id']; |
|
| 78 | + $ano = (int) $params['ano']; |
|
| 79 | + $sector_id = (int) $params['sector_id']; |
|
| 80 | 80 | |
| 81 | 81 | $sql = 'SELECT SUM(e.valor) as total, a.id, a.nombre |
| 82 | 82 | FROM emision e |
@@ -228,7 +228,7 @@ discard block |
||
| 228 | 228 | { |
| 229 | 229 | $params = $this->params()->fromRoute(); |
| 230 | 230 | |
| 231 | - $ano = (int)$params['ano']; |
|
| 231 | + $ano = (int) $params['ano']; |
|
| 232 | 232 | |
| 233 | 233 | $response = []; |
| 234 | 234 | |
@@ -260,7 +260,7 @@ discard block |
||
| 260 | 260 | { |
| 261 | 261 | $params = $this->params()->fromRoute(); |
| 262 | 262 | |
| 263 | - $ano = (int)$params['ano']; |
|
| 263 | + $ano = (int) $params['ano']; |
|
| 264 | 264 | |
| 265 | 265 | $response = []; |
| 266 | 266 | |
@@ -12,175 +12,175 @@ discard block |
||
| 12 | 12 | */ |
| 13 | 13 | class EvolutionReportController extends AbstractRestfulController |
| 14 | 14 | { |
| 15 | - /** |
|
| 16 | - * |
|
| 17 | - */ |
|
| 18 | - private $db; |
|
| 15 | + /** |
|
| 16 | + * |
|
| 17 | + */ |
|
| 18 | + private $db; |
|
| 19 | 19 | |
| 20 | - public function __construct(AdapterInterface $db) |
|
| 21 | - { |
|
| 22 | - $this->db = $db; |
|
| 23 | - } |
|
| 20 | + public function __construct(AdapterInterface $db) |
|
| 21 | + { |
|
| 22 | + $this->db = $db; |
|
| 23 | + } |
|
| 24 | 24 | |
| 25 | - public function getWholeSectoralEvolutionAction() |
|
| 26 | - { |
|
| 27 | - $params = $this->params()->fromRoute(); |
|
| 25 | + public function getWholeSectoralEvolutionAction() |
|
| 26 | + { |
|
| 27 | + $params = $this->params()->fromRoute(); |
|
| 28 | 28 | |
| 29 | - $response = []; |
|
| 29 | + $response = []; |
|
| 30 | 30 | |
| 31 | - // TRAIGO LOS SECTORES CON SUS COLORES |
|
| 31 | + // TRAIGO LOS SECTORES CON SUS COLORES |
|
| 32 | 32 | |
| 33 | - $sql = "SELECT s.nombre, s.color |
|
| 33 | + $sql = "SELECT s.nombre, s.color |
|
| 34 | 34 | FROM sector s |
| 35 | 35 | WHERE 1 |
| 36 | 36 | ORDER BY s.nombre "; |
| 37 | 37 | |
| 38 | - $statement = $this->db->createStatement($sql); |
|
| 38 | + $statement = $this->db->createStatement($sql); |
|
| 39 | 39 | |
| 40 | - $arrSectores = $statement->execute(); |
|
| 40 | + $arrSectores = $statement->execute(); |
|
| 41 | 41 | |
| 42 | - if (!$arrSectores->isQueryResult()) { |
|
| 43 | - $this->response->setStatusCode(404); |
|
| 44 | - } |
|
| 42 | + if (!$arrSectores->isQueryResult()) { |
|
| 43 | + $this->response->setStatusCode(404); |
|
| 44 | + } |
|
| 45 | 45 | |
| 46 | - // TRAIGO LOS VALORES POR ANO |
|
| 46 | + // TRAIGO LOS VALORES POR ANO |
|
| 47 | 47 | |
| 48 | - $sql = "SELECT s.nombre as sector, e.ano, sum(e.valor) as total |
|
| 48 | + $sql = "SELECT s.nombre as sector, e.ano, sum(e.valor) as total |
|
| 49 | 49 | FROM emision e |
| 50 | 50 | LEFT JOIN sector s ON (e.sector_id = s.id) |
| 51 | 51 | where 1 |
| 52 | 52 | GROUP BY e.ano, s.nombre"; |
| 53 | 53 | |
| 54 | - // LO QUE ESTA ADENTRO DEL LOOP DEBERIA IR ACA |
|
| 54 | + // LO QUE ESTA ADENTRO DEL LOOP DEBERIA IR ACA |
|
| 55 | 55 | |
| 56 | - $arrAnos = []; |
|
| 57 | - $arrValores = []; |
|
| 58 | - $arrColores = []; |
|
| 56 | + $arrAnos = []; |
|
| 57 | + $arrValores = []; |
|
| 58 | + $arrColores = []; |
|
| 59 | 59 | |
| 60 | - for ($i=1990;$i<=2014;$i++) { |
|
| 61 | - $arrAnos[] = $i; |
|
| 62 | - } |
|
| 60 | + for ($i=1990;$i<=2014;$i++) { |
|
| 61 | + $arrAnos[] = $i; |
|
| 62 | + } |
|
| 63 | 63 | |
| 64 | - $column = 2; |
|
| 64 | + $column = 2; |
|
| 65 | 65 | |
| 66 | - while ($sector = $arrSectores->next()) { |
|
| 67 | - $response['column_'.$column][] = $sector['nombre']; |
|
| 68 | - $response['colores'][] = $sector['color']; |
|
| 66 | + while ($sector = $arrSectores->next()) { |
|
| 67 | + $response['column_'.$column][] = $sector['nombre']; |
|
| 68 | + $response['colores'][] = $sector['color']; |
|
| 69 | 69 | |
| 70 | - foreach ($arrAnos as $ano) { |
|
| 71 | - // ATENCION, CABECEADA |
|
| 72 | - // ESTOY EJECUTANDO EL QUERY CADA VEZ QUE NECESITO LA LISTA DE VALORES |
|
| 73 | - // ESTA PARTE DEBERIA AFUERA DEL LOOP Y SE DEBERIA REUTILIZAR $arrValoresCrudo |
|
| 74 | - $statement = $this->db->createStatement($sql); |
|
| 75 | - $arrValoresCrudo = $statement->execute(); |
|
| 70 | + foreach ($arrAnos as $ano) { |
|
| 71 | + // ATENCION, CABECEADA |
|
| 72 | + // ESTOY EJECUTANDO EL QUERY CADA VEZ QUE NECESITO LA LISTA DE VALORES |
|
| 73 | + // ESTA PARTE DEBERIA AFUERA DEL LOOP Y SE DEBERIA REUTILIZAR $arrValoresCrudo |
|
| 74 | + $statement = $this->db->createStatement($sql); |
|
| 75 | + $arrValoresCrudo = $statement->execute(); |
|
| 76 | 76 | |
| 77 | - if (!$arrValoresCrudo->isQueryResult()) { |
|
| 78 | - $this->response->setStatusCode(404); |
|
| 79 | - } |
|
| 80 | - // HASTA ACA |
|
| 77 | + if (!$arrValoresCrudo->isQueryResult()) { |
|
| 78 | + $this->response->setStatusCode(404); |
|
| 79 | + } |
|
| 80 | + // HASTA ACA |
|
| 81 | 81 | |
| 82 | - $response['column_'.$column][] = Utils::returnSectorAno($arrValoresCrudo, $sector['nombre'], $ano); |
|
| 83 | - } |
|
| 82 | + $response['column_'.$column][] = Utils::returnSectorAno($arrValoresCrudo, $sector['nombre'], $ano); |
|
| 83 | + } |
|
| 84 | 84 | |
| 85 | - $column++; |
|
| 86 | - } |
|
| 85 | + $column++; |
|
| 86 | + } |
|
| 87 | 87 | |
| 88 | 88 | |
| 89 | - $arrAnos = array_merge(array('x'), $arrAnos); |
|
| 90 | - $response['column_1'] = $arrAnos; |
|
| 89 | + $arrAnos = array_merge(array('x'), $arrAnos); |
|
| 90 | + $response['column_1'] = $arrAnos; |
|
| 91 | 91 | |
| 92 | 92 | |
| 93 | - return new JsonModel($response); |
|
| 94 | - } |
|
| 93 | + return new JsonModel($response); |
|
| 94 | + } |
|
| 95 | 95 | |
| 96 | - public function getSectoralEvolutionAction() |
|
| 97 | - { |
|
| 98 | - $params = $this->params()->fromRoute(); |
|
| 96 | + public function getSectoralEvolutionAction() |
|
| 97 | + { |
|
| 98 | + $params = $this->params()->fromRoute(); |
|
| 99 | 99 | |
| 100 | - $sector_id = (int)$params['sector_id']; |
|
| 100 | + $sector_id = (int)$params['sector_id']; |
|
| 101 | 101 | |
| 102 | - $response = []; |
|
| 102 | + $response = []; |
|
| 103 | 103 | |
| 104 | - // TRAIGO LOS SECTORES CON SUS COLORES |
|
| 104 | + // TRAIGO LOS SECTORES CON SUS COLORES |
|
| 105 | 105 | |
| 106 | - $sql = "SELECT s.nombre, s.color |
|
| 106 | + $sql = "SELECT s.nombre, s.color |
|
| 107 | 107 | FROM sector s |
| 108 | 108 | WHERE 1 |
| 109 | 109 | AND s.id = ? |
| 110 | 110 | ORDER BY s.nombre "; |
| 111 | 111 | |
| 112 | - $params = [ |
|
| 113 | - $sector_id, |
|
| 114 | - ]; |
|
| 112 | + $params = [ |
|
| 113 | + $sector_id, |
|
| 114 | + ]; |
|
| 115 | 115 | |
| 116 | - $statement = $this->db->createStatement($sql, $params); |
|
| 116 | + $statement = $this->db->createStatement($sql, $params); |
|
| 117 | 117 | |
| 118 | - $arrSectores = $statement->execute(); |
|
| 118 | + $arrSectores = $statement->execute(); |
|
| 119 | 119 | |
| 120 | - if (!$arrSectores->isQueryResult()) { |
|
| 121 | - $this->response->setStatusCode(404); |
|
| 122 | - } |
|
| 120 | + if (!$arrSectores->isQueryResult()) { |
|
| 121 | + $this->response->setStatusCode(404); |
|
| 122 | + } |
|
| 123 | 123 | |
| 124 | - // TRAIGO LOS VALORES POR ANO |
|
| 124 | + // TRAIGO LOS VALORES POR ANO |
|
| 125 | 125 | |
| 126 | - $sql = "SELECT s.nombre as sector, e.ano, sum(e.valor) as total |
|
| 126 | + $sql = "SELECT s.nombre as sector, e.ano, sum(e.valor) as total |
|
| 127 | 127 | FROM emision e |
| 128 | 128 | LEFT JOIN sector s ON (e.sector_id = s.id) |
| 129 | 129 | where 1 |
| 130 | 130 | GROUP BY e.ano, s.nombre"; |
| 131 | 131 | |
| 132 | - // LO QUE ESTA ADENTRO DEL LOOP DEBERIA IR ACA |
|
| 132 | + // LO QUE ESTA ADENTRO DEL LOOP DEBERIA IR ACA |
|
| 133 | 133 | |
| 134 | - $arrAnos = []; |
|
| 135 | - $arrValores = []; |
|
| 136 | - $arrColores = []; |
|
| 134 | + $arrAnos = []; |
|
| 135 | + $arrValores = []; |
|
| 136 | + $arrColores = []; |
|
| 137 | 137 | |
| 138 | - for ($i=1990;$i<=2014;$i++) { |
|
| 139 | - $arrAnos[] = $i; |
|
| 140 | - } |
|
| 138 | + for ($i=1990;$i<=2014;$i++) { |
|
| 139 | + $arrAnos[] = $i; |
|
| 140 | + } |
|
| 141 | 141 | |
| 142 | - $column = 2; |
|
| 142 | + $column = 2; |
|
| 143 | 143 | |
| 144 | - while ($sector = $arrSectores->next()) { |
|
| 145 | - $response['column_'.$column][] = $sector['nombre']; |
|
| 146 | - $response['colores'][] = $sector['color']; |
|
| 144 | + while ($sector = $arrSectores->next()) { |
|
| 145 | + $response['column_'.$column][] = $sector['nombre']; |
|
| 146 | + $response['colores'][] = $sector['color']; |
|
| 147 | 147 | |
| 148 | - foreach ($arrAnos as $ano) { |
|
| 149 | - // ATENCION, CABECEADA |
|
| 150 | - // ESTOY EJECUTANDO EL QUERY CADA VEZ QUE NECESITO LA LISTA DE VALORES |
|
| 151 | - // ESTA PARTE DEBERIA AFUERA DEL LOOP Y SE DEBERIA REUTILIZAR $arrValoresCrudo |
|
| 152 | - $statement = $this->db->createStatement($sql); |
|
| 153 | - $arrValoresCrudo = $statement->execute(); |
|
| 148 | + foreach ($arrAnos as $ano) { |
|
| 149 | + // ATENCION, CABECEADA |
|
| 150 | + // ESTOY EJECUTANDO EL QUERY CADA VEZ QUE NECESITO LA LISTA DE VALORES |
|
| 151 | + // ESTA PARTE DEBERIA AFUERA DEL LOOP Y SE DEBERIA REUTILIZAR $arrValoresCrudo |
|
| 152 | + $statement = $this->db->createStatement($sql); |
|
| 153 | + $arrValoresCrudo = $statement->execute(); |
|
| 154 | 154 | |
| 155 | - if (!$arrValoresCrudo->isQueryResult()) { |
|
| 156 | - $this->response->setStatusCode(404); |
|
| 157 | - } |
|
| 158 | - // HASTA ACA |
|
| 155 | + if (!$arrValoresCrudo->isQueryResult()) { |
|
| 156 | + $this->response->setStatusCode(404); |
|
| 157 | + } |
|
| 158 | + // HASTA ACA |
|
| 159 | 159 | |
| 160 | - $response['column_'.$column][] = Utils::returnSectorAno($arrValoresCrudo, $sector['nombre'], $ano); |
|
| 161 | - } |
|
| 160 | + $response['column_'.$column][] = Utils::returnSectorAno($arrValoresCrudo, $sector['nombre'], $ano); |
|
| 161 | + } |
|
| 162 | 162 | |
| 163 | - $column++; |
|
| 164 | - } |
|
| 163 | + $column++; |
|
| 164 | + } |
|
| 165 | 165 | |
| 166 | 166 | |
| 167 | - $arrAnos = array_merge(array('x'), $arrAnos); |
|
| 168 | - $response['column_1'] = $arrAnos; |
|
| 167 | + $arrAnos = array_merge(array('x'), $arrAnos); |
|
| 168 | + $response['column_1'] = $arrAnos; |
|
| 169 | 169 | |
| 170 | 170 | |
| 171 | - return new JsonModel($response); |
|
| 172 | - } |
|
| 171 | + return new JsonModel($response); |
|
| 172 | + } |
|
| 173 | 173 | |
| 174 | 174 | |
| 175 | - public function getSectoralEvolutionSubactivityAction() |
|
| 176 | - { |
|
| 177 | - $params = $this->params()->fromRoute(); |
|
| 175 | + public function getSectoralEvolutionSubactivityAction() |
|
| 176 | + { |
|
| 177 | + $params = $this->params()->fromRoute(); |
|
| 178 | 178 | |
| 179 | - $sector_id = (int)$params['sector_id']; |
|
| 179 | + $sector_id = (int)$params['sector_id']; |
|
| 180 | 180 | |
| 181 | - $response = []; |
|
| 181 | + $response = []; |
|
| 182 | 182 | |
| 183 | - $sql = "SELECT sub.nombre |
|
| 183 | + $sql = "SELECT sub.nombre |
|
| 184 | 184 | FROM subactividad sub |
| 185 | 185 | INNER JOIN actividad a ON (a.id = sub.actividad_id) |
| 186 | 186 | INNER JOIN sector s ON (a.sector_id = s.id) |
@@ -188,23 +188,23 @@ discard block |
||
| 188 | 188 | AND s.id = ? |
| 189 | 189 | ORDER BY sub.nombre"; |
| 190 | 190 | |
| 191 | - $params = [ |
|
| 192 | - $sector_id, |
|
| 193 | - ]; |
|
| 191 | + $params = [ |
|
| 192 | + $sector_id, |
|
| 193 | + ]; |
|
| 194 | 194 | |
| 195 | 195 | |
| 196 | - $statement = $this->db->createStatement($sql, $params); |
|
| 196 | + $statement = $this->db->createStatement($sql, $params); |
|
| 197 | 197 | |
| 198 | - $arrSubactividades = $statement->execute(); |
|
| 198 | + $arrSubactividades = $statement->execute(); |
|
| 199 | 199 | |
| 200 | 200 | |
| 201 | - if (!$arrSubactividades->isQueryResult()) { |
|
| 202 | - $this->response->setStatusCode(404); |
|
| 203 | - } |
|
| 201 | + if (!$arrSubactividades->isQueryResult()) { |
|
| 202 | + $this->response->setStatusCode(404); |
|
| 203 | + } |
|
| 204 | 204 | |
| 205 | - // TRAIGO LOS VALORES POR ANO |
|
| 205 | + // TRAIGO LOS VALORES POR ANO |
|
| 206 | 206 | |
| 207 | - $sql = "SELECT sub.nombre as sector, e.ano, SUM(e.valor) as total |
|
| 207 | + $sql = "SELECT sub.nombre as sector, e.ano, SUM(e.valor) as total |
|
| 208 | 208 | FROM emision e |
| 209 | 209 | INNER JOIN subactividad sub ON (e.subactividad_id = sub.id) |
| 210 | 210 | INNER JOIN sector s ON (e.sector_id = s.id) |
@@ -214,61 +214,61 @@ discard block |
||
| 214 | 214 | |
| 215 | 215 | |
| 216 | 216 | |
| 217 | - // LO QUE ESTA ADENTRO DEL LOOP DEBERIA IR ACA |
|
| 217 | + // LO QUE ESTA ADENTRO DEL LOOP DEBERIA IR ACA |
|
| 218 | 218 | |
| 219 | - $arrAnos = []; |
|
| 220 | - $arrValores = []; |
|
| 221 | - $arrColores = []; |
|
| 219 | + $arrAnos = []; |
|
| 220 | + $arrValores = []; |
|
| 221 | + $arrColores = []; |
|
| 222 | 222 | |
| 223 | - for ($i=1990;$i<=2014;$i++) { |
|
| 224 | - $arrAnos[] = $i; |
|
| 225 | - } |
|
| 223 | + for ($i=1990;$i<=2014;$i++) { |
|
| 224 | + $arrAnos[] = $i; |
|
| 225 | + } |
|
| 226 | 226 | |
| 227 | - $column = 2; |
|
| 227 | + $column = 2; |
|
| 228 | 228 | |
| 229 | 229 | |
| 230 | - while ($subactividad = $arrSubactividades->next()) { |
|
| 231 | - $response['column_'.$column][] = $subactividad['nombre']; |
|
| 232 | - $response['groups'][] = $subactividad['nombre']; |
|
| 230 | + while ($subactividad = $arrSubactividades->next()) { |
|
| 231 | + $response['column_'.$column][] = $subactividad['nombre']; |
|
| 232 | + $response['groups'][] = $subactividad['nombre']; |
|
| 233 | 233 | |
| 234 | - foreach ($arrAnos as $ano) { |
|
| 235 | - // ATENCION, CABECEADA |
|
| 236 | - // ESTOY EJECUTANDO EL QUERY CADA VEZ QUE NECESITO LA LISTA DE VALORES |
|
| 237 | - // ESTA PARTE DEBERIA AFUERA DEL LOOP Y SE DEBERIA REUTILIZAR $arrValoresCrudo |
|
| 234 | + foreach ($arrAnos as $ano) { |
|
| 235 | + // ATENCION, CABECEADA |
|
| 236 | + // ESTOY EJECUTANDO EL QUERY CADA VEZ QUE NECESITO LA LISTA DE VALORES |
|
| 237 | + // ESTA PARTE DEBERIA AFUERA DEL LOOP Y SE DEBERIA REUTILIZAR $arrValoresCrudo |
|
| 238 | 238 | |
| 239 | - $statement = $this->db->createStatement($sql, $params); |
|
| 239 | + $statement = $this->db->createStatement($sql, $params); |
|
| 240 | 240 | |
| 241 | - $arrValoresCrudo = $statement->execute(); |
|
| 241 | + $arrValoresCrudo = $statement->execute(); |
|
| 242 | 242 | |
| 243 | - if (!$arrValoresCrudo->isQueryResult()) { |
|
| 244 | - $this->response->setStatusCode(404); |
|
| 245 | - } |
|
| 246 | - // HASTA ACA |
|
| 243 | + if (!$arrValoresCrudo->isQueryResult()) { |
|
| 244 | + $this->response->setStatusCode(404); |
|
| 245 | + } |
|
| 246 | + // HASTA ACA |
|
| 247 | 247 | |
| 248 | - $response['column_'.$column][] = Utils::returnSectorAno($arrValoresCrudo, $subactividad['nombre'], $ano); |
|
| 249 | - } |
|
| 248 | + $response['column_'.$column][] = Utils::returnSectorAno($arrValoresCrudo, $subactividad['nombre'], $ano); |
|
| 249 | + } |
|
| 250 | 250 | |
| 251 | - $column++; |
|
| 252 | - } |
|
| 251 | + $column++; |
|
| 252 | + } |
|
| 253 | 253 | |
| 254 | 254 | |
| 255 | - $arrAnos = array_merge(array('x'), $arrAnos); |
|
| 256 | - $response['column_1'] = $arrAnos; |
|
| 255 | + $arrAnos = array_merge(array('x'), $arrAnos); |
|
| 256 | + $response['column_1'] = $arrAnos; |
|
| 257 | 257 | |
| 258 | 258 | |
| 259 | - return new JsonModel($response); |
|
| 260 | - } |
|
| 259 | + return new JsonModel($response); |
|
| 260 | + } |
|
| 261 | 261 | |
| 262 | - public function getSectoralEvolutionSubactivityCategoryAction() |
|
| 263 | - { |
|
| 264 | - $params = $this->params()->fromRoute(); |
|
| 262 | + public function getSectoralEvolutionSubactivityCategoryAction() |
|
| 263 | + { |
|
| 264 | + $params = $this->params()->fromRoute(); |
|
| 265 | 265 | |
| 266 | - $sector_id = (int)$params['sector_id']; |
|
| 267 | - $subactividad_id = (int)$params['subactividad_id']; |
|
| 266 | + $sector_id = (int)$params['sector_id']; |
|
| 267 | + $subactividad_id = (int)$params['subactividad_id']; |
|
| 268 | 268 | |
| 269 | - $response = []; |
|
| 269 | + $response = []; |
|
| 270 | 270 | |
| 271 | - $sql = "SELECT DISTINCT c.nombre |
|
| 271 | + $sql = "SELECT DISTINCT c.nombre |
|
| 272 | 272 | FROM emision e |
| 273 | 273 | INNER JOIN subactividad sub ON (e.subactividad_id = sub.id) |
| 274 | 274 | INNER JOIN sector s ON (e.sector_id = s.id) |
@@ -279,18 +279,18 @@ discard block |
||
| 279 | 279 | ORDER BY c.nombre"; |
| 280 | 280 | |
| 281 | 281 | |
| 282 | - $params = [ |
|
| 282 | + $params = [ |
|
| 283 | 283 | |
| 284 | - $sector_id, |
|
| 285 | - $subactividad_id |
|
| 286 | - ]; |
|
| 284 | + $sector_id, |
|
| 285 | + $subactividad_id |
|
| 286 | + ]; |
|
| 287 | 287 | |
| 288 | - $statement = $this->db->createStatement($sql, $params); |
|
| 289 | - $arrCategorias = $statement->execute(); |
|
| 288 | + $statement = $this->db->createStatement($sql, $params); |
|
| 289 | + $arrCategorias = $statement->execute(); |
|
| 290 | 290 | |
| 291 | 291 | |
| 292 | 292 | |
| 293 | - $sql = "SELECT sub.nombre as subcategoria, e.ano, c.nombre, e.valor |
|
| 293 | + $sql = "SELECT sub.nombre as subcategoria, e.ano, c.nombre, e.valor |
|
| 294 | 294 | FROM emision e |
| 295 | 295 | INNER JOIN subactividad sub ON (e.subactividad_id = sub.id) |
| 296 | 296 | INNER JOIN sector s ON (e.sector_id = s.id) |
@@ -300,57 +300,57 @@ discard block |
||
| 300 | 300 | AND sub.id = ? |
| 301 | 301 | GROUP BY e.ano, c.nombre"; |
| 302 | 302 | |
| 303 | - $params = [ |
|
| 304 | - $sector_id, |
|
| 305 | - $subactividad_id, |
|
| 306 | - ]; |
|
| 303 | + $params = [ |
|
| 304 | + $sector_id, |
|
| 305 | + $subactividad_id, |
|
| 306 | + ]; |
|
| 307 | 307 | |
| 308 | 308 | |
| 309 | 309 | |
| 310 | 310 | |
| 311 | - // LO QUE ESTA ADENTRO DEL LOOP DEBERIA IR ACA |
|
| 312 | - $arrAnos = array(); |
|
| 313 | - $arrValores = array(); |
|
| 314 | - $arrColores = array(); |
|
| 311 | + // LO QUE ESTA ADENTRO DEL LOOP DEBERIA IR ACA |
|
| 312 | + $arrAnos = array(); |
|
| 313 | + $arrValores = array(); |
|
| 314 | + $arrColores = array(); |
|
| 315 | 315 | |
| 316 | 316 | |
| 317 | - for ($i=1990;$i<=2014;$i++) { |
|
| 318 | - $arrAnos[] = $i; |
|
| 319 | - } |
|
| 317 | + for ($i=1990;$i<=2014;$i++) { |
|
| 318 | + $arrAnos[] = $i; |
|
| 319 | + } |
|
| 320 | 320 | |
| 321 | - $column = 2; |
|
| 321 | + $column = 2; |
|
| 322 | 322 | |
| 323 | - // // // pr($arrCategorias); |
|
| 324 | - // // // pr($arr); |
|
| 323 | + // // // pr($arrCategorias); |
|
| 324 | + // // // pr($arr); |
|
| 325 | 325 | |
| 326 | - while ($categoria = $arrCategorias->next()) { |
|
| 327 | - $response['column_'.$column][] = $categoria['nombre']; |
|
| 328 | - $response['groups'][] = $categoria['nombre']; |
|
| 326 | + while ($categoria = $arrCategorias->next()) { |
|
| 327 | + $response['column_'.$column][] = $categoria['nombre']; |
|
| 328 | + $response['groups'][] = $categoria['nombre']; |
|
| 329 | 329 | |
| 330 | - foreach ($arrAnos as $ano) { |
|
| 330 | + foreach ($arrAnos as $ano) { |
|
| 331 | 331 | |
| 332 | - // ATENCION, CABECEADA |
|
| 333 | - // ESTOY EJECUTANDO EL QUERY CADA VEZ QUE NECESITO LA LISTA DE VALORES |
|
| 334 | - // ESTA PARTE DEBERIA AFUERA DEL LOOP Y SE DEBERIA REUTILIZAR $arrValoresCrudo |
|
| 335 | - $statement = $this->db->createStatement($sql, $params); |
|
| 336 | - $arrValoresCrudo = $statement->execute(); |
|
| 332 | + // ATENCION, CABECEADA |
|
| 333 | + // ESTOY EJECUTANDO EL QUERY CADA VEZ QUE NECESITO LA LISTA DE VALORES |
|
| 334 | + // ESTA PARTE DEBERIA AFUERA DEL LOOP Y SE DEBERIA REUTILIZAR $arrValoresCrudo |
|
| 335 | + $statement = $this->db->createStatement($sql, $params); |
|
| 336 | + $arrValoresCrudo = $statement->execute(); |
|
| 337 | 337 | |
| 338 | - if (!$arrValoresCrudo->isQueryResult()) { |
|
| 339 | - $this->response->setStatusCode(404); |
|
| 340 | - } |
|
| 341 | - // HASTA ACA |
|
| 338 | + if (!$arrValoresCrudo->isQueryResult()) { |
|
| 339 | + $this->response->setStatusCode(404); |
|
| 340 | + } |
|
| 341 | + // HASTA ACA |
|
| 342 | 342 | |
| 343 | 343 | |
| 344 | - $response['column_'.$column][] = Utils::returnCategoriaAno($arrValoresCrudo, $categoria['nombre'], $ano); |
|
| 345 | - } |
|
| 344 | + $response['column_'.$column][] = Utils::returnCategoriaAno($arrValoresCrudo, $categoria['nombre'], $ano); |
|
| 345 | + } |
|
| 346 | 346 | |
| 347 | - $column++; |
|
| 348 | - } |
|
| 347 | + $column++; |
|
| 348 | + } |
|
| 349 | 349 | |
| 350 | 350 | |
| 351 | - $arrAnos = array_merge(array('x'), $arrAnos); |
|
| 352 | - $response['column_1'] = $arrAnos; |
|
| 351 | + $arrAnos = array_merge(array('x'), $arrAnos); |
|
| 352 | + $response['column_1'] = $arrAnos; |
|
| 353 | 353 | |
| 354 | - return new JsonModel($response); |
|
| 355 | - } |
|
| 354 | + return new JsonModel($response); |
|
| 355 | + } |
|
| 356 | 356 | } |
@@ -57,7 +57,7 @@ discard block |
||
| 57 | 57 | $arrValores = []; |
| 58 | 58 | $arrColores = []; |
| 59 | 59 | |
| 60 | - for ($i=1990;$i<=2014;$i++) { |
|
| 60 | + for ($i = 1990; $i <= 2014; $i++) { |
|
| 61 | 61 | $arrAnos[] = $i; |
| 62 | 62 | } |
| 63 | 63 | |
@@ -65,7 +65,7 @@ discard block |
||
| 65 | 65 | |
| 66 | 66 | while ($sector = $arrSectores->next()) { |
| 67 | 67 | $response['column_'.$column][] = $sector['nombre']; |
| 68 | - $response['colores'][] = $sector['color']; |
|
| 68 | + $response['colores'][] = $sector['color']; |
|
| 69 | 69 | |
| 70 | 70 | foreach ($arrAnos as $ano) { |
| 71 | 71 | // ATENCION, CABECEADA |
@@ -97,7 +97,7 @@ discard block |
||
| 97 | 97 | { |
| 98 | 98 | $params = $this->params()->fromRoute(); |
| 99 | 99 | |
| 100 | - $sector_id = (int)$params['sector_id']; |
|
| 100 | + $sector_id = (int) $params['sector_id']; |
|
| 101 | 101 | |
| 102 | 102 | $response = []; |
| 103 | 103 | |
@@ -135,7 +135,7 @@ discard block |
||
| 135 | 135 | $arrValores = []; |
| 136 | 136 | $arrColores = []; |
| 137 | 137 | |
| 138 | - for ($i=1990;$i<=2014;$i++) { |
|
| 138 | + for ($i = 1990; $i <= 2014; $i++) { |
|
| 139 | 139 | $arrAnos[] = $i; |
| 140 | 140 | } |
| 141 | 141 | |
@@ -143,7 +143,7 @@ discard block |
||
| 143 | 143 | |
| 144 | 144 | while ($sector = $arrSectores->next()) { |
| 145 | 145 | $response['column_'.$column][] = $sector['nombre']; |
| 146 | - $response['colores'][] = $sector['color']; |
|
| 146 | + $response['colores'][] = $sector['color']; |
|
| 147 | 147 | |
| 148 | 148 | foreach ($arrAnos as $ano) { |
| 149 | 149 | // ATENCION, CABECEADA |
@@ -176,7 +176,7 @@ discard block |
||
| 176 | 176 | { |
| 177 | 177 | $params = $this->params()->fromRoute(); |
| 178 | 178 | |
| 179 | - $sector_id = (int)$params['sector_id']; |
|
| 179 | + $sector_id = (int) $params['sector_id']; |
|
| 180 | 180 | |
| 181 | 181 | $response = []; |
| 182 | 182 | |
@@ -220,7 +220,7 @@ discard block |
||
| 220 | 220 | $arrValores = []; |
| 221 | 221 | $arrColores = []; |
| 222 | 222 | |
| 223 | - for ($i=1990;$i<=2014;$i++) { |
|
| 223 | + for ($i = 1990; $i <= 2014; $i++) { |
|
| 224 | 224 | $arrAnos[] = $i; |
| 225 | 225 | } |
| 226 | 226 | |
@@ -263,8 +263,8 @@ discard block |
||
| 263 | 263 | { |
| 264 | 264 | $params = $this->params()->fromRoute(); |
| 265 | 265 | |
| 266 | - $sector_id = (int)$params['sector_id']; |
|
| 267 | - $subactividad_id = (int)$params['subactividad_id']; |
|
| 266 | + $sector_id = (int) $params['sector_id']; |
|
| 267 | + $subactividad_id = (int) $params['subactividad_id']; |
|
| 268 | 268 | |
| 269 | 269 | $response = []; |
| 270 | 270 | |
@@ -314,7 +314,7 @@ discard block |
||
| 314 | 314 | $arrColores = array(); |
| 315 | 315 | |
| 316 | 316 | |
| 317 | - for ($i=1990;$i<=2014;$i++) { |
|
| 317 | + for ($i = 1990; $i <= 2014; $i++) { |
|
| 318 | 318 | $arrAnos[] = $i; |
| 319 | 319 | } |
| 320 | 320 | |
@@ -10,8 +10,8 @@ |
||
| 10 | 10 | */ |
| 11 | 11 | class DistributionReportTransactionScript |
| 12 | 12 | { |
| 13 | - public function __construct() |
|
| 14 | - { |
|
| 15 | - # code... |
|
| 16 | - } |
|
| 13 | + public function __construct() |
|
| 14 | + { |
|
| 15 | + # code... |
|
| 16 | + } |
|
| 17 | 17 | } |
@@ -4,46 +4,46 @@ |
||
| 4 | 4 | |
| 5 | 5 | final class Utils |
| 6 | 6 | { |
| 7 | - public static function returnSectorGas($arr, $sector, $gas) |
|
| 8 | - { |
|
| 9 | - foreach ($arr as $val) { |
|
| 10 | - if ($val['sector'] == $sector && $val['gas'] == $gas) { |
|
| 11 | - return $val['total']; |
|
| 12 | - } |
|
| 13 | - } |
|
| 14 | - return 0; |
|
| 15 | - } |
|
| 7 | + public static function returnSectorGas($arr, $sector, $gas) |
|
| 8 | + { |
|
| 9 | + foreach ($arr as $val) { |
|
| 10 | + if ($val['sector'] == $sector && $val['gas'] == $gas) { |
|
| 11 | + return $val['total']; |
|
| 12 | + } |
|
| 13 | + } |
|
| 14 | + return 0; |
|
| 15 | + } |
|
| 16 | 16 | |
| 17 | - public static function returnSectorAno($arr, $sector, $ano) |
|
| 18 | - { |
|
| 19 | - while ($val = $arr->next()) { |
|
| 20 | - if ($val['sector'] == $sector && $val['ano'] == $ano) { |
|
| 21 | - return $val['total']; |
|
| 22 | - } |
|
| 23 | - } |
|
| 17 | + public static function returnSectorAno($arr, $sector, $ano) |
|
| 18 | + { |
|
| 19 | + while ($val = $arr->next()) { |
|
| 20 | + if ($val['sector'] == $sector && $val['ano'] == $ano) { |
|
| 21 | + return $val['total']; |
|
| 22 | + } |
|
| 23 | + } |
|
| 24 | 24 | |
| 25 | - return 0; |
|
| 26 | - } |
|
| 25 | + return 0; |
|
| 26 | + } |
|
| 27 | 27 | |
| 28 | - public static function returnSubactividadAno($arr, $subactividad, $ano) |
|
| 29 | - { |
|
| 30 | - foreach ($arr as $val) { |
|
| 31 | - if (trim($val['nombre']) == trim($subactividad) && $val['ano'] == $ano) { |
|
| 32 | - return $val['valor']; |
|
| 33 | - } |
|
| 34 | - } |
|
| 28 | + public static function returnSubactividadAno($arr, $subactividad, $ano) |
|
| 29 | + { |
|
| 30 | + foreach ($arr as $val) { |
|
| 31 | + if (trim($val['nombre']) == trim($subactividad) && $val['ano'] == $ano) { |
|
| 32 | + return $val['valor']; |
|
| 33 | + } |
|
| 34 | + } |
|
| 35 | 35 | |
| 36 | - return 0; |
|
| 37 | - } |
|
| 36 | + return 0; |
|
| 37 | + } |
|
| 38 | 38 | |
| 39 | - public static function returnCategoriaAno($arr, $categoria, $ano) |
|
| 40 | - { |
|
| 41 | - while ($val = $arr->next()) { |
|
| 42 | - if (trim($val['nombre']) == trim($categoria) && $val['ano'] == $ano) { |
|
| 43 | - return $val['valor']; |
|
| 44 | - } |
|
| 45 | - } |
|
| 39 | + public static function returnCategoriaAno($arr, $categoria, $ano) |
|
| 40 | + { |
|
| 41 | + while ($val = $arr->next()) { |
|
| 42 | + if (trim($val['nombre']) == trim($categoria) && $val['ano'] == $ano) { |
|
| 43 | + return $val['valor']; |
|
| 44 | + } |
|
| 45 | + } |
|
| 46 | 46 | |
| 47 | - return 0; |
|
| 48 | - } |
|
| 47 | + return 0; |
|
| 48 | + } |
|
| 49 | 49 | } |
@@ -9,10 +9,10 @@ |
||
| 9 | 9 | |
| 10 | 10 | class Module |
| 11 | 11 | { |
| 12 | - const VERSION = '3.0.2'; |
|
| 12 | + const VERSION = '3.0.2'; |
|
| 13 | 13 | |
| 14 | - public function getConfig() |
|
| 15 | - { |
|
| 16 | - return include __DIR__ . '/../config/module.config.php'; |
|
| 17 | - } |
|
| 14 | + public function getConfig() |
|
| 15 | + { |
|
| 16 | + return include __DIR__ . '/../config/module.config.php'; |
|
| 17 | + } |
|
| 18 | 18 | } |
@@ -13,6 +13,6 @@ |
||
| 13 | 13 | |
| 14 | 14 | public function getConfig() |
| 15 | 15 | { |
| 16 | - return include __DIR__ . '/../config/module.config.php'; |
|
| 16 | + return include __DIR__.'/../config/module.config.php'; |
|
| 17 | 17 | } |
| 18 | 18 | } |
@@ -12,10 +12,10 @@ |
||
| 12 | 12 | */ |
| 13 | 13 | class EvolutionReportControllerFactory implements FactoryInterface |
| 14 | 14 | { |
| 15 | - public function __invoke(ContainerInterface $container, $requestedName, array $options = null) |
|
| 16 | - { |
|
| 17 | - return new EvolutionReportController( |
|
| 18 | - $container->get(AdapterInterface::class) |
|
| 19 | - ); |
|
| 20 | - } |
|
| 15 | + public function __invoke(ContainerInterface $container, $requestedName, array $options = null) |
|
| 16 | + { |
|
| 17 | + return new EvolutionReportController( |
|
| 18 | + $container->get(AdapterInterface::class) |
|
| 19 | + ); |
|
| 20 | + } |
|
| 21 | 21 | } |