下游结算单生成功能上传

master
zyx 5 years ago
parent a6b1194be0
commit 0aad9c4735

@ -270,9 +270,18 @@ class AjaxController extends ThinkController{
$statementData = json_decode($getStatementData['statement_info'],true);
$reward = 0;
$forfeit = 0;
if ($statementData) {
$data['sum'] = $getStatementData['statement_money'];
$data['pay_amount'] = $getStatementData['pay_amount'];
$data['reward'] = 0;
$data['forfeit'] = 0;
$handleStatementData = [];
foreach ($statementData as $key=>$sv) {
if ($sv['game_id']) {
@ -287,9 +296,15 @@ class AjaxController extends ThinkController{
$handleStatementData[$sv['game_id']][] = $nowVal;
} else {
$data['forfeit'] = $sv['sum_money'];
if ($sv['statement_type'] == 2) {
$data['reward'] += $sv['sum_money'];
} else if ($sv['statement_type'] == 1) {
$data['forfeit'] += $sv['sum_money'];
}
}
}
// dump($handleStatementData);die();
$first_party_info = json_decode($getStatementData['first_party_info'],true);
$second_party_info = json_decode($getStatementData['second_party_info'],true);
$data['game_ratio'] = $handleStatementData;
@ -358,6 +373,32 @@ class AjaxController extends ThinkController{
foreach ($value as $k => &$v) {
$startTime = strtotime($v['begin_time']);
$endTime = strtotime($v['end_time']);
$rewardData = M('reward_record','tab_')
->field("sum(tab_reward_record.money) as money,reward_type")
->join("left join (select * from tab_game group by relation_game_id)tab_game on tab_reward_record.relation_game_id=tab_game.relation_game_id")
->where(['company_type'=>2,'relation_game_name'=>['like',"%{$v['game_name']}%"],'company_id'=>$data['company_id'],'reward_time'=>['between',[$startTime,$endTime]]])
->group('reward_type')
->select();
foreach ($rewardData as $key => $valReward) {
if ($valReward['reward_type']==1) {
$reward = $reward + $valReward['money'];
} else if ($valReward['reward_type']==2) {
$forfeit = $forfeit + $valReward['money'];
}
}
// dump($reward);die();
if ($game_ratio[$v['game_name']]) {
$v['sum_amount'] = number_format($v['sum_amount'] + $game_ratio[$v['game_name']]['sum_amount'],2,'.','');
@ -370,6 +411,9 @@ class AjaxController extends ThinkController{
}
$data['reward'] = $reward;
$data['forfeit'] = $forfeit;
$yfData = M('tool','tab_')->where(['name'=>'company_info'])->find();
$yfData = json_decode($yfData['config'],true);

@ -315,10 +315,16 @@
}
str+="<tr class=''><td>-</td><td>罚款</td>" +
"<td><input value='0' style='width: 30px' class='forfeit'/></td>" +
"<td class = 'forfeit'>"+data.data.forfeit+"</td>" +
"<td>-</td>" +
"<td>-</td>" +
"<td>0</td>" +
"<td>"+data.data.forfeit+"</td>" +
"</tr>" +
"<tr class=''><td>-</td><td>奖励</td>" +
"<td class = 'reward'>"+data.data.reward+"</td>" +
"<td>-</td>" +
"<td>-</td>" +
"<td>"+data.data.reward+"</td>" +
"</tr>" +
"<tr><td>合计</td>" +
"<td>---</td>" +
@ -333,8 +339,20 @@
"<td>-</td>" +
"<td data-value='"+sum+"'>"+number_chinese(sum)+"</td>" +
"</tr>";
$("tbody").empty();
$("tbody").append(str);
console.log(parseFloat($(".reward").text()))
$('.sumAmount').text((parseFloat($('.sumAmount').text())+parseFloat($(".reward").text())-parseFloat($(".forfeit").text())).toFixed(2));
$('.sumAmount').attr('data-value',(parseFloat($('.sumAmount').text())+parseFloat($(".reward").text())-parseFloat($(".forfeit").text())).toFixed(2));
$('.sumAll').text((parseFloat($('.sumAll').text())+parseFloat($(".reward").text())-parseFloat($(".forfeit").text())).toFixed(2));
$('.sumAll').attr('data-value',(parseFloat($('.sumAll').text())+parseFloat($(".reward").text())-parseFloat($(".forfeit").text())).toFixed(2));
eventnew();
}
})
@ -442,10 +460,16 @@
}
str+="<tr class=''><td>-</td><td>罚款</td>" +
"<td><input value='0' style='width: 30px' class='forfeit'/></td>" +
"<td class = 'forfeit'>"+data.data.forfeit+"</td>" +
"<td>-</td>" +
"<td>-</td>" +
"<td>"+data.data.forfeit+"</td>" +
"</tr>" +
"<tr class=''><td>-</td><td>奖励</td>" +
"<td class = 'reward'>"+data.data.reward+"</td>" +
"<td>-</td>" +
"<td>-</td>" +
"<td>0</td>" +
"<td>"+data.data.reward+"</td>" +
"</tr>" +
"<tr><td>合计</td>" +
"<td>---</td>" +
@ -462,6 +486,15 @@
"</tr>";
$("tbody").empty();
$("tbody").append(str);
$('.sumAmount').text((parseFloat($('.sumAmount').text())+parseFloat($(".reward").text())-parseFloat($(".forfeit").text())).toFixed(2));
$('.sumAmount').attr('data-value',(parseFloat($('.sumAmount').text())+parseFloat($(".reward").text())-parseFloat($(".forfeit").text())).toFixed(2));
$('.sumAll').text((parseFloat($('.sumAll').text())+parseFloat($(".reward").text())-parseFloat($(".forfeit").text())).toFixed(2));
$('.sumAll').attr('data-value',(parseFloat($('.sumAll').text())+parseFloat($(".reward").text())-parseFloat($(".forfeit").text())).toFixed(2));
eventnew();
}
})
@ -568,10 +601,19 @@
var forfeit = {};
forfeit['type_name'] = '罚款';
forfeit['sum_money'] = $('.forfeit').val();
forfeit['sum_money'] = $('.forfeit').text();
forfeit['statement_type'] = 1;
pushStatement.push(forfeit);
var reward = {};
reward['type_name'] = '奖励';
reward['sum_money'] = $('.reward').text();
reward['statement_type'] = 2;
pushStatement.push(reward);
// console.log(pushStatement);
sumData['statement_money'] = $(".sumAll").text();

@ -262,11 +262,17 @@
}
str+="<tr class=''><td>-</td><td>罚款</td>" +
"<td><input value='"+data.data.forfeit+"' style='width: 30px' class='forfeit'/></td>" +
"<td class = 'forfeit'>"+data.data.forfeit+"</td>" +
"<td>-</td>" +
"<td>-</td>" +
"<td>"+data.data.forfeit+"</td>" +
"</tr>" +
"<tr class=''><td>-</td><td>奖励</td>" +
"<td class = 'reward'>"+data.data.reward+"</td>" +
"<td>-</td>" +
"<td>-</td>" +
"<td>"+data.data.reward+"</td>" +
"</tr>" +
"<tr><td>合计</td>" +
"<td>---</td>" +
"<td class='sumAmount' data-value='"+sumAmount+"'>"+data.data.pay_amount+"</td>" +
@ -282,6 +288,14 @@
"</tr>";
$("tbody").empty();
$("tbody").append(str);
// $('.sumAmount').text((parseFloat($('.sumAmount').text())+parseFloat($(".reward").text())-parseFloat($(".forfeit").text())).toFixed(2));
// $('.sumAmount').attr('data-value',(parseFloat($('.sumAmount').text())+parseFloat($(".reward").text())-parseFloat($(".forfeit").text())).toFixed(2));
//
//
// $('.sumAll').text((parseFloat($('.sumAll').text())+parseFloat($(".reward").text())-parseFloat($(".forfeit").text())).toFixed(2));
// $('.sumAll').attr('data-value',(parseFloat($('.sumAll').text())+parseFloat($(".reward").text())-parseFloat($(".forfeit").text())).toFixed(2));
eventnew();
}
})

Loading…
Cancel
Save