public function execute() { try { if (request::getInstance()->isMethod('POST')) { $id = request::getInstance()->getPost(detalleSalidaBodegaTableClass::getNameField(detalleSalidaBodegaTableClass::ID, true)); $id_registro = request::getInstance()->getPost(detalleSalidaBodegaTableClass::getNameField(detalleSalidaBodegaTableClass::ID_SALIDA, true)); $tipo_insumo = request::getInstance()->getPost(detalleSalidaBodegaTableClass::getNameField(detalleSalidaBodegaTableClass::TIPO_INSUMO, true)); $insumo = request::getInstance()->getPost(detalleSalidaBodegaTableClass::getNameField(detalleSalidaBodegaTableClass::ID_INSUMO, true)); $cantidad = request::getInstance()->getPost(detalleSalidaBodegaTableClass::getNameField(detalleSalidaBodegaTableClass::CANDITDAD, true)); $PATH_INFO = request::getInstance()->getPost('PATH_INFO'); detalleSalidaBodegaTableClass::validateUpdate($tipo_insumo, $insumo, $cantidad); $ids = array(detalleSalidaBodegaTableClass::ID => $id); // detalleSalidaBodegaTableClass::validateUpdate($tipo_insumo, $insumo, $cantidad); $data = array(detalleSalidaBodegaTableClass::TIPO_INSUMO => $tipo_insumo, detalleSalidaBodegaTableClass::ID_INSUMO => $insumo, detalleSalidaBodegaTableClass::CANDITDAD => $cantidad); detalleSalidaBodegaTableClass::update($ids, $data); // log::register(i18n::__('update'), detalleSalidaBodegaTableClass::getNameTable()); } //close if $dir = config::getUrlBase() . config::getIndexFile() . $PATH_INFO . '?' . 'id' . '=' . $id_registro; header('location: ' . $dir); } 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 { if (session::getInstance()->hasAttribute('detalleSalida')) { session::getInstance()->deleteAttribute('detalleSalida'); } //clse if routing::getInstance()->redirect('bodega', 'indexSalida'); log::register(i18n::__('eliminar filtros'), detalleSalidaBodegaTableClass::getNameTable()); } catch (PDOException $exc) { session::getInstance()->setFlash('exc', $exc); routing::getInstance()->forward('shfSecurity', 'exception'); } }
public function execute() { try { if (request::getInstance()->isMethod('POST')) { $id_registro = request::getInstance()->getPost(detalleSalidaBodegaTableClass::getNameField(detalleSalidaBodegaTableClass::ID_SALIDA, true)); $tipo_insumo = request::getInstance()->getPost(detalleSalidaBodegaTableClass::getNameField(detalleSalidaBodegaTableClass::TIPO_INSUMO, true)); $id_insumo = request::getInstance()->getPost(detalleSalidaBodegaTableClass::getNameField(detalleSalidaBodegaTableClass::ID_INSUMO, true)); $cantidad = request::getInstance()->getPost(detalleSalidaBodegaTableClass::getNameField(detalleSalidaBodegaTableClass::CANDITDAD, true)); $lote = request::getInstance()->getPost(detalleSalidaBodegaTableClass::getNameField(detalleSalidaBodegaTableClass::LOTE, true)); detalleSalidaBodegaTableClass::validateCreate($tipo_insumo, $id_insumo, $cantidad, $lote); //Manejo de inventario $fieldsInventario = array(insumoTableClass::CANTIDAD); $whereInventario = array(insumoTableClass::ID => $id_insumo); $objInsumoInventario = insumoTableClass::getAll($fieldsInventario, true, null, null, null, null, $whereInventario); $insumoInventario = $objInsumoInventario[0]->cantidad - $cantidad; $id_inventario_insumo = array(insumoTableClass::ID => $id_insumo); $data_inventario_insuom = array(insumoTableClass::CANTIDAD => $insumoInventario); $flag = false; if ($cantidad > $objInsumoInventario[0]->cantidad) { session::getInstance()->setError('La cantidad del insumo no es suficiente'); $flag = true; session::getInstance()->setFlash(detalleSalidaBodegaTableClass::getNameField(detalleSalidaBodegaTableClass::CANDITDAD, true), true); } if ($flag == true) { request::getInstance()->setMethod('GET'); routing::getInstance()->forward('bodega', 'indexSalida'); } insumoTableClass::update($id_inventario_insumo, $data_inventario_insuom); $data = array(detalleSalidaBodegaTableClass::CANDITDAD => $cantidad, detalleSalidaBodegaTableClass::ID_SALIDA => $id_registro, detalleSalidaBodegaTableClass::ID_INSUMO => $id_insumo, detalleSalidaBodegaTableClass::TIPO_INSUMO => $tipo_insumo, detalleSalidaBodegaTableClass::LOTE => $lote); // print_r($data); // exit(); detalleSalidaBodegaTableClass::insert($data); session::getInstance()->setSuccess(i18n::__('succesCreate3', null, 'bodega')); log::register(i18n::__('create'), detalleSalidaBodegaTableClass::getNameTable()); routing::getInstance()->redirect('bodega', 'indexSalida'); } else { log::register(i18n::__('create'), detalleSalidaBodegaBaseTableClass::getNameTable(), i18n::__('errorCreateBitacora')); session::getInstance()->setError('El Detalle de Vacunación no pudo ser insertado'); routing::getInstance()->redirect('vacunacion', 'indexVacunacion'); } //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(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'); } }