diff --git a/src/java/com/rjconsultores/ventaboletos/relatorios/impl/RelatorioMovimentacaoBilhete.java b/src/java/com/rjconsultores/ventaboletos/relatorios/impl/RelatorioMovimentacaoBilhete.java index 6c17f6e7a..59d9f7b8c 100644 --- a/src/java/com/rjconsultores/ventaboletos/relatorios/impl/RelatorioMovimentacaoBilhete.java +++ b/src/java/com/rjconsultores/ventaboletos/relatorios/impl/RelatorioMovimentacaoBilhete.java @@ -127,7 +127,7 @@ public class RelatorioMovimentacaoBilhete extends Relatorio { } RelatorioMovimentacaoBilheteBean bean = new RelatorioMovimentacaoBilheteBean(); - bean.setTarifa(rset.getBigDecimal("precio")); + bean.setTarifa(rset.getBigDecimal("preciopagado")); bean.setCcf(rset.getString("ccf")); bean.setCorridaId(rset.getString("corrida_id")); bean.setCveusuario(rset.getString("cveusuario")); @@ -173,16 +173,37 @@ public class RelatorioMovimentacaoBilhete extends Relatorio { bean.setProtocolobpe(rset.getString("nprot")); bean.setHoraMD(rset.getTimestamp("feccreacion") != null ? hora.format(rset.getTimestamp("feccreacion")) : ""); bean.setHoraEmissao(rset.getTimestamp("fechorventa") != null ? hora.format(rset.getTimestamp("fechorventa")) : ""); - + bean.setNumPuntoVenta(rset.getString("numpuntoventa")); + if (isPossuiElemento(RelatorioMovimentacaoBilheteStatusEnum.TROCA.getStatusRelatorioAnterior(), indstatusboleto) || isPossuiElemento(RelatorioMovimentacaoBilheteStatusEnum.TRANSFERENCIA.getStatusRelatorioAnterior(), indstatusboleto) || isPossuiElemento(RelatorioMovimentacaoBilheteStatusEnum.REATIVACAO.getStatusRelatorioAnterior(), indstatusboleto) || isPossuiElemento(RelatorioMovimentacaoBilheteStatusEnum.TROCA_TITULARIDADE.getStatusRelatorioAnterior(), indstatusboleto) || isPossuiElemento(RelatorioMovimentacaoBilheteStatusEnum.TROCA_POLTRONA.getStatusRelatorioAnterior(), indstatusboleto)) { + bean.setChavebpe(rset.getString("chbpe_ori")); + bean.setProtocolobpe(rset.getString("nprot_ori")); + } + + if (isPossuiElemento(RelatorioMovimentacaoBilheteStatusEnum.TRANSFERENCIA.getStatusRelatorioAnterior(), indstatusboleto)) { + bean.setSerienovo(rset.getString("serienovo_ant")); + bean.setSubserienovo(rset.getString("subserienovo_ant")); + bean.setCcfnovo(rset.getString("ccfnovo_ant")); + bean.setBpenovo(rset.getString("bpenovo_ant")); + bean.setNumfoliosistemanovo(rset.getString("numfoliosistema_ant")); + } else if (isPossuiElemento(RelatorioMovimentacaoBilheteStatusEnum.TROCA.getStatusRelatorioAnterior(), indstatusboleto) + || isPossuiElemento(RelatorioMovimentacaoBilheteStatusEnum.REATIVACAO.getStatusRelatorioAnterior(), indstatusboleto)) { + bean.setSerienovo(rset.getString("serienovo_prox")); + bean.setSubserienovo(rset.getString("subserienovo_prox")); + bean.setCcfnovo(rset.getString("ccfnovo_prox")); + bean.setBpenovo(rset.getString("bpenovo_prox")); + bean.setNumfoliosistemanovo(rset.getString("numfoliosistema_prox")); + } else if (isPossuiElemento(RelatorioMovimentacaoBilheteStatusEnum.TROCA_TITULARIDADE.getStatusRelatorioAnterior(), indstatusboleto) + || isPossuiElemento(RelatorioMovimentacaoBilheteStatusEnum.TROCA_POLTRONA.getStatusRelatorioAnterior(), indstatusboleto)) { bean.setSerienovo(rset.getString("serienovo")); bean.setSubserienovo(rset.getString("subserienovo")); bean.setCcfnovo(rset.getString("ccfnovo")); bean.setBpenovo(rset.getString("bpenovo")); + bean.setNumfoliosistemanovo(rset.getString("numfoliosistemanovo")); } lsDadosRelatorio.add(bean); @@ -248,7 +269,7 @@ public class RelatorioMovimentacaoBilhete extends Relatorio { StringBuilder sb = new StringBuilder(); sb.append("SELECT * "); sb.append("FROM "); - sb.append(" (SELECT b.boletooriginal_id, b.boleto_id,"); + sb.append(" (SELECT distinct b.boletooriginal_id, b.boleto_id,"); sb.append(" b.ccf,"); sb.append(" og.descorgao,"); sb.append(" b.feccreacion,"); @@ -268,7 +289,6 @@ public class RelatorioMovimentacaoBilhete extends Relatorio { sb.append(" tar.preciooriginal,"); sb.append(" tar.precio,"); sb.append(" case when b.PRECIOBASE > 0 then TRUNC(((100 - (b.PRECIOPAGADO * 100) / b.PRECIOBASE)),2) else 0 end as porccategoria, "); - sb.append(" (select sum(bfpv.importe) from boleto_formapago bfpv where bfpv.boleto_id = b.boleto_id and bfpv.activo = 1) as preciopagado, ");; sb.append(" u.cveusuario,"); sb.append(" ag.nombpuntoventa,"); sb.append(" ag.direccionnumero,"); @@ -303,9 +323,24 @@ public class RelatorioMovimentacaoBilhete extends Relatorio { sb.append(" 'N/A' as subserienovo , "); sb.append(" 'N/A' as ccfnovo , "); sb.append(" 'N/A' as bpenovo, "); + sb.append(" 'N/A' as numfoliosistemanovo, "); sb.append(" b.importetpp, "); sb.append(" 0 as checkin, "); - sb.append(" 0 as titularidade_trocada "); + sb.append(" 0 as titularidade_trocada, "); + sb.append(" ag.numpuntoventa, "); + sb.append(" b.preciopagado, "); + sb.append(" null chbpe_ori, "); + sb.append(" null nprot_ori, "); + sb.append(" 'N/A' as serienovo_ant, "); + sb.append(" 'N/A' as subserienovo_ant, "); + sb.append(" 'N/A' as ccfnovo_ant , "); + sb.append(" 'N/A' as bpenovo_ant, "); + sb.append(" 'N/A' as numfoliosistema_ant, "); + sb.append(" 'N/A' as serienovo_prox , "); + sb.append(" 'N/A' as subserienovo_prox , "); + sb.append(" 'N/A' as ccfnovo_prox , "); + sb.append(" 'N/A' as bpenovo_prox, "); + sb.append(" 'N/A' as numfoliosistema_prox "); sb.append(" FROM boleto b"); sb.append(" JOIN categoria ca ON b.categoria_id = ca.categoria_id"); sb.append(" JOIN parada ori ON ori.parada_id = b.origen_id"); @@ -368,7 +403,7 @@ public class RelatorioMovimentacaoBilhete extends Relatorio { sb.append(" "); sb.append(" UNION ALL "); sb.append(" "); - sb.append(" SELECT c.transacaooriginal_id, c.transacao_id,"); + sb.append(" SELECT distinct c.transacaooriginal_id, c.transacao_id,"); sb.append(" c.ccf,"); sb.append(" og.descorgao,"); sb.append(" c.feccreacion,"); @@ -388,7 +423,6 @@ public class RelatorioMovimentacaoBilhete extends Relatorio { sb.append(" tar.preciooriginal,"); sb.append(" tar.precio,"); sb.append(" case when c.PRECIOBASE > 0 then TRUNC(((100 - (c.PRECIOPAGADO * 100) / c.PRECIOBASE)),2) else 0 end as porccategoria, "); - sb.append(" (select sum(cfpv.importe) from caja_formapago cfpv where cfpv.caja_id = c.caja_id and cfpv.activo = 1) as preciopagado, "); sb.append(" u.cveusuario,"); sb.append(" ag.nombpuntoventa,"); sb.append(" ag.direccionnumero,"); @@ -447,13 +481,28 @@ public class RelatorioMovimentacaoBilhete extends Relatorio { sb.append(" c.num_bpe num_bpe, "); sb.append(" bpe.chbpe chbpe, "); sb.append(" bpe.nprot nprot, "); - sb.append(" cori.ccf as ccfnovo, "); + sb.append(" c_ori.ccf as ccfnovo, "); sb.append(" aidf_ori.serie serienovo, "); sb.append(" aidf_ori.subserie subserienovo, "); - sb.append(" cori.num_bpe bpenovo, "); + sb.append(" c_ori.num_bpe bpenovo, "); + sb.append(" c_ori.numfoliosistema numfoliosistemanovo, "); sb.append(" c.importetpp, "); sb.append(" case when c.indstatusboleto = 'V' and (select count(*) from boleto_checkin bc1 where bc1.activo=1 and bc1.boletooriginal_id=c.transacao_id)=0 and c.fechorviaje > c.fechorventa then 1 else 0 end as checkin, "); - sb.append(" case when c.indstatusboleto = 'V' and (select count(*) from caja c1 join cambio_titularidad ct1 on ct1.boleto_id = c1.transacao_id where c1.activo=1 and c1.transacaooriginal_id=c.transacao_id)>0 then 1 else 0 end as titularidade_trocada "); + sb.append(" case when c.indstatusboleto = 'V' and (select count(*) from caja c1 join cambio_titularidad ct1 on ct1.boleto_id = c1.transacao_id where c1.activo=1 and c1.transacaooriginal_id=c.transacao_id)>0 then 1 else 0 end as titularidade_trocada, "); + sb.append(" ag.numpuntoventa, "); + sb.append(" c.preciopagado, "); + sb.append(" bpe_ori.chbpe chbpe_ori, "); + sb.append(" bpe_ori.nprot nprot_ori, "); + sb.append(" c_ant.ccf as ccfnovo_ant, "); + sb.append(" aidf_ant.serie serienovo_ant, "); + sb.append(" aidf_ant.subserie subserienovo_ant, "); + sb.append(" c_ant.num_bpe bpenovo_ant, "); + sb.append(" c_ant.numfoliosistema numfoliosistema_ant, "); + sb.append(" c_prox.ccf as ccfnovo_prox, "); + sb.append(" aidf_prox.serie serienovo_prox, "); + sb.append(" aidf_prox.subserie subserienovo_prox, "); + sb.append(" c_prox.num_bpe bpenovo_prox, "); + sb.append(" c_prox.numfoliosistema numfoliosistema_prox "); sb.append(" FROM caja c"); sb.append(" JOIN categoria ca ON c.categoria_id = ca.categoria_id"); sb.append(" JOIN parada ori ON ori.parada_id = c.origen_id"); @@ -476,9 +525,16 @@ public class RelatorioMovimentacaoBilhete extends Relatorio { sb.append(" LEFT JOIN cambio_titularidad ct on ct.boleto_id = c.transacao_id "); sb.append(" LEFT JOIN AIDF AIDF ON AIDF.AIDF_ID = c.AIDF_ID "); sb.append(" left join bpe bpe on bpe.boleto_id = c.transacao_id "); - sb.append(" left join caja cori on cori.transacao_id = c.transacaooriginal_id "); - sb.append(" LEFT JOIN AIDF aidf_ori ON aidf_ori.AIDF_ID = cori.AIDF_ID "); - sb.append(" left join bpe bpe_ori on bpe_ori.boleto_id = cori.transacao_id "); + + sb.append(" left join caja c_ori on c_ori.transacao_id = c.transacaooriginal_id "); + sb.append(" left join caja c_ant on c_ant.transacao_id = c.transacaoanterior_id "); + sb.append(" left join caja c_prox on c_prox.transacaoanterior_id = c.transacao_id "); + + sb.append(" left join aidf aidf_ori ON aidf_ori.AIDF_ID = c_ori.AIDF_ID "); + sb.append(" left join aidf aidf_ant ON aidf_ant.AIDF_ID = c_ant.AIDF_ID "); + sb.append(" left join aidf aidf_prox ON aidf_prox.AIDF_ID = c_prox.AIDF_ID "); + + sb.append(" left join bpe bpe_ori on bpe_ori.boleto_id = c_ori.transacao_id "); sb.append(" WHERE 1=1 "); sb.append(" and c.motivoreimpresion_id is null "); sb.append(" and (c.motivocancelacion_id IN ("); @@ -533,7 +589,7 @@ public class RelatorioMovimentacaoBilhete extends Relatorio { sb.append(") "); sb.append("ORDER BY 5, 15"); - + return sb.toString(); } diff --git a/src/java/com/rjconsultores/ventaboletos/relatorios/templates/RelatorioMovimentacaoBilhete.jasper b/src/java/com/rjconsultores/ventaboletos/relatorios/templates/RelatorioMovimentacaoBilhete.jasper index 33924da40..130aefc8e 100644 Binary files a/src/java/com/rjconsultores/ventaboletos/relatorios/templates/RelatorioMovimentacaoBilhete.jasper and b/src/java/com/rjconsultores/ventaboletos/relatorios/templates/RelatorioMovimentacaoBilhete.jasper differ diff --git a/src/java/com/rjconsultores/ventaboletos/relatorios/templates/RelatorioMovimentacaoBilhete.jrxml b/src/java/com/rjconsultores/ventaboletos/relatorios/templates/RelatorioMovimentacaoBilhete.jrxml index eeba3e5ea..695448a28 100644 --- a/src/java/com/rjconsultores/ventaboletos/relatorios/templates/RelatorioMovimentacaoBilhete.jrxml +++ b/src/java/com/rjconsultores/ventaboletos/relatorios/templates/RelatorioMovimentacaoBilhete.jrxml @@ -1,6 +1,6 @@ - + @@ -69,6 +69,8 @@ + + @@ -82,394 +84,401 @@ - <band/> - - - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + + + + + + + + + + + @@ -625,7 +634,7 @@ - + @@ -761,33 +770,40 @@ - + - + - + - + + + + + + + + diff --git a/src/java/com/rjconsultores/ventaboletos/relatorios/utilitarios/RelatorioMovimentacaoBilheteBean.java b/src/java/com/rjconsultores/ventaboletos/relatorios/utilitarios/RelatorioMovimentacaoBilheteBean.java index 28ca48758..88809686f 100644 --- a/src/java/com/rjconsultores/ventaboletos/relatorios/utilitarios/RelatorioMovimentacaoBilheteBean.java +++ b/src/java/com/rjconsultores/ventaboletos/relatorios/utilitarios/RelatorioMovimentacaoBilheteBean.java @@ -56,6 +56,8 @@ public class RelatorioMovimentacaoBilheteBean implements Cloneable { private String bpenovo = "N/A"; private String horaMD; private String horaEmissao; + private String numPuntoVenta; + private String numfoliosistemanovo = "N/A"; public String getFecdatviaje() { return fecdatviaje; @@ -389,4 +391,20 @@ public class RelatorioMovimentacaoBilheteBean implements Cloneable { public RelatorioMovimentacaoBilheteBean getClone() throws CloneNotSupportedException { return (RelatorioMovimentacaoBilheteBean) super.clone(); } + + public String getNumPuntoVenta() { + return numPuntoVenta; + } + + public void setNumPuntoVenta(String numPuntoVenta) { + this.numPuntoVenta = numPuntoVenta; + } + + public String getNumfoliosistemanovo() { + return numfoliosistemanovo; + } + + public void setNumfoliosistemanovo(String numfoliosistemanovo) { + this.numfoliosistemanovo = numfoliosistemanovo; + } } \ No newline at end of file