public decimal CalculateAttendanceForMonth(Group group, DateTime startDate, DateTime endDate) { var endOfMonth = new DateTime(startDate.Year, startDate.Month, DateTime.DaysInMonth(startDate.Year, startDate.Month)); // If filtered date is before end of month use that instead of end of month endDate = endDate < endOfMonth ? endDate : endOfMonth; _headcountTotal = HeadCountHelper.GetHeadCountForGroup(group.Guid, startDate, endDate) ?? 0.0m; return(_headcountTotal); }
public static QuarterInformation GetQuarteredStatistics(Group @group, DateTime startDateTime, DateTime?endDateTime, Dictionary <int, Quarter> quarters) { decimal q1 = quarters[1].StartDateTime == null ? 0.0m : HeadCountHelper.GetHeadCountForGroup(@group.Guid, quarters[1].StartDateTime.Value, quarters[1].EndDateTime.Value) ?? 0.0m; decimal q2 = quarters[2].StartDateTime == null ? 0.0m : HeadCountHelper.GetHeadCountForGroup(@group.Guid, quarters[2].StartDateTime.Value, quarters[2].EndDateTime.Value) ?? 0.0m; decimal q3 = quarters[3].StartDateTime == null ? 0.0m : HeadCountHelper.GetHeadCountForGroup(@group.Guid, quarters[3].StartDateTime.Value, quarters[3].EndDateTime.Value) ?? 0.0m; decimal q4 = quarters[4].StartDateTime == null ? 0.0m : HeadCountHelper.GetHeadCountForGroup(@group.Guid, quarters[4].StartDateTime.Value, quarters[4].EndDateTime.Value) ?? 0.0m; decimal total = q1 + q2 + q3 + q4; decimal average = total / (endDateTime.Value.Month - startDateTime.Month + 1); var quarterResults = new QuarterInformation(total, q1, q2, q3, q4, average); return(quarterResults); }
public decimal CalculateYearToDate(DateTime startDate, DateTime endDate, Group group) { _headcountTotalToDate = HeadCountHelper.GetHeadCountForGroup(group.Guid, startDate, endDate) ?? 0.0m; return(_headcountTotalToDate); }