public void Update(EmployeeT entity)
 {
     Connection.Execute(
         @"UPDATE EmployeeT SET 
                 EmployeeName = @EmployeeName,
                 EmployeePosition = @EmployeePosition,
                 EmployeePhone = @EmployeePhone,
                 Email = @Email,
                 BirthdayDate = @BirthdayDate,
                 SignInDate = @SignInDate,
                 ResignedDate = @ResignedDate,
                 IsResigned = @IsResigned,
                 Salary = @Salary,
                 EditedDate = GETUTCDATE() 
             WHERE EmployeeID = @EmployeeID",
         param: new
     {
         EmployeeID       = entity.EmployeeID,
         EmployeePosition = entity.EmployeePosition,
         EmployeePhone    = entity.EmployeePhone,
         EmployeeName     = entity.EmployeeName,
         Email            = entity.Email,
         BirthdayDate     = entity.BirthdayDate,
         SignInDate       = entity.SignInDate,
         ResignedDate     = entity.ResignedDate,
         IsResigned       = entity.IsResigned,
         Salary           = entity.Salary,
     }, transaction: Transaction);
 }
 public void Delete(EmployeeT entity)
 {
     Connection.Execute("" +
                        @"DELETE FROM EmployeeT WHERE EmployeeID = @EmployeeID
           DELETE FROM CompanyT_EmployeeT WHERE EmployeeID = @EmployeeID",
                        param: new { EmployeeID = entity.EmployeeID }, transaction: Transaction);
 }
Beispiel #3
0
        public void TimeCardRules_CalculateWeeklyOvertime_OneWeekOverTwoPayPeriods()
        {
            string    suffix    = "26";
            DateTime  startDate = DateTime.Parse("2001-02-01");         //This will create a pay period that splits a work week.
            Employee  emp       = EmployeeT.CreateEmployee(suffix);
            PayPeriod payP1     = PayPeriodT.CreateTwoWeekPayPeriodIfNotExists(startDate);
            PayPeriod payP2     = PayPeriodT.CreateTwoWeekPayPeriodIfNotExists(startDate.AddDays(14));

            PayPeriods.RefreshCache();
            Prefs.UpdateInt(PrefName.TimeCardOvertimeFirstDayOfWeek, 0);
            TimeCardRules.RefreshCache();
            long clockEvent1 = ClockEventT.InsertWorkPeriod(emp.EmployeeNum, startDate.AddDays(10).AddHours(6), startDate.AddDays(10).AddHours(17), 0);
            long clockEvent2 = ClockEventT.InsertWorkPeriod(emp.EmployeeNum, startDate.AddDays(11).AddHours(6), startDate.AddDays(11).AddHours(17), 0);
            long clockEvent3 = ClockEventT.InsertWorkPeriod(emp.EmployeeNum, startDate.AddDays(12).AddHours(6), startDate.AddDays(12).AddHours(17), 0);
            //new pay period
            long clockEvent4 = ClockEventT.InsertWorkPeriod(emp.EmployeeNum, startDate.AddDays(14).AddHours(6), startDate.AddDays(14).AddHours(17), 0);

            TimeCardRules.CalculateWeeklyOvertime(emp, payP1.DateStart, payP1.DateStop);
            TimeCardRules.CalculateWeeklyOvertime(emp, payP2.DateStart, payP2.DateStop);
            //Validate
            List <TimeAdjust> resultList = TimeAdjusts.Refresh(emp.EmployeeNum, startDate, startDate.AddDays(28));

            Assert.IsFalse(resultList.Count < 1);
            TimeAdjust result = resultList[0];

            Assert.AreEqual(TimeSpan.FromHours(-4), result.RegHours);
            Assert.AreEqual(TimeSpan.FromHours(4), result.OTimeHours);
        }
