$map["_string"] = "(c.statement_begin_time <= {$time_end} ) OR (c.statement_end_time <= {$time_end})";
}
if(isset($_REQUEST['pay_status'])){
$map['c.pay_status'] = $_REQUEST['pay_status'];
}
//其他
if(isset($_REQUEST['company_type'])){
@ -115,9 +118,12 @@ class CompanyStatementOfflineController extends ThinkController
$v['oplist'] = $this->OpAuth($v);
}
$count = SM("company_statement_info","tab_")->alias("c")->field("count(c.id) count,sum(c.statement_money) statement_money")->join("tab_company_statement_pool as p ON c.pool_id = p.id")->where($map)->find();
// dd($count);
//pay_status
$field = "count(c.id) count,IFNULL(SUM(CASE WHEN pay_status = 1 THEN c.statement_money ELSE 0 END),0) as success_money,
IFNULL(SUM(CASE WHEN pay_status = 0 THEN c.statement_money ELSE 0 END),0) as statement_money,
IFNULL(SUM(CASE WHEN pay_status = -1 THEN c.statement_money ELSE 0 END),0) as error_money";
$count = SM("company_statement_info","tab_")->alias("c")->field($field)->join("tab_company_statement_pool as p ON c.pool_id = p.id")->where($map)->find();