|
|
|
|
@ -251,10 +251,13 @@ class StatisticsController extends CommonController
|
|
|
|
|
$refund = $model_refund->sum("money");
|
|
|
|
|
|
|
|
|
|
$refund_by_payment = $model_refund->select("payment", "paid_at", "money", "order_id")->addSelect(DB::raw("sum(`money`) as total"))->groupBy("payment")->get()->keyBy("payment")->toArray();
|
|
|
|
|
// dd($refund_by_payment);
|
|
|
|
|
$refund_methods = (new Refund())->groupBy("payment")->get()->keyBy("payment")->toArray();
|
|
|
|
|
foreach ($refund_methods as $k => $refund_method) {
|
|
|
|
|
$refund_by_methods[$k] = $model_refund->where("payment", $k)->sum("money");
|
|
|
|
|
if (isset($refund_by_payment[$k])) {
|
|
|
|
|
$refund_by_methods[$k] = $refund_by_payment[$k]["total"];
|
|
|
|
|
} else {
|
|
|
|
|
$refund_by_methods[$k] = 0;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$payment_methods = (new Recharge())->payment_methods;
|
|
|
|
|
|