bug#11600

dev: julio
qua:

git-svn-id: http://desenvolvimento.rjconsultores.com.br/repositorio/sco/AdmVenta/Model/trunk/modelWeb@83842 d1611594-4594-4d17-8e1d-87c2c4800839
master
julio 2018-08-01 20:12:25 +00:00
parent 08407d8045
commit 871e0bacf7
3 changed files with 30 additions and 16 deletions

View File

@ -107,10 +107,12 @@ public class BpeHibernateDAO extends HibernateDaoSupport implements BpeDAO {
sql.append(" where c.activo = 1 and po.activo = 1 and co.activo = 1 and eo.activo = 1 and ei.activo = 1 "); sql.append(" where c.activo = 1 and po.activo = 1 and co.activo = 1 and eo.activo = 1 and ei.activo = 1 ");
sql.append(" and coalesce(case when s.aliasorigen_id is null then ei.activo else eis.activo end, 0) = 1 "); sql.append(" and coalesce(case when s.aliasorigen_id is null then ei.activo else eis.activo end, 0) = 1 ");
sql.append(" and bpe.tipoamb = 1 "); sql.append(" and bpe.tipoamb = 1 ");
sql.append(" and ((c.indreimpresion = 0 and c.motivocancelacion_id is null and c.numfoliosistema is not null) or (c.indstatusboleto = 'E' and c.indreimpresion = 1)) ");
sql.append(" and ((case when coalesce(r.indtribtarifa,0) = 1 then c.preciopagado else 0 end) + (case when coalesce(r.indtribtaxaembarque,0) = 1 then c.importetaxaembarque else 0 end) + (case when coalesce(r.indtribpedagio,0) = 1 then c.importepedagio else 0 end)) > 0 "); // sql.append(" and ((c.indreimpresion = 0 and c.motivocancelacion_id is null and c.numfoliosistema is not null) or (c.indstatusboleto = 'E' and c.indreimpresion = 1)) ");
// sql.append(" and ((case when coalesce(r.indtribtarifa,0) = 1 then c.preciopagado else 0 end) + (case when coalesce(r.indtribtaxaembarque,0) = 1 then c.importetaxaembarque else 0 end) + (case when coalesce(r.indtribpedagio,0) = 1 then c.importepedagio else 0 end)) > 0 ");
// sql.append(" and c.feccreacion >= to_date(?,'DD/MM/YYYY HH24:MI:SS') and c.feccreacion <= to_date(?,'DD/MM/YYYY HH24:MI:SS') "); // sql.append(" and c.feccreacion >= to_date(?,'DD/MM/YYYY HH24:MI:SS') and c.feccreacion <= to_date(?,'DD/MM/YYYY HH24:MI:SS') ");
sql.append(" and (case when (case when s.aliasorigen_id is null then ei.indtribviagem else eis.indtribviagem end) = 1 then "); sql.append(" and (case when (case when s.aliasorigen_id is null then ei.indtribviagem else eis.indtribviagem end) = 1 then ");
sql.append(" c.fechorviaje else c.feccreacion end) >= to_date(?,'DD/MM/YYYY HH24:MI:SS') "); sql.append(" c.fechorviaje else c.feccreacion end) >= to_date(?,'DD/MM/YYYY HH24:MI:SS') ");
sql.append(" and (case when (case when s.aliasorigen_id is null then ei.indtribviagem else eis.indtribviagem end) = 1 then "); sql.append(" and (case when (case when s.aliasorigen_id is null then ei.indtribviagem else eis.indtribviagem end) = 1 then ");
@ -118,7 +120,7 @@ public class BpeHibernateDAO extends HibernateDaoSupport implements BpeDAO {
sql.append(" and c.empresacorrida_id = ? "); sql.append(" and c.empresacorrida_id = ? ");
sql.append(" and ((case when s.aliasorigen_id is null then eo.cveestado else eos.cveestado end) = ?) "); sql.append(" and ((case when s.aliasorigen_id is null then eo.cveestado else eos.cveestado end) = ?) ");
sql.append(" order by dhrecbto, numfoliosistema "); sql.append(" order by dhrecbto, chbpe, numfoliosistema ");
try { try {
PreparedStatement ps = connection.prepareStatement(sql.toString()); PreparedStatement ps = connection.prepareStatement(sql.toString());
@ -239,9 +241,14 @@ public class BpeHibernateDAO extends HibernateDaoSupport implements BpeDAO {
String xmlBpe = null; String xmlBpe = null;
StringBuilder sql = new StringBuilder(); StringBuilder sql = new StringBuilder();
sql.append(" select distinct "); sql.append(" select distinct ");
sql.append(" DBMS_LOB.substr(bpe.xmlregular, 4000) as xml_bpe, "); sql.append(" DBMS_LOB.substr(bpe.xmlregular, 3000) as xml_bpe, ");
sql.append(" DBMS_LOB.substr(bpe.xmlregular, 4000, 4001) as xml_bpe_2, "); sql.append(" DBMS_LOB.substr(bpe.xmlregular, 3000, 3001) as xml_bpe_2, ");
sql.append(" DBMS_LOB.substr(bpe.xmlregular, 4000, 8001) as xml_bpe_3 "); sql.append(" DBMS_LOB.substr(bpe.xmlregular, 3000, 6001) as xml_bpe_3 ");
// sql.append(" DBMS_LOB.substr(bpe.xmlregular, 4000) as xml_bpe, ");
// sql.append(" DBMS_LOB.substr(bpe.xmlregular, 4000, 4001) as xml_bpe_2, ");
// sql.append(" DBMS_LOB.substr(bpe.xmlregular, 4000, 8001) as xml_bpe_3 ");
sql.append(" from bpe bpe "); sql.append(" from bpe bpe ");
sql.append(" where bpe.activo = 1 "); sql.append(" where bpe.activo = 1 ");
sql.append(" and bpe.tipoamb = 1 "); sql.append(" and bpe.tipoamb = 1 ");

View File

@ -103,9 +103,10 @@ public class ExportacaoBpe {
String chaveEletrônica = tipoBPE.getChaveEletronica(); String chaveEletrônica = tipoBPE.getChaveEletronica();
String serie = tipoBPE.getSerie(); String serie = tipoBPE.getSerie();
String numero = tipoBPE.getNumero(); String numero = tipoBPE.getNumero();
String dataEmissao = tipoBPE.getDataEmissao(); String dataPrestacao = StringUtils.isBlank(tipoBPE.getDataPrestacao()) ? VAZIO : tipoBPE.getDataPrestacao();
String dataEmissao = StringUtils.isBlank(tipoBPE.getDataEmissao()) ? VAZIO : tipoBPE.getDataEmissao();
String situacaoDocumento = tipoBPE.getSituacaoDoc(); String situacaoDocumento = tipoBPE.getSituacaoDoc();
String dataPrestacao = tipoBPE.getDataPrestacao();
String valorBruto = tipoBPE.getValorBruto() == null ? VAZIO : formataValor(tipoBPE.getValorBruto(), 15); String valorBruto = tipoBPE.getValorBruto() == null ? VAZIO : formataValor(tipoBPE.getValorBruto(), 15);
String valorDesconto = tipoBPE.getValorDesconto() == null ? VAZIO : formataValor(tipoBPE.getValorDesconto(), 15); String valorDesconto = tipoBPE.getValorDesconto() == null ? VAZIO : formataValor(tipoBPE.getValorDesconto(), 15);
String UFOrigem = tipoBPE.getUFOrigem(); String UFOrigem = tipoBPE.getUFOrigem();
@ -129,8 +130,7 @@ public class ExportacaoBpe {
String receitaIRPJ3 = VAZIO; String receitaIRPJ3 = VAZIO;
String receitaIRPJ4 = VAZIO; String receitaIRPJ4 = VAZIO;
String tipoBPe = tipoBPE.getTipoBPe(); String tipoBPe = tipoBPE.getTipoBPe();
String chaveEletRef = VAZIO; String chaveEletRef = StringUtils.isBlank(tipoBPE.getChaveEletronicaReferencia()) ? VAZIO : tipoBPE.getChaveEletronicaReferencia();
// String chaveEletRef = tipoBPE.getChaveEletronicaReferencia();
String codigoContabil = StringUtils.isBlank(tipoBPE.getCodigoContabil()) ? VAZIO : tipoBPE.getCodigoContabil(); String codigoContabil = StringUtils.isBlank(tipoBPE.getCodigoContabil()) ? VAZIO : tipoBPE.getCodigoContabil();
String codigoPrevidenciaria = tipoBPE.getIndContribuicaoPrevidenciaria(); String codigoPrevidenciaria = tipoBPE.getIndContribuicaoPrevidenciaria();
String codigoComplementar = VAZIO; String codigoComplementar = VAZIO;

View File

@ -86,10 +86,17 @@ public class ExportacaoBPEVo {
registro.getListaRegistroBPE().add(tipoBPE); registro.getListaRegistroBPE().add(tipoBPE);
} else { } else {
String vBC = tbpe.getInfBPe().getImp().getICMS().getICMS00().getVBC(); String vBC = null;
String pICMS = tbpe.getInfBPe().getImp().getICMS().getICMS00().getPICMS(); String pICMS = null;
String vICMS = tbpe.getInfBPe().getImp().getICMS().getICMS00().getVICMS(); String vICMS = null;
String vBP = tbpe.getInfBPe().getInfValorBPe().getVBP(); String vBP = null;
if (tbpe.getInfBPe().getImp().getICMS().getICMS00() != null) {
vBC = tbpe.getInfBPe().getImp().getICMS().getICMS00().getVBC();
pICMS = tbpe.getInfBPe().getImp().getICMS().getICMS00().getPICMS();
vICMS = tbpe.getInfBPe().getImp().getICMS().getICMS00().getVICMS();
vBP = tbpe.getInfBPe().getInfValorBPe().getVBP();
}
String cstCofins = "01"; String cstCofins = "01";
String cstPis = "01"; String cstPis = "01";