diff --git a/Application/Admin/Controller/CompanyStatementPoolController.class.php b/Application/Admin/Controller/CompanyStatementPoolController.class.php index e9be8af63..50f3f3fba 100644 --- a/Application/Admin/Controller/CompanyStatementPoolController.class.php +++ b/Application/Admin/Controller/CompanyStatementPoolController.class.php @@ -605,7 +605,7 @@ class CompanyStatementPoolController extends ThinkController //周结算金额计算 for ($i=0;;$i++) { if ($sv[$i]['sum_money']) { - $game_data['week_amount'] += $sv[$i]['sum_money']- $sv[$i]['withhold']; + $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']; @@ -1705,6 +1705,10 @@ class CompanyStatementPoolController extends ThinkController $amount = 0; $statement_amount = 0; $statement_lack_amount = 0; + $reward = 0; + $fine = 0; + $lreward = 0; + $lfine = 0; foreach ($increment_ratio as $key => $value) { @@ -1720,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) { @@ -1745,6 +1750,7 @@ class CompanyStatementPoolController extends ThinkController $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_info[$k]['game_list'][$gk]['withhold']; + } } @@ -1753,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; @@ -1762,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'=>'保存成功']);