@ -716,6 +716,8 @@ class Business extends Common
$sql_a = CrmBusinessModel::field([
'SUM(CASE WHEN is_end = 1 THEN money ELSE 0 END) AS sum_ying',
'SUM(CASE WHEN is_end = 2 THEN money ELSE 0 END) AS sum_shu',
'count(if (is_end = 1,true,null)) as count_ying',
'count(if (is_end = 2,true,null)) as count_shu',
'type_id'
])
->where($map)
@ -729,7 +731,7 @@ class Business extends Common
'type_id'
])
->where($where)
->whereNotIn('is_end', '1,2, 3')
->whereNotIn('is_end', '3')
->group('status_id')
->fetchSql()
->select();
@ -754,6 +756,8 @@ class Business extends Common
$data['list'] = $statusList;
$data['sum_ying'] = $res_a[0]['sum_ying'] ?: 0;
$data['sum_shu'] = $res_a[0]['sum_shu'] ?: 0;
$data['count_ying']=$res_a[0]['count_ying']?:0;
$data['count_shu']=$res_a[0]['count_shu']?:0;
$data['sum_money'] = $sum_money ?: 0;
$data['total'] = ['name' => '合计', 'money_count' => $moneyCount, 'count' => $count];