@alexssmusica/node-pdf-nfe 1.1.0 → 1.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/application/helpers/generate-pdf/nfe/campo.js +15 -1
- package/lib/application/helpers/generate-pdf/nfe/cria-layout.js +143 -1
- package/lib/application/helpers/generate-pdf/nfe/default.js +26 -1
- package/lib/application/helpers/generate-pdf/nfe/gerar-itens.js +275 -1
- package/lib/application/helpers/generate-pdf/nfe/get-dados-adicionais.js +53 -1
- package/lib/application/helpers/generate-pdf/nfe/get-dados-emitente.js +309 -1
- package/lib/application/helpers/generate-pdf/nfe/get-destinatario-remetente.js +123 -1
- package/lib/application/helpers/generate-pdf/nfe/get-fatura-duplicata.js +64 -1
- package/lib/application/helpers/generate-pdf/nfe/get-homologacao.js +26 -1
- package/lib/application/helpers/generate-pdf/nfe/get-imposto.js +219 -1
- package/lib/application/helpers/generate-pdf/nfe/get-iss.js +63 -1
- package/lib/application/helpers/generate-pdf/nfe/get-menu-itens.js +199 -1
- package/lib/application/helpers/generate-pdf/nfe/get-recibo.js +102 -1
- package/lib/application/helpers/generate-pdf/nfe/get-transporte.js +143 -1
- package/lib/application/helpers/generate-pdf/nfe/italico.js +16 -1
- package/lib/application/helpers/generate-pdf/nfe/linha-horizontal-tracejada.js +8 -1
- package/lib/application/helpers/generate-pdf/nfe/linha-horizontal.js +16 -1
- package/lib/application/helpers/generate-pdf/nfe/linha-vertical.js +10 -1
- package/lib/application/helpers/generate-pdf/nfe/load-fontes.js +31 -1
- package/lib/application/helpers/generate-pdf/nfe/negrito.js +16 -1
- package/lib/application/helpers/generate-pdf/nfe/normal.js +16 -1
- package/lib/application/helpers/generate-pdf/nfe/options-doc.js +14 -1
- package/lib/application/helpers/generate-pdf/nfe/secao.js +17 -1
- package/lib/application/helpers/generate-pdf/nfe/titulo.js +17 -1
- package/lib/application/helpers/xml/deserialize.js +25 -1
- package/lib/application/helpers/xml/index.js +17 -1
- package/lib/domain/use-cases/pdf/index.js +26 -1
- package/lib/domain/use-cases/pdf/pdf-NFCe.js +688 -1
- package/lib/domain/use-cases/pdf/pdf-NFe.js +43 -1
- package/lib/domain/use-cases/utils/data-atual.js +12 -1
- package/lib/domain/use-cases/utils/index.js +18 -1
- package/lib/domain/use-cases/utils/intl-number-format.js +7 -1
- package/lib/index.js +5 -1
- package/lib/tsconfig.tsbuildinfo +1 -0
- package/lib/types/generate-pdf.js +2 -1
- package/lib/types/index.js +19 -1
- package/lib/types/nfe-proc.js +2 -1
- package/lib/types/schema.js +2 -1
- package/package.json +3 -9
|
@@ -1 +1,143 @@
|
|
|
1
|
-
"use strict";
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getTransporte = void 0;
|
|
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 getTransporte({ y, doc, ajusteX, ajusteY, margemDireita, margemEsquerda, margemTopo, larguraDoFormulario, transp }) {
|
|
12
|
+
(0, linha_horizontal_1.linhaHorizontal)({ x1: 0, x2: 0, y: y + 8, doc, ajusteX, ajusteY, margemDireita, margemEsquerda, margemTopo });
|
|
13
|
+
(0, linha_horizontal_1.linhaHorizontal)({ x1: 0, x2: 0, y: y + 28, doc, ajusteX, ajusteY, margemDireita, margemEsquerda, margemTopo });
|
|
14
|
+
(0, linha_horizontal_1.linhaHorizontal)({ x1: 0, x2: 0, y: y + 48, doc, ajusteX, ajusteY, margemDireita, margemEsquerda, margemTopo });
|
|
15
|
+
(0, linha_horizontal_1.linhaHorizontal)({ x1: 0, x2: 0, y: y + 68, doc, ajusteX, ajusteY, margemDireita, margemEsquerda, margemTopo });
|
|
16
|
+
(0, linha_vertical_1.linhaVertical)({ y1: y + 8, y2: y + 68, x: 0, doc, ajusteX, ajusteY, margemEsquerda, margemTopo });
|
|
17
|
+
(0, linha_vertical_1.linhaVertical)({ y1: y + 8, y2: y + 28, x: 170, doc, ajusteX, ajusteY, margemEsquerda, margemTopo });
|
|
18
|
+
(0, linha_vertical_1.linhaVertical)({ y1: y + 8, y2: y + 28, x: 346, doc, ajusteX, ajusteY, margemEsquerda, margemTopo });
|
|
19
|
+
(0, linha_vertical_1.linhaVertical)({ y1: y + 8, y2: y + 48, x: 434, doc, ajusteX, ajusteY, margemEsquerda, margemTopo });
|
|
20
|
+
(0, linha_vertical_1.linhaVertical)({ y1: y + 8, y2: y + 48, x: 456.65, doc, ajusteX, ajusteY, margemEsquerda, margemTopo });
|
|
21
|
+
(0, linha_vertical_1.linhaVertical)({ y1: y + 8, y2: y + 68, x: 258, doc, ajusteX, ajusteY, margemEsquerda, margemTopo });
|
|
22
|
+
(0, linha_vertical_1.linhaVertical)({ y1: y + 48, y2: y + 68, x: 59.6, doc, ajusteX, ajusteY, margemEsquerda, margemTopo });
|
|
23
|
+
(0, linha_vertical_1.linhaVertical)({ y1: y + 48, y2: y + 68, x: 156.6, doc, ajusteX, ajusteY, margemEsquerda, margemTopo });
|
|
24
|
+
(0, linha_vertical_1.linhaVertical)({ y1: y + 48, y2: y + 68, x: 357, doc, ajusteX, ajusteY, margemEsquerda, margemTopo });
|
|
25
|
+
(0, linha_vertical_1.linhaVertical)({ y1: y + 48, y2: y + 68, x: 473.3, doc, ajusteX, ajusteY, margemEsquerda, margemTopo });
|
|
26
|
+
(0, linha_vertical_1.linhaVertical)({ y1: y + 8, y2: y + 68, x: larguraDoFormulario, doc, ajusteX, ajusteY, margemEsquerda, margemTopo });
|
|
27
|
+
(0, secao_1.secao)({ doc, value: 'TRANSPORTADOR / VOLUMES TRANSPORTADOS', x: 1.5, y, largura: 0, ajusteX, ajusteY, margemEsquerda, margemTopo });
|
|
28
|
+
(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
|
+
(0, campo_1.campo)({
|
|
34
|
+
value: transp.transporta?.xNome ?? '',
|
|
35
|
+
x: 1.5,
|
|
36
|
+
y: y + 17.5,
|
|
37
|
+
largura: 166.5,
|
|
38
|
+
alinhamento: 'left',
|
|
39
|
+
tamanho: tamanhoFonte,
|
|
40
|
+
ajusteX,
|
|
41
|
+
ajusteY,
|
|
42
|
+
doc,
|
|
43
|
+
margemEsquerda,
|
|
44
|
+
margemTopo
|
|
45
|
+
});
|
|
46
|
+
function ModFrete(value) {
|
|
47
|
+
if (value === '0') {
|
|
48
|
+
return 'Por conta do Remetente';
|
|
49
|
+
}
|
|
50
|
+
else if (value === '1') {
|
|
51
|
+
return 'Por conta do Destinatário';
|
|
52
|
+
}
|
|
53
|
+
else if (value === '2') {
|
|
54
|
+
return 'Por conta de Terceiros';
|
|
55
|
+
}
|
|
56
|
+
else if (value === '3') {
|
|
57
|
+
return 'Por conta do Remetente';
|
|
58
|
+
}
|
|
59
|
+
else if (value === '4') {
|
|
60
|
+
return 'Por conta do Destinatário';
|
|
61
|
+
}
|
|
62
|
+
else if (value === '9') {
|
|
63
|
+
return 'Sem Ocorrência de Transporte';
|
|
64
|
+
}
|
|
65
|
+
return 'VALOR NAO CADASTRADO';
|
|
66
|
+
}
|
|
67
|
+
(0, titulo_1.titulo)({ value: 'FRETE POR CONTA', x: 171.5, y: y + 9.5, largura: 85, ajusteX, ajusteY, doc, margemEsquerda, margemTopo });
|
|
68
|
+
(0, campo_1.campo)({
|
|
69
|
+
value: ModFrete(transp.modFrete),
|
|
70
|
+
x: 171.5,
|
|
71
|
+
y: y + 17.5,
|
|
72
|
+
largura: 85,
|
|
73
|
+
ajusteX,
|
|
74
|
+
ajusteY,
|
|
75
|
+
doc,
|
|
76
|
+
margemEsquerda,
|
|
77
|
+
margemTopo,
|
|
78
|
+
tamanho: 6
|
|
79
|
+
});
|
|
80
|
+
(0, titulo_1.titulo)({ value: 'CÓDIGO ANTT', x: 259.5, y: y + 9.5, largura: 84, ajusteX, ajusteY, doc, margemEsquerda, margemTopo });
|
|
81
|
+
(0, campo_1.campo)({ value: transp.veicTransp?.RNTC ?? '', x: 259.5, y: y + 17.5, largura: 84, ajusteX, ajusteY, doc, margemEsquerda, margemTopo });
|
|
82
|
+
(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 });
|
|
84
|
+
(0, titulo_1.titulo)({ value: 'UF', x: 435.5, y: y + 9.5, largura: 19.5, ajusteX, ajusteY, doc, margemEsquerda, margemTopo });
|
|
85
|
+
(0, campo_1.campo)({ value: transp.veicTransp?.UF ?? '', x: 435.5, y: y + 17.5, largura: 19.5, ajusteX, ajusteY, doc, margemEsquerda, margemTopo });
|
|
86
|
+
(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 });
|
|
89
|
+
(0, titulo_1.titulo)({ value: 'ENDEREÇO', x: 1.5, y: y + 30, largura: 254, ajusteX, ajusteY, doc, margemEsquerda, margemTopo });
|
|
90
|
+
(0, campo_1.campo)({
|
|
91
|
+
value: transp.transporta?.xEnder ?? '',
|
|
92
|
+
x: 1.5,
|
|
93
|
+
y: y + 38.5,
|
|
94
|
+
largura: 254,
|
|
95
|
+
alinhamento: 'left',
|
|
96
|
+
tamanho: default_1.DEFAULT_NFE.tamanhoDaFonteDoCampo - 0.5,
|
|
97
|
+
ajusteX,
|
|
98
|
+
ajusteY,
|
|
99
|
+
doc,
|
|
100
|
+
margemEsquerda,
|
|
101
|
+
margemTopo
|
|
102
|
+
});
|
|
103
|
+
(0, titulo_1.titulo)({ value: 'MUNICÍPIO', x: 259.5, y: y + 30, largura: 172, ajusteX, ajusteY, doc, margemEsquerda, margemTopo });
|
|
104
|
+
(0, campo_1.campo)({ value: transp.transporta?.xMun ?? '', x: 259.5, y: y + 38.5, largura: 172, ajusteX, ajusteY, doc, margemEsquerda, margemTopo });
|
|
105
|
+
(0, titulo_1.titulo)({ value: 'UF', x: 435.5, y: y + 30, largura: 19.5, ajusteX, ajusteY, doc, margemEsquerda, margemTopo });
|
|
106
|
+
(0, campo_1.campo)({ value: transp.transporta?.uf ?? '', x: 435.5, y: y + 38.5, largura: 19.5, ajusteX, ajusteY, doc, margemEsquerda, margemTopo });
|
|
107
|
+
(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 });
|
|
109
|
+
(0, titulo_1.titulo)({ value: 'QUANTIDADE', x: 1.5, y: y + 50, largura: 56.5, ajusteX, ajusteY, doc, margemEsquerda, margemTopo });
|
|
110
|
+
(0, campo_1.campo)({ value: transp.vol?.qVol ?? '', x: 1.5, y: y + 58, largura: 56.5, ajusteX, ajusteY, doc, margemEsquerda, margemTopo });
|
|
111
|
+
(0, titulo_1.titulo)({ value: 'ESPÉCIE', x: 60.8, y: y + 50, largura: 96, ajusteX, ajusteY, doc, margemEsquerda, margemTopo });
|
|
112
|
+
(0, campo_1.campo)({ value: transp.vol?.esp ?? '', x: 60.8, y: y + 58, largura: 96, ajusteX, ajusteY, doc, margemEsquerda, margemTopo });
|
|
113
|
+
(0, titulo_1.titulo)({ value: 'MARCA', x: 160, y: y + 50, largura: 96, ajusteX, ajusteY, doc, margemEsquerda, margemTopo });
|
|
114
|
+
(0, campo_1.campo)({ value: transp.vol?.marca ?? '', x: 160, y: y + 58, largura: 96, ajusteX, ajusteY, doc, margemEsquerda, margemTopo });
|
|
115
|
+
(0, titulo_1.titulo)({ value: 'NUMERAÇÃO', x: 259.5, y: y + 50, largura: 96, ajusteX, ajusteY, doc, margemEsquerda, margemTopo });
|
|
116
|
+
(0, campo_1.campo)({ value: transp.vol?.nVol ?? '', x: 259.5, y: y + 58, largura: 96, ajusteX, ajusteY, doc, margemEsquerda, margemTopo });
|
|
117
|
+
(0, titulo_1.titulo)({ value: 'PESO BRUTO', x: 358.5, y: y + 50, largura: 112.5, ajusteX, ajusteY, doc, margemEsquerda, margemTopo });
|
|
118
|
+
(0, campo_1.campo)({
|
|
119
|
+
value: transp.vol?.pesoB ? (0, utils_1.formatMoney)(transp.vol?.pesoB, 3) : '',
|
|
120
|
+
x: 358.5,
|
|
121
|
+
y: y + 58,
|
|
122
|
+
largura: 112.5,
|
|
123
|
+
ajusteX,
|
|
124
|
+
ajusteY,
|
|
125
|
+
doc,
|
|
126
|
+
margemEsquerda,
|
|
127
|
+
margemTopo
|
|
128
|
+
});
|
|
129
|
+
(0, titulo_1.titulo)({ value: 'PESO LÍQUIDO', x: 474.5, y: y + 50, largura: 110.5, ajusteX, ajusteY, doc, margemEsquerda, margemTopo });
|
|
130
|
+
(0, campo_1.campo)({
|
|
131
|
+
value: transp.vol?.pesoL ? (0, utils_1.formatMoney)(transp.vol?.pesoL, 3) : '',
|
|
132
|
+
x: 474.5,
|
|
133
|
+
y: y + 58,
|
|
134
|
+
largura: 110.5,
|
|
135
|
+
ajusteX,
|
|
136
|
+
ajusteY,
|
|
137
|
+
doc,
|
|
138
|
+
margemEsquerda,
|
|
139
|
+
margemTopo
|
|
140
|
+
});
|
|
141
|
+
return doc.y;
|
|
142
|
+
}
|
|
143
|
+
exports.getTransporte = getTransporte;
|
|
@@ -1 +1,16 @@
|
|
|
1
|
-
"use strict";
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.italico = void 0;
|
|
4
|
+
const default_1 = require("./default");
|
|
5
|
+
function italico({ ajusteX, ajusteY, doc, largura, margemEsquerda, margemTopo, value, x, y, alinhamento, tamanho }) {
|
|
6
|
+
doc
|
|
7
|
+
.font('italico')
|
|
8
|
+
.fillColor(default_1.DEFAULT_NFE.corDoTitulo)
|
|
9
|
+
.fontSize(tamanho ?? 6)
|
|
10
|
+
.text(value ?? '', margemEsquerda + ajusteX + x, margemTopo + ajusteY + y, {
|
|
11
|
+
width: largura,
|
|
12
|
+
align: alinhamento ?? 'center',
|
|
13
|
+
lineGap: -1.5
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
exports.italico = italico;
|
|
@@ -1 +1,8 @@
|
|
|
1
|
-
"use strict";
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.linhaHorizontalTracejada = void 0;
|
|
4
|
+
const linha_horizontal_1 = require("./linha-horizontal");
|
|
5
|
+
function linhaHorizontalTracejada(input) {
|
|
6
|
+
(0, linha_horizontal_1.linhaHorizontal)({ ...input, tracejada: false });
|
|
7
|
+
}
|
|
8
|
+
exports.linhaHorizontalTracejada = linhaHorizontalTracejada;
|
|
@@ -1 +1,16 @@
|
|
|
1
|
-
"use strict";
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.linhaHorizontal = void 0;
|
|
4
|
+
function linhaHorizontal({ ajusteX, ajusteY, doc, x1, x2, y, margemDireita, margemEsquerda, margemTopo, tracejada = false }) {
|
|
5
|
+
y = margemTopo + ajusteY + y;
|
|
6
|
+
x1 = margemEsquerda + ajusteX + x1;
|
|
7
|
+
x2 = margemDireita + ajusteX + x2;
|
|
8
|
+
if (tracejada) {
|
|
9
|
+
doc.moveTo(x1, y).lineTo(x2, y).dash(3, { space: 5 }).stroke();
|
|
10
|
+
doc.undash();
|
|
11
|
+
}
|
|
12
|
+
else {
|
|
13
|
+
doc.moveTo(x1, y).lineTo(x2, y).stroke();
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
exports.linhaHorizontal = linhaHorizontal;
|
|
@@ -1 +1,10 @@
|
|
|
1
|
-
"use strict";
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.linhaVertical = void 0;
|
|
4
|
+
function linhaVertical({ ajusteX, ajusteY, doc, margemEsquerda, margemTopo, x, y1, y2 }) {
|
|
5
|
+
x = margemEsquerda + ajusteX + x;
|
|
6
|
+
y1 = margemTopo + ajusteY + y1;
|
|
7
|
+
y2 = margemTopo + ajusteY + y2;
|
|
8
|
+
doc.moveTo(x, y1).lineTo(x, y2).stroke();
|
|
9
|
+
}
|
|
10
|
+
exports.linhaVertical = linhaVertical;
|
|
@@ -1 +1,31 @@
|
|
|
1
|
-
"use strict";
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.loadFontsNFCe = exports.loadFonts = void 0;
|
|
7
|
+
const path_1 = __importDefault(require("path"));
|
|
8
|
+
function loadFonts(doc) {
|
|
9
|
+
const diretorioDeFontes = path_1.default.join(__dirname, './../fontes');
|
|
10
|
+
const timesNewRoman = path_1.default.join(diretorioDeFontes, 'Times New Roman.ttf');
|
|
11
|
+
const timesNewRomanNegrito = path_1.default.join(diretorioDeFontes, 'Times New Roman Bold.ttf');
|
|
12
|
+
const timesNewRomanItalico = path_1.default.join(diretorioDeFontes, 'Times New Roman Italic.ttf');
|
|
13
|
+
const timesNewRomanNegritoItalico = path_1.default.join(diretorioDeFontes, 'Times New Roman Bold Italic.ttf');
|
|
14
|
+
doc.registerFont('normal', timesNewRoman);
|
|
15
|
+
doc.registerFont('negrito', timesNewRomanNegrito);
|
|
16
|
+
doc.registerFont('italico', timesNewRomanItalico);
|
|
17
|
+
doc.registerFont('negrito-italico', timesNewRomanNegritoItalico);
|
|
18
|
+
}
|
|
19
|
+
exports.loadFonts = loadFonts;
|
|
20
|
+
function loadFontsNFCe(doc) {
|
|
21
|
+
const diretorioDeFontes = path_1.default.join(__dirname, './../fontes/roboto-condensed');
|
|
22
|
+
const normal = path_1.default.join(diretorioDeFontes, 'RobotoCondensed-Regular.ttf');
|
|
23
|
+
const negrito = path_1.default.join(diretorioDeFontes, 'RobotoCondensed-Bold.ttf');
|
|
24
|
+
const italico = path_1.default.join(diretorioDeFontes, 'RobotoCondensed-Italic.ttf');
|
|
25
|
+
const negritoItalico = path_1.default.join(diretorioDeFontes, 'RobotoCondensed-BoldItalic.ttf');
|
|
26
|
+
doc.registerFont('normal', normal);
|
|
27
|
+
doc.registerFont('negrito', negrito);
|
|
28
|
+
doc.registerFont('italico', italico);
|
|
29
|
+
doc.registerFont('negrito-italico', negritoItalico);
|
|
30
|
+
}
|
|
31
|
+
exports.loadFontsNFCe = loadFontsNFCe;
|
|
@@ -1 +1,16 @@
|
|
|
1
|
-
"use strict";
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.negrito = void 0;
|
|
4
|
+
const default_1 = require("./default");
|
|
5
|
+
function negrito({ ajusteX, ajusteY, doc, largura, margemEsquerda, margemTopo, value, x, y, alinhamento, tamanho }) {
|
|
6
|
+
doc
|
|
7
|
+
.font('negrito')
|
|
8
|
+
.fillColor(default_1.DEFAULT_NFE.corDoTitulo)
|
|
9
|
+
.fontSize(tamanho ?? 6)
|
|
10
|
+
.text(value, margemEsquerda + ajusteX + x, margemTopo + ajusteY + y, {
|
|
11
|
+
width: largura,
|
|
12
|
+
align: alinhamento ?? 'center',
|
|
13
|
+
lineGap: -1.5
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
exports.negrito = negrito;
|
|
@@ -1 +1,16 @@
|
|
|
1
|
-
"use strict";
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.normal = void 0;
|
|
4
|
+
const default_1 = require("./default");
|
|
5
|
+
function normal({ ajusteX, ajusteY, doc, largura, margemEsquerda, margemTopo, value, x, y, alinhamento, tamanho }) {
|
|
6
|
+
doc
|
|
7
|
+
.font('normal')
|
|
8
|
+
.fillColor(default_1.DEFAULT_NFE.corDoTitulo)
|
|
9
|
+
.fontSize(tamanho ?? 8)
|
|
10
|
+
.text(value ?? '', margemEsquerda + ajusteX + x, margemTopo + ajusteY + y, {
|
|
11
|
+
width: largura,
|
|
12
|
+
align: alinhamento ?? 'center',
|
|
13
|
+
lineGap: -1.5
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
exports.normal = normal;
|
|
@@ -1 +1,14 @@
|
|
|
1
|
-
"use strict";
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.optionsDocNFCe = exports.optionsDocNFe = void 0;
|
|
4
|
+
const default_1 = require("./default");
|
|
5
|
+
exports.optionsDocNFe = {
|
|
6
|
+
bufferPages: true,
|
|
7
|
+
margin: 0,
|
|
8
|
+
size: [default_1.DEFAULT_NFE.larguraDaPagina, default_1.DEFAULT_NFE.alturaDaPagina]
|
|
9
|
+
};
|
|
10
|
+
exports.optionsDocNFCe = {
|
|
11
|
+
bufferPages: true,
|
|
12
|
+
margin: 0,
|
|
13
|
+
size: [100, 10000000000000]
|
|
14
|
+
};
|
|
@@ -1 +1,17 @@
|
|
|
1
|
-
"use strict";
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.secao = void 0;
|
|
4
|
+
const default_1 = require("./default");
|
|
5
|
+
function secao({ ajusteX, ajusteY, doc, largura, margemEsquerda, margemTopo, value, x, y, tamanho }) {
|
|
6
|
+
x = margemEsquerda + ajusteX + x;
|
|
7
|
+
y = margemTopo + ajusteY + y;
|
|
8
|
+
doc
|
|
9
|
+
.font('negrito')
|
|
10
|
+
.fillColor(default_1.DEFAULT_NFE.corDaSecao)
|
|
11
|
+
.fontSize(tamanho ?? default_1.DEFAULT_NFE.tamanhoDaFonteDaSecao)
|
|
12
|
+
.text(value.toUpperCase(), x, y, {
|
|
13
|
+
width: largura,
|
|
14
|
+
align: 'left'
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
exports.secao = secao;
|
|
@@ -1 +1,17 @@
|
|
|
1
|
-
"use strict";
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.titulo = void 0;
|
|
4
|
+
const default_1 = require("./default");
|
|
5
|
+
function titulo({ doc, largura, value, x, y, margemEsquerda, margemTopo, ajusteX, ajusteY, alinhamento, tamanho }) {
|
|
6
|
+
x = margemEsquerda + ajusteX + x;
|
|
7
|
+
y = margemTopo + ajusteY + y;
|
|
8
|
+
doc
|
|
9
|
+
.font('normal')
|
|
10
|
+
.fillColor(default_1.DEFAULT_NFE.corDoTitulo)
|
|
11
|
+
.fontSize(tamanho ?? default_1.DEFAULT_NFE.tamanhoDaFonteDoTitulo)
|
|
12
|
+
.text(value.toUpperCase(), x, y, {
|
|
13
|
+
width: largura,
|
|
14
|
+
align: alinhamento ?? default_1.DEFAULT_NFE.alinhamentoDoTitulo
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
exports.titulo = titulo;
|
|
@@ -1 +1,25 @@
|
|
|
1
|
-
"use strict";
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.deserializeXml = void 0;
|
|
4
|
+
const xml2js_1 = require("xml2js");
|
|
5
|
+
async function deserializeXml(xml, options) {
|
|
6
|
+
if (options == null) {
|
|
7
|
+
options = {
|
|
8
|
+
mergeAttrs: true,
|
|
9
|
+
ignoreAttrs: true,
|
|
10
|
+
explicitArray: false
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
const parser = new xml2js_1.Parser(options);
|
|
14
|
+
return new Promise((resolve, reject) => {
|
|
15
|
+
parser.parseString(xml, (err, result) => {
|
|
16
|
+
if (err != null) {
|
|
17
|
+
reject(err);
|
|
18
|
+
}
|
|
19
|
+
else {
|
|
20
|
+
resolve(result);
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
exports.deserializeXml = deserializeXml;
|
|
@@ -1 +1,17 @@
|
|
|
1
|
-
"use strict";
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./deserialize"), exports);
|
|
@@ -1 +1,26 @@
|
|
|
1
|
-
"use strict";
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.gerarPDF = void 0;
|
|
4
|
+
const xml_1 = require("../../../application/helpers/xml");
|
|
5
|
+
const pdf_NFCe_1 = require("./pdf-NFCe");
|
|
6
|
+
const pdf_NFe_1 = require("./pdf-NFe");
|
|
7
|
+
async function gerarPDF(xmlNFe, pathLogo) {
|
|
8
|
+
const nf = await (0, xml_1.deserializeXml)(xmlNFe);
|
|
9
|
+
const nfeProc = nf.nfeProc;
|
|
10
|
+
if (!(nfeProc.NFe.infNFe.det instanceof Array)) {
|
|
11
|
+
nfeProc.NFe.infNFe.det = [nfeProc.NFe.infNFe.det];
|
|
12
|
+
}
|
|
13
|
+
if (!(nfeProc.NFe.infNFe.pag.detPag instanceof Array)) {
|
|
14
|
+
nfeProc.NFe.infNFe.pag.detPag = [nfeProc.NFe.infNFe.pag.detPag];
|
|
15
|
+
}
|
|
16
|
+
if (nfeProc.NFe.infNFe.cobr?.dup !== undefined && !(nfeProc.NFe.infNFe.cobr?.dup instanceof Array)) {
|
|
17
|
+
nfeProc.NFe.infNFe.cobr.dup = [nfeProc.NFe.infNFe.cobr?.dup];
|
|
18
|
+
}
|
|
19
|
+
if (nfeProc.NFe.infNFe.ide.mod === '55') {
|
|
20
|
+
return await (0, pdf_NFe_1.pdfNFe)(nfeProc, pathLogo);
|
|
21
|
+
}
|
|
22
|
+
else {
|
|
23
|
+
return await (0, pdf_NFCe_1.pdfNFCe)(nfeProc, pathLogo);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
exports.gerarPDF = gerarPDF;
|