public function execute()
 {
     try {
         $where = null;
         if (request::getInstance()->hasRequest('filter')) {
             $report = request::getInstance()->getPost('filter');
             if (isset($report['fecha_inicio']) and $report['fecha_inicio'] !== null and $report['fecha_inicio'] !== '' and isset($report['fecha_fin']) and $report['fecha_fin'] !== null and $report['fecha_fin'] !== '') {
                 $where[salidaBodegaTableClass::getNameTable() . '.' . salidaBodegaTableClass::FECHA] = array(date(config::getFormatTimestamp(), strtotime($report['fecha_inicio'] . ' 00.00.00')), date(config::getFormatTimestamp(), strtotime($report['fecha_fin'] . ' 23.59.59')));
             }
             //close if
             if (isset($report['empleado']) and $report['empleado'] !== null and $report['empleado'] !== '') {
                 $where[salidaBodegaTableClass::getNameTable() . '.' . salidaBodegaTableClass::EMPLEADO] = $report['empleado'];
             }
         }
         $fields = array(salidaBodegaTableClass::ID, salidaBodegaTableClass::FECHA, salidaBodegaTableClass::EMPLEADO);
         $fieldsEmpleado = array(empleadoTableClass::ID, empleadoTableClass::NOMBRE);
         $fJoin1 = salidaBodegaTableClass::EMPLEADO;
         $fJoin2 = empleadoTableClass::ID;
         $orderBy = array(salidaBodegaTableClass::ID);
         $this->mensaje = "Informe de Salidas de Bodega";
         $this->objSalida = salidaBodegaTableClass::getAllJoin($fields, $fieldsEmpleado, null, null, $fJoin1, $fJoin2, null, null, null, null, true, $orderBy, 'ASC', null, null, $where);
         log::register(i18n::__('reporte'), salidaBodegaTableClass::getNameTable());
         $this->defineView('index', 'salidaBodega', session::getInstance()->getFormatOutput());
     } catch (PDOException $exc) {
         session::getInstance()->setFlash('exc', $exc);
         routing::getInstance()->forward('shfSecurity', 'exception');
     }
 }
 public function execute()
 {
     try {
         $where = null;
         if (request::getInstance()->hasPost('filter')) {
             $filter = request::getInstance()->getPost('filter');
             if (isset($filter['fecha_fin']) and $filter['fecha_fin'] !== null and $filter['fecha_fin'] !== '' and isset($filter['fecha_inicio']) and $filter['fecha_inicio'] !== null and $filter['fecha_inicio'] !== '') {
                 $where[salidaBodegaTableClass::getNameTable() . '.' . salidaBodegaTableClass::FECHA] = array(date(config::getFormatTimestamp(), strtotime($filter['fecha_inicio'] . ' 00.00.00')), date(config::getFormatTimestamp(), strtotime($filter['fecha_fin'] . ' 23.59.59')));
             }
             if (isset($filter['empleado']) and $filter['empleado'] !== null and $filter['empleado'] !== '') {
                 $where[salidaBodegaTableClass::EMPLEADO] = $filter['empleado'];
             }
             //close if
             session::getInstance()->setAttribute('salidaFilter', $where);
         } elseif (session::getInstance()->hasAttribute('salidaFilter')) {
             $where = session::getInstance()->getAttribute('salidaFilter');
         }
         //close if
         $fieldsSalida = array(salidaBodegaTableClass::EMPLEADO, salidaBodegaTableClass::ESTADO, salidaBodegaTableClass::FECHA, salidaBodegaTableClass::ID);
         $fieldsEmpleado = array(empleadoTableClass::NOMBRE);
         $fieldsEmpleado2 = array(empleadoTableClass::NOMBRE, empleadoTableClass::ID);
         $fJoin1 = salidaBodegaTableClass::EMPLEADO;
         $fJoin2 = empleadoTableClass::ID;
         $orderBy = array(salidaBodegaTableClass::ID);
         $fieldsInsumo = array(insumoTableClass::ID, insumoTableClass::NOMBRE);
         $fieldsTipoInsumo = array(tipoInsumoTableClass::ID, tipoInsumoTableClass::DESCRIPCION);
         $fieldsLote = array(loteTableClass::ID, loteTableClass::NOMBRE);
         $page = 0;
         if (request::getInstance()->hasGet('page')) {
             $page = request::getInstance()->getGet('page') - 1;
             $page = $page * config::getRowGrid();
         }
         //close if
         $f = array(salidaBodegaTableClass::ID);
         $lines = config::getRowGrid();
         $this->cntPages = salidaBodegaTableClass::getAllCount($f, true, $lines, $where);
         if (request::getInstance()->hasGet('page')) {
             $this->page = request::getInstance()->getGet('page');
         } else {
             $this->page = $page;
         }
         //close if
         $this->objTipoInsumo = tipoInsumoTableClass::getAll($fieldsTipoInsumo, false);
         $this->objInsumo = insumoTableClass::getAll($fieldsInsumo, true);
         $this->objLote = loteTableClass::getAll($fieldsLote, true);
         $this->objEmpleado = empleadoTableClass::getAll($fieldsEmpleado2, false);
         $this->objSalidaBodega = salidaBodegaTableClass::getAllJoin($fieldsSalida, $fieldsEmpleado, null, null, $fJoin1, $fJoin2, null, null, null, null, true, $orderBy, 'ASC', config::getRowGrid(), $page, $where);
         log::register(i18n::__('ver1', null, 'bodega'), salidaBodegaTableClass::getNameTable());
         $this->defineView('index', 'salidaBodega', session::getInstance()->getFormatOutput());
     } catch (PDOException $exc) {
         session::getInstance()->setFlash('exc', $exc);
         routing::getInstance()->forward('shfSecurity', 'exception');
     }
 }
 public function execute()
 {
     try {
         $where = null;
         $idVacunacion = request::getInstance()->getRequest(salidaBodegaTableClass::ID);
         if (request::getInstance()->hasRequest('report')) {
             $report = request::getInstance()->getPost('report');
             //                if (isset($report['fecha']) and $report['fecha'] !== null and $report['fecha'] !== '') {
             //                    $where[detalleVacunacionTableClass::FECHA] = $report['fecha'];
             //                }//close if
             if (isset($report['tipoInsumo']) and $report['tipoInsumo'] !== null and $report['tipoInsumo'] !== '') {
                 $where[detalleSalidaBodegaTableClass::TIPO_INSUMO] = $report['tipoInsumo'];
             }
             //close if
             if (isset($report['Insumo']) and $report['Insumo'] !== null and $report['Insumo'] !== '') {
                 $where[detalleSalidaBodegaTableClass::ID_INSUMO] = $report['Insumo'];
             }
             //close if
             if (isset($report['cantidad']) and $report['cantidad'] !== null and $report['cantidad'] !== '') {
                 $where[detalleSalidaBodegaTableClass::getNameTable() . '.' . detalleSalidaBodegaTableClass::CANDITDAD] = $report['cantidad'];
             }
             //close if
         }
         //close if
         $where[detalleSalidaBodegaTableClass::ID_SALIDA] = $idVacunacion;
         $fieldsDetalleSalidaBodega = array(detalleSalidaBodegaTableClass::ID, detalleSalidaBodegaTableClass::CANDITDAD);
         $fieldsS = array(salidaBodegaTableClass::ID);
         $fieldsTipo = array(tipoInsumoTableClass::DESCRIPCION);
         $fieldsInsumo = array(insumoTableClass::NOMBRE);
         $fJoin1 = detalleSalidaBodegaTableClass::ID_SALIDA;
         $fJoin2 = salidaBodegaTableClass::ID;
         $fJoin3 = detalleSalidaBodegaTableClass::TIPO_INSUMO;
         $fJoin4 = tipoInsumoTableClass::ID;
         $fJoin5 = detalleSalidaBodegaTableClass::ID_INSUMO;
         $fJoin6 = insumoTableClass::ID;
         $fieldsSalida = array(salidaBodegaTableClass::ID, salidaBodegaTableClass::FECHA);
         $fieldsEmpleado = array(empleadoTableClass::NOMBRE);
         $fJoinVacunacion1 = salidaBodegaTableClass::EMPLEADO;
         $fJoinVacunacion2 = empleadoTableClass::ID;
         $whereVacunacion = array(salidaBodegaTableClass::getNameTable() . "." . salidaBodegaTableClass::ID => $idVacunacion);
         $orderBy = array(detalleSalidaBodegaTableClass::ID);
         $this->objDetalleSalidaBodega = detalleSalidaBodegaTableClass::getAllJoin($fieldsDetalleSalidaBodega, $fieldsS, $fieldsTipo, $fieldsInsumo, $fJoin1, $fJoin2, $fJoin3, $fJoin4, $fJoin5, $fJoin6, true, $orderBy, 'ASC', $where);
         $this->objSalidaBodega = salidaBodegaTableClass::getAllJoin($fieldsSalida, $fieldsEmpleado, null, null, $fJoinVacunacion1, $fJoinVacunacion2, null, null, null, null, true, null, null, null, null, $whereVacunacion);
         $this->mensajeDetalle = "Informe de Detalles de Salida de Bodega";
         log::register(i18n::__('reporte'), detalleSalidaBodegaTableClass::getNameTable());
         $this->defineView('reportDetalle', 'bodega', session::getInstance()->getFormatOutput());
     } catch (PDOException $exc) {
         session::getInstance()->setFlash('exc', $exc);
         routing::getInstance()->forward('shfSecurity', 'exception');
     }
 }
 public function execute()
 {
     try {
         $where = null;
         //      if (request::getInstance()->hasRequest(entradaBodegaTableClass::ID)) {
         $idSalida = request::getInstance()->getRequest(detalleSalidaBodegaTableClass::ID);
         $where = null;
         if (request::getInstance()->hasPost('filter')) {
             $filter = request::getInstance()->getPost('filter');
             if (isset($filter['tipoInsumo']) and $filter['tipoInsumo'] !== null and $filter['tipoInsumo'] !== '') {
                 $where[detalleEntradaBodegaTableClass::TIPO_INSUMO] = $filter['tipoInsumo'];
             }
             //close if
             if (isset($filter['Insumo']) and $filter['Insumo'] !== null and $filter['Insumo'] !== '') {
                 $where[detalleEntradaBodegaTableClass::ID_INSUMO] = $filter['Insumo'];
             }
             //close if
             if (isset($filter['cantidad']) and $filter['cantidad'] !== null and $filter['cantidad'] !== '') {
                 $where[detalleEntradaBodegaTableClass::CANDITDAD] = $filter['cantidad'];
             }
             //close if
             $where[detalleSalidaBodegaTableClass::ID_SALIDA] = $idSalida;
             session::getInstance()->setAttribute('detalleSalida', $where);
         } elseif (session::getInstance()->hasAttribute('detalleSalida')) {
             $where = session::getInstance()->getAttribute('detalleSalida');
         } else {
             $where = array(detalleSalidaBodegaTableClass::ID_SALIDA => $idSalida);
         }
         //close if
         $fieldsSalida = array(salidaBodegaTableClass::ID, salidaBodegaTableClass::FECHA);
         $fieldsEmpleado = array(empleadoTableClass::NOMBRE);
         $whereSalida = array(salidaBodegaTableClass::getNameTable() . '.' . salidaBodegaTableClass::ID => $idSalida);
         $fJoinEntrada1 = salidaBodegaTableClass::EMPLEADO;
         $fJoinEntrada2 = empleadoTableClass::ID;
         $page = 0;
         if (request::getInstance()->hasGet('page')) {
             $page = request::getInstance()->getGet('page') - 1;
             $page = $page * config::getRowGrid();
         }
         //close if
         $f = array(detalleSalidaBodegaTableClass::ID);
         $whereCnt = array(detalleSalidaBodegaTableClass::ID_SALIDA => $idSalida);
         $lines = config::getRowGrid();
         $fieldsDetalleSalida = array(detalleSalidaBodegaTableClass::ID, detalleSalidaBodegaTableClass::CANDITDAD, detalleSalidaBodegaTableClass::ID_SALIDA);
         $fieldsDetalleInsumo = array(insumoTableClass::NOMBRE);
         $fieldsDetalleTipoInsumo = array(tipoInsumoTableClass::DESCRIPCION);
         $fieldsL = array(loteTableClass::NOMBRE);
         $fJoin1 = detalleSalidaBodegaTableClass::ID_INSUMO;
         $fJoin2 = insumoTableClass::ID;
         $fJoin3 = detalleSalidaBodegaTableClass::TIPO_INSUMO;
         $fJoin4 = tipoInsumoTableClass::ID;
         $fJoin5 = detalleSalidaBodegaTableClass::LOTE;
         $fJoin6 = loteTableClass::ID;
         $fieldsInsumo = array(insumoTableClass::ID, insumoTableClass::NOMBRE);
         $fieldsTipoInsumo = array(tipoInsumoTableClass::ID, tipoInsumoTableClass::DESCRIPCION);
         $fieldsLote = array(loteTableClass::ID, loteTableClass::NOMBRE);
         $this->objTipoInsumo = tipoInsumoTableClass::getAll($fieldsTipoInsumo, false);
         $this->objInsumo = insumoTableClass::getAll($fieldsInsumo, true);
         $this->objLote = loteTableClass::getAll($fieldsLote, true);
         $this->cntPages = detalleSalidaBodegaTableClass::getAllCount($f, true, $lines, $whereCnt);
         $this->objSalida = salidaBodegaTableClass::getAllJoin($fieldsSalida, $fieldsEmpleado, null, null, $fJoinEntrada1, $fJoinEntrada2, null, null, null, null, true, null, null, config::getRowGrid(), $page, $whereSalida);
         $this->objDetalleSalida = detalleSalidaBodegaTableClass::getAllJoin($fieldsDetalleSalida, $fieldsDetalleInsumo, $fieldsDetalleTipoInsumo, $fieldsL, $fJoin1, $fJoin2, $fJoin3, $fJoin4, $fJoin5, $fJoin6, false, null, 'ASC', config::getRowGrid(), $page, $where);
         log::register(i18n::__('ver3', null, 'bodega'), detalleSalidaBodegaTableClass::getNameTable());
         $this->defineView('view', 'salidaBodega', session::getInstance()->getFormatOutput());
         //      } else {
         //        session::getInstance()->setError('pailas');
         //        routing::getInstance()->redirect('vacunacion', 'indexVacunacion');
         //      }//close if
     } catch (PDOException $exc) {
         session::getInstance()->setFlash('exc', $exc);
         routing::getInstance()->forward('shfSecurity', 'exception');
     }
 }