//線長點名可看的明細 public ActionResult xzdetail(string id) { List <xzdetail> list_xzdetail = new List <xzdetail>(); //查詢今日出勤明細 if (id == null) { id = "0"; } DateTime now = DateTime.Now.AddDays(int.Parse(id)); string today = now.Date.ToShortDateString(); DateTime start = Convert.ToDateTime(today.Trim() + " " + "00:00:00"); DateTime end = Convert.ToDateTime(today.Trim() + " " + "23:59:59"); //搜索 if (Request.Form["RData"] != null && Request.Form["RData"].ToString().Length == 8) { if (common.IsDate(Request.Form["RData"].ToString())) { string RData = Request.Form["RData"]; now = DateTime.ParseExact(RData, "yyyyMMdd", System.Globalization.CultureInfo.CurrentCulture); today = now.Date.ToShortDateString(); start = Convert.ToDateTime(today.Trim() + " " + "00:00:00"); end = Convert.ToDateTime(today.Trim() + " " + "23:59:59"); } ; } var temp = attendanceService.DbSession.AttendanceDal.GetEntity(u => u.BU == UserBU && u.LINENAME == UserLINENAME && u.CLASS == UserCLASS && u.date1 > start && u.date1 < end); foreach (Attendance ad in temp) { xzdetail dt = new xzdetail(); dt.ID = ad.ID; dt.NAME = ad.NAME; if (ad.state1 == "到") { dt.cq = true; } else { dt.cq = false; } if (ad.reason1 == "遲到") { dt.cd = true; } else { dt.cd = false; } if (ad.reason1 == "請假") { dt.qj = true; } else { dt.qj = false; } if (ad.reason1 == "曠工") { dt.kg = true; } else { dt.kg = false; } if (ad.state2 == "中途上班") { dt.zsb = true; } else { dt.zsb = false; } if (ad.reason2 == "早退") { dt.zzt = true; } else { dt.zzt = false; } if (ad.reason2 == "請假") { dt.zqj = true; } else { dt.zqj = false; } if (ad.reason2 == "曠工") { dt.zkg = true; } else { dt.zkg = false; } if (ad.time1 != null) { dt.time1 = double.Parse(ad.time1.ToString()); } list_xzdetail.Add(dt); } ViewData["list_xzdetail"] = list_xzdetail; ViewData["date_int"] = id; ViewData["Date"] = now.ToString("yyyy/MM/dd"); return(View()); }
//線長明細 public ActionResult xzdetail2(string id) { List <xzdetail> list_xzdetail = new List <xzdetail>(); if (id == null) { id = "0"; } string[] uid = id.Split(','); string UserBU1 = ""; string UserLINENAME1 = ""; string UserCLASS1 = ""; if (id == null) { id = "0"; } if (uid.Count() == 4) { UserBU1 = uid[0]; UserLINENAME1 = uid[1]; UserCLASS1 = uid[2] == "b"?"白班":"晚班"; id = uid[3]; } int lineID = int.Parse(UserLINENAME1); UserLINENAME1 = attendanceService.DbSession.LienNumberDal.FirstOrDefault(u => u.id == lineID).linename; //查詢今日出勤明細 DateTime now = DateTime.Now.AddDays(int.Parse(id)); string today = now.Date.ToShortDateString(); DateTime start = Convert.ToDateTime(today.Trim() + " " + "00:00:00"); DateTime end = Convert.ToDateTime(today.Trim() + " " + "23:59:59"); //搜索 if (Request.Form["RData"] != null && Request.Form["RData"].ToString().Length == 8) { if (common.IsDate(Request.Form["RData"].ToString())) { string RData = Request.Form["RData"]; now = DateTime.ParseExact(RData, "yyyyMMdd", System.Globalization.CultureInfo.CurrentCulture); today = now.Date.ToShortDateString(); start = Convert.ToDateTime(today.Trim() + " " + "00:00:00"); end = Convert.ToDateTime(today.Trim() + " " + "23:59:59"); id = (now - DateTime.Now).Days.ToString(); } ; } var temp = attendanceService.DbSession.AttendanceDal.GetEntity(u => u.BU == UserBU1 && u.LINENAME == UserLINENAME1 && u.CLASS == UserCLASS1 && u.date1 > start && u.date1 < end); foreach (Attendance ad in temp) { xzdetail dt = new xzdetail(); dt.ID = ad.ID; dt.NAME = ad.NAME; if (ad.state1 == "到") { dt.cq = true; } else { dt.cq = false; } if (ad.reason1 == "遲到") { dt.cd = true; } else { dt.cd = false; } if (ad.reason1 == "請假") { dt.qj = true; } else { dt.qj = false; } if (ad.reason1 == "曠工") { dt.kg = true; } else { dt.kg = false; } if (ad.state2 == "中途上班") { dt.zsb = true; } else { dt.zsb = false; } if (ad.reason2 == "早退") { dt.zzt = true; } else { dt.zzt = false; } if (ad.reason2 == "請假") { dt.zqj = true; } else { dt.zqj = false; } if (ad.reason2 == "曠工") { dt.zkg = true; } else { dt.zkg = false; } if (ad.time1 != null) { dt.time1 = double.Parse(ad.time1.ToString()); } list_xzdetail.Add(dt); } ViewData["list_xzdetail"] = list_xzdetail; ViewData["date_int"] = id; ViewData["Date"] = now.ToString("yyyy/MM/dd"); ViewData["UserBU1"] = UserBU1; ViewData["UserLINENAME1"] = UserLINENAME1; ViewData["UserCLASS1"] = UserCLASS1; return(View()); }