Beispiel #1
0
        public void TimeCardRules_CalculateDailyOvertime_ForHoursWorkedBeforeACertainTime()
        {
            string    suffix    = "33";
            DateTime  startDate = DateTime.Parse("2001-01-01");
            Employee  emp       = EmployeeT.CreateEmployee(suffix);
            PayPeriod payP1     = PayPeriodT.CreateTwoWeekPayPeriodIfNotExists(startDate);

            PayPeriods.RefreshCache();
            Prefs.UpdateInt(PrefName.TimeCardOvertimeFirstDayOfWeek, 0);
            Prefs.UpdateBool(PrefName.TimeCardsMakesAdjustmentsForOverBreaks, true);
            TimeCardRuleT.CreateAMTimeRule(emp.EmployeeNum, TimeSpan.FromHours(7.5));
            TimeCardRules.RefreshCache();
            long clockEvent1 = ClockEventT.InsertWorkPeriod(emp.EmployeeNum, startDate.AddHours(6), startDate.AddHours(16), 0);

            ClockEventT.InsertBreak(emp.EmployeeNum, startDate.AddHours(11), 40, 0);
            CalculateDailyOvertime(emp, payP1.DateStart, payP1.DateStop);
            //Validate
            Assert.AreEqual(TimeSpan.FromMinutes(-10), ClockEvents.GetOne(clockEvent1).AdjustAuto);
            Assert.AreEqual(TimeSpan.FromMinutes(90), ClockEvents.GetOne(clockEvent1).Rate2Auto);
        }
Beispiel #2
0
        public void TimeCardRules_CalculateDailyOvertime_WhileEmployeeClockedInTodayDuringPayPeriod()
        {
            DateTime  startDate = DateTime.Now.Date.AddDays(-1);
            Employee  emp       = EmployeeT.CreateEmployee("CalculateDailyWhileEmployeeClockedInDuringPayPeriod");
            PayPeriod payP1     = PayPeriodT.CreateTwoWeekPayPeriodIfNotExists(startDate);

            PayPeriods.RefreshCache();
            Prefs.UpdateInt(PrefName.TimeCardOvertimeFirstDayOfWeek, 0);
            Prefs.UpdateBool(PrefName.TimeCardsMakesAdjustmentsForOverBreaks, true);
            Prefs.RefreshCache();
            TimeCardRules.RefreshCache();
            //10 hour day with 45 minute break
            long clockEvent1 = ClockEventT.InsertWorkPeriod(emp.EmployeeNum, startDate.AddHours(8), startDate.AddHours(18));
            long break1      = ClockEventT.InsertBreak(emp.EmployeeNum, startDate.AddHours(12), 45);
            //Next day clock in, but have no clock out event yet.
            long clockEvent2 = ClockEventT.InsertWorkPeriod(emp.EmployeeNum, startDate.AddDays(1).AddHours(8), DateTime.MinValue);

            CalculateDailyOvertime(emp, payP1.DateStart, payP1.DateStop);
            //Ensure that the 15 minutes was subtracted from the shift.
            Assert.AreEqual(TimeSpan.FromMinutes(-15), ClockEvents.GetOne(clockEvent1).AdjustAuto);
        }