private double TinhCongPhep(dsTinhLuong.tbDangKyVangMatRow i) { if (i["denGio"] == DBNull.Value) { i["denGio"] = new TimeSpan(); } if (i["tuGio"] == DBNull.Value) { i["tuGio"] = new TimeSpan(); } TimeSpan denGio = new TimeSpan(); if (i.denGio < i.tuGio) { denGio = i.denGio.Add(new TimeSpan(24, 0, 0)); } else { denGio = i.denGio; } double soTieng = (denGio - i.tuGio).TotalHours; if (soTieng < 0) { soTieng = 0; } if (soTieng > i.soTiengTinhCa) { soTieng = i.soTiengTinhCa; } return(Math.Round(soTieng / i.soTiengTinhCa, 2)); }
private double TinhNgayCongPhep(dsTinhLuong.tbDangKyVangMatRow i) { double h = (i.denGio - i.tuGio).TotalHours; if (h > i.soTiengTinhCa) return 1; return h / i.soTiengTinhCa; }
private double TinhNgayCongPhep(dsTinhLuong.tbDangKyVangMatRow i) { double h = 0; if (i.denGio < i.tuGio) { h = (i.denGio.Add(new TimeSpan(24, 0, 0)) - i.tuGio).TotalHours; } else { h = (i.denGio - i.tuGio).TotalHours; } if (h > i.soTiengTinhCa) { return(1); } return(h / i.soTiengTinhCa); }