payroll-rules-india 2.10.1 → 2.12.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.
- package/dist/index.d.ts +3 -0
- package/dist/index.js +6 -0
- package/dist/rules/fy2024_2025/acChargesRules.d.ts +2 -0
- package/dist/rules/fy2024_2025/acChargesRules.js +10 -0
- package/dist/rules/fy2024_2025/additionalAllowanceRules.d.ts +2 -0
- package/dist/rules/fy2024_2025/additionalAllowanceRules.js +12 -0
- package/dist/rules/fy2024_2025/basicRules.d.ts +5 -0
- package/dist/rules/fy2024_2025/basicRules.js +65 -0
- package/dist/rules/fy2024_2025/bonusRules.d.ts +3 -0
- package/dist/rules/fy2024_2025/bonusRules.js +23 -0
- package/dist/rules/fy2024_2025/conveyanceAllowanceRules.d.ts +6 -0
- package/dist/rules/fy2024_2025/conveyanceAllowanceRules.js +59 -0
- package/dist/rules/fy2024_2025/dearnessAllowanceRules.d.ts +2 -0
- package/dist/rules/fy2024_2025/dearnessAllowanceRules.js +11 -0
- package/dist/rules/fy2024_2025/earnedleaveRules.d.ts +3 -0
- package/dist/rules/fy2024_2025/earnedleaveRules.js +23 -0
- package/dist/rules/fy2024_2025/emergencyAllowanceRules.d.ts +2 -0
- package/dist/rules/fy2024_2025/emergencyAllowanceRules.js +12 -0
- package/dist/rules/fy2024_2025/employerEsiRules.d.ts +2 -0
- package/dist/rules/fy2024_2025/employerEsiRules.js +11 -0
- package/dist/rules/fy2024_2025/employerPfRules.d.ts +2 -0
- package/dist/rules/fy2024_2025/employerPfRules.js +11 -0
- package/dist/rules/fy2024_2025/esiRules.d.ts +6 -0
- package/dist/rules/fy2024_2025/esiRules.js +54 -0
- package/dist/rules/fy2024_2025/extraBasicRules.d.ts +2 -0
- package/dist/rules/fy2024_2025/extraBasicRules.js +11 -0
- package/dist/rules/fy2024_2025/fuelAllowanceRules.d.ts +2 -0
- package/dist/rules/fy2024_2025/fuelAllowanceRules.js +12 -0
- package/dist/rules/fy2024_2025/generalAllowanceRules.d.ts +2 -0
- package/dist/rules/fy2024_2025/generalAllowanceRules.js +12 -0
- package/dist/rules/fy2024_2025/geyserAllowanceRules.d.ts +2 -0
- package/dist/rules/fy2024_2025/geyserAllowanceRules.js +11 -0
- package/dist/rules/fy2024_2025/hraRules.d.ts +8 -0
- package/dist/rules/fy2024_2025/hraRules.js +82 -0
- package/dist/rules/fy2024_2025/incomeTaxRules.d.ts +2 -0
- package/dist/rules/fy2024_2025/incomeTaxRules.js +15 -0
- package/dist/rules/fy2024_2025/index.d.ts +38 -0
- package/dist/rules/fy2024_2025/index.js +38 -0
- package/dist/rules/fy2024_2025/jaggeryAllowanceRule.d.ts +2 -0
- package/dist/rules/fy2024_2025/jaggeryAllowanceRule.js +10 -0
- package/dist/rules/fy2024_2025/leaveAllowanceRules.d.ts +3 -0
- package/dist/rules/fy2024_2025/leaveAllowanceRules.js +24 -0
- package/dist/rules/fy2024_2025/localAllowanceRules.d.ts +2 -0
- package/dist/rules/fy2024_2025/localAllowanceRules.js +11 -0
- package/dist/rules/fy2024_2025/medicalAllowanceRules.d.ts +3 -0
- package/dist/rules/fy2024_2025/medicalAllowanceRules.js +24 -0
- package/dist/rules/fy2024_2025/mobileAllowanceRules.d.ts +7 -0
- package/dist/rules/fy2024_2025/mobileAllowanceRules.js +68 -0
- package/dist/rules/fy2024_2025/nationalHolidayRules.d.ts +6 -0
- package/dist/rules/fy2024_2025/nationalHolidayRules.js +60 -0
- package/dist/rules/fy2024_2025/optionalHolidayRules.d.ts +2 -0
- package/dist/rules/fy2024_2025/optionalHolidayRules.js +12 -0
- package/dist/rules/fy2024_2025/otherAllowanceRules.d.ts +4 -0
- package/dist/rules/fy2024_2025/otherAllowanceRules.js +35 -0
- package/dist/rules/fy2024_2025/otherDeductionsRule.d.ts +2 -0
- package/dist/rules/fy2024_2025/otherDeductionsRule.js +11 -0
- package/dist/rules/fy2024_2025/otherPaidHolidayRules.d.ts +2 -0
- package/dist/rules/fy2024_2025/otherPaidHolidayRules.js +12 -0
- package/dist/rules/fy2024_2025/overTimesRules.d.ts +3 -0
- package/dist/rules/fy2024_2025/overTimesRules.js +20 -0
- package/dist/rules/fy2024_2025/pfRules.d.ts +4 -0
- package/dist/rules/fy2024_2025/pfRules.js +34 -0
- package/dist/rules/fy2024_2025/profTaxRules.d.ts +2 -0
- package/dist/rules/fy2024_2025/profTaxRules.js +11 -0
- package/dist/rules/fy2024_2025/professionTaxrules.d.ts +2 -0
- package/dist/rules/fy2024_2025/professionTaxrules.js +10 -0
- package/dist/rules/fy2024_2025/quarterRentRules.d.ts +2 -0
- package/dist/rules/fy2024_2025/quarterRentRules.js +10 -0
- package/dist/rules/fy2024_2025/retentionBonusRules.d.ts +7 -0
- package/dist/rules/fy2024_2025/retentionBonusRules.js +69 -0
- package/dist/rules/fy2024_2025/retrenchmentRules.d.ts +2 -0
- package/dist/rules/fy2024_2025/retrenchmentRules.js +12 -0
- package/dist/rules/fy2024_2025/rfbRules.d.ts +2 -0
- package/dist/rules/fy2024_2025/rfbRules.js +11 -0
- package/dist/rules/fy2024_2025/safetyAllowanceRules.d.ts +4 -0
- package/dist/rules/fy2024_2025/safetyAllowanceRules.js +32 -0
- package/dist/rules/fy2024_2025/shiftAllowanceRules.d.ts +5 -0
- package/dist/rules/fy2024_2025/shiftAllowanceRules.js +44 -0
- package/dist/rules/fy2024_2025/specialAllowanceRules.d.ts +3 -0
- package/dist/rules/fy2024_2025/specialAllowanceRules.js +22 -0
- package/dist/rules/fy2024_2025/teaAllowanceRules.d.ts +2 -0
- package/dist/rules/fy2024_2025/teaAllowanceRules.js +12 -0
- package/dist/rules/fy2024_2025/uniformAllowanceRules.d.ts +6 -0
- package/dist/rules/fy2024_2025/uniformAllowanceRules.js +58 -0
- package/dist/rules/fy2024_2025/washingAllowanceRules.d.ts +11 -0
- package/dist/rules/fy2024_2025/washingAllowanceRules.js +105 -0
- package/dist/rules/index.d.ts +5 -0
- package/dist/rules/index.js +4 -0
- package/dist/utils/ruleEvaluator.d.ts +2 -0
- package/dist/utils/ruleEvaluator.js +32 -0
- package/dist/utils/types.d.ts +44 -0
- package/dist/utils/types.js +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
// Shift Allowance: payable days * 17.16 rupee per day
|
|
2
|
+
export const shiftAllowanceRule = {
|
|
3
|
+
ruleCode: "SHIFT_ALLOWANCE",
|
|
4
|
+
name: "Shift Allowance",
|
|
5
|
+
category: "Earning",
|
|
6
|
+
type: "Custom",
|
|
7
|
+
version: "FY2024-2025",
|
|
8
|
+
description: "Shift Allowance = payable days * 17.16 rupee per day",
|
|
9
|
+
condition: "payableDays > 0",
|
|
10
|
+
monthlyFormula: "round(payableDays * 17.16, 2)",
|
|
11
|
+
annualFormula: "round(payableDays * 17.16 * 12, 2)",
|
|
12
|
+
};
|
|
13
|
+
// Shift Allowance: payable days * 11.50 rupee per day
|
|
14
|
+
export const shiftAllowanceRuleNew = {
|
|
15
|
+
ruleCode: "SHIFT_ALLOWANCE_NEW",
|
|
16
|
+
name: "Shift Allowance -new ",
|
|
17
|
+
category: "Earning",
|
|
18
|
+
type: "Custom",
|
|
19
|
+
version: "FY2024-2025",
|
|
20
|
+
description: "Shift Allowance = payable days * 11.50 rupee per day",
|
|
21
|
+
condition: "payableDays > 0",
|
|
22
|
+
monthlyFormula: "round(payableDays * 11.50, 2)",
|
|
23
|
+
annualFormula: "round(payableDays * 11.50 * 12, 2)",
|
|
24
|
+
};
|
|
25
|
+
export const shiftAllowanceRuleTierA = {
|
|
26
|
+
ruleCode: "SHIFT_ALLOWANCE_TIER_A",
|
|
27
|
+
name: "Shift Allowance",
|
|
28
|
+
category: "Earning",
|
|
29
|
+
type: "Custom",
|
|
30
|
+
version: "FY2024-2025",
|
|
31
|
+
description: "Shift Allowance calculated as 7.5% of wage rate multiplied by shift days.",
|
|
32
|
+
condition: "shiftDays > 0",
|
|
33
|
+
monthlyFormula: "round((dailyWages * 0.075) * shiftDays, 0)",
|
|
34
|
+
};
|
|
35
|
+
export const nightShiftAllowanceRuleTierB = {
|
|
36
|
+
ruleCode: "NIGHT_SHIFT_ALLOWANCE",
|
|
37
|
+
name: "Night Shift Allowance",
|
|
38
|
+
category: "Earning",
|
|
39
|
+
type: "Custom",
|
|
40
|
+
version: "FY2024-2025",
|
|
41
|
+
description: "shift allowance calculated at Rs.6.15 per night shift day.",
|
|
42
|
+
condition: "shiftDays > 0",
|
|
43
|
+
monthlyFormula: "round(shiftDays * 6.15, 2)",
|
|
44
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export const specialAllowanceRule = {
|
|
2
|
+
ruleCode: "SPECIAL_ALLOWANCE",
|
|
3
|
+
name: "Special Allowance",
|
|
4
|
+
category: "Earning",
|
|
5
|
+
version: "FY2024-2025",
|
|
6
|
+
description: "Residual component after mandatory allocations",
|
|
7
|
+
condition: "ctc > 0",
|
|
8
|
+
monthlyFormula: "round((ctc / 12) - (basic + hra + conveyance + da + gratuity + pf + esi), 2)",
|
|
9
|
+
annualFormula: "round(ctc - ((basic + hra + conveyance + da + gratuity + pf + esi) * 12), 2)",
|
|
10
|
+
};
|
|
11
|
+
// Special Allowance: 22 rupees per day * worked days
|
|
12
|
+
export const specialAllowanceDailyRule = {
|
|
13
|
+
ruleCode: "SPECIAL_ALLOWANCE_DAILY",
|
|
14
|
+
name: "Special Allowance - Daily Rate",
|
|
15
|
+
category: "Earning",
|
|
16
|
+
type: "Custom",
|
|
17
|
+
version: "FY2024-2025",
|
|
18
|
+
description: "Special Allowance = 22 rupees per day * worked days (payable days)",
|
|
19
|
+
condition: "payableDays > 0",
|
|
20
|
+
monthlyFormula: "round(22 * payableDays, 2)",
|
|
21
|
+
annualFormula: "round(22 * payableDays * 12, 2)",
|
|
22
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
// Tea Allowance: 544 * No of payable days
|
|
2
|
+
export const teaAllowanceRule = {
|
|
3
|
+
ruleCode: "TEA_ALLOWANCE",
|
|
4
|
+
name: "Tea Allowance",
|
|
5
|
+
category: "Earning",
|
|
6
|
+
type: "Custom",
|
|
7
|
+
version: "FY2024-2025",
|
|
8
|
+
description: "Tea Allowance = 5.44 * No of payable days",
|
|
9
|
+
condition: "payableDays > 0",
|
|
10
|
+
monthlyFormula: "round(5.44 * payableDays, 2)",
|
|
11
|
+
annualFormula: "round(5.44 * payableDays * 12, 2)",
|
|
12
|
+
};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { Rule } from "../../utils/types";
|
|
2
|
+
export declare const uniformAllowanceHSWRule: Rule;
|
|
3
|
+
export declare const uniformAllowanceRule: Rule;
|
|
4
|
+
export declare const uniformAllowanceSWRule: Rule;
|
|
5
|
+
export declare const uniformAllowanceSSWRule: Rule;
|
|
6
|
+
export declare const uniformAllowanceRuleForAll: Rule;
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
// Uniform Allowance - HSW: Rs. 60.63/- * payable days
|
|
2
|
+
export const uniformAllowanceHSWRule = {
|
|
3
|
+
ruleCode: "UNIFORM_ALLOWANCE_HSW",
|
|
4
|
+
name: "Uniform Allowance - HSW",
|
|
5
|
+
category: "Earning",
|
|
6
|
+
type: "Custom",
|
|
7
|
+
version: "FY2024-2025",
|
|
8
|
+
description: "Uniform Allowance (HSW) = Rs. 60.63/- * payable days (worked days)",
|
|
9
|
+
condition: "payableDays > 0 && employeeCategory === 'HSW'",
|
|
10
|
+
monthlyFormula: "round(60.63 * payableDays, 2)",
|
|
11
|
+
annualFormula: "round(60.63 * payableDays * 12, 2)",
|
|
12
|
+
};
|
|
13
|
+
export const uniformAllowanceRule = {
|
|
14
|
+
ruleCode: "UNIFORM_ALLOWANCE_CUSTOM",
|
|
15
|
+
name: "Uniform Allowance - custom(HSW)",
|
|
16
|
+
category: "Earning",
|
|
17
|
+
type: "Custom",
|
|
18
|
+
version: "FY2024-2025",
|
|
19
|
+
description: "ONLY FOR HSW Uniform Allowance = Rs. 65.00/- * payable days (worked days)",
|
|
20
|
+
condition: "payableDays > 0 && employeeCategory === 'HSW'",
|
|
21
|
+
monthlyFormula: "round(65 * payableDays, 2)",
|
|
22
|
+
annualFormula: "round(65 * payableDays * 12, 2)",
|
|
23
|
+
};
|
|
24
|
+
// Uniform Allowance - SW: Rs. 45.76/- * payable days
|
|
25
|
+
export const uniformAllowanceSWRule = {
|
|
26
|
+
ruleCode: "UNIFORM_ALLOWANCE_SW",
|
|
27
|
+
name: "Uniform Allowance - SW",
|
|
28
|
+
category: "Earning",
|
|
29
|
+
type: "Custom",
|
|
30
|
+
version: "FY2024-2025",
|
|
31
|
+
description: "Uniform Allowance (SW) = Rs. 45.76/- * payable days (worked days)",
|
|
32
|
+
condition: "payableDays > 0 && employeeCategory === 'SW'",
|
|
33
|
+
monthlyFormula: "round(45.76 * payableDays, 2)",
|
|
34
|
+
annualFormula: "round(45.76 * payableDays * 12, 2)",
|
|
35
|
+
};
|
|
36
|
+
// Uniform Allowance - SSW: Rs. 38.90/- * payable days
|
|
37
|
+
export const uniformAllowanceSSWRule = {
|
|
38
|
+
ruleCode: "UNIFORM_ALLOWANCE_SSW",
|
|
39
|
+
name: "Uniform Allowance - SSW",
|
|
40
|
+
category: "Earning",
|
|
41
|
+
type: "Custom",
|
|
42
|
+
version: "FY2024-2025",
|
|
43
|
+
description: "Uniform Allowance (SSW) = Rs. 38.90/- * payable days (worked days)",
|
|
44
|
+
condition: "payableDays > 0 && employeeCategory === 'SSW'",
|
|
45
|
+
monthlyFormula: "round(38.90 * payableDays, 2)",
|
|
46
|
+
annualFormula: "round(38.90 * payableDays * 12, 2)",
|
|
47
|
+
};
|
|
48
|
+
export const uniformAllowanceRuleForAll = {
|
|
49
|
+
ruleCode: "UNIFORM_ALLOWANCE_CUSTOM_ALL",
|
|
50
|
+
name: "Uniform Allowance - custom",
|
|
51
|
+
category: "Earning",
|
|
52
|
+
type: "Custom",
|
|
53
|
+
version: "FY2024-2025",
|
|
54
|
+
description: "General Uniform Allowance = Rs. 65.00/- * payable days (worked days)",
|
|
55
|
+
condition: "payableDays > 0",
|
|
56
|
+
monthlyFormula: "round(65 * payableDays, 2)",
|
|
57
|
+
annualFormula: "round(65 * payableDays * 12, 2)",
|
|
58
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Rule } from "../../utils/types";
|
|
2
|
+
export declare const washingAllowanceTierA: Rule;
|
|
3
|
+
export declare const washingAllowanceTierB: Rule;
|
|
4
|
+
export declare const washingAllowanceTierC: Rule;
|
|
5
|
+
export declare const washingAllowanceTierCRevised: Rule;
|
|
6
|
+
export declare const washingAllowanceUSWRuleTierD: Rule;
|
|
7
|
+
export declare const washingAllowanceUSWRuleTierE: Rule;
|
|
8
|
+
export declare const washingAllowanceUSWRuleTierF: Rule;
|
|
9
|
+
export declare const washingAllowanceUSWRuleTierG: Rule;
|
|
10
|
+
export declare const washingAllowanceTierH: Rule;
|
|
11
|
+
export declare const washingAllowanceDailyRule: Rule;
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
export const washingAllowanceTierA = {
|
|
2
|
+
ruleCode: "WASHING_ALLOWANCE_TIER_A",
|
|
3
|
+
name: "Washing Allowance – Tier A",
|
|
4
|
+
category: "Earning",
|
|
5
|
+
type: "Custom",
|
|
6
|
+
version: "FY2024-2025",
|
|
7
|
+
description: "Washing Allowance = Rs. 16.02 * payable days",
|
|
8
|
+
condition: "payableDays > 0",
|
|
9
|
+
monthlyFormula: "round(16.02 * payableDays, 2)",
|
|
10
|
+
annualFormula: "round(16.02 * payableDays * 12, 2)",
|
|
11
|
+
};
|
|
12
|
+
export const washingAllowanceTierB = {
|
|
13
|
+
ruleCode: "WASHING_ALLOWANCE_TIER_B",
|
|
14
|
+
name: "Washing Allowance – Tier B",
|
|
15
|
+
category: "Earning",
|
|
16
|
+
type: "Custom",
|
|
17
|
+
version: "FY2024-2025",
|
|
18
|
+
description: "Washing Allowance = Rs. 12.58 * payable days",
|
|
19
|
+
condition: "payableDays > 0",
|
|
20
|
+
monthlyFormula: "round(12.58 * payableDays, 2)",
|
|
21
|
+
annualFormula: "round(12.58 * payableDays * 12, 2)",
|
|
22
|
+
};
|
|
23
|
+
export const washingAllowanceTierC = {
|
|
24
|
+
ruleCode: "WASHING_ALLOWANCE_TIER_C",
|
|
25
|
+
name: "Washing Allowance – Tier C",
|
|
26
|
+
category: "Earning",
|
|
27
|
+
type: "Custom",
|
|
28
|
+
version: "FY2024-2025",
|
|
29
|
+
description: "Washing Allowance = Rs. 10.30 * payable days",
|
|
30
|
+
condition: "payableDays > 0",
|
|
31
|
+
monthlyFormula: "round(10.30 * payableDays, 2)",
|
|
32
|
+
annualFormula: "round(10.30 * payableDays * 12, 2)",
|
|
33
|
+
};
|
|
34
|
+
export const washingAllowanceTierCRevised = {
|
|
35
|
+
ruleCode: "WASHING_ALLOWANCE_TIER_C_REVISED",
|
|
36
|
+
name: "Washing Allowance – Tier C (Revised Rate)",
|
|
37
|
+
category: "Earning",
|
|
38
|
+
type: "Custom",
|
|
39
|
+
version: "FY2024-2025",
|
|
40
|
+
description: "Washing Allowance = Rs. 11.50 * payable days",
|
|
41
|
+
condition: "payableDays > 0",
|
|
42
|
+
monthlyFormula: "round(11.50 * payableDays, 2)",
|
|
43
|
+
annualFormula: "round(11.50 * payableDays * 12, 2)",
|
|
44
|
+
};
|
|
45
|
+
export const washingAllowanceUSWRuleTierD = {
|
|
46
|
+
ruleCode: "WASHING_ALLOWANCE_USW",
|
|
47
|
+
name: "Washing Allowance (USW)",
|
|
48
|
+
category: "Earning",
|
|
49
|
+
type: "Custom",
|
|
50
|
+
version: "FY2024-2025",
|
|
51
|
+
description: "Washing allowance for USW category at Rs.25 per present day.",
|
|
52
|
+
condition: "payableDays > 0",
|
|
53
|
+
monthlyFormula: "round(payableDays * 25, 2)",
|
|
54
|
+
};
|
|
55
|
+
export const washingAllowanceUSWRuleTierE = {
|
|
56
|
+
ruleCode: "WASHING_ALLOWANCE_SW",
|
|
57
|
+
name: "Washing Allowance (SW)",
|
|
58
|
+
category: "Earning",
|
|
59
|
+
type: "Custom",
|
|
60
|
+
version: "FY2024-2025",
|
|
61
|
+
description: "Washing allowance for SW category at Rs.35 per present day.",
|
|
62
|
+
condition: "payableDays > 0",
|
|
63
|
+
monthlyFormula: "round(payableDays * 35, 2)",
|
|
64
|
+
};
|
|
65
|
+
export const washingAllowanceUSWRuleTierF = {
|
|
66
|
+
ruleCode: "WASHING_ALLOWANCE",
|
|
67
|
+
name: "Washing Allowance At ₹44",
|
|
68
|
+
category: "Earning",
|
|
69
|
+
type: "Custom",
|
|
70
|
+
version: "FY2024-2025",
|
|
71
|
+
description: "Washing allowance for SW category at Rs.44 per present day.",
|
|
72
|
+
condition: "payableDays > 0",
|
|
73
|
+
monthlyFormula: "round(payableDays * 44, 2)",
|
|
74
|
+
};
|
|
75
|
+
export const washingAllowanceUSWRuleTierG = {
|
|
76
|
+
ruleCode: "WASHING_ALLOWANCE_TIER_G",
|
|
77
|
+
name: "Washing Allowance At ₹5.44",
|
|
78
|
+
category: "Earning",
|
|
79
|
+
type: "Custom",
|
|
80
|
+
version: "FY2024-2025",
|
|
81
|
+
description: "Washing allowance for category at Rs.5.44 per present day.",
|
|
82
|
+
condition: "payableDays > 0",
|
|
83
|
+
monthlyFormula: "round(payableDays * 5.44, 2)",
|
|
84
|
+
};
|
|
85
|
+
export const washingAllowanceTierH = {
|
|
86
|
+
ruleCode: "WASHING_ALLOWANCE_TIER_H",
|
|
87
|
+
name: "Washing Allowance – Tier H",
|
|
88
|
+
category: "Earning",
|
|
89
|
+
type: "Custom",
|
|
90
|
+
version: "FY2024-2025",
|
|
91
|
+
description: "Washing Allowance = Rs. 10 * payable days",
|
|
92
|
+
condition: "payableDays > 0",
|
|
93
|
+
monthlyFormula: "round(10 * payableDays, 2)",
|
|
94
|
+
annualFormula: "round(10 * payableDays * 12, 2)",
|
|
95
|
+
};
|
|
96
|
+
export const washingAllowanceDailyRule = {
|
|
97
|
+
ruleCode: "WASHING_ALLOWANCE_DAILY",
|
|
98
|
+
name: "Washing Allowance",
|
|
99
|
+
category: "Earning",
|
|
100
|
+
type: "Custom",
|
|
101
|
+
version: "FY2024-2025",
|
|
102
|
+
description: "Washing allowance calculated at Rs.41 per payable day.",
|
|
103
|
+
condition: "payableDays > 0",
|
|
104
|
+
monthlyFormula: "round(payableDays * 41, 0)",
|
|
105
|
+
};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { Parser } from "expr-eval";
|
|
2
|
+
const parser = new Parser();
|
|
3
|
+
const safeFunctions = {
|
|
4
|
+
round: (v, d = 2) => Math.round(v * Math.pow(10, d)) / Math.pow(10, d),
|
|
5
|
+
min: Math.min,
|
|
6
|
+
max: Math.max,
|
|
7
|
+
abs: Math.abs,
|
|
8
|
+
};
|
|
9
|
+
export function evaluateRule(rule, context, mode = "monthly") {
|
|
10
|
+
const formula = mode === "annual" ? rule.annualFormula : rule.monthlyFormula;
|
|
11
|
+
if (!formula) {
|
|
12
|
+
return {
|
|
13
|
+
applies: false,
|
|
14
|
+
value: null,
|
|
15
|
+
ruleCode: rule.ruleCode,
|
|
16
|
+
name: rule.name,
|
|
17
|
+
category: rule.category,
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
const conditionAst = rule.condition ? parser.parse(rule.condition) : null;
|
|
21
|
+
const formulaAst = parser.parse(formula);
|
|
22
|
+
const ctx = { ...context, ...safeFunctions };
|
|
23
|
+
const applies = conditionAst ? Boolean(conditionAst.evaluate(ctx)) : true;
|
|
24
|
+
const value = applies ? Number(formulaAst.evaluate(ctx)) : null;
|
|
25
|
+
return {
|
|
26
|
+
applies,
|
|
27
|
+
value,
|
|
28
|
+
ruleCode: rule.ruleCode,
|
|
29
|
+
name: rule.name,
|
|
30
|
+
category: rule.category,
|
|
31
|
+
};
|
|
32
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
export type Rule = {
|
|
2
|
+
ruleCode: string;
|
|
3
|
+
name: string;
|
|
4
|
+
category: "Earning" | "Deduction" | "Adjustment";
|
|
5
|
+
type?: "Statutory" | "Custom" | "Fixed";
|
|
6
|
+
description?: string;
|
|
7
|
+
version?: string;
|
|
8
|
+
condition?: string;
|
|
9
|
+
monthlyFormula?: string;
|
|
10
|
+
annualFormula?: string;
|
|
11
|
+
};
|
|
12
|
+
export type EvaluationContext = {
|
|
13
|
+
basic?: number;
|
|
14
|
+
hra?: number;
|
|
15
|
+
da?: number;
|
|
16
|
+
specialAllowance?: number;
|
|
17
|
+
conveyance?: number;
|
|
18
|
+
gross?: number;
|
|
19
|
+
grossEarnings?: number;
|
|
20
|
+
ctc?: number;
|
|
21
|
+
lopDays?: number;
|
|
22
|
+
workedDays?: number;
|
|
23
|
+
payableDays?: number;
|
|
24
|
+
dailyWages?: number;
|
|
25
|
+
totalDaysInMonth?: number;
|
|
26
|
+
workingDaysInMonth?: number;
|
|
27
|
+
noOfHolidays?: number;
|
|
28
|
+
employeeCategory?: "HSW" | "SW" | "SSW";
|
|
29
|
+
isPfApplicable?: boolean;
|
|
30
|
+
isEsiApplicable?: boolean;
|
|
31
|
+
isMetro?: boolean;
|
|
32
|
+
pfWageLimit?: number;
|
|
33
|
+
esiWageLimit?: number;
|
|
34
|
+
state?: string;
|
|
35
|
+
taxRegime?: "old" | "new";
|
|
36
|
+
[key: string]: any;
|
|
37
|
+
};
|
|
38
|
+
export type EvaluationResult = {
|
|
39
|
+
applies: boolean;
|
|
40
|
+
value: number | null;
|
|
41
|
+
ruleCode: string;
|
|
42
|
+
name: string;
|
|
43
|
+
category: string;
|
|
44
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|