@alexssmusica/node-pdf-nfe 1.1.4 → 1.1.6

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.
Files changed (56) hide show
  1. package/lib/application/helpers/generate-pdf/nfe/cria-layout.d.ts +1 -1
  2. package/lib/application/helpers/generate-pdf/nfe/cria-layout.js +7 -2
  3. package/lib/application/helpers/generate-pdf/nfe/gerar-itens.d.ts +1 -1
  4. package/lib/application/helpers/generate-pdf/nfe/gerar-itens.js +15 -13
  5. package/lib/application/helpers/generate-pdf/nfe/get-dados-emitente.js +20 -8
  6. package/lib/application/helpers/generate-pdf/nfe/get-destinatario-remetente.js +40 -8
  7. package/lib/application/helpers/generate-pdf/nfe/get-fatura-duplicata.js +4 -4
  8. package/lib/application/helpers/generate-pdf/nfe/get-homologacao.d.ts +1 -1
  9. package/lib/application/helpers/generate-pdf/nfe/get-homologacao.js +12 -1
  10. package/lib/application/helpers/generate-pdf/nfe/get-imposto.js +14 -14
  11. package/lib/application/helpers/generate-pdf/nfe/get-iss.js +12 -1
  12. package/lib/application/helpers/generate-pdf/nfe/get-nota-cancelada.d.ts +2 -0
  13. package/lib/application/helpers/generate-pdf/nfe/get-nota-cancelada.js +17 -0
  14. package/lib/application/helpers/generate-pdf/nfe/get-recibo.js +1 -1
  15. package/lib/application/helpers/generate-pdf/nfe/get-transporte.js +58 -21
  16. package/lib/domain/use-cases/pdf/index.d.ts +2 -1
  17. package/lib/domain/use-cases/pdf/index.js +3 -3
  18. package/lib/domain/use-cases/pdf/pdf-NFCe.js +13 -13
  19. package/lib/domain/use-cases/pdf/pdf-NFe.d.ts +2 -2
  20. package/lib/domain/use-cases/pdf/pdf-NFe.js +13 -2
  21. package/lib/domain/use-cases/utils/current-date.d.ts +1 -0
  22. package/lib/domain/use-cases/utils/{data-atual.js → current-date.js} +3 -3
  23. package/lib/domain/use-cases/utils/format-cnpj.d.ts +1 -0
  24. package/lib/domain/use-cases/utils/format-cnpj.js +9 -0
  25. package/lib/domain/use-cases/utils/format-cpf.d.ts +1 -0
  26. package/lib/domain/use-cases/utils/format-cpf.js +9 -0
  27. package/lib/domain/use-cases/utils/format-date-time.d.ts +1 -0
  28. package/lib/domain/use-cases/utils/format-date-time.js +11 -0
  29. package/lib/domain/use-cases/utils/format-date.d.ts +1 -0
  30. package/lib/domain/use-cases/utils/format-date.js +10 -0
  31. package/lib/domain/use-cases/utils/format-key.d.ts +1 -0
  32. package/lib/domain/use-cases/utils/format-key.js +7 -0
  33. package/lib/domain/use-cases/utils/format-number.d.ts +1 -0
  34. package/lib/domain/use-cases/utils/format-number.js +7 -0
  35. package/lib/domain/use-cases/utils/format-phone.d.ts +1 -0
  36. package/lib/domain/use-cases/utils/format-phone.js +21 -0
  37. package/lib/domain/use-cases/utils/format-plate.d.ts +1 -0
  38. package/lib/domain/use-cases/utils/format-plate.js +17 -0
  39. package/lib/domain/use-cases/utils/format-postal-code.d.ts +1 -0
  40. package/lib/domain/use-cases/utils/format-postal-code.js +9 -0
  41. package/lib/domain/use-cases/utils/format-protocol.d.ts +1 -0
  42. package/lib/domain/use-cases/utils/format-protocol.js +9 -0
  43. package/lib/domain/use-cases/utils/format-state-registration.d.ts +1 -0
  44. package/lib/domain/use-cases/utils/format-state-registration.js +50 -0
  45. package/lib/domain/use-cases/utils/format-time.d.ts +1 -0
  46. package/lib/domain/use-cases/utils/format-time.js +9 -0
  47. package/lib/domain/use-cases/utils/index.d.ts +10 -2
  48. package/lib/domain/use-cases/utils/index.js +10 -2
  49. package/lib/domain/use-cases/utils/return-font-size-carrier.d.ts +1 -0
  50. package/lib/domain/use-cases/utils/return-font-size-carrier.js +24 -0
  51. package/lib/tsconfig.tsbuildinfo +1 -1
  52. package/lib/types/generate-pdf.d.ts +15 -0
  53. package/package.json +3 -3
  54. package/lib/domain/use-cases/utils/data-atual.d.ts +0 -1
  55. package/lib/domain/use-cases/utils/intl-number-format.d.ts +0 -1
  56. package/lib/domain/use-cases/utils/intl-number-format.js +0 -7
@@ -1,2 +1,2 @@
1
1
  import type { GeneratePdf } from '../../../../types';
2
- export declare function criaLayout({ pathLogo, nf, ajusteX, ajusteY, doc, margemEsquerda, margemTopo, larguraDoFormulario, margemDireita, folha }: GeneratePdf.InputCriaLayout): Promise<void>;
2
+ export declare function criaLayout({ pathLogo, nf, ajusteX, ajusteY, doc, margemEsquerda, margemTopo, larguraDoFormulario, margemDireita, folha, cancelada }: GeneratePdf.InputCriaLayout): Promise<void>;
@@ -10,9 +10,10 @@ const get_homologacao_1 = require("./get-homologacao");
10
10
  const get_imposto_1 = require("./get-imposto");
