diff --git a/src/java/com/rjconsultores/ventaboletos/relatorios/impl/RelatorioGratuidadeARTESP.java b/src/java/com/rjconsultores/ventaboletos/relatorios/impl/RelatorioGratuidadeARTESP.java index 9708bc06a..2c7da1961 100644 --- a/src/java/com/rjconsultores/ventaboletos/relatorios/impl/RelatorioGratuidadeARTESP.java +++ b/src/java/com/rjconsultores/ventaboletos/relatorios/impl/RelatorioGratuidadeARTESP.java @@ -48,8 +48,9 @@ public class RelatorioGratuidadeARTESP extends Relatorio { String linhaIds = parametros.get("linhaIds").toString(); String empresa = parametros.get("empresa") != null ? parametros.get("empresa").toString() : ""; String codOrgaoConcedente = parametros.get("CodOrgaoConcedente").toString(); + String estados = (String) parametros.get("ESTADOS_ID"); - String sql = getSql(fecInicioVenda, fecFinalVenda, linhaIds, tipGratuIds, empresa, codOrgaoConcedente); + String sql = getSql(fecInicioVenda, fecFinalVenda, linhaIds, tipGratuIds, empresa, codOrgaoConcedente, estados); NamedParameterStatement stmt = new NamedParameterStatement(conexao, sql); @@ -129,7 +130,7 @@ public class RelatorioGratuidadeARTESP extends Relatorio { bean.setEndereco(retornarPrimeiroEndereco(rset.getString("endereco"))); bean.setDesistencia(rset.getBoolean("desistencia")); bean.setVlrGratuidade(rset.getBigDecimal("vlrGratuidade")); - + bean.setChaveBPE(rset.getString("chaveBPE")); lsDadosRelatorio.add(bean); } @@ -169,7 +170,7 @@ public class RelatorioGratuidadeARTESP extends Relatorio { protected void processaParametros() throws Exception { } - private String getSql(String fecInicioVenda, String fecFinalVenda, String linha, String tipoGratu, String empresa, String codOrgaoConcedente) { + private String getSql(String fecInicioVenda, String fecFinalVenda, String linha, String tipoGratu, String empresa, String codOrgaoConcedente, String estados) { StringBuilder sql = new StringBuilder(); @@ -207,7 +208,8 @@ public class RelatorioGratuidadeARTESP extends Relatorio { sql.append("THEN 1 ELSE 0 "); sql.append("END AS DESISTENCIA, "); sql.append(" (COALESCE(T.PRECIO, 0) + COALESCE(T.IMPORTEPEDAGIO,0)) "); - sql.append("-(COALESCE(b.PRECIOPAGADO, 0) + COALESCE(b.IMPORTEPEDAGIO,0)) AS vlrGratuidade "); + sql.append("-(COALESCE(b.PRECIOPAGADO, 0) + COALESCE(b.IMPORTEPEDAGIO,0)) AS vlrGratuidade, "); + sql.append(" bpe.chbpe as chaveBPE "); sql.append("FROM BOLETO b "); sql.append(" LEFT JOIN CAJA ON B.BOLETO_ID = CAJA.TRANSACAO_ID "); sql.append("JOIN categoria ca ON b.categoria_id = ca.categoria_id "); @@ -224,6 +226,8 @@ public class RelatorioGratuidadeARTESP extends Relatorio { sql.append("JOIN ORGAO_EMP_PARAM O ON e.empresa_id = O.EMPRESA_ID AND OC.ORGAOCONCEDENTE_ID = O.ORGAOCONCEDENTE_ID AND O.ACTIVO = 1 "); sql.append("JOIN TARIFA T ON r.RUTA_ID = T.RUTA_ID AND b.ORIGEN_ID = T.ORIGEN_ID AND b.DESTINO_ID = T.DESTINO_ID AND b.CLASESERVICIO_ID = T.CLASESERVICIO_ID AND m.MARCA_ID = T.MARCA_ID AND oc.ORGAOCONCEDENTE_ID = T.ORGAOCONCEDENTE_ID AND T.TRAMO_ID=tr.TRAMO_ID and T.ACTIVO=1 "); sql.append("JOIN VIGENCIA_TARIFA vt ON vt.VIGENCIATARIFA_ID = t.VIGENCIATARIFA_ID AND b.FECHORVIAJE BETWEEN vt.FECINICIOVIGENCIA AND vt.FECFINVIGENCIA "); + sql.append(" left JOIN BPE bpe ON bpe.BOLETO_ID = b.BOLETO_ID and bpe.activo = 1 "); + sql.append(" LEFT JOIN estado e ON e.CODIBGE = bpe.UF "); sql.append("WHERE b.fechorviaje BETWEEN to_date(:fecInicioVenda,'dd/mm/yyyy hh24:mi') AND to_date(:fecFinalVenda,'dd/mm/yyyy hh24:mi') "); sql.append("AND (b.MOTIVOCANCELACION_ID not in (4) or b.MOTIVOCANCELACION_ID is null) "); @@ -242,6 +246,9 @@ public class RelatorioGratuidadeARTESP extends Relatorio { if(codOrgaoConcedente != null && Integer.valueOf(codOrgaoConcedente) > -1) { sql.append(" AND OC.ORGAOCONCEDENTE_ID = :codOrgaoConcedente"); } + if (estados != null) { + sql.append(" AND e.ESTADO_ID IN ( " + estados + " )"); + } sql.append(" group by OC.DESCORGAO, O.CODEMPRESAPORORGAO, B.FECHORVIAJE, ca.desccategoria, "); sql.append(" ori.cveparada, ori.descparada, des.cveparada, B.NUMASIENTO, des.descparada, "); @@ -249,7 +256,7 @@ public class RelatorioGratuidadeARTESP extends Relatorio { sql.append(" b.FECCORRIDA, COALESCE(c.numtelefono, CAJA.DESCTELEFONO), c.DESCCORREO, CASE WHEN b.DESCNUMDOC IS NOT NULL THEN b.DESCNUMDOC ELSE c.NUMIDENTIFICAUNO END, "); sql.append(" b.NUMFOLIOSISTEMA, CASE WHEN b.DESCNUMDOC2 IS NOT NULL THEN b.DESCNUMDOC2 ELSE c.NUMIDENTIFICADOS END, b.NOMBPASAJERO, b.NUMIDENTIFICACION, T.PRECIO, b.PRECIOPAGADO, b.descorgaodoc, r.PREFIXO, B.MOTIVOCANCELACION_ID, "); sql.append(" T.IMPORTEOUTROS, T.IMPORTEPEDAGIO, T.IMPORTESEGURO, T.IMPORTETAXAEMBARQUE, T.IMPORTETPP, b.descorgaodoc, "); - sql.append(" b.IMPORTECATEGORIA, b.IMPORTEOUTROS, b.IMPORTEPEDAGIO, b.IMPORTESEGURO, b.IMPORTETAXAEMBARQUE, b.IMPORTETPP "); + sql.append(" b.IMPORTECATEGORIA, b.IMPORTEOUTROS, b.IMPORTEPEDAGIO, b.IMPORTESEGURO, b.IMPORTETAXAEMBARQUE, b.IMPORTETPP, bpe.chbpe "); sql.append(" ORDER BY OC.DESCORGAO, O.CODEMPRESAPORORGAO, b.FECHORVIAJE, descorigem, descdestino "); return sql.toString(); diff --git a/src/java/com/rjconsultores/ventaboletos/relatorios/internacionalizacao/RelatorioGratuidadeARTESP_pt_BR.properties b/src/java/com/rjconsultores/ventaboletos/relatorios/internacionalizacao/RelatorioGratuidadeARTESP_pt_BR.properties index 46a212bb9..e46476e5d 100644 --- a/src/java/com/rjconsultores/ventaboletos/relatorios/internacionalizacao/RelatorioGratuidadeARTESP_pt_BR.properties +++ b/src/java/com/rjconsultores/ventaboletos/relatorios/internacionalizacao/RelatorioGratuidadeARTESP_pt_BR.properties @@ -35,4 +35,5 @@ detail.telEmail=Tel/\nE-mail detail.desistencia=Houve Desistência? detail.gratuidade=Valor Gratuidade concedida detail.total=Total +detail.chaveBPE=Chave BPE diff --git a/src/java/com/rjconsultores/ventaboletos/relatorios/templates/RelatorioGratuidadeARTESP.jasper b/src/java/com/rjconsultores/ventaboletos/relatorios/templates/RelatorioGratuidadeARTESP.jasper index 1c85d1fb7..f0473b373 100644 Binary files a/src/java/com/rjconsultores/ventaboletos/relatorios/templates/RelatorioGratuidadeARTESP.jasper and b/src/java/com/rjconsultores/ventaboletos/relatorios/templates/RelatorioGratuidadeARTESP.jasper differ diff --git a/src/java/com/rjconsultores/ventaboletos/relatorios/templates/RelatorioGratuidadeARTESP.jrxml b/src/java/com/rjconsultores/ventaboletos/relatorios/templates/RelatorioGratuidadeARTESP.jrxml index b3e62aa60..43bc1c21e 100644 --- a/src/java/com/rjconsultores/ventaboletos/relatorios/templates/RelatorioGratuidadeARTESP.jrxml +++ b/src/java/com/rjconsultores/ventaboletos/relatorios/templates/RelatorioGratuidadeARTESP.jrxml @@ -1,8 +1,8 @@ - - - + + + @@ -33,70 +33,82 @@ + <band height="136"> <textField> - <reportElement x="0" y="0" width="614" height="37" uuid="8c77b68e-7c9d-4b71-8cc1-fbb6aaf36f9c"/> + <reportElement uuid="8c77b68e-7c9d-4b71-8cc1-fbb6aaf36f9c" x="0" y="0" width="614" height="37"/> <textElement markup="styled"> <font size="22" isBold="true"/> </textElement> <textFieldExpression><![CDATA[$P{TITULO}]]></textFieldExpression> </textField> <textField pattern="dd/MM/yyyy HH:mm"> - <reportElement x="720" y="0" width="102" height="37" uuid="32538cdd-7697-4a03-8035-f9474e869395"/> + <reportElement uuid="32538cdd-7697-4a03-8035-f9474e869395" x="720" y="0" width="102" height="37"/> <textElement textAlignment="Left"/> <textFieldExpression><![CDATA[new java.util.Date()]]></textFieldExpression> </textField> <textField> - <reportElement x="614" y="0" width="106" height="37" uuid="abc399f3-d012-46aa-b4e9-678ab812bee4"/> + <reportElement uuid="abc399f3-d012-46aa-b4e9-678ab812bee4" x="614" y="0" width="106" height="37"/> + <textElement/> <textFieldExpression><![CDATA[$R{header.data.hora}]]></textFieldExpression> </textField> <textField> - <reportElement x="129" y="37" width="591" height="20" uuid="f25e6675-4dcb-4d37-8586-e50abe4013af"/> + <reportElement uuid="f25e6675-4dcb-4d37-8586-e50abe4013af" x="129" y="37" width="591" height="20"/> + <textElement/> <textFieldExpression><![CDATA[( $P{fecInicioVenda} != null ? ($P{fecInicioVenda} + " Ă  " + $P{fecFinalVenda}) : "" )]]></textFieldExpression> </textField> <textField> - <reportElement x="1" y="37" width="127" height="20" uuid="e15cecc4-995a-4cbc-934e-44970c809849"/> + <reportElement uuid="e15cecc4-995a-4cbc-934e-44970c809849" x="1" y="37" width="127" height="20"/> + <textElement/> <textFieldExpression><![CDATA[$R{header.periodo.viagem}]]></textFieldExpression> </textField> <textField> - <reportElement x="2" y="96" width="127" height="20" isRemoveLineWhenBlank="true" uuid="234e6e88-b5a2-4793-a029-85f64b4cad85"/> + <reportElement uuid="234e6e88-b5a2-4793-a029-85f64b4cad85" x="2" y="96" width="127" height="20" isRemoveLineWhenBlank="true"/> + <textElement/> <textFieldExpression><![CDATA[$R{header.tipopassagem}]]></textFieldExpression> </textField> <textField> - <reportElement x="2" y="56" width="127" height="20" isRemoveLineWhenBlank="true" uuid="d3d41ddb-2dbb-4b0e-bf82-02af7f81b63f"/> + <reportElement uuid="d3d41ddb-2dbb-4b0e-bf82-02af7f81b63f" x="2" y="56" width="127" height="20" isRemoveLineWhenBlank="true"/> + <textElement/> <textFieldExpression><![CDATA[$R{header.empresa}]]></textFieldExpression> </textField> <textField> - <reportElement x="129" y="116" width="591" height="20" isRemoveLineWhenBlank="true" uuid="c61794c6-537b-4cab-9a5c-41c3101cdaac"/> + <reportElement uuid="c61794c6-537b-4cab-9a5c-41c3101cdaac" x="129" y="116" width="591" height="20" isRemoveLineWhenBlank="true"/> + <textElement/> <textFieldExpression><![CDATA[$P{orgaoConcedente}]]></textFieldExpression> </textField> <textField> - <reportElement x="129" y="96" width="591" height="20" isRemoveLineWhenBlank="true" uuid="6b435ede-b8f2-46ee-8098-50d36c0d5e23"/> + <reportElement uuid="6b435ede-b8f2-46ee-8098-50d36c0d5e23" x="129" y="96" width="591" height="20" isRemoveLineWhenBlank="true"/> + <textElement/> <textFieldExpression><![CDATA[$P{tipGratu}]]></textFieldExpression> </textField> <textField> - <reportElement x="2" y="116" width="127" height="20" isRemoveLineWhenBlank="true" uuid="7a4f4ad0-6b74-4194-b089-2bf61e0b7ce4"/> + <reportElement uuid="7a4f4ad0-6b74-4194-b089-2bf61e0b7ce4" x="2" y="116" width="127" height="20" isRemoveLineWhenBlank="true"/> + <textElement/> <textFieldExpression><![CDATA[$R{header.orgaoConcedente}]]></textFieldExpression> </textField> <textField> - <reportElement x="129" y="76" width="591" height="20" isRemoveLineWhenBlank="true" uuid="7bc881ef-b270-4178-8416-54ad2602eaab"/> + <reportElement uuid="7bc881ef-b270-4178-8416-54ad2602eaab" x="129" y="76" width="591" height="20" isRemoveLineWhenBlank="true"/> + <textElement/> <textFieldExpression><![CDATA[$P{linhas}]]></textFieldExpression> </textField> <textField> - <reportElement x="129" y="56" width="591" height="20" isRemoveLineWhenBlank="true" uuid="33bc773a-8bd3-4bc0-946c-664d78a19f5c"/> + <reportElement uuid="33bc773a-8bd3-4bc0-946c-664d78a19f5c" x="129" y="56" width="591" height="20" isRemoveLineWhenBlank="true"/> + <textElement/> <textFieldExpression><![CDATA[$P{nomb_empresa}]]></textFieldExpression> </textField> <textField> - <reportElement x="2" y="76" width="127" height="20" isRemoveLineWhenBlank="true" uuid="c3b8e525-e015-4aaa-a505-1a92f3d6b0fb"/> + <reportElement uuid="c3b8e525-e015-4aaa-a505-1a92f3d6b0fb" x="2" y="76" width="127" height="20" isRemoveLineWhenBlank="true"/> + <textElement/> <textFieldExpression><![CDATA[$R{header.filtro.linha}]]></textFieldExpression> </textField> </band> - + - + @@ -108,7 +120,7 @@ - + @@ -120,7 +132,7 @@ - + @@ -132,7 +144,7 @@ - + @@ -145,7 +157,7 @@ - + @@ -157,7 +169,7 @@ - + @@ -169,7 +181,7 @@ - + @@ -181,7 +193,7 @@ - + @@ -193,7 +205,7 @@ - + @@ -205,7 +217,7 @@ - + @@ -217,7 +229,7 @@ - + @@ -229,7 +241,7 @@ - + @@ -241,7 +253,7 @@ - + @@ -253,7 +265,7 @@ - + @@ -265,7 +277,7 @@ - + @@ -277,7 +289,7 @@ - + @@ -288,12 +300,24 @@ + + + + + + + + + + + + - + - + @@ -305,7 +329,7 @@ - + @@ -317,7 +341,7 @@ - + @@ -329,7 +353,7 @@ - + @@ -341,7 +365,7 @@ - + @@ -353,7 +377,7 @@ - + @@ -365,7 +389,7 @@ - + @@ -377,7 +401,7 @@ - + @@ -389,7 +413,7 @@ - + @@ -401,7 +425,7 @@ - + @@ -413,7 +437,7 @@ - + @@ -425,7 +449,7 @@ - + @@ -437,7 +461,7 @@ - + @@ -450,7 +474,7 @@ - + @@ -462,7 +486,7 @@ - + @@ -477,7 +501,7 @@ ? $F{email} : $F{tel}]]> - + @@ -488,12 +512,25 @@ + + + + + + + + + + + + - + + diff --git a/src/java/com/rjconsultores/ventaboletos/relatorios/utilitarios/RelatorioGratuidadeARTESPBean.java b/src/java/com/rjconsultores/ventaboletos/relatorios/utilitarios/RelatorioGratuidadeARTESPBean.java index bcbff4af9..695f8b683 100644 --- a/src/java/com/rjconsultores/ventaboletos/relatorios/utilitarios/RelatorioGratuidadeARTESPBean.java +++ b/src/java/com/rjconsultores/ventaboletos/relatorios/utilitarios/RelatorioGratuidadeARTESPBean.java @@ -24,6 +24,7 @@ public class RelatorioGratuidadeARTESPBean { private String email; private Boolean desistencia; private BigDecimal vlrGratuidade; + private String chaveBPE; public String getEmpresa() { @@ -185,4 +186,13 @@ public class RelatorioGratuidadeARTESPBean { public void setOrgao(String orgao) { this.orgao = orgao; } + + public String getChaveBPE() { + return chaveBPE; + } + + public void setChaveBPE(String chaveBPE) { + this.chaveBPE = chaveBPE; + } + } diff --git a/src/java/com/rjconsultores/ventaboletos/web/gui/controladores/relatorios/RelatorioGratuidadeARTESPController.java b/src/java/com/rjconsultores/ventaboletos/web/gui/controladores/relatorios/RelatorioGratuidadeARTESPController.java index e0693de08..4c2f82fed 100644 --- a/src/java/com/rjconsultores/ventaboletos/web/gui/controladores/relatorios/RelatorioGratuidadeARTESPController.java +++ b/src/java/com/rjconsultores/ventaboletos/web/gui/controladores/relatorios/RelatorioGratuidadeARTESPController.java @@ -21,17 +21,20 @@ import org.zkoss.zul.Textbox; import com.rjconsultores.ventaboletos.entidad.Categoria; import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.entidad.Estado; import com.rjconsultores.ventaboletos.entidad.OrgaoConcedente; import com.rjconsultores.ventaboletos.entidad.Ruta; import com.rjconsultores.ventaboletos.relatorios.impl.RelatorioGratuidadeARTESP; import com.rjconsultores.ventaboletos.relatorios.utilitarios.Relatorio; import com.rjconsultores.ventaboletos.service.CategoriaService; import com.rjconsultores.ventaboletos.service.EmpresaService; +import com.rjconsultores.ventaboletos.service.EstadoService; import com.rjconsultores.ventaboletos.service.OrgaoConcedenteService; import com.rjconsultores.ventaboletos.service.RutaService; import com.rjconsultores.ventaboletos.web.utilerias.MyComboboxEstandar; import com.rjconsultores.ventaboletos.web.utilerias.MyGenericForwardComposer; import com.rjconsultores.ventaboletos.web.utilerias.MyListbox; +import com.rjconsultores.ventaboletos.web.utilerias.render.RenderEstadoUf; import com.rjconsultores.ventaboletos.web.utilerias.render.RenderRelatorioLinhaHorario; @Controller("relatorioGratuidadeARTESPController") @@ -64,9 +67,12 @@ public class RelatorioGratuidadeARTESPController extends MyGenericForwardCompose private MyListbox linhaList; private MyListbox linhaListSelList; private MyListbox selectedTipoGratuidadeList; + private MyListbox estadoList; private List listSelectedTipoGratuidade; private static Logger log = Logger.getLogger(RelatorioGratuidadeARTESPController.class); + @Autowired + private EstadoService estadoService; public void onClick$btnRemoveTipoGratuidade(Event ev) throws InterruptedException { Categoria categoria = (Categoria) selectedTipoGratuidadeList.getSelectedItem().getValue(); @@ -212,6 +218,22 @@ public class RelatorioGratuidadeARTESPController extends MyGenericForwardCompose } parametros.put("TITULO", Labels.getLabel("relatorioGratuidadeARTESPController.window.title")); + + String estadosIds = ""; + String UFs = ""; + List lsEstadosSelecionados = estadoList.getItensSelecionados(); + + if (!lsEstadosSelecionados.isEmpty()) { + for (int i = 0; i < lsEstadosSelecionados.size(); i++) { + Estado estado = (Estado) lsEstadosSelecionados.get(i); + UFs = UFs + estado.getCveestado() + ","; + estadosIds = estadosIds + estado.getEstadoId() + ","; + } + + estadosIds = estadosIds.substring(0, estadosIds.length() - 1); + UFs = UFs.substring(0, UFs.length() - 1); + parametros.put("ESTADOS_ID", estadosIds); + } Relatorio relatorio = new RelatorioGratuidadeARTESP(parametros, dataSourceRead.getConnection()); @@ -240,6 +262,8 @@ public class RelatorioGratuidadeARTESPController extends MyGenericForwardCompose linhaList.setItemRenderer(new RenderRelatorioLinhaHorario()); linhaListSelList.setItemRenderer(new RenderRelatorioLinhaHorario()); + estadoList.setItemRenderer(new RenderEstadoUf()); + estadoList.setData(estadoService.obtenerTodos()); } public List getLsCategorias() { diff --git a/web/gui/relatorios/filtroRelatorioGratuidadeARTESP.zul b/web/gui/relatorios/filtroRelatorioGratuidadeARTESP.zul index b7d6c8771..75c7c7bc5 100644 --- a/web/gui/relatorios/filtroRelatorioGratuidadeARTESP.zul +++ b/web/gui/relatorios/filtroRelatorioGratuidadeARTESP.zul @@ -7,7 +7,7 @@ @@ -47,7 +47,14 @@ use="com.rjconsultores.ventaboletos.web.utilerias.MyComboboxEstandar" model="@{winFiltroRelatorioGratuidadeARTESP$composer.lsEmpresas}" /> - + +