bug #6817
git-svn-id: http://desenvolvimento.rjconsultores.com.br/repositorio/sco/AdmVenta/Model/trunk/modelWeb@54304 d1611594-4594-4d17-8e1d-87c2c4800839master
parent
ec8b541bcf
commit
347ba8d80b
|
@ -21,4 +21,6 @@ public interface FiscalDAO {
|
|||
|
||||
public List<ImportacionNaoFiscalVO> buscaDatosNaoFiscais(Date inicio, Date fim, Integer empresaId) throws SQLException;
|
||||
|
||||
public String sqlFiscaisECFCancelados(Date inicio, Date fim, Integer empresaId);
|
||||
|
||||
}
|
||||
|
|
|
@ -296,6 +296,85 @@ public class FiscalHibernateDAO extends GenericHibernateDAO<String, String> impl
|
|||
return listRedZ;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String sqlFiscaisECFCancelados(Date inicio, Date fim, Integer empresaId) {
|
||||
|
||||
StringBuilder sql = new StringBuilder();
|
||||
sql.append("SELECT r4.numserie20 as numImpressora, ");
|
||||
sql.append(" r4.coo as coo, ");
|
||||
sql.append(" r4.imptotalliquido as valorTotal, ");
|
||||
sql.append(" r4.datainicialemissao as dataEmissao, ");
|
||||
sql.append(" r4.cpfcnpjcliente as cnpjCliente, ");
|
||||
sql.append(" b.boleto_id as boletoId, ");
|
||||
sql.append(" b.marca_id as empresaId, ");
|
||||
sql.append(" co.codibge as origenId, ");
|
||||
sql.append(" eo.cveestado as origenUf, ");
|
||||
sql.append(" cd.codibge as destinoId, ");
|
||||
sql.append(" ed.cveestado as destinoUf, ");
|
||||
sql.append(" fi.numcnpj as cnpjImpressora, ");
|
||||
sql.append(" fi.numserie as numpdv, ");
|
||||
sql.append(" r5.totparcial as repTributado, ");
|
||||
sql.append(" r5.imptotalliquido as valorItem, ");
|
||||
sql.append(" r5.tipopassagem as tipoPassagem, ");
|
||||
sql.append(" r5.numitem as numItem, ");
|
||||
sql.append(" r5.codproduto as codProduto, ");
|
||||
sql.append(" fi.modelo as modeloImpressora, ");
|
||||
sql.append(" r4.usuario_id as numCaixa, ");
|
||||
sql.append(" max(ml2.valortarifa) as valorTarifa, ");
|
||||
sql.append(" max(ml2.pedagio) as valorPedagio, ");
|
||||
sql.append(" max(ml2.taxaembarque) as valorEmbarque, ");
|
||||
sql.append(" 'C' as status, ");
|
||||
sql.append(" b.motivocancelacion_id as motivocancelacion, ");
|
||||
sql.append(" ee.impingreso as valorMulta ");
|
||||
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(" AND r4.datamov = r5.datamov AND r4.contador = r5.contador ");
|
||||
sql.append(" INNER JOIN fiscal_impressora fi ON fi.numserie20 = r4.numserie20 ");
|
||||
sql.append(" AND fi.fiscalimpressora_id = r5.fiscalimpressora_id ");
|
||||
sql.append(" LEFT JOIN fiscal_ml2 ml2 ON ml2.boleto_id = r4.boleto_id ");
|
||||
sql.append(" INNER JOIN boleto b ON b.boleto_id = r4.boleto_id ");
|
||||
sql.append(" LEFT JOIN evento_extra ee on ee.boleto_id = b.boleto_id and ee.tipoeventoextra_id in (42) ");
|
||||
sql.append(" LEFT JOIN alias_servico ase ON ase.origen_id = b.origen_id ");
|
||||
sql.append(" and ase.destino_id = b.destino_id and ase.ruta_id = b.ruta_id and ase.activo = 1 and ase.corrida_id is null ");
|
||||
sql.append(" INNER JOIN parada o ON coalesce(ase.aliasorigen_id, b.origen_id) = o.parada_id ");
|
||||
sql.append(" INNER JOIN ciudad co ON o.ciudad_id = co.ciudad_id ");
|
||||
sql.append(" INNER JOIN estado eo ON eo.estado_id = co.estado_id ");
|
||||
sql.append(" INNER JOIN parada d ON coalesce(ase.aliasdestino_id, b.destino_id) = d.parada_id ");
|
||||
sql.append(" INNER JOIN ciudad cd ON d.ciudad_id = cd.ciudad_id ");
|
||||
sql.append(" INNER JOIN estado ed ON ed.estado_id = cd.estado_id ");
|
||||
sql.append(" WHERE r4.datamov BETWEEN ? AND ? ");
|
||||
sql.append(" AND b.marca_id = ? ");
|
||||
sql.append(" AND b.motivocancelacion_id in (31, 32, 10, 23, 27) ");
|
||||
sql.append(" GROUP BY r4.numserie20, ");
|
||||
sql.append(" r4.coo, ");
|
||||
sql.append(" r4.datainicialemissao, ");
|
||||
sql.append(" r4.cpfcnpjcliente, ");
|
||||
sql.append(" r4.imptotalliquido, ");
|
||||
sql.append(" b.boleto_id, ");
|
||||
sql.append(" b.marca_id, ");
|
||||
sql.append(" co.codibge, ");
|
||||
sql.append(" cd.codibge, ");
|
||||
sql.append(" fi.numcnpj, ");
|
||||
sql.append(" fi.numserie, ");
|
||||
sql.append(" r5.impdesconto, ");
|
||||
sql.append(" r5.totparcial, ");
|
||||
sql.append(" r5.imptotalliquido, ");
|
||||
sql.append(" r5.tipopassagem, ");
|
||||
sql.append(" r5.numitem, ");
|
||||
sql.append(" r5.codproduto, ");
|
||||
sql.append(" fi.modelo, ");
|
||||
sql.append(" r4.usuario_id, ");
|
||||
sql.append(" eo.cveestado, ");
|
||||
sql.append(" ed.cveestado, ");
|
||||
sql.append(" b.motivocancelacion_id, ");
|
||||
sql.append(" ee.impingreso ");
|
||||
sql.append(" ORDER BY r4.datainicialemissao, ");
|
||||
sql.append(" r4.numserie20, ");
|
||||
sql.append(" r4.coo ");
|
||||
|
||||
return sql.toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String sqlFiscaisECF(Date inicio, Date fim, Integer empresaId) {
|
||||
|
||||
|
@ -320,9 +399,9 @@ public class FiscalHibernateDAO extends GenericHibernateDAO<String, String> impl
|
|||
sql.append(" r5.codproduto as codProduto, ");
|
||||
sql.append(" fi.modelo as modeloImpressora, ");
|
||||
sql.append(" r4.usuario_id as numCaixa, ");
|
||||
sql.append(" ml2.valortarifa as valorTarifa, ");
|
||||
sql.append(" ml2.pedagio as valorPedagio, ");
|
||||
sql.append(" ml2.taxaembarque as valorEmbarque, ");
|
||||
sql.append(" max(ml2.valortarifa) as valorTarifa, ");
|
||||
sql.append(" max(ml2.pedagio) as valorPedagio, ");
|
||||
sql.append(" max(ml2.taxaembarque) as valorEmbarque, ");
|
||||
sql.append(" 'N' as status ");
|
||||
sql.append(" FROM fiscal_r4 r4 ");
|
||||
sql.append(" INNER JOIN fiscal_r5 r5 ON r4.numserie20 = r5.numserie20 AND r4.coo = r5.coo ");
|
||||
|
@ -361,11 +440,7 @@ public class FiscalHibernateDAO extends GenericHibernateDAO<String, String> impl
|
|||
sql.append(" fi.modelo, ");
|
||||
sql.append(" r4.usuario_id, ");
|
||||
sql.append(" eo.cveestado, ");
|
||||
sql.append(" ed.cveestado, ");
|
||||
sql.append(" ml2.valortarifa, ");
|
||||
sql.append(" ml2.pedagio, ");
|
||||
sql.append(" ml2.taxaembarque, ");
|
||||
sql.append(" r4.indcancelamento ");
|
||||
sql.append(" ed.cveestado ");
|
||||
sql.append(" ORDER BY r4.datainicialemissao, ");
|
||||
sql.append(" r4.numserie20, ");
|
||||
sql.append(" r4.coo ");
|
||||
|
|
|
@ -20,4 +20,6 @@ public interface FiscalService {
|
|||
|
||||
public File importacionNaoFiscal(Date inicio, Date fim, Empresa empresa);
|
||||
|
||||
public File importacionFiscalECFCancelados(Date inicio, Date fim, Empresa empresa, Connection conn);
|
||||
|
||||
}
|
||||
|
|
|
@ -37,6 +37,7 @@ import com.rjconsultores.ventaboletos.vo.impressaofiscal.ImportacionFiscalVO;
|
|||
import com.rjconsultores.ventaboletos.vo.impressaofiscal.ImportacionManualFiscalVO;
|
||||
import com.rjconsultores.ventaboletos.vo.impressaofiscal.ImportacionNaoFiscalVO;
|
||||
import com.rjconsultores.ventaboletos.vo.impressaofiscal.ItemFiscalVO;
|
||||
import com.rjconsultores.ventaboletos.vo.impressaofiscal.SiglaMotivoCancelacion;
|
||||
import com.rjconsultores.ventaboletos.vo.impressaofiscal.SituacaoTributaria;
|
||||
import com.rjconsultores.ventaboletos.vo.impressaofiscal.SubItens;
|
||||
|
||||
|
@ -145,7 +146,7 @@ public class FiscalServiceImpl implements FiscalService {
|
|||
filialCliente, condicaoPagamento, valorTotalDocumanto, valorItens, baseCalICMS, valorTotalICMS,
|
||||
valorPIS, valorCofins, valorCSLL, totalICMSIsento, totalICMSNaotributado, origenUf, origen,
|
||||
destinoUf, destino, subSerie,
|
||||
aidf, status, brancos170, sequencial);
|
||||
aidf, status, null, null, brancos170, sequencial);
|
||||
gravarArq.print(header + QUEBRA_LINHA);
|
||||
|
||||
for (String itemDoc : montarItensFiscaisManual(imf, imf.getSubItens(), seq)) {
|
||||
|
@ -248,7 +249,7 @@ public class FiscalServiceImpl implements FiscalService {
|
|||
unidade, quantidade, valorUnitario, valorTotal, aliquotaItem, impostoItem,
|
||||
aliquotaPIS, valorPIS, aliquotaCofins, valorCofins, aliquotaCSLL, valorCSLL,
|
||||
aliquotaISS, valorISS, totalICMSIsentoItem, totalICMSNaotributadoItem,
|
||||
numeroPDV, numeroSeriePDV, modeloImpressora, numCaixa, status,
|
||||
numeroPDV, numeroSeriePDV, modeloImpressora, numCaixa, status, null, null,
|
||||
brancos111, sequencial);
|
||||
itensDocs.add(itemDoc);
|
||||
}
|
||||
|
@ -416,6 +417,213 @@ public class FiscalServiceImpl implements FiscalService {
|
|||
return aux;
|
||||
}
|
||||
|
||||
@Override
|
||||
public File importacionFiscalECFCancelados(Date inicio, Date fim, Empresa empresa, Connection conn) {
|
||||
|
||||
try {
|
||||
String nomeArquivo = UsuarioLogado.getUsuarioLogado().getNombusuario() + "_" + Calendar.getInstance().getTime().getTime() + "_" + "fiscal";
|
||||
File arquivo = File.createTempFile(nomeArquivo, ".tmp");
|
||||
|
||||
PrintWriter gravarArq = new PrintWriter(new OutputStreamWriter(new FileOutputStream(arquivo), Constantes.UTF_8));
|
||||
|
||||
Integer seq = 1;
|
||||
|
||||
String cnpjFilial = empresa.getCnpj();
|
||||
String brancos371 = StringHelper.preencherStringEspacoEsquerda(null, 371);
|
||||
String dataAgora = DateUtil.getStringDate(Calendar.getInstance().getTime(), DATE_FORMAT_FISCAL);
|
||||
String seqAbertura = StringHelper.preencherZeroEsquerda(seq.toString(), 6);
|
||||
|
||||
String abertura = aberturaDeArquivo("0", dataAgora, cnpjFilial, brancos371, seqAbertura);
|
||||
gravarArq.print(abertura + QUEBRA_LINHA);
|
||||
|
||||
String sql = fiscalDAO.sqlFiscaisECFCancelados(inicio, fim, empresa.getEmpresaId());
|
||||
|
||||
PreparedStatement stmt = conn.prepareStatement(sql);
|
||||
stmt.setFetchSize(100);
|
||||
stmt.setString(1, DateUtil.getStringDate(inicio, DATE_FORMAT_FISCAL));
|
||||
stmt.setString(2, DateUtil.getStringDate(fim, DATE_FORMAT_FISCAL));
|
||||
|
||||
if (empresa != null) {
|
||||
stmt.setInt(3, empresa.getEmpresaId());
|
||||
}
|
||||
|
||||
Integer qtdDoc = 0;
|
||||
Integer qtdItens = 0;
|
||||
|
||||
List<ImportacionFiscalVO> list = new ArrayList<ImportacionFiscalVO>();
|
||||
|
||||
String header = null;
|
||||
List<String> itensDocs = new ArrayList<String>();
|
||||
ImportacionFiscalVO fiscal = null;
|
||||
|
||||
ResultSet rset = stmt.executeQuery();
|
||||
while (rset.next()) {
|
||||
|
||||
ItemFiscalVO item = new ItemFiscalVO();
|
||||
item.setNumImpressora(rset.getString("numImpressora"));
|
||||
item.setCoo(rset.getString("coo"));
|
||||
item.setBoletoId(rset.getLong("boletoId"));
|
||||
item.setEmpresaId(rset.getInt("empresaId"));
|
||||
item.setDataEmissao(rset.getString("dataEmissao"));
|
||||
item.setCnpjCliente(rset.getString("cnpjCliente"));
|
||||
item.setCnpjImpressora(rset.getString("cnpjImpressora"));
|
||||
item.setOrigenId(rset.getInt("origenId"));
|
||||
item.setOrigenUf(rset.getString("origenUf"));
|
||||
item.setDestinoId(rset.getInt("destinoId"));
|
||||
item.setDestinoUf(rset.getString("destinoUf"));
|
||||
item.setNumpdv(rset.getString("numpdv"));
|
||||
item.setValorTotal(rset.getBigDecimal("valorTotal"));
|
||||
item.setNumItem(rset.getString("numItem"));
|
||||
item.setCodProduto(rset.getString("codProduto"));
|
||||
item.setRepTributado(rset.getString("repTributado"));
|
||||
item.setTipoPassagem(rset.getString("tipoPassagem"));
|
||||
item.setValorItem(rset.getBigDecimal("valorItem"));
|
||||
item.setModeloImpressora(rset.getString("modeloImpressora"));
|
||||
item.setNumCaixa(rset.getString("numCaixa"));
|
||||
item.setStatus(rset.getString("status"));
|
||||
item.setMotivocancelacion(rset.getInt("motivocancelacion"));
|
||||
item.setValorMulta(rset.getBigDecimal("valorMulta"));
|
||||
|
||||
// TODO: Estes atributos foram criados para corrigir o valorItem que esta sendo gravado errado na tabela FISCAL_R5
|
||||
// estes dados sao extraidos da tabela FISCAL_ML2, que esta registrando corretamento o valor da tarifa paga
|
||||
// e nao o valor do preco base da tarifa, como esta sendo feita na FISCAL_R5
|
||||
item.setValorTarifa(rset.getBigDecimal("valorTarifa"));
|
||||
item.setValorPedagio(rset.getBigDecimal("valorPedagio"));
|
||||
item.setValorEmbarque(rset.getBigDecimal("valorEmbarque"));
|
||||
|
||||
ImportacionFiscalVO novoFiscal = item;
|
||||
if (!novoFiscal.equals(fiscal) && fiscal != null) {
|
||||
|
||||
grabarHeaderItens(gravarArq, header, itensDocs);
|
||||
|
||||
header = null;
|
||||
itensDocs = new ArrayList<String>();
|
||||
fiscal = null;
|
||||
}
|
||||
|
||||
boolean jaCadastrado = verificarItensFiscais(list, item);
|
||||
if (!jaCadastrado) {
|
||||
fiscal = item;
|
||||
list.add(fiscal);
|
||||
}
|
||||
|
||||
/*
|
||||
* Header da importacion Fiscal ECF
|
||||
*/
|
||||
if (!jaCadastrado) {
|
||||
qtdDoc++;
|
||||
}
|
||||
|
||||
fiscal.getItensFiscais().add(item);
|
||||
|
||||
String data = fiscal.getDataEmissao();
|
||||
String brancos167 = StringHelper.preencherStringEspacoEsquerda(null, 167);
|
||||
|
||||
String serie = item.getNumImpressora();
|
||||
if (serie.length() >= 20) {
|
||||
serie = serie.substring(17);
|
||||
serie = StringHelper.preencherStringEspacoEsquerda(serie, 3);
|
||||
} else {
|
||||
serie = StringHelper.preencherStringEspacoEsquerda(null, 3);
|
||||
}
|
||||
|
||||
String especie = StringHelper.preencherStringEspacoDireita("CF", 5);
|
||||
|
||||
String codigoCliente = StringHelper.preencherStringEsquerda(null, 6, "9");
|
||||
String filialCliente = StringHelper.preencherStringEsquerda(null, 2, "9");
|
||||
String condicaoPagamento = StringHelper.preencherStringEsquerda(null, 3, "9");
|
||||
|
||||
String valorPIS = StringHelper.preencherZeroEsquerda(null, 14);
|
||||
String valorCofins = StringHelper.preencherZeroEsquerda(null, 14);
|
||||
String valorCSLL = StringHelper.preencherZeroEsquerda(null, 14);
|
||||
|
||||
String coo = StringHelper.preencherStringEspacoDireita(fiscal.getCoo(), 9);
|
||||
|
||||
BigDecimal valorTotal = valorTotalItensECF(item);
|
||||
String valorTotalDocumanto = StringHelper.preencherStringEspacoDireita(valorTotal.toString(), 14);
|
||||
String valorItens = StringHelper.preencherStringEspacoDireita(valorTotal.toString(), 14);
|
||||
|
||||
HashMap<String, String> aliquotaBaseCalculo = getAliquotaBaseCalculo(fiscal);
|
||||
String aliquota = aliquotaBaseCalculo.get("aliquota");
|
||||
String imposto = aliquotaBaseCalculo.get("imposto");
|
||||
String totalICMSIsento = aliquotaBaseCalculo.get("totalICMSIsento");
|
||||
String totalICMSNaotributado = aliquotaBaseCalculo.get("totalICMSNaotributado");
|
||||
|
||||
String origenUf = StringHelper.preencherStringEspacoEsquerda(fiscal.getOrigenUf(), 2);
|
||||
String origen = fiscal.getOrigenId().toString();
|
||||
if (origen.length() > 2) {
|
||||
origen = origen.substring(2);
|
||||
origen = StringHelper.preencherStringEspacoEsquerda(origen, 5);
|
||||
} else {
|
||||
origen = StringHelper.preencherStringEspacoEsquerda(origen, 5);
|
||||
}
|
||||
|
||||
String destinoUf = StringHelper.preencherStringEspacoEsquerda(fiscal.getDestinoUf(), 2);
|
||||
String destino = fiscal.getDestinoId().toString();
|
||||
if (destino.length() > 2) {
|
||||
destino = destino.substring(2);
|
||||
destino = StringHelper.preencherStringEspacoEsquerda(destino, 5);
|
||||
} else {
|
||||
destino = StringHelper.preencherStringEspacoEsquerda(destino, 5);
|
||||
}
|
||||
|
||||
String status = StringHelper.preencherStringEspacoEsquerda(fiscal.getStatus(), 1);
|
||||
|
||||
SiglaMotivoCancelacion sigla = SiglaMotivoCancelacion.valueOf(item.getMotivocancelacion());
|
||||
String motivocancelacion = StringHelper.preencherStringEspacoEsquerda(sigla.toString(), 20);
|
||||
String valorMulta = UtileriasFiscal.formataZeroDecimal(item.getValorMulta(), 15);
|
||||
|
||||
String seqHeader = null;
|
||||
if (!jaCadastrado) {
|
||||
seq++;
|
||||
seqHeader = StringHelper.preencherZeroEsquerda(Integer.valueOf(seq).toString(), 6);
|
||||
} else {
|
||||
seqHeader = StringHelper.preencherZeroEsquerda(Integer.valueOf(seq - itensDocs.size()).toString(), 6);
|
||||
|
||||
}
|
||||
|
||||
header = headerDocumentoFiscal("1", data, cnpjFilial, coo, serie, especie, codigoCliente,
|
||||
filialCliente, condicaoPagamento, valorTotalDocumanto, valorItens, aliquota, imposto,
|
||||
valorPIS, valorCofins, valorCSLL, totalICMSIsento, totalICMSNaotributado, origenUf, origen,
|
||||
destinoUf, destino, null, null, status, motivocancelacion, valorMulta, brancos167, seqHeader);
|
||||
|
||||
/*
|
||||
* Item da importacion Fiscal ECF
|
||||
*/
|
||||
String itemDoc = montarItensFiscais(item, seq, true);
|
||||
itensDocs.add(itemDoc);
|
||||
|
||||
qtdItens++;
|
||||
seq++;
|
||||
|
||||
}
|
||||
|
||||
grabarHeaderItens(gravarArq, header, itensDocs);
|
||||
|
||||
seq++;
|
||||
String qtdeDocGerados = StringHelper.preencherZeroEsquerda(qtdDoc.toString(), 6);
|
||||
String qtdeItensDocGerados = StringHelper.preencherZeroEsquerda(qtdItens.toString(), 6);
|
||||
String brancos381 = StringHelper.preencherStringEspacoEsquerda(null, 381);
|
||||
String seqFechamento = StringHelper.preencherZeroEsquerda(seq.toString(), 6);
|
||||
|
||||
String fechamento = fechamentoDeArquivo("3", qtdeDocGerados, qtdeItensDocGerados, brancos381, seqFechamento);
|
||||
gravarArq.print(fechamento + QUEBRA_LINHA);
|
||||
|
||||
gravarArq.close();
|
||||
|
||||
if (!conn.isClosed())
|
||||
conn.close();
|
||||
|
||||
return arquivo;
|
||||
|
||||
} catch (IOException e) {
|
||||
log.error("", e);
|
||||
} catch (SQLException e) {
|
||||
log.error("", e);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public File importacionFiscalECF(Date inicio, Date fim, Empresa empresa, Connection conn) {
|
||||
|
||||
|
@ -578,12 +786,12 @@ public class FiscalServiceImpl implements FiscalService {
|
|||
header = headerDocumentoFiscal("1", data, cnpjFilial, coo, serie, especie, codigoCliente,
|
||||
filialCliente, condicaoPagamento, valorTotalDocumanto, valorItens, aliquota, imposto,
|
||||
valorPIS, valorCofins, valorCSLL, totalICMSIsento, totalICMSNaotributado, origenUf, origen,
|
||||
destinoUf, destino, null, null, status, brancos202, seqHeader);
|
||||
destinoUf, destino, null, null, status, null, null, brancos202, seqHeader);
|
||||
|
||||
/*
|
||||
* Item da importacion Fiscal ECF
|
||||
*/
|
||||
String itemDoc = montarItensFiscais(item, seq);
|
||||
String itemDoc = montarItensFiscais(item, seq, false);
|
||||
itensDocs.add(itemDoc);
|
||||
|
||||
qtdItens++;
|
||||
|
@ -639,7 +847,7 @@ public class FiscalServiceImpl implements FiscalService {
|
|||
}
|
||||
}
|
||||
|
||||
private String montarItensFiscais(ItemFiscalVO item, Integer seq) {
|
||||
private String montarItensFiscais(ItemFiscalVO item, Integer seq, boolean isCancelados) {
|
||||
|
||||
String tipoPassagem = null;
|
||||
if (item.getRepTributado().length() == 7 && item.getRepTributado().substring(2, 3).equals(SituacaoTributaria.TRIBUTADO.getValue())) {
|
||||
|
@ -745,15 +953,32 @@ public class FiscalServiceImpl implements FiscalService {
|
|||
String numCaixa = StringHelper.preencherStringEspacoDireita(item.getNumCaixa(), 10);
|
||||
String status = StringHelper.preencherStringEspacoEsquerda(item.getStatus(), 1);
|
||||
|
||||
String coo = null;
|
||||
String serie = null;
|
||||
String brancos = StringHelper.preencherStringEspacoEsquerda(null, 111);
|
||||
|
||||
if (isCancelados) {
|
||||
coo = StringHelper.preencherStringEspacoDireita(item.getCoo(), 9);
|
||||
serie = item.getNumImpressora();
|
||||
if (serie.length() >= 20) {
|
||||
serie = serie.substring(17);
|
||||
serie = StringHelper.preencherStringEspacoEsquerda(serie, 3);
|
||||
} else {
|
||||
serie = StringHelper.preencherStringEspacoEsquerda(null, 3);
|
||||
}
|
||||
|
||||
brancos = StringHelper.preencherStringEspacoEsquerda(null, 99);
|
||||
}
|
||||
|
||||
seq++;
|
||||
String sequencial = StringHelper.preencherZeroEsquerda(seq.toString(), 6);
|
||||
String brancos111 = StringHelper.preencherStringEspacoEsquerda(null, 111);
|
||||
|
||||
String itemDoc = itensDocumentoFiscal("2", numItem, cfop, codigoTES, codProduto,
|
||||
unidade, quantidade, valorUnitario, valorTotal, aliquotaItem, impostoItem,
|
||||
aliquotaPIS, valorPIS, aliquotaCofins, valorCofins, aliquotaCSLL, valorCSLL,
|
||||
aliquotaISS, valorISS, totalICMSIsentoItem, totalICMSNaotributadoItem,
|
||||
numeroPDV, numeroSeriePDV, modeloImpressora, numCaixa, status, brancos111, sequencial);
|
||||
numeroPDV, numeroSeriePDV, modeloImpressora, numCaixa, status, coo, serie,
|
||||
brancos, sequencial);
|
||||
return itemDoc;
|
||||
|
||||
}
|
||||
|
@ -906,7 +1131,7 @@ public class FiscalServiceImpl implements FiscalService {
|
|||
String valorTotalDocumanto, String valorItens, String aliquota, String imposto, String valorPIS,
|
||||
String valorCofins, String valorCSLL, String totalICMSIsento, String totalICMSNaotributado, String origenUf,
|
||||
String origen, String destinoUf, String destino, String subSerie, String aidf, String status,
|
||||
String brancos, String sequencial) {
|
||||
String motivocancelacion, String valorMulta, String brancos, String sequencial) {
|
||||
|
||||
StringBuilder header = new StringBuilder();
|
||||
header.append(identificador);
|
||||
|
@ -934,6 +1159,8 @@ public class FiscalServiceImpl implements FiscalService {
|
|||
header.append(subSerie == null ? "" : subSerie);
|
||||
header.append(aidf == null ? "" : aidf);
|
||||
header.append(status);
|
||||
header.append(motivocancelacion == null ? "" : motivocancelacion);
|
||||
header.append(valorMulta == null ? "" : valorMulta);
|
||||
header.append(brancos);
|
||||
header.append(sequencial);
|
||||
|
||||
|
@ -945,7 +1172,8 @@ public class FiscalServiceImpl implements FiscalService {
|
|||
String aliquotaItem, String impostoItem, String valorPIS, String aliquotaPIS, String aliquotaCofins,
|
||||
String valorCofins, String aliquotaCSLL, String valorCSLL, String aliquotaISS, String valorISS,
|
||||
String totalICMSIsentoItem, String totalICMSNaotributadoItem, String numeroPDV, String numeroSeriePDV,
|
||||
String modeloImpressora, String numCaixa, String status, String brancos, String sequencial) {
|
||||
String modeloImpressora, String numCaixa, String status, String coo, String serie,
|
||||
String brancos, String sequencial) {
|
||||
|
||||
StringBuilder item = new StringBuilder();
|
||||
item.append(identificador);
|
||||
|
@ -974,6 +1202,8 @@ public class FiscalServiceImpl implements FiscalService {
|
|||
item.append(modeloImpressora);
|
||||
item.append(numCaixa);
|
||||
item.append(status);
|
||||
item.append(coo == null ? "" : coo);
|
||||
item.append(serie == null ? "" : serie);
|
||||
item.append(brancos);
|
||||
item.append(sequencial);
|
||||
|
||||
|
|
|
@ -22,6 +22,8 @@ public class ImportacionFiscalVO {
|
|||
private String modeloImpressora;
|
||||
private String numCaixa;
|
||||
private String status;
|
||||
private Integer motivocancelacion;
|
||||
private BigDecimal valorMulta;
|
||||
|
||||
private List<ItemFiscalVO> itensFiscais;
|
||||
|
||||
|
@ -201,4 +203,20 @@ public class ImportacionFiscalVO {
|
|||
this.status = status;
|
||||
}
|
||||
|
||||
public Integer getMotivocancelacion() {
|
||||
return motivocancelacion;
|
||||
}
|
||||
|
||||
public void setMotivocancelacion(Integer motivocancelacion) {
|
||||
this.motivocancelacion = motivocancelacion;
|
||||
}
|
||||
|
||||
public BigDecimal getValorMulta() {
|
||||
return valorMulta;
|
||||
}
|
||||
|
||||
public void setValorMulta(BigDecimal valorMulta) {
|
||||
this.valorMulta = valorMulta;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,29 @@
|
|||
package com.rjconsultores.ventaboletos.vo.impressaofiscal;
|
||||
|
||||
public enum SiglaMotivoCancelacion {
|
||||
|
||||
DEVOLUCAO, CANCELAMENTO, CHECKIN, TROCA, TRANSFERENCIA;
|
||||
|
||||
public static SiglaMotivoCancelacion valueOf(Integer motivocancelacionId) {
|
||||
switch (motivocancelacionId) {
|
||||
case 31:
|
||||
return CANCELAMENTO;
|
||||
|
||||
case 32:
|
||||
return DEVOLUCAO;
|
||||
|
||||
case 10:
|
||||
return TROCA;
|
||||
|
||||
case 23:
|
||||
return TRANSFERENCIA;
|
||||
|
||||
case 27:
|
||||
return CHECKIN;
|
||||
|
||||
default:
|
||||
return CANCELAMENTO;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue