$map["_string"] = "(c.statement_begin_time <= {$time_end} ) OR (c.statement_end_time <= {$time_end})";
$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'])){
if(isset($_REQUEST['company_type'])){
@ -67,7 +70,7 @@ class CompanyStatementOfflineController extends ThinkController
->alias("c")
->alias("c")
->field("c.*,p.statement_num,p.verify_status")
->field("c.*,p.statement_num,p.verify_status")
->where($map)
->where($map)
->where(['p.verify_status'=>['neq',6]])
->where('p.verify_status <> 6')
->join("tab_company_statement_pool as p ON c.pool_id = p.id")
->join("tab_company_statement_pool as p ON c.pool_id = p.id")
->order("id desc")
->order("id desc")
->select();
->select();
@ -81,10 +84,8 @@ class CompanyStatementOfflineController extends ThinkController
->alias("c")
->alias("c")
->field("c.*,p.statement_num,p.verify_status")
->field("c.*,p.statement_num,p.verify_status")
->where($map)
->where($map)
->where(['p.verify_status'=>['neq',6]])
->where('p.verify_status <> 6')
->join("tab_company_statement_pool as p ON c.pool_id = p.id")
->join("tab_company_statement_pool as p ON c.pool_id = p.id")
->page($page,$row)
->page($page,$row)
->order("id desc")
->order("id desc")
->select();
->select();
@ -117,9 +118,12 @@ class CompanyStatementOfflineController extends ThinkController
$v['oplist'] = $this->OpAuth($v);
$v['oplist'] = $this->OpAuth($v);
}
}
//pay_status
$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();
$field = "count(c.id) count,IFNULL(SUM(CASE WHEN pay_status = 1 THEN c.statement_money ELSE 0 END),0) as success_money,
// dd($count);
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();