新增预警列表

master
chenzhi 4 years ago
parent 7a248e44d4
commit fc381eca8b

@ -0,0 +1,282 @@
<?php
namespace Admin\Controller;
use Think\Controller;
/**
* cp/公会对账单
* ThinkController
*/
class StatementWarningController extends AdminController
{
private $statementWarningKey;
private $statementWarningModel;
private $statementWarningInfoModel;
private $statementWarningType=[
1=>'业务收入',
2=>'业务成本',
3=>'毛利',
4=>'营业利润'
];
//创建
public function _initialize(){
//初始化
$this->statementWarningModel=M("statement_warning","tab_");
$this->statementWarningInfoModel=M("statement_warning_info","tab_");
$this->statementWarningKey=A("StatementWarningSet")->getStatementWarningKey();
parent::_initialize();
}
public function lists()
{
if(!array_key_exists("year",$_REQUEST)){
$this->redirect(ACTION_NAME, array('year' => date('Y',time())));
}
$year = $_REQUEST['year'];
$yearData = $this->statementWarningModel->where("count_year = '{$year}'")->select();
$yearData = $this->setWaringDataShow( $this->setWaringDataCount( $this->resetWaringData($yearData) ) );
$isCan = D("CmdTasks")->isCanAddTask("StatementWarningSet");
$this->assign("is_can",$isCan);
$this->assign("data",$yearData);
$this->getLastUpdate();
$this->getYearList();
$this->display();
}
private function getLastUpdate()
{
$lastUpdate = $this->statementWarningModel->where([
'count_year'=>$_REQUEST['year'],
"name"=>'wm_platm',
"type"=>1
])->field("MAX(count_month),create_time")->find();
if($lastUpdate){
$lastUpdate = date('Y-m-d H:i:s',$lastUpdate['create_time']);
}else{
$lastUpdate = '未更新';
}
$this->assign('last_update', $lastUpdate);
}
private function resetWaringData($data)
{
$sendData = [];
foreach ($this->statementWarningType as $key => $va) {
$sendData[$key] = [
'name'=>$va,
'list'=>[],
'count'=>[0,0,0,0,0,0,0,0,0,0,0,0,0]
];
if($key == 3){
$sendData[$key]['list']['margin_ratio'] = [0,0,0,0,0,0,0,0,0,0,0,0,0];
}
if($key == 4){
$sendData[$key]['list']['profit_ratio'] = [0,0,0,0,0,0,0,0,0,0,0,0,0];
}
}
foreach ($data as $k => $v) {
$name = $v['name'];
$typelist = &$sendData[$v['type']]['list'];
if( !isset($typelist[$name]) ){
$typelist[$name] = [0,0,0,0,0,0,0,0,0,0,0,0,0];
}
$typelist[$name][$v['count_month']-1] = $v['money'];
}
return $sendData;
}
private function setWaringDataCount($data)
{
//业务成本/收入
for ($type=1; $type < 3; $type++) {
foreach ($data[$type]['list'] as $k => &$item) {
$item[12] = array_sum($item);
for ($i=0; $i < 13; $i++) {
$data[$type]['count'][$i] += $item[$i];
}
}
}
//毛利
$data[3]['list']['费用'][12] = array_sum($data[3]['list']['费用']);
$data[3]['list']['其他收入'][12] = array_sum($data[3]['list']['其他收入']);
for ($i=0; $i < 13; $i++) {
$data[3]['count'][$i] = $data[1]['count'][$i]-$data[2]['count'][$i];
$data[4]['count'][$i] = ($data[3]['count'][$i]-$data[3]['list']['费用'][$i]+$data[3]['list']['其他收入'][$i]);
if($data[1]['count'][$i] != 0){
$data[3]['list']['margin_ratio'][$i] = round( $data[3]['count'][$i]/$data[1]['count'][$i],4);
$data[4]['list']['profit_ratio'][$i] = round($data[4]['count'][$i]/$data[1]['count'][$i],4);
}
}
return $data;
}
private function setWaringDataShow($data)
{
foreach ($data as $type => $item) {
for ($i=0; $i < 13; $i++) {
$data[$type]['count'][$i] = round($data[$type]['count'][$i]/10000,2);
}
foreach ($item['list'] as $name => $value) {
for ($i=0; $i < 13; $i++) {
if( in_array($name,['margin_ratio','profit_ratio']) ){
$value[$i] = ( ($value[$i]*100)."%");
}else{
$value[$i] = round($value[$i]/10000,2);
}
}
unset($data[$type]['list'][$name]);
if(isset($this->statementWarningKey[$name])){
$data[$type]['list'][$name]['name'] = $this->statementWarningKey[$name];
$data[$type]['list'][$name]['list'] = $value;
$data[$type]['list'][$name]['is_edit'] = 0;
}else{
$data[$type]['list'][$name]['name'] = $name;
$data[$type]['list'][$name]['list'] = $value;
$data[$type]['list'][$name]['is_edit'] = 1;
}
}
}
return $data;
}
//获取历史年份
private function getYearList()
{
$star = 2021;
$end = date("Y",time());
$list = [];
for ($i=$star; $i <= $end; $i++) {
$temp = array(
"value"=>$i,
"name"=>"{$i}年"
);
$list[] = $temp ;
}
$this->assign('YearList', $list);
}
public function edit()
{
$act = $_REQUEST['act'];
$isEdit = 1;
if($act == 'add'){
$isEdit = 0;
$this->assign('is_edit', 0);
}else{
$this->assign('is_edit', 1);
}
$this->getYearList();
if(IS_POST) {
$parm = I('post.');
if(count($parm['value']) < 12){
$this->ajaxReturn(["msg"=>"不想添加的月份请设置值为0不能为空","code"=>0]);
}
if($parm['is_edit'] == 0){
$this->doAdd($parm);
}else{
$this->doEdit($parm);
}
$this->ajaxReturn(["msg"=>"添加成功","code"=>1,"url"=>U("lists")]);
}else{
if($isEdit == 1){
$this->resetWarningData();
$this->assign('title', '编辑预警类目');
}else{
$this->assign('title', '新增预警类目');
}
$this->display();
}
}
private function doAdd($p)
{
$adddata = [];
$baseArray = [
'count_year'=>$p['year'],
'type'=>$p['type'],
'name'=>trim($p['name']),
'create_time'=>time()
];
for ($i=0; $i < 12; $i++) {
if($p['value'][$i] != 0){
$countMoth = ($i-0+1);
if(strlen($countMoth) < 2) $countMoth="0".$countMoth;
$baseArray['count_month'] = $countMoth;
$baseArray['money'] = $p['value'][$i]*10000;
$adddata[] = $baseArray;
}
}
if(empty($adddata)){
$this->ajaxReturn(["msg"=>"添加失败,值不能全为0","code"=>0]);
}
$res = $this->statementWarningModel->addAll($adddata);
if(!$res){
$this->ajaxReturn(["msg"=>"添加失败","code"=>0]);
}
}
private function resetWarningData()
{
$where = [
'name'=>$_REQUEST['name'],
'count_year'=>$_REQUEST['count_year']
];
$data = $this->statementWarningModel->where($where)->select();
$sendData = [
'count_year'=>$data[0]['count_year'],
'type'=>$data[0]['type'],
'name'=>$data[0]['name'],
'value'=>[0,0,0,0,0,0,0,0,0,0,0,0],
'ids'=>[0,0,0,0,0,0,0,0,0,0,0,0]
];
foreach ($data as $key => $value) {
$sendData['value'][$value['count_month']-1] = $value['money']/10000;
$sendData['ids'][$value['count_month']-1] = $value['id'];
}
$this->assign('data', $sendData);
}
private function doEdit($p)
{
$adddata = [];
$baseArray = [
'count_year'=>$p['year'],
'type'=>$p['type'],
'name'=>trim($p['name']),
'create_time'=>time()
];
for ($i=0; $i < 12; $i++) {
$id = $p['ids'][$i];
$money = $p['value'][$i];
if($id > 0){
$save['id'] = $id;
$save['money'] = $p['value'][$i]*10000;
$save['name'] = trim($p['name']);
$this->statementWarningModel->save($save);
continue;
}
if($money != 0){
$countMoth = ($i-0+1);
if(strlen($countMoth) < 2) $countMoth="0".$countMoth;
$baseArray['count_month'] = $countMoth;
$baseArray['money'] = $p['value'][$i]*10000;
$adddata[] = $baseArray;
}
}
if(!empty($adddata)){
$this->statementWarningModel->addAll($adddata);
}
}
public function updateStatement()
{
if(!isset($_REQUEST['time'])) $this->error("参数错误");
$time = $_REQUEST['time'];
$params = "php ".SUBSITE_INDEX." StatementWarningSet/setFreeMonth/count_date/{$time}";
$r = D("CmdTasks")->addTask("StatementWarningSet",$params);
if($r){
$this->ajaxReturn(["success"=>"ok"]);
}else{
$this->ajaxReturn(["error"=>"error"]);
}
}
}

