diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/BpeHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/BpeHibernateDAO.java index b6fc33eaa..2bb62ac89 100644 --- a/src/com/rjconsultores/ventaboletos/dao/hibernate/BpeHibernateDAO.java +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/BpeHibernateDAO.java @@ -63,8 +63,8 @@ public class BpeHibernateDAO extends HibernateDaoSupport implements BpeDAO { sql.append(" bpe.desconto as v_desconto, "); sql.append(" bpe.chbpe, "); sql.append(" coalesce(chbpe_substituicao, ' ') as chbpe_sub, "); - sql.append(" to_char(c.feccreacion, 'yyyymmdd') as dhrecbto, "); sql.append(" to_char(c.feccreacion, 'yyyymmdd') as dh_emisao, "); + sql.append(" to_char(c.fechorviaje, 'yyyymmdd') as dhrecbto, "); sql.append(" coalesce(bpe.tiposubstituicao, '0') as tp_bpe, "); sql.append(" bpe.retorno_id as retorno, "); sql.append(" bpe.nprot, "); @@ -107,7 +107,7 @@ public class BpeHibernateDAO extends HibernateDaoSupport implements BpeDAO { sql.append(" and (case when ei.indtribviagem = 1 then c.fechorviaje else c.feccreacion end) <= to_date(?,'DD/MM/YYYY HH24:MI:SS')"); sql.append(" and ep.empresa_id = ? "); sql.append(" and e.cveestado = ? "); - sql.append("order by to_number(c.numfoliosistema), to_number(num_bpe), dhrecbto "); + sql.append("order by to_number(c.numfoliosistema), to_number(num_bpe), dh_emisao "); try { PreparedStatement ps = connection.prepareStatement(sql.toString()); diff --git a/src/com/rjconsultores/ventaboletos/utilerias/DateUtil.java b/src/com/rjconsultores/ventaboletos/utilerias/DateUtil.java index f0db0f5f2..4309f54e3 100644 --- a/src/com/rjconsultores/ventaboletos/utilerias/DateUtil.java +++ b/src/com/rjconsultores/ventaboletos/utilerias/DateUtil.java @@ -25,7 +25,7 @@ public final class DateUtil { public static String ddMMaaHHmm = "dd/MM/yyyy hh:mm"; public static String ddMMaa = "dd/MM/yyyy"; public static String formatGMT = "yyyy-MM-dd'T'HH:mm:ss"; - public static String formatExp = "yyyymmdd"; + public static String formatExp = "yyyyMMdd"; /** * No need for an instance diff --git a/src/com/rjconsultores/ventaboletos/utilerias/exportacao/ExportacaoBpe.java b/src/com/rjconsultores/ventaboletos/utilerias/exportacao/ExportacaoBpe.java index d3f966520..274cb1748 100644 --- a/src/com/rjconsultores/ventaboletos/utilerias/exportacao/ExportacaoBpe.java +++ b/src/com/rjconsultores/ventaboletos/utilerias/exportacao/ExportacaoBpe.java @@ -103,8 +103,8 @@ public class ExportacaoBpe { String chaveEletrônica = tipoBPE.getChaveEletronica(); String serie = tipoBPE.getSerie(); String numero = tipoBPE.getNumero(); - String dataPrestacao = StringUtils.isBlank(tipoBPE.getDataPrestacao()) ? VAZIO : tipoBPE.getDataPrestacao(); String dataEmissao = StringUtils.isBlank(tipoBPE.getDataEmissao()) ? VAZIO : tipoBPE.getDataEmissao(); + String dataPrestacao = StringUtils.isBlank(tipoBPE.getDataPrestacao()) ? VAZIO : tipoBPE.getDataPrestacao(); String situacaoDocumento = tipoBPE.getSituacaoDoc(); String valorBruto = tipoBPE.getValorBruto() == null ? VAZIO : formataValor(tipoBPE.getValorBruto(), 15); diff --git a/src/com/rjconsultores/ventaboletos/utilerias/exportacao/bpe/ExportacaoBPEVo.java b/src/com/rjconsultores/ventaboletos/utilerias/exportacao/bpe/ExportacaoBPEVo.java index f73a201db..90d8e6398 100644 --- a/src/com/rjconsultores/ventaboletos/utilerias/exportacao/bpe/ExportacaoBPEVo.java +++ b/src/com/rjconsultores/ventaboletos/utilerias/exportacao/bpe/ExportacaoBPEVo.java @@ -85,13 +85,14 @@ public class ExportacaoBPEVo { String tpDoc = isCancelamento ? "1" : (StringUtils.isBlank(registro.getChbpeSub()) ? "0" : "0"); String numBpe = StringUtils.isNotBlank(xml) ? tbpe.getInfBPe().getIde().getNBP() : registro.getNumBpe(); - String dhEmisao = StringUtils.isBlank(xml) ? registro.getDhEmisao() - : DateUtil.changeFormatStringDate(tbpe.getInfBPe().getIde().getDhEmi(), DateUtil.formatGMT, DateUtil.formatExp); + String dhEmisao = registro.getDhEmisao(); + String dataPrestacao = StringUtils.isBlank(xml) ? registro.getDhrecbto() + : DateUtil.changeFormatStringDate(tbpe.getInfBPe().getInfPassagem().getDhEmb(), DateUtil.formatGMT, DateUtil.formatExp); if (isCancelamento) { ExportacaoBPETipoBPE tipoBPE = new ExportacaoBPETipoBPE(registro.getCodEstabelecimento(), registro.getChbpe(), registro.getNumSerieBpe(), - numBpe, registro.getDhrecbto(), tpDoc, VAZIO, null, null, + numBpe, dhEmisao, tpDoc, VAZIO, null, null, VAZIO, VAZIO, VAZIO, VAZIO, VAZIO, null, VAZIO, VAZIO, VAZIO, VAZIO, registro.getRetorno(), VAZIO); @@ -149,7 +150,7 @@ public class ExportacaoBPEVo { String tpBpe = StringUtils.isBlank(xml) ? "" : (StringUtils.isBlank(tbpe.getInfBPe().getInfBPeSub() == null ? "" : tbpe.getInfBPe().getInfBPeSub().getChBPe()) ? "1" : "2"); ExportacaoBPETipoBPE tipoBPE = new ExportacaoBPETipoBPE(registro.getCodEstabelecimento(), registro.getChbpe(), registro.getNumSerieBpe(), - numBpe, registro.getDhrecbto(), tpDoc, dhEmisao, valorBruto, + numBpe, dhEmisao, tpDoc, dataPrestacao, valorBruto, desconto, estadoOrigem, municipioOrigem, estadoDestino, municipioDestino, cstCofins, receitaTriCofins, tpBpe, chbpeSub, codigoContabil, indContribuicaoPrevidenciaria, registro.getRetorno(), cstPis);