@ -1255,16 +1255,17 @@ class FinanceController extends ThinkController
$map1['pay_type'] = 1;
$totalSpend = M('value_detail_log', 'tab_')->where($map1)->sum('value');
$totalSpend = empty($totalSpend) ? '0.00' : $totalSpend;
$totalSpend = number_format(abs($totalSpend),2,'.','');
$map2['create_time'] = $map['create_time'];
$map2['pay_type'] = 2;
$deposit = M('value_detail_log', 'tab_')->where($map2)->sum('value');
$deposit= empty($deposit) ? '0.00' : $deposit;
$deposit= empty($deposit) ? '0.00' : number_format( $deposit,2,'.','') ;
$map3['create_time'] = $map['create_time'];
$map3['pay_type'] = 3;
$allpromoteCoin = M('value_detail_log', 'tab_')->where($map3)->sum('value');
$allpromoteCoin = empty($promoteCoin) ? '0.00' : $promoteCoin;
$allpromoteCoin = empty($promoteCoin) ? '0.00' : number_format( $all promoteCoin,2,'.','') ;
$map4['create_time'] = $map['create_time'];
$banlace = M('value_detail_log', 'tab_')->field('user_id, after_value')->where($map4)->group('user_id')->select();
@ -1272,7 +1273,7 @@ class FinanceController extends ThinkController
foreach($banlace as $k222 => $vvv) {
$banlaceTotal += $vvv['after_value'];
}
$banlaceTotal = number_format($banlaceTotal,2,'.','');
$map['user_id'] = ['in', $ids];
$newValueByTimeDatas = M('value_detail_log', 'tab_')->field('user_id, after_value')->where($map)->group('user_id')->select();
// var_dump($newValueByTimeDatas);die();
@ -1309,7 +1310,7 @@ class FinanceController extends ThinkController
$this->display();
}
public function definiteDetaile() {
public function definiteDetaile($p=1 ) {
$page = intval($p);
$page = $page ? $page : 1; //默认显示第一页数据
$row=10;
@ -1328,10 +1329,12 @@ class FinanceController extends ThinkController
} elseif (empty($_REQUEST['timestart']) & & !empty($_REQUEST['timeend'])) {
$map['create_time'] = array('elt', (strtotime($_REQUEST['timeend']) + 86399));
}
$total = 0;
$total = '0.00';
$t = M('value_detail_log', 'tab_')->where($map)->sum('value');
$valueDetailDatas = M('value_detail_log', 'tab_')->field('order_number, user_id, before_value, value, after_value, create_time, type, remark, pay_type')
->where($map)
->page($page,$row)
->order('create_time desc')
->select();
$counts = M('value_detail_log', 'tab_')->field('id')
->where($map)
@ -1344,7 +1347,7 @@ class FinanceController extends ThinkController
$vlaueDetailDatas[$key]['pay_type'] = $valueDetailData['pay_type'];
if($valueDetailData['pay_type'] == 1) {
$vlaueDetailDatas[$key]['type'] = "消费";
$total - = $valueDetailData['value'];
$total + = $valueDetailData['value'];
}
if($valueDetailData['pay_type'] == 2) {
$vlaueDetailDatas[$key]['type'] = "充值";
@ -1355,17 +1358,24 @@ class FinanceController extends ThinkController
$total += $valueDetailData['value'];
}
}
if($total >= 0 ) {
$fuhao = '+' ;
if (!empty($vlaueDetailDatas[0]['after_value']) ) {
$totalAfterValue = number_format($vlaueDetailDatas[0]['after_value'],2,'.','') ;
}else {
$fuhao = '-';
}
$totalAfterValue = '0.00';
}
$total = number_format($total,2,'.','');
// if($total >= 0 ) {
// $fuhao = '+';
// }else {
// $fuhao = '-';
// }
$page = set_pagination($counts,$row);
if($page) {$this->assign('_page', $page);}
$this->assign('fuhao', $fuhao);
$this->assign('total', $total);
$this->assign('total', $t);
$this->assign('listdata', $vlaueDetailDatas);
$this->assign('totalAfterValue', $totalAfterValue);
$this->display();
}