Beispiel #4
0
        public void TimeCardRules_CalculateWeeklyOvertime_ForDifferentClinicsRealData()
        {
            string    suffix    = "66";
            DateTime  startDate = DateTime.Parse("2016-05-09");         //This will create a pay period that splits a work week.
            Employee  emp       = EmployeeT.CreateEmployee(suffix);
            PayPeriod payP1     = PayPeriodT.CreateTwoWeekPayPeriodIfNotExists(startDate);

            PayPeriods.RefreshCache();
            Prefs.UpdateInt(PrefName.TimeCardOvertimeFirstDayOfWeek, 0);
            TimeCardRules.RefreshCache();
            //Each of these are 11 hour days. Should have 4 hours of OT with clinic 3 in the second pay period and 11 hours for clinic 4.
            //Week 1 - 40.4 hours
            long clockEvent1 = ClockEventT.InsertWorkPeriod(emp.EmployeeNum, startDate.AddDays(0).AddHours(6), startDate.AddDays(0).AddHours(6 + 8), 0);             //Mon
            long clockEvent2 = ClockEventT.InsertWorkPeriod(emp.EmployeeNum, startDate.AddDays(1).AddHours(6), startDate.AddDays(1).AddHours(6 + 8), 0);             //Tue
            long clockEvent3 = ClockEventT.InsertWorkPeriod(emp.EmployeeNum, startDate.AddDays(2).AddHours(6), startDate.AddDays(2).AddHours(6 + 8.76), 0, 0.06);    //Wed
            long clockEvent4 = ClockEventT.InsertWorkPeriod(emp.EmployeeNum, startDate.AddDays(3).AddHours(6), startDate.AddDays(3).AddHours(6 + 8.72), 0, 0.73);    //Thurs
            long clockEvent5 = ClockEventT.InsertWorkPeriod(emp.EmployeeNum, startDate.AddDays(4).AddHours(6), startDate.AddDays(4).AddHours(6 + 8.12), 0, 0.41);    //Fri
            //Week 2 - 41.23 hours
            long clockEvent6  = ClockEventT.InsertWorkPeriod(emp.EmployeeNum, startDate.AddDays(7).AddHours(6), startDate.AddDays(7).AddHours(6 + 8.79), 0, 0.4);    //Mon
            long clockEvent7  = ClockEventT.InsertWorkPeriod(emp.EmployeeNum, startDate.AddDays(8).AddHours(6), startDate.AddDays(8).AddHours(6 + 8.85), 0, 0.38);   //Tue
            long clockEvent8  = ClockEventT.InsertWorkPeriod(emp.EmployeeNum, startDate.AddDays(9).AddHours(6), startDate.AddDays(9).AddHours(6 + 7.78), 0, 0.29);   //Wed
            long clockEvent9  = ClockEventT.InsertWorkPeriod(emp.EmployeeNum, startDate.AddDays(10).AddHours(6), startDate.AddDays(10).AddHours(6 + 8.88), 0, 0.02); //Thurs
            long clockEvent10 = ClockEventT.InsertWorkPeriod(emp.EmployeeNum, startDate.AddDays(11).AddHours(6), startDate.AddDays(11).AddHours(6 + 8.59), 0, 0.57); //Fri

            TimeCardRules.CalculateWeeklyOvertime(emp, payP1.DateStart, payP1.DateStop);
            //Validate
            List <TimeAdjust> listAdjusts = TimeAdjusts.GetValidList(emp.EmployeeNum, startDate, startDate.AddDays(28)).OrderBy(x => x.OTimeHours).ToList();

            Assert.AreEqual(2, listAdjusts.Count);
            Assert.AreEqual(TimeSpan.FromHours(-0.4), listAdjusts[0].RegHours);
            Assert.AreEqual(TimeSpan.FromHours(0.4), listAdjusts[0].OTimeHours);
            Assert.AreEqual(TimeSpan.FromHours(-1.23), listAdjusts[1].RegHours);
            Assert.AreEqual(TimeSpan.FromHours(1.23), listAdjusts[1].OTimeHours);
        }
Beispiel #5
0
        public void TimeCardRules_CalculateWeeklyOvertime_OneWeekOverTwoPayPeriodsForDifferentClinicPreferences()
        {
            string    suffix    = "64";
            DateTime  startDate = DateTime.Parse("2001-02-01");         //This will create a pay period that splits a work week.
            Employee  emp       = EmployeeT.CreateEmployee(suffix);
            PayPeriod payP1     = PayPeriodT.CreateTwoWeekPayPeriodIfNotExists(startDate);
            PayPeriod payP2     = PayPeriodT.CreateTwoWeekPayPeriodIfNotExists(startDate.AddDays(14));

            PayPeriods.RefreshCache();
            Prefs.UpdateInt(PrefName.TimeCardOvertimeFirstDayOfWeek, 0);
            TimeCardRules.RefreshCache();
            //Each of these are 11 hour days. Should have 4 hours of OT with clinic 3 in the second pay period and 11 hours for clinic 4.
            long clockEvent1 = ClockEventT.InsertWorkPeriod(emp.EmployeeNum, startDate.AddDays(10).AddHours(6), startDate.AddDays(10).AddHours(17), 0);       //Sun
            long clockEvent2 = ClockEventT.InsertWorkPeriod(emp.EmployeeNum, startDate.AddDays(11).AddHours(6), startDate.AddDays(11).AddHours(17), 1);       //Mon
            long clockEvent3 = ClockEventT.InsertWorkPeriod(emp.EmployeeNum, startDate.AddDays(12).AddHours(6), startDate.AddDays(12).AddHours(17), 2);       //Tue
            //new pay period
            long clockEvent4 = ClockEventT.InsertWorkPeriod(emp.EmployeeNum, startDate.AddDays(14).AddHours(6), startDate.AddDays(14).AddHours(17), 3);       //Wed
            long clockEvent5 = ClockEventT.InsertWorkPeriod(emp.EmployeeNum, startDate.AddDays(15).AddHours(6), startDate.AddDays(15).AddHours(17), 4);       //Thurs

            TimeCardRules.CalculateWeeklyOvertime(emp, payP1.DateStart, payP1.DateStop);
            TimeCardRules.CalculateWeeklyOvertime(emp, payP2.DateStart, payP2.DateStop);
            //Validate
            List <TimeAdjust> listAdjusts = TimeAdjusts.GetValidList(emp.EmployeeNum, startDate, startDate.AddDays(28)).OrderBy(x => x.OTimeHours).ToList();

            Assert.AreEqual(2, listAdjusts.Count);
            Assert.AreEqual(TimeSpan.FromHours(-4), listAdjusts[0].RegHours);
            Assert.AreEqual(3, listAdjusts[0].ClinicNum);
            Assert.AreEqual(TimeSpan.FromHours(4), listAdjusts[0].OTimeHours);
            Assert.AreEqual(TimeSpan.FromHours(-11), listAdjusts[1].RegHours);
            Assert.AreEqual(4, listAdjusts[1].ClinicNum);
            Assert.AreEqual(TimeSpan.FromHours(11), listAdjusts[1].OTimeHours);
        }
Beispiel #6
0
        public void TimeCardRules_CalculateWeeklyOvertime_ForDifferentClinics()
        {
            string    suffix    = "62";
            DateTime  startDate = DateTime.Parse("2001-01-01");
            Employee  emp       = EmployeeT.CreateEmployee(suffix);
            PayPeriod payP1     = PayPeriodT.CreateTwoWeekPayPeriodIfNotExists(startDate);

            PayPeriods.RefreshCache();
            Prefs.UpdateInt(PrefName.TimeCardOvertimeFirstDayOfWeek, 0);
            TimeCardRules.RefreshCache();
            //Each of these are 11 hour days. Should have 4 hours of OT with clinic 3 and 11 hours OT with clinic 4 the end of the pay period.
            long clockEvent1 = ClockEventT.InsertWorkPeriod(emp.EmployeeNum, startDate.AddDays(0).AddHours(6), startDate.AddDays(0).AddHours(17), 0);
            long clockEvent2 = ClockEventT.InsertWorkPeriod(emp.EmployeeNum, startDate.AddDays(1).AddHours(6), startDate.AddDays(1).AddHours(17), 1);
            long clockEvent3 = ClockEventT.InsertWorkPeriod(emp.EmployeeNum, startDate.AddDays(2).AddHours(6), startDate.AddDays(2).AddHours(17), 2);
            long clockEvent4 = ClockEventT.InsertWorkPeriod(emp.EmployeeNum, startDate.AddDays(3).AddHours(6), startDate.AddDays(3).AddHours(17), 3);
            long clockEvent5 = ClockEventT.InsertWorkPeriod(emp.EmployeeNum, startDate.AddDays(4).AddHours(6), startDate.AddDays(4).AddHours(17), 4);

            TimeCardRules.CalculateWeeklyOvertime(emp, payP1.DateStart, payP1.DateStop);
            //Validate
            List <TimeAdjust> listAdjusts = TimeAdjusts.GetValidList(emp.EmployeeNum, startDate, startDate.AddDays(5)).OrderBy(x => x.OTimeHours).ToList();

            Assert.AreEqual(2, listAdjusts.Count);
            Assert.AreEqual(TimeSpan.FromHours(-4), listAdjusts[0].RegHours);
            Assert.AreEqual(3, listAdjusts[0].ClinicNum);
            Assert.AreEqual(TimeSpan.FromHours(4), listAdjusts[0].OTimeHours);
            Assert.AreEqual(TimeSpan.FromHours(-11), listAdjusts[1].RegHours);
            Assert.AreEqual(4, listAdjusts[1].ClinicNum);
            Assert.AreEqual(TimeSpan.FromHours(11), listAdjusts[1].OTimeHours);
        }
