private void CalculateWeeklyMessageOrSaldoWorkingModels(EmployeeWeek planningweek) { if (planningweek.IsValidWeek) { EmployeeDay epday = planningweek.GetDay(planningweek.EndDate); EmployeeWorkingModel entity = null; foreach (WorkingModelWrapperNew wrap in _weeklyMessagesModels) { if (!planningweek.PlannedWeek) { if (!wrap.Model.UseInRecording) { continue; } } if (!DateTimeHelper.IsIntersectInc(wrap.Model.BeginTime, wrap.Model.EndTime, planningweek.BeginDate, planningweek.EndDate)) { continue; } if (wrap.Validate(planningweek, planningweek.BeginDate)) { if (wrap.IsMessageModel) { entity = new EmployeeWorkingModel(); entity.EmployeeID = epday.EmployeeId; entity.Date = epday.Date; entity.WorkingModelID = wrap.Model.ID; if (epday.WorkingModels == null) { epday.WorkingModels = new List <EmployeeWorkingModel>(); } epday.WorkingModels.Add(entity); } } } } }
private void CalculateWeeklyWorkingModels(EmployeeWeek planningweek) { Debug.Assert(planningweek != null); if (planningweek.IsValidWeek) { EmployeeDay epday = planningweek.GetDay(planningweek.EndDate); EmployeeWorkingModel entity = null; foreach (WorkingModelWrapperNew wrap in _weeklyModels) { if (!planningweek.PlannedWeek) { if (!wrap.Model.UseInRecording) { continue; } } if (!DateTimeHelper.IsIntersectInc(wrap.Model.BeginTime, wrap.Model.EndTime, planningweek.BeginDate, planningweek.EndDate)) { continue; } if (wrap.Validate(planningweek, planningweek.BeginDate)) { entity = new EmployeeWorkingModel(); entity.EmployeeID = epday.EmployeeId; entity.Date = epday.Date; entity.WorkingModelID = wrap.Model.ID; if (!wrap.IsMessageModel) { entity.Hours = wrap.GetModelValue; entity.AdditionalCharge = wrap.Model.AddCharges; if (wrap.Model.AddCharges) { epday.CountDailyAdditionalCharges += entity.Hours; } else { epday.CountDailyPlannedWorkingHours += entity.Hours; } } //if (!wrap.IsMessageModel) //{ // int result = 0; // if (wrap.Model.AddValue != 0) // { // result += DateTimeHelper.RoundToQuoter((short)(60 * wrap.Model.AddValue)); // } // if (wrap.Model.MultiplyValue != 0) // { // result += DateTimeHelper.RoundToQuoter((short)(wrap.Hours * wrap.Model.MultiplyValue - wrap.Hours)); // } // if (wrap.Model.AddCharges) // { // entity.AdditionalCharge = true; // entity.Hours = result; // epday.CountDailyAdditionalCharges += result; // } // else // { // entity.AdditionalCharge = false; // entity.Hours = result; // epday.CountDailyPlannedWorkingHours += result; // } //} if (epday.WorkingModels == null) { epday.WorkingModels = new List <EmployeeWorkingModel>(); } epday.WorkingModels.Add(entity); } } } }
private void CalculateDailyWorkingModels(EmployeeWeek planningweek) { #region daily calculation Debug.Assert(planningweek != null); if (planningweek.IsValidWeek) { EmployeeWorkingModel entity = null; foreach (EmployeeDay epd in planningweek.DaysList) { epd.CountDailyAdditionalCharges = 0; epd.WorkingModels = null; if (!epd.IsValidDay) { continue; } foreach (WorkingModelWrapperNew wrap in _dailyModels) { if (!planningweek.PlannedWeek) { if (!wrap.Model.UseInRecording) { continue; } } if (!DateTimeHelper.Between(epd.Date, wrap.Model.BeginTime, wrap.Model.EndTime)) { continue; } if (wrap.Validate(planningweek, epd.Date)) { entity = new EmployeeWorkingModel(); entity.EmployeeID = epd.EmployeeId; entity.Date = epd.Date; entity.WorkingModelID = wrap.Model.ID; // modify 20.12.2007 if (!wrap.IsMessageModel) { entity.Hours = wrap.GetModelValue; entity.AdditionalCharge = wrap.Model.AddCharges; if (wrap.Model.AddCharges) { epd.CountDailyAdditionalCharges += entity.Hours; } else { epd.CountDailyPlannedWorkingHours += entity.Hours; } //if (wrap.Model.AddCharges) //{ // entity.AdditionalCharge = true; // if (wrap.Model.AddValue != 0) // { // entity.Hours += DateTimeHelper.RoundToQuoter((short)(60 * wrap.Model.AddValue)); // epd.CountDailyAdditionalCharges += DateTimeHelper.RoundToQuoter((short)(60 * wrap.Model.AddValue)); // } // if (wrap.Model.MultiplyValue != 0) // { // entity.Hours = DateTimeHelper.RoundToQuoter((short)(wrap.Hours * wrap.Model.MultiplyValue - wrap.Hours)); // epd.CountDailyAdditionalCharges += DateTimeHelper.RoundToQuoter((short)(wrap.Hours * wrap.Model.MultiplyValue - wrap.Hours)); // } //} //else //{ // entity.AdditionalCharge = false; // if (wrap.Model.AddValue != 0) // { // entity.Hours += DateTimeHelper.RoundToQuoter((short)(60 * wrap.Model.AddValue)); // epd.CountDailyPlannedWorkingHours += DateTimeHelper.RoundToQuoter((short)(60 * wrap.Model.AddValue)); // } // if (wrap.Model.MultiplyValue != 0) // { // entity.Hours += DateTimeHelper.RoundToQuoter((short)(wrap.Hours * wrap.Model.MultiplyValue - wrap.Hours)); // epd.CountDailyPlannedWorkingHours += DateTimeHelper.RoundToQuoter((short)(wrap.Hours * wrap.Model.MultiplyValue - wrap.Hours)); // } //} } if (epd.WorkingModels == null) { epd.WorkingModels = new List <EmployeeWorkingModel>(); } epd.WorkingModels.Add(entity); } } } } #endregion }