财务汇总ok

master
chenzhi 5 years ago
parent aaf67b85cc
commit 2fe965749e

@ -0,0 +1,126 @@
<?php
namespace Admin\Controller;
class FinancialSummaryController extends AdminController
{
public $keyname=array(
"cash_spend"=>"现金充值收入",
"balance_coin_spend"=>"平台币充值收入",
"balance_coin_income"=>"平台币消耗",
"game_supersign_income"=>"超级签购买收入",
"test_user_income"=>"测试收入",
"reward_count"=>"奖励",
"fine_count"=>"违规处罚",
"inside_count"=>"内团",
"outer_count"=>"外团",
"inside_count"=>"内团",
"outer_count"=>"外团",
"gfwx_count"=>"官方-微信",
"gfzfb_count"=>"官方-支付宝",
"sqzfb_count"=>"双乾-支付宝",
"sqkj_count"=>"双乾-快捷",
"wx_count"=>"微信",
"zfb_count"=>"支付宝",
"kj_count"=>"快捷"
);
public function _initialize()
{
parent::_initialize();
// echo "<pre>";
}
public function index($p=1)
{
if(!array_key_exists("year",$_REQUEST) || !array_key_exists("type",$_REQUEST)){
$this->redirect(ACTION_NAME, array('year' => date('Y',time()),"type"=>2));
}
$this->getYearList();
$this->getYearData();
$this->display();
}
//获取指定年份数据
public function getYearData()
{
$senddata = array(
"income"=>[
"count"=>[0,0,0,0,0,0,0,0,0,0,0,0,0]
],
"promote"=>[
"count"=>[0,0,0,0,0,0,0,0,0,0,0,0,0]
],
"channel"=>[
"count"=>[0,0,0,0,0,0,0,0,0,0,0,0,0]
],
"payway"=>[
"count"=>[0,0,0,0,0,0,0,0,0,0,0,0,0]
]
);
$data = [];
//初始化数据
foreach ($this->keyname as $k => $v) {
$data[$k] = array("name"=>$v,"money"=>[0,0,0,0,0,0,0,0,0,0,0,0,0]);
}
$map = array(
"count_year"=>$_REQUEST['year'],
"type"=>array("IN","1,{$_REQUEST['type']},4,5")
);
$dbres = M("FinancialSummary","tab_")->field("*")->where($map)->select();
foreach ($dbres as $k => $v) {
if($v['type'] == 1){
if(!in_array($v['key_name'],$senddata['income']['list'])){
$senddata['income']['list'][] = $v['key_name'];
}
}
if($v['type'] == 4){
if(!in_array($v['key_name'],$senddata['channel']['list'])){
$senddata['channel']['list'][] = $v['key_name'];
}
}
if($v['type'] == 5){
if(!in_array($v['key_name'],$senddata['payway']['list'])){
$senddata['payway']['list'][] = $v['key_name'];
}
}
if($v['type'] == $_REQUEST['type']){
if(!in_array($v['key_name'],$senddata['promote']['list'])){
$senddata['promote']['list'][] = $v['key_name'];
}
}
$data[$v['key_name']]["money"][((int)$v['count_month']-1)] = $v['sum_money'];
# code...
}
foreach ($senddata as $k => $v) {
foreach ($v as $ke => $va) {
if($ke !='count'){
foreach ($va as $key => $val) {
for ($i=0; $i < 12; $i++) {
$data[$val]["money"][12] += $data[$val]["money"][$i];
$senddata[$k]['count'][$i] += $data[$val]["money"][$i];
$senddata[$k]['count'][12] +=$data[$val]["money"][$i];
}
$senddata[$k][$ke][$key] = $data[$val];
}
}
}
}
$this->assign('data', $senddata);
}
//获取历史年份
public function getYearList()
{
$star = 2019;
$end = date("Y",time());
$list = [];
for ($i=$star; $i <= $end; $i++) {
$temp = array(
"value"=>$i,
"name"=>"{$i}年"
);
$list[] = $temp ;
}
$this->assign('YearList', $list);
}
}

@ -0,0 +1,442 @@
<extend name="Public/base" />
<block name="body">
<link rel="stylesheet" href="__CSS__/select2.min.css" type="text/css" />
<script type="text/javascript" src="__JS__/bootstrap.min.js"></script>
<script type="text/javascript" src="__JS__/select2.min.js"></script>
<script type="text/javascript" src="__STATIC__/layer3/layer.js"></script>
<style>
.select2-container--default .select2-selection--single {
color: #000;
resize: none;
border-width: 1px;
border-style: solid;
border-color: #a7b5bc #ced9df #ced9df #a7b5bc;
box-shadow: 0px 3px 3px #F7F8F9 inset;
height: 35px;
height: 28px;
border-radius: 3px;
font-size: 12px;
}
.select2-container--default .select2-selection--single .select2-selection__rendered {
line-height: 35px;
line-height: 28px;
}
.select2-container--default .select2-selection--single .select2-selection__arrow {
height: 26px;
}
.select2-container--default .select2-search--dropdown .select2-search__field {
height: 26px;
line-height: 26px;
font-size: 12px;
}
.select2-results__option[aria-selected] {
font-size: 12px;
}
.tooltip {
position: relative;
/* display: block; */
/* color: #056dae; */
}
.tooltip .tooltiptext {
display: none;
width: 100%;
background-color: #fff;
text-align: center;
border-radius: 6px;
padding: 5px 10px 5px 5px;
position: absolute;
z-index: 1;
bottom: 80%;
left: 0;
border: #000 solid 1px;
line-height: 20px;
}
.tooltip .tooltiptext::after {
content: "";
position: absolute;
top: 100%;
left: 50%;
margin-left: -5px;
border-width: 5px;
border-style: solid;
border-color: black transparent transparent transparent;
}
.tooltip:hover .tooltiptext {
color: #333;
display: block;
}
</style>
<!-- 标题栏 -->
<div class="cf main-place top_nav_list navtab_list">
<h3 class="page_title">财务汇总统计</h3>
<p class="description_text"></p>
</div>
<style>
</style>
<div class="cf top_nav_list">
<!-- 高级搜索 -->
<div class="jssearch search_list fl cf">
<div class="input-list search-title-box">
<label>搜索:</label>
</div>
<div class="input-list input-list-resway search_label_rehab">
<select id="year" name="year" class="select_gallery" style="width:150px;">
<volist name="YearList" id="vo">
<option value="{$vo.value}" <if condition="I('year') && $vo.value eq I('year')">selected
</if> >{$vo.name}</option>
</volist>
</select>
</div>
<div class="input-list input-list-resway search_label_rehab">
<select id="type" name="type" class="select_gallery" style="width:150px;">
<option value="2" <if condition="I('type') && $vo.value eq 2">selected
</if> >不包含绑币</option>
<option value="3" <if condition="I('type') && $vo.value eq 3">selected
</if> >包含绑币</option>
</select>
</div>
<input type="hidden" name="" value="" class="sortBy">
<div class="input-list">
<a class="sch-btn" href="javascript:;" id="search"
url="{:U('FinancialSummary/index','model='.$model['name'] .'&row='.I('row'),false)}">
搜索</a>
</div>
</div>
</div>
<!-- 数据列表 -->
<div class="data_list">
<table>
<caption class="" style="text-align: left;font-size: 20px;font-weight: 600;">按收入类型</caption>
<thead>
<tr>
<th>序号</th><th>流水类型</th><th>1月</th><th>2月</th><th>3月</th><th>4月</th><th>5月</th><th>6月</th><th>7月</th><th>8月</th><th>9月</th><th>10月</th><th>11月</th><th>12月</th><th>年度合计</th>
</tr>
</thead>
<tbody>
<volist name="data.income.list" id="income" key="incomekey">
<tr>
<td>{$incomekey}</td>
<td>{$income.name}</td>
<volist name="income.money" id="incomemoney" >
<td>{$incomemoney}</td>
</volist>
</tr>
</volist>
<tr class="data_summary">
<td colspan="2" style="text-align: center;">合计:</td>
<volist name="data.income.count" id="incomecount" >
<td>{$incomecount}</td>
</volist>
</tr>
</tbody>
</table>
<table style="margin-top: 30px;">
<caption class="" style="text-align: left;font-size: 20px;font-weight: 600;">按合作方类型</caption>
<thead>
<tr>
<th>序号</th><th>流水类型</th><th>1月</th><th>2月</th><th>3月</th><th>4月</th><th>5月</th><th>6月</th><th>7月</th><th>8月</th><th>9月</th><th>10月</th><th>11月</th><th>12月</th><th>年度合计</th>
</tr>
</thead>
<tbody>
<volist name="data.promote.list" id="promote" key="promotekey">
<tr>
<td>{$promotekey}</td>
<td>{$promote.name}</td>
<volist name="promote.money" id="promotemoney" >
<td>{$promotemoney}</td>
</volist>
</tr>
</volist>
<tr class="data_summary">
<td colspan="2" style="text-align: center;">合计:</td>
<volist name="data.promote.count" id="promotecount" >
<td>{$promotecount}</td>
</volist>
</tr>
</tbody>
</table>
<table style="margin-top: 30px;">
<caption class="" style="text-align: left;font-size: 20px;font-weight: 600;">按支付渠道类型</caption>
<thead>
<tr>
<th>序号</th><th>流水类型</th><th>1月</th><th>2月</th><th>3月</th><th>4月</th><th>5月</th><th>6月</th><th>7月</th><th>8月</th><th>9月</th><th>10月</th><th>11月</th><th>12月</th><th>年度合计</th>
</tr>
</thead>
<tbody>
<volist name="data.channel.list" id="channel" key="channelkey">
<tr>
<td>{$channelkey}</td>
<td>{$channel.name}</td>
<volist name="channel.money" id="channelmoney" >
<td>{$channelmoney}</td>
</volist>
</tr>
</volist>
<tr class="data_summary">
<td colspan="2" style="text-align: center;">合计:</td>
<volist name="data.channel.count" id="channelcount" >
<td>{$channelcount}</td>
</volist>
</tr>
</tbody>
</table>
<table style="margin-top: 30px;">
<caption class="" style="text-align: left;font-size: 20px;font-weight: 600;">支付类型类型</caption>
<thead>
<tr>
<th>序号</th><th>流水类型</th><th>1月</th><th>2月</th><th>3月</th><th>4月</th><th>5月</th><th>6月</th><th>7月</th><th>8月</th><th>9月</th><th>10月</th><th>11月</th><th>12月</th><th>年度合计</th>
</tr>
</thead>
<tbody>
<volist name="data.payway.list" id="payway" key="paywaykey">
<tr>
<td>{$paywaykey}</td>
<td>{$payway.name}</td>
<volist name="payway.money" id="paywaymoney" >
<td>{$paywaymoney}</td>
</volist>
</tr>
</volist>
<tr class="data_summary">
<td colspan="2" style="text-align: center;">合计:</td>
<volist name="data.payway.count" id="paywaycount" >
<td>{$paywaycount}</td>
</volist>
</tr>
</tbody>
</table>
<div style="width: 100%;height: 50px;"></div>
</div>
</block>
<block name="script">
<link href="__STATIC__/datetimepicker/css/datetimepicker.css" rel="stylesheet" type="text/css">
<php>if(C('COLOR_STYLE')=='blue_color') echo '
<link href="__STATIC__/datetimepicker/css/datetimepicker_blue.css" rel="stylesheet" type="text/css">';</php>
<link href="__STATIC__/datetimepicker/css/dropdown.css" rel="stylesheet" type="text/css">
<script type="text/javascript" src="__STATIC__/datetimepicker/js/bootstrap-datetimepicker.min.js"></script>
<script type="text/javascript" src="__STATIC__/datetimepicker/js/locales/bootstrap-datetimepicker.zh-CN.js"
charset="UTF-8"></script>
<script type="text/javascript">
</script>
<script type="text/javascript">
//导航高亮
highlight_subnav('{:U("FinancialSummary/index")}');
$(function () {
<volist name=":I('get.')" id="vo">
Think.setValue('{$key}',"{$vo}");
</volist>
});
</script>
<script type="text/javascript">
$(function () {
$(".coin-detail").click(function () {
var pay_type = $(this).data('pay_type');
var url = $(this).data('url');
var title = pay_type == -1 ? '内充支出明细' :(pay_type == 0 ? '平台币直充明细': '平台币内充明细');
layer.open({
type: 2,
title: title,
shadeClose: true,
shade: 0.8,
area: ['70%', '80%'],
content: url
});
});
$(".select_gallery").select2();
//搜索功能
$("#search").click(function () {
var url = $(this).attr('url');
var query = $('.jssearch').find('input').serialize();
query += "&" + $('.jssearch').find('select').serialize();
query = query.replace(/(&|^)(\w*?\d*?\-*?_*?)*?=?((?=&)|(?=$))/g, '');
query = query.replace(/^&/g, '');
if (url.indexOf('?') > 0) {
url += '&' + query;
} else {
url += '?' + query;
}
var start = $("#time_start").val();
var end = $("#time_end").val();
if (start != '' && end != '') {
if (Date.parse(start) > Date.parse(end)) {
layer.msg('开始时间必须小于等于结束时间');
return false;
}
}
window.location.href = url;
});
$(".paixu").click(function () {
var that = $(this);
$data_order = that.attr('data-order');
$order_type = '{$userarpu_order}';
if ($order_type == '' || $order_type == '4') {
$(".sortBy").attr('name', 'data_order');
val = '3,' + $data_order;
$(".sortBy").attr('value', val);
$("#search").click();
} else if ($order_type == '3') {
$(".sortBy").attr('name', 'data_order');
val = '4,' + $data_order;
$(".sortBy").attr('value', val);
$("#search").click();
}
});
$('.jssamlllist').click(function () {
var that = $(this), url = that.attr('data-url');
var url =
layer.open({
type: 2,
title: "【" + that.attr('data-account') + "】小号列表",
shadeClose: true,
shade: 0.8,
area: ['1062px', '80%'],
content: url,//iframe的url
});
return false;
});
$(".paixu").click(function () {
var val = $(this).attr('data-order');
if (val == 1) {
val = 2;
} else if (val == 2) {
val = 1;
}
var name = $(this).attr('name');
if (name == 'balance_status') {
$('#key').val(1);
} else {
$('#key').val(2);
}
$("#" + name).val(val);
$("#search").click();
});
//回车自动提交
$('.jssearch').find('input').keyup(function (event) {
if (event.keyCode === 13) {
$("#search").click();
}
});
$("#total_status").click(function () {
$("#search").click();
})
$('#time_start').datetimepicker({
format: 'yyyy-mm-dd',
language: "zh-CN",
minView: 2,
autoclose: true
});
$('#datetimepicker').datetimepicker({
format: 'yyyy-mm-dd',
language: "zh-CN",
minView: 2,
autoclose: true,
pickerPosition: 'bottom-left'
})
var promote_id = "{:I('promote_id')}";
var company_id = "{:I('company_id')}";
function getPromotersByCompanyid() {
var company_id = $("#company_id option:selected").val();
if(!company_id){
company_id = -1;
}
$.ajax({
url: "{:U('Ajax/getPromotersByCompanyid')}",
type: "get",
data: { company_id:company_id},
dataType: 'json',
success: function (response) {
str = '<option value="">请选择会长</option>';
if(company_id == 0 || company_id ==-1){
str +='<option value="0"' + (promote_id && 0 == promote_id ? 'selected' : '') + '>官方渠道</option>';
}
data = response.data;
for (var i in data) {
str += "<option value='" + data[i].id + "' " + (promote_id && data[i].id == promote_id ? 'selected' : '') + ">" + data[i].nickname + "</option>"
}
$("#promote_id").empty();
$("#promote_id").append(str);
$("#promote_id").select2();
}
})
}
getPromotersByCompanyid();
$("#company_id").change(function(){
getPromotersByCompanyid();
})
})
function shenhe(status) {
var text = $("input:checkbox[name='ids[]']:checked").map(function (index, elem) {
return $(elem).val();
}).get().join("\n");
var desc = '';
if (status == 0) {
desc = '锁定';
} else {
desc = '开启';
}
layer.prompt({
formType: 2,
value: text,
placeholder: '玩家账号(一个账号一行)',
title: '请输入要' + desc + '的玩家账号(一个账号一行)',
area: ['800px', '350px'] //自定义文本域宽高
}, function (value, index, elem) {
if (value == '') {
layer.msg("请输入账户ID");
return;
}
$.ajax({
cache: true,
type: "POST",
url: "{:U('Member/lock_status')}",
data: { accounts: value, lock_status: status },// 你的formid
async: false,
error: function (data) {
layer.alert("服务器故障,请稍后重试!", { icon: 2 });
},
success: function (data) {
// var obj = JSON.parse(data);
// layer.alert(obj.info,{icon:obj.status})
layer.alert(data.info, { icon: data.status })
window.location.reload()
}
});
layer.close(index);
});
}
</script>
</block>
Loading…
Cancel
Save