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,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, [0, 0, 0, 0]);
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
+ }
@@ -0,0 +1,264 @@
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.generatePodsumowanieStawekPodatkuVat = generatePodsumowanieStawekPodatkuVat;
7
+ exports.getSummaryTaxRate = getSummaryTaxRate;
8
+ const PDF_functions_1 = require("../../../shared/PDF-functions");
9
+ const common_enum_1 = __importDefault(require("../../../shared/enums/common.enum"));
10
+ function generatePodsumowanieStawekPodatkuVat(faktura) {
11
+ 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, _4, _5, _6, _7;
12
+ const AnyP13P14_5Diff0 = (0, PDF_functions_1.hasValue)((_a = faktura.Fa) === null || _a === void 0 ? void 0 : _a.P_13_1) ||
13
+ (0, PDF_functions_1.hasValue)((_b = faktura.Fa) === null || _b === void 0 ? void 0 : _b.P_13_2) ||
14
+ (0, PDF_functions_1.hasValue)((_c = faktura.Fa) === null || _c === void 0 ? void 0 : _c.P_13_3) ||
15
+ (0, PDF_functions_1.hasValue)((_d = faktura.Fa) === null || _d === void 0 ? void 0 : _d.P_13_4) ||
16
+ ((0, PDF_functions_1.hasValue)((_e = faktura.Fa) === null || _e === void 0 ? void 0 : _e.P_13_5) && (!(0, PDF_functions_1.hasValue)((_f = faktura.Fa) === null || _f === void 0 ? void 0 : _f.P_14_5) || (0, PDF_functions_1.getValue)((_g = faktura.Fa) === null || _g === void 0 ? void 0 : _g.P_14_5) == 0)) ||
17
+ (0, PDF_functions_1.hasValue)((_h = faktura.Fa) === null || _h === void 0 ? void 0 : _h.P_13_6_1) ||
18
+ (0, PDF_functions_1.hasValue)((_j = faktura.Fa) === null || _j === void 0 ? void 0 : _j.P_13_6_2) ||
19
+ (0, PDF_functions_1.hasValue)((_k = faktura.Fa) === null || _k === void 0 ? void 0 : _k.P_13_6_3) ||
20
+ (0, PDF_functions_1.hasValue)((_l = faktura.Fa) === null || _l === void 0 ? void 0 : _l.P_13_7) ||
21
+ (0, PDF_functions_1.hasValue)((_m = faktura.Fa) === null || _m === void 0 ? void 0 : _m.P_13_8) ||
22
+ (0, PDF_functions_1.hasValue)((_o = faktura.Fa) === null || _o === void 0 ? void 0 : _o.P_13_9) ||
23
+ (0, PDF_functions_1.hasValue)((_p = faktura.Fa) === null || _p === void 0 ? void 0 : _p.P_13_10) ||
24
+ (0, PDF_functions_1.hasValue)((_q = faktura.Fa) === null || _q === void 0 ? void 0 : _q.P_13_11);
25
+ const AnyP13 = (0, PDF_functions_1.hasValue)((_r = faktura.Fa) === null || _r === void 0 ? void 0 : _r.P_13_1) ||
26
+ (0, PDF_functions_1.hasValue)((_s = faktura.Fa) === null || _s === void 0 ? void 0 : _s.P_13_2) ||
27
+ (0, PDF_functions_1.hasValue)((_t = faktura.Fa) === null || _t === void 0 ? void 0 : _t.P_13_3) ||
28
+ (0, PDF_functions_1.hasValue)((_u = faktura.Fa) === null || _u === void 0 ? void 0 : _u.P_13_4) ||
29
+ (0, PDF_functions_1.hasValue)((_v = faktura.Fa) === null || _v === void 0 ? void 0 : _v.P_13_5) ||
30
+ (0, PDF_functions_1.hasValue)((_w = faktura.Fa) === null || _w === void 0 ? void 0 : _w.P_13_6_1) ||
31
+ (0, PDF_functions_1.hasValue)((_x = faktura.Fa) === null || _x === void 0 ? void 0 : _x.P_13_6_2) ||
32
+ (0, PDF_functions_1.hasValue)((_y = faktura.Fa) === null || _y === void 0 ? void 0 : _y.P_13_6_3) ||
33
+ (0, PDF_functions_1.hasValue)((_z = faktura.Fa) === null || _z === void 0 ? void 0 : _z.P_13_7) ||
34
+ (0, PDF_functions_1.hasValue)((_0 = faktura.Fa) === null || _0 === void 0 ? void 0 : _0.P_13_8) ||
35
+ (0, PDF_functions_1.hasValue)((_1 = faktura.Fa) === null || _1 === void 0 ? void 0 : _1.P_13_9) ||
36
+ (0, PDF_functions_1.hasValue)((_2 = faktura.Fa) === null || _2 === void 0 ? void 0 : _2.P_13_10) ||
37
+ (0, PDF_functions_1.hasValue)((_3 = faktura.Fa) === null || _3 === void 0 ? void 0 : _3.P_13_11);
38
+ const AnyP_14xW = (0, PDF_functions_1.hasValue)((_4 = faktura.Fa) === null || _4 === void 0 ? void 0 : _4.P_14_1W) ||
39
+ (0, PDF_functions_1.hasValue)((_5 = faktura.Fa) === null || _5 === void 0 ? void 0 : _5.P_14_2W) ||
40
+ (0, PDF_functions_1.hasValue)((_6 = faktura.Fa) === null || _6 === void 0 ? void 0 : _6.P_14_3W) ||
41
+ (0, PDF_functions_1.hasValue)((_7 = faktura.Fa) === null || _7 === void 0 ? void 0 : _7.P_14_4W);
42
+ let tableBody = [];
43
+ const table = {
44
+ table: {
45
+ headerRows: 1,
46
+ widths: [],
47
+ body: [],
48
+ },
49
+ layout: {
50
+ hLineWidth: () => 1,
51
+ hLineColor: () => '#BABABA',
52
+ vLineWidth: () => 1,
53
+ vLineColor: () => '#BABABA',
54
+ },
55
+ };
56
+ const definedHeader = [
57
+ ...[{ text: 'Lp.', style: common_enum_1.default.GrayBoldTitle }],
58
+ ...(AnyP13P14_5Diff0 ? [{ text: 'Stawka podatku', style: common_enum_1.default.GrayBoldTitle }] : []),
59
+ ...(AnyP13 ? [{ text: 'Kwota netto', style: common_enum_1.default.GrayBoldTitle }] : []),
60
+ ...(AnyP13P14_5Diff0 ? [{ text: 'Kwota podatku', style: common_enum_1.default.GrayBoldTitle }] : []),
61
+ ...(AnyP13 ? [{ text: 'Kwota brutto', style: common_enum_1.default.GrayBoldTitle }] : []),
62
+ ...(AnyP_14xW ? [{ text: 'Kwota podatku PLN', style: common_enum_1.default.GrayBoldTitle }] : []),
63
+ ];
64
+ const widths = [
65
+ ...['auto'],
66
+ ...(AnyP13P14_5Diff0 ? ['*'] : []),
67
+ ...(AnyP13 ? ['*'] : []),
68
+ ...(AnyP13P14_5Diff0 ? ['*'] : []),
69
+ ...(AnyP13 ? ['*'] : []),
70
+ ...(AnyP_14xW ? ['*'] : []),
71
+ ];
72
+ if (faktura === null || faktura === void 0 ? void 0 : faktura.Fa) {
73
+ const summary = getSummaryTaxRate(faktura.Fa);
74
+ tableBody = summary.map((item) => {
75
+ const data = [];
76
+ data.push(item.no);
77
+ if (AnyP13P14_5Diff0) {
78
+ data.push(item.taxRateString);
79
+ }
80
+ if (AnyP13) {
81
+ data.push((0, PDF_functions_1.formatText)(item.net, common_enum_1.default.Currency));
82
+ }
83
+ if (AnyP13P14_5Diff0) {
84
+ data.push((0, PDF_functions_1.formatText)(item.tax, common_enum_1.default.Currency));
85
+ }
86
+ if (AnyP13) {
87
+ data.push((0, PDF_functions_1.formatText)(item.gross, common_enum_1.default.Currency));
88
+ }
89
+ if (AnyP_14xW) {
90
+ data.push((0, PDF_functions_1.formatText)(item.taxPLN, common_enum_1.default.Currency));
91
+ }
92
+ return data;
93
+ });
94
+ }
95
+ table.table.body = [[...definedHeader], ...tableBody];
96
+ table.table.widths = [...widths];
97
+ return tableBody.length
98
+ ? (0, PDF_functions_1.createSection)([...(0, PDF_functions_1.createHeader)('Podsumowanie stawek podatku', [0, 0, 0, 8]), table], false)
99
+ : [];
100
+ }
101
+ function getSummaryTaxRate(fa) {
102
+ const summary = [];
103
+ const AnyP13_1P14_1P14_1WDiff0 = hasValueAndDiff0(fa === null || fa === void 0 ? void 0 : fa.P_13_1) || hasValueAndDiff0(fa === null || fa === void 0 ? void 0 : fa.P_14_1) || hasValueAndDiff0(fa === null || fa === void 0 ? void 0 : fa.P_14_1W);
104
+ const AnyP13_2P14_2P14_2WDiff0 = hasValueAndDiff0(fa === null || fa === void 0 ? void 0 : fa.P_13_2) || hasValueAndDiff0(fa === null || fa === void 0 ? void 0 : fa.P_14_2) || hasValueAndDiff0(fa === null || fa === void 0 ? void 0 : fa.P_14_2W);
105
+ const AnyP13_3P14_3P14_3WDiff0 = hasValueAndDiff0(fa === null || fa === void 0 ? void 0 : fa.P_13_3) || hasValueAndDiff0(fa === null || fa === void 0 ? void 0 : fa.P_14_3) || hasValueAndDiff0(fa === null || fa === void 0 ? void 0 : fa.P_14_3W);
106
+ const AnyP13_4P14_4P14_4WDiff0 = hasValueAndDiff0(fa === null || fa === void 0 ? void 0 : fa.P_13_4) || hasValueAndDiff0(fa === null || fa === void 0 ? void 0 : fa.P_14_4) || hasValueAndDiff0(fa === null || fa === void 0 ? void 0 : fa.P_14_4W);
107
+ const AnyP13_5P14_5Diff0 = hasValueAndDiff0(fa === null || fa === void 0 ? void 0 : fa.P_13_5) || hasValueAndDiff0(fa === null || fa === void 0 ? void 0 : fa.P_14_5);
108
+ const AnyP13_6_1Diff0 = hasValueAndDiff0(fa === null || fa === void 0 ? void 0 : fa.P_13_6_1);
109
+ const AnyP13_6_2Diff0 = hasValueAndDiff0(fa === null || fa === void 0 ? void 0 : fa.P_13_6_2);
110
+ const AnyP13_6_3Diff0 = hasValueAndDiff0(fa === null || fa === void 0 ? void 0 : fa.P_13_6_3);
111
+ const AnyP13_7Diff0 = hasValueAndDiff0(fa === null || fa === void 0 ? void 0 : fa.P_13_7);
112
+ const AnyP13_8Diff0 = hasValueAndDiff0(fa === null || fa === void 0 ? void 0 : fa.P_13_8);
113
+ const AnyP13_9Diff0 = hasValueAndDiff0(fa === null || fa === void 0 ? void 0 : fa.P_13_9);
114
+ const AnyP13_10Diff0 = hasValueAndDiff0(fa === null || fa === void 0 ? void 0 : fa.P_13_10);
115
+ const AnyP13_11Diff0 = hasValueAndDiff0(fa === null || fa === void 0 ? void 0 : fa.P_13_11);
116
+ let no = 1;
117
+ if (AnyP13_1P14_1P14_1WDiff0) {
118
+ summary.push({
119
+ no,
120
+ net: (0, PDF_functions_1.getNumberRounded)(fa.P_13_1).toFixed(2),
121
+ gross: ((0, PDF_functions_1.getNumberRounded)(fa.P_13_1) + (0, PDF_functions_1.getNumberRounded)(fa.P_14_1)).toFixed(2),
122
+ tax: (0, PDF_functions_1.getNumberRounded)(fa.P_14_1).toFixed(2),
123
+ taxPLN: (0, PDF_functions_1.getNumberRounded)(fa.P_14_1W).toFixed(2),
124
+ taxRateString: '23% lub 22%',
125
+ });
126
+ no++;
127
+ }
128
+ if (AnyP13_2P14_2P14_2WDiff0) {
129
+ summary.push({
130
+ no,
131
+ net: (0, PDF_functions_1.getNumberRounded)(fa.P_13_2).toFixed(2),
132
+ gross: ((0, PDF_functions_1.getNumberRounded)(fa.P_13_2) + (0, PDF_functions_1.getNumberRounded)(fa.P_14_2)).toFixed(2),
133
+ tax: (0, PDF_functions_1.getNumberRounded)(fa.P_14_2).toFixed(2),
134
+ taxPLN: (0, PDF_functions_1.getNumberRounded)(fa.P_14_2W).toFixed(2),
135
+ taxRateString: '8% lub 7%',
136
+ });
137
+ no++;
138
+ }
139
+ if (AnyP13_3P14_3P14_3WDiff0) {
140
+ summary.push({
141
+ no,
142
+ net: (0, PDF_functions_1.getNumberRounded)(fa.P_13_3).toFixed(2),
143
+ gross: ((0, PDF_functions_1.getNumberRounded)(fa.P_13_3) + (0, PDF_functions_1.getNumberRounded)(fa.P_14_3)).toFixed(2),
144
+ tax: (0, PDF_functions_1.getNumberRounded)(fa.P_14_3).toFixed(2),
145
+ taxPLN: (0, PDF_functions_1.getNumberRounded)(fa.P_14_3W).toFixed(2),
146
+ taxRateString: '5%',
147
+ });
148
+ no++;
149
+ }
150
+ if (AnyP13_4P14_4P14_4WDiff0) {
151
+ summary.push({
152
+ no,
153
+ net: (0, PDF_functions_1.getNumberRounded)(fa.P_13_4).toFixed(2),
154
+ gross: ((0, PDF_functions_1.getNumberRounded)(fa.P_13_4) + (0, PDF_functions_1.getNumberRounded)(fa.P_14_4)).toFixed(2),
155
+ tax: (0, PDF_functions_1.getNumberRounded)(fa.P_14_4).toFixed(2),
156
+ taxPLN: (0, PDF_functions_1.getNumberRounded)(fa.P_14_4W).toFixed(2),
157
+ taxRateString: '4% lub 3% lub oo',
158
+ });
159
+ no++;
160
+ }
161
+ if (AnyP13_5P14_5Diff0) {
162
+ summary.push({
163
+ no,
164
+ net: (0, PDF_functions_1.getNumberRounded)(fa.P_13_5).toFixed(2),
165
+ gross: (0, PDF_functions_1.getNumberRounded)(fa.P_13_5).toFixed(2),
166
+ tax: (0, PDF_functions_1.getNumberRounded)(fa.P_14_5).toFixed(2),
167
+ taxPLN: '',
168
+ taxRateString: (0, PDF_functions_1.getValue)(fa.P_14_5) != 0 ? 'niepodlegające opodatkowaniu' : '',
169
+ });
170
+ no++;
171
+ }
172
+ if (AnyP13_6_1Diff0) {
173
+ summary.push({
174
+ no,
175
+ net: (0, PDF_functions_1.getNumberRounded)(fa.P_13_6_1).toFixed(2),
176
+ gross: (0, PDF_functions_1.getNumberRounded)(fa.P_13_6_1).toFixed(2),
177
+ tax: '0.00',
178
+ taxPLN: '',
179
+ taxRateString: '0% - krajowe',
180
+ });
181
+ no++;
182
+ }
183
+ if (AnyP13_6_2Diff0) {
184
+ summary.push({
185
+ no,
186
+ net: (0, PDF_functions_1.getNumberRounded)(fa.P_13_6_2).toFixed(2),
187
+ gross: (0, PDF_functions_1.getNumberRounded)(fa.P_13_6_2).toFixed(2),
188
+ tax: '0.00',
189
+ taxPLN: '',
190
+ taxRateString: '0% - wdt',
191
+ });
192
+ no++;
193
+ }
194
+ if (AnyP13_6_3Diff0) {
195
+ summary.push({
196
+ no,
197
+ net: (0, PDF_functions_1.getNumberRounded)(fa.P_13_6_2).toFixed(2),
198
+ gross: (0, PDF_functions_1.getNumberRounded)(fa.P_13_6_2).toFixed(2),
199
+ tax: '0.00',
200
+ taxPLN: '',
201
+ taxRateString: '0% - eksport',
202
+ });
203
+ no++;
204
+ }
205
+ if (AnyP13_7Diff0) {
206
+ summary.push({
207
+ no,
208
+ net: (0, PDF_functions_1.getNumberRounded)(fa.P_13_7).toFixed(2),
209
+ gross: (0, PDF_functions_1.getNumberRounded)(fa.P_13_7).toFixed(2),
210
+ tax: '0.00',
211
+ taxPLN: '',
212
+ taxRateString: 'zwolnione z opodatkowania',
213
+ });
214
+ no++;
215
+ }
216
+ if (AnyP13_8Diff0) {
217
+ summary.push({
218
+ no,
219
+ net: (0, PDF_functions_1.getNumberRounded)(fa.P_13_8).toFixed(2),
220
+ gross: (0, PDF_functions_1.getNumberRounded)(fa.P_13_8).toFixed(2),
221
+ tax: '0.00',
222
+ taxPLN: '',
223
+ taxRateString: 'np z wyłączeniem art. 100 ust 1 pkt 4 ustawy',
224
+ });
225
+ no++;
226
+ }
227
+ if (AnyP13_9Diff0) {
228
+ summary.push({
229
+ no,
230
+ net: (0, PDF_functions_1.getNumberRounded)(fa.P_13_9).toFixed(2),
231
+ gross: (0, PDF_functions_1.getNumberRounded)(fa.P_13_9).toFixed(2),
232
+ tax: '0.00',
233
+ taxPLN: '',
234
+ taxRateString: 'np na podstawie art. 100 ust. 1 pkt 4 ustawy',
235
+ });
236
+ no++;
237
+ }
238
+ if (AnyP13_10Diff0) {
239
+ summary.push({
240
+ no,
241
+ net: (0, PDF_functions_1.getNumberRounded)(fa.P_13_10).toFixed(2),
242
+ gross: (0, PDF_functions_1.getNumberRounded)(fa.P_13_10).toFixed(2),
243
+ tax: '0.00',
244
+ taxPLN: '',
245
+ taxRateString: 'odwrotne obciążenie',
246
+ });
247
+ no++;
248
+ }
249
+ if (AnyP13_11Diff0) {
250
+ summary.push({
251
+ no,
252
+ net: (0, PDF_functions_1.getNumberRounded)(fa.P_13_11).toFixed(2),
253
+ gross: (0, PDF_functions_1.getNumberRounded)(fa.P_13_11).toFixed(2),
254
+ tax: '0.00',
255
+ taxPLN: '',
256
+ taxRateString: 'marża',
257
+ });
258
+ no++;
259
+ }
260
+ return summary;
261
+ }
262
+ function hasValueAndDiff0(value) {
263
+ return (0, PDF_functions_1.hasValue)(value) && (0, PDF_functions_1.getValue)(value) != 0;
264
+ }
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.generatePrzewoznik = generatePrzewoznik;
4
+ const PDF_functions_1 = require("../../../shared/PDF-functions");
5
+ const PodmiotAdres_1 = require("./PodmiotAdres");
6
+ const PodmiotDaneIdentyfikacyjneTPodmiot2Dto_1 = require("./PodmiotDaneIdentyfikacyjneTPodmiot2Dto");
7
+ function generatePrzewoznik(przewoznik) {
8
+ if (!przewoznik) {
9
+ return [];
10
+ }
11
+ return [
12
+ ...(0, PDF_functions_1.createHeader)('Przewoźnik'),
13
+ [
14
+ (0, PDF_functions_1.generateTwoColumns)((0, PodmiotDaneIdentyfikacyjneTPodmiot2Dto_1.generateDaneIdentyfikacyjneTPodmiot2Dto)(przewoznik.DaneIdentyfikacyjne), (0, PodmiotAdres_1.generatePodmiotAdres)(przewoznik.AdresPrzewoznika, 'Adres przewoźnika', true, [0, 0, 0, 0]), [0, 0, 0, 8]),
15
+ ],
16
+ ];
17
+ }
@@ -0,0 +1,57 @@
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.generateRabat = generateRabat;
37
+ const PDF_functions_1 = require("../../../shared/PDF-functions");
38
+ const common_enum_1 = __importStar(require("../../../shared/enums/common.enum"));
39
+ function generateRabat(invoice) {
40
+ const faRows = (0, PDF_functions_1.getTable)(invoice.FaWiersz);
41
+ const result = [];
42
+ const definedHeader = [
43
+ { name: 'NrWierszaFay', title: 'Lp.', format: common_enum_1.default.Default },
44
+ { name: 'P_7', title: 'Nazwa towaru lub usługi', format: common_enum_1.default.Default },
45
+ { name: 'P_8B', title: 'Ilość', format: common_enum_1.default.Default },
46
+ { name: 'P_8A', title: 'Miara', format: common_enum_1.default.Default },
47
+ ];
48
+ const tabRabat = (0, PDF_functions_1.getContentTable)(definedHeader, faRows, '*');
49
+ const isNrWierszaFa = tabRabat.fieldsWithValue.includes('NrWierszaFa');
50
+ result.push(...(0, PDF_functions_1.createHeader)('Rabat'), ...(0, PDF_functions_1.createLabelText)('Wartość rabatu ogółem: ', invoice.P_15, common_enum_1.default.Currency, {
51
+ alignment: common_enum_1.Position.RIGHT,
52
+ }), (0, PDF_functions_1.generateTwoColumns)((0, PDF_functions_1.formatText)(`Rabat ${isNrWierszaFa ? 'nie ' : ''}dotyczy wszystkich dostaw towarów i wykonanych usług na rzecz tego nabywcy w danym okresie.`, common_enum_1.default.Default), ''));
53
+ if (tabRabat.fieldsWithValue.length > 0 && tabRabat.content) {
54
+ result.push(tabRabat.content);
55
+ }
56
+ return (0, PDF_functions_1.createSection)(result, true);
57
+ }
@@ -0,0 +1,58 @@
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.generujRachunekBankowy = void 0;
7
+ const PDF_functions_1 = require("../../../shared/PDF-functions");
8
+ const common_enum_1 = __importDefault(require("../../../shared/enums/common.enum"));
9
+ const functions_1 = require("../../../shared/generators/common/functions");
10
+ const generujRachunekBankowy = (accounts, title) => {
11
+ const result = [];
12
+ if (!(accounts === null || accounts === void 0 ? void 0 : accounts.length)) {
13
+ return [];
14
+ }
15
+ accounts.forEach((account, index) => {
16
+ var _a, _b, _c, _d;
17
+ const table = [];
18
+ const base = (0, PDF_functions_1.createHeader)(title ? `${title} ${(accounts === null || accounts === void 0 ? void 0 : accounts.length) > 1 ? ++index : ''}` : '', [0, 12, 0, 8]);
19
+ table.push([
20
+ (0, PDF_functions_1.formatText)('Pełny numer rachunku', common_enum_1.default.GrayBoldTitle),
21
+ (0, PDF_functions_1.formatText)((_a = account.NrRB) === null || _a === void 0 ? void 0 : _a._text, common_enum_1.default.Default),
22
+ ]);
23
+ table.push([
24
+ (0, PDF_functions_1.formatText)('Kod SWIFT', common_enum_1.default.GrayBoldTitle),
25
+ (0, PDF_functions_1.formatText)((_b = account.SWIFT) === null || _b === void 0 ? void 0 : _b._text, common_enum_1.default.Default),
26
+ ]);
27
+ table.push([
28
+ (0, PDF_functions_1.formatText)('Rachunek własny banku', common_enum_1.default.GrayBoldTitle),
29
+ (0, PDF_functions_1.formatText)((0, functions_1.getTypRachunkowWlasnych)(account.RachunekWlasnyBanku), common_enum_1.default.Default),
30
+ ]);
31
+ table.push([
32
+ (0, PDF_functions_1.formatText)('Nazwa banku', common_enum_1.default.GrayBoldTitle),
33
+ (0, PDF_functions_1.formatText)((_c = account.NazwaBanku) === null || _c === void 0 ? void 0 : _c._text, common_enum_1.default.Default),
34
+ ]);
35
+ table.push([
36
+ (0, PDF_functions_1.formatText)('Opis rachunku', common_enum_1.default.GrayBoldTitle),
37
+ (0, PDF_functions_1.formatText)((_d = account.OpisRachunku) === null || _d === void 0 ? void 0 : _d._text, common_enum_1.default.Default),
38
+ ]);
39
+ result.push([
40
+ ...base,
41
+ {
42
+ unbreakable: true,
43
+ table: {
44
+ body: table,
45
+ widths: ['*', 'auto'],
46
+ },
47
+ layout: {
48
+ hLineWidth: () => 1,
49
+ hLineColor: () => '#BABABA',
50
+ vLineWidth: () => 1,
51
+ vLineColor: () => '#BABABA',
52
+ },
53
+ },
54
+ ]);
55
+ });
56
+ return (0, PDF_functions_1.createSection)(result, false);
57
+ };
58
+ exports.generujRachunekBankowy = generujRachunekBankowy;
@@ -0,0 +1,138 @@
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.generateSzczegoly = generateSzczegoly;
7
+ const PDF_functions_1 = require("../../../shared/PDF-functions");
8
+ const const_1 = require("../../../shared/consts/const");
9
+ const common_enum_1 = __importDefault(require("../../../shared/enums/common.enum"));
10
+ function generateSzczegoly(faVat) {
11
+ var _a, _b, _c;
12
+ const faWiersze = (0, PDF_functions_1.getTable)(faVat.FaWiersz);
13
+ const zamowieniaWiersze = (0, PDF_functions_1.getTable)((_a = faVat.Zamowienie) === null || _a === void 0 ? void 0 : _a.ZamowienieWiersz);
14
+ const LabelP_6 = faVat.RodzajFaktury == const_1.TRodzajFaktury.ZAL || faVat.RodzajFaktury == const_1.TRodzajFaktury.KOR_ZAL
15
+ ? 'Data otrzymania zapłaty: '
16
+ : 'Data dokonania lub zakończenia dostawy towarów lub wykonania usługi: ';
17
+ const P_6Scope = generateP_6Scope((_b = faVat.OkresFa) === null || _b === void 0 ? void 0 : _b.P_6_Od, (_c = faVat.OkresFa) === null || _c === void 0 ? void 0 : _c.P_6_Do);
18
+ const cenyLabel1 = [];
19
+ const cenyLabel2 = [];
20
+ if (!(faWiersze.length > 0 || zamowieniaWiersze.length > 0)) {
21
+ const Any_P_11 = (0, PDF_functions_1.hasColumnsValue)('P_11', faWiersze) || (0, PDF_functions_1.hasColumnsValue)('P_11', zamowieniaWiersze);
22
+ if (Any_P_11) {
23
+ cenyLabel1.push((0, PDF_functions_1.createLabelText)('Faktura wystawiona w cenach: ', 'netto'));
24
+ }
25
+ else {
26
+ cenyLabel1.push((0, PDF_functions_1.createLabelText)('Faktura wystawiona w cenach: ', 'brutto'));
27
+ }
28
+ cenyLabel2.push((0, PDF_functions_1.createLabelText)('Kod waluty: ', faVat.KodWaluty));
29
+ }
30
+ const P_12_XIILabel = [];
31
+ if ((0, PDF_functions_1.hasColumnsValue)('P_12_XII', faWiersze) || (0, PDF_functions_1.hasColumnsValue)('P_12_XII', zamowieniaWiersze)) {
32
+ P_12_XIILabel.push((0, PDF_functions_1.createLabelText)('Procedura One Stop Shop', ' '));
33
+ }
34
+ const kodWalutyLabel1 = [];
35
+ const kodWalutyLabel2 = [];
36
+ if ((0, PDF_functions_1.hasValue)(faVat.KodWaluty) && (0, PDF_functions_1.getValue)(faVat.KodWaluty) != 'PLN') {
37
+ if ((0, PDF_functions_1.hasValue)(faVat.KursWalutyZ)) {
38
+ kodWalutyLabel1.push((0, PDF_functions_1.createLabelText)('Kurs waluty wspólny dla wszystkich wierszy faktury', ' '));
39
+ kodWalutyLabel2.push((0, PDF_functions_1.createLabelText)('Kurs waluty: ', faVat.KursWalutyZ, common_enum_1.default.Currency6));
40
+ }
41
+ else {
42
+ const Common_KursWaluty = (0, PDF_functions_1.getDifferentColumnsValue)('KursWaluty', faWiersze);
43
+ if (Common_KursWaluty.length === 1) {
44
+ kodWalutyLabel1.push((0, PDF_functions_1.createLabelText)('Kurs waluty wspólny dla wszystkich wierszy faktury', ' '));
45
+ kodWalutyLabel2.push((0, PDF_functions_1.createLabelText)('Kurs waluty: ', Common_KursWaluty[0].value, common_enum_1.default.Currency6));
46
+ }
47
+ }
48
+ }
49
+ const tpLabel1 = [];
50
+ const tpLabel2 = [];
51
+ const forColumns = [
52
+ (0, PDF_functions_1.createLabelText)('Data wystawienia, z zastrzeżeniem art. 106na ust. 1 ustawy: ', faVat.P_1),
53
+ (0, PDF_functions_1.createLabelText)('Miejsce wystawienia: ', faVat.P_1M),
54
+ (0, PDF_functions_1.createLabelText)('Okres, którego dotyczy rabat: ', faVat.OkresFaKorygowanej),
55
+ (0, PDF_functions_1.createLabelText)(LabelP_6, faVat.P_6),
56
+ P_6Scope,
57
+ cenyLabel1,
58
+ cenyLabel2,
59
+ P_12_XIILabel,
60
+ kodWalutyLabel1,
61
+ kodWalutyLabel2,
62
+ tpLabel1,
63
+ tpLabel2,
64
+ ].filter((el) => el.length > 0);
65
+ const columns1 = [];
66
+ const columns2 = [];
67
+ forColumns.forEach((tab, index) => {
68
+ if (index % 2) {
69
+ columns2.push(tab);
70
+ }
71
+ else {
72
+ columns1.push(tab);
73
+ }
74
+ });
75
+ const table = [
76
+ ...(0, PDF_functions_1.createHeader)('Szczegóły'),
77
+ (0, PDF_functions_1.generateTwoColumns)(columns1, columns2),
78
+ ...generateZaliczkaCzesciowa(faVat.ZaliczkaCzesciowa),
79
+ ...generateFakturaZaliczkowa(faVat.FakturaZaliczkowa),
80
+ ];
81
+ return (0, PDF_functions_1.createSection)(table, true);
82
+ }
83
+ function generateP_6Scope(P_6_Od, P_6_Do) {
84
+ const table = [];
85
+ if ((0, PDF_functions_1.hasValue)(P_6_Od) && (0, PDF_functions_1.hasValue)(P_6_Do)) {
86
+ table.push((0, PDF_functions_1.createLabelTextArray)([
87
+ {
88
+ value: 'Data dokonania lub zakończenia dostawy towarów lub wykonania usługi: od ',
89
+ },
90
+ { value: P_6_Od, formatTyp: common_enum_1.default.Value },
91
+ { value: ' do ' },
92
+ { value: P_6_Do, formatTyp: common_enum_1.default.Value },
93
+ ]));
94
+ }
95
+ else if ((0, PDF_functions_1.hasValue)(P_6_Od)) {
96
+ table.push((0, PDF_functions_1.createLabelText)('Data dokonania lub zakończenia dostawy towarów lub wykonania usługi: od ', P_6_Od));
97
+ }
98
+ else if ((0, PDF_functions_1.hasValue)(P_6_Do)) {
99
+ table.push((0, PDF_functions_1.createLabelText)('Data dokonania lub zakończenia dostawy towarów lub wykonania usługi: do ', P_6_Do));
100
+ }
101
+ return table;
102
+ }
103
+ function generateZaliczkaCzesciowa(zaliczkaCzesciowaData) {
104
+ if (!zaliczkaCzesciowaData) {
105
+ return [];
106
+ }
107
+ const zaplataCzesciowa = (0, PDF_functions_1.getTable)(zaliczkaCzesciowaData);
108
+ const table = [];
109
+ const zaplataCzesciowaHeader = [
110
+ { name: 'P_6Z', title: 'Data otrzymania płatności', format: common_enum_1.default.Default },
111
+ { name: 'P_15Z', title: 'Kwota płatności', format: common_enum_1.default.Default },
112
+ { name: 'KursWalutyZW', title: 'Kurs waluty', format: common_enum_1.default.Currency6 },
113
+ ];
114
+ const tableZaliczkaCzesciowa = (0, PDF_functions_1.getContentTable)(zaplataCzesciowaHeader, zaplataCzesciowa, 'auto');
115
+ if (tableZaliczkaCzesciowa.content) {
116
+ table.push(tableZaliczkaCzesciowa.content);
117
+ }
118
+ return table;
119
+ }
120
+ function generateFakturaZaliczkowa(fakturaZaliczkowaData) {
121
+ if (!fakturaZaliczkowaData) {
122
+ return [];
123
+ }
124
+ const fakturaZaliczkowa = (0, PDF_functions_1.getTable)(fakturaZaliczkowaData);
125
+ const table = [];
126
+ const fakturaZaliczkowaHeader = [
127
+ {
128
+ name: 'NrKSeFFaZaliczkowej',
129
+ title: 'Numery wcześniejszych faktur zaliczkowych',
130
+ format: common_enum_1.default.Default,
131
+ },
132
+ ];
133
+ const tableFakturaZaliczkowa = (0, PDF_functions_1.getContentTable)(fakturaZaliczkowaHeader, fakturaZaliczkowa, 'auto', [0, 4, 0, 0]);
134
+ if (tableFakturaZaliczkowa.content) {
135
+ table.push(tableFakturaZaliczkowa.content);
136
+ }
137
+ return table;
138
+ }