系统部分统计项目重算脚本,能用上就拿去。也许大家会疑惑一些统计项目系统月帐生成已经计算好了,为什么还要重算呢? 因为部分工厂行政跟工人的计算日期是不同的,行政是1-月底,像有些工人是20几号到下月20几号。这样我们不得不设两次日期,生成两份,还要过滤一下才能导出,很是麻烦。 于是加了些脚本,月帐只生成一份就好,行政人员日期按系统默认1号至月底,工人的开始结束日期都按我们设定的计算,操作一次就得出来 以下仅统参考,大家举一反三 sql="select count(*) from timer_class_emp where (emp_id='" emp_id "' and class_date>=''" 开始日期 "'' and class_date<=''" 结束日期 "'')" db_run(sql) 排班天数=db_res(0) 应出勤天数= 排班天数 应出勤时数=应出勤天数*8 sql="select sum(overtime_minute) from timer_list where (emp_id ='" emp_id "' and tq_date >= '" 开始日期 "' and tq_date <= '" 结束日期 "')" db_run(sql) 日帐加班累计=db_res(0) //这里用日帐的加班时间字段放餐费补贴 sql="select sum(tq_money) from tuiquan where (emp_id ='" emp_id "' and tq_date >= '" 开始日期 "' and tq_date <= '" 结束日期 "')" db_run(sql) 退餐券=db_res(0) 用餐补贴=日帐加班累计-退餐券 sql="select sum(on_late_minute)*1.0/60 from timer_list where (emp_id ='" emp_id "' and class_date >= '" 开始日期 "' and class_date <= '" 结束日期 "')" db_run(sql) 迟到累计=db_res(0) sql="select count(*) from timer_list where (emp_id ='" emp_id "' and class_date >= '" 开始日期 "' and class_date <= '" 结束日期 "' and on_late_minute>0)" db_run(sql) 迟到次数=db_res(0) sql="select sum(off_early_minute)*1.0/60 from timer_list where (emp_id ='" emp_id "' and class_date >= '" 开始日期 "' and class_date <= '" 结束日期 "')" db_run(sql) 早退累计=db_res(0) sql="select count(*) from timer_list where (emp_id ='" emp_id "' and class_date >= '" 开始日期 "' and class_date <= '" 结束日期 "' and off_early_minute>0)" db_run(sql) 早退次数=db_res(0) sql="select sum(absent_minute)*1.0/60 from timer_list where (emp_id ='" emp_id "' and class_date >= '" 开始日期 "' and class_date <= '" 结束日期 "')" db_run(sql) 缺勤累计=db_res(0) sql="select count(*) fromtimer_list where (emp_id ='" emp_id "' and class_date >= '" 开始日期 "' and class_date <= '" 结束日期 "' and absent_minute>0)" db_run(sql) 缺勤次数=db_res(0) sql="select sum(hours*60 minutes) from timer_overtime where (emp_id ='" emp_id "' and overtime_date >= '" 开始日期 "' and overtime_date <= '" 结束日期 "' and overtime_type_id='b')" db_run(sql) 平时加班累计=db_res(0) sql="select sum(hours*60 minutes)*1.0/60 from timer_overtime where (emp_id ='" emp_id "' and overtime_date >= '" 开始日期 "' and overtime_date <= '" 结束日期 "' and overtime_type_id='c')" db_run(sql) 周日加班累计=db_res(0) sql="select sum(hours*60 minutes)*1.0/60 from timer_leave where (emp_id ='" emp_id "' and beg_time >= '" 开始日期 "' and end_time <= '" 结束日期 "' and leave_type_id='c')" db_run(sql) 病假累计=db_res(0) sql="select sum(hours*60 minutes)*1.0/60 from timer_leave where (emp_id ='" emp_id "' and beg_time >= '" 开始日期 "' and end_time <= '" 结束日期 "' and leave_type_id='a')" db_run(sql) 事假累计=db_res(0) sql="select sum(hours*60 minutes)*1.0/60 from timer_leave where (emp_id ='" emp_id "' and beg_time >= '" 开始日期 "' and end_time <= '" 结束日期 "' and leave_type_id='g')" db_run(sql) 节假日累计=db_res(0) sql="select sum(total_minute)*1.0/60 from timer_list where (emp_id ='" emp_id "' and class_date >= '" 开始日期 "' and class_date <= '" 结束日期 "')" db_run(sql) 日帐总计小时=db_res(0) 于 2013-08-09 17:02 被 awfixtdm 修改

qq:80240800 |
感谢 awfixtdm 分享心得, 很强。

三生石上旧精魂 赏月吟风莫要论 惭愧情人远相访 此身虽异性长存 |
这些脚本得写在哪里呀 |
月帐计算规则

qq:80240800 |
谢谢分享,辛苦了。 |
感谢分享。收藏。 |