public function execute() { try { if (request::getInstance()->hasRequest(registroPartoTableClass::ID)) { $fields = array(registroPartoTableClass::ID, registroPartoTableClass::FECHA_NACIMIENTO, registroPartoTableClass::HEMBRAS_NACIDAS_VIVAS, registroPartoTableClass::MACHOS_NACIDOS_VIVOS, registroPartoTableClass::NACIDOS_MUERTOS, registroPartoTableClass::ANIMAL_ID); // $fieldsRaza = array( // razaTableClass::ID, // razaTableClass::NOMBRE_RAZA // ); $fieldsAnimal = array(animalTableClass::ID, animalTableClass::NUMERO); $raza_id = 2; $whereAnimal = array(animalTableClass::GENERO_ID => $raza_id); $where = array(registroPartoTableClass::ID => request::getInstance()->getRequest(registroPartoTableClass::ID)); $this->objAnimal = animalTableClass::getAll($fieldsAnimal, true, null, null, null, null, $whereAnimal); // $this->objRaza = razaTableClass::getAll($fieldsRaza, true); $this->objParto = registroPartoTableClass::getAll($fields, false, null, null, null, null, $where); $this->defineView('edit', 'registroParto', session::getInstance()->getFormatOutput()); } else { routing::getInstance()->redirect('animal', 'indexRegistroParto'); } } 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_inicio']) and $filter['fecha_inicio'] !== null and $filter['fecha_inicio'] !== '' and isset($filter['fecha_final']) and $filter['fecha_fina'] !== null and $filter['fecha_final'] !== '') { $where[procesoVentaTableClass::getNameTable() . '.' . procesoVentaTableClass::FECHA_HORA_VENTA] = array(date(config::getFormatTimestamp(), strtotime($filter['fecha_inicial'] . ' 00.00.00')), date(config::getFormatTimestamp(), strtotime($filter['fecha_final'] . ' 23.59.59'))); } //close if if (isset($filter['cliente']) and $filter['cliente'] !== null and $filter['cliente'] !== '') { $where[procesoVentaTableClass::CLIENTE_ID] = $filter['cliente']; } //close if session::getInstance()->setAttribute('facturaVentaFilter', $where); } elseif (session::getInstance()->hasAttribute('facturaVentaFilter')) { $where = session::getInstance()->getAttribute('facturaVentaFilter'); } //close if $fieldsEmple = array(empleadoTableClass::ID, empleadoTableClass::NOMBRE); $fieldsCli = array(clienteTableClass::ID, clienteTableClass::NOMBRE); $fieldsFacturaVenta = array(procesoVentaTableClass::ID, procesoVentaTableClass::FECHA_HORA_VENTA, procesoVentaTableClass::ACTIVA); $fieldsEmpleado = array(empleadoTableClass::NOMBRE); $fieldsCliente = array(clienteTableClass::NOMBRE); $fieldsEmpleado2 = array(empleadoTableClass::NOMBRE, empleadoTableClass::ID); $fieldsCliente2 = array(clienteTableClass::NOMBRE, clienteTableClass::ID); $fieldsAnimal = array(animalTableClass::ID, animalTableClass::NUMERO); $fJoin1 = procesoVentaTableClass::EMPLEADO_ID; $fJoin2 = empleadoTableClass::ID; $fJoin3 = procesoVentaTableClass::CLIENTE_ID; $fJoin4 = clienteTableClass::ID; $orderBy = array(procesoVentaTableClass::FECHA_HORA_VENTA); $this->objEmpleado = empleadoTableClass::getAll($fieldsEmpleado2, false); $this->objCliente = clienteTableClass::getAll($fieldsCliente2, false); $page = 0; if (request::getInstance()->hasGet('page')) { $page = request::getInstance()->getGet('page') - 1; $page = $page * config::getRowGrid(); } //close if $f = array(procesoVentaTableClass::ID); $lines = config::getRowGrid(); $this->cntPages = procesoVentaTableClass::getAllCount($f, true, $lines, $where); if (request::getInstance()->hasGet('page')) { $this->page = request::getInstance()->getGet('page'); } else { $this->page = $page; } //close if $this->objCliente = clienteTableClass::getAll($fieldsCli, true); $this->objEmpleado = empleadoTableClass::getAll($fieldsEmple, true); $this->objAnimal = animalTableClass::getAll($fieldsAnimal, true); $this->objFacturaVenta = procesoVentaTableClass::getAllJoin($fieldsFacturaVenta, $fieldsEmpleado, $fieldsCliente, null, $fJoin1, $fJoin2, $fJoin3, $fJoin4, null, null, true, $orderBy, 'ASC', config::getRowGrid(), $page, $where); log::register(i18n::__('ver', null, 'facturaVenta'), procesoVentaTableClass::getNameTable()); $this->defineView('index', 'facturaVenta', session::getInstance()->getFormatOutput()); } catch (PDOException $exc) { session::getInstance()->setFlash('exc', $exc); routing::getInstance()->forward('shfSecurity', 'exception'); } }
public function execute() { try { $where = null; // $idAnimal = request::getInstance()->getRequest(animalTableClass::ID); if (request::getInstance()->hasRequest('filter')) { $report = request::getInstance()->getPost('filter'); if (isset($report['numero']) and $report['numero'] !== null and $report['numero'] !== '') { $where[animalTableClass::getNameTable() . '.' . animalTableClass::ID] = $report['numero']; } //close if if (isset($report['lote']) and $report['lote'] !== null and $report['lote'] !== '') { $where[animalTableClass::getNameTable() . '.' . animalTableClass::LOTE_ID] = $report['lote']; } //close if } //close if $fieldsAnimal = array(animalTableClass::ID, animalTableClass::NUMERO, animalTableClass::LOTE_ID); $fieldsLote = array(loteTableClass::NOMBRE); $fJoin1 = animalTableClass::LOTE_ID; $fJoin2 = loteTableClass::ID; // print_r($where); //echo 12; // exit(); $this->objAnimal = animalTableClass::getAllJoin($fieldsAnimal, $fieldsLote, null, null, $fJoin1, $fJoin2, null, null, null, null, true, null, null, null, null, $where); $this->mensajeDetalle = "Inventario de Cerdos por Lote"; log::register(i18n::__('reporte'), animalTableClass::getNameTable()); $this->defineView('reportDetalle', 'animal', session::getInstance()->getFormatOutput()); } catch (PDOException $exc) { session::getInstance()->setFlash('exc', $exc); routing::getInstance()->forward('shfSecurity', 'exception'); } }
public function execute() { try { $fecha = request::getInstance()->getPost(procesoVentaTableClass::getNameField(procesoVentaTableClass::FECHA_HORA_VENTA, true)); $empleado = request::getInstance()->getPost(procesoVentaTableClass::getNameField(procesoVentaTableClass::EMPLEADO_ID, true)); $cliente = request::getInstance()->getPost(procesoVentaTableClass::getNameField(procesoVentaTableClass::CLIENTE_ID, true)); $animal = request::getInstance()->getPost(procesoVentaTableClass::getNameField(procesoVentaTableClass::ANIMAL, true)); $peso = request::getInstance()->getPost(procesoVentaTableClass::getNameField(procesoVentaTableClass::PESO, true)); $valor = request::getInstance()->getPost(procesoVentaTableClass::getNameField(procesoVentaTableClass::VALOR, true)); $subtotal = $peso * $valor; procesoVentaTableClass::validateCreate($fecha, $empleado, $cliente); $data = array(procesoVentaTableClass::CLIENTE_ID => $cliente, procesoVentaTableClass::EMPLEADO_ID => $empleado, procesoVentaTableClass::FECHA_HORA_VENTA => $fecha, procesoVentaTableClass::ANIMAL => $animal, procesoVentaTableClass::PESO => $peso, procesoVentaTableClass::VALOR => $valor, procesoVentaTableClass::SUBTOTAL => $subtotal); //Manejo de inventario $fieldsAnimal = array(animalTableClass::NUMERO, animalTableClass::ID); $whereInventario = array(animalTableClass::ID => $animal); $objAnimal = animalTableClass::getAll($fieldsAnimal, true, null, null, null, null, $whereInventario); procesoVentaTableClass::validateInventario($objAnimal[0]->id); $fieldsAnimalDelete = array(animalTableClass::ID => $objAnimal[0]->id); animalTableClass::delete($fieldsAnimalDelete, true); procesoVentaTableClass::insert($data); session::getInstance()->setSuccess(i18n::__('succesCreate', null, 'facturaVenta')); log::register(i18n::__('create'), procesoVentaTableClass::getNameTable()); routing::getInstance()->redirect('factura', 'indexFacturaVenta'); } catch (PDOException $exc) { session::getInstance()->setFlash('exc', $exc); routing::getInstance()->forward('shfSecurity', 'exception'); } }
public function execute() { try { if (request::getInstance()->isMethod('POST')) { // DATOS DE ANIMAL $fecha = request::getInstance()->getPost(gestacionTableClass::getNameField(gestacionTableClass::FECHA, true)); $empleado = request::getInstance()->getPost(gestacionTableClass::getNameField(gestacionTableClass::EMPLEADO, true)); $animal = request::getInstance()->getPost(gestacionTableClass::getNameField(gestacionTableClass::ANIMAL, true)); $fecha_monta = request::getInstance()->getPost(gestacionTableClass::getNameField(gestacionTableClass::FECHA_MONTA, true)); // $fecha_parto = request::getInstance()->getPost(gestacionTableClass::getNameField(gestacionTableClass::FECHA_PROBABLE_PARTO, true)); $fecundador = request::getInstance()->getPost(gestacionTableClass::getNameField(gestacionTableClass::ANIMAL_FECUNDADOR, true)); //validar si los campos estan vacios $datos = array($fecha, $empleado, $animal, $fecha_monta, $fecundador); gestacionTableClass::validate($fecha, $fecha_monta); //Insertar la informacion del usuario $data = array(gestacionTableClass::FECHA => $fecha, gestacionTableClass::EMPLEADO => $empleado, gestacionTableClass::ANIMAL => $animal, gestacionTableClass::FECHA_MONTA => $fecha_monta, gestacionTableClass::ANIMAL_FECUNDADOR => $fecundador); gestacionTableClass::insert($data); session::getInstance()->setSuccess(i18n::__('succesCreate', null, 'gestacion')); log::register(i18n::__('create'), animalTableClass::getNameTable()); routing::getInstance()->redirect('animal', 'indexGestacion', array(hojaVidaTableClass::getNameField(hojaVidaTableClass::ANIMAL) => $animal)); } else { log::register(i18n::__('create'), animalTableClass::getNameTable(), i18n::__('errorCreateBitacora')); session::getInstance()->setError(i18n::__('errorCreate', null, 'animal')); routing::getInstance()->redirect('animal', 'indexGestacion'); } } catch (PDOException $exc) { session::getInstance()->setFlash('exc', $exc); routing::getInstance()->forward('shfSecurity', 'exception'); } }
public function execute() { try { // $where=null; $idHojaVida = request::getInstance()->getGet(hojaVidaBaseTableClass::getNameField(hojaVidaTableClass::ANIMAL, TRUE)); if (isset($idHojaVida)) { $where[registroPartoTableClass::ANIMAL_ID] = $idHojaVida; } if (request::getInstance()->hasPost('filter')) { $filter = request::getInstance()->getPost('filter'); if (isset($filter['fecha_inicial']) and isset($filter['fecha_fin']) and $filter['fecha_inicial'] !== null and $filter['fecha_inicial'] !== '' and $filter['fecha_fin'] !== null and $filter['fecha_fin'] !== '') { $where[registroPartoTableClass::FECHA_NACIMIENTO] = array(date(config::getFormatTimestamp(), strtotime($filter['fecha_inicial'] . ' 00.00.00')), date(config::getFormatTimestamp(), strtotime($filter['fecha_fin'] . ' 23.59.59'))); } session::getInstance()->setAttribute('partoFiltersParto', $where); } $idAnimalSeleccionado = request::getInstance()->getGet(hojaVidaTableClass::getNameField(hojaVidaTableClass::ANIMAL, true)); $fieldsAnimal = array(animalTableClass::ID, animalTableClass::NUMERO); // $fieldsRaza= array( // razaTableClass::ID, // razaTableClass::NOMBRE_RAZA // ); $fields = array(registroPartoTableClass::ID, registroPartoTableClass::ANIMAL_ID, registroPartoTableClass::FECHA_NACIMIENTO, registroPartoTableClass::HEMBRAS_NACIDAS_VIVAS, registroPartoTableClass::MACHOS_NACIDOS_VIVOS, registroPartoTableClass::NACIDOS_MUERTOS); $fields2 = array(animalTableClass::NUMERO); // $fields3 = array ( // razaTableClass::NOMBRE_RAZA // ); $fJoin1 = registroPartoTableClass::ANIMAL_ID; $fJoin2 = animalTableClass::ID; // $fJoin3 = registroPartoTableClass::RAZA_ID; // $fJoin4 = razaTableClass::ID; $orderBy = array(registroPartoTableClass::ID); $page = 0; if (request::getInstance()->hasGet('page')) { $page = request::getInstance()->getGet('page') - 1; $page = $page * config::getRowGrid(); } $f = array(registroPartoTableClass::ID); if (request::getInstance()->hasGet('page')) { $this->page = request::getInstance()->getGet('page'); } else { $this->page = $page; } $where = array(registroPartoTableClass::ANIMAL_ID => $idAnimalSeleccionado); $lines = config::getRowGrid(); $this->idHojaVida = $idHojaVida; $this->cntPages = registroPartoTableClass::getAllCount($f, false, $lines, $where); // $this->page = request::getInstance()->getGet('page'); $this->objAnimal = animalTableClass::getAll($fieldsAnimal, true); $this->idAnimalSeleccionado = $idAnimalSeleccionado; // $this->objRaza = razaTableClass::getAll($fieldsRaza, false); $this->objParto = registroPartoTableClass::getAllJoin($fields, $fields2, null, null, $fJoin1, $fJoin2, null, null, null, null, false, $orderBy, 'ASC', config::getRowGrid(), $page, $where); $this->defineView('index', 'registroParto', session::getInstance()->getFormatOutput()); } catch (PDOException $exc) { session::getInstance()->setFlash('exc', $exc); routing::getInstance()->forward('shfSecurity', 'exception'); } }
public function execute() { try { // $where[hojaVidaTableClass::ANIMAL] = $idAnimal; // $where = array( // hojaVidaTableClass::ANIMAL => $idAnimal // ); $idAnimal = request::getInstance()->getGet(animalTableClass::ID); $fieldsAnimal = array(animalTableClass::ID, animalTableClass::NUMERO); $fieldsGenero = array(generoTableClass::ID, generoTableClass::NOMBRE); $fieldsRaza = array(razaTableClass::ID, razaTableClass::NOMBRE_RAZA); $fields = array(hojaVidaTableClass::ID, hojaVidaTableClass::ANIMAL, hojaVidaTableClass::FECHA_NACIMIENTO, hojaVidaTableClass::GENERO_ID, hojaVidaTableClass::PESO, hojaVidaTableClass::RAZA, hojaVidaTableClass::PARTO); $fields1 = array(animalTableClass::NUMERO); $fields2 = array(generoTableClass::NOMBRE); $fields3 = array(razaTableClass::NOMBRE_RAZA); $fJoin1 = hojaVidaTableClass::ANIMAL; $fJoin2 = animalTableClass::ID; $fJoin3 = hojaVidaTableClass::GENERO_ID; $fJoin4 = generoTableClass::ID; $fJoin5 = hojaVidaTableClass::RAZA; $fJoin6 = razaTableClass::ID; $whereAnimal = array(hojaVidaTableClass::ANIMAL => $idAnimal); // $orderBy = array( // hojaVidaTableClass::FECHA_NACIMIENTO // ); $page = 0; if (request::getInstance()->hasGet('page')) { $page = request::getInstance()->getGet('page') - 1; $page = $page * config::getRowGrid(); } $f = array(hojaVidaTableClass::ID); // $whereAnimal = array( // animalTableClass::getNameTable() . '.' . animalTableClass::NUMERO => $idAnimal // ); if (request::getInstance()->hasGet('page')) { $this->page = request::getInstance()->getGet('page'); } else { $this->page = $page; } $lines = config::getRowGrid(); $this->cntPages = animalTableClass::getAllCount($f, true, $lines); // $this->page = request::getInstance()->getGet('page'); $this->objHojaVida = hojaVidaTableClass::getAllJoin($fields, $fields1, $fields2, $fields3, $fJoin1, $fJoin2, $fJoin3, $fJoin4, $fJoin5, $fJoin6, true, null, null, null, null, $whereAnimal); $this->objAnimal = animalTableClass::getAll($fieldsAnimal, true); $this->objGenero = generoTableClass::getAll($fieldsGenero, false); $this->objRaza = razaTableClass::getAll($fieldsRaza, false); $this->defineView('hojadevida', 'animal', session::getInstance()->getFormatOutput()); } catch (PDOException $exc) { session::getInstance()->setFlash('exc', $exc); routing::getInstance()->forward('shfSecurity', 'exception'); } }
public function execute() { try { $fieldsVeterinario = array(veterinarioTableClass::ID, veterinarioTableClass::NOMBRE); $fieldsAnimal = array(animalTableClass::ID, animalTableClass::NUMERO); $this->objAnimal = animalTableClass::getAll($fieldsAnimal, true); // $this->objAnimal = animalTableClass::subQuery(); $this->objVeterinario = veterinarioTableClass::getAll($fieldsVeterinario, true); $this->defineView('insert', 'vacunacion', 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')) { $fecha = request::getInstance()->getPost(registroPartoTableClass::getNameField(registroPartoTableClass::FECHA_NACIMIENTO, true)); $hembras = request::getInstance()->getPost(registroPartoTableClass::getNameField(registroPartoTableClass::HEMBRAS_NACIDAS_VIVAS, true)); $machos = request::getInstance()->getPost(registroPartoTableClass::getNameField(registroPartoTableClass::MACHOS_NACIDOS_VIVOS, true)); $muertos = request::getInstance()->getPost(registroPartoTableClass::getNameField(registroPartoTableClass::NACIDOS_MUERTOS, true)); // $raza = request::getInstance()->getPost(registroPartoTableClass::getNameField(registroPartoTableClass::RAZA_ID, true)); $animal_id = request::getInstance()->getPost(registroPartoTableClass::getNameField(registroPartoTableClass::ANIMAL_ID, true)); // $caracteres = validator::getInstance()->validatorCharactersSpecial($nombre); // // if ($caracteres == true) { // throw new PDOException(i18n::__(10005, null, 'errors', null, 10005)); // } // loteTableClass::validatCreate($nombre); $fieldsAnimal = array(hojaVidaTableClass::ANIMAL, hojaVidaTableClass::ID, hojaVidaTableClass::PARTO, hojaVidaTableClass::GENERO_ID); $whereAnimal = array(hojaVidaTableClass::ANIMAL => $animal_id, hojaVidaTableClass::GENERO_ID => 1); $objAnimal = hojaVidaTableClass::getAll($fieldsAnimal, true, null, null, null, null, $whereAnimal); // print_r($objAnimal); // exit(); $flag = false; if ($objAnimal[0]->numero_parto > 5) { session::getInstance()->setError("Disponible para la Venta"); $flag = true; session::getInstance()->setFlash(animalTableClass::getNameField(animalTableClass::PESO, true), true); } if ($flag == true) { request::getInstance()->setMethod('GET'); routing::getInstance()->forward('animal', 'insertRegistroParto'); } $partosAnimal = $objAnimal[0]->numero_parto + 1; $idAnimalInventario = array(hojaVidaTableClass::ANIMAL => $animal_id); $dataAnimal = array(hojaVidaTableClass::PARTO => $partosAnimal); hojaVidaTableClass::update($idAnimalInventario, $dataAnimal); $data = array(registroPartoTableClass::FECHA_NACIMIENTO => $fecha, registroPartoTableClass::HEMBRAS_NACIDAS_VIVAS => $hembras, registroPartoTableClass::MACHOS_NACIDOS_VIVOS => $machos, registroPartoTableClass::NACIDOS_MUERTOS => $muertos, registroPartoTableClass::ANIMAL_ID => $animal_id); registroPartoTableClass::insert($data); session::getInstance()->setSuccess(i18n::__('succesCreate', null, 'parto')); log::register(i18n::__('create'), registroPartoTableClass::getNameTable()); routing::getInstance()->redirect('animal', 'indexRegistroParto', array(hojaVidaTableClass::getNameField(hojaVidaTableClass::ANIMAL) => $animal_id)); } else { log::register(i18n::__('create'), registroPartoTableClass::getNameTable(), i18n::__('errorCreateBitacora')); session::getInstance()->setError(i18n::__('errorCreate')); routing::getInstance()->redirect('animal', 'indexRegistroParto'); } } catch (PDOException $exc) { session::getInstance()->setFlash('exc', $exc); routing::getInstance()->forward('shfSecurity', 'exception'); } }
public function execute() { try { $fieldsAnimal = array(animalTableClass::ID, animalTableClass::NUMERO); $fieldsEmpleado = array(empleadoTableClass::ID, empleadoTableClass::NOMBRE); $this->idAnimalSeleccionado = request::getInstance()->getGet(hojaVidaTableClass::getNameField(hojaVidaTableClass::ANIMAL, true)); $this->objAnimal = animalTableClass::getAll($fieldsAnimal, true); $this->objEmpleado = empleadoTableClass::getAll($fieldsEmpleado, true); $this->defineView('insertRegistroPeso', 'animal', session::getInstance()->getFormatOutput()); } catch (PDOException $exc) { session::getInstance()->setFlash('exc', $exc); routing::getInstance()->forward('shfSecurity', 'exception'); } }
public function execute() { try { $fieldsEmpleado = array(empleadoTableClass::ID, empleadoTableClass::NOMBRE); $this->objEmpleado = empleadoTableClass::getAll($fieldsEmpleado, true); $fieldsCliente = array(clienteTableClass::ID, clienteTableClass::NOMBRE); $this->objCliente = clienteTableClass::getAll($fieldsCliente, false); $fieldsAnimal = array(animalTableClass::ID, animalTableClass::NUMERO); $this->objAnimal = animalTableClass::getAll($fieldsAnimal, true); $this->defineView('insert', 'facturaVenta', session::getInstance()->getFormatOutput()); } catch (PDOException $exc) { session::getInstance()->setFlash('exc', $exc); routing::getInstance()->forward('shfSecurity', 'exception'); } }
public function execute() { try { $fieldsGestacion = array(gestacionTableClass::ID, gestacionTableClass::FECHA, gestacionBaseTableClass::FECHA_MONTA, gestacionTableClass::EMPLEADO, gestacionTableClass::ANIMAL, gestacionTableClass::ANIMAL_FECUNDADOR); $fieldsAnimal = array(animalTableClass::ID, animalTableClass::NUMERO); $fieldsEmpleado = array(empleadoTableClass::ID, empleadoTableClass::NOMBRE); $where = array(gestacionTableClass::ID => request::getInstance()->getRequest(gestacionTableClass::ID, true)); $this->objAnimal = animalTableClass::getAll($fieldsAnimal, true); $this->objEmpleado = empleadoTableClass::getAll($fieldsEmpleado, true); $this->objGestacion = gestacionTableClass::getAll($fieldsGestacion, false, null, null, null, null, $where); $this->defineView('edit', 'gestacion', session::getInstance()->getFormatOutput()); } catch (PDOException $exc) { session::getInstance()->setFlash('exc', $exc); routing::getInstance()->forward('shfSecurity', 'exception'); } }
public function execute() { try { $fieldsAnimal = array(animalTableClass::ID, animalTableClass::NUMERO); $fieldsVeterinario = array(veterinarioTableClass::ID, veterinarioTableClass::NOMBRE); $fieldsVacuna = array(vacunaTableClass::ID, vacunaTableClass::NOMBRE_VACUNA); $this->objAnimal = animalTableClass::getAll($fieldsAnimal, true); $this->objVeterinario = veterinarioTableClass::getAll($fieldsVeterinario, true); $this->objVacuna = vacunaTableClass::getAll($fieldsVacuna, true); $this->idAnimalHojaVida = request::getInstance()->getGet(hojaVidaTableClass::getNameField(hojaVidaTableClass::ANIMAL, true)); $this->defineView('insertVacunacion', 'animal', session::getInstance()->getFormatOutput()); } catch (PDOException $exc) { session::getInstance()->setFlash('exc', $exc); routing::getInstance()->forward('shfSecurity', 'exception'); } }
public function execute() { try { if (request::getInstance()->hasRequest(animalTableClass::ID)) { $fieldsLote = array(loteTableClass::ID, loteTableClass::NOMBRE); $fieldsAnimal = array(animalTableClass::ID, animalTableClass::LOTE_ID); $where = array(animalTableClass::ID => request::getInstance()->getRequest(animalTableClass::ID, true)); $this->objLote = loteTableClass::getAll($fieldsLote); $this->objAnimal = animalTableClass::getAll($fieldsAnimal, true, null, null, null, null, $where); $this->defineView('edit', 'animal', session::getInstance()->getFormatOutput()); } else { routing::getInstance()->redirect('animal', 'indexAnimal'); } } catch (PDOException $exc) { session::getInstance()->setFlash('exc', $exc); routing::getInstance()->forward('shfSecurity', 'exception'); } }
public function execute() { try { $fieldsVacunacion = array(carneVacunasTableClass::ACCION, carneVacunasTableClass::ANIMAL, carneVacunasTableClass::DOSIS, carneVacunasTableClass::FECHA_VACUNACION, carneVacunasTableClass::ID, carneVacunasTableClass::VACUNA, carneVacunasTableClass::VETERINARIO); $fieldsAnimal = array(animalTableClass::ID, animalTableClass::NUMERO); $fieldsVacuna = array(vacunaTableClass::ID, vacunaTableClass::NOMBRE_VACUNA); $fieldsVeterinario = array(veterinarioTableClass::ID, veterinarioTableClass::NOMBRE); $where = array(carneVacunasTableClass::ID => request::getInstance()->getRequest(carneVacunasTableClass::ID, true)); $this->objAnimal = animalTableClass::getAll($fieldsAnimal, true); $this->objVacuna = vacunaTableClass::getAll($fieldsVacuna, true); $this->objVeterinario = veterinarioTableClass::getAll($fieldsVeterinario, true); $this->objCarne = carneVacunasTableClass::getAll($fieldsVacunacion, true, null, null, null, null, $where); $this->defineView('editVacunacion', 'animal', 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')) { // DATOS DE ANIMAL $numeroIdentificacion = request::getInstance()->getPost(animalTableClass::getNameField(animalTableClass::NUMERO, true)); //validar si los campos estan vacios $datos = array($numeroIdentificacion); $validatorEmpty = validator::getInstance()->validateFieldsEmpty($datos); if ($validatorEmpty == false) { throw new PDOException(i18n::__(10006, null, 'errors', null, 10006)); } //Validar el formato de fecha // $validacionFecha = validator::getInstance()->validateDate($fecha); // if ($validacionFecha == true) { // throw new PDOException(i18n::__(10005, null, 'errors', null, 10005)); // } //Validar campos numericos // $validacionNumericos = validator::getInstance()->validateCharactersNumber($peso); // if ($validacionNumericos == true) { // throw new PDOException(i18n::__(10005, null, 'errors', null, 10005)); // } // $validacionNumericos = validator::getInstance()->validateCharactersNumber($edad); // if ($validacionNumericos == true) { // throw new PDOException(i18n::__(10005, null, 'errors', null, 10005)); // } //Insertar la informacion del usuario $data = array(animalTableClass::LOTE_ID => 2, animalTableClass::NUMERO => $numeroIdentificacion); animalTableClass::insert($data); session::getInstance()->setSuccess(i18n::__('succesCreate', null, 'animal')); log::register(i18n::__('create'), animalTableClass::getNameTable()); routing::getInstance()->redirect('animal', 'indexAnimal'); } else { log::register(i18n::__('create'), animalTableClass::getNameTable(), i18n::__('errorCreateBitacora')); session::getInstance()->setError(i18n::__('errorCreate', null, 'animal')); routing::getInstance()->redirect('animal', 'indexAnimal'); } } catch (PDOException $exc) { session::getInstance()->setFlash('exc', $exc); routing::getInstance()->forward('shfSecurity', 'exception'); } }
public function execute() { try { if (request::getInstance()->hasRequest(vacunacionTableClass::ID)) { $fields = array(vacunacionTableClass::ID, vacunacionTableClass::ANIMAL, vacunacionTableClass::VETERINARIO, vacunacionTableClass::FECHA); $where = array(vacunacionTableClass::ID => request::getInstance()->getRequest(vacunacionTableClass::ID)); $fieldsAnimal = array(animalTableClass::ID, animalTableClass::NUMERO); $fieldsVeterinario = array(veterinarioTableClass::ID, veterinarioTableClass::NOMBRE); $this->objAnimal = animalTableClass::getAll($fieldsAnimal, true); $this->objVeterinario = veterinarioTableClass::getAll($fieldsVeterinario, true); $this->objVacunacion = vacunacionTableClass::getAll($fields, true, null, null, null, null, $where); $this->defineView('edit', 'vacunacion', session::getInstance()->getFormatOutput()); } else { routing::getInstance()->redirect('vacunacion', 'indexVacunacion'); } //close if } catch (PDOException $exc) { session::getInstance()->setFlash('exc', $exc); routing::getInstance()->forward('shfSecurity', 'exception'); } }
public static function validate($numero_identificacion, $lote) { $flag = false; $pattern = "/^((19|20)?[0-9]{2})[\\/|-](0?[1-9]|[1][012])[\\/|-](0?[1-9]|[12][0-9]|3[01])\$/"; $dateNow = date("Y-m-d", strtotime("now")); if (!is_numeric($numero_identificacion)) { session::getInstance()->setError(i18n::__(10007, null, 'errors')); $flag = true; session::getInstance()->setFlash(animalTableClass::getNameField(animalTableClass::PESO, true), true); } // if (!is_numeric($peso)) { // session::getInstance()->setError(i18n::__(10007, null, 'errors')); // $flag = true; // session::getInstance()->setFlash(animalTableClass::getNameField(animalTableClass::PESO, true), true); // } // if ($genero !== 1 or $genero !== 2) { // session::getInstance()->setError(i18n::__(10009, null, 'errors', array('%campo%' => 'Genero'))); // $flag = true; // session::getInstance()->setFlash(animalTableClass::getNameField(animalTableClass::GENERO_ID, true), true); // } // if (preg_match($pattern, $fecha_nacimiento) == false) { // session::getInstance()->setError(i18n::__(10008, null, 'errors')); // $flag = true; // session::getInstance()->setFlash(animalTableClass::getNameField(animalTableClass::FECHA_NACIMIENTO, true), true); // } if (!is_numeric($lote)) { session::getInstance()->setError(i18n::__(10007, null, 'errors')); $flag = true; session::getInstance()->setFlash(animalTableClass::getNameField(animalTableClass::LOTE_ID, true), true); } // if (!is_numeric($raza)) { // session::getInstance()->setError(i18n::__(10007, null, 'errors')); // $flag = true; // session::getInstance()->setFlash(animalTableClass::getNameField(animalTableClass::RAZA, true), true); // } if ($flag == true) { request::getInstance()->setMethod('GET'); routing::getInstance()->forward('animal', 'insertAnimal'); } }
public function execute() { try { if (request::getInstance()->isMethod('POST')) { $id = request::getInstance()->getPost(animalTableClass::getNameField(animalTableClass::ID, true)); $lote = request::getInstance()->getPost(animalTableClass::getNameField(animalTableClass::LOTE_ID, true)); $ids = array(animalTableClass::ID => $id); $data = array(animalTableClass::LOTE_ID => $lote); animalTableClass::update($ids, $data); session::getInstance()->setSuccess(i18n::__('succesUpdate', null, 'animal')); log::register(i18n::__('update'), usuarioTableClass::getNameTable()); routing::getInstance()->redirect('animal', 'indexAnimal'); } else { log::register(i18n::__('update'), usuarioTableClass::getNameTable(), i18n::__('errorUpdateBitacora')); session::getInstance()->setError(i18n::__('errorUpdate', null, 'animal')); routing::getInstance()->redirect('animal', 'indexAnimal'); } } 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(animalTableClass::getNameField(animalTableClass::ID, true)); //$observacion = request::getInstance()->getPost(usuarioTableClass::getNameField(usuarioTableClass::OBSERVACION, true)); $ids = array(animalTableClass::ID => $id); animalTableClass::delete($ids, true); $this->arrayAjax = array('code' => 11, 'msg' => 'La eliminacion ha sido exitosa'); $this->defineView('delete', 'animal', session::getInstance()->getFormatOutput()); log::register(i18n::__('delete'), usuarioTableClass::getNameTable()); session::getInstance()->setSuccess(i18n::__('succesDelete', null, 'animal')); } else { log::register(i18n::__('delete'), animalTableClass::getNameTable(), i18n::__('errorDeleteBitacora')); session::getInstance()->setError(i18n::__('errorDelete', null, 'animal')); routing::getInstance()->redirect('animal', 'index'); } } 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()->hasPost('chk')) { $idsToDelete = request::getInstance()->getPost('chk'); foreach ($idsToDelete as $id) { $ids = array(animalTableClass::ID => $id); animalTableClass::delete($ids, true); } log::register(i18n::__('delete'), animalTableClass::getNameTable()); session::getInstance()->setSuccess(i18n::__('succesDelete', null, 'animal')); routing::getInstance()->redirect('animal', 'indexAnimal'); } else { log::register(i18n::__('errorDelete'), animalTableClass::getNameTable()); session::getInstance()->setError(i18n::__('errorDeleteMasivo', null, 'user')); routing::getInstance()->redirect('animal', 'indexAnimal'); } } catch (PDOException $exc) { session::getInstance()->setFlash('exc', $exc); routing::getInstance()->forward('shfSecurity', 'exception'); } }
<div class="container"> <div class="row"> <div class="col-xs-6-offset-3"> <div class="table-responsive"> <table class="table table-bordered"> <tr> <?php if (!isset($objAnimal)) { ?> <th> <?php echo i18n::__('identification', null, 'animal'); ?> :</th> <th> <input required type="text" name="<?php echo animalTableClass::getNameField(animalTableClass::NUMERO, true); ?> " > </th> </tr><tr> <th colspan="2"> <font size="2">* <?php echo i18n::__('oblig', null, 'animal'); ?> </font></th> </tr> <?php } ?>
public function execute() { try { $where = null; if (request::getInstance()->hasPost('filter')) { $filter = request::getInstance()->getPost('filter'); if (isset($filter['numero']) and $filter['numero'] !== null and $filter['numero'] !== '') { $where[animalTableClass::NUMERO] = $filter['numero']; } if (isset($filter['lote']) and $filter['lote'] !== null and $filter['lote'] !== '') { $where[animalTableClass::LOTE_ID] = $filter['lote']; } session::getInstance()->setAttribute('animalFiltersAnimal', $where); } elseif (session::getInstance()->hasAttribute('animalFiltersAnimal')) { $where = session::getInstance()->getAttribute('animalFiltersAnimal'); } $fieldsGestacion = array(gestacionTableClass::ID, gestacionTableClass::ANIMAL, gestacionTableClass::FECHA); $objGestacion = gestacionTableClass::getAll($fieldsGestacion, false); foreach ($objGestacion as $key) { $segundos = strtotime($key->fecha) - strtotime('now'); $diferencia_dias = intval($segundos / 60 / 60 / 24); $diferencia_dias = $diferencia_dias * -1; if ($diferencia_dias > 116) { session::getInstance()->setWarning("A la cerda " . $key->animal . " no se le ha realizado el registro de parto"); } } // print_r($objGestacion); // exit(); $fields = array(animalTableClass::ID, animalTableClass::NUMERO, animalTableClass::LOTE_ID); $fieldsLote = array(loteTableClass::ID, loteTableClass::NOMBRE); $fields3 = array(loteTableClass::NOMBRE); $fieldsHojaVida = array(hojaVidaTableClass::ID, hojaVidaTableClass::ANIMAL, hojaVidaTableClass::FECHA_NACIMIENTO, hojaVidaTableClass::PARTO, hojaVidaTableClass::GENERO_ID, hojaVidaTableClass::RAZA, hojaVidaTableClass::PESO); $fieldsGenero = array(generoTableClass::ID, generoTableClass::NOMBRE); $fieldsRaza = array(razaTableClass::ID, razaTableClass::NOMBRE_RAZA); $fJoin1 = animalTableClass::LOTE_ID; $fJoin2 = loteTableClass::ID; $fJoin3 = animalTableClass::NUMERO; $fJoin4 = hojaVidaTableClass::NUMERO; $orderBy = array(animalTableClass::NUMERO); $page = 0; if (request::getInstance()->hasGet('page')) { $page = request::getInstance()->getGet('page') - 1; $page = $page * config::getRowGrid(); } $f = array(animalTableClass::ID); if (request::getInstance()->hasGet('page')) { $this->page = request::getInstance()->getGet('page'); } else { $this->page = $page; } $objAnimal = animalTableClass::getAllJoin($fields, $fields3, $fieldsHojaVida, null, $fJoin1, $fJoin2, $fJoin3, $fJoin4, null, null, true, $orderBy, 'ASC', config::getRowGrid(), $page, $where); //metodo cambio de lote foreach ($objAnimal as $key) { $p = $key->peso_animal; $i = $key->numero_identificacion; $segundos = strtotime($key->fecha_nacimiento) - strtotime('now'); $diferencia_dias = intval($segundos / 60 / 60 / 24); $diferencia_dias = $diferencia_dias * -1; $ids = array(animalTableClass::NUMERO => $i); if ($diferencia_dias >= 42) { if ($p >= 25 and $p < 55) { $dataLote = array(animalTableClass::LOTE_ID => 4); animalTableClass::update($ids, $dataLote); } if ($p >= 55) { $dataLote = array(animalTableClass::LOTE_ID => 5); animalTableClass::update($ids, $dataLote); } if ($p >= 100) { session::getInstance()->setInformation("El cerdo " . $key->numero_identificacion . " esta disponible para la venta"); } } else { if ($diferencia_dias >= 21 and $diferencia_dias < 42) { $dataLote = array(animalTableClass::LOTE_ID => 3); animalTableClass::update($ids, $dataLote); } } } $lines = config::getRowGrid(); $this->cntPages = animalTableClass::getAllCount($f, true, $lines, $where); $this->objGenero = generoTableClass::getAll($fieldsGenero, false); $this->objRaza = razaTableClass::getAll($fieldsRaza, true); $this->objLote = loteTableClass::getAll($fieldsLote, true); $this->objFilterAnimal = animalTableClass::getAll($fields, true); $this->objAnimal = animalTableClass::getAllJoin($fields, $fields3, null, null, $fJoin1, $fJoin2, null, null, null, null, true, $orderBy, 'ASC', config::getRowGrid(), $page, $where); $this->objHojaVida = hojaVidaTableClass::getAll($fieldsHojaVida, true); $this->defineView('index', 'animal', session::getInstance()->getFormatOutput()); } catch (PDOException $exc) { session::getInstance()->setFlash('exc', $exc); routing::getInstance()->forward('shfSecurity', 'exception'); } }
public function execute() { try { $where = null; $idHojaVida = request::getInstance()->getGet(hojaVidaBaseTableClass::getNameField(hojaVidaTableClass::ANIMAL, TRUE)); if (request::getInstance()->hasPost('filter')) { $filter = request::getInstance()->getPost('filter'); if (isset($filter['fecha_inicio']) and $filter['fecha_inicio'] !== null and $filter['fecha_inicio'] !== '' and isset($filter['fecha_fin']) and $filter['fecha_fin'] !== null and $filter['fecha_fin'] !== '') { $where[carneVacunasTableClass::getNameTable() . '.' . carneVacunasTableClass::FECHA_VACUNACION] = array(date(config::getFormatTimestamp(), strtotime($filter['fecha_inicio'] . ' 00.00.00')), date(config::getFormatTimestamp(), strtotime($filter['fecha_fin'] . ' 23.59.59'))); } //close if if (isset($filter['veterinario']) and $filter['veterinario'] !== null and $filter['veterinario'] !== '') { $where[carneVacunasTableClass::getNameTable() . '.' . carneVacunasTableClass::VETERINARIO] = $filter['veterinario']; } //close if if (isset($filter['vacuna']) and $filter['vacuna'] !== null and $filter['vacuna'] !== '') { $where[carneVacunasTableClass::getNameTable() . '.' . carneVacunasTableClass::VACUNA] = $filter['vacuna']; } //close if if (isset($filter['dosis']) and $filter['dosis'] !== null and $filter['dosis'] !== '') { $where[carneVacunasTableClass::DOSIS] = $filter['dosis']; } //close if if (isset($filter['accion']) and $filter['accion'] !== null and $filter['accion'] !== '') { $where[carneVacunasTableClass::getNameTable() . '.' . carneVacunasTableClass::ACCION] = $filter['accion']; } //close if session::getInstance()->setAttribute('animalFiltersVacunacion', $where); } elseif (session::getInstance()->hasAttribute('animalFiltersVacunacion')) { $where = session::getInstance()->getAttribute('animalFiltersVacunacion'); } $fieldsVeterinario = array(veterinarioTableClass::ID, veterinarioTableClass::NOMBRE); $fieldsAnimal = array(animalTableClass::ID, animalTableClass::NUMERO); $fieldsVacuna = array(vacunaTableClass::ID, vacunaTableClass::NOMBRE_VACUNA); $fields = array(carneVacunasTableClass::ACCION, carneVacunasTableClass::DOSIS, carneVacunasTableClass::FECHA_VACUNACION, carneVacunasTableClass::ID); $fields2 = array(animalTableClass::NUMERO); $fields3 = array(veterinarioTableClass::NOMBRE); $fields4 = array(vacunaTableClass::NOMBRE_VACUNA); $fJoin1 = carneVacunasTableClass::ANIMAL; $fJoin2 = animalTableClass::ID; $fJoin3 = carneVacunasTableClass::VETERINARIO; $fJoin4 = veterinarioTableClass::ID; $fJoin5 = carneVacunasTableClass::VACUNA; $fJoin6 = vacunaTableClass::ID; $orderBy = array(carneVacunasTableClass::FECHA_VACUNACION); $page = 0; if (request::getInstance()->hasGet('page')) { $page = request::getInstance()->getGet('page') - 1; $page = $page * config::getRowGrid(); } $f = array(carneVacunasTableClass::ID); $lines = config::getRowGrid(); $this->cntPages = carneVacunasTableClass::getAllCount($f, true, $lines); if (request::getInstance()->hasGet('page')) { $this->page = request::getInstance()->getGet('page'); } else { $this->page = $page; } $this->idHojaVida = $idHojaVida; $this->objCarne = carneVacunasTableClass::getAllJoin($fields, $fields2, $fields3, $fields4, $fJoin1, $fJoin2, $fJoin3, $fJoin4, $fJoin5, $fJoin6, true, $orderBy, 'ASC', config::getRowGrid(), $page, $where); $this->objAnimal = animalTableClass::getAll($fieldsAnimal, true); //$this->page = request::getInstance()->getGet('page'); $this->objVeterinario = veterinarioTableClass::getAll($fieldsVeterinario, true); $this->objVacuna = vacunaTableClass::getAll($fieldsVacuna, true); $this->idAnimalHojaVida = request::getInstance()->getGet(hojaVidaTableClass::getNameField(hojaVidaTableClass::ANIMAL, true)); $this->defineView('indexVacunacion', 'animal', session::getInstance()->getFormatOutput()); } catch (PDOException $exc) { session::getInstance()->setFlash('exc', $exc); routing::getInstance()->forward('shfSecurity', 'exception'); } }
public function execute() { try { $where = null; $idHojaVida = request::getInstance()->getGet(hojaVidaBaseTableClass::getNameField(hojaVidaTableClass::ANIMAL, TRUE)); if (isset($idHojaVida)) { $where[registroPesoTableClass::ANIMAL] = $idHojaVida; } if (request::getInstance()->hasPost('filter')) { $filter = request::getInstance()->getPost('filter'); if (isset($filter['fecha']) and $filter['fecha'] !== null and $filter['fecha'] !== '' and isset($filter['fin']) and $filter['fin'] !== null and $filter['fin'] !== '') { $where[registroPesoTableClass::getNameTable() . '.' . registroPesoTableClass::FECHA] = array(date(config::getFormatTimestamp(), strtotime($filter['fecha'] . ' 00.00.00')), date(config::getFormatTimestamp(), strtotime($filter['fin'] . ' 23.59.59'))); } if (isset($filter['empleado']) and $filter['empleado'] !== null and $filter['empleado'] !== '') { $where[registroPesoTableClass::getNameTable() . '.' . registroPesoTableClass::EMPLEADO] = $filter['empleado']; } //close if if (isset($filter['kilo']) and $filter['kilo'] !== null and $filter['kilo'] !== '') { $where[registroPesoTableClass::KILO] = $filter['kilo']; } //close if if (isset($filter['total']) and $filter['total'] !== null and $filter['total'] !== '') { $where[registroPesoTableClass::getNameTable() . '.' . registroPesoTableClass::VALOR] = $filter['total']; } //close if if (isset($filter['peso']) and $filter['peso'] !== null and $filter['peso'] !== '') { $where[registroPesoTableClass::getNameTable() . '.' . registroPesoTableClass::PESO] = $filter['peso']; } //close if session::getInstance()->setAttribute('animalFiltersRegistroPeso', $where); } elseif (session::getInstance()->hasAttribute('animalFiltersRegistroPeso')) { $where = session::getInstance()->getAttribute('animalFiltersRegistroPeso'); } $fieldsEmpleado = array(empleadoTableClass::ID, empleadoTableClass::NOMBRE); $fieldsAnimal = array(animalTableClass::ID, animalTableClass::NUMERO); $fields = array(registroPesoTableClass::ID, registroPesoTableClass::FECHA, registroPesoTableClass::KILO, registroPesoTableClass::PESO, registroPesoTableClass::VALOR); $fields2 = array(empleadoTableClass::NOMBRE); $fields3 = array(animalTableClass::NUMERO); $fJoin3 = registroPesoTableClass::EMPLEADO; $fJoin4 = empleadoTableClass::ID; $fJoin1 = registroPesoTableClass::ANIMAL; $fJoin2 = animalTableClass::ID; $orderBy = array(registroPesoTableClass::ID); $page = 0; if (request::getInstance()->hasGet('page')) { $page = request::getInstance()->getGet('page') - 1; $page = $page * config::getRowGrid(); } $f = array(registroPesoTableClass::ID); $lines = config::getRowGrid(); $this->cntPages = registroPesoTableClass::getAllCount($f, false, $lines); if (request::getInstance()->hasGet('page')) { $this->page = request::getInstance()->getGet('page'); } else { $this->page = $page; } $this->idHojaVida = $idHojaVida; $this->idAnimalSeleccionado = request::getInstance()->getGet(hojaVidaTableClass::getNameField(hojaVidaTableClass::ANIMAL, true)); $this->objPeso = registroPesoTableClass::getAllJoin($fields, $fields2, $fields3, null, $fJoin3, $fJoin4, $fJoin1, $fJoin2, null, null, false, $orderBy, 'ASC', config::getRowGrid(), $page, $where); $this->objAnimal = animalTableClass::getAll($fieldsAnimal, true); //$this->page = request::getInstance()->getGet('page'); $this->objEmpleado = empleadoTableClass::getAll($fieldsEmpleado, true); $this->defineView('indexRegistroPeso', 'animal', 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['id']) and $filter['id'] !== null and $filter['id'] !== '') { // $where[vacunacionTableClass::getNameTable() . '.' . vacunacionTableClass::ID] = $filter['id']; // }//close if if (isset($filter['fecha']) and $filter['fecha'] !== null and $filter['fecha'] !== '') { $where[vacunacionTableClass::FECHA] = $filter['fecha']; } //close if if (isset($filter['animal']) and $filter['animal'] !== null and $filter['animal'] !== '') { $where[vacunacionTableClass::ANIMAL] = $filter['animal']; } //close if if (isset($filter['veterinario']) and $filter['veterinario'] !== null and $filter['veterinario'] !== '') { $where[vacunacionTableClass::VETERINARIO] = $filter['veterinario']; } //close if session::getInstance()->setAttribute('vacunacionFiltersAnimal', $where); } elseif (session::getInstance()->hasAttribute('vacunacionFiltersAnimal')) { $where = session::getInstance()->getAttribute('vacunacionFiltersAnimal'); } //close if $fieldsVeterinario = array(veterinarioTableCLass::ID, veterinarioTableClass::NOMBRE); $fieldsAnimal = array(animalTableClass::ID, animalTableClass::NUMERO); $orderBy = array(vacunacionTableClass::FECHA); $page = 0; if (request::getInstance()->hasGet('page')) { $page = request::getInstance()->getGet('page') - 1; $page = $page * config::getRowGrid(); } //close if $f = array(vacunacionTableClass::ID); $lines = config::getRowGrid(); $this->cntPages = vacunacionTableClass::getAllCount($f, true, $lines, $where); if (request::getInstance()->hasGet('page')) { $this->page = request::getInstance()->getGet('page'); } else { $this->page = $page; } //close if $fieldsVavuna = array(vacunaTableClass::ID, vacunaTableClass::NOMBRE_VACUNA); $fieldsVacunacion = array(vacunacionTableClass::ID, vacunacionTableClass::FECHA); $fieldsVete = array(veterinarioTableClass::NOMBRE); $fieldsAni = array(animalTableClass::NUMERO); $fJoin1 = vacunacionTableClass::VETERINARIO; $fJoin2 = veterinarioTableClass::ID; $fJoin3 = vacunacionTableClass::ANIMAL; $fJoin4 = animalTableClass::ID; $this->objVacuna = vacunaTableClass::getAll($fieldsVavuna, true); $this->objAnimal = animalTableClass::getAll($fieldsAnimal, true); $this->objVeterinario = veterinarioTableClass::getAll($fieldsVeterinario, true); $this->objVacunacion = vacunacionTableClass::getAllJoin($fieldsVacunacion, $fieldsVete, $fieldsAni, null, $fJoin1, $fJoin2, $fJoin3, $fJoin4, null, null, true, $orderBy, 'ASC', config::getRowGrid(), $page, $where); // $this->objVacunacion = vacunacionTableClass::getAll($fields, true, $orderBy, 'ASC', config::getRowGrid(), $page, $where); log::register(i18n::__('view', null, 'empleado'), vacunacionTableClass::getNameTable()); $this->defineView('index', 'vacunacion', session::getInstance()->getFormatOutput()); } catch (PDOException $exc) { session::getInstance()->setFlash('exc', $exc); routing::getInstance()->forward('shfSecurity', 'exception'); } }
public function execute() { try { $idHojaVida = request::getInstance()->getGet(hojaVidaBaseTableClass::getNameField(hojaVidaTableClass::ANIMAL, TRUE)); if (isset($idHojaVida)) { $where[gestacionTableClass::ANIMAL] = $idHojaVida; } if (request::getInstance()->hasPost('filter')) { $filter = request::getInstance()->getPost('filter'); if (isset($filter['fecha']) and $filter['fecha'] !== null and $filter['fecha'] !== '') { $where[gestacionTableClass::getNameTable() . '.' . gestacionTableClass::FECHA] = $filter['fecha']; } //close if if (isset($filter['numero']) and $filter['numero'] !== null and $filter['numero'] !== '') { $where[gestacionTableClass::ANIMAL] = $filter['numero']; } //close if if (isset($filter['fechaMonta']) and $filter['fechaMonta'] !== null and $filter['fechaMonta'] !== '') { $where[gestacionTableClass::getNameTable() . '.' . gestacionTableClass::FECHA_MONTA] = $filter['fechaMonta']; } //close if // if (isset($filter['fechaParto']) and $filter['fechaParto'] !== null and $filter['fechaParto'] !== '') { // $where[gestacionTableClass::getNameTable() . '.' . gestacionTableClass::FECHA_PROBABLE_PARTO] = $filter['fechaParto']; // }//close if if (isset($filter['macho']) and $filter['macho'] !== null and $filter['macho'] !== '') { $where[gestacionTableClass::ANIMAL_FECUNDADOR] = $filter['macho']; } //close if if (isset($filter['empleado']) and $filter['empleado'] !== null and $filter['empleado'] !== '') { $where[gestacionTableClass::getNameTable() . '.' . gestacionTableClass::EMPLEADO] = $filter['empleado']; } //close if session::getInstance()->setAttribute('animalFiltersGestacion', $where); } elseif (session::getInstance()->hasAttribute('animalFiltersGestacion')) { $where = session::getInstance()->getAttribute('animalFiltersGestacion'); } $idAnimalHojaVida = request::getInstance()->getGet(hojaVidaTableClass::getNameField(hojaVidaTableClass::ANIMAL, true)); $where = array(gestacionTableClass::ANIMAL => $idAnimalHojaVida); $fieldsEmpleado = array(empleadoTableClass::ID, empleadoTableClass::NOMBRE); $fieldsAnimal = array(animalTableClass::ID, animalTableClass::NUMERO); $fields = array(gestacionTableClass::ID, gestacionTableClass::FECHA, gestacionTableClass::FECHA_MONTA, gestacionTableClass::ANIMAL_FECUNDADOR); $fields2 = array(animalTableClass::NUMERO); $fields3 = array(empleadoTableClass::NOMBRE); $fJoin1 = gestacionTableClass::ANIMAL; $fJoin2 = animalTableClass::ID; $fJoin3 = gestacionTableClass::EMPLEADO; $fJoin4 = empleadoTableClass::ID; $orderBy = array(gestacionTableClass::ID); $page = 0; if (request::getInstance()->hasGet('page')) { $page = request::getInstance()->getGet('page') - 1; $page = $page * config::getRowGrid(); } $f = array(gestacionTableClass::ID); $lines = config::getRowGrid(); $this->cntPages = gestacionTableClass::getAllCount($f, false, $lines); if (request::getInstance()->hasGet('page')) { $this->page = request::getInstance()->getGet('page'); } else { $this->page = $page; } $this->idHojaVida = $idHojaVida; // $this->idAnimalSeleccionado = request::getInstance()->getGet(hojaVidaTableClass::getNameField(hojaVidaTableClass::ANIMAL,true)); $this->objGestacion = gestacionTableClass::getAllJoin($fields, $fields2, $fields3, null, $fJoin1, $fJoin2, $fJoin3, $fJoin4, null, null, false, $orderBy, 'ASC', config::getRowGrid(), $page, $where); $this->objAnimal = animalTableClass::getAll($fieldsAnimal, true); //$this->page = request::getInstance()->getGet('page'); $this->idAnimalHojaVida = $idAnimalHojaVida; $this->objEmpleado = empleadoTableClass::getAll($fieldsEmpleado, false); $this->defineView('index', 'gestacion', session::getInstance()->getFormatOutput()); } catch (PDOException $exc) { session::getInstance()->setFlash('exc', $exc); routing::getInstance()->forward('shfSecurity', 'exception'); } }
public function execute() { try { if (request::getInstance()->hasRequest(vacunacionTableClass::ID)) { $idVacunacion = request::getInstance()->getRequest(vacunacionTableClass::ID); $fieldsVacuna = array(vacunaTableClass::ID, vacunaTableClass::NOMBRE_VACUNA); $orderBy = array(detalleVacunacionTableClass::ID); $where = array(detalleVacunacionTableClass::ID_REGISTRO => $idVacunacion); if (request::getInstance()->hasPost('filter')) { $where = null; $filter = request::getInstance()->getPost('filter'); if (isset($filter['fecha_inicial']) and $filter['fecha_inicial'] !== null and $filter['fecha_inicial'] !== '' and isset($filter['fecha_final']) and $filter['fecha_final'] !== null and $filter['fecha_final'] !== '') { $where[detalleVacunacionTableClass::FECHA] = array(date(config::getFormatTimestamp(), strtotime($filter['fecha_inicial'] . ' 00.00.00')), date(config::getFormatTimestamp(), strtotime($filter['fecha_final'] . ' 23.59.59'))); } //close if if (isset($filter['vacuna']) and $filter['vacuna'] !== null and $filter['vacuna'] !== '') { $where[detalleVacunacionTableClass::VACUNA] = $filter['vacuna']; } //close if if (isset($filter['dosis']) and $filter['dosis'] !== null and $filter['dosis'] !== '') { $where[detalleVacunacionTableClass::DOSIS] = $filter['dosis']; } //close if // if (isset($filter['accion']) and $filter['accion'] !== null and $filter['accion'] !== '') { // $where[detalleVacunacionTableClass::ACCION] = $filter['accion']; // } session::getInstance()->setAttribute('facturaVentaFilter', $where); } elseif (session::getInstance()->hasAttribute('facturaVentaFilter')) { $where = session::getInstance()->getAttribute('facturaVentaFilter'); } //close if $fieldsVacunacion = array(vacunacionTableClass::ID, vacunacionTableClass::FECHA); $fieldsVete = array(veterinarioTableClass::NOMBRE); $fieldsAni = array(animalTableClass::NUMERO); $whereVacunacion = array(vacunacionTableClass::getNameTable() . '.' . vacunacionTableClass::ID => $idVacunacion); $fieldsAnimal = array(animalTableClass::ID, animalTableClass::NUMERO); $page = 0; if (request::getInstance()->hasGet('page')) { $page = request::getInstance()->getGet('page') - 1; $page = $page * config::getRowGrid(); } //close if $f = array(detalleVacunacionTableClass::ID); $whereCnt = array(detalleVacunacionTableClass::ID_REGISTRO => $idVacunacion); $lines = config::getRowGrid(); $fieldsDetalleVacunacion = array(detalleVacunacionTableClass::ID, detalleVacunacionTableClass::ID_REGISTRO, detalleVacunacionTableClass::FECHA, detalleVacunacionTableClass::VACUNA, detalleVacunacionTableClass::DOSIS, detalleVacunacionTableClass::ACCION); $fieldsVacu = array(vacunaTableClass::NOMBRE_VACUNA); $fJoin1 = detalleVacunacionTableClass::VACUNA; $fJoin2 = vacunaTableClass::ID; $fJoinVacu1 = vacunacionTableClass::VETERINARIO; $fJoinVacu2 = veterinarioTableClass::ID; $fJoinVacu3 = vacunacionTableClass::ANIMAL; $fJoinVacu4 = animalTableClass::ID; $this->objAnimal = animalTableClass::getAll($fieldsAnimal, true); $this->objVacuna = vacunaTableClass::getAll($fieldsVacuna, true); $this->cntPages = detalleVacunacionTableClass::getAllCount($f, true, $lines, $whereCnt); $this->objVacunacion = vacunacionTableClass::getAllJoin($fieldsVacunacion, $fieldsVete, $fieldsAni, null, $fJoinVacu1, $fJoinVacu2, $fJoinVacu3, $fJoinVacu4, null, null, true, $orderBy, 'ASC', config::getRowGrid(), $page, $whereVacunacion); $this->objDetalleVacunacion = detalleVacunacionTableClass::getAllJoin($fieldsDetalleVacunacion, $fieldsVacu, null, null, $fJoin1, $fJoin2, null, null, null, null, true, $orderBy, 'ASC', config::getRowGrid(), $page, $where); // $this->objDetalleVacunacion = detalleVacunacionTableClass::getAll($fields, true, $orderBy, 'ASC', 10, $page, $where); $this->defineView('view', 'vacunacion', 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'); } }
public function execute() { try { $where = null; if (session::getInstance()->hasAttribute('animalFiltersAnimal')) { $where = session::getInstance()->getAttribute('animalFiltersAnimal'); } if (request::getInstance()->hasPost('report')) { $report = request::getInstance()->getPost('report'); // if (isset($report['edad_inicial']) and $report['edad_inicial'] !== null and $report['edad_inicial'] !== '' and isset($report['edad_fin']) and $report['edad_fin'] !== null and $report['edad_fin'] !== '') { $edad_inicial = validate::getInstance()->validateCharactersNumber($report['edad_inicial']); $edad_fin = validate::getInstance()->validateCharactersNumber($report['edad_fin']); /* echo ($edad_inicial) ? 'verdadero' : 'falso'; exit(); */ if ($edad_inicial == true or $edad_fin == true) { throw new PDOException(i18n::__(10007, null, 'errors')); } $where[animalTableClass::EDAD] = array($report['edad_inicial'], $report['edad_fin']); } if (isset($report['peso_inicial']) and $report['peso_inicial'] !== null and $report['peso_inicial'] !== '' and isset($report['peso_fin']) and $report['peso_fin'] !== null and $report['peso_fin'] !== '') { $peso_inicial = validate::getInstance()->validateCharactersNumber($report['peso_inicial']); $peso_fin = validate::getInstance()->validateCharactersNumber($report['peso_fin']); if ($edad_inicial == true or $edad_fin == true) { throw new PDOException(i18n::__(10007, null, 'errors')); } $where[animalTableClass::PESO] = array($report['peso_inicial'], $report['peso_fin']); } if (isset($report['fecha_inicial']) and $report['fecha_inicial'] !== null and $report['fecha_inicial'] !== '' and isset($report['fecha_fin']) and $report['fecha_fin'] !== null and $report['fecha_fin'] !== '') { $fecha_inicial = validate::getInstance()->validateDate($filter['fecha_inicial']); $fecha_fin = validate::getInstance()->validateDate($filter['fecha_fin']); if ($fecha_inicial == false or $fecha_fin == false) { throw new PDOException(i18n::__(10008, null, 'errors')); } $where[animalTableClass::FECHA_INGRESO] = array(date(config::getFormatTimestamp(), strtotime($report['fecha_inicial'])), date(config::getFormatTimestamp(), strtotime($report['fecha_fin']))); } if (isset($report['genero']) and $report['genero'] !== null and $report['genero'] !== '' and $report['genero'] !== "default") { $genero = validate::getInstance()->validateCharactersNumber($report['genero']); if ($genero == true) { throw new PDOException(i18n::__(10007, null, 'errors')); } $where[animalTableClass::GENERO_ID] = $report['genero']; } if (isset($report['lote']) and $report['lote'] !== null and $report['lote'] !== '' and $report['lote'] !== "default") { $lote = validate::getInstance()->validateCharactersNumber($report['lote']); if ($lote == true) { throw new PDOException(i18n::__(10007, null, 'errors')); } $where[animalTableClass::LOTE_ID] = $report['lote']; } if (isset($report['raza']) and $report['raza'] !== null and $report['raza'] !== '' and $report['raza'] !== "default") { $raza = validate::getInstance()->validateCharactersNumber($report['raza']); if ($raza == true) { throw new PDOException(i18n::__(10007, null, 'errors')); } $where[animalTableClass::RAZA] = $report['raza']; } } $fields = array(animalTableClass::ID, animalTableClass::PESO, animalTableClass::PRECIO_ANIMAL, animalTableClass::FECHA_NACIMIENTO, animalTableClass::NUMERO, animalTableClass::PRECIO_ANIMAL, animalTableClass::FECHA_NACIMIENTO, animalTableClass::PARTO); $fields2 = array(generoTableClass::NOMBRE); $fields3 = array(loteTableClass::NOMBRE); $fields4 = array(razaTableClass::NOMBRE_RAZA); $fJoin1 = animalTableClass::GENERO_ID; $fJoin2 = generoTableClass::ID; $fJoin3 = animalTableClass::LOTE_ID; $fJoin4 = loteTableClass::ID; $fJoin5 = animalTableClass::RAZA; $fJoin6 = razaTableClass::ID; $orderBy = array(animalTableClass::ID); $this->objAnimal = animalTableClass::getAllJoin($fields, $fields2, $fields3, $fields4, $fJoin1, $fJoin2, $fJoin3, $fJoin4, $fJoin5, $fJoin6, true, $orderBy, 'ASC', null, null, $where); $this->mensaje = 'Informe de Cerdos en Nuestro Sistema'; $this->defineView('index', 'animal', session::getInstance()->getFormatOutput()); } catch (PDOException $exc) { session::getInstance()->setFlash('exc', $exc); routing::getInstance()->forward('shfSecurity', 'exception'); } }
<div class="modal-body"> <?php echo i18n::__('eliminarIndividual'); ?> </div> <div class="modal-footer responsive"> <a href="#close2" title="Close" class="btn btn-default fa fa-times-circle-o close2"><?php echo i18n::__('cancel'); ?> </a> <button type="button" class="btn btn-primary fa fa-eraser" onclick="eliminar(<?php echo $key->{$idAnimal}; ?> , '<?php echo animalTableClass::getNameField(animalTableClass::ID, true); ?> ', '<?php echo routing::getInstance()->getUrlWeb('animal', 'deleteAnimal'); ?> ')"><?php echo i18n::__('delete'); ?> </button> </div> </div> </div> </th> </tr>