-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathindex.js
More file actions
108 lines (95 loc) · 1.99 KB
/
index.js
File metadata and controls
108 lines (95 loc) · 1.99 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
'use strict';
/*
USAGE : node calcIntervenantDomicile.js <prix> [<AEbrut>]
brut (booléen) : si le prix donné est un brut d'AE
*/
require('console.table');
const _ = require('lodash');
const TMI = 0.3;
const CSAE = 1 / (1 - 0.233) - 1;
const CSEmployee = 0.83;
var prix = +process.argv[2];
if (process.argv[3])
prix = prix * (1 - 0.233);
console.log('Prix net : ' + decimals(prix));
const cases = {
black: {
csInt: 0,
rCsIntFixed: 0,
rIRPrix: 0,
rIRCS: 0,
creditIS: 0,
direct: 1,
},
AE: {
csInt: CSAE,
rCsIntFixed: 0,
rIRPrix: 0,
rIRCS: 0,
creditIS: 0,
direct: 1,
},
'AE-SAP': {
csInt: CSAE,
rCsIntFixed: 0,
rIRPrix: 0.5,
rIRCS: 0.5,
creditIS: 0,
direct: 1,
},
CESU: {
csInt: CSEmployee,
rCsIntFixed: 2,
rIRPrix: 0.5,
rIRCS: 0.5,
creditIS: 0,
direct: 1,
},
'CESU-pre': {
csInt: CSEmployee,
rCsIntFixed: 2,
rIRPrix: 0,
rIRCS: 0.5,
creditIS: 0.25,
direct: 0,
},
'CESU-pre-post': {
csInt: CSEmployee,
rCsIntFixed: 2,
rIRPrix: 0.5,
rIRCS: 0.5,
creditIS: 0.25,
direct: 1,
},
// 'CESU-decla': {
// csInt: CSEmployee,
// rCsIntFixed: 2,
// rIRPrix: 0.5,
// rIRCS: 0.5,
// creditIS: 0.25,
// direct: 0,
// },
}
function cout(prix, type) {
const vars = cases[type];
const r = {type: type};
r.csInt = prix * vars.csInt - vars.rCsIntFixed;
r.intTotal = prix + r.csInt;
r.rIR = prix * vars.rIRPrix + r.csInt * vars.rIRCS;
r.remu = (prix * vars.direct + r.csInt - r.rIR) / (1 - TMI);
r.IR = r.remu * TMI;
r.cs = r.remu * 0.45;
r.rIS = (prix * !vars.direct + r.remu + r.cs) * 0.28 + prix * vars.creditIS;
r.cout = r.remu + r.cs - r.rIS + prix * !vars.direct;
return r;
}
function decimals(nb) {
if (_.isString(nb))
return nb;
return Math.round(nb * 100) / 100;
}
function compute(type) {
return _.mapValues(cout(prix, type), decimals);
}
const res = _.map(_.keys(cases), compute);
console.table(res);