@alexssmusica/node-pdf-nfe 1.1.0 → 1.1.1
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 +15 -1
- package/lib/application/helpers/generate-pdf/nfe/cria-layout.js +143 -1
- package/lib/application/helpers/generate-pdf/nfe/default.js +26 -1
- package/lib/application/helpers/generate-pdf/nfe/gerar-itens.js +275 -1
- package/lib/application/helpers/generate-pdf/nfe/get-dados-adicionais.js +53 -1
- package/lib/application/helpers/generate-pdf/nfe/get-dados-emitente.js +309 -1
- package/lib/application/helpers/generate-pdf/nfe/get-destinatario-remetente.js +123 -1
- package/lib/application/helpers/generate-pdf/nfe/get-fatura-duplicata.js +64 -1
- package/lib/application/helpers/generate-pdf/nfe/get-homologacao.js +26 -1
- package/lib/application/helpers/generate-pdf/nfe/get-imposto.js +219 -1
- package/lib/application/helpers/generate-pdf/nfe/get-iss.js +63 -1
- package/lib/application/helpers/generate-pdf/nfe/get-menu-itens.js +199 -1
- package/lib/application/helpers/generate-pdf/nfe/get-recibo.js +102 -1
- package/lib/application/helpers/generate-pdf/nfe/get-transporte.js +143 -1
- package/lib/application/helpers/generate-pdf/nfe/italico.js +16 -1
- package/lib/application/helpers/generate-pdf/nfe/linha-horizontal-tracejada.js +8 -1
- package/lib/application/helpers/generate-pdf/nfe/linha-horizontal.js +16 -1
- package/lib/application/helpers/generate-pdf/nfe/linha-vertical.js +10 -1
- package/lib/application/helpers/generate-pdf/nfe/load-fontes.js +31 -1
- package/lib/application/helpers/generate-pdf/nfe/negrito.js +16 -1
- package/lib/application/helpers/generate-pdf/nfe/normal.js +16 -1
- package/lib/application/helpers/generate-pdf/nfe/options-doc.js +14 -1
- package/lib/application/helpers/generate-pdf/nfe/secao.js +17 -1
- package/lib/application/helpers/generate-pdf/nfe/titulo.js +17 -1
- package/lib/application/helpers/xml/deserialize.js +25 -1
- package/lib/application/helpers/xml/index.js +17 -1
- package/lib/domain/use-cases/pdf/index.js +26 -1
- package/lib/domain/use-cases/pdf/pdf-NFCe.js +688 -1
- package/lib/domain/use-cases/pdf/pdf-NFe.js +43 -1
- package/lib/domain/use-cases/utils/data-atual.js +12 -1
- package/lib/domain/use-cases/utils/index.js +18 -1
- package/lib/domain/use-cases/utils/intl-number-format.js +7 -1
- package/lib/index.js +5 -1
- package/lib/tsconfig.tsbuildinfo +1 -0
- package/lib/types/generate-pdf.js +2 -1
- package/lib/types/index.js +19 -1
- package/lib/types/nfe-proc.js +2 -1
- package/lib/types/schema.js +2 -1
- package/package.json +3 -9
|
@@ -1 +1,309 @@
|
|
|
1
|
-
"use strict";
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.getDadosEmitente = void 0;
|
|
7
|
+
const bwip_js_1 = __importDefault(require("bwip-js"));
|
|
8
|
+
const date_fns_1 = require("date-fns");
|
|
9
|
+
const campo_1 = require("./campo");
|
|
10
|
+
const default_1 = require("./default");
|
|
11
|
+
const italico_1 = require("./italico");
|
|
12
|
+
const linha_horizontal_1 = require("./linha-horizontal");
|
|
13
|
+
const linha_vertical_1 = require("./linha-vertical");
|
|
14
|
+
const negrito_1 = require("./negrito");
|
|
15
|
+
const normal_1 = require("./normal");
|
|
16
|
+
const titulo_1 = require("./titulo");
|
|
17
|
+
async function getDadosEmitente({ y, doc, ajusteX, ajusteY, margemDireita, margemEsquerda, margemTopo, larguraDoFormulario, emit, protNFe, pathLogo, ide, folha }) {
|
|
18
|
+
(0, linha_horizontal_1.linhaHorizontal)({ x1: 317, x2: -254.7, y: y + 53.1, doc, ajusteX, ajusteY, margemDireita, margemEsquerda, margemTopo });
|
|
19
|
+
(0, linha_horizontal_1.linhaHorizontal)({ x1: 317, x2: -254.7, y: y + 72.9, doc, ajusteX, ajusteY, margemDireita, margemEsquerda, margemTopo });
|
|
20
|
+
(0, linha_vertical_1.linhaVertical)({ y1: y + 53.1, y2: y + 72.9, x: 317.4, doc, ajusteX, ajusteY, margemEsquerda, margemTopo });
|
|
21
|
+
(0, linha_vertical_1.linhaVertical)({ y1: y + 53.1, y2: y + 72.9, x: 331.55, doc, ajusteX, ajusteY, margemEsquerda, margemTopo });
|
|
22
|
+
(0, linha_horizontal_1.linhaHorizontal)({ x1: 0, x2: 0, y: y + 15.25, doc, ajusteX, ajusteY, margemDireita, margemEsquerda, margemTopo });
|
|
23
|
+
(0, linha_horizontal_1.linhaHorizontal)({ x1: 340.05, x2: 0, y: y + 60.5, doc, ajusteX, ajusteY, margemDireita, margemEsquerda, margemTopo });
|
|
24
|
+
(0, linha_horizontal_1.linhaHorizontal)({ x1: 340.05, x2: 0, y: y + 83.1, doc, ajusteX, ajusteY, margemDireita, margemEsquerda, margemTopo });
|
|
25
|
+
(0, linha_horizontal_1.linhaHorizontal)({ x1: 0, x2: 0, y: y + 105.9, doc, ajusteX, ajusteY, margemDireita, margemEsquerda, margemTopo });
|
|
26
|
+
(0, linha_horizontal_1.linhaHorizontal)({ x1: 0, x2: 0, y: y + 125.7, doc, ajusteX, ajusteY, margemDireita, margemEsquerda, margemTopo });
|
|
27
|
+
(0, linha_horizontal_1.linhaHorizontal)({ x1: 0, x2: 0, y: y + 145.7, doc, ajusteX, ajusteY, margemDireita, margemEsquerda, margemTopo });
|
|
28
|
+
(0, linha_vertical_1.linhaVertical)({ y1: y + 15.25, y2: y + 145.7, x: 0, doc, ajusteX, ajusteY, margemEsquerda, margemTopo });
|
|
29
|
+
(0, linha_vertical_1.linhaVertical)({ y1: y + 15.25, y2: y + 105.7, x: 240.75, doc, ajusteX, ajusteY, margemEsquerda, margemTopo });
|
|
30
|
+
(0, linha_vertical_1.linhaVertical)({ y1: y + 15.25, y2: y + 125.7, x: 340.05, doc, ajusteX, ajusteY, margemEsquerda, margemTopo });
|
|
31
|
+
(0, linha_vertical_1.linhaVertical)({ y1: y + 15.25, y2: y + 145.7, x: larguraDoFormulario, doc, ajusteX, ajusteY, margemEsquerda, margemTopo });
|
|
32
|
+
(0, linha_vertical_1.linhaVertical)({ y1: y + 125.7, y2: y + 145.7, x: 195.55, doc, ajusteX, ajusteY, margemEsquerda, margemTopo });
|
|
33
|
+
(0, linha_vertical_1.linhaVertical)({ y1: y + 125.7, y2: y + 145.7, x: 391, doc, ajusteX, ajusteY, margemEsquerda, margemTopo });
|
|
34
|
+
(0, titulo_1.titulo)({
|
|
35
|
+
value: 'DANFE',
|
|
36
|
+
x: 266.5,
|
|
37
|
+
y: y + 19.2,
|
|
38
|
+
largura: 197,
|
|
39
|
+
alinhamento: 'left',
|
|
40
|
+
tamanho: 14,
|
|
41
|
+
ajusteX,
|
|
42
|
+
ajusteY,
|
|
43
|
+
doc,
|
|
44
|
+
margemEsquerda,
|
|
45
|
+
margemTopo
|
|
46
|
+
});
|
|
47
|
+
(0, italico_1.italico)({
|
|
48
|
+
doc,
|
|
49
|
+
value: 'IDENTIFICAÇÃO DO EMITENTE',
|
|
50
|
+
x: 1,
|
|
51
|
+
y: y + 15.7,
|
|
52
|
+
largura: 238,
|
|
53
|
+
alinhamento: 'center',
|
|
54
|
+
tamanho: 10,
|
|
55
|
+
ajusteX,
|
|
56
|
+
ajusteY,
|
|
57
|
+
margemEsquerda,
|
|
58
|
+
margemTopo
|
|
59
|
+
});
|
|
60
|
+
const identificacaoDoEmitenteY = pathLogo !== undefined ? y + 33.7 : y + 39.7;
|
|
61
|
+
const identificacaoDoEmitenteX = pathLogo !== undefined ? 67 : 1.5;
|
|
62
|
+
const identificacaoDoEmitenteLargura = pathLogo !== undefined ? 172 : 237;
|
|
63
|
+
const identificacaoDoEmitenteFonte = pathLogo !== undefined ? 0 : 1.5;
|
|
64
|
+
if (pathLogo !== undefined) {
|
|
65
|
+
if (folha === 0) {
|
|
66
|
+
doc.image(pathLogo, margemEsquerda + ajusteX + 4.5, margemTopo + ajusteY + default_1.DEFAULT_NFE.ajusteYDoLogotipo + 78, {
|
|
67
|
+
fit: [60, 60]
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
else {
|
|
71
|
+
doc.image(pathLogo, margemEsquerda + ajusteX + 4.5, margemTopo + ajusteY + default_1.DEFAULT_NFE.ajusteYDoLogotipo + 33, {
|
|
72
|
+
fit: [60, 60]
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
(0, negrito_1.negrito)({
|
|
77
|
+
doc,
|
|
78
|
+
value: emit.xNome,
|
|
79
|
+
x: identificacaoDoEmitenteX,
|
|
80
|
+
y: identificacaoDoEmitenteY + default_1.DEFAULT_NFE.ajusteYDaIdentificacaoDoEmitente,
|
|
81
|
+
largura: identificacaoDoEmitenteLargura,
|
|
82
|
+
alinhamento: 'center',
|
|
83
|
+
tamanho: 8 + identificacaoDoEmitenteFonte,
|
|
84
|
+
ajusteX,
|
|
85
|
+
ajusteY,
|
|
86
|
+
margemEsquerda,
|
|
87
|
+
margemTopo
|
|
88
|
+
});
|
|
89
|
+
(0, normal_1.normal)({
|
|
90
|
+
doc,
|
|
91
|
+
value: `${emit.enderEmit.xLgr}, ${emit.enderEmit.nro} ${emit.enderEmit.xCpl ?? ''}`,
|
|
92
|
+
x: identificacaoDoEmitenteX,
|
|
93
|
+
y: doc.y - margemTopo + 2,
|
|
94
|
+
largura: identificacaoDoEmitenteLargura,
|
|
95
|
+
alinhamento: 'center',
|
|
96
|
+
tamanho: 6 + identificacaoDoEmitenteFonte,
|
|
97
|
+
ajusteX,
|
|
98
|
+
ajusteY,
|
|
99
|
+
margemEsquerda,
|
|
100
|
+
margemTopo
|
|
101
|
+
});
|
|
102
|
+
(0, normal_1.normal)({
|
|
103
|
+
doc,
|
|
104
|
+
value: `${emit.enderEmit.xBairro}. ${emit.enderEmit.xMun}-${emit.enderEmit.UF}`,
|
|
105
|
+
x: identificacaoDoEmitenteX,
|
|
106
|
+
y: doc.y - margemTopo,
|
|
107
|
+
largura: identificacaoDoEmitenteLargura,
|
|
108
|
+
alinhamento: 'center',
|
|
109
|
+
tamanho: 6 + identificacaoDoEmitenteFonte,
|
|
110
|
+
ajusteX,
|
|
111
|
+
ajusteY,
|
|
112
|
+
margemEsquerda,
|
|
113
|
+
margemTopo
|
|
114
|
+
});
|
|
115
|
+
if (emit.fone !== undefined) {
|
|
116
|
+
(0, normal_1.normal)({
|
|
117
|
+
doc,
|
|
118
|
+
value: 'Telefone: ' + emit.fone,
|
|
119
|
+
x: identificacaoDoEmitenteX,
|
|
120
|
+
y: doc.y - margemTopo + 2,
|
|
121
|
+
largura: identificacaoDoEmitenteLargura,
|
|
122
|
+
alinhamento: 'center',
|
|
123
|
+
tamanho: 6 + identificacaoDoEmitenteFonte,
|
|
124
|
+
ajusteX,
|
|
125
|
+
ajusteY,
|
|
126
|
+
margemEsquerda,
|
|
127
|
+
margemTopo
|
|
128
|
+
});
|
|
129
|
+
}
|
|
130
|
+
(0, normal_1.normal)({
|
|
131
|
+
doc,
|
|
132
|
+
value: 'Documento Auxiliar da Nota Fiscal Eletrônica',
|
|
133
|
+
x: 241.5,
|
|
134
|
+
y: y + 32.7,
|
|
135
|
+
largura: 99.5,
|
|
136
|
+
alinhamento: 'center',
|
|
137
|
+
tamanho: 10,
|
|
138
|
+
ajusteX,
|
|
139
|
+
ajusteY,
|
|
140
|
+
margemEsquerda,
|
|
141
|
+
margemTopo
|
|
142
|
+
});
|
|
143
|
+
(0, normal_1.normal)({
|
|
144
|
+
doc,
|
|
145
|
+
value: '0 - ENTRADA',
|
|
146
|
+
x: 248,
|
|
147
|
+
y: y + 55.7,
|
|
148
|
+
largura: 99.5,
|
|
149
|
+
alinhamento: 'left',
|
|
150
|
+
ajusteX,
|
|
151
|
+
ajusteY,
|
|
152
|
+
margemEsquerda,
|
|
153
|
+
margemTopo
|
|
154
|
+
});
|
|
155
|
+
(0, normal_1.normal)({
|
|
156
|
+
doc,
|
|
157
|
+
value: '1 - SAÍDA',
|
|
158
|
+
x: 248,
|
|
159
|
+
y: y + 64.2,
|
|
160
|
+
largura: 99.5,
|
|
161
|
+
alinhamento: 'left',
|
|
162
|
+
ajusteX,
|
|
163
|
+
ajusteY,
|
|
164
|
+
margemEsquerda,
|
|
165
|
+
margemTopo
|
|
166
|
+
});
|
|
167
|
+
(0, normal_1.normal)({
|
|
168
|
+
doc,
|
|
169
|
+
value: ide.tpNF,
|
|
170
|
+
x: 317.5,
|
|
171
|
+
y: y + 52.5,
|
|
172
|
+
largura: 14.5,
|
|
173
|
+
alinhamento: 'center',
|
|
174
|
+
tamanho: 18,
|
|
175
|
+
ajusteX,
|
|
176
|
+
ajusteY,
|
|
177
|
+
margemEsquerda,
|
|
178
|
+
margemTopo
|
|
179
|
+
});
|
|
180
|
+
(0, normal_1.normal)({
|
|
181
|
+
doc,
|
|
182
|
+
value: 'Consulta de autenticidade no portal nacional da NF-e',
|
|
183
|
+
x: 340.5,
|
|
184
|
+
y: y + 85.7,
|
|
185
|
+
largura: 244,
|
|
186
|
+
ajusteX,
|
|
187
|
+
ajusteY,
|
|
188
|
+
margemEsquerda,
|
|
189
|
+
margemTopo
|
|
190
|
+
});
|
|
191
|
+
(0, normal_1.normal)({
|
|
192
|
+
doc,
|
|
193
|
+
value: 'www.nfe.fazenda.gov.br/portal ou no site da Sefaz Autorizadora',
|
|
194
|
+
x: 340.5,
|
|
195
|
+
y: y + 93.7,
|
|
196
|
+
largura: 244,
|
|
197
|
+
ajusteX,
|
|
198
|
+
ajusteY,
|
|
199
|
+
margemEsquerda,
|
|
200
|
+
margemTopo
|
|
201
|
+
});
|
|
202
|
+
(0, normal_1.normal)({
|
|
203
|
+
doc,
|
|
204
|
+
value: 'Nº. ' + ide.nNF.padStart(9, '0').replace(/(\d{3})(\d{3})(\d{3})/, '$1.$2.$3'),
|
|
205
|
+
x: 241.2,
|
|
206
|
+
y: y + 75.2,
|
|
207
|
+
largura: 98.5,
|
|
208
|
+
alinhamento: 'center',
|
|
209
|
+
tamanho: 10,
|
|
210
|
+
ajusteX,
|
|
211
|
+
ajusteY,
|
|
212
|
+
margemEsquerda,
|
|
213
|
+
margemTopo
|
|
214
|
+
});
|
|
215
|
+
(0, normal_1.normal)({
|
|
216
|
+
doc,
|
|
217
|
+
value: 'Série ' + ide.serie,
|
|
218
|
+
x: 241.2,
|
|
219
|
+
y: y + 85.2,
|
|
220
|
+
largura: 98.5,
|
|
221
|
+
alinhamento: 'center',
|
|
222
|
+
tamanho: 10,
|
|
223
|
+
ajusteX,
|
|
224
|
+
ajusteY,
|
|
225
|
+
margemEsquerda,
|
|
226
|
+
margemTopo
|
|
227
|
+
});
|
|
228
|
+
const options = {
|
|
229
|
+
bcid: 'code128',
|
|
230
|
+
text: protNFe.infProt.chNFe,
|
|
231
|
+
height: 15,
|
|
232
|
+
width: 130
|
|
233
|
+
};
|
|
234
|
+
const barcodeCep = await bwip_js_1.default.toBuffer(options);
|
|
235
|
+
doc.image(barcodeCep, 350, y + 22.7, { fit: [230, 50] });
|
|
236
|
+
(0, titulo_1.titulo)({ value: 'CHAVE DE ACESSO', x: 341.5, y: y + 61.2, largura: 244, ajusteX, ajusteY, doc, margemEsquerda, margemTopo });
|
|
237
|
+
(0, campo_1.campo)({
|
|
238
|
+
value: protNFe.infProt.chNFe.replace(/(.{4})(?=.)/g, '$1 '),
|
|
239
|
+
x: 341.5,
|
|
240
|
+
y: y + 67.7,
|
|
241
|
+
largura: 244,
|
|
242
|
+
ajusteX,
|
|
243
|
+
ajusteY,
|
|
244
|
+
doc,
|
|
245
|
+
margemEsquerda,
|
|
246
|
+
margemTopo
|
|
247
|
+
});
|
|
248
|
+
(0, titulo_1.titulo)({
|
|
249
|
+
value: 'PROTOCOLO DE AUTORIZAÇÃO DE USO',
|
|
250
|
+
x: 341.5,
|
|
251
|
+
y: y + 106.7,
|
|
252
|
+
largura: 244,
|
|
253
|
+
ajusteX,
|
|
254
|
+
ajusteY,
|
|
255
|
+
doc,
|
|
256
|
+
margemEsquerda,
|
|
257
|
+
margemTopo
|
|
258
|
+
});
|
|
259
|
+
(0, campo_1.campo)({
|
|
260
|
+
value: `${protNFe.infProt.nProt.replace(/(.{3})(?=.)/g, '$1 ')} - ${(0, date_fns_1.format)((0, date_fns_1.parseISO)(protNFe.infProt.dhRecbto), 'dd/MM/yyyy HH:mm:ss')}`,
|
|
261
|
+
x: 341.5,
|
|
262
|
+
y: y + 114.1,
|
|
263
|
+
largura: 244,
|
|
264
|
+
ajusteX,
|
|
265
|
+
ajusteY,
|
|
266
|
+
doc,
|
|
267
|
+
margemEsquerda,
|
|
268
|
+
margemTopo
|
|
269
|
+
});
|
|
270
|
+
(0, titulo_1.titulo)({ value: 'NATUREZA DA OPERAÇÃO', x: 1.5, y: y + 106.7, largura: 338, ajusteX, ajusteY, doc, margemEsquerda, margemTopo });
|
|
271
|
+
(0, campo_1.campo)({ value: ide.natOp, x: 1.5, y: y + 114.1, largura: 338, ajusteX, ajusteY, doc, margemEsquerda, margemTopo });
|
|
272
|
+
(0, titulo_1.titulo)({ value: 'INSCRIÇÃO ESTADUAL', x: 1.5, y: y + 126.7, largura: 192.5, ajusteX, ajusteY, doc, margemEsquerda, margemTopo });
|
|
273
|
+
(0, campo_1.campo)({
|
|
274
|
+
value: emit.IE.replace(/(\d{3})(\d{3})(\d{3})(\d{3})/, '$1.$2.$3.$4'),
|
|
275
|
+
x: 1.5,
|
|
276
|
+
y: y + 134.1,
|
|
277
|
+
largura: 192.5,
|
|
278
|
+
ajusteX,
|
|
279
|
+
ajusteY,
|
|
280
|
+
doc,
|
|
281
|
+
margemEsquerda,
|
|
282
|
+
margemTopo
|
|
283
|
+
});
|
|
284
|
+
(0, titulo_1.titulo)({
|
|
285
|
+
value: 'INSCRIÇÃO ESTADUAL DO SUBST. TRIBUT.',
|
|
286
|
+
x: 197,
|
|
287
|
+
y: y + 126.7,
|
|
288
|
+
largura: 192.5,
|
|
289
|
+
ajusteX,
|
|
290
|
+
ajusteY,
|
|
291
|
+
doc,
|
|
292
|
+
margemEsquerda,
|
|
293
|
+
margemTopo
|
|
294
|
+
});
|
|
295
|
+
(0, campo_1.campo)({ value: emit.iEST ?? '', x: 197, y: y + 134.1, largura: 192.5, ajusteX, ajusteY, doc, margemEsquerda, margemTopo });
|
|
296
|
+
(0, titulo_1.titulo)({ value: 'CNPJ', x: 392.5, y: y + 126.7, largura: 192.5, ajusteX, ajusteY, doc, margemEsquerda, margemTopo });
|
|
297
|
+
(0, campo_1.campo)({
|
|
298
|
+
value: emit.CNPJ?.replace(/(\d{2})(\d{3})(\d{3})(\d{4})(\d{2})/, '$1.$2.$3/$4-$5') ?? '',
|
|
299
|
+
x: 392.5,
|
|
300
|
+
y: y + 134.1,
|
|
301
|
+
largura: 192.5,
|
|
302
|
+
ajusteX,
|
|
303
|
+
ajusteY,
|
|
304
|
+
doc,
|
|
305
|
+
margemEsquerda,
|
|
306
|
+
margemTopo
|
|
307
|
+
});
|
|
308
|
+
}
|
|
309
|
+
exports.getDadosEmitente = getDadosEmitente;
|
|
@@ -1 +1,123 @@
|
|
|
1
|
-
"use strict";
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getDestinatarioRemetente = void 0;
|
|
4
|
+
const date_fns_1 = require("date-fns");
|
|
5
|
+
const campo_1 = require("./campo");
|
|
6
|
+
const default_1 = require("./default");
|
|
7
|
+
const linha_horizontal_1 = require("./linha-horizontal");
|
|
8
|
+
const linha_vertical_1 = require("./linha-vertical");
|
|
9
|
+
const secao_1 = require("./secao");
|
|
10
|
+
const titulo_1 = require("./titulo");
|
|
11
|
+
function getDestinatarioRemetente({ y, doc, ajusteX, ajusteY, margemDireita, margemEsquerda, margemTopo, larguraDoFormulario, dest, ide }) {
|
|
12
|
+
(0, linha_horizontal_1.linhaHorizontal)({ x1: 0, x2: 0, y: y + 9, doc, ajusteX, ajusteY, margemDireita, margemEsquerda, margemTopo });
|
|
13
|
+
(0, linha_horizontal_1.linhaHorizontal)({ x1: 0, x2: 0, y: y + 29, doc, ajusteX, ajusteY, margemDireita, margemEsquerda, margemTopo });
|
|
14
|
+
(0, linha_horizontal_1.linhaHorizontal)({ x1: 0, x2: 0, y: y + 49, doc, ajusteX, ajusteY, margemDireita, margemEsquerda, margemTopo });
|
|
15
|
+
(0, linha_horizontal_1.linhaHorizontal)({ x1: 0, x2: 0, y: y + 69, doc, ajusteX, ajusteY, margemDireita, margemEsquerda, margemTopo });
|
|
16
|
+
(0, linha_vertical_1.linhaVertical)({ y1: y + 9.2, y2: y + 69, x: 0, doc, ajusteX, ajusteY, margemEsquerda, margemTopo });
|
|
17
|
+
(0, linha_vertical_1.linhaVertical)({ y1: y + 9.2, y2: y + 29, x: 357.1, doc, ajusteX, ajusteY, margemEsquerda, margemTopo });
|
|
18
|
+
(0, linha_vertical_1.linhaVertical)({ y1: y + 29.2, y2: y + 69, x: 274.9, doc, ajusteX, ajusteY, margemEsquerda, margemTopo });
|
|
19
|
+
(0, linha_vertical_1.linhaVertical)({ y1: y + 49.2, y2: y + 69, x: 297.6, doc, ajusteX, ajusteY, margemEsquerda, margemTopo });
|
|
20
|
+
(0, linha_vertical_1.linhaVertical)({ y1: y + 29.2, y2: y + 69, x: 396.75, doc, ajusteX, ajusteY, margemEsquerda, margemTopo });
|
|
21
|
+
(0, linha_vertical_1.linhaVertical)({ y1: y + 9.2, y2: y + 69, x: 493.1, doc, ajusteX, ajusteY, margemEsquerda, margemTopo });
|
|
22
|
+
(0, linha_vertical_1.linhaVertical)({ y1: y + 9.2, y2: y + 69, x: larguraDoFormulario, doc, ajusteX, ajusteY, margemEsquerda, margemTopo });
|
|
23
|
+
(0, secao_1.secao)({ doc, value: 'DESTINATÁRIO / REMETENTE', x: 1.5, y: y + 0.9, largura: 0, ajusteX, ajusteY, margemEsquerda, margemTopo });
|
|
24
|
+
(0, titulo_1.titulo)({ value: 'NOME / RAZÃO SOCIAL', x: 1.5, y: y + 11, largura: 353.5, ajusteX, ajusteY, doc, margemEsquerda, margemTopo });
|
|
25
|
+
(0, campo_1.campo)({ value: dest.xNome, x: 1.5, y: y + 18, largura: 353.5, alinhamento: 'left', ajusteX, ajusteY, doc, margemEsquerda, margemTopo });
|
|
26
|
+
(0, titulo_1.titulo)({ value: 'CNPJ / CPF', x: 358, y: y + 11, largura: 133.5, ajusteX, ajusteY, doc, margemEsquerda, margemTopo });
|
|
27
|
+
(0, campo_1.campo)({
|
|
28
|
+
value: dest.CPF?.replace(/(\d{3})(\d{3})(\d{3})(\d{2})/, '$1.$2.$3-$4') ?? '',
|
|
29
|
+
x: 358,
|
|
30
|
+
y: y + 18,
|
|
31
|
+
largura: 133.5,
|
|
32
|
+
ajusteX,
|
|
33
|
+
ajusteY,
|
|
34
|
+
doc,
|
|
35
|
+
margemEsquerda,
|
|
36
|
+
margemTopo
|
|
37
|
+
});
|
|
38
|
+
(0, campo_1.campo)({
|
|
39
|
+
value: dest.CNPJ?.replace(/(\d{2})(\d{3})(\d{3})(\d{4})(\d{2})/, '$1.$2.$3/$4-$5') ?? '',
|
|
40
|
+
x: 358,
|
|
41
|
+
y: y + 18,
|
|
42
|
+
largura: 133.5,
|
|
43
|
+
ajusteX,
|
|
44
|
+
ajusteY,
|
|
45
|
+
doc,
|
|
46
|
+
margemEsquerda,
|
|
47
|
+
margemTopo
|
|
48
|
+
});
|
|
49
|
+
(0, titulo_1.titulo)({ value: 'DATA DA EMISSÃO', x: 495, y: y + 11, largura: 90, ajusteX, ajusteY, doc, margemEsquerda, margemTopo });
|
|
50
|
+
(0, campo_1.campo)({
|
|
51
|
+
value: (0, date_fns_1.format)((0, date_fns_1.parseISO)(ide.dhEmi), 'dd/MM/yyyy HH:mm:ss'),
|
|
52
|
+
x: 495,
|
|
53
|
+
y: y + 18,
|
|
54
|
+
largura: 90,
|
|
55
|
+
ajusteX,
|
|
56
|
+
ajusteY,
|
|
57
|
+
doc,
|
|
58
|
+
margemEsquerda,
|
|
59
|
+
margemTopo
|
|
60
|
+
});
|
|
61
|
+
(0, titulo_1.titulo)({ value: 'ENDEREÇO', x: 1.5, y: y + 30, largura: 272, ajusteX, ajusteY, doc, margemEsquerda, margemTopo });
|
|
62
|
+
(0, campo_1.campo)({
|
|
63
|
+
value: dest.enderDest?.xLgr && dest.enderDest?.nro ? `${dest.enderDest.xLgr}, ${dest.enderDest.nro}` : dest.enderDest?.xLgr ?? '',
|
|
64
|
+
x: 1.5,
|
|
65
|
+
y: y + 38,
|
|
66
|
+
largura: 272,
|
|
67
|
+
alinhamento: 'left',
|
|
68
|
+
tamanho: default_1.DEFAULT_NFE.tamanhoDaFonteDoCampo - 0.5,
|
|
69
|
+
ajusteX,
|
|
70
|
+
ajusteY,
|
|
71
|
+
doc,
|
|
72
|
+
margemEsquerda,
|
|
73
|
+
margemTopo
|
|
74
|
+
});
|
|
75
|
+
(0, titulo_1.titulo)({ value: 'BAIRRO / DISTRITO', x: 276, y: y + 30, largura: 192, ajusteX, ajusteY, doc, margemEsquerda, margemTopo });
|
|
76
|
+
(0, campo_1.campo)({ value: dest.enderDest?.xBairro ?? '', x: 276, y: y + 38, largura: 119, ajusteX, ajusteY, doc, margemEsquerda, margemTopo });
|
|
77
|
+
(0, titulo_1.titulo)({ value: 'CEP', x: 398, y: y + 30, largura: 93, ajusteX, ajusteY, doc, margemEsquerda, margemTopo });
|
|
78
|
+
(0, campo_1.campo)({ value: dest.enderDest?.CEP ?? '', x: 398, y: y + 38, largura: 93, ajusteX, ajusteY, doc, margemEsquerda, margemTopo });
|
|
79
|
+
(0, titulo_1.titulo)({ value: 'DATA DA SAÍDA', x: 495, y: y + 30, largura: 90, ajusteX, ajusteY, doc, margemEsquerda, margemTopo });
|
|
80
|
+
(0, campo_1.campo)({
|
|
81
|
+
value: ide.dhSaiEnt !== undefined ? (0, date_fns_1.format)((0, date_fns_1.parseISO)(ide.dhSaiEnt), 'dd/MM/yyyy HH:mm:ss') : '',
|
|
82
|
+
x: 495,
|
|
83
|
+
y: y + 38,
|
|
84
|
+
largura: 90,
|
|
85
|
+
ajusteX,
|
|
86
|
+
ajusteY,
|
|
87
|
+
doc,
|
|
88
|
+
margemEsquerda,
|
|
89
|
+
margemTopo
|
|
90
|
+
});
|
|
91
|
+
(0, titulo_1.titulo)({ value: 'MUNICÍPIO', x: 1.5, y: y + 51, largura: 272, ajusteX, ajusteY, doc, margemEsquerda, margemTopo });
|
|
92
|
+
(0, campo_1.campo)({
|
|
93
|
+
value: dest.enderDest?.xMun ?? '',
|
|
94
|
+
x: 1.5,
|
|
95
|
+
y: y + 58,
|
|
96
|
+
largura: 272,
|
|
97
|
+
alinhamento: 'left',
|
|
98
|
+
ajusteX,
|
|
99
|
+
ajusteY,
|
|
100
|
+
doc,
|
|
101
|
+
margemEsquerda,
|
|
102
|
+
margemTopo
|
|
103
|
+
});
|
|
104
|
+
(0, titulo_1.titulo)({ value: 'UF', x: 276, y: y + 51, largura: 20, ajusteX, ajusteY, doc, margemEsquerda, margemTopo });
|
|
105
|
+
(0, campo_1.campo)({ value: dest.enderDest?.UF ?? '', x: 276, y: y + 58, largura: 20, ajusteX, ajusteY, doc, margemEsquerda, margemTopo });
|
|
106
|
+
(0, titulo_1.titulo)({ value: 'FONE / FAX', x: 299, y: y + 51, largura: 96, ajusteX, ajusteY, doc, margemEsquerda, margemTopo });
|
|
107
|
+
(0, campo_1.campo)({ value: dest.enderDest?.fone ?? '', x: 299, y: y + 58, largura: 96, ajusteX, ajusteY, doc, margemEsquerda, margemTopo });
|
|
108
|
+
(0, titulo_1.titulo)({ value: 'INSCRIÇÃO ESTADUAL', x: 398, y: y + 51, largura: 93, ajusteX, ajusteY, doc, margemEsquerda, margemTopo });
|
|
109
|
+
(0, campo_1.campo)({
|
|
110
|
+
value: dest?.IE?.replace(/(\d{3})(\d{3})(\d{3})(\d{3})/, '$1.$2.$3.$4') ?? '',
|
|
111
|
+
x: 398,
|
|
112
|
+
y: y + 58,
|
|
113
|
+
largura: 93,
|
|
114
|
+
ajusteX,
|
|
115
|
+
ajusteY,
|
|
116
|
+
doc,
|
|
117
|
+
margemEsquerda,
|
|
118
|
+
margemTopo
|
|
119
|
+
});
|
|
120
|
+
(0, titulo_1.titulo)({ value: 'HORA DA SAÍDA', x: 495, y: y + 51, largura: 90, ajusteX, ajusteY, doc, margemEsquerda, margemTopo });
|
|
121
|
+
return doc.y;
|
|
122
|
+
}
|
|
123
|
+
exports.getDestinatarioRemetente = getDestinatarioRemetente;
|
|
@@ -1 +1,64 @@
|
|
|
1
|
-
"use strict";
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getFaturaDuplicata = void 0;
|
|
4
|
+
const date_fns_1 = require("date-fns");
|
|
5
|
+
const utils_1 = require("../../../../domain/use-cases/utils");
|
|
6
|
+
const default_1 = require("./default");
|
|
7
|
+
const linha_horizontal_1 = require("./linha-horizontal");
|
|
8
|
+
const linha_vertical_1 = require("./linha-vertical");
|
|
9
|
+
const secao_1 = require("./secao");
|
|
10
|
+
function getFaturaDuplicata({ y, doc, ajusteX, ajusteY, margemDireita, margemEsquerda, margemTopo, larguraDoFormulario, cobr }) {
|
|
11
|
+
if (cobr !== undefined && Object.keys(cobr).length > 0) {
|
|
12
|
+
(0, secao_1.secao)({ doc, value: 'FATURA / DUPLICATA', x: 1.5, y: y + 12, largura: 0, ajusteX, ajusteY, margemEsquerda, margemTopo });
|
|
13
|
+
if (cobr.fat !== undefined) {
|
|
14
|
+
doc
|
|
15
|
+
.font('negrito')
|
|
16
|
+
.fillColor(default_1.DEFAULT_NFE.corDoTitulo)
|
|
17
|
+
.fontSize(8)
|
|
18
|
+
.text('Número da Fatura:', 5, y + 24, {
|
|
19
|
+
width: larguraDoFormulario - 5,
|
|
20
|
+
align: 'justify',
|
|
21
|
+
lineGap: -1.5,
|
|
22
|
+
continued: true
|
|
23
|
+
})
|
|
24
|
+
.font('normal')
|
|
25
|
+
.text(cobr.fat.nFat, { continued: true })
|
|
26
|
+
.font('negrito')
|
|
27
|
+
.text(' Valor Original:', { continued: true })
|
|
28
|
+
.font('normal')
|
|
29
|
+
.text(` ${(0, utils_1.formatMoney)(cobr.fat.vOrig, 2)}`, { continued: true })
|
|
30
|
+
.font('negrito')
|
|
31
|
+
.text(' Valor Desconto:', { continued: true })
|
|
32
|
+
.font('normal')
|
|
33
|
+
.text(` ${(0, utils_1.formatMoney)(cobr.fat.vDesc, 2)}`, { continued: true })
|
|
34
|
+
.font('negrito')
|
|
35
|
+
.text(' Valor Líquido:', { continued: true })
|
|
36
|
+
.font('normal')
|
|
37
|
+
.text(` ${(0, utils_1.formatMoney)(cobr.fat.vLiq, 2)}.`, { continued: true });
|
|
38
|
+
}
|
|
39
|
+
if (cobr.dup !== undefined) {
|
|
40
|
+
cobr.dup.forEach((dup, index) => {
|
|
41
|
+
doc.font('negrito').text(' Duplicata:', { continued: true }).font('normal').text(` ${dup.nDup}`, { continued: true });
|
|
42
|
+
doc
|
|
43
|
+
.font('negrito')
|
|
44
|
+
.text(' Valor:', { continued: true })
|
|
45
|
+
.font('normal')
|
|
46
|
+
.text(` ${(0, utils_1.formatMoney)(dup.vDup, 2)}`, { continued: true });
|
|
47
|
+
doc
|
|
48
|
+
.font('negrito')
|
|
49
|
+
.text(' Vencimento:', { continued: true })
|
|
50
|
+
.font('normal')
|
|
51
|
+
.text(` ${(0, date_fns_1.format)((0, date_fns_1.parseISO)(dup.dVenc), 'dd/MM/yyyy')}`, { continued: true });
|
|
52
|
+
if (index === cobr.dup.length - 1) {
|
|
53
|
+
doc.text('');
|
|
54
|
+
}
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
(0, linha_horizontal_1.linhaHorizontal)({ x1: 0, x2: 0, y: y + 20, doc, ajusteX, ajusteY, margemDireita, margemEsquerda, margemTopo });
|
|
58
|
+
(0, linha_horizontal_1.linhaHorizontal)({ x1: 0, x2: 0, y: doc.y + 6, doc, ajusteX, ajusteY, margemDireita, margemEsquerda, margemTopo });
|
|
59
|
+
(0, linha_vertical_1.linhaVertical)({ y1: y + 20, y2: doc.y + 6, x: 0, doc, ajusteX, ajusteY, margemEsquerda, margemTopo });
|
|
60
|
+
(0, linha_vertical_1.linhaVertical)({ y1: y + 20, y2: doc.y + 6, x: larguraDoFormulario, doc, ajusteX, ajusteY, margemEsquerda, margemTopo });
|
|
61
|
+
}
|
|
62
|
+
return doc.y;
|
|
63
|
+
}
|
|
64
|
+
exports.getFaturaDuplicata = getFaturaDuplicata;
|
|
@@ -1 +1,26 @@
|
|
|
1
|
-
"use strict";
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getHomologacao = void 0;
|
|
4
|
+
const default_1 = require("./default");
|
|
5
|
+
function getHomologacao({ doc, ajusteX, ajusteY, margemEsquerda, margemTopo, larguraDoFormulario, protNFe }) {
|
|
6
|
+
doc
|
|
7
|
+
.font('normal')
|
|
8
|
+
.fillColor(default_1.DEFAULT_NFE.corDoTitulo)
|
|
9
|
+
.fontSize(38)
|
|
10
|
+
.fillOpacity(default_1.DEFAULT_NFE.opacidadeDaHomologacao)
|
|
11
|
+
.text('EMITIDA EM HOMOLOGAÇÃO', margemEsquerda + ajusteX + 0, margemTopo + ajusteY + 200 + default_1.DEFAULT_NFE.ajusteYDaHomologacao, {
|
|
12
|
+
width: larguraDoFormulario,
|
|
13
|
+
align: 'center'
|
|
14
|
+
});
|
|
15
|
+
doc
|
|
16
|
+
.font('normal')
|
|
17
|
+
.fillColor(default_1.DEFAULT_NFE.corDoTitulo)
|
|
18
|
+
.fontSize(25)
|
|
19
|
+
.fillOpacity(default_1.DEFAULT_NFE.opacidadeDaHomologacao)
|
|
20
|
+
.text(protNFe !== undefined ? 'SEM VALOR FISCAL' : 'NÃO ENVIADA PARA SEFAZ', margemEsquerda + ajusteX + 0, margemTopo + ajusteY + 250 + default_1.DEFAULT_NFE.ajusteYDaHomologacao, {
|
|
21
|
+
width: larguraDoFormulario,
|
|
22
|
+
align: 'center'
|
|
23
|
+
});
|
|
24
|
+
doc.fillOpacity(100);
|
|
25
|
+
}
|
|
26
|
+
exports.getHomologacao = getHomologacao;
|