public function execute() { try { if (request::getInstance()->isMethod('POST')) { $id = request::getInstance()->getPost(entradaBodegaTableClass::getNameField(entradaBodegaTableClass::ID, true)); $fecha = request::getInstance()->getPost(entradaBodegaTableClass::getNameField(entradaBodegaTableClass::FECHA, true)); $empleado = request::getInstance()->getPost(entradaBodegaTableClass::getNameField(entradaBodegaTableClass::EMPLEADO, true)); entradaBodegaTableClass::validateUpdate($fecha, $empleado); $ids = array(entradaBodegaTableClass::ID => $id); $data = array(entradaBodegaTableClass::FECHA => $fecha, entradaBodegaTableClass::EMPLEADO => $empleado); entradaBodegaTableClass::update($ids, $data); session::getInstance()->setSuccess(i18n::__('succesUpdate', null, 'bodega')); log::register('update', entradaBodegaTableClass::getNameTable()); routing::getInstance()->redirect('bodega', 'indexEntrada'); } else { log::register(i18n::__('update'), entradaBodegaTableClass::getNameTable(), i18n::__('errorUpdateBitacora')); session::getInstance()->setError(i18n::__('errorUpdate')); routing::getInstance()->redirect('bodega', 'indexEntrada'); } //close if } catch (PDOException $exc) { session::getInstance()->setFlash('exc', $exc); routing::getInstance()->forward('shfSecurity', 'exception'); } }
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[entradaBodegaTableClass::getNameTable() . '.' . entradaBodegaTableClass::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[entradaBodegaTableClass::getNameTable() . '.' . entradaBodegaTableClass::EMPLEADO] = $report['empleado']; } } $fields = array(entradaBodegaTableClass::ID, entradaBodegaTableClass::FECHA, entradaBodegaTableClass::EMPLEADO); $fieldsEmpleado = array(empleadoTableClass::ID, empleadoTableClass::NOMBRE); $fJoin1 = entradaBodegaTableClass::EMPLEADO; $fJoin2 = empleadoTableClass::ID; $orderBy = array(entradaBodegaTableClass::ID); $this->mensaje = "Informe de Entradas de Bodega"; $this->objEntrada = entradaBodegaTableClass::getAllJoin($fields, $fieldsEmpleado, null, null, $fJoin1, $fJoin2, null, null, null, null, true, $orderBy, 'ASC', null, null, $where); log::register(i18n::__('reporte'), entradaBodegaTableClass::getNameTable()); $this->defineView('index', 'entradaBodega', 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[entradaBodegaTableClass::getNameTable() . '.' . entradaBodegaTableClass::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['fecha']) and $filter['fecha'] !== null and $filter['fecha'] !== '') { // $where[entradaBodegaTableClass::FECHA] = $filter['fecha']; // }//close if if (isset($filter['empleado']) and $filter['empleado'] !== null and $filter['empleado'] !== '') { $where[entradaBodegaTableClass::EMPLEADO] = $filter['empleado']; } //close if session::getInstance()->setAttribute('entradaFilter', $where); } elseif (session::getInstance()->hasAttribute('entradaFilter')) { $where = session::getInstance()->getAttribute('entradaFilter'); } //close if $fieldsEntrada = array(entradaBodegaTableClass::ID, entradaBodegaTableClass::FECHA, entradaBodegaTableClass::EMPLEADO, entradaBodegaTableClass::ESTADO); $fieldsEmpleado = array(empleadoTableClass::NOMBRE); $fieldsEmpleado2 = array(empleadoTableClass::NOMBRE, empleadoTableClass::ID); $fJoin1 = entradaBodegaTableClass::EMPLEADO; $fJoin2 = empleadoTableClass::ID; $orderBy = array(entradaBodegaTableClass::ID); $fieldsInsumo = array(insumoTableClass::ID, insumoTableClass::NOMBRE); $fieldsTipoInsumo = array(tipoInsumoTableClass::ID, tipoInsumoTableClass::DESCRIPCION); $page = 0; if (request::getInstance()->hasGet('page')) { $page = request::getInstance()->getGet('page') - 1; $page = $page * config::getRowGrid(); } //close if $f = array(entradaBodegaTableClass::ID); $lines = config::getRowGrid(); $this->cntPages = entradaBodegaTableClass::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->objEmpleado = empleadoTableClass::getAll($fieldsEmpleado2, false); $this->objEntradaBodega = entradaBodegaTableClass::getAllJoin($fieldsEntrada, $fieldsEmpleado, null, null, $fJoin1, $fJoin2, null, null, null, null, true, $orderBy, 'ASC', config::getRowGrid(), $page, $where); log::register(i18n::__('ver', null, 'bodega'), entradaBodegaTableClass::getNameTable()); $this->defineView('index', 'entradaBodega', 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(entradaBodegaTableClass::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[detalleEntradaBodegaTableClass::TIPO_INSUMO] = $report['tipoInsumo']; } //close if if (isset($report['Insumo']) and $report['Insumo'] !== null and $report['Insumo'] !== '') { $where[detalleEntradaBodegaTableClass::ID_INSUMO] = $report['Insumo']; } //close if if (isset($report['cantidad']) and $report['cantidad'] !== null and $report['cantidad'] !== '') { $where[detalleEntradaBodegaTableClass::CANDITDAD] = $report['cantidad']; } //close if } //close if $where[detalleEntradaBodegaTableClass::ID_ENTRADA] = $idVacunacion; $fieldsDetalleEntradaBodega = array(detalleEntradaBodegaTableClass::ID, detalleEntradaBodegaTableClass::CANDITDAD); $fields = array(entradaBodegaTableClass::ID); $fieldsInsumo = array(insumoTableClass::NOMBRE); $fieldsTipo = array(tipoInsumoTableClass::DESCRIPCION); $fJoin1 = detalleEntradaBodegaTableClass::ID_ENTRADA; $fJoin2 = entradaBodegaTableClass::ID; $fJoin3 = detalleEntradaBodegaTableClass::ID_INSUMO; $fJoin4 = insumoTableClass::ID; $fJoin5 = detalleEntradaBodegaTableClass::TIPO_INSUMO; $fJoin6 = tipoInsumoTableClass::ID; $fieldsEntrada = array(entradaBodegaTableClass::ID, entradaBodegaTableClass::FECHA); $fieldsEmpleado = array(empleadoTableClass::NOMBRE); $fJoinVacunacion1 = entradaBodegaTableClass::EMPLEADO; $fJoinVacunacion2 = empleadoTableClass::ID; $whereVacunacion = array(entradaBodegaTableClass::getNameTable() . "." . entradaBodegaTableClass::ID => $idVacunacion); $this->objDetalleEntradaBodega = detalleEntradaBodegaTableClass::getAllJoin($fieldsDetalleEntradaBodega, $fieldsInsumo, $fieldsTipo, $fields, $fJoin1, $fJoin2, $fJoin3, $fJoin4, $fJoin5, $fJoin6, true, null, null, null, null, $where); $this->objEntradaBodega = entradaBodegaTableClass::getAllJoin($fieldsEntrada, $fieldsEmpleado, null, null, $fJoinVacunacion1, $fJoinVacunacion2, null, null, null, null, true, null, null, null, null, $whereVacunacion); $this->mensajeDetalle = "Informe de Detalles de Entrada de Bodega"; log::register(i18n::__('reporte'), detalleEntradaBodegaTableClass::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 { if (session::getInstance()->hasAttribute('entradaFilter')) { session::getInstance()->deleteAttribute('entradaFilter'); } //clse if routing::getInstance()->redirect('bodega', 'indexEntrada'); log::register(i18n::__('eliminar filtros'), entradaBodegaTableClass::getNameTable()); } catch (PDOException $exc) { session::getInstance()->setFlash('exc', $exc); routing::getInstance()->forward('shfSecurity', 'exception'); } }
public function execute() { try { $fecha = request::getInstance()->getPost(entradaBodegaTableClass::getNameField(entradaBodegaTableClass::FECHA, true)); $empleado = request::getInstance()->getPost(entradaBodegaTableClass::getNameField(entradaBodegaTableClass::EMPLEADO, true)); entradaBodegaTableClass::validateCreate($fecha, $empleado); $data = array(entradaBodegaTableClass::EMPLEADO => $empleado, entradaBodegaTableClass::FECHA => $fecha, entradaBodegaTableClass::ESTADO => true); entradaBodegaTableClass::insert($data); session::getInstance()->setSuccess(i18n::__('succesCreate', null, 'bodega')); log::register(i18n::__('create'), entradaBodegaTableClass::getNameTable()); routing::getInstance()->redirect('bodega', 'indexEntrada'); } 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)) { $idEntrada = request::getInstance()->getRequest(detalleEntradaBodegaTableClass::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::getNameTable() . '.' . detalleEntradaBodegaTableClass::CANDITDAD] = $filter['cantidad']; } //close if $where[detalleEntradaBodegaTableClass::ID_ENTRADA] = $idEntrada; session::getInstance()->setAttribute('detalleEntrada', $where); } elseif (session::getInstance()->hasAttribute('detalleEntrada')) { $where = session::getInstance()->getAttribute('detalleEntrada'); } else { $where = array(detalleEntradaBodegaTableClass::ID_ENTRADA => $idEntrada); } //close if $fieldsEntrada = array(entradaBodegaTableClass::ID, entradaBodegaTableClass::FECHA); $fieldsEmpleado = array(empleadoTableClass::NOMBRE); $whereEntrada = array(entradaBodegaTableClass::getNameTable() . '.' . entradaBodegaTableClass::ID => $idEntrada); $fJoinEntrada1 = entradaBodegaTableClass::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(detalleEntradaBodegaTableClass::ID); $whereCnt = array(detalleEntradaBodegaTableClass::ID_ENTRADA => $idEntrada); $lines = config::getRowGrid(); $fieldsDetalleEntrada = array(detalleEntradaBodegaTableClass::ID, detalleEntradaBodegaTableClass::CANDITDAD, detalleEntradaBodegaTableClass::ID_ENTRADA); $fieldsDetalleInsumo = array(insumoTableClass::NOMBRE); $fieldsDetalleTipoInsumo = array(tipoInsumoTableClass::DESCRIPCION); $fJoin1 = detalleEntradaBodegaTableClass::ID_INSUMO; $fJoin2 = insumoTableClass::ID; $fJoin3 = detalleEntradaBodegaTableClass::TIPO_INSUMO; $fJoin4 = tipoInsumoTableClass::ID; $fieldsInsumo = array(insumoTableClass::ID, insumoTableClass::NOMBRE); $fieldsTipoInsumo = array(tipoInsumoTableClass::ID, tipoInsumoTableClass::DESCRIPCION); $this->objTipoInsumo = tipoInsumoTableClass::getAll($fieldsTipoInsumo, false); $this->objInsumo = insumoTableClass::getAll($fieldsInsumo, true); $this->cntPages = detalleEntradaBodegaTableClass::getAllCount($f, true, $lines, $whereCnt); $this->objEntrada = entradaBodegaTableClass::getAllJoin($fieldsEntrada, $fieldsEmpleado, null, null, $fJoinEntrada1, $fJoinEntrada2, null, null, null, null, true, null, null, config::getRowGrid(), $page, $whereEntrada); $this->objDetalleEntrada = detalleEntradaBodegaTableClass::getAllJoin($fieldsDetalleEntrada, $fieldsDetalleInsumo, $fieldsDetalleTipoInsumo, null, $fJoin1, $fJoin2, $fJoin3, $fJoin4, null, null, false, null, 'ASC', config::getRowGrid(), $page, $where); log::register(i18n::__('ver2', null, 'bodega'), detalleEntradaBodegaTableClass::getNameTable()); $this->defineView('view', 'entradaBodega', 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'); } }