<script>
var fyczd = "field11037"; // 隐藏字段(总明细行)
var jzrq = "field11036";//考勤结束日期
var ksrq = "field6262";//考勤开始日期
$(function(){
var nodenum = $("#nodesnum0").val();
WfForm.changeFieldValue(fyczd, {value:nodenum});
_customAddFun0 = function(){
var value = $("#nodesnum0").val();
WfForm.changeFieldValue(fyczd, {value:value});
}
checkCustomize = function(){
var fjzrq = WfForm.getFieldValue(jzrq);
var fksrq = WfForm.getFieldValue(ksrq);
var myDate = new Date(); //当前日期
var myksDate1 = new Date(fksrq); //上次考勤开始日
var myDate1 = new Date(fjzrq); //上次考勤截止日
var myDate2= new Date(new Date(new Date().toLocaleDateString()).getTime());//当天凌晨时间
var days=(myDate.getTime() - myDate1.getTime())/86400000;
var days2=(myDate2.getTime() - myDate1.getTime())/86400000;
if(Number(days)<=Number(days2)|| Number(days2)<=0){
WfForm.showMessage("当天补卡必须次日进行提交申请 !", 2, 3);
return false;
}
var month = myDate.getMonth()+1;
var year = myDate.getYear();
var month2 = myDate1.getMonth()+1;
var year2= myDate1.getYear();
var day2Time = myDate.getDate();
var ksyear = myksDate1.getYear();
var ksmonth = myksDate1.getMonth()+1;
if(Number(ksmonth)!=Number(month2)){
WfForm.showMessage("补卡申请不能跨月申请,请分批申请!", 2, 3);
return false;
}
if(Number(year)==Number(year2)){
if((Number(month)-Number(month2))>1){
WfForm.showMessage("不能补上个月之前的卡!", 2, 3);
return false;
}
if((Number(month)-Number(month2))>=1&&Number(day2Time)>=3){
WfForm.showMessage("上个月的补卡只能在下个月的三号之前提交!", 2, 3);
return false;
}
}else if(Number(year)-1==Number(year2)){
if((Number(month)-Number(month2))>1){
WfForm.showMessage("不能补上个月之前的卡!", 2, 3);
return false;
}
if(Number(month2)==12&&Number(month)>=1&&Number(day2Time)>=3){
WfForm.showMessage("上个月的补卡只能在下个月的三号之前提交!", 2, 3);
return false;
}
}
return true;
}
})
</script>
|