-
Notifications
You must be signed in to change notification settings - Fork 0
/
CurrentCipav.fs
49 lines (42 loc) · 2.17 KB
/
CurrentCipav.fs
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
module CurrentCipav
open Domain
let ratioUpTo1Pass = 0.0823m
let ratioUpTo5Pass = 0.0187m
let cotisationsCnav annualRevenu =
let upTo1Pass = min pass annualRevenu
let upTo5Pass = min (5m * pass) annualRevenu
ratioUpTo1Pass * upTo1Pass, ratioUpTo5Pass * upTo5Pass
// reference : https://www.lacipav.fr/sites/default/files/2019-05/CIPAV%20-%20Guide%20Pratique%20-%20web_3.pdf
let calculateCnavBasePension career =
let cotisationsTranche1, cotisationsTranche2 = calculateWholeCareer cotisationsCnav career
let points = cotisationsTranche1 / (ratioUpTo1Pass * 77.18m) + cotisationsTranche2 / (ratioUpTo5Pass * 8_104.8m)
let validatedQuarters = (career.RetiringAge - career.StartingAge) * 4m
let requiredQuarters = requiredQuarters career.BirthYear
let missingQuarters = requiredQuarters - validatedQuarters |> min 20m
let pensionRate = 1m - (min 12m missingQuarters) * 0.01m - (max 0m (missingQuarters - 12m)) * 0.0125m
// TODO : surcote not taken in account here
let pension = points * 0.5690m * pensionRate / 12m
{ Cotisations = cotisationsTranche1 + cotisationsTranche2; MonthlyAmount = pension }
let cotisationsComplementaire annualRevenu =
match annualRevenu with
| _ when annualRevenu < 26580m -> 1353m, 36m
| _ when annualRevenu < 49280m -> 2705m, 72m
| _ when annualRevenu < 57850m -> 4058m, 108m
| _ when annualRevenu < 66400m -> 6763m, 180m
| _ when annualRevenu < 83060m -> 9468m, 252m
| _ when annualRevenu < 103180m -> 14878m, 396m
| _ when annualRevenu < 123300m -> 16231m, 432m
| _ -> 17583m, 468m
let calculateComplementaire career =
let cotisations, points = calculateWholeCareer cotisationsComplementaire career
// No surcote/decote according validated quarters ??
let pension = points * 2.63m / 12m
{ Cotisations = cotisations; MonthlyAmount = pension }
let calculatePension career =
let pension = {
ComposedOf = [ calculateCnavBasePension career; calculateComplementaire career ]
NetReplacementRate = 0m
}
{ pension with
NetReplacementRate =
pension.TotalMonthlyNetAmount / career.EndMonthSalary }