diff --git a/app/Actions/Dealer/CalculateManageSubsidiesOfCurrentPeriod.php b/app/Actions/Dealer/CalculateManageSubsidiesOfCurrentPeriod.php index 4a9e2894..ed7a0902 100644 --- a/app/Actions/Dealer/CalculateManageSubsidiesOfCurrentPeriod.php +++ b/app/Actions/Dealer/CalculateManageSubsidiesOfCurrentPeriod.php @@ -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); } } diff --git a/app/Actions/Dealer/CalculatePurchaseAmountOfCurrentPeriod.php b/app/Actions/Dealer/CalculatePurchaseAmountOfCurrentPeriod.php index 856cbb9c..03c32b68 100644 --- a/app/Actions/Dealer/CalculatePurchaseAmountOfCurrentPeriod.php +++ b/app/Actions/Dealer/CalculatePurchaseAmountOfCurrentPeriod.php @@ -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); } } diff --git a/app/Actions/Dealer/CalculateUnsettledManageSubsidies.php b/app/Actions/Dealer/CalculateUnsettledManageSubsidies.php index 2f17f050..6294cbc8 100644 --- a/app/Actions/Dealer/CalculateUnsettledManageSubsidies.php +++ b/app/Actions/Dealer/CalculateUnsettledManageSubsidies.php @@ -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); } } diff --git a/app/Actions/Dealer/CalculateUnsettledPurchaseAmount.php b/app/Actions/Dealer/CalculateUnsettledPurchaseAmount.php index 8f925094..1436244c 100644 --- a/app/Actions/Dealer/CalculateUnsettledPurchaseAmount.php +++ b/app/Actions/Dealer/CalculateUnsettledPurchaseAmount.php @@ -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); } }