fix(display): fix the display of amount, mileage and hours to use only 2 decimals and no more
This commit is contained in:
parent
681779345e
commit
581a4252cd
|
|
@ -303,26 +303,26 @@ export class PayPeriodsQueryService {
|
||||||
const hours = computeHours(shift.start_time, shift.end_time);
|
const hours = computeHours(shift.start_time, shift.end_time);
|
||||||
const type = (shift.bank_code?.type ?? '').toUpperCase();
|
const type = (shift.bank_code?.type ?? '').toUpperCase();
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case "EVENING": record.other_hours.evening_hours += hours;
|
case "EVENING": record.other_hours.evening_hours = Number((record.other_hours.evening_hours += hours).toFixed(2));
|
||||||
record.total_hours += hours;
|
record.total_hours = Number((record.total_hours += hours).toFixed(2));
|
||||||
break;
|
break;
|
||||||
case "EMERGENCY": record.other_hours.emergency_hours += hours;
|
case "EMERGENCY": record.other_hours.emergency_hours = Number((record.other_hours.emergency_hours += hours).toFixed(2));
|
||||||
record.total_hours += hours;
|
record.total_hours = Number((record.total_hours += hours).toFixed(2));
|
||||||
break;
|
break;
|
||||||
case "OVERTIME": record.other_hours.overtime_hours += hours;
|
case "OVERTIME": record.other_hours.overtime_hours = Number((record.other_hours.overtime_hours += hours).toFixed(2));
|
||||||
record.total_hours += hours;
|
record.total_hours = Number((record.total_hours += hours).toFixed(2));
|
||||||
break;
|
break;
|
||||||
case "SICK": record.other_hours.sick_hours += hours;
|
case "SICK": record.other_hours.sick_hours = Number((record.other_hours.sick_hours += hours).toFixed(2));
|
||||||
record.total_hours += hours;
|
record.total_hours = Number((record.total_hours += hours).toFixed(2));
|
||||||
break;
|
break;
|
||||||
case "HOLIDAY": record.other_hours.holiday_hours += hours;
|
case "HOLIDAY": record.other_hours.holiday_hours = Number((record.other_hours.holiday_hours += hours).toFixed(2));
|
||||||
record.total_hours += hours;
|
record.total_hours = Number((record.total_hours += hours).toFixed(2));
|
||||||
break;
|
break;
|
||||||
case "VACATION": record.other_hours.vacation_hours += hours;
|
case "VACATION": record.other_hours.vacation_hours = Number(record.other_hours.vacation_hours += hours);
|
||||||
record.total_hours += hours;
|
record.total_hours = Number((record.total_hours += hours).toFixed(2));
|
||||||
break;
|
break;
|
||||||
case "REGULAR": record.regular_hours += hours;
|
case "REGULAR": record.regular_hours = Number((record.regular_hours += hours).toFixed(2));
|
||||||
record.total_hours += hours;
|
record.total_hours = Number((record.total_hours += hours).toFixed(2));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -336,12 +336,12 @@ export class PayPeriodsQueryService {
|
||||||
const record = ensure(exp.id, name, exp.user.email);
|
const record = ensure(exp.id, name, exp.user.email);
|
||||||
|
|
||||||
const amount = toMoney(expense.amount);
|
const amount = toMoney(expense.amount);
|
||||||
record.expenses += amount;
|
record.expenses = Number((record.expenses += amount).toFixed(2));
|
||||||
|
|
||||||
const type = (expense.bank_code?.type || "").toUpperCase();
|
const type = (expense.bank_code?.type || "").toUpperCase();
|
||||||
const rate = expense.bank_code?.modifier ?? 0;
|
const rate = expense.bank_code?.modifier ?? 0;
|
||||||
if (type === "MILEAGE" && rate > 0) {
|
if (type === "MILEAGE" && rate > 0) {
|
||||||
record.mileage += Math.round((amount / rate) * 100) / 100;
|
record.mileage = Number((record.mileage += Math.round((amount / rate) * 100) / 100).toFixed(2));
|
||||||
}
|
}
|
||||||
record.is_approved = record.is_approved && expense.timesheet.is_approved;
|
record.is_approved = record.is_approved && expense.timesheet.is_approved;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user