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 = 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 {
         $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');
     }
 }