@alexssmusica/node-pdf-nfe 1.1.2 → 1.1.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.
Files changed (44) hide show
  1. package/lib/application/helpers/generate-pdf/nfe/gerar-itens.js +10 -10
  2. package/lib/application/helpers/generate-pdf/nfe/get-dados-emitente.js +20 -8
  3. package/lib/application/helpers/generate-pdf/nfe/get-destinatario-remetente.js +40 -8
  4. package/lib/application/helpers/generate-pdf/nfe/get-fatura-duplicata.js +4 -4
  5. package/lib/application/helpers/generate-pdf/nfe/get-imposto.js +14 -14
  6. package/lib/application/helpers/generate-pdf/nfe/get-iss.js +12 -1
  7. package/lib/application/helpers/generate-pdf/nfe/get-recibo.js +1 -1
  8. package/lib/application/helpers/generate-pdf/nfe/get-transporte.js +58 -21
  9. package/lib/domain/use-cases/pdf/pdf-NFCe.js +13 -13
  10. package/lib/domain/use-cases/utils/current-date.d.ts +1 -0
  11. package/lib/domain/use-cases/utils/{data-atual.js → current-date.js} +3 -3
  12. package/lib/domain/use-cases/utils/format-cnpj.d.ts +1 -0
  13. package/lib/domain/use-cases/utils/format-cnpj.js +9 -0
  14. package/lib/domain/use-cases/utils/format-cpf.d.ts +1 -0
  15. package/lib/domain/use-cases/utils/format-cpf.js +9 -0
  16. package/lib/domain/use-cases/utils/format-date-time.d.ts +1 -0
  17. package/lib/domain/use-cases/utils/format-date-time.js +11 -0
  18. package/lib/domain/use-cases/utils/format-date.d.ts +1 -0
  19. package/lib/domain/use-cases/utils/format-date.js +10 -0
  20. package/lib/domain/use-cases/utils/format-key.d.ts +1 -0
  21. package/lib/domain/use-cases/utils/format-key.js +7 -0
  22. package/lib/domain/use-cases/utils/format-number.d.ts +1 -0
  23. package/lib/domain/use-cases/utils/format-number.js +7 -0
  24. package/lib/domain/use-cases/utils/format-phone.d.ts +1 -0
  25. package/lib/domain/use-cases/utils/format-phone.js +21 -0
  26. package/lib/domain/use-cases/utils/format-plate.d.ts +1 -0
  27. package/lib/domain/use-cases/utils/format-plate.js +17 -0
  28. package/lib/domain/use-cases/utils/format-postal-code.d.ts +1 -0
  29. package/lib/domain/use-cases/utils/format-postal-code.js +9 -0
  30. package/lib/domain/use-cases/utils/format-protocol.d.ts +1 -0
  31. package/lib/domain/use-cases/utils/format-protocol.js +9 -0
  32. package/lib/domain/use-cases/utils/format-state-registration.d.ts +1 -0
  33. package/lib/domain/use-cases/utils/format-state-registration.js +50 -0
  34. package/lib/domain/use-cases/utils/format-time.d.ts +1 -0
  35. package/lib/domain/use-cases/utils/format-time.js +9 -0
  36. package/lib/domain/use-cases/utils/index.d.ts +10 -2
  37. package/lib/domain/use-cases/utils/index.js +10 -2
  38. package/lib/domain/use-cases/utils/return-font-size-carrier.d.ts +1 -0
  39. package/lib/domain/use-cases/utils/return-font-size-carrier.js +24 -0
  40. package/lib/tsconfig.tsbuildinfo +1 -1
  41. package/package.json +5 -5
  42. package/lib/domain/use-cases/utils/data-atual.d.ts +0 -1
  43. package/lib/domain/use-cases/utils/intl-number-format.d.ts +0 -1
  44. package/lib/domain/use-cases/utils/intl-number-format.js +0 -7
@@ -97,7 +97,7 @@ async function gerarItens({ nf, ajusteX, ajusteY, doc, margemEsquerda, margemTop
97
97
  maiorY = Math.max(maiorY, pdf.y);
98
98
  (0, normal_1.normal)({
99
99
  doc,
100
- value: (0, utils_1.formatMoney)(item.prod.qCom, 4),
100
+ value: (0, utils_1.formatNumber)(item.prod.qCom, 4),
101
101
  x: 335,
102
102
  y,
103
103
  largura: 37,
@@ -111,7 +111,7 @@ async function gerarItens({ nf, ajusteX, ajusteY, doc, margemEsquerda, margemTop
111
111
  maiorY = Math.max(maiorY, pdf.y);
112
112
  (0, normal_1.normal)({
113
113
  doc,
114
- value: (0, utils_1.formatMoney)(item.prod.vUnCom, 2),
114
+ value: (0, utils_1.formatNumber)(item.prod.vUnCom, 2),
115
115
  x: 375,
116
116
  y,
117
117
  largura: 32.5,
@@ -125,7 +125,7 @@ async function gerarItens({ nf, ajusteX, ajusteY, doc, margemEsquerda, margemTop
125
125
  maiorY = Math.max(maiorY, pdf.y);
126
126
  (0, normal_1.normal)({
127
127
  doc,
128
- value: (0, utils_1.formatMoney)(item.prod.vProd, 2),
128
+ value: (0, utils_1.formatNumber)(item.prod.vProd, 2),
129
129
  x: 409.5,
130
130
  y,
131
131
  largura: 31,
@@ -144,7 +144,7 @@ async function gerarItens({ nf, ajusteX, ajusteY, doc, margemEsquerda, margemTop
144
144
  (0, normal_1.normal)({
145
145
  doc,
146
146
  value: item.imposto[keys[i]][newKeys[0]].CST
147
- ? `${item.imposto[keys[i]][newKeys[0]].orig}${item.imposto[keys[i]][newKeys[0]].CST}`
147
+ ? `${item.imposto[keys[i]][newKeys[0]].orig}/${item.imposto[keys[i]][newKeys[0]].CST}`
148
148
  : '',
149
149
  x: 270,
150
150
  y,
@@ -159,7 +159,7 @@ async function gerarItens({ nf, ajusteX, ajusteY, doc, margemEsquerda, margemTop
159
159
  (0, normal_1.normal)({
160
160
  doc,
161
161
  value: item.imposto[keys[i]][newKeys[0]].CSOSN
162
- ? `${item.imposto[keys[i]][newKeys[0]].orig}${item.imposto[keys[i]][newKeys[0]].CSOSN}`
162
+ ? `${item.imposto[keys[i]][newKeys[0]].orig}/${item.imposto[keys[i]][newKeys[0]].CSOSN}`
163
163
  : '',
164
164
  x: 270,
165
165
  y,
@@ -174,7 +174,7 @@ async function gerarItens({ nf, ajusteX, ajusteY, doc, margemEsquerda, margemTop
174
174
  maiorY = Math.max(maiorY, pdf.y);
175
175
  (0, normal_1.normal)({
176
176
  doc,
177
- value: (0, utils_1.formatMoney)(item.imposto[keys[i]][newKeys[0]].vBC ?? 0, 2),
177
+ value: (0, utils_1.formatNumber)(item.imposto[keys[i]][newKeys[0]].vBC ?? 0, 2),
178
178
  x: 443,
179
179
  y,
180
180
  largura: 32.5,
@@ -188,7 +188,7 @@ async function gerarItens({ nf, ajusteX, ajusteY, doc, margemEsquerda, margemTop
188
188
  maiorY = Math.max(maiorY, pdf.y);
189
189
  (0, normal_1.normal)({
190
190
  doc,
191
- value: (0, utils_1.formatMoney)(item.imposto[keys[i]][newKeys[0]].vICMS ?? 0, 2),
191
+ value: (0, utils_1.formatNumber)(item.imposto[keys[i]][newKeys[0]].vICMS ?? 0, 2),
192
192
  x: 476,
193
193
  y,
194
194
  largura: 32,
@@ -202,7 +202,7 @@ async function gerarItens({ nf, ajusteX, ajusteY, doc, margemEsquerda, margemTop
202
202
  maiorY = Math.max(maiorY, pdf.y);
203
203
  (0, normal_1.normal)({
204
204
  doc,
205
- value: (0, utils_1.formatMoney)(item.imposto[keys[i]][newKeys[0]].pICMS ?? 0, 2),
205
+ value: (0, utils_1.formatNumber)(item.imposto[keys[i]][newKeys[0]].pICMS ?? 0, 2),
206
206
  x: 532,
207
207
  y: y + 0.65,
208
208
  largura: 28,
@@ -218,7 +218,7 @@ async function gerarItens({ nf, ajusteX, ajusteY, doc, margemEsquerda, margemTop
218
218
  }
219
219
  (0, normal_1.normal)({
220
220
  doc,
221
- value: (0, utils_1.formatMoney)(item.imposto.IPI?.IPITrib?.vIPI ?? 0, 2),
221
+ value: (0, utils_1.formatNumber)(item.imposto.IPI?.IPITrib?.vIPI ?? 0, 2),
222
222
  x: 507.5,
223
223
  y,
224
224
  largura: 26,
@@ -232,7 +232,7 @@ async function gerarItens({ nf, ajusteX, ajusteY, doc, margemEsquerda, margemTop
232
232
  maiorY = Math.max(maiorY, pdf.y);
233
233
  (0, normal_1.normal)({
234
234
  doc,
235
- value: (0, utils_1.formatMoney)(item.imposto.IPI?.IPITrib?.pIPI ?? 0, 2),
235
+ value: (0, utils_1.formatNumber)(item.imposto.IPI?.IPITrib?.pIPI ?? 0, 2),
236
236
  x: 557.75,
237
237
  y,
238
238
  largura: 29,
@@ -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 })
@@ -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 ?? '',
@@ -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:',
@@ -2,6 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getTransporte = void 0;
4
4
  const utils_1 = require("../../../../domain/use-cases/utils");
5
+ const format_plate_1 = require("../../../../domain/use-cases/utils/format-plate");
5
6
  const campo_1 = require("./campo");
6
7
  const default_1 = require("./default");
7
8
  const linha_horizontal_1 = require("./linha-horizontal");
@@ -26,17 +27,13 @@ function getTransporte({ y, doc, ajusteX, ajusteY, margemDireita, margemEsquerda
26
27
  (0, linha_vertical_1.linhaVertical)({ y1: y + 8, y2: y + 68, x: larguraDoFormulario, doc, ajusteX, ajusteY, margemEsquerda, margemTopo });
27
28
  (0, secao_1.secao)({ doc, value: 'TRANSPORTADOR / VOLUMES TRANSPORTADOS', x: 1.5, y, largura: 0, ajusteX, ajusteY, margemEsquerda, margemTopo });
28
29
  (0, titulo_1.titulo)({ value: 'NOME / RAZÃO SOCIAL', x: 1.5, y: y + 9.5, largura: 166.5, ajusteX, ajusteY, doc, margemEsquerda, margemTopo });
29
- let tamanhoFonte = 6;
30
- if (transp.transporta?.xNome && transp.transporta?.xNome.length > 40) {
31
- tamanhoFonte = 5;
32
- }
33
30
  (0, campo_1.campo)({
34
31
  value: transp.transporta?.xNome ?? '',
35
32
  x: 1.5,
36
33
  y: y + 17.5,
37
34
  largura: 166.5,
38
35
  alinhamento: 'left',
39
- tamanho: tamanhoFonte,
36
+ tamanho: (0, utils_1.returnFontSizeCarrier)(transp.transporta?.xNome ?? ''),
40
37
  ajusteX,
41
38
  ajusteY,
42
39
  doc,
@@ -45,47 +42,77 @@ function getTransporte({ y, doc, ajusteX, ajusteY, margemDireita, margemEsquerda
45
42
  });
46
43
  function ModFrete(value) {
47
44
  if (value === '0') {
48
- return 'Por conta do Remetente';
45
+ return '0 - Por conta do Remet';
49
46
  }
50
47
  else if (value === '1') {
51
- return 'Por conta do Destinatário';
48
+ return '1 - Por conta do Dest';
52
49
  }
53
50
  else if (value === '2') {
54
- return 'Por conta de Terceiros';
51
+ return '2 - Por conta de Terc';
55
52
  }
56
53
  else if (value === '3') {
57
- return 'Por conta do Remetente';
54
+ return '3 - Por conta do Remet';
58
55
  }
59
56
  else if (value === '4') {
60
- return 'Por conta do Destinatário';
57
+ return '4 - Por conta do Dest';
61
58
  }
62
59
  else if (value === '9') {
63
- return 'Sem Ocorrência de Transporte';
60
+ return '9 - Sem Ocorr de Transp';
64
61
  }
65
- return 'VALOR NAO CADASTRADO';
62
+ return '';
66
63
  }
67
64
  (0, titulo_1.titulo)({ value: 'FRETE POR CONTA', x: 171.5, y: y + 9.5, largura: 85, ajusteX, ajusteY, doc, margemEsquerda, margemTopo });
68
65
  (0, campo_1.campo)({
69
66
  value: ModFrete(transp.modFrete),
70
- x: 171.5,
67
+ x: 164,
71
68
  y: y + 17.5,
72
- largura: 85,
69
+ largura: 100,
73
70
  ajusteX,
74
71
  ajusteY,
75
72
  doc,
76
73
  margemEsquerda,
77
74
  margemTopo,
78
- tamanho: 6
75
+ tamanho: 8.4
79
76
  });
80
77
  (0, titulo_1.titulo)({ value: 'CÓDIGO ANTT', x: 259.5, y: y + 9.5, largura: 84, ajusteX, ajusteY, doc, margemEsquerda, margemTopo });
81
78
  (0, campo_1.campo)({ value: transp.veicTransp?.RNTC ?? '', x: 259.5, y: y + 17.5, largura: 84, ajusteX, ajusteY, doc, margemEsquerda, margemTopo });
82
79
  (0, titulo_1.titulo)({ value: 'PLACA DO VEÍCULO', x: 347.5, y: y + 9.5, largura: 84, ajusteX, ajusteY, doc, margemEsquerda, margemTopo });
83
- (0, campo_1.campo)({ value: transp.veicTransp?.placa ?? '', x: 347.5, y: y + 17.5, largura: 84, ajusteX, ajusteY, doc, margemEsquerda, margemTopo });
80
+ (0, campo_1.campo)({
81
+ value: (0, format_plate_1.formatLicensePlate)(transp.veicTransp?.placa ?? ''),
82
+ x: 347.5,
83
+ y: y + 17.5,
84
+ largura: 84,
85
+ ajusteX,
86
+ ajusteY,
87
+ doc,
88
+ margemEsquerda,
89
+ margemTopo
90
+ });
84
91
  (0, titulo_1.titulo)({ value: 'UF', x: 435.5, y: y + 9.5, largura: 19.5, ajusteX, ajusteY, doc, margemEsquerda, margemTopo });
85
92
  (0, campo_1.campo)({ value: transp.veicTransp?.UF ?? '', x: 435.5, y: y + 17.5, largura: 19.5, ajusteX, ajusteY, doc, margemEsquerda, margemTopo });
86
93
  (0, titulo_1.titulo)({ value: 'CNPJ / CPF', x: 458, y: y + 9.5, largura: 126.5, ajusteX, ajusteY, doc, margemEsquerda, margemTopo });
87
- (0, campo_1.campo)({ value: transp.transporta?.CNPJ ?? '', x: 458, y: y + 17.5, largura: 126.5, ajusteX, ajusteY, doc, margemEsquerda, margemTopo });
88
- (0, campo_1.campo)({ value: transp.transporta?.CPF ?? '', x: 458, y: y + 17.5, largura: 126.5, ajusteX, ajusteY, doc, margemEsquerda, margemTopo });
94
+ (0, campo_1.campo)({
95
+ value: (0, utils_1.formatCnpj)(transp.transporta?.CNPJ ?? ''),
96
+ x: 458,
97
+ y: y + 17.5,
98
+ largura: 126.5,
99
+ ajusteX,
100
+ ajusteY,
101
+ doc,
102
+ margemEsquerda,
103
+ margemTopo
104
+ });
105
+ (0, campo_1.campo)({
106
+ value: (0, utils_1.formatCpf)(transp.transporta?.CPF ?? ''),
107
+ x: 458,
108
+ y: y + 17.5,
109
+ largura: 126.5,
110
+ ajusteX,
111
+ ajusteY,
112
+ doc,
113
+ margemEsquerda,
114
+ margemTopo
115
+ });
89
116
  (0, titulo_1.titulo)({ value: 'ENDEREÇO', x: 1.5, y: y + 30, largura: 254, ajusteX, ajusteY, doc, margemEsquerda, margemTopo });
90
117
  (0, campo_1.campo)({
91
118
  value: transp.transporta?.xEnder ?? '',
@@ -105,7 +132,17 @@ function getTransporte({ y, doc, ajusteX, ajusteY, margemDireita, margemEsquerda
105
132
  (0, titulo_1.titulo)({ value: 'UF', x: 435.5, y: y + 30, largura: 19.5, ajusteX, ajusteY, doc, margemEsquerda, margemTopo });
106
133
  (0, campo_1.campo)({ value: transp.transporta?.uf ?? '', x: 435.5, y: y + 38.5, largura: 19.5, ajusteX, ajusteY, doc, margemEsquerda, margemTopo });
107
134
  (0, titulo_1.titulo)({ value: 'INSCRIÇÃO ESTADUAL', x: 458, y: y + 30, largura: 126.5, ajusteX, ajusteY, doc, margemEsquerda, margemTopo });
108
- (0, campo_1.campo)({ value: transp.transporta?.ie ?? '', x: 458, y: y + 38.5, largura: 126.5, ajusteX, ajusteY, doc, margemEsquerda, margemTopo });
135
+ (0, campo_1.campo)({
136
+ value: (0, utils_1.formatStateRegistration)(transp.transporta?.ie ?? ''),
137
+ x: 458,
138
+ y: y + 38.5,
139
+ largura: 126.5,
140
+ ajusteX,
141
+ ajusteY,
142
+ doc,
143
+ margemEsquerda,
144
+ margemTopo
145
+ });
109
146
  (0, titulo_1.titulo)({ value: 'QUANTIDADE', x: 1.5, y: y + 50, largura: 56.5, ajusteX, ajusteY, doc, margemEsquerda, margemTopo });
110
147
  (0, campo_1.campo)({ value: transp.vol?.qVol ?? '', x: 1.5, y: y + 58, largura: 56.5, ajusteX, ajusteY, doc, margemEsquerda, margemTopo });
111
148
  (0, titulo_1.titulo)({ value: 'ESPÉCIE', x: 60.8, y: y + 50, largura: 96, ajusteX, ajusteY, doc, margemEsquerda, margemTopo });
@@ -116,7 +153,7 @@ function getTransporte({ y, doc, ajusteX, ajusteY, margemDireita, margemEsquerda
116
153
  (0, campo_1.campo)({ value: transp.vol?.nVol ?? '', x: 259.5, y: y + 58, largura: 96, ajusteX, ajusteY, doc, margemEsquerda, margemTopo });
117
154
  (0, titulo_1.titulo)({ value: 'PESO BRUTO', x: 358.5, y: y + 50, largura: 112.5, ajusteX, ajusteY, doc, margemEsquerda, margemTopo });
118
155
  (0, campo_1.campo)({
119
- value: transp.vol?.pesoB ? (0, utils_1.formatMoney)(transp.vol?.pesoB, 3) : '',
156
+ value: transp.vol?.pesoB ? (0, utils_1.formatNumber)(transp.vol?.pesoB, 3) : '',
120
157
  x: 358.5,
121
158
  y: y + 58,
122
159
  largura: 112.5,
@@ -128,7 +165,7 @@ function getTransporte({ y, doc, ajusteX, ajusteY, margemDireita, margemEsquerda
128
165
  });
129
166
  (0, titulo_1.titulo)({ value: 'PESO LÍQUIDO', x: 474.5, y: y + 50, largura: 110.5, ajusteX, ajusteY, doc, margemEsquerda, margemTopo });
130
167
  (0, campo_1.campo)({
131
- value: transp.vol?.pesoL ? (0, utils_1.formatMoney)(transp.vol?.pesoL, 3) : '',
168
+ value: transp.vol?.pesoL ? (0, utils_1.formatNumber)(transp.vol?.pesoL, 3) : '',
132
169
  x: 474.5,
133
170
  y: y + 58,
134
171
  largura: 110.5,