原创_【补打卡申请单据】根据日期和部门自动生成明细脚本分享_使用经验
学习.交流
专业源于专注
www. onlyit. cn   
学习交流 文件下载 手册资料 交流QQ群

    

 5  1/1   1  
作者
内容
fwj3861  [个人空间]
QQ名  越南-叶子(121305301)


注册  2010-09-09
发贴数  536
精华贴  10
原创贴  20
来自  越南
状态  正常

级别  贵宾
#1»发布于2023-05-22 21:40

之前有用户提出【补打卡申请单据】增加导入功能,以便可以批量做补打卡申请,为使部门文员更加简单的做补打卡申请单据,在请官方更新【grid_copy_row】脚本之后,可以使用脚本提取缺勤记录后自动按照缺勤时间来增加新的记录, 
经过测试,员工当日缺勤3次可以生成3条补卡明细并自动赋值3个缺勤时间到【时间】列,基本能满足日常打卡4次的补卡需求了,员工当日缺勤4次-6次的算法建模比较费脑,就暂时不去考虑了, 
 
脚本思路: 
一. 启用表头基本属性扩展4个,【补卡日期】,【补卡部门】,【补卡原因】,【待补卡数】 
1. 【补卡日期】和【补卡部门】是必选项,作为提取条件从考勤日账明细提取缺勤明细 
2. 【补卡原因】为非必选项,用来作为批量填充明细【原因】列,【默认设置明细【原因】不能为空,有空列的不能保存和送审,可以根据需要自行关闭】 
3. 【待补卡数】作为【grid_copy_row】函数的目标行号变量,用来自动添加补卡明细,当【待补卡数】为0后才判断为补卡申请完成,可以送审单据了 
二.脚本创建表头控件【引入缺勤记录】,用来根据【补卡日期】和【补卡部门】提取缺勤记录 
1.在【新增单据】时,默认【当日】为【单据日期】,默认【昨日】为【补卡日期】,默认【操作员所属部门】为【补卡部门】 
三.用脚本新建4个列【打卡记录】,【考勤班次编号】,【考勤班次名称】,【考勤班次时间段】,这4个列的数据在重新打开单据检查或审核时会刷新显示【目前单据不支持添加明细扩展列和显示自定义列,只能用脚本添加】 
1.【打卡记录】用来显示考勤日账的打卡明细,便于直观的显示缺勤时间段 
2.【考勤班次编号】,【考勤班次名称】,【考勤班次时间段】仅用来参考 
四.根据考勤班次的5个上下班时间段,用脚本批量新建6组各5个列【上班1-5】,【下班1-5】,【上班次数1-5】,【下班次数1-5】,【标准上班时间1-5】,【标准下班时间1-5】,这30个列默认全部隐藏,用来作为计算缺勤次数和时间的建模参数 
1.从【考勤日账】提取过来的打卡时间组合赋值到【打卡记录】并分别转换为【10】之后赋值到【上班1-5】和【下班1-5】结合【标准上下班时间】用【grid_copy_row】函数来计算缺勤次数的参数 
2.根据【考勤日账】的【考勤班次】来提取【考勤班次的5组上下班时间】赋值到标准上班时间1-5】和【标准下班时间1-5】,结合【上下班1-5】用【grid_copy_row】函数来作为【时间】列赋值的参数 
3.根据【考勤班次时间段】数据分别转为【10】之后赋值到【上下班次数1-5】,结合【上下班1-5】用【grid_copy_row】函数来作为【时间】列赋值的参数 
五.员工当日考勤缺勤次数超过3次,【grid_copy_row】脚本函数执行后会在明细中间产生【空白行】,所以需要在【引入缺勤记录】执行完之后用函数来隐藏【空白行】 
六.在一个单据会自动按【补卡日期】和【补卡部门】生成完整的补卡明细,所以在重复做相同【补卡日期】和【补卡部门】的补卡明细时,会自动弹出提示并删除重复的数据,最后锁定【引入缺勤记录】控件,必须再次执行【新增单据】操作选择其他【补卡日期】或【补卡部门】 
 请使用最新版本【20230517】测试,【grid_copy_row】函数从这个版本开始才有。【补打卡申请单据】审核之后,在考勤数据处理界面就能提取出来了 
欢迎各位用户在使用中提出改善意见或建议,谢谢! 
【单据内脚本只有缺勤1-2次的判断脚本,缺勤3次的判断脚本受单据脚本1500行的限制,另外新建4个脚本文件来被单据脚本调用的,有需要缺勤3次的脚本文件,请QQ联系】 
 
int init_test() 

  return 1; 
}; 
 
int create_voucher() 

 string d,deptid; 
 d = get_cur_date_std(); //获取【当前日期】 
 gui_set_val("DateTimePicker_Voucher_Date",d); //设置【单据日期】为【当前日期】 
 gui_set_val("date_Ext1",d-1); //设置【补卡日期】为【当前日期的前一天】 
 deptid = get_user_dept_id(); //获取【当前操作员部门编号】 
 gui_set_val("ext_Ext2",deptid); //设置【补卡部门】为【当前操作员所属部门】 
 gui_enable("date_Ext1") //允许点击【补卡日期】控件 
 gui_enable("timer_list") //允许点击【引入缺勤记录】控件 
 gui_hide("timer_list_r") //隐藏【删除考勤记录数据】控件 
 gui_hide("timer_item") //隐藏【自动添加补卡时间】控件 
 grid_mark_readonly('MG_Item','emp_id') //【工号】列不允许编辑 
 grid_mark_readonly('MG_Item','emp_name')//【姓名】列不允许编辑 
 grid_mark_readonly('MG_Item','mark_date') //【日期】列不允许编辑 
 return 1; 
}; 
 
int 删除缺勤记录数据() 

  string d,deptid; 
  d = get_cur_date_std(); //获取【当前日期】 
  gui_set_val("DateTimePicker_Voucher_Date",d); //设置【单据日期】为【当前日期】 
  gui_set_val("date_Ext1",d-1); //设置【补卡日期】为【当前日期的前一天】 
  deptid = get_user_dept_id(); //获取【当前操作员部门编号】 
  gui_set_val("ext_Ext2",deptid); //设置【补卡部门】为【当前操作员所属部门】 
  gui_set_val("edit_Ext4",''); //清空【待补卡数】 
  gui_trigger_click("Popu_Item_Erase_All"); //执行【清空所有明细】 
  gui_enable("timer_list") //允许点击【引入缺勤记录】控件 
  gui_enable("date_Ext1") //允许点击【补卡日期】控件 
  gui_enable("ext_Ext2") //允许点击【补卡部门】控件 
grid_unmark_readonly('MG_Item','add_cause_name')//【原因】列允许编辑 
    return 1; 
}; 
 
