bug#11600
dev: julio qua: git-svn-id: http://desenvolvimento.rjconsultores.com.br/repositorio/sco/AdmVenta/Model/trunk/modelWeb@84314 d1611594-4594-4d17-8e1d-87c2c4800839master
parent
95fb18fce2
commit
cf360ab445
|
@ -54,9 +54,9 @@ public class BpeHibernateDAO extends HibernateDaoSupport implements BpeDAO {
|
|||
sql.append(" c.numfoliosistema as numfoliosistema, ");
|
||||
sql.append(" coalesce(c.preciopagado,0) + coalesce(c.importetaxaembarque,0) + coalesce(c.importeseguro,0) + coalesce(c.importepedagio,0) + coalesce(c.importeoutros,0) as valortotal, ");
|
||||
sql.append(" bpe.codstat as codstatus, ");
|
||||
sql.append(" DBMS_LOB.substr(bpe.xmlregular, 3000) as xml_bpe, ");
|
||||
sql.append(" DBMS_LOB.substr(bpe.xmlregular, 3000, 3001) as xml_bpe_2, ");
|
||||
sql.append(" DBMS_LOB.substr(bpe.xmlregular, 3000, 6001) as xml_bpe_3, ");
|
||||
sql.append(" DBMS_LOB.substr(coalesce(bpe.xmlregular, bpe.xmlcontingencia), 3000) as xml_bpe, ");
|
||||
sql.append(" DBMS_LOB.substr(coalesce(bpe.xmlregular, bpe.xmlcontingencia), 3000, 3001) as xml_bpe_2, ");
|
||||
sql.append(" DBMS_LOB.substr(coalesce(bpe.xmlregular, bpe.xmlcontingencia), 3000, 6001) as xml_bpe_3, ");
|
||||
sql.append(" bpe.tipoevento as tipoevento, ");
|
||||
sql.append(" bpe.desconto as v_desconto, ");
|
||||
sql.append(" bpe.chbpe, ");
|
||||
|
@ -99,7 +99,7 @@ public class BpeHibernateDAO extends HibernateDaoSupport implements BpeDAO {
|
|||
sql.append(" left join empresa_imposto ei on ei.empresa_id = ep.empresa_id and ei.estado_id = e.estado_id ");
|
||||
sql.append("where c.activo = 1 and e.activo = 1 and ei.activo = 1 ");
|
||||
sql.append(" and bpe.tipoamb = 1 and ep.activo = 1 ");
|
||||
sql.append(" and bpe.errocontingencia is null ");
|
||||
// sql.append(" and bpe.errocontingencia is null ");
|
||||
//sql.append(" and bpe.codstat <> 150 "); // não deve ser enviados os registros de contigencia
|
||||
sql.append(" and (tipoevento <> 110115 or tipoevento is null) ");
|
||||
sql.append(" and (case when ei.indtribviagem = 1 then c.fechorviaje else c.feccreacion end) >= to_date(?,'DD/MM/YYYY HH24:MI:SS') ");
|
||||
|
|
|
@ -56,8 +56,8 @@ public class ExportacaoBPEVo {
|
|||
|
||||
public boolean isBpeCancelado(ExportacaoBPEBase registro) {
|
||||
return (registro.getCodstatus() == null ? false : (registro.getCodstatus().equals(StatusBpe.EVENTOS)))
|
||||
// && (registro.getTipoevento() == null ? true : (registro.getTipoevento().equals(EventosBpe.CANCELAMENTO)))
|
||||
;
|
||||
// && (registro.getTipoevento() == null ? true : (registro.getTipoevento().equals(EventosBpe.CANCELAMENTO)))
|
||||
;
|
||||
}
|
||||
|
||||
public void gerarListas(ExportacaoBPEBase registro) {
|
||||
|
@ -67,7 +67,7 @@ public class ExportacaoBPEVo {
|
|||
boolean isCancelamento = isBpeCancelado(registro);
|
||||
|
||||
TBPe tbpe = null;
|
||||
String xml = StringUtils.isNotBlank(registro.getXmlAnterior()) ? registro.getXmlAnterior() : registro.getXml();
|
||||
String xml = StringUtils.isNotBlank(registro.getXmlAnterior()) ? registro.getXmlAnterior() : registro.getXml();
|
||||
|
||||
if (StringUtils.isNotBlank(xml))
|
||||
tbpe = convertXmlToBpe(xml);
|
||||
|
@ -97,6 +97,7 @@ public class ExportacaoBPEVo {
|
|||
String pICMS = null;
|
||||
String vICMS = null;
|
||||
String cst = null;
|
||||
String pRedBC = null;
|
||||
|
||||
String vBP = null;
|
||||
String vDesconto = null;
|
||||
|
@ -106,13 +107,31 @@ public class ExportacaoBPEVo {
|
|||
vBC = tbpe.getInfBPe().getImp().getICMS().getICMS00().getVBC();
|
||||
pICMS = tbpe.getInfBPe().getImp().getICMS().getICMS00().getPICMS();
|
||||
vICMS = tbpe.getInfBPe().getImp().getICMS().getICMS00().getVICMS();
|
||||
cst = tbpe.getInfBPe().getImp().getICMS().getICMS00().getCST();
|
||||
} else if (tbpe.getInfBPe().getImp().getICMS().getICMS20() != null) {
|
||||
vBC = tbpe.getInfBPe().getImp().getICMS().getICMS20().getVBC();
|
||||
pICMS = tbpe.getInfBPe().getImp().getICMS().getICMS20().getPICMS();
|
||||
vICMS = tbpe.getInfBPe().getImp().getICMS().getICMS20().getVICMS();
|
||||
pRedBC = tbpe.getInfBPe().getImp().getICMS().getICMS20().getPRedBC();
|
||||
}
|
||||
|
||||
if (tbpe.getInfBPe().getInfValorBPe() != null) {
|
||||
vBP = tbpe.getInfBPe().getInfValorBPe().getVBP();
|
||||
vDesconto = tbpe.getInfBPe().getInfValorBPe().getVDesconto();
|
||||
}
|
||||
|
||||
// validar cst enviado
|
||||
if (tbpe.getInfBPe().getImp().getICMS().getICMS00() != null)
|
||||
cst = tbpe.getInfBPe().getImp().getICMS().getICMS00().getCST();
|
||||
else if (tbpe.getInfBPe().getImp().getICMS().getICMS20() != null)
|
||||
cst = tbpe.getInfBPe().getImp().getICMS().getICMS20().getCST();
|
||||
else if (tbpe.getInfBPe().getImp().getICMS().getICMS45() != null)
|
||||
cst = tbpe.getInfBPe().getImp().getICMS().getICMS45().getCST();
|
||||
else if (tbpe.getInfBPe().getImp().getICMS().getICMS90() != null)
|
||||
cst = tbpe.getInfBPe().getImp().getICMS().getICMS90().getCST();
|
||||
else if (tbpe.getInfBPe().getImp().getICMS().getICMSOutraUF() != null)
|
||||
cst = tbpe.getInfBPe().getImp().getICMS().getICMSOutraUF().getCST();
|
||||
else if (tbpe.getInfBPe().getImp().getICMS().getICMSSN() != null)
|
||||
cst = tbpe.getInfBPe().getImp().getICMS().getICMSSN().getCST();
|
||||
}
|
||||
|
||||
String cstCofins = "01";
|
||||
|
@ -133,8 +152,10 @@ public class ExportacaoBPEVo {
|
|||
registro.getListaRegistroBPE().add(tipoBPE);
|
||||
|
||||
String cfop = isInterMunicipal ? "5357" : "6357";
|
||||
String cstb = isInterMunicipal ? (registro.getRedBaseCalcEstadual() == null || registro.getRedBaseCalcEstadual().equals(ZERO)) ? "00" : "20"
|
||||
: (registro.getRedBaseCalcMunicipal() == null || registro.getRedBaseCalcMunicipal().equals(ZERO)) ? "00" : "20";
|
||||
|
||||
// String cstb = StringUtils.isNotBlank(xml) ? tbpe.getInfBPe().getImp().getICMS().getICMS45().getCST() :
|
||||
// isInterMunicipal ? (registro.getRedBaseCalcEstadual() == null || registro.getRedBaseCalcEstadual().equals(ZERO)) ? "00" : "20"
|
||||
// : (registro.getRedBaseCalcMunicipal() == null || registro.getRedBaseCalcMunicipal().equals(ZERO)) ? "00" : "20";
|
||||
|
||||
String csosnb = "";
|
||||
if (registro.getCrt().equals(CrtBpe.SIMPLES_NACIONAL)) {
|
||||
|
@ -149,9 +170,10 @@ public class ExportacaoBPEVo {
|
|||
BigDecimal aliquotaICMS = new BigDecimal(pICMS == null ? "0.0" : pICMS);
|
||||
BigDecimal icms = new BigDecimal(vICMS == null ? "0.0" : vICMS);
|
||||
BigDecimal isentas = registro.getValortotal().subtract(baseCalculoICMS);
|
||||
BigDecimal outras = new BigDecimal(cst == null ? "0.0" : cst);
|
||||
|
||||
ExportacaoBPETipoDPE tipoDPE = new ExportacaoBPETipoDPE(registro.getValortotal(), cfop, cstb, csosnb,
|
||||
BigDecimal outras = new BigDecimal(pRedBC == null ? "0.0" : pRedBC);
|
||||
|
||||
ExportacaoBPETipoDPE tipoDPE = new ExportacaoBPETipoDPE(registro.getValortotal(), cfop, cst, csosnb,
|
||||
baseCalculoICMS, aliquotaICMS, icms, isentas, outras);
|
||||
registro.getListaRegistroDPE().add(tipoDPE);
|
||||
|
||||
|
@ -178,7 +200,7 @@ public class ExportacaoBPEVo {
|
|||
this.getListaRegistroBaseBPE().add(registro);
|
||||
}
|
||||
|
||||
private TBPe convertXmlToBpe(String xml) {
|
||||
public TBPe convertXmlToBpe(String xml) {
|
||||
TBPe objeto = null;
|
||||
if (xml != null) {
|
||||
try {
|
||||
|
|
Loading…
Reference in New Issue