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,78 @@
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.generateTransport = generateTransport;
7
+ const const_1 = require("../../../shared/consts/const");
8
+ const PDF_functions_1 = require("../../../shared/PDF-functions");
9
+ const functions_1 = require("../../../shared/generators/common/functions");
10
+ const Przewoznik_1 = require("./Przewoznik");
11
+ const common_enum_1 = __importDefault(require("../../../shared/enums/common.enum"));
12
+ function generateTransport(transport, index) {
13
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3;
14
+ const table = [];
15
+ const columns = {
16
+ transport: [],
17
+ dane: [],
18
+ wysylkaZ: [],
19
+ wysylkaDo: [],
20
+ wysylkaPrzez: [],
21
+ };
22
+ table.push((0, PDF_functions_1.createHeader)(index ? `Transport ${index}` : 'Transport'));
23
+ if ((_a = transport.RodzajTransportu) === null || _a === void 0 ? void 0 : _a._text) {
24
+ columns.transport.push((0, PDF_functions_1.createLabelText)('Rodzaj transportu: ', (0, functions_1.getRodzajTransportuString)(transport.RodzajTransportu)));
25
+ }
26
+ else if (((_b = transport.TransportInny) === null || _b === void 0 ? void 0 : _b._text) == '1' && ((_c = transport.OpisInnegoTransportu) === null || _c === void 0 ? void 0 : _c._text)) {
27
+ columns.transport.push((0, PDF_functions_1.createLabelText)('Rodzaj transportu: ', 'Transport inny'));
28
+ columns.transport.push((0, PDF_functions_1.createLabelText)('Opis innego rodzaju transportu: ', transport.OpisInnegoTransportu));
29
+ }
30
+ columns.dane.push((0, PDF_functions_1.createLabelText)('Numer zlecenia transportu: ', transport.NrZleceniaTransportu));
31
+ if ((0, PDF_functions_1.hasValue)(transport.OpisLadunku)) {
32
+ columns.dane.push((0, PDF_functions_1.createLabelText)('Opis ładunku: ', (0, functions_1.getOpisTransportuString)(transport.OpisLadunku)));
33
+ if (((_d = transport.LadunekInny) === null || _d === void 0 ? void 0 : _d._text) === '1' && ((_e = transport.OpisInnegoLadunku) === null || _e === void 0 ? void 0 : _e._text)) {
34
+ columns.dane.push((0, PDF_functions_1.createLabelText)('Opis ładunku: ', 'Ładunek inny'));
35
+ columns.dane.push((0, PDF_functions_1.createLabelText)('Opis innego ładunku: ', transport.OpisInnegoLadunku));
36
+ }
37
+ }
38
+ columns.dane.push((0, PDF_functions_1.createLabelText)('Jednostka opakowania: ', transport.JednostkaOpakowania));
39
+ columns.dane.push((0, PDF_functions_1.createLabelText)('Data i godzina rozpoczęcia transportu: ', (0, functions_1.getDateTimeWithoutSeconds)(transport.DataGodzRozpTransportu)));
40
+ columns.dane.push((0, PDF_functions_1.createLabelText)('Data i godzina zakończenia transportu: ', (0, functions_1.getDateTimeWithoutSeconds)(transport.DataGodzZakTransportu)));
41
+ if (columns.dane.length > 0) {
42
+ columns.dane.unshift((0, PDF_functions_1.createSubHeader)('Dane transportu', [0, 0, 0, 0]));
43
+ }
44
+ table.push((0, PDF_functions_1.generateTwoColumns)(columns.transport, columns.dane));
45
+ table.push((0, Przewoznik_1.generatePrzewoznik)(transport.Przewoznik));
46
+ if ((_f = transport.WysylkaZ) === null || _f === void 0 ? void 0 : _f.AdresL1) {
47
+ columns.wysylkaZ.push((0, PDF_functions_1.createSubHeader)('Adres miejsca wysyłki', [0, 0, 0, 0]));
48
+ columns.wysylkaZ.push((0, PDF_functions_1.formatText)((_h = (_g = transport.WysylkaZ) === null || _g === void 0 ? void 0 : _g.AdresL1) === null || _h === void 0 ? void 0 : _h._text, common_enum_1.default.Default));
49
+ columns.wysylkaZ.push((0, PDF_functions_1.formatText)((_k = (_j = transport.WysylkaZ) === null || _j === void 0 ? void 0 : _j.AdresL2) === null || _k === void 0 ? void 0 : _k._text, common_enum_1.default.Default));
50
+ columns.wysylkaZ.push((0, PDF_functions_1.formatText)(const_1.Kraj[(_o = (_m = (_l = transport.WysylkaZ) === null || _l === void 0 ? void 0 : _l.KodKraju) === null || _m === void 0 ? void 0 : _m._text) !== null && _o !== void 0 ? _o : ''], common_enum_1.default.Default));
51
+ columns.wysylkaZ.push((0, PDF_functions_1.createLabelText)('GLN: ', (_q = (_p = transport.WysylkaZ) === null || _p === void 0 ? void 0 : _p.GLN) === null || _q === void 0 ? void 0 : _q._text));
52
+ }
53
+ if ((_r = transport.WysylkaDo) === null || _r === void 0 ? void 0 : _r.AdresL1) {
54
+ columns.wysylkaDo.push((0, PDF_functions_1.createSubHeader)('Adres miejsca docelowego, do którego został zlecony transport', [0, 0, 0, 0]));
55
+ columns.wysylkaDo.push((0, PDF_functions_1.formatText)((_t = (_s = transport.WysylkaDo) === null || _s === void 0 ? void 0 : _s.AdresL1) === null || _t === void 0 ? void 0 : _t._text, common_enum_1.default.Default));
56
+ columns.wysylkaDo.push((0, PDF_functions_1.formatText)((_v = (_u = transport.WysylkaDo) === null || _u === void 0 ? void 0 : _u.AdresL2) === null || _v === void 0 ? void 0 : _v._text, common_enum_1.default.Default));
57
+ columns.wysylkaDo.push((0, PDF_functions_1.formatText)(const_1.Kraj[(_y = (_x = (_w = transport.WysylkaDo) === null || _w === void 0 ? void 0 : _w.KodKraju) === null || _x === void 0 ? void 0 : _x._text) !== null && _y !== void 0 ? _y : ''], common_enum_1.default.Default));
58
+ columns.wysylkaDo.push((0, PDF_functions_1.createLabelText)('GLN: ', (_0 = (_z = transport.WysylkaDo) === null || _z === void 0 ? void 0 : _z.GLN) === null || _0 === void 0 ? void 0 : _0._text));
59
+ }
60
+ const wysylkaPrzez = (0, PDF_functions_1.getTable)(transport.WysylkaPrzez);
61
+ wysylkaPrzez.forEach((adres, index) => {
62
+ var _a, _b, _c, _d, _e;
63
+ if (index) {
64
+ columns.wysylkaPrzez.push('\n');
65
+ }
66
+ columns.wysylkaPrzez.push((0, PDF_functions_1.createSubHeader)('Adres pośredni wysyłki', [0, 4, 0, 0]));
67
+ columns.wysylkaPrzez.push((0, PDF_functions_1.formatText)((_a = adres.AdresL1) === null || _a === void 0 ? void 0 : _a._text, common_enum_1.default.Default));
68
+ columns.wysylkaPrzez.push((0, PDF_functions_1.formatText)((_b = adres === null || adres === void 0 ? void 0 : adres.AdresL2) === null || _b === void 0 ? void 0 : _b._text, common_enum_1.default.Default));
69
+ columns.wysylkaPrzez.push((0, PDF_functions_1.formatText)(const_1.Kraj[(_d = (_c = adres === null || adres === void 0 ? void 0 : adres.KodKraju) === null || _c === void 0 ? void 0 : _c._text) !== null && _d !== void 0 ? _d : ''], common_enum_1.default.Default));
70
+ columns.wysylkaPrzez.push((0, PDF_functions_1.createLabelText)('GLN: ', (_e = adres === null || adres === void 0 ? void 0 : adres.GLN) === null || _e === void 0 ? void 0 : _e._text));
71
+ });
72
+ if (((_1 = transport.WysylkaZ) === null || _1 === void 0 ? void 0 : _1.AdresL1) || ((_2 = transport.WysylkaDo) === null || _2 === void 0 ? void 0 : _2.AdresL1) || ((_3 = transport.WysylkaPrzez) === null || _3 === void 0 ? void 0 : _3.length)) {
73
+ table.push((0, PDF_functions_1.createHeader)('Wysyłka'));
74
+ table.push((0, PDF_functions_1.generateTwoColumns)(columns.wysylkaZ, columns.wysylkaDo));
75
+ table.push((0, PDF_functions_1.generateTwoColumns)(columns.wysylkaPrzez, []));
76
+ }
77
+ return (0, PDF_functions_1.createSection)(table, true);
78
+ }
@@ -0,0 +1,68 @@
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.generateWarunkiTransakcji = generateWarunkiTransakcji;
7
+ const PDF_functions_1 = require("../../../shared/PDF-functions");
8
+ const Transport_1 = require("./Transport");
9
+ const common_enum_1 = __importDefault(require("../../../shared/enums/common.enum"));
10
+ function generateWarunkiTransakcji(warunkiTransakcji) {
11
+ var _a, _b, _c;
12
+ if (!warunkiTransakcji) {
13
+ return [];
14
+ }
15
+ const table = [];
16
+ const Kolumny = { umowy: [], zamowienia: [] };
17
+ const umowy = (0, PDF_functions_1.getTable)(warunkiTransakcji === null || warunkiTransakcji === void 0 ? void 0 : warunkiTransakcji.Umowy);
18
+ const zamowienia = (0, PDF_functions_1.getTable)(warunkiTransakcji === null || warunkiTransakcji === void 0 ? void 0 : warunkiTransakcji.Zamowienia);
19
+ const partiaTowaru = (0, PDF_functions_1.getTable)(warunkiTransakcji === null || warunkiTransakcji === void 0 ? void 0 : warunkiTransakcji.NrPartiiTowaru);
20
+ const definedHeaderUmowy = [
21
+ { name: 'DataUmowy', title: 'Data umowy', format: common_enum_1.default.Default },
22
+ { name: 'NrUmowy', title: 'Numer umowy', format: common_enum_1.default.Default },
23
+ ];
24
+ const definedHeaderZamowienia = [
25
+ { name: 'DataZamowienia', title: 'Data zamówienia', format: common_enum_1.default.Default },
26
+ { name: 'NrZamowienia', title: 'Numer zamówienia', format: common_enum_1.default.Default },
27
+ ];
28
+ const definedHeaderPartiaTowaru = [
29
+ { name: '', title: 'Numer partii towaru', format: common_enum_1.default.Default },
30
+ ];
31
+ table.push((0, PDF_functions_1.createHeader)('Warunki transakcji', [0, 8, 0, 4]));
32
+ if (umowy.length > 0) {
33
+ const tabUmowy = (0, PDF_functions_1.getContentTable)(definedHeaderUmowy, umowy, '*');
34
+ if (tabUmowy.content) {
35
+ Kolumny.umowy = [(0, PDF_functions_1.createSubHeader)('Umowa'), tabUmowy.content];
36
+ }
37
+ }
38
+ if (zamowienia.length > 0) {
39
+ const tabZamowienia = (0, PDF_functions_1.getContentTable)(definedHeaderZamowienia, zamowienia, '*');
40
+ if (tabZamowienia.content && tabZamowienia.fieldsWithValue.length > 0) {
41
+ Kolumny.zamowienia = [(0, PDF_functions_1.createSubHeader)('Zamówienie'), tabZamowienia.content];
42
+ }
43
+ }
44
+ if (Kolumny.zamowienia.length > 0 || Kolumny.umowy.length > 0) {
45
+ table.push((0, PDF_functions_1.generateTwoColumns)(Kolumny.umowy, Kolumny.zamowienia));
46
+ }
47
+ if (((_a = warunkiTransakcji.WalutaUmowna) === null || _a === void 0 ? void 0 : _a._text) || ((_b = warunkiTransakcji.KursUmowny) === null || _b === void 0 ? void 0 : _b._text)) {
48
+ table.push((0, PDF_functions_1.createHeader)('Waluta umowna i kurs umowny', [0, 8, 0, 4]));
49
+ table.push((0, PDF_functions_1.createLabelText)('Waluta umowna: ', warunkiTransakcji.WalutaUmowna));
50
+ table.push((0, PDF_functions_1.createLabelText)('Kurs umowny: ', warunkiTransakcji.KursUmowny));
51
+ }
52
+ if (partiaTowaru.length > 0) {
53
+ const tabPartiaTowaru = (0, PDF_functions_1.getContentTable)(definedHeaderPartiaTowaru, partiaTowaru, '*', [0, 4]);
54
+ if (tabPartiaTowaru.content) {
55
+ table.push((0, PDF_functions_1.generateTwoColumns)(tabPartiaTowaru.content, ''));
56
+ }
57
+ }
58
+ table.push((0, PDF_functions_1.createLabelText)('Warunki dostawy towarów: ', warunkiTransakcji.WarunkiDostawy, common_enum_1.default.MarginTop4));
59
+ if (((_c = warunkiTransakcji.PodmiotPosredniczacy) === null || _c === void 0 ? void 0 : _c._text) === '1') {
60
+ table.push((0, PDF_functions_1.formatText)('Dostawa dokonana przez podmiot, o którym mowa w art. 22 ust. 2d ustawy. Pole dotyczy sytuacji, w której podmiot uczestniczy w transakcji łańcuchowej innej niż procedura trójstronna uproszczona, o której mowa w art. 135 ust. 1 pkt 4 ustawy', [common_enum_1.default.Label, common_enum_1.default.MarginTop4]));
61
+ }
62
+ if (warunkiTransakcji.Transport) {
63
+ (0, PDF_functions_1.getTable)(warunkiTransakcji.Transport).forEach((transport, index) => {
64
+ table.push((0, Transport_1.generateTransport)(transport, (0, PDF_functions_1.getTable)(warunkiTransakcji.Transport).length !== 0 ? index + 1 : null));
65
+ });
66
+ }
67
+ return (0, PDF_functions_1.createSection)(table, true);
68
+ }
@@ -0,0 +1,140 @@
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.generateWiersze = generateWiersze;
37
+ const PDF_functions_1 = require("../../../shared/PDF-functions");
38
+ const const_1 = require("../../../shared/consts/const");
39
+ const common_enum_1 = __importStar(require("../../../shared/enums/common.enum"));
40
+ const Wiersze_1 = require("../common/Wiersze");
41
+ function generateWiersze(faVat) {
42
+ var _a, _b, _c, _d, _e, _f, _g;
43
+ const table = [];
44
+ const rodzajFaktury = (0, PDF_functions_1.getValue)(faVat.RodzajFaktury);
45
+ const isP_PMarzy = Boolean(Number((0, PDF_functions_1.getValue)((_b = (_a = faVat.Adnotacje) === null || _a === void 0 ? void 0 : _a.PMarzy) === null || _b === void 0 ? void 0 : _b.P_PMarzy)));
46
+ const faWiersze = (0, PDF_functions_1.getTable)(faVat.FaWiersz).map((wiersz) => {
47
+ const marza = (0, Wiersze_1.shouldAddMarza)(rodzajFaktury, isP_PMarzy, wiersz);
48
+ return marza ? { ...wiersz, ...marza } : wiersz;
49
+ });
50
+ const definedHeaderLp = [
51
+ { name: 'NrWierszaFa', title: 'Lp.', format: common_enum_1.default.Default, width: 'auto' },
52
+ ];
53
+ const definedHeader1 = [
54
+ { name: 'UU_ID', title: 'Unikalny numer wiersza', format: common_enum_1.default.Default, width: 'auto' },
55
+ { name: 'P_7', title: 'Nazwa towaru lub usługi', format: common_enum_1.default.Default, width: '*' },
56
+ { name: 'P_9A', title: 'Cena jedn. netto', format: common_enum_1.default.Currency, width: 'auto' },
57
+ { name: 'P_9B', title: 'Cena jedn. brutto', format: common_enum_1.default.Currency, width: 'auto' },
58
+ { name: 'P_8B', title: 'Ilość', format: common_enum_1.default.Right, width: 'auto' },
59
+ { name: 'P_8A', title: 'Miara', format: common_enum_1.default.Default, width: 'auto' },
60
+ { name: 'P_10', title: 'Rabat', format: common_enum_1.default.Currency, width: 'auto' },
61
+ { name: 'P_12', title: 'Stawka podatku', format: common_enum_1.default.Default, width: 'auto' },
62
+ { name: 'P_12_XII', title: 'Stawka podatku OSS', format: common_enum_1.default.Default, width: 'auto' },
63
+ {
64
+ name: 'P_12_Zal_15',
65
+ title: 'Znacznik dla towaru lub usługi z zał. nr 15 do ustawy',
66
+ format: common_enum_1.default.Default,
67
+ width: 'auto',
68
+ },
69
+ { name: 'P_11', title: 'Wartość sprzedaży netto', format: common_enum_1.default.Currency, width: 'auto' },
70
+ { name: 'P_11A', title: 'Wartość sprzedaży brutto', format: common_enum_1.default.Currency, width: 'auto' },
71
+ { name: 'P_11Vat', title: 'Wartość sprzedaży vat', format: common_enum_1.default.Currency, width: 'auto' },
72
+ { name: 'KursWaluty', title: 'Kurs waluty', format: common_enum_1.default.Currency6, width: 'auto' },
73
+ { name: 'StanPrzed', title: 'Stan przed', format: common_enum_1.default.Boolean, width: 'auto' },
74
+ ];
75
+ const definedHeader2 = [
76
+ { name: 'GTIN', title: 'GTIN', format: common_enum_1.default.Default, width: 'auto' },
77
+ { name: 'PKWiU', title: 'PKWiU', format: common_enum_1.default.Default, width: 'auto' },
78
+ { name: 'CN', title: 'CN', format: common_enum_1.default.Default, width: 'auto' },
79
+ { name: 'PKOB', title: 'PKOB', format: common_enum_1.default.Default, width: 'auto' },
80
+ { name: 'KwotaAkcyzy', title: 'KwotaAkcyzy', format: common_enum_1.default.Default, width: 'auto' },
81
+ { name: 'GTU', title: 'GTU', format: common_enum_1.default.Default, width: 'auto' },
82
+ { name: 'Procedura', title: 'Procedura', format: common_enum_1.default.Default, width: '*' },
83
+ { name: 'P_6A', title: 'Data dostawy / wykonania', format: common_enum_1.default.Default, width: 'auto' },
84
+ { name: 'Indeks', title: 'Indeks', format: common_enum_1.default.Default, width: 'auto' },
85
+ ];
86
+ let content = (0, PDF_functions_1.getContentTable)([...definedHeaderLp, ...definedHeader1, ...definedHeader2], faWiersze, 'auto');
87
+ const ceny = (0, PDF_functions_1.formatText)(`Faktura wystawiona w cenach ${content.fieldsWithValue.includes('P_11') ? 'netto' : 'brutto'} w walucie ${(_c = faVat.KodWaluty) === null || _c === void 0 ? void 0 : _c._text}`, [common_enum_1.default.Label, common_enum_1.default.MarginBottom8]);
88
+ const p_15 = (0, PDF_functions_1.getValue)(faVat.P_15);
89
+ let opis = '';
90
+ if (rodzajFaktury == const_1.TRodzajFaktury.ROZ && Number(p_15) !== 0) {
91
+ opis = {
92
+ stack: (0, PDF_functions_1.createLabelTextArray)([
93
+ { value: 'Kwota pozostała do zapłaty: ', formatTyp: common_enum_1.default.LabelGreater },
94
+ {
95
+ value: p_15,
96
+ formatTyp: common_enum_1.default.CurrencyGreater,
97
+ currency: (_e = (_d = (0, PDF_functions_1.getValue)(faVat.KodWaluty)) === null || _d === void 0 ? void 0 : _d.toString()) !== null && _e !== void 0 ? _e : '',
98
+ },
99
+ ]),
100
+ alignment: common_enum_1.Position.RIGHT,
101
+ margin: [0, 8, 0, 0],
102
+ };
103
+ }
104
+ else if ((rodzajFaktury == const_1.TRodzajFaktury.VAT ||
105
+ rodzajFaktury == const_1.TRodzajFaktury.KOR ||
106
+ rodzajFaktury == const_1.TRodzajFaktury.KOR_ROZ ||
107
+ rodzajFaktury == const_1.TRodzajFaktury.UPR) &&
108
+ Number(p_15) !== 0) {
109
+ opis = {
110
+ stack: (0, PDF_functions_1.createLabelTextArray)([
111
+ { value: 'Kwota należności ogółem: ', formatTyp: common_enum_1.default.LabelGreater },
112
+ {
113
+ value: p_15,
114
+ formatTyp: [common_enum_1.default.CurrencyGreater, common_enum_1.default.HeaderContent, common_enum_1.default.Value],
115
+ currency: (_g = (_f = (0, PDF_functions_1.getValue)(faVat.KodWaluty)) === null || _f === void 0 ? void 0 : _f.toString()) !== null && _g !== void 0 ? _g : '',
116
+ },
117
+ ]),
118
+ alignment: common_enum_1.Position.RIGHT,
119
+ margin: [0, 8, 0, 0],
120
+ };
121
+ }
122
+ if (content.fieldsWithValue.length <= 8 && content.content) {
123
+ table.push(content.content);
124
+ }
125
+ else {
126
+ content = (0, PDF_functions_1.getContentTable)([...definedHeaderLp, ...definedHeader1], faWiersze, '*');
127
+ if (content.content) {
128
+ table.push(content.content);
129
+ }
130
+ content = (0, PDF_functions_1.getContentTable)([...definedHeaderLp, ...definedHeader2], faWiersze, '*');
131
+ if (content.content && content.fieldsWithValue.length > 1) {
132
+ table.push('\n');
133
+ table.push(content.content);
134
+ }
135
+ }
136
+ if (table.length < 1) {
137
+ return [];
138
+ }
139
+ return (0, PDF_functions_1.createSection)([...(0, PDF_functions_1.createHeader)('Pozycje'), ceny, ...table, opis], true);
140
+ }
@@ -0,0 +1,148 @@
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.generateZamowienie = generateZamowienie;
37
+ const PDF_functions_1 = require("../../../shared/PDF-functions");
38
+ const const_1 = require("../../../shared/consts/const");
39
+ const common_enum_1 = __importStar(require("../../../shared/enums/common.enum"));
40
+ const invoice_enums_1 = require("../../enums/invoice.enums");
41
+ function generateZamowienie(orderData, zamowienieKorekta, p_15, rodzajFaktury, KodWaluty) {
42
+ var _a;
43
+ if (!orderData) {
44
+ return [];
45
+ }
46
+ const formatAbs = zamowienieKorekta === invoice_enums_1.ZamowienieKorekta.BeforeCorrection ? common_enum_1.default.CurrencyAbs : common_enum_1.default.Currency;
47
+ const orderTable = (0, PDF_functions_1.getTable)(orderData === null || orderData === void 0 ? void 0 : orderData.ZamowienieWiersz).map((el, index) => {
48
+ if (!el.NrWierszaZam._text) {
49
+ el.NrWierszaZam._text = (index + 1).toString();
50
+ }
51
+ return el;
52
+ });
53
+ const definedHeaderLp = [
54
+ { name: 'NrWierszaZam', title: 'Lp.', format: common_enum_1.default.Default, width: 'auto' },
55
+ ];
56
+ const definedHeader1 = [
57
+ { name: 'UU_ID', title: 'Unikalny numer wiersza', format: common_enum_1.default.Default, width: 'auto' },
58
+ { name: 'P_7Z', title: 'Nazwa towaru lub usługi', format: common_enum_1.default.Default, width: '*' },
59
+ {
60
+ name: 'P_9AZ',
61
+ title: 'Cena jedn. netto',
62
+ format: formatAbs,
63
+ width: 'auto',
64
+ },
65
+ { name: 'P_8BZ', title: 'Ilość', format: common_enum_1.default.Right, width: 'auto' },
66
+ { name: 'P_8AZ', title: 'Miara', format: common_enum_1.default.Default, width: 'auto' },
67
+ { name: 'P_12Z', title: 'Stawka podatku', format: common_enum_1.default.Default, width: 'auto' },
68
+ { name: 'P_12Z_XII', title: 'Stawka podatku OSS', format: common_enum_1.default.Default, width: 'auto' },
69
+ {
70
+ name: 'P_12Z_Zal_15',
71
+ title: 'Znacznik dla towaru lub usługi z zał. nr 15 do ustawy',
72
+ format: common_enum_1.default.Default,
73
+ width: 'auto',
74
+ },
75
+ { name: 'P_11NettoZ', title: 'Wartość sprzedaży netto', format: formatAbs, width: 'auto' },
76
+ { name: 'P_11VatZ', title: 'Kwota podatku', format: formatAbs, width: 'auto' },
77
+ ];
78
+ const definedHeader2 = [
79
+ { name: 'UU_IDZ', title: 'Numer umowy / Zamów.', format: common_enum_1.default.Default, width: 'auto' },
80
+ { name: 'GTINZ', title: 'GTIN', format: common_enum_1.default.Default, width: 'auto' },
81
+ { name: 'PKWiUZ', title: 'PKWiU', format: common_enum_1.default.Default, width: 'auto' },
82
+ { name: 'CNZ', title: 'CN', format: common_enum_1.default.Default, width: 'auto' },
83
+ { name: 'PKOBZ', title: 'PKOB', format: common_enum_1.default.Default, width: 'auto' },
84
+ { name: 'KwotaAkcyzyZ', title: 'Kwota podatku akcyzowego', format: common_enum_1.default.Currency, width: 'auto' },
85
+ { name: 'GTUZ', title: 'GTU', format: common_enum_1.default.Default, width: 'auto' },
86
+ { name: 'ProceduraZ', title: 'Oznaczenia dotyczące procedur', format: common_enum_1.default.Default, width: '*' },
87
+ { name: 'IndeksZ', title: 'Indeks', format: common_enum_1.default.Default, width: 'auto' },
88
+ { name: 'StanPrzedZ', title: 'Stan przed', format: common_enum_1.default.Boolean, width: 'auto' },
89
+ ];
90
+ let content = (0, PDF_functions_1.getContentTable)([...definedHeaderLp, ...definedHeader1, ...definedHeader2], orderTable, '*');
91
+ const table = [];
92
+ if (content.fieldsWithValue.length <= 8) {
93
+ if (content.content) {
94
+ table.push(content.content);
95
+ }
96
+ }
97
+ else {
98
+ content = (0, PDF_functions_1.getContentTable)([...definedHeaderLp, ...definedHeader1], orderTable, '*');
99
+ if (content.content) {
100
+ table.push(content.content);
101
+ }
102
+ content = (0, PDF_functions_1.getContentTable)([...definedHeaderLp, ...definedHeader2], orderTable, '*');
103
+ if (content.content && content.fieldsWithValue.length > 1) {
104
+ table.push(content.content);
105
+ }
106
+ }
107
+ const ceny = `Faktura wystawiona w cenach ${content.fieldsWithValue.includes('P_11') ? 'netto' : 'brutto'} w walucie ${KodWaluty}`;
108
+ let opis = '';
109
+ if (Number(p_15) > 0 && rodzajFaktury == const_1.TRodzajFaktury.ZAL) {
110
+ opis = {
111
+ stack: (0, PDF_functions_1.createLabelTextArray)([
112
+ { value: 'Otrzymana kwota zapłaty (zaliczki): ', formatTyp: common_enum_1.default.LabelGreater },
113
+ { value: p_15, formatTyp: common_enum_1.default.CurrencyGreater },
114
+ ]),
115
+ alignment: common_enum_1.Position.RIGHT,
116
+ margin: [0, 8, 0, 0],
117
+ };
118
+ }
119
+ else if (zamowienieKorekta !== invoice_enums_1.ZamowienieKorekta.BeforeCorrection &&
120
+ rodzajFaktury == const_1.TRodzajFaktury.KOR_ZAL &&
121
+ Number(p_15) >= 0) {
122
+ opis = {
123
+ stack: (0, PDF_functions_1.createLabelTextArray)([
124
+ { value: 'Kwota należności ogółem: ', formatTyp: common_enum_1.default.LabelGreater },
125
+ { value: p_15, formatTyp: common_enum_1.default.CurrencyGreater },
126
+ ]),
127
+ alignment: common_enum_1.Position.RIGHT,
128
+ margin: [0, 8, 0, 0],
129
+ };
130
+ }
131
+ return [
132
+ {
133
+ stack: [
134
+ (0, PDF_functions_1.createHeader)(zamowienieKorekta),
135
+ ceny,
136
+ {
137
+ text: [
138
+ 'Wartość zamówienia lub umowy z uwzględnieniem kwoty podatku: ',
139
+ (0, PDF_functions_1.formatText)((_a = orderData.WartoscZamowienia) === null || _a === void 0 ? void 0 : _a._text, common_enum_1.default.Currency),
140
+ ],
141
+ marginBottom: 4,
142
+ },
143
+ ...table,
144
+ opis,
145
+ ],
146
+ },
147
+ ];
148
+ }
@@ -0,0 +1,74 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.generateDaneFaKorygowanej = generateDaneFaKorygowanej;
4
+ const const_1 = require("../../../shared/consts/const");
5
+ const PDF_functions_1 = require("../../../shared/PDF-functions");
6
+ function generateDaneFaKorygowanej(invoice) {
7
+ var _a, _b;
8
+ const result = [];
9
+ let firstColumn = [];
10
+ let secondColumn = [];
11
+ let previousSection = false;
12
+ if (invoice) {
13
+ const daneFakturyKorygowanej = (0, PDF_functions_1.getTable)((_a = invoice.DaneFaKorygowanej) !== null && _a !== void 0 ? _a : []);
14
+ if (invoice.NrFaKorygowany) {
15
+ firstColumn.push((0, PDF_functions_1.createLabelText)('Poprawny numer faktury korygowanej: ', invoice.NrFaKorygowany));
16
+ }
17
+ if (invoice.PrzyczynaKorekty) {
18
+ firstColumn.push((0, PDF_functions_1.createLabelText)('Przyczyna korekty dla faktur korygujących: ', invoice.PrzyczynaKorekty));
19
+ }
20
+ if ((_b = invoice.TypKorekty) === null || _b === void 0 ? void 0 : _b._text) {
21
+ firstColumn.push((0, PDF_functions_1.createLabelText)('Typ skutku korekty: ', const_1.TypKorekty[invoice.TypKorekty._text]));
22
+ }
23
+ if (firstColumn.length) {
24
+ firstColumn.unshift((0, PDF_functions_1.createHeader)('Dane faktury korygowanej'));
25
+ }
26
+ if ((daneFakturyKorygowanej === null || daneFakturyKorygowanej === void 0 ? void 0 : daneFakturyKorygowanej.length) === 1) {
27
+ secondColumn.push((0, PDF_functions_1.createHeader)('Dane identyfikacyjne faktury korygowanej'));
28
+ generateCorrectiveData(daneFakturyKorygowanej[0], secondColumn);
29
+ if (firstColumn.length > 0 || secondColumn.length) {
30
+ if (firstColumn.length) {
31
+ result.push((0, PDF_functions_1.generateTwoColumns)(firstColumn, secondColumn));
32
+ }
33
+ else {
34
+ result.push((0, PDF_functions_1.generateTwoColumns)(secondColumn, []));
35
+ }
36
+ previousSection = true;
37
+ }
38
+ firstColumn = [];
39
+ secondColumn = [];
40
+ }
41
+ else {
42
+ if (firstColumn.length > 1) {
43
+ result.push((0, PDF_functions_1.generateTwoColumns)(firstColumn, []));
44
+ previousSection = true;
45
+ }
46
+ firstColumn = [];
47
+ daneFakturyKorygowanej === null || daneFakturyKorygowanej === void 0 ? void 0 : daneFakturyKorygowanej.forEach((item, index) => {
48
+ if (index % 2 === 0) {
49
+ firstColumn.push((0, PDF_functions_1.createHeader)(`Dane identyfikacyjne faktury korygowanej ${index + 1}`));
50
+ generateCorrectiveData(item, firstColumn);
51
+ }
52
+ else {
53
+ secondColumn.push((0, PDF_functions_1.createHeader)(`Dane identyfikacyjne faktury korygowanej ${index + 1}`));
54
+ generateCorrectiveData(item, secondColumn);
55
+ }
56
+ });
57
+ }
58
+ }
59
+ if (firstColumn.length && secondColumn.length) {
60
+ result.push((0, PDF_functions_1.createSection)([(0, PDF_functions_1.generateTwoColumns)(firstColumn, secondColumn)], previousSection));
61
+ }
62
+ return (0, PDF_functions_1.createSection)(result, true);
63
+ }
64
+ function generateCorrectiveData(data, column) {
65
+ if (data.DataWystFaKorygowanej) {
66
+ column.push((0, PDF_functions_1.createLabelText)('Data wystawienia faktury, której dotyczy faktura korygująca: ', data.DataWystFaKorygowanej));
67
+ }
68
+ if (data.NrFaKorygowanej) {
69
+ column.push((0, PDF_functions_1.createLabelText)('Numer faktury korygowanej: ', data.NrFaKorygowanej));
70
+ }
71
+ if (data.NrKSeFFaKorygowanej) {
72
+ column.push((0, PDF_functions_1.createLabelText)('Numer KSeF faktury korygowanej: ', data.NrKSeFFaKorygowanej));
73
+ }
74
+ }
@@ -0,0 +1,100 @@
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.generateNaglowek = generateNaglowek;
37
+ const PDF_functions_1 = require("../../../shared/PDF-functions");
38
+ const const_1 = require("../../../shared/consts/const");
39
+ const common_enum_1 = __importStar(require("../../../shared/enums/common.enum"));
40
+ function generateNaglowek(fa, additionalData, zalacznik) {
41
+ var _a, _b;
42
+ let invoiceName = '???';
43
+ switch ((_a = fa === null || fa === void 0 ? void 0 : fa.RodzajFaktury) === null || _a === void 0 ? void 0 : _a._text) {
44
+ case const_1.TRodzajFaktury.VAT:
45
+ invoiceName = 'Faktura podstawowa';
46
+ break;
47
+ case const_1.TRodzajFaktury.ZAL:
48
+ invoiceName = 'Faktura zaliczkowa';
49
+ break;
50
+ case const_1.TRodzajFaktury.ROZ:
51
+ invoiceName = 'Faktura rozliczeniowa';
52
+ break;
53
+ case const_1.TRodzajFaktury.KOR_ROZ:
54
+ invoiceName = 'Faktura korygująca rozliczeniową';
55
+ break;
56
+ case const_1.TRodzajFaktury.KOR_ZAL:
57
+ invoiceName = 'Faktura korygująca zaliczkową';
58
+ break;
59
+ case const_1.TRodzajFaktury.KOR:
60
+ if ((fa === null || fa === void 0 ? void 0 : fa.OkresFaKorygowanej) != null) {
61
+ invoiceName = 'Faktura korygująca zbiorcza (rabat)';
62
+ }
63
+ else {
64
+ invoiceName = 'Faktura korygująca';
65
+ }
66
+ break;
67
+ case const_1.TRodzajFaktury.UPR:
68
+ invoiceName = 'Faktura uproszczona';
69
+ break;
70
+ }
71
+ return [
72
+ { ...(0, PDF_functions_1.formatText)('Numer Faktury:', common_enum_1.default.ValueMedium), alignment: common_enum_1.Position.RIGHT },
73
+ { ...(0, PDF_functions_1.formatText)((_b = fa === null || fa === void 0 ? void 0 : fa.P_2) === null || _b === void 0 ? void 0 : _b._text, common_enum_1.default.HeaderPosition), alignment: common_enum_1.Position.RIGHT },
74
+ {
75
+ ...(0, PDF_functions_1.formatText)(invoiceName, [common_enum_1.default.ValueMedium, common_enum_1.default.Default]),
76
+ alignment: common_enum_1.Position.RIGHT,
77
+ },
78
+ ...((additionalData === null || additionalData === void 0 ? void 0 : additionalData.nrKSeF)
79
+ ? [
80
+ {
81
+ text: [
82
+ (0, PDF_functions_1.formatText)('Numer KSEF:', common_enum_1.default.LabelMedium),
83
+ (0, PDF_functions_1.formatText)(additionalData === null || additionalData === void 0 ? void 0 : additionalData.nrKSeF, common_enum_1.default.ValueMedium),
84
+ ],
85
+ alignment: common_enum_1.Position.RIGHT,
86
+ },
87
+ ]
88
+ : []),
89
+ ...((additionalData === null || additionalData === void 0 ? void 0 : additionalData.isMobile) && zalacznik
90
+ ? [
91
+ { stack: [(0, PDF_functions_1.generateLine)()], margin: [0, 8, 0, 8] },
92
+ {
93
+ text: [
94
+ (0, PDF_functions_1.formatText)('Uwaga, faktura zawiera załącznik, jednak ze względu na ograniczenia wizualizacji, nie został on uwzględniony w pliku PDF', common_enum_1.default.Bold),
95
+ ],
96
+ },
97
+ ]
98
+ : []),
99
+ ];
100
+ }