@alexssmusica/node-pdf-nfe 1.2.4 → 1.2.5
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/campo.js +14 -15
- package/lib/application/helpers/generate-pdf/nfe/cria-layout.js +147 -148
- package/lib/application/helpers/generate-pdf/nfe/default.js +26 -26
- package/lib/application/helpers/generate-pdf/nfe/gerar-itens.js +276 -277
- package/lib/application/helpers/generate-pdf/nfe/get-dados-adicionais.js +52 -53
- package/lib/application/helpers/generate-pdf/nfe/get-dados-emitente.js +333 -319
- package/lib/application/helpers/generate-pdf/nfe/get-destinatario-remetente.js +153 -154
- package/lib/application/helpers/generate-pdf/nfe/get-fatura-duplicata.js +63 -64
- package/lib/application/helpers/generate-pdf/nfe/get-homologacao.js +36 -37
- package/lib/application/helpers/generate-pdf/nfe/get-imposto.js +218 -219
- package/lib/application/helpers/generate-pdf/nfe/get-iss.js +73 -74
- package/lib/application/helpers/generate-pdf/nfe/get-menu-itens.js +198 -199
- package/lib/application/helpers/generate-pdf/nfe/get-nota-cancelada.js +16 -17
- package/lib/application/helpers/generate-pdf/nfe/get-recibo.js +100 -101
- package/lib/application/helpers/generate-pdf/nfe/get-transporte.js +178 -179
- package/lib/application/helpers/generate-pdf/nfe/italico.js +15 -16
- package/lib/application/helpers/generate-pdf/nfe/linha-horizontal-tracejada.js +7 -8
- package/lib/application/helpers/generate-pdf/nfe/linha-horizontal.js +15 -16
- package/lib/application/helpers/generate-pdf/nfe/linha-vertical.js +9 -10
- package/lib/application/helpers/generate-pdf/nfe/load-fontes.js +30 -31
- package/lib/application/helpers/generate-pdf/nfe/negrito.js +15 -16
- package/lib/application/helpers/generate-pdf/nfe/normal.js +15 -16
- package/lib/application/helpers/generate-pdf/nfe/options-doc.js +14 -14
- package/lib/application/helpers/generate-pdf/nfe/secao.js +16 -17
- package/lib/application/helpers/generate-pdf/nfe/titulo.js +16 -17
- package/lib/application/helpers/xml/deserialize.js +24 -25
- package/lib/application/helpers/xml/index.js +17 -17
- package/lib/domain/use-cases/pdf/index.js +25 -26
- package/lib/domain/use-cases/pdf/pdf-NFCe.js +688 -688
- package/lib/domain/use-cases/pdf/pdf-NFe.js +54 -54
- package/lib/domain/use-cases/utils/current-date.js +8 -12
- package/lib/domain/use-cases/utils/format-cnpj.js +8 -9
- package/lib/domain/use-cases/utils/format-cpf.js +8 -9
- package/lib/domain/use-cases/utils/format-date-time.js +10 -11
- package/lib/domain/use-cases/utils/format-date.js +9 -10
- package/lib/domain/use-cases/utils/format-key.js +6 -7
- package/lib/domain/use-cases/utils/format-number.js +6 -7
- package/lib/domain/use-cases/utils/format-phone.js +20 -21
- package/lib/domain/use-cases/utils/format-plate.js +16 -17
- package/lib/domain/use-cases/utils/format-postal-code.js +12 -9
- package/lib/domain/use-cases/utils/format-protocol.js +8 -9
- package/lib/domain/use-cases/utils/format-state-registration.js +49 -50
- package/lib/domain/use-cases/utils/format-time.js +8 -9
- package/lib/domain/use-cases/utils/index.js +30 -30
- package/lib/domain/use-cases/utils/return-font-size-carrier.js +23 -24
- package/lib/index.js +5 -5
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/lib/types/generate-pdf.js +2 -2
- package/lib/types/index.js +19 -19
- package/lib/types/nfe-proc.js +2 -2
- package/lib/types/schema.js +2 -2
- package/package.json +76 -72
- package/lib/application/helpers/generate-pdf/nfe/campo.d.ts +0 -2
- package/lib/application/helpers/generate-pdf/nfe/cria-layout.d.ts +0 -2
- package/lib/application/helpers/generate-pdf/nfe/default.d.ts +0 -23
- package/lib/application/helpers/generate-pdf/nfe/gerar-itens.d.ts +0 -2
- package/lib/application/helpers/generate-pdf/nfe/get-dados-adicionais.d.ts +0 -2
- package/lib/application/helpers/generate-pdf/nfe/get-dados-emitente.d.ts +0 -2
- package/lib/application/helpers/generate-pdf/nfe/get-destinatario-remetente.d.ts +0 -2
- package/lib/application/helpers/generate-pdf/nfe/get-fatura-duplicata.d.ts +0 -2
- package/lib/application/helpers/generate-pdf/nfe/get-homologacao.d.ts +0 -2
- package/lib/application/helpers/generate-pdf/nfe/get-imposto.d.ts +0 -2
- package/lib/application/helpers/generate-pdf/nfe/get-iss.d.ts +0 -2
- package/lib/application/helpers/generate-pdf/nfe/get-menu-itens.d.ts +0 -2
- package/lib/application/helpers/generate-pdf/nfe/get-nota-cancelada.d.ts +0 -2
- package/lib/application/helpers/generate-pdf/nfe/get-recibo.d.ts +0 -2
- package/lib/application/helpers/generate-pdf/nfe/get-transporte.d.ts +0 -2
- package/lib/application/helpers/generate-pdf/nfe/italico.d.ts +0 -2
- package/lib/application/helpers/generate-pdf/nfe/linha-horizontal-tracejada.d.ts +0 -2
- package/lib/application/helpers/generate-pdf/nfe/linha-horizontal.d.ts +0 -2
- package/lib/application/helpers/generate-pdf/nfe/linha-vertical.d.ts +0 -2
- package/lib/application/helpers/generate-pdf/nfe/load-fontes.d.ts +0 -3
- package/lib/application/helpers/generate-pdf/nfe/negrito.d.ts +0 -2
- package/lib/application/helpers/generate-pdf/nfe/normal.d.ts +0 -2
- package/lib/application/helpers/generate-pdf/nfe/options-doc.d.ts +0 -10
- package/lib/application/helpers/generate-pdf/nfe/secao.d.ts +0 -2
- package/lib/application/helpers/generate-pdf/nfe/titulo.d.ts +0 -2
- package/lib/application/helpers/xml/deserialize.d.ts +0 -2
- package/lib/application/helpers/xml/index.d.ts +0 -1
- package/lib/domain/use-cases/pdf/index.d.ts +0 -3
- package/lib/domain/use-cases/pdf/pdf-NFCe.d.ts +0 -3
- package/lib/domain/use-cases/pdf/pdf-NFe.d.ts +0 -3
- package/lib/domain/use-cases/utils/current-date.d.ts +0 -1
- package/lib/domain/use-cases/utils/format-cnpj.d.ts +0 -1
- package/lib/domain/use-cases/utils/format-cpf.d.ts +0 -1
- package/lib/domain/use-cases/utils/format-date-time.d.ts +0 -1
- package/lib/domain/use-cases/utils/format-date.d.ts +0 -1
- package/lib/domain/use-cases/utils/format-key.d.ts +0 -1
- package/lib/domain/use-cases/utils/format-number.d.ts +0 -1
- package/lib/domain/use-cases/utils/format-phone.d.ts +0 -1
- package/lib/domain/use-cases/utils/format-plate.d.ts +0 -1
- package/lib/domain/use-cases/utils/format-postal-code.d.ts +0 -1
- package/lib/domain/use-cases/utils/format-protocol.d.ts +0 -1
- package/lib/domain/use-cases/utils/format-state-registration.d.ts +0 -1
- package/lib/domain/use-cases/utils/format-time.d.ts +0 -1
- package/lib/domain/use-cases/utils/index.d.ts +0 -14
- package/lib/domain/use-cases/utils/return-font-size-carrier.d.ts +0 -1
- package/lib/index.d.ts +0 -1
- package/lib/types/generate-pdf.d.ts +0 -259
- package/lib/types/index.d.ts +0 -3
- package/lib/types/nfe-proc.d.ts +0 -42
- package/lib/types/schema.d.ts +0 -875
|
@@ -1,277 +1,276 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.gerarItens =
|
|
4
|
-
const utils_1 = require("../../../../domain/use-cases/utils");
|
|
5
|
-
const cria_layout_1 = require("./cria-layout");
|
|
6
|
-
const default_1 = require("./default");
|
|
7
|
-
const linha_horizontal_tracejada_1 = require("./linha-horizontal-tracejada");
|
|
8
|
-
const normal_1 = require("./normal");
|
|
9
|
-
const options_doc_1 = require("./options-doc");
|
|
10
|
-
async function gerarItens({ nf, ajusteX, ajusteY, doc, margemEsquerda, margemTopo, margemDireita, larguraDoFormulario, pathLogo, cancelada }) {
|
|
11
|
-
let folha = 0;
|
|
12
|
-
await (0, cria_layout_1.criaLayout)({
|
|
13
|
-
ajusteX,
|
|
14
|
-
ajusteY,
|
|
15
|
-
nf,
|
|
16
|
-
doc,
|
|
17
|
-
larguraDoFormulario,
|
|
18
|
-
margemDireita,
|
|
19
|
-
margemEsquerda,
|
|
20
|
-
margemTopo,
|
|
21
|
-
pathLogo,
|
|
22
|
-
folha,
|
|
23
|
-
cancelada
|
|
24
|
-
});
|
|
25
|
-
let maiorY = doc.y;
|
|
26
|
-
for (let i = 0; i < nf.NFe.infNFe.det.length; i++) {
|
|
27
|
-
const item = nf.NFe.infNFe.det[i];
|
|
28
|
-
function renderizarLinha(pdf) {
|
|
29
|
-
const y = maiorY + 2;
|
|
30
|
-
(0, normal_1.normal)({
|
|
31
|
-
doc,
|
|
32
|
-
value: item.prod.cProd,
|
|
33
|
-
x: 1.5,
|
|
34
|
-
y,
|
|
35
|
-
largura: 51,
|
|
36
|
-
alinhamento: 'center',
|
|
37
|
-
tamanho: default_1.DEFAULT_NFE.tamanhoDaFonteDosItens,
|
|
38
|
-
ajusteX,
|
|
39
|
-
ajusteY,
|
|
40
|
-
margemEsquerda,
|
|
41
|
-
margemTopo
|
|
42
|
-
});
|
|
43
|
-
(0, normal_1.normal)({
|
|
44
|
-
doc,
|
|
45
|
-
value: item.prod.xProd,
|
|
46
|
-
x: 55.5,
|
|
47
|
-
y,
|
|
48
|
-
largura: 178,
|
|
49
|
-
alinhamento: 'justify',
|
|
50
|
-
tamanho: default_1.DEFAULT_NFE.tamanhoDaFonteDosItens,
|
|
51
|
-
ajusteX,
|
|
52
|
-
ajusteY,
|
|
53
|
-
margemEsquerda,
|
|
54
|
-
margemTopo
|
|
55
|
-
});
|
|
56
|
-
maiorY = Math.max(maiorY, pdf.y);
|
|
57
|
-
(0, normal_1.normal)({
|
|
58
|
-
doc,
|
|
59
|
-
value: item.prod.NCM,
|
|
60
|
-
x: 235.5,
|
|
61
|
-
y,
|
|
62
|
-
largura: 32.5,
|
|
63
|
-
alinhamento: 'center',
|
|
64
|
-
tamanho: default_1.DEFAULT_NFE.tamanhoDaFonteDosItens,
|
|
65
|
-
ajusteX,
|
|
66
|
-
ajusteY,
|
|
67
|
-
margemEsquerda,
|
|
68
|
-
margemTopo
|
|
69
|
-
});
|
|
70
|
-
maiorY = Math.max(maiorY, pdf.y);
|
|
71
|
-
(0, normal_1.normal)({
|
|
72
|
-
doc,
|
|
73
|
-
value: item.prod.CFOP,
|
|
74
|
-
x: 293.5,
|
|
75
|
-
y,
|
|
76
|
-
largura: 21,
|
|
77
|
-
alinhamento: 'center',
|
|
78
|
-
tamanho: default_1.DEFAULT_NFE.tamanhoDaFonteDosItens,
|
|
79
|
-
ajusteX,
|
|
80
|
-
ajusteY,
|
|
81
|
-
margemEsquerda,
|
|
82
|
-
margemTopo
|
|
83
|
-
});
|
|
84
|
-
maiorY = Math.max(maiorY, pdf.y);
|
|
85
|
-
(0, normal_1.normal)({
|
|
86
|
-
doc,
|
|
87
|
-
value: item.prod.uCom,
|
|
88
|
-
x: 315.5,
|
|
89
|
-
y,
|
|
90
|
-
largura: 16.5,
|
|
91
|
-
alinhamento: 'center',
|
|
92
|
-
tamanho: default_1.DEFAULT_NFE.tamanhoDaFonteDosItens,
|
|
93
|
-
ajusteX,
|
|
94
|
-
ajusteY,
|
|
95
|
-
margemEsquerda,
|
|
96
|
-
margemTopo
|
|
97
|
-
});
|
|
98
|
-
maiorY = Math.max(maiorY, pdf.y);
|
|
99
|
-
(0, normal_1.normal)({
|
|
100
|
-
doc,
|
|
101
|
-
value: (0, utils_1.formatNumber)(item.prod.qCom, 4),
|
|
102
|
-
x: 335,
|
|
103
|
-
y,
|
|
104
|
-
largura: 37,
|
|
105
|
-
alinhamento: 'center',
|
|
106
|
-
tamanho: default_1.DEFAULT_NFE.tamanhoDaFonteDosItens,
|
|
107
|
-
ajusteX,
|
|
108
|
-
ajusteY,
|
|
109
|
-
margemEsquerda,
|
|
110
|
-
margemTopo
|
|
111
|
-
});
|
|
112
|
-
maiorY = Math.max(maiorY, pdf.y);
|
|
113
|
-
(0, normal_1.normal)({
|
|
114
|
-
doc,
|
|
115
|
-
value: (0, utils_1.formatNumber)(item.prod.vUnCom, 2),
|
|
116
|
-
x: 375,
|
|
117
|
-
y,
|
|
118
|
-
largura: 32.5,
|
|
119
|
-
alinhamento: 'center',
|
|
120
|
-
tamanho: default_1.DEFAULT_NFE.tamanhoDaFonteDosItens,
|
|
121
|
-
ajusteX,
|
|
122
|
-
ajusteY,
|
|
123
|
-
margemEsquerda,
|
|
124
|
-
margemTopo
|
|
125
|
-
});
|
|
126
|
-
maiorY = Math.max(maiorY, pdf.y);
|
|
127
|
-
(0, normal_1.normal)({
|
|
128
|
-
doc,
|
|
129
|
-
value: (0, utils_1.formatNumber)(item.prod.vProd, 2),
|
|
130
|
-
x: 409.5,
|
|
131
|
-
y,
|
|
132
|
-
largura: 31,
|
|
133
|
-
alinhamento: 'center',
|
|
134
|
-
tamanho: default_1.DEFAULT_NFE.tamanhoDaFonteDosItens,
|
|
135
|
-
ajusteX,
|
|
136
|
-
ajusteY,
|
|
137
|
-
margemEsquerda,
|
|
138
|
-
margemTopo
|
|
139
|
-
});
|
|
140
|
-
maiorY = Math.max(maiorY, pdf.y);
|
|
141
|
-
const keys = Object.keys(item.imposto);
|
|
142
|
-
for (let i = 0; i < keys.length; i++) {
|
|
143
|
-
if (keys[i].includes('ICMS') && !keys[i].includes('UFDest')) {
|
|
144
|
-
const newKeys = Object.keys(item.imposto[keys[i]]);
|
|
145
|
-
(0, normal_1.normal)({
|
|
146
|
-
doc,
|
|
147
|
-
value: item.imposto[keys[i]][newKeys[0]].CST
|
|
148
|
-
? `${item.imposto[keys[i]][newKeys[0]].orig}/${item.imposto[keys[i]][newKeys[0]].CST}`
|
|
149
|
-
: '',
|
|
150
|
-
x: 270,
|
|
151
|
-
y,
|
|
152
|
-
largura: 21,
|
|
153
|
-
alinhamento: 'center',
|
|
154
|
-
tamanho: default_1.DEFAULT_NFE.tamanhoDaFonteDosItens,
|
|
155
|
-
ajusteX,
|
|
156
|
-
ajusteY,
|
|
157
|
-
margemEsquerda,
|
|
158
|
-
margemTopo
|
|
159
|
-
});
|
|
160
|
-
(0, normal_1.normal)({
|
|
161
|
-
doc,
|
|
162
|
-
value: item.imposto[keys[i]][newKeys[0]].CSOSN
|
|
163
|
-
? `${item.imposto[keys[i]][newKeys[0]].orig}/${item.imposto[keys[i]][newKeys[0]].CSOSN}`
|
|
164
|
-
: '',
|
|
165
|
-
x: 270,
|
|
166
|
-
y,
|
|
167
|
-
largura: 21,
|
|
168
|
-
alinhamento: 'center',
|
|
169
|
-
tamanho: default_1.DEFAULT_NFE.tamanhoDaFonteDosItens,
|
|
170
|
-
ajusteX,
|
|
171
|
-
ajusteY,
|
|
172
|
-
margemEsquerda,
|
|
173
|
-
margemTopo
|
|
174
|
-
});
|
|
175
|
-
maiorY = Math.max(maiorY, pdf.y);
|
|
176
|
-
(0, normal_1.normal)({
|
|
177
|
-
doc,
|
|
178
|
-
value: (0, utils_1.formatNumber)(item.imposto[keys[i]][newKeys[0]].vBC ?? 0, 2),
|
|
179
|
-
x: 443,
|
|
180
|
-
y,
|
|
181
|
-
largura: 32.5,
|
|
182
|
-
alinhamento: 'center',
|
|
183
|
-
tamanho: default_1.DEFAULT_NFE.tamanhoDaFonteDosItens,
|
|
184
|
-
ajusteX,
|
|
185
|
-
ajusteY,
|
|
186
|
-
margemEsquerda,
|
|
187
|
-
margemTopo
|
|
188
|
-
});
|
|
189
|
-
maiorY = Math.max(maiorY, pdf.y);
|
|
190
|
-
(0, normal_1.normal)({
|
|
191
|
-
doc,
|
|
192
|
-
value: (0, utils_1.formatNumber)(item.imposto[keys[i]][newKeys[0]].vICMS ?? 0, 2),
|
|
193
|
-
x: 476,
|
|
194
|
-
y,
|
|
195
|
-
largura: 32,
|
|
196
|
-
alinhamento: 'center',
|
|
197
|
-
tamanho: default_1.DEFAULT_NFE.tamanhoDaFonteDosItens,
|
|
198
|
-
ajusteX,
|
|
199
|
-
ajusteY,
|
|
200
|
-
margemEsquerda,
|
|
201
|
-
margemTopo
|
|
202
|
-
});
|
|
203
|
-
maiorY = Math.max(maiorY, pdf.y);
|
|
204
|
-
(0, normal_1.normal)({
|
|
205
|
-
doc,
|
|
206
|
-
value: (0, utils_1.formatNumber)(item.imposto[keys[i]][newKeys[0]].pICMS ?? 0, 2),
|
|
207
|
-
x: 532,
|
|
208
|
-
y: y + 0.65,
|
|
209
|
-
largura: 28,
|
|
210
|
-
alinhamento: 'center',
|
|
211
|
-
tamanho: default_1.DEFAULT_NFE.tamanhoDaFonteDosItens,
|
|
212
|
-
ajusteX,
|
|
213
|
-
ajusteY,
|
|
214
|
-
margemEsquerda,
|
|
215
|
-
margemTopo
|
|
216
|
-
});
|
|
217
|
-
maiorY = Math.max(maiorY, pdf.y);
|
|
218
|
-
}
|
|
219
|
-
}
|
|
220
|
-
(0, normal_1.normal)({
|
|
221
|
-
doc,
|
|
222
|
-
value: (0, utils_1.formatNumber)(item.imposto.IPI?.IPITrib?.vIPI ?? 0, 2),
|
|
223
|
-
x: 507.5,
|
|
224
|
-
y,
|
|
225
|
-
largura: 26,
|
|
226
|
-
alinhamento: 'center',
|
|
227
|
-
tamanho: default_1.DEFAULT_NFE.tamanhoDaFonteDosItens,
|
|
228
|
-
ajusteX,
|
|
229
|
-
ajusteY,
|
|
230
|
-
margemEsquerda,
|
|
231
|
-
margemTopo
|
|
232
|
-
});
|
|
233
|
-
maiorY = Math.max(maiorY, pdf.y);
|
|
234
|
-
(0, normal_1.normal)({
|
|
235
|
-
doc,
|
|
236
|
-
value: (0, utils_1.formatNumber)(item.imposto.IPI?.IPITrib?.pIPI ?? 0, 2),
|
|
237
|
-
x: 557.75,
|
|
238
|
-
y,
|
|
239
|
-
largura: 29,
|
|
240
|
-
alinhamento: 'center',
|
|
241
|
-
tamanho: default_1.DEFAULT_NFE.tamanhoDaFonteDosItens,
|
|
242
|
-
ajusteX,
|
|
243
|
-
ajusteY,
|
|
244
|
-
margemEsquerda,
|
|
245
|
-
margemTopo
|
|
246
|
-
});
|
|
247
|
-
maiorY = Math.max(maiorY, pdf.y);
|
|
248
|
-
return Number(maiorY) + (default_1.DEFAULT_NFE.separadorDeItens !== undefined ? 2 : 0);
|
|
249
|
-
}
|
|
250
|
-
maiorY = renderizarLinha(doc);
|
|
251
|
-
if (doc.y > (folha === 0 ? default_1.DEFAULT_NFE.finalTamanhoDet1 - 26 : 800)) {
|
|
252
|
-
doc.addPage(options_doc_1.optionsDocNFe);
|
|
253
|
-
doc.y = 0;
|
|
254
|
-
folha++;
|
|
255
|
-
await (0, cria_layout_1.criaLayout)({
|
|
256
|
-
ajusteX,
|
|
257
|
-
ajusteY,
|
|
258
|
-
nf,
|
|
259
|
-
doc,
|
|
260
|
-
larguraDoFormulario,
|
|
261
|
-
margemDireita,
|
|
262
|
-
margemEsquerda,
|
|
263
|
-
margemTopo,
|
|
264
|
-
pathLogo,
|
|
265
|
-
folha,
|
|
266
|
-
cancelada
|
|
267
|
-
});
|
|
268
|
-
maiorY = doc.y;
|
|
269
|
-
}
|
|
270
|
-
else {
|
|
271
|
-
if (default_1.DEFAULT_NFE.separadorDeItens !== undefined) {
|
|
272
|
-
(0, linha_horizontal_tracejada_1.linhaHorizontalTracejada)({ x1: 0, x2: 0, y: maiorY - 1, doc, ajusteX, ajusteY, margemDireita, margemEsquerda, margemTopo });
|
|
273
|
-
}
|
|
274
|
-
}
|
|
275
|
-
}
|
|
276
|
-
}
|
|
277
|
-
exports.gerarItens = gerarItens;
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.gerarItens = gerarItens;
|
|
4
|
+
const utils_1 = require("../../../../domain/use-cases/utils");
|
|
5
|
+
const cria_layout_1 = require("./cria-layout");
|
|
6
|
+
const default_1 = require("./default");
|
|
7
|
+
const linha_horizontal_tracejada_1 = require("./linha-horizontal-tracejada");
|
|
8
|
+
const normal_1 = require("./normal");
|
|
9
|
+
const options_doc_1 = require("./options-doc");
|
|
10
|
+
async function gerarItens({ nf, ajusteX, ajusteY, doc, margemEsquerda, margemTopo, margemDireita, larguraDoFormulario, pathLogo, cancelada }) {
|
|
11
|
+
let folha = 0;
|
|
12
|
+
await (0, cria_layout_1.criaLayout)({
|
|
13
|
+
ajusteX,
|
|
14
|
+
ajusteY,
|
|
15
|
+
nf,
|
|
16
|
+
doc,
|
|
17
|
+
larguraDoFormulario,
|
|
18
|
+
margemDireita,
|
|
19
|
+
margemEsquerda,
|
|
20
|
+
margemTopo,
|
|
21
|
+
pathLogo,
|
|
22
|
+
folha,
|
|
23
|
+
cancelada
|
|
24
|
+
});
|
|
25
|
+
let maiorY = doc.y;
|
|
26
|
+
for (let i = 0; i < nf.NFe.infNFe.det.length; i++) {
|
|
27
|
+
const item = nf.NFe.infNFe.det[i];
|
|
28
|
+
function renderizarLinha(pdf) {
|
|
29
|
+
const y = maiorY + 2;
|
|
30
|
+
(0, normal_1.normal)({
|
|
31
|
+
doc,
|
|
32
|
+
value: item.prod.cProd,
|
|
33
|
+
x: 1.5,
|
|
34
|
+
y,
|
|
35
|
+
largura: 51,
|
|
36
|
+
alinhamento: 'center',
|
|
37
|
+
tamanho: default_1.DEFAULT_NFE.tamanhoDaFonteDosItens,
|
|
38
|
+
ajusteX,
|
|
39
|
+
ajusteY,
|
|
40
|
+
margemEsquerda,
|
|
41
|
+
margemTopo
|
|
42
|
+
});
|
|
43
|
+
(0, normal_1.normal)({
|
|
44
|
+
doc,
|
|
45
|
+
value: item.prod.xProd,
|
|
46
|
+
x: 55.5,
|
|
47
|
+
y,
|
|
48
|
+
largura: 178,
|
|
49
|
+
alinhamento: 'justify',
|
|
50
|
+
tamanho: default_1.DEFAULT_NFE.tamanhoDaFonteDosItens,
|
|
51
|
+
ajusteX,
|
|
52
|
+
ajusteY,
|
|
53
|
+
margemEsquerda,
|
|
54
|
+
margemTopo
|
|
55
|
+
});
|
|
56
|
+
maiorY = Math.max(maiorY, pdf.y);
|
|
57
|
+
(0, normal_1.normal)({
|
|
58
|
+
doc,
|
|
59
|
+
value: item.prod.NCM,
|
|
60
|
+
x: 235.5,
|
|
61
|
+
y,
|
|
62
|
+
largura: 32.5,
|
|
63
|
+
alinhamento: 'center',
|
|
64
|
+
tamanho: default_1.DEFAULT_NFE.tamanhoDaFonteDosItens,
|
|
65
|
+
ajusteX,
|
|
66
|
+
ajusteY,
|
|
67
|
+
margemEsquerda,
|
|
68
|
+
margemTopo
|
|
69
|
+
});
|
|
70
|
+
maiorY = Math.max(maiorY, pdf.y);
|
|
71
|
+
(0, normal_1.normal)({
|
|
72
|
+
doc,
|
|
73
|
+
value: item.prod.CFOP,
|
|
74
|
+
x: 293.5,
|
|
75
|
+
y,
|
|
76
|
+
largura: 21,
|
|
77
|
+
alinhamento: 'center',
|
|
78
|
+
tamanho: default_1.DEFAULT_NFE.tamanhoDaFonteDosItens,
|
|
79
|
+
ajusteX,
|
|
80
|
+
ajusteY,
|
|
81
|
+
margemEsquerda,
|
|
82
|
+
margemTopo
|
|
83
|
+
});
|
|
84
|
+
maiorY = Math.max(maiorY, pdf.y);
|
|
85
|
+
(0, normal_1.normal)({
|
|
86
|
+
doc,
|
|
87
|
+
value: item.prod.uCom,
|
|
88
|
+
x: 315.5,
|
|
89
|
+
y,
|
|
90
|
+
largura: 16.5,
|
|
91
|
+
alinhamento: 'center',
|
|
92
|
+
tamanho: default_1.DEFAULT_NFE.tamanhoDaFonteDosItens,
|
|
93
|
+
ajusteX,
|
|
94
|
+
ajusteY,
|
|
95
|
+
margemEsquerda,
|
|
96
|
+
margemTopo
|
|
97
|
+
});
|
|
98
|
+
maiorY = Math.max(maiorY, pdf.y);
|
|
99
|
+
(0, normal_1.normal)({
|
|
100
|
+
doc,
|
|
101
|
+
value: (0, utils_1.formatNumber)(item.prod.qCom, 4),
|
|
102
|
+
x: 335,
|
|
103
|
+
y,
|
|
104
|
+
largura: 37,
|
|
105
|
+
alinhamento: 'center',
|
|
106
|
+
tamanho: default_1.DEFAULT_NFE.tamanhoDaFonteDosItens,
|
|
107
|
+
ajusteX,
|
|
108
|
+
ajusteY,
|
|
109
|
+
margemEsquerda,
|
|
110
|
+
margemTopo
|
|
111
|
+
});
|
|
112
|
+
maiorY = Math.max(maiorY, pdf.y);
|
|
113
|
+
(0, normal_1.normal)({
|
|
114
|
+
doc,
|
|
115
|
+
value: (0, utils_1.formatNumber)(item.prod.vUnCom, 2),
|
|
116
|
+
x: 375,
|
|
117
|
+
y,
|
|
118
|
+
largura: 32.5,
|
|
119
|
+
alinhamento: 'center',
|
|
120
|
+
tamanho: default_1.DEFAULT_NFE.tamanhoDaFonteDosItens,
|
|
121
|
+
ajusteX,
|
|
122
|
+
ajusteY,
|
|
123
|
+
margemEsquerda,
|
|
124
|
+
margemTopo
|
|
125
|
+
});
|
|
126
|
+
maiorY = Math.max(maiorY, pdf.y);
|
|
127
|
+
(0, normal_1.normal)({
|
|
128
|
+
doc,
|
|
129
|
+
value: (0, utils_1.formatNumber)(item.prod.vProd, 2),
|
|
130
|
+
x: 409.5,
|
|
131
|
+
y,
|
|
132
|
+
largura: 31,
|
|
133
|
+
alinhamento: 'center',
|
|
134
|
+
tamanho: default_1.DEFAULT_NFE.tamanhoDaFonteDosItens,
|
|
135
|
+
ajusteX,
|
|
136
|
+
ajusteY,
|
|
137
|
+
margemEsquerda,
|
|
138
|
+
margemTopo
|
|
139
|
+
});
|
|
140
|
+
maiorY = Math.max(maiorY, pdf.y);
|
|
141
|
+
const keys = Object.keys(item.imposto);
|
|
142
|
+
for (let i = 0; i < keys.length; i++) {
|
|
143
|
+
if (keys[i].includes('ICMS') && !keys[i].includes('UFDest')) {
|
|
144
|
+
const newKeys = Object.keys(item.imposto[keys[i]]);
|
|
145
|
+
(0, normal_1.normal)({
|
|
146
|
+
doc,
|
|
147
|
+
value: item.imposto[keys[i]][newKeys[0]].CST
|
|
148
|
+
? `${item.imposto[keys[i]][newKeys[0]].orig}/${item.imposto[keys[i]][newKeys[0]].CST}`
|
|
149
|
+
: '',
|
|
150
|
+
x: 270,
|
|
151
|
+
y,
|
|
152
|
+
largura: 21,
|
|
153
|
+
alinhamento: 'center',
|
|
154
|
+
tamanho: default_1.DEFAULT_NFE.tamanhoDaFonteDosItens,
|
|
155
|
+
ajusteX,
|
|
156
|
+
ajusteY,
|
|
157
|
+
margemEsquerda,
|
|
158
|
+
margemTopo
|
|
159
|
+
});
|
|
160
|
+
(0, normal_1.normal)({
|
|
161
|
+
doc,
|
|
162
|
+
value: item.imposto[keys[i]][newKeys[0]].CSOSN
|
|
163
|
+
? `${item.imposto[keys[i]][newKeys[0]].orig}/${item.imposto[keys[i]][newKeys[0]].CSOSN}`
|
|
164
|
+
: '',
|
|
165
|
+
x: 270,
|
|
166
|
+
y,
|
|
167
|
+
largura: 21,
|
|
168
|
+
alinhamento: 'center',
|
|
169
|
+
tamanho: default_1.DEFAULT_NFE.tamanhoDaFonteDosItens,
|
|
170
|
+
ajusteX,
|
|
171
|
+
ajusteY,
|
|
172
|
+
margemEsquerda,
|
|
173
|
+
margemTopo
|
|
174
|
+
});
|
|
175
|
+
maiorY = Math.max(maiorY, pdf.y);
|
|
176
|
+
(0, normal_1.normal)({
|
|
177
|
+
doc,
|
|
178
|
+
value: (0, utils_1.formatNumber)(item.imposto[keys[i]][newKeys[0]].vBC ?? 0, 2),
|
|
179
|
+
x: 443,
|
|
180
|
+
y,
|
|
181
|
+
largura: 32.5,
|
|
182
|
+
alinhamento: 'center',
|
|
183
|
+
tamanho: default_1.DEFAULT_NFE.tamanhoDaFonteDosItens,
|
|
184
|
+
ajusteX,
|
|
185
|
+
ajusteY,
|
|
186
|
+
margemEsquerda,
|
|
187
|
+
margemTopo
|
|
188
|
+
});
|
|
189
|
+
maiorY = Math.max(maiorY, pdf.y);
|
|
190
|
+
(0, normal_1.normal)({
|
|
191
|
+
doc,
|
|
192
|
+
value: (0, utils_1.formatNumber)(item.imposto[keys[i]][newKeys[0]].vICMS ?? 0, 2),
|
|
193
|
+
x: 476,
|
|
194
|
+
y,
|
|
195
|
+
largura: 32,
|
|
196
|
+
alinhamento: 'center',
|
|
197
|
+
tamanho: default_1.DEFAULT_NFE.tamanhoDaFonteDosItens,
|
|
198
|
+
ajusteX,
|
|
199
|
+
ajusteY,
|
|
200
|
+
margemEsquerda,
|
|
201
|
+
margemTopo
|
|
202
|
+
});
|
|
203
|
+
maiorY = Math.max(maiorY, pdf.y);
|
|
204
|
+
(0, normal_1.normal)({
|
|
205
|
+
doc,
|
|
206
|
+
value: (0, utils_1.formatNumber)(item.imposto[keys[i]][newKeys[0]].pICMS ?? 0, 2),
|
|
207
|
+
x: 532,
|
|
208
|
+
y: y + 0.65,
|
|
209
|
+
largura: 28,
|
|
210
|
+
alinhamento: 'center',
|
|
211
|
+
tamanho: default_1.DEFAULT_NFE.tamanhoDaFonteDosItens,
|
|
212
|
+
ajusteX,
|
|
213
|
+
ajusteY,
|
|
214
|
+
margemEsquerda,
|
|
215
|
+
margemTopo
|
|
216
|
+
});
|
|
217
|
+
maiorY = Math.max(maiorY, pdf.y);
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
(0, normal_1.normal)({
|
|
221
|
+
doc,
|
|
222
|
+
value: (0, utils_1.formatNumber)(item.imposto.IPI?.IPITrib?.vIPI ?? 0, 2),
|
|
223
|
+
x: 507.5,
|
|
224
|
+
y,
|
|
225
|
+
largura: 26,
|
|
226
|
+
alinhamento: 'center',
|
|
227
|
+
tamanho: default_1.DEFAULT_NFE.tamanhoDaFonteDosItens,
|
|
228
|
+
ajusteX,
|
|
229
|
+
ajusteY,
|
|
230
|
+
margemEsquerda,
|
|
231
|
+
margemTopo
|
|
232
|
+
});
|
|
233
|
+
maiorY = Math.max(maiorY, pdf.y);
|
|
234
|
+
(0, normal_1.normal)({
|
|
235
|
+
doc,
|
|
236
|
+
value: (0, utils_1.formatNumber)(item.imposto.IPI?.IPITrib?.pIPI ?? 0, 2),
|
|
237
|
+
x: 557.75,
|
|
238
|
+
y,
|
|
239
|
+
largura: 29,
|
|
240
|
+
alinhamento: 'center',
|
|
241
|
+
tamanho: default_1.DEFAULT_NFE.tamanhoDaFonteDosItens,
|
|
242
|
+
ajusteX,
|
|
243
|
+
ajusteY,
|
|
244
|
+
margemEsquerda,
|
|
245
|
+
margemTopo
|
|
246
|
+
});
|
|
247
|
+
maiorY = Math.max(maiorY, pdf.y);
|
|
248
|
+
return Number(maiorY) + (default_1.DEFAULT_NFE.separadorDeItens !== undefined ? 2 : 0);
|
|
249
|
+
}
|
|
250
|
+
maiorY = renderizarLinha(doc);
|
|
251
|
+
if (doc.y > (folha === 0 ? default_1.DEFAULT_NFE.finalTamanhoDet1 - 26 : 800)) {
|
|
252
|
+
doc.addPage(options_doc_1.optionsDocNFe);
|
|
253
|
+
doc.y = 0;
|
|
254
|
+
folha++;
|
|
255
|
+
await (0, cria_layout_1.criaLayout)({
|
|
256
|
+
ajusteX,
|
|
257
|
+
ajusteY,
|
|
258
|
+
nf,
|
|
259
|
+
doc,
|
|
260
|
+
larguraDoFormulario,
|
|
261
|
+
margemDireita,
|
|
262
|
+
margemEsquerda,
|
|
263
|
+
margemTopo,
|
|
264
|
+
pathLogo,
|
|
265
|
+
folha,
|
|
266
|
+
cancelada
|
|
267
|
+
});
|
|
268
|
+
maiorY = doc.y;
|
|
269
|
+
}
|
|
270
|
+
else {
|
|
271
|
+
if (default_1.DEFAULT_NFE.separadorDeItens !== undefined) {
|
|
272
|
+
(0, linha_horizontal_tracejada_1.linhaHorizontalTracejada)({ x1: 0, x2: 0, y: maiorY - 1, doc, ajusteX, ajusteY, margemDireita, margemEsquerda, margemTopo });
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
}
|
|
@@ -1,53 +1,52 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getDadosAdicionais =
|
|
4
|
-
const linha_horizontal_1 = require("./linha-horizontal");
|
|
5
|
-
const linha_vertical_1 = require("./linha-vertical");
|
|
6
|
-
const normal_1 = require("./normal");
|
|
7
|
-
const secao_1 = require("./secao");
|
|
8
|
-
const titulo_1 = require("./titulo");
|
|
9
|
-
function getDadosAdicionais({ doc, ajusteX, ajusteY, margemEsquerda, margemTopo, margemDireita, larguraDoFormulario, infAdic, finalEspacoDet }) {
|
|
10
|
-
(0, linha_horizontal_1.linhaHorizontal)({ x1: 0, x2: 0, y: finalEspacoDet + 8, doc, ajusteX, ajusteY, margemDireita, margemEsquerda, margemTopo });
|
|
11
|
-
(0, linha_horizontal_1.linhaHorizontal)({ x1: 0, x2: 0, y: 821.8, doc, ajusteX, ajusteY, margemDireita, margemEsquerda, margemTopo });
|
|
12
|
-
(0, linha_vertical_1.linhaVertical)({ y1: finalEspacoDet + 8, y2: 821.8, x: 0, doc, ajusteX, ajusteY, margemEsquerda, margemTopo });
|
|
13
|
-
(0, linha_vertical_1.linhaVertical)({ y1: finalEspacoDet + 8, y2: 821.8, x: 388.25, doc, ajusteX, ajusteY, margemEsquerda, margemTopo });
|
|
14
|
-
(0, linha_vertical_1.linhaVertical)({ y1: finalEspacoDet + 8, y2: 821.8, x: larguraDoFormulario, doc, ajusteX, ajusteY, margemEsquerda, margemTopo });
|
|
15
|
-
(0, secao_1.secao)({ doc, value: 'DADOS ADICIONAIS', x: 1.5, y: finalEspacoDet, largura: 0, ajusteX, ajusteY, margemEsquerda, margemTopo });
|
|
16
|
-
(0, titulo_1.titulo)({
|
|
17
|
-
value: 'INFORMAÇÕES COMPLEMENTARES',
|
|
18
|
-
x: 1.5,
|
|
19
|
-
y: finalEspacoDet + 10,
|
|
20
|
-
largura: 385.5,
|
|
21
|
-
ajusteX,
|
|
22
|
-
ajusteY,
|
|
23
|
-
doc,
|
|
24
|
-
margemEsquerda,
|
|
25
|
-
margemTopo
|
|
26
|
-
});
|
|
27
|
-
(0, titulo_1.titulo)({
|
|
28
|
-
value: 'RESERVADO AO FISCO',
|
|
29
|
-
x: 390,
|
|
30
|
-
y: finalEspacoDet + 10,
|
|
31
|
-
largura: 195,
|
|
32
|
-
ajusteX,
|
|
33
|
-
ajusteY,
|
|
34
|
-
doc,
|
|
35
|
-
margemEsquerda,
|
|
36
|
-
margemTopo
|
|
37
|
-
});
|
|
38
|
-
const informacoesComplementares = [infAdic?.infCpl];
|
|
39
|
-
(0, normal_1.normal)({
|
|
40
|
-
doc,
|
|
41
|
-
value: informacoesComplementares.join(' - '),
|
|
42
|
-
x: 1,
|
|
43
|
-
y: finalEspacoDet + 17.5,
|
|
44
|
-
largura: 386,
|
|
45
|
-
alinhamento: 'justify',
|
|
46
|
-
tamanho: 6,
|
|
47
|
-
ajusteX,
|
|
48
|
-
ajusteY,
|
|
49
|
-
margemEsquerda,
|
|
50
|
-
margemTopo
|
|
51
|
-
});
|
|
52
|
-
}
|
|
53
|
-
exports.getDadosAdicionais = getDadosAdicionais;
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getDadosAdicionais = getDadosAdicionais;
|
|
4
|
+
const linha_horizontal_1 = require("./linha-horizontal");
|
|
5
|
+
const linha_vertical_1 = require("./linha-vertical");
|
|
6
|
+
const normal_1 = require("./normal");
|
|
7
|
+
const secao_1 = require("./secao");
|
|
8
|
+
const titulo_1 = require("./titulo");
|
|
9
|
+
function getDadosAdicionais({ doc, ajusteX, ajusteY, margemEsquerda, margemTopo, margemDireita, larguraDoFormulario, infAdic, finalEspacoDet }) {
|
|
10
|
+
(0, linha_horizontal_1.linhaHorizontal)({ x1: 0, x2: 0, y: finalEspacoDet + 8, doc, ajusteX, ajusteY, margemDireita, margemEsquerda, margemTopo });
|
|
11
|
+
(0, linha_horizontal_1.linhaHorizontal)({ x1: 0, x2: 0, y: 821.8, doc, ajusteX, ajusteY, margemDireita, margemEsquerda, margemTopo });
|
|
12
|
+
(0, linha_vertical_1.linhaVertical)({ y1: finalEspacoDet + 8, y2: 821.8, x: 0, doc, ajusteX, ajusteY, margemEsquerda, margemTopo });
|
|
13
|
+
(0, linha_vertical_1.linhaVertical)({ y1: finalEspacoDet + 8, y2: 821.8, x: 388.25, doc, ajusteX, ajusteY, margemEsquerda, margemTopo });
|
|
14
|
+
(0, linha_vertical_1.linhaVertical)({ y1: finalEspacoDet + 8, y2: 821.8, x: larguraDoFormulario, doc, ajusteX, ajusteY, margemEsquerda, margemTopo });
|
|
15
|
+
(0, secao_1.secao)({ doc, value: 'DADOS ADICIONAIS', x: 1.5, y: finalEspacoDet, largura: 0, ajusteX, ajusteY, margemEsquerda, margemTopo });
|
|
16
|
+
(0, titulo_1.titulo)({
|
|
17
|
+
value: 'INFORMAÇÕES COMPLEMENTARES',
|
|
18
|
+
x: 1.5,
|
|
19
|
+
y: finalEspacoDet + 10,
|
|
20
|
+
largura: 385.5,
|
|
21
|
+
ajusteX,
|
|
22
|
+
ajusteY,
|
|
23
|
+
doc,
|
|
24
|
+
margemEsquerda,
|
|
25
|
+
margemTopo
|
|
26
|
+
});
|
|
27
|
+
(0, titulo_1.titulo)({
|
|
28
|
+
value: 'RESERVADO AO FISCO',
|
|
29
|
+
x: 390,
|
|
30
|
+
y: finalEspacoDet + 10,
|
|
31
|
+
largura: 195,
|
|
32
|
+
ajusteX,
|
|
33
|
+
ajusteY,
|
|
34
|
+
doc,
|
|
35
|
+
margemEsquerda,
|
|
36
|
+
margemTopo
|
|
37
|
+
});
|
|
38
|
+
const informacoesComplementares = [infAdic?.infCpl];
|
|
39
|
+
(0, normal_1.normal)({
|
|
40
|
+
doc,
|
|
41
|
+
value: informacoesComplementares.join(' - '),
|
|
42
|
+
x: 1,
|
|
43
|
+
y: finalEspacoDet + 17.5,
|
|
44
|
+
largura: 386,
|
|
45
|
+
alinhamento: 'justify',
|
|
46
|
+
tamanho: 6,
|
|
47
|
+
ajusteX,
|
|
48
|
+
ajusteY,
|
|
49
|
+
margemEsquerda,
|
|
50
|
+
margemTopo
|
|
51
|
+
});
|
|
52
|
+
}
|