public function initcontrolsAction() { try { $EntityManagerPlugin = $this->EntityManagerPlugin(); $GrupoPrecioCabBO = new GrupoPrecioCabBO(); $ProductoBO = new ProductoBO(); $ColorVentasBO = new ColorVentasBO(); $GrupoPrecioCabBO->setEntityManager($EntityManagerPlugin->getEntityManager()); $ProductoBO->setEntityManager($EntityManagerPlugin->getEntityManager()); $ColorVentasBO->setEntityManager($EntityManagerPlugin->getEntityManager()); $SesionUsuarioPlugin = $this->SesionUsuarioPlugin(); $SesionUsuarioPlugin->isLoginAdmin(); $body = $this->getRequest()->getContent(); $json = json_decode($body, true); $opcion = $json['opcion']; switch ($opcion) { case 'panel-precio': $grupo_dispo_1er_elemento = $json['grupo_dispo_1er_elemento']; $producto_1er_elemento = $json['producto_1er_elemento']; $color_ventas_1er_elemento = $json['color_ventas_1er_elemento']; $tipo_precio_1er_elemento = ''; $grupo_precio_cab_id = null; $producto_id = null; $variedad_id = null; $grado_id = null; $color_ventas_id = null; $grupo_precio_opciones = $GrupoPrecioCabBO->getComboGrupoPrecio($grupo_precio_cab_id, $grupo_dispo_1er_elemento); $producto_opciones = $ProductoBO->getComboProductoId($producto_id, $producto_1er_elemento); $tipo_precio_opciones = $GrupoPrecioCabBO->getComboTipoPrecio('', $tipo_precio_1er_elemento); $color_ventas_opciones = $ColorVentasBO->getCombo($color_ventas_id, $color_ventas_1er_elemento); //$variedad_opciones = $VariedadBO->getCombo($variedad_id); $response = new \stdClass(); $response->grupo_precio_opciones = $grupo_precio_opciones; $response->tipo_precio_opciones = $tipo_precio_opciones; $response->color_ventas_opciones = $color_ventas_opciones; $response->respuesta_code = 'OK'; break; } //end switch $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; } }
function getcomboAction() { try { $EntityManagerPlugin = $this->EntityManagerPlugin(); $GrupoPrecioCabBO = new GrupoPrecioCabBO(); $GrupoPrecioCabBO->setEntityManager($EntityManagerPlugin->getEntityManager()); $SesionUsuarioPlugin = $this->SesionUsuarioPlugin(); $SesionUsuarioPlugin->isLoginClienteVendedor(); $body = $this->getRequest()->getContent(); $json = json_decode($body, true); //var_dump($json); exit; $texto_primer_elemento = $json['texto_primer_elemento']; $grupo_precio_cab_id = $json['grupo_precio_cab_id']; $cliente_id = $SesionUsuarioPlugin->getUserClienteId(); $opciones = $GrupoPrecioCabBO->getComboGrupoPrecio($grupo_precio_cab_id, $texto_primer_elemento); $response = new \stdClass(); $response->opciones = $opciones; $response->respuesta_code = 'OK'; $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; } }