makeapps-transformer 1.0.0

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 (174) hide show
  1. package/.vscode/settings.json +3 -0
  2. package/dist/index.d.ts +7 -0
  3. package/dist/index.js +4 -0
  4. package/dist/lib-public/FA3-generator.js +50 -0
  5. package/dist/lib-public/enums/invoice.enums.js +9 -0
  6. package/dist/lib-public/generate-invoice.js +21 -0
  7. package/dist/lib-public/generators/FA2/Adnotacje.js +174 -0
  8. package/dist/lib-public/generators/FA2/Adres.js +23 -0
  9. package/dist/lib-public/generators/FA2/DodatkoweInformacje.js +69 -0
  10. package/dist/lib-public/generators/FA2/Platnosc.js +91 -0
  11. package/dist/lib-public/generators/FA2/Podmiot1.js +32 -0
  12. package/dist/lib-public/generators/FA2/Podmiot1Podmiot1K.js +63 -0
  13. package/dist/lib-public/generators/FA2/Podmiot2.js +28 -0
  14. package/dist/lib-public/generators/FA2/Podmiot2Podmiot2k.js +62 -0
  15. package/dist/lib-public/generators/FA2/Podmiot3.js +37 -0
  16. package/dist/lib-public/generators/FA2/Podmiot3Podmiot2k.js +57 -0
  17. package/dist/lib-public/generators/FA2/PodmiotAdres.js +14 -0
  18. package/dist/lib-public/generators/FA2/PodmiotDaneIdentyfikacyjneTPodmiot1Dto.js +10 -0
  19. package/dist/lib-public/generators/FA2/PodmiotDaneIdentyfikacyjneTPodmiot2Dto.js +34 -0
  20. package/dist/lib-public/generators/FA2/PodmiotDaneIdentyfikacyjneTPodmiot3Dto.js +44 -0
  21. package/dist/lib-public/generators/FA2/PodmiotDaneKontaktowe.js +13 -0
  22. package/dist/lib-public/generators/FA2/PodmiotUpowazniony.js +29 -0
  23. package/dist/lib-public/generators/FA2/PodmiotUpowaznionyDaneKontaktowe.js +28 -0
  24. package/dist/lib-public/generators/FA2/Podmioty.js +92 -0
  25. package/dist/lib-public/generators/FA2/PodsumowanieStawekPodatkuVat.js +260 -0
  26. package/dist/lib-public/generators/FA2/Przewoznik.js +17 -0
  27. package/dist/lib-public/generators/FA2/Rabat.js +57 -0
  28. package/dist/lib-public/generators/FA2/RachunekBankowy.js +54 -0
  29. package/dist/lib-public/generators/FA2/Szczegoly.js +138 -0
  30. package/dist/lib-public/generators/FA2/Transport.js +78 -0
  31. package/dist/lib-public/generators/FA2/WarunkiTransakcji.js +68 -0
  32. package/dist/lib-public/generators/FA2/Wiersze.js +140 -0
  33. package/dist/lib-public/generators/FA2/Zamowienie.js +148 -0
  34. package/dist/lib-public/generators/FA3/Adnotacje.js +185 -0
  35. package/dist/lib-public/generators/FA3/Adres.js +23 -0
  36. package/dist/lib-public/generators/FA3/DodatkoweInformacje.js +69 -0
  37. package/dist/lib-public/generators/FA3/Platnosc.js +105 -0
  38. package/dist/lib-public/generators/FA3/Podmiot1.js +32 -0
  39. package/dist/lib-public/generators/FA3/Podmiot1Podmiot1K.js +67 -0
  40. package/dist/lib-public/generators/FA3/Podmiot2.js +34 -0
  41. package/dist/lib-public/generators/FA3/Podmiot2Podmiot2k.js +49 -0
  42. package/dist/lib-public/generators/FA3/Podmiot3.js +37 -0
  43. package/dist/lib-public/generators/FA3/Podmiot3Podmiot2k.js +57 -0
  44. package/dist/lib-public/generators/FA3/PodmiotAdres.js +14 -0
  45. package/dist/lib-public/generators/FA3/PodmiotDaneIdentyfikacyjneTPodmiot1Dto.js +10 -0
  46. package/dist/lib-public/generators/FA3/PodmiotDaneIdentyfikacyjneTPodmiot2Dto.js +34 -0
  47. package/dist/lib-public/generators/FA3/PodmiotDaneIdentyfikacyjneTPodmiot3Dto.js +44 -0
  48. package/dist/lib-public/generators/FA3/PodmiotDaneKontaktowe.js +13 -0
  49. package/dist/lib-public/generators/FA3/PodmiotUpowazniony.js +29 -0
  50. package/dist/lib-public/generators/FA3/PodmiotUpowaznionyDaneKontaktowe.js +28 -0
  51. package/dist/lib-public/generators/FA3/Podmioty.js +92 -0
  52. package/dist/lib-public/generators/FA3/PodsumowanieStawekPodatkuVat.js +264 -0
  53. package/dist/lib-public/generators/FA3/Przewoznik.js +17 -0
  54. package/dist/lib-public/generators/FA3/Rabat.js +57 -0
  55. package/dist/lib-public/generators/FA3/RachunekBankowy.js +58 -0
  56. package/dist/lib-public/generators/FA3/Szczegoly.js +138 -0
  57. package/dist/lib-public/generators/FA3/Transport.js +78 -0
  58. package/dist/lib-public/generators/FA3/WarunkiTransakcji.js +68 -0
  59. package/dist/lib-public/generators/FA3/Wiersze.js +140 -0
  60. package/dist/lib-public/generators/FA3/Zamowienie.js +148 -0
  61. package/dist/lib-public/generators/common/DaneFaKorygowanej.js +74 -0
  62. package/dist/lib-public/generators/common/Naglowek.js +100 -0
  63. package/dist/lib-public/generators/common/Rozliczenie.js +120 -0
  64. package/dist/lib-public/generators/common/Stopka.js +113 -0
  65. package/dist/lib-public/generators/common/Wiersze.js +28 -0
  66. package/dist/lib-public/generators/common/Zalaczniki.js +182 -0
  67. package/dist/lib-public/index.js +5 -0
  68. package/dist/lib-public/types/common.types.js +2 -0
  69. package/dist/lib-public/types/fa1-additional-types.js +2 -0
  70. package/dist/lib-public/types/fa1.types.js +2 -0
  71. package/dist/lib-public/types/fa2-additional-types.js +2 -0
  72. package/dist/lib-public/types/fa2.types.js +2 -0
  73. package/dist/lib-public/types/fa2Podmiot3DaneIdentyfikacyjne.types.js +2 -0
  74. package/dist/lib-public/types/fa3.types.js +2 -0
  75. package/dist/lib-public/types/fa3Podmiot3DaneIdentyfikacyjne.types.js +2 -0
  76. package/dist/lib-public/types/tax-summary.types.js +2 -0
  77. package/dist/lib-public/types/upo-v4_2.types.js +2 -0
  78. package/dist/shared/PDF-functions.js +429 -0
  79. package/dist/shared/XML-parser.js +21 -0
  80. package/dist/shared/consts/const.js +390 -0
  81. package/dist/shared/enums/common.enum.js +48 -0
  82. package/dist/shared/enums/invoice.enums.js +13 -0
  83. package/dist/shared/generators/common/functions.js +95 -0
  84. package/dist/shared/types/additional-data.types.js +2 -0
  85. package/dist/shared/types/pdf-types.js +2 -0
  86. package/dist/shared/types/universal.types.js +2 -0
  87. package/package.json +21 -0
  88. package/src/index.d.ts +7 -0
  89. package/src/index.ts +2 -0
  90. package/src/lib-public/FA3-generator.ts +56 -0
  91. package/src/lib-public/enums/invoice.enums.ts +5 -0
  92. package/src/lib-public/generate-invoice.ts +32 -0
  93. package/src/lib-public/generators/FA2/Adnotacje.ts +206 -0
  94. package/src/lib-public/generators/FA2/Adres.ts +20 -0
  95. package/src/lib-public/generators/FA2/DodatkoweInformacje.ts +97 -0
  96. package/src/lib-public/generators/FA2/Platnosc.ts +131 -0
  97. package/src/lib-public/generators/FA2/Podmiot1.ts +40 -0
  98. package/src/lib-public/generators/FA2/Podmiot1Podmiot1K.ts +73 -0
  99. package/src/lib-public/generators/FA2/Podmiot2.ts +42 -0
  100. package/src/lib-public/generators/FA2/Podmiot2Podmiot2k.ts +74 -0
  101. package/src/lib-public/generators/FA2/Podmiot3.ts +50 -0
  102. package/src/lib-public/generators/FA2/Podmiot3Podmiot2k.ts +77 -0
  103. package/src/lib-public/generators/FA2/PodmiotAdres.ts +19 -0
  104. package/src/lib-public/generators/FA2/PodmiotDaneIdentyfikacyjneTPodmiot1Dto.ts +10 -0
  105. package/src/lib-public/generators/FA2/PodmiotDaneIdentyfikacyjneTPodmiot2Dto.ts +37 -0
  106. package/src/lib-public/generators/FA2/PodmiotDaneIdentyfikacyjneTPodmiot3Dto.ts +44 -0
  107. package/src/lib-public/generators/FA2/PodmiotDaneKontaktowe.ts +12 -0
  108. package/src/lib-public/generators/FA2/PodmiotUpowazniony.ts +31 -0
  109. package/src/lib-public/generators/FA2/PodmiotUpowaznionyDaneKontaktowe.ts +34 -0
  110. package/src/lib-public/generators/FA2/Podmioty.ts +96 -0
  111. package/src/lib-public/generators/FA2/PodsumowanieStawekPodatkuVat.ts +294 -0
  112. package/src/lib-public/generators/FA2/Przewoznik.ts +21 -0
  113. package/src/lib-public/generators/FA2/Rabat.ts +47 -0
  114. package/src/lib-public/generators/FA2/RachunekBankowy.ts +60 -0
  115. package/src/lib-public/generators/FA2/Szczegoly.ts +187 -0
  116. package/src/lib-public/generators/FA2/Transport.ts +108 -0
  117. package/src/lib-public/generators/FA2/WarunkiTransakcji.ts +105 -0
  118. package/src/lib-public/generators/FA2/Wiersze.ts +126 -0
  119. package/src/lib-public/generators/FA2/Zamowienie.ts +144 -0
  120. package/src/lib-public/generators/FA3/Adnotacje.ts +249 -0
  121. package/src/lib-public/generators/FA3/Adres.ts +20 -0
  122. package/src/lib-public/generators/FA3/DodatkoweInformacje.ts +92 -0
  123. package/src/lib-public/generators/FA3/Platnosc.ts +144 -0
  124. package/src/lib-public/generators/FA3/Podmiot1.ts +40 -0
  125. package/src/lib-public/generators/FA3/Podmiot1Podmiot1K.ts +78 -0
  126. package/src/lib-public/generators/FA3/Podmiot2.ts +55 -0
  127. package/src/lib-public/generators/FA3/Podmiot2Podmiot2k.ts +59 -0
  128. package/src/lib-public/generators/FA3/Podmiot3.ts +50 -0
  129. package/src/lib-public/generators/FA3/Podmiot3Podmiot2k.ts +78 -0
  130. package/src/lib-public/generators/FA3/PodmiotAdres.ts +19 -0
  131. package/src/lib-public/generators/FA3/PodmiotDaneIdentyfikacyjneTPodmiot1Dto.ts +10 -0
  132. package/src/lib-public/generators/FA3/PodmiotDaneIdentyfikacyjneTPodmiot2Dto.ts +37 -0
  133. package/src/lib-public/generators/FA3/PodmiotDaneIdentyfikacyjneTPodmiot3Dto.ts +44 -0
  134. package/src/lib-public/generators/FA3/PodmiotDaneKontaktowe.ts +12 -0
  135. package/src/lib-public/generators/FA3/PodmiotUpowazniony.ts +31 -0
  136. package/src/lib-public/generators/FA3/PodmiotUpowaznionyDaneKontaktowe.ts +34 -0
  137. package/src/lib-public/generators/FA3/Podmioty.ts +96 -0
  138. package/src/lib-public/generators/FA3/PodsumowanieStawekPodatkuVat.ts +298 -0
  139. package/src/lib-public/generators/FA3/Przewoznik.ts +24 -0
  140. package/src/lib-public/generators/FA3/Rabat.ts +45 -0
  141. package/src/lib-public/generators/FA3/RachunekBankowy.ts +60 -0
  142. package/src/lib-public/generators/FA3/Szczegoly.ts +184 -0
  143. package/src/lib-public/generators/FA3/Transport.ts +108 -0
  144. package/src/lib-public/generators/FA3/WarunkiTransakcji.ts +100 -0
  145. package/src/lib-public/generators/FA3/Wiersze.ts +126 -0
  146. package/src/lib-public/generators/FA3/Zamowienie.ts +143 -0
  147. package/src/lib-public/generators/common/DaneFaKorygowanej.ts +91 -0
  148. package/src/lib-public/generators/common/Naglowek.ts +84 -0
  149. package/src/lib-public/generators/common/Rozliczenie.ts +119 -0
  150. package/src/lib-public/generators/common/Stopka.ts +161 -0
  151. package/src/lib-public/generators/common/Wiersze.ts +32 -0
  152. package/src/lib-public/generators/common/Zalaczniki.ts +232 -0
  153. package/src/lib-public/index.ts +3 -0
  154. package/src/lib-public/types/common.types.ts +29 -0
  155. package/src/lib-public/types/fa1-additional-types.ts +26 -0
  156. package/src/lib-public/types/fa1.types.ts +299 -0
  157. package/src/lib-public/types/fa2-additional-types.ts +30 -0
  158. package/src/lib-public/types/fa2.types.ts +307 -0
  159. package/src/lib-public/types/fa2Podmiot3DaneIdentyfikacyjne.types.ts +12 -0
  160. package/src/lib-public/types/fa3.types.ts +384 -0
  161. package/src/lib-public/types/fa3Podmiot3DaneIdentyfikacyjne.types.ts +12 -0
  162. package/src/lib-public/types/tax-summary.types.ts +8 -0
  163. package/src/lib-public/types/upo-v4_2.types.ts +68 -0
  164. package/src/shared/PDF-functions.ts +466 -0
  165. package/src/shared/XML-parser.ts +42 -0
  166. package/src/shared/consts/const.ts +406 -0
  167. package/src/shared/enums/common.enum.ts +45 -0
  168. package/src/shared/enums/invoice.enums.ts +9 -0
  169. package/src/shared/generators/common/functions.ts +101 -0
  170. package/src/shared/types/additional-data.types.ts +15 -0
  171. package/src/shared/types/pdf-types.ts +58 -0
  172. package/src/shared/types/universal.types.ts +16 -0
  173. package/transformer.code-workspace +45 -0
  174. package/tsconfig.json +16 -0
@@ -0,0 +1,120 @@
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 __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.generateRozliczenie = generateRozliczenie;
37
+ const PDF_functions_1 = require("../../../shared/PDF-functions");
38
+ const common_enum_1 = __importStar(require("../../../shared/enums/common.enum"));
39
+ function generateRozliczenie(rozliczenie, KodWaluty) {
40
+ var _a, _b, _c, _d;
41
+ if (!rozliczenie) {
42
+ return [];
43
+ }
44
+ const obciazenia = (0, PDF_functions_1.getTable)(rozliczenie === null || rozliczenie === void 0 ? void 0 : rozliczenie.Obciazenia);
45
+ const odliczenia = (0, PDF_functions_1.getTable)(rozliczenie === null || rozliczenie === void 0 ? void 0 : rozliczenie.Odliczenia);
46
+ const result = [];
47
+ const headerOdliczenia = [
48
+ {
49
+ title: 'Powód odliczenia',
50
+ name: 'Powod',
51
+ format: common_enum_1.default.Default,
52
+ },
53
+ {
54
+ title: 'Kwota odliczenia',
55
+ name: 'Kwota',
56
+ format: common_enum_1.default.Currency,
57
+ },
58
+ ];
59
+ const headerObciazenia = [
60
+ {
61
+ name: 'Powod',
62
+ title: 'Powód obciążenia',
63
+ format: common_enum_1.default.Default,
64
+ },
65
+ {
66
+ name: 'Kwota',
67
+ title: 'Kwota obciążenia',
68
+ format: common_enum_1.default.Currency,
69
+ },
70
+ ];
71
+ const tableObciazenia = (0, PDF_functions_1.getContentTable)(headerObciazenia, obciazenia, '*');
72
+ const tableOdliczenia = (0, PDF_functions_1.getContentTable)(headerOdliczenia, odliczenia, '*');
73
+ const SumaObciazen = (0, PDF_functions_1.createLabelText)('Suma kwot obciążenia: ', rozliczenie.SumaObciazen, common_enum_1.default.Currency, {
74
+ alignment: common_enum_1.Position.RIGHT,
75
+ });
76
+ const Sumaodliczen = (0, PDF_functions_1.createLabelText)('Suma kwot odliczenia: ', rozliczenie === null || rozliczenie === void 0 ? void 0 : rozliczenie.SumaOdliczen, common_enum_1.default.Currency, {
77
+ alignment: common_enum_1.Position.RIGHT,
78
+ });
79
+ const resultObciazenia = [
80
+ (0, PDF_functions_1.createSubHeader)('Obciążenia'),
81
+ (_a = tableObciazenia.content) !== null && _a !== void 0 ? _a : [],
82
+ SumaObciazen,
83
+ ];
84
+ const resultOdliczenia = [
85
+ (0, PDF_functions_1.createSubHeader)('Odliczenia'),
86
+ (_b = tableOdliczenia.content) !== null && _b !== void 0 ? _b : [],
87
+ Sumaodliczen,
88
+ ];
89
+ result.push((0, PDF_functions_1.createHeader)('Rozliczenie', [0, 8, 0, 4]));
90
+ if (obciazenia.length > 0 && odliczenia.length > 0) {
91
+ result.push((0, PDF_functions_1.generateTwoColumns)([resultObciazenia], [resultOdliczenia]));
92
+ }
93
+ else if (obciazenia.length > 0) {
94
+ result.push((0, PDF_functions_1.generateTwoColumns)([resultObciazenia], []));
95
+ }
96
+ else if (odliczenia.length > 0) {
97
+ result.push((0, PDF_functions_1.generateTwoColumns)([], [resultOdliczenia]));
98
+ }
99
+ if ((_c = rozliczenie === null || rozliczenie === void 0 ? void 0 : rozliczenie.DoZaplaty) === null || _c === void 0 ? void 0 : _c._text) {
100
+ result.push({
101
+ stack: (0, PDF_functions_1.createLabelTextArray)([
102
+ { value: 'Do zapłaty: ', formatTyp: common_enum_1.default.LabelGreater },
103
+ { value: rozliczenie === null || rozliczenie === void 0 ? void 0 : rozliczenie.DoZaplaty, formatTyp: common_enum_1.default.CurrencyGreater, currency: KodWaluty },
104
+ ]),
105
+ alignment: common_enum_1.Position.RIGHT,
106
+ margin: [0, 8, 0, 0],
107
+ });
108
+ }
109
+ else if ((_d = rozliczenie === null || rozliczenie === void 0 ? void 0 : rozliczenie.DoRozliczenia) === null || _d === void 0 ? void 0 : _d._text) {
110
+ result.push({
111
+ stack: (0, PDF_functions_1.createLabelTextArray)([
112
+ { value: 'Do rozliczenia: ', formatTyp: common_enum_1.default.LabelGreater },
113
+ { value: rozliczenie === null || rozliczenie === void 0 ? void 0 : rozliczenie.DoRozliczenia, formatTyp: common_enum_1.default.CurrencyGreater, currency: KodWaluty },
114
+ ]),
115
+ alignment: common_enum_1.Position.RIGHT,
116
+ marginTop: 8,
117
+ });
118
+ }
119
+ return (0, PDF_functions_1.createSection)(result, true);
120
+ }
@@ -0,0 +1,113 @@
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.generateStopka = generateStopka;
7
+ const PDF_functions_1 = require("../../../shared/PDF-functions");
8
+ const Zalaczniki_1 = require("./Zalaczniki");
9
+ const common_enum_1 = __importDefault(require("../../../shared/enums/common.enum"));
10
+ function generateStopka(additionalData, stopka, naglowek, wz, zalacznik) {
11
+ const wzty = generateWZ(wz);
12
+ const rejestry = generateRejestry(stopka);
13
+ const informacje = generateInformacje(stopka);
14
+ const qrCode = generateQRCodeData(additionalData);
15
+ const zalaczniki = !(additionalData === null || additionalData === void 0 ? void 0 : additionalData.isMobile) ? (0, Zalaczniki_1.generateZalaczniki)(zalacznik) : [];
16
+ const result = [
17
+ (0, PDF_functions_1.verticalSpacing)(1),
18
+ ...(wzty.length ? [(0, PDF_functions_1.generateLine)()] : []),
19
+ ...(wzty.length ? [(0, PDF_functions_1.generateTwoColumns)(wzty, [])] : []),
20
+ ...(rejestry.length || informacje.length ? [(0, PDF_functions_1.generateLine)()] : []),
21
+ ...rejestry,
22
+ ...informacje,
23
+ ...(zalaczniki.length ? zalaczniki : []),
24
+ { stack: [...qrCode], unbreakable: true },
25
+ (0, PDF_functions_1.createSection)([
26
+ {
27
+ stack: (0, PDF_functions_1.createLabelText)('Wytworzona w:', naglowek === null || naglowek === void 0 ? void 0 : naglowek.SystemInfo),
28
+ margin: [0, 8, 0, 0],
29
+ },
30
+ ], true, [0, 0, 0, 0]),
31
+ ];
32
+ return (0, PDF_functions_1.createSection)(result, false);
33
+ }
34
+ function generateWZ(wz) {
35
+ const result = [];
36
+ const definedHeader = [{ name: '', title: 'Numer WZ', format: common_enum_1.default.Default }];
37
+ const faWiersze = (0, PDF_functions_1.getTable)(wz !== null && wz !== void 0 ? wz : []);
38
+ const content = (0, PDF_functions_1.getContentTable)([...definedHeader], faWiersze, '*');
39
+ if (content.fieldsWithValue.length && content.content) {
40
+ result.push((0, PDF_functions_1.createSubHeader)('Numery dokumentów magazynowych WZ', [0, 8, 0, 4]));
41
+ result.push(content.content);
42
+ }
43
+ return result;
44
+ }
45
+ function generateRejestry(stopka) {
46
+ var _a;
47
+ const result = [];
48
+ const definedHeader = [
49
+ { name: 'PelnaNazwa', title: 'Pełna nazwa', format: common_enum_1.default.Default },
50
+ { name: 'KRS', title: 'KRS', format: common_enum_1.default.Default },
51
+ { name: 'REGON', title: 'REGON', format: common_enum_1.default.Default },
52
+ { name: 'BDO', title: 'BDO', format: common_enum_1.default.Default },
53
+ ];
54
+ const faWiersze = (0, PDF_functions_1.getTable)((_a = stopka === null || stopka === void 0 ? void 0 : stopka.Rejestry) !== null && _a !== void 0 ? _a : []);
55
+ const content = (0, PDF_functions_1.getContentTable)([...definedHeader], faWiersze, '*');
56
+ if (content.fieldsWithValue.length && content.content) {
57
+ result.push((0, PDF_functions_1.createHeader)('Rejestry'));
58
+ result.push(content.content);
59
+ }
60
+ return result;
61
+ }
62
+ function generateInformacje(stopka) {
63
+ var _a;
64
+ const result = [];
65
+ const definedHeader = [
66
+ { name: 'StopkaFaktury', title: 'Stopka faktury', format: common_enum_1.default.Default },
67
+ ];
68
+ const faWiersze = (0, PDF_functions_1.getTable)((_a = stopka === null || stopka === void 0 ? void 0 : stopka.Informacje) !== null && _a !== void 0 ? _a : []);
69
+ const content = (0, PDF_functions_1.getContentTable)([...definedHeader], faWiersze, '*');
70
+ if (content.fieldsWithValue.length && content.content) {
71
+ result.push((0, PDF_functions_1.createHeader)('Pozostałe informacje'));
72
+ result.push(content.content);
73
+ }
74
+ return result;
75
+ }
76
+ function generateQRCodeData(additionalData) {
77
+ var _a;
78
+ const result = [];
79
+ if ((additionalData === null || additionalData === void 0 ? void 0 : additionalData.qrCode) && additionalData.nrKSeF) {
80
+ const qrCode = (0, PDF_functions_1.generateQRCode)(additionalData.qrCode);
81
+ result.push((0, PDF_functions_1.createHeader)('Sprawdź, czy Twoja faktura znajduje się w KSeF!'));
82
+ if (qrCode) {
83
+ result.push({
84
+ columns: [
85
+ {
86
+ stack: [
87
+ qrCode,
88
+ {
89
+ stack: [(0, PDF_functions_1.formatText)(additionalData.nrKSeF, common_enum_1.default.Default)],
90
+ width: 'auto',
91
+ alignment: 'center',
92
+ marginLeft: 10,
93
+ marginRight: 10,
94
+ marginTop: 10,
95
+ },
96
+ ],
97
+ width: 150,
98
+ },
99
+ {
100
+ stack: [
101
+ (0, PDF_functions_1.formatText)('Nie możesz zeskanować kodu z obrazka? Kliknij w link weryfikacyjny i przejdź do weryfikacji faktury!', common_enum_1.default.Value),
102
+ { stack: [(0, PDF_functions_1.formatText)(additionalData.qrCode, common_enum_1.default.Link)], marginTop: 5 },
103
+ ],
104
+ link: additionalData.qrCode,
105
+ margin: [10, ((_a = qrCode.fit) !== null && _a !== void 0 ? _a : 120) / 2 - 30, 0, 0],
106
+ width: 'auto',
107
+ },
108
+ ],
109
+ });
110
+ }
111
+ }
112
+ return (0, PDF_functions_1.createSection)(result, true);
113
+ }
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.shouldAddMarza = shouldAddMarza;
4
+ const const_1 = require("../../../shared/consts/const");
5
+ const PDF_functions_1 = require("../../../shared/PDF-functions");
6
+ function shouldAddMarza(rodzajFaktury, isP_PMarzy, wiersz) {
7
+ if (typeof rodzajFaktury === 'string') {
8
+ const isVATType = [
9
+ const_1.TRodzajFaktury.VAT,
10
+ const_1.TRodzajFaktury.KOR,
11
+ const_1.TRodzajFaktury.ROZ,
12
+ const_1.TRodzajFaktury.KOR_ROZ,
13
+ ].includes(rodzajFaktury);
14
+ const isZALType = [const_1.TRodzajFaktury.ZAL, const_1.TRodzajFaktury.KOR_ZAL].includes(rodzajFaktury);
15
+ if (isP_PMarzy) {
16
+ if (isVATType && !(0, PDF_functions_1.getValue)(wiersz.P_12) && !(0, PDF_functions_1.getValue)(wiersz.P_12_XII)) {
17
+ return { P_12: { _text: 'marża' } };
18
+ }
19
+ else if (isZALType && !(0, PDF_functions_1.getValue)(wiersz.P_12Z) && !(0, PDF_functions_1.getValue)(wiersz.P_12Z_XII)) {
20
+ return { P_12Z: { _text: 'marża' } };
21
+ }
22
+ else {
23
+ return null;
24
+ }
25
+ }
26
+ }
27
+ return null;
28
+ }
@@ -0,0 +1,182 @@
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.generateZalaczniki = generateZalaczniki;
7
+ exports.chunkArray = chunkArray;
8
+ const const_1 = require("../../../shared/consts/const");
9
+ const PDF_functions_1 = require("../../../shared/PDF-functions");
10
+ const common_enum_1 = __importDefault(require("../../../shared/enums/common.enum"));
11
+ function generateZalaczniki(zalacznik) {
12
+ var _a;
13
+ if (!(0, PDF_functions_1.getTable)(zalacznik === null || zalacznik === void 0 ? void 0 : zalacznik.BlokDanych).length) {
14
+ return [];
15
+ }
16
+ const result = [];
17
+ const definedHeader = [
18
+ { name: 'PelnaNazwa', title: 'Pełna nazwa', format: common_enum_1.default.Default },
19
+ { name: 'KRS', title: 'KRS', format: common_enum_1.default.Default },
20
+ { name: 'REGON', title: 'REGON', format: common_enum_1.default.Default },
21
+ { name: 'BDO', title: 'BDO', format: common_enum_1.default.Default },
22
+ ];
23
+ const faWiersze = (0, PDF_functions_1.getTable)((_a = zalacznik === null || zalacznik === void 0 ? void 0 : zalacznik.BlokDanych) !== null && _a !== void 0 ? _a : []);
24
+ const content = (0, PDF_functions_1.getContentTable)([...definedHeader], faWiersze, '*');
25
+ result.push((0, PDF_functions_1.createHeader)('Załącznik do Faktury VAT'));
26
+ (0, PDF_functions_1.getTable)(zalacznik === null || zalacznik === void 0 ? void 0 : zalacznik.BlokDanych).forEach((blok, index) => {
27
+ var _a, _b;
28
+ result.push((0, PDF_functions_1.createSubHeader)(`Szczegółowe dane załącznika (${index + 1})`));
29
+ if (blok.ZNaglowek) {
30
+ result.push((0, PDF_functions_1.createLabelText)('Nagłówek bloku danych: ', blok.ZNaglowek, common_enum_1.default.Value, { marginBottom: 8 }));
31
+ }
32
+ if ((_a = (0, PDF_functions_1.getTable)(blok.MetaDane)) === null || _a === void 0 ? void 0 : _a.length) {
33
+ result.push(generateKluczWartosc((0, PDF_functions_1.getTable)(blok.MetaDane)));
34
+ }
35
+ if ((_b = blok.Tekst) === null || _b === void 0 ? void 0 : _b.Akapit) {
36
+ result.push((0, PDF_functions_1.createLabelText)('Opis: ', ' '));
37
+ (0, PDF_functions_1.getTable)(blok.Tekst.Akapit).forEach((text) => {
38
+ if ((0, PDF_functions_1.hasValue)(text)) {
39
+ result.push((0, PDF_functions_1.formatText)(text._text, common_enum_1.default.Value));
40
+ }
41
+ });
42
+ }
43
+ if ((0, PDF_functions_1.getTable)(blok.Tabela).length) {
44
+ (0, PDF_functions_1.getTable)(blok.Tabela).forEach((tabela, index) => {
45
+ var _a, _b, _c, _d, _e, _f;
46
+ if ((_a = blok.ZNaglowek) === null || _a === void 0 ? void 0 : _a._text) {
47
+ result.push((0, PDF_functions_1.createSubHeader)(`${(_b = blok.ZNaglowek) === null || _b === void 0 ? void 0 : _b._text} ${index + 1}`));
48
+ }
49
+ if ((_c = (0, PDF_functions_1.getTable)(tabela.TMetaDane)) === null || _c === void 0 ? void 0 : _c.length) {
50
+ result.push({
51
+ stack: generateKluczWartosc((0, PDF_functions_1.getTable)(tabela.TMetaDane).map((item) => ({
52
+ ZKlucz: item.TKlucz,
53
+ ZWartosc: item.TWartosc,
54
+ }))),
55
+ margin: [0, 8, 0, 0],
56
+ });
57
+ }
58
+ if (tabela.Opis) {
59
+ result.push((0, PDF_functions_1.createLabelText)('Opis: ', tabela.Opis));
60
+ }
61
+ if ((0, PDF_functions_1.getTable)((_d = tabela.TNaglowek) === null || _d === void 0 ? void 0 : _d.Kol).length) {
62
+ result.push((0, PDF_functions_1.formatText)('Tabela', [common_enum_1.default.GrayBoldTitle, common_enum_1.default.LabelSmallMargin]));
63
+ result.push(generateTable(tabela));
64
+ }
65
+ if ((0, PDF_functions_1.getTable)((_e = tabela.Suma) === null || _e === void 0 ? void 0 : _e.SKom).length) {
66
+ result.push(generateSuma((0, PDF_functions_1.getTable)((_f = tabela.Suma) === null || _f === void 0 ? void 0 : _f.SKom)));
67
+ }
68
+ });
69
+ }
70
+ });
71
+ if (content.fieldsWithValue.length && content.content) {
72
+ result.push(content.content);
73
+ }
74
+ return (0, PDF_functions_1.createSection)(result, false);
75
+ }
76
+ function generateKluczWartosc(data) {
77
+ const result = [];
78
+ const definedHeader = [
79
+ { name: 'ZKlucz', title: 'Klucz', format: common_enum_1.default.Default },
80
+ { name: 'ZWartosc', title: 'Wartość', format: common_enum_1.default.Default },
81
+ ];
82
+ const faWiersze = (0, PDF_functions_1.getTable)(data !== null && data !== void 0 ? data : []);
83
+ const content = (0, PDF_functions_1.getContentTable)([...definedHeader], faWiersze, '*');
84
+ if (content.fieldsWithValue.length && content.content) {
85
+ result.push(content.content);
86
+ }
87
+ return result;
88
+ }
89
+ function generateTable(tabela) {
90
+ var _a, _b;
91
+ if (!((_b = (_a = tabela.TNaglowek) === null || _a === void 0 ? void 0 : _a.Kol) === null || _b === void 0 ? void 0 : _b.length)) {
92
+ return [];
93
+ }
94
+ const result = [];
95
+ const Kol = (0, PDF_functions_1.getTable)(tabela.TNaglowek.Kol);
96
+ const cutedTableHeader = chunkArray(Kol);
97
+ cutedTableHeader.forEach((table, index) => {
98
+ var _a;
99
+ result.push(createTable(table, (_a = tabela.Wiersz) !== null && _a !== void 0 ? _a : [], index, Kol.length));
100
+ });
101
+ return result;
102
+ }
103
+ function createTable(cols, rows, subTableIndex, totalLength) {
104
+ const definedHeader = cols.map((item) => { var _a; return (0, PDF_functions_1.formatText)((_a = item.NKom) === null || _a === void 0 ? void 0 : _a._text, common_enum_1.default.GrayBoldTitle); });
105
+ const tableBody = [];
106
+ rows.forEach((item) => {
107
+ const WKom = (0, PDF_functions_1.getTable)(item.WKom);
108
+ while (WKom.length < totalLength) {
109
+ WKom.push({ _text: '' });
110
+ }
111
+ const cuttedRows = chunkArray(WKom !== null && WKom !== void 0 ? WKom : []);
112
+ if (cuttedRows.length >= subTableIndex + 1) {
113
+ tableBody.push(cuttedRows[subTableIndex].map((subItem, index) => {
114
+ var _a, _b;
115
+ return (0, PDF_functions_1.formatText)((_a = subItem._text) !== null && _a !== void 0 ? _a : '', ((_b = cols[index]._attributes) === null || _b === void 0 ? void 0 : _b.Typ) ? const_1.TableDataType[cols[index]._attributes.Typ] : common_enum_1.default.Value);
116
+ }));
117
+ }
118
+ });
119
+ const widths = definedHeader.map((index) => {
120
+ if (index) {
121
+ return ['*'];
122
+ }
123
+ else {
124
+ return ['auto'];
125
+ }
126
+ });
127
+ return {
128
+ table: {
129
+ headerRows: 1,
130
+ widths: [...widths],
131
+ heights: 8,
132
+ body: [[...definedHeader], ...tableBody],
133
+ },
134
+ layout: const_1.DEFAULT_TABLE_LAYOUT,
135
+ marginTop: 8,
136
+ };
137
+ }
138
+ function generateSuma(data) {
139
+ const result = [];
140
+ const definedHeader = [
141
+ { name: '', title: 'Podsumowanie tabeli', format: common_enum_1.default.Default },
142
+ ];
143
+ const faWiersze = (0, PDF_functions_1.getTable)(data !== null && data !== void 0 ? data : []);
144
+ const content = (0, PDF_functions_1.getContentTable)([...definedHeader], faWiersze, '*', [0, 8, 0, 0]);
145
+ if (content.fieldsWithValue.length && content.content) {
146
+ result.push(content.content);
147
+ }
148
+ return result;
149
+ }
150
+ function chunkArray(columns) {
151
+ if (!Array.isArray(columns)) {
152
+ return [];
153
+ }
154
+ const n = columns.length;
155
+ if (n <= 7) {
156
+ return [columns];
157
+ }
158
+ else if (n >= 8 && n <= 14) {
159
+ const half = Math.floor(n / 2);
160
+ if (n % 2 === 0) {
161
+ return [columns.slice(0, half), columns.slice(half)];
162
+ }
163
+ else {
164
+ return [columns.slice(0, half + 1), columns.slice(half + 1)];
165
+ }
166
+ }
167
+ else {
168
+ const base = Math.floor(n / 3);
169
+ const remainder = n % 3;
170
+ const splits = [base, base, base];
171
+ for (let i = 0; i < remainder; i++) {
172
+ splits[i] += 1;
173
+ }
174
+ const result = [];
175
+ let idx = 0;
176
+ for (const size of splits) {
177
+ result.push(columns.slice(idx, idx + size));
178
+ idx += size;
179
+ }
180
+ return result;
181
+ }
182
+ }
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.generateInvoice = void 0;
4
+ const generate_invoice_1 = require("./generate-invoice");
5
+ Object.defineProperty(exports, "generateInvoice", { enumerable: true, get: function () { return generate_invoice_1.generateInvoice; } });
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });