diff --git a/frontend/components/employees/RttTab.vue b/frontend/components/employees/RttTab.vue index 6844ce9..43070df 100644 --- a/frontend/components/employees/RttTab.vue +++ b/frontend/components/employees/RttTab.vue @@ -103,11 +103,11 @@ 0 h - {{ formatMinutes(week.base25Minutes) }} + {{ formatMinutes(week.totalMinutes >= 0 ? week.base25Minutes : 0) }} 0 h - {{ formatMinutes(week.bonus25Minutes) }} + {{ formatMinutes(week.totalMinutes >= 0 ? week.bonus25Minutes : 0) }} 0 h @@ -115,11 +115,11 @@ 0 h - {{ formatMinutes(week.base50Minutes) }} + {{ formatMinutes(week.totalMinutes >= 0 ? week.base50Minutes : 0) }} 0 h - {{ formatMinutes(week.bonus50Minutes) }} + {{ formatMinutes(week.totalMinutes >= 0 ? week.bonus50Minutes : 0) }} 0 h @@ -162,13 +162,13 @@ Reste - - {{ formatMinutes(monthReport.base25 + totals.base25 - (currentPayment?.paidBase25Minutes ?? 0)) }} - {{ formatMinutes(monthReport.bonus25 + totals.bonus25 - (currentPayment?.paidBonus25Minutes ?? 0)) }} - {{ formatMinutes(monthReport.total25 + totals.total25 - (currentPayment?.paidBase25Minutes ?? 0) - (currentPayment?.paidBonus25Minutes ?? 0)) }} - {{ formatMinutes(monthReport.base50 + totals.base50 - (currentPayment?.paidBase50Minutes ?? 0)) }} - {{ formatMinutes(monthReport.bonus50 + totals.bonus50 - (currentPayment?.paidBonus50Minutes ?? 0)) }} - {{ formatMinutes(monthReport.total50 + totals.total50 - (currentPayment?.paidBase50Minutes ?? 0) - (currentPayment?.paidBonus50Minutes ?? 0)) }} - {{ formatMinutes(resteTotal) }} + {{ formatMinutes(reste.base25) }} + {{ formatMinutes(reste.bonus25) }} + {{ formatMinutes(reste.total25) }} + {{ formatMinutes(reste.base50) }} + {{ formatMinutes(reste.bonus50) }} + {{ formatMinutes(reste.total50) }} + {{ formatMinutes(reste.total) }} @@ -419,13 +419,14 @@ const showMonthReportRow = computed(() => { const totals = computed(() => { const weeks = weeksForCurrentMonth.value + const positive = weeks.filter((w) => w.totalMinutes >= 0) return { overtime: weeks.reduce((s, w) => s + w.overtimeMinutes, 0), - base25: weeks.reduce((s, w) => s + w.base25Minutes, 0), - bonus25: weeks.reduce((s, w) => s + w.bonus25Minutes, 0), + base25: positive.reduce((s, w) => s + w.base25Minutes, 0), + bonus25: positive.reduce((s, w) => s + w.bonus25Minutes, 0), total25: weeks.reduce((s, w) => s + w.base25Minutes + w.bonus25Minutes, 0), - base50: weeks.reduce((s, w) => s + w.base50Minutes, 0), - bonus50: weeks.reduce((s, w) => s + w.bonus50Minutes, 0), + base50: positive.reduce((s, w) => s + w.base50Minutes, 0), + bonus50: positive.reduce((s, w) => s + w.bonus50Minutes, 0), total50: weeks.reduce((s, w) => s + w.base50Minutes + w.bonus50Minutes, 0), total: weeks.reduce((s, w) => s + w.totalMinutes, 0), } @@ -442,8 +443,19 @@ const paidTotal = computed(() => { return -(p.paidBase25Minutes + p.paidBonus25Minutes + p.paidBase50Minutes + p.paidBonus50Minutes) }) -const resteTotal = computed(() => { - return monthReport.value.total + totals.value.total + paidTotal.value +const reste = computed(() => { + const total25 = monthReport.value.total25 + totals.value.total25 + - (currentPayment.value?.paidBase25Minutes ?? 0) - (currentPayment.value?.paidBonus25Minutes ?? 0) + const total50 = monthReport.value.total50 + totals.value.total50 + - (currentPayment.value?.paidBase50Minutes ?? 0) - (currentPayment.value?.paidBonus50Minutes ?? 0) + + const base25 = Math.round(total25 / 1.25) + const bonus25 = total25 - base25 + const base50 = Math.round(total50 / 1.5) + const bonus50 = total50 - base50 + const total = monthReport.value.total + totals.value.total + paidTotal.value + + return { base25, bonus25, total25, base50, bonus50, total50, total } }) // --- Format ---