fix(payperiod): add type to payload.
This commit is contained in:
parent
c52de6ecb8
commit
d45feb1aa0
|
|
@ -161,7 +161,9 @@ export class PayPeriodsQueryService {
|
||||||
} },
|
} },
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
bank_code: { select: { categorie: true } },
|
bank_code: { select: {
|
||||||
|
type: true,
|
||||||
|
categorie: true } },
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -184,7 +186,10 @@ export class PayPeriodsQueryService {
|
||||||
} },
|
} },
|
||||||
} },
|
} },
|
||||||
} },
|
} },
|
||||||
bank_code: { select: { categorie: true, modifier: true } },
|
bank_code: { select: {
|
||||||
|
type: true,
|
||||||
|
categorie: true,
|
||||||
|
modifier: true } },
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -230,13 +235,14 @@ export class PayPeriodsQueryService {
|
||||||
const record = ensure(employee.id, name, employee.user.email);
|
const record = ensure(employee.id, name, employee.user.email);
|
||||||
|
|
||||||
const hours = computeHours(shift.start_time, shift.end_time);
|
const hours = computeHours(shift.start_time, shift.end_time);
|
||||||
const categorie = (shift.bank_code?.categorie || "REGULAR").toUpperCase();
|
const type = (shift.bank_code?.type).toUpperCase();
|
||||||
switch (categorie) {
|
switch (type) {
|
||||||
case "EVENING": record.evening_hours += hours; break;
|
case "EVENING": record.evening_hours += hours; break;
|
||||||
case "EMERGENCY": record.emergency_hours += hours; break;
|
case "EMERGENCY": record.emergency_hours += hours; break;
|
||||||
case "OVERTIME": record.overtime_hours += hours; break;
|
case "OVERTIME": record.overtime_hours += hours; break;
|
||||||
default: record.regular_hours += hours; break;
|
case "REGULAR": record.regular_hours += hours; break;
|
||||||
}
|
}
|
||||||
|
|
||||||
record.is_approved = record.is_approved && shift.timesheet.is_approved;
|
record.is_approved = record.is_approved && shift.timesheet.is_approved;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -248,10 +254,10 @@ export class PayPeriodsQueryService {
|
||||||
const amount = toMoney(expense.amount);
|
const amount = toMoney(expense.amount);
|
||||||
record.expenses += amount;
|
record.expenses += amount;
|
||||||
|
|
||||||
const categorie = (expense.bank_code?.categorie || "").toUpperCase();
|
const type = (expense.bank_code?.type || "").toUpperCase();
|
||||||
const rate = expense.bank_code?.modifier ?? 0;
|
const rate = expense.bank_code?.modifier ?? 0;
|
||||||
if (categorie === "MILEAGE" && rate > 0) {
|
if (type === "MILEAGE" && rate > 0) {
|
||||||
record.mileage += amount / rate;
|
record.mileage += Math.round((amount / rate) * 100) / 100;
|
||||||
}
|
}
|
||||||
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