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.ItemFiscalVO;
|
||||
import com.rjconsultores.ventaboletos.vo.impressaofiscal.SituacaoTributaria;
|
||||
import com.rjconsultores.ventaboletos.vo.impressaofiscal.SubItens;
|
||||
|
||||
@Service("fiscalService")
|
||||
public class FiscalServiceImpl implements FiscalService {
|
||||
|
@ -89,7 +90,7 @@ public class FiscalServiceImpl implements FiscalService {
|
|||
String filialCliente = StringHelper.preencherStringEsquerda(null, 2, "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 valorItens = UtileriasFiscal.formataZeroDecimal(valorTotal, 14);
|
||||
|
||||
|
@ -139,7 +140,7 @@ public class FiscalServiceImpl implements FiscalService {
|
|||
aidf, brancos171, sequencial);
|
||||
gravarArq.println(header);
|
||||
|
||||
for (String itemDoc : montarItensFiscaisManual(imf, imf.getItens(), seq)) {
|
||||
for (String itemDoc : montarItensFiscaisManual(imf, imf.getSubItens(), seq)) {
|
||||
|
||||
qtdItens++;
|
||||
gravarArq.println(itemDoc);
|
||||
|
@ -167,12 +168,22 @@ public class FiscalServiceImpl implements FiscalService {
|
|||
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>();
|
||||
Integer num = 0;
|
||||
|
||||
for (BigDecimal item : itensFiscais) {
|
||||
for (SubItens item : itensFiscais) {
|
||||
|
||||
num++;
|
||||
String numItem = StringHelper.preencherZeroEsquerda(num.toString(), 3);
|
||||
|
@ -185,11 +196,13 @@ public class FiscalServiceImpl implements FiscalService {
|
|||
}
|
||||
|
||||
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 quantidade = "001";
|
||||
|
||||
BigDecimal valorItem = UtileriasFiscal.arredondar(item);
|
||||
BigDecimal valorItem = UtileriasFiscal.arredondar(item.getValor());
|
||||
String valorUnitario = UtileriasFiscal.formataZeroDecimal(valorItem, 15);
|
||||
String valorTotal = UtileriasFiscal.formataZeroDecimal(valorItem, 15);
|
||||
|
||||
|
@ -237,24 +250,28 @@ public class FiscalServiceImpl implements FiscalService {
|
|||
|
||||
for (ImportacionManualFiscalVO imf : list) {
|
||||
|
||||
List<BigDecimal> itens = new ArrayList<BigDecimal>();
|
||||
if (imf.getImporteoutros() != null) {
|
||||
itens.add(imf.getImporteoutros());
|
||||
}
|
||||
List<SubItens> itens = new ArrayList<SubItens>();
|
||||
|
||||
// if (imf.getImporteoutros() != null) {
|
||||
// itens.add(new SubItens(imf.getImporteoutros(), "00000000000-OT"));
|
||||
// }
|
||||
|
||||
if (imf.getImportepedagio() != null) {
|
||||
itens.add(imf.getImportepedagio());
|
||||
itens.add(new SubItens(imf.getImportepedagio(), "00000000000-PE"));
|
||||
}
|
||||
|
||||
if (imf.getImporteseguro() != null) {
|
||||
itens.add(imf.getImporteseguro());
|
||||
itens.add(new SubItens(imf.getImporteseguro(), "00000000000-SE"));
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
|
|
|
@ -36,7 +36,7 @@ public class ImportacionManualFiscalVO {
|
|||
private String modeloImpressora;
|
||||
private String numCaixa;
|
||||
|
||||
List<BigDecimal> itens;
|
||||
List<SubItens> subItens;
|
||||
|
||||
public String getNumImpressora() {
|
||||
return numImpressora;
|
||||
|
@ -198,12 +198,12 @@ public class ImportacionManualFiscalVO {
|
|||
this.importeseguro = importeseguro;
|
||||
}
|
||||
|
||||
public List<BigDecimal> getItens() {
|
||||
return itens;
|
||||
public List<SubItens> getSubItens() {
|
||||
return subItens;
|
||||
}
|
||||
|
||||
public void setItens(List<BigDecimal> itens) {
|
||||
this.itens = itens;
|
||||
public void setSubItens(List<SubItens> subItens) {
|
||||
this.subItens = subItens;
|
||||
}
|
||||
|
||||
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