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;
     }
 }
 public function getcomboPrecioAction()
 {
     try {
         $EntityManagerPlugin = $this->EntityManagerPlugin();
         $GrupoPrecioCabBO = new GrupoPrecioCabBO();
         $GrupoPrecioCabBO->setEntityManager($EntityManagerPlugin->getEntityManager());
         $SesionUsuarioPlugin = $this->SesionUsuarioPlugin();
         $SesionUsuarioPlugin->isLoginVentas();
         //Solo el Vendedor Puede hacer este procedimiento
         $body = $this->getRequest()->getContent();
         $json = json_decode($body, true);
         //var_dump($json); exit;
         //$texto_primer_elemento		= null;
         $grupo_precio_cab_id = null;
         $inventario_id = $json['inventario_id'];
         $calidad_id = $json['calidad_id'];
         $opciones_precio = $GrupoPrecioCabBO->getComboPorInventario($grupo_precio_cab_id, $inventario_id, $calidad_id);
         $response = new \stdClass();
         $response->opciones_precio = $opciones_precio;
         $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;
     }
 }
 public function getcombosofertasAction()
 {
     try {
         $EntityManagerPlugin = $this->EntityManagerPlugin();
         $config = $this->getServiceLocator()->get('Config');
         $GrupoPrecioCabBO = new GrupoPrecioCabBO();
         $ProductoBO = new ProductoBO();
         $GradoBO = new GradoBO();
         $SesionUsuarioPlugin = $this->SesionUsuarioPlugin();
         $SesionUsuarioPlugin->isLoginAdmin();
         $GrupoPrecioCabBO->setEntityManager($EntityManagerPlugin->getEntityManager());
         $ProductoBO->setEntityManager($EntityManagerPlugin->getEntityManager());
         $GradoBO->setEntityManager($EntityManagerPlugin->getEntityManager());
         $body = $this->getRequest()->getContent();
         $json = json_decode($body, true);
         $grupo_precio_cab_id = $json['grupo_precio_cab_id'];
         $producto_combo_id = $json['producto_combo_id'];
         $variedad_id = null;
         $grado_id = null;
         $producto_combo_1er_elemento = $json['producto_combo_1er_elemento'];
         $producto_opciones = $ProductoBO->getComboProductoId($producto_combo_id, $producto_combo_1er_elemento);
         $variedad_opciones = $GrupoPrecioCabBO->getComboVariedad($producto_combo_id, $variedad_id, $grupo_precio_cab_id);
         $grado_opciones = $GradoBO->getCombo($grado_id);
         $response = new \stdClass();
         $response->producto_opciones = $producto_opciones;
         $response->variedad_opciones = $variedad_opciones;
         $response->grado_opciones = $grado_opciones;
         $response->respuesta_code = 'OK';
         $response->validacion_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;
     }
 }