资源预览内容
第1页 / 共30页
第2页 / 共30页
第3页 / 共30页
第4页 / 共30页
第5页 / 共30页
第6页 / 共30页
第7页 / 共30页
第8页 / 共30页
第9页 / 共30页
第10页 / 共30页
亲,该文档总共30页,到这儿已超出免费预览范围,如果喜欢就下载吧!
资源描述
员工考勤信息管理的设计和实现1. 系统描述1.1问题说明本试验要设计员工考勤管理系统,本系统作用是用于企业员工管理,解决人工考勤面对庞大数据量的弊病.该系统侧重于员工考勤信息管理和员工考勤信息的登记与查询。本系统使用的开发工具是vc+开发程序,通过已编制好的程序,完成对员工信息的输入、输出、插入、删除操作,以与员工迟到、早退考勤信息的登记和查询,完善企业管理现代化,方便管理人员统计,考核员工出勤情况,方便员工管理部门查询,考核员工的出勤率,准确地掌握员工出勤情况和相关资料,有效管理、掌握员工各项情况.1.2功能需求本试验要实现员工考勤管理系统,本系统包括的基本功能有:1.2.1员工信息的管理1.2.2员工信息的统计1.2.3员工考勤信息的管理和查询1.3数据需求本系统为完成所要求功能需要的数据包括:1.3.1员工ID,部门1.3.2员工迟到,早退情况1.3.3在一定期间里员工迟到,早退次数2.系统设计2.1存数据结构设计系统各实体可用以下关系表示:员工(ID,部门)考勤(ID,迟到,早退,日期)统计(ID,迟到次数,早退次数,期间2.2数据文件设计2.2.1.存储员工信息的文件:文件名:information1.txt文件容:日期ID部门. .例:2010 3 1 ID部门 11三安保部 12四安保部2.2.2.存储员工考勤信息的文件:文件名:由日期经过变换后得到。变换方式:(1)给整个系统设置一个基准日期 基准日期:一段时期的起始日期,通常规定为一个月的1号,考勤所记录的是基准日期之后的考勤信息.(2)考勤记录的日期与基准日期相差的天数加1。由以上变换可得:基准日期的考勤的文件名为“1.txt”。2.2.3.存储考勤一段时期的统计信息的文件:文件名:管理员自己输入。文件容:起始日期 终止日期ID迟到次数早退次数.例如:2010412010630ID迟到次数早退次数11三1212四20各文件之间的关系:考勤文件是按照当天的员工信息文件的顺序依次记录。在此把请假等排除在外不考虑。2.3代码设计设计代码主要包括:voidinput_employee() /第一次输入员工信息voidread_file()/专门用于读取存储员工信息的文件的函数void write_file()/专门用于向存储员工信息的文件中写函数void output_employee() /输出员工信息void insert_employee(struct employee new_person) /添加员工信息voiddelete_employee(int id)/删除员工信息void management_employee() /管理员工信息总函数int computer(struct data someday)/计算日期对应的文件名void recorder()/记录每天每个员工的考勤情况void statistic()/统计所有员工某段时间的考勤情况,把统计结果输入文件中void single_quire()/查询某一天的考勤情况void multi_quire()/查询一段连续时间的考勤情况void quire_attendance()/查询的总函数void management_attendance()/考勤管理的总函数2.4 程序代码#include stdafx.h#include#include#include#include process.h#include #define MAX_COUNT 30 /最大员工数struct employee /员工信息结构体 int id; char name20; char department20;struct date /日期结构体 int year; int month; int day;struct attendance /考勤结构体 int id; int late; int early; char name20; struct date dat;struct statistic /统计表结构体 int id; int late_count; int early_count; char name20;int COUNT=0; /记录员工的人数int FLAG_pause=1; /涉与插入,输出函数的联合操作时某些位置是否调用system(“pause”)struct employee personMAX_COUNT;struct date BASE_DATA=2012,1,1; /基准日期void input_employee() /第一次输入员工信息,相当于初始化 system(cls); FILE *fp1,*fp2; struct employee temp; fp1=fopen(information1.txt,w); fp2=fopen(information2.txt,w); printf(tttt 员工信息n); printf(nttttIDtt部门ntttt); fprintf(fp1,tttt 输入员工信息n); fprintf(fp1,nttttIDtt部门n); scanf(%d%s%s,&temp.id,temp.name,temp.department); while(temp.id!=0) personCOUNT=temp; printf(%d,temp.id); COUNT+; fprintf(fp1,tttt%dt%st%sn,temp.id,temp.name,temp.department); fprintf(fp2,%dt%st%sn,temp.id,temp.name,temp.department); printf(tttt); scanf(%d%s%s,&temp.id,temp.name,temp.department); fclose(fp1); fclose(fp2);void read_file() /专门用于读存储员工信息的文件的函数 FILE *fp; COUNT=0; if(fp=fopen(information2.txt,r)=NULL) printf(cant not open filen); exit(1); while(!feof(fp) fscanf(fp,%d%s%s,&personCOUNT.id,personCOUNT.name,personCOUNT.department); COUNT+; COUNT-; fclose(fp);/专门用于向存储员工信息的文件中写函数void write_file() int i; FILE *fp1,*fp2; fp1=fopen(information1.txt,w+);fp2=fopen(information2.txt,w+); if(fp1=NULL | fp2=NULL) printf(cant not open filen); exit(1); fprintf(fp1,tttt 输入员工信息n);printf(nttttIDtt部门n); for(i=0;iCOUNT;i+) fprintf(fp1,tttt%dt%st%sn,personi.id,personi.name,personi.department); fprintf(fp2,%dt%st%sn,personi.id,personi.name,personi.department); fclose(fp1); fclose(fp2);/输出员工信息void output_employee() int i; int id; int choice; char temp20; system(cls); read_file(); /读员工信息文件 printf(nttttt输出员工信息n); printf(nt1.输出全体员工信息t); printf(2.按输出员工信息t); printf(3.按ID输出员工信息t); printf(4.按部门员工信息t); printf(5.返回主菜单n); printf(nt请选择(15):t); start: scanf(%d,&choice); if(choice5) printf(t输入错误,请重输:t); goto start; switch(choice) case(1): printf(tttIDtt部门n); for(i=0;
收藏 下载该资源
网站客服QQ:2055934822
金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号