master
parent
ec737e2a49
commit
ef9750f729
|
|
@ -35,7 +35,13 @@ 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)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue