Подсчет долга теперь только при начальной дате периода = началу года

This commit is contained in:
brusnitsyn
2026-07-08 15:09:01 +09:00
parent 18638dfcab
commit 8db7f19dda
3 changed files with 11 additions and 3 deletions

View File

@@ -23,18 +23,23 @@ const props = defineProps({
debt_from_year: 0,
actual_year_to_date: 0,
cumulative_percent: 0,
is_calculate_debt: false,
})
}
})
// План за период + непогашенный долг, накопленный до начала периода
const planWithDebt = computed(() => {
return Number(props.plan?.period_plan ?? 0) + Number(props.plan?.debt_at_period_start ?? 0)
const periodPlan = Number(props.plan?.period_plan ?? 0)
const periodDebt = Number(props.plan?.debt_from_year ?? 0)
return props.plan?.is_calculate_debt ? periodPlan + periodDebt : periodPlan
})
// % выполнения плана за период с учётом долга (иначе долг никак не влияет на оценку)
// % выполнения плана за период с учётом долга
const periodPercent = computed(() => {
if (!planWithDebt.value) return 0
return Math.round((Number(props.value) * 100) / planWithDebt.value)
})