public function listadodataAction() { try { $EntityManagerPlugin = $this->EntityManagerPlugin(); $GrupoPrecioCabBO = new GrupoPrecioCabBO(); $GrupoPrecioCabBO->setEntityManager($EntityManagerPlugin->getEntityManager()); $SesionUsuarioPlugin = $this->SesionUsuarioPlugin(); $SesionUsuarioPlugin->isLoginAdmin(); $request = $this->getRequest(); $grupo_precio_cab_id = $request->getQuery('grupo_precio_cab_id'); $tipo_precio = $request->getQuery('tipo_precio'); $color_ventas_id = $request->getQuery('color_ventas_id', ""); $page = $request->getQuery('page'); $limit = $request->getQuery('rows'); $sidx = $request->getQuery('sidx', 1); $sord = $request->getQuery('sord', ""); $GrupoPrecioCabBO->setPage($page); $GrupoPrecioCabBO->setLimit($limit); $GrupoPrecioCabBO->setSidx($sidx); $GrupoPrecioCabBO->setSord($sord); $condiciones = array("grupo_precio_cab_id" => $grupo_precio_cab_id, "color_ventas_id" => $color_ventas_id); $result = $GrupoPrecioCabBO->listado($tipo_precio, $condiciones); $response = new \stdClass(); $i = 0; if ($result) { foreach ($result as $row) { $response->rows[$i] = $row; $i++; } //end foreach } //end if $tot_reg = $i; $response->total = ceil($tot_reg / $limit); $response->page = $page; $response->records = $tot_reg; $json = new JsonModel(get_object_vars($response)); return $json; } catch (\Exception $e) { $excepcion_msg = utf8_encode($this->ExcepcionPlugin()->getMessageFormat($e)); $response = $this->getResponse(); $response->setStatusCode(500); $response->setContent($excepcion_msg); return $response; } }