public static void _CORRECT_WASHUP(DateTime start, DateTime end, ref TimeSpan wash, string word) { TimeSpan val; if (!TimeSpan.TryParse(word, out val)) { saveToLog("Washup time data updated"); val = ShiftInformation.CalcWashupTime(start, end, ShiftInformation.LunchLength); } wash = val; }
private void checkBox1_CheckedChanged(object sender, EventArgs e) { CheckBox cb = (CheckBox)sender; //period.WashupTime = cb.Checked; if (cb.Checked) { changeWashupTime(ShiftInformation.CalcWashupTime(this.period.StartTime, this.period.EndTime, ShiftInformation.LunchLength)); cb.BackColor = SystemColors.ControlDark; } else { changeWashupTime(TimeSpan.Zero); cb.BackColor = Control.DefaultBackColor; } }
public List <PremiumCode> GenerateCodes(List <work_period> wp, Settings settings) { List <PremiumCode> outputcodes = new List <PremiumCode>(); foreach (work_period p in wp) { if (p.WashupTime <= TimeSpan.Zero || p.StartTime == DateTime.MinValue || p.EndTime == DateTime.MinValue) { continue; } TimeSpan washup = ShiftInformation.CalcWashupTime(p.StartTime, p.EndTime, ShiftInformation.LunchLength); DateTime washupEnd = p.EndTime + washup; TimeSpan ot = ShiftInformation.CalcOvertime(p.StartTime, p.EndTime); if (ot >= ShiftInformation.ShiftLength) // 7.5 Hrs of OT or more { PremiumCode pc = new PremiumCode(DEFAULT_CODE, p.EndTime); pc.EndDate = washupEnd; pc.SetArrayHours(p.WashupTime, PremiumCode.HoursMultiplier.X200); outputcodes.Add(pc); } else if (p.EndTime.DayOfWeek == DayOfWeek.Sunday && washupEnd.DayOfWeek == DayOfWeek.Sunday && settings.SplitSaturday) // Shift ends on a sunday { PremiumCode x20 = new PremiumCode(DEFAULT_CODE, p.EndTime); x20.EndDate = washupEnd; x20.SetArrayHours(p.WashupTime, PremiumCode.HoursMultiplier.X200); outputcodes.Add(x20); } else if (washupEnd.DayOfWeek == DayOfWeek.Sunday) { DateTime cutoff = new DateTime(washupEnd.Year, washupEnd.Month, washupEnd.Day, 0, 0, 0); PremiumCode x15 = new PremiumCode(DEFAULT_CODE, p.EndTime); x15.EndDate = cutoff; x15.SetArrayHours(cutoff - p.EndTime, PremiumCode.HoursMultiplier.X150); outputcodes.Add(x15); PremiumCode x20 = new PremiumCode(DEFAULT_CODE, cutoff); x20.EndDate = washupEnd; x20.SetArrayHours(washupEnd - cutoff, PremiumCode.HoursMultiplier.X200); outputcodes.Add(x20); } else //Usual case { PremiumCode pc = new PremiumCode(DEFAULT_CODE, p.EndTime); pc.EndDate = washupEnd; pc.SetArrayHours(p.WashupTime, PremiumCode.HoursMultiplier.X150); outputcodes.Add(pc); } } return(outputcodes); }
private void updateWashup() { period.WashupTime = ShiftInformation.CalcWashupTime(period.StartTime, period.EndTime, ShiftInformation.LunchLength); cb_Washup.Checked = period.WashupTime > TimeSpan.Zero; }