Merge pull request 'feature/statement_warning_change' (#491) from feature/statement_warning_change into master

Reviewed-on: http://8.136.139.249:3000/wmtx/platform/pulls/491
master
廖金灵 3 years ago
commit cb4721f5c1

@ -53,11 +53,12 @@ class StatementWarningController extends AdminController
private function getLastUpdate()
{
$preMonth = explode('-',date('Y-m',mktime(0,0,0,date('m',time()),1,date('Y',time()))-1));
$time =strtotime(date('Y',time()).'-'.date('m',time())."-1");
$nextMonth = explode('-', date('Y-m',strtotime('+32 day',$time)) );
$lastUpdate = $this->statementWarningModel->where([
'count_year'=>$preMonth[0],
'count_month'=>$preMonth[1],
'count_year'=>$nextMonth[0],
'count_month'=>$nextMonth[1],
"name"=>'wm_platm',
"type"=>1
])->field("create_time")->find();
@ -308,8 +309,8 @@ class StatementWarningController extends AdminController
{
if(!isset($_REQUEST['time'])) $this->error("参数错误");
$time =strtotime($_REQUEST['time']."-1");
$time = date('Y-m',strtotime('+32 day',$time));
$time =strtotime($_REQUEST['time']."-1")-1;
$time = date('Y-m',$time);
$params = "php ".SUBSITE_INDEX." StatementWarningSet/setFreeMonth/count_date/{$time}";
$r = D("CmdTasks")->addTask("StatementWarningSet",$params);
@ -422,11 +423,11 @@ class StatementWarningController extends AdminController
$poolname = 'up_statement';
}
$preMonth = explode('-',date('Y-m',mktime(0,0,0,$info['count_month'],1,$info['count_year'])-1));
$time =strtotime($info['count_year'].'-'.$info['count_month']."-1");
$nextMonth = explode('-', date('Y-m',strtotime('+32 day',$time)) );
$this->statementWarningModel->where([
'count_year'=>$preMonth[0],
'count_month'=>$preMonth[1],
'count_year'=>$nextMonth[0],
'count_month'=>$nextMonth[1],
'name'=>$poolname,
])->setDec('money',$diffMoney);
}

@ -68,15 +68,16 @@ class StatementWarningSetController extends Controller {
$count_date = date('Y',time()).'-'.(date('m',time()));
$this->configInit($count_date);
$preMonth = $this->getPreMonth();
$nextMonth = $this->getNextMonth();
$hasdb = $this->statementWarningModel->where([
'count_year'=>$preMonth[0],
'count_month'=>$preMonth[1],
'count_year'=>$nextMonth[0],
'count_month'=>$nextMonth[1],
"name"=>'wm_platm',
"type"=>1
])->find();
if(!$hasdb){
//第一次生成,同时上一次结扎
$preMonth = $this->getPreMonth();
$preCountMonth = $preMonth[0]."-".$preMonth[1];
$params = "php ".SUBSITE_INDEX." StatementWarningSet/setFreeMonth/count_date/{$preCountMonth}";
$time = time()+2*3600;
@ -366,12 +367,12 @@ class StatementWarningSetController extends Controller {
private function addStatementWarning($type,$name,$money,$issave = true)
{
//汇总表差一个月
$preMonth = $this->getPreMonth();
$nextMonth = $this->getNextMonth();
$savedata = [
'type'=>$type,
'name'=>$name,
'count_year'=>$preMonth[0],
'count_month'=>$preMonth[1]
'count_year'=>$nextMonth[0],
'count_month'=>$nextMonth[1]
];
$hasDb = $this->statementWarningModel->where($savedata)->find();
$savedata = array_merge(['money'=>$money,'create_time'=>time()],$savedata);
@ -440,7 +441,10 @@ class StatementWarningSetController extends Controller {
return explode('-',date("Y-m",$this->beginThismonth-1));
}
private function getNextMonth()
{
return explode('-',date("Y-m",$this->endThismonth+1));
}

@ -53,7 +53,7 @@
<div class="cf main-place top_nav_list navtab_list">
<h3 class="page_title">财务预警表</h3>
<p class="description_text">每日凌晨五点自动更新,如需获取时时数据,请手动进行【月份重算】/ 预警月份与时时表一个月</p>
<p class="description_text">每日凌晨五点自动更新,如需获取时时数据,请手动进行【月份重算】/ 预警月份与时时表一个月</p>
</div>
<style>
@ -234,14 +234,10 @@
var today = new Date();
today.setTime(today.getTime());
var year = today.getFullYear();
var month = today.getMonth()+1;
var month = today.getMonth()+1;//可以超出一个月
if(subtimeArr[0] > year){
layer.msg('要重算的月份必须小于当前时间');
return false;
}
if(subtimeArr[0] == year && subtimeArr[1] >= month){
layer.msg('要重算的月份必须小于当前月份');
if((subtimeArr[0]*12 + (subtimeArr[1]-0) ) > (year*12+month+1) ){
layer.msg('要重算的月份最多大于当前1个月');
return false;
}

Loading…
Cancel
Save