diff --git a/app/Service/DepositService.php b/app/Service/DepositService.php index 23de9e2..e7568b3 100644 --- a/app/Service/DepositService.php +++ b/app/Service/DepositService.php @@ -35,8 +35,14 @@ class DepositService */ public function calculateSummary(int $markId, $start, $end): array { - $days = $start->diffInDays($end, false); + $fullDays = $start->copy()->diffInDays($end); // 7 + $totalHours = $start->copy()->diffInHours($end); // 191 часов + $hoursRemainder = $totalHours - ($fullDays * 24); // остаток: 191 - 7*24 = 191 - 168 = 23 + $threshold = 10; // если остаток по часам больше этого порога, то добавим день + + $days = $fullDays + ($hoursRemainder > $threshold ? 1 : 0); + $tariffs = UniModel::model('pipi_auto_tariffs') ->where('model_id', $markId) ->get();