e.New(1);
e.RenameWorksheet((size_t)0, L\职工考勤\
BasicExcelWorksheet* sheet = e.GetWorksheet(L\职工考勤\sheet->Cell(0,0)->SetWString(\日期\sheet->Cell(0,1)->SetWString(\星期\sheet->Cell(0,2)->SetWString(\姓名\sheet->Cell(0,3)->SetWString(\部门\sheet->Cell(0,4)->SetWString(\上班\sheet->Cell(0,5)->SetWString(\下班\CListCtrl *hlist=&_lists;
int rows=hlist->GetItemCount();
int lows=hlist->GetHeaderCtrl()->GetItemCount(); int i,j;
COleDateTime odt; for(i=1;i<=rows;i++) { for(j=0;jCell(i,j)->SetWString(hlist->GetItemText(i-1,j)); } } i=i+2; int m,n;
m=_latearray.GetSize();
sheet->Cell(i,0)->SetWString(\迟到\i++;
for(n=0,j=0;nCell(i,j++)->SetWString(_latearray.GetAt(n).GetDate()); sheet->Cell(i,j++)->SetWString(_latearray.GetAt(n).GetWeek()); sheet->Cell(i,j++)->SetWString(_latearray.GetAt(n).GetName()); sheet->Cell(i,j++)->SetWString(_latearray.GetAt(n).GetDepartment()); } i=i+2;
m=_leaveearlyarray.GetSize();
sheet->Cell(i,0)->SetWString(\早退\i++;
for(n=0,j=0;nCell(i,j++)->SetWString(_leaveearlyarray.GetAt(n).GetDate()); sheet->Cell(i,j++)->SetWString(_leaveearlyarray.GetAt(n).GetWeek()); sheet->Cell(i,j++)->SetWString(_leaveearlyarray.GetAt(n).GetName()); sheet->Cell(i,j++)->SetWString(_leaveearlyarray.GetAt(n).GetDepartment()); }
25
i=i+2; m=_absentarray.GetSize(); sheet->Cell(i,0)->SetWString(\缺勤\ i++; for(n=0,j=0;nCell(i,j++)->SetWString(_absentarray.GetAt(n).GetDate()); sheet->Cell(i,j++)->SetWString(_absentarray.GetAt(n).GetWeek()); sheet->Cell(i,j++)->SetWString(_absentarray.GetAt(n).GetName()); sheet->Cell(i,j++)->SetWString(_absentarray.GetAt(n).GetDepartment()); } i=i+2; m=_employstatinfoarray.GetSize(); sheet->Cell(i,0)->SetWString(\单个职工统计\ i++; j=0; sheet->Cell(i,j++)->SetWString(\姓名\ sheet->Cell(i,j++)->SetWString(\专业\ sheet->Cell(i,j++)->SetWString(\早退次数\ sheet->Cell(i,j++)->SetWString(\迟到次数\ sheet->Cell(i,j++)->SetWString(\缺勤次数\ sheet->Cell(i,j++)->SetWString(\未刷卡次数\ i++; for(n=0,j=0;nCell(i,j++)->SetWString(_employstatinfoarray.GetAt(n).m_name); sheet->Cell(i,j++)->SetWString(_employstatinfoarray.GetAt(n).m_department); sheet->Cell(i,j++)->Set(_employstatinfoarray.GetAt(n).m_leave.GetCount()); sheet->Cell(i,j++)->Set(_employstatinfoarray.GetAt(n).m_late.GetCount()); sheet->Cell(i,j++)->Set(_employstatinfoarray.GetAt(n).m_absent.GetCount()); sheet->Cell(i,j++)->Set(_employstatinfoarray.GetAt(n).m_norecord.GetCount()); } if(e.SaveAs(\ AfxMessageBox(TEXT(\成功导出为Excel - example.xls\MB_ICONINFORMATION, 0); else AfxMessageBox(TEXT(\导出失败\}
#undef ATTENDANCE_LIST_DATETIME_IDX #undef ATTENDANCE_LIST_WEEK_IDX #undef ATTENDANCE_LIST_NAME_IDX #undef ATTENDANCE_LIST_DEPARTMENT_IDX #undef ATTENDANCE_LIST_SWORDTIME_IDX #undef ATTENDANCE_LIST_EWORKTIME_IDX
26
void CAttendance::OnLvnItemchangedListAttendancd(NMHDR *pNMHDR, LRESULT *pResult) { LPNMLISTVIEW pNMLV = reinterpret_cast(pNMHDR); // TODO: 在此添加控件通知处理程序代码 *pResult = 0; } void CAttendance::OnDtnDatetimechangeDatetimepickerDateend(NMHDR *pNMHDR, LRESULT *pResult) { LPNMDATETIMECHANGE pDTChange = reinterpret_cast(pNMHDR); // TODO: 在此添加控件通知处理程序代码 *pResult = 0;
}
4.4系统运行结果
以下为该职工考勤系统运行的结果:
图15 用户运行界面 图16 学院运行界面
27
图17 专业运行界面 图18 职工运行界面
图19 考勤运行界面 图20 读卡运行界面
图21 导出的Excel表
28