asv-hlps 1.3.41 → 1.3.43
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.
- package/lib/cjs/estates/hlpEstate.d.ts +11 -0
- package/lib/cjs/estates/hlpEstate.js +37 -0
- package/lib/cjs/estates/index.d.ts +4 -0
- package/lib/cjs/estates/index.js +26 -0
- package/lib/cjs/estates/pipes/estate-pipe.d.ts +6 -0
- package/lib/cjs/estates/pipes/estate-pipe.js +17 -0
- package/lib/cjs/estates/pipes/list-estate-pipe.d.ts +6 -0
- package/lib/cjs/estates/pipes/list-estate-pipe.js +17 -0
- package/lib/cjs/index.d.ts +1 -1
- package/lib/cjs/index.js +1 -1
- package/lib/cjs/salaries/Salary.d.ts +7 -0
- package/lib/cjs/salaries/Salary.js +2 -0
- package/lib/cjs/salaries/SalaryScale.d.ts +25 -0
- package/lib/cjs/salaries/SalaryScale.js +2 -0
- package/lib/cjs/salaries/hlpSalary.d.ts +45 -0
- package/lib/cjs/salaries/hlpSalary.js +207 -0
- package/lib/cjs/salaries/index.d.ts +4 -0
- package/lib/cjs/salaries/index.js +8 -0
- package/lib/cjs/services/authService.d.ts +1 -2
- package/lib/cjs/services/authService.js +1 -3
- package/lib/esm/estates/hlpEstate.d.ts +11 -0
- package/lib/esm/estates/hlpEstate.js +35 -0
- package/lib/esm/estates/index.d.ts +4 -0
- package/lib/esm/estates/index.js +4 -0
- package/lib/esm/estates/pipes/estate-pipe.d.ts +6 -0
- package/lib/esm/estates/pipes/estate-pipe.js +12 -0
- package/lib/esm/estates/pipes/list-estate-pipe.d.ts +6 -0
- package/lib/esm/estates/pipes/list-estate-pipe.js +12 -0
- package/lib/esm/index.d.ts +1 -1
- package/lib/esm/index.js +1 -1
- package/lib/esm/salaries/Salary.d.ts +7 -0
- package/lib/esm/salaries/Salary.js +1 -0
- package/lib/esm/salaries/SalaryScale.d.ts +25 -0
- package/lib/esm/salaries/SalaryScale.js +1 -0
- package/lib/esm/salaries/hlpSalary.d.ts +45 -0
- package/lib/esm/salaries/hlpSalary.js +205 -0
- package/lib/esm/salaries/index.d.ts +4 -0
- package/lib/esm/salaries/index.js +2 -0
- package/lib/esm/services/authService.d.ts +1 -2
- package/lib/esm/services/authService.js +1 -3
- package/package.json +1 -1
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Estate } from "../models/estates/Estate";
|
|
2
|
+
import { Housing } from "../models/estates/Housing";
|
|
3
|
+
declare class HlpEstate {
|
|
4
|
+
nbHousings(estate: Estate): number;
|
|
5
|
+
totalHousings(estates: Estate[]): number;
|
|
6
|
+
nbLodgers(housings: Housing[]): number;
|
|
7
|
+
totalLodgers(estates: Estate[]): number;
|
|
8
|
+
address(estate: Estate): string;
|
|
9
|
+
}
|
|
10
|
+
declare const _default: HlpEstate;
|
|
11
|
+
export default _default;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
class HlpEstate {
|
|
4
|
+
nbHousings(estate) {
|
|
5
|
+
return estate.housings.length || 0;
|
|
6
|
+
}
|
|
7
|
+
totalHousings(estates) {
|
|
8
|
+
if (!estates.length) {
|
|
9
|
+
return 0;
|
|
10
|
+
}
|
|
11
|
+
let count = 0;
|
|
12
|
+
estates.map((estate) => {
|
|
13
|
+
count += this.nbHousings(estate);
|
|
14
|
+
});
|
|
15
|
+
return count;
|
|
16
|
+
}
|
|
17
|
+
nbLodgers(housings) {
|
|
18
|
+
let count = 0;
|
|
19
|
+
housings.map((housing) => {
|
|
20
|
+
if (housing.lodger) {
|
|
21
|
+
count++;
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
return count;
|
|
25
|
+
}
|
|
26
|
+
totalLodgers(estates) {
|
|
27
|
+
let count = 0;
|
|
28
|
+
estates.map((estate) => {
|
|
29
|
+
count += this.nbLodgers(estate.housings);
|
|
30
|
+
});
|
|
31
|
+
return count;
|
|
32
|
+
}
|
|
33
|
+
address(estate) {
|
|
34
|
+
return estate.region.name + ", " + estate.city.name + ", " + estate.quarter.name;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
exports.default = new HlpEstate();
|
|
@@ -0,0 +1,26 @@
|
|
|
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 __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
17
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
18
|
+
};
|
|
19
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
20
|
+
exports.ListEstatePipe = exports.HlpEstate = exports.EstatePipe = void 0;
|
|
21
|
+
const hlpEstate_1 = __importDefault(require("./hlpEstate"));
|
|
22
|
+
exports.HlpEstate = hlpEstate_1.default;
|
|
23
|
+
const estate_pipe_1 = __importDefault(require("./pipes/estate-pipe"));
|
|
24
|
+
Object.defineProperty(exports, "EstatePipe", { enumerable: true, get: function () { return estate_pipe_1.default; } });
|
|
25
|
+
Object.defineProperty(exports, "ListEstatePipe", { enumerable: true, get: function () { return estate_pipe_1.default; } });
|
|
26
|
+
__exportStar(require("../models/estates/index"), exports);
|
|
@@ -0,0 +1,17 @@
|
|
|
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
|
+
const hlpEstate_1 = __importDefault(require("../hlpEstate"));
|
|
7
|
+
class EstatePipe {
|
|
8
|
+
transform(estate, params) {
|
|
9
|
+
switch (params) {
|
|
10
|
+
case "housings":
|
|
11
|
+
return hlpEstate_1.default.nbHousings(estate);
|
|
12
|
+
case "lodgers":
|
|
13
|
+
return hlpEstate_1.default.nbLodgers(estate.housings);
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
exports.default = new EstatePipe();
|
|
@@ -0,0 +1,17 @@
|
|
|
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
|
+
const hlpEstate_1 = __importDefault(require("../hlpEstate"));
|
|
7
|
+
class ListEstatePipe {
|
|
8
|
+
transform(estates, params) {
|
|
9
|
+
switch (params) {
|
|
10
|
+
case "housings":
|
|
11
|
+
return hlpEstate_1.default.totalHousings(estates);
|
|
12
|
+
case "lodgers":
|
|
13
|
+
return hlpEstate_1.default.totalLodgers(estates);
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
exports.default = new ListEstatePipe();
|
package/lib/cjs/index.d.ts
CHANGED
|
@@ -24,7 +24,7 @@ import "./utils";
|
|
|
24
24
|
export * from "./back-end";
|
|
25
25
|
export * from "./bill";
|
|
26
26
|
export * from "./bootstrap";
|
|
27
|
-
export * from "./
|
|
27
|
+
export * from "./estates/index";
|
|
28
28
|
export * from "./models/index";
|
|
29
29
|
export * from "./npms/typeorm";
|
|
30
30
|
export * from "./npms/yup";
|
package/lib/cjs/index.js
CHANGED
|
@@ -57,7 +57,7 @@ require("./utils");
|
|
|
57
57
|
__exportStar(require("./back-end"), exports);
|
|
58
58
|
__exportStar(require("./bill"), exports);
|
|
59
59
|
__exportStar(require("./bootstrap"), exports);
|
|
60
|
-
__exportStar(require("./
|
|
60
|
+
__exportStar(require("./estates/index"), exports);
|
|
61
61
|
__exportStar(require("./models/index"), exports);
|
|
62
62
|
__exportStar(require("./npms/typeorm"), exports);
|
|
63
63
|
__exportStar(require("./npms/yup"), exports);
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { User } from "../models/users/User";
|
|
2
|
+
interface ScaleUser extends User {
|
|
3
|
+
entryDate?: string | Date;
|
|
4
|
+
}
|
|
5
|
+
export interface SalaryScale {
|
|
6
|
+
id?: number;
|
|
7
|
+
baseSalary: number;
|
|
8
|
+
cashBonus?: number;
|
|
9
|
+
dirtBonus?: number;
|
|
10
|
+
housingBonus?: number;
|
|
11
|
+
jobBonus?: number;
|
|
12
|
+
otherBonus?: number;
|
|
13
|
+
otherIrppBonus?: number;
|
|
14
|
+
personInCharge?: number;
|
|
15
|
+
reponsabilityBonus?: number;
|
|
16
|
+
debtMonthly?: number;
|
|
17
|
+
entryDate?: string | Date;
|
|
18
|
+
subSalary?: number;
|
|
19
|
+
subtitBonus?: number;
|
|
20
|
+
transportBonus?: number;
|
|
21
|
+
firstTenYearImmoInterest?: number;
|
|
22
|
+
user?: ScaleUser;
|
|
23
|
+
store?: string;
|
|
24
|
+
}
|
|
25
|
+
export {};
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { SalaryScale } from "./SalaryScale";
|
|
2
|
+
declare class HlpSalary {
|
|
3
|
+
amountIrpp: (taxableSalary: number) => number;
|
|
4
|
+
brutSalary: (tob: SalaryScale, amountSeniority: number) => number;
|
|
5
|
+
/** revenu brut = salaire brut + Autres Primes imposables à l'IRPP*/
|
|
6
|
+
brutRevenu: (brutSalary: number, otherIrppBonus: number) => number;
|
|
7
|
+
/**cnss = 4% du revenu brut */
|
|
8
|
+
cnss: (brutRevenu: number) => number;
|
|
9
|
+
employerCnss: (brutRevenu: number) => number;
|
|
10
|
+
/** salaire semi brut = revenu brut - cnss */
|
|
11
|
+
brutSemiSalary: (brutRevenu: number, cnss: number) => number;
|
|
12
|
+
/** abbatement = 28% du brutSemiSalary */
|
|
13
|
+
abbatmentSalary: (brutSemiSalary: number) => number;
|
|
14
|
+
/** brut après abbatement = salaire semi brut - abbatement */
|
|
15
|
+
brutAfterAbbatmentSalary: (brutSemiSalary: number, abbatmentSalary: number) => number;
|
|
16
|
+
/** brut après abbatement = salaire semi brut - abbatement */
|
|
17
|
+
amountPersonInCharge: (personInCharge: number) => number;
|
|
18
|
+
/** net taxable = brut après abbatement - montant persone en charge*/
|
|
19
|
+
netTaxableSalary: (brutAfterAbbatmentSalary: number, amountPersonInCharge: number) => number;
|
|
20
|
+
/** amountseniority */
|
|
21
|
+
amountSeniority: (entryDate: string | Date, baseSalary: number) => number;
|
|
22
|
+
/** inam = (salaire de base + anciennete )*3,5 */
|
|
23
|
+
healthInsurance: (baseSalary: number, amountSeniority?: number) => number;
|
|
24
|
+
/**assurance retraite complémentaire = */
|
|
25
|
+
supplementaryRetirementInsurance: () => number;
|
|
26
|
+
/** Assurance vie employé */
|
|
27
|
+
lifeInsurance: () => number;
|
|
28
|
+
/** Assurance vie des enfants à charge */
|
|
29
|
+
dependentChildrenlifeInsurance: () => number;
|
|
30
|
+
/** Dons volontaires */
|
|
31
|
+
voluntaryDonations: () => number;
|
|
32
|
+
/** Autres indemnités, Primes et rétributions, non imposable */
|
|
33
|
+
otherBonusRenumNoTaxable: (healthInsurance: number) => number;
|
|
34
|
+
otherDeductions: (firstTenYearImmoInterest?: number) => number;
|
|
35
|
+
/** Solde après les autres déductions */
|
|
36
|
+
netTaxableSalaryAllDiscount: (netTaxableSalary: number, otherDeductions: number) => number;
|
|
37
|
+
/** Base imposable arrondie */
|
|
38
|
+
netTaxableSalaryAllDiscountRounded: (netTaxableSalaryAllDiscount: number) => number | false;
|
|
39
|
+
/** net a payer = REVENU BRUT - cnss -irpp -Autres indemnités, Primes et rétributions, non impossable */
|
|
40
|
+
netSalary: (brutRevenu: number, cnss: number, amountIrpp: number, otherBonusRenumNoTaxable: number, debtMonthly: number) => number;
|
|
41
|
+
sumIrpp: (salaries: any, useSalary: any) => number;
|
|
42
|
+
sumNetSalary: (salaries: any, useSalary: any) => number;
|
|
43
|
+
}
|
|
44
|
+
declare const _default: HlpSalary;
|
|
45
|
+
export default _default;
|
|
@@ -0,0 +1,207 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const utils_1 = require("../utils");
|
|
4
|
+
var Coef;
|
|
5
|
+
(function (Coef) {
|
|
6
|
+
Coef[Coef["PT_03"] = 0.03] = "PT_03";
|
|
7
|
+
Coef[Coef["PT_10"] = 0.1] = "PT_10";
|
|
8
|
+
Coef[Coef["PT_15"] = 0.15] = "PT_15";
|
|
9
|
+
Coef[Coef["PT_20"] = 0.2] = "PT_20";
|
|
10
|
+
Coef[Coef["PT_25"] = 0.25] = "PT_25";
|
|
11
|
+
Coef[Coef["PT_30"] = 0.3] = "PT_30";
|
|
12
|
+
Coef[Coef["PT_35"] = 0.35] = "PT_35";
|
|
13
|
+
})(Coef || (Coef = {}));
|
|
14
|
+
class HlpSalary {
|
|
15
|
+
constructor() {
|
|
16
|
+
this.amountIrpp = (taxableSalary) => {
|
|
17
|
+
// const rate_0 = taxableSalary <= 75_000 && 0;
|
|
18
|
+
const rate_0 = 0;
|
|
19
|
+
const rate_03 = (250000 - 75001) * Coef.PT_03;
|
|
20
|
+
const rate_10 = rate_03 + (500000 - 250001) * Coef.PT_10;
|
|
21
|
+
const rate_15 = rate_10 + (750000 - 500001) * Coef.PT_15;
|
|
22
|
+
const rate_20 = rate_15 + (1000000 - 750001) * Coef.PT_20;
|
|
23
|
+
const rate_25 = rate_20 + (1250000 - 1000001) * Coef.PT_25;
|
|
24
|
+
const rate_30 = rate_25 + (1666667 - 1250001) * Coef.PT_30;
|
|
25
|
+
// const rate_35 = rate_30 + (taxableSalary - 1_666_667) * Coef.PT_35;
|
|
26
|
+
if (taxableSalary <= 75000) {
|
|
27
|
+
return rate_0;
|
|
28
|
+
}
|
|
29
|
+
if (taxableSalary > 75001 && taxableSalary <= 250000) {
|
|
30
|
+
return Math.floor((taxableSalary - 75001) * Coef.PT_03 + rate_0);
|
|
31
|
+
// return rate_03;
|
|
32
|
+
}
|
|
33
|
+
if (taxableSalary > 250001 && taxableSalary <= 500000) {
|
|
34
|
+
return Math.floor((taxableSalary - 250001) * Coef.PT_10 + rate_03);
|
|
35
|
+
// return rate_10;
|
|
36
|
+
}
|
|
37
|
+
if (taxableSalary > 500001 && taxableSalary <= 750000) {
|
|
38
|
+
return Math.floor((taxableSalary - 500001) * Coef.PT_15 + rate_10);
|
|
39
|
+
// return rate_15;
|
|
40
|
+
}
|
|
41
|
+
if (taxableSalary > 750001 && taxableSalary <= 1000000) {
|
|
42
|
+
return Math.floor((taxableSalary - 750001) * Coef.PT_20 + rate_15);
|
|
43
|
+
// return rate_20;
|
|
44
|
+
}
|
|
45
|
+
if (taxableSalary > 1000001 && taxableSalary <= 1250000) {
|
|
46
|
+
return Math.floor((taxableSalary - 1000001) * Coef.PT_25 + rate_20);
|
|
47
|
+
// return rate_25;
|
|
48
|
+
}
|
|
49
|
+
if (taxableSalary > 1250001 && taxableSalary <= 1666667) {
|
|
50
|
+
return Math.floor((taxableSalary - 1250001) * Coef.PT_30 + rate_25);
|
|
51
|
+
// return rate_30;
|
|
52
|
+
}
|
|
53
|
+
if (taxableSalary > 1666667) {
|
|
54
|
+
return Math.floor((taxableSalary - 1666667) * Coef.PT_35 + rate_30);
|
|
55
|
+
// return rate_35;
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
this.brutSalary = (tob, amountSeniority) => {
|
|
59
|
+
// reduce of some property of SalaryElt
|
|
60
|
+
return (+tob.baseSalary +
|
|
61
|
+
+tob.transportBonus +
|
|
62
|
+
+tob.housingBonus +
|
|
63
|
+
+tob.subSalary +
|
|
64
|
+
+tob.cashBonus +
|
|
65
|
+
+tob.dirtBonus +
|
|
66
|
+
+tob.jobBonus +
|
|
67
|
+
+tob.subtitBonus +
|
|
68
|
+
+tob.reponsabilityBonus +
|
|
69
|
+
+tob.debtMonthly +
|
|
70
|
+
+amountSeniority);
|
|
71
|
+
};
|
|
72
|
+
/** revenu brut = salaire brut + Autres Primes imposables à l'IRPP*/
|
|
73
|
+
this.brutRevenu = (brutSalary, otherIrppBonus) => {
|
|
74
|
+
// return +this.brutSalary(salary) + otherIrppBonus;
|
|
75
|
+
return Math.floor(+brutSalary + otherIrppBonus);
|
|
76
|
+
};
|
|
77
|
+
/**cnss = 4% du revenu brut */
|
|
78
|
+
this.cnss = (brutRevenu) => {
|
|
79
|
+
// return Math.floor(brutRevenu * 0.04);
|
|
80
|
+
return Math.floor(brutRevenu * 0.09);
|
|
81
|
+
};
|
|
82
|
+
this.employerCnss = (brutRevenu) => {
|
|
83
|
+
// return Math.floor(brutRevenu * 0.04);
|
|
84
|
+
// return Math.floor(brutRevenu * 0.09);
|
|
85
|
+
return Math.floor(brutRevenu * 0.225);
|
|
86
|
+
};
|
|
87
|
+
/** salaire semi brut = revenu brut - cnss */
|
|
88
|
+
this.brutSemiSalary = (brutRevenu, cnss) => {
|
|
89
|
+
return Math.floor(+brutRevenu - cnss);
|
|
90
|
+
};
|
|
91
|
+
/** abbatement = 28% du brutSemiSalary */
|
|
92
|
+
this.abbatmentSalary = (brutSemiSalary) => {
|
|
93
|
+
if (brutSemiSalary * 12 <= 10000000) {
|
|
94
|
+
return Math.floor(+brutSemiSalary * 0.28);
|
|
95
|
+
}
|
|
96
|
+
return (10000001 / 12) * 0.28;
|
|
97
|
+
};
|
|
98
|
+
/** brut après abbatement = salaire semi brut - abbatement */
|
|
99
|
+
this.brutAfterAbbatmentSalary = (brutSemiSalary, abbatmentSalary) => {
|
|
100
|
+
return Math.floor(+brutSemiSalary - abbatmentSalary);
|
|
101
|
+
};
|
|
102
|
+
/** brut après abbatement = salaire semi brut - abbatement */
|
|
103
|
+
this.amountPersonInCharge = (personInCharge) => {
|
|
104
|
+
return personInCharge * 10000 || 0;
|
|
105
|
+
};
|
|
106
|
+
/** net taxable = brut après abbatement - montant persone en charge*/
|
|
107
|
+
this.netTaxableSalary = (brutAfterAbbatmentSalary, amountPersonInCharge) => {
|
|
108
|
+
return Math.floor(brutAfterAbbatmentSalary - amountPersonInCharge);
|
|
109
|
+
};
|
|
110
|
+
/** amountseniority */
|
|
111
|
+
this.amountSeniority = (entryDate, baseSalary) => {
|
|
112
|
+
const nbMonths = (0, utils_1.dateDiff)(entryDate, "month");
|
|
113
|
+
const nbYears = (0, utils_1.dateDiff)(entryDate);
|
|
114
|
+
/** cal senority */
|
|
115
|
+
let amountSenority = 0;
|
|
116
|
+
// if (nbYears <= 2) {
|
|
117
|
+
if (nbMonths <= 24) {
|
|
118
|
+
return amountSenority;
|
|
119
|
+
}
|
|
120
|
+
else {
|
|
121
|
+
for (let index = 0; index < nbYears; index++) {
|
|
122
|
+
amountSenority += baseSalary * 0.01;
|
|
123
|
+
}
|
|
124
|
+
return Math.floor(amountSenority);
|
|
125
|
+
}
|
|
126
|
+
};
|
|
127
|
+
/* amountSeniority = (username: string, baseSalary: number) => {
|
|
128
|
+
const currentFullYear = new Date().getFullYear();
|
|
129
|
+
const currentShortYear = currentFullYear.toLocaleString().substring(3); // 2 digits
|
|
130
|
+
const entryShortYear = username?.substring(3, 5); // 2 digits;
|
|
131
|
+
const entryFullYear = entryShortYear <= currentShortYear ? `20${entryShortYear}` : `19${entryShortYear}`;
|
|
132
|
+
const seniority = currentFullYear - parseInt(entryFullYear);
|
|
133
|
+
let amountSenority: number = 0;
|
|
134
|
+
for (let index = 1; index < seniority + 1; index++) {
|
|
135
|
+
if (index <= 2) {
|
|
136
|
+
amountSenority = 0;
|
|
137
|
+
} else if (index === 3) {
|
|
138
|
+
amountSenority += baseSalary * 0.02;
|
|
139
|
+
} else {
|
|
140
|
+
amountSenority += baseSalary * 0.01;
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
return Math.floor(amountSenority);
|
|
144
|
+
}; */
|
|
145
|
+
/** inam = (salaire de base + anciennete )*3,5 */
|
|
146
|
+
// healthInsurance = (baseSalary: number, seniority: number = 0) => {
|
|
147
|
+
this.healthInsurance = (baseSalary, amountSeniority = 0) => {
|
|
148
|
+
return Math.floor(+((baseSalary + amountSeniority) * 0.035));
|
|
149
|
+
};
|
|
150
|
+
/**assurance retraite complémentaire = */
|
|
151
|
+
this.supplementaryRetirementInsurance = () => {
|
|
152
|
+
return Math.floor(0);
|
|
153
|
+
};
|
|
154
|
+
/** Assurance vie employé */
|
|
155
|
+
this.lifeInsurance = () => {
|
|
156
|
+
return Math.floor(0);
|
|
157
|
+
};
|
|
158
|
+
/** Assurance vie des enfants à charge */
|
|
159
|
+
this.dependentChildrenlifeInsurance = () => {
|
|
160
|
+
return Math.floor(0);
|
|
161
|
+
};
|
|
162
|
+
/** Dons volontaires */
|
|
163
|
+
this.voluntaryDonations = () => {
|
|
164
|
+
return Math.floor(0);
|
|
165
|
+
};
|
|
166
|
+
/** Autres indemnités, Primes et rétributions, non imposable */
|
|
167
|
+
this.otherBonusRenumNoTaxable = (healthInsurance) => {
|
|
168
|
+
return Math.floor(healthInsurance);
|
|
169
|
+
};
|
|
170
|
+
this.otherDeductions = (firstTenYearImmoInterest = 0) => {
|
|
171
|
+
return (this.voluntaryDonations() +
|
|
172
|
+
this.dependentChildrenlifeInsurance() +
|
|
173
|
+
this.lifeInsurance() +
|
|
174
|
+
this.supplementaryRetirementInsurance() +
|
|
175
|
+
firstTenYearImmoInterest);
|
|
176
|
+
};
|
|
177
|
+
/** Solde après les autres déductions */
|
|
178
|
+
this.netTaxableSalaryAllDiscount = (netTaxableSalary, otherDeductions) => {
|
|
179
|
+
return Math.floor(netTaxableSalary - otherDeductions);
|
|
180
|
+
};
|
|
181
|
+
/** Base imposable arrondie */
|
|
182
|
+
this.netTaxableSalaryAllDiscountRounded = (netTaxableSalaryAllDiscount) => {
|
|
183
|
+
return (0, utils_1.roundLastNDigits)(netTaxableSalaryAllDiscount);
|
|
184
|
+
};
|
|
185
|
+
/** net a payer = REVENU BRUT - cnss -irpp -Autres indemnités, Primes et rétributions, non impossable */
|
|
186
|
+
this.netSalary = (brutRevenu, cnss, amountIrpp, otherBonusRenumNoTaxable, debtMonthly) => {
|
|
187
|
+
return Math.floor(brutRevenu - (cnss + amountIrpp + otherBonusRenumNoTaxable + debtMonthly));
|
|
188
|
+
};
|
|
189
|
+
this.sumIrpp = (salaries, useSalary) => {
|
|
190
|
+
let sumIrpp = 0;
|
|
191
|
+
for (const tob of salaries) {
|
|
192
|
+
const { amountIrpp } = useSalary(tob);
|
|
193
|
+
sumIrpp += amountIrpp;
|
|
194
|
+
}
|
|
195
|
+
return sumIrpp;
|
|
196
|
+
};
|
|
197
|
+
this.sumNetSalary = (salaries, useSalary) => {
|
|
198
|
+
let sumNetSalary = 0;
|
|
199
|
+
for (const tob of salaries) {
|
|
200
|
+
const { netSalary } = useSalary(tob);
|
|
201
|
+
sumNetSalary += netSalary;
|
|
202
|
+
}
|
|
203
|
+
return sumNetSalary;
|
|
204
|
+
};
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
exports.default = new HlpSalary();
|
|
@@ -0,0 +1,8 @@
|
|
|
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.HlpSalary = void 0;
|
|
7
|
+
const hlpSalary_1 = __importDefault(require("./hlpSalary"));
|
|
8
|
+
exports.HlpSalary = hlpSalary_1.default;
|
|
@@ -6,8 +6,7 @@ type LoginType = {
|
|
|
6
6
|
export declare class AuthService {
|
|
7
7
|
tokenKey: string;
|
|
8
8
|
authStes: string[];
|
|
9
|
-
|
|
10
|
-
constructor(tokenkey: string, authStes: string[], capacitor?: boolean);
|
|
9
|
+
constructor(tokenkey: string, authStes: string[]);
|
|
11
10
|
getStorageToken: (param?: "local") => string;
|
|
12
11
|
setStorageToken: (jwt: any) => any;
|
|
13
12
|
decodeToken: () => unknown;
|
|
@@ -17,10 +17,9 @@ const jwt_decode_1 = __importDefault(require("jwt-decode"));
|
|
|
17
17
|
const auth_1 = require("../auth");
|
|
18
18
|
const storageService_1 = __importDefault(require("./storageService"));
|
|
19
19
|
class AuthService {
|
|
20
|
-
constructor(tokenkey, authStes
|
|
20
|
+
constructor(tokenkey, authStes) {
|
|
21
21
|
this.tokenKey = "";
|
|
22
22
|
this.authStes = [];
|
|
23
|
-
this.capacitor = false;
|
|
24
23
|
// getStorageToken = (tokenKey, local = false) => {
|
|
25
24
|
this.getStorageToken = (param) => {
|
|
26
25
|
if (!this.tokenKey) {
|
|
@@ -96,7 +95,6 @@ class AuthService {
|
|
|
96
95
|
};
|
|
97
96
|
this.tokenKey = tokenkey;
|
|
98
97
|
this.authStes = authStes;
|
|
99
|
-
capacitor = capacitor;
|
|
100
98
|
}
|
|
101
99
|
}
|
|
102
100
|
exports.AuthService = AuthService;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Estate } from "../models/estates/Estate";
|
|
2
|
+
import { Housing } from "../models/estates/Housing";
|
|
3
|
+
declare class HlpEstate {
|
|
4
|
+
nbHousings(estate: Estate): number;
|
|
5
|
+
totalHousings(estates: Estate[]): number;
|
|
6
|
+
nbLodgers(housings: Housing[]): number;
|
|
7
|
+
totalLodgers(estates: Estate[]): number;
|
|
8
|
+
address(estate: Estate): string;
|
|
9
|
+
}
|
|
10
|
+
declare const _default: HlpEstate;
|
|
11
|
+
export default _default;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
class HlpEstate {
|
|
2
|
+
nbHousings(estate) {
|
|
3
|
+
return estate.housings.length || 0;
|
|
4
|
+
}
|
|
5
|
+
totalHousings(estates) {
|
|
6
|
+
if (!estates.length) {
|
|
7
|
+
return 0;
|
|
8
|
+
}
|
|
9
|
+
let count = 0;
|
|
10
|
+
estates.map((estate) => {
|
|
11
|
+
count += this.nbHousings(estate);
|
|
12
|
+
});
|
|
13
|
+
return count;
|
|
14
|
+
}
|
|
15
|
+
nbLodgers(housings) {
|
|
16
|
+
let count = 0;
|
|
17
|
+
housings.map((housing) => {
|
|
18
|
+
if (housing.lodger) {
|
|
19
|
+
count++;
|
|
20
|
+
}
|
|
21
|
+
});
|
|
22
|
+
return count;
|
|
23
|
+
}
|
|
24
|
+
totalLodgers(estates) {
|
|
25
|
+
let count = 0;
|
|
26
|
+
estates.map((estate) => {
|
|
27
|
+
count += this.nbLodgers(estate.housings);
|
|
28
|
+
});
|
|
29
|
+
return count;
|
|
30
|
+
}
|
|
31
|
+
address(estate) {
|
|
32
|
+
return estate.region.name + ", " + estate.city.name + ", " + estate.quarter.name;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
export default new HlpEstate();
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import HlpEstate from "../hlpEstate";
|
|
2
|
+
class EstatePipe {
|
|
3
|
+
transform(estate, params) {
|
|
4
|
+
switch (params) {
|
|
5
|
+
case "housings":
|
|
6
|
+
return HlpEstate.nbHousings(estate);
|
|
7
|
+
case "lodgers":
|
|
8
|
+
return HlpEstate.nbLodgers(estate.housings);
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
export default new EstatePipe();
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import HlpEstate from "../hlpEstate";
|
|
2
|
+
class ListEstatePipe {
|
|
3
|
+
transform(estates, params) {
|
|
4
|
+
switch (params) {
|
|
5
|
+
case "housings":
|
|
6
|
+
return HlpEstate.totalHousings(estates);
|
|
7
|
+
case "lodgers":
|
|
8
|
+
return HlpEstate.totalLodgers(estates);
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
export default new ListEstatePipe();
|
package/lib/esm/index.d.ts
CHANGED
|
@@ -24,7 +24,7 @@ import "./utils";
|
|
|
24
24
|
export * from "./back-end";
|
|
25
25
|
export * from "./bill";
|
|
26
26
|
export * from "./bootstrap";
|
|
27
|
-
export * from "./
|
|
27
|
+
export * from "./estates/index";
|
|
28
28
|
export * from "./models/index";
|
|
29
29
|
export * from "./npms/typeorm";
|
|
30
30
|
export * from "./npms/yup";
|
package/lib/esm/index.js
CHANGED
|
@@ -29,7 +29,7 @@ import "./utils";
|
|
|
29
29
|
export * from "./back-end";
|
|
30
30
|
export * from "./bill";
|
|
31
31
|
export * from "./bootstrap";
|
|
32
|
-
export * from "./
|
|
32
|
+
export * from "./estates/index";
|
|
33
33
|
export * from "./models/index";
|
|
34
34
|
export * from "./npms/typeorm";
|
|
35
35
|
export * from "./npms/yup";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { User } from "../models/users/User";
|
|
2
|
+
interface ScaleUser extends User {
|
|
3
|
+
entryDate?: string | Date;
|
|
4
|
+
}
|
|
5
|
+
export interface SalaryScale {
|
|
6
|
+
id?: number;
|
|
7
|
+
baseSalary: number;
|
|
8
|
+
cashBonus?: number;
|
|
9
|
+
dirtBonus?: number;
|
|
10
|
+
housingBonus?: number;
|
|
11
|
+
jobBonus?: number;
|
|
12
|
+
otherBonus?: number;
|
|
13
|
+
otherIrppBonus?: number;
|
|
14
|
+
personInCharge?: number;
|
|
15
|
+
reponsabilityBonus?: number;
|
|
16
|
+
debtMonthly?: number;
|
|
17
|
+
entryDate?: string | Date;
|
|
18
|
+
subSalary?: number;
|
|
19
|
+
subtitBonus?: number;
|
|
20
|
+
transportBonus?: number;
|
|
21
|
+
firstTenYearImmoInterest?: number;
|
|
22
|
+
user?: ScaleUser;
|
|
23
|
+
store?: string;
|
|
24
|
+
}
|
|
25
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { SalaryScale } from "./SalaryScale";
|
|
2
|
+
declare class HlpSalary {
|
|
3
|
+
amountIrpp: (taxableSalary: number) => number;
|
|
4
|
+
brutSalary: (tob: SalaryScale, amountSeniority: number) => number;
|
|
5
|
+
/** revenu brut = salaire brut + Autres Primes imposables à l'IRPP*/
|
|
6
|
+
brutRevenu: (brutSalary: number, otherIrppBonus: number) => number;
|
|
7
|
+
/**cnss = 4% du revenu brut */
|
|
8
|
+
cnss: (brutRevenu: number) => number;
|
|
9
|
+
employerCnss: (brutRevenu: number) => number;
|
|
10
|
+
/** salaire semi brut = revenu brut - cnss */
|
|
11
|
+
brutSemiSalary: (brutRevenu: number, cnss: number) => number;
|
|
12
|
+
/** abbatement = 28% du brutSemiSalary */
|
|
13
|
+
abbatmentSalary: (brutSemiSalary: number) => number;
|
|
14
|
+
/** brut après abbatement = salaire semi brut - abbatement */
|
|
15
|
+
brutAfterAbbatmentSalary: (brutSemiSalary: number, abbatmentSalary: number) => number;
|
|
16
|
+
/** brut après abbatement = salaire semi brut - abbatement */
|
|
17
|
+
amountPersonInCharge: (personInCharge: number) => number;
|
|
18
|
+
/** net taxable = brut après abbatement - montant persone en charge*/
|
|
19
|
+
netTaxableSalary: (brutAfterAbbatmentSalary: number, amountPersonInCharge: number) => number;
|
|
20
|
+
/** amountseniority */
|
|
21
|
+
amountSeniority: (entryDate: string | Date, baseSalary: number) => number;
|
|
22
|
+
/** inam = (salaire de base + anciennete )*3,5 */
|
|
23
|
+
healthInsurance: (baseSalary: number, amountSeniority?: number) => number;
|
|
24
|
+
/**assurance retraite complémentaire = */
|
|
25
|
+
supplementaryRetirementInsurance: () => number;
|
|
26
|
+
/** Assurance vie employé */
|
|
27
|
+
lifeInsurance: () => number;
|
|
28
|
+
/** Assurance vie des enfants à charge */
|
|
29
|
+
dependentChildrenlifeInsurance: () => number;
|
|
30
|
+
/** Dons volontaires */
|
|
31
|
+
voluntaryDonations: () => number;
|
|
32
|
+
/** Autres indemnités, Primes et rétributions, non imposable */
|
|
33
|
+
otherBonusRenumNoTaxable: (healthInsurance: number) => number;
|
|
34
|
+
otherDeductions: (firstTenYearImmoInterest?: number) => number;
|
|
35
|
+
/** Solde après les autres déductions */
|
|
36
|
+
netTaxableSalaryAllDiscount: (netTaxableSalary: number, otherDeductions: number) => number;
|
|
37
|
+
/** Base imposable arrondie */
|
|
38
|
+
netTaxableSalaryAllDiscountRounded: (netTaxableSalaryAllDiscount: number) => number | false;
|
|
39
|
+
/** net a payer = REVENU BRUT - cnss -irpp -Autres indemnités, Primes et rétributions, non impossable */
|
|
40
|
+
netSalary: (brutRevenu: number, cnss: number, amountIrpp: number, otherBonusRenumNoTaxable: number, debtMonthly: number) => number;
|
|
41
|
+
sumIrpp: (salaries: any, useSalary: any) => number;
|
|
42
|
+
sumNetSalary: (salaries: any, useSalary: any) => number;
|
|
43
|
+
}
|
|
44
|
+
declare const _default: HlpSalary;
|
|
45
|
+
export default _default;
|
|
@@ -0,0 +1,205 @@
|
|
|
1
|
+
import { dateDiff, roundLastNDigits } from "../utils";
|
|
2
|
+
var Coef;
|
|
3
|
+
(function (Coef) {
|
|
4
|
+
Coef[Coef["PT_03"] = 0.03] = "PT_03";
|
|
5
|
+
Coef[Coef["PT_10"] = 0.1] = "PT_10";
|
|
6
|
+
Coef[Coef["PT_15"] = 0.15] = "PT_15";
|
|
7
|
+
Coef[Coef["PT_20"] = 0.2] = "PT_20";
|
|
8
|
+
Coef[Coef["PT_25"] = 0.25] = "PT_25";
|
|
9
|
+
Coef[Coef["PT_30"] = 0.3] = "PT_30";
|
|
10
|
+
Coef[Coef["PT_35"] = 0.35] = "PT_35";
|
|
11
|
+
})(Coef || (Coef = {}));
|
|
12
|
+
class HlpSalary {
|
|
13
|
+
constructor() {
|
|
14
|
+
this.amountIrpp = (taxableSalary) => {
|
|
15
|
+
// const rate_0 = taxableSalary <= 75_000 && 0;
|
|
16
|
+
const rate_0 = 0;
|
|
17
|
+
const rate_03 = (250000 - 75001) * Coef.PT_03;
|
|
18
|
+
const rate_10 = rate_03 + (500000 - 250001) * Coef.PT_10;
|
|
19
|
+
const rate_15 = rate_10 + (750000 - 500001) * Coef.PT_15;
|
|
20
|
+
const rate_20 = rate_15 + (1000000 - 750001) * Coef.PT_20;
|
|
21
|
+
const rate_25 = rate_20 + (1250000 - 1000001) * Coef.PT_25;
|
|
22
|
+
const rate_30 = rate_25 + (1666667 - 1250001) * Coef.PT_30;
|
|
23
|
+
// const rate_35 = rate_30 + (taxableSalary - 1_666_667) * Coef.PT_35;
|
|
24
|
+
if (taxableSalary <= 75000) {
|
|
25
|
+
return rate_0;
|
|
26
|
+
}
|
|
27
|
+
if (taxableSalary > 75001 && taxableSalary <= 250000) {
|
|
28
|
+
return Math.floor((taxableSalary - 75001) * Coef.PT_03 + rate_0);
|
|
29
|
+
// return rate_03;
|
|
30
|
+
}
|
|
31
|
+
if (taxableSalary > 250001 && taxableSalary <= 500000) {
|
|
32
|
+
return Math.floor((taxableSalary - 250001) * Coef.PT_10 + rate_03);
|
|
33
|
+
// return rate_10;
|
|
34
|
+
}
|
|
35
|
+
if (taxableSalary > 500001 && taxableSalary <= 750000) {
|
|
36
|
+
return Math.floor((taxableSalary - 500001) * Coef.PT_15 + rate_10);
|
|
37
|
+
// return rate_15;
|
|
38
|
+
}
|
|
39
|
+
if (taxableSalary > 750001 && taxableSalary <= 1000000) {
|
|
40
|
+
return Math.floor((taxableSalary - 750001) * Coef.PT_20 + rate_15);
|
|
41
|
+
// return rate_20;
|
|
42
|
+
}
|
|
43
|
+
if (taxableSalary > 1000001 && taxableSalary <= 1250000) {
|
|
44
|
+
return Math.floor((taxableSalary - 1000001) * Coef.PT_25 + rate_20);
|
|
45
|
+
// return rate_25;
|
|
46
|
+
}
|
|
47
|
+
if (taxableSalary > 1250001 && taxableSalary <= 1666667) {
|
|
48
|
+
return Math.floor((taxableSalary - 1250001) * Coef.PT_30 + rate_25);
|
|
49
|
+
// return rate_30;
|
|
50
|
+
}
|
|
51
|
+
if (taxableSalary > 1666667) {
|
|
52
|
+
return Math.floor((taxableSalary - 1666667) * Coef.PT_35 + rate_30);
|
|
53
|
+
// return rate_35;
|
|
54
|
+
}
|
|
55
|
+
};
|
|
56
|
+
this.brutSalary = (tob, amountSeniority) => {
|
|
57
|
+
// reduce of some property of SalaryElt
|
|
58
|
+
return (+tob.baseSalary +
|
|
59
|
+
+tob.transportBonus +
|
|
60
|
+
+tob.housingBonus +
|
|
61
|
+
+tob.subSalary +
|
|
62
|
+
+tob.cashBonus +
|
|
63
|
+
+tob.dirtBonus +
|
|
64
|
+
+tob.jobBonus +
|
|
65
|
+
+tob.subtitBonus +
|
|
66
|
+
+tob.reponsabilityBonus +
|
|
67
|
+
+tob.debtMonthly +
|
|
68
|
+
+amountSeniority);
|
|
69
|
+
};
|
|
70
|
+
/** revenu brut = salaire brut + Autres Primes imposables à l'IRPP*/
|
|
71
|
+
this.brutRevenu = (brutSalary, otherIrppBonus) => {
|
|
72
|
+
// return +this.brutSalary(salary) + otherIrppBonus;
|
|
73
|
+
return Math.floor(+brutSalary + otherIrppBonus);
|
|
74
|
+
};
|
|
75
|
+
/**cnss = 4% du revenu brut */
|
|
76
|
+
this.cnss = (brutRevenu) => {
|
|
77
|
+
// return Math.floor(brutRevenu * 0.04);
|
|
78
|
+
return Math.floor(brutRevenu * 0.09);
|
|
79
|
+
};
|
|
80
|
+
this.employerCnss = (brutRevenu) => {
|
|
81
|
+
// return Math.floor(brutRevenu * 0.04);
|
|
82
|
+
// return Math.floor(brutRevenu * 0.09);
|
|
83
|
+
return Math.floor(brutRevenu * 0.225);
|
|
84
|
+
};
|
|
85
|
+
/** salaire semi brut = revenu brut - cnss */
|
|
86
|
+
this.brutSemiSalary = (brutRevenu, cnss) => {
|
|
87
|
+
return Math.floor(+brutRevenu - cnss);
|
|
88
|
+
};
|
|
89
|
+
/** abbatement = 28% du brutSemiSalary */
|
|
90
|
+
this.abbatmentSalary = (brutSemiSalary) => {
|
|
91
|
+
if (brutSemiSalary * 12 <= 10000000) {
|
|
92
|
+
return Math.floor(+brutSemiSalary * 0.28);
|
|
93
|
+
}
|
|
94
|
+
return (10000001 / 12) * 0.28;
|
|
95
|
+
};
|
|
96
|
+
/** brut après abbatement = salaire semi brut - abbatement */
|
|
97
|
+
this.brutAfterAbbatmentSalary = (brutSemiSalary, abbatmentSalary) => {
|
|
98
|
+
return Math.floor(+brutSemiSalary - abbatmentSalary);
|
|
99
|
+
};
|
|
100
|
+
/** brut après abbatement = salaire semi brut - abbatement */
|
|
101
|
+
this.amountPersonInCharge = (personInCharge) => {
|
|
102
|
+
return personInCharge * 10000 || 0;
|
|
103
|
+
};
|
|
104
|
+
/** net taxable = brut après abbatement - montant persone en charge*/
|
|
105
|
+
this.netTaxableSalary = (brutAfterAbbatmentSalary, amountPersonInCharge) => {
|
|
106
|
+
return Math.floor(brutAfterAbbatmentSalary - amountPersonInCharge);
|
|
107
|
+
};
|
|
108
|
+
/** amountseniority */
|
|
109
|
+
this.amountSeniority = (entryDate, baseSalary) => {
|
|
110
|
+
const nbMonths = dateDiff(entryDate, "month");
|
|
111
|
+
const nbYears = dateDiff(entryDate);
|
|
112
|
+
/** cal senority */
|
|
113
|
+
let amountSenority = 0;
|
|
114
|
+
// if (nbYears <= 2) {
|
|
115
|
+
if (nbMonths <= 24) {
|
|
116
|
+
return amountSenority;
|
|
117
|
+
}
|
|
118
|
+
else {
|
|
119
|
+
for (let index = 0; index < nbYears; index++) {
|
|
120
|
+
amountSenority += baseSalary * 0.01;
|
|
121
|
+
}
|
|
122
|
+
return Math.floor(amountSenority);
|
|
123
|
+
}
|
|
124
|
+
};
|
|
125
|
+
/* amountSeniority = (username: string, baseSalary: number) => {
|
|
126
|
+
const currentFullYear = new Date().getFullYear();
|
|
127
|
+
const currentShortYear = currentFullYear.toLocaleString().substring(3); // 2 digits
|
|
128
|
+
const entryShortYear = username?.substring(3, 5); // 2 digits;
|
|
129
|
+
const entryFullYear = entryShortYear <= currentShortYear ? `20${entryShortYear}` : `19${entryShortYear}`;
|
|
130
|
+
const seniority = currentFullYear - parseInt(entryFullYear);
|
|
131
|
+
let amountSenority: number = 0;
|
|
132
|
+
for (let index = 1; index < seniority + 1; index++) {
|
|
133
|
+
if (index <= 2) {
|
|
134
|
+
amountSenority = 0;
|
|
135
|
+
} else if (index === 3) {
|
|
136
|
+
amountSenority += baseSalary * 0.02;
|
|
137
|
+
} else {
|
|
138
|
+
amountSenority += baseSalary * 0.01;
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
return Math.floor(amountSenority);
|
|
142
|
+
}; */
|
|
143
|
+
/** inam = (salaire de base + anciennete )*3,5 */
|
|
144
|
+
// healthInsurance = (baseSalary: number, seniority: number = 0) => {
|
|
145
|
+
this.healthInsurance = (baseSalary, amountSeniority = 0) => {
|
|
146
|
+
return Math.floor(+((baseSalary + amountSeniority) * 0.035));
|
|
147
|
+
};
|
|
148
|
+
/**assurance retraite complémentaire = */
|
|
149
|
+
this.supplementaryRetirementInsurance = () => {
|
|
150
|
+
return Math.floor(0);
|
|
151
|
+
};
|
|
152
|
+
/** Assurance vie employé */
|
|
153
|
+
this.lifeInsurance = () => {
|
|
154
|
+
return Math.floor(0);
|
|
155
|
+
};
|
|
156
|
+
/** Assurance vie des enfants à charge */
|
|
157
|
+
this.dependentChildrenlifeInsurance = () => {
|
|
158
|
+
return Math.floor(0);
|
|
159
|
+
};
|
|
160
|
+
/** Dons volontaires */
|
|
161
|
+
this.voluntaryDonations = () => {
|
|
162
|
+
return Math.floor(0);
|
|
163
|
+
};
|
|
164
|
+
/** Autres indemnités, Primes et rétributions, non imposable */
|
|
165
|
+
this.otherBonusRenumNoTaxable = (healthInsurance) => {
|
|
166
|
+
return Math.floor(healthInsurance);
|
|
167
|
+
};
|
|
168
|
+
this.otherDeductions = (firstTenYearImmoInterest = 0) => {
|
|
169
|
+
return (this.voluntaryDonations() +
|
|
170
|
+
this.dependentChildrenlifeInsurance() +
|
|
171
|
+
this.lifeInsurance() +
|
|
172
|
+
this.supplementaryRetirementInsurance() +
|
|
173
|
+
firstTenYearImmoInterest);
|
|
174
|
+
};
|
|
175
|
+
/** Solde après les autres déductions */
|
|
176
|
+
this.netTaxableSalaryAllDiscount = (netTaxableSalary, otherDeductions) => {
|
|
177
|
+
return Math.floor(netTaxableSalary - otherDeductions);
|
|
178
|
+
};
|
|
179
|
+
/** Base imposable arrondie */
|
|
180
|
+
this.netTaxableSalaryAllDiscountRounded = (netTaxableSalaryAllDiscount) => {
|
|
181
|
+
return roundLastNDigits(netTaxableSalaryAllDiscount);
|
|
182
|
+
};
|
|
183
|
+
/** net a payer = REVENU BRUT - cnss -irpp -Autres indemnités, Primes et rétributions, non impossable */
|
|
184
|
+
this.netSalary = (brutRevenu, cnss, amountIrpp, otherBonusRenumNoTaxable, debtMonthly) => {
|
|
185
|
+
return Math.floor(brutRevenu - (cnss + amountIrpp + otherBonusRenumNoTaxable + debtMonthly));
|
|
186
|
+
};
|
|
187
|
+
this.sumIrpp = (salaries, useSalary) => {
|
|
188
|
+
let sumIrpp = 0;
|
|
189
|
+
for (const tob of salaries) {
|
|
190
|
+
const { amountIrpp } = useSalary(tob);
|
|
191
|
+
sumIrpp += amountIrpp;
|
|
192
|
+
}
|
|
193
|
+
return sumIrpp;
|
|
194
|
+
};
|
|
195
|
+
this.sumNetSalary = (salaries, useSalary) => {
|
|
196
|
+
let sumNetSalary = 0;
|
|
197
|
+
for (const tob of salaries) {
|
|
198
|
+
const { netSalary } = useSalary(tob);
|
|
199
|
+
sumNetSalary += netSalary;
|
|
200
|
+
}
|
|
201
|
+
return sumNetSalary;
|
|
202
|
+
};
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
export default new HlpSalary();
|
|
@@ -6,8 +6,7 @@ type LoginType = {
|
|
|
6
6
|
export declare class AuthService {
|
|
7
7
|
tokenKey: string;
|
|
8
8
|
authStes: string[];
|
|
9
|
-
|
|
10
|
-
constructor(tokenkey: string, authStes: string[], capacitor?: boolean);
|
|
9
|
+
constructor(tokenkey: string, authStes: string[]);
|
|
11
10
|
getStorageToken: (param?: "local") => string;
|
|
12
11
|
setStorageToken: (jwt: any) => any;
|
|
13
12
|
decodeToken: () => unknown;
|
|
@@ -11,10 +11,9 @@ import jwtDecode from "jwt-decode";
|
|
|
11
11
|
import { getAuth } from "../auth";
|
|
12
12
|
import storageService from "./storageService";
|
|
13
13
|
export class AuthService {
|
|
14
|
-
constructor(tokenkey, authStes
|
|
14
|
+
constructor(tokenkey, authStes) {
|
|
15
15
|
this.tokenKey = "";
|
|
16
16
|
this.authStes = [];
|
|
17
|
-
this.capacitor = false;
|
|
18
17
|
// getStorageToken = (tokenKey, local = false) => {
|
|
19
18
|
this.getStorageToken = (param) => {
|
|
20
19
|
if (!this.tokenKey) {
|
|
@@ -90,7 +89,6 @@ export class AuthService {
|
|
|
90
89
|
};
|
|
91
90
|
this.tokenKey = tokenkey;
|
|
92
91
|
this.authStes = authStes;
|
|
93
|
-
capacitor = capacitor;
|
|
94
92
|
}
|
|
95
93
|
}
|
|
96
94
|
// export default new AuthService("awPharma");
|