public function execute() { try { $where = null; if (request::getInstance()->hasRequest('filter')) { $report = request::getInstance()->getPost('filter'); if (isset($report['numero']) and $report['numero'] !== null and $report['numero'] !== '') { $where[registroPesoTableClass::getNameTable() . '.' . registroPesoTableClass::ANIMAL] = $report['numero']; } //close if } //close if $fields = array(registroPesoTableClass::FECHA, registroPesoTableClass::ID, registroPesoTableClass::KILO, registroPesoTableClass::PESO, registroPesoTableClass::VALOR); $fieldsEmpleado = array(empleadoTableClass::ID, empleadoTableClass::NOMBRE); $fieldsAnimal = array(animalTableClass::ID, animalTableClass::NUMERO); $fJoin1 = registroPesoTableClass::EMPLEADO; $fJoin2 = empleadoTableClass::ID; $fJoin3 = registroPesoTableClass::ANIMAL; $fJoin4 = animalTableClass::ID; $orderBy = array(registroPesoTableClass::FECHA); $this->mensaje = "Informe de Registros de Peso Diario del Cerdo"; $this->objRegistroPeso = registroPesoTableClass::getAllJoin($fields, $fieldsEmpleado, $fieldsAnimal, null, $fJoin1, $fJoin2, $fJoin3, $fJoin4, null, null, true, $orderBy, 'ASC', null, null, $where); log::register(i18n::__('reporte'), registroPesoTableClass::getNameTable()); $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; $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'); } }