@provis/provis-common-be-module 2.6.95 → 2.6.96

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 (42) hide show
  1. package/dist/class/main.repository.js +4 -4
  2. package/dist/constants/claim/general.js +1 -1
  3. package/dist/constants/claim/kalog.js +1 -1
  4. package/dist/constants/claim/life.d.ts +2 -2
  5. package/dist/constants/claim/life.js +1 -1
  6. package/dist/constants/claim/loket.js +40 -40
  7. package/dist/constants/claim/motorVehicle.js +1 -1
  8. package/dist/constants/claim/travel.js +1 -1
  9. package/dist/constants/config.js +2 -2
  10. package/dist/constants/invoice/coa.d.ts +30 -1
  11. package/dist/constants/invoice/coa.js +45 -1
  12. package/dist/constants/product/cargo/quotation.js +1 -1
  13. package/dist/constants/product.js +14 -14
  14. package/dist/constants/source.js +1 -1
  15. package/dist/helpers/alphaNumericCleansing.js +1 -1
  16. package/dist/helpers/amountDescription.js +1 -1
  17. package/dist/helpers/axiosGet.js +1 -1
  18. package/dist/helpers/axiosPost.js +1 -1
  19. package/dist/helpers/axiosPut.js +1 -1
  20. package/dist/helpers/calculateByType.js +1 -1
  21. package/dist/helpers/calculateForNullable.js +6 -6
  22. package/dist/helpers/decimalAmount.d.ts +11 -0
  23. package/dist/helpers/decimalAmount.js +36 -0
  24. package/dist/helpers/getHeaderUser.js +4 -4
  25. package/dist/helpers/index.d.ts +2 -1
  26. package/dist/helpers/index.js +6 -1
  27. package/dist/helpers/invoicePeriod.d.ts +11 -0
  28. package/dist/helpers/invoicePeriod.js +66 -0
  29. package/dist/helpers/loop.js +2 -2
  30. package/dist/helpers/loopBackward.js +2 -2
  31. package/dist/helpers/readExcel.d.ts +0 -2
  32. package/package.json +1 -1
  33. package/dist/constants/bankAccount.d.ts +0 -8
  34. package/dist/constants/bankAccount.js +0 -54
  35. package/dist/constants/product/cargo.d.ts +0 -39
  36. package/dist/constants/product/cargo.js +0 -41
  37. package/dist/constants/product/coretax.d.ts +0 -12
  38. package/dist/constants/product/coretax.js +0 -14
  39. package/dist/constants/product/mv.d.ts +0 -30
  40. package/dist/constants/product/mv.js +0 -158
  41. package/dist/constants/product/property/occupation.d.ts +0 -5
  42. package/dist/constants/product/property/occupation.js +0 -1725
@@ -0,0 +1,66 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.canReviseInPlace = exports.requiresCreditNote = exports.monthsBetween = exports.CUTOFF_DAY = void 0;
4
+ // Buku bulan N ditutup tanggal 15 bulan N+1. Selama periode invoice masih terbuka, revisi dan
5
+ // cancel boleh langsung ubah invoice yang sama. Kalau sudah ditutup, invoice lama harus dicancel
6
+ // dan terbit Credit Note (untuk revisi: plus invoice baru dengan nomor baru).
7
+ //
8
+ // contoh invoice terbit 1 Januari 2026:
9
+ // 31 Januari -> boleh langsung, bulannya sama
10
+ // 14 Februari -> boleh langsung, buku Januari belum ditutup
11
+ // 15 Februari -> wajib CN, buku Januari sudah ditutup
12
+ // 10 Maret -> wajib CN
13
+ exports.CUTOFF_DAY = 15;
14
+ // ambil komponen tanggalnya saja biar tidak kena geser zona waktu.
15
+ // terima Date maupun string 'YYYY-MM-DD...' seperti yang disimpan di database
16
+ const toDateParts = (value) => {
17
+ if (!value)
18
+ return null;
19
+ if (value instanceof Date) {
20
+ if (isNaN(value.getTime()))
21
+ return null;
22
+ return {
23
+ year: value.getFullYear(),
24
+ month: value.getMonth() + 1,
25
+ day: value.getDate(),
26
+ };
27
+ }
28
+ const matched = /^(\d{4})-(\d{2})-(\d{2})/.exec(`${value}`.trim());
29
+ if (!matched)
30
+ return null;
31
+ return {
32
+ year: parseInt(matched[1], 10),
33
+ month: parseInt(matched[2], 10),
34
+ day: parseInt(matched[3], 10),
35
+ };
36
+ };
37
+ const monthsBetween = (issueDate, actionDate) => {
38
+ const issue = toDateParts(issueDate);
39
+ const action = toDateParts(actionDate);
40
+ if (!issue || !action)
41
+ return null;
42
+ return ((action.year - issue.year) * 12) + (action.month - issue.month);
43
+ };
44
+ exports.monthsBetween = monthsBetween;
45
+ // true = tidak boleh diubah langsung, wajib terbitkan Credit Note.
46
+ // kalau tanggalnya tidak kebaca, balikin false biar perilaku lama (revisi langsung) tetap jalan
47
+ const requiresCreditNote = (issueDate, actionDate) => {
48
+ const monthsDiff = (0, exports.monthsBetween)(issueDate, actionDate);
49
+ const action = toDateParts(actionDate);
50
+ if (monthsDiff === null || !action)
51
+ return false;
52
+ if (monthsDiff <= 0)
53
+ return false; // masih bulan yang sama
54
+ if (monthsDiff === 1)
55
+ return action.day >= exports.CUTOFF_DAY; // buku bulan lalu ditutup tanggal 15
56
+ return true; // dua bulan atau lebih, periodenya pasti sudah tutup
57
+ };
58
+ exports.requiresCreditNote = requiresCreditNote;
59
+ const canReviseInPlace = (issueDate, actionDate) => !(0, exports.requiresCreditNote)(issueDate, actionDate);
60
+ exports.canReviseInPlace = canReviseInPlace;
61
+ exports.default = {
62
+ CUTOFF_DAY: exports.CUTOFF_DAY,
63
+ monthsBetween: exports.monthsBetween,
64
+ requiresCreditNote: exports.requiresCreditNote,
65
+ canReviseInPlace: exports.canReviseInPlace,
66
+ };
@@ -9,8 +9,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
9
9
  });
10
10
  };
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
- function loop(list, callback, result = []) {
13
- return __awaiter(this, void 0, void 0, function* () {
12
+ function loop(list_1, callback_1) {
13
+ return __awaiter(this, arguments, void 0, function* (list, callback, result = []) {
14
14
  if (list && list.length > 0) {
15
15
  const [head, ...tail] = list;
16
16
  return loop(tail, callback, [yield callback(head), ...result]);
@@ -9,8 +9,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
9
9
  });
10
10
  };
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
- function loop(list, callback, result = []) {
13
- return __awaiter(this, void 0, void 0, function* () {
12
+ function loop(list_1, callback_1) {
13
+ return __awaiter(this, arguments, void 0, function* (list, callback, result = []) {
14
14
  if (list && list.length > 0) {
15
15
  const [head, ...tail] = list;
16
16
  return loop(tail, callback, [...result, yield callback(head)]);
@@ -1,5 +1,3 @@
1
- /// <reference types="node" />
2
- /// <reference types="node" />
3
1
  import IReadExcel from '../interface/read.excel.interface';
4
2
  declare function readExcel(file: Buffer, data: IReadExcel): Promise<any>;
5
3
  export default readExcel;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@provis/provis-common-be-module",
3
- "version": "2.6.95",
3
+ "version": "2.6.96",
4
4
  "description": "This common module for Provis internal backend use lib",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {
@@ -1,8 +0,0 @@
1
- declare const bankAccount: {
2
- code: string;
3
- desc: {
4
- id: string;
5
- en: string;
6
- };
7
- }[];
8
- export default bankAccount;
@@ -1,54 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const bankAccount = [
4
- {
5
- code: 'BCA2000',
6
- desc: {
7
- id: 'BCA 5455682000',
8
- en: 'BCA 5455682000',
9
- }
10
- },
11
- {
12
- code: 'BCA2999',
13
- desc: {
14
- id: 'BCA 5455682999',
15
- en: 'BCA 5455682999',
16
- }
17
- },
18
- {
19
- code: 'OCBC371-IDR',
20
- desc: {
21
- id: 'OCBC IDR 111800004371',
22
- en: 'OCBC IDR 111800004371',
23
- }
24
- },
25
- {
26
- code: 'OCBC371-USD',
27
- desc: {
28
- id: 'OCBC USD 111800004371',
29
- en: 'OCBC USD 111800004371',
30
- }
31
- },
32
- {
33
- code: 'PERMATA4371',
34
- desc: {
35
- id: 'Permata 0980-9340-683',
36
- en: 'Permata 0980-9340-683',
37
- }
38
- },
39
- {
40
- code: 'PERMATA4371',
41
- desc: {
42
- id: 'QNB 1220-004544-001',
43
- en: 'QNB 1220-004544-001',
44
- }
45
- },
46
- {
47
- code: 'BTPN3068',
48
- desc: {
49
- id: 'BTPN Syariah 1035883068',
50
- en: 'BTPN Syariah 1035883068',
51
- }
52
- },
53
- ];
54
- exports.default = bankAccount;
@@ -1,39 +0,0 @@
1
- declare const cargo: {
2
- STATUS: {
3
- DRAFT: string;
4
- SUBMITED: string;
5
- PAID: string;
6
- CANCEL: string;
7
- };
8
- TYPE: {
9
- TYPE_ICCA_INV: {
10
- code: string;
11
- desc: {
12
- id: string;
13
- en: string;
14
- };
15
- };
16
- TYPE_ICCC_INV: {
17
- code: string;
18
- desc: {
19
- id: string;
20
- en: string;
21
- };
22
- };
23
- TYPE_ICCA_FLB: {
24
- code: string;
25
- desc: {
26
- id: string;
27
- en: string;
28
- };
29
- };
30
- TYPE_ICCC_FLB: {
31
- code: string;
32
- desc: {
33
- id: string;
34
- en: string;
35
- };
36
- };
37
- };
38
- };
39
- export default cargo;
@@ -1,41 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const cargo = {
4
- STATUS: {
5
- DRAFT: '0',
6
- SUBMITED: '100',
7
- PAID: '200',
8
- CANCEL: '300',
9
- },
10
- TYPE: {
11
- TYPE_ICCA_INV: {
12
- code: 'ICCA-INV',
13
- desc: {
14
- id: '',
15
- en: 'Institute Cargo Clause (A) 01/01/09 - Invoice value +10%',
16
- },
17
- },
18
- TYPE_ICCC_INV: {
19
- code: 'ICCC-INV',
20
- desc: {
21
- id: '',
22
- en: 'Institute Cargo Clause (C) 01/01/09 - Invoice value +10%',
23
- },
24
- },
25
- TYPE_ICCA_FLB: {
26
- code: 'ICCA-FLB',
27
- desc: {
28
- id: '',
29
- en: 'Institute Cargo Clause (A) 01/01/09 - First Loss Basis',
30
- },
31
- },
32
- TYPE_ICCC_FLB: {
33
- code: 'ICCC-FLB',
34
- desc: {
35
- id: '',
36
- en: 'Institute Cargo Clause (C) 01/01/09 - First Loss Basis',
37
- },
38
- },
39
- }
40
- };
41
- exports.default = cargo;
@@ -1,12 +0,0 @@
1
- declare const coretax: {
2
- STATUS: {
3
- DRAFT: string;
4
- SUBMIT: string;
5
- CANCEL: string;
6
- };
7
- TYPE_CORETAX: {
8
- CREATE: string;
9
- UPDATE: string;
10
- };
11
- };
12
- export default coretax;
@@ -1,14 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const coretax = {
4
- STATUS: {
5
- DRAFT: "0",
6
- SUBMIT: "100",
7
- CANCEL: "300",
8
- },
9
- TYPE_CORETAX: {
10
- CREATE: "CREATE",
11
- UPDATE: "UPDATE"
12
- },
13
- };
14
- exports.default = coretax;
@@ -1,30 +0,0 @@
1
- declare const insuranceType: {
2
- code: string;
3
- desc: {
4
- id: string;
5
- en: string;
6
- };
7
- }[];
8
- declare const regionCode: {
9
- code: string;
10
- desc: {
11
- id: string;
12
- en: string;
13
- };
14
- }[];
15
- declare const vehicleTypeCode: {
16
- code: string;
17
- desc: {
18
- id: string;
19
- en: string;
20
- };
21
- }[];
22
- declare const additionalCoverage: {
23
- code: string;
24
- desc: {
25
- id: string;
26
- en: string;
27
- };
28
- isVisible: boolean;
29
- }[];
30
- export { insuranceType, regionCode, vehicleTypeCode, additionalCoverage, };
@@ -1,158 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.additionalCoverage = exports.vehicleTypeCode = exports.regionCode = exports.insuranceType = void 0;
4
- const insuranceType = [
5
- {
6
- code: "all-risk",
7
- desc: {
8
- id: "Komprehensif",
9
- en: "Comprehensive",
10
- },
11
- },
12
- {
13
- code: "total-loss",
14
- desc: {
15
- id: "Kerugian Total",
16
- en: "Total Loss",
17
- },
18
- },
19
- ];
20
- exports.insuranceType = insuranceType;
21
- const regionCode = [
22
- {
23
- code: "RC001",
24
- desc: {
25
- id: "Wilayah 1",
26
- en: "Region 1",
27
- },
28
- },
29
- {
30
- code: "RC002",
31
- desc: {
32
- id: "Wilayah 2",
33
- en: "Region 2",
34
- },
35
- },
36
- {
37
- code: "RC003",
38
- desc: {
39
- id: "Wilayah 3",
40
- en: "Region 3",
41
- },
42
- },
43
- ];
44
- exports.regionCode = regionCode;
45
- const vehicleTypeCode = [
46
- {
47
- code: "VT001",
48
- desc: {
49
- id: "Jenis Kendaraan Non Bus dan Non Truk",
50
- en: "Types of Non-Bus and Non-Truck Vehicles",
51
- },
52
- },
53
- {
54
- code: "VT002",
55
- desc: {
56
- id: "Jenis Kendaraan Truk dan Pickup",
57
- en: "Vehicle Types Truck and Pickup",
58
- },
59
- },
60
- {
61
- code: "VT003",
62
- desc: {
63
- id: "Jenis Kendaraan Bus",
64
- en: "Vehicle Types Bus",
65
- },
66
- },
67
- {
68
- code: "VT004",
69
- desc: {
70
- id: "Jenis Kendaraan Roda 2 (dua)",
71
- en: "Type of 2 (two) Wheeled Vehicle",
72
- },
73
- },
74
- ];
75
- exports.vehicleTypeCode = vehicleTypeCode;
76
- const additionalCoverage = [
77
- {
78
- code: "TSFWD",
79
- desc: {
80
- id: "Topan, Badai, Banjir, Kerusakan Akibat Air",
81
- en: "Typhoon, Storm, Flood, Water Damage",
82
- },
83
- isVisible: true,
84
- },
85
- {
86
- code: "EQVET",
87
- desc: {
88
- id: "Gempa Bumi, Letusan Gunung Berapi dan Tsunami",
89
- en: "Earthquake, Volcanic Eruption and Tsunami",
90
- },
91
- isVisible: true,
92
- },
93
- {
94
- code: "SRCC",
95
- desc: {
96
- id: "Mogok Kerja, Kerusuhan dan Kerusuhan Sipil",
97
- en: "Strike, Riot & Civil Commotion",
98
- },
99
- isVisible: true,
100
- },
101
- {
102
- code: "PSATSI",
103
- desc: {
104
- id: "Terorisme dan Sabotase",
105
- en: "Terrorism and Sabotage",
106
- },
107
- isVisible: true,
108
- },
109
- {
110
- code: "TPL",
111
- desc: {
112
- id: "Tanggung Jawab Hukum Pihak Ketiga",
113
- en: "Third Party Liability",
114
- },
115
- isVisible: true,
116
- },
117
- {
118
- code: "PAD",
119
- desc: {
120
- id: "Kecelakaan Pengemudi",
121
- en: "Personal Accident Driver",
122
- },
123
- isVisible: true,
124
- },
125
- {
126
- code: "PAP",
127
- desc: {
128
- id: " Kcelakaan Penumpang",
129
- en: "Personal Accident Passenger",
130
- },
131
- isVisible: true,
132
- },
133
- {
134
- code: "TBOD",
135
- desc: {
136
- id: "Biaya Medis, Izin Bengkel, Tunjangan Ambulans, Ban dan Velg",
137
- en: "TBOD, Authorize Workshop, Ambulance Allowance, Tire and Wheel",
138
- },
139
- isVisible: true,
140
- },
141
- {
142
- code: "CASCO",
143
- desc: {
144
- id: "",
145
- en: "",
146
- },
147
- isVisible: false,
148
- },
149
- {
150
- code: "TLO",
151
- desc: {
152
- id: "",
153
- en: "",
154
- },
155
- isVisible: false,
156
- },
157
- ];
158
- exports.additionalCoverage = additionalCoverage;
@@ -1,5 +0,0 @@
1
- declare const ocupation: {
2
- id: number;
3
- name: string;
4
- }[];
5
- export default ocupation;