Update
parent
29ad8a666a
commit
968050e108
|
|
@ -23,6 +23,8 @@ class CalculateManageSubsidiesOfCurrentPeriod
|
||||||
$startAt = $tz->copy()->subMonthNoOverflow()->setDay(20)->startOfDay();
|
$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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -29,6 +29,6 @@ class CalculatePurchaseAmountOfCurrentPeriod
|
||||||
$startAt = $tz->copy()->subMonthNoOverflow()->setDay(20)->startOfDay();
|
$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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -13,6 +13,8 @@ class CalculateUnsettledManageSubsidies
|
||||||
*/
|
*/
|
||||||
public function handle(Dealer $dealer): string
|
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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -15,8 +15,10 @@ class CalculateUnsettledPurchaseAmount
|
||||||
*/
|
*/
|
||||||
public function handle(Dealer $dealer): string
|
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}%")
|
->where('path', 'like', "{$dealer->userInfo->full_path}%")
|
||||||
->sum('total_amount');
|
->sum('total_amount');
|
||||||
|
|
||||||
|
return bcmul($total, '1', 2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue