6
0
Fork 0
release
李静 2022-03-24 10:35:43 +08:00
parent 29ad8a666a
commit 968050e108
4 changed files with 10 additions and 4 deletions

View File

@ -23,6 +23,8 @@ class CalculateManageSubsidiesOfCurrentPeriod
$startAt = $tz->copy()->subMonthNoOverflow()->setDay(20)->startOfDay();
}
return DealerManageSubsidyLog::where('order_completed_at', '>=', $startAt)->where('user_id', $dealer->user_id)->sum('total_amount');
$total = DealerManageSubsidyLog::where('order_completed_at', '>=', $startAt)->where('user_id', $dealer->user_id)->sum('total_amount');
return bcmul($total, '1', 2);
}
}

View File

@ -29,6 +29,6 @@ class CalculatePurchaseAmountOfCurrentPeriod
$startAt = $tz->copy()->subMonthNoOverflow()->setDay(20)->startOfDay();
}
return bcdiv($this->calculatePurchaseAmount->handle($dealer, $startAt), '1', 2);
return bcmul($this->calculatePurchaseAmount->handle($dealer, $startAt), '1', 2);
}
}

View File

@ -13,6 +13,8 @@ class CalculateUnsettledManageSubsidies
*/
public function handle(Dealer $dealer): string
{
return DealerManageSubsidyLog::whereNull('order_completed_at')->where('user_id', $dealer->user_id)->sum('total_amount');
$total = DealerManageSubsidyLog::whereNull('order_completed_at')->where('user_id', $dealer->user_id)->sum('total_amount');
return bcmul($total, '1', 2);
}
}

View File

@ -15,8 +15,10 @@ class CalculateUnsettledPurchaseAmount
*/
public function handle(Dealer $dealer): string
{
return DealerPurchaseLog::whereNull('order_completed_at')
$total = DealerPurchaseLog::whereNull('order_completed_at')
->where('path', 'like', "{$dealer->userInfo->full_path}%")
->sum('total_amount');
return bcmul($total, '1', 2);
}
}