RMD - Arquivo Exportação para QS (fixes bug #6374)
Tempo: 01 hora git-svn-id: http://desenvolvimento.rjconsultores.com.br/repositorio/sco/AdmVenta/Model/trunk/modelWeb@45860 d1611594-4594-4d17-8e1d-87c2c4800839master
parent
eb5d8a4b5f
commit
9f4ab9878f
|
@ -57,15 +57,16 @@ public class FiscalServiceImpl implements FiscalService {
|
||||||
FileWriter arq = new FileWriter(arquivo);
|
FileWriter arq = new FileWriter(arquivo);
|
||||||
PrintWriter gravarArq = new PrintWriter(arq);
|
PrintWriter gravarArq = new PrintWriter(arq);
|
||||||
|
|
||||||
String cnpjFilial = empresa.getCnpj();
|
|
||||||
String brancos372 = StringHelper.preencherStringEspacoEsquerda(null, 372);
|
|
||||||
String dataAgora = DateUtil.getStringDate(Calendar.getInstance().getTime(), DATE_FORMAT_FISCAL);
|
|
||||||
|
|
||||||
String abertura = aberturaDeArquivo("0", dataAgora, cnpjFilial, brancos372, "00001");
|
|
||||||
gravarArq.println(abertura);
|
|
||||||
|
|
||||||
Integer seq = 1;
|
Integer seq = 1;
|
||||||
|
|
||||||
|
String cnpjFilial = empresa.getCnpj();
|
||||||
|
String brancos371 = StringHelper.preencherStringEspacoEsquerda(null, 371);
|
||||||
|
String dataAgora = DateUtil.getStringDate(Calendar.getInstance().getTime(), DATE_FORMAT_FISCAL);
|
||||||
|
String sequencial = StringHelper.preencherZeroEsquerda(seq.toString(), 6);
|
||||||
|
|
||||||
|
String abertura = aberturaDeArquivo("0", dataAgora, cnpjFilial, brancos371, sequencial);
|
||||||
|
gravarArq.println(abertura);
|
||||||
|
|
||||||
Integer qtdDoc = 0;
|
Integer qtdDoc = 0;
|
||||||
Integer qtdItens = 0;
|
Integer qtdItens = 0;
|
||||||
|
|
||||||
|
@ -105,15 +106,15 @@ public class FiscalServiceImpl implements FiscalService {
|
||||||
String origen = StringHelper.preencherStringEspacoEsquerda(imf.getOrigenId().toString(), 5);
|
String origen = StringHelper.preencherStringEspacoEsquerda(imf.getOrigenId().toString(), 5);
|
||||||
String subSerie = StringHelper.preencherStringEspacoEsquerda(imf.getSubSerie(), 2);
|
String subSerie = StringHelper.preencherStringEspacoEsquerda(imf.getSubSerie(), 2);
|
||||||
String aidf = StringHelper.preencherStringEspacoEsquerda(imf.getAidf(), 30);
|
String aidf = StringHelper.preencherStringEspacoEsquerda(imf.getAidf(), 30);
|
||||||
String brancos181 = StringHelper.preencherStringEspacoEsquerda(null, 181);
|
String brancos180 = StringHelper.preencherStringEspacoEsquerda(null, 180);
|
||||||
|
|
||||||
seq++;
|
seq++;
|
||||||
String sequencial = StringHelper.preencherZeroEsquerda(seq.toString(), 5);
|
sequencial = StringHelper.preencherZeroEsquerda(seq.toString(), 6);
|
||||||
|
|
||||||
String header = headerDocumentoFiscal("1", data, cnpjFilial, coo, serie, especie, codigoCliente,
|
String header = headerDocumentoFiscal("1", data, cnpjFilial, coo, serie, especie, codigoCliente,
|
||||||
filialCliente, condicaoPagamento, valorTotalDocumanto, valorItens, baseCalICMS, valorTotalICMS,
|
filialCliente, condicaoPagamento, valorTotalDocumanto, valorItens, baseCalICMS, valorTotalICMS,
|
||||||
valorPIS, valorCofins, valorCSLL, totalICMSIsento, totalICMSNaotributado, origen, subSerie,
|
valorPIS, valorCofins, valorCSLL, totalICMSIsento, totalICMSNaotributado, origen, subSerie,
|
||||||
aidf, brancos181, sequencial);
|
aidf, brancos180, sequencial);
|
||||||
gravarArq.println(header);
|
gravarArq.println(header);
|
||||||
|
|
||||||
for (String itemDoc : montarItensFiscaisManual(imf, imf.getItens(), seq)) {
|
for (String itemDoc : montarItensFiscaisManual(imf, imf.getItens(), seq)) {
|
||||||
|
@ -128,10 +129,10 @@ public class FiscalServiceImpl implements FiscalService {
|
||||||
|
|
||||||
String qtdeDocGerados = StringHelper.preencherZeroEsquerda(qtdDoc.toString(), 6);
|
String qtdeDocGerados = StringHelper.preencherZeroEsquerda(qtdDoc.toString(), 6);
|
||||||
String qtdeItensDocGerados = StringHelper.preencherZeroEsquerda(qtdItens.toString(), 6);
|
String qtdeItensDocGerados = StringHelper.preencherZeroEsquerda(qtdItens.toString(), 6);
|
||||||
String brancos382 = StringHelper.preencherStringEspacoEsquerda(null, 382);
|
String brancos381 = StringHelper.preencherStringEspacoEsquerda(null, 381);
|
||||||
String sequencial = StringHelper.preencherZeroEsquerda(seq.toString(), 5);
|
sequencial = StringHelper.preencherZeroEsquerda(seq.toString(), 6);
|
||||||
|
|
||||||
String fechamento = fechamentoDeArquivo("3", qtdeDocGerados, qtdeItensDocGerados, brancos382, sequencial);
|
String fechamento = fechamentoDeArquivo("3", qtdeDocGerados, qtdeItensDocGerados, brancos381, sequencial);
|
||||||
gravarArq.println(fechamento);
|
gravarArq.println(fechamento);
|
||||||
|
|
||||||
arq.close();
|
arq.close();
|
||||||
|
@ -190,14 +191,14 @@ public class FiscalServiceImpl implements FiscalService {
|
||||||
String valorISS = StringHelper.preencherZeroEsquerda(null, 15);
|
String valorISS = StringHelper.preencherZeroEsquerda(null, 15);
|
||||||
|
|
||||||
seq++;
|
seq++;
|
||||||
String sequencial = StringHelper.preencherZeroEsquerda(seq.toString(), 5);
|
String sequencial = StringHelper.preencherZeroEsquerda(seq.toString(), 6);
|
||||||
String brancos193 = StringHelper.preencherStringEspacoDireita(null, 193);
|
String brancos192 = StringHelper.preencherStringEspacoDireita(null, 192);
|
||||||
|
|
||||||
String itemDoc = itensDocumentoFiscal("2", numItem, cfop, codigoTES, codProduto,
|
String itemDoc = itensDocumentoFiscal("2", numItem, cfop, codigoTES, codProduto,
|
||||||
unidade, quantidade, valorUnitario, valorTotal, aliquotaItem, impostoItem,
|
unidade, quantidade, valorUnitario, valorTotal, aliquotaItem, impostoItem,
|
||||||
aliquotaPIS, valorPIS, aliquotaCofins, valorCofins, aliquotaCSLL, valorCSLL,
|
aliquotaPIS, valorPIS, aliquotaCofins, valorCofins, aliquotaCSLL, valorCSLL,
|
||||||
aliquotaISS, valorISS, totalICMSIsentoItem, totalICMSNaotributadoItem,
|
aliquotaISS, valorISS, totalICMSIsentoItem, totalICMSNaotributadoItem,
|
||||||
brancos193, sequencial);
|
brancos192, sequencial);
|
||||||
itensDocs.add(itemDoc);
|
itensDocs.add(itemDoc);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -243,16 +244,17 @@ public class FiscalServiceImpl implements FiscalService {
|
||||||
FileWriter arq = new FileWriter(arquivo);
|
FileWriter arq = new FileWriter(arquivo);
|
||||||
PrintWriter gravarArq = new PrintWriter(arq);
|
PrintWriter gravarArq = new PrintWriter(arq);
|
||||||
|
|
||||||
|
Integer seq = 1;
|
||||||
|
|
||||||
String cnpjFilial = StringHelper.retornaSomenteNumeros(empresa.getCnpj() == null ?
|
String cnpjFilial = StringHelper.retornaSomenteNumeros(empresa.getCnpj() == null ?
|
||||||
StringHelper.preencherStringEspacoEsquerda(null, 14) : empresa.getCnpj());
|
StringHelper.preencherStringEspacoEsquerda(null, 14) : empresa.getCnpj());
|
||||||
String brancos372 = StringHelper.preencherStringEspacoEsquerda(null, 372);
|
String brancos371 = StringHelper.preencherStringEspacoEsquerda(null, 371);
|
||||||
String dataAgora = DateUtil.getStringDate(Calendar.getInstance().getTime(), DATE_FORMAT_FISCAL);
|
String dataAgora = DateUtil.getStringDate(Calendar.getInstance().getTime(), DATE_FORMAT_FISCAL);
|
||||||
|
String sequencial = StringHelper.preencherZeroEsquerda(seq.toString(), 6);
|
||||||
|
|
||||||
String abertura = aberturaDeArquivo("0", dataAgora, cnpjFilial, brancos372, "00001");
|
String abertura = aberturaDeArquivo("0", dataAgora, cnpjFilial, brancos371, sequencial);
|
||||||
gravarArq.println(abertura);
|
gravarArq.println(abertura);
|
||||||
|
|
||||||
Integer seq = 1;
|
|
||||||
|
|
||||||
List<ImportacionFiscalReducaoZVO> list = agruparReducaoZ(fiscalDAO.buscaDatosFiscaisReducaoZ(inicio, fim, empresa.getEmpresaId()));
|
List<ImportacionFiscalReducaoZVO> list = agruparReducaoZ(fiscalDAO.buscaDatosFiscaisReducaoZ(inicio, fim, empresa.getEmpresaId()));
|
||||||
|
|
||||||
for (ImportacionFiscalReducaoZVO ifrZ : list) {
|
for (ImportacionFiscalReducaoZVO ifrZ : list) {
|
||||||
|
@ -311,15 +313,15 @@ public class FiscalServiceImpl implements FiscalService {
|
||||||
String horaReducaoZ = ifrZ.getHorareducao();
|
String horaReducaoZ = ifrZ.getHorareducao();
|
||||||
|
|
||||||
String valorDocFiscal = StringHelper.preencherZeroEsquerda(ifrZ.getImposto().toString(), 13);
|
String valorDocFiscal = StringHelper.preencherZeroEsquerda(ifrZ.getImposto().toString(), 13);
|
||||||
String brancos83 = StringHelper.preencherStringEspacoEsquerda(null, 83);
|
String brancos82 = StringHelper.preencherStringEspacoEsquerda(null, 82);
|
||||||
|
|
||||||
seq++;
|
seq++;
|
||||||
String sequencial = StringHelper.preencherZeroEsquerda(seq.toString(), 5);
|
sequencial = StringHelper.preencherZeroEsquerda(seq.toString(), 6);
|
||||||
|
|
||||||
String redZ = reducaoZ("1", dataMovimento, cnpj, numRelatorio, numPDV, numSeriePDV, numReducaoZ,
|
String redZ = reducaoZ("1", dataMovimento, cnpj, numRelatorio, numPDV, numSeriePDV, numReducaoZ,
|
||||||
gtInicial, gtFinal, docFiscalInic, docFiscalFinal, valorCancel, valorContabil, subtributaria,
|
gtInicial, gtFinal, docFiscalInic, docFiscalFinal, valorCancel, valorContabil, subtributaria,
|
||||||
descontos, isento, naoTributado, aliquota, aliquota2, aliquota3, aliquota4, coo, outrosRecebimentos,
|
descontos, isento, naoTributado, aliquota, aliquota2, aliquota3, aliquota4, coo, outrosRecebimentos,
|
||||||
impostoDebitado, dataReducaoZ, horaReducaoZ, valorDocFiscal, brancos83, sequencial);
|
impostoDebitado, dataReducaoZ, horaReducaoZ, valorDocFiscal, brancos82, sequencial);
|
||||||
|
|
||||||
gravarArq.println(redZ);
|
gravarArq.println(redZ);
|
||||||
}
|
}
|
||||||
|
@ -328,10 +330,10 @@ public class FiscalServiceImpl implements FiscalService {
|
||||||
seq++;
|
seq++;
|
||||||
|
|
||||||
String qtdeDocGerados = StringHelper.preencherZeroEsquerda(qtdeDoc.toString(), 6);
|
String qtdeDocGerados = StringHelper.preencherZeroEsquerda(qtdeDoc.toString(), 6);
|
||||||
String brancos388 = StringHelper.preencherStringEspacoEsquerda(null, 388);
|
String brancos387 = StringHelper.preencherStringEspacoEsquerda(null, 387);
|
||||||
String sequencial = StringHelper.preencherZeroEsquerda(seq.toString(), 5);
|
sequencial = StringHelper.preencherZeroEsquerda(seq.toString(), 6);
|
||||||
|
|
||||||
String fechamento = fechamentoDeArquivo("3", qtdeDocGerados, null, brancos388, sequencial);
|
String fechamento = fechamentoDeArquivo("3", qtdeDocGerados, null, brancos387, sequencial);
|
||||||
gravarArq.println(fechamento);
|
gravarArq.println(fechamento);
|
||||||
|
|
||||||
arq.close();
|
arq.close();
|
||||||
|
@ -371,15 +373,16 @@ public class FiscalServiceImpl implements FiscalService {
|
||||||
FileWriter arq = new FileWriter(arquivo);
|
FileWriter arq = new FileWriter(arquivo);
|
||||||
PrintWriter gravarArq = new PrintWriter(arq);
|
PrintWriter gravarArq = new PrintWriter(arq);
|
||||||
|
|
||||||
String cnpjFilial = empresa.getCnpj();
|
|
||||||
String brancos372 = StringHelper.preencherStringEspacoEsquerda(null, 372);
|
|
||||||
String dataAgora = DateUtil.getStringDate(Calendar.getInstance().getTime(), DATE_FORMAT_FISCAL);
|
|
||||||
|
|
||||||
String abertura = aberturaDeArquivo("0", dataAgora, cnpjFilial, brancos372, "00001");
|
|
||||||
gravarArq.println(abertura);
|
|
||||||
|
|
||||||
Integer seq = 1;
|
Integer seq = 1;
|
||||||
|
|
||||||
|
String cnpjFilial = empresa.getCnpj();
|
||||||
|
String brancos371 = StringHelper.preencherStringEspacoEsquerda(null, 371);
|
||||||
|
String dataAgora = DateUtil.getStringDate(Calendar.getInstance().getTime(), DATE_FORMAT_FISCAL);
|
||||||
|
String sequencial = StringHelper.preencherZeroEsquerda(seq.toString(), 6);
|
||||||
|
|
||||||
|
String abertura = aberturaDeArquivo("0", dataAgora, cnpjFilial, brancos371, sequencial);
|
||||||
|
gravarArq.println(abertura);
|
||||||
|
|
||||||
List<ItemFiscalVO> itens = fiscalDAO.buscaDatosFiscaisECF(inicio, fim, empresa.getEmpresaId());
|
List<ItemFiscalVO> itens = fiscalDAO.buscaDatosFiscaisECF(inicio, fim, empresa.getEmpresaId());
|
||||||
List<ImportacionFiscalVO> list = agruparItensFiscais(itens);
|
List<ImportacionFiscalVO> list = agruparItensFiscais(itens);
|
||||||
|
|
||||||
|
@ -390,7 +393,7 @@ public class FiscalServiceImpl implements FiscalService {
|
||||||
|
|
||||||
qtdDoc++;
|
qtdDoc++;
|
||||||
String data = fiscal.getDataEmissao();
|
String data = fiscal.getDataEmissao();
|
||||||
String brancos213 = StringHelper.preencherStringEspacoEsquerda(null, 213);
|
String brancos212 = StringHelper.preencherStringEspacoEsquerda(null, 212);
|
||||||
|
|
||||||
String serie = StringHelper.preencherStringEspacoEsquerda(null, 3);
|
String serie = StringHelper.preencherStringEspacoEsquerda(null, 3);
|
||||||
String especie = StringHelper.preencherStringEspacoDireita("CF", 5);
|
String especie = StringHelper.preencherStringEspacoDireita("CF", 5);
|
||||||
|
@ -416,12 +419,12 @@ public class FiscalServiceImpl implements FiscalService {
|
||||||
String origen = StringHelper.preencherStringEspacoEsquerda(fiscal.getOrigenId().toString(), 5);
|
String origen = StringHelper.preencherStringEspacoEsquerda(fiscal.getOrigenId().toString(), 5);
|
||||||
|
|
||||||
seq++;
|
seq++;
|
||||||
String sequencial = StringHelper.preencherZeroEsquerda(seq.toString(), 5);
|
sequencial = StringHelper.preencherZeroEsquerda(seq.toString(), 6);
|
||||||
|
|
||||||
String header = headerDocumentoFiscal("1", data, cnpjFilial, coo, serie, especie, codigoCliente,
|
String header = headerDocumentoFiscal("1", data, cnpjFilial, coo, serie, especie, codigoCliente,
|
||||||
filialCliente, condicaoPagamento, valorTotalDocumanto, valorItens, aliquota, imposto,
|
filialCliente, condicaoPagamento, valorTotalDocumanto, valorItens, aliquota, imposto,
|
||||||
valorPIS, valorCofins, valorCSLL, totalICMSIsento, totalICMSNaotributado, origen, null,
|
valorPIS, valorCofins, valorCSLL, totalICMSIsento, totalICMSNaotributado, origen, null,
|
||||||
null, brancos213, sequencial);
|
null, brancos212, sequencial);
|
||||||
gravarArq.println(header);
|
gravarArq.println(header);
|
||||||
|
|
||||||
for (String itemDoc : montarItensFiscais(fiscal.getItensFiscais(), seq)) {
|
for (String itemDoc : montarItensFiscais(fiscal.getItensFiscais(), seq)) {
|
||||||
|
@ -436,10 +439,10 @@ public class FiscalServiceImpl implements FiscalService {
|
||||||
seq++;
|
seq++;
|
||||||
String qtdeDocGerados = StringHelper.preencherZeroEsquerda(qtdDoc.toString(), 6);
|
String qtdeDocGerados = StringHelper.preencherZeroEsquerda(qtdDoc.toString(), 6);
|
||||||
String qtdeItensDocGerados = StringHelper.preencherZeroEsquerda(qtdItens.toString(), 6);
|
String qtdeItensDocGerados = StringHelper.preencherZeroEsquerda(qtdItens.toString(), 6);
|
||||||
String brancos382 = StringHelper.preencherStringEspacoEsquerda(null, 382);
|
String brancos381 = StringHelper.preencherStringEspacoEsquerda(null, 381);
|
||||||
String sequencial = StringHelper.preencherZeroEsquerda(seq.toString(), 5);
|
sequencial = StringHelper.preencherZeroEsquerda(seq.toString(), 6);
|
||||||
|
|
||||||
String fechamento = fechamentoDeArquivo("3", qtdeDocGerados, qtdeItensDocGerados, brancos382, sequencial);
|
String fechamento = fechamentoDeArquivo("3", qtdeDocGerados, qtdeItensDocGerados, brancos381, sequencial);
|
||||||
gravarArq.println(fechamento);
|
gravarArq.println(fechamento);
|
||||||
|
|
||||||
arq.close();
|
arq.close();
|
||||||
|
@ -536,14 +539,14 @@ public class FiscalServiceImpl implements FiscalService {
|
||||||
String valorISS = StringHelper.preencherZeroEsquerda(null, 15);
|
String valorISS = StringHelper.preencherZeroEsquerda(null, 15);
|
||||||
|
|
||||||
seq++;
|
seq++;
|
||||||
String sequencial = StringHelper.preencherZeroEsquerda(seq.toString(), 5);
|
String sequencial = StringHelper.preencherZeroEsquerda(seq.toString(), 6);
|
||||||
String brancos193 = StringHelper.preencherStringEspacoEsquerda(null, 193);
|
String brancos192 = StringHelper.preencherStringEspacoEsquerda(null, 192);
|
||||||
|
|
||||||
String itemDoc = itensDocumentoFiscal("2", numItem, cfop, codigoTES, codProduto,
|
String itemDoc = itensDocumentoFiscal("2", numItem, cfop, codigoTES, codProduto,
|
||||||
unidade, quantidade, valorUnitario, valorTotal, aliquotaItem, impostoItem,
|
unidade, quantidade, valorUnitario, valorTotal, aliquotaItem, impostoItem,
|
||||||
aliquotaPIS, valorPIS, aliquotaCofins, valorCofins, aliquotaCSLL, valorCSLL,
|
aliquotaPIS, valorPIS, aliquotaCofins, valorCofins, aliquotaCSLL, valorCSLL,
|
||||||
aliquotaISS, valorISS, totalICMSIsentoItem, totalICMSNaotributadoItem,
|
aliquotaISS, valorISS, totalICMSIsentoItem, totalICMSNaotributadoItem,
|
||||||
brancos193, sequencial);
|
brancos192, sequencial);
|
||||||
itensDocs.add(itemDoc);
|
itensDocs.add(itemDoc);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue