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,260 @@
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
+ const const_1 = require("../../../shared/consts/const");
11
+ function generatePodsumowanieStawekPodatkuVat(faktura) {
12
+ 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;
13
+ const AnyP13P14_5Diff0 = (0, PDF_functions_1.hasValue)((_a = faktura.Fa) === null || _a === void 0 ? void 0 : _a.P_13_1) ||
14
+ (0, PDF_functions_1.hasValue)((_b = faktura.Fa) === null || _b === void 0 ? void 0 : _b.P_13_2) ||
15
+ (0, PDF_functions_1.hasValue)((_c = faktura.Fa) === null || _c === void 0 ? void 0 : _c.P_13_3) ||
16
+ (0, PDF_functions_1.hasValue)((_d = faktura.Fa) === null || _d === void 0 ? void 0 : _d.P_13_4) ||
17
+ ((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)) ||
18
+ (0, PDF_functions_1.hasValue)((_h = faktura.Fa) === null || _h === void 0 ? void 0 : _h.P_13_6_1) ||
19
+ (0, PDF_functions_1.hasValue)((_j = faktura.Fa) === null || _j === void 0 ? void 0 : _j.P_13_6_2) ||
20
+ (0, PDF_functions_1.hasValue)((_k = faktura.Fa) === null || _k === void 0 ? void 0 : _k.P_13_6_3) ||
21
+ (0, PDF_functions_1.hasValue)((_l = faktura.Fa) === null || _l === void 0 ? void 0 : _l.P_13_7) ||
22
+ (0, PDF_functions_1.hasValue)((_m = faktura.Fa) === null || _m === void 0 ? void 0 : _m.P_13_8) ||
23
+ (0, PDF_functions_1.hasValue)((_o = faktura.Fa) === null || _o === void 0 ? void 0 : _o.P_13_9) ||
24
+ (0, PDF_functions_1.hasValue)((_p = faktura.Fa) === null || _p === void 0 ? void 0 : _p.P_13_10) ||
25
+ (0, PDF_functions_1.hasValue)((_q = faktura.Fa) === null || _q === void 0 ? void 0 : _q.P_13_11);
26
+ const AnyP13 = (0, PDF_functions_1.hasValue)((_r = faktura.Fa) === null || _r === void 0 ? void 0 : _r.P_13_1) ||
27
+ (0, PDF_functions_1.hasValue)((_s = faktura.Fa) === null || _s === void 0 ? void 0 : _s.P_13_2) ||
28
+ (0, PDF_functions_1.hasValue)((_t = faktura.Fa) === null || _t === void 0 ? void 0 : _t.P_13_3) ||
29
+ (0, PDF_functions_1.hasValue)((_u = faktura.Fa) === null || _u === void 0 ? void 0 : _u.P_13_4) ||
30
+ (0, PDF_functions_1.hasValue)((_v = faktura.Fa) === null || _v === void 0 ? void 0 : _v.P_13_5) ||
31
+ (0, PDF_functions_1.hasValue)((_w = faktura.Fa) === null || _w === void 0 ? void 0 : _w.P_13_6_1) ||
32
+ (0, PDF_functions_1.hasValue)((_x = faktura.Fa) === null || _x === void 0 ? void 0 : _x.P_13_6_2) ||
33
+ (0, PDF_functions_1.hasValue)((_y = faktura.Fa) === null || _y === void 0 ? void 0 : _y.P_13_6_3) ||
34
+ (0, PDF_functions_1.hasValue)((_z = faktura.Fa) === null || _z === void 0 ? void 0 : _z.P_13_7) ||
35
+ (0, PDF_functions_1.hasValue)((_0 = faktura.Fa) === null || _0 === void 0 ? void 0 : _0.P_13_8) ||
36
+ (0, PDF_functions_1.hasValue)((_1 = faktura.Fa) === null || _1 === void 0 ? void 0 : _1.P_13_9) ||
37
+ (0, PDF_functions_1.hasValue)((_2 = faktura.Fa) === null || _2 === void 0 ? void 0 : _2.P_13_10) ||
38
+ (0, PDF_functions_1.hasValue)((_3 = faktura.Fa) === null || _3 === void 0 ? void 0 : _3.P_13_11);
39
+ const AnyP_14xW = (0, PDF_functions_1.hasValue)((_4 = faktura.Fa) === null || _4 === void 0 ? void 0 : _4.P_14_1W) ||
40
+ (0, PDF_functions_1.hasValue)((_5 = faktura.Fa) === null || _5 === void 0 ? void 0 : _5.P_14_2W) ||
41
+ (0, PDF_functions_1.hasValue)((_6 = faktura.Fa) === null || _6 === void 0 ? void 0 : _6.P_14_3W) ||
42
+ (0, PDF_functions_1.hasValue)((_7 = faktura.Fa) === null || _7 === void 0 ? void 0 : _7.P_14_4W);
43
+ let tableBody = [];
44
+ const table = {
45
+ table: {
46
+ headerRows: 1,
47
+ widths: [],
48
+ body: [],
49
+ },
50
+ layout: const_1.DEFAULT_TABLE_LAYOUT,
51
+ };
52
+ const definedHeader = [
53
+ ...[{ text: 'Lp.', style: common_enum_1.default.GrayBoldTitle }],
54
+ ...(AnyP13P14_5Diff0 ? [{ text: 'Stawka podatku', style: common_enum_1.default.GrayBoldTitle }] : []),
55
+ ...(AnyP13 ? [{ text: 'Kwota netto', style: common_enum_1.default.GrayBoldTitle }] : []),
56
+ ...(AnyP13P14_5Diff0 ? [{ text: 'Kwota podatku', style: common_enum_1.default.GrayBoldTitle }] : []),
57
+ ...(AnyP13 ? [{ text: 'Kwota brutto', style: common_enum_1.default.GrayBoldTitle }] : []),
58
+ ...(AnyP_14xW ? [{ text: 'Kwota podatku PLN', style: common_enum_1.default.GrayBoldTitle }] : []),
59
+ ];
60
+ const widths = [
61
+ ...['auto'],
62
+ ...(AnyP13P14_5Diff0 ? ['*'] : []),
63
+ ...(AnyP13 ? ['*'] : []),
64
+ ...(AnyP13P14_5Diff0 ? ['*'] : []),
65
+ ...(AnyP13 ? ['*'] : []),
66
+ ...(AnyP_14xW ? ['*'] : []),
67
+ ];
68
+ if (faktura === null || faktura === void 0 ? void 0 : faktura.Fa) {
69
+ const summary = getSummaryTaxRate(faktura.Fa);
70
+ tableBody = summary.map((item) => {
71
+ const data = [];
72
+ data.push(item.no);
73
+ if (AnyP13P14_5Diff0) {
74
+ data.push(item.taxRateString);
75
+ }
76
+ if (AnyP13) {
77
+ data.push((0, PDF_functions_1.formatText)(item.net, common_enum_1.default.Currency));
78
+ }
79
+ if (AnyP13P14_5Diff0) {
80
+ data.push((0, PDF_functions_1.formatText)(item.tax, common_enum_1.default.Currency));
81
+ }
82
+ if (AnyP13) {
83
+ data.push((0, PDF_functions_1.formatText)(item.gross, common_enum_1.default.Currency));
84
+ }
85
+ if (AnyP_14xW) {
86
+ data.push((0, PDF_functions_1.formatText)(item.taxPLN, common_enum_1.default.Currency));
87
+ }
88
+ return data;
89
+ });
90
+ }
91
+ table.table.body = [[...definedHeader], ...tableBody];
92
+ table.table.widths = [...widths];
93
+ return tableBody.length
94
+ ? (0, PDF_functions_1.createSection)([...(0, PDF_functions_1.createHeader)('Podsumowanie stawek podatku', [0, 0, 0, 8]), table], false)
95
+ : [];
96
+ }
97
+ function getSummaryTaxRate(fa) {
98
+ const summary = [];
99
+ 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);
100
+ 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);
101
+ 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);
102
+ 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);
103
+ 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);
104
+ const AnyP13_6_1Diff0 = hasValueAndDiff0(fa === null || fa === void 0 ? void 0 : fa.P_13_6_1);
105
+ const AnyP13_6_2Diff0 = hasValueAndDiff0(fa === null || fa === void 0 ? void 0 : fa.P_13_6_2);
106
+ const AnyP13_6_3Diff0 = hasValueAndDiff0(fa === null || fa === void 0 ? void 0 : fa.P_13_6_3);
107
+ const AnyP13_7Diff0 = hasValueAndDiff0(fa === null || fa === void 0 ? void 0 : fa.P_13_7);
108
+ const AnyP13_8Diff0 = hasValueAndDiff0(fa === null || fa === void 0 ? void 0 : fa.P_13_8);
109
+ const AnyP13_9Diff0 = hasValueAndDiff0(fa === null || fa === void 0 ? void 0 : fa.P_13_9);
110
+ const AnyP13_10Diff0 = hasValueAndDiff0(fa === null || fa === void 0 ? void 0 : fa.P_13_10);
111
+ const AnyP13_11Diff0 = hasValueAndDiff0(fa === null || fa === void 0 ? void 0 : fa.P_13_11);
112
+ let no = 1;
113
+ if (AnyP13_1P14_1P14_1WDiff0) {
114
+ summary.push({
115
+ no,
116
+ net: (0, PDF_functions_1.getNumberRounded)(fa.P_13_1).toFixed(2),
117
+ gross: ((0, PDF_functions_1.getNumberRounded)(fa.P_13_1) + (0, PDF_functions_1.getNumberRounded)(fa.P_14_1)).toFixed(2),
118
+ tax: (0, PDF_functions_1.getNumberRounded)(fa.P_14_1).toFixed(2),
119
+ taxPLN: (0, PDF_functions_1.getNumberRounded)(fa.P_14_1W).toFixed(2),
120
+ taxRateString: '23% lub 22%',
121
+ });
122
+ no++;
123
+ }
124
+ if (AnyP13_2P14_2P14_2WDiff0) {
125
+ summary.push({
126
+ no,
127
+ net: (0, PDF_functions_1.getNumberRounded)(fa.P_13_2).toFixed(2),
128
+ gross: ((0, PDF_functions_1.getNumberRounded)(fa.P_13_2) + (0, PDF_functions_1.getNumberRounded)(fa.P_14_2)).toFixed(2),
129
+ tax: (0, PDF_functions_1.getNumberRounded)(fa.P_14_2).toFixed(2),
130
+ taxPLN: (0, PDF_functions_1.getNumberRounded)(fa.P_14_2W).toFixed(2),
131
+ taxRateString: '8% lub 7%',
132
+ });
133
+ no++;
134
+ }
135
+ if (AnyP13_3P14_3P14_3WDiff0) {
136
+ summary.push({
137
+ no,
138
+ net: (0, PDF_functions_1.getNumberRounded)(fa.P_13_3).toFixed(2),
139
+ gross: ((0, PDF_functions_1.getNumberRounded)(fa.P_13_3) + (0, PDF_functions_1.getNumberRounded)(fa.P_14_3)).toFixed(2),
140
+ tax: (0, PDF_functions_1.getNumberRounded)(fa.P_14_3).toFixed(2),
141
+ taxPLN: (0, PDF_functions_1.getNumberRounded)(fa.P_14_3W).toFixed(2),
142
+ taxRateString: '5%',
143
+ });
144
+ no++;
145
+ }
146
+ if (AnyP13_4P14_4P14_4WDiff0) {
147
+ summary.push({
148
+ no,
149
+ net: (0, PDF_functions_1.getNumberRounded)(fa.P_13_4).toFixed(2),
150
+ gross: ((0, PDF_functions_1.getNumberRounded)(fa.P_13_4) + (0, PDF_functions_1.getNumberRounded)(fa.P_14_4)).toFixed(2),
151
+ tax: (0, PDF_functions_1.getNumberRounded)(fa.P_14_4).toFixed(2),
152
+ taxPLN: (0, PDF_functions_1.getNumberRounded)(fa.P_14_4W).toFixed(2),
153
+ taxRateString: '4% lub 3% lub oo',
154
+ });
155
+ no++;
156
+ }
157
+ if (AnyP13_5P14_5Diff0) {
158
+ summary.push({
159
+ no,
160
+ net: (0, PDF_functions_1.getNumberRounded)(fa.P_13_5).toFixed(2),
161
+ gross: (0, PDF_functions_1.getNumberRounded)(fa.P_13_5).toFixed(2),
162
+ tax: (0, PDF_functions_1.getNumberRounded)(fa.P_14_5).toFixed(2),
163
+ taxPLN: '',
164
+ taxRateString: (0, PDF_functions_1.getValue)(fa.P_14_5) != 0 ? 'niepodlegające opodatkowaniu' : '',
165
+ });
166
+ no++;
167
+ }
168
+ if (AnyP13_6_1Diff0) {
169
+ summary.push({
170
+ no,
171
+ net: (0, PDF_functions_1.getNumberRounded)(fa.P_13_6_1).toFixed(2),
172
+ gross: (0, PDF_functions_1.getNumberRounded)(fa.P_13_6_1).toFixed(2),
173
+ tax: '0.00',
174
+ taxPLN: '',
175
+ taxRateString: '0% - krajowe',
176
+ });
177
+ no++;
178
+ }
179
+ if (AnyP13_6_2Diff0) {
180
+ summary.push({
181
+ no,
182
+ net: (0, PDF_functions_1.getNumberRounded)(fa.P_13_6_2).toFixed(2),
183
+ gross: (0, PDF_functions_1.getNumberRounded)(fa.P_13_6_2).toFixed(2),
184
+ tax: '0.00',
185
+ taxPLN: '',
186
+ taxRateString: '0% - wdt',
187
+ });
188
+ no++;
189
+ }
190
+ if (AnyP13_6_3Diff0) {
191
+ summary.push({
192
+ no,
193
+ net: (0, PDF_functions_1.getNumberRounded)(fa.P_13_6_2).toFixed(2),
194
+ gross: (0, PDF_functions_1.getNumberRounded)(fa.P_13_6_2).toFixed(2),
195
+ tax: '0.00',
196
+ taxPLN: '',
197
+ taxRateString: '0% - eksport',
198
+ });
199
+ no++;
200
+ }
201
+ if (AnyP13_7Diff0) {
202
+ summary.push({
203
+ no,
204
+ net: (0, PDF_functions_1.getNumberRounded)(fa.P_13_7).toFixed(2),
205
+ gross: (0, PDF_functions_1.getNumberRounded)(fa.P_13_7).toFixed(2),
206
+ tax: '0.00',
207
+ taxPLN: '',
208
+ taxRateString: 'zwolnione z opodatkowania',
209
+ });
210
+ no++;
211
+ }
212
+ if (AnyP13_8Diff0) {
213
+ summary.push({
214
+ no,
215
+ net: (0, PDF_functions_1.getNumberRounded)(fa.P_13_8).toFixed(2),
216
+ gross: (0, PDF_functions_1.getNumberRounded)(fa.P_13_8).toFixed(2),
217
+ tax: '0.00',
218
+ taxPLN: '',
219
+ taxRateString: 'np z wyłączeniem art. 100 ust 1 pkt 4 ustawy',
220
+ });
221
+ no++;
222
+ }
223
+ if (AnyP13_9Diff0) {
224
+ summary.push({
225
+ no,
226
+ net: (0, PDF_functions_1.getNumberRounded)(fa.P_13_9).toFixed(2),
227
+ gross: (0, PDF_functions_1.getNumberRounded)(fa.P_13_9).toFixed(2),
228
+ tax: '0.00',
229
+ taxPLN: '',
230
+ taxRateString: 'np na podstawie art. 100 ust. 1 pkt 4 ustawy',
231
+ });
232
+ no++;
233
+ }
234
+ if (AnyP13_10Diff0) {
235
+ summary.push({
236
+ no,
237
+ net: (0, PDF_functions_1.getNumberRounded)(fa.P_13_10).toFixed(2),
238
+ gross: (0, PDF_functions_1.getNumberRounded)(fa.P_13_10).toFixed(2),
239
+ tax: '0.00',
240
+ taxPLN: '',
241
+ taxRateString: 'odwrotne obciążenie',
242
+ });
243
+ no++;
244
+ }
245
+ if (AnyP13_11Diff0) {
246
+ summary.push({
247
+ no,
248
+ net: (0, PDF_functions_1.getNumberRounded)(fa.P_13_11).toFixed(2),
249
+ gross: (0, PDF_functions_1.getNumberRounded)(fa.P_13_11).toFixed(2),
250
+ tax: '0.00',
251
+ taxPLN: '',
252
+ taxRateString: 'marża',
253
+ });
254
+ no++;
255
+ }
256
+ return summary;
257
+ }
258
+ function hasValueAndDiff0(value) {
259
+ return (0, PDF_functions_1.hasValue)(value) && (0, PDF_functions_1.getValue)(value) != 0;
260
+ }
@@ -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,54 @@
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 const_1 = require("../../../shared/consts/const");
11
+ const generujRachunekBankowy = (accounts, title) => {
12
+ const result = [];
13
+ if (!(accounts === null || accounts === void 0 ? void 0 : accounts.length)) {
14
+ return [];
15
+ }
16
+ accounts.forEach((account, index) => {
17
+ var _a, _b, _c, _d;
18
+ const table = [];
19
+ const base = (0, PDF_functions_1.createHeader)(title ? `${title} ${(accounts === null || accounts === void 0 ? void 0 : accounts.length) > 1 ? ++index : ''}` : '', [0, 12, 0, 8]);
20
+ table.push([
21
+ (0, PDF_functions_1.formatText)('Pełny numer rachunku', common_enum_1.default.GrayBoldTitle),
22
+ (0, PDF_functions_1.formatText)((_a = account.NrRB) === null || _a === void 0 ? void 0 : _a._text, common_enum_1.default.Default),
23
+ ]);
24
+ table.push([
25
+ (0, PDF_functions_1.formatText)('Kod SWIFT', common_enum_1.default.GrayBoldTitle),
26
+ (0, PDF_functions_1.formatText)((_b = account.SWIFT) === null || _b === void 0 ? void 0 : _b._text, common_enum_1.default.Default),
27
+ ]);
28
+ table.push([
29
+ (0, PDF_functions_1.formatText)('Rachunek własny banku', common_enum_1.default.GrayBoldTitle),
30
+ (0, PDF_functions_1.formatText)((0, functions_1.getTypRachunkowWlasnych)(account.RachunekWlasnyBanku), common_enum_1.default.Default),
31
+ ]);
32
+ table.push([
33
+ (0, PDF_functions_1.formatText)('Nazwa banku', common_enum_1.default.GrayBoldTitle),
34
+ (0, PDF_functions_1.formatText)((_c = account.NazwaBanku) === null || _c === void 0 ? void 0 : _c._text, common_enum_1.default.Default),
35
+ ]);
36
+ table.push([
37
+ (0, PDF_functions_1.formatText)('Opis rachunku', common_enum_1.default.GrayBoldTitle),
38
+ (0, PDF_functions_1.formatText)((_d = account.OpisRachunku) === null || _d === void 0 ? void 0 : _d._text, common_enum_1.default.Default),
39
+ ]);
40
+ result.push([
41
+ ...base,
42
+ {
43
+ unbreakable: true,
44
+ table: {
45
+ body: table,
46
+ widths: ['*', 'auto'],
47
+ },
48
+ layout: const_1.DEFAULT_TABLE_LAYOUT,
49
+ },
50
+ ]);
51
+ });
52
+ return (0, PDF_functions_1.createSection)(result, false);
53
+ };
54
+ 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
+ }
@@ -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 common_enum_1 = __importDefault(require("../../../shared/enums/common.enum"));
10
+ const functions_1 = require("../../../shared/generators/common/functions");
11
+ const Przewoznik_1 = require("./Przewoznik");
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
+ }