Beispiel #7
0
        public void TimeCardRules_CalculateWeeklyOvertime_OneWeekWorkWeekStartsOnWednesday()
        {
            string    suffix    = "27";
            DateTime  startDate = DateTime.Parse("2001-01-01");
            Employee  emp       = EmployeeT.CreateEmployee(suffix);
            PayPeriod payP1     = PayPeriodT.CreateTwoWeekPayPeriodIfNotExists(startDate);

            PayPeriods.RefreshCache();
            Prefs.UpdateInt(PrefName.TimeCardOvertimeFirstDayOfWeek, 3);
            TimeCardRules.RefreshCache();
            long clockEvent1 = ClockEventT.InsertWorkPeriod(emp.EmployeeNum, startDate.AddDays(0).AddHours(6), startDate.AddDays(0).AddHours(17), 0);
            long clockEvent2 = ClockEventT.InsertWorkPeriod(emp.EmployeeNum, startDate.AddDays(1).AddHours(6), startDate.AddDays(1).AddHours(17), 0);
            //new work week
            long clockEvent3 = ClockEventT.InsertWorkPeriod(emp.EmployeeNum, startDate.AddDays(2).AddHours(6), startDate.AddDays(2).AddHours(17), 0);
            long clockEvent4 = ClockEventT.InsertWorkPeriod(emp.EmployeeNum, startDate.AddDays(3).AddHours(6), startDate.AddDays(3).AddHours(17), 0);
            long clockEvent5 = ClockEventT.InsertWorkPeriod(emp.EmployeeNum, startDate.AddDays(4).AddHours(6), startDate.AddDays(4).AddHours(17), 0);
            long clockEvent6 = ClockEventT.InsertWorkPeriod(emp.EmployeeNum, startDate.AddDays(5).AddHours(6), startDate.AddDays(5).AddHours(17), 0);

            TimeCardRules.CalculateWeeklyOvertime(emp, payP1.DateStart, payP1.DateStop);
            //Validate
            TimeAdjust result = TimeAdjusts.Refresh(emp.EmployeeNum, startDate, startDate.AddDays(28))[0];

            Assert.AreEqual(TimeSpan.FromHours(-4), result.RegHours);
            Assert.AreEqual(TimeSpan.FromHours(4), result.OTimeHours);
        }
        public void Add(EmployeeT entity)
        {
            Connection.Execute(@"
                            INSERT INTO EmployeeT(
                                EmployeeName,
                                Email,
                                EmployeePosition,
                                EmployeePhone,
                                BirthdayDate,
                                SignInDate,
                                ResignedDate,
                                IsResigned,
                                Salary)
                            VALUES(
                                @EmployeeName,
                                @Email,
                                @EmployeePhone,
                                @EmployeePosition,
                                @BirthdayDate,
                                @SignInDate,
                                @ResignedDate,
                                @IsResigned,
                                @Salary)

                            DECLARE @LastID int
                            SELECT @LastID =  SCOPE_IDENTITY()

                            INSERT INTO CompanyT_EmployeeT(
                                CompanyID,
                                EmployeeID
                            ) VALUES(
                                @CompanyID,
                                @LastID 
                            )",
                               param: new
            {
                EmployeeName     = entity.EmployeeName,
                Email            = entity.Email,
                EmployeePosition = entity.EmployeePosition,
                EmployeePhone    = entity.EmployeePhone,
                BirthdayDate     = entity.BirthdayDate,
                SignInDate       = entity.SignInDate,
                ResignedDate     = entity.ResignedDate,
                IsResigned       = entity.IsResigned,
                Salary           = entity.Salary,
                CompanyID        = entity.CompanyID
            }, transaction: Transaction);
        }
