Пример #1
0
 private void ValidateTimeBillable(CRServiceCaseLabor row)
 {
     if (row.TimeSpent != null && row.TimeBillable != null && row.TimeBillable > row.TimeSpent)
     {
         Caches[row.GetType()].RaiseExceptionHandling <CRServiceCaseLabor.timeBillable>(row, row.TimeBillable,
                                                                                        new PXSetPropertyException(Messages.BillableTimeCannotBeGreaterThanTimeSpent));
     }
 }
Пример #2
0
        private static void SetTimeBillable(CRServiceCaseLabor item)
        {
            if (item == null)
            {
                return;
            }

            item.TimeBillable     = item.TimeSpent != null && item.TimeSpent >= 0 ? item.TimeSpent : 0;
            item.OvertimeBillable = item.OvertimeSpent != null && item.OvertimeSpent >= 0 ? item.OvertimeSpent : 0;
        }
Пример #3
0
        private void SetOvertimeSpent(CRServiceCaseLabor item, CRServiceCase serviceCase)
        {
            if (item == null || item.StartDate == null || item.TimeSpent == null)
            {
                return;
            }
            try
            {
                var startDate  = (DateTime)item.StartDate;
                var endDate    = startDate.AddMinutes((int)item.TimeSpent);
                var empoyeeID  = item.EmployeeID;
                var locationID = serviceCase.With(c => c.LocationID);

                var overtimespent = CalculateOvertime(startDate, endDate, empoyeeID, locationID);
                item.OvertimeSpent = (int)overtimespent.TotalMinutes;
            }
            catch (ArgumentOutOfRangeException)
            {
            }
        }