diff --git a/HRM.DA/Service/Bonus/ProdBonusProcessService.cs b/HRM.DA/Service/Bonus/ProdBonusProcessService.cs index c96cd16..b379462 100644 --- a/HRM.DA/Service/Bonus/ProdBonusProcessService.cs +++ b/HRM.DA/Service/Bonus/ProdBonusProcessService.cs @@ -662,7 +662,8 @@ namespace HRM.DA foreach (ProductionBonusSetup oProductionBonusSetup in _oProductionBonusSetups) { - + //if (oProductionBonusSetup.ID != 12583) + //{ continue; } prodAttn = prodAttns.Where(x => x.ProdBonusSetupID == oProductionBonusSetup.ID).ToList();//ToObjectsTemplate(); ProdBonusProcessItem oProcessItem = null; foreach (ProdBonusLine oLine in oProductionBonusSetup.ProductionBonusLinesNew) @@ -689,7 +690,8 @@ namespace HRM.DA } } - + //if (item.Key == 2991) + //{ } bool isSuperVisor = allProdBonusSupervisors.FindIndex(x => x.EmployeeID == item.Key && x.ProdBonusLineID == oLine.ID) == -1 ? false : true; diff --git a/HRM.Report/Class/rptBonus.cs b/HRM.Report/Class/rptBonus.cs index a2c2272..fdfea6b 100644 --- a/HRM.Report/Class/rptBonus.cs +++ b/HRM.Report/Class/rptBonus.cs @@ -334,7 +334,8 @@ namespace HRM.Report List oShifts = new ShiftService().GetAllShift(); Shift oShift = null; - + DateTime? bonusIntime = DateTime.MinValue; + DateTime? bonusOuttime = DateTime.MinValue; List prodAttn = new ProdBonusAttnService().GetBySetupID(designId); string empIds = string.Empty; empIds = prodAttn.Select(x => x.EmployeeID).Distinct().Aggregate(new StringBuilder(), (sb, empid) => sb.Append(empid + ","), sb => sb.ToString().Trim(',')); @@ -362,6 +363,7 @@ namespace HRM.Report double hour = 0; foreach (ProdBonusAttn tAtt in tempAttn) { + DailyAttnProcess dailyAtt = oDailyAttnProsess.FirstOrDefault(o => o.AttnDate.Date == tAtt.InTime.Date && o.EmployeeID == item.ID && (o.AttenType == EnumAttendanceType.Present || @@ -370,20 +372,36 @@ namespace HRM.Report o.AttenType == EnumAttendanceType.Early || o.AttenType == EnumAttendanceType.Late || o.AttenType == EnumAttendanceType.OutSideDuty)); + double wh = 0; if (dailyAtt != null) { + if (dailyAtt.OutTime != DateTime.MinValue && dailyAtt.InTime != DateTime.MinValue) { + bonusIntime = dailyAtt.InTime; + bonusOuttime = dailyAtt.OutTime; oShift = oShifts.FirstOrDefault(x => x.ID == dailyAtt.ShiftID); - if (design.FromDate.Date == dailyAtt.AttnDate.Date) - dailyAtt.InTime = design.FromDate > dailyAtt.InTime ? design.FromDate : dailyAtt.InTime; - else if (design.ToDate.Date == dailyAtt.AttnDate.Date) - dailyAtt.OutTime = design.ToDate < dailyAtt.OutTime ? design.ToDate : dailyAtt.OutTime; - else if (oShift != null && dailyAtt.InTime.Value.TimeOfDay < oShift.InTime.TimeOfDay) - dailyAtt.InTime = dailyAtt.InTime.Value.Date.AddHours(oShift.InTime.Hour).AddMinutes(oShift.InTime.Minute); + //if (design.FromDate.Date == dailyAtt.AttnDate.Date) + // dailyAtt.InTime = design.FromDate > dailyAtt.InTime ? design.FromDate : dailyAtt.InTime; + //else if (design.ToDate.Date == dailyAtt.AttnDate.Date) + // dailyAtt.OutTime = design.ToDate < dailyAtt.OutTime ? design.ToDate : dailyAtt.OutTime; + //else if (oShift != null && dailyAtt.InTime.Value.TimeOfDay < oShift.InTime.TimeOfDay) + // dailyAtt.InTime = dailyAtt.InTime.Value.Date.AddHours(oShift.InTime.Hour).AddMinutes(oShift.InTime.Minute); - TimeSpan ts = dailyAtt.OutTime.Value - dailyAtt.InTime.Value; + if (design.FromDate.Date == dailyAtt.AttnDate.Date) + bonusIntime = design.FromDate > dailyAtt.InTime ? design.FromDate : dailyAtt.InTime; + else if (dailyAtt.InTime.GetValueOrDefault().TimeOfDay < tAtt.InTime.TimeOfDay) + bonusIntime = dailyAtt.InTime.GetValueOrDefault().Date.AddHours(tAtt.InTime.Hour).AddMinutes(tAtt.InTime.Minute); + if (design.ToDate.Date == dailyAtt.AttnDate.Date) + bonusOuttime = design.ToDate < dailyAtt.OutTime ? design.ToDate : dailyAtt.OutTime; + else if (dailyAtt.OutTime.GetValueOrDefault().TimeOfDay > tAtt.OutTime.TimeOfDay) + bonusOuttime = dailyAtt.OutTime.GetValueOrDefault().Date.AddHours(tAtt.OutTime.Hour).AddMinutes(tAtt.OutTime.Minute); + //else if (oShift != null && dailyAtt.InTime.GetValueOrDefault().TimeOfDay < oShift.InTime.TimeOfDay) + // bonusIntime = dailyAtt.InTime.GetValueOrDefault().Date.AddHours(oShift.InTime.Hour).AddMinutes(oShift.InTime.Minute); + + //TimeSpan ts = dailyAtt.OutTime.Value - dailyAtt.InTime.Value; + TimeSpan ts = (TimeSpan)(bonusOuttime - bonusIntime); if (ts.Minutes < 16 && ts.Hours < 5) wh = ts.Hours; else if (ts.Minutes < 16) diff --git a/HRM.Report/RDLC/rptProdBonusAttendance.rdlc b/HRM.Report/RDLC/rptProdBonusAttendance.rdlc index 07b70f7..4198f07 100644 --- a/HRM.Report/RDLC/rptProdBonusAttendance.rdlc +++ b/HRM.Report/RDLC/rptProdBonusAttendance.rdlc @@ -208,9 +208,10 @@ - =Sum(Fields!WorkingHour.Value) + =Sum(CDBL(Fields!WorkingHour.Value))