Beispiel #9
0
        public Jsend <EmployeeT> FindEmployeeByName(string name)
        {
            EmployeeT result = null;

            try
            {
                result = _uow.EmployeeTRepository.FindByName(name);
                _uow.Commit();
            }
            catch (SqlException ex)
            {
                _logger.Error(ex);
                return(JsendResult <EmployeeT> .Error("FindEmployeeByName() occured error"));
            }
            return(JsendResult <EmployeeT> .Success(result));
        }
Beispiel #10
0
        public Jsend <EmployeeT> FindEmployeeByID(int id)
        {
            EmployeeT result = null;

            try
            {
                result = _uow.EmployeeTRepository.FindByID(id);
                _uow.Commit();
            }
            catch (SqlException ex)
            {
                _logger.Error(ex);
                return(JsendResult <EmployeeT> .Error(""));
            }
            return(JsendResult <EmployeeT> .Success(result));
        }
Beispiel #11
0
        public void TimeCardRules_CalculateWeeklyOvertime_CalculationWithManualOvertime()
        {
            string    suffix    = "67";
            DateTime  startDate = DateTime.Parse("2016-03-14");
            Employee  emp       = EmployeeT.CreateEmployee(suffix);
            PayPeriod payP1     = PayPeriodT.CreateTwoWeekPayPeriodIfNotExists(startDate);

            PayPeriods.RefreshCache();
            Prefs.UpdateInt(PrefName.TimeCardOvertimeFirstDayOfWeek, 0);
            TimeCardRules.RefreshCache();
            //Each of these are 11 hour days. Should have 4 hours of OT with clinic 3 in the second pay period and 11 hours for clinic 4.
            //Week 1 - 40.13 (Note: These appear as they should after CalculateDaily is run.)
            long clockEvent1 = ClockEventT.InsertWorkPeriod(emp.EmployeeNum, startDate.AddDays(0).AddHours(6), startDate.AddDays(0).AddHours(6 + 8.06), 0);    //Mon
            long clockEvent2 = ClockEventT.InsertWorkPeriod(emp.EmployeeNum, startDate.AddDays(1).AddHours(6), startDate.AddDays(1).AddHours(6 + 8), 0);       //Tue
            long clockEvent3 = ClockEventT.InsertWorkPeriod(emp.EmployeeNum, startDate.AddDays(2).AddHours(6), startDate.AddDays(2).AddHours(6 + 8.08), 0);    //Wed
            long clockEvent4 = ClockEventT.InsertWorkPeriod(emp.EmployeeNum, startDate.AddDays(3).AddHours(6), startDate.AddDays(3).AddHours(6 + 8), 0, 0.02); //Thurs
            long clockEvent5 = ClockEventT.InsertWorkPeriod(emp.EmployeeNum, startDate.AddDays(4).AddHours(6), startDate.AddDays(4).AddHours(6 + 8.01), 0);    //Fri
            //SATURDAY - 4.1 HRS OF OVERTIME
            ClockEvent ce = new ClockEvent();

            ce.ClinicNum      = 0;
            ce.ClockStatus    = TimeClockStatus.Home;
            ce.EmployeeNum    = emp.EmployeeNum;
            ce.OTimeHours     = TimeSpan.FromHours(4.1);
            ce.TimeDisplayed1 = new DateTime(startDate.Year, startDate.Month, startDate.AddDays(5).Day, 6, 54, 0);
            ce.TimeDisplayed2 = new DateTime(startDate.Year, startDate.Month, startDate.AddDays(5).Day, 11, 0, 0);
            ce.TimeEntered1   = ce.TimeDisplayed1;
            ce.TimeEntered2   = ce.TimeDisplayed2;
            ce.ClockEventNum  = ClockEvents.Insert(ce);
            ClockEvents.Update(ce);
            //Week 2 - 41.06
            long clockEvent6  = ClockEventT.InsertWorkPeriod(emp.EmployeeNum, startDate.AddDays(7).AddHours(6), startDate.AddDays(7).AddHours(6 + 8.02), 0);   //Mon
            long clockEvent7  = ClockEventT.InsertWorkPeriod(emp.EmployeeNum, startDate.AddDays(8).AddHours(6), startDate.AddDays(8).AddHours(6 + 8), 0);      //Tue
            long clockEvent8  = ClockEventT.InsertWorkPeriod(emp.EmployeeNum, startDate.AddDays(9).AddHours(6), startDate.AddDays(9).AddHours(6 + 8), 0);      //Wed
            long clockEvent9  = ClockEventT.InsertWorkPeriod(emp.EmployeeNum, startDate.AddDays(10).AddHours(6), startDate.AddDays(10).AddHours(6 + 9.04), 0); //Thurs
            long clockEvent10 = ClockEventT.InsertWorkPeriod(emp.EmployeeNum, startDate.AddDays(11).AddHours(6), startDate.AddDays(11).AddHours(6 + 8), 0);    //Fri

            TimeCardRules.CalculateWeeklyOvertime(emp, payP1.DateStart, payP1.DateStop);
            //Validate
            List <TimeAdjust> listAdjusts = TimeAdjusts.GetValidList(emp.EmployeeNum, startDate, startDate.AddDays(28)).OrderBy(x => x.OTimeHours).ToList();

            Assert.AreEqual(2, listAdjusts.Count);
            Assert.AreEqual(TimeSpan.FromHours(-0.13), listAdjusts[0].RegHours);
            Assert.AreEqual(TimeSpan.FromHours(0.13), listAdjusts[0].OTimeHours);
            Assert.AreEqual(TimeSpan.FromHours(-1.06), listAdjusts[1].RegHours);
            Assert.AreEqual(TimeSpan.FromHours(1.06), listAdjusts[1].OTimeHours);
        }
