diff --git a/app/Http/Controllers/Admin/StatisticsController.php b/app/Http/Controllers/Admin/StatisticsController.php index c2b96f9..340daed 100755 --- a/app/Http/Controllers/Admin/StatisticsController.php +++ b/app/Http/Controllers/Admin/StatisticsController.php @@ -358,6 +358,7 @@ class StatisticsController extends CommonController if ($mode == 'order') { $orderBalances = Orders::query() ->withoutGlobalScopes() + ->leftJoin("project", "project.id", "=", "orders.project_id") ->leftJoin("customers", "customers.id", "=", "orders.customer_id") ->leftJoin("patient", "patient.id", "=", "orders.patient_id") ->leftJoin("balance", function ($join) use ($before_datetime_text) { @@ -372,10 +373,12 @@ class StatisticsController extends CommonController ->groupBy( "orders.id", "orders.serial", + "project.name", "orders.from_date", "orders.to_date", "orders.contact", "orders.mobile", + "orders.status", "customers.mobile", "patient.name" ) @@ -384,10 +387,21 @@ class StatisticsController extends CommonController ->get([ "orders.id", "orders.serial", + "project.name as project_name", "orders.from_date", "orders.to_date", "orders.contact", "orders.mobile as contact_mobile", + DB::raw("'" . $before_datetime_text . "' as point_time"), + DB::raw(" + CASE orders.status + WHEN " . Orders::STATUS_UNCONFIRMED . " THEN '" . Orders::TEXT_UNCONFIRMED . "' + WHEN " . Orders::STATUS_UNASSIGNED . " THEN '" . Orders::TEXT_UNASSIGNED . "' + WHEN " . Orders::STATUS_ONGOING . " THEN '" . Orders::TEXT_ONGOING . "' + WHEN " . Orders::STATUS_FINISHED . " THEN '" . Orders::TEXT_FINISHED . "' + ELSE orders.status + END as status_name + "), "customers.mobile as customer_mobile", "patient.name as patient_name", DB::raw("COALESCE(SUM(balance.money), 0) as balance"), diff --git a/resources/views/admin/statistics/customer-balance.blade.php b/resources/views/admin/statistics/customer-balance.blade.php index f09f435..c35e4ae 100755 --- a/resources/views/admin/statistics/customer-balance.blade.php +++ b/resources/views/admin/statistics/customer-balance.blade.php @@ -47,6 +47,9 @@ + @if(\App\Models\CommonModel::checkExport()) + + @endif @endif @@ -58,7 +61,10 @@ 序号 + 项目名称 + 时点 订单号 + 订单状态 客户手机号 联系人 联系电话 @@ -72,7 +78,10 @@ @foreach($orderBalances as $item) {{ $loop->iteration }} + {{ $item->project_name }} + {{ $item->point_time }} {{ $item->serial }} + {{ $item->status_name }} {{ $item->customer_mobile }} {{ $item->contact }} {{ $item->contact_mobile }} @@ -122,4 +131,10 @@ @include("plugins.datatable") + + @endsection