@ -294,6 +294,11 @@ class CompanyStatementPoolController extends ThinkController
$v['statement_money'] = "=ROUND(";
}
$handle_data = $this->changeDataStruct($v['statement_info'],$is_export,$week_line);
$v['statement_info'] = $handle_data;
$row = 0;
foreach($v['statement_info'] as $ke=>& $va){
$va['row'] = count($va['game_list']);
@ -336,15 +341,13 @@ class CompanyStatementPoolController extends ThinkController
$v['statement_money'] .= "N{$line}+";
}else{
$count['platform_amount'] += $val['pay_amount'];
$count['sum_money'] += $val['sum_money'];
// $count['sum_money'] += $val['sum_money'];
}
}
$count['week_money'] += $va['week_amount'];
$count['sum_money'] += $va['week_amount'];
}
$handle_data = $this->changeDataStruct($v['statement_info'],$is_export,$week_line);
$v['statement_info'] = $handle_data;
$v['row'] = $row;
if($is_export){
if($v['withdraw_type'] != 3) {
@ -388,6 +391,10 @@ class CompanyStatementPoolController extends ThinkController
$v['statement_money'] = "=ROUND(";
}
$handle_data = $this->changeDataStruct($v['statement_info'],$is_export,$week_line);
$v['statement_info'] = $handle_data;
$row = 0;
foreach($v['statement_info'] as $ke=>& $va){
$va['row'] = count($va['game_list']);
@ -430,15 +437,13 @@ class CompanyStatementPoolController extends ThinkController
$v['statement_money'] .= "N{$line}+";
}else{
$count['platform_amount'] += $val['pay_amount'];
$count['sum_money'] += $val['sum_money'];
// $count['sum_money'] += $val['sum_money'];
}
}
$count['week_money'] += $va['week_amount'];
$count['sum_money'] += $va['week_amount'];
}
$handle_data = $this->changeDataStruct($v['statement_info'],$is_export,$week_line);
$v['statement_info'] = $handle_data;
$v['row'] = $row;
if($is_export){
if($v['withdraw_type'] != 3) {
@ -484,7 +489,7 @@ class CompanyStatementPoolController extends ThinkController
$v['statement_money'] = "=ROUND(";
}
$handle_data = $this->changeDataStruct($v['statement_info'],$is_export,$week_line);
// dump($handle_data);
$v['statement_info'] = $handle_data;
$row = 0;
foreach($v['statement_info'] as $ke=>& $va){
@ -515,17 +520,19 @@ class CompanyStatementPoolController extends ThinkController
if($v['withdraw_type'] != 3) {
$val['sum_money'] = "=ROUND((K{$line}-L{$line})*(M{$line}+N{$line}),2)";
} else {
$val['sum_money'] = "=ROUND(K{$line}*(N{$line}),2)";
$val['sum_money'] = "=ROUND(( K{$line}-L{$line}) *(N{$line}),2)";
}
$v['statement_money'] .= "S{$line}+";
}else{
$count['platform_amount'] += $val['pay_amount'];
$count['week_money'] += $val['sum_money'];
$count['sum_money'] += $val['sum_money'];
// $count['sum_money'] += $val['sum_money'];
}
}
$count['week_money'] += $va['week_amount'];
$count['sum_money'] += $va['week_amount'];
}
// dump($count);
$v['row'] = $row;
@ -598,7 +605,7 @@ class CompanyStatementPoolController extends ThinkController
//周结算金额计算
for ($i=0;;$i++) {
if ($sv[$i]['sum_money']) {
$game_data['week_amount'] += $sv[$i]['sum_money'];
$game_data['week_amount'] += $sv[$i]['sum_money']- $sv[$i]['withhold']+$sv[$i]['reward']-$sv[$i]['fine'] ;
$game_data['withhold_amount'] += $sv[$i]['withhold'];
$game_data['fine'] += $sv[$i]['fine'];
$game_data['reward'] += $sv[$i]['reward'];
@ -696,7 +703,7 @@ class CompanyStatementPoolController extends ThinkController
}
}
// dump($handle_data);
return $handle_data?$handle_data:[];
}
@ -1698,8 +1705,12 @@ class CompanyStatementPoolController extends ThinkController
$amount = 0;
$statement_amount = 0;
$statement_lack_amount = 0;
$reward = 0;
$fine = 0;
$lreward = 0;
$lfine = 0;
// dump($increment_ratio);
foreach ($increment_ratio as $key => $value) {
$statement_info = array();
@ -1713,6 +1724,7 @@ class CompanyStatementPoolController extends ThinkController
$statement_data = $model->where(['id'=>$key])->find();
$statement_info = json_decode($statement_data['statement_info'],true);
foreach ($statement_info as $k => $v) {
@ -1732,12 +1744,13 @@ class CompanyStatementPoolController extends ThinkController
$statement_info[$k]['game_list'][$gk]['sum_money'] = $sum_money[$key][$v['account']][$gk];
$amount += $sum_money[$key][$v['account']][$gk];
$amount += $sum_money[$key][$v['account']][$gk] - $statement_info[$k]['game_list'][$gk]['withhold'] ;
if ($st[$key][$akey] == 1) {
$statement_amount += $sum_money[$key][$v['account']][$gk];
$statement_amount += $sum_money[$key][$v['account']][$gk]-$statement_info[$k]['game_list'][$gk]['withhold'] ;
} else {
$statement_lack_amount += $sum_money[$key][$v['account']][$gk];
$statement_lack_amount += $sum_money[$key][$v['account']][$gk]-$statement_info[$k]['game_list'][$gk]['withhold'];
}
}
@ -1746,7 +1759,16 @@ class CompanyStatementPoolController extends ThinkController
$statement_info_data = json_encode($statement_info);
$model->where(['id'=>$key])->save(['statement_info'=>$statement_info_data,'statement_money'=>$amount,'pay_amount'=>$amount,'remark'=>$remark[$key]]);
$r_data = $model->field("fine,reward")->where(['id'=>$key])->find();
if($model == M("company_statement_info","tab_")) {
$reward += $r_data['reward'];
$fine += $r_data['fine'];
} else {
$lreward += $r_data['reward'];
$lfine += $r_data['fine'];
}
$model->where(['id'=>$key])->save(['statement_info'=>$statement_info_data,'statement_money'=>$amount+($r_data['reward']?$r_data['reward']:0)-($r_data['fine']?$r_data['fine']:0),'pay_amount'=>$amount,'remark'=>$remark[$key]]);
$amount = 0;
@ -1755,7 +1777,7 @@ class CompanyStatementPoolController extends ThinkController
}
M("company_statement_pool","tab_")->where(['id'=>$id])->save(['pay_amount'=>$statement_amount,'statement_money'=>$statement_amount,'lack_statement_money'=>$statement_lack_amount]);
M("company_statement_pool","tab_")->where(['id'=>$id])->save(['pay_amount'=>$statement_amount,'statement_money'=>$statement_amount+$reward-$fine ,'lack_statement_money'=>$statement_lack_amount+$lreward-$lfine ]);
$this->ajaxReturn(['status'=>1,'info'=>'保存成功']);