From e2f55ce099eaaf9597e5d95b0ad29f72f70eb604 Mon Sep 17 00:00:00 2001 From: valdevir Date: Mon, 17 Aug 2020 14:20:42 +0000 Subject: [PATCH] =?UTF-8?q?fixes=20bug#19632=20qua:=20dev:Valdir=20Impleme?= =?UTF-8?q?ntado=20relat=C3=B3rio=20para=20mostrar=20caixa=20por=20=C3=B3r?= =?UTF-8?q?g=C3=A3o=20concedente=20pode=20filtrar=20por=20usu=C3=A1rio=20e?= =?UTF-8?q?=20por=20ag=C3=AAncia.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git-svn-id: http://desenvolvimento.rjconsultores.com.br/repositorio/sco/AdmVenta/Web/trunk/ventaboletos@102910 d1611594-4594-4d17-8e1d-87c2c4800839 --- ...latorioCaixaOrgaoConcedenteController.java | 60 ++++++++++++++----- web/WEB-INF/i3-label_en.label | 2 + web/WEB-INF/i3-label_es_MX.label | 2 + web/WEB-INF/i3-label_pt_BR.label | 2 + 4 files changed, 52 insertions(+), 14 deletions(-) diff --git a/src/java/com/rjconsultores/ventaboletos/web/gui/controladores/relatorios/RelatorioCaixaOrgaoConcedenteController.java b/src/java/com/rjconsultores/ventaboletos/web/gui/controladores/relatorios/RelatorioCaixaOrgaoConcedenteController.java index 3118ecb96..940eb8771 100644 --- a/src/java/com/rjconsultores/ventaboletos/web/gui/controladores/relatorios/RelatorioCaixaOrgaoConcedenteController.java +++ b/src/java/com/rjconsultores/ventaboletos/web/gui/controladores/relatorios/RelatorioCaixaOrgaoConcedenteController.java @@ -1,7 +1,6 @@ package com.rjconsultores.ventaboletos.web.gui.controladores.relatorios; import java.text.SimpleDateFormat; -import java.util.Date; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -69,6 +68,9 @@ public class RelatorioCaixaOrgaoConcedenteController extends MyGenericForwardCom Map parametros = new HashMap(); SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy"); + if(!validaCampos()) { + return; + } if (this.dataInicial.getValue() != null) { parametros.put("fecInicio", sdf.format(this.dataInicial.getValue())); @@ -77,19 +79,7 @@ public class RelatorioCaixaOrgaoConcedenteController extends MyGenericForwardCom parametros.put("fecFinal", sdf.format(this.dataFinal.getValue())); } - if ((parametros.get("fecInicio") != null || parametros.get("fecFinal") != null) && - ((parametros.get("fecInicio") == null || parametros.get("fecFinal") == null))) { - Messagebox.show(Labels.getLabel("relatorioCaixaOrgaoConcedenteController.window.title"), - Labels.getLabel("relatorioCaixaOrgaoConcedenteController.window.title"), - Messagebox.OK, Messagebox.INFORMATION); - return; - } - - if(DateUtil.compareOnlyDate(dataInicial.getValue()) >0 ) { - Messagebox.show(Labels.getLabel("relatorio.parametro.dataMenorDataAtual"), - Labels.getLabel("relatorioCaixaOrgaoConcedenteController.window.title"), - Messagebox.OK, Messagebox.INFORMATION); - } + if (cmbEmpresa.getSelectedIndex() != -1) { parametros.put("empresa", ((Empresa) cmbEmpresa.getSelectedItem().getValue()).getEmpresaId()); parametros.put("nomb_empresa", ((Empresa) cmbEmpresa.getSelectedItem().getValue()).getNombempresa()); @@ -149,6 +139,48 @@ public class RelatorioCaixaOrgaoConcedenteController extends MyGenericForwardCom openWindow("/component/reportView.zul", Labels.getLabel("relatorioCaixaOrgaoConcedenteController.window.title"), args, MODAL); + } + + private boolean validaCampos() throws Exception{ + if (dataInicial.getValue() == null || dataFinal.getValue() ==null ) { + Messagebox.show(Labels.getLabel("MSG.Error.invalida.dataInicialOuDataFinalNaoInformada"), + Labels.getLabel("relatorioCaixaOrgaoConcedenteController.window.title"), + Messagebox.OK, Messagebox.INFORMATION); + + return false; + } + + + if(DateUtil.compareOnlyDate(dataInicial.getValue(), dataFinal.getValue() ) >0 ) { + Messagebox.show(Labels.getLabel("MSG.Error.invalida.dataInicialDepoisDataFinal"), + Labels.getLabel("relatorioCaixaOrgaoConcedenteController.window.title"), + Messagebox.OK, Messagebox.ERROR); + return false; + } + + if(DateUtil.compareOnlyDate(dataInicial.getValue()) >0 ) { + Messagebox.show(Labels.getLabel("relatorio.parametro.dataMenorDataAtual"), + Labels.getLabel("relatorioCaixaOrgaoConcedenteController.window.title"), + Messagebox.OK, Messagebox.ERROR); + return false; + } + + if(cmbEmpresa.getValue()==null || cmbEmpresa.getValue().isEmpty()) { + Messagebox.show(Labels.getLabel("MSG.Error.empresa.naoinformado"), + Labels.getLabel("relatorioCaixaOrgaoConcedenteController.window.title"), + Messagebox.OK, Messagebox.ERROR); + return false; + } + + if(DateUtil.diferencaEntreDatasEmdias(dataInicial.getValue(), dataFinal.getValue()) > 30) { + Messagebox.show(Labels.getLabel("MSG.Error.data.maiorquelimite"), + Labels.getLabel("relatorioCaixaOrgaoConcedenteController.window.title"), + Messagebox.OK, Messagebox.ERROR); + return false; + } + return true; + + } public List getLsEmpresas() { diff --git a/web/WEB-INF/i3-label_en.label b/web/WEB-INF/i3-label_en.label index 7367fff28..22e5a00a4 100644 --- a/web/WEB-INF/i3-label_en.label +++ b/web/WEB-INF/i3-label_en.label @@ -65,6 +65,8 @@ MSG.Error.invalida.intervaloInvalidoDias=dia(s). MSG.Error.invalida.puntoVentaSemFechamentoParaEmpresa=Esta agência não possui fechamento para esta empresa. MSG.ATIVADO=Ativado MSG.DESATIVADO=Desativado +MSG.Error.empresa.naoinformado = Empresa não informada +MSG.Error.data.maiorquelimite = Intervalo de datas deve ser menor que 30 dias # Labels Default lb.id=ID diff --git a/web/WEB-INF/i3-label_es_MX.label b/web/WEB-INF/i3-label_es_MX.label index ab1bd4be0..ca44d6c32 100644 --- a/web/WEB-INF/i3-label_es_MX.label +++ b/web/WEB-INF/i3-label_es_MX.label @@ -64,6 +64,8 @@ MSG.Error.invalida.intervaloInvalidoDias = dia(s). MSG.Error.invalida.puntoVentaSemFechamentoParaEmpresa = Esta agência não possui fechamento para esta empresa. MSG.ATIVADO = Ativado MSG.DESATIVADO = Desativado +MSG.Error.empresa.naoinformado = Empresa não informada +MSG.Error.data.maiorquelimite = Intervalo de datas deve ser menor que 30 dias # Labels Default lb.id = ID diff --git a/web/WEB-INF/i3-label_pt_BR.label b/web/WEB-INF/i3-label_pt_BR.label index 8a18af7ae..af5da8dd3 100644 --- a/web/WEB-INF/i3-label_pt_BR.label +++ b/web/WEB-INF/i3-label_pt_BR.label @@ -63,6 +63,8 @@ MSG.Error.necessita.puntoVenta = Ponto de Venda (Agência) Obrigatório MSG.Error.invalida.intervaloInvalido = Intervalo inválido, o período de pesquisa deve ser de MSG.Error.invalida.intervaloInvalidoDias = dia(s). MSG.Error.invalida.puntoVentaSemFechamentoParaEmpresa = Esta agência não possui fechamento para esta empresa. +MSG.Error.empresa.naoinformado = Empresa não informada +MSG.Error.data.maiorquelimite = Intervalo de datas deve ser menor que 30 dias MSG.ATIVADO = Ativado MSG.DESATIVADO = Desativado