使用场景: 某公司迟到规则: 1,60分钟以上每迟到一次算迟到 2,10次以上迟到,每迟到一次算迟到。 3,综合2个信息,取最大值算迟到。 // 当月第一天=get_last_month(get_cur_month())+01 当月最后一天=get_last_month(get_cur_month())+get_month_days(get_last_month(get_cur_month())) sql="select sum(on_late_minute) from timer_list where on_late_minute <=30 and emp_id='"+emp_id+"'and class_date <='"+当月最后一天+"'and class_date >='"+当月第一天+"' " db_run(sql) 30分钟内迟到分钟数=to_int(db_res(0)) // sql5="select n1 from timer_list where n1 >0 and emp_id='"+emp_id+"'and class_date <='"+当月最后一天+"'and class_date >='"+当月第一天+"'" db_run(sql5) 30分钟内迟到次数 =to_int(db_row_count()) // if (30分钟内迟到次数 >10&& 30分钟内迟到分钟数<60) { 30分钟内超频次数=30分钟内迟到次数-10 } else if(30分钟内迟到分钟数 >60&&30分钟内迟到次数 <10) { sql8="select on_late_minute,class_date from timer_list where n1 >0 and emp_id='"+emp_id+"'and class_date <='"+当月最后一天+"'and class_date >= '"+当月第一天+"'" db_run(sql8) db_sort_ext('class_date') a=to_int(db_row_count()) b=to_int(db_res(0)) c=0 db_go_head() for(id=0;id<a;id++) { if(b <=60) { db_next() b=to_int(db_res(0))+b } else if(b>60) { c=c+1 30分钟内超频次数=c } } } else if(30分钟内迟到分钟数>60&&30分钟内迟到次数 >10) { sql17="select on_late_minute,class_date from timer_list where n1 >0 and emp_id='"+emp_id+"'and class_date <='"+当月最后一天+"'and class_date >= '"+当月第一天+"'" db_run(sql17) db_sort_ext('class_date') a1=to_int(db_row_count()) b1=to_int(db_res(0)) db_go_head() 状态A=30分钟内迟到次数-10 for(id1=0;id1<a1;id1++) { if(b1 <=60) { db_next() b1=to_int(db_res(0))+b1 } else if(b1>60) { c1=c1+1 状态B=c1 } } if(状态A >状态B) { 30分钟内超频次数=状态A } else if(状态A <=状态B) { 30分钟内超频次数=状态B } } |