int 自动添加补卡时间() 

 gui_hide("timer_item") //隐藏【自动添加补卡时间】控件 
 int i,j,rc; 
 string empid,vbeg1,vbeg2,vbeg3,vbeg4,vbeg5,vend1,vend2,vend3,vend4,vend5,vtimen,on1,on2,on3,on4,on5,off1,off2,off3,off4,off5,btime1,btime2,btime3,btime4,btime5,etime1,etime2,etime3,etime4,etime5; 
 string marktime; 
 num on1,on2,on3,on4,on5,off1,off2,off3,off4,off5,marktimesum; 
 num btime2,btime3,btime4,btime5,etime1,etime2,etime3,etime4,etime5,b1,b2,b3,b4,b5,e1,e2,e3,e4,e5; 
 num sumon1,sumon2,sumon3,sumon4,sumon5,sumoff1,sumoff2,sumoff3,sumoff4,sumoff5,sumbeg1,sumbeg2,sumbeg3,sumbeg4,sumbeg5,sumend1,sumend2,sumend3,sumend4,sumend5; 
 marktimesum = gui_get_val("edit_Ext4") 
 rc = grid_find('MG_Item','emp_id',''); 
 for(i=1;i<rc;i++) 
 { 
  empid = grid_get_v('MG_Item','emp_id',i); 
  marktime = grid_get_v('MG_Item','mark_time',i); 
  vbeg1 = grid_get_v('MG_Item','beg1',i); 
  vbeg2 = grid_get_v('MG_Item','beg2',i); 
  vbeg3 = grid_get_v('MG_Item','beg3',i); 
  vbeg4 = grid_get_v('MG_Item','beg4',i); 
  vbeg5 = grid_get_v('MG_Item','beg5',i); 
  vend1 = grid_get_v('MG_Item','end1',i); 
  vend2 = grid_get_v('MG_Item','end2',i); 
  vend3 = grid_get_v('MG_Item','end3',i); 
  vend4 = grid_get_v('MG_Item','end4',i); 
  vend5 = grid_get_v('MG_Item','end5',i); 
  on1 = grid_get_v('MG_Item','on01',i); 
  on2 = grid_get_v('MG_Item','on02',i); 
  on3 = grid_get_v('MG_Item','on03',i); 
  on4 = grid_get_v('MG_Item','on04',i); 
  on5 = grid_get_v('MG_Item','on05',i); 
  off1 = grid_get_v('MG_Item','off01',i); 
  off2 = grid_get_v('MG_Item','off02',i); 
  off3 = grid_get_v('MG_Item','off03',i); 
  off4 = grid_get_v('MG_Item','off04',i); 
  off5 = grid_get_v('MG_Item','off05',i); 
  btime1 = grid_get_v('MG_Item','begtime1',i); 
  btime2 = grid_get_v('MG_Item','begtime2',i); 
  btime3 = grid_get_v('MG_Item','begtime3',i); 
  btime4 = grid_get_v('MG_Item','begtime4',i); 
  btime5 = grid_get_v('MG_Item','begtime5',i); 
  etime1 = grid_get_v('MG_Item','endtime1',i); 
  etime2 = grid_get_v('MG_Item','endtime2',i); 
  etime3 = grid_get_v('MG_Item','endtime3',i); 
  etime4 = grid_get_v('MG_Item','endtime4',i); 
  etime5 = grid_get_v('MG_Item','endtime5',i); 
  b1 = btime1-on1 
  b2 = btime2-on2 
  b3 = btime3-on3 
  b4 = btime4-on4 
  b5 = btime5-on5 
  e1 = etime1-off1 
  e2 = etime2-off2 
  e3 = etime3-off3 
  e4 = etime4-off4 
  e5 = etime5-off5 
  if(marktime == '') 
  { 
   //上班缺勤1次算法 
    if(b1=='10'&&e1=='0'&&b2=='0'&&e2=='0'&&b3=='0'&&e3=='0'&&b4=='0'&&e4=='0'&&b5=='0'&&e5=='0'){ 
    grid_set_v("MG_Item","mark_time",i,vbeg1);//【上班1】缺勤 
    }if(b1=='0'&&e1=='0'&&b2=='10'&&e2=='0'&&b3=='0'&&e3=='0'&&b4=='0'&&e4=='0'&&b5=='0'&&e5=='0'){ 
    grid_set_v("MG_Item","mark_time",i,vbeg2);//【上班2】缺勤 
    }if(b1=='0'&&e1=='0'&&b2=='0'&&e2=='0'&&b3=='10'&&e3=='0'&&b4=='0'&&e4=='0'&&b5=='0'&&e5=='0'){ 
    grid_set_v("MG_Item","mark_time",i,vbeg3);//【上班3】缺勤 
    }if(b1=='0'&&e1=='0'&&b2=='0'&&e2=='0'&&b3=='0'&&e3=='0'&&b4=='10'&&e4=='0'&&b5=='0'&&e5=='0'){ 
    grid_set_v("MG_Item","mark_time",i,vbeg4);//【上班4】缺勤 
    }if(b1=='0'&&e1=='0'&&b2=='0'&&e2=='0'&&b3=='0'&&e3=='0'&&b4=='0'&&e4=='0'&&b5=='0'&&e5=='10'){ 
    grid_set_v("MG_Item","mark_time",i,vbeg5);//【上班5】缺勤 
    } 
   //下班缺勤1次算法 
    if(b1=='0'&&e1=='10'&&b2=='0'&&e2=='0'&&b3=='0'&&e3=='0'&&b4=='0'&&e4=='0'&&b5=='0'&&e5=='0'){ 
    grid_set_v("MG_Item","mark_time",i,vend1);//【下班1】缺勤 
    }if(b1=='0'&&e1=='0'&&b2=='0'&&e2=='10'&&b3=='0'&&e3=='0'&&b4=='0'&&e4=='0'&&b5=='0'&&e5=='0'){ 
    grid_set_v("MG_Item","mark_time",i,vend2);//【下班2】缺勤 
    }if(b1=='0'&&e1=='0'&&b2=='0'&&e2=='0'&&b3=='0'&&e3=='10'&&b4=='0'&&e4=='0'&&b5=='0'&&e5=='0'){ 
    grid_set_v("MG_Item","mark_time",i,vend3);//【下班3】缺勤 
    }if(b1=='0'&&e1=='0'&&b2=='0'&&e2=='0'&&b3=='0'&&e3=='0'&&b4=='0'&&e4=='10'&&b5=='0'&&e5=='0'){ 
    grid_set_v("MG_Item","mark_time",i,vend4);//【下班4】缺勤 
    }if(b1=='0'&&e1=='0'&&b2=='0'&&e2=='0'&&b3=='0'&&e3=='0'&&b4=='0'&&e4=='0'&&b5=='0'&&e5=='10'){ 
    grid_set_v("MG_Item","mark_time",i,vend5);//【下班5】缺勤 
    } 
    //上班缺勤2次算法 
    if(b1=='10'&&e1=='0'&&b2=='10'&&e2=='0'&&b3=='0'&&e3=='0'&&b4=='0'&&e4=='0'&&b5=='0'&&e5=='0'){ 
    grid_set_v("MG_Item","mark_time",i,vbeg1);//【上班1】缺勤 
    grid_insert_before('MG_Item',i+marktimesum) 
    grid_copy_row("MG_Item",i,i+marktimesum); 
    grid_set_v("MG_Item","mark_time",i+marktimesum,vbeg2);//【上班2】缺勤 
    }if(b1=='10'&&e1=='0'&&b2=='0'&&e2=='10'&&b3=='10'&&e3=='0'&&b4=='0'&&e4=='0'&&b5=='0'&&e5=='0'){ 
    grid_set_v("MG_Item","mark_time",i,vbeg1);//【上班1】缺勤 
    grid_insert_before('MG_Item',i+marktimesum) 
    grid_copy_row("MG_Item",i,i+marktimesum); 
    grid_set_v("MG_Item","mark_time",i+marktimesum,vbeg3);//【上班3】缺勤 
    }if(b1=='10'&&e1=='0'&&b2=='0'&&e2=='0'&&b3=='0'&&e3=='0'&&b4=='10'&&e4=='0'&&b5=='0'&&e5=='0'){ 
    grid_set_v("MG_Item","mark_time",i,vbeg1);//【上班1】缺勤 
    grid_insert_before('MG_Item',i+marktimesum) 
    grid_copy_row("MG_Item",i,i+marktimesum); 
    grid_set_v("MG_Item","mark_time",i+marktimesum,vbeg4);//【上班4】缺勤 
    }if(b1=='10'&&e1=='0'&&b2=='0'&&e2=='0'&&b3=='0'&&e3=='0'&&b4=='0'&&e4=='0'&&b5=='10'&&e5=='0'){ 
    grid_set_v("MG_Item","mark_time",i,vbeg1);//【上班1】缺勤 
    grid_insert_before('MG_Item',i+marktimesum) 
    grid_copy_row("MG_Item",i,i+marktimesum); 
    grid_set_v("MG_Item","mark_time",i+marktimesum,vbeg5);//【上班5】缺勤 
    }if(b1=='0'&&e1=='0'&&b2=='10'&&e2=='10'&&b3=='10'&&e3=='0'&&b4=='0'&&e4=='0'&&b5=='0'&&e5=='0'){ 
    grid_set_v("MG_Item","mark_time",i,vbeg2);//【上班2】缺勤 
    grid_insert_before('MG_Item',i+marktimesum) 
    grid_copy_row("MG_Item",i,i+marktimesum); 
    grid_set_v("MG_Item","mark_time",i+marktimesum,vbeg3);//【上班3】缺勤 
    }if(b1=='0'&&e1=='0'&&b2=='10'&&e2=='0'&&b3=='0'&&e3=='0'&&b4=='10'&&e4=='0'&&b5=='0'&&e5=='0'){ 
    grid_set_v("MG_Item","mark_time",i,vbeg2);//【上班2】缺勤 
    grid_insert_before('MG_Item',i+marktimesum) 
    grid_copy_row("MG_Item",i,i+marktimesum); 
    grid_set_v("MG_Item","mark_time",i+marktimesum,vbeg4);//【上班4】缺勤 
    }if(b1=='0'&&e1=='0'&&b2=='10'&&e2=='0'&&b3=='0'&&e3=='0'&&b4=='0'&&e4=='0'&&b5=='10'&&e5=='0'){ 
    grid_set_v("MG_Item","mark_time",i,vbeg2);//【上班2】缺勤 
    grid_insert_before('MG_Item',i+marktimesum) 
    grid_copy_row("MG_Item",i,i+marktimesum); 
    grid_set_v("MG_Item","mark_time",i+marktimesum,vbeg5);//【上班5】缺勤 
    }if(b1=='0'&&e1=='0'&&b2=='0'&&e2=='0'&&b3=='10'&&e3=='0'&&b4=='10'&&e4=='0'&&b5=='0'&&e5=='0'){ 
    grid_set_v("MG_Item","mark_time",i,vbeg3);//【上班3】缺勤 
    grid_insert_before('MG_Item',i+marktimesum) 
    grid_copy_row("MG_Item",i,i+marktimesum); 
    grid_set_v("MG_Item","mark_time",i+marktimesum,vbeg4);//【上班4】缺勤 
    }if(b1=='0'&&e1=='0'&&b2=='0'&&e2=='0'&&b3=='10'&&e3=='0'&&b4=='0'&&e4=='0'&&b5=='10'&&e5=='0'){ 
    grid_set_v("MG_Item","mark_time",i,vbeg3);//【上班3】缺勤 
    grid_insert_before('MG_Item',i+marktimesum) 
    grid_copy_row("MG_Item",i,i+marktimesum); 
    grid_set_v("MG_Item","mark_time",i+marktimesum,vbeg5);//【上班5】缺勤 
    }if(b1=='0'&&e1=='0'&&b2=='0'&&e2=='0'&&b3=='0'&&e3=='0'&&b4=='10'&&e4=='0'&&b5=='10'&&e5=='0'){ 
    grid_set_v("MG_Item","mark_time",i,vbeg4);//【上班4】缺勤 
    grid_insert_before('MG_Item',i+marktimesum) 
    grid_copy_row("MG_Item",i,i+marktimesum); 
    grid_set_v("MG_Item","mark_time",i+marktimesum,vbeg5);//【上班5】缺勤 
    } 
    //上班1次下班1次缺勤2次算法 
    if(b1=='10'&&e1=='10'&&b2=='0'&&e2=='0'&&b3=='0'&&e3=='0'&&b4=='0'&&e4=='0'&&b5=='0'&&e5=='0'){ 
    grid_set_v("MG_Item","mark_time",i,vbeg1);//【上班1】缺勤 
    grid_insert_before('MG_Item',i+marktimesum) 
    grid_copy_row("MG_Item",i,i+marktimesum); 
    grid_set_v("MG_Item","mark_time",i+marktimesum,vend1);//【下班1】缺勤 
    }if(b1=='10'&&e1=='0'&&b2=='0'&&e2=='10'&&b3=='0'&&e3=='0'&&b4=='0'&&e4=='0'&&b5=='0'&&e5=='0'){ 
    grid_set_v("MG_Item","mark_time",i,vbeg1);//【上班1】缺勤 
    grid_insert_before('MG_Item',i+marktimesum) 
    grid_copy_row("MG_Item",i,i+marktimesum); 
    grid_set_v("MG_Item","mark_time",i+marktimesum,vend2);//【下班2】缺勤 
    }if(b1=='10'&&e1=='0'&&b2=='0'&&e2=='0'&&b3=='0'&&e3=='10'&&b4=='0'&&e4=='0'&&b5=='0'&&e5=='0'){ 
    grid_set_v("MG_Item","mark_time",i,vbeg1);//【上班1】缺勤 
    grid_insert_before('MG_Item',i+marktimesum) 
    grid_copy_row("MG_Item",i,i+marktimesum); 
    grid_set_v("MG_Item","mark_time",i+marktimesum,vend3);//【下班3】缺勤 
    }if(b1=='10'&&e1=='0'&&b2=='0'&&e2=='0'&&b3=='0'&&e3=='0'&&b4=='0'&&e4=='10'&&b5=='0'&&e5=='0'){ 
    grid_set_v("MG_Item","mark_time",i,vbeg1);//【上班1】缺勤 
    grid_insert_before('MG_Item',i+marktimesum) 
    grid_copy_row("MG_Item",i,i+marktimesum); 
    grid_set_v("MG_Item","mark_time",i+marktimesum,vend4);//【下班4】缺勤 
    }if(b1=='10'&&e1=='0'&&b2=='0'&&e2=='0'&&b3=='0'&&e3=='0'&&b4=='0'&&e4=='0'&&b5=='0'&&e5=='10'){ 
    grid_set_v("MG_Item","mark_time",i,vbeg1);//【上班1】缺勤 
    grid_insert_before('MG_Item',i+marktimesum) 
    grid_copy_row("MG_Item",i,i+marktimesum); 
    grid_set_v("MG_Item","mark_time",i+marktimesum,vend5);//【下班5】缺勤 
    }if(b1=='0'&&e1=='10'&&b2=='10'&&e2=='0'&&b3=='0'&&e3=='0'&&b4=='0'&&e4=='0'&&b5=='0'&&e5=='0'){ 
    grid_set_v("MG_Item","mark_time",i,vbeg2);//【上班2】缺勤 
    grid_insert_before('MG_Item',i+marktimesum)    grid_copy_row("MG_Item",i,i+marktimesum); 
    grid_set_v("MG_Item","mark_time",i+marktimesum,vend1);//【下班1】缺勤 
    }if(b1=='0'&&e1=='0'&&b2=='10'&&e2=='10'&&b3=='0'&&e3=='0'&&b4=='0'&&e4=='0'&&b5=='0'&&e5=='0'){ 
    grid_set_v("MG_Item","mark_time",i,vbeg2);//【上班2】缺勤 
    grid_insert_before('MG_Item',i+marktimesum) 
    grid_copy_row("MG_Item",i,i+marktimesum); 
    grid_set_v("MG_Item","mark_time",i+marktimesum,vend2);//【下班2】缺勤 
    }if(b1=='0'&&e1=='0'&&b2=='10'&&e2=='0'&&b3=='0'&&e3=='10'&&b4=='0'&&e4=='0'&&b5=='0'&&e5=='0'){ 
    grid_set_v("MG_Item","mark_time",i,vbeg2);//【上班2】缺勤 
    grid_insert_before('MG_Item',i+marktimesum) 
    grid_copy_row("MG_Item",i,i+marktimesum); 
    grid_set_v("MG_Item","mark_time",i+marktimesum,vend3);//【下班3】缺勤 
    }if(b1=='0'&&e1=='0'&&b2=='10'&&e2=='0'&&b3=='0'&&e3=='0'&&b4=='0'&&e4=='10'&&b5=='0'&&e5=='0'){ 
    grid_set_v("MG_Item","mark_time",i,vbeg2);//【上班2】缺勤 
    grid_insert_before('MG_Item',i+marktimesum) 
    grid_copy_row("MG_Item",i,i+marktimesum); 
    grid_set_v("MG_Item","mark_time",i+marktimesum,vend4);//【下班4】缺勤 
    }if(b1=='0'&&e1=='0'&&b2=='10'&&e2=='0'&&b3=='0'&&e3=='0'&&b4=='0'&&e4=='0'&&b5=='0'&&e5=='10'){ 
    grid_set_v("MG_Item","mark_time",i,vbeg2);//【上班2】缺勤 
    grid_insert_before('MG_Item',i+marktimesum) 
    grid_copy_row("MG_Item",i,i+marktimesum); 
    grid_set_v("MG_Item","mark_time",i+marktimesum,vend5);//【下班5】缺勤 
    }if(b1=='0'&&e1=='10'&&b2=='0'&&e2=='0'&&b3=='10'&&e3=='0'&&b4=='0'&&e4=='0'&&b5=='0'&&e5=='0'){ 
    grid_set_v("MG_Item","mark_time",i,vbeg3);//【上班3】缺勤 
    grid_insert_before('MG_Item',i+marktimesum) 
    grid_copy_row("MG_Item",i,i+marktimesum); 
    grid_set_v("MG_Item","mark_time",i+marktimesum,vend1);//【下班1】缺勤 
    }if(b1=='0'&&e1=='0'&&b2=='0'&&e2=='10'&&b3=='10'&&e3=='0'&&b4=='0'&&e4=='0'&&b5=='0'&&e5=='0'){ 
    grid_set_v("MG_Item","mark_time",i,vbeg3);//【上班3】缺勤 
    grid_insert_before('MG_Item',i+marktimesum) 
    grid_copy_row("MG_Item",i,i+marktimesum); 
    grid_set_v("MG_Item","mark_time",i+marktimesum,vend2);//【下班2】缺勤   }if(b1=='0'&&e1=='0'&&b2=='0'&&e2=='0'&&b3=='10'&&e3=='10'&&b4=='0'&&e4=='0'&&b5=='0'&&e5=='0'){ 
    grid_set_v("MG_Item","mark_time",i,vbeg3);//【上班3】缺勤 
    grid_insert_before('MG_Item',i+marktimesum) 
    grid_copy_row("MG_Item",i,i+marktimesum); 
    grid_set_v("MG_Item","mark_time",i+marktimesum,vend3);//【下班3】缺勤 
    }if(b1=='0'&&e1=='0'&&b2=='0'&&e2=='0'&&b3=='10'&&e3=='0'&&b4=='10'&&e4=='10'&&b5=='0'&&e5=='0'){ 
    grid_set_v("MG_Item","mark_time",i,vbeg3);//【上班3】缺勤 
    grid_insert_before('MG_Item',i+marktimesum) 
    grid_copy_row("MG_Item",i,i+marktimesum); 
    grid_set_v("MG_Item","mark_time",i+marktimesum,vend4);//【下班4】缺勤 
    }if(b1=='0'&&e1=='0'&&b2=='0'&&e2=='0'&&b3=='10'&&e3=='0'&&b4=='0'&&e4=='0'&&b5=='0'&&e5=='10'){ 
    grid_set_v("MG_Item","mark_time",i,vbeg3);//【上班3】缺勤 
    grid_insert_before('MG_Item',i+marktimesum) 
    grid_copy_row("MG_Item",i,i+marktimesum); 
    grid_set_v("MG_Item","mark_time",i+marktimesum,vend5);//【下班5】缺勤 
    }if(b1=='0'&&e1=='10'&&b2=='0'&&e2=='0'&&b3=='0'&&e3=='0'&&b4=='10'&&e4=='0'&&b5=='0'&&e5=='0'){ 
    grid_set_v("MG_Item","mark_time",i,vbeg4);//【上班4】缺勤 
    grid_insert_before('MG_Item',i+marktimesum) 
    grid_copy_row("MG_Item",i,i+marktimesum); 
    grid_set_v("MG_Item","mark_time",i+marktimesum,vend1);//【下班1】缺勤 
    }if(b1=='0'&&e1=='0'&&b2=='0'&&e2=='10'&&b3=='0'&&e3=='0'&&b4=='10'&&e4=='0'&&b5=='0'&&e5=='0'){ 
    grid_set_v("MG_Item","mark_time",i,vbeg4);//【上班4】缺勤 
    grid_insert_before('MG_Item',i+marktimesum) 
    grid_copy_row("MG_Item",i,i+marktimesum); 
    grid_set_v("MG_Item","mark_time",i+marktimesum,vend2);//【下班2】缺勤 
    }if(b1=='0'&&e1=='0'&&b2=='0'&&e2=='0'&&b3=='0'&&e3=='10'&&b4=='10'&&e4=='0'&&b5=='0'&&e5=='0'){ 
    grid_set_v("MG_Item","mark_time",i,vbeg4);//【上班4】缺勤 
    grid_insert_before('MG_Item',i+marktimesum) 
    grid_copy_row("MG_Item",i,i+marktimesum); 
    grid_set_v("MG_Item","mark_time",i+marktimesum,vend3);//【下班3】缺勤 
    }if(b1=='0'&&e1=='0'&&b2=='0'&&e2=='0'&&b3=='0'&&e3=='0'&&b4=='10'&&e4=='10'&&b5=='0'&&e5=='0'){ 
    grid_set_v("MG_Item","mark_time",i,vbeg4);//【上班4】缺勤 
    grid_insert_before('MG_Item',i+marktimesum) 
    grid_copy_row("MG_Item",i,i+marktimesum); 
    grid_set_v("MG_Item","mark_time",i+marktimesum,vend4);//【下班4】缺勤 
    }if(b1=='0'&&e1=='0'&&b2=='0'&&e2=='0'&&b3=='0'&&e3=='0'&&b4=='10'&&e4=='0'&&b5=='0'&&e5=='10'){ 
    grid_set_v("MG_Item","mark_time",i,vbeg4);//【上班4】缺勤 
    grid_insert_before('MG_Item',i+marktimesum) 
    grid_copy_row("MG_Item",i,i+marktimesum); 
    grid_set_v("MG_Item","mark_time",i+marktimesum,vend5);//【下班5】缺勤 
    }if(b1=='0'&&e1=='10'&&b2=='0'&&e2=='0'&&b3=='0'&&e3=='0'&&b4=='0'&&e4=='0'&&b5=='10'&&e5=='0'){ 
    grid_set_v("MG_Item","mark_time",i,vbeg5);//【上班5】缺勤 
    grid_insert_before('MG_Item',i+marktimesum) 
    grid_copy_row("MG_Item",i,i+marktimesum); 
    grid_set_v("MG_Item","mark_time",i+marktimesum,vend1);//【下班1】缺勤 
    }if(b1=='0'&&e1=='0'&&b2=='0'&&e2=='10'&&b3=='0'&&e3=='0'&&b4=='0'&&e4=='0'&&b5=='10'&&e5=='0'){ 
    grid_set_v("MG_Item","mark_time",i,vbeg5);//【上班5】缺勤 
    grid_insert_before('MG_Item',i+marktimesum) 
    grid_copy_row("MG_Item",i,i+marktimesum); 
    grid_set_v("MG_Item","mark_time",i+marktimesum,vend2);//【下班2】缺勤 
    }if(b1=='0'&&e1=='0'&&b2=='0'&&e2=='0'&&b3=='0'&&e3=='10'&&b4=='0'&&e4=='0'&&b5=='10'&&e5=='0'){ 
    grid_set_v("MG_Item","mark_time",i,vbeg5);//【上班5】缺勤 
    grid_insert_before('MG_Item',i+marktimesum) 
    grid_copy_row("MG_Item",i,i+marktimesum); 
    grid_set_v("MG_Item","mark_time",i+marktimesum,vend3);//【下班3】缺勤 
    }if(b1=='0'&&e1=='0'&&b2=='0'&&e2=='0'&&b3=='0'&&e3=='0'&&b4=='0'&&e4=='10'&&b5=='10'&&e5=='0'){  grid_set_v("MG_Item","mark_time",i,vbeg5);//【上班5】缺勤 
    grid_insert_before('MG_Item',i+marktimesum) 
    grid_copy_row("MG_Item",i,i+marktimesum); 
    grid_set_v("MG_Item","mark_time",i+marktimesum,vend4);//【下班4】缺勤 
    }if(b1=='0'&&e1=='0'&&b2=='0'&&e2=='0'&&b3=='0'&&e3=='0'&&b4=='0'&&e4=='0'&&b5=='10'&&e5=='10'){ 
    grid_set_v("MG_Item","mark_time",i,vbeg5);//【上班5】缺勤 
    grid_insert_before('MG_Item',i+marktimesum) 
    grid_copy_row("MG_Item",i,i+marktimesum); 
    grid_set_v("MG_Item","mark_time",i+marktimesum,vend5);//【下班5】缺勤 
    } 
   //下班缺勤2次算法 
    if(b1=='0'&&e1=='10'&&b2=='0'&&e2=='10'&&b3=='0'&&e3=='0'&&b4=='0'&&e4=='0'&&b5=='0'&&e5=='0'){ 
    grid_set_v("MG_Item","mark_time",i,vend1);//【下班1】缺勤 
    grid_insert_before('MG_Item',i+marktimesum) 
    grid_copy_row("MG_Item",i,i+marktimesum); 
    grid_set_v("MG_Item","mark_time",i+marktimesum,vend2);//【下班2】缺勤 
    }if(b1=='0'&&e1=='10'&&b2=='0'&&e2=='0'&&b3=='0'&&e3=='10'&&b4=='0'&&e4=='0'&&b5=='0'&&e5=='0'){ 
    grid_set_v("MG_Item","mark_time",i,vend1);//【下班1】缺勤 
    grid_insert_before('MG_Item',i+marktimesum) 
    grid_copy_row("MG_Item",i,i+marktimesum); 
    grid_set_v("MG_Item","mark_time",i+marktimesum,vend3);//【下班3】缺勤 
    }if(b1=='0'&&e1=='10'&&b2=='0'&&e2=='0'&&b3=='0'&&e3=='0'&&b4=='0'&&e4=='10'&&b5=='0'&&e5=='0'){ 
    grid_set_v("MG_Item","mark_time",i,vend1);//【下班1】缺勤 
    grid_insert_before('MG_Item',i+marktimesum) 
    grid_copy_row("MG_Item",i,i+marktimesum); 
    grid_set_v("MG_Item","mark_time",i+marktimesum,vend4);//【下班4】缺勤 
    }if(b1=='0'&&e1=='10'&&b2=='0'&&e2=='0'&&b3=='0'&&e3=='0'&&b4=='0'&&e4=='0'&&b5=='0'&&e5=='10'){ 
    grid_set_v("MG_Item","mark_time",i,vend1);//【下班1】缺勤 
    grid_insert_before('MG_Item',i+marktimesum) 
    grid_copy_row("MG_Item",i,i+marktimesum); 
    grid_set_v("MG_Item","mark_time",i+marktimesum,vend5);//【下班5】缺勤 
    }if(b1=='0'&&e1=='0'&&b2=='0'&&e2=='10'&&b3=='0'&&e3=='10'&&b4=='0'&&e4=='0'&&b5=='0'&&e5=='0'){ 
    grid_set_v("MG_Item","mark_time",i,vend2);//【下班2】缺勤 
    grid_insert_before('MG_Item',i+marktimesum) 
    grid_copy_row("MG_Item",i,i+marktimesum);    grid_set_v("MG_Item","mark_time",i+marktimesum,vend3);//【下班3】缺勤 
    }if(b1=='0'&&e1=='0'&&b2=='0'&&e2=='10'&&b3=='0'&&e3=='0'&&b4=='0'&&e4=='10'&&b5=='0'&&e5=='0'){ 
    grid_set_v("MG_Item","mark_time",i,vend2);//【下班2】缺勤 
    grid_insert_before('MG_Item',i+marktimesum) 
    grid_copy_row("MG_Item",i,i+marktimesum); 
    grid_set_v("MG_Item","mark_time",i+marktimesum,vend4);//【下班4】缺勤 
    }if(b1=='0'&&e1=='0'&&b2=='0'&&e2=='10'&&b3=='0'&&e3=='0'&&b4=='0'&&e4=='0'&&b5=='0'&&e5=='10'){ 
    grid_set_v("MG_Item","mark_time",i,vend2);//【下班2】缺勤 
    grid_insert_before('MG_Item',i+marktimesum) 
    grid_copy_row("MG_Item",i,i+marktimesum); 
    grid_set_v("MG_Item","mark_time",i+marktimesum,vend5);//【下班5】缺勤 
    }if(b1=='0'&&e1=='0'&&b2=='0'&&e2=='0'&&b3=='0'&&e3=='10'&&b4=='0'&&e4=='10'&&b5=='0'&&e5=='0'){ 
    grid_set_v("MG_Item","mark_time",i,vend3);//【下班3】缺勤 
    grid_insert_before('MG_Item',i+marktimesum) 
    grid_copy_row("MG_Item",i,i+marktimesum); 
    grid_set_v("MG_Item","mark_time",i+marktimesum,vend4);//【下班4】缺勤 
    }if(b1=='0'&&e1=='0'&&b2=='0'&&e2=='0'&&b3=='0'&&e3=='10'&&b4=='0'&&e4=='0'&&b5=='0'&&e5=='10'){ 
    grid_set_v("MG_Item","mark_time",i,vend3);//【下班3】缺勤 
    grid_insert_before('MG_Item',i+marktimesum) 
    grid_copy_row("MG_Item",i,i+marktimesum); 
    grid_set_v("MG_Item","mark_time",i+marktimesum,vend5);//【下班5】缺勤 
    }if(b1=='0'&&e1=='0'&&b2=='0'&&e2=='0'&&b3=='0'&&e3=='0'&&b4=='0'&&e4=='10'&&b5=='0'&&e5=='10'){ 
    grid_set_v("MG_Item","mark_time",i,vend4);//【下班4】缺勤 
    grid_insert_before('MG_Item',i+marktimesum) 
    grid_copy_row("MG_Item",i,i+marktimesum); 
    grid_set_v("MG_Item","mark_time",i+marktimesum,vend5);//【下班5】缺勤 
    }; 
   }; 
  }; 
    call_str('call_prog.上班缺勤3次算法'); 
    call_str('call_prog.下班缺勤3次算法'); 
    call_str('call_prog.上班2下班1缺勤3次算法'); 
    call_str('call_prog.上班1下班2缺勤3次算法'); 
    grid_sort("MG_Item",'emp_id,mark_time'); 
    grid_unmark_readonly('MG_Item','add_cause_name') 
    grid_filter_hide("MG_Item","工号==''"); //隐藏【grid_copy_row】函数产生的空白行 
  return 1; 
}; 
 
int 提取补卡日期缺勤记录() 

   gui_disable("timer_list") //不允许点击【引入缺勤记录】控件 
   gui_disable("date_Ext1")  //不允许点击【补卡日期】控件 
   gui_disable("ext_Ext2")  //不允许点击【补卡部门】控件 
   gui_disable("edit_Ext4")  //不允许点击【缺勤合计】控件 
   gui_hide("timer_list_r")//隐藏【删除考勤记录数据】控件 
   grid_mark_readonly('MG_Item','mark_time')//【时间】列不允许编辑 
   int i,count,j; 
   string sql,sql1,class_date,Punch_record,on1,off1,on2,off2,on3,off3,on4,off4,on5,off5,class_id,class_name,dept_id,dept_name,voucherno,timestt,timesttok; 
   string mbeg1,mbeg2,mbeg3,mbeg4,mbeg5,mend1,mend2,mend3,mend4,mend5; 
   num vtimesum,vrecordsum,von1,von2,von3,von4,von5,voff1,voff2,voff3,voff4,voff5,vbeg1,vbeg2,vbeg3,vbeg4,vbeg5,vend1,vend2,vend3,vend4,vend5,marktimesum; 
   num sumon1,sumon2,sumon3,sumon4,sumon5,sumoff1,sumoff2,sumoff3,sumoff4,sumoff5,sumbeg1,sumbeg2,sumbeg3,sumbeg4,sumbeg5,sumend1,sumend2,sumend3,sumend4,sumend5; 
   grid_add_col_str("MG_Item",'Punch_record','打卡记录') //添加【打卡记录】列 
   grid_mark_readonly('MG_Item','Punch_record') //设置【打卡记录】列【不允许编辑】 
   grid_set_col_width("MG_Item",'Punch_record',200) //设置【打卡记录】列【宽度】 
   grid_set_col_color("MG_Item",'Punch_record',0x0000ff);//设置【打卡记录】列【字体颜色】 
   grid_add_col_str("MG_Item",'class_id','考勤班次编号') 
   grid_mark_readonly('MG_Item','class_id') 
   grid_set_col_width("MG_Item",'class_id',100) 
   grid_set_col_color("MG_Item",'class_id',0x0000ff); 
   grid_add_col_str("MG_Item",'class_name','考勤班次名称') 
   grid_mark_readonly('MG_Item','class_name') 
   grid_set_col_width("MG_Item",'class_name',100) 
   grid_set_col_color("MG_Item",'class_name',0x0000ff); 
   grid_add_col_str("MG_Item",'classitem','考勤班次时间段') 
   grid_mark_readonly('MG_Item','classitem')  grid_set_col_width("MG_Item",'classitem',200) 
   grid_set_col_color("MG_Item",'classitem',16711680); 
   for(j=1;j<6;j++); 
   { 
    grid_add_col_num("MG_Item",'on0'+j,'上班'+j) 
    grid_mark_readonly('MG_Item','on0'+j) 
    grid_add_col_num("MG_Item",'off0'+j,'下班'+j) 
    grid_mark_readonly('MG_Item','off0'+j) 
    grid_add_col_num("MG_Item",'begtime'+j,'上班次数'+j) 
    grid_mark_readonly('MG_Item','begtime'+j) 
    grid_add_col_num("MG_Item",'endtime'+j,'下班次数'+j) 
    grid_mark_readonly('MG_Item','endtime'+j) 
    grid_add_col_str("MG_Item",'beg'+j,'标准上班时间'+j) 
    grid_mark_readonly('MG_Item','beg'+j) 
    grid_add_col_str("MG_Item",'end'+j,'标准下班时间'+j) 
    grid_mark_readonly('MG_Item','end'+j) 
   }; 
   voucherno = gui_get_val("Edit_Voucher_No") //获取【单据编号】 
   class_date = gui_get_val("date_Ext1") //获取【补卡日期】 
   dept_id = gui_get_val("ext_Ext2") //获取【补卡部门】ID 
   dept_name = gui_get_text("ext_Ext2") //获取【补卡部门】名称 
   if(class_date == '') 
   { 
    msg('请选择【补卡日期】') 
    gui_hide("timer_list_r") //隐藏【删除缺勤记录数据】控件 
    gui_hide("timer_item") //隐藏【自动添加补卡时间】控件 
    gui_enable("timer_list") //允许点击【引入缺勤记录】控件 
    gui_enable("date_Ext1") //允许点击【补卡日期】控件 
    gui_enable("ext_Ext2")  //允许点击【补卡部门】控件 
    return 0 
    }; 
   if(dept_id == '') 
   { 
    msg('请选择【部门】') 
    gui_hide("timer_list_r") //隐藏【删除缺勤记录数据】控件 
    gui_hide("timer_item") //隐藏【自动添加补卡时间】控件 
    gui_enable("timer_list") //允许点击【引入缺勤记录】控件 
    gui_enable("date_Ext1") //允许点击【补卡日期】控件 
    gui_enable("ext_Ext2")  //允许点击【补卡部门】控件 
    return 0 
    } 
   gui_set_val("Edit_Title",fmt_date(class_date,'yyyy年mm月dd日')+'【'+dept_name+'】缺勤补卡【'+voucherno+'】');sql = "select a.emp_id,a.class_date,a.on_time_1,a.off_time_1,a.on_time_2,a.off_time_2,a.on_time_3,a.off_time_3,"; 
   sql =sql+ "a.on_time_4,a.off_time_4,a.on_time_5,a.off_time_5,a.class_id,b.name,b.beg_time_1,b.end_time_1,b.beg_time_2,b.end_time_2,"; 
   sql =sql+ "b.beg_time_3,b.end_time_3,b.beg_time_4,b.end_time_4,b.beg_time_5,b.end_time_5,a.emp_id as emp_name"; 
   sql =sql+ " from timer_list a,timer_class_def b where a.class_id=b.class_id and class_date= '" + class_date + "' and absent_minute > '0'"; 
   sql =sql+ " and dept_id= '" + dept_id + "'"; 
   sql1 = "select o.emp_id,o.class_date,o.on_time_1,o.off_time_1,o.on_time_2,o.off_time_2,o.on_time_3,o.off_time_3,"; 
   sql1 =sql1+ "o.on_time_4,o.off_time_4,o.on_time_5,o.off_time_5,o.class_id,o.name,o.beg_time_1,o.end_time_1,o.beg_time_2,o.end_time_2,"; 
   sql1 =sql1+ "o.beg_time_3,o.end_time_3,o.beg_time_4,o.end_time_4,o.beg_time_5,o.end_time_5,o.emp_id as emp_name"; 
   sql1 =sql1+ ",p.dept_id,p.dept_id as dept_name from ( " + sql + " ) o left join (select * from emp) p on o.emp_id = p.emp_id" 
   db_run_query_thr(sql1) 
   db_map("emp","emp_name","emp_name"); //转换【姓名】 
   db_map("dept","dept_name","dept_name"); //转换【部门】 
   count = db_row_count() //获取缺勤数据记录数 
   if(dept_id != '' && count == '0') 
   { 
    msg('【'+dept_name+'】:【'+fmt_date(class_date,'yyyy年mm月dd日')+'】没有缺勤记录,请【重新设置引入条件】!') 
    gui_hide("timer_list_r") //隐藏【删除缺勤记录数据】控件 
    gui_hide("timer_item") //隐藏【自动添加补卡时间】控件 
    gui_enable("date_Ext1") //允许点击【补卡日期】控件 
    gui_enable("ext_Ext2") //允许点击【补卡部门】控件 
    gui_enable("timer_list") //允许点击【引入缺勤记录】控件 
    return 0 
    }; 
   for(i=0;i<count;i++); 
   { 
    db_go_row(i) //指向某条【缺勤记录】 
    grid_set_v("MG_Item","emp_id",i+1,db_res(0)); //【工号】列赋值 
    grid_set_v("MG_Item","mark_date",i+1,db_res(1)); //【日期】列赋值 
    grid_set_v("MG_Item","class_id",i+1,db_res(12)); //【考勤班次编号】列赋值(单据保存前使用,不会保存到数据库) 
    grid_set_v("MG_Item","class_name",i+1,db_res(13)); //【考勤班次名称】列赋值(单据保存前使用,不会保存到数据库) 
    grid_set_v("MG_Item","emp_name",i+1,db_res(24)); //【姓名】列赋值(单据保存后刷新前参考) 
    grid_set_v("MG_Item","dept_id",i+1,db_res(25)); //【部门编号】列赋值(单据保存后刷新前参考) 
    grid_set_v("MG_Item","dept_name",i+1,db_res(26)); //【部门】列赋值(单据保存后刷新前参考) 
    grid_set_v("MG_Item","beg1",i+1,db_res(14)); //【考勤班次的上班时间1】列赋值(单据保存后刷新前参考) 
    grid_set_v("MG_Item","end1",i+1,db_res(15)); //【考勤班次的下班时间1】列赋值(单据保存后刷新前参考) 
    grid_set_v("MG_Item","beg2",i+1,db_res(16)); //【考勤班次的上班时间2】列赋值(单据保存后刷新前参考) 
    grid_set_v("MG_Item","end2",i+1,db_res(17)); //【考勤班次的下班时间2】列赋值(单据保存后刷新前参考) 
    grid_set_v("MG_Item","beg3",i+1,db_res(18)); //【考勤班次的上班时间3】列赋值(单据保存后刷新前参考) 
    grid_set_v("MG_Item","end3",i+1,db_res(19)); //【考勤班次的下班时间3】列赋值(单据保存后刷新前参考) 
    grid_set_v("MG_Item","beg4",i+1,db_res(20)); //【考勤班次的上班时间4】列赋值(单据保存后刷新前参考) 
    grid_set_v("MG_Item","end4",i+1,db_res(21)); //【考勤班次的下班时间4】列赋值(单据保存后刷新前参考) 
    grid_set_v("MG_Item","beg5",i+1,db_res(22)); //【考勤班次的上班时间5】列赋值(单据保存后刷新前参考) 
    grid_set_v("MG_Item","end5",i+1,db_res(23)); //【考勤班次的下班时间5】列赋值(单据保存后刷新前参考) 
    mbeg1 = fmt_date(db_res(14),"hh:mi"); 
    mend1 = fmt_date(db_res(15),"hh:mi"); 
    mbeg2 = fmt_date(db_res(16),"hh:mi"); 
    mend2 = fmt_date(db_res(17),"hh:mi"); 
    mbeg3 = fmt_date(db_res(18),"hh:mi"); 
    mend3 = fmt_date(db_res(19),"hh:mi"); 
    mbeg4 = fmt_date(db_res(20),"hh:mi"); 
    mend4 = fmt_date(db_res(21),"hh:mi"); 
    mbeg5 = fmt_date(db_res(22),"hh:mi"); 
    mend5 = fmt_date(db_res(23),"hh:mi"); 
    grid_set_v("MG_Item","begtime"+j,i+1,'0'); 
    grid_set_v("MG_Item","endtime"+j,i+1,'0'); 
    grid_set_v("MG_Item","on0"+j,i+1,'0'); 
    grid_set_v("MG_Item","off0"+j,i+1,'0'); 
    if(db_res(14) != ''){ 
     grid_set_v("MG_Item","begtime1",i+1,'10'); 
     vbeg1 = grid_get_v("MG_Item","begtime1",i+1,); 
    }if(db_res(15) != ''){ 
     grid_set_v("MG_Item","endtime1",i+1,'10'); 
     vend1 = grid_get_v("MG_Item","endtime1",i+1,); 
    }if(db_res(16) != ''){ 
     grid_set_v("MG_Item","begtime2",i+1,'10'); 
     vbeg2 = grid_get_v("MG_Item","begtime2",i+1,); 
    }if(db_res(17) != ''){ 
     grid_set_v("MG_Item","endtime2",i+1,'10'); 
     vend2 = grid_get_v("MG_Item","endtime2",i+1,); 
    }if(db_res(18) != ''){ 
     grid_set_v("MG_Item","begtime3",i+1,'10'); 
     vbeg3 = grid_get_v("MG_Item","begtime3",i+1,); 
    }if(db_res(19) != ''){ 
     grid_set_v("MG_Item","endtime3",i+1,'10'); 
     vend3 = grid_get_v("MG_Item","endtime3",i+1,); 
    }if(db_res(20) != ''){ 
     grid_set_v("MG_Item","begtime4",i+1,'10'); 
     vbeg4 = grid_get_v("MG_Item","begtime4",i+1,); 
    }if(db_res(21) != ''){ 
     grid_set_v("MG_Item","endtime4",i+1,'10'); 
     vend4 = grid_get_v("MG_Item","endtime4",i+1,); 
    }if(db_res(22) != ''){ 
     grid_set_v("MG_Item","begtime5",i+1,'10'); 
     vbeg5 = grid_get_v("MG_Item","begtime5",i+1,); 
    }if(db_res(23) != ''){ 
     grid_set_v("MG_Item","endtime5",i+1,'10'); 
     vend5 = grid_get_v("MG_Item","endtime5",i+1,); 
    } 
    if(db_res(14) != '' && db_res(2) == ''){ 
    on1='--:--' 
    }if(db_res(14) != '' && db_res(2) != ''){ 
    on1=fmt_date(db_res(2),"hh:mi") 
    grid_set_v("MG_Item","on01",i+1,'10'); 
    von1 = grid_get_v("MG_Item","on01",i+1,); 
    }if(db_res(15) != '' && db_res(3) == ''){ 
    off1= '--:--' 
    }if(db_res(15) != '' && db_res(3) != ''){ 
    off1=fmt_date(db_res(3),"hh:mi") 
    grid_set_v("MG_Item","off01",i+1,'10'); 
    voff1 = grid_get_v("MG_Item","off01",i+1,); 
    }if(db_res(16) != '' && db_res(4) == ''){ 
    on2='--:--' 
    }if(db_res(16) != '' && db_res(4)!= ''){ 
    on2=fmt_date(db_res(4),"hh:mi") 
    grid_set_v("MG_Item","on02",i+1,'10'); 
    von2 = grid_get_v("MG_Item","on02",i+1,); 
    }if(db_res(17) != '' && db_res(5) == ''){ 
    off2='--:--' 
    }if(db_res(17) != '' && db_res(5) != ''){ 
    off2=fmt_date(db_res(5),"hh:mi") 
    grid_set_v("MG_Item","off02",i+1,'10'); 
    voff2 = grid_get_v("MG_Item","off02",i+1,); 
    }if(db_res(18) != '' && db_res(6) == ''){ 
    on3='--:--' 
    }if(db_res(18) != '' && db_res(6) != ''){ 
    on3=fmt_date(db_res(6),"hh:mi") 
    grid_set_v("MG_Item","on03",i+1,'10'); 
    von3 = grid_get_v("MG_Item","on03",i+1,); 
    }if(db_res(19) != '' && db_res(7) == ''){ 
    off3='--:--' 
    }if(db_res(19) != '' && db_res(7) != ''){ 
    off3=fmt_date(db_res(7),"hh:mi") 
    grid_set_v("MG_Item","off03",i+1,'10'); 
    voff3 = grid_get_v("MG_Item","off03",i+1,); 
    }if(db_res(20) != '' && db_res(8) == ''){ 
    on4='--:--' 
    }if(db_res(20) != '' && db_res(8) != ''){ 
    on4=fmt_date(db_res(8),"hh:mi") 
    grid_set_v("MG_Item","on04",i+1,'10'); 
    von4 = grid_get_v("MG_Item","on04",i+1,); 
    }if(db_res(21) != '' && db_res(9) == ''){ 
    off4='--:--' 
    }if(db_res(21) != '' && db_res(9) != ''){ 
    off4=fmt_date(db_res(9),"hh:mi") 
    grid_set_v("MG_Item","off04",i+1,'10'); 
    voff4 = grid_get_v("MG_Item","off04",i+1,); 
    }if(db_res(22) != '' && db_res(10) == ''){ 
    on5='--:--' 
    }if(db_res(22) != '' && db_res(10) != ''){ 
    on5=fmt_date(db_res(10),"hh:mi") 
    grid_set_v("MG_Item","on05",i+1,'10'); 
    von5 = grid_get_v("MG_Item","on05",i+1,); 
    }if(db_res(23) != '' && db_res(11) == ''){ 
    off5='--:--' 
    }if(db_res(23) != '' && db_res(11) != ''){ 
    off5=fmt_date(db_res(11),"hh:mi") 
    grid_set_v("MG_Item","off05",i+1,'10'); 
    voff5 = grid_get_v("MG_Item","off05",i+1,); 
    }if(db_res(14)!=''&&db_res(15)!=''&&db_res(16)==''&&db_res(17)==''){ 
    grid_set_v("MG_Item","Punch_record",i+1,on1+' - '+off1); 
    grid_set_v("MG_Item","classitem",i+1,mbeg1+' - '+mend1); 
    }if(db_res(16)!=''&&db_res(17)!=''&&db_res(18)==''&&db_res(19)==''){ 
    grid_set_v("MG_Item","Punch_record",i+1,on1+' - '+off1+'|'+on2+' - '+off2); 
    grid_set_v("MG_Item","classitem",i+1,mbeg1+' - '+mend1+'|'+mbeg2+' - '+mend2); 
    }if(db_res(18)!=''&&db_res(19)!=''&&db_res(20)==''&&db_res(21)==''){ 
    grid_set_v("MG_Item","Punch_record",i+1,on1+' - '+off1+'|'+on2+' - '+off2+'|'+on3+' - '+off3); 
    grid_set_v("MG_Item","classitem",i+1,mbeg1+' - '+mend1+'|'+mbeg2+' - '+mend2+'|'+mbeg3+' - '+mend3); 
    }if(db_res(20)!=''&&db_res(21)!=''&&db_res(22)==''&&db_res(23)==''){ 
    grid_set_v("MG_Item","Punch_record",i+1,on1+' - '+off1+'|'+on2+' - '+off2+'|'+on3+' - '+off3+'|'+on4+' - '+off4); 
    grid_set_v("MG_Item","classitem",i+1,mbeg1+' - '+mend1+'|'+mbeg2+' - '+mend2+'|'+mbeg3+' - '+mend3+'|'+mbeg4+' - '+mend4); 
    }if(db_res(23) != ''){ 
    grid_set_v("MG_Item","Punch_record",i+1,on1+' - '+off1+'|'+on2+' - '+off2+'|'+on3+' - '+off3+'|'+on4+' - '+off4+'|'+on5+' - '+off5); 
    grid_set_v("MG_Item","classitem",i+1,mbeg1+' - '+mend1+'|'+mbeg2+' - '+mend2+'|'+mbeg3+' - '+mend3+'|'+mbeg4+' - '+mend4+'|'+mbeg5+' - '+mend5); 
    }; 
   }; 
    sumon1 = grid_get_col_sum('MG_Item','on01')/10 
    sumon2 = grid_get_col_sum('MG_Item','on02')/10 
    sumon3 = grid_get_col_sum('MG_Item','on03')/10 
    sumon4 = grid_get_col_sum('MG_Item','on04')/10 
    sumon5 = grid_get_col_sum('MG_Item','on05')/10 
    sumoff1 = grid_get_col_sum('MG_Item','off01')/10 
    sumoff2 = grid_get_col_sum('MG_Item','off02')/10 
    sumoff3 = grid_get_col_sum('MG_Item','off03')/10 
    sumoff4 = grid_get_col_sum('MG_Item','off04')/10 
    sumoff5 = grid_get_col_sum('MG_Item','off05')/10 
    sumbeg1 = grid_get_col_sum('MG_Item','begtime1')/10 
    sumbeg2 = grid_get_col_sum('MG_Item','begtime2')/10 
    sumbeg3 = grid_get_col_sum('MG_Item','begtime3')/10 
    sumbeg4 = grid_get_col_sum('MG_Item','begtime4')/10 
    sumbeg5 = grid_get_col_sum('MG_Item','begtime5')/10 
    sumend1 = grid_get_col_sum('MG_Item','endtime1')/10 
    sumend2 = grid_get_col_sum('MG_Item','endtime2')/10 
    sumend3 = grid_get_col_sum('MG_Item','endtime3')/10 
    sumend4 = grid_get_col_sum('MG_Item','endtime4')/10 
    sumend5 = grid_get_col_sum('MG_Item','endtime5')/10 
    marktimesum=sumbeg1+sumbeg2+sumbeg3+sumbeg4+sumbeg5+sumend1+sumend2+sumend3+sumend4+sumend5-sumon1-sumon2-sumon3-sumon4-sumon5-sumoff1-sumoff2-sumoff3-sumoff4-sumoff5 
    marktimesum=num_trim(marktimesum)-i 
    gui_set_val("edit_Ext4",marktimesum) 
   for(j=1;j<6;j++); 
   { 
    grid_hide_col("MG_Item",'on0'+j); 
    grid_hide_col("MG_Item",'off0'+j); 
    grid_hide_col("MG_Item",'begtime'+j); 
    grid_hide_col("MG_Item",'endtime'+j); 
    grid_hide_col("MG_Item",'beg'+j); 
    grid_hide_col("MG_Item",'end'+j); 
    grid_mark_sum("MG_Item",'on0'+j); 
    grid_mark_sum("MG_Item",'off0'+j); 
    grid_mark_sum("MG_Item",'begtime'+j); 
    grid_mark_sum("MG_Item",'endtime'+j); 
    grid_mark_sum("MG_Item",'beg'+j); 
    grid_mark_sum("MG_Item",'end'+j); 
   }; 
  grid_sort("MG_Item",'emp_id'); 
  int x,y,w,h,x1; 
  x=gui_get_x("timer_list") //【引入缺勤记录】横向坐标 
  y=gui_get_y("timer_list") //【引入缺勤记录】控件纵向坐标 
  w=gui_get_w("timer_list") //【引入缺勤记录】控件宽度 
  h=gui_get_h("timer_list") //【引入缺勤记录】控件高度 
  gui_create_speedbutton("ScrollBox_Base","timer_list_r",x+w+10,y,w+20,h,"删除缺勤记录数据","call_csp.voucher.YC.删除缺勤记录数据"); 
  gui_set_font_color('timer_list_r',0x0000ff); 
  gui_set_hint ("timer_list_r", '删除已引入的缺勤记录数据'); 
  gui_hide("timer_list_r") //隐藏【删除缺勤记录数据】控件 
  gui_create_speedbutton("ScrollBox_Base","timer_item",x+w*2+40,y,w+20,h,"自动添加补卡时间","call_csp.voucher.YC.自动添加补卡时间"); 
  gui_hide("timer_item") //隐藏【自动添加补卡时间】控件 
  gui_trigger_click("timer_item"); 
  return 1; 
}; 
 
int 刷新补卡日期缺勤明细() 

   gui_disable("timer_list") //不允许点击【引入缺勤记录】控件 
   gui_disable("date_Ext1")  //不允许点击【补卡日期】控件 
   gui_disable("date_Ext2")  //不允许点击【补卡部门】控件 
   gui_hide("timer_list_r")//隐藏【删除考勤记录数据】控件 
   gui_hide("timer_item") //隐藏【自动添加补卡时间】控件 
   int i,rc,j; 
   string sql,sql1,class_date,Punch_record,on1,off1,on2,off2,on3,off3,on4,off4,on5,off5,class_id,class_name,dept_id,dept_name,voucherno,timestt,timesttok,empid; 
   string mbeg1,mbeg2,mbeg3,mbeg4,mbeg5,mend1,mend2,mend3,mend4,mend5; 
   num vtimesum,vrecordsum,von1,von2,von3,von4,von5,voff1,voff2,voff3,voff4,voff5,vbeg1,vbeg2,vbeg3,vbeg4,vbeg5,vend1,vend2,vend3,vend4,vend5; 
   grid_add_col_str("MG_Item",'Punch_record','打卡记录') 
   grid_mark_readonly('MG_Item','Punch_record') 
   grid_set_col_width("MG_Item",'Punch_record',200) 
   grid_set_col_color("MG_Item",'Punch_record',0x0000ff); 
   grid_add_col_str("MG_Item",'class_id','考勤班次编号') 
   grid_mark_readonly('MG_Item','class_id') 
   grid_set_col_width("MG_Item",'class_id',100) 
   grid_set_col_color("MG_Item",'class_id',0x0000ff); 
   grid_add_col_str("MG_Item",'class_name','考勤班次名称') 
   grid_mark_readonly('MG_Item','class_name') 
   grid_set_col_width("MG_Item",'class_name',100) 
   grid_set_col_color("MG_Item",'class_name',0x0000ff); 
   grid_add_col_str("MG_Item",'classitem','考勤班次时间段') 
   grid_mark_readonly('MG_Item','classitem') 
   grid_set_col_width("MG_Item",'classitem',200) 
   grid_set_col_color("MG_Item",'classitem',16711680); 
   for(j=1;j<6;j++); 
   { 
    grid_add_col_str("MG_Item",'on0'+j,'上班'+j) 
    grid_mark_readonly('MG_Item','on0'+j) 
    grid_add_col_str("MG_Item",'off0'+j,'下班'+j) 
    grid_mark_readonly('MG_Item','off0'+j) 
    grid_add_col_str("MG_Item",'begtime'+j,'上班次数'+j) 
    grid_mark_readonly('MG_Item','begtime'+j) 
    grid_add_col_str("MG_Item",'endtime'+j,'下班次数'+j) 
    grid_mark_readonly('MG_Item','endtime'+j) 
    grid_add_col_str("MG_Item",'beg'+j,'标准上班时间'+j) 
    grid_mark_readonly('MG_Item','beg'+j) 
    grid_add_col_str("MG_Item",'end'+j,'标准下班时间'+j) 
    grid_mark_readonly('MG_Item','end'+j) 
   }; 
   class_date = gui_get_val("date_Ext1") //获取【补卡日期】 
   rc = grid_find('MG_Item','emp_id',''); 
   for(i=1;i<rc;i++); 
   { 
    empid = grid_get_v("MG_Item","emp_id",i,); 
    sql = "select a.emp_id,a.class_date,a.on_time_1,a.off_time_1,a.on_time_2,a.off_time_2,a.on_time_3,a.off_time_3,"; 
    sql =sql+ "a.on_time_4,a.off_time_4,a.on_time_5,a.off_time_5,a.class_id,b.name,b.beg_time_1,b.end_time_1,b.beg_time_2,b.end_time_2,"; 
    sql =sql+ "b.beg_time_3,b.end_time_3,b.beg_time_4,b.end_time_4,b.beg_time_5,b.end_time_5,a.emp_id as emp_name"; 
    sql =sql+ " from timer_list a,timer_class_def b where a.class_id=b.class_id and class_date= '" + class_date + "' and absent_minute > '0'"; 
    sql =sql+ " and emp_id= '" + empid + "'"; 
    db_run_query_thr(sql) 
    grid_set_v("MG_Item","class_id",i,db_res(12)); //【考勤班次编号】列赋值(单据保存前使用,不会保存到数据库) 
    grid_set_v("MG_Item","class_name",i,db_res(13)); //【考勤班次名称】列赋值(单据保存前使用,不会保存到数据库) 
    grid_set_v("MG_Item","beg1",i+1,db_res(14)); //【考勤班次的上班时间1】列赋值(单据保存后刷新前参考) 
    grid_set_v("MG_Item","end1",i+1,db_res(15)); //【考勤班次的下班时间1】列赋值(单据保存后刷新前参考) 
    grid_set_v("MG_Item","beg2",i+1,db_res(16)); //【考勤班次的上班时间2】列赋值(单据保存后刷新前参考) 
    grid_set_v("MG_Item","end2",i+1,db_res(17)); //【考勤班次的下班时间2】列赋值(单据保存后刷新前参考) 
    grid_set_v("MG_Item","beg3",i+1,db_res(18)); //【考勤班次的上班时间3】列赋值(单据保存后刷新前参考) 
    grid_set_v("MG_Item","end3",i+1,db_res(19)); //【考勤班次的下班时间3】列赋值(单据保存后刷新前参考) 
    grid_set_v("MG_Item","beg4",i+1,db_res(20)); //【考勤班次的上班时间4】列赋值(单据保存后刷新前参考) 
    grid_set_v("MG_Item","end4",i+1,db_res(21)); //【考勤班次的下班时间4】列赋值(单据保存后刷新前参考) 
    grid_set_v("MG_Item","beg5",i+1,db_res(22)); //【考勤班次的上班时间5】列赋值(单据保存后刷新前参考) 
    grid_set_v("MG_Item","end5",i+1,db_res(23)); //【考勤班次的下班时间5】列赋值(单据保存后刷新前参考) 
    mbeg1 = fmt_date(db_res(14),"hh:mi"); 
    mend1 = fmt_date(db_res(15),"hh:mi"); 
    mbeg2 = fmt_date(db_res(16),"hh:mi"); 
    mend2 = fmt_date(db_res(17),"hh:mi"); 
    mbeg3 = fmt_date(db_res(18),"hh:mi"); 
    mend3 = fmt_date(db_res(19),"hh:mi"); 
    mbeg4 = fmt_date(db_res(20),"hh:mi"); 
    mend4 = fmt_date(db_res(21),"hh:mi"); 
    mbeg5 = fmt_date(db_res(22),"hh:mi"); 
    mend5 = fmt_date(db_res(23),"hh:mi"); 
    if(db_res(14) != ''){ 
     grid_set_v("MG_Item","begtime1",i+1,'10'); 
     vbeg1 = grid_get_v("MG_Item","begtime1",i+1,); 
    }if(db_res(15) != ''){ 
     grid_set_v("MG_Item","endtime1",i+1,'10'); 
     vend1 = grid_get_v("MG_Item","endtime1",i+1,); 
    }if(db_res(16) != ''){ 
     grid_set_v("MG_Item","begtime2",i+1,'10'); 
     vbeg2 = grid_get_v("MG_Item","begtime2",i+1,); 
    }if(db_res(17) != ''){ 
     grid_set_v("MG_Item","endtime2",i+1,'10'); 
     vend2 = grid_get_v("MG_Item","endtime2",i+1,); 
    }if(db_res(18) != ''){ 
     grid_set_v("MG_Item","begtime3",i+1,'10'); 
     vbeg3 = grid_get_v("MG_Item","begtime3",i+1,); 
    }if(db_res(19) != ''){ 
     grid_set_v("MG_Item","endtime3",i+1,'10'); 
     vend3 = grid_get_v("MG_Item","endtime3",i+1,); 
    }if(db_res(20) != ''){ 
     grid_set_v("MG_Item","begtime4",i+1,'10'); 
     vbeg4 = grid_get_v("MG_Item","begtime4",i+1,); 
    }if(db_res(21) != ''){ 
     grid_set_v("MG_Item","endtime4",i+1,'10'); 
     vend4 = grid_get_v("MG_Item","endtime4",i+1,); 
    }if(db_res(22) != ''){ 
     grid_set_v("MG_Item","begtime5",i+1,'10'); 
     vbeg5 = grid_get_v("MG_Item","begtime5",i+1,); 
    }if(db_res(23) != ''){ 
     grid_set_v("MG_Item","endtime5",i+1,'10'); 
     vend5 = grid_get_v("MG_Item","endtime5",i+1,); 
    } 
    if(db_res(14) != '' && db_res(2) == ''){on1='--:--' 
    }if(db_res(14) != '' && db_res(2) != ''){ 
    on1=fmt_date(db_res(2),"hh:mi") 
    grid_set_v("MG_Item","on01",i,'10'); 
    von1 = grid_get_v("MG_Item","on01",i,); 
    grid_set_cell_color("MG_Item",'on01',i,32768); 
    }if(db_res(15) != '' && db_res(3) == ''){ 
    off1= '--:--' 
    }if(db_res(15) != '' && db_res(3) != ''){ 
    off1=fmt_date(db_res(3),"hh:mi") 
    grid_set_v("MG_Item","off01",i,'10'); 
    grid_set_cell_color("MG_Item",'off01',i,32768); 
    voff1 = grid_get_v("MG_Item","off01",i,); 
    }if(db_res(16) != '' && db_res(4) == ''){ 
    on2='--:--' 
    }if(db_res(16) != '' && db_res(4) != ''){ 
    on2=fmt_date(db_res(4),"hh:mi") 
    grid_set_v("MG_Item","on02",i,'10'); 
    grid_set_cell_color("MG_Item",'on02',i,32768); 
    von2 = grid_get_v("MG_Item","on02",i,); 
    }if(db_res(17) != '' && db_res(5) == ''){ 
    off2='--:--' 
    }if(db_res(17) != '' && db_res(5) != ''){ 
    off2=fmt_date(db_res(5),"hh:mi") 
    grid_set_v("MG_Item","off02",i,'10'); 
    grid_set_cell_color("MG_Item",'off02',i,32768); 
    voff2 = grid_get_v("MG_Item","off02",i,); 
    }if(db_res(18) != '' && db_res(6) == ''){ 
    on3='--:--' 
    }if(db_res(18) != '' && db_res(6) != ''){ 
    on3=fmt_date(db_res(6),"hh:mi") 
    grid_set_v("MG_Item","on03",i,'10'); 
    grid_set_cell_color("MG_Item",'on03',i,32768); 
    von3 = grid_get_v("MG_Item","on03",i,); 
    }if(db_res(19) != '' && db_res(7) == ''){ 
    off3='--:--' 
    }if(db_res(19) != '' && db_res(7) != ''){ 
    off3=fmt_date(db_res(7),"hh:mi") 
    grid_set_v("MG_Item","off03",i,'10'); 
    grid_set_cell_color("MG_Item",'off03',i,32768); 
    voff3 = grid_get_v("MG_Item","off03",i,); 
    }if(db_res(20) != '' && db_res(8) == ''){ 
    on4='--:--' 
    }if(db_res(20) != '' && db_res(8) != ''){ 
    on4=fmt_date(db_res(8),"hh:mi") 
    grid_set_v("MG_Item","on04",i,'10'); 
    grid_set_cell_color("MG_Item",'on04',i,32768); 
    von4 = grid_get_v("MG_Item","on04",i,); 
    }if(db_res(21) !='' && db_res(9) == ''){ 
    off4='--:--' 
    }if(db_res(21) != '' && db_res(9) != ''){ 
    off4=fmt_date(db_res(9),"hh:mi") 
    grid_set_v("MG_Item","off04",i,'10'); 
    grid_set_cell_color("MG_Item",'off04',i,32768); 
    voff4 = grid_get_v("MG_Item","off04",i,); 
    }if(db_res(22) != '' && db_res(10) == ''){ 
    on5='--:--' 
    }if(db_res(22) != '' && db_res(10) != ''){ 
    on5=fmt_date(db_res(10),"hh:mi") 
    grid_set_v("MG_Item","on05",i,'10'); 
    grid_set_cell_color("MG_Item",'on05',i,32768); 
    von5 = grid_get_v("MG_Item","on05",i,); 
    }if(db_res(23) != '' && db_res(11) == ''){ 
    off5='--:--' 
    }if(db_res(23) != '' && db_res(11) != ''){ 
    off5=fmt_date(db_res(11),"hh:mi") 
    grid_set_v("MG_Item","off05",i,'10'); 
    grid_set_cell_color("MG_Item",'off05',i,32768); 
    voff5 = grid_get_v("MG_Item","off05",i,); 
    }if(db_res(14)!=''&&db_res(15)!=''&&db_res(16)==''&&db_res(17)==''){ 
    grid_set_v("MG_Item","Punch_record",i,on1+' - '+off1); 
    grid_set_v("MG_Item","classitem",i,mbeg1+' - '+mend1); 
    }if(db_res(16)!=''&&db_res(17)!=''&&db_res(18)==''&&db_res(19)==''){ 
    grid_set_v("MG_Item","Punch_record",i,on1+' - '+off1+'|'+on2+' - '+off2); 
    grid_set_v("MG_Item","classitem",i,mbeg1+' - '+mend1+'|'+mbeg2+' - '+mend2); 
    }if(db_res(18)!=''&&db_res(19)!=''&&db_res(20)==''&&db_res(21)==''){ 
    grid_set_v("MG_Item","Punch_record",i,on1+' - '+off1+'|'+on2+' - '+off2+'|'+on3+' - '+off3); 
    grid_set_v("MG_Item","classitem",i,mbeg1+' - '+mend1+'|'+mbeg2+' - '+mend2+'|'+mbeg3+' - '+mend3); 
    }if(db_res(20)!=''&&db_res(21)!=''&&db_res(22)==''&&db_res(23)==''){ 
    grid_set_v("MG_Item","Punch_record",i,on1+' - '+off1+'|'+on2+' - '+off2+'|'+on3+' - '+off3+'|'+on4+' - '+off4); 
    grid_set_v("MG_Item","classitem",i,mbeg1+' - '+mend1+'|'+mbeg2+' - '+mend2+'|'+mbeg3+' - '+mend3+'|'+mbeg4+' - '+mend4); 
    }if(db_res(23) != ''){ 
    grid_set_v("MG_Item","Punch_record",i,on1+' - '+off1+'|'+on2+' - '+off2+'|'+on3+' - '+off3+'|'+on4+' - '+off4+'|'+on5+' - '+off5); 
    grid_set_v("MG_Item","classitem",i,mbeg1+' - '+mend1+'|'+mbeg2+' - '+mend2+'|'+mbeg3+' - '+mend3+'|'+mbeg4+' - '+mend4+'|'+mbeg5+' - '+mend5); 
    }; 
   }; for(j=1;j<6;j++); 
   { 
    grid_hide_col("MG_Item",'on0'+j); 
    grid_hide_col("MG_Item",'off0'+j); 
    grid_hide_col("MG_Item",'begtime'+j); 
    grid_hide_col("MG_Item",'endtime'+j); 
    grid_hide_col("MG_Item",'beg'+j); 
    grid_hide_col("MG_Item",'end'+j); 
   }; 
 return 1; 
}; 
 
int func_show() 

  int x,y,w,h; 
  x=gui_get_x("SpeedButton_Return") //【单据日期】横向坐标 
  y=gui_get_y("SpeedButton_Return") //【单据日期】控件纵向坐标 
  w=gui_get_w("SpeedButton_Return") //【单据日期】控件宽度 
  h=gui_get_h("SpeedButton_Return") //【单据日期】控件高度 
  gui_create_speedbutton("ScrollBox_Base","timer_list",x*3+30,y,w+20,h,"引入缺勤记录","call_csp.voucher.YC.提取补卡日期缺勤记录"); 
  gui_set_font_color('timer_list',0x0000ff); 
  gui_set_hint ("timer_list", '提取【补卡日期】和【补卡部门】的缺勤记录,此控件为灰色不可点击时,请新增单据重新做单!'); 
  gui_create_speedbutton("ScrollBox_Base","timer_list_r",x*3+w+60,y,w+35,h,"删除缺勤记录数据","call_csp.voucher.YC.删除缺勤记录数据"); 
  gui_set_font_color('timer_list_r',0x0000ff); 
  gui_set_hint ("timer_list_r", '删除已引入的缺勤记录数据'); 
  gui_hide("timer_list_r") //隐藏【删除缺勤记录数据】控件 
  gui_create_speedbutton("ScrollBox_Base","timer_item",x*3+w*2+105,y,w+35,h,"自动添加补卡时间","call_csp.voucher.YC.自动添加补卡时间"); 
  gui_set_font_color('timer_item',0x0000ff); 
  gui_set_hint ("timer_item", '根据【缺勤次数】自动【添加明细行】并匹配【标准考勤时间】到【时间】列'); 
  gui_set_hint ("SpeedButton_Save", '单据要保存2次之后才允许送审!'); 
  gui_show("timer_list_r") //显示【删除考勤记录数据】控件 
  if(v_voucher_id != '0') 
  { 
   刷新补卡日期缺勤明细() 
   }; 
   grid_filter_hide("MG_Item","工号==''");//隐藏【grid_copy_row】函数产生的空白行 
  return 1; 
}; 
 
int cell_change() 

  //change_col,change_col_id,change_row_id 
  return 1; 
}; 
 
int obj_change() 

  if(change_obj ==  "ext_Ext3" ) 
  { 
    int i,grid_rows; 
    string addcauseid,addcausename; 
    grid_rows = grid_find('MG_Item','emp_id',''); 
    addcauseid = gui_get_val("ext_Ext3") 
    addcausename = gui_get_text("ext_Ext3") 
    for(i=1;i<grid_rows;i++) 
    { 
      grid_set_v('MG_Item','add_cause_id',i,addcauseid); 
      grid_set_v('MG_Item','add_cause_name',i,addcausename); 
     }; 
   }; 
  //change_obj 
  return 1; 
}; 
 
int init_row() 

  return 1; 
}; 
 
int adjust_row() 

  return 1; 
}; 
 
int func_before_print() 

  //can_print=1; 
  return 1; 
}; 
 
int func_before_save() 

 if(gui_get_val("DateTimePicker_Voucher_Date") > get_cur_date_std()) 
  { 
   msg('单据日期超过当前日期,保存失败,请检查!'); 
   can_save = 0; 
  }; 
    int i,grid_rows,rb,rc,rd; 
    db_run("select count(*) from timer_mark_v_item where voucher_id='"+v_voucher_id+"'") 
    grid_rows = grid_find('MG_Item','emp_id',''); 
    rb = grid_find('MG_Item','mark_time',''); 
    rc = grid_rows-grid_find('MG_Item','mark_time',''); 
    rd = grid_rows-grid_find('MG_Item','add_cause_name',''); 
    gui_set_val("edit_Ext4",rc) 
    grid_rows = grid_rows-1 
    if(rb == '1') 
    { 
     msg('没有补卡明细,禁止保存!'); 
     can_save = 0; 
     }; 
    if(rc != '0' && rb != '1') 
    { 
     自动添加补卡时间() 
     }if(grid_rows == db_res(0) && rc == '0' && rd == '0' && rb != '1'){ 
     msg('【补卡申请】完成,可以送审单据了!') 
     } 
     grid_sort("MG_Item",'emp_id,mark_time'); 
