fixes bug #6817
git-svn-id: http://desenvolvimento.rjconsultores.com.br/repositorio/sco/AdmVenta/Model/trunk/modelWeb@54880 d1611594-4594-4d17-8e1d-87c2c4800839master
parent
b544971f09
commit
0226dc3e53
|
@ -20,6 +20,7 @@ import org.springframework.stereotype.Repository;
|
||||||
import com.rjconsultores.ventaboletos.dao.FiscalDAO;
|
import com.rjconsultores.ventaboletos.dao.FiscalDAO;
|
||||||
import com.rjconsultores.ventaboletos.entidad.EsquemaCorrida;
|
import com.rjconsultores.ventaboletos.entidad.EsquemaCorrida;
|
||||||
import com.rjconsultores.ventaboletos.utilerias.DateUtil;
|
import com.rjconsultores.ventaboletos.utilerias.DateUtil;
|
||||||
|
import com.rjconsultores.ventaboletos.utilerias.StringHelper;
|
||||||
import com.rjconsultores.ventaboletos.vo.impressaofiscal.ImportacionFiscalReducaoZVO;
|
import com.rjconsultores.ventaboletos.vo.impressaofiscal.ImportacionFiscalReducaoZVO;
|
||||||
import com.rjconsultores.ventaboletos.vo.impressaofiscal.ImportacionFiscalVO;
|
import com.rjconsultores.ventaboletos.vo.impressaofiscal.ImportacionFiscalVO;
|
||||||
import com.rjconsultores.ventaboletos.vo.impressaofiscal.ImportacionManualFiscalVO;
|
import com.rjconsultores.ventaboletos.vo.impressaofiscal.ImportacionManualFiscalVO;
|
||||||
|
@ -325,6 +326,7 @@ public class FiscalHibernateDAO extends GenericHibernateDAO<String, String> impl
|
||||||
sql.append(" b.preciopagado as importetarifa, ");
|
sql.append(" b.preciopagado as importetarifa, ");
|
||||||
sql.append(" b.importetaxaembarque as importetaxaembarque, ");
|
sql.append(" b.importetaxaembarque as importetaxaembarque, ");
|
||||||
sql.append(" b.importepedagio as importepedagio, ");
|
sql.append(" b.importepedagio as importepedagio, ");
|
||||||
|
sql.append(" b.importeseguro as importeseguro, ");
|
||||||
sql.append(" 'C' as status, ");
|
sql.append(" 'C' as status, ");
|
||||||
sql.append(" b.motivocancelacion_id as motivocancelacion, ");
|
sql.append(" b.motivocancelacion_id as motivocancelacion, ");
|
||||||
sql.append(" ee.impingreso as valorMulta ");
|
sql.append(" ee.impingreso as valorMulta ");
|
||||||
|
@ -371,7 +373,8 @@ public class FiscalHibernateDAO extends GenericHibernateDAO<String, String> impl
|
||||||
sql.append(" ee.impingreso, ");
|
sql.append(" ee.impingreso, ");
|
||||||
sql.append(" b.preciopagado, ");
|
sql.append(" b.preciopagado, ");
|
||||||
sql.append(" b.importetaxaembarque, ");
|
sql.append(" b.importetaxaembarque, ");
|
||||||
sql.append(" b.importepedagio ");
|
sql.append(" b.importepedagio, ");
|
||||||
|
sql.append(" b.importeseguro ");
|
||||||
sql.append(" ORDER BY r4.datainicialemissao, ");
|
sql.append(" ORDER BY r4.datainicialemissao, ");
|
||||||
sql.append(" r4.numserie20, ");
|
sql.append(" r4.numserie20, ");
|
||||||
sql.append(" r4.coo, ");
|
sql.append(" r4.coo, ");
|
||||||
|
@ -406,6 +409,7 @@ public class FiscalHibernateDAO extends GenericHibernateDAO<String, String> impl
|
||||||
sql.append(" b.preciopagado as importetarifa, ");
|
sql.append(" b.preciopagado as importetarifa, ");
|
||||||
sql.append(" b.importetaxaembarque as importetaxaembarque, ");
|
sql.append(" b.importetaxaembarque as importetaxaembarque, ");
|
||||||
sql.append(" b.importepedagio as importepedagio, ");
|
sql.append(" b.importepedagio as importepedagio, ");
|
||||||
|
sql.append(" b.importeseguro as importeseguro, ");
|
||||||
sql.append(" 'N' as status ");
|
sql.append(" 'N' as status ");
|
||||||
sql.append(" FROM fiscal_r4 r4 ");
|
sql.append(" FROM fiscal_r4 r4 ");
|
||||||
sql.append(" INNER JOIN fiscal_r5 r5 ON r4.numserie20 = r5.numserie20 AND r4.coo = r5.coo ");
|
sql.append(" INNER JOIN fiscal_r5 r5 ON r4.numserie20 = r5.numserie20 AND r4.coo = r5.coo ");
|
||||||
|
@ -446,7 +450,8 @@ public class FiscalHibernateDAO extends GenericHibernateDAO<String, String> impl
|
||||||
sql.append(" ed.cveestado, ");
|
sql.append(" ed.cveestado, ");
|
||||||
sql.append(" b.preciopagado, ");
|
sql.append(" b.preciopagado, ");
|
||||||
sql.append(" b.importetaxaembarque, ");
|
sql.append(" b.importetaxaembarque, ");
|
||||||
sql.append(" b.importepedagio ");
|
sql.append(" b.importepedagio, ");
|
||||||
|
sql.append(" b.importeseguro ");
|
||||||
sql.append(" ORDER BY r4.datainicialemissao, ");
|
sql.append(" ORDER BY r4.datainicialemissao, ");
|
||||||
sql.append(" r4.numserie20, ");
|
sql.append(" r4.numserie20, ");
|
||||||
sql.append(" r4.coo, ");
|
sql.append(" r4.coo, ");
|
||||||
|
@ -504,11 +509,12 @@ public class FiscalHibernateDAO extends GenericHibernateDAO<String, String> impl
|
||||||
item.setValorTarifa(rset.getBigDecimal("importetarifa"));
|
item.setValorTarifa(rset.getBigDecimal("importetarifa"));
|
||||||
item.setValorPedagio(rset.getBigDecimal("importepedagio"));
|
item.setValorPedagio(rset.getBigDecimal("importepedagio"));
|
||||||
item.setValorEmbarque(rset.getBigDecimal("importetaxaembarque"));
|
item.setValorEmbarque(rset.getBigDecimal("importetaxaembarque"));
|
||||||
|
item.setValorSeguro(rset.getBigDecimal("importeseguro"));
|
||||||
|
|
||||||
ImportacionFiscalVO novoFiscal = item;
|
ImportacionFiscalVO novoFiscal = item;
|
||||||
|
|
||||||
codProduto = item.getCodProduto();
|
codProduto = item.getCodProduto();
|
||||||
codProduto = codProduto.toString().replace("-", "").replace("TA", "").replace("TX", "").replace("PE", "");
|
codProduto = codProduto.toString().replace("-", "").replace("TA", "").replace("TX", "").replace("PE", "").replace("SE", "");
|
||||||
|
|
||||||
if (fiscal == null) {
|
if (fiscal == null) {
|
||||||
fiscal = item;
|
fiscal = item;
|
||||||
|
@ -550,10 +556,12 @@ public class FiscalHibernateDAO extends GenericHibernateDAO<String, String> impl
|
||||||
boolean temTarifa = validaValorExiste(fiscal.getValorTarifa());
|
boolean temTarifa = validaValorExiste(fiscal.getValorTarifa());
|
||||||
boolean temPedagio = validaValorExiste(fiscal.getValorPedagio());
|
boolean temPedagio = validaValorExiste(fiscal.getValorPedagio());
|
||||||
boolean temEmbarque = validaValorExiste(fiscal.getValorEmbarque());
|
boolean temEmbarque = validaValorExiste(fiscal.getValorEmbarque());
|
||||||
|
boolean temSeguro = validaValorExiste(fiscal.getValorSeguro());
|
||||||
|
|
||||||
boolean tarifaCriada = false;
|
boolean tarifaCriada = false;
|
||||||
boolean pedagioCriada = false;
|
boolean pedagioCriada = false;
|
||||||
boolean embarqueCriada = false;
|
boolean embarqueCriada = false;
|
||||||
|
boolean seguroCriada = false;
|
||||||
List<ItemFiscalVO> itensFiscais = new ArrayList<ItemFiscalVO>();
|
List<ItemFiscalVO> itensFiscais = new ArrayList<ItemFiscalVO>();
|
||||||
for (ItemFiscalVO item : fiscal.getItensFiscais()) {
|
for (ItemFiscalVO item : fiscal.getItensFiscais()) {
|
||||||
|
|
||||||
|
@ -568,16 +576,20 @@ public class FiscalHibernateDAO extends GenericHibernateDAO<String, String> impl
|
||||||
if (codigoProduto.indexOf("PE") >= 0)
|
if (codigoProduto.indexOf("PE") >= 0)
|
||||||
pedagioCriada = true;
|
pedagioCriada = true;
|
||||||
|
|
||||||
|
if (codigoProduto.indexOf("SE") >= 0)
|
||||||
|
seguroCriada = true;
|
||||||
|
|
||||||
itensFiscais.add(item);
|
itensFiscais.add(item);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int numeroItem = 1;
|
||||||
if (temTarifa && !tarifaCriada) {
|
if (temTarifa && !tarifaCriada) {
|
||||||
ItemFiscalVO novoTarifa = new ItemFiscalVO(fiscal);
|
ItemFiscalVO novoTarifa = new ItemFiscalVO(fiscal);
|
||||||
novoTarifa.setCodProduto(codProduto + "-TA");
|
novoTarifa.setCodProduto(codProduto + "-TA");
|
||||||
novoTarifa.setTipoPassagem("E");
|
novoTarifa.setTipoPassagem("E");
|
||||||
novoTarifa.setValorItem(fiscal.getValorTarifa());
|
novoTarifa.setValorItem(fiscal.getValorTarifa());
|
||||||
novoTarifa.setRepTributado("N1");
|
novoTarifa.setRepTributado("N1");
|
||||||
novoTarifa.setNumItem("001");
|
novoTarifa.setNumItem(StringHelper.preencherZeroEsquerda((numeroItem++) + "", 3));
|
||||||
itensFiscais.add(novoTarifa);
|
itensFiscais.add(novoTarifa);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -587,7 +599,7 @@ public class FiscalHibernateDAO extends GenericHibernateDAO<String, String> impl
|
||||||
novoEmbarque.setTipoPassagem("E");
|
novoEmbarque.setTipoPassagem("E");
|
||||||
novoEmbarque.setValorItem(fiscal.getValorEmbarque());
|
novoEmbarque.setValorItem(fiscal.getValorEmbarque());
|
||||||
novoEmbarque.setRepTributado("N1");
|
novoEmbarque.setRepTributado("N1");
|
||||||
novoEmbarque.setNumItem("002");
|
novoEmbarque.setNumItem(StringHelper.preencherZeroEsquerda((numeroItem++) + "", 3));
|
||||||
itensFiscais.add(novoEmbarque);
|
itensFiscais.add(novoEmbarque);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -597,14 +609,22 @@ public class FiscalHibernateDAO extends GenericHibernateDAO<String, String> impl
|
||||||
novoPedagio.setTipoPassagem("E");
|
novoPedagio.setTipoPassagem("E");
|
||||||
novoPedagio.setValorItem(fiscal.getValorPedagio());
|
novoPedagio.setValorItem(fiscal.getValorPedagio());
|
||||||
novoPedagio.setRepTributado("N1");
|
novoPedagio.setRepTributado("N1");
|
||||||
if (temEmbarque)
|
novoPedagio.setNumItem(StringHelper.preencherZeroEsquerda((numeroItem++) + "", 3));
|
||||||
novoPedagio.setNumItem("003");
|
|
||||||
else
|
|
||||||
novoPedagio.setNumItem("002");
|
|
||||||
|
|
||||||
itensFiscais.add(novoPedagio);
|
itensFiscais.add(novoPedagio);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (temSeguro && !seguroCriada) {
|
||||||
|
ItemFiscalVO novoSeguro = new ItemFiscalVO(fiscal);
|
||||||
|
novoSeguro.setCodProduto(codProduto + "-SE");
|
||||||
|
novoSeguro.setTipoPassagem("E");
|
||||||
|
novoSeguro.setValorItem(fiscal.getValorSeguro());
|
||||||
|
novoSeguro.setRepTributado("N1");
|
||||||
|
novoSeguro.setNumItem(StringHelper.preencherZeroEsquerda((numeroItem++) + "", 3));
|
||||||
|
|
||||||
|
itensFiscais.add(novoSeguro);
|
||||||
|
}
|
||||||
|
|
||||||
return itensFiscais;
|
return itensFiscais;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -569,10 +569,11 @@ public class FiscalServiceImpl implements FiscalService {
|
||||||
BigDecimal valorPedagio = item.getValorPedagio() == null ? BigDecimal.ZERO : item.getValorPedagio();
|
BigDecimal valorPedagio = item.getValorPedagio() == null ? BigDecimal.ZERO : item.getValorPedagio();
|
||||||
BigDecimal valorEmbarque = item.getValorEmbarque() == null ? BigDecimal.ZERO : item.getValorEmbarque();
|
BigDecimal valorEmbarque = item.getValorEmbarque() == null ? BigDecimal.ZERO : item.getValorEmbarque();
|
||||||
BigDecimal valorTarifa = item.getValorTarifa() == null ? BigDecimal.ZERO : item.getValorTarifa();
|
BigDecimal valorTarifa = item.getValorTarifa() == null ? BigDecimal.ZERO : item.getValorTarifa();
|
||||||
|
BigDecimal valorSeguro = item.getValorSeguro() == null ? BigDecimal.ZERO : item.getValorSeguro();
|
||||||
if (valorTarifa.equals(BigDecimal.ZERO))
|
if (valorTarifa.equals(BigDecimal.ZERO))
|
||||||
valorTarifa = BigDecimal.ONE;
|
valorTarifa = BigDecimal.ONE;
|
||||||
|
|
||||||
valorTotal = valorTotal.add(valorTarifa).add(valorPedagio).add(valorEmbarque);
|
valorTotal = valorTotal.add(valorTarifa).add(valorPedagio).add(valorEmbarque).add(valorSeguro);
|
||||||
|
|
||||||
return valorTotal;
|
return valorTotal;
|
||||||
}
|
}
|
||||||
|
@ -627,6 +628,10 @@ public class FiscalServiceImpl implements FiscalService {
|
||||||
// PEDAGIO
|
// PEDAGIO
|
||||||
} else if (codProduto.indexOf("PE") >= 0) {
|
} else if (codProduto.indexOf("PE") >= 0) {
|
||||||
valorItem = item.getValorPedagio() == null ? valorItem : item.getValorPedagio();
|
valorItem = item.getValorPedagio() == null ? valorItem : item.getValorPedagio();
|
||||||
|
|
||||||
|
// SEGURO
|
||||||
|
} else if (codProduto.indexOf("SE") >= 0) {
|
||||||
|
valorItem = item.getValorSeguro() == null ? valorItem : item.getValorSeguro();
|
||||||
}
|
}
|
||||||
|
|
||||||
valorItem = UtileriasFiscal.arredondar(valorItem);
|
valorItem = UtileriasFiscal.arredondar(valorItem);
|
||||||
|
@ -743,6 +748,10 @@ public class FiscalServiceImpl implements FiscalService {
|
||||||
// PEDAGIO
|
// PEDAGIO
|
||||||
} else if (codProduto.indexOf("PE") >= 0) {
|
} else if (codProduto.indexOf("PE") >= 0) {
|
||||||
valorItem = item.getValorPedagio() == null ? valorItem : item.getValorPedagio();
|
valorItem = item.getValorPedagio() == null ? valorItem : item.getValorPedagio();
|
||||||
|
|
||||||
|
// SEGURO
|
||||||
|
} else if (codProduto.indexOf("SE") >= 0) {
|
||||||
|
valorItem = item.getValorSeguro() == null ? valorItem : item.getValorSeguro();
|
||||||
}
|
}
|
||||||
|
|
||||||
valorItem = UtileriasFiscal.arredondar(valorItem);
|
valorItem = UtileriasFiscal.arredondar(valorItem);
|
||||||
|
|
|
@ -26,6 +26,7 @@ public class ImportacionFiscalVO {
|
||||||
private BigDecimal valorTarifa;
|
private BigDecimal valorTarifa;
|
||||||
private BigDecimal valorPedagio;
|
private BigDecimal valorPedagio;
|
||||||
private BigDecimal valorEmbarque;
|
private BigDecimal valorEmbarque;
|
||||||
|
private BigDecimal valorSeguro;
|
||||||
|
|
||||||
private List<ItemFiscalVO> itensFiscais;
|
private List<ItemFiscalVO> itensFiscais;
|
||||||
|
|
||||||
|
@ -33,7 +34,7 @@ public class ImportacionFiscalVO {
|
||||||
super();
|
super();
|
||||||
}
|
}
|
||||||
|
|
||||||
public ImportacionFiscalVO(String numImpressora, String coo, Long boletoId, Integer empresaId, String dataEmissao, String cnpjCliente, String cnpjImpressora, Integer origenId, String origenUf, Integer destinoId, String destinoUf, String numpdv, String modeloImpressora, String numCaixa, String status, Integer motivocancelacion, BigDecimal valorMulta, BigDecimal valorTarifa, BigDecimal valorPedagio, BigDecimal valorEmbarque) {
|
public ImportacionFiscalVO(String numImpressora, String coo, Long boletoId, Integer empresaId, String dataEmissao, String cnpjCliente, String cnpjImpressora, Integer origenId, String origenUf, Integer destinoId, String destinoUf, String numpdv, String modeloImpressora, String numCaixa, String status, Integer motivocancelacion, BigDecimal valorMulta, BigDecimal valorTarifa, BigDecimal valorPedagio, BigDecimal valorEmbarque, BigDecimal valorSeguro) {
|
||||||
super();
|
super();
|
||||||
this.numImpressora = numImpressora;
|
this.numImpressora = numImpressora;
|
||||||
this.coo = coo;
|
this.coo = coo;
|
||||||
|
@ -55,6 +56,7 @@ public class ImportacionFiscalVO {
|
||||||
this.valorTarifa = valorTarifa;
|
this.valorTarifa = valorTarifa;
|
||||||
this.valorPedagio = valorPedagio;
|
this.valorPedagio = valorPedagio;
|
||||||
this.valorEmbarque = valorEmbarque;
|
this.valorEmbarque = valorEmbarque;
|
||||||
|
this.valorSeguro = valorSeguro;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getNumImpressora() {
|
public String getNumImpressora() {
|
||||||
|
@ -265,4 +267,12 @@ public class ImportacionFiscalVO {
|
||||||
this.valorEmbarque = valorEmbarque;
|
this.valorEmbarque = valorEmbarque;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public BigDecimal getValorSeguro() {
|
||||||
|
return valorSeguro;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setValorSeguro(BigDecimal valorSeguro) {
|
||||||
|
this.valorSeguro = valorSeguro;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,7 +19,7 @@ public class ItemFiscalVO extends ImportacionFiscalVO {
|
||||||
item.getCnpjCliente(), item.getCnpjImpressora(), item.getOrigenId(), item.getOrigenUf(), item.getDestinoId(),
|
item.getCnpjCliente(), item.getCnpjImpressora(), item.getOrigenId(), item.getOrigenUf(), item.getDestinoId(),
|
||||||
item.getDestinoUf(), item.getNumpdv(), item.getModeloImpressora(), item.getNumCaixa(), item.getStatus(),
|
item.getDestinoUf(), item.getNumpdv(), item.getModeloImpressora(), item.getNumCaixa(), item.getStatus(),
|
||||||
item.getMotivocancelacion(), item.getValorMulta(), item.getValorTarifa(), item.getValorPedagio(),
|
item.getMotivocancelacion(), item.getValorMulta(), item.getValorTarifa(), item.getValorPedagio(),
|
||||||
item.getValorEmbarque());
|
item.getValorEmbarque(), item.getValorSeguro());
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getNumItem() {
|
public String getNumItem() {
|
||||||
|
|
Loading…
Reference in New Issue