日期:2014-05-16 浏览次数:20425 次
function renderer_Meta_notice(value, cellmeta, record){
??? var now = new Date();
??? var yy = now.getFullYear();//系统年份4位
??? var mm = now.getMonth()+1;//系统月份
??? var dd = now.getDate();//系统当前几号(1-31)
???
??? var endtime = record.get("Meta_Contract_End_Date");//给定的时间
??? var etyy='',etmm='',etdd='';//结束时间的年、月、日
??? var styy='',stmm='',stdd='';//结束时间的前一个月的年、月、日
??? if(endtime!=null && endtime!=''){
??? ??? endtime = endtime.substring(0,10);
??? ??? var arr = endtime.split('-');
??? ??? etyy = arr[0];
??? ??? etmm = arr[1];
??? ??? erdd = arr[2];
??? ???
??? ??? stmm = etmm-1;
??? ??? if(stmm==0){
??? ??? ??? styy=-1;
??? ??? ??? stmm=12;
??? ??? }
??? ??? styy = styy+etyy;
??? ??? var new_date = new Date(styy,stmm,1);
??? ??? var theMouMaxDate = (new Date(new_date.getTime()-1000*60*60*24)).getDate();//获得当前给定时间前一个月的月份的日期最大值
??? ??? if(erdd>theMouMaxDate){
??? ??? ??? stdd = theMouMaxDate;
??? ??? }else{
??? ??? ??? stdd = erdd;
??? ??? }
??? ??? if(value==""){
??? ??? ??? value="no_food.jpg";
??? ??? }
??? ??? if(yy>=styy && yy<=etyy){
??? ??? ??? if(yy>styy && yy<etyy){
??? ??? ??? ??? return "<img src='/upload/"+value+"' width='20px' height='20px'/>";
??? ??? ??? }else if(yy==styy && mm>stmm && yy<etyy){
??? ??? ??? ??? return "<img src='/upload/"+value+"' width='20px' height='20px'/>";
??? ??? ??? }else if(yy==styy && mm==stmm && dd>stdd && yy<etyy){
??? ??? ??? ??? return "<img src='/upload/"+value+"' width='20px' height='20px'/>";
??? ??? ??? }else if(yy==styy && mm==stmm && dd==stdd && yy<etyy){
??? ??? ??? ??? return "<img src='/upload/"+value+"' width='20px' height='20px'/>";
??? ??? ??? }else if(yy>styy && yy==etyy && mm<etmm){
??? ??? ??? ??? return "<img src='/upload/"+value+"' width='20px' height='20px'/>";
??? ??? ??? }else if(yy>styy && yy==etyy && mm==etmm && dd<etdd){
??? ??? ??? ??? return "<img src='/upload/"+value+"' width='20px' height='20px'/>";
??? ??? ??? }else if(yy>styy && yy==etyy && mm==etmm && dd==etdd){
??? ??? ??? ??? return "<img src='/upload/"+value+"' width='20px' height='20px'/>";
??? ??? ??? }else{
??? ??? ??? ??? return "";
??? ??? ??? }
??? ??? }else{
??? ??? ??? return "";
??? ??? }
??? ??? //alert(endtime+","+yy+"-"+mm+"-"+dd+","+styy+"-"+stmm+"-"+stdd);
??? }
}