@alexssmusica/node-pdf-nfe 1.0.57 → 1.0.59
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/lib/application/helpers/generate-pdf/nfe/cria-layout.js +2 -1
- package/lib/application/helpers/generate-pdf/nfe/gerar-itens.js +2 -2
- package/lib/application/helpers/generate-pdf/nfe/get-dados-emitente.js +11 -4
- package/lib/application/helpers/generate-pdf/nfe/get-fatura-duplicata.js +11 -9
- package/package.json +1 -1
|
@@ -31,12 +31,12 @@ async function gerarItens({ nf, ajusteX, ajusteY, doc, margemEsquerda, margemTop
|
|
|
31
31
|
maiorY = Math.max(maiorY, pdf.y);
|
|
32
32
|
const keys = Object.keys(item.imposto);
|
|
33
33
|
for (let i = 0; i < keys.length; i++) {
|
|
34
|
-
if (keys[i].includes('ICMS')) {
|
|
34
|
+
if (keys[i].includes('ICMS') && !keys[i].includes('UFDest')) {
|
|
35
35
|
const newKeys = Object.keys(item.imposto[keys[i]]);
|
|
36
36
|
(0, normal_1.normal)({ doc, value: item.imposto[keys[i]][newKeys[0]].CST ? `${item.imposto[keys[i]][newKeys[0]].orig}${item.imposto[keys[i]][newKeys[0]].CST}` : '', x: 270, y, largura: 21, alinhamento: 'center', tamanho: default_1.DEFAULT_NFE.tamanhoDaFonteDosItens, ajusteX, ajusteY, margemEsquerda, margemTopo });
|
|
37
37
|
(0, normal_1.normal)({ doc, value: item.imposto[keys[i]][newKeys[0]].CSOSN ? `${item.imposto[keys[i]][newKeys[0]].orig}${item.imposto[keys[i]][newKeys[0]].CSOSN}` : '', x: 270, y, largura: 21, alinhamento: 'center', tamanho: default_1.DEFAULT_NFE.tamanhoDaFonteDosItens, ajusteX, ajusteY, margemEsquerda, margemTopo });
|
|
38
38
|
maiorY = Math.max(maiorY, pdf.y);
|
|
39
|
-
(0, normal_1.normal)({ doc, value: item.imposto[keys[i]][newKeys[0]].
|
|
39
|
+
(0, normal_1.normal)({ doc, value: item.imposto[keys[i]][newKeys[0]].vBC ?? Intl.NumberFormat('pt-BR', { minimumFractionDigits: 2 }).format(Number(0)), x: 443, y, largura: 32.5, alinhamento: 'center', tamanho: default_1.DEFAULT_NFE.tamanhoDaFonteDosItens, ajusteX, ajusteY, margemEsquerda, margemTopo });
|
|
40
40
|
maiorY = Math.max(maiorY, pdf.y);
|
|
41
41
|
(0, normal_1.normal)({ doc, value: item.imposto[keys[i]][newKeys[0]].vICMS ?? Intl.NumberFormat('pt-BR', { minimumFractionDigits: 2 }).format(Number(0)), x: 476, y, largura: 32, alinhamento: 'center', tamanho: default_1.DEFAULT_NFE.tamanhoDaFonteDosItens, ajusteX, ajusteY, margemEsquerda, margemTopo });
|
|
42
42
|
maiorY = Math.max(maiorY, pdf.y);
|
|
@@ -14,7 +14,7 @@ const campo_1 = require("./campo");
|
|
|
14
14
|
const negrito_1 = require("./negrito");
|
|
15
15
|
const default_1 = require("./default");
|
|
16
16
|
const italico_1 = require("./italico");
|
|
17
|
-
async function getDadosEmitente({ y, doc, ajusteX, ajusteY, margemDireita, margemEsquerda, margemTopo, larguraDoFormulario, emit, protNFe, pathLogo, ide }) {
|
|
17
|
+
async function getDadosEmitente({ y, doc, ajusteX, ajusteY, margemDireita, margemEsquerda, margemTopo, larguraDoFormulario, emit, protNFe, pathLogo, ide, folha }) {
|
|
18
18
|
(0, linha_horizontal_1.linhaHorizontal)({ x1: 317, x2: -254.7, y: y + 53.1, doc, ajusteX, ajusteY, margemDireita, margemEsquerda, margemTopo });
|
|
19
19
|
(0, linha_horizontal_1.linhaHorizontal)({ x1: 317, x2: -254.7, y: y + 72.9, doc, ajusteX, ajusteY, margemDireita, margemEsquerda, margemTopo });
|
|
20
20
|
(0, linha_vertical_1.linhaVertical)({ y1: y + 53.1, y2: y + 72.9, x: 317.4, doc, ajusteX, ajusteY, margemEsquerda, margemTopo });
|
|
@@ -38,9 +38,16 @@ async function getDadosEmitente({ y, doc, ajusteX, ajusteY, margemDireita, marge
|
|
|
38
38
|
const identificacaoDoEmitenteLargura = pathLogo !== undefined ? 172 : 237;
|
|
39
39
|
const identificacaoDoEmitenteFonte = pathLogo !== undefined ? 0 : 1.5;
|
|
40
40
|
if (pathLogo !== undefined) {
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
41
|
+
if (folha === 0) {
|
|
42
|
+
doc.image(pathLogo, margemEsquerda + ajusteX + 4.5, margemTopo + ajusteY + default_1.DEFAULT_NFE.ajusteYDoLogotipo + 78 , {
|
|
43
|
+
fit: [60, 60]
|
|
44
|
+
});
|
|
45
|
+
}else{
|
|
46
|
+
doc.image(pathLogo, margemEsquerda + ajusteX + 4.5, margemTopo + ajusteY + default_1.DEFAULT_NFE.ajusteYDoLogotipo + 33 , {
|
|
47
|
+
fit: [60, 60]
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
|
|
44
51
|
}
|
|
45
52
|
(0, negrito_1.negrito)({ doc, value: emit.xNome, x: identificacaoDoEmitenteX, y: identificacaoDoEmitenteY + default_1.DEFAULT_NFE.ajusteYDaIdentificacaoDoEmitente, largura: identificacaoDoEmitenteLargura, alinhamento: 'center', tamanho: 8 + identificacaoDoEmitenteFonte, ajusteX, ajusteY, margemEsquerda, margemTopo });
|
|
46
53
|
(0, normal_1.normal)({ doc, value: `${emit.enderEmit.xLgr}, ${emit.enderEmit.nro} ${emit.enderEmit.xCpl ?? ''}`, x: identificacaoDoEmitenteX, y: doc.y - margemTopo + 2, largura: identificacaoDoEmitenteLargura, alinhamento: 'center', tamanho: 6 + identificacaoDoEmitenteFonte, ajusteX, ajusteY, margemEsquerda, margemTopo });
|
|
@@ -7,7 +7,7 @@ const linha_horizontal_1 = require("./linha-horizontal");
|
|
|
7
7
|
const linha_vertical_1 = require("./linha-vertical");
|
|
8
8
|
const date_fns_1 = require("date-fns");
|
|
9
9
|
function getFaturaDuplicata({ y, doc, ajusteX, ajusteY, margemDireita, margemEsquerda, margemTopo, larguraDoFormulario, cobr }) {
|
|
10
|
-
if (cobr !== undefined) {
|
|
10
|
+
if (cobr !== undefined && Object.keys(cobr).length > 0) {
|
|
11
11
|
(0, secao_1.secao)({ doc, value: 'FATURA / DUPLICATA', x: 1.5, y: y + 12, largura: 0, ajusteX, ajusteY, margemEsquerda, margemTopo });
|
|
12
12
|
if (cobr.fat !== undefined) {
|
|
13
13
|
doc.font('negrito')
|
|
@@ -23,14 +23,16 @@ function getFaturaDuplicata({ y, doc, ajusteX, ajusteY, margemDireita, margemEsq
|
|
|
23
23
|
.font('negrito').text(' Valor Desconto:', { continued: true }).font('normal').text(` ${Intl.NumberFormat('pt-BR', { minimumFractionDigits: 2 }).format(Number(cobr.fat.vDesc))}`, { continued: true })
|
|
24
24
|
.font('negrito').text(' Valor Líquido:', { continued: true }).font('normal').text(` ${Intl.NumberFormat('pt-BR', { minimumFractionDigits: 2 }).format(Number(cobr.fat.vLiq))}.`, { continued: true });
|
|
25
25
|
}
|
|
26
|
-
cobr.dup
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
26
|
+
if(cobr.dup !== undefined){
|
|
27
|
+
cobr.dup.forEach((dup, index) => {
|
|
28
|
+
doc.font('negrito').text(' Duplicata:', { continued: true }).font('normal').text(` ${dup.nDup}`, { continued: true });
|
|
29
|
+
doc.font('negrito').text(' Valor:', { continued: true }).font('normal').text(` ${Intl.NumberFormat('pt-BR', { minimumFractionDigits: 2 }).format(Number(dup.vDup))}`, { continued: true });
|
|
30
|
+
doc.font('negrito').text(' Vencimento:', { continued: true }).font('normal').text(` ${(0, date_fns_1.format)((0, date_fns_1.parseISO)(dup.dVenc), 'dd/MM/yyyy')}`, { continued: true });
|
|
31
|
+
if (index === cobr.dup.length - 1) {
|
|
32
|
+
doc.text('');
|
|
33
|
+
}
|
|
34
|
+
});
|
|
35
|
+
}
|
|
34
36
|
(0, linha_horizontal_1.linhaHorizontal)({ x1: 0, x2: 0, y: y + 20, doc, ajusteX, ajusteY, margemDireita, margemEsquerda, margemTopo });
|
|
35
37
|
(0, linha_horizontal_1.linhaHorizontal)({ x1: 0, x2: 0, y: doc.y + 6, doc, ajusteX, ajusteY, margemDireita, margemEsquerda, margemTopo });
|
|
36
38
|
(0, linha_vertical_1.linhaVertical)({ y1: y + 20, y2: doc.y + 6, x: 0, doc, ajusteX, ajusteY, margemEsquerda, margemTopo });
|