提交 24657eb5 authored 作者: chengye's avatar chengye

调整抄表模式,支持峰谷表手动输入汇总度数与单价

上级 3c7dc911
...@@ -59,54 +59,17 @@ class Em extends Base ...@@ -59,54 +59,17 @@ class Em extends Base
} }
//如果没有超过表 不论是峰谷表还是普通表 都是空的 //如果没有超过表 不论是峰谷表还是普通表 都是空的
if(!$ue) { if(!$ue) {
//如果不是详情页 $ue = new Useage();
$em->last_date = $em->init_date; $ue->last_date = $em->init_date;
$em->last_numb = $em->init_numb; $ue->last_sum_numb = $em->init_numb ?: 0;
//如果是峰谷表 初始化
if($em->rule->pricing_type == 2) {
$em->last_sum_numb = 0;
$ulist[] = ['typeName' => '尖峰段', 'last_numb' => 0, 'current_numb' => ''];
$ulist[] = ['typeName' => '峰段', 'last_numb' => 0, 'current_numb' => ''];
$ulist[] = ['typeName' => '谷段', 'last_numb' => 0, 'current_numb' => ''];
$ulist[] = ['typeName' => '平段', 'last_numb' => 0, 'current_numb' => ''];
} else {
$ulist[] = ['typeName' => '普通', 'last_numb' => 0, 'current_numb' => ''];
$em->last_sum_numb = $em->init_numb;
}
$em->useage = $ulist;
//历史抄表
if($em->rule->settle_type==1){
$em->is_history = 1;
}
} else { } else {
$em->last_date = $ue->current_date; if($curr == false){
$em->last_sum_numb = $ue->current_sum_numb; $ue->last_sum_numb = $ue->current_sum_numb;
$fields = 'last_numb,current_numb,price'; $ue->last_date = $ue->current_date;
if($em->rule->pricing_type == 2){
$ulist = UseageDetail
::field('case type
when 1 then "尖峰段"
when 2 then "峰段"
when 3 then "谷段"
when 4 then "平段"
else "普通" end as typeName
')
->field($fields)
->where(['useage_id'=>$ue->useage_id])->select();
foreach ($ulist as &$u){
$u->last_numb = $u->current_numb;
$u->current_numb = '';
$u->price = '';
}
$em->useage = $ulist;
} }
$em->photo = $ue->photo;
} }
$ue->price = $em->rule->pricing_type==1 ? $em->rule->pay_price : '';
$em->useage = $ue;
return $em; return $em;
} }
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论