//按照【工号】,【日期】,【时间】检查已做的申请单,避免重复做单 
 if(v_voucher_id == '0') 
 { 
  string sql,empid,empname,markdate,marktime,voucherid,deptname; 
  int i,j,rc,count; 
  grid_color_clear("MG_Item") 
  markdate = gui_get_val("date_Ext1") 
  deptname = gui_get_text("ext_Ext2") 
  rc = grid_find("MG_Item","emp_id",""); 
  for(i=1;i<rc;i++); 
  { 
   //dbg(v_voucher_id) 
   empid = grid_get_v("MG_Item","emp_id",i); 
   empname = grid_get_v("MG_Item","emp_name",i); 
   marktime = grid_get_v("MG_Item","mark_time",i); 
   db_run("select voucher_id from timer_mark_v_item where emp_id='" + empid + "'and mark_date='" + markdate + "' and mark_time='" + marktime + "'") 
    if(db_res(0) != '') 
    { 
     grid_del_row('MG_Item',i); 
     i--; 
     msg('【'+deptname+'】:【'+empid+'】:【'+empname+'】:【'+fmt_date(markdate,'yyyy年mm月dd日')+'】:【'+fmt_date(marktime,'hh:mi')+'】已申请补卡,重复申请记录【自动删除中】!'); 
     can_save = 0; 
     }if(grid_find("MG_Item","emp_id","") == '1'){ 
     gui_trigger_click("timer_list_r"); 
     }; 
    }; 
   }; 
  //can_save=1; 
  return 1; 
}; 
 
int func_before_check() 

  //can_check=1; 
  return 1; 
}; 
 
int func_after_save() 

  return 1; 
}; 
 
int func_after_check() 

  return 1; 
}; 
 
int func_after_print() 

  return 1; 
}; 
 
int func_before_oper() 

 if(oper_type() == 'ask_check') 
 { 
  int i,grid_rows,rb,rc,rd; 
  db_run("select count(*) from timer_mark_v_item where voucher_id='"+v_voucher_id+"'") 
  grid_rows = grid_find('MG_Item','emp_id',''); 
  rb = grid_find('MG_Item','mark_time',''); 
  rc = grid_rows-grid_find('MG_Item','mark_time',''); 
  rd = grid_rows-grid_find('MG_Item','add_cause_name',''); 
  if(v_voucher_id == '0') 
  { 
   msg('单据还没有保存,请保存单据后再送审!') 
   can_oper=0 
   }; 
  if(db_res(0) == grid_rows) 
  { 
   msg('单据没有保存2次,请保存单据后再送审!') 
   can_oper=0 
    view_voucher_by_no(v_voucher_no) 
   }; 
  grid_rows = grid_rows-1 
  if(v_voucher_id !='0' && rb != '1' && rc != '0' && rd != '0' && db_res(0) == grid_rows) 
  { 
   msg('还有【'+rc+'】行的【时间】列和【'+rd+'】行的【原因】列为空,请再保存单据一次并补齐【原因】列数据后再【送审】单据!') 
   can_oper=0 
   }; 
  if(rb != '1' && rc != '0' && rd == '0') 
  { 
   msg('还有【'+rc+'】行的【时间】列为空,请再保存单据一次后再【送审】单据') 
   can_oper=0 
   }; 
  if(v_voucher_id !='0' && rc == '0' && rd != '0' && rb != '1') 
  { 
   msg('还有【'+rd+'】行的【原因】列为空,请补齐【原因】列数据后再【送审】单据!') 
   can_oper=0 
   }; 
  }; 
  //oper_type=save,check,check_r,finish,finish_r,delete,giveup,ask_check,ask_check_r,checked_update; 
  //can_oper=1; 
  return 1; 
}; 
 
int func_after_oper() 

  //oper_type=save,check,check_r,finish,finish_r,delete,giveup,ask_check,ask_check_r,checked_update,duplicate; 
  return 1; 
}; 
 
int main() 

  return 1; 
};




        于 2023-05-22 21:40 被 fwj3861 修改




官方认证第三方服务团队  樊文俊(越南-叶子) QQ:121305301 TEL:+84869350626
承接越南北部-河内周边省份-OIT部署和维护服务(24小时上门或远程服务)
服务介绍:http://www.onlyit.cn/onlyit_service.html

fwj3861  [个人空间]
QQ名  越南-叶子(121305301)


注册  2010-09-09
发贴数  536
精华贴  10
原创贴  20
来自  越南
状态  正常

级别  贵宾
#2»发布于2023-05-22 18:13

单据审核完成,会同步数据到打卡记录,在考勤数据处理这里提取出来重新处理一次,考勤日账就正常了,没有缺勤记录了,再做一次补打卡申请就会弹出提示了








官方认证第三方服务团队  樊文俊(越南-叶子) QQ:121305301 TEL:+84869350626
承接越南北部-河内周边省份-OIT部署和维护服务(24小时上门或远程服务)
服务介绍:http://www.onlyit.cn/onlyit_service.html

hong816  [个人空间]
QQ名  浮天风


注册  2010-04-26
发贴数  362
精华贴  1
原创贴  1
来自  
状态  正常

级别  贵宾
#3»发布于2023-05-23 08:24

感谢分享!一些特殊需求确实麻烦!






诚信是金!!!!提供onlyit系统服务:人力资源、进销存生产管理、数字化工厂建设等一条龙服务:401698929    13958183550

821059058  [个人空间]


注册  2023-04-22
发贴数  6
精华数  0
原创贴  0
来自  
状态  正常

级别  会员
#4»发布于2023-08-10 14:42

不错,感谢分享,虽然用不到,但是能学到不少东西。




wwx001  [个人空间]
QQ名  时光呓语


注册  2011-05-23
发贴数  657
精华贴  2
原创贴  3
来自  
状态  正常

级别  会员
#5»发布于2023-08-10 19:32

感谢分享,可作为参考。






QQ:772600297


 5  1/1   1  

登录后方可发贴


[ 电话: 0571-85462761 王先生 QQ: 124520435 加入软件QQ群 - 杭州 - 浙ICP备19051128号-1 网安 33010402003225 ]