11
11
  const get_iss_1 = require("./get-iss");
12
12
  const get_menu_itens_1 = require("./get-menu-itens");
13
+ const get_nota_cancelada_1 = require("./get-nota-cancelada");
13
14
  const get_recibo_1 = require("./get-recibo");
14
15
  const get_transporte_1 = require("./get-transporte");
15
- async function criaLayout({ pathLogo, nf, ajusteX, ajusteY, doc, margemEsquerda, margemTopo, larguraDoFormulario, margemDireita, folha }) {
16
+ async function criaLayout({ pathLogo, nf, ajusteX, ajusteY, doc, margemEsquerda, margemTopo, larguraDoFormulario, margemDireita, folha, cancelada }) {
16
17
  const { dest, emit, ide, infAdic, total, transp, cobr } = nf.NFe.infNFe;
17
18
  let y = 0;
18
19
  const finalEspacoDet = folha === 0 ? default_1.DEFAULT_NFE.finalTamanhoDet1 : default_1.DEFAULT_NFE.finalTamanhoDetDemais;
@@ -24,9 +25,13 @@ async function criaLayout({ pathLogo, nf, ajusteX, ajusteY, doc, margemEsquerda,
24
25
  margemEsquerda,
25
26
  margemTopo,
26
27
  larguraDoFormulario,
27
- protNFe: nf.protNFe
28
+ protNFe: nf.protNFe,
29
+ cancelada
28
30
  });
29
31
  }
32
+ else if (ide.tpAmb === '1' && cancelada) {
33
+ (0, get_nota_cancelada_1.getNotaCancelada)({ ajusteX, ajusteY, doc, margemEsquerda, margemTopo, larguraDoFormulario });
34
+ }
30
35
  if (folha === 0) {
31
36
  y = (0, get_recibo_1.getRecibo)({
32
37
  y,
@@ -1,2 +1,2 @@
1
1
  import type { GeneratePdf } from '../../../../types';
2
- export declare function gerarItens({ nf, ajusteX, ajusteY, doc, margemEsquerda, margemTopo, margemDireita, larguraDoFormulario, pathLogo }: GeneratePdf.InputCriaMargem): Promise<void>;
2
+ export declare function gerarItens({ nf, ajusteX, ajusteY, doc, margemEsquerda, margemTopo, margemDireita, larguraDoFormulario, pathLogo, cancelada }: GeneratePdf.InputCriaMargem): Promise<void>;
@@ -7,7 +7,7 @@ const default_1 = require("./default");
7
7
  const linha_horizontal_tracejada_1 = require("./linha-horizontal-tracejada");
8
8
  const normal_1 = require("./normal");
9
9
  const options_doc_1 = require("./options-doc");
10
- async function gerarItens({ nf, ajusteX, ajusteY, doc, margemEsquerda, margemTopo, margemDireita, larguraDoFormulario, pathLogo }) {
10
+ async function gerarItens({ nf, ajusteX, ajusteY, doc, margemEsquerda, margemTopo, margemDireita, larguraDoFormulario, pathLogo, cancelada }) {
11
11
  let folha = 0;
12
12
  await (0, cria_layout_1.criaLayout)({
13
13
  ajusteX,
@@ -19,7 +19,8 @@ async function gerarItens({ nf, ajusteX, ajusteY, doc, margemEsquerda, margemTop
19
19
  margemEsquerda,
20
20
  margemTopo,
21
21
  pathLogo,
22
- folha
22
+ folha,
23
+ cancelada
23
24
  });
24
25
  let maiorY = doc.y;
25
26
  for (let i = 0; i < nf.NFe.infNFe.det.length; i++) {
@@ -97,7 +98,7 @@ async function gerarItens({ nf, ajusteX, ajusteY, doc, margemEsquerda, margemTop
97
98
  maiorY = Math.max(maiorY, pdf.y);
98
99
  (0, normal_1.normal)({
99
100
  doc,
100
- value: (0, utils_1.formatMoney)(item.prod.qCom, 4),
101
+ value: (0, utils_1.formatNumber)(item.prod.qCom, 4),
101
102
  x: 335,
102
103
  y,
103
104
  largura: 37,
@@ -111,7 +112,7 @@ async function gerarItens({ nf, ajusteX, ajusteY, doc, margemEsquerda, margemTop
111
112
  maiorY = Math.max(maiorY, pdf.y);
112
113
  (0, normal_1.normal)({
113
114
  doc,
114
- value: (0, utils_1.formatMoney)(item.prod.vUnCom, 2),
115
+ value: (0, utils_1.formatNumber)(item.prod.vUnCom, 2),
115
116
  x: 375,
116
117
  y,
117
118
  largura: 32.5,
@@ -125,7 +126,7 @@ async function gerarItens({ nf, ajusteX, ajusteY, doc, margemEsquerda, margemTop
125
126
  maiorY = Math.max(maiorY, pdf.y);
126
127
  (0, normal_1.normal)({
127
128
  doc,
128
- value: (0, utils_1.formatMoney)(item.prod.vProd, 2),
129
+ value: (0, utils_1.formatNumber)(item.prod.vProd, 2),
129
130
  x: 409.5,
130
131
  y,
131
132
  largura: 31,
@@ -144,7 +145,7 @@ async function gerarItens({ nf, ajusteX, ajusteY, doc, margemEsquerda, margemTop
144
145
  (0, normal_1.normal)({
145
146
  doc,
146
147
  value: item.imposto[keys[i]][newKeys[0]].CST
147
- ? `${item.imposto[keys[i]][newKeys[0]].orig}${item.imposto[keys[i]][newKeys[0]].CST}`
148
+ ? `${item.imposto[keys[i]][newKeys[0]].orig}/${item.imposto[keys[i]][newKeys[0]].CST}`
148
149
  : '',
149
150
  x: 270,
150
151
  y,
@@ -159,7 +160,7 @@ async function gerarItens({ nf, ajusteX, ajusteY, doc, margemEsquerda, margemTop
159
160
  (0, normal_1.normal)({
160
161
  doc,
161
162
  value: item.imposto[keys[i]][newKeys[0]].CSOSN
162
- ? `${item.imposto[keys[i]][newKeys[0]].orig}${item.imposto[keys[i]][newKeys[0]].CSOSN}`
163
+ ? `${item.imposto[keys[i]][newKeys[0]].orig}/${item.imposto[keys[i]][newKeys[0]].CSOSN}`
163
164
  : '',
164
165
  x: 270,
165
166
  y,
@@ -174,7 +175,7 @@ async function gerarItens({ nf, ajusteX, ajusteY, doc, margemEsquerda, margemTop
174
175
  maiorY = Math.max(maiorY, pdf.y);
175
176
  (0, normal_1.normal)({
176
177
  doc,
177
- value: (0, utils_1.formatMoney)(item.imposto[keys[i]][newKeys[0]].vBC ?? 0, 2),
178
+ value: (0, utils_1.formatNumber)(item.imposto[keys[i]][newKeys[0]].vBC ?? 0, 2),
178
179
  x: 443,
179
180
  y,
180
181
  largura: 32.5,
@@ -188,7 +189,7 @@ async function gerarItens({ nf, ajusteX, ajusteY, doc, margemEsquerda, margemTop
188
189
  maiorY = Math.max(maiorY, pdf.y);
189
190
  (0, normal_1.normal)({
190
191
  doc,
191
- value: (0, utils_1.formatMoney)(item.imposto[keys[i]][newKeys[0]].vICMS ?? 0, 2),
192
+ value: (0, utils_1.formatNumber)(item.imposto[keys[i]][newKeys[0]].vICMS ?? 0, 2),
192
193
  x: 476,
193
194
  y,
194
195
  largura: 32,
@@ -202,7 +203,7 @@ async function gerarItens({ nf, ajusteX, ajusteY, doc, margemEsquerda, margemTop
202
203
  maiorY = Math.max(maiorY, pdf.y);
203
204
  (0, normal_1.normal)({
204
205
  doc,
205
- value: (0, utils_1.formatMoney)(item.imposto[keys[i]][newKeys[0]].pICMS ?? 0, 2),
206
+ value: (0, utils_1.formatNumber)(item.imposto[keys[i]][newKeys[0]].pICMS ?? 0, 2),
206
207
  x: 532,
207
208
  y: y + 0.65,
208
209
  largura: 28,
@@ -218,7 +219,7 @@ async function gerarItens({ nf, ajusteX, ajusteY, doc, margemEsquerda, margemTop
218
219
  }
219
220
  (0, normal_1.normal)({
220
221
  doc,
221
- value: (0, utils_1.formatMoney)(item.imposto.IPI?.IPITrib?.vIPI ?? 0, 2),
222
+ value: (0, utils_1.formatNumber)(item.imposto.IPI?.IPITrib?.vIPI ?? 0, 2),
222
223
  x: 507.5,
223
224
  y,
224
225
  largura: 26,
@@ -232,7 +233,7 @@ async function gerarItens({ nf, ajusteX, ajusteY, doc, margemEsquerda, margemTop
232
233
  maiorY = Math.max(maiorY, pdf.y);
233
234
  (0, normal_1.normal)({
234
235
  doc,
235
- value: (0, utils_1.formatMoney)(item.imposto.IPI?.IPITrib?.pIPI ?? 0, 2),
236
+ value: (0, utils_1.formatNumber)(item.imposto.IPI?.IPITrib?.pIPI ?? 0, 2),
236
237
  x: 557.75,
237
238
  y,
238
239
  largura: 29,
@@ -261,7 +262,8 @@ async function gerarItens({ nf, ajusteX, ajusteY, doc, margemEsquerda, margemTop
261
262
  margemEsquerda,
262
263
  margemTopo,
263
264
  pathLogo,
264
- folha
265
+ folha,
266
+ cancelada
265
267
  });
266
268
  maiorY = doc.y;
267
269
  }
@@ -5,7 +5,9 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.getDadosEmitente = void 0;
7
7
  const bwip_js_1 = __importDefault(require("bwip-js"));
8
- const date_fns_1 = require("date-fns");
8
+ const utils_1 = require("../../../../domain/use-cases/utils");
9
+ const format_date_time_1 = require("../../../../domain/use-cases/utils/format-date-time");
10
+ const format_protocol_1 = require("../../../../domain/use-cases/utils/format-protocol");
9
11
  const campo_1 = require("./campo");
10
12
  const default_1 = require("./default");
11
13
  const italico_1 = require("./italico");
@@ -112,10 +114,10 @@ async function getDadosEmitente({ y, doc, ajusteX, ajusteY, margemDireita, marge
112
114
  margemEsquerda,
113
115
  margemTopo
114
116
  });
115
- if (emit.fone !== undefined) {
117
+ if (emit.enderEmit && emit.enderEmit.fone !== undefined) {
116
118
  (0, normal_1.normal)({
117
119
  doc,
118
- value: 'Telefone: ' + emit.fone,
120
+ value: 'Telefone: ' + (0, utils_1.formatPhone)(emit.enderEmit.fone),
119
121
  x: identificacaoDoEmitenteX,
120
122
  y: doc.y - margemTopo + 2,
121
123
  largura: identificacaoDoEmitenteLargura,
@@ -235,7 +237,7 @@ async function getDadosEmitente({ y, doc, ajusteX, ajusteY, margemDireita, marge
235
237
  doc.image(barcodeCep, 350, y + 22.7, { fit: [230, 50] });
236
238
  (0, titulo_1.titulo)({ value: 'CHAVE DE ACESSO', x: 341.5, y: y + 61.2, largura: 244, ajusteX, ajusteY, doc, margemEsquerda, margemTopo });
237
239
  (0, campo_1.campo)({
238
- value: protNFe.infProt.chNFe.replace(/(.{4})(?=.)/g, '$1 '),
240
+ value: (0, utils_1.formatKey)(protNFe.infProt.chNFe),
239
241
  x: 341.5,
240
242
  y: y + 67.7,
241
243
  largura: 244,
@@ -257,7 +259,7 @@ async function getDadosEmitente({ y, doc, ajusteX, ajusteY, margemDireita, marge
257
259
  margemTopo
258
260
  });
259
261
  (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')}`,
262
+ value: `${(0, format_protocol_1.formatProtocol)(protNFe.infProt.nProt)} - ${(0, format_date_time_1.formatDateTime)(protNFe.infProt.dhRecbto)}`,
261
263
  x: 341.5,
262
264
  y: y + 114.1,
263
265
  largura: 244,
@@ -271,7 +273,7 @@ async function getDadosEmitente({ y, doc, ajusteX, ajusteY, margemDireita, marge
271
273
  (0, campo_1.campo)({ value: ide.natOp, x: 1.5, y: y + 114.1, largura: 338, ajusteX, ajusteY, doc, margemEsquerda, margemTopo });
272
274
  (0, titulo_1.titulo)({ value: 'INSCRIÇÃO ESTADUAL', x: 1.5, y: y + 126.7, largura: 192.5, ajusteX, ajusteY, doc, margemEsquerda, margemTopo });
273
275
  (0, campo_1.campo)({
274
- value: emit.IE.replace(/(\d{3})(\d{3})(\d{3})(\d{3})/, '$1.$2.$3.$4'),
276
+ value: (0, utils_1.formatStateRegistration)(emit.IE),
275
277
  x: 1.5,
276
278
  y: y + 134.1,
277
279
  largura: 192.5,
@@ -292,10 +294,20 @@ async function getDadosEmitente({ y, doc, ajusteX, ajusteY, margemDireita, marge
292
294
  margemEsquerda,
293
295
  margemTopo
294
296
  });
295
- (0, campo_1.campo)({ value: emit.iEST ?? '', x: 197, y: y + 134.1, largura: 192.5, ajusteX, ajusteY, doc, margemEsquerda, margemTopo });
297
+ (0, campo_1.campo)({
298
+ value: (0, utils_1.formatStateRegistration)(emit.iEST ?? '') ?? '',
299
+ x: 197,
300
+ y: y + 134.1,
301
+ largura: 192.5,
302
+ ajusteX,
303
+ ajusteY,
304
+ doc,
305
+ margemEsquerda,
306
+ margemTopo
307
+ });
296
308
  (0, titulo_1.titulo)({ value: 'CNPJ', x: 392.5, y: y + 126.7, largura: 192.5, ajusteX, ajusteY, doc, margemEsquerda, margemTopo });
297
309
  (0, campo_1.campo)({
298
- value: emit.CNPJ?.replace(/(\d{2})(\d{3})(\d{3})(\d{4})(\d{2})/, '$1.$2.$3/$4-$5') ?? '',
310
+ value: (0, utils_1.formatCnpj)(emit.CNPJ ?? ''),
299
311
  x: 392.5,
300
312
  y: y + 134.1,
301
313
  largura: 192.5,
@@ -1,7 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getDestinatarioRemetente = void 0;
4
- const date_fns_1 = require("date-fns");
4
+ const utils_1 = require("../../../../domain/use-cases/utils");
5
+ const format_time_1 = require("../../../../domain/use-cases/utils/format-time");
5
6
  const campo_1 = require("./campo");
6
7
  const default_1 = require("./default");
7
8
  const linha_horizontal_1 = require("./linha-horizontal");
@@ -25,7 +26,7 @@ function getDestinatarioRemetente({ y, doc, ajusteX, ajusteY, margemDireita, mar
25
26
  (0, campo_1.campo)({ value: dest.xNome, x: 1.5, y: y + 18, largura: 353.5, alinhamento: 'left', ajusteX, ajusteY, doc, margemEsquerda, margemTopo });
26
27
  (0, titulo_1.titulo)({ value: 'CNPJ / CPF', x: 358, y: y + 11, largura: 133.5, ajusteX, ajusteY, doc, margemEsquerda, margemTopo });
27
28
  (0, campo_1.campo)({
28
- value: dest.CPF?.replace(/(\d{3})(\d{3})(\d{3})(\d{2})/, '$1.$2.$3-$4') ?? '',
29
+ value: (0, utils_1.formatCpf)(dest.CPF ?? ''),
29
30
  x: 358,
30
31
  y: y + 18,
31
32
  largura: 133.5,
@@ -36,7 +37,7 @@ function getDestinatarioRemetente({ y, doc, ajusteX, ajusteY, margemDireita, mar
36
37
  margemTopo
37
38
  });
38
39
  (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
+ value: (0, utils_1.formatCnpj)(dest.CNPJ ?? ''),
40
41
  x: 358,
41
42
  y: y + 18,
42
43
  largura: 133.5,
@@ -48,7 +49,7 @@ function getDestinatarioRemetente({ y, doc, ajusteX, ajusteY, margemDireita, mar
48
49
  });
49
50
  (0, titulo_1.titulo)({ value: 'DATA DA EMISSÃO', x: 495, y: y + 11, largura: 90, ajusteX, ajusteY, doc, margemEsquerda, margemTopo });
50
51
  (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
+ value: (0, utils_1.formatDate)(ide.dhEmi),
52
53
  x: 495,
53
54
  y: y + 18,
54
55
  largura: 90,
@@ -75,10 +76,20 @@ function getDestinatarioRemetente({ y, doc, ajusteX, ajusteY, margemDireita, mar
75
76
  (0, titulo_1.titulo)({ value: 'BAIRRO / DISTRITO', x: 276, y: y + 30, largura: 192, ajusteX, ajusteY, doc, margemEsquerda, margemTopo });
76
77
  (0, campo_1.campo)({ value: dest.enderDest?.xBairro ?? '', x: 276, y: y + 38, largura: 119, ajusteX, ajusteY, doc, margemEsquerda, margemTopo });
77
78
  (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, campo_1.campo)({
80
+ value: (0, utils_1.formatPostalCode)(dest.enderDest?.CEP ?? ''),
81
+ x: 398,
82
+ y: y + 38,
83
+ largura: 93,
84
+ ajusteX,
85
+ ajusteY,
86
+ doc,
87
+ margemEsquerda,
88
+ margemTopo
89
+ });
79
90
  (0, titulo_1.titulo)({ value: 'DATA DA SAÍDA', x: 495, y: y + 30, largura: 90, ajusteX, ajusteY, doc, margemEsquerda, margemTopo });
80
91
  (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') : '',
92
+ value: ide.dhSaiEnt !== undefined ? (0, utils_1.formatDate)(ide.dhSaiEnt) : '',
82
93
  x: 495,
83
94
  y: y + 38,
84
95
  largura: 90,
@@ -104,10 +115,20 @@ function getDestinatarioRemetente({ y, doc, ajusteX, ajusteY, margemDireita, mar
104
115
  (0, titulo_1.titulo)({ value: 'UF', x: 276, y: y + 51, largura: 20, ajusteX, ajusteY, doc, margemEsquerda, margemTopo });
105
116
  (0, campo_1.campo)({ value: dest.enderDest?.UF ?? '', x: 276, y: y + 58, largura: 20, ajusteX, ajusteY, doc, margemEsquerda, margemTopo });
106
117
  (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 });
118
+ (0, campo_1.campo)({
119
+ value: (0, utils_1.formatPhone)(dest.enderDest?.fone ?? ''),
120
+ x: 299,
121
+ y: y + 58,
122
+ largura: 96,
123
+ ajusteX,
124
+ ajusteY,
125
+ doc,
126
+ margemEsquerda,
127
+ margemTopo
128
+ });
108
129
  (0, titulo_1.titulo)({ value: 'INSCRIÇÃO ESTADUAL', x: 398, y: y + 51, largura: 93, ajusteX, ajusteY, doc, margemEsquerda, margemTopo });
109
130
  (0, campo_1.campo)({
110
- value: dest?.IE?.replace(/(\d{3})(\d{3})(\d{3})(\d{3})/, '$1.$2.$3.$4') ?? '',
131
+ value: (0, utils_1.formatStateRegistration)(dest?.IE ?? ''),
111
132
  x: 398,
112
133
  y: y + 58,
113
134
  largura: 93,
@@ -118,6 +139,17 @@ function getDestinatarioRemetente({ y, doc, ajusteX, ajusteY, margemDireita, mar
118
139
  margemTopo
119
140
  });
120
141
  (0, titulo_1.titulo)({ value: 'HORA DA SAÍDA', x: 495, y: y + 51, largura: 90, ajusteX, ajusteY, doc, margemEsquerda, margemTopo });
142
+ (0, campo_1.campo)({
143
+ value: ide.dhSaiEnt !== undefined ? (0, format_time_1.formatTime)(ide.dhSaiEnt) : '',
144
+ x: 495,
145
+ y: y + 58,
146
+ largura: 90,
147
+ ajusteX,
148
+ ajusteY,
149
+ doc,
150
+ margemEsquerda,
151
+ margemTopo
152
+ });
121
153
  return doc.y;
122
154
  }
123
155
  exports.getDestinatarioRemetente = getDestinatarioRemetente;
@@ -26,15 +26,15 @@ function getFaturaDuplicata({ y, doc, ajusteX, ajusteY, margemDireita, margemEsq
26
26
  .font('negrito')
27
27
  .text(' Valor Original:', { continued: true })
28
28
  .font('normal')
29
- .text(` ${(0, utils_1.formatMoney)(cobr.fat.vOrig, 2)}`, { continued: true })
29
+ .text(` ${(0, utils_1.formatNumber)(cobr.fat.vOrig, 2)}`, { continued: true })
30
30
  .font('negrito')
31
31
  .text(' Valor Desconto:', { continued: true })
32
32
  .font('normal')
33
- .text(` ${(0, utils_1.formatMoney)(cobr.fat.vDesc, 2)}`, { continued: true })
33
+ .text(` ${(0, utils_1.formatNumber)(cobr.fat.vDesc, 2)}`, { continued: true })
34
34
  .font('negrito')
35
35
  .text(' Valor Líquido:', { continued: true })
36
36
  .font('normal')
37
- .text(` ${(0, utils_1.formatMoney)(cobr.fat.vLiq, 2)}.`, { continued: true });
37
+ .text(` ${(0, utils_1.formatNumber)(cobr.fat.vLiq, 2)}.`, { continued: true });
38
38
  }
39
39
  if (cobr.dup !== undefined) {
40
40
  cobr.dup.forEach((dup, index) => {
@@ -43,7 +43,7 @@ function getFaturaDuplicata({ y, doc, ajusteX, ajusteY, margemDireita, margemEsq
43
43
  .font('negrito')
44
44
  .text(' Valor:', { continued: true })
45
45
  .font('normal')
46
- .text(` ${(0, utils_1.formatMoney)(dup.vDup, 2)}`, { continued: true });
46
+ .text(` ${(0, utils_1.formatNumber)(dup.vDup, 2)}`, { continued: true });
47
47
  doc
48
48
  .font('negrito')
49
49
  .text(' Vencimento:', { continued: true })
@@ -1,2 +1,2 @@
1
1
  import type { GeneratePdf } from '../../../../types';
2
- export declare function getHomologacao({ doc, ajusteX, ajusteY, margemEsquerda, margemTopo, larguraDoFormulario, protNFe }: GeneratePdf.InputHomologacao): void;
2
+ export declare function getHomologacao({ doc, ajusteX, ajusteY, margemEsquerda, margemTopo, larguraDoFormulario, protNFe, cancelada }: GeneratePdf.InputHomologacao): void;
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getHomologacao = void 0;
4
4
  const default_1 = require("./default");
5
- function getHomologacao({ doc, ajusteX, ajusteY, margemEsquerda, margemTopo, larguraDoFormulario, protNFe }) {
5
+ function getHomologacao({ doc, ajusteX, ajusteY, margemEsquerda, margemTopo, larguraDoFormulario, protNFe, cancelada }) {
6
6
  doc
7
7
  .font('normal')
8
8
  .fillColor(default_1.DEFAULT_NFE.corDoTitulo)
@@ -21,6 +21,17 @@ function getHomologacao({ doc, ajusteX, ajusteY, margemEsquerda, margemTopo, lar
21
21
  width: larguraDoFormulario,
22
22
  align: 'center'
23
23
  });
24
+ if (cancelada) {
25
+ doc
26
+ .font('normal')
27
+ .fillColor(default_1.DEFAULT_NFE.corDoTitulo)
28
+ .fontSize(38)
29
+ .fillOpacity(default_1.DEFAULT_NFE.opacidadeDaHomologacao)
30
+ .text('CANCELADA', margemEsquerda + ajusteX + 0, margemTopo + ajusteY + 300 + default_1.DEFAULT_NFE.ajusteYDaHomologacao, {
31
+ width: larguraDoFormulario,
32
+ align: 'center'
33
+ });
34
+ }
24
35
  doc.fillOpacity(100);
25
36
  }
26
37
  exports.getHomologacao = getHomologacao;
@@ -23,7 +23,7 @@ function getImposto({ y, doc, ajusteX, ajusteY, margemDireita, margemEsquerda, m
23
23
  (0, secao_1.secao)({ doc, value: 'CÁLCULO DO IMPOSTO', x: 1.5, y: y + 8.7, largura: 0, ajusteX, ajusteY, margemEsquerda, margemTopo });
24
24
  (0, titulo_1.titulo)({ value: 'BASE DE CÁLCULO DO ICMS', x: 1.5, y: y + 17.2, largura: 84, ajusteX, ajusteY, doc, margemEsquerda, margemTopo });
25
25
  (0, campo_1.campo)({
26
- value: (0, utils_1.formatMoney)(total.ICMSTot.vBC, 2),
26
+ value: (0, utils_1.formatNumber)(total.ICMSTot.vBC, 2),
27
27
  x: 1.5,
28
28
  y: y + 26.2,
29
29
  largura: 84,
@@ -36,7 +36,7 @@ function getImposto({ y, doc, ajusteX, ajusteY, margemDireita, margemEsquerda, m
36
36
  });
37
37
  (0, titulo_1.titulo)({ value: 'VALOR DO ICMS', x: 89, y: y + 17.2, largura: 84, ajusteX, ajusteY, doc, margemEsquerda, margemTopo });
38
38
  (0, campo_1.campo)({
39
- value: (0, utils_1.formatMoney)(total.ICMSTot.vICMS, 2),
39
+ value: (0, utils_1.formatNumber)(total.ICMSTot.vICMS, 2),
40
40
  x: 89,
41
41
  y: y + 26.2,
42
42
  largura: 84,
@@ -49,7 +49,7 @@ function getImposto({ y, doc, ajusteX, ajusteY, margemDireita, margemEsquerda, m
49
49
  });
50
50
  (0, titulo_1.titulo)({ value: 'BASE DE CÁLC. ICMS S.T.', x: 177, y: y + 17.2, largura: 84, ajusteX, ajusteY, doc, margemEsquerda, margemTopo });
51
51
  (0, campo_1.campo)({
52
- value: (0, utils_1.formatMoney)(total.ICMSTot.vBCST, 2),
52
+ value: (0, utils_1.formatNumber)(total.ICMSTot.vBCST, 2),
53
53
  x: 177,
54
54
  y: y + 26.2,
55
55
  largura: 84,
@@ -62,7 +62,7 @@ function getImposto({ y, doc, ajusteX, ajusteY, margemDireita, margemEsquerda, m
62
62
  });
63
63
  (0, titulo_1.titulo)({ value: 'VALOR DO ICMS SUBST.', x: 265, y: y + 17.2, largura: 84, ajusteX, ajusteY, doc, margemEsquerda, margemTopo });
64
64
  (0, campo_1.campo)({
65
- value: (0, utils_1.formatMoney)(total.ICMSTot.vST, 2),
65
+ value: (0, utils_1.formatNumber)(total.ICMSTot.vST, 2),
66
66
  x: 265,
67
67
  y: y + 26.2,
68
68
  largura: 84,
@@ -75,7 +75,7 @@ function getImposto({ y, doc, ajusteX, ajusteY, margemDireita, margemEsquerda, m
75
75
  });
76
76
  (0, titulo_1.titulo)({ value: 'VALOR IMP. IMPORTAÇÃO', x: 353, y: y + 17.2, largura: 84, ajusteX, ajusteY, doc, margemEsquerda, margemTopo });
77
77
  (0, campo_1.campo)({
78
- value: (0, utils_1.formatMoney)(total.ICMSTot.vIPI, 2),
78
+ value: (0, utils_1.formatNumber)(total.ICMSTot.vIPI, 2),
79
79
  x: 353,
80
80
  y: y + 26.2,
81
81
  largura: 84,
@@ -88,7 +88,7 @@ function getImposto({ y, doc, ajusteX, ajusteY, margemDireita, margemEsquerda, m
88
88
  });
89
89
  (0, titulo_1.titulo)({ value: 'VALOR DO PIS', x: 441, y: y + 17.2, largura: 47, ajusteX, ajusteY, doc, margemEsquerda, margemTopo });
90
90
  (0, campo_1.campo)({
91
- value: (0, utils_1.formatMoney)(total.ICMSTot.vPIS, 2),
91
+ value: (0, utils_1.formatNumber)(total.ICMSTot.vPIS, 2),
92
92
  x: 441,
93
93
  y: y + 26.2,
94
94
  largura: 47,
@@ -101,7 +101,7 @@ function getImposto({ y, doc, ajusteX, ajusteY, margemDireita, margemEsquerda, m
101
101
  });
102
102
  (0, titulo_1.titulo)({ value: 'VALOR TOTAL DOS PRODUTOS', x: 492, y: y + 17.2, largura: 93, ajusteX, ajusteY, doc, margemEsquerda, margemTopo });
103
103
  (0, campo_1.campo)({
104
- value: (0, utils_1.formatMoney)(total.ICMSTot.vProd, 2),
104
+ value: (0, utils_1.formatNumber)(total.ICMSTot.vProd, 2),
105
105
  x: 492,
106
106
  y: y + 26.2,
107
107
  largura: 93,
@@ -114,7 +114,7 @@ function getImposto({ y, doc, ajusteX, ajusteY, margemDireita, margemEsquerda, m
114
114
  });
115
115
  (0, titulo_1.titulo)({ value: 'VALOR DO FRETE', x: 1.5, y: y + 37.2, largura: 84, ajusteX, ajusteY, doc, margemEsquerda, margemTopo });
116
116
  (0, campo_1.campo)({
117
- value: (0, utils_1.formatMoney)(total.ICMSTot.vFrete, 2),
117
+ value: (0, utils_1.formatNumber)(total.ICMSTot.vFrete, 2),
118
118
  x: 1.5,
119
119
  y: y + 46.2,
120
120
  largura: 84,
@@ -127,7 +127,7 @@ function getImposto({ y, doc, ajusteX, ajusteY, margemDireita, margemEsquerda, m
127
127
  });
128
128
  (0, titulo_1.titulo)({ value: 'VALOR DO SEGURO', x: 89, y: y + 37.2, largura: 84, ajusteX, ajusteY, doc, margemEsquerda, margemTopo });
129
129
  (0, campo_1.campo)({
130
- value: (0, utils_1.formatMoney)(total.ICMSTot.vSeg, 2),
130
+ value: (0, utils_1.formatNumber)(total.ICMSTot.vSeg, 2),
131
131
  x: 89,
132
132
  y: y + 46.2,
133
133
  largura: 84,
@@ -140,7 +140,7 @@ function getImposto({ y, doc, ajusteX, ajusteY, margemDireita, margemEsquerda, m
140
140
  });
141
141
  (0, titulo_1.titulo)({ value: 'DESCONTO', x: 177, y: y + 37.2, largura: 84, ajusteX, ajusteY, doc, margemEsquerda, margemTopo });
142
142
  (0, campo_1.campo)({
143
- value: (0, utils_1.formatMoney)(total.ICMSTot.vDesc, 2),
143
+ value: (0, utils_1.formatNumber)(total.ICMSTot.vDesc, 2),
144
144
  x: 177,
145
145
  y: y + 46.2,
146
146
  largura: 84,
@@ -153,7 +153,7 @@ function getImposto({ y, doc, ajusteX, ajusteY, margemDireita, margemEsquerda, m
153
153
  });
154
154
  (0, titulo_1.titulo)({ value: 'OUTRAS DESPESAS', x: 265, y: y + 37.2, largura: 84, ajusteX, ajusteY, doc, margemEsquerda, margemTopo });
155
155
  (0, campo_1.campo)({
156
- value: (0, utils_1.formatMoney)(total.ICMSTot.vOutro, 2),
156
+ value: (0, utils_1.formatNumber)(total.ICMSTot.vOutro, 2),
157
157
  x: 265,
158
158
  y: y + 46.2,
159
159
  largura: 84,
@@ -166,7 +166,7 @@ function getImposto({ y, doc, ajusteX, ajusteY, margemDireita, margemEsquerda, m
166
166
  });
167
167
  (0, titulo_1.titulo)({ value: 'VALOR TOTAL DO IPI', x: 353, y: y + 37.2, largura: 84, ajusteX, ajusteY, doc, margemEsquerda, margemTopo });
168
168
  (0, campo_1.campo)({
169
- value: (0, utils_1.formatMoney)(total.ICMSTot.vIPI, 2),
169
+ value: (0, utils_1.formatNumber)(total.ICMSTot.vIPI, 2),
170
170
  x: 353,
171
171
  y: y + 46.2,
172
172
  largura: 84,
@@ -190,7 +190,7 @@ function getImposto({ y, doc, ajusteX, ajusteY, margemDireita, margemEsquerda, m
190
190
  tamanho: default_1.DEFAULT_NFE.tamanhoDaFonteDoTitulo - 1
191
191
  });
192
192
  (0, campo_1.campo)({
193
- value: (0, utils_1.formatMoney)(total.ICMSTot.vCOFINS, 2),
193
+ value: (0, utils_1.formatNumber)(total.ICMSTot.vCOFINS, 2),
194
194
  x: 440.5,
195
195
  y: y + 46.2,
196
196
  largura: 47,
@@ -203,7 +203,7 @@ function getImposto({ y, doc, ajusteX, ajusteY, margemDireita, margemEsquerda, m
203
203
  });
204
204
  (0, titulo_1.titulo)({ value: 'VALOR TOTAL DA NOTA', x: 492, y: y + 37.2, largura: 93, ajusteX, ajusteY, doc, margemEsquerda, margemTopo });
205
205
  (0, campo_1.campo)({
206
- value: (0, utils_1.formatMoney)(total.ICMSTot.vNF, 2),
206
+ value: (0, utils_1.formatNumber)(total.ICMSTot.vNF, 2),
207
207
  x: 492,
208
208
  y: y + 46.2,
209
209
  largura: 93,
@@ -17,7 +17,18 @@ function getIss({ y, doc, ajusteX, ajusteY, margemDireita, margemEsquerda, marge
17
17
  (0, linha_vertical_1.linhaVertical)({ y1: 762.2, y2: 782.2, x: larguraDoFormulario, doc, ajusteX, ajusteY, margemEsquerda, margemTopo });
18
18
  (0, secao_1.secao)({ doc, value: 'CÁLCULO DO ISSQN', x: 1.5, y: 754.5, largura: 0, ajusteX, ajusteY, margemEsquerda, margemTopo });
19
19
  (0, titulo_1.titulo)({ value: 'INSCRIÇÃO MUNICIPAL', x: 1.5, y: 763, largura: 132.5, ajusteX, ajusteY, doc, margemEsquerda, margemTopo });
20
- (0, campo_1.campo)({ value: emit.IE, x: 1.5, y: 771, largura: 132.5, alinhamento: 'left', ajusteX, ajusteY, doc, margemEsquerda, margemTopo });
20
+ (0, campo_1.campo)({
21
+ value: emit?.IM ?? '',
22
+ x: 1.5,
23
+ y: 771,
24
+ largura: 132.5,
25
+ alinhamento: 'left',
26
+ ajusteX,
27
+ ajusteY,
28
+ doc,
29
+ margemEsquerda,
30
+ margemTopo
31
+ });
21
32
  (0, titulo_1.titulo)({ value: 'VALOR TOTAL DOS SERVIÇOS', x: 137.5, y: 763, largura: 132.5, ajusteX, ajusteY, doc, margemEsquerda, margemTopo });
22
33
  (0, campo_1.campo)({
23
34
  value: total.ISSQNtot?.vServ ?? '',
@@ -0,0 +1,2 @@
1
+ import type { GeneratePdf } from '../../../../types';
2
+ export declare function getNotaCancelada({ doc, ajusteX, ajusteY, margemEsquerda, margemTopo, larguraDoFormulario }: GeneratePdf.InputNotaCancelada): void;
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getNotaCancelada = void 0;
4
+ const default_1 = require("./default");
5
+ function getNotaCancelada({ doc, ajusteX, ajusteY, margemEsquerda, margemTopo, larguraDoFormulario }) {
6
+ doc
7
+ .font('normal')
8
+ .fillColor(default_1.DEFAULT_NFE.corDoTitulo)
9
+ .fontSize(60)
10
+ .fillOpacity(default_1.DEFAULT_NFE.opacidadeDaHomologacao)
11
+ .text('CANCELADA', margemEsquerda + ajusteX + 0, margemTopo + ajusteY + 200 + default_1.DEFAULT_NFE.ajusteYDaHomologacao, {
12
+ width: larguraDoFormulario,
13
+ align: 'center'
14
+ });
15
+ doc.fillOpacity(100);
16
+ }
17
+ exports.getNotaCancelada = getNotaCancelada;
@@ -27,7 +27,7 @@ function getRecibo({ y, doc, ajusteX, ajusteY, margemDireita, margemEsquerda, ma
27
27
  'Emissão:',
28
28
  (0, date_fns_1.format)((0, date_fns_1.parseISO)(ide.dhEmi), 'dd/MM/yyyy HH:mm:ss'),
29
29
  '- Valor Total:',
30
- (0, utils_1.formatMoney)(total.ICMSTot.vNF, 2),
30
+ (0, utils_1.formatNumber)(total.ICMSTot.vNF, 2),
31
31
  '- Destinatário:',
32
32
  dest.xNome,
33
33
  '- Endereço:',