public function execute() { try { if (request::getInstance()->isMethod('POST')) { $nombre = request::getInstance()->getPost(vacunaTableClass::getNameField(vacunaTableClass::NOMBRE_VACUNA, true)); $lote = request::getInstance()->getPost(vacunaTableClass::getNameField(vacunaTableClass::LOTE_VACUNA, true)); $fecha_fabricacion = request::getInstance()->getPost(vacunaTableClass::getNameField(vacunaTableClass::FECHA_FABRICACION, true)); $fecha_vencimiento = request::getInstance()->getPost(vacunaTableClass::getNameField(vacunaTableClass::FECHA_VENCIMIENTO, true)); $valor = request::getInstance()->getPost(vacunaTableClass::getNameField(vacunaTableClass::VALOR, true)); $cantidad = request::getInstance()->getPost(vacunaTableClass::getNameField(vacunaTableClass::CANTIDAD, true)); $stock = request::getInstance()->getPost(vacunaTableClass::getNameField(vacunaTableClass::STOCK_MINIMO, true)); vacunaTableClass::validateCreate($nombre, $lote, $fecha_fabricacion, $fecha_vencimiento, $valor, $cantidad, $stock); $data = array(vacunaTableClass::NOMBRE_VACUNA => $nombre, vacunaTableClass::FECHA_FABRICACION => $fecha_fabricacion, vacunaTableClass::FECHA_VENCIMIENTO => $fecha_vencimiento, vacunaTableClass::LOTE_VACUNA => $lote, vacunaTableClass::VALOR => $valor, vacunaTableClass::CANTIDAD => $cantidad, vacunaTableClass::STOCK_MINIMO => $stock); vacunaTableClass::insert($data); session::getInstance()->setSuccess(i18n::__('succesCreate', null, 'vacuna')); log::register(i18n::__('create'), vacunaTableClass::getNameTable()); routing::getInstance()->redirect('vacunacion', 'indexVacuna'); } else { log::register(i18n::__('create'), vacunaTableClass::getNameTable(), i18n::__('errorCreateBitacora')); session::getInstance()->setError(i18n::__('errorCreate')); routing::getInstance()->redirect('vacunacion', 'indexVacuna'); } //close if } catch (PDOException $exc) { session::getInstance()->setFlash('exc', $exc); routing::getInstance()->forward('shfSecurity', 'exception'); } }
public function execute() { try { if (session::getInstance()->hasAttribute('vacunaFilters')) { session::getInstance()->deleteAttribute('vacunaFilters'); } //close if routing::getInstance()->redirect('vacunacion', 'indexVacuna'); log::register(i18n::__('eliminar filtros'), vacunaTableClass::getNameTable()); } catch (PDOException $exc) { session::getInstance()->setFlash('exc', $exc); routing::getInstance()->forward('shfSecurity', 'exception'); } }
public function execute() { try { $where = null; if (request::getInstance()->hasRequest('filter')) { $filter = request::getInstance()->getPost('filter'); if (isset($filter['nombre']) and $filter['nombre'] !== null and $filter['nombre'] !== '') { $where[vacunaTableClass::NOMBRE_VACUNA] = $filter['nombre']; } //close if if (isset($filter['lote']) and $filter['lote'] !== null and $filter['lote'] !== '') { $where[vacunaTableClass::LOTE_VACUNA] = $filter['lote']; } //close if if (isset($filter['fecha_f']) and $filter['fecha_f'] !== null and $filter['fecha_f'] !== '') { $where[vacunaTableClass::FECHA_FABRICACION] = $filter['fecha_f']; } //close if if (isset($filter['fecha_v']) and $filter['fecha_v'] !== null and $filter['fecha_v'] !== '') { $where[vacunaTableClass::FECHA_VENCIMIENTO] = $filter['fecha_v']; } //close if if (isset($filter['valor']) and $filter['valor'] !== null and $filter['valor'] !== '') { $where[vacunaTableClass::VALOR] = $filter['valor']; } //close if // if (isset($filter['cantidad']) and $filter['cantidad'] !== null and $filter['cantidad'] !== '') { // $where[vacunaTableClass::CANTIDAD] = $filter['cantidad']; // }//close if // if (isset($filter['stock']) and $filter['stock'] !== null and $filter['stock'] !== '') { // $where[vacunaTableClass::STOCK_MINIMO] = $filter['stock']; // }//close if } $fields = array(vacunaTableClass::ID, vacunaTableClass::NOMBRE_VACUNA, vacunaTableClass::LOTE_VACUNA, vacunaTableClass::FECHA_FABRICACION, vacunaTableClass::FECHA_VENCIMIENTO, vacunaTableClass::VALOR, vacunaTableClass::CANTIDAD, vacunaTableClass::STOCK_MINIMO); $orderBy = array(vacunaTableClass::ID); $this->objVacuna = vacunaTableClass::getAll($fields, true, $orderBy, 'ASC', null, null, $where); $this->mensaje = 'Informe de Vacunas en Nuestro Sistema'; log::register(i18n::__('reporte'), vacunaTableClass::getNameTable()); $this->defineView('index', 'vacuna', session::getInstance()->getFormatOutput()); } catch (PDOException $exc) { session::getInstance()->setFlash('exc', $exc); routing::getInstance()->forward('shfSecurity', 'exception'); } }
public function execute() { try { if (request::getInstance()->isMethod('POST')) { $nombre = request::getInstance()->getPost(vacunaTableClass::getNameField(vacunaTableClass::NOMBRE_VACUNA, true)); $lote = request::getInstance()->getPost(vacunaTableClass::getNameField(vacunaTableClass::LOTE_VACUNA, true)); $fecha_fabricacion = request::getInstance()->getPost(vacunaTableClass::getNameField(vacunaTableClass::FECHA_FABRICACION, true)); $fecha_vencimiento = request::getInstance()->getPost(vacunaTableClass::getNameField(vacunaTableClass::FECHA_VENCIMIENTO, true)); $valor = request::getInstance()->getPost(vacunaTableClass::getNameField(vacunaTableClass::VALOR, true)); $id = request::getInstance()->getPost(vacunaTableClass::getNameField(vacunaTableClass::ID, true)); vacunaTableClass::validateEdit($nombre, $lote, $fecha_fabricacion, $fecha_vencimiento, $valor); // $id = request::getInstance()->getPost(razaTableClass::getNameField(razaTableClass::ID, true)); // $nombre = request::getInstance()->getPost(razaTableClass::getNameField(razaTableClass::NOMBRE_RAZA, true)); // // $ids = array( // razaTableClass::ID => $id // ); $ids = array(vacunaTableClass::ID => $id); $data = array(vacunaTableClass::NOMBRE_VACUNA => $nombre, vacunaTableClass::LOTE_VACUNA => $lote, vacunaTableClass::FECHA_FABRICACION => $fecha_fabricacion, vacunaTableClass::FECHA_VENCIMIENTO => $fecha_vencimiento, vacunaTableClass::VALOR => $valor); vacunaTableClass::update($ids, $data); session::getInstance()->setSuccess(i18n::__('succesUpdate', null, 'vacuna')); log::register(i18n::__('update'), vacunaTableClass::getNameTable()); routing::getInstance()->redirect('vacunacion', 'indexVacuna'); // $data = array( // razaTableClass::NOMBRE_RAZA => $nombre // ); // // razaTableClass::update($ids, $data); // session::getInstance()->setSuccess(i18n::__('succesUpdate')); // log::register(i18n::__('update'), razaTableClass::getNameTable()); } else { log::register(i18n::__('update'), vacunaTableClass::getNameTable(), i18n::__('errorUpdateBitacora')); session::getInstance()->setError(i18n::__('errorUpdate')); routing::getInstance()->redirect('vacunacion', 'indexVacuna'); } //close if // log::register(i18n::__('update'), razaTableClass::getNameTable(), i18n::__('errorUpdateBitacora')); // session::getInstance()->setError(i18n::__('errorUpdate')); } catch (PDOException $exc) { session::getInstance()->setFlash('exc', $exc); routing::getInstance()->forward('shfSecurity', 'exception'); } }
public function execute() { try { if (request::getInstance()->isMethod('POST') and request::getInstance()->isAjaxRequest()) { $id = request::getInstance()->getPost(vacunaTableClass::getNameField(vacunaTableClass::ID, true)); $ids = array(vacunaTableClass::ID => $id); vacunaTableClass::delete($ids, true); $this->arrayAjax = array('code' => 11, 'msg' => 'La eliminacion ha sido exitosa'); $this->defineView('delete', 'vacuna', session::getInstance()->getFormatOutput()); log::register(i18n::__('delete'), vacunaTableClass::getNameTable()); session::getInstance()->setSuccess(i18n::__('succesDelete', null, 'vacuna')); } else { log::register(i18n::__('delete'), vacunaTableClass::getNameTable(), i18n::__('errorDeleteBitacora')); session::getInstance()->setError(i18n::__('errorDelete')); routing::getInstance()->redirect('animal', 'indexRaza'); } //close if } catch (PDOException $exc) { session::getInstance()->setFlash('exc', $exc); routing::getInstance()->forward('shfSecurity', 'exception'); } }
public function execute() { try { if (request::getInstance()->isMethod('POST')) { $idsToDelete = request::getInstance()->getPost('chk'); foreach ($idsToDelete as $id) { $ids = array(vacunaTableClass::ID => $id); vacunaTableClass::delete($ids, true); } //close foreach session::getInstance()->setSuccess(i18n::__('SuccesDeleteMasive', null, 'vacuna')); log::register(i18n::__('borrar seleccion'), vacunaTableClass::getNameTable()); routing::getInstance()->redirect('vacunacion', 'indexVacuna'); } else { session::getInstance()->setError('mal'); routing::getInstance()->redirect('vacunacion', 'indexVacuna'); } //close if } catch (PDOException $exc) { session::getInstance()->setFlash('exc', $exc); routing::getInstance()->forward('shfSecurity', 'exception'); } }
public function execute() { try { if (request::getInstance()->isMethod('POST')) { $id = request::getInstance()->getPost(vacunaTableClass::getNameField(vacunaTableClass::ID, true)); $cantidad = request::getInstance()->getPost(vacunaTableClass::getNameField(vacunaTableClass::CANTIDAD, true)); // vacunaTableClass::validateUpdateInsert($cantidad); $fieldsVacuna = array(vacunaTableClass::CANTIDAD); $where = array(vacunaTableClass::ID => $id); $vacuna = vacunaTableClass::getAll($fieldsVacuna, true, null, null, null, null, $where); $vacunaTotal = $cantidad + $vacuna[0]->cantidad; $ids = array(vacunaTableClass::ID => $id); $data = array(vacunaTableClass::CANTIDAD => $vacunaTotal); vacunaTableClass::update($ids, $data); session::getInstance()->setSuccess(i18n::__('successUpdate', null, 'vacuna')); log::register(i18n::__('update'), vacunaTableClass::getNameTable()); routing::getInstance()->redirect('vacunacion', 'indexVacuna'); // $data = array( // razaTableClass::NOMBRE_RAZA => $nombre // ); // // razaTableClass::update($ids, $data); // session::getInstance()->setSuccess(i18n::__('succesUpdate')); // log::register(i18n::__('update'), razaTableClass::getNameTable()); } else { log::register(i18n::__('update'), vacunaTableClass::getNameTable(), i18n::__('errorUpdateBitacora')); session::getInstance()->setError(i18n::__('errorCreate')); routing::getInstance()->redirect('vacunacion', 'indexVacuna'); } //close if // log::register(i18n::__('update'), razaTableClass::getNameTable(), i18n::__('errorUpdateBitacora')); // session::getInstance()->setError(i18n::__('errorUpdate')); } 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['nombre']) and $filter['nombre'] !== null and $filter['nombre'] !== '') { $where[vacunaTableClass::NOMBRE_VACUNA] = $filter['nombre']; } //close if if (isset($filter['lote']) and $filter['lote'] !== null and $filter['lote'] !== '') { $where[vacunaTableClass::LOTE_VACUNA] = $filter['lote']; } //close if if (isset($filter['fecha_f']) and $filter['fecha_f'] !== null and $filter['fecha_f'] !== '') { $where[vacunaTableClass::FECHA_FABRICACION] = $filter['fecha_f']; } //close if if (isset($filter['fecha_v']) and $filter['fecha_v'] !== null and $filter['fecha_v'] !== '') { $where[vacunaTableClass::FECHA_VENCIMIENTO] = $filter['fecha_v']; } //close if if (isset($filter['valor']) and $filter['valor'] !== null and $filter['valor'] !== '') { $where[vacunaTableClass::VALOR] = $filter['valor']; } //close if if (isset($filter['cantidad']) and $filter['cantidad'] !== null and $filter['cantidad'] !== '') { $where[vacunaTableClass::CANTIDAD] = $filter['cantidad']; } //close if if (isset($filter['stock']) and $filter['stock'] !== null and $filter['stock'] !== '') { $where[vacunaTableClass::STOCK_MINIMO] = $filter['stock']; } //close if session::getInstance()->setAttribute('vacunaFilters', $where); } elseif (session::getInstance()->hasAttribute('vacunaFilters')) { $where = session::getInstance()->getAttribute('vacunaFilters'); } //close if $fields = array(vacunaTableClass::FECHA_VENCIMIENTO, vacunaTableClass::FECHA_FABRICACION, vacunaTableClass::ID, vacunaTableClass::LOTE_VACUNA, vacunaTableClass::NOMBRE_VACUNA, vacunaTableClass::VALOR, vacunaTableClass::CANTIDAD, vacunaTableClass::STOCK_MINIMO); $orderBy = array(vacunaTableClass::ID); $page = 0; if (request::getInstance()->hasGet('page')) { $page = request::getInstance()->getGet('page') - 1; $page = $page * config::getRowGrid(); } //close if $f = array(vacunaTableClass::ID); $lines = config::getRowGrid(); if (request::getInstance()->hasGet('page')) { $this->page = request::getInstance()->getGet('page'); } else { $this->page = $page; } //close if $objVacuna = vacunaTableClass::getAll($fields, true, $orderBy, 'ASC', config::getRowGrid(), $page, $where); foreach ($objVacuna as $key) { if ($key->cantidad < $key->stock_minimo and $key->cantidad >= 1) { session::getInstance()->setWarning("La vacuna " . $key->nombre_vacuna . " " . "esta a punto de agotarse " . "le quedan " . $key->cantidad . " " . "y " . "su cantidad minima es de " . $key->stock_minimo); } elseif ($key->cantidad < $key->stock_minimo) { session::getInstance()->setWarning("La vacuna " . $key->nombre_vacuna . " " . "se ha agotado"); } } $this->cntPages = vacunaTableClass::getAllCount($f, false, $lines); $this->objVacuna = vacunaTableClass::getAll($fields, true, $orderBy, 'ASC', config::getRowGrid(), $page, $where); log::register(i18n::__('ver', null, 'vacunacion'), vacunaTableClass::getNameTable()); $this->defineView('index', 'vacuna', session::getInstance()->getFormatOutput()); } catch (PDOException $exc) { session::getInstance()->setFlash('exc', $exc); routing::getInstance()->forward('shfSecurity', 'exception'); } }