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,62 @@
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.generatePodmiot2Podmiot2K = generatePodmiot2Podmiot2K;
7
+ exports.generateCorrectedContent = generateCorrectedContent;
8
+ const PDF_functions_1 = require("../../../shared/PDF-functions");
9
+ const common_enum_1 = __importDefault(require("../../../shared/enums/common.enum"));
10
+ const Adres_1 = require("./Adres");
11
+ const PodmiotDaneIdentyfikacyjneTPodmiot1Dto_1 = require("./PodmiotDaneIdentyfikacyjneTPodmiot1Dto");
12
+ const PodmiotDaneKontaktowe_1 = require("./PodmiotDaneKontaktowe");
13
+ function generatePodmiot2Podmiot2K(podmiot2, podmiot2K) {
14
+ const result = (0, PDF_functions_1.createHeader)('Nabywca');
15
+ let firstColumn = [];
16
+ let secondColumn = [];
17
+ firstColumn.push((0, PDF_functions_1.createHeader)('Dane identyfikacyjne'), (0, PDF_functions_1.createLabelText)('Numer EORI: ', podmiot2.NrEORI));
18
+ if (podmiot2.DaneIdentyfikacyjne) {
19
+ firstColumn.push(...(0, PodmiotDaneIdentyfikacyjneTPodmiot1Dto_1.generateDaneIdentyfikacyjneTPodmiot1Dto)(podmiot2.DaneIdentyfikacyjne));
20
+ }
21
+ if (podmiot2.DaneKontaktowe) {
22
+ firstColumn.push((0, PodmiotDaneKontaktowe_1.generateDaneKontaktowe)((0, PDF_functions_1.getTable)(podmiot2.DaneKontaktowe)));
23
+ }
24
+ if (podmiot2.NrKlienta) {
25
+ firstColumn.push((0, PDF_functions_1.createLabelText)('Numer klienta: ', podmiot2.NrKlienta));
26
+ }
27
+ if (firstColumn.length) {
28
+ result.push({
29
+ columns: [firstColumn, []],
30
+ columnGap: 20,
31
+ });
32
+ }
33
+ firstColumn = generateCorrectedContent(podmiot2K);
34
+ secondColumn = generateCorrectedContent(podmiot2);
35
+ if (podmiot2.AdresKoresp) {
36
+ secondColumn.push((0, PDF_functions_1.formatText)('Adres do korespondencji', [common_enum_1.default.Label, common_enum_1.default.LabelMargin]), (0, Adres_1.generateAdres)(podmiot2.AdresKoresp));
37
+ }
38
+ if (firstColumn.length || secondColumn.length) {
39
+ result.push({
40
+ columns: [firstColumn, secondColumn],
41
+ columnGap: 20,
42
+ });
43
+ }
44
+ if (result.length) {
45
+ result.push((0, PDF_functions_1.verticalSpacing)(1));
46
+ }
47
+ return result;
48
+ }
49
+ function generateCorrectedContent(podmiot) {
50
+ const result = [];
51
+ result.push((0, PDF_functions_1.createHeader)('Treść korygowana'));
52
+ if ((0, PDF_functions_1.hasValue)(podmiot.IDNabywcy)) {
53
+ result.push((0, PDF_functions_1.createLabelText)('Identyfikator nabywcy: ', podmiot.IDNabywcy));
54
+ }
55
+ if (podmiot.DaneIdentyfikacyjne) {
56
+ result.push(...(0, PodmiotDaneIdentyfikacyjneTPodmiot1Dto_1.generateDaneIdentyfikacyjneTPodmiot1Dto)(podmiot.DaneIdentyfikacyjne));
57
+ }
58
+ if (podmiot.Adres) {
59
+ result.push((0, PDF_functions_1.formatText)('Adres', [common_enum_1.default.Label, common_enum_1.default.LabelMargin]), (0, Adres_1.generateAdres)(podmiot.Adres));
60
+ }
61
+ return result;
62
+ }
@@ -0,0 +1,37 @@
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.generatePodmiot3 = generatePodmiot3;
7
+ const PDF_functions_1 = require("../../../shared/PDF-functions");
8
+ const Adres_1 = require("./Adres");
9
+ const PodmiotDaneIdentyfikacyjneTPodmiot3Dto_1 = require("./PodmiotDaneIdentyfikacyjneTPodmiot3Dto");
10
+ const PodmiotDaneKontaktowe_1 = require("./PodmiotDaneKontaktowe");
11
+ const functions_1 = require("../../../shared/generators/common/functions");
12
+ const common_enum_1 = __importDefault(require("../../../shared/enums/common.enum"));
13
+ function generatePodmiot3(podmiot, index) {
14
+ const result = [];
15
+ result.push((0, PDF_functions_1.generateLine)());
16
+ const column1 = [
17
+ ...(0, PDF_functions_1.createHeader)(`Podmiot inny ${index + 1}`),
18
+ (0, PDF_functions_1.createLabelText)('Identyfikator nabywcy: ', podmiot.IDNabywcy),
19
+ (0, PDF_functions_1.createLabelText)('NrEORI: ', podmiot.NrEORI),
20
+ ...(0, PodmiotDaneIdentyfikacyjneTPodmiot3Dto_1.generateDaneIdentyfikacyjneTPodmiot3Dto)(podmiot.DaneIdentyfikacyjne),
21
+ (0, PDF_functions_1.createLabelText)('Rola: ', (0, functions_1.getRolaString)(podmiot.Rola, 2)),
22
+ (0, PDF_functions_1.createLabelText)('Rola inna: ', podmiot.OpisRoli),
23
+ (0, PDF_functions_1.createLabelText)('Udział: ', podmiot.Udzial, [common_enum_1.default.Percentage]),
24
+ ];
25
+ const column2 = [];
26
+ if (podmiot.Adres) {
27
+ column2.push((0, PDF_functions_1.formatText)('Adres', [common_enum_1.default.Label, common_enum_1.default.LabelMargin]), (0, Adres_1.generateAdres)(podmiot.Adres));
28
+ }
29
+ if (podmiot.AdresKoresp) {
30
+ column2.push((0, PDF_functions_1.formatText)('Adres do korespondencji', [common_enum_1.default.Label, common_enum_1.default.LabelMargin]), ...(0, Adres_1.generateAdres)(podmiot.AdresKoresp));
31
+ }
32
+ if (podmiot.DaneKontaktowe) {
33
+ column2.push((0, PDF_functions_1.formatText)('Dane kontaktowe', [common_enum_1.default.Label, common_enum_1.default.LabelMargin]), ...(0, PodmiotDaneKontaktowe_1.generateDaneKontaktowe)(podmiot.DaneKontaktowe), (0, PDF_functions_1.createLabelText)('Numer klienta: ', podmiot.NrKlienta));
34
+ }
35
+ result.push((0, PDF_functions_1.generateTwoColumns)(column1, column2));
36
+ return result;
37
+ }
@@ -0,0 +1,57 @@
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.generateDaneIdentyfikacyjneTPodmiot3Dto = generateDaneIdentyfikacyjneTPodmiot3Dto;
7
+ const PDF_functions_1 = require("../../../shared/PDF-functions");
8
+ const functions_1 = require("../../../shared/generators/common/functions");
9
+ const PodmiotAdres_1 = require("./PodmiotAdres");
10
+ const PodmiotDaneIdentyfikacyjneTPodmiot2Dto_1 = require("./PodmiotDaneIdentyfikacyjneTPodmiot2Dto");
11
+ const PodmiotDaneKontaktowe_1 = require("./PodmiotDaneKontaktowe");
12
+ const common_enum_1 = __importDefault(require("../../../shared/enums/common.enum"));
13
+ function generateDaneIdentyfikacyjneTPodmiot3Dto(podmiot2KDto, index) {
14
+ var _a;
15
+ if (!podmiot2KDto) {
16
+ return [];
17
+ }
18
+ const podmiot1 = podmiot2KDto.fakturaPodmiotNDto;
19
+ const podmiot1DaneKontaktowe = (0, PDF_functions_1.getTable)(podmiot1.DaneKontaktowe);
20
+ const podmiot1K = podmiot2KDto.podmiot2KDto;
21
+ const result = (0, PDF_functions_1.createHeader)(`Podmiot inny ${index + 1}`);
22
+ if ((0, PDF_functions_1.hasValue)(podmiot1.NrEORI) ||
23
+ (0, PDF_functions_1.hasValue)(podmiot1.Rola) ||
24
+ (0, PDF_functions_1.hasValue)(podmiot1.OpisRoli) ||
25
+ (0, PDF_functions_1.hasValue)(podmiot1 === null || podmiot1 === void 0 ? void 0 : podmiot1.Udzial)) {
26
+ result.push(...(0, PDF_functions_1.createHeader)('Dane identyfikacyjne'), (0, PDF_functions_1.createLabelText)('Numer EORI: ', podmiot1.NrEORI), (0, PDF_functions_1.createLabelText)('Rola: ', (0, functions_1.getRolaString)(podmiot1.Rola, 2)), (0, PDF_functions_1.createLabelText)('Rola inna: ', podmiot1.OpisRoli), (0, PDF_functions_1.createLabelText)('Udział: ', podmiot1.Udzial, common_enum_1.default.Currency6));
27
+ }
28
+ if (podmiot1DaneKontaktowe.length > 0 || (0, PDF_functions_1.hasValue)(podmiot1.NrKlienta)) {
29
+ result.push((0, PodmiotDaneKontaktowe_1.generateDaneKontaktowe)((_a = podmiot1.DaneKontaktowe) !== null && _a !== void 0 ? _a : []));
30
+ result.push((0, PDF_functions_1.createLabelText)('Numer klienta: ', podmiot1.NrKlienta));
31
+ }
32
+ const columns1 = [
33
+ ...(0, PDF_functions_1.createHeader)('Treść korygowana'),
34
+ (0, PDF_functions_1.createLabelText)('Identyfikator nabywcy: ', podmiot1K === null || podmiot1K === void 0 ? void 0 : podmiot1K.IDNabywcy),
35
+ ];
36
+ if (podmiot1K === null || podmiot1K === void 0 ? void 0 : podmiot1K.DaneIdentyfikacyjne) {
37
+ columns1.push((0, PodmiotDaneIdentyfikacyjneTPodmiot2Dto_1.generateDaneIdentyfikacyjneTPodmiot2Dto)(podmiot1K.DaneIdentyfikacyjne));
38
+ }
39
+ if (podmiot1K === null || podmiot1K === void 0 ? void 0 : podmiot1K.Adres) {
40
+ columns1.push((0, PodmiotAdres_1.generatePodmiotAdres)(podmiot1K.Adres));
41
+ }
42
+ const columns2 = [
43
+ ...(0, PDF_functions_1.createHeader)('Treść korygująca'),
44
+ (0, PDF_functions_1.createLabelText)('Identyfikator nabywcy: ', podmiot1 === null || podmiot1 === void 0 ? void 0 : podmiot1.IDNabywcy),
45
+ ];
46
+ if (podmiot1 === null || podmiot1 === void 0 ? void 0 : podmiot1.DaneIdentyfikacyjne) {
47
+ columns2.push((0, PodmiotDaneIdentyfikacyjneTPodmiot2Dto_1.generateDaneIdentyfikacyjneTPodmiot2Dto)(podmiot1.DaneIdentyfikacyjne));
48
+ }
49
+ if (podmiot1 === null || podmiot1 === void 0 ? void 0 : podmiot1.Adres) {
50
+ columns2.push((0, PodmiotAdres_1.generatePodmiotAdres)(podmiot1.Adres));
51
+ }
52
+ if (podmiot1.AdresKoresp != null) {
53
+ columns2.push((0, PodmiotAdres_1.generatePodmiotAdres)(podmiot1.AdresKoresp, 'Adres korespondencyjny'));
54
+ }
55
+ result.push((0, PDF_functions_1.generateTwoColumns)(columns1, columns2));
56
+ return result;
57
+ }
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.generatePodmiotAdres = generatePodmiotAdres;
4
+ const PDF_functions_1 = require("../../../shared/PDF-functions");
5
+ const Adres_1 = require("./Adres");
6
+ function generatePodmiotAdres(podmiotAdres, headerTitle = 'Adres', isSubheader = false, headerMargin) {
7
+ if (!podmiotAdres) {
8
+ return [];
9
+ }
10
+ return [
11
+ ...(isSubheader ? (0, PDF_functions_1.createSubHeader)(headerTitle, headerMargin) : (0, PDF_functions_1.createHeader)(headerTitle, headerMargin)),
12
+ ...(0, Adres_1.generateAdres)(podmiotAdres),
13
+ ];
14
+ }
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.generateDaneIdentyfikacyjneTPodmiot1Dto = generateDaneIdentyfikacyjneTPodmiot1Dto;
4
+ const PDF_functions_1 = require("../../../shared/PDF-functions");
5
+ function generateDaneIdentyfikacyjneTPodmiot1Dto(daneIdentyfikacyjne) {
6
+ return [
7
+ (0, PDF_functions_1.createLabelText)('NIP: ', daneIdentyfikacyjne.NIP),
8
+ (0, PDF_functions_1.createLabelText)('Nazwa: ', daneIdentyfikacyjne.Nazwa),
9
+ ];
10
+ }
@@ -0,0 +1,34 @@
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.generateDaneIdentyfikacyjneTPodmiot2Dto = generateDaneIdentyfikacyjneTPodmiot2Dto;
7
+ const PDF_functions_1 = require("../../../shared/PDF-functions");
8
+ const common_enum_1 = __importDefault(require("../../../shared/enums/common.enum"));
9
+ function generateDaneIdentyfikacyjneTPodmiot2Dto(daneIdentyfikacyjne) {
10
+ var _a, _b, _c;
11
+ const result = [];
12
+ result.push((0, PDF_functions_1.createLabelText)('NIP: ', daneIdentyfikacyjne.NIP));
13
+ if ((_a = daneIdentyfikacyjne.NrVatUE) === null || _a === void 0 ? void 0 : _a._text) {
14
+ result.push((0, PDF_functions_1.createLabelTextArray)([
15
+ { value: 'Numer VAT-UE: ', formatTyp: common_enum_1.default.Label },
16
+ { value: daneIdentyfikacyjne.KodUE, formatTyp: common_enum_1.default.Value },
17
+ { value: ' ' },
18
+ { value: daneIdentyfikacyjne.NrVatUE, formatTyp: common_enum_1.default.Value },
19
+ ]));
20
+ }
21
+ if ((_b = daneIdentyfikacyjne.KodKraju) === null || _b === void 0 ? void 0 : _b._text) {
22
+ result.push((0, PDF_functions_1.createLabelTextArray)([
23
+ { value: 'Identyfikator podatkowy inny: ', formatTyp: common_enum_1.default.Label },
24
+ { value: daneIdentyfikacyjne.KodKraju, formatTyp: common_enum_1.default.Value },
25
+ { value: ' ' },
26
+ { value: daneIdentyfikacyjne.NrID, formatTyp: common_enum_1.default.Value },
27
+ ]));
28
+ }
29
+ if (((_c = daneIdentyfikacyjne.BrakID) === null || _c === void 0 ? void 0 : _c._text) === '1') {
30
+ result.push((0, PDF_functions_1.formatText)('Brak identyfikatora', common_enum_1.default.Label));
31
+ }
32
+ result.push((0, PDF_functions_1.createLabelText)('Nazwa: ', daneIdentyfikacyjne.Nazwa));
33
+ return result;
34
+ }
@@ -0,0 +1,44 @@
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.generateDaneIdentyfikacyjneTPodmiot3Dto = generateDaneIdentyfikacyjneTPodmiot3Dto;
7
+ const PDF_functions_1 = require("../../../shared/PDF-functions");
8
+ const common_enum_1 = __importDefault(require("../../../shared/enums/common.enum"));
9
+ function generateDaneIdentyfikacyjneTPodmiot3Dto(daneIdentyfikacyjne) {
10
+ var _a;
11
+ if (!daneIdentyfikacyjne) {
12
+ return [];
13
+ }
14
+ const result = [];
15
+ if ((0, PDF_functions_1.hasValue)(daneIdentyfikacyjne.NIP)) {
16
+ result.push((0, PDF_functions_1.createLabelText)('NIP: ', daneIdentyfikacyjne.NIP, common_enum_1.default.Default));
17
+ }
18
+ else if ((0, PDF_functions_1.hasValue)(daneIdentyfikacyjne.IDWew)) {
19
+ result.push((0, PDF_functions_1.createLabelText)('Identyfikator wewnętrzny: ', daneIdentyfikacyjne.IDWew, common_enum_1.default.Default));
20
+ }
21
+ else if ((0, PDF_functions_1.hasValue)(daneIdentyfikacyjne.KodUE)) {
22
+ result.push((0, PDF_functions_1.createLabelTextArray)([
23
+ { value: 'Numer VAT-UE: ', formatTyp: common_enum_1.default.Label },
24
+ { value: daneIdentyfikacyjne.KodUE, formatTyp: common_enum_1.default.Default },
25
+ { value: '' },
26
+ { value: daneIdentyfikacyjne.NrVatUE, formatTyp: common_enum_1.default.Default },
27
+ ]));
28
+ }
29
+ else if ((0, PDF_functions_1.hasValue)(daneIdentyfikacyjne.NrID)) {
30
+ result.push((0, PDF_functions_1.createLabelTextArray)([
31
+ { value: 'Identyfikator podatkowy inny: ', formatTyp: common_enum_1.default.Label },
32
+ { value: daneIdentyfikacyjne.KodKraju, formatTyp: common_enum_1.default.Default },
33
+ { value: '' },
34
+ { value: daneIdentyfikacyjne.NrID, formatTyp: common_enum_1.default.Default },
35
+ ]));
36
+ }
37
+ else if (((_a = daneIdentyfikacyjne.BrakID) === null || _a === void 0 ? void 0 : _a._text) === '1') {
38
+ result.push((0, PDF_functions_1.createLabelText)('Brak identyfikatora', ' ', common_enum_1.default.Default));
39
+ }
40
+ if ((0, PDF_functions_1.hasValue)(daneIdentyfikacyjne.Nazwa)) {
41
+ result.push((0, PDF_functions_1.createLabelText)('Nazwa: ', daneIdentyfikacyjne.Nazwa, common_enum_1.default.Default));
42
+ }
43
+ return result;
44
+ }
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.generateDaneKontaktowe = generateDaneKontaktowe;
4
+ const PDF_functions_1 = require("../../../shared/PDF-functions");
5
+ function generateDaneKontaktowe(daneKontaktowe) {
6
+ var _a;
7
+ return (_a = (0, PDF_functions_1.getTable)(daneKontaktowe)) === null || _a === void 0 ? void 0 : _a.map((daneKontaktowe) => {
8
+ return [
9
+ (0, PDF_functions_1.createLabelText)('Email: ', daneKontaktowe.Email),
10
+ (0, PDF_functions_1.createLabelText)('Tel.: ', daneKontaktowe.Telefon),
11
+ ];
12
+ });
13
+ }
@@ -0,0 +1,29 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.generatePodmiotUpowazniony = generatePodmiotUpowazniony;
4
+ const PDF_functions_1 = require("../../../shared/PDF-functions");
5
+ const PodmiotAdres_1 = require("./PodmiotAdres");
6
+ const PodmiotDaneIdentyfikacyjneTPodmiot1Dto_1 = require("./PodmiotDaneIdentyfikacyjneTPodmiot1Dto");
7
+ const PodmiotUpowaznionyDaneKontaktowe_1 = require("./PodmiotUpowaznionyDaneKontaktowe");
8
+ const functions_1 = require("../../../shared/generators/common/functions");
9
+ function generatePodmiotUpowazniony(podmiotUpowazniony) {
10
+ if (!podmiotUpowazniony) {
11
+ return [];
12
+ }
13
+ const result = (0, PDF_functions_1.createHeader)('Podmiot upoważniony');
14
+ if ((0, PDF_functions_1.hasValue)(podmiotUpowazniony.RolaPU)) {
15
+ result.push((0, PDF_functions_1.createLabelText)('Rola: ', (0, functions_1.getRolaUpowaznionegoString)(podmiotUpowazniony.RolaPU, 2)));
16
+ }
17
+ if ((0, PDF_functions_1.hasValue)(podmiotUpowazniony.NrEORI)) {
18
+ result.push((0, PDF_functions_1.createLabelText)('Numer EORI: ', podmiotUpowazniony.NrEORI));
19
+ }
20
+ if (podmiotUpowazniony.DaneIdentyfikacyjne) {
21
+ result.push((0, PodmiotDaneIdentyfikacyjneTPodmiot1Dto_1.generateDaneIdentyfikacyjneTPodmiot1Dto)(podmiotUpowazniony.DaneIdentyfikacyjne));
22
+ }
23
+ result.push([
24
+ ...(0, PodmiotAdres_1.generatePodmiotAdres)(podmiotUpowazniony.Adres),
25
+ ...(0, PodmiotAdres_1.generatePodmiotAdres)(podmiotUpowazniony.AdresKoresp, 'Adres korespondencyjny'),
26
+ ...(0, PodmiotUpowaznionyDaneKontaktowe_1.generatePodmiotUpowaznionyDaneKontaktowe)(podmiotUpowazniony.DaneKontaktowe),
27
+ ]);
28
+ return result;
29
+ }
@@ -0,0 +1,28 @@
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.generatePodmiotUpowaznionyDaneKontaktowe = generatePodmiotUpowaznionyDaneKontaktowe;
7
+ const PDF_functions_1 = require("../../../shared/PDF-functions");
8
+ const common_enum_1 = __importDefault(require("../../../shared/enums/common.enum"));
9
+ function generatePodmiotUpowaznionyDaneKontaktowe(daneKontaktoweSource) {
10
+ if (!daneKontaktoweSource) {
11
+ return [];
12
+ }
13
+ const result = [(0, PDF_functions_1.formatText)('Dane kontaktowe', common_enum_1.default.Description)];
14
+ const daneKontaktowe = (0, PDF_functions_1.getTable)(daneKontaktoweSource);
15
+ if (daneKontaktowe.length === 0) {
16
+ return [];
17
+ }
18
+ daneKontaktowe.forEach((kontakt) => {
19
+ if ((0, PDF_functions_1.hasValue)(kontakt.EmailPU)) {
20
+ result.push((0, PDF_functions_1.createLabelText)('E-mail: ', kontakt.EmailPU));
21
+ }
22
+ if ((0, PDF_functions_1.hasValue)(kontakt.TelefonPU)) {
23
+ result.push((0, PDF_functions_1.createLabelText)('Tel.: ', kontakt.TelefonPU));
24
+ }
25
+ result.push((0, PDF_functions_1.verticalSpacing)(1));
26
+ });
27
+ return result;
28
+ }
@@ -0,0 +1,92 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.generatePodmioty = generatePodmioty;
4
+ const PDF_functions_1 = require("../../../shared/PDF-functions");
5
+ const Podmiot1_1 = require("./Podmiot1");
6
+ const Podmiot1Podmiot1K_1 = require("./Podmiot1Podmiot1K");
7
+ const Podmiot2_1 = require("./Podmiot2");
8
+ const Podmiot2Podmiot2k_1 = require("./Podmiot2Podmiot2k");
9
+ const Podmiot3_1 = require("./Podmiot3");
10
+ const Podmiot3Podmiot2k_1 = require("./Podmiot3Podmiot2k");
11
+ const PodmiotUpowazniony_1 = require("./PodmiotUpowazniony");
12
+ function generatePodmioty(invoice) {
13
+ var _a, _b, _c, _d, _e;
14
+ const result = [];
15
+ const podmiot2K = (0, PDF_functions_1.getTable)((_a = invoice.Fa) === null || _a === void 0 ? void 0 : _a.Podmiot2K);
16
+ const podmiot3 = (0, PDF_functions_1.getTable)(invoice.Podmiot3);
17
+ if (((_b = invoice.Fa) === null || _b === void 0 ? void 0 : _b.Podmiot1K) || podmiot2K.length > 0) {
18
+ if ((_c = invoice.Fa) === null || _c === void 0 ? void 0 : _c.Podmiot1K) {
19
+ result.push((0, Podmiot1Podmiot1K_1.generatePodmiot1Podmiot1K)((_d = invoice.Podmiot1) !== null && _d !== void 0 ? _d : {}, (_e = invoice.Fa) === null || _e === void 0 ? void 0 : _e.Podmiot1K));
20
+ }
21
+ else if (invoice.Podmiot1 != null) {
22
+ result.push((0, Podmiot1_1.generatePodmiot1)(invoice.Podmiot1));
23
+ }
24
+ if (podmiot2K.length > 0) {
25
+ podmiot2K.forEach((podmiot2K) => {
26
+ var _a;
27
+ result.push((0, Podmiot2Podmiot2k_1.generatePodmiot2Podmiot2K)((_a = invoice.Podmiot2) !== null && _a !== void 0 ? _a : {}, podmiot2K));
28
+ });
29
+ }
30
+ else if (invoice.Podmiot2) {
31
+ result.push((0, PDF_functions_1.createSection)((0, Podmiot2_1.generatePodmiot2)(invoice.Podmiot2), true));
32
+ }
33
+ }
34
+ else {
35
+ result.push([
36
+ {
37
+ columns: [(0, Podmiot1_1.generatePodmiot1)(invoice.Podmiot1), (0, Podmiot2_1.generatePodmiot2)(invoice.Podmiot2)],
38
+ margin: [0, 0, 0, 8],
39
+ },
40
+ ]);
41
+ }
42
+ if (podmiot3.length > 0) {
43
+ const podmiot3Podmiot2KDto = getPodmiot3Podmiot2KDto(podmiot2K, podmiot3);
44
+ if (podmiot3Podmiot2KDto.length > 0) {
45
+ podmiot3Podmiot2KDto.forEach((pdm2KDto, i) => {
46
+ if (pdm2KDto.podmiot2KDto) {
47
+ result.push((0, Podmiot3Podmiot2k_1.generateDaneIdentyfikacyjneTPodmiot3Dto)(pdm2KDto, i));
48
+ }
49
+ else {
50
+ result.push((0, Podmiot3_1.generatePodmiot3)(pdm2KDto.fakturaPodmiotNDto, i));
51
+ }
52
+ if (i < podmiot3Podmiot2KDto.length - 1) {
53
+ result.push({ margin: [0, 8, 0, 0], text: '' });
54
+ }
55
+ });
56
+ }
57
+ else {
58
+ podmiot3.forEach((podmiot, index) => {
59
+ result.push((0, Podmiot3_1.generatePodmiot3)(podmiot, index));
60
+ if (index < podmiot3.length - 1) {
61
+ result.push({ margin: [0, 8, 0, 0], text: '' });
62
+ }
63
+ });
64
+ }
65
+ }
66
+ result.push((0, PodmiotUpowazniony_1.generatePodmiotUpowazniony)(invoice.PodmiotUpowazniony));
67
+ return (0, PDF_functions_1.createSection)(result, true);
68
+ }
69
+ function getPodmiot3Podmiot2KDto(podmioty2K, podmioty3) {
70
+ const result = [];
71
+ if (podmioty2K.length > 1 &&
72
+ podmioty3.filter((p) => (0, PDF_functions_1.getValue)(p.Rola) === '4').length > 0) {
73
+ let idx = 1;
74
+ podmioty3.forEach((podmiot3) => {
75
+ if ((0, PDF_functions_1.getValue)(podmiot3.Rola) === '4') {
76
+ if (podmioty2K.length > idx) {
77
+ result.push({
78
+ fakturaPodmiotNDto: podmiot3,
79
+ podmiot2KDto: podmioty2K[idx],
80
+ });
81
+ }
82
+ idx++;
83
+ }
84
+ else {
85
+ result.push({
86
+ fakturaPodmiotNDto: podmiot3,
87
+ });
88
+ }
89
+ });
90
+ }
91
+ return result;
92
+ }