From 525d2b0c2edbb2a7cc27a8cddc15aec01431cab7 Mon Sep 17 00:00:00 2001 From: leonardo Date: Mon, 28 Mar 2016 19:59:30 +0000 Subject: [PATCH] fixes bug #7288 git-svn-id: http://desenvolvimento.rjconsultores.com.br/repositorio/sco/AdmVenta/Web/trunk/ventaboletos@54309 d1611594-4594-4d17-8e1d-87c2c4800839 --- .../RelatorioArquivoBGMController.java | 18 +++++++++++++++--- web/WEB-INF/i3-label_es_MX.label | 1 + web/WEB-INF/i3-label_pt_BR.label | 1 + .../relatorios/filtroRelatorioArquivoBGM.zul | 4 ++-- 4 files changed, 19 insertions(+), 5 deletions(-) diff --git a/src/java/com/rjconsultores/ventaboletos/web/gui/controladores/relatorios/RelatorioArquivoBGMController.java b/src/java/com/rjconsultores/ventaboletos/web/gui/controladores/relatorios/RelatorioArquivoBGMController.java index da120eb5e..a8f2afbf6 100644 --- a/src/java/com/rjconsultores/ventaboletos/web/gui/controladores/relatorios/RelatorioArquivoBGMController.java +++ b/src/java/com/rjconsultores/ventaboletos/web/gui/controladores/relatorios/RelatorioArquivoBGMController.java @@ -20,6 +20,8 @@ import org.apache.log4j.Logger; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Scope; import org.springframework.stereotype.Controller; +import org.zkoss.util.resource.Labels; +import org.zkoss.zhtml.Messagebox; import org.zkoss.zk.ui.Component; import org.zkoss.zk.ui.event.Event; import org.zkoss.zul.Datebox; @@ -57,6 +59,12 @@ public class RelatorioArquivoBGMController extends MyGenericForwardComposer { } public void onClick$btnExecutarRelatorio(Event ev) throws Exception { + if (cmbPuntoVenta.getSelectedItem() == null){ + Messagebox.show(Labels.getLabel("relatorioArquivoBGMController.msg.erro.puntoventa"), + Labels.getLabel("relatorioArquivoBGMController.window.title"), + Messagebox.OK, Messagebox.INFORMATION); + return; + } executarRelatorio(); } @@ -72,6 +80,10 @@ public class RelatorioArquivoBGMController extends MyGenericForwardComposer { cal.setTime(datInicial.getValue()); Calendar calFinal = Calendar.getInstance(); calFinal.setTime(datFinal.getValue()); + + Calendar cf = Calendar.getInstance(); + cf.setTime(datFinal.getValue()); + cf.add(Calendar.DATE, 1); // seta dia e mês finais para limite da iteração int diaFinal = calFinal.get(Calendar.DAY_OF_MONTH); int mesFinal = calFinal.get(Calendar.MONTH); @@ -79,8 +91,8 @@ public class RelatorioArquivoBGMController extends MyGenericForwardComposer { try{ con = dataSource.getConnection(); - while (cal.get(Calendar.DAY_OF_MONTH) <= diaFinal && cal.get(Calendar.MONTH) <= mesFinal) { - String fileName = System.getProperty("jboss.server.log.dir") + "/BGM-" + cal.get(Calendar.YEAR) + "" + DespesaReceita.lpad(Integer.toString(cal.get(Calendar.MONTH) + 1), "0", 2) + "" + DespesaReceita.lpad(Integer.toString(cal.get(Calendar.DAY_OF_MONTH)), "0", 2) + ".txt"; + while (cal.before(cf)) { + String fileName = System.getProperty("jboss.server.log.dir") + File.separator + "BGM-" + cal.get(Calendar.YEAR) + "" + DespesaReceita.lpad(Integer.toString(cal.get(Calendar.MONTH) + 1), "0", 2) + "" + DespesaReceita.lpad(Integer.toString(cal.get(Calendar.DAY_OF_MONTH)), "0", 2) + ".txt"; File file = new File(fileName); Totalbus totalbus = new Totalbus(con); @@ -96,7 +108,7 @@ public class RelatorioArquivoBGMController extends MyGenericForwardComposer { } - String fileZip = System.getProperty("jboss.server.log.dir") + "/ArquivosBGM.zip"; + String fileZip = System.getProperty("jboss.server.log.dir") + File.separator + "ArquivosBGM.zip"; log.debug("nome arquivo: " + fileZip); FileInputStream inputStream; diff --git a/web/WEB-INF/i3-label_es_MX.label b/web/WEB-INF/i3-label_es_MX.label index 3de7d7544..d6a22df2f 100644 --- a/web/WEB-INF/i3-label_es_MX.label +++ b/web/WEB-INF/i3-label_es_MX.label @@ -6245,6 +6245,7 @@ relatorioArquivoBGMController.lbDataIni.value = Data Inicial relatorioArquivoBGMController.lbDataFin.value = Data Final relatorioArquivoBGMController.lbEmpresa.value = Empresa relatorioArquivoBGMController.lbPuntoVenta.value = Agência +relatorioArquivoBGMController.msg.erro.puntoventa = O Campo Agência é obrigatório! # Recebimento Malote recebimentoMaloteController.window.title = Recebimento Malote diff --git a/web/WEB-INF/i3-label_pt_BR.label b/web/WEB-INF/i3-label_pt_BR.label index fb97c9947..1576de1c0 100644 --- a/web/WEB-INF/i3-label_pt_BR.label +++ b/web/WEB-INF/i3-label_pt_BR.label @@ -6372,6 +6372,7 @@ relatorioArquivoBGMController.lbDataIni.value = Data Inicial relatorioArquivoBGMController.lbDataFin.value = Data Final relatorioArquivoBGMController.lbEmpresa.value = Empresa relatorioArquivoBGMController.lbPuntoVenta.value = Agência +relatorioArquivoBGMController.msg.erro.puntoventa = O Campo Agência é obrigatório! # Recebimento Malote recebimentoMaloteController.window.title = Recebimento Malote diff --git a/web/gui/relatorios/filtroRelatorioArquivoBGM.zul b/web/gui/relatorios/filtroRelatorioArquivoBGM.zul index 456123370..3c689ae14 100644 --- a/web/gui/relatorios/filtroRelatorioArquivoBGM.zul +++ b/web/gui/relatorios/filtroRelatorioArquivoBGM.zul @@ -35,7 +35,7 @@ value="${c:l('relatorioArquivoBGMController.lbEmpresa.value')}" /> @@ -43,7 +43,7 @@ value="${c:l('relatorioArquivoBGMController.lbPuntoVenta.value')}" />