优化管理后台线下打款合计字段

master
chenzhi 4 years ago
parent fa514335cd
commit 35c25119e4

@ -47,6 +47,9 @@ class CompanyStatementOfflineController extends ThinkController
$time_end = strtotime($_REQUEST['time_end'])+ 86399;
$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);
}
//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();
$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);
$params['p'] = $page;
$params['row'] = $row;
$page = set_pagination($count['count'], $row, $params);
@ -128,6 +134,7 @@ class CompanyStatementOfflineController extends ThinkController
$this->assign('data',$data);
$this->assign('count',$count);
$this->assign('CompanyType',$this->CompanyType);
$this->assign("PayStatus", $this->PayStatus);
$this->display();
}

@ -117,6 +117,14 @@
<div class="input-list">
<input style="width: 200px;" type="text" name="company_name" class="search-input" value="{:I('company_name')}" placeholder="请输入公司名称搜索">&nbsp;
</div>
<div class="input-list input-list-promote search_label_rehab">
<select id="pay_status" name="pay_status" class="select_gallery" >
<option value="">打款状态</option>
<volist name="PayStatus" id="vo">
<option value="{$key}" <if condition="isset($_GET['pay_status']) && $key eq I('pay_status')">selected</if> >{$vo}</option>
</volist>
</select>
</div>
<div class="input-list">
<input style="width: 200px;" type="text" name="statement_pool_num" class="search-input" value="{:I('statement_pool_num')}" placeholder="请输入汇总单号">&nbsp;
@ -195,7 +203,8 @@
</td>
</tr>
</volist>
<tr><td style="line-height: 42px;">合计</td><td colspan="12" style="line-height: 42px;">结算总金额:&nbsp;{$count.statement_money}</td></tr>
<tr><td style="line-height: 42px;">合计</td><td colspan="12" style="line-height: 42px;">待打款金额:&nbsp;{$count.statement_money}&nbsp;&nbsp;&nbsp;&nbsp;打款成功金额:&nbsp;{$count.success_money}&nbsp;&nbsp;&nbsp;&nbsp;打款失败金额:&nbsp;{$count.error_money}</td></tr>
</notemtpy>
</tbody>
</table>

Loading…
Cancel
Save