@plasoft/boletos 1.0.32 → 1.0.34
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/ailos-boleto.hbs +6 -6
- package/build/banco-brasil-boleto.hbs +763 -556
- package/build/index.d.mts +20 -14
- package/build/index.d.ts +20 -14
- package/build/index.js +167 -129
- package/build/index.mjs +168 -130
- package/build/sicredi-boleto.hbs +707 -701
- package/build/teste.html +730 -690
- package/package.json +1 -1
package/build/index.d.mts
CHANGED
|
@@ -51,10 +51,10 @@ interface IDadosPDF$4 {
|
|
|
51
51
|
agenciaDigito: string;
|
|
52
52
|
conta: string;
|
|
53
53
|
contaDigito: string;
|
|
54
|
-
juros
|
|
55
|
-
multa
|
|
56
|
-
desconto
|
|
57
|
-
protesto
|
|
54
|
+
juros: number;
|
|
55
|
+
multa: number;
|
|
56
|
+
desconto: number;
|
|
57
|
+
protesto: number;
|
|
58
58
|
};
|
|
59
59
|
endereco: {
|
|
60
60
|
logradouro: string;
|
|
@@ -91,7 +91,7 @@ interface IDadosPDF$4 {
|
|
|
91
91
|
instrucao2?: string;
|
|
92
92
|
instrucao3?: string;
|
|
93
93
|
instrucao4?: string;
|
|
94
|
-
observacoes?: string;
|
|
94
|
+
observacoes?: string[];
|
|
95
95
|
nfs: string;
|
|
96
96
|
};
|
|
97
97
|
}
|
|
@@ -367,10 +367,10 @@ interface IDadosPDF$2 {
|
|
|
367
367
|
agencia: string;
|
|
368
368
|
numero: string;
|
|
369
369
|
posto: string;
|
|
370
|
-
juros
|
|
371
|
-
multa
|
|
372
|
-
desconto
|
|
373
|
-
protesto
|
|
370
|
+
juros: number;
|
|
371
|
+
multa: number;
|
|
372
|
+
desconto: number;
|
|
373
|
+
protesto: number;
|
|
374
374
|
};
|
|
375
375
|
endereco: {
|
|
376
376
|
logradouro: string;
|
|
@@ -407,6 +407,7 @@ interface IDadosPDF$2 {
|
|
|
407
407
|
instrucao2?: string;
|
|
408
408
|
instrucao3?: string;
|
|
409
409
|
instrucao4?: string;
|
|
410
|
+
observacoes?: string[];
|
|
410
411
|
nfs: string;
|
|
411
412
|
};
|
|
412
413
|
}
|
|
@@ -640,15 +641,16 @@ interface IDadosPDF {
|
|
|
640
641
|
cnpj: string;
|
|
641
642
|
dadosBancario: {
|
|
642
643
|
carteira: string;
|
|
644
|
+
variacao_carteira: string;
|
|
643
645
|
convenio: string;
|
|
644
646
|
agencia: string;
|
|
645
647
|
agenciaDigito: string;
|
|
646
648
|
conta: string;
|
|
647
649
|
contaDigito: string;
|
|
648
|
-
juros
|
|
649
|
-
multa
|
|
650
|
-
desconto
|
|
651
|
-
protesto
|
|
650
|
+
juros: number;
|
|
651
|
+
multa: number;
|
|
652
|
+
desconto: number;
|
|
653
|
+
protesto: number;
|
|
652
654
|
};
|
|
653
655
|
endereco: {
|
|
654
656
|
logradouro: string;
|
|
@@ -685,7 +687,8 @@ interface IDadosPDF {
|
|
|
685
687
|
instrucao2?: string;
|
|
686
688
|
instrucao3?: string;
|
|
687
689
|
instrucao4?: string;
|
|
688
|
-
observacoes?: string;
|
|
690
|
+
observacoes?: string[];
|
|
691
|
+
nfs: string;
|
|
689
692
|
};
|
|
690
693
|
}
|
|
691
694
|
interface IGerarRemessaBancoBrasil {
|
|
@@ -709,6 +712,7 @@ interface IDadosRemessa {
|
|
|
709
712
|
};
|
|
710
713
|
dadosBancario: {
|
|
711
714
|
carteira: string;
|
|
715
|
+
variacao_carteira: string;
|
|
712
716
|
convenio: string;
|
|
713
717
|
agencia: string;
|
|
714
718
|
agenciaDigito: string;
|
|
@@ -721,6 +725,8 @@ interface IDadosRemessa {
|
|
|
721
725
|
diasProtesto: number;
|
|
722
726
|
};
|
|
723
727
|
boletos: {
|
|
728
|
+
tipoDocumento: 'NFE' | 'FIN' | 'FAT';
|
|
729
|
+
id_boleto: number;
|
|
724
730
|
identificacaoTitulo: string;
|
|
725
731
|
vencimento: string | Date;
|
|
726
732
|
valor: number | string;
|
package/build/index.d.ts
CHANGED
|
@@ -51,10 +51,10 @@ interface IDadosPDF$4 {
|
|
|
51
51
|
agenciaDigito: string;
|
|
52
52
|
conta: string;
|
|
53
53
|
contaDigito: string;
|
|
54
|
-
juros
|
|
55
|
-
multa
|
|
56
|
-
desconto
|
|
57
|
-
protesto
|
|
54
|
+
juros: number;
|
|
55
|
+
multa: number;
|
|
56
|
+
desconto: number;
|
|
57
|
+
protesto: number;
|
|
58
58
|
};
|
|
59
59
|
endereco: {
|
|
60
60
|
logradouro: string;
|
|
@@ -91,7 +91,7 @@ interface IDadosPDF$4 {
|
|
|
91
91
|
instrucao2?: string;
|
|
92
92
|
instrucao3?: string;
|
|
93
93
|
instrucao4?: string;
|
|
94
|
-
observacoes?: string;
|
|
94
|
+
observacoes?: string[];
|
|
95
95
|
nfs: string;
|
|
96
96
|
};
|
|
97
97
|
}
|
|
@@ -367,10 +367,10 @@ interface IDadosPDF$2 {
|
|
|
367
367
|
agencia: string;
|
|
368
368
|
numero: string;
|
|
369
369
|
posto: string;
|
|
370
|
-
juros
|
|
371
|
-
multa
|
|
372
|
-
desconto
|
|
373
|
-
protesto
|
|
370
|
+
juros: number;
|
|
371
|
+
multa: number;
|
|
372
|
+
desconto: number;
|
|
373
|
+
protesto: number;
|
|
374
374
|
};
|
|
375
375
|
endereco: {
|
|
376
376
|
logradouro: string;
|
|
@@ -407,6 +407,7 @@ interface IDadosPDF$2 {
|
|
|
407
407
|
instrucao2?: string;
|
|
408
408
|
instrucao3?: string;
|
|
409
409
|
instrucao4?: string;
|
|
410
|
+
observacoes?: string[];
|
|
410
411
|
nfs: string;
|
|
411
412
|
};
|
|
412
413
|
}
|
|
@@ -640,15 +641,16 @@ interface IDadosPDF {
|
|
|
640
641
|
cnpj: string;
|
|
641
642
|
dadosBancario: {
|
|
642
643
|
carteira: string;
|
|
644
|
+
variacao_carteira: string;
|
|
643
645
|
convenio: string;
|
|
644
646
|
agencia: string;
|
|
645
647
|
agenciaDigito: string;
|
|
646
648
|
conta: string;
|
|
647
649
|
contaDigito: string;
|
|
648
|
-
juros
|
|
649
|
-
multa
|
|
650
|
-
desconto
|
|
651
|
-
protesto
|
|
650
|
+
juros: number;
|
|
651
|
+
multa: number;
|
|
652
|
+
desconto: number;
|
|
653
|
+
protesto: number;
|
|
652
654
|
};
|
|
653
655
|
endereco: {
|
|
654
656
|
logradouro: string;
|
|
@@ -685,7 +687,8 @@ interface IDadosPDF {
|
|
|
685
687
|
instrucao2?: string;
|
|
686
688
|
instrucao3?: string;
|
|
687
689
|
instrucao4?: string;
|
|
688
|
-
observacoes?: string;
|
|
690
|
+
observacoes?: string[];
|
|
691
|
+
nfs: string;
|
|
689
692
|
};
|
|
690
693
|
}
|
|
691
694
|
interface IGerarRemessaBancoBrasil {
|
|
@@ -709,6 +712,7 @@ interface IDadosRemessa {
|
|
|
709
712
|
};
|
|
710
713
|
dadosBancario: {
|
|
711
714
|
carteira: string;
|
|
715
|
+
variacao_carteira: string;
|
|
712
716
|
convenio: string;
|
|
713
717
|
agencia: string;
|
|
714
718
|
agenciaDigito: string;
|
|
@@ -721,6 +725,8 @@ interface IDadosRemessa {
|
|
|
721
725
|
diasProtesto: number;
|
|
722
726
|
};
|
|
723
727
|
boletos: {
|
|
728
|
+
tipoDocumento: 'NFE' | 'FIN' | 'FAT';
|
|
729
|
+
id_boleto: number;
|
|
724
730
|
identificacaoTitulo: string;
|
|
725
731
|
vencimento: string | Date;
|
|
726
732
|
valor: number | string;
|
package/build/index.js
CHANGED
|
@@ -256,7 +256,6 @@ function decompress(input) {
|
|
|
256
256
|
// src/banks/ailos/gerarPDF.ts
|
|
257
257
|
function gerarPDF(_0) {
|
|
258
258
|
return __async(this, arguments, function* ({ dados }) {
|
|
259
|
-
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
260
259
|
try {
|
|
261
260
|
const { generatePDF, dadosPDF } = dados;
|
|
262
261
|
const codigoBarra2 = yield import_bwip_js.default.toBuffer({
|
|
@@ -287,6 +286,7 @@ function gerarPDF(_0) {
|
|
|
287
286
|
dadosPDF.boleto.valorDescontoAbatimento = maskFormat_default.numberToReal(
|
|
288
287
|
dadosPDF.boleto.valorDescontoAbatimento
|
|
289
288
|
);
|
|
289
|
+
const valorDocumento = Number(dadosPDF.boleto.valorDocumento);
|
|
290
290
|
dadosPDF.boleto.valorDocumento = maskFormat_default.numberToReal(
|
|
291
291
|
dadosPDF.boleto.valorDocumento
|
|
292
292
|
);
|
|
@@ -297,21 +297,21 @@ function gerarPDF(_0) {
|
|
|
297
297
|
if (dadosPDF.boleto.quantidade) {
|
|
298
298
|
dadosPDF.boleto.quantidade = maskFormat_default.numberToReal(dadosPDF.boleto.quantidade);
|
|
299
299
|
}
|
|
300
|
-
const jurosMes =
|
|
301
|
-
const
|
|
302
|
-
if (
|
|
303
|
-
dadosPDF.boleto.instrucao1 = `COBRAR JUROS DE
|
|
300
|
+
const jurosMes = dadosPDF.beneficiario.dadosBancario.juros;
|
|
301
|
+
const jurosDia = jurosMes / 100 / 30 * valorDocumento;
|
|
302
|
+
if (jurosDia > 0) {
|
|
303
|
+
dadosPDF.boleto.instrucao1 = `COBRAR JUROS DE R$${maskFormat_default.numberToReal(jurosDia)} AO DIA, AP\xD3S O VENCIMENTO`;
|
|
304
304
|
}
|
|
305
|
-
const descontoVencimento =
|
|
306
|
-
if (
|
|
305
|
+
const descontoVencimento = dadosPDF.beneficiario.dadosBancario.desconto || 0;
|
|
306
|
+
if (descontoVencimento > 0) {
|
|
307
307
|
dadosPDF.boleto.instrucao2 = `AT\xC9 O VENCIMENTO, CONCEDER DESCONTO DE ${descontoVencimento}%`;
|
|
308
308
|
}
|
|
309
|
-
const multaAtraso =
|
|
310
|
-
if (
|
|
311
|
-
dadosPDF.boleto.instrucao3 = `MULTA DE ${multaAtraso}
|
|
309
|
+
const multaAtraso = dadosPDF.beneficiario.dadosBancario.multa || 0;
|
|
310
|
+
if (multaAtraso > 0) {
|
|
311
|
+
dadosPDF.boleto.instrucao3 = `MULTA DE ${multaAtraso}%`;
|
|
312
312
|
}
|
|
313
|
-
const protestoDias =
|
|
314
|
-
if (
|
|
313
|
+
const protestoDias = dadosPDF.beneficiario.dadosBancario.protesto || 0;
|
|
314
|
+
if (protestoDias > 0) {
|
|
315
315
|
dadosPDF.boleto.instrucao4 = `PROTESTAR AP\xD3S ${protestoDias} DIAS CORRIDOS DO VENCIMENTO`;
|
|
316
316
|
}
|
|
317
317
|
dadosPDF.boleto.valor = maskFormat_default.numberToReal(dadosPDF.boleto.valor);
|
|
@@ -1259,7 +1259,6 @@ function getDigito3(texto) {
|
|
|
1259
1259
|
var import_bwip_js3 = __toESM(require("bwip-js"));
|
|
1260
1260
|
function gerarPDF3(_0) {
|
|
1261
1261
|
return __async(this, arguments, function* ({ dados }) {
|
|
1262
|
-
var _a, _b, _c, _d, _e, _f, _g;
|
|
1263
1262
|
try {
|
|
1264
1263
|
const { generatePDF, dadosPDF } = dados;
|
|
1265
1264
|
const codigoBarra2 = yield import_bwip_js3.default.toBuffer({
|
|
@@ -1289,6 +1288,7 @@ function gerarPDF3(_0) {
|
|
|
1289
1288
|
dadosPDF.boleto.valorDescontoAbatimento = maskFormat_default.numberToReal(
|
|
1290
1289
|
dadosPDF.boleto.valorDescontoAbatimento
|
|
1291
1290
|
);
|
|
1291
|
+
const valorDocumento = Number(dadosPDF.boleto.valorDocumento);
|
|
1292
1292
|
dadosPDF.boleto.valorDocumento = maskFormat_default.numberToReal(
|
|
1293
1293
|
dadosPDF.boleto.valorDocumento
|
|
1294
1294
|
);
|
|
@@ -1299,20 +1299,20 @@ function gerarPDF3(_0) {
|
|
|
1299
1299
|
if (dadosPDF.boleto.quantidade) {
|
|
1300
1300
|
dadosPDF.boleto.quantidade = maskFormat_default.numberToReal(dadosPDF.boleto.quantidade);
|
|
1301
1301
|
}
|
|
1302
|
-
const jurosMes =
|
|
1303
|
-
const
|
|
1304
|
-
if (
|
|
1305
|
-
dadosPDF.boleto.instrucao1 = `COBRAR JUROS DE
|
|
1302
|
+
const jurosMes = dadosPDF.beneficiario.dadosBancario.juros;
|
|
1303
|
+
const jurosDia = jurosMes / 100 / 30 * valorDocumento;
|
|
1304
|
+
if (jurosDia > 0) {
|
|
1305
|
+
dadosPDF.boleto.instrucao1 = `COBRAR JUROS DE R$${maskFormat_default.numberToReal(jurosDia)} AO DIA, AP\xD3S O VENCIMENTO`;
|
|
1306
1306
|
}
|
|
1307
|
-
const descontoVencimento =
|
|
1308
|
-
if (
|
|
1307
|
+
const descontoVencimento = dadosPDF.beneficiario.dadosBancario.desconto || 0;
|
|
1308
|
+
if (descontoVencimento > 0) {
|
|
1309
1309
|
dadosPDF.boleto.instrucao2 = `AT\xC9 O VENCIMENTO, CONCEDER DESCONTO DE ${descontoVencimento}%`;
|
|
1310
1310
|
}
|
|
1311
|
-
const multaAtraso =
|
|
1312
|
-
if (
|
|
1313
|
-
dadosPDF.boleto.instrucao3 = `MULTA DE ${multaAtraso}
|
|
1311
|
+
const multaAtraso = dadosPDF.beneficiario.dadosBancario.multa || 0;
|
|
1312
|
+
if (multaAtraso > 0) {
|
|
1313
|
+
dadosPDF.boleto.instrucao3 = `MULTA DE ${multaAtraso}%`;
|
|
1314
1314
|
}
|
|
1315
|
-
const protestoDias =
|
|
1315
|
+
const protestoDias = dadosPDF.beneficiario.dadosBancario.protesto || 0;
|
|
1316
1316
|
if (protestoDias > 0) {
|
|
1317
1317
|
dadosPDF.boleto.instrucao4 = `PROTESTAR AP\xD3S ${protestoDias} DIAS CORRIDOS DO VENCIMENTO`;
|
|
1318
1318
|
}
|
|
@@ -1997,10 +1997,19 @@ function gerarDadosBoleto5({ dados }) {
|
|
|
1997
1997
|
parcela.valor = Number(parcela.valor);
|
|
1998
1998
|
const fatorVencimento = getFatorVencimento(parcela.vencimento);
|
|
1999
1999
|
const valor = getValor5(parcela.valor);
|
|
2000
|
-
const convenio =
|
|
2001
|
-
|
|
2002
|
-
|
|
2003
|
-
|
|
2000
|
+
const convenio = bancario.convenio;
|
|
2001
|
+
let nossoNumero = "";
|
|
2002
|
+
let numeroDocumento = "";
|
|
2003
|
+
let campoLivre = "";
|
|
2004
|
+
if (convenio.length === 6) {
|
|
2005
|
+
numeroDocumento = padLeft(`${parcela.id_boleto}2`, 5);
|
|
2006
|
+
nossoNumero = getNossoNumero3(`${convenio}${numeroDocumento}2`);
|
|
2007
|
+
campoLivre = copy(nossoNumero, 1, 11) + padLeft(bancario.agencia, 4) + padLeft(`${bancario.numero}${bancario.numero_dv}`, 8) + padLeft(bancario.carteira, 2);
|
|
2008
|
+
} else if (convenio.length === 7) {
|
|
2009
|
+
numeroDocumento = padLeft(`${parcela.id_boleto}2`, 10);
|
|
2010
|
+
nossoNumero = `${convenio}${numeroDocumento}`;
|
|
2011
|
+
campoLivre = `000000${nossoNumero}${padLeft(bancario.carteira, 2)}`;
|
|
2012
|
+
}
|
|
2004
2013
|
const digitoGeral = getDigitoGeral5(`0019${fatorVencimento}${valor}${campoLivre}`);
|
|
2005
2014
|
const codigoBarra2 = `0019${digitoGeral}${fatorVencimento}${valor}${campoLivre}`;
|
|
2006
2015
|
const campo1 = copy(codigoBarra2, 1, 3) + copy(codigoBarra2, 4, 4) + copy(codigoBarra2, 20, 24);
|
|
@@ -2095,7 +2104,6 @@ function getDigito5(texto) {
|
|
|
2095
2104
|
var import_bwip_js5 = __toESM(require("bwip-js"));
|
|
2096
2105
|
function gerarPDF5(_0) {
|
|
2097
2106
|
return __async(this, arguments, function* ({ dados }) {
|
|
2098
|
-
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
2099
2107
|
try {
|
|
2100
2108
|
const { dadosPDF } = dados;
|
|
2101
2109
|
const codigoBarra2 = yield import_bwip_js5.default.toBuffer({
|
|
@@ -2126,6 +2134,7 @@ function gerarPDF5(_0) {
|
|
|
2126
2134
|
dadosPDF.boleto.valorDescontoAbatimento = maskFormat_default.numberToReal(
|
|
2127
2135
|
dadosPDF.boleto.valorDescontoAbatimento
|
|
2128
2136
|
);
|
|
2137
|
+
const valorDocumento = Number(dadosPDF.boleto.valorDocumento);
|
|
2129
2138
|
dadosPDF.boleto.valorDocumento = maskFormat_default.numberToReal(
|
|
2130
2139
|
dadosPDF.boleto.valorDocumento
|
|
2131
2140
|
);
|
|
@@ -2136,21 +2145,21 @@ function gerarPDF5(_0) {
|
|
|
2136
2145
|
if (dadosPDF.boleto.quantidade) {
|
|
2137
2146
|
dadosPDF.boleto.quantidade = maskFormat_default.numberToReal(dadosPDF.boleto.quantidade);
|
|
2138
2147
|
}
|
|
2139
|
-
const jurosMes =
|
|
2140
|
-
const
|
|
2141
|
-
if (
|
|
2142
|
-
dadosPDF.boleto.instrucao1 = `COBRAR JUROS DE
|
|
2148
|
+
const jurosMes = dadosPDF.beneficiario.dadosBancario.juros;
|
|
2149
|
+
const jurosDia = jurosMes / 100 / 30 * valorDocumento;
|
|
2150
|
+
if (jurosDia > 0) {
|
|
2151
|
+
dadosPDF.boleto.instrucao1 = `COBRAR JUROS DE R$${jurosDia} AO DIA, AP\xD3S O VENCIMENTO`;
|
|
2143
2152
|
}
|
|
2144
|
-
const descontoVencimento =
|
|
2145
|
-
if (
|
|
2153
|
+
const descontoVencimento = dadosPDF.beneficiario.dadosBancario.desconto || 0;
|
|
2154
|
+
if (descontoVencimento > 0) {
|
|
2146
2155
|
dadosPDF.boleto.instrucao2 = `AT\xC9 O VENCIMENTO, CONCEDER DESCONTO DE ${descontoVencimento}%`;
|
|
2147
2156
|
}
|
|
2148
|
-
const multaAtraso =
|
|
2149
|
-
if (
|
|
2150
|
-
dadosPDF.boleto.instrucao3 = `MULTA DE ${multaAtraso}
|
|
2157
|
+
const multaAtraso = dadosPDF.beneficiario.dadosBancario.multa || 0;
|
|
2158
|
+
if (multaAtraso > 0) {
|
|
2159
|
+
dadosPDF.boleto.instrucao3 = `MULTA DE ${multaAtraso}%`;
|
|
2151
2160
|
}
|
|
2152
|
-
const protestoDias =
|
|
2153
|
-
if (
|
|
2161
|
+
const protestoDias = dadosPDF.beneficiario.dadosBancario.protesto || 0;
|
|
2162
|
+
if (protestoDias > 0) {
|
|
2154
2163
|
dadosPDF.boleto.instrucao4 = `PROTESTAR AP\xD3S ${protestoDias} DIAS CORRIDOS DO VENCIMENTO`;
|
|
2155
2164
|
}
|
|
2156
2165
|
dadosPDF.boleto.valor = maskFormat_default.numberToReal(dadosPDF.boleto.valor);
|
|
@@ -2186,58 +2195,69 @@ function gerarPDF5(_0) {
|
|
|
2186
2195
|
var import_date_fns6 = require("date-fns");
|
|
2187
2196
|
function gerarRemessa5({ dados }) {
|
|
2188
2197
|
try {
|
|
2189
|
-
const {
|
|
2198
|
+
const {
|
|
2199
|
+
dadosBancario,
|
|
2200
|
+
beneficiario,
|
|
2201
|
+
boletos
|
|
2202
|
+
} = dados.remessa;
|
|
2190
2203
|
const arquivo = new Arquivo();
|
|
2191
2204
|
const dataAtual = /* @__PURE__ */ new Date();
|
|
2192
2205
|
const data = (0, import_date_fns6.format)(dataAtual, "ddMMyyyy");
|
|
2193
2206
|
const hora = (0, import_date_fns6.format)(dataAtual, "HHmmss");
|
|
2194
|
-
const
|
|
2195
|
-
|
|
2196
|
-
const remessa2 = `REM${convenio}-${numero}-${data}.REM`;
|
|
2197
|
-
arquivo.add("085");
|
|
2207
|
+
const remessa2 = `REM${dadosBancario.numeroRemessa.padStart(5, "0")}.CNAB`;
|
|
2208
|
+
arquivo.add("001");
|
|
2198
2209
|
arquivo.add("0000");
|
|
2199
2210
|
arquivo.add("0");
|
|
2200
|
-
arquivo.add("
|
|
2211
|
+
arquivo.add(" ".padEnd(9, " "));
|
|
2201
2212
|
arquivo.add("2");
|
|
2202
|
-
arquivo.add(beneficiario.cnpj);
|
|
2203
|
-
arquivo.add(dadosBancario.convenio.
|
|
2204
|
-
arquivo.add(
|
|
2205
|
-
arquivo.add(dadosBancario.
|
|
2206
|
-
arquivo.add(dadosBancario.
|
|
2207
|
-
arquivo.add(
|
|
2213
|
+
arquivo.add(beneficiario.cnpj.padStart(14, "0"));
|
|
2214
|
+
arquivo.add(dadosBancario.convenio.padStart(9, "0"));
|
|
2215
|
+
arquivo.add("0014");
|
|
2216
|
+
arquivo.add(dadosBancario.carteira.padStart(2, "0"));
|
|
2217
|
+
arquivo.add(dadosBancario.variacao_carteira.padStart(3, "0"));
|
|
2218
|
+
arquivo.add(" ");
|
|
2219
|
+
arquivo.add("0");
|
|
2220
|
+
arquivo.add(`${dadosBancario.agencia}${dadosBancario.agenciaDigito}`.padStart(5, "0"));
|
|
2221
|
+
arquivo.add("00000");
|
|
2222
|
+
arquivo.add(`${dadosBancario.conta}${dadosBancario.contaDigito}`.padStart(8, "0"));
|
|
2208
2223
|
arquivo.add(" ");
|
|
2209
2224
|
arquivo.add(removerAcentos(beneficiario.nome).substring(0, 30).padEnd(30, " "));
|
|
2210
|
-
arquivo.add("
|
|
2211
|
-
arquivo.add("
|
|
2225
|
+
arquivo.add("BANCO DO BRASIL S.A.".padEnd(30, " "));
|
|
2226
|
+
arquivo.add(" ".padEnd(10, " "));
|
|
2212
2227
|
arquivo.add("1");
|
|
2213
2228
|
arquivo.add(data);
|
|
2214
2229
|
arquivo.add(hora);
|
|
2215
2230
|
arquivo.add(dadosBancario.numeroRemessa.padStart(6, "0"));
|
|
2216
|
-
arquivo.add("
|
|
2231
|
+
arquivo.add("030");
|
|
2217
2232
|
arquivo.add("00000");
|
|
2218
|
-
arquivo.add(" ".padEnd(
|
|
2219
|
-
arquivo.add(" ".padEnd(
|
|
2220
|
-
arquivo.add("
|
|
2233
|
+
arquivo.add(" ".padEnd(40, " "));
|
|
2234
|
+
arquivo.add(" ".padEnd(11, " "));
|
|
2235
|
+
arquivo.add("CSP");
|
|
2236
|
+
arquivo.add("000");
|
|
2237
|
+
arquivo.add(" ".padEnd(12, " "));
|
|
2221
2238
|
arquivo.addLine();
|
|
2222
|
-
arquivo.add("
|
|
2239
|
+
arquivo.add("001");
|
|
2223
2240
|
arquivo.add("0001");
|
|
2224
2241
|
arquivo.add("1");
|
|
2225
2242
|
arquivo.add("R");
|
|
2226
2243
|
arquivo.add("01");
|
|
2227
|
-
arquivo.add("
|
|
2228
|
-
arquivo.add("
|
|
2244
|
+
arquivo.add("00");
|
|
2245
|
+
arquivo.add("020");
|
|
2229
2246
|
arquivo.add(" ");
|
|
2230
2247
|
arquivo.add("2");
|
|
2231
2248
|
arquivo.add(beneficiario.cnpj.padStart(15, "0"));
|
|
2232
|
-
arquivo.add(dadosBancario.convenio.padEnd(
|
|
2233
|
-
arquivo.add(
|
|
2234
|
-
arquivo.add(dadosBancario.
|
|
2235
|
-
arquivo.add(dadosBancario.
|
|
2236
|
-
arquivo.add(
|
|
2249
|
+
arquivo.add(dadosBancario.convenio.padEnd(9, " "));
|
|
2250
|
+
arquivo.add("0014");
|
|
2251
|
+
arquivo.add(dadosBancario.carteira.padStart(2, "0"));
|
|
2252
|
+
arquivo.add(dadosBancario.variacao_carteira.padStart(3, "0"));
|
|
2253
|
+
arquivo.add(" ");
|
|
2254
|
+
arquivo.add("0");
|
|
2255
|
+
arquivo.add(`${dadosBancario.agencia}${dadosBancario.agenciaDigito}`.padStart(5, "0"));
|
|
2256
|
+
arquivo.add("00000");
|
|
2257
|
+
arquivo.add(`${dadosBancario.conta}${dadosBancario.contaDigito}`.padStart(8, "0"));
|
|
2237
2258
|
arquivo.add(" ");
|
|
2238
2259
|
arquivo.add(removerAcentos(beneficiario.nome).substring(0, 30).padEnd(30, " "));
|
|
2239
|
-
arquivo.add(" ".padEnd(
|
|
2240
|
-
arquivo.add(" ".padEnd(40, " "));
|
|
2260
|
+
arquivo.add(" ".padEnd(80, " "));
|
|
2241
2261
|
arquivo.add(dadosBancario.numeroRemessa.padStart(8, "0"));
|
|
2242
2262
|
arquivo.add(data);
|
|
2243
2263
|
arquivo.add("00000000");
|
|
@@ -2247,72 +2267,97 @@ function gerarRemessa5({ dados }) {
|
|
|
2247
2267
|
let quantidadeRegistro = 0;
|
|
2248
2268
|
let total = 0;
|
|
2249
2269
|
for (const boleto of boletos) {
|
|
2270
|
+
const convenio = dadosBancario.convenio;
|
|
2271
|
+
let nosso_numero = "";
|
|
2272
|
+
if (convenio.length === 6) {
|
|
2273
|
+
switch (boleto.tipoDocumento) {
|
|
2274
|
+
case "NFE": {
|
|
2275
|
+
nosso_numero = getNossoNumero3(`${convenio}${boleto.id_boleto}2`);
|
|
2276
|
+
break;
|
|
2277
|
+
}
|
|
2278
|
+
case "FAT": {
|
|
2279
|
+
nosso_numero = getNossoNumero3(`${convenio}${boleto.id_boleto}4`);
|
|
2280
|
+
break;
|
|
2281
|
+
}
|
|
2282
|
+
case "FIN": {
|
|
2283
|
+
nosso_numero = getNossoNumero3(`${convenio}${boleto.id_boleto}5`);
|
|
2284
|
+
break;
|
|
2285
|
+
}
|
|
2286
|
+
}
|
|
2287
|
+
} else if (convenio.length === 7) {
|
|
2288
|
+
switch (boleto.tipoDocumento) {
|
|
2289
|
+
case "NFE": {
|
|
2290
|
+
nosso_numero = `${convenio}${boleto.id_boleto.toString().padStart(10, "0")}2`;
|
|
2291
|
+
break;
|
|
2292
|
+
}
|
|
2293
|
+
case "FAT": {
|
|
2294
|
+
nosso_numero = `${convenio}${boleto.id_boleto.toString().padStart(10, "0")}4`;
|
|
2295
|
+
break;
|
|
2296
|
+
}
|
|
2297
|
+
case "FIN": {
|
|
2298
|
+
nosso_numero = `${convenio}${boleto.id_boleto.toString().padStart(10, "0")}5`;
|
|
2299
|
+
break;
|
|
2300
|
+
}
|
|
2301
|
+
}
|
|
2302
|
+
}
|
|
2303
|
+
const valorJurosDia = dadosBancario.jurosMes > 0 ? Number(boleto.valor) * dadosBancario.jurosMes / 100 / 30 : 0;
|
|
2250
2304
|
const { pagador } = boleto;
|
|
2305
|
+
const tipoInscricao = pagador.pessoa === "F" ? "1" : "2";
|
|
2251
2306
|
const vencimento = (0, import_date_fns6.format)(new Date(boleto.vencimento), "ddMMyyyy");
|
|
2252
2307
|
total += Number(boleto.valor);
|
|
2253
|
-
|
|
2254
|
-
|
|
2255
|
-
|
|
2256
|
-
|
|
2257
|
-
|
|
2258
|
-
|
|
2259
|
-
|
|
2260
|
-
|
|
2261
|
-
|
|
2262
|
-
|
|
2263
|
-
arquivo.add("
|
|
2308
|
+
let protesto = "3";
|
|
2309
|
+
let diasProtesto = "00";
|
|
2310
|
+
let baixarDevolver = "1";
|
|
2311
|
+
let diasBaixa = "000";
|
|
2312
|
+
if (dadosBancario.diasProtesto) {
|
|
2313
|
+
protesto = "1";
|
|
2314
|
+
diasProtesto = dadosBancario.diasProtesto.toString().padStart(2, "0");
|
|
2315
|
+
baixarDevolver = "2";
|
|
2316
|
+
diasBaixa = "060";
|
|
2317
|
+
}
|
|
2318
|
+
arquivo.add("001");
|
|
2264
2319
|
arquivo.add("0001");
|
|
2265
2320
|
arquivo.add("3");
|
|
2266
2321
|
arquivo.add((++sequencia).toString().padStart(5, "0"));
|
|
2267
2322
|
arquivo.add("P");
|
|
2268
2323
|
arquivo.add(" ");
|
|
2269
2324
|
arquivo.add("01");
|
|
2270
|
-
arquivo.add(
|
|
2271
|
-
arquivo.add(dadosBancario.agenciaDigito);
|
|
2272
|
-
arquivo.add(
|
|
2273
|
-
arquivo.add(dadosBancario.contaDigito);
|
|
2325
|
+
arquivo.add("0");
|
|
2326
|
+
arquivo.add(`${dadosBancario.agencia}${dadosBancario.agenciaDigito}`.padStart(5, "0"));
|
|
2327
|
+
arquivo.add("00000");
|
|
2328
|
+
arquivo.add(`${dadosBancario.conta}${dadosBancario.contaDigito}`.padStart(8, "0"));
|
|
2274
2329
|
arquivo.add(" ");
|
|
2275
|
-
arquivo.add(
|
|
2276
|
-
arquivo.add("
|
|
2277
|
-
arquivo.add("
|
|
2278
|
-
arquivo.add("
|
|
2279
|
-
arquivo.add("2");
|
|
2280
|
-
arquivo.add("2");
|
|
2281
|
-
arquivo.add(`${boleto.numeroDocumento}/${boleto.parcela}`.padEnd(15, " "));
|
|
2330
|
+
arquivo.add(nosso_numero.padEnd(20, " "));
|
|
2331
|
+
arquivo.add("7");
|
|
2332
|
+
arquivo.add("1122");
|
|
2333
|
+
arquivo.add(`${boleto.numeroDocumento.padStart(6, "0")}-${boleto.parcela.toString().padStart(2, "0")}`.padEnd(15, " "));
|
|
2282
2334
|
arquivo.add(vencimento);
|
|
2283
2335
|
arquivo.add(
|
|
2284
2336
|
Number(boleto.valor).toFixed(2).replace(".", "").padStart(15, "0")
|
|
2285
2337
|
);
|
|
2286
|
-
arquivo.add(
|
|
2287
|
-
arquivo.add(dadosBancario.agenciaDigito);
|
|
2338
|
+
arquivo.add("00000 ");
|
|
2288
2339
|
arquivo.add("02");
|
|
2289
|
-
arquivo.add("
|
|
2340
|
+
arquivo.add("N");
|
|
2290
2341
|
arquivo.add(data);
|
|
2291
|
-
arquivo.add(
|
|
2292
|
-
arquivo.add(
|
|
2293
|
-
arquivo.add(
|
|
2294
|
-
arquivo.add(
|
|
2295
|
-
arquivo.add(
|
|
2296
|
-
arquivo.add(desconto.replace(".", "").padStart(15, "0"));
|
|
2342
|
+
arquivo.add("1");
|
|
2343
|
+
arquivo.add("00000000");
|
|
2344
|
+
arquivo.add(valorJurosDia.toFixed(2).replace(".", "").padStart(15, "0"));
|
|
2345
|
+
arquivo.add("0");
|
|
2346
|
+
arquivo.add("00000000");
|
|
2297
2347
|
arquivo.add("000000000000000");
|
|
2298
2348
|
arquivo.add("000000000000000");
|
|
2299
|
-
arquivo.add(
|
|
2349
|
+
arquivo.add("000000000000000");
|
|
2350
|
+
arquivo.add(" ".padEnd(25, " "));
|
|
2300
2351
|
arquivo.add(protesto);
|
|
2301
|
-
arquivo.add(diasProtesto
|
|
2302
|
-
arquivo.add(
|
|
2303
|
-
arquivo.add(
|
|
2352
|
+
arquivo.add(diasProtesto);
|
|
2353
|
+
arquivo.add(baixarDevolver);
|
|
2354
|
+
arquivo.add(diasBaixa);
|
|
2304
2355
|
arquivo.add("09");
|
|
2305
2356
|
arquivo.add("0000000000");
|
|
2306
2357
|
arquivo.add(" ");
|
|
2307
2358
|
arquivo.addLine();
|
|
2308
|
-
let tipoInscricao = "1";
|
|
2309
|
-
if (pagador.pessoa === "F") {
|
|
2310
|
-
tipoInscricao = "1";
|
|
2311
|
-
} else {
|
|
2312
|
-
tipoInscricao = "2";
|
|
2313
|
-
}
|
|
2314
2359
|
pagador.endereco.logradouro = `${removerAcentos(pagador.endereco.logradouro).substring(0, 32).padEnd(32, " ")}${pagador.endereco.numero.padEnd(8, " ")}`;
|
|
2315
|
-
arquivo.add("
|
|
2360
|
+
arquivo.add("001");
|
|
2316
2361
|
arquivo.add("0001");
|
|
2317
2362
|
arquivo.add("3");
|
|
2318
2363
|
arquivo.add((++sequencia).toString().padStart(5, "0"));
|
|
@@ -2324,21 +2369,19 @@ function gerarRemessa5({ dados }) {
|
|
|
2324
2369
|
arquivo.add(removerAcentos(pagador.nome).substring(0, 40).padEnd(40, " "));
|
|
2325
2370
|
arquivo.add(removerAcentos(pagador.endereco.logradouro).substring(0, 40).padEnd(40, " "));
|
|
2326
2371
|
arquivo.add(removerAcentos(pagador.endereco.bairro).substring(0, 15).padEnd(15, " "));
|
|
2327
|
-
arquivo.add(pagador.endereco.cep
|
|
2328
|
-
arquivo.add(pagador.endereco.cep.substring(5, 7).padStart(3, "0"));
|
|
2372
|
+
arquivo.add(pagador.endereco.cep);
|
|
2329
2373
|
arquivo.add(removerAcentos(pagador.endereco.municipio).substring(0, 15).padEnd(15, " "));
|
|
2330
2374
|
arquivo.add(removerAcentos(pagador.endereco.uf).padEnd(2, " "));
|
|
2331
2375
|
arquivo.add("0");
|
|
2332
2376
|
arquivo.add("000000000000000");
|
|
2333
2377
|
arquivo.add(" ".padEnd(40, " "));
|
|
2334
2378
|
arquivo.add("000");
|
|
2335
|
-
arquivo.add(" ".padEnd(
|
|
2336
|
-
arquivo.add(" ".padEnd(8, " "));
|
|
2379
|
+
arquivo.add(" ".padEnd(28, " "));
|
|
2337
2380
|
arquivo.addLine();
|
|
2338
2381
|
dadosBancario.multaAtraso = Number(dadosBancario.multaAtraso || 0);
|
|
2339
2382
|
if (dadosBancario.multaAtraso > 0) {
|
|
2340
2383
|
const multa = dadosBancario.multaAtraso.toFixed(2);
|
|
2341
|
-
arquivo.add("
|
|
2384
|
+
arquivo.add("001");
|
|
2342
2385
|
arquivo.add("0001");
|
|
2343
2386
|
arquivo.add("3");
|
|
2344
2387
|
arquivo.add((++sequencia).toString().padStart(5, "0"));
|
|
@@ -2363,31 +2406,25 @@ function gerarRemessa5({ dados }) {
|
|
|
2363
2406
|
arquivo.add("00000");
|
|
2364
2407
|
arquivo.add(" ");
|
|
2365
2408
|
arquivo.add("000000000000");
|
|
2366
|
-
arquivo.add("
|
|
2367
|
-
arquivo.add(" ");
|
|
2409
|
+
arquivo.add(" ");
|
|
2368
2410
|
arquivo.add("0");
|
|
2369
|
-
arquivo.add("
|
|
2411
|
+
arquivo.add(" ".padEnd(9, " "));
|
|
2370
2412
|
arquivo.addLine();
|
|
2371
2413
|
}
|
|
2372
2414
|
quantidadeRegistro++;
|
|
2373
2415
|
}
|
|
2374
|
-
arquivo.add("
|
|
2416
|
+
arquivo.add("001");
|
|
2375
2417
|
arquivo.add("0001");
|
|
2376
2418
|
arquivo.add("5");
|
|
2377
2419
|
arquivo.add(" ".padEnd(9, " "));
|
|
2378
2420
|
arquivo.add((sequencia + 3).toString().padStart(6, "0"));
|
|
2379
|
-
arquivo.add(
|
|
2380
|
-
arquivo.add(
|
|
2381
|
-
arquivo.add("
|
|
2382
|
-
arquivo.add("
|
|
2383
|
-
arquivo.add("
|
|
2384
|
-
arquivo.add("0".padStart(17, "0"));
|
|
2385
|
-
arquivo.add("0".padStart(6, "0"));
|
|
2386
|
-
arquivo.add("0".padStart(17, "0"));
|
|
2387
|
-
arquivo.add(" ".padStart(8, " "));
|
|
2388
|
-
arquivo.add(" ".padStart(117, " "));
|
|
2421
|
+
arquivo.add("000000");
|
|
2422
|
+
arquivo.add("00");
|
|
2423
|
+
arquivo.add("000000000000000");
|
|
2424
|
+
arquivo.add("000000000000000000000000000000000000000000000000000000000000000000000");
|
|
2425
|
+
arquivo.add(" ".padEnd(125, " "));
|
|
2389
2426
|
arquivo.addLine();
|
|
2390
|
-
arquivo.add("
|
|
2427
|
+
arquivo.add("001");
|
|
2391
2428
|
arquivo.add("9999");
|
|
2392
2429
|
arquivo.add("9");
|
|
2393
2430
|
arquivo.add(" ".padEnd(9, " "));
|
|
@@ -2395,6 +2432,7 @@ function gerarRemessa5({ dados }) {
|
|
|
2395
2432
|
arquivo.add((sequencia + 4).toString().padStart(6, "0"));
|
|
2396
2433
|
arquivo.add("000000");
|
|
2397
2434
|
arquivo.add(" ".padEnd(205, " "));
|
|
2435
|
+
arquivo.addLine();
|
|
2398
2436
|
return {
|
|
2399
2437
|
download: remessa2,
|
|
2400
2438
|
arquivo: arquivo.getArquivo()
|