From 4d530f7f54a7696a580b0709a8077471569e59d4 Mon Sep 17 00:00:00 2001 From: julio Date: Wed, 8 Jun 2016 20:39:23 +0000 Subject: [PATCH] bug #7500 git-svn-id: http://desenvolvimento.rjconsultores.com.br/repositorio/sco/AdmVenta/Web/trunk/ventaboletos@56832 d1611594-4594-4d17-8e1d-87c2c4800839 --- .../BusquedaImportacionFiscalController.java | 48 +++++++++++--- ...enuImportacionFiscalReducaoZPendencia.java | 33 ++++++++++ .../impressaofiscal/TipoImportacaoFiscal.java | 62 ++----------------- web/WEB-INF/i3-label_es_MX.label | 2 + web/WEB-INF/i3-label_pt_BR.label | 4 +- .../busquedaImportacionFiscal.zul | 4 ++ 6 files changed, 87 insertions(+), 66 deletions(-) create mode 100644 src/java/com/rjconsultores/ventaboletos/web/utilerias/menu/item/relatorios/impressaofiscal/ItemMenuImportacionFiscalReducaoZPendencia.java diff --git a/src/java/com/rjconsultores/ventaboletos/web/gui/controladores/impressaofiscal/BusquedaImportacionFiscalController.java b/src/java/com/rjconsultores/ventaboletos/web/gui/controladores/impressaofiscal/BusquedaImportacionFiscalController.java index 8ffe874e3..6ea116902 100644 --- a/src/java/com/rjconsultores/ventaboletos/web/gui/controladores/impressaofiscal/BusquedaImportacionFiscalController.java +++ b/src/java/com/rjconsultores/ventaboletos/web/gui/controladores/impressaofiscal/BusquedaImportacionFiscalController.java @@ -67,6 +67,7 @@ public class BusquedaImportacionFiscalController extends MyGenericForwardCompose private Button btnExeRelatorioFinanceiro; private Button btnExeRelatorioVoucher; private Button btnExeRelatorioPendenciaEcf; + private Button btnExeRelatorioPendenciaReducaoZ; private Boolean isExibirTipoGeracaoArquivo; private Boolean isExibirCompetencia; @@ -84,62 +85,69 @@ public class BusquedaImportacionFiscalController extends MyGenericForwardCompose private void defineImportacao() { - boolean isEcf = (Boolean) Executions.getCurrent().getArg().get("ECF"); + boolean isEcf = Executions.getCurrent().getArg().get("ECF") == null ? Boolean.FALSE : (Boolean) Executions.getCurrent().getArg().get("ECF"); if (isEcf) { btnExeImportacionEcf.setVisible(true); } else { btnExeImportacionEcf.setVisible(false); } - boolean isEcfCancel = (Boolean) Executions.getCurrent().getArg().get("ECF_CANCELADOS"); + boolean isEcfCancel = Executions.getCurrent().getArg().get("ECF_CANCELADOS") == null ? Boolean.FALSE : (Boolean) Executions.getCurrent().getArg().get("ECF_CANCELADOS"); if (isEcfCancel) { btnExeImportacionEcfCancelados.setVisible(true); } else { btnExeImportacionEcfCancelados.setVisible(false); } - boolean isManual = (Boolean) Executions.getCurrent().getArg().get("MANUAL"); + boolean isManual = Executions.getCurrent().getArg().get("MANUAL") == null ? Boolean.FALSE : (Boolean) Executions.getCurrent().getArg().get("MANUAL"); if (isManual) { btnExeImportacionManual.setVisible(true); } else { btnExeImportacionManual.setVisible(false); } - boolean isReducaoZ = (Boolean) Executions.getCurrent().getArg().get("REDUCAO_Z"); + boolean isReducaoZ = Executions.getCurrent().getArg().get("REDUCAO_Z") == null ? Boolean.FALSE : (Boolean) Executions.getCurrent().getArg().get("REDUCAO_Z"); if (isReducaoZ) { btnExeImportacionReducaoZ.setVisible(true); } else { btnExeImportacionReducaoZ.setVisible(false); } - boolean isNaoFiscal = (Boolean) Executions.getCurrent().getArg().get("NAO_FISCAL"); + boolean isNaoFiscal = Executions.getCurrent().getArg().get("NAO_FISCAL") == null ? Boolean.FALSE : (Boolean) Executions.getCurrent().getArg().get("NAO_FISCAL"); if (isNaoFiscal) { btnExeImportacionNaoFiscal.setVisible(true); } else { btnExeImportacionNaoFiscal.setVisible(false); } - boolean isRelatorioFinanceiro = (Boolean) Executions.getCurrent().getArg().get("RELATORIO_FINANCEIRO"); + boolean isRelatorioFinanceiro = Executions.getCurrent().getArg().get("RELATORIO_FINANCEIRO") == null ? Boolean.FALSE : (Boolean) Executions.getCurrent().getArg().get("RELATORIO_FINANCEIRO"); if (isRelatorioFinanceiro) { btnExeRelatorioFinanceiro.setVisible(true); } else { btnExeRelatorioFinanceiro.setVisible(false); } - boolean isRelatorioVoucher = (Boolean) Executions.getCurrent().getArg().get("RELATORIO_VOUCHER"); + boolean isRelatorioVoucher = Executions.getCurrent().getArg().get("RELATORIO_VOUCHER") == null ? Boolean.FALSE : (Boolean) Executions.getCurrent().getArg().get("RELATORIO_VOUCHER"); if (isRelatorioVoucher) { btnExeRelatorioVoucher.setVisible(true); } else { btnExeRelatorioVoucher.setVisible(false); } - boolean isRelatorioPendenciaEcf = (Boolean) Executions.getCurrent().getArg().get("PENDENCIA_ECF"); + boolean isRelatorioPendenciaEcf = Executions.getCurrent().getArg().get("PENDENCIA_ECF") == null ? Boolean.FALSE : (Boolean) Executions.getCurrent().getArg().get("PENDENCIA_ECF"); if (isRelatorioPendenciaEcf) { btnExeRelatorioPendenciaEcf.setVisible(true); } else { btnExeRelatorioPendenciaEcf.setVisible(false); } + boolean isRelatorioPendenciaReducaoZ = Executions.getCurrent().getArg().get("PENDENCIA_REDUCAO_Z") == null ? Boolean.FALSE : (Boolean) Executions.getCurrent().getArg().get("PENDENCIA_REDUCAO_Z"); + if (isRelatorioPendenciaReducaoZ) { + btnExeRelatorioPendenciaReducaoZ.setVisible(true); + } else { + btnExeRelatorioPendenciaReducaoZ.setVisible(false); + } + isExibirTipoGeracaoArquivo = (Boolean) Executions.getCurrent().getArg().get("ExibirTipoGeracaoArquivo"); isExibirCompetencia = (Boolean) Executions.getCurrent().getArg().get("ExibirCompetencia"); isExibirDatas = isExibirCompetencia != null ? !isExibirCompetencia : true; @@ -265,6 +273,30 @@ public class BusquedaImportacionFiscalController extends MyGenericForwardCompose } } + public void onClick$btnExeRelatorioPendenciaReducaoZ(Event ev) throws InterruptedException { + + Empresa empresa = null; + Comboitem itemEmpresa = cmbEmpresa.getSelectedItem(); + if (itemEmpresa != null) { + empresa = (Empresa) itemEmpresa.getValue(); + } + + try { + File arquivoTxt = fiscalService.importacionFiscalReducaoZPendencia(datInicial.getValue(), datFinal.getValue(), empresa); + File arquivoXls = null; + // if (chkArquivoXls.isChecked()) { + // arquivoXls = fiscalService.importacionFiscalReducaoZXls(empresa, arquivoTxt); + // } + downloadArquivo(arquivoTxt, arquivoXls); + /* + * File arquivo = fiscalService.importacionFiscalReducaoZ(datInicial.getValue(), datFinal.getValue(), empresa); InputStream is = new FileInputStream(arquivo); Filedownload.save(is, "application/notepad", "fiscal_reducao_z" + DateUtil.getStringDate(Calendar.getInstance().getTime(), "yyyyMMddhhmm") + ".txt"); arquivo.delete(); + */ + } catch (Exception e) { + log.error("", e); + } + + } + public void onClick$btnExeImportacionReducaoZ(Event ev) throws InterruptedException { Empresa empresa = null; diff --git a/src/java/com/rjconsultores/ventaboletos/web/utilerias/menu/item/relatorios/impressaofiscal/ItemMenuImportacionFiscalReducaoZPendencia.java b/src/java/com/rjconsultores/ventaboletos/web/utilerias/menu/item/relatorios/impressaofiscal/ItemMenuImportacionFiscalReducaoZPendencia.java new file mode 100644 index 000000000..b65369dbd --- /dev/null +++ b/src/java/com/rjconsultores/ventaboletos/web/utilerias/menu/item/relatorios/impressaofiscal/ItemMenuImportacionFiscalReducaoZPendencia.java @@ -0,0 +1,33 @@ +package com.rjconsultores.ventaboletos.web.utilerias.menu.item.relatorios.impressaofiscal; + +import java.util.HashMap; + +import org.zkoss.util.resource.Labels; + +import com.rjconsultores.ventaboletos.web.utilerias.PantallaUtileria; +import com.rjconsultores.ventaboletos.web.utilerias.menu.DefaultItemMenuSistema; +import com.rjconsultores.ventaboletos.web.utilerias.menu.item.relatorios.impressaofiscal.TipoImportacaoFiscal.TipoImportacao; + +public class ItemMenuImportacionFiscalReducaoZPendencia extends DefaultItemMenuSistema { + + public ItemMenuImportacionFiscalReducaoZPendencia() { + super("indexController.mniImportacionFiscalPendenciaReducaoZ.label"); + } + + @Override + public String getClaveMenu() { + return "COM.RJCONSULTORES.ADMINISTRACION.GUI.RELATORIOS.IMPRESSAOFISCAL.MENU.IMPORTACIONFISCAL"; + } + + @Override + public void ejecutar() { + + @SuppressWarnings("unchecked") + HashMap map = TipoImportacaoFiscal.selecionaTipoImportacao(TipoImportacao.PENDENCIA_REDUCAO_Z, (HashMap) getArgs()); + // map.put("ExibirTipoGeracaoArquivo", true); + + PantallaUtileria.openWindow("/gui/impressaofiscal/busquedaImportacionFiscal.zul", + Labels.getLabel("busquedaImportacionFiscalEcfPendenciaReducaoZController.window.title"), map, desktop); + + } +} diff --git a/src/java/com/rjconsultores/ventaboletos/web/utilerias/menu/item/relatorios/impressaofiscal/TipoImportacaoFiscal.java b/src/java/com/rjconsultores/ventaboletos/web/utilerias/menu/item/relatorios/impressaofiscal/TipoImportacaoFiscal.java index ae9f0a2d1..22a1f3132 100644 --- a/src/java/com/rjconsultores/ventaboletos/web/utilerias/menu/item/relatorios/impressaofiscal/TipoImportacaoFiscal.java +++ b/src/java/com/rjconsultores/ventaboletos/web/utilerias/menu/item/relatorios/impressaofiscal/TipoImportacaoFiscal.java @@ -5,7 +5,7 @@ import java.util.HashMap; public class TipoImportacaoFiscal { public enum TipoImportacao { - ECF, ECF_CANCELADOS, MANUAL, REDUCAO_Z, NAO_FISCAL, RELATORIO_FINANCEIRO, RELATORIO_VOUCHER, PENDENCIA_ECF; + ECF, ECF_CANCELADOS, MANUAL, REDUCAO_Z, NAO_FISCAL, RELATORIO_FINANCEIRO, RELATORIO_VOUCHER, PENDENCIA_ECF, PENDENCIA_REDUCAO_Z; } public static HashMap selecionaTipoImportacao(TipoImportacao tipo, HashMap map) { @@ -21,92 +21,40 @@ public class TipoImportacaoFiscal { if (tipo.equals(TipoImportacao.ECF)) { map.put(TipoImportacao.ECF.toString(), Boolean.TRUE); - map.put(TipoImportacao.ECF_CANCELADOS.toString(), Boolean.FALSE); - map.put(TipoImportacao.MANUAL.toString(), Boolean.FALSE); - map.put(TipoImportacao.REDUCAO_Z.toString(), Boolean.FALSE); - map.put(TipoImportacao.NAO_FISCAL.toString(), Boolean.FALSE); - map.put(TipoImportacao.RELATORIO_FINANCEIRO.toString(), Boolean.FALSE); - map.put(TipoImportacao.RELATORIO_VOUCHER.toString(), Boolean.FALSE); - map.put(TipoImportacao.PENDENCIA_ECF.toString(), Boolean.FALSE); } if (tipo.equals(TipoImportacao.ECF_CANCELADOS)) { - map.put(TipoImportacao.ECF.toString(), Boolean.FALSE); map.put(TipoImportacao.ECF_CANCELADOS.toString(), Boolean.TRUE); - map.put(TipoImportacao.MANUAL.toString(), Boolean.FALSE); - map.put(TipoImportacao.REDUCAO_Z.toString(), Boolean.FALSE); - map.put(TipoImportacao.NAO_FISCAL.toString(), Boolean.FALSE); - map.put(TipoImportacao.RELATORIO_FINANCEIRO.toString(), Boolean.FALSE); - map.put(TipoImportacao.RELATORIO_VOUCHER.toString(), Boolean.FALSE); - map.put(TipoImportacao.PENDENCIA_ECF.toString(), Boolean.FALSE); } if (tipo.equals(TipoImportacao.MANUAL)) { - map.put(TipoImportacao.ECF.toString(), Boolean.FALSE); - map.put(TipoImportacao.ECF_CANCELADOS.toString(), Boolean.FALSE); map.put(TipoImportacao.MANUAL.toString(), Boolean.TRUE); - map.put(TipoImportacao.REDUCAO_Z.toString(), Boolean.FALSE); - map.put(TipoImportacao.NAO_FISCAL.toString(), Boolean.FALSE); - map.put(TipoImportacao.RELATORIO_FINANCEIRO.toString(), Boolean.FALSE); - map.put(TipoImportacao.RELATORIO_VOUCHER.toString(), Boolean.FALSE); - map.put(TipoImportacao.PENDENCIA_ECF.toString(), Boolean.FALSE); } if (tipo.equals(TipoImportacao.REDUCAO_Z)) { - map.put(TipoImportacao.ECF.toString(), Boolean.FALSE); - map.put(TipoImportacao.ECF_CANCELADOS.toString(), Boolean.FALSE); - map.put(TipoImportacao.MANUAL.toString(), Boolean.FALSE); map.put(TipoImportacao.REDUCAO_Z.toString(), Boolean.TRUE); - map.put(TipoImportacao.NAO_FISCAL.toString(), Boolean.FALSE); - map.put(TipoImportacao.RELATORIO_FINANCEIRO.toString(), Boolean.FALSE); - map.put(TipoImportacao.RELATORIO_VOUCHER.toString(), Boolean.FALSE); - map.put(TipoImportacao.PENDENCIA_ECF.toString(), Boolean.FALSE); } if (tipo.equals(TipoImportacao.NAO_FISCAL)) { - map.put(TipoImportacao.ECF.toString(), Boolean.FALSE); - map.put(TipoImportacao.ECF_CANCELADOS.toString(), Boolean.FALSE); - map.put(TipoImportacao.MANUAL.toString(), Boolean.FALSE); - map.put(TipoImportacao.REDUCAO_Z.toString(), Boolean.FALSE); map.put(TipoImportacao.NAO_FISCAL.toString(), Boolean.TRUE); - map.put(TipoImportacao.RELATORIO_FINANCEIRO.toString(), Boolean.FALSE); - map.put(TipoImportacao.RELATORIO_VOUCHER.toString(), Boolean.FALSE); - map.put(TipoImportacao.PENDENCIA_ECF.toString(), Boolean.FALSE); } if (tipo.equals(TipoImportacao.RELATORIO_FINANCEIRO)) { - map.put(TipoImportacao.ECF.toString(), Boolean.FALSE); - map.put(TipoImportacao.ECF_CANCELADOS.toString(), Boolean.FALSE); - map.put(TipoImportacao.MANUAL.toString(), Boolean.FALSE); - map.put(TipoImportacao.REDUCAO_Z.toString(), Boolean.FALSE); - map.put(TipoImportacao.NAO_FISCAL.toString(), Boolean.FALSE); map.put(TipoImportacao.RELATORIO_FINANCEIRO.toString(), Boolean.TRUE); - map.put(TipoImportacao.RELATORIO_VOUCHER.toString(), Boolean.FALSE); - map.put(TipoImportacao.PENDENCIA_ECF.toString(), Boolean.FALSE); } if (tipo.equals(TipoImportacao.RELATORIO_VOUCHER)) { - map.put(TipoImportacao.ECF.toString(), Boolean.FALSE); - map.put(TipoImportacao.ECF_CANCELADOS.toString(), Boolean.FALSE); - map.put(TipoImportacao.MANUAL.toString(), Boolean.FALSE); - map.put(TipoImportacao.REDUCAO_Z.toString(), Boolean.FALSE); - map.put(TipoImportacao.NAO_FISCAL.toString(), Boolean.FALSE); - map.put(TipoImportacao.RELATORIO_FINANCEIRO.toString(), Boolean.FALSE); map.put(TipoImportacao.RELATORIO_VOUCHER.toString(), Boolean.TRUE); - map.put(TipoImportacao.PENDENCIA_ECF.toString(), Boolean.FALSE); } if (tipo.equals(TipoImportacao.PENDENCIA_ECF)) { - map.put(TipoImportacao.ECF.toString(), Boolean.FALSE); - map.put(TipoImportacao.ECF_CANCELADOS.toString(), Boolean.FALSE); - map.put(TipoImportacao.MANUAL.toString(), Boolean.FALSE); - map.put(TipoImportacao.REDUCAO_Z.toString(), Boolean.FALSE); - map.put(TipoImportacao.NAO_FISCAL.toString(), Boolean.FALSE); - map.put(TipoImportacao.RELATORIO_FINANCEIRO.toString(), Boolean.FALSE); - map.put(TipoImportacao.RELATORIO_VOUCHER.toString(), Boolean.FALSE); map.put(TipoImportacao.PENDENCIA_ECF.toString(), Boolean.TRUE); } + if (tipo.equals(TipoImportacao.PENDENCIA_REDUCAO_Z)) { + map.put(TipoImportacao.PENDENCIA_REDUCAO_Z.toString(), Boolean.TRUE); + } + return map; } diff --git a/web/WEB-INF/i3-label_es_MX.label b/web/WEB-INF/i3-label_es_MX.label index d7c377213..8be24b6d4 100644 --- a/web/WEB-INF/i3-label_es_MX.label +++ b/web/WEB-INF/i3-label_es_MX.label @@ -283,6 +283,7 @@ indexController.mniImportacionNaoFiscal.label=Não Fiscal indexController.mniRelatorioFinanceiro.label=Financeiro indexController.mniRelatorioVoucher.label=Voucher indexController.mniImportacionFiscalPendenciaEcf.label=Pendência ECF +indexController.mniImportacionFiscalPendenciaReducaoZ.label=Pendência Redução Z indexController.mniSubMenuClientePacote.label=Paquete indexController.mniManutencaoPacote.label=Mantenimiento Paquete @@ -6442,6 +6443,7 @@ busquedaImportacionFiscalNaoFiscalController.window.title=Impressão Fiscal :: N busquedaImportacionFiscalRelatorioFinanceiroController.window.title=Impressão Fiscal :: Relatório Financeiro busquedaImportacionFiscalRelatorioVoucherController.window.title=Impressão Fiscal :: Relatório Voucher busquedaImportacionFiscalEcfPendenciaController.window.title=Impressão Fiscal :: Pendência ECF +busquedaImportacionFiscalEcfPendenciaReducaoZController.window.title=Impressão Fiscal :: Pendência Redução Z #OCD busquedaOCDParamController.empresa.label=Empresa diff --git a/web/WEB-INF/i3-label_pt_BR.label b/web/WEB-INF/i3-label_pt_BR.label index ad07a3615..31bb78bcd 100644 --- a/web/WEB-INF/i3-label_pt_BR.label +++ b/web/WEB-INF/i3-label_pt_BR.label @@ -289,6 +289,7 @@ indexController.mniImportacionNaoFiscal.label=Não Fiscal indexController.mniRelatorioFinanceiro.label=Financeiro indexController.mniRelatorioVoucher.label=Voucher indexController.mniImportacionFiscalPendenciaEcf.label=Pendência ECF +indexController.mniImportacionFiscalPendenciaReducaoZ.label=Pendência Redução Z indexController.mniSubMenuClientePacote.label=Pacote indexController.mniManutencaoPacote.label=Manutenção Pacote @@ -6591,4 +6592,5 @@ busquedaImportacionFiscalReducaoZController.window.title=Impressão Fiscal :: Re busquedaImportacionFiscalNaoFiscalController.window.title=Impressão Fiscal :: Não Fiscal busquedaImportacionFiscalRelatorioFinanceiroController.window.title=Impressão Fiscal :: Relatório Financeiro busquedaImportacionFiscalRelatorioVoucherController.window.title=Impressão Fiscal :: Relatório Voucher -busquedaImportacionFiscalEcfPendenciaController.window.title=Impressão Fiscal :: Pendência ECF \ No newline at end of file +busquedaImportacionFiscalEcfPendenciaController.window.title=Impressão Fiscal :: Pendência ECF +busquedaImportacionFiscalEcfPendenciaReducaoZController.window.title=Impressão Fiscal :: Pendência Redução Z \ No newline at end of file diff --git a/web/gui/impressaofiscal/busquedaImportacionFiscal.zul b/web/gui/impressaofiscal/busquedaImportacionFiscal.zul index f91300fac..46ff2e4da 100644 --- a/web/gui/impressaofiscal/busquedaImportacionFiscal.zul +++ b/web/gui/impressaofiscal/busquedaImportacionFiscal.zul @@ -94,6 +94,10 @@