public function execute() { try { $fields = array(loteTableClass::ID, loteTableClass::NOMBRE); $orderBy = array(loteTableClass::ID); $page = 0; if (request::getInstance()->hasGet('page')) { $page = request::getInstance()->getGet('page') - 1; $page = $page * config::getRowGrid(); } $f = array(loteTableClass::ID); if (request::getInstance()->hasGet('page')) { $this->page = request::getInstance()->getGet('page'); } else { $this->page = $page; } $lines = config::getRowGrid(); $this->cntPages = loteTableClass::getAllCount($f, true, $lines); //$this->page = request::getInstance()->getGet('page'); $this->objLote = loteTableClass::getAll($fields, true, $orderBy, 'ASC', config::getRowGrid(), $page); $this->defineView('index', 'lote', 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['fecha_fin']) and $filter['fecha_fin'] !== null and $filter['fecha_fin'] !== '' and isset($filter['fecha_inicio']) and $filter['fecha_inicio'] !== null and $filter['fecha_inicio'] !== '') { $where[salidaBodegaTableClass::getNameTable() . '.' . salidaBodegaTableClass::FECHA] = array(date(config::getFormatTimestamp(), strtotime($filter['fecha_inicio'] . ' 00.00.00')), date(config::getFormatTimestamp(), strtotime($filter['fecha_fin'] . ' 23.59.59'))); } if (isset($filter['empleado']) and $filter['empleado'] !== null and $filter['empleado'] !== '') { $where[salidaBodegaTableClass::EMPLEADO] = $filter['empleado']; } //close if session::getInstance()->setAttribute('salidaFilter', $where); } elseif (session::getInstance()->hasAttribute('salidaFilter')) { $where = session::getInstance()->getAttribute('salidaFilter'); } //close if $fieldsSalida = array(salidaBodegaTableClass::EMPLEADO, salidaBodegaTableClass::ESTADO, salidaBodegaTableClass::FECHA, salidaBodegaTableClass::ID); $fieldsEmpleado = array(empleadoTableClass::NOMBRE); $fieldsEmpleado2 = array(empleadoTableClass::NOMBRE, empleadoTableClass::ID); $fJoin1 = salidaBodegaTableClass::EMPLEADO; $fJoin2 = empleadoTableClass::ID; $orderBy = array(salidaBodegaTableClass::ID); $fieldsInsumo = array(insumoTableClass::ID, insumoTableClass::NOMBRE); $fieldsTipoInsumo = array(tipoInsumoTableClass::ID, tipoInsumoTableClass::DESCRIPCION); $fieldsLote = array(loteTableClass::ID, loteTableClass::NOMBRE); $page = 0; if (request::getInstance()->hasGet('page')) { $page = request::getInstance()->getGet('page') - 1; $page = $page * config::getRowGrid(); } //close if $f = array(salidaBodegaTableClass::ID); $lines = config::getRowGrid(); $this->cntPages = salidaBodegaTableClass::getAllCount($f, true, $lines, $where); if (request::getInstance()->hasGet('page')) { $this->page = request::getInstance()->getGet('page'); } else { $this->page = $page; } //close if $this->objTipoInsumo = tipoInsumoTableClass::getAll($fieldsTipoInsumo, false); $this->objInsumo = insumoTableClass::getAll($fieldsInsumo, true); $this->objLote = loteTableClass::getAll($fieldsLote, true); $this->objEmpleado = empleadoTableClass::getAll($fieldsEmpleado2, false); $this->objSalidaBodega = salidaBodegaTableClass::getAllJoin($fieldsSalida, $fieldsEmpleado, null, null, $fJoin1, $fJoin2, null, null, null, null, true, $orderBy, 'ASC', config::getRowGrid(), $page, $where); log::register(i18n::__('ver1', null, 'bodega'), salidaBodegaTableClass::getNameTable()); $this->defineView('index', 'salidaBodega', session::getInstance()->getFormatOutput()); } catch (PDOException $exc) { session::getInstance()->setFlash('exc', $exc); routing::getInstance()->forward('shfSecurity', 'exception'); } }
public function execute() { try { $fieldsLote = array(loteTableClass::ID, loteTableClass::NOMBRE); $this->objLote = loteTableClass::getAll($fieldsLote); $this->defineView('insert', '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(loteTableClass::ID)) { $fields = array(loteTableClass::ID, loteTableClass::NOMBRE); $where = array(loteTableClass::ID => request::getInstance()->getRequest(loteTableClass::ID)); $this->objLote = loteTableClass::getAll($fields, false, null, null, null, null, $where); $this->defineView('edit', 'lote', session::getInstance()->getFormatOutput()); } else { routing::getInstance()->redirect('lote', 'index'); } } catch (PDOException $exc) { session::getInstance()->setFlash('exc', $exc); routing::getInstance()->forward('shfSecurity', 'exception'); } }
public function execute() { try { $where = null; if (session::getInstance()->hasAttribute('loteFiltersAnimal')) { $where = session::getInstance()->getAttribute('loteFiltersAnimal'); } $fields = array(loteTableClass::ID, loteTableClass::NOMBRE); $orderBy = array(loteTableClass::ID); $this->objLote = loteTableClass::getAll($fields, true, $orderBy, 'ASC', null, null, $where); $this->mensaje = 'Informe de los lotes en nuestro sistema'; $this->defineView('index', 'lote', 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['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; // if (request::getInstance()->hasRequest(entradaBodegaTableClass::ID)) { $idSalida = request::getInstance()->getRequest(detalleSalidaBodegaTableClass::ID); $where = null; if (request::getInstance()->hasPost('filter')) { $filter = request::getInstance()->getPost('filter'); if (isset($filter['tipoInsumo']) and $filter['tipoInsumo'] !== null and $filter['tipoInsumo'] !== '') { $where[detalleEntradaBodegaTableClass::TIPO_INSUMO] = $filter['tipoInsumo']; } //close if if (isset($filter['Insumo']) and $filter['Insumo'] !== null and $filter['Insumo'] !== '') { $where[detalleEntradaBodegaTableClass::ID_INSUMO] = $filter['Insumo']; } //close if if (isset($filter['cantidad']) and $filter['cantidad'] !== null and $filter['cantidad'] !== '') { $where[detalleEntradaBodegaTableClass::CANDITDAD] = $filter['cantidad']; } //close if $where[detalleSalidaBodegaTableClass::ID_SALIDA] = $idSalida; session::getInstance()->setAttribute('detalleSalida', $where); } elseif (session::getInstance()->hasAttribute('detalleSalida')) { $where = session::getInstance()->getAttribute('detalleSalida'); } else { $where = array(detalleSalidaBodegaTableClass::ID_SALIDA => $idSalida); } //close if $fieldsSalida = array(salidaBodegaTableClass::ID, salidaBodegaTableClass::FECHA); $fieldsEmpleado = array(empleadoTableClass::NOMBRE); $whereSalida = array(salidaBodegaTableClass::getNameTable() . '.' . salidaBodegaTableClass::ID => $idSalida); $fJoinEntrada1 = salidaBodegaTableClass::EMPLEADO; $fJoinEntrada2 = empleadoTableClass::ID; $page = 0; if (request::getInstance()->hasGet('page')) { $page = request::getInstance()->getGet('page') - 1; $page = $page * config::getRowGrid(); } //close if $f = array(detalleSalidaBodegaTableClass::ID); $whereCnt = array(detalleSalidaBodegaTableClass::ID_SALIDA => $idSalida); $lines = config::getRowGrid(); $fieldsDetalleSalida = array(detalleSalidaBodegaTableClass::ID, detalleSalidaBodegaTableClass::CANDITDAD, detalleSalidaBodegaTableClass::ID_SALIDA); $fieldsDetalleInsumo = array(insumoTableClass::NOMBRE); $fieldsDetalleTipoInsumo = array(tipoInsumoTableClass::DESCRIPCION); $fieldsL = array(loteTableClass::NOMBRE); $fJoin1 = detalleSalidaBodegaTableClass::ID_INSUMO; $fJoin2 = insumoTableClass::ID; $fJoin3 = detalleSalidaBodegaTableClass::TIPO_INSUMO; $fJoin4 = tipoInsumoTableClass::ID; $fJoin5 = detalleSalidaBodegaTableClass::LOTE; $fJoin6 = loteTableClass::ID; $fieldsInsumo = array(insumoTableClass::ID, insumoTableClass::NOMBRE); $fieldsTipoInsumo = array(tipoInsumoTableClass::ID, tipoInsumoTableClass::DESCRIPCION); $fieldsLote = array(loteTableClass::ID, loteTableClass::NOMBRE); $this->objTipoInsumo = tipoInsumoTableClass::getAll($fieldsTipoInsumo, false); $this->objInsumo = insumoTableClass::getAll($fieldsInsumo, true); $this->objLote = loteTableClass::getAll($fieldsLote, true); $this->cntPages = detalleSalidaBodegaTableClass::getAllCount($f, true, $lines, $whereCnt); $this->objSalida = salidaBodegaTableClass::getAllJoin($fieldsSalida, $fieldsEmpleado, null, null, $fJoinEntrada1, $fJoinEntrada2, null, null, null, null, true, null, null, config::getRowGrid(), $page, $whereSalida); $this->objDetalleSalida = detalleSalidaBodegaTableClass::getAllJoin($fieldsDetalleSalida, $fieldsDetalleInsumo, $fieldsDetalleTipoInsumo, $fieldsL, $fJoin1, $fJoin2, $fJoin3, $fJoin4, $fJoin5, $fJoin6, false, null, 'ASC', config::getRowGrid(), $page, $where); log::register(i18n::__('ver3', null, 'bodega'), detalleSalidaBodegaTableClass::getNameTable()); $this->defineView('view', 'salidaBodega', session::getInstance()->getFormatOutput()); // } else { // session::getInstance()->setError('pailas'); // routing::getInstance()->redirect('vacunacion', 'indexVacunacion'); // }//close if } catch (PDOException $exc) { session::getInstance()->setFlash('exc', $exc); routing::getInstance()->forward('shfSecurity', 'exception'); } }