Добавил ограничение по отказникам
This commit is contained in:
@@ -32,6 +32,12 @@ class PlanCalculator extends BaseMetricService implements MetricCalculatorInterf
|
||||
$startCurrentMonth = $endDate->copy()->startOfMonth()->setHours(9);
|
||||
$currentMonth = $endDate->month;
|
||||
|
||||
// Кол-во календарных месяцев, затронутых выбранным диапазоном (для нормы за период)
|
||||
$monthsInRange = max(
|
||||
1,
|
||||
($endDate->year * 12 + $endDate->month) - ($startDate->year * 12 + $startDate->month) + 1
|
||||
);
|
||||
|
||||
// Получаем фактические выписки с начала года по прошлый месяц
|
||||
$previousOutcomeMonth = DB::table('report_duties as r')
|
||||
->join('duty_report_metric_results as mr', 'r.id', '=', 'mr.rf_report_id')
|
||||
@@ -99,6 +105,7 @@ class PlanCalculator extends BaseMetricService implements MetricCalculatorInterf
|
||||
$results[$departmentId] = [
|
||||
'year_plan' => $annualPlan,
|
||||
'month_plan' => $oneMonthPlan,
|
||||
'period_plan' => $oneMonthPlan * $monthsInRange, // норма за выбранный период (мес. × кол-во месяцев)
|
||||
'total_debt' => $totalDebt,
|
||||
'current_mouth_dept' => $currentMonthPlanOnly,
|
||||
'cumulative_plan' => $cumulativePlan,
|
||||
|
||||
Reference in New Issue
Block a user