@ -26,7 +26,9 @@ class StatementWarningSetController extends Controller {
'wm_platm'=>'万盟平台',
'up_statement'=>'上游',
'pc_statement'=>'下游内团',
'pu_statement'=>'下游外团'
'pu_statement'=>'下游外团',
'margin_ratio'=>'毛利率',
'profit_ratio'=>'利润率'
];
private $statementWarningModel;
@ -81,6 +83,7 @@ class StatementWarningSetController extends Controller {
D("CmdTasks")->addScheduleTask("StatementWarningSet",$params,$time);
}
$this->setStatementWarning();
$this->setDefaultStatementWarning();
}
/**
* 更新某月毛利数据
@ -89,6 +92,7 @@ class StatementWarningSetController extends Controller {
{
$this->configInit($count_date);
$this->setStatementWarning();
$this->setDefaultStatementWarning();
}
/**
@ -199,6 +203,30 @@ class StatementWarningSetController extends Controller {
$this->statementWarningModel->add($saveData);
}
}
/**
* 添加默认信息
*/
private function setDefaultStatementWarning()
{
$Where = [
"count_month"=>$this->month,
"count_year"=>$this->year,
"name"=>'费用',
"type"=>3
];
$hasDb = $this->statementWarningModel->where($Where)->find();
$saveData = array_merge(['money'=>700000,'create_time'=>time()],$Where);
if(!$hasDb){
$this->statementWarningModel->add($saveData);
}
$Where['name'] = '其他收入';
$hasDb = $this->statementWarningModel->where($Where)->find();
$saveData = array_merge(['money'=>26000,'create_time'=>time()],$Where);
if(!$hasDb){
$this->statementWarningModel->add($saveData);
}
}
/**
* 获取上游的结算金额
*/
@ -407,7 +435,7 @@ class StatementWarningSetController extends Controller {
$statementAmount = 0;
foreach ($company as $key => $value) {
$statementMoney = array_key_exists('statement_money',$value) ? ($value['statement_money']-0) : 0;
$statementAmount += $statementMoney;
$company[$key]['is_wm'] = $this->getCompanyIsWm($key,$companyBelong);
$company[$key]['company_belong'] = $companyBelong;
$company[$key]['count_month'] = $this->month;
@ -420,6 +448,7 @@ class StatementWarningSetController extends Controller {
$company[$key]['wm_amount'] = 0;
$company[$key]['other_amount'] = $statementMoney;
}
$statementAmount += $company[$key]['wm_amount'];
$id = $this->statementWarningInfoModel->where([
'count_year'=>$this->year,
'count_month'=>$this->month,

@ -0,0 +1,248 @@
<extend name="Public/base" />
<block name="body">
<link rel="stylesheet" href="__CSS__/select2.min.css" type="text/css" />
<link rel="stylesheet" type="text/css" href="__CSS__/admin_table.css" media="all">
<link href="__STATIC__/icons_alibaba/iconfont.css" rel="stylesheet">
<script type="text/javascript" src="__STATIC__/uploadify/jquery.uploadify.min.js"></script>
<script type="text/javascript" src="__STATIC__/provincecityarea/AreaData_min.js"></script>
<script src="__STATIC__/layer/layer.js"></script>
<script type="text/javascript" src="__JS__/select2.min.js"></script>
<style>
.tabcon1711 input.time {
width: 150px;
}
#form .txt_area {
width: 300px;
height: 150px;
}
.tabcon1711 .form_unit {
margin-left: 2px;
}
.tabcon1711 .mustmark {
margin-left:-7px;
}
.list-ratio {
display: table;
}
.list-ratio .li-ratio {
display: flex;
margin-bottom: 20px;
align-items: center;
}
.list-ratio .li-ratio .turnover, .list-ratio .li-ratio .turnover-ratio {
position: relative;
}
.list-ratio .li-ratio .turnover span, .list-ratio .li-ratio .turnover-ratio .error-message {
color: red;
position: absolute;
left: 0;
top: 30px;
white-space: nowrap;
display: none;
}
.iconfont-btn {
cursor: pointer;
}
.iconfont-style {
font-size: 18px;
color: #fff;
border-radius: 4px;
border: 0;
padding: 5px;
margin-left: 10px;
}
.iconfont-selected {
background-color: #0A9AF2;
}
.iconfont-selected:hover {
background-color: #03a9f4;
}
.iconfont-unselected {
background-color: #999;
}
.iconfont-unselected:hover {
background-color: #ababab;
}
input[type=number]{
padding: 4px 6px;
font-size: 12px;
line-height: 20px;
color: #555;
vertical-align: middle;
-webkit-border-radius: 4px;
-moz-border-radius: 4px;
border-radius: 4px;
background-color: #fff;
border: 1px solid #ccc;
-webkit-box-shadow: inset 0 1px 1px rgba(0,0,0,0.075);
-moz-box-shadow: inset 0 1px 1px rgba(0,0,0,0.075);
box-shadow: inset 0 1px 1px rgba(0,0,0,0.075);
-webkit-transition: border linear .2s, box-shadow linear .2s;
-moz-transition: border linear .2s, box-shadow linear .2s;
-o-transition: border linear .2s, box-shadow linear .2s;
transition: border linear .2s, box-shadow linear .2s;
}
</style>
<div class="cf main-place top_nav_list navtab_list">
<h3 class="page_title">{$title}</h3>
<p class="description_text">说明:单位(万元)</p>
</div>
<!-- 标签页导航 -->
<div class="tab-wrap">
<div class="tab-content tabcon1711">
<!-- 表单 -->
<form id="form" action="{:U('edit')}" method="post" class="form-horizontal">
<!-- 基础文档模型 -->
<div id="tab1" class="tab-pane in tab1">
<table border="0" cellspacing="0" cellpadding="0">
<tbody>
<input type="text" name="is_edit" id="is_edit" value="{$is_edit}" style="display: none;">
<if condition="$is_edit eq 1">
<input type="text" name="year" value="{$data['count_year']}" style="display: none;">
<input type="text" name="type" value="{$data['type']}" style="display: none;">
</if>
<if condition="($data['name'] eq '费用') OR ($data.name eq '其他收入')">
<input type="text" name="name" value="{$data['name']}" style="display: none;">
</if>
<tr>
<td class="l"><i class="mustmark">*</i>年度:</td>
<td class="r table_radio">
<div style="float: left;">
<select id="year" name="year" style="width:150px;" <if condition="$is_edit eq 1">disabled</if> >
<volist name="YearList" id="vo">
<option value="{$vo.value}" <if condition="$vo.value eq $data['count_year']">selected
</if> >{$vo.name}</option>
</volist>
</select>
</div>
</td>
</tr>
<tr>
<td class="l"><i class="mustmark">*</i>类型:</td>
<td class="r table_radio">
<div style="float: left;">
<select id="type" name="type" style="width:150px;" <if condition="$is_edit eq 1">disabled</if> >
<option value="1" <if condition="1 eq $data['type']">selected </if> >业务收入</option>
<option value="2" <if condition="2 eq $data['type']">selected </if> >业务成本</option>
</select>
</div>
</td>
</tr>
<tr>
<td class="l"><i class="mustmark">*</i>类型名称:</td>
<td class="r table_radio">
<div style="float: left;">
<input type="text" class="txt ratio" name="name" id="name" value="{$data['name']}" placeholder="请输入名称" style="width: 150px;" <if condition="($data['name'] eq '费用') OR ($data.name eq '其他收入')">disabled</if>>
</div>
</td>
</tr>
<if condition="$is_edit eq 0">
<for start="0" end="12">
<tr>
<td class="l">{$i-0+1}月份:</td>
<td class="r table_radio">
<div style="float: left;">
<input type="number" class="txt ratio" name="value[]" id="name" value="0" placeholder="" οninput="value=value.replace(/[^\w\.\/]/ig, '')" style="width: 150px;">
</div>
</td>
</tr>
</for>
<else />
<for start="0" end="12">
<tr>
<td class="l">{$i-0+1}月份:</td>
<td class="r table_radio">
<div style="float: left;">
<input type="number" class="txt ratio" name="ids[]" value="{$data['ids'][$i]}" style="display: none;">
<input type="number" class="txt ratio" name="value[]" id="name" value="{$data['value'][$i]}" placeholder="" οninput="value=value.replace(/[^\w\.\/]/ig, '')" style="width: 150px;">
</div>
</td>
</tr>
</for>
</if>
</tbody>
</table>
</div>
<div class="form-item cf">
<button class="submit_btn mlspacing" id="submit" type="submit" target-form="form-horizontal">
保存
</button>
<a class="submit_btn " alt="返回上一页" title="返回上一页" href="javascript:window.history.back();" >
返回
</a>
</div>
</form>
</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 src="__STATIC__/czinputcheck.js?v=1.29" type="text/javascript"></script>
<script type="text/javascript">
//导航高亮
highlight_subnav("{:U('lists')}");
$(".select_gallery").select2();
$(function(){
subevn();
function subevn(){
$('#submit').off("click");
$('#submit').click(function (e) {
//查看是否报错
var name = $("#name").val();
if(name.length < 1){
layer.msg("名称不能为空", {icon: 2});
return false;
}
var target = $('form').get(0).action;
var query = $('form').serialize();
var that = this;
$(that).addClass('disabled').attr('autocomplete','off').prop('disabled',true);
$.post(target,query).success(function(data){
if(layer) {layer.closeAll('loading');}
if (data.code==1) {
if (data.url) {
updateAlert(data.msg + ' 页面即将自动跳转~');
}else{
updateAlert(data.msg);
}
setTimeout(function(){
$(that).removeClass('disabled').prop('disabled',false);
if (data.url) {
location.href=data.url;
}else if( $(that).hasClass('no-refresh')){
$('#tip').find('.tipclose').click();
}else{
location.reload();
}
},1500);
}else{
$(that).removeClass('disabled').prop('disabled',false);
layer.msg(data.msg,{icon: 2});
}
});
});
}
});
</script>
</block>

@ -0,0 +1,296 @@
<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;
}
.butnbox {padding:10px 0 15px;}
.butnbox .butnlist {overflow:hidden;clear:both;}
.butnbox .butnlist .butn,.butnbox .butnlist .butn:hover {text-decoration:none;border:none;}
.butnbox .butnlist .butn {display:inline-block;width:120px;height:28px;line-height:28px;text-align:center;color:#FFF;background:#3C95C8;border-radius:3px;}
.butnbox .butnlist .butn.last {background:#009900;}
.butnbox .butnlist .butn~.butn {margin-left:20px;}
.data_list table td{
border-right: 0;
}
</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" style="margin-bottom: 10px;">
<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">
<a class="sch-btn" href="javascript:;" id="search"
url="{:U('lists','model='.$model['name'] .'&row='.I('row'),false)}">
搜索</a>
</div>
</div>
</div>
<div class="butnbox">
<div class="butnlist jscheckbutn" style="margin-left: 2px">
<if condition="$is_can">
<a class='butn' id='updateStatement' style='background-color: #3C95C8;'>月份重算</a>
</if>
<a class='butn' href="{:U('edit?act=add')}" style='background-color: #3C95C8;'>新增类目</a>
</div>
</div>
<!-- 数据列表 -->
<div class="data_list">
<div style="display: flex;line-height: 3;justify-content:space-between;">
<div style="color: red;">
结算时间:{$last_update}
</div>
<div style="color: red;">
单位:万元
</div>
</div>
<table>
<thead>
<tr>
<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><th>操作</th>
</tr>
</thead>
<tbody>
<volist name="data" id="item" key="type">
<tr style="background-color: #F0F5F7;border: 0;font-weight: 600;font-size: 14px;">
<td>{$item.name}</td>
<for start="0" end="13">
<td>{$item['count'][$i]}</td>
</for>
<td></td>
</tr>
<foreach name="item.list" item="vo" key="k" >
<tr style="background-color: #fff;">
<td>{$vo['name']}</td>
<for start="0" end="13">
<td>{$vo['list'][$i]}</td>
</for>
<td>
<if condition="$vo.is_edit eq 1 ">
<a href="{:U('edit?act=edit',array('name'=>$vo['name'],'count_year'=>I('year')))}">编辑</a>
<if condition="($vo['name'] neq '费用') AND ($vo.name neq '其他收入')">
<a style="color: red;" href="{:U('verifyDel',array('id'=>$data['id']))}" class="confirm ajax-get">删除</a>
</if>
</if>
</td>
</tr>
</foreach>
</volist>
</tbody>
</table>
<div style="width: 100%;height: 50px;"></div>
</div>
<script type="text/html" id="updateStatementTpl">
<div style="padding:10px 40px 30px;">
<spend style="font-size:14px;color:#666;">
按月份对汇总数据进行重算任务提交成功后大约需等待3-5分钟才会完成重算
</spend>
<table border="0" cellspacing="0" cellpadding="0" style="margin-top:30px;">
<tr>
<td class="l noticeinfo" style="width:80px;">重算月份:</td>
<td class="r table_radio">
<input type="text" id="updateStatementTime" name="updateStatementTime" autocomplete="off" class="date" placeholder="重算月份" />
</td>
</tr>
</table>
<button class="submit_btn mlspacing" id="updateStatementSubmit" type="submit" style="margin-top:30px;">
保存
</button>
</div>
</script>
</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 () {
});
</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;
});
$("#updateStatement").on("click",function(){
var html = $("#updateStatementTpl").html();
layer.open({
type: 1,
title: "汇总重算",
maxWidth:720,
closeBtn: 1,
shadeClose: true,
content: html,
success:function(){
$("#updateStatementSubmit").off("click");
$("#updateStatementTime").datetimepicker({
format: 'yyyy-mm',
language: "zh-CN",
showMeridian:true,
pickDate:true,
startView: 3,
minView: 3,
autoclose: true,
pickTime:true
});
$("#updateStatementSubmit").on("click",function() {
var subtime= $("#updateStatementTime").val();
if(subtime == ''){
layer.msg('请先选择要重算的月份');
return false;
}
var subtimeArr = subtime.split("-");
var today = new Date();
today.setTime(today.getTime());
var year = today.getFullYear();
var month = today.getMonth()+1;
if(subtimeArr[0] > year){
layer.msg('要重算的月份必须小于当前时间');
return false;
}
if(subtimeArr[0] == year && subtimeArr[1] > month){
layer.msg('要重算的月份必须小于当前时间');
return false;
}
$.ajax({
type: 'post',
url: "{:U('updateStatement')}",
data:{time:subtime},
success: function(data) {
if(data.success){
layer.alert('添加重算任务成功请2分钟后刷新查看',function(){
window.location.reload();
});
}else{
layer.alert('添加任务失败,已有重算任务。请等待上个重算任务完成');
}
},
error:function(){
layer.alert("网络错误或超时");
return false;
}
});
});
}
});
})
//回车自动提交
$('.jssearch').find('input').keyup(function (event) {
if (event.keyCode === 13) {
$("#search").click();
}
});
})
</script>
</block>
Loading…
Cancel
Save