public function execute() { try { $where = null; if (request::getInstance()->hasRequest('filter')) { $report = request::getInstance()->getPost('filter'); if (isset($report['fecha_inicio']) and $report['fecha_inicio'] !== null and $report['fecha_inicio'] !== '' and isset($report['fecha_fin']) and $report['fecha_fin'] !== null and $report['fecha_fin'] !== '') { $where[salidaBodegaTableClass::getNameTable() . '.' . salidaBodegaTableClass::FECHA] = array(date(config::getFormatTimestamp(), strtotime($report['fecha_inicio'] . ' 00.00.00')), date(config::getFormatTimestamp(), strtotime($report['fecha_fin'] . ' 23.59.59'))); } //close if if (isset($report['empleado']) and $report['empleado'] !== null and $report['empleado'] !== '') { $where[salidaBodegaTableClass::getNameTable() . '.' . salidaBodegaTableClass::EMPLEADO] = $report['empleado']; } } $fields = array(salidaBodegaTableClass::ID, salidaBodegaTableClass::FECHA, salidaBodegaTableClass::EMPLEADO); $fieldsEmpleado = array(empleadoTableClass::ID, empleadoTableClass::NOMBRE); $fJoin1 = salidaBodegaTableClass::EMPLEADO; $fJoin2 = empleadoTableClass::ID; $orderBy = array(salidaBodegaTableClass::ID); $this->mensaje = "Informe de Salidas de Bodega"; $this->objSalida = salidaBodegaTableClass::getAllJoin($fields, $fieldsEmpleado, null, null, $fJoin1, $fJoin2, null, null, null, null, true, $orderBy, 'ASC', null, null, $where); log::register(i18n::__('reporte'), salidaBodegaTableClass::getNameTable()); $this->defineView('index', 'salidaBodega', session::getInstance()->getFormatOutput()); } catch (PDOException $exc) { session::getInstance()->setFlash('exc', $exc); routing::getInstance()->forward('shfSecurity', 'exception'); } }
/** * Método para borrar un registro de una tabla X en la base de datos * * @param string $table Nombre de la tabla * @param array $fieldsAndValues Array con los campos por posiciones * asociativas y los valores por valores a tener en cuenta para el borrado. * Ejemplo $fieldsAndValues['id'] = 1 * @param boolean $deletedLogical [optional] Borrado lógico [por defecto] o * borrado físico de un registro en una tabla de la base de datos * @return boolean * @throws \PDOException */ public static function delete($fieldsAndValues, $deletedLogical = true, $table) { try { if ($deletedLogical === false) { $sql = "DELETE FROM {$table} "; $sqlID = "SELECT id FROM {$table} "; $flag = 0; foreach ($fieldsAndValues as $field => $value) { if ($flag === 0) { $sql = $sql . 'WHERE ' . $field . ' = ' . (is_numeric($value) === true ? $value : "'{$value}' "); $sqlID = $sqlID . 'WHERE ' . $field . ' = ' . (is_numeric($value) === true ? $value : "'{$value}' "); $flag++; } else { $sql = $sql . 'AND ' . $field . ' = ' . (is_numeric($value) === true ? $value : "'{$value}' "); $sqlID = $sqlID . 'AND ' . $field . ' = ' . (is_numeric($value) === true ? $value : "'{$value}' "); } } $row = model::getInstance()->query($sqlID); $answer = $row->fetch(\PDO::FETCH_OBJ); $answer = (int) $answer->id; model::getInstance()->beginTransaction(); model::getInstance()->exec($sql); model::getInstance()->commit(); } else { $data[self::$fieldDeleteAt] = date(config::getFormatTimestamp()); $answer = self::update($fieldsAndValues, $data, $table); } return $answer; } catch (\PDOException $exc) { // en caso de haber un error entonces se devuelve todo y se deja como estaba model::getInstance()->rollback(); throw $exc; } }
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; if (request::getInstance()->hasRequest('filter')) { $report = request::getInstance()->getPost('filter'); if (isset($report['fecha_inicio']) and $report['fecha_inicio'] !== null and $report['fecha_inicio'] !== '' and isset($report['fecha_fin']) and $report['fecha_fin'] !== null and $report['fecha_fin'] !== '') { $where[procesoCompraTableClass::getNameTable() . '.' . procesoCompraTableClass::FECHA_HORA_COMPRA] = array(date(config::getFormatTimestamp(), strtotime($report['fecha_inicio'] . ' 00.00.00')), date(config::getFormatTimestamp(), strtotime($report['fecha_fin'] . ' 23.59.59'))); } //close if if (isset($report['empleado']) and $report['empleado'] !== null and $report['empleado'] !== '') { $where[procesoCompraTableClass::getNameTable() . '.' . procesoCompraTableClass::EMPLEADO_ID] = $report['empleado']; } if (isset($report['proveedor']) and $report['proveedor'] !== null and $report['proveedor'] !== '') { $where[procesoCompraTableClass::getNameTable() . '.' . procesoCompraTableClass::PROVEEDOR_ID] = $report['proveedor']; } } $fieldsFacturaCompra = array(procesoCompraTableClass::ID, procesoCompraTableClass::NUMERO, procesoCompraTableClass::FECHA_HORA_COMPRA); $fieldsEmpleado = array(empleadoTableClass::ID, empleadoTableClass::NOMBRE); $fieldsProveedor = array(proveedorTableClass::ID, proveedorTableClass::NOMBRE); $fJoin1 = procesoCompraTableClass::EMPLEADO_ID; $fJoin2 = empleadoTableClass::ID; $fJoin3 = procesoCompraTableClass::PROVEEDOR_ID; $fJoin4 = proveedorTableClass::ID; $this->objFacturaCompra = procesoCompraTableClass::getAllJoin($fieldsFacturaCompra, $fieldsEmpleado, $fieldsProveedor, null, $fJoin1, $fJoin2, $fJoin3, $fJoin4, null, null, true, null, null, null, null, $where); $this->mensaje = "Informe de Facturas de Compra"; log::register(i18n::__('reporte'), procesoCompraTableClass::getNameTable()); $this->defineView('report', 'facturaCompra', 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[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; 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[entradaBodegaTableClass::getNameTable() . '.' . entradaBodegaTableClass::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['fecha']) and $filter['fecha'] !== null and $filter['fecha'] !== '') { // $where[entradaBodegaTableClass::FECHA] = $filter['fecha']; // }//close if if (isset($filter['empleado']) and $filter['empleado'] !== null and $filter['empleado'] !== '') { $where[entradaBodegaTableClass::EMPLEADO] = $filter['empleado']; } //close if session::getInstance()->setAttribute('entradaFilter', $where); } elseif (session::getInstance()->hasAttribute('entradaFilter')) { $where = session::getInstance()->getAttribute('entradaFilter'); } //close if $fieldsEntrada = array(entradaBodegaTableClass::ID, entradaBodegaTableClass::FECHA, entradaBodegaTableClass::EMPLEADO, entradaBodegaTableClass::ESTADO); $fieldsEmpleado = array(empleadoTableClass::NOMBRE); $fieldsEmpleado2 = array(empleadoTableClass::NOMBRE, empleadoTableClass::ID); $fJoin1 = entradaBodegaTableClass::EMPLEADO; $fJoin2 = empleadoTableClass::ID; $orderBy = array(entradaBodegaTableClass::ID); $fieldsInsumo = array(insumoTableClass::ID, insumoTableClass::NOMBRE); $fieldsTipoInsumo = array(tipoInsumoTableClass::ID, tipoInsumoTableClass::DESCRIPCION); $page = 0; if (request::getInstance()->hasGet('page')) { $page = request::getInstance()->getGet('page') - 1; $page = $page * config::getRowGrid(); } //close if $f = array(entradaBodegaTableClass::ID); $lines = config::getRowGrid(); $this->cntPages = entradaBodegaTableClass::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->objEmpleado = empleadoTableClass::getAll($fieldsEmpleado2, false); $this->objEntradaBodega = entradaBodegaTableClass::getAllJoin($fieldsEntrada, $fieldsEmpleado, null, null, $fJoin1, $fJoin2, null, null, null, null, true, $orderBy, 'ASC', config::getRowGrid(), $page, $where); log::register(i18n::__('ver', null, 'bodega'), entradaBodegaTableClass::getNameTable()); $this->defineView('index', 'entradaBodega', session::getInstance()->getFormatOutput()); } catch (PDOException $exc) { session::getInstance()->setFlash('exc', $exc); routing::getInstance()->forward('shfSecurity', 'exception'); } }
/** * * @param type $accion * @param type $tabla * @param type $observacion * @param type $registro * @param type $user_id */ public static function register($accion, $tabla, $observacion = null, $registro = null, $user_id = null) { $data = array(\bitacoraTableClass::ACCION => $accion, \bitacoraTableClass::USUARIO_ID => session::getInstance()->hasUserId() ? session::getInstance()->getUserId() : $user_id, \bitacoraTableClass::FECHA => date(config::getFormatTimestamp()), \bitacoraTableClass::TABLA => $tabla); if ($observacion !== null) { $data[\bitacoraTableClass::OBSERVACION] = $observacion; } if ($registro !== null) { $data[\bitacoraTableClass::REGISTRO] = $registro; } session::getInstance()->setAttribute('shfLogRegister', serialize($data)); }
public static function setRegisterLastLoginAt($id) { try { $sql = 'UPDATE ' . usuarioTableClass::getNameTable() . ' SET ' . usuarioTableClass::LAST_LOGIN_AT . ' = :last_login_at WHERE ' . usuarioTableClass::ID . ' = :id'; $params = array(':id' => $id, ':last_login_at' => date(config::getFormatTimestamp())); $answer = model::getInstance()->prepare($sql); $answer->execute($params); return true; } catch (PDOException $exc) { throw $exc; } }
public function execute() { try { $where = null; if (request::getInstance()->hasRequest('filter')) { $report = request::getInstance()->getPost('filter'); if (isset($report['fecha_inicio']) and $report['fecha_inicio'] !== null and $report['fecha_inicio'] !== '' and isset($report['fecha_fin']) and $report['fecha_fin'] !== null and $report['fecha_fin'] !== '') { $where[procesoVentaTableClass::getNameTable() . '.' . procesoVentaTableClass::FECHA_HORA_COMPRA] = array(date(config::getFormatTimestamp(), strtotime($report['fecha_inicio'] . ' 00.00.00')), date(config::getFormatTimestamp(), strtotime($report['fecha_fin'] . ' 23.59.59'))); } //close if if (isset($report['empleado']) and $report['empleado'] !== null and $report['empleado'] !== '') { $where[procesoVentaTableClass::getNameTable() . '.' . procesoVentaTableClass::EMPLEADO_ID] = $report['empleado']; } if (isset($report['proveedor']) and $report['proveedor'] !== null and $report['proveedor'] !== '') { $where[procesoVentaTableClass::getNameTable() . '.' . procesoVentaTableClass::CLIENTE_ID] = $report['proveedor']; } if (isset($report['peso']) and $report['peso'] !== null and $report['peso'] !== '') { $where[procesoVentaTableClass::getNameTable() . '.' . procesoVentaTableClass::PESO] = $report['peso']; } if (isset($report['animal']) and $report['animal'] !== null and $report['animal'] !== '') { $where[procesoVentaTableClass::getNameTable() . '.' . procesoVentaTableClass::ANIMAL] = $report['animal']; } } $fieldsFacturaVenta = array(procesoVentaTableClass::ID, procesoVentaTableClass::FECHA_HORA_VENTA, procesoVentaTableClass::ACTIVA, procesoVentaTableClass::PESO, procesoVentaTableClass::SUBTOTAL); $fieldsEmpleado = array(empleadoTableClass::ID, empleadoTableClass::NOMBRE); $fieldsCliente = array(clienteTableClass::ID, clienteTableClass::NOMBRE); $fieldsAnimal = array(animalTableClass::ID, animalTableClass::NUMERO); $fJoin1 = procesoVentaTableClass::EMPLEADO_ID; $fJoin2 = empleadoTableClass::ID; $fJoin3 = procesoVentaTableClass::CLIENTE_ID; $fJoin4 = clienteTableClass::ID; $fJoin5 = procesoVentaTableClass::ANIMAL; $fJoin6 = animalTableClass::ID; $orderBy = array(procesoVentaTableClass::FECHA_HORA_VENTA); $this->objFacturaVenta = procesoVentaTableClass::getAllJoin($fieldsFacturaVenta, $fieldsEmpleado, $fieldsCliente, $fieldsAnimal, $fJoin1, $fJoin2, $fJoin3, $fJoin4, $fJoin5, $fJoin6, true, $orderBy, 'ASC', null, null, $where); $this->mensaje = "Informe de Facturas de Venta"; log::register(i18n::__('reporte'), procesoVentaTableClass::getNameTable()); $this->defineView('report', 'facturaVenta', 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 { 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'); } }
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'); } }