hvp-shared 6.67.0 → 6.69.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.
|
@@ -49,5 +49,12 @@ export declare const MONTH_WORK_DAYS: number;
|
|
|
49
49
|
export declare const DAILY_WORK_HOURS = 8;
|
|
50
50
|
/** Working days in a week (alias for clarity) */
|
|
51
51
|
export declare const WEEK_WORK_DAYS = 6;
|
|
52
|
-
/**
|
|
52
|
+
/** Weeks per month (52 / 12 ≈ 4.333) — used for hourly rate calculation */
|
|
53
|
+
export declare const WEEKS_PER_MONTH: number;
|
|
54
|
+
/**
|
|
55
|
+
* Calculate hourly rate from monthly fixed income.
|
|
56
|
+
* Formula: income / (52/12) / 48
|
|
57
|
+
* Divides by work-weeks per month and max weekly hours (48).
|
|
58
|
+
* Hourly workers are NOT paid for rest days, so we use actual work hours, not calendar days.
|
|
59
|
+
*/
|
|
53
60
|
export declare function calculateHourlyRate(jobFixedIncome: number): number;
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
* - Derived/calculated (computed from other constants)
|
|
12
12
|
*/
|
|
13
13
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
|
-
exports.WEEK_WORK_DAYS = exports.DAILY_WORK_HOURS = exports.MONTH_WORK_DAYS = exports.MONTH_DAYS = exports.WEEKS_IN_MONTH = exports.AVERAGE_WORK_DAYS_PER_MONTH = exports.EXCELLENCE_BONUS_RATE = exports.EXCELLENCE_BONUS_MIN_CLOSINGS = exports.DEDUCTION_INVALID_WITHDRAWAL = exports.DEDUCTION_INVALID_CLOSING = exports.BONUS_PER_CLOSING = exports.BONUS_SMALL_CLOSING = exports.BONUS_LARGE_CLOSING = exports.CLOSING_LARGE_THRESHOLD = exports.COMMISSION_SENIORITY_BONUS_PER_SEMESTER = exports.COMMISSION_PERCENTAGE_FOR_YEAR_END_BONUS = exports.YEAR_END_BONUS_DAYS = exports.ANNUAL_RAISE_PERCENT = exports.WORKING_DAYS_IN_A_WEEK = exports.MAX_DOUBLE_PLAY_WORK_WEEK_LIMIT = exports.MAX_WORK_WEEK_LIMIT = exports.HOLIDAY_OR_REST_EXTRA_PAY_PERCENTAGE = exports.SUNDAY_BONUS_PERCENTAGE = exports.VACATION_BONUS_PERCENTAGE = void 0;
|
|
14
|
+
exports.WEEKS_PER_MONTH = exports.WEEK_WORK_DAYS = exports.DAILY_WORK_HOURS = exports.MONTH_WORK_DAYS = exports.MONTH_DAYS = exports.WEEKS_IN_MONTH = exports.AVERAGE_WORK_DAYS_PER_MONTH = exports.EXCELLENCE_BONUS_RATE = exports.EXCELLENCE_BONUS_MIN_CLOSINGS = exports.DEDUCTION_INVALID_WITHDRAWAL = exports.DEDUCTION_INVALID_CLOSING = exports.BONUS_PER_CLOSING = exports.BONUS_SMALL_CLOSING = exports.BONUS_LARGE_CLOSING = exports.CLOSING_LARGE_THRESHOLD = exports.COMMISSION_SENIORITY_BONUS_PER_SEMESTER = exports.COMMISSION_PERCENTAGE_FOR_YEAR_END_BONUS = exports.YEAR_END_BONUS_DAYS = exports.ANNUAL_RAISE_PERCENT = exports.WORKING_DAYS_IN_A_WEEK = exports.MAX_DOUBLE_PLAY_WORK_WEEK_LIMIT = exports.MAX_WORK_WEEK_LIMIT = exports.HOLIDAY_OR_REST_EXTRA_PAY_PERCENTAGE = exports.SUNDAY_BONUS_PERCENTAGE = exports.VACATION_BONUS_PERCENTAGE = void 0;
|
|
15
15
|
exports.calculateHourlyRate = calculateHourlyRate;
|
|
16
16
|
// ── Mexican Labor Law (not configurable) ──
|
|
17
17
|
/** Prima vacacional: 25% of vacation days' salary (Art. 80 LFT) */
|
|
@@ -61,9 +61,16 @@ exports.DAILY_WORK_HOURS = 8;
|
|
|
61
61
|
/** Working days in a week (alias for clarity) */
|
|
62
62
|
exports.WEEK_WORK_DAYS = 6;
|
|
63
63
|
// ── Utility Functions ──
|
|
64
|
-
/**
|
|
64
|
+
/** Weeks per month (52 / 12 ≈ 4.333) — used for hourly rate calculation */
|
|
65
|
+
exports.WEEKS_PER_MONTH = 52 / 12;
|
|
66
|
+
/**
|
|
67
|
+
* Calculate hourly rate from monthly fixed income.
|
|
68
|
+
* Formula: income / (52/12) / 48
|
|
69
|
+
* Divides by work-weeks per month and max weekly hours (48).
|
|
70
|
+
* Hourly workers are NOT paid for rest days, so we use actual work hours, not calendar days.
|
|
71
|
+
*/
|
|
65
72
|
function calculateHourlyRate(jobFixedIncome) {
|
|
66
73
|
if (!jobFixedIncome || jobFixedIncome <= 0)
|
|
67
74
|
return 0;
|
|
68
|
-
return Math.round((jobFixedIncome / exports.
|
|
75
|
+
return Math.round((jobFixedIncome / exports.WEEKS_PER_MONTH / exports.MAX_WORK_WEEK_LIMIT) * 100) / 100;
|
|
69
76
|
}
|
|
@@ -57,17 +57,20 @@ export interface SalaryRates {
|
|
|
57
57
|
effectiveHourly: number;
|
|
58
58
|
}
|
|
59
59
|
/**
|
|
60
|
-
*
|
|
60
|
+
* Employment Overrides
|
|
61
61
|
*
|
|
62
|
-
*
|
|
63
|
-
*
|
|
64
|
-
* the override holds the user's intent.
|
|
62
|
+
* User-set overrides for specific calculated fields.
|
|
63
|
+
* Each field, when present, replaces the corresponding calculated value.
|
|
65
64
|
* Effective value = override ?? calculated.
|
|
65
|
+
*
|
|
66
|
+
* Lives as a top-level field on the employment document.
|
|
67
|
+
* Not all fields apply to all employment types — see comments.
|
|
66
68
|
*/
|
|
67
|
-
export interface
|
|
69
|
+
export interface EmploymentOverrides {
|
|
68
70
|
guaranteedIncome?: number;
|
|
69
71
|
adjustedJobIncome?: number;
|
|
70
|
-
|
|
72
|
+
hourlyRate?: number;
|
|
73
|
+
commissionRateAdjustment?: number;
|
|
71
74
|
}
|
|
72
75
|
/**
|
|
73
76
|
* Employment Salary Data
|
|
@@ -81,7 +84,6 @@ export interface EmploymentSalaryData {
|
|
|
81
84
|
adjustedJobIncome: number;
|
|
82
85
|
totalFixedIncome: number;
|
|
83
86
|
rates: SalaryRates;
|
|
84
|
-
overrides?: SalaryDataOverrides;
|
|
85
87
|
}
|
|
86
88
|
/**
|
|
87
89
|
* Employment Hourly Data
|
|
@@ -93,7 +95,6 @@ export interface EmploymentSalaryData {
|
|
|
93
95
|
export interface EmploymentHourlyData {
|
|
94
96
|
adjustedHourlyRate: number;
|
|
95
97
|
averageDailyHoursWorked: number;
|
|
96
|
-
adjustedHourlyRateOverride?: number;
|
|
97
98
|
}
|
|
98
99
|
/**
|
|
99
100
|
* Employment Benefits
|