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 {
         if (request::getInstance()->isMethod('POST')) {
             // DATOS DE ANIMAL
             $fecha = request::getInstance()->getPost(registroPesoTableClass::getNameField(registroPesoTableClass::FECHA, true));
             $empleado = request::getInstance()->getPost(registroPesoTableClass::getNameField(registroPesoTableClass::EMPLEADO, true));
             $animal = request::getInstance()->getPost(registroPesoTableClass::getNameField(registroPesoTableClass::ANIMAL, true));
             $valor_kilo = request::getInstance()->getPost(registroPesoTableClass::getNameField(registroPesoTableClass::KILO, true));
             //        $valor_total = request::getInstance()->getPost(registroPesoTableClass::getNameField(registroPesoTableClass::VALOR, true));
             $peso = request::getInstance()->getPost(registroPesoTableClass::getNameField(registroPesoTableClass::PESO, true));
             $valor_total = $peso * $valor_kilo;
             registroPesoTableClass::validateCreate($fecha, $empleado, $peso, $valor_kilo);
             //                $datos = array(
             //                    $fecha,
             //                    $empleado,
             //                    $animal,
             //                    $valor_kilo,
             //                    $valor_total,
             //                    $peso
             //                );
             $dataPeso = array(registroPesoTableClass::FECHA => $fecha, registroPesoTableClass::EMPLEADO => $empleado, registroPesoTableClass::ANIMAL => $animal, registroPesoTableClass::KILO => $valor_kilo, registroPesoTableClass::VALOR => $valor_total, registroPesoTableClass::PESO => $peso);
             registroPesoTableClass::insert($dataPeso);
             //                $fieldsAnimal = array(
             //                    hojaVidaTableClass::NUMERO,
             //                    hojaVidaTableClass::PESO,
             //                );
             //                $whereAnimal = array(
             //                    hojaVidaTableClass::ANIMAL => $animal
             //                );
             //                $objAnimalHojaDeVida = hojaVidaTableClass::getAll($fieldsAnimal, FALSE, NULL, NULL, NULL, NULL, $whereAnimal);
             //                $peso = $peso + $objAnimalHojaDeVida[0]->peso_animal;
             //                exit();
             // se pasa los datos del ID animal para Actualizar la hoja de vida
             $data = array(hojaVidaTableClass::PESO => $peso);
             $ids = array(hojaVidaTableClass::ANIMAL => $animal);
             hojaVidaTableClass::update($ids, $data);
             //FIN
             session::getInstance()->setSuccess(i18n::__('succesCreate1', null, 'dpVenta'));
             log::register(i18n::__('create'), registroPesoTableClass::getNameTable());
             routing::getInstance()->redirect('animal', 'indexRegistroPeso', array(hojaVidaTableClass::getNameField(hojaVidaTableClass::ANIMAL) => $animal));
         } else {
             log::register(i18n::__('create'), registroPesoTableClass::getNameTable(), i18n::__('errorCreateBitacora'));
             session::getInstance()->setError(i18n::__('errorCreate1', null, 'dpVenta'));
             routing::getInstance()->redirect('animal', 'indexRegistroPeso');
         }
     } catch (PDOException $exc) {
         session::getInstance()->setFlash('exc', $exc);
         routing::getInstance()->forward('shfSecurity', 'exception');
     }
 }
 public function execute()
 {
     try {
         if (request::getInstance()->isMethod('POST')) {
             $id = request::getInstance()->getPost(registroPesoTableClass::getNameField(registroPesoTableClass::ID, true));
             $cantidad = request::getInstance()->getPost(registroPesoTableClass::getNameField(registroPesoTableClass::KILO, true));
             //                vacunaTableClass::validateUpdateInsert($cantidad);
             $fieldsVacuna = array(registroPesoTableClass::KILO);
             $where = array(registroPesoTableClass::ID => $id);
             $vacuna = registroPesoTableClass::getAll($fieldsVacuna, true, null, null, null, null, $where);
             $vacunaTotal = $cantidad + $vacuna[0]->valor_kilo;
             $ids = array(registroPesoTableClass::ID => $id);
             $data = array(registroPesoTableClass::KILO => $vacunaTotal);
             registroPesoTableClass::update($ids, $data);
             session::getInstance()->setSuccess(i18n::__('qil', null, 'animal'));
             log::register(i18n::__('update'), registroPesoTableClass::getNameTable());
             routing::getInstance()->redirect('animal', 'indexRegistroPeso');
             //                $data = array(
             //                    razaTableClass::NOMBRE_RAZA => $nombre
             //                );
             //
             //                razaTableClass::update($ids, $data);
             //      session::getInstance()->setSuccess(i18n::__('succesUpdate'));
             //      log::register(i18n::__('update'), razaTableClass::getNameTable());
         } else {
             log::register(i18n::__('update'), registroPesoTableClass::getNameTable(), i18n::__('errorUpdateBitacora'));
             session::getInstance()->setError(i18n::__('errorCreate'));
             routing::getInstance()->redirect('animal', 'indexRegistroPeso');
         }
         //close if
         //       log::register(i18n::__('update'), razaTableClass::getNameTable(), i18n::__('errorUpdateBitacora'));
         //          session::getInstance()->setError(i18n::__('errorUpdate'));
     } catch (PDOException $exc) {
         session::getInstance()->setFlash('exc', $exc);
         routing::getInstance()->forward('shfSecurity', 'exception');
     }
 }
コード例 #4
0
?>
" name="<?php 
echo registroPesoTableClass::getNameField(registroPesoTableClass::PESO, true);
?>
"></th>
                    </tr>
                        <tr>
                        <th><?php 
echo i18n::__('valor_kilo');
?>
:</th>
                        <th> <input type="number" placeholder="<?php 
echo i18n::__('valor_kilo');
?>
" name="<?php 
echo registroPesoTableClass::getNameField(registroPesoTableClass::KILO, true);
?>
"></th>
                    </tr>
                 
                                                  <tr>
                        <th colspan="2" >
                    <div class=" text-center">

                        <input type="submit" class="btn" value="<?php 
echo i18n::__(isset($objRegistroPeso) == TRUE ? 'edit' : 'register', NULL, 'user');
?>
">

                    </div>
                    </th>
コード例 #5
0
 public static function validateModificar($fecha, $empleado, $valor_kilo, $valor_total, $peso)
 {
     $flag = false;
     $dateNow = date("Y-m-d H:m", strtotime("now"));
     if (empty($fecha) or !isset($fecha) or $fecha == '') {
         session::getInstance()->setError(i18n::__(10055, null, 'errors', array('%campo%' => $fecha)));
         $flag = true;
         session::getInstance()->setFlash(registroPesoTableClass::getNameField(registroPesoTableClass::FECHA, true), true);
     }
     if ($fecha > $dateNow) {
         session::getInstance()->setError(i18n::__(10010, null, 'errors', array('%fecha%' => $fecha)));
         $flag = true;
         session::getInstance()->setFlash(registroPesoTableClass::getNameField(registroPesoTableClass::FECHA, true), true);
     }
     if (empty($empleado) or !isset($empleado) or $empleado == '') {
         session::getInstance()->setError(i18n::__(10099, null, 'errors'));
         $flag = true;
         session::getInstance()->setFlash(registroPesoTableClass::getNameField(registroPesoTableClass::EMPLEADO, true), true);
     }
     if (!is_numeric($empleado)) {
         session::getInstance()->setError(i18n::__(10100, null, 'errors', array('%campo%' => $empleado)));
         $flag = true;
         session::getInstance()->setFlash(registroPesoTableClass::getNameField(registroPesoTableClass::EMPLEADO, true), true);
     }
     if ($empleado < 0) {
         session::getInstance()->setError(i18n::__(10101, null, 'errors'));
         $flag = true;
         session::getInstance()->setFlash(registroPesoTableClass::getNameField(registroPesoTableClass::EMPLEADO, true), true);
     }
     if (empty($valor_kilo) or !isset($valor_kilo) or $valor_kilo == '') {
         session::getInstance()->setError(i18n::__(10126, null, 'errors', array('%campo%' => $valor_kilo)));
         $flag = true;
         session::getInstance()->setFlash(registroPesoTableClass::getNameField(registroPesoTableClass::KILO, true), true);
     }
     if (!is_numeric($valor_kilo)) {
         session::getInstance()->setError(i18n::__(10127, null, 'errors', array('%campo%' => $valor_kilo)));
         $flag = true;
         session::getInstance()->setFlash(registroPesoTableClass::getNameField(registroPesoTableClass::KILO, true), true);
     }
     if ($valor_kilo < 0) {
         session::getInstance()->setError(i18n::__(10128, null, 'errors'));
         $flag = true;
         session::getInstance()->setFlash(registroPesoTableClass::getNameField(registroPesoTableClass::KILO, true), true);
     }
     if (strlen($valor_kilo) > 6) {
         session::getInstance()->setError(i18n::__(10129, null, 'errors'));
         $flag = true;
         session::getInstance()->setFlash(registroPesoTableClass::getNameField(registroPesoTableClass::KILO, true), true);
     }
     if (empty($valor_total) or !isset($valor_total) or $valor_total == '') {
         session::getInstance()->setError(i18n::__(10130, null, 'errors', array('%campo%' => $valor_total)));
         $flag = true;
         session::getInstance()->setFlash(registroPesoTableClass::getNameField(registroPesoTableClass::VALOR, true), true);
     }
     if (!is_numeric($valor_total)) {
         session::getInstance()->setError(i18n::__(10131, null, 'errors', array('%campo%' => $valor_total)));
         $flag = true;
         session::getInstance()->setFlash(registroPesoTableClass::getNameField(registroPesoTableClass::VALOR, true), true);
     }
     if ($valor_total < 0) {
         session::getInstance()->setError(i18n::__(10132, null, 'errors'));
         $flag = true;
         session::getInstance()->setFlash(registroPesoTableClass::getNameField(registroPesoTableClass::VALOR, true), true);
     }
     if (strlen($valor_total) > 10) {
         session::getInstance()->setError(i18n::__(10133, null, 'errors'));
         $flag = true;
         session::getInstance()->setFlash(registroPesoTableClass::getNameField(registroPesoTableClass::VALOR, true), true);
     }
     if (empty($peso) or !isset($peso) or $peso == '') {
         session::getInstance()->setError(i18n::__(10134, null, 'errors', array('%campo%' => $peso)));
         $flag = true;
         session::getInstance()->setFlash(registroPesoTableClass::getNameField(registroPesoTableClass::PESO, true), true);
     }
     if (!is_numeric($peso)) {
         session::getInstance()->setError(i18n::__(10135, null, 'errors', array('%campo%' => $peso)));
         $flag = true;
         session::getInstance()->setFlash(registroPesoTableClass::getNameField(registroPesoTableClass::PESO, true), true);
     }
     if ($peso < 0) {
         session::getInstance()->setError(i18n::__(10136, null, 'errors'));
         $flag = true;
         session::getInstance()->setFlash(registroPesoTableClass::getNameField(registroPesoTableClass::PESO, true), true);
     }
     if (strlen($peso) > 4) {
         session::getInstance()->setError(i18n::__(10137, null, 'errors'));
         $flag = true;
         session::getInstance()->setFlash(registroPesoTableClass::getNameField(registroPesoTableClass::PESO, true), true);
     }
     if ($flag == true) {
         request::getInstance()->setMethod('GET');
         routing::getInstance()->forward('animal', 'editRegistroPeso');
     }
 }
 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');
     }
 }