Beispiel #12
0
        ///<summary>Tests that, when creating Patient Characteristics for submission to NewCrop, the Patient's height, heightUnits, weight
        ///and weightUnits are _only_ included when specified. In the below case, only the height information is gvien and thus only the height
        ///information should be in the final results.</summary>
        public void NewCrop_AddingHeightOnly()
        {
            long    provNum = ProviderT.CreateProvider("DOC", "Beverly", "Crusher");                                                                        //Provider
            Patient pat     = PatientT.CreatePatient(priProvNum: provNum, email: "*****@*****.**",
                                                     phone: "1234567", lName: "Wayne", fName: "Bruce", preferredName: "Batman", setPortalAccessInfo: true); //Patient
            Employee       emp            = EmployeeT.CreateEmployee("");                                                                                   //Employee
            ProviderClinic providerClinic = ProviderClinicT.CreateProviderClinic(Providers.GetProv(provNum), dEANum: "93485", stateRxID: "439578");

            ProviderClinicT.Update(providerClinic);
            Vitalsign vitals = VitalsignT.CreateVitalsign(patNum: pat.PatNum, height: 6, heightExamCode: "3137-7", weightExamCode: "3141-9");   //Vitalsigns

            VitalsignT.Update(vitals: vitals, patNum: pat.PatNum);
            ErxXml.BuildNewCropClickThroughXml(Providers.GetProv(provNum), emp, pat, out NCScript nCScript);
            Assert.AreEqual("6", nCScript.Patient.PatientCharacteristics.height);
            Assert.AreEqual("inches", nCScript.Patient.PatientCharacteristics.heightUnits);
            Assert.AreEqual(null, nCScript.Patient.PatientCharacteristics.weight);
            Assert.AreEqual(WeightUnitType.Item, nCScript.Patient.PatientCharacteristics.weightUnits);           //WeightUnitType.Item is default for enum (0)
        }
Beispiel #13
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 #14
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);
        }