fixes bug #6817
git-svn-id: http://desenvolvimento.rjconsultores.com.br/repositorio/sco/AdmVenta/Model/trunk/modelWeb@51011 d1611594-4594-4d17-8e1d-87c2c4800839master
parent
e5a41dbab8
commit
b834202afb
|
@ -34,6 +34,7 @@ import com.rjconsultores.ventaboletos.vo.impressaofiscal.ImportacionFiscalVO;
|
||||||
import com.rjconsultores.ventaboletos.vo.impressaofiscal.ImportacionManualFiscalVO;
|
import com.rjconsultores.ventaboletos.vo.impressaofiscal.ImportacionManualFiscalVO;
|
||||||
import com.rjconsultores.ventaboletos.vo.impressaofiscal.ItemFiscalVO;
|
import com.rjconsultores.ventaboletos.vo.impressaofiscal.ItemFiscalVO;
|
||||||
import com.rjconsultores.ventaboletos.vo.impressaofiscal.SituacaoTributaria;
|
import com.rjconsultores.ventaboletos.vo.impressaofiscal.SituacaoTributaria;
|
||||||
|
import com.rjconsultores.ventaboletos.vo.impressaofiscal.SubItens;
|
||||||
|
|
||||||
@Service("fiscalService")
|
@Service("fiscalService")
|
||||||
public class FiscalServiceImpl implements FiscalService {
|
public class FiscalServiceImpl implements FiscalService {
|
||||||
|
@ -89,7 +90,7 @@ public class FiscalServiceImpl implements FiscalService {
|
||||||
String filialCliente = StringHelper.preencherStringEsquerda(null, 2, "9");
|
String filialCliente = StringHelper.preencherStringEsquerda(null, 2, "9");
|
||||||
String condicaoPagamento = StringHelper.preencherStringEsquerda(null, 3, "9");
|
String condicaoPagamento = StringHelper.preencherStringEsquerda(null, 3, "9");
|
||||||
|
|
||||||
BigDecimal valorTotal = UtileriasFiscal.arredondar(imf.getValorTotal());
|
BigDecimal valorTotal = UtileriasFiscal.arredondar(calculaValorTotalECFManual(imf));
|
||||||
String valorTotalDocumanto = UtileriasFiscal.formataZeroDecimal(valorTotal, 14);
|
String valorTotalDocumanto = UtileriasFiscal.formataZeroDecimal(valorTotal, 14);
|
||||||
String valorItens = UtileriasFiscal.formataZeroDecimal(valorTotal, 14);
|
String valorItens = UtileriasFiscal.formataZeroDecimal(valorTotal, 14);
|
||||||
|
|
||||||
|
@ -139,7 +140,7 @@ public class FiscalServiceImpl implements FiscalService {
|
||||||
aidf, brancos171, sequencial);
|
aidf, brancos171, sequencial);
|
||||||
gravarArq.println(header);
|
gravarArq.println(header);
|
||||||
|
|
||||||
for (String itemDoc : montarItensFiscaisManual(imf, imf.getItens(), seq)) {
|
for (String itemDoc : montarItensFiscaisManual(imf, imf.getSubItens(), seq)) {
|
||||||
|
|
||||||
qtdItens++;
|
qtdItens++;
|
||||||
gravarArq.println(itemDoc);
|
gravarArq.println(itemDoc);
|
||||||
|
@ -167,12 +168,22 @@ public class FiscalServiceImpl implements FiscalService {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<String> montarItensFiscaisManual(ImportacionManualFiscalVO imf, List<BigDecimal> itensFiscais, Integer seq) {
|
private BigDecimal calculaValorTotalECFManual(ImportacionManualFiscalVO imf) {
|
||||||
|
BigDecimal valorTotal = BigDecimal.ZERO;
|
||||||
|
valorTotal = valorTotal.add(imf.getValorTotal());
|
||||||
|
valorTotal = valorTotal.add(imf.getImporteoutros() == null ? BigDecimal.ZERO : imf.getImporteoutros());
|
||||||
|
valorTotal = valorTotal.add(imf.getImportepedagio() == null ? BigDecimal.ZERO : imf.getImportepedagio());
|
||||||
|
valorTotal = valorTotal.add(imf.getImporteseguro() == null ? BigDecimal.ZERO : imf.getImporteseguro());
|
||||||
|
valorTotal = valorTotal.add(imf.getImportetaxaembarque() == null ? BigDecimal.ZERO : imf.getImportetaxaembarque());
|
||||||
|
return valorTotal;
|
||||||
|
}
|
||||||
|
|
||||||
|
private List<String> montarItensFiscaisManual(ImportacionManualFiscalVO imf, List<SubItens> itensFiscais, Integer seq) {
|
||||||
|
|
||||||
List<String> itensDocs = new ArrayList<String>();
|
List<String> itensDocs = new ArrayList<String>();
|
||||||
Integer num = 0;
|
Integer num = 0;
|
||||||
|
|
||||||
for (BigDecimal item : itensFiscais) {
|
for (SubItens item : itensFiscais) {
|
||||||
|
|
||||||
num++;
|
num++;
|
||||||
String numItem = StringHelper.preencherZeroEsquerda(num.toString(), 3);
|
String numItem = StringHelper.preencherZeroEsquerda(num.toString(), 3);
|
||||||
|
@ -185,11 +196,13 @@ public class FiscalServiceImpl implements FiscalService {
|
||||||
}
|
}
|
||||||
|
|
||||||
String codigoTES = StringHelper.preencherStringEsquerda(null, 3, "9");
|
String codigoTES = StringHelper.preencherStringEsquerda(null, 3, "9");
|
||||||
String codProduto = StringHelper.preencherStringEspacoEsquerda(imf.getCodProduto(), 15);
|
String prod = imf.getCodProduto() == null ? item.getCodProduto() : imf.getCodProduto();
|
||||||
|
String codProduto = StringHelper.preencherStringEspacoEsquerda(prod, 15);
|
||||||
|
|
||||||
String unidade = "UN";
|
String unidade = "UN";
|
||||||
String quantidade = "001";
|
String quantidade = "001";
|
||||||
|
|
||||||
BigDecimal valorItem = UtileriasFiscal.arredondar(item);
|
BigDecimal valorItem = UtileriasFiscal.arredondar(item.getValor());
|
||||||
String valorUnitario = UtileriasFiscal.formataZeroDecimal(valorItem, 15);
|
String valorUnitario = UtileriasFiscal.formataZeroDecimal(valorItem, 15);
|
||||||
String valorTotal = UtileriasFiscal.formataZeroDecimal(valorItem, 15);
|
String valorTotal = UtileriasFiscal.formataZeroDecimal(valorItem, 15);
|
||||||
|
|
||||||
|
@ -237,24 +250,28 @@ public class FiscalServiceImpl implements FiscalService {
|
||||||
|
|
||||||
for (ImportacionManualFiscalVO imf : list) {
|
for (ImportacionManualFiscalVO imf : list) {
|
||||||
|
|
||||||
List<BigDecimal> itens = new ArrayList<BigDecimal>();
|
List<SubItens> itens = new ArrayList<SubItens>();
|
||||||
if (imf.getImporteoutros() != null) {
|
|
||||||
itens.add(imf.getImporteoutros());
|
// if (imf.getImporteoutros() != null) {
|
||||||
}
|
// itens.add(new SubItens(imf.getImporteoutros(), "00000000000-OT"));
|
||||||
|
// }
|
||||||
|
|
||||||
if (imf.getImportepedagio() != null) {
|
if (imf.getImportepedagio() != null) {
|
||||||
itens.add(imf.getImportepedagio());
|
itens.add(new SubItens(imf.getImportepedagio(), "00000000000-PE"));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (imf.getImporteseguro() != null) {
|
if (imf.getImporteseguro() != null) {
|
||||||
itens.add(imf.getImporteseguro());
|
itens.add(new SubItens(imf.getImporteseguro(), "00000000000-SE"));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (imf.getImportetaxaembarque() != null) {
|
if (imf.getImportetaxaembarque() != null) {
|
||||||
itens.add(imf.getImportetaxaembarque());
|
itens.add(new SubItens(imf.getImportetaxaembarque(), "00000000000-TX"));
|
||||||
|
}
|
||||||
|
if (imf.getValorItem() != null) {
|
||||||
|
itens.add(new SubItens(imf.getValorTotal(), "00000000000-TA"));
|
||||||
}
|
}
|
||||||
|
|
||||||
imf.setItens(itens);
|
imf.setSubItens(itens);
|
||||||
aux.add(imf);
|
aux.add(imf);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -36,7 +36,7 @@ public class ImportacionManualFiscalVO {
|
||||||
private String modeloImpressora;
|
private String modeloImpressora;
|
||||||
private String numCaixa;
|
private String numCaixa;
|
||||||
|
|
||||||
List<BigDecimal> itens;
|
List<SubItens> subItens;
|
||||||
|
|
||||||
public String getNumImpressora() {
|
public String getNumImpressora() {
|
||||||
return numImpressora;
|
return numImpressora;
|
||||||
|
@ -198,12 +198,12 @@ public class ImportacionManualFiscalVO {
|
||||||
this.importeseguro = importeseguro;
|
this.importeseguro = importeseguro;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<BigDecimal> getItens() {
|
public List<SubItens> getSubItens() {
|
||||||
return itens;
|
return subItens;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setItens(List<BigDecimal> itens) {
|
public void setSubItens(List<SubItens> subItens) {
|
||||||
this.itens = itens;
|
this.subItens = subItens;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Integer getEstadoIdOrigen() {
|
public Integer getEstadoIdOrigen() {
|
||||||
|
|
|
@ -0,0 +1,30 @@
|
||||||
|
package com.rjconsultores.ventaboletos.vo.impressaofiscal;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
|
public class SubItens {
|
||||||
|
public SubItens(BigDecimal valor, String codProduto) {
|
||||||
|
super();
|
||||||
|
this.valor = valor;
|
||||||
|
this.codProduto = codProduto;
|
||||||
|
}
|
||||||
|
|
||||||
|
private BigDecimal valor;
|
||||||
|
private String codProduto;
|
||||||
|
|
||||||
|
public BigDecimal getValor() {
|
||||||
|
return valor;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setValor(BigDecimal valor) {
|
||||||
|
this.valor = valor;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getCodProduto() {
|
||||||
|
return codProduto;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCodProduto(String codProduto) {
|
||||||
|
this.codProduto = codProduto;
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue