@mmachadosantos/nfe-danfe-pdf 1.0.4

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 (135) hide show
  1. package/README.md +719 -0
  2. package/lib/application/helpers/generate-pdf/fontes/Times New Roman Bold Italic.ttf +0 -0
  3. package/lib/application/helpers/generate-pdf/fontes/Times New Roman Bold.ttf +0 -0
  4. package/lib/application/helpers/generate-pdf/fontes/Times New Roman Italic.ttf +0 -0
  5. package/lib/application/helpers/generate-pdf/fontes/Times New Roman.ttf +0 -0
  6. package/lib/application/helpers/generate-pdf/fontes/barlow-condensed/BarlowCondensed-Black.ttf +0 -0
  7. package/lib/application/helpers/generate-pdf/fontes/barlow-condensed/BarlowCondensed-BlackItalic.ttf +0 -0
  8. package/lib/application/helpers/generate-pdf/fontes/barlow-condensed/BarlowCondensed-Bold.ttf +0 -0
  9. package/lib/application/helpers/generate-pdf/fontes/barlow-condensed/BarlowCondensed-BoldItalic.ttf +0 -0
  10. package/lib/application/helpers/generate-pdf/fontes/barlow-condensed/BarlowCondensed-ExtraBold.ttf +0 -0
  11. package/lib/application/helpers/generate-pdf/fontes/barlow-condensed/BarlowCondensed-ExtraBoldItalic.ttf +0 -0
  12. package/lib/application/helpers/generate-pdf/fontes/barlow-condensed/BarlowCondensed-ExtraLight.ttf +0 -0
  13. package/lib/application/helpers/generate-pdf/fontes/barlow-condensed/BarlowCondensed-ExtraLightItalic.ttf +0 -0
  14. package/lib/application/helpers/generate-pdf/fontes/barlow-condensed/BarlowCondensed-Italic.ttf +0 -0
  15. package/lib/application/helpers/generate-pdf/fontes/barlow-condensed/BarlowCondensed-Light.ttf +0 -0
  16. package/lib/application/helpers/generate-pdf/fontes/barlow-condensed/BarlowCondensed-LightItalic.ttf +0 -0
  17. package/lib/application/helpers/generate-pdf/fontes/barlow-condensed/BarlowCondensed-Medium.ttf +0 -0
  18. package/lib/application/helpers/generate-pdf/fontes/barlow-condensed/BarlowCondensed-MediumItalic.ttf +0 -0
  19. package/lib/application/helpers/generate-pdf/fontes/barlow-condensed/BarlowCondensed-Regular.ttf +0 -0
  20. package/lib/application/helpers/generate-pdf/fontes/barlow-condensed/BarlowCondensed-SemiBold.ttf +0 -0
  21. package/lib/application/helpers/generate-pdf/fontes/barlow-condensed/BarlowCondensed-SemiBoldItalic.ttf +0 -0
  22. package/lib/application/helpers/generate-pdf/fontes/barlow-condensed/BarlowCondensed-Thin.ttf +0 -0
  23. package/lib/application/helpers/generate-pdf/fontes/barlow-condensed/BarlowCondensed-ThinItalic.ttf +0 -0
  24. package/lib/application/helpers/generate-pdf/fontes/roboto-condensed/RobotoCondensed-Bold.ttf +0 -0
  25. package/lib/application/helpers/generate-pdf/fontes/roboto-condensed/RobotoCondensed-BoldItalic.ttf +0 -0
  26. package/lib/application/helpers/generate-pdf/fontes/roboto-condensed/RobotoCondensed-Italic.ttf +0 -0
  27. package/lib/application/helpers/generate-pdf/fontes/roboto-condensed/RobotoCondensed-Light.ttf +0 -0
  28. package/lib/application/helpers/generate-pdf/fontes/roboto-condensed/RobotoCondensed-LightItalic.ttf +0 -0
  29. package/lib/application/helpers/generate-pdf/fontes/roboto-condensed/RobotoCondensed-Regular.ttf +0 -0
  30. package/lib/application/helpers/generate-pdf/nfe/campo.d.ts +2 -0
  31. package/lib/application/helpers/generate-pdf/nfe/campo.js +15 -0
  32. package/lib/application/helpers/generate-pdf/nfe/cria-layout.d.ts +2 -0
  33. package/lib/application/helpers/generate-pdf/nfe/cria-layout.js +149 -0
  34. package/lib/application/helpers/generate-pdf/nfe/default.d.ts +23 -0
  35. package/lib/application/helpers/generate-pdf/nfe/default.js +26 -0
  36. package/lib/application/helpers/generate-pdf/nfe/gerar-itens.d.ts +2 -0
  37. package/lib/application/helpers/generate-pdf/nfe/gerar-itens.js +291 -0
  38. package/lib/application/helpers/generate-pdf/nfe/get-dados-adicionais.d.ts +2 -0
  39. package/lib/application/helpers/generate-pdf/nfe/get-dados-adicionais.js +269 -0
  40. package/lib/application/helpers/generate-pdf/nfe/get-dados-emitente.d.ts +2 -0
  41. package/lib/application/helpers/generate-pdf/nfe/get-dados-emitente.js +319 -0
  42. package/lib/application/helpers/generate-pdf/nfe/get-destinatario-remetente.d.ts +2 -0
  43. package/lib/application/helpers/generate-pdf/nfe/get-destinatario-remetente.js +154 -0
  44. package/lib/application/helpers/generate-pdf/nfe/get-fatura-duplicata.d.ts +2 -0
  45. package/lib/application/helpers/generate-pdf/nfe/get-fatura-duplicata.js +118 -0
  46. package/lib/application/helpers/generate-pdf/nfe/get-homologacao.d.ts +2 -0
  47. package/lib/application/helpers/generate-pdf/nfe/get-homologacao.js +36 -0
  48. package/lib/application/helpers/generate-pdf/nfe/get-imposto.d.ts +2 -0
  49. package/lib/application/helpers/generate-pdf/nfe/get-imposto.js +219 -0
  50. package/lib/application/helpers/generate-pdf/nfe/get-iss.d.ts +2 -0
  51. package/lib/application/helpers/generate-pdf/nfe/get-iss.js +73 -0
  52. package/lib/application/helpers/generate-pdf/nfe/get-menu-itens.d.ts +2 -0
  53. package/lib/application/helpers/generate-pdf/nfe/get-menu-itens.js +199 -0
  54. package/lib/application/helpers/generate-pdf/nfe/get-nota-cancelada.d.ts +2 -0
  55. package/lib/application/helpers/generate-pdf/nfe/get-nota-cancelada.js +16 -0
  56. package/lib/application/helpers/generate-pdf/nfe/get-recibo.d.ts +2 -0
  57. package/lib/application/helpers/generate-pdf/nfe/get-recibo.js +101 -0
  58. package/lib/application/helpers/generate-pdf/nfe/get-transporte.d.ts +2 -0
  59. package/lib/application/helpers/generate-pdf/nfe/get-transporte.js +179 -0
  60. package/lib/application/helpers/generate-pdf/nfe/italico.d.ts +2 -0
  61. package/lib/application/helpers/generate-pdf/nfe/italico.js +16 -0
  62. package/lib/application/helpers/generate-pdf/nfe/linha-horizontal-tracejada.d.ts +2 -0
  63. package/lib/application/helpers/generate-pdf/nfe/linha-horizontal-tracejada.js +7 -0
  64. package/lib/application/helpers/generate-pdf/nfe/linha-horizontal.d.ts +2 -0
  65. package/lib/application/helpers/generate-pdf/nfe/linha-horizontal.js +26 -0
  66. package/lib/application/helpers/generate-pdf/nfe/linha-vertical.d.ts +2 -0
  67. package/lib/application/helpers/generate-pdf/nfe/linha-vertical.js +14 -0
  68. package/lib/application/helpers/generate-pdf/nfe/load-fontes.d.ts +2 -0
  69. package/lib/application/helpers/generate-pdf/nfe/load-fontes.js +30 -0
  70. package/lib/application/helpers/generate-pdf/nfe/negrito.d.ts +2 -0
  71. package/lib/application/helpers/generate-pdf/nfe/negrito.js +16 -0
  72. package/lib/application/helpers/generate-pdf/nfe/normal.d.ts +2 -0
  73. package/lib/application/helpers/generate-pdf/nfe/normal.js +16 -0
  74. package/lib/application/helpers/generate-pdf/nfe/options-doc.d.ts +10 -0
  75. package/lib/application/helpers/generate-pdf/nfe/options-doc.js +14 -0
  76. package/lib/application/helpers/generate-pdf/nfe/secao.d.ts +2 -0
  77. package/lib/application/helpers/generate-pdf/nfe/secao.js +16 -0
  78. package/lib/application/helpers/generate-pdf/nfe/titulo.d.ts +2 -0
  79. package/lib/application/helpers/generate-pdf/nfe/titulo.js +17 -0
  80. package/lib/application/helpers/xml/deserialize.d.ts +2 -0
  81. package/lib/application/helpers/xml/deserialize.js +24 -0
  82. package/lib/application/helpers/xml/index.d.ts +1 -0
  83. package/lib/application/helpers/xml/index.js +17 -0
  84. package/lib/domain/use-cases/pdf/index.d.ts +2 -0
  85. package/lib/domain/use-cases/pdf/index.js +25 -0
  86. package/lib/domain/use-cases/pdf/pdf-NFCe.d.ts +2 -0
  87. package/lib/domain/use-cases/pdf/pdf-NFCe.js +687 -0
  88. package/lib/domain/use-cases/pdf/pdf-NFe.d.ts +2 -0
  89. package/lib/domain/use-cases/pdf/pdf-NFe.js +54 -0
  90. package/lib/domain/use-cases/utils/clean-html-entities.d.ts +2 -0
  91. package/lib/domain/use-cases/utils/clean-html-entities.js +45 -0
  92. package/lib/domain/use-cases/utils/current-date.d.ts +1 -0
  93. package/lib/domain/use-cases/utils/current-date.js +7 -0
  94. package/lib/domain/use-cases/utils/format-cnpj.d.ts +1 -0
  95. package/lib/domain/use-cases/utils/format-cnpj.js +8 -0
  96. package/lib/domain/use-cases/utils/format-cpf.d.ts +1 -0
  97. package/lib/domain/use-cases/utils/format-cpf.js +8 -0
  98. package/lib/domain/use-cases/utils/format-date-time.d.ts +1 -0
  99. package/lib/domain/use-cases/utils/format-date-time.js +10 -0
  100. package/lib/domain/use-cases/utils/format-date.d.ts +1 -0
  101. package/lib/domain/use-cases/utils/format-date.js +9 -0
  102. package/lib/domain/use-cases/utils/format-key.d.ts +1 -0
  103. package/lib/domain/use-cases/utils/format-key.js +6 -0
  104. package/lib/domain/use-cases/utils/format-number.d.ts +1 -0
  105. package/lib/domain/use-cases/utils/format-number.js +6 -0
  106. package/lib/domain/use-cases/utils/format-phone.d.ts +1 -0
  107. package/lib/domain/use-cases/utils/format-phone.js +20 -0
  108. package/lib/domain/use-cases/utils/format-plate.d.ts +1 -0
  109. package/lib/domain/use-cases/utils/format-plate.js +16 -0
  110. package/lib/domain/use-cases/utils/format-postal-code.d.ts +1 -0
  111. package/lib/domain/use-cases/utils/format-postal-code.js +8 -0
  112. package/lib/domain/use-cases/utils/format-protocol.d.ts +1 -0
  113. package/lib/domain/use-cases/utils/format-protocol.js +8 -0
  114. package/lib/domain/use-cases/utils/format-state-registration.d.ts +1 -0
  115. package/lib/domain/use-cases/utils/format-state-registration.js +152 -0
  116. package/lib/domain/use-cases/utils/format-time.d.ts +1 -0
  117. package/lib/domain/use-cases/utils/format-time.js +8 -0
  118. package/lib/domain/use-cases/utils/index.d.ts +15 -0
  119. package/lib/domain/use-cases/utils/index.js +31 -0
  120. package/lib/domain/use-cases/utils/return-font-size-carrier.d.ts +1 -0
  121. package/lib/domain/use-cases/utils/return-font-size-carrier.js +23 -0
  122. package/lib/index.d.ts +1 -0
  123. package/lib/index.js +5 -0
  124. package/lib/tsconfig.tsbuildinfo +1 -0
  125. package/lib/types/generate-pdf.d.ts +266 -0
  126. package/lib/types/generate-pdf.js +2 -0
  127. package/lib/types/index.d.ts +3 -0
  128. package/lib/types/index.js +19 -0
  129. package/lib/types/nfe-proc.d.ts +42 -0
  130. package/lib/types/nfe-proc.js +2 -0
  131. package/lib/types/schema.d.ts +876 -0
  132. package/lib/types/schema.js +2 -0
  133. package/lib/utils/index.d.ts +1 -0
  134. package/lib/utils/index.js +6 -0
  135. package/package.json +59 -0
@@ -0,0 +1,154 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getDestinatarioRemetente = getDestinatarioRemetente;
4
+ const utils_1 = require("../../../../domain/use-cases/utils");
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
+ doc
13
+ .lineWidth(0.5)
14
+ .roundedRect(margemEsquerda + ajusteX, margemTopo + ajusteY + y + 9, larguraDoFormulario, 60, 3)
15
+ .stroke()
16
+ .lineWidth(1);
17
+ (0, linha_horizontal_1.linhaHorizontal)({ x1: 0, x2: 0, y: y + 29, doc, ajusteX, ajusteY, margemDireita, margemEsquerda, margemTopo });
18
+ (0, linha_horizontal_1.linhaHorizontal)({ x1: 0, x2: 0, y: y + 49, doc, ajusteX, ajusteY, margemDireita, margemEsquerda, margemTopo });
19
+ (0, linha_vertical_1.linhaVertical)({ y1: y + 9.2, y2: y + 29, x: 357.1, doc, ajusteX, ajusteY, margemEsquerda, margemTopo });
20
+ (0, linha_vertical_1.linhaVertical)({ y1: y + 29.2, y2: y + 69, x: 274.9, doc, ajusteX, ajusteY, margemEsquerda, margemTopo });
21
+ (0, linha_vertical_1.linhaVertical)({ y1: y + 49.2, y2: y + 69, x: 297.6, doc, ajusteX, ajusteY, margemEsquerda, margemTopo });
22
+ (0, linha_vertical_1.linhaVertical)({ y1: y + 29.2, y2: y + 69, x: 396.75, doc, ajusteX, ajusteY, margemEsquerda, margemTopo });
23
+ (0, linha_vertical_1.linhaVertical)({ y1: y + 9.2, y2: y + 69, x: 493.1, doc, ajusteX, ajusteY, margemEsquerda, margemTopo });
24
+ (0, secao_1.secao)({ doc, value: 'DESTINATÁRIO / REMETENTE', x: 1.5, y: y + 0.9, largura: 0, ajusteX, ajusteY, margemEsquerda, margemTopo });
25
+ (0, titulo_1.titulo)({ value: 'NOME / RAZÃO SOCIAL', x: 1.5, y: y + 11, largura: 353.5, ajusteX, ajusteY, doc, margemEsquerda, margemTopo });
26
+ (0, campo_1.campo)({ value: dest.xNome, x: 1.5, y: y + 18, largura: 353.5, alinhamento: 'left', ajusteX, ajusteY, doc, margemEsquerda, margemTopo });
27
+ (0, titulo_1.titulo)({ value: 'CNPJ / CPF', x: 358, y: y + 11, largura: 133.5, ajusteX, ajusteY, doc, margemEsquerda, margemTopo });
28
+ (0, campo_1.campo)({
29
+ value: (0, utils_1.formatCpf)(dest.CPF ?? ''),
30
+ x: 358,
31
+ y: y + 18,
32
+ largura: 133.5,
33
+ ajusteX,
34
+ ajusteY,
35
+ doc,
36
+ margemEsquerda,
37
+ margemTopo
38
+ });
39
+ (0, campo_1.campo)({
40
+ value: (0, utils_1.formatCnpj)(dest.CNPJ ?? ''),
41
+ x: 358,
42
+ y: y + 18,
43
+ largura: 133.5,
44
+ ajusteX,
45
+ ajusteY,
46
+ doc,
47
+ margemEsquerda,
48
+ margemTopo
49
+ });
50
+ (0, titulo_1.titulo)({ value: 'DATA DA EMISSÃO', x: 495, y: y + 11, largura: 90, ajusteX, ajusteY, doc, margemEsquerda, margemTopo });
51
+ (0, campo_1.campo)({
52
+ value: (0, utils_1.formatDate)(ide.dhEmi),
53
+ x: 495,
54
+ y: y + 18,
55
+ largura: 90,
56
+ ajusteX,
57
+ ajusteY,
58
+ doc,
59
+ margemEsquerda,
60
+ margemTopo
61
+ });
62
+ (0, titulo_1.titulo)({ value: 'ENDEREÇO', x: 1.5, y: y + 30, largura: 272, ajusteX, ajusteY, doc, margemEsquerda, margemTopo });
63
+ (0, campo_1.campo)({
64
+ value: dest.enderDest?.xLgr && dest.enderDest?.nro ? `${dest.enderDest.xLgr}, ${dest.enderDest.nro}` : (dest.enderDest?.xLgr ?? ''),
65
+ x: 1.5,
66
+ y: y + 38,
67
+ largura: 272,
68
+ alinhamento: 'left',
69
+ tamanho: default_1.DEFAULT_NFE.tamanhoDaFonteDoCampo - 0.5,
70
+ ajusteX,
71
+ ajusteY,
72
+ doc,
73
+ margemEsquerda,
74
+ margemTopo
75
+ });
76
+ (0, titulo_1.titulo)({ value: 'BAIRRO / DISTRITO', x: 276, y: y + 30, largura: 192, ajusteX, ajusteY, doc, margemEsquerda, margemTopo });
77
+ (0, campo_1.campo)({ value: dest.enderDest?.xBairro ?? '', x: 276, y: y + 38, largura: 119, ajusteX, ajusteY, doc, margemEsquerda, margemTopo });
78
+ (0, titulo_1.titulo)({ value: 'CEP', x: 398, y: y + 30, 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
+ });
90
+ (0, titulo_1.titulo)({ value: 'DATA DA SAÍDA', x: 495, y: y + 30, largura: 90, ajusteX, ajusteY, doc, margemEsquerda, margemTopo });
91
+ (0, campo_1.campo)({
92
+ value: ide.dhSaiEnt !== undefined ? (0, utils_1.formatDate)(ide.dhSaiEnt) : '',
93
+ x: 495,
94
+ y: y + 38,
95
+ largura: 90,
96
+ ajusteX,
97
+ ajusteY,
98
+ doc,
99
+ margemEsquerda,
100
+ margemTopo
101
+ });
102
+ (0, titulo_1.titulo)({ value: 'MUNICÍPIO', x: 1.5, y: y + 51, largura: 272, ajusteX, ajusteY, doc, margemEsquerda, margemTopo });
103
+ (0, campo_1.campo)({
104
+ value: dest.enderDest?.xMun ?? '',
105
+ x: 1.5,
106
+ y: y + 58,
107
+ largura: 272,
108
+ alinhamento: 'left',
109
+ ajusteX,
110
+ ajusteY,
111
+ doc,
112
+ margemEsquerda,
113
+ margemTopo
114
+ });
115
+ (0, titulo_1.titulo)({ value: 'UF', x: 276, y: y + 51, largura: 20, ajusteX, ajusteY, doc, margemEsquerda, margemTopo });
116
+ (0, campo_1.campo)({ value: dest.enderDest?.UF ?? '', x: 276, y: y + 58, largura: 20, ajusteX, ajusteY, doc, margemEsquerda, margemTopo });
117
+ (0, titulo_1.titulo)({ value: 'FONE / FAX', x: 299, y: y + 51, 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
+ });
129
+ (0, titulo_1.titulo)({ value: 'INSCRIÇÃO ESTADUAL', x: 398, y: y + 51, largura: 93, ajusteX, ajusteY, doc, margemEsquerda, margemTopo });
130
+ (0, campo_1.campo)({
131
+ value: (0, utils_1.formatStateRegistration)(dest?.IE ?? ''),
132
+ x: 398,
133
+ y: y + 58,
134
+ largura: 93,
135
+ ajusteX,
136
+ ajusteY,
137
+ doc,
138
+ margemEsquerda,
139
+ margemTopo
140
+ });
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, utils_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
+ });
153
+ return doc.y;
154
+ }
@@ -0,0 +1,2 @@
1
+ import type { GeneratePdf } from '../../../../types';
2
+ export declare function getFaturaDuplicata({ y, doc, ajusteX, ajusteY, margemDireita, margemEsquerda, margemTopo, larguraDoFormulario, cobr }: GeneratePdf.InputFaturaDuplicata): number;
@@ -0,0 +1,118 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getFaturaDuplicata = getFaturaDuplicata;
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 secao_1 = require("./secao");
8
+ function getFaturaDuplicata({ y, doc, ajusteX, ajusteY, margemDireita, margemEsquerda, margemTopo, larguraDoFormulario, cobr }) {
9
+ if (cobr !== undefined && Object.keys(cobr).length > 0) {
10
+ (0, secao_1.secao)({ doc, value: 'FATURA/DUPLICATA', x: 1.5, y: y + 12, largura: 0, ajusteX, ajusteY, margemEsquerda, margemTopo });
11
+ const larguraMinimaColuna = 80;
12
+ const margemInternaCelulas = 1.5;
13
+ const margemDireitaCelulas = 1.5;
14
+ const larguraDisponivel = larguraDoFormulario - margemInternaCelulas - margemDireitaCelulas;
15
+ const colunas = Math.floor(larguraDisponivel / larguraMinimaColuna);
16
+ const larguraColuna = larguraDisponivel / colunas;
17
+ const alturaLinha = 34;
18
+ let yAtual = y + 24;
19
+ let xAtual = margemInternaCelulas;
20
+ let coluna = 0;
21
+ if (cobr.fat !== undefined) {
22
+ const xColuna = margemEsquerda + ajusteX + xAtual + coluna * larguraColuna;
23
+ const yColuna = margemTopo + ajusteY + yAtual;
24
+ doc
25
+ .lineWidth(0.5)
26
+ .roundedRect(xColuna, yColuna, larguraColuna, alturaLinha, 3)
27
+ .stroke()
28
+ .lineWidth(1);
29
+ doc
30
+ .font('negrito')
31
+ .fontSize(6)
32
+ .fillColor(default_1.DEFAULT_NFE.corDoTitulo)
33
+ .text('Número da Fatura:', xColuna + 2, yColuna + 2, {
34
+ width: larguraColuna - 4,
35
+ align: 'left'
36
+ })
37
+ .font('normal')
38
+ .fontSize(6)
39
+ .fillColor('black')
40
+ .text(cobr.fat.nFat, xColuna + 2, yColuna + 8, {
41
+ width: larguraColuna - 4,
42
+ align: 'left'
43
+ })
44
+ .font('negrito')
45
+ .fontSize(6)
46
+ .fillColor(default_1.DEFAULT_NFE.corDoTitulo)
47
+ .text(`Valor Original: R$ ${(0, utils_1.formatNumber)(cobr.fat.vOrig, 2)}`, xColuna + 2, yColuna + 14, {
48
+ width: larguraColuna - 4,
49
+ align: 'left'
50
+ })
51
+ .font('normal')
52
+ .fontSize(6)
53
+ .fillColor('black')
54
+ .text(`Desconto: R$ ${(0, utils_1.formatNumber)(cobr.fat.vDesc, 2)}`, xColuna + 2, yColuna + 20, {
55
+ width: larguraColuna - 4,
56
+ align: 'left'
57
+ })
58
+ .font('negrito')
59
+ .fontSize(6)
60
+ .fillColor(default_1.DEFAULT_NFE.corDoTitulo)
61
+ .text(`Valor Líquido: R$ ${(0, utils_1.formatNumber)(cobr.fat.vLiq, 2)}`, xColuna + 2, yColuna + 26, {
62
+ width: larguraColuna - 4,
63
+ align: 'left'
64
+ });
65
+ coluna++;
66
+ }
67
+ if (cobr.dup !== undefined) {
68
+ cobr.dup.forEach((dup, index) => {
69
+ const xColuna = margemEsquerda + ajusteX + xAtual + coluna * larguraColuna;
70
+ const yColuna = margemTopo + ajusteY + yAtual;
71
+ doc
72
+ .lineWidth(0.5)
73
+ .roundedRect(xColuna, yColuna, larguraColuna, alturaLinha, 3)
74
+ .stroke()
75
+ .lineWidth(1);
76
+ doc
77
+ .font('negrito')
78
+ .fontSize(6)
79
+ .fillColor(default_1.DEFAULT_NFE.corDoTitulo)
80
+ .text('Duplicata:', xColuna + 2, yColuna + 2, {
81
+ width: larguraColuna - 4,
82
+ align: 'left'
83
+ })
84
+ .font('normal')
85
+ .fontSize(6)
86
+ .fillColor('black')
87
+ .text(dup.nDup, xColuna + 2, yColuna + 8, {
88
+ width: larguraColuna - 4,
89
+ align: 'left'
90
+ })
91
+ .font('negrito')
92
+ .fontSize(6)
93
+ .fillColor(default_1.DEFAULT_NFE.corDoTitulo)
94
+ .text(`R$ ${(0, utils_1.formatNumber)(dup.vDup, 2)}`, xColuna + 2, yColuna + 14, {
95
+ width: larguraColuna - 4,
96
+ align: 'left'
97
+ })
98
+ .font('normal')
99
+ .fontSize(6)
100
+ .fillColor('black')
101
+ .text((0, date_fns_1.format)((0, date_fns_1.parseISO)(dup.dVenc), 'dd/MM/yyyy'), xColuna + 2, yColuna + 20, {
102
+ width: larguraColuna - 4,
103
+ align: 'left'
104
+ });
105
+ coluna++;
106
+ if (coluna >= colunas) {
107
+ coluna = 0;
108
+ yAtual += alturaLinha;
109
+ }
110
+ });
111
+ }
112
+ if (coluna > 0) {
113
+ yAtual += alturaLinha;
114
+ }
115
+ doc.text('', margemInternaCelulas, yAtual);
116
+ }
117
+ return doc.y;
118
+ }
@@ -0,0 +1,2 @@
1
+ import type { GeneratePdf } from '../../../../types';
2
+ export declare function getHomologacao({ doc, ajusteX, ajusteY, margemEsquerda, margemTopo, larguraDoFormulario, protNFe, cancelada }: GeneratePdf.InputHomologacao): void;
@@ -0,0 +1,36 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getHomologacao = getHomologacao;
4
+ const default_1 = require("./default");
5
+ function getHomologacao({ doc, ajusteX, ajusteY, margemEsquerda, margemTopo, larguraDoFormulario, protNFe, cancelada }) {
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
+ 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
+ }
35
+ doc.fillOpacity(100);
36
+ }
@@ -0,0 +1,2 @@
1
+ import type { GeneratePdf } from '../../../../types';
2
+ export declare function getImposto({ y, doc, ajusteX, ajusteY, margemDireita, margemEsquerda, margemTopo, larguraDoFormulario, total }: GeneratePdf.InputImposto): number;
@@ -0,0 +1,219 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getImposto = getImposto;
4
+ const utils_1 = require("../../../../domain/use-cases/utils");
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 getImposto({ y, doc, ajusteX, ajusteY, margemDireita, margemEsquerda, margemTopo, larguraDoFormulario, total }) {
12
+ doc
13
+ .lineWidth(0.5)
14
+ .roundedRect(margemEsquerda + ajusteX, margemTopo + ajusteY + y + 16.2, larguraDoFormulario, 40, 3)
15
+ .stroke()
16
+ .lineWidth(1);
17
+ (0, linha_horizontal_1.linhaHorizontal)({ x1: 0, x2: 0, y: y + 36.2, doc, ajusteX, ajusteY, margemDireita, margemEsquerda, margemTopo });
18
+ (0, linha_vertical_1.linhaVertical)({ y1: y + 16.2, y2: y + 56.2, x: 87.7, doc, ajusteX, ajusteY, margemEsquerda, margemTopo });
19
+ (0, linha_vertical_1.linhaVertical)({ y1: y + 16.2, y2: y + 56.2, x: 87.7 * 2 + 0.3, doc, ajusteX, ajusteY, margemEsquerda, margemTopo });
20
+ (0, linha_vertical_1.linhaVertical)({ y1: y + 16.2, y2: y + 56.2, x: 87.7 * 3 + 0.4, doc, ajusteX, ajusteY, margemEsquerda, margemTopo });
21
+ (0, linha_vertical_1.linhaVertical)({ y1: y + 16.2, y2: y + 56.2, x: 87.7 * 4 + 0.4, doc, ajusteX, ajusteY, margemEsquerda, margemTopo });
22
+ (0, linha_vertical_1.linhaVertical)({ y1: y + 16.2, y2: y + 56.2, x: 87.7 * 5 + 0.6, doc, ajusteX, ajusteY, margemEsquerda, margemTopo });
23
+ (0, linha_vertical_1.linhaVertical)({ y1: y + 16.2, y2: y + 56.2, x: 87.7 * 5 + 51.8, doc, ajusteX, ajusteY, margemEsquerda, margemTopo });
24
+ (0, secao_1.secao)({ doc, value: 'CÁLCULO DO IMPOSTO', x: 1.5, y: y + 8.7, largura: 0, ajusteX, ajusteY, margemEsquerda, margemTopo });
25
+ (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 });
26
+ (0, campo_1.campo)({
27
+ value: (0, utils_1.formatNumber)(total.ICMSTot.vBC, 2),
28
+ x: 1.5,
29
+ y: y + 26.2,
30
+ largura: 84,
31
+ alinhamento: 'right',
32
+ ajusteX,
33
+ ajusteY,
34
+ doc,
35
+ margemEsquerda,
36
+ margemTopo
37
+ });
38
+ (0, titulo_1.titulo)({ value: 'VALOR DO ICMS', x: 89, y: y + 17.2, largura: 84, ajusteX, ajusteY, doc, margemEsquerda, margemTopo });
39
+ (0, campo_1.campo)({
40
+ value: (0, utils_1.formatNumber)(total.ICMSTot.vICMS, 2),
41
+ x: 89,
42
+ y: y + 26.2,
43
+ largura: 84,
44
+ alinhamento: 'right',
45
+ ajusteX,
46
+ ajusteY,
47
+ doc,
48
+ margemEsquerda,
49
+ margemTopo
50
+ });
51
+ (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 });
52
+ (0, campo_1.campo)({
53
+ value: (0, utils_1.formatNumber)(total.ICMSTot.vBCST, 2),
54
+ x: 177,
55
+ y: y + 26.2,
56
+ largura: 84,
57
+ alinhamento: 'right',
58
+ ajusteX,
59
+ ajusteY,
60
+ doc,
61
+ margemEsquerda,
62
+ margemTopo
63
+ });
64
+ (0, titulo_1.titulo)({ value: 'VALOR DO ICMS SUBST.', x: 265, y: y + 17.2, largura: 84, ajusteX, ajusteY, doc, margemEsquerda, margemTopo });
65
+ (0, campo_1.campo)({
66
+ value: (0, utils_1.formatNumber)(total.ICMSTot.vST, 2),
67
+ x: 265,
68
+ y: y + 26.2,
69
+ largura: 84,
70
+ alinhamento: 'right',
71
+ ajusteX,
72
+ ajusteY,
73
+ doc,
74
+ margemEsquerda,
75
+ margemTopo
76
+ });
77
+ (0, titulo_1.titulo)({ value: 'VALOR IMP. IMPORTAÇÃO', x: 353, y: y + 17.2, largura: 84, ajusteX, ajusteY, doc, margemEsquerda, margemTopo });
78
+ (0, campo_1.campo)({
79
+ value: (0, utils_1.formatNumber)(total.ICMSTot.vIPI, 2),
80
+ x: 353,
81
+ y: y + 26.2,
82
+ largura: 84,
83
+ alinhamento: 'right',
84
+ ajusteX,
85
+ ajusteY,
86
+ doc,
87
+ margemEsquerda,
88
+ margemTopo
89
+ });
90
+ (0, titulo_1.titulo)({ value: 'VALOR DO PIS', x: 441, y: y + 17.2, largura: 47, ajusteX, ajusteY, doc, margemEsquerda, margemTopo });
91
+ (0, campo_1.campo)({
92
+ value: (0, utils_1.formatNumber)(total.ICMSTot.vPIS, 2),
93
+ x: 441,
94
+ y: y + 26.2,
95
+ largura: 47,
96
+ alinhamento: 'right',
97
+ ajusteX,
98
+ ajusteY,
99
+ doc,
100
+ margemEsquerda,
101
+ margemTopo
102
+ });
103
+ (0, titulo_1.titulo)({ value: 'VALOR TOTAL DOS PRODUTOS', x: 492, y: y + 17.2, largura: 93, ajusteX, ajusteY, doc, margemEsquerda, margemTopo });
104
+ (0, campo_1.campo)({
105
+ value: (0, utils_1.formatNumber)(total.ICMSTot.vProd, 2),
106
+ x: 492,
107
+ y: y + 26.2,
108
+ largura: 93,
109
+ alinhamento: 'right',
110
+ ajusteX,
111
+ ajusteY,
112
+ doc,
113
+ margemEsquerda,
114
+ margemTopo
115
+ });
116
+ (0, titulo_1.titulo)({ value: 'VALOR DO FRETE', x: 1.5, y: y + 37.2, largura: 84, ajusteX, ajusteY, doc, margemEsquerda, margemTopo });
117
+ (0, campo_1.campo)({
118
+ value: (0, utils_1.formatNumber)(total.ICMSTot.vFrete, 2),
119
+ x: 1.5,
120
+ y: y + 46.2,
121
+ largura: 84,
122
+ alinhamento: 'right',
123
+ ajusteX,
124
+ ajusteY,
125
+ doc,
126
+ margemEsquerda,
127
+ margemTopo
128
+ });
129
+ (0, titulo_1.titulo)({ value: 'VALOR DO SEGURO', x: 89, y: y + 37.2, largura: 84, ajusteX, ajusteY, doc, margemEsquerda, margemTopo });
130
+ (0, campo_1.campo)({
131
+ value: (0, utils_1.formatNumber)(total.ICMSTot.vSeg, 2),
132
+ x: 89,
133
+ y: y + 46.2,
134
+ largura: 84,
135
+ alinhamento: 'right',
136
+ ajusteX,
137
+ ajusteY,
138
+ doc,
139
+ margemEsquerda,
140
+ margemTopo
141
+ });
142
+ (0, titulo_1.titulo)({ value: 'DESCONTO', x: 177, y: y + 37.2, largura: 84, ajusteX, ajusteY, doc, margemEsquerda, margemTopo });
143
+ (0, campo_1.campo)({
144
+ value: (0, utils_1.formatNumber)(total.ICMSTot.vDesc, 2),
145
+ x: 177,
146
+ y: y + 46.2,
147
+ largura: 84,
148
+ alinhamento: 'right',
149
+ ajusteX,
150
+ ajusteY,
151
+ doc,
152
+ margemEsquerda,
153
+ margemTopo
154
+ });
155
+ (0, titulo_1.titulo)({ value: 'OUTRAS DESPESAS', x: 265, y: y + 37.2, largura: 84, ajusteX, ajusteY, doc, margemEsquerda, margemTopo });
156
+ (0, campo_1.campo)({
157
+ value: (0, utils_1.formatNumber)(total.ICMSTot.vOutro, 2),
158
+ x: 265,
159
+ y: y + 46.2,
160
+ largura: 84,
161
+ alinhamento: 'right',
162
+ ajusteX,
163
+ ajusteY,
164
+ doc,
165
+ margemEsquerda,
166
+ margemTopo
167
+ });
168
+ (0, titulo_1.titulo)({ value: 'VALOR TOTAL DO IPI', x: 353, y: y + 37.2, largura: 84, ajusteX, ajusteY, doc, margemEsquerda, margemTopo });
169
+ (0, campo_1.campo)({
170
+ value: (0, utils_1.formatNumber)(total.ICMSTot.vIPI, 2),
171
+ x: 353,
172
+ y: y + 46.2,
173
+ largura: 84,
174
+ alinhamento: 'right',
175
+ ajusteX,
176
+ ajusteY,
177
+ doc,
178
+ margemEsquerda,
179
+ margemTopo
180
+ });
181
+ (0, titulo_1.titulo)({
182
+ value: 'VALOR DA COFINS',
183
+ x: 440.5,
184
+ y: y + 37.2,
185
+ largura: 47,
186
+ ajusteX,
187
+ ajusteY,
188
+ doc,
189
+ margemEsquerda,
190
+ margemTopo,
191
+ tamanho: default_1.DEFAULT_NFE.tamanhoDaFonteDoTitulo - 1
192
+ });
193
+ (0, campo_1.campo)({
194
+ value: (0, utils_1.formatNumber)(total.ICMSTot.vCOFINS, 2),
195
+ x: 440.5,
196
+ y: y + 46.2,
197
+ largura: 47,
198
+ alinhamento: 'right',
199
+ ajusteX,
200
+ ajusteY,
201
+ doc,
202
+ margemEsquerda,
203
+ margemTopo
204
+ });
205
+ (0, titulo_1.titulo)({ value: 'VALOR TOTAL DA NOTA', x: 492, y: y + 37.2, largura: 93, ajusteX, ajusteY, doc, margemEsquerda, margemTopo });
206
+ (0, campo_1.campo)({
207
+ value: (0, utils_1.formatNumber)(total.ICMSTot.vNF, 2),
208
+ x: 492,
209
+ y: y + 46.2,
210
+ largura: 93,
211
+ alinhamento: 'right',
212
+ ajusteX,
213
+ ajusteY,
214
+ doc,
215
+ margemEsquerda,
216
+ margemTopo
217
+ });
218
+ return doc.y;
219
+ }
@@ -0,0 +1,2 @@
1
+ import type { GeneratePdf } from '../../../../types';
2
+ export declare function getIss({ y, doc, ajusteX, ajusteY, margemDireita, margemEsquerda, margemTopo, larguraDoFormulario, emit, total }: GeneratePdf.InputISS): number;
@@ -0,0 +1,73 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getIss = getIss;
4
+ const campo_1 = require("./campo");
5
+ const linha_horizontal_1 = require("./linha-horizontal");
6
+ const linha_vertical_1 = require("./linha-vertical");
7
+ const secao_1 = require("./secao");
8
+ const titulo_1 = require("./titulo");
9
+ function getIss({ y, doc, ajusteX, ajusteY, margemDireita, margemEsquerda, margemTopo, larguraDoFormulario, emit, total }) {
10
+ if (total.ISSQNtot?.vServ !== undefined || total.ISSQNtot?.vBC !== undefined || total.ISSQNtot?.vISS !== undefined) {
11
+ (0, linha_horizontal_1.linhaHorizontal)({ x1: 0, x2: 0, y: 762.2, doc, ajusteX, ajusteY, margemDireita, margemEsquerda, margemTopo });
12
+ (0, linha_horizontal_1.linhaHorizontal)({ x1: 0, x2: 0, y: 782.2, doc, ajusteX, ajusteY, margemDireita, margemEsquerda, margemTopo });
13
+ (0, linha_vertical_1.linhaVertical)({ y1: 762.2, y2: 782.2, x: 0, doc, ajusteX, ajusteY, margemEsquerda, margemTopo });
14
+ (0, linha_vertical_1.linhaVertical)({ y1: 762.2, y2: 782.2, x: 136.1, doc, ajusteX, ajusteY, margemEsquerda, margemTopo });
15
+ (0, linha_vertical_1.linhaVertical)({ y1: 762.2, y2: 782.2, x: 136.1 * 2 - 0.1, doc, ajusteX, ajusteY, margemEsquerda, margemTopo });
16
+ (0, linha_vertical_1.linhaVertical)({ y1: 762.2, y2: 782.2, x: 136.1 * 3 - 0.1, doc, ajusteX, ajusteY, margemEsquerda, margemTopo });
17
+ (0, linha_vertical_1.linhaVertical)({ y1: 762.2, y2: 782.2, x: larguraDoFormulario, doc, ajusteX, ajusteY, margemEsquerda, margemTopo });
18
+ (0, secao_1.secao)({ doc, value: 'CÁLCULO DO ISSQN', x: 1.5, y: 754.5, largura: 0, ajusteX, ajusteY, margemEsquerda, margemTopo });
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)({
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
+ });
32
+ (0, titulo_1.titulo)({ value: 'VALOR TOTAL DOS SERVIÇOS', x: 137.5, y: 763, largura: 132.5, ajusteX, ajusteY, doc, margemEsquerda, margemTopo });
33
+ (0, campo_1.campo)({
34
+ value: total.ISSQNtot?.vServ ?? '',
35
+ x: 137.5,
36
+ y: 771,
37
+ largura: 132.5,
38
+ alinhamento: 'right',
39
+ ajusteX,
40
+ ajusteY,
41
+ doc,
42
+ margemEsquerda,
43
+ margemTopo
44
+ });
45
+ (0, titulo_1.titulo)({ value: 'BASE DE CÁLCULO DO ISSQN', x: 273.5, y: 763, largura: 132.5, ajusteX, ajusteY, doc, margemEsquerda, margemTopo });
46
+ (0, campo_1.campo)({
47
+ value: total.ISSQNtot?.vBC ?? '',
48
+ x: 273.5,
49
+ y: 771,
50
+ largura: 132.5,
51
+ alinhamento: 'right',
52
+ ajusteX,
53
+ ajusteY,
54
+ doc,
55
+ margemEsquerda,
56
+ margemTopo
57
+ });
58
+ (0, titulo_1.titulo)({ value: 'VALOR TOTAL DO ISSQN', x: 409.5, y: 763, largura: 175.5, ajusteX, ajusteY, doc, margemEsquerda, margemTopo });
59
+ (0, campo_1.campo)({
60
+ value: total.ISSQNtot?.vISS ?? '',
61
+ x: 409.5,
62
+ y: 771,
63
+ largura: 175.5,
64
+ alinhamento: 'right',
65
+ ajusteX,
66
+ ajusteY,
67
+ doc,
68
+ margemEsquerda,
69
+ margemTopo
70
+ });
71
+ }
72
+ return doc.y;
73
+ }
@@ -0,0 +1,2 @@
1
+ import type { GeneratePdf } from '../../../../types';
2
+ export declare function getMenuItens({ y, doc, ajusteX, ajusteY, margemEsquerda, margemTopo, margemDireita, finalEspacoDet, larguraDoFormulario }: GeneratePdf.InputMenuItens): number;