Merge pull request '财务子系统bug修复' (#198) from feature/add_item into master

Reviewed-on: http://8.136.139.249:3000/wmtx/platform/pulls/198
master
廖金灵 4 years ago
commit a429003fa9

@ -472,15 +472,24 @@ class CompanyStatementController extends ThinkController
$promote_ids = array_column($promote_data,"id");
$statement_info = json_decode($value['statement_info'],true);
// dump($statement_info);
$statement_begin_time = $value['statement_begin_time'];
$statement_end_time = $value['statement_end_time'];
$user_data = SM("user", "tab_")
->field("id")
->where([
'promote_id' => ['in', $promote_ids],
"register_time" => ['between', [$statement_begin_time, $statement_end_time]]
])->select();
$amount_data['user_newcount'] += count($user_data);
if ($value['company_type'] == 1) {
$list = array_merge($list,$statement_info);
foreach ($statement_info as $k => $v) {
$statement_begin_time = strtotime(str_replace(".", "-", $v['statement_begin_time']));
$statement_end_time = strtotime(str_replace(".", "-", $v['statement_end_time'])) + 86399;
if (!$amount_data['statement_begin_time'] || $amount_data['statement_begin_time'] > $v['statement_begin_time']) {
$amount_data['statement_begin_time'] = $v['statement_begin_time'];
}
@ -489,13 +498,7 @@ class CompanyStatementController extends ThinkController
$amount_data['statement_end_time'] = $v['statement_end_time'];
}
$user_data = SM("user", "tab_")
->field("id")
->where([
'promote_id' => ['in', $promote_ids],
'fgame_name' => ['like', "%{$v['game_name']}%"],
"register_time" => ['between', [$statement_begin_time, $statement_end_time]]
])->select();
if ($v['game_name'] != '罚款' && $v['game_name'] != '奖励') {
$amount_data['pay_amount'] += $v["pay_amount"];
}
@ -504,7 +507,6 @@ class CompanyStatementController extends ThinkController
} else {
$amount_data['sum_money'] += $v["sum_money"];
}
$amount_data['user_newcount'] += count($user_data);
}
} elseif($value['company_type'] == 2) {
@ -516,8 +518,6 @@ class CompanyStatementController extends ThinkController
$list = array_merge($list,$game_list);
foreach ($game_list as $gk=>$gv) {
$statement_begin_time = strtotime(str_replace(".", "-", $gv['statement_begin_time']));
$statement_end_time = strtotime(str_replace(".", "-", $gv['statement_end_time'])) + 86399;
if (!$amount_data['statement_begin_time'] || $amount_data['statement_begin_time'] > $gv['statement_begin_time']) {
$amount_data['statement_begin_time'] = $gv['statement_begin_time'];
@ -527,13 +527,6 @@ class CompanyStatementController extends ThinkController
$amount_data['statement_end_time'] = $gv['statement_end_time'];
}
$user_data = SM("user", "tab_")
->field("id")
->where([
'promote_id' => ['in', $promote_ids],
'fgame_name' => ['like', "%{$gv['game_name']}%"],
"register_time" => ['between', [$statement_begin_time, $statement_end_time]]
])->select();
if ($gv['game_name'] != '罚款' && $gv['game_name'] != '奖励') {
$amount_data['pay_amount'] += $gv["pay_amount"];
}
@ -543,7 +536,7 @@ class CompanyStatementController extends ThinkController
} else {
$amount_data['sum_money'] += $gv["sum_money"];
}
$amount_data['user_newcount'] += count($user_data);
}
}
@ -629,21 +622,6 @@ class CompanyStatementController extends ThinkController
foreach ($company_id as $ckey => $cvalue) {
$use_data = [
"01"=>["time"=>"01"],
"02"=>["time"=>"02"],
"03"=>["time"=>"03"],
"04"=>["time"=>"04"],
"05"=>["time"=>"05"],
"06"=>["time"=>"06"],
"07"=>["time"=>"07"],
"08"=>["time"=>"08"],
"09"=>["time"=>"09"],
"10"=>["time"=>"10"],
"11"=>["time"=>"11"],
"12"=>["time"=>"12"],
];
$map["company_id"] = $cvalue;
$map['company_belong'] = 9;
@ -652,6 +630,21 @@ class CompanyStatementController extends ThinkController
->where($map)
->select();
$use_data = [
"01"=>["time"=>"01","show_company_name"=>$data[0]["company_name"]],
"02"=>["time"=>"02","show_company_name"=>$data[0]["company_name"]],
"03"=>["time"=>"03","show_company_name"=>$data[0]["company_name"]],
"04"=>["time"=>"04","show_company_name"=>$data[0]["company_name"]],
"05"=>["time"=>"05","show_company_name"=>$data[0]["company_name"]],
"06"=>["time"=>"06","show_company_name"=>$data[0]["company_name"]],
"07"=>["time"=>"07","show_company_name"=>$data[0]["company_name"]],
"08"=>["time"=>"08","show_company_name"=>$data[0]["company_name"]],
"09"=>["time"=>"09","show_company_name"=>$data[0]["company_name"]],
"10"=>["time"=>"10","show_company_name"=>$data[0]["company_name"]],
"11"=>["time"=>"11","show_company_name"=>$data[0]["company_name"]],
"12"=>["time"=>"12","show_company_name"=>$data[0]["company_name"]],
];
$row = 0;
foreach($data as $key => $value) {
@ -661,7 +654,7 @@ class CompanyStatementController extends ThinkController
$statement_info = $data[$key]['statement_info'];
$data[$key]['row'] = count($data[$key]['statement_info']);
$data[$key]['show_company_name'] = $value["company_name"];
$row += $data[$key]['row'];
foreach ($statement_info as $k => $v) {
@ -729,8 +722,6 @@ class CompanyStatementController extends ThinkController
$check_list = array_column(json_decode($_POST["list"],true),"game_name");
// dump($check_list);die();
if (!$company_id) {
$data = [];
} else {
@ -750,6 +741,22 @@ class CompanyStatementController extends ThinkController
$statement_info = json_decode($value['statement_info'], true);
$statement_begin_time = $value['statement_begin_time'];
$statement_end_time = $value['statement_end_time'];
$user_data = [];
if ($promote_ids) {
$user_data = SM("user", "tab_")
->field("id")
->where([
'promote_id' => ['in', $promote_ids?$promote_ids:0],
"register_time" => ['between', [$statement_begin_time, $statement_end_time]]
])->select();
}
$amount_data['user_newcount'] += count($user_data);
if ($value['company_type'] == 1) {
// $list = array_merge(, $statement_info);
@ -757,16 +764,7 @@ class CompanyStatementController extends ThinkController
if (!in_array($v["game_name"],$check_list)) {
array_push($list,$v);
}
$statement_begin_time = strtotime(str_replace(".", "-", $v['statement_begin_time']));
$statement_end_time = strtotime(str_replace(".", "-", $v['statement_end_time'])) + 86399;
$user_data = SM("user", "tab_")
->field("id")
->where([
'promote_id' => ['in', $promote_ids?$promote_ids:0],
'fgame_name' => ['like', "%{$v['game_name']}%"],
"register_time" => ['between', [$statement_begin_time, $statement_end_time]]
])->select();
if ($v['game_name'] != '罚款' && $v['game_name'] != '奖励') {
$amount_data['pay_amount'] += $v["pay_amount"];
}
@ -777,8 +775,6 @@ class CompanyStatementController extends ThinkController
$amount_data['sum_money'] += $v["sum_money"];
}
$amount_data['user_newcount'] += count($user_data);
}
} elseif($value['company_type'] == 2) {
foreach ($statement_info as $k => $v) {
@ -790,9 +786,6 @@ class CompanyStatementController extends ThinkController
array_push($list,$gv);
}
$statement_begin_time = strtotime(str_replace(".", "-", $gv['statement_begin_time']));
$statement_end_time = strtotime(str_replace(".", "-", $gv['statement_end_time'])) + 86399;
if (!$amount_data['statement_begin_time'] || $amount_data['statement_begin_time'] > $gv['statement_begin_time']) {
$amount_data['statement_begin_time'] = $gv['statement_begin_time'];
}
@ -801,14 +794,6 @@ class CompanyStatementController extends ThinkController
$amount_data['statement_end_time'] = $gv['statement_end_time'];
}
$user_data = SM("user", "tab_")
->field("id")
->where([
'promote_id' => ['in', $promote_ids?$promote_ids:0],
'fgame_name' => ['like', "%{$gv['game_name']}%"],
"register_time" => ['between', [$statement_begin_time, $statement_end_time]]
])->select();
if ($gv['game_name'] != '罚款' && $gv['game_name'] != '奖励') {
$amount_data['pay_amount'] += floatval($gv["pay_amount"]);
}
@ -818,8 +803,7 @@ class CompanyStatementController extends ThinkController
} else {
$amount_data['sum_money'] += floatval($gv["sum_money"]);
}
$amount_data['user_newcount'] += count($user_data);
}
}
}
@ -903,7 +887,7 @@ class CompanyStatementController extends ThinkController
$save['statement_begin_time'] = strtotime(str_replace(".", "-", $amount_data['statement_begin_time']));
$save['statement_end_time'] = strtotime(str_replace(".", "-", $amount_data['statement_end_time'])) + 86399;
$save['pay_amount'] = $amount_data['pay_amount'];
$save['sum_money'] = $amount_data['sum_money']-($amount_data['sum_money']*$_POST['fax_ratio']/100);
$save['sum_money'] = $amount_data['sum_money'];
$save['user_newcount'] = $amount_data['user_newcount'];
$save['fax_ratio'] = $_POST['fax_ratio'];
$save['statement_ids'] = $_POST['id'].','.$_POST['other_id'];

@ -118,8 +118,8 @@
<td>{$data[0]['game_name']}</td>
<td rowspan="{$row}" class="pay_amount">{$amount_data['pay_amount']}</td>
<td rowspan="{$row}" class="user_newcount">{$amount_data['user_newcount']}</td>
<td rowspan="{$row}" class="parent_fax_ratio"><input class="fax_ratio" type="text" class="txt" name="fax_ratio" value="0" placeholder="" style="width: 25px">%</td>
<td rowspan="{$row}" class="sum_money">{$amount_data['sum_money']}</td>
<td rowspan="{$row}" class="parent_fax_ratio"><input class="fax_ratio txt" type="text" name="fax_ratio" value="0" placeholder="" style="width: 25px">%</td>
<td rowspan="{$row}" class = "parent_sum_money"><input class="sum_money txt" type="text" name="sum_money" value="{$amount_data['sum_money']}" placeholder="" style="width: 88px;text-align: right;"></td>
</tr>
<foreach name="data" item="it" key="key">
@ -153,16 +153,23 @@
$(function () {
var sum_amount = parseFloat($(".sum_money").text());
var sum_amount = parseFloat($(".sum_money").val());
var row = 0;
var amount_datas;
var other_list;
var list = '{$js_data}';
var company_id;
var other_id;
var submit = 0;
$(".submit_btn").click(function () {
if (submit == 0) {
submit++;
} else {
return;
}
var id = "{$_GET['id']}";
if (!company_id) {
@ -195,6 +202,21 @@
});
$(".sum_money").blur(function() {
var pay_amount = parseFloat($(".pay_amount").text());
sum_amount = parseFloat($(this).val());
if (sum_amount > pay_amount) {
sum_amount = pay_amount;
$(this).val(sum_amount)
}
var jsonObj = JSON.parse(amount_datas);
jsonObj["sum_money"] = sum_amount;
amount_datas = JSON.stringify(jsonObj);
});
$("#promote_company").change(function () {
var begin = $(".time").data("begin");
var end = $(".time").data("end");
@ -212,7 +234,7 @@
$(".pay_amount").attr("rowspan",parseInt($(".pay_amount").attr('rowspan'))-row);
$(".user_newcount").attr("rowspan",parseInt($(".user_newcount").attr('rowspan'))-row);
$(".parent_fax_ratio").attr("rowspan",parseInt($(".parent_fax_ratio").attr('rowspan'))-row);
$(".sum_money").attr("rowspan",parseInt($(".sum_money").attr('rowspan'))-row);
$(".parent_sum_money").attr("rowspan",parseInt($(".parent_sum_money").attr('rowspan'))-row);
layer.load(2);
$.ajax({
@ -237,12 +259,12 @@
$(".pay_amount").text(data.amount_data['pay_amount']);
$(".user_newcount").text(data.amount_data['user_newcount']);
// $(".fax_ratio").text(data.amount_data['pay_amount']);
$(".sum_money").text(data.amount_data['sum_money']);
$(".sum_money").val(data.amount_data['sum_money']);
$(".pay_amount").attr("rowspan",parseInt($(".pay_amount").attr('rowspan'))+row);
$(".user_newcount").attr("rowspan",parseInt($(".user_newcount").attr('rowspan'))+row);
$(".parent_fax_ratio").attr("rowspan",parseInt($(".parent_fax_ratio").attr('rowspan'))+row);
$(".sum_money").attr("rowspan",parseInt($(".sum_money").attr('rowspan'))+row);
$(".parent_sum_money").attr("rowspan",parseInt($(".parent_sum_money").attr('rowspan'))+row);
sum_amount = data.amount_data['sum_money'];
amount_datas = JSON.stringify(data.amount_data);
other_list = JSON.stringify(data.list);
@ -269,7 +291,7 @@
sum_money = sum_amount-fax_amount;
$(".sum_money").text(sum_money.toFixed(2));
$(".sum_money").val(sum_money.toFixed(2));
});

@ -122,6 +122,7 @@
<div class="butnbox" >
<div class="butnlist jscheckbutn" style="margin-left: 2px">
<a class='butn' id='export'>批量导出</a>
<a class='butn' id='view_show'>查看</a>
</div>
</div>
@ -310,6 +311,36 @@
$("body").append(iframeExcel)
});
$("#view_show").click(function () {
var time = $("#year").val();
var text = $("input:checkbox[name='ids[]']:checked").map(function(index,elem) {
return $(elem).val();
}).get();
if(text.length > 20){
layer.msg("<font style='color:white'>" + '暂不支持超过20条的批量导出' + "</font>");
return;
}
if(text.length < 1){
layer.msg("<font style='color:white'>" + '请先选择要导出的公司' + "</font>");
return;
}
var url ="{:U('showCpStatementView')}"+"&company_id="+text.join(",")+"&time="+time;
layer.open({
type: 2,
title: "详情",
shadeClose: true,
shade: 0.8,
area: ['100%', '100%'],
content: url
});
});
$(".view").click(function () {
var company_id = $(this).data("company_id");
var time = $("#year").val();

@ -99,6 +99,7 @@
<!-- 表头 -->
<thead>
<tr>
<th>公司名称</th>
<th>结算时间</th>
<th>产品</th>
<th>联运流水</th>
@ -122,11 +123,12 @@
</if>
<foreach name="data" item="first_data" key="index" >
<foreach name="first_data" item="data">
<foreach name="first_data" item="datas">
<tr>
<td rowspan="{$data['row']}">{$time}年{$data["time"]}月</td>
<if condition="$data['statement_info'][0]['statement_type'] gt 0">
<td>{$data['statement_info'][0]['game_name']|default="--"}</td>
<td rowspan="{$datas['row']}">{$datas['show_company_name']}</td>
<td rowspan="{$datas['row']}">{$time}年{$datas["time"]}月</td>
<if condition="$datas['statement_info'][0]['statement_type'] gt 0">
<td>{$datas['statement_info'][0]['game_name']|default="--"}</td>
<td>--</td>
<td>--</td>
<td>--</td>
@ -134,22 +136,22 @@
<td>--</td>
<td>--</td>
<td>--</td>
<td><if condition="$data['statement_info'][0]['statement_type'] eq 2">-</if>{$data['statement_info'][0]['sum_money']|default="--"}</td>
<td><if condition="$datas['statement_info'][0]['statement_type'] eq 2">-</if>{$datas['statement_info'][0]['sum_money']|default="--"}</td>
<else/>
<td>{$data['statement_info'][0]['game_name']|default="--"}</td>
<td>{$data['statement_info'][0]['platform_money']|default="--"}</td>
<td>{$data['statement_info'][0]['aggregate_money']|default="--"}</td>
<td>{$data['statement_info'][0]['sum_amount']|default="--"}</td>
<td>{$data['statement_info'][0]['ratio']|default="--"}</td>
<td>{$data['statement_info'][0]['promote_ratio']|default="--"}</td>
<td>{$data['statement_info'][0]['fax_ratio']|default="--"}</td>
<td>{$data['statement_info'][0]['other_amount']|default="--"}</td>
<td>{$data['statement_info'][0]['sum_money']|default="--"}</td>
<td>{$datas['statement_info'][0]['game_name']|default="--"}</td>
<td>{$datas['statement_info'][0]['platform_money']|default="--"}</td>
<td>{$datas['statement_info'][0]['aggregate_money']|default="--"}</td>
<td>{$datas['statement_info'][0]['sum_amount']|default="--"}</td>
<td>{$datas['statement_info'][0]['ratio']|default="--"}</td>
<td>{$datas['statement_info'][0]['promote_ratio']|default="--"}</td>
<td>{$datas['statement_info'][0]['fax_ratio']|default="--"}</td>
<td>{$datas['statement_info'][0]['other_amount']|default="--"}</td>
<td>{$datas['statement_info'][0]['sum_money']|default="--"}</td>
</if>
</tr>
<foreach name="data['statement_info']" item="statement_info" key="skey">
<foreach name="datas['statement_info']" item="statement_info" key="skey">
<if condition="$skey gt 0">
<if condition="$statement_info['statement_type'] gt 0">
<td>{$statement_info['game_name']|default="--"}</td>
@ -180,6 +182,7 @@
<tr>
<td>小计</td>
<td>--</td>
<td>--</td>
<td>{$sum[$index]['platform_money']}</td>
<td>{$sum[$index]['aggregate_money']}</td>
<td>{$sum[$index]['sum_amount']}</td>

Loading…
Cancel
Save