feat(pay-periods): added total_hours and is_remote to payload
This commit is contained in:
parent
0fb6465c27
commit
8ef5c0ac11
|
|
@ -30,6 +30,8 @@ export class EmployeePeriodOverviewDto {
|
||||||
@ApiProperty({ example: 2, description: 'pay-period`s overtime hours' })
|
@ApiProperty({ example: 2, description: 'pay-period`s overtime hours' })
|
||||||
overtime_hours: number;
|
overtime_hours: number;
|
||||||
|
|
||||||
|
total_hours: number;
|
||||||
|
|
||||||
@ApiProperty({ example: 420.69, description: 'pay-period`s total expenses ($)' })
|
@ApiProperty({ example: 420.69, description: 'pay-period`s total expenses ($)' })
|
||||||
expenses: number;
|
expenses: number;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -203,6 +203,7 @@ export class PayPeriodsQueryService {
|
||||||
evening_hours: 0,
|
evening_hours: 0,
|
||||||
emergency_hours: 0,
|
emergency_hours: 0,
|
||||||
overtime_hours: 0,
|
overtime_hours: 0,
|
||||||
|
total_hours: 0,
|
||||||
expenses: 0,
|
expenses: 0,
|
||||||
mileage: 0,
|
mileage: 0,
|
||||||
is_approved: true,
|
is_approved: true,
|
||||||
|
|
@ -220,6 +221,7 @@ export class PayPeriodsQueryService {
|
||||||
evening_hours: 0,
|
evening_hours: 0,
|
||||||
emergency_hours: 0,
|
emergency_hours: 0,
|
||||||
overtime_hours: 0,
|
overtime_hours: 0,
|
||||||
|
total_hours: 0,
|
||||||
expenses: 0,
|
expenses: 0,
|
||||||
mileage: 0,
|
mileage: 0,
|
||||||
is_approved: true,
|
is_approved: true,
|
||||||
|
|
@ -235,14 +237,16 @@ 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?.type).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;
|
||||||
case "REGULAR" : 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;
|
||||||
|
record.total_hours += hours;
|
||||||
|
record.is_remote = record.is_remote || !!shift.is_remote;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (const expense of expenses) {
|
for (const expense of expenses) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user