public static void TaoTableXacNhanCa(List <cUserInfo> dsnv, DataRow[] arrRecs, DataTable table) { table.Rows.Clear(); foreach (var dataRow in arrRecs) { var nv = (cUserInfo)dataRow["cUserInfo"]; var ngay = (DateTime)dataRow["TimeStrNgay"]; var ngayCong = nv.DSNgayCong.Find(item => item.Ngay == ngay); foreach (var CIO in ngayCong.DSVaoRa) { if (CIO.HaveINOUT < 0) { continue; } var row = table.NewRow(); row["UserEnrollNumber"] = nv.MaCC; //0 row["UserFullCode"] = nv.MaNV; //1 row["UserFullName"] = nv.TenNV; //1 row["TimeStrNgay"] = ngay; //2 row["TimeStrVao"] = CIO.Vao.Time; //4 row["TimeStrRaa"] = CIO.Raa.Time; //5 row["ShiftCode"] = CIO.CIOCodeFull(); row["ShiftID"] = CIO.ThuocCa.ID; //9 row["Cong"] = CIO.Cong; //20 row["TongGioLam"] = CIO.TG.GioLamViec5; //Danglam giophut row["TongGioThuc"] = CIO.TG.GioThucTe5; //Danglam giophut row["cUserInfo"] = nv; row["cNgayCong"] = ngayCong; row["cCheckInOut"] = CIO; row["IsEdited"] = false; //CIO.IsEdited; table.Rows.Add(row); } } }
private void loadRow(cUserInfo nhanvien_goc, DateTime ngayCong) { var cNgayCong = nhanvien_goc.DSNgayCong.FirstOrDefault(item => item.Ngay == ngayCong); if (cNgayCong == null || cNgayCong.HasCheck == false) { return; } foreach (var CIO in cNgayCong.DSVaoRa) { var row = m_Bang_ChiTiet.NewRow(); row["UserEnrollNumber"] = nhanvien_goc.MaCC; row["UserFullName"] = nhanvien_goc.TenNV; row["UserFullCode"] = nhanvien_goc.MaNV; row["TimeStrNgay"] = cNgayCong.Ngay; row["TimeStrVao"] = (CIO.Vao != null) ? CIO.Vao.Time : (object)DBNull.Value; row["TimeStrRaa"] = (CIO.Raa != null) ? CIO.Raa.Time : (object)DBNull.Value; row["ShiftCode"] = CIO.CIOCodeFull(); row["cUserInfo"] = nhanvien_goc; row["cChkInOut"] = CIO; row["cNgayCong"] = cNgayCong; row["IsEdited"] = CIO.IsEdited; m_Bang_ChiTiet.Rows.Add(row); } }
public static void TaoTableXacNhanLamThem(List <cUserInfo> dsnv, DataTable table) { /*( ngaycong.TG.GioLamViec > XL2._08gio || ngaycong.DSVaoRa.Exists(item => item.HaveINOUT==0 || && item.DaXN == false || && item.TG.OLai > TimeSpan.Zero))*/ table.Rows.Clear(); foreach (var nv in dsnv) { var min = 2; var max = nv.DSNgayCong.Count - 3; List <cNgayCong> list3 = nv.DSNgayCong .Where(item => item.TG.GioLamViec > XL2._08gio || item.DSVaoRa.Exists(subitem => subitem.HaveINOUT == 0 && subitem.DaXN == false && subitem.TG.OLai > TimeSpan.Zero)) .TakeWhile((item1, i) => (i >= min || i <= max)).ToList(); foreach (var ngayCong in list3) { foreach (var CIO in ngayCong.DSVaoRa) { if (CIO.HaveINOUT < 0) { continue; } var row = table.NewRow(); row["UserEnrollNumber"] = nv.MaCC; //0 row["UserFullCode"] = nv.MaNV; //1 row["UserFullName"] = nv.TenNV; //1 row["TimeStrNgay"] = ngayCong.Ngay; //2 row["TimeStrVao"] = CIO.Vao.Time; //4 row["TimeStrRaa"] = CIO.Raa.Time; //5 row["ShiftCode"] = CIO.CIOCodeFull(); row["ShiftID"] = CIO.ThuocCa.ID; //9 row["Cong"] = CIO.Cong; //20 row["TongGioLam"] = CIO.TG.GioLamViec; //Danglam giophut row["TongGioThuc"] = CIO.TG.GioThuc; //Danglam giophut row["DuyetCPVaoTre"] = CIO.DuyetChoPhepVaoTre; //ver 4.0.0.8 row["DuyetCPRaSom"] = CIO.DuyetChoPhepRaSom; //ver 4.0.0.8 row["VaoTreTuDo"] = CIO.VaoTreTinhCV; //ver 4.0.0.8 row["RaSomTuDo"] = CIO.RaaSomTinhCV; //ver 4.0.0.8 row["ChoBuGioTre"] = CIO.ChoBuGioTre; //ver 4.0.0.8 row["ChoBuGioSom"] = CIO.ChoBuGioSom; //ver 4.0.0.8 row["ChoBuPhepTre"] = CIO.ChoBuPhepTre; //ver 4.0.0.8 row["TGBuPhepTre"] = XacDinhTGBuPhep(CIO.BuCongPhepTreCongDon); //ver 4.0.0.8 row["ChoBuPhepSom"] = CIO.ChoBuPhepSom; //ver 4.0.0.8 row["TGBuPhepSom"] = XacDinhTGBuPhep(CIO.BuCongPhepSomCongDon); //ver 4.0.0.8 row["cUserInfo"] = nv; row["cNgayCong"] = ngayCong; row["cCheckInOut"] = CIO; table.Rows.Add(row); } } } }
public static void TaoTableXacNhanCa(List <cUserInfo> dsnv, DataRow[] arrRecs, DataTable table) { table.Rows.Clear(); foreach (var dataRow in arrRecs) { var nv = (cUserInfo)dataRow["cUserInfo"]; var ngay = (DateTime)dataRow["TimeStrNgay"]; var ngayCong = nv.DSNgayCong.Find(item => item.Ngay == ngay); foreach (var CIO in ngayCong.DSVaoRa) { if (CIO.HaveINOUT < 0) { continue; } var row = table.NewRow(); row["UserEnrollNumber"] = nv.MaCC; //0 row["UserFullCode"] = nv.MaNV; //1 row["UserFullName"] = nv.TenNV; //1 row["TimeStrNgay"] = ngay; //2 row["TimeStrVao"] = CIO.Vao.Time; //4 row["TimeStrRaa"] = CIO.Raa.Time; //5 row["ShiftCode"] = CIO.CIOCodeFull(); row["ShiftID"] = CIO.ThuocCa.ID; //9 row["Cong"] = CIO.Cong; //20 row["TongGioLam"] = CIO.TG.GioLamViec; //Danglam giophut row["TongGioThuc"] = CIO.TG.GioThuc; //Danglam giophut row["DuyetCPVaoTre"] = CIO.DuyetChoPhepVaoTre; //ver 4.0.0.8 row["DuyetCPRaSom"] = CIO.DuyetChoPhepRaSom; //ver 4.0.0.8 row["VaoTreTuDo"] = CIO.VaoTreTinhCV; //ver 4.0.0.8 row["RaSomTuDo"] = CIO.RaaSomTinhCV; //ver 4.0.0.8 row["ChoBuGioTre"] = CIO.ChoBuGioTre; //ver 4.0.0.8 row["ChoBuGioSom"] = CIO.ChoBuGioSom; //ver 4.0.0.8 row["ChoBuPhepTre"] = CIO.ChoBuPhepTre; //ver 4.0.0.8 row["TGBuPhepTre"] = XacDinhTGBuPhep(CIO.BuCongPhepTreCongDon); //ver 4.0.0.8 row["ChoBuPhepSom"] = CIO.ChoBuPhepSom; //ver 4.0.0.8 row["TGBuPhepSom"] = XacDinhTGBuPhep(CIO.BuCongPhepSomCongDon); //ver 4.0.0.8 row["cUserInfo"] = nv; row["cNgayCong"] = ngayCong; row["cCheckInOut"] = CIO; table.Rows.Add(row); } } }
private void loadRow(cUserInfo nhanvien_goc, cNgayCong ngayCong) { if (ngayCong == null || ngayCong.DSVaoRa.Count == 0) { return; } foreach (var CIO in ngayCong.DSVaoRa) { var row = m_Bang_ChiTiet.NewRow(); row["UserEnrollNumber"] = nhanvien_goc.MaCC; row["UserFullName"] = nhanvien_goc.TenNV; row["UserFullCode"] = nhanvien_goc.MaNV; row["TimeStrNgay"] = ngayCong.Ngay; row["TimeStrVao"] = (CIO.Vao != null) ? CIO.Vao.Time : (object)DBNull.Value; row["TimeStrRaa"] = (CIO.Raa != null) ? CIO.Raa.Time : (object)DBNull.Value; row["ShiftCode"] = CIO.CIOCodeFull(); row["cUserInfo"] = nhanvien_goc; row["cCheckInOut"] = CIO; row["cNgayCong"] = ngayCong; m_Bang_ChiTiet.Rows.Add(row); } }
private void loadRow(cNgayCong ngayCong, bool isEnableEdit) { if (ngayCong.DSVaoRa.Count == 0) { var row1 = m_Bang_ChiTiet.NewRow(); var row2 = m_Bang_ChiTiet.NewRow(); row1["cNgayCong"] = row2["cNgayCong"] = ngayCong; row1["cUserInfo"] = row2["cUserInfo"] = nhanvien_goc; row1["TimeStrThu"] = row1["TimeStrNgay"] = ngayCong.Ngay.Date; row2["TimeStrThu"] = row2["TimeStrNgay"] = ngayCong.Ngay.Date; row1["Loai"] = "Vào"; row2["Loai"] = "Ra"; row1["IsEdited"] = (ngayCong.IsEdited > 0); row2["IsEdited"] = (ngayCong.IsEdited > 0); row1["IsEnableEdit"] = isEnableEdit; row2["IsEnableEdit"] = isEnableEdit; m_Bang_ChiTiet.Rows.Add(row1); m_Bang_ChiTiet.Rows.Add(row2); return; } foreach (var CIO in ngayCong.DSVaoRa) { var row1 = m_Bang_ChiTiet.NewRow(); var row2 = m_Bang_ChiTiet.NewRow(); row1["Loai"] = "Vào"; row2["Loai"] = "Ra"; row1["cNgayCong"] = row2["cNgayCong"] = ngayCong; row1["cUserInfo"] = row2["cUserInfo"] = nhanvien_goc; row1["TimeStrThu"] = row1["TimeStrNgay"] = ngayCong.Ngay.Date; row2["TimeStrThu"] = row2["TimeStrNgay"] = ngayCong.Ngay.Date; var temp = CIO.CIOCodeFull(); if (CIO.HaveINOUT == -1) { row1["cChk"] = CIO.Vao; row1["TimeStr"] = CIO.Vao.Time; row1["MachineNo"] = CIO.Vao.MachineNo; row1["Source"] = CIO.Vao.Source; row1["ShiftCode"] = temp; } else if (CIO.HaveINOUT == -2) { row2["cChk"] = CIO.Raa; row2["TimeStr"] = CIO.Raa.Time; row2["MachineNo"] = CIO.Raa.MachineNo; row2["Source"] = CIO.Raa.Source; row2["ShiftCode"] = temp; } else { row1["cChk"] = CIO.Vao; row2["cChk"] = CIO.Raa; row1["TimeStr"] = CIO.Vao.Time; row2["TimeStr"] = CIO.Raa.Time; row1["MachineNo"] = CIO.Vao.MachineNo; row2["MachineNo"] = CIO.Raa.MachineNo; row1["Source"] = CIO.Vao.Source; row2["Source"] = CIO.Raa.Source; row1["ShiftCode"] = row2["ShiftCode"] = temp; } row1["IsEdited"] = (CIO.IsEdited > 0); row2["IsEdited"] = (CIO.IsEdited > 0); row1["IsEnableEdit"] = isEnableEdit; row2["IsEnableEdit"] = isEnableEdit; m_Bang_ChiTiet.Rows.Add(row1); m_Bang_ChiTiet.Rows.Add(row2); } }
public string CIOs_CodeFull(string chuoiTruoc = null) { var kq = DSVaoRa.Aggregate(string.Empty, (current, CIO) => current + ((current == string.Empty) ? CIO.CIOCodeFull() : "; " + CIO.CIOCodeFull())); kq = (chuoiTruoc == null) ? kq : chuoiTruoc + "; " + kq; return(kq); }