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,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,185 @@
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.generateAdnotacje = generateAdnotacje;
7
+ exports.generateDostawy = generateDostawy;
8
+ const PDF_functions_1 = require("../../../shared/PDF-functions");
9
+ const common_enum_1 = __importDefault(require("../../../shared/enums/common.enum"));
10
+ function generateAdnotacje(adnotacje) {
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;
12
+ const result = [];
13
+ const firstColumn = [];
14
+ const secondColumn = [];
15
+ if (adnotacje) {
16
+ const zwolnienie = adnotacje.Zwolnienie;
17
+ if (((_a = zwolnienie === null || zwolnienie === void 0 ? void 0 : zwolnienie.P_19) === null || _a === void 0 ? void 0 : _a._text) === '1') {
18
+ addToColumn(firstColumn, secondColumn, {
19
+ text: 'Dostawa towarów lub świadczenie usług zwolnionych od podatku na podstawie art. 43 ust. 1, art. 113 ust. 1 i 9 albo przepisów wydanych na podstawie art. 82 ust. 3 lub na podstawie innych przepisów',
20
+ }, true);
21
+ if ((_b = zwolnienie.P_19A) === null || _b === void 0 ? void 0 : _b._text) {
22
+ addToColumn(firstColumn, secondColumn, (0, PDF_functions_1.createLabelText)('Podstawa zwolnienia od podatku: ', 'Przepis ustawy albo aktu wydanego na podstawie ustawy, na podstawie którego podatnik stosuje zwolnienie od podatku'), true);
23
+ addToColumn(firstColumn, secondColumn, (0, PDF_functions_1.createLabelText)('Przepis ustawy albo aktu wydanego na podstawie ustawy: ', zwolnienie.P_19A._text), true);
24
+ }
25
+ if ((_c = zwolnienie.P_19B) === null || _c === void 0 ? void 0 : _c._text) {
26
+ addToColumn(firstColumn, secondColumn, (0, PDF_functions_1.createLabelText)('Podstawa zwolnienia od podatku: ', 'Przepis dyrektywy 2006/112/WE, który zwalnia od podatku taką dostawę towarów lub takie świadczenie usług'), true);
27
+ addToColumn(firstColumn, secondColumn, (0, PDF_functions_1.createLabelText)('Przepis dyrektywy: ', zwolnienie.P_19B._text), true);
28
+ }
29
+ if ((_d = zwolnienie.P_19C) === null || _d === void 0 ? void 0 : _d._text) {
30
+ addToColumn(firstColumn, secondColumn, (0, PDF_functions_1.createLabelText)('Podstawa zwolnienia od podatku: ', 'Inna podstawa prawna wskazującą na to, że dostawa towarów lub świadczenie usług korzysta ze zwolnienia'), true);
31
+ addToColumn(firstColumn, secondColumn, (0, PDF_functions_1.createLabelText)('Inna podstawa prawna: ', zwolnienie.P_19C._text), true);
32
+ }
33
+ }
34
+ if (((_f = (_e = adnotacje.NoweSrodkiTransportu) === null || _e === void 0 ? void 0 : _e.P_42_5) === null || _f === void 0 ? void 0 : _f._text) === '1' ||
35
+ ((_h = (_g = adnotacje.NoweSrodkiTransportu) === null || _g === void 0 ? void 0 : _g.P_42_5) === null || _h === void 0 ? void 0 : _h._text) === '2') {
36
+ let obowiazekVAT = [];
37
+ let value = ' ';
38
+ if (((_j = adnotacje.NoweSrodkiTransportu.P_42_5) === null || _j === void 0 ? void 0 : _j._text) === '1') {
39
+ value = 'Istnieje obowiązek wystawienia dokumentu VAT-22';
40
+ }
41
+ else if (((_k = adnotacje.NoweSrodkiTransportu.P_42_5) === null || _k === void 0 ? void 0 : _k._text) === '2') {
42
+ value = 'Nie istnieje obowiązek wystawienia dokumentu VAT-22';
43
+ }
44
+ obowiazekVAT = [
45
+ ...(0, PDF_functions_1.createLabelText)('Wewnątrzwspólnotowe dostawy nowych środków transportu: ', value !== null && value !== void 0 ? value : ''),
46
+ ];
47
+ if (obowiazekVAT) {
48
+ addToColumn(firstColumn, secondColumn, obowiazekVAT, true);
49
+ }
50
+ }
51
+ if (((_l = adnotacje.P_18A) === null || _l === void 0 ? void 0 : _l._text) === '1') {
52
+ addToColumn(firstColumn, secondColumn, { text: 'Mechanizm podzielonej płatności' });
53
+ }
54
+ if (((_m = adnotacje.P_16) === null || _m === void 0 ? void 0 : _m._text) === '1') {
55
+ addToColumn(firstColumn, secondColumn, { text: 'Metoda kasowa' });
56
+ }
57
+ if (((_o = adnotacje.P_18) === null || _o === void 0 ? void 0 : _o._text) === '1') {
58
+ addToColumn(firstColumn, secondColumn, { text: 'Odwrotne obciążenie' });
59
+ }
60
+ if (((_p = adnotacje.P_23) === null || _p === void 0 ? void 0 : _p._text) === '1') {
61
+ addToColumn(firstColumn, secondColumn, { text: 'Procedura trójstronna uproszczona' });
62
+ }
63
+ if (((_r = (_q = adnotacje.PMarzy) === null || _q === void 0 ? void 0 : _q.P_PMarzy) === null || _r === void 0 ? void 0 : _r._text) === '1') {
64
+ let valueMarzy = '';
65
+ if (((_s = adnotacje.PMarzy.P_PMarzy_3_1) === null || _s === void 0 ? void 0 : _s._text) === '1') {
66
+ valueMarzy = 'towary używane';
67
+ }
68
+ else if (((_t = adnotacje.PMarzy.P_PMarzy_3_2) === null || _t === void 0 ? void 0 : _t._text) === '1') {
69
+ valueMarzy = 'dzieła sztuki';
70
+ }
71
+ else if (((_u = adnotacje.PMarzy.P_PMarzy_2) === null || _u === void 0 ? void 0 : _u._text) === '1') {
72
+ valueMarzy = 'biura podróży';
73
+ }
74
+ else if (((_v = adnotacje.PMarzy.P_PMarzy_3_3) === null || _v === void 0 ? void 0 : _v._text) === '1') {
75
+ valueMarzy = 'przedmioty kolekcjonerskie i antyki';
76
+ }
77
+ addToColumn(firstColumn, secondColumn, (0, PDF_functions_1.createLabelText)('Procedura marży: ', valueMarzy));
78
+ }
79
+ if (((_w = adnotacje.P_17) === null || _w === void 0 ? void 0 : _w._text) === '1') {
80
+ addToColumn(firstColumn, secondColumn, { text: 'Samofakturowanie' });
81
+ }
82
+ if (firstColumn.length || secondColumn.length) {
83
+ result.push({ columns: [firstColumn, secondColumn], columnGap: 20 });
84
+ }
85
+ if (result.length) {
86
+ result.unshift((0, PDF_functions_1.verticalSpacing)(1));
87
+ result.unshift((0, PDF_functions_1.createHeader)('Adnotacje'));
88
+ result.unshift((0, PDF_functions_1.verticalSpacing)(1));
89
+ result.push((0, PDF_functions_1.verticalSpacing)(1));
90
+ }
91
+ if (((_y = (_x = adnotacje.NoweSrodkiTransportu) === null || _x === void 0 ? void 0 : _x.P_42_5) === null || _y === void 0 ? void 0 : _y._text) === '1' ||
92
+ ((_0 = (_z = adnotacje.NoweSrodkiTransportu) === null || _z === void 0 ? void 0 : _z.P_42_5) === null || _0 === void 0 ? void 0 : _0._text) === '2') {
93
+ result.push(generateDostawy(adnotacje.NoweSrodkiTransportu));
94
+ }
95
+ }
96
+ return result;
97
+ }
98
+ function generateDostawy(noweSrodkiTransportu) {
99
+ const nowySrodekTransportu = (0, PDF_functions_1.getTable)(noweSrodkiTransportu.NowySrodekTransportu);
100
+ let tableBody = [];
101
+ const table = {
102
+ table: {
103
+ headerRows: 1,
104
+ widths: [100, '*'],
105
+ body: [],
106
+ },
107
+ layout: {
108
+ hLineWidth: () => 1,
109
+ hLineColor: () => '#BABABA',
110
+ vLineWidth: () => 1,
111
+ vLineColor: () => '#BABABA',
112
+ },
113
+ marginTop: 4,
114
+ };
115
+ if (nowySrodekTransportu === null || nowySrodekTransportu === void 0 ? void 0 : nowySrodekTransportu.length) {
116
+ const definedHeader = [
117
+ { text: 'Data dopuszczenia do użytku', style: common_enum_1.default.GrayBoldTitle },
118
+ { text: 'Opis', style: common_enum_1.default.GrayBoldTitle },
119
+ ];
120
+ tableBody = nowySrodekTransportu.map((item) => {
121
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r;
122
+ const value = [];
123
+ const anyP22B = (0, PDF_functions_1.hasValue)(item.P_22B) ||
124
+ (0, PDF_functions_1.hasValue)(item.P_22BT) ||
125
+ (0, PDF_functions_1.hasValue)(item.P_22B1) ||
126
+ (0, PDF_functions_1.hasValue)(item.P_22B2) ||
127
+ (0, PDF_functions_1.hasValue)(item.P_22B3) ||
128
+ (0, PDF_functions_1.hasValue)(item.P_22B4);
129
+ const anyP22C = (0, PDF_functions_1.hasValue)(item.P_22C) || (0, PDF_functions_1.hasValue)(item.P_22C1);
130
+ const anyP22D = (0, PDF_functions_1.hasValue)(item.P_22D) || (0, PDF_functions_1.hasValue)(item.P_22D1);
131
+ const anyP22N = (0, PDF_functions_1.hasValue)(item.P_22B1) || (0, PDF_functions_1.hasValue)(item.P_22B2) || (0, PDF_functions_1.hasValue)(item.P_22B3) || (0, PDF_functions_1.hasValue)(item.P_22B4);
132
+ if ((_a = item.P_NrWierszaNST) === null || _a === void 0 ? void 0 : _a._text) {
133
+ value.push(item.P_NrWierszaNST._text);
134
+ }
135
+ if (anyP22B) {
136
+ value.push('Dostawa dotyczy pojazdów lądowych, o których mowa w art. 2 pkt 10 lit. a ustawy');
137
+ }
138
+ else if (anyP22C) {
139
+ value.push('Dostawa dotyczy jednostek pływających, o których mowa w art. 2 pkt 10 lit. b ustawy');
140
+ }
141
+ else if (anyP22D) {
142
+ value.push('Dostawa dotyczy statków powietrznych, o których mowa w art. 2 pkt 10 lit. c ustawy');
143
+ }
144
+ if ((_b = item.DetailsString) === null || _b === void 0 ? void 0 : _b._text) {
145
+ value.push(item.DetailsString._text);
146
+ }
147
+ if (anyP22B || anyP22C || anyP22D) {
148
+ value.push((_h = (_f = (_d = (_c = item.P_22B) === null || _c === void 0 ? void 0 : _c._text) !== null && _d !== void 0 ? _d : (_e = item.P_22C) === null || _e === void 0 ? void 0 : _e._text) !== null && _f !== void 0 ? _f : (_g = item.P_22D) === null || _g === void 0 ? void 0 : _g._text) !== null && _h !== void 0 ? _h : '');
149
+ }
150
+ if ((_j = item.P_22C1) === null || _j === void 0 ? void 0 : _j._text) {
151
+ value.push(`Numer kadłuba nowego środka transportu: ${item.P_22C1._text}`);
152
+ }
153
+ if ((_k = item.P_22D1) === null || _k === void 0 ? void 0 : _k._text) {
154
+ value.push(`Numer fabryczny nowego środka transportu: ${item.P_22D1._text}`);
155
+ }
156
+ if (anyP22N) {
157
+ if ((_l = item.P_22B1) === null || _l === void 0 ? void 0 : _l._text) {
158
+ value.push(`Numer VIN: ${item.P_22B1._text}`);
159
+ }
160
+ if ((_m = item.P_22B2) === null || _m === void 0 ? void 0 : _m._text) {
161
+ value.push(`Numer nadwozia: ${item.P_22B2._text}`);
162
+ }
163
+ if ((_o = item.P_22B3) === null || _o === void 0 ? void 0 : _o._text) {
164
+ value.push(`Numer podwozia: ${item.P_22B3._text}`);
165
+ }
166
+ if ((_p = item.P_22B4) === null || _p === void 0 ? void 0 : _p._text) {
167
+ value.push(`Numer ramy: ${item.P_22B4._text}`);
168
+ }
169
+ }
170
+ if ((_q = item.P_22BT) === null || _q === void 0 ? void 0 : _q._text) {
171
+ value.push(item.P_22BT._text);
172
+ }
173
+ return [(0, PDF_functions_1.formatText)((_r = item.P_22A) === null || _r === void 0 ? void 0 : _r._text), { text: value.join('\n') }];
174
+ });
175
+ table.table.body = [[...definedHeader], ...tableBody];
176
+ }
177
+ return tableBody.length ? [table, (0, PDF_functions_1.verticalSpacing)(1)] : [];
178
+ }
179
+ function addToColumn(firstColumn, secondColumn, content, isFirstColumn) {
180
+ if (firstColumn.length > secondColumn.length && isFirstColumn) {
181
+ secondColumn.push(content);
182
+ return;
183
+ }
184
+ firstColumn.push(content);
185
+ }
@@ -0,0 +1,23 @@
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.generateAdres = generateAdres;
7
+ const PDF_functions_1 = require("../../../shared/PDF-functions");
8
+ const common_enum_1 = __importDefault(require("../../../shared/enums/common.enum"));
9
+ function generateAdres(adres) {
10
+ var _a;
11
+ const result = [];
12
+ if (adres === null || adres === void 0 ? void 0 : adres.AdresL1) {
13
+ result.push((0, PDF_functions_1.formatText)(adres.AdresL1._text, common_enum_1.default.Value));
14
+ }
15
+ if (adres === null || adres === void 0 ? void 0 : adres.AdresL2) {
16
+ result.push((0, PDF_functions_1.formatText)(adres.AdresL2._text, common_enum_1.default.Value));
17
+ }
18
+ if (adres === null || adres === void 0 ? void 0 : adres.KodKraju) {
19
+ result.push((0, PDF_functions_1.formatText)((0, PDF_functions_1.getKraj)((_a = adres.KodKraju._text) !== null && _a !== void 0 ? _a : ''), common_enum_1.default.Value));
20
+ }
21
+ result.push(...(0, PDF_functions_1.createLabelText)('GLN: ', adres.GLN));
22
+ return result;
23
+ }
@@ -0,0 +1,69 @@
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.generateDodatkoweInformacje = generateDodatkoweInformacje;
7
+ const PDF_functions_1 = require("../../../shared/PDF-functions");
8
+ const common_enum_1 = __importDefault(require("../../../shared/enums/common.enum"));
9
+ function generateDodatkoweInformacje(faVat) {
10
+ const tpLabel1 = [];
11
+ const tpLabel2 = [];
12
+ if ((0, PDF_functions_1.getValue)(faVat.TP) === '1') {
13
+ tpLabel1.push((0, PDF_functions_1.formatText)('- Istniejące powiązania między nabywcą a dokonującym dostawy towarów lub usługodawcą'));
14
+ tpLabel2.push((0, PDF_functions_1.formatText)('- Faktura, o której mowa w art. 109 ust. 3d ustawy'));
15
+ }
16
+ const zwrotAkcyzyLabel = [];
17
+ if ((0, PDF_functions_1.getValue)(faVat.ZwrotAkcyzy) === '1') {
18
+ zwrotAkcyzyLabel.push((0, PDF_functions_1.formatText)('- Informacja dodatkowa związana ze zwrotem podatku akcyzowego zawartego w cenie oleju napędowego'));
19
+ }
20
+ const labels = [tpLabel1, tpLabel2, zwrotAkcyzyLabel].filter((el) => el.length > 0);
21
+ const table = [
22
+ ...(0, PDF_functions_1.createHeader)('Dodatkowe informacje'),
23
+ ...labels,
24
+ ...generateDodatkowyOpis(faVat.DodatkowyOpis),
25
+ ];
26
+ return table.length > 1 ? (0, PDF_functions_1.createSection)(table, true) : [];
27
+ }
28
+ function generateDodatkowyOpis(fakturaZaliczkowaData) {
29
+ var _a;
30
+ if (!fakturaZaliczkowaData) {
31
+ return [];
32
+ }
33
+ const fakturaZaliczkowa = (_a = (0, PDF_functions_1.getTable)(fakturaZaliczkowaData)) === null || _a === void 0 ? void 0 : _a.map((item, index) => ({
34
+ ...item,
35
+ lp: { _text: index + 1 },
36
+ }));
37
+ const table = (0, PDF_functions_1.createSubHeader)('Dodatkowy opis');
38
+ const fakturaZaliczkowaHeader = [
39
+ {
40
+ name: 'lp',
41
+ title: 'Lp.',
42
+ format: common_enum_1.default.Default,
43
+ width: 'auto',
44
+ },
45
+ {
46
+ name: 'NrWiersza',
47
+ title: 'Numer wiersza',
48
+ format: common_enum_1.default.Default,
49
+ width: 'auto',
50
+ },
51
+ {
52
+ name: 'Klucz',
53
+ title: 'Rodzaj informacji',
54
+ format: common_enum_1.default.Default,
55
+ width: 'auto',
56
+ },
57
+ {
58
+ name: 'Wartosc',
59
+ title: 'Treść informacji',
60
+ format: common_enum_1.default.Default,
61
+ width: '*',
62
+ },
63
+ ];
64
+ const tableFakturaZaliczkowa = (0, PDF_functions_1.getContentTable)(fakturaZaliczkowaHeader, fakturaZaliczkowa, '*', [0, 0, 0, 0]);
65
+ if (tableFakturaZaliczkowa.content) {
66
+ table.push(tableFakturaZaliczkowa.content);
67
+ }
68
+ return table;
69
+ }