新增财务汇总重算

master
chenzhi 4 years ago
parent b19d73388b
commit 57abd846c6

@ -29,13 +29,7 @@ class FinancialSummaryController extends AdminController
if(!IS_ROOT){
$this->OpAuthList= getModuleControllerAuth();
}
$this->assign('menubtn',$this->menuAuth());
$lastRecount = D("CmdTasks")->getTypeLastTask("FinancialSummary");
if(!$lastRecount){
$lastRecount = "无";
}
$this->assign('lastRecount',$lastRecount);
$this->assign('menubtn',$this->menuAuth());
$this->getYearList();
$this->getYearData();
$this->display();
@ -43,9 +37,10 @@ class FinancialSummaryController extends AdminController
}
public function updateStatement()
{
$temp = date('Y-m',strtotime(date('Y',time()).'-'.(date('m',time())-1).'-01'));
$params = "php ".SUBSITE_INDEX." FinancialSummarySet/setMonthFinancialSummary/recount/1/count_date/{$temp}";
if(!isset($_REQUEST['time'])) $this->error("参数错误");
$time = $_REQUEST['time'];
$params = "php ".SUBSITE_INDEX." FinancialSummarySet/setMonthFinancialSummary/recount/1/count_date/{$time}";
$r = D("CmdTasks")->addTask("FinancialSummary",$params);
if($r){
$this->ajaxReturn(["success"=>"ok"]);

@ -225,6 +225,24 @@
</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>
@ -285,26 +303,70 @@
window.location.href = url;
});
$("#updateStatement").on("click",function(){
layer.confirm("重算需要花费2分钟左右时间,并且只统计上个月信息,无需重算请取消,上次重算时间【{$lastRecount}】",{title:false}, function(index){
$.ajax({
type: 'post',
url: "{:U('updateStatement')}",
data:{},
success: function(data) {
if(data.success){
layer.alert('添加重算任务成功请2分钟后刷新查看',function(){
window.location.reload();
});
}else{
layer.alert('添加任务失败,已有重算任务。请等待上个重算任务完成');
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;
}
},
error:function(){
layer.alert("网络错误或超时");
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;
}
});
});
}
});
})
//回车自动提交

Loading…
Cancel
Save