public function mantenimientoAction()
 {
     try {
         $EntityManagerPlugin = $this->EntityManagerPlugin();
         $viewModel = new ViewModel();
         $TipoCajaBO = new TipoCajaBO();
         $TipoCajaBO->setEntityManager($EntityManagerPlugin->getEntityManager());
         //Controla el acceso a la informacion, solo accedera si es administrador
         $SesionUsuarioPlugin = $this->SesionUsuarioPlugin();
         $respuesta = $SesionUsuarioPlugin->isLoginAdmin();
         if ($respuesta == false) {
             return false;
         }
         $result = $TipoCajaBO->consultarTodos();
         $viewModel->result = $result;
         $this->layout($SesionUsuarioPlugin->getUserLayout());
         $viewModel->setTemplate('dispo/prueba/mantenimiento.phtml');
         return $viewModel;
     } 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 getComboDataGridAction()
 {
     try {
         $EntityManagerPlugin = $this->EntityManagerPlugin();
         $TipoCajaBO = new TipoCajaBO();
         $TipoCajaBO->setEntityManager($EntityManagerPlugin->getEntityManager());
         $request = $this->getRequest();
         $opciones = utf8_encode($TipoCajaBO->getComboDataGrid());
         $response = $this->getResponse();
         $response->setContent($opciones);
         return $response;
     } 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 listadodetalledispoAction()
 {
     try {
         $EntityManagerPlugin = $this->EntityManagerPlugin();
         $SesionUsuarioPlugin = $this->SesionUsuarioPlugin();
         $SesionUsuarioPlugin->isLoginClienteVendedor();
         $DispoBO = new DispoBO();
         $TipoCajaBO = new TipoCajaBO();
         $DispoBO->setEntityManager($EntityManagerPlugin->getEntityManager());
         $TipoCajaBO->setEntityManager($EntityManagerPlugin->getEntityManager());
         //Se pregunta si se ha seleccionado una marcacion y una agencia, caso contrario lo rutea
         //para obligarlo a seleccionar
         $marcacion_id = $SesionUsuarioPlugin->getClienteSeleccionMarcacionSec();
         $agencia_id = $SesionUsuarioPlugin->getClienteSeleccionAgenciaId();
         //Se pregunta si ya existe una marcacion y agencia seleccionada por el cliente
         //en caso de no estar, se lo dirige a la pantalla para que lo seleccione
         /*			if ((empty($marcacion_id))||(empty($agencia_id)))
         			{
         				return $this->redirect()->toRoute('dispo-disponibilidad-seleccionar-marcacion-agencia');
         			}//end if
         */
         //Se consulta la dispo, considerando los criterios de busqueda
         $cliente_id = $SesionUsuarioPlugin->getUserClienteId();
         $usuario_id = $SesionUsuarioPlugin->getClienteUsuarioId();
         $marcacion_sec = $SesionUsuarioPlugin->getClienteSeleccionMarcacionSec();
         $tipo_caja_id = $SesionUsuarioPlugin->getMarcacionTipoCajaDefaultId();
         $result_cajas = $TipoCajaBO->getArrayIndexado();
         $result = $DispoBO->getDispo($cliente_id, $usuario_id, $marcacion_sec, $tipo_caja_id);
         //var_dump($result);
         $viewModel = new ViewModel();
         $viewModel->respuesta_dispo_code = $result['respuesta_code'];
         $viewModel->respuesta_dispo_msg = $result['respuesta_msg'];
         $viewModel->result_cajas = $result_cajas;
         if (!empty($result['result_dispo'])) {
             $viewModel->result = $result['result_dispo'];
         } else {
             $viewModel->result = null;
         }
         //end if
         $viewModel->setTerminal(true);
         $viewModel->setTemplate('dispo/disponibilidad/listado_detalle_dispo.phtml');
         return $viewModel;
     } 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 initcontrolsAction()
 {
     try {
         $EntityManagerPlugin = $this->EntityManagerPlugin();
         $SesionUsuarioPlugin = $this->SesionUsuarioPlugin();
         $SesionUsuarioPlugin->isLoginAdmin();
         $body = $this->getRequest()->getContent();
         $json = json_decode($body, true);
         $opcion = $json['opcion'];
         switch ($opcion) {
             case 'mantenimiento':
                 $InventarioBO = new InventarioBO();
                 $TipoCajaBO = new TipoCajaBO();
                 $InventarioBO->setEntityManager($EntityManagerPlugin->getEntityManager());
                 $TipoCajaBO->setEntityManager($EntityManagerPlugin->getEntityManager());
                 $inventario_1er_elemento = $json['inventario_1er_elemento'];
                 $inventario_id = null;
                 $tipo_caja_1er_elemento = $json['tipo_caja_1er_elemento'];
                 $tipo_caja_id = null;
                 $inventario_opciones = $InventarioBO->getCombo($inventario_id, $inventario_1er_elemento);
                 $tipocaja_opciones = $TipoCajaBO->getCombo($tipo_caja_id, $tipo_caja_1er_elemento);
                 $response = new \stdClass();
                 $response->inventario_opciones = $inventario_opciones;
                 $response->tipocaja_opciones = $tipocaja_opciones;
                 $response->respuesta_code = 'OK';
                 break;
             case 'actualizacion-masiva':
                 $TipoCajaMatrizBO = new TipoCajaMatrizBO();
                 $GradoBO = new GradoBO();
                 $TipoCajaMatrizBO->setEntityManager($EntityManagerPlugin->getEntityManager());
                 $GradoBO->setEntityManager($EntityManagerPlugin->getEntityManager());
                 $variedad_1er_elemento = $json['variedad_1er_elemento'];
                 $variedad_id = null;
                 $grado_1er_elemento = $json['grado_1er_elemento'];
                 $grado_id = null;
                 $inventario_id = $json['inventario_id'];
                 $tipo_caja_id = $json['tipo_caja_id'];
                 //Se debe de obtener las variedades de acuerdo al tipo de inventario  $inventario_id, $variedad_id, $variedad_1er_elemento
                 $variedad_opciones = $TipoCajaMatrizBO->getComboVariedad($tipo_caja_id, $inventario_id, $variedad_id, $variedad_1er_elemento);
                 $grado_opciones = $GradoBO->getCombo($grado_id, $grado_1er_elemento);
                 $response = new \stdClass();
                 $response->variedad_opciones = $variedad_opciones;
                 $response->grado_opciones = $grado_opciones;
                 $response->respuesta_code = 'OK';
                 break;
             case 'caja-matriz':
                 $TipoCajaBO = new TipoCajaBO();
                 $InventarioBO = new InventarioBO();
                 $TamanoBunchBO = new TamanoBunchBO();
                 $TipoCajaBO->setEntityManager($EntityManagerPlugin->getEntityManager());
                 $InventarioBO->setEntityManager($EntityManagerPlugin->getEntityManager());
                 $TamanoBunchBO->setEntityManager($EntityManagerPlugin->getEntityManager());
                 $tipo_caja_id = $json['tipo_caja_id'];
                 $inventario_id = $json['inventario_id'];
                 $tamano_bunch_id = $json['tamano_bunch_id'];
                 $inventario_opciones = $InventarioBO->getCombo($inventario_id);
                 $tipocaja_opciones = $TipoCajaBO->getCombo($tipo_caja_id);
                 $tamano_bunch_opciones = $TamanoBunchBO->getCombo($tamano_bunch_id);
                 $response = new \stdClass();
                 $response->tipocaja_opciones = $tipocaja_opciones;
                 $response->inventario_opciones = $inventario_opciones;
                 $response->tamano_bunch_opciones = $tamano_bunch_opciones;
                 $response->respuesta_code = 'OK';
         }
         //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 getCombosDataGridAction()
 {
     try {
         $EntityManagerPlugin = $this->EntityManagerPlugin();
         $TipoCajaBO = new TipoCajaBO();
         $InventarioBO = new InventarioBO();
         $GradoBO = new GradoBO();
         $TipoCajaBO->setEntityManager($EntityManagerPlugin->getEntityManager());
         $InventarioBO->setEntityManager($EntityManagerPlugin->getEntityManager());
         $GradoBO->setEntityManager($EntityManagerPlugin->getEntityManager());
         $request = $this->getRequest();
         $opciones_tipo_caja = utf8_encode($TipoCajaBO->getComboDataGrid());
         $opciones_inventario = utf8_encode($InventarioBO->getComboDataGrid());
         $opciones_grado = utf8_encode($GradoBO->getComboDataGrid());
         $response = new \stdClass();
         $response->respuesta_code = 'OK';
         $response->opciones_tipo_caja = $opciones_tipo_caja;
         $response->opciones_inventario = $opciones_inventario;
         $response->opciones_grado = $opciones_grado;
         $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 consultardataAction()
 {
     try {
         $SesionUsuarioPlugin = $this->SesionUsuarioPlugin();
         $EntityManagerPlugin = $this->EntityManagerPlugin();
         $MarcacionBO = new MarcacionBO();
         $PaisBO = new PaisBO();
         $TipoCajaBO = new TipoCajaBO();
         $MarcacionBO->setEntityManager($EntityManagerPlugin->getEntityManager());
         $PaisBO->setEntityManager($EntityManagerPlugin->getEntityManager());
         $TipoCajaBO->setEntityManager($EntityManagerPlugin->getEntityManager());
         $respuesta = $SesionUsuarioPlugin->isLoginAdmin();
         if ($respuesta == false) {
             return false;
         }
         $body = $this->getRequest()->getContent();
         $json = json_decode($body, true);
         $marcacion_sec = $json['marcacion_sec'];
         $row = $MarcacionBO->consultar($marcacion_sec, \Application\Constants\ResultType::MATRIZ);
         $response = new \stdClass();
         $response->row = $row;
         $response->cbo_pais_id = $PaisBO->getComboPais($row['pais_id'], "<Seleccione>");
         $response->cbo_tipo_caja = $TipoCajaBO->getCombo($row['tipo_caja_default_id'], "<Seleccione>");
         $response->cbo_estado = \Application\Classes\ComboGeneral::getComboEstado($row['estado'], "");
         $response->respuesta_code = 'OK';
         $response->respuesta_mensaje = '';
         $json = new JsonModel(get_object_vars($response));
         return $json;
         //false
     } catch (\Exception $e) {
         $excepcion_msg = utf8_encode($this->ExcepcionPlugin()->getMessageFormat($e));
         $response = $this->getResponse();
         $response->setStatusCode(500);
         $response->setContent($excepcion_msg);
         return $response;
     }
 }