master
Rustem 2025-05-28 16:37:37 +05:00
parent ec737e2a49
commit ef9750f729
1 changed files with 7 additions and 1 deletions

View File

@ -35,8 +35,14 @@ class DepositService
*/ */
public function calculateSummary(int $markId, $start, $end): array 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') $tariffs = UniModel::model('pipi_auto_tariffs')
->where('model_id', $markId) ->where('model_id', $markId)
->get(); ->get();