diff --git a/src/java/com/rjconsultores/ventaboletos/relatorios/impl/RelatorioBilhetesVendidosNovoLayout.java b/src/java/com/rjconsultores/ventaboletos/relatorios/impl/RelatorioBilhetesVendidosNovoLayout.java index 323351e7e..2b5fb111c 100644 --- a/src/java/com/rjconsultores/ventaboletos/relatorios/impl/RelatorioBilhetesVendidosNovoLayout.java +++ b/src/java/com/rjconsultores/ventaboletos/relatorios/impl/RelatorioBilhetesVendidosNovoLayout.java @@ -17,7 +17,6 @@ import com.rjconsultores.ventaboletos.relatorios.utilitarios.ArrayDataSource; import com.rjconsultores.ventaboletos.relatorios.utilitarios.IndStatusBoleto; import com.rjconsultores.ventaboletos.relatorios.utilitarios.Relatorio; import com.rjconsultores.ventaboletos.relatorios.utilitarios.RelatorioBilhetesVendidosNovoLayoutBean; -import com.rjconsultores.ventaboletos.relatorios.utilitarios.RelatorioVendasPTABean; import com.rjconsultores.ventaboletos.utilerias.DateUtil; import com.rjconsultores.ventaboletos.web.utilerias.NamedParameterStatement; @@ -47,26 +46,25 @@ public class RelatorioBilhetesVendidosNovoLayout extends Relatorio { StringBuilder sql = new StringBuilder(); - sql.append("SELECT est.cveestado as cveestado, ae.decespecie as especie, "); - sql.append(" a.acfiscal as numaidf,"); - sql.append(" c.fechorventa as datavenda,"); - sql.append(" a.forminicial as forminicial,"); - sql.append(" a.formfinal as formfinal,"); + sql.append("SELECT distinct est.cveestado as cveestado,"); + sql.append(" ae.decespecie as especie, "); + sql.append(" to_char(c.fechorventa, 'dd/mm/yyyy hh24:mi:ss') as datavenda,"); + sql.append(" (select min(NUMFOLIOSISTEMA) as maximo from boleto e where e.NUMOPERACION = c.NUMOPERACION) as forminicial,"); + sql.append(" (select max(NUMFOLIOSISTEMA) as maximo from boleto e where e.NUMOPERACION = c.NUMOPERACION) as formfinal,"); sql.append(" a.serie AS serie,"); - sql.append(" a.subserie as subserie,"); sql.append(" est.icms AS valoraliquiotaicms,"); sql.append(" c.preciopagado as valorcontabil,"); sql.append(" c.preciopagado - (c.preciopagado * coalesce(ei.porcredbaseicms / 100,0))AS valorbasecalculo, "); sql.append(" (c.preciopagado - (c.preciopagado * coalesce(ei.porcredbaseicms / 100,0)) * est.icms) / 100 AS valoricms, "); sql.append(" c.INDSTATUSBOLETO statuspassagem "); sql.append("FROM boleto c "); - sql.append("LEFT join aidf a ON a.aidf_id = c.aidf_id "); - sql.append("LEFT join aidf_especie ae ON (a.aidfesp_id = ae.aidfesp_id) "); + sql.append("left join aidf a ON a.aidf_id = c.aidf_id "); + sql.append("left join aidf_especie ae ON (a.aidfesp_id = ae.aidfesp_id) "); sql.append("join empresa e ON e.empresa_id = c.empresacorrida_id "); sql.append("join parada po ON po.parada_id = c.origen_id "); sql.append("join ciudad co ON co.ciudad_id = po.ciudad_id "); sql.append("join estado est ON est.estado_id = co.estado_id "); - sql.append("INNER join empresa_imposto ei ON ei.empresa_id = e.empresa_id "); + sql.append("join empresa_imposto ei ON ei.empresa_id = e.empresa_id "); sql.append("JOIN PUNTO_VENTA pv on c.PUNTOVENTA_ID = pv.PUNTOVENTA_ID "); sql.append("AND ei.estado_id = est.estado_id "); sql.append(" where "); @@ -84,12 +82,13 @@ public class RelatorioBilhetesVendidosNovoLayout extends Relatorio { if (parametros.get("STATUS").toString().contains("V") && parametros.get("STATUS").toString().contains("C")) { sql.append(" AND ((c.INDSTATUSBOLETO = 'C' AND c.MOTIVOCANCELACION_ID IS NOT NULL) OR (c.INDSTATUSBOLETO = 'V' AND c.MOTIVOCANCELACION_ID IS NULL)) "); } else if (parametros.get("STATUS").toString().contains("C")) { - sql.append(" AND c.INDSTATUSBOLETO = 'C' AND c.MOTIVOCANCELACION_ID IS NOT NULL"); + sql.append(" AND c.INDSTATUSBOLETO = 'C' AND c.MOTIVOCANCELACION_ID IS NOT NULL "); } else if (parametros.get("STATUS").toString().contains("V")) { - sql.append(" AND c.INDSTATUSBOLETO = 'V' AND c.MOTIVOCANCELACION_ID IS NULL"); + sql.append(" AND c.INDSTATUSBOLETO = 'V' AND c.MOTIVOCANCELACION_ID IS NULL "); } } - + sql.append(" ORDER BY cveestado, datavenda "); + NamedParameterStatement stmt = new NamedParameterStatement(conexao, sql.toString()); stmt.setInt("EMPRESA_ID", Integer.valueOf(parametros.get("EMPRESA_ID").toString())); @@ -118,12 +117,10 @@ public class RelatorioBilhetesVendidosNovoLayout extends Relatorio { dataResult.put("statuspassagem", IndStatusBoleto.valueOf(rset.getString("statuspassagem")).getValue()); } - bean.setNumAIDF((String) (rset.getObject("numaidf") == null ? "" : rset.getObject("numaidf"))); - bean.setDataVenda((Date) (rset.getObject("datavenda") == null ? "" : rset.getObject("datavenda"))); + bean.setDataVenda(rset.getString("datavenda") == null ? "" : rset.getString("datavenda")); bean.setFormInicial((String) (rset.getObject("formInicial") == null ? "" : rset.getObject("formInicial"))); bean.setFormFinal((String) (rset.getObject("formfinal") == null ? "" : rset.getObject("formfinal"))); bean.setSerie((String) (rset.getObject("serie") == null ? "" : rset.getObject("serie"))); - bean.setSubSerie((String) (rset.getObject("subserie") == null ? "" : rset.getObject("subserie"))); bean.setValorContabil((BigDecimal) (rset.getObject("valorcontabil") == null ? "" : rset.getObject("valorcontabil"))); bean.setValorBaseCalculo((BigDecimal) (rset.getObject("valorbasecalculo") == null ? "" : rset.getObject("valorbasecalculo"))); bean.setValorAliquiotaICMS((BigDecimal) (rset.getObject("valoraliquiotaicms") == null ? "" : rset.getObject("valoraliquiotaicms"))); diff --git a/src/java/com/rjconsultores/ventaboletos/relatorios/templates/RelatorioBilhetesVendidosNovoLayout.jasper b/src/java/com/rjconsultores/ventaboletos/relatorios/templates/RelatorioBilhetesVendidosNovoLayout.jasper index a6fe43cda..c762154eb 100644 Binary files a/src/java/com/rjconsultores/ventaboletos/relatorios/templates/RelatorioBilhetesVendidosNovoLayout.jasper and b/src/java/com/rjconsultores/ventaboletos/relatorios/templates/RelatorioBilhetesVendidosNovoLayout.jasper differ diff --git a/src/java/com/rjconsultores/ventaboletos/relatorios/templates/RelatorioBilhetesVendidosNovoLayout.jrxml b/src/java/com/rjconsultores/ventaboletos/relatorios/templates/RelatorioBilhetesVendidosNovoLayout.jrxml index d86074b9f..986fca0e7 100644 --- a/src/java/com/rjconsultores/ventaboletos/relatorios/templates/RelatorioBilhetesVendidosNovoLayout.jrxml +++ b/src/java/com/rjconsultores/ventaboletos/relatorios/templates/RelatorioBilhetesVendidosNovoLayout.jrxml @@ -1,8 +1,8 @@ - - + + @@ -37,7 +37,7 @@ - + @@ -152,42 +152,42 @@ - + - + - + - + - + - + @@ -201,35 +201,35 @@ - + - + - + - + - + @@ -240,49 +240,49 @@ - + - + - + - + - + - + - + @@ -295,29 +295,29 @@ - - + + - + - + - + @@ -326,19 +326,19 @@ - + - + - + - + diff --git a/src/java/com/rjconsultores/ventaboletos/relatorios/utilitarios/RelatorioBilhetesVendidosNovoLayoutBean.java b/src/java/com/rjconsultores/ventaboletos/relatorios/utilitarios/RelatorioBilhetesVendidosNovoLayoutBean.java index 9a38a2dca..718eb8702 100644 --- a/src/java/com/rjconsultores/ventaboletos/relatorios/utilitarios/RelatorioBilhetesVendidosNovoLayoutBean.java +++ b/src/java/com/rjconsultores/ventaboletos/relatorios/utilitarios/RelatorioBilhetesVendidosNovoLayoutBean.java @@ -19,7 +19,7 @@ public class RelatorioBilhetesVendidosNovoLayoutBean { private Integer estadoId; private String statusPassagem; private String bilhete; - private Date dataVenda; + private String dataVenda; private String codFiscal; public String getCodFiscal() { @@ -142,11 +142,11 @@ public class RelatorioBilhetesVendidosNovoLayoutBean { this.bilhete = bilhete; } - public Date getDataVenda() { + public String getDataVenda() { return dataVenda; } - public void setDataVenda(Date dataVenda) { + public void setDataVenda(String dataVenda) { this.dataVenda = dataVenda; }