diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/BpeHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/BpeHibernateDAO.java index e60831fd8..9932021b9 100644 --- a/src/com/rjconsultores/ventaboletos/dao/hibernate/BpeHibernateDAO.java +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/BpeHibernateDAO.java @@ -377,6 +377,12 @@ public class BpeHibernateDAO extends HibernateDaoSupport implements BpeDAO { for (DetalhadoFiscal det : list) { + String xml = det.getXml(); + + TBPe tbpe = null; + if (StringUtils.isNotBlank(xml)) + tbpe = new ExportacaoBPEVo().convertXmlToBpe(xml); + BigDecimal passagem = BigDecimal.ZERO; BigDecimal isentos = BigDecimal.ZERO; BigDecimal outros = BigDecimal.ZERO; @@ -480,21 +486,20 @@ public class BpeHibernateDAO extends HibernateDaoSupport implements BpeDAO { array[2] = xml_bpe_3; String xml = StringUtils.join(array); - ExportacaoBPEVo exportacaoBPEVo = new ExportacaoBPEVo(); TBPe tbpe = null; if (StringUtils.isNotBlank(xml)) - tbpe = exportacaoBPEVo.convertXmlToBpe(xml); + tbpe = new ExportacaoBPEVo().convertXmlToBpe(xml); DetalhadoFiscal df = new DetalhadoFiscal(); + df.setXml(xml); String municipioOrigem = StringUtils.isNotBlank(xml) ? tbpe.getInfBPe().getIde().getCMunIni() : rs.getString("municipioOrigem"); - // String municipioDestino = StringUtils.isNotBlank(xml) ? tbpe.getInfBPe().getIde().getCMunFim() : null; String estadoOrigem = (StringUtils.isNotBlank(xml) ? tbpe.getInfBPe().getIde().getUFIni().value() : rs.getString("estadoOrigem")); String estadoDestino = (StringUtils.isNotBlank(xml) ? tbpe.getInfBPe().getIde().getUFFim().value() : rs.getString("estadoDestino")); - + boolean isInterEstadual = !estadoOrigem.equals(estadoDestino); - df.setEstadoOrigem(estadoOrigem ); + df.setEstadoOrigem(estadoOrigem); df.setEstadoDestino(estadoDestino); df.setMunicipioOrigem(municipioOrigem); @@ -586,7 +591,8 @@ public class BpeHibernateDAO extends HibernateDaoSupport implements BpeDAO { sql.append("from boleto c "); sql.append(" join bpe bpe on c.boleto_id = bpe.boleto_id "); - sql.append(" left join bpe bpecan on bpecan.chbpe = bpe.chbpe and bpecan.codstat = 100 and bpe.codstat = 135 and bpe.tipoevento = 110111 "); +// sql.append(" left join bpe bpecan on bpecan.chbpe = bpe.chbpe and bpecan.codstat = 100 and bpe.codstat = 135 and bpe.tipoevento = 110111 "); + sql.append(" left join bpe bpecan on bpecan.chbpe = bpe.chbpe and bpecan.codstat = 135 and bpe.codstat = 100 and bpecan.tipoevento = 110111 "); sql.append(" join estado e on e.codibge = bpe.uf "); sql.append(" join marca ma on c.marca_id = ma.marca_id "); sql.append(" join empresa ep on ma.empresa_id = ep.empresa_id ");