protected virtual void EPActivityApprove_EarningTypeID_FieldDefaulting(PXCache cache, PXFieldDefaultingEventArgs e) { EPActivityApprove row = (EPActivityApprove)e.Row; if (row == null || EPsetingst.Current == null) { return; } EPEmployee rowEmploye = PXSelect <EPEmployee> .Search <EPEmployee.userID>(this, Filter.Current.OwnerID); if (rowEmploye == null || row.StartDate == null) { return; } if (CalendarHelper.IsWorkDay(this, rowEmploye.CalendarID, (DateTime)row.StartDate)) { e.NewValue = EPsetingst.Current.RegularHoursType; } else { e.NewValue = EPsetingst.Current.HolidaysType; } }
protected virtual void EPActivityFilter_RowSelected(PXCache sender, PXRowSelectedEventArgs e) { EPActivityFilter row = (EPActivityFilter)e.Row; if (row != null) { row.BillableTime = 0; row.BillableOvertime = 0; row.BillableTotal = 0; row.RegularTime = 0; row.RegularOvertime = 0; row.RegularTotal = 0; foreach (PXResult <EPActivityApprove, CRActivityLink, EPEarningType> item in Activity.Select()) { EPActivityApprove rowActivity = (EPActivityApprove)item; EPEarningType rowEarningType = (EPEarningType)item; if (rowEarningType.IsOvertime == true) { row.RegularOvertime += rowActivity.TimeSpent.GetValueOrDefault(0); row.BillableOvertime += rowActivity.TimeBillable.GetValueOrDefault(0); } else { row.RegularTime += rowActivity.TimeSpent.GetValueOrDefault(0); row.BillableTime += rowActivity.TimeBillable.GetValueOrDefault(0); } row.BillableTotal = row.BillableTime + row.BillableOvertime; row.RegularTotal = row.RegularTime + row.RegularOvertime; } } }
protected virtual void EPActivityApprove_ProjectTaskID_FieldDefaulting(PXCache cache, PXFieldDefaultingEventArgs e) { EPActivityApprove row = (EPActivityApprove)e.Row; if (row == null) { return; } if (Filter.Current.ProjectTaskID != null) { e.NewValue = Filter.Current.ProjectTaskID; e.Cancel = true; return; } if (row.ParentTaskID != null) { EPActivityApprove rowParentTask = PXSelect <EPActivityApprove> .Search <EPActivityApprove.taskID>(this, row.ParentTaskID); if (rowParentTask != null && rowParentTask.ProjectID == row.ProjectID) { e.NewValue = rowParentTask.ProjectTaskID; e.Cancel = true; } } EPEarningType earningRow = (EPEarningType)PXSelectorAttribute.Select <EPActivityApprove.earningTypeID>(cache, row); if (e.NewValue == null && earningRow != null && earningRow.ProjectID == row.ProjectID) { e.NewValue = earningRow.TaskID; e.Cancel = true; } }
protected virtual void EPActivityApprove_ProjectID_FieldDefaulting(PXCache cache, PXFieldDefaultingEventArgs e) { EPActivityApprove row = (EPActivityApprove)e.Row; if (row == null) { return; } if (Filter.Current.ProjectID != null) { e.NewValue = Filter.Current.ProjectID; e.Cancel = true; } else { EPEarningType earningType = PXSelect <EPEarningType, Where <EPEarningType.typeCD, Equal <Required <EPEarningType.typeCD> > > > .Select(this, row.EarningTypeID); if (earningType != null && earningType.ProjectID != null && row.ProjectID == null && PXSelectorAttribute.Select(cache, e.Row, cache.GetField(typeof(EPActivityApprove.projectID)), earningType.ProjectID) != null //available in selector ) { e.NewValue = earningType.ProjectID; e.Cancel = true; } } }
protected virtual void PMTimeActivityFilter_RowSelected(PXCache sender, PXRowSelectedEventArgs e) { PXDBDateAndTimeAttribute.SetTimeVisible <EPActivityApprove.date>(Activity.Cache, null, EPsetingst.Current.RequireTimes == true); PMTimeActivityFilter row = (PMTimeActivityFilter)e.Row; if (row != null) { row.BillableTime = 0; row.BillableOvertime = 0; row.BillableTotal = 0; row.RegularTime = 0; row.RegularOvertime = 0; row.RegularTotal = 0; foreach (PXResult <EPActivityApprove, EPEarningType> item in Activity.Select()) { EPActivityApprove rowActivity = (EPActivityApprove)item; EPEarningType rowEarningType = (EPEarningType)item; if (rowEarningType.IsOvertime == true) { row.RegularOvertime += rowActivity.TimeSpent.GetValueOrDefault(0); row.BillableOvertime += rowActivity.TimeBillable.GetValueOrDefault(0); } else { row.RegularTime += rowActivity.TimeSpent.GetValueOrDefault(0); row.BillableTime += rowActivity.TimeBillable.GetValueOrDefault(0); } row.BillableTotal = row.BillableTime + row.BillableOvertime; row.RegularTotal = row.RegularTime + row.RegularOvertime; } } }
protected virtual void StartDateFieldUpdating(PXCache sender, PXFieldUpdatingEventArgs e) { PMTimeActivityFilter rowFilter = Filter.Current; EPActivityApprove row = (EPActivityApprove)e.Row; if (rowFilter == null || e.NewValue == null) { return; } DateTime?newValue = null; DateTime valFromString; if (e.NewValue is string && DateTime.TryParse((string)e.NewValue, sender.Graph.Culture, System.Globalization.DateTimeStyles.None, out valFromString)) { newValue = valFromString; } if (e.NewValue is DateTime) { newValue = (DateTime)e.NewValue; } if (newValue != null) { int weekId = PXWeekSelector2Attribute.GetWeekID(this, newValue.Value.Date); if (weekId < rowFilter.FromWeek || weekId > rowFilter.TillWeek) { sender.RaiseExceptionHandling <EPActivityApprove.date>(row, e.NewValue, new PXSetPropertyException(Messages.StartDateOutOfRange)); e.Cancel = true; } } }
protected virtual void EPActivityApprove_ProjectTaskID_FieldVerifying(PXCache sender, PXFieldVerifyingEventArgs e) { EPActivityApprove row = (EPActivityApprove)e.Row; if (row == null) { return; } if (e.NewValue != null && e.NewValue is int) { PMTask task = PXSelect <PMTask> .Search <PMTask.taskID>(sender.Graph, e.NewValue); if (task != null) { if (task.IsCompleted == true) { var ex = new PXSetPropertyException(PM.Messages.ProjectTaskIsCompleted); ex.ErrorValue = task.TaskCD; throw ex; } if (task.IsCancelled == true) { var ex = new PXSetPropertyException(PM.Messages.ProjectTaskIsCanceled); ex.ErrorValue = task.TaskCD; throw ex; } } } }
protected virtual void EPActivityFilter_RowSelected(PXCache sender, PXRowSelectedEventArgs e) { if (!PXAccess.FeatureInstalled <FeaturesSet.timeReportingModule>()) { PXUIFieldAttribute.SetVisible(Activity.Cache, typeof(EPActivity.timeSpent).Name, false); PXUIFieldAttribute.SetVisible(Activity.Cache, typeof(EPActivity.timeBillable).Name, false); PXUIFieldAttribute.SetVisible(Activity.Cache, typeof(EPActivity.isBillable).Name, false); PXUIFieldAttribute.SetVisible <EPActivityFilter.regularOvertime>(sender, null, false); PXUIFieldAttribute.SetVisible <EPActivityFilter.regularTime>(sender, null, false); PXUIFieldAttribute.SetVisible <EPActivityFilter.regularTotal>(sender, null, false); PXUIFieldAttribute.SetVisible <EPActivityFilter.billableOvertime>(sender, null, false); PXUIFieldAttribute.SetVisible <EPActivityFilter.billableTime>(sender, null, false); PXUIFieldAttribute.SetVisible <EPActivityFilter.billableTotal>(sender, null, false); } if (!PXAccess.FeatureInstalled <FeaturesSet.projectModule>()) { PXUIFieldAttribute.SetVisible(Activity.Cache, typeof(EPActivity.projectTaskID).Name, false); PXUIFieldAttribute.SetVisible <EPActivityFilter.projectTaskID>(sender, null, false); } EPActivityFilter row = (EPActivityFilter)e.Row; if (row != null) { PXResult res = (PXResult)Activity.Select(); if (res == null || res[typeof(EPEarningType)] == null) { return; } row.BillableTime = 0; row.BillableOvertime = 0; row.BillableTotal = 0; row.RegularTime = 0; row.RegularOvertime = 0; row.RegularTotal = 0; foreach (PXResult <EPActivityApprove, EPEarningType> item in Activity.Select()) { EPActivityApprove rowActivity = (EPActivityApprove)item; EPEarningType rowEarningType = (EPEarningType)item; if (rowEarningType.IsOvertime == true) { row.RegularOvertime += rowActivity.TimeSpent.GetValueOrDefault(0); row.BillableOvertime += rowActivity.TimeBillable.GetValueOrDefault(0); } else { row.RegularTime += rowActivity.TimeSpent.GetValueOrDefault(0); row.BillableTime += rowActivity.TimeBillable.GetValueOrDefault(0); } row.BillableTotal = row.BillableTime + row.BillableOvertime; row.RegularTotal = row.RegularTime + row.RegularOvertime; } } }
protected virtual void EPActivityApprove_Date_FieldUpdated(PXCache cache, PXFieldUpdatedEventArgs e) { EPActivityApprove row = (EPActivityApprove)e.Row; if (row != null && row.Date != null) { TempData.Cache.SetValue <CRActivityMaint.EPTempData.lastEnteredDate>(TempData.Current, row.Date); } }
protected virtual void EPActivityApprove_Hold_FieldSelecting(PXCache cache, PXFieldSelectingEventArgs e) { EPActivityApprove row = (EPActivityApprove)e.Row; if (row != null) { e.ReturnValue = (row.UIStatus == CR.ActivityStatusListAttribute.Rejected || row.UIStatus == CR.ActivityStatusListAttribute.Open); } }
protected virtual void EPActivityApprove_RowSelected(PXCache sender, PXRowSelectedEventArgs e) { EPActivityApprove row = (EPActivityApprove)e.Row; PMTimeActivityFilter rowFilter = (PMTimeActivityFilter)Filter.Current; if (row == null || rowFilter == null) { return; } if (row.Released == true) { PXUIFieldAttribute.SetEnabled(sender, row, false); PXDBDateAndTimeAttribute.SetTimeEnabled <EPActivityApprove.date>(sender, row, false); PXDBDateAndTimeAttribute.SetDateEnabled <EPActivityApprove.date>(sender, row, false); } else if (row.ApprovalStatus == CR.ActivityStatusListAttribute.Open) { PXUIFieldAttribute.SetEnabled(sender, row, true); PXUIFieldAttribute.SetEnabled <EPActivityApprove.timeBillable>(sender, row); PMProject project = (PMProject)PXSelectorAttribute.Select <EPActivityApprove.projectID>(sender, row); PXUIFieldAttribute.SetEnabled <EPActivityApprove.projectID>(sender, row, rowFilter.ProjectID == null); if (project != null) { PXUIFieldAttribute.SetEnabled <EPActivityApprove.projectTaskID>(sender, row, rowFilter.ProjectTaskID == null && project.BaseType == CT.CTPRType.Project); } else { PXUIFieldAttribute.SetEnabled <EPActivityApprove.projectTaskID>(sender, row, rowFilter.ProjectTaskID == null); } PXDBDateAndTimeAttribute.SetTimeEnabled <EPActivityApprove.date>(sender, row, true); PXDBDateAndTimeAttribute.SetDateEnabled <EPActivityApprove.date>(sender, row, true); PXUIFieldAttribute.SetEnabled <EPActivityApprove.approvalStatus>(sender, row, false); PXUIFieldAttribute.SetEnabled <EPActivityApprove.approverID>(sender, row, false); PXUIFieldAttribute.SetEnabled <EPActivityApprove.timeCardCD>(sender, row, false); } else { PXUIFieldAttribute.SetEnabled(sender, row, false); PXDBDateAndTimeAttribute.SetTimeEnabled <EPActivityApprove.date>(sender, row, false); PXDBDateAndTimeAttribute.SetDateEnabled <EPActivityApprove.date>(sender, row, false); PXUIFieldAttribute.SetEnabled <EPActivityApprove.hold>(sender, row, true); } PXUIFieldAttribute.SetEnabled <EPActivityApprove.approvalStatus>(sender, row, false); PXUIFieldAttribute.SetEnabled <EPActivityApprove.employeeRate>(sender, row, false); if (row.ApprovalStatus == CR.ActivityStatusListAttribute.Rejected) { sender.RaiseExceptionHandling <EPActivityApprove.hold>(row, null, new PXSetPropertyException(Messages.Rejected, PXErrorLevel.RowWarning)); } }
protected virtual void EPActivityApprove_Date_FieldDefaulting(PXCache cache, PXFieldDefaultingEventArgs e) { EPActivityApprove row = (EPActivityApprove)e.Row; if (row == null) { e.NewValue = null; } else { e.NewValue = CRActivityMaint.GetNextActivityStartDate <EPActivityApprove>(this, Activity.Select(), row, Filter.Current.FromWeek, Filter.Current.TillWeek, TempData.Cache, typeof(EP.CRActivityMaint.EPTempData.lastEnteredDate)); } }
protected virtual void EPActivityApprove_RowSelected(PXCache sender, PXRowSelectedEventArgs e) { EPActivityApprove row = (EPActivityApprove)e.Row; if (row == null) { return; } PXUIFieldAttribute.SetEnabled(sender, row, false); PXUIFieldAttribute.SetEnabled <EPActivityApprove.isApproved>(sender, row, true); PXUIFieldAttribute.SetEnabled <EPActivityApprove.isReject>(sender, row, true); }
protected virtual void EPActivityApprove_TimeSpent_FieldUpdated(PXCache cache, PXFieldUpdatedEventArgs e) { EPActivityApprove row = (EPActivityApprove)e.Row; if (row == null) { return; } else { row.TimeBillable = GetTimeBillable(row, (int?)e.OldValue); } }
protected virtual void EPActivityApprove_RowDeleted(PXCache sender, PXRowDeletedEventArgs e) { EPActivityApprove row = (EPActivityApprove)e.Row; if (row == null) { return; } if (this.IsMobile) { this.Persist(); } }
protected virtual void EPActivityApprove_RowUpdating(PXCache sender, PXRowUpdatingEventArgs e) { EPActivityApprove row = (EPActivityApprove)e.Row; if (row == null) { return; } if (row.TimeCardCD != null) { Filter.View.Ask(Messages.ActivityAssignedToTimeCard, MessageButtons.OK); e.Cancel = true; } }
protected virtual void EPActivityApprove_Type_FieldDefaulting(PXCache cache, PXFieldDefaultingEventArgs e) { EPActivityApprove row = (EPActivityApprove)e.Row; if (row == null) { e.NewValue = null; } else { e.NewValue = EPsetingst.Current.DefaultActivityType; e.Cancel = true; } }
protected virtual void EPActivityApprove_ProjectID_FieldDefaulting(PXCache cache, PXFieldDefaultingEventArgs e) { EPActivityApprove row = (EPActivityApprove)e.Row; if (row == null) { return; } if (Filter.Current.ProjectID != null) { e.NewValue = Filter.Current.ProjectID; e.Cancel = true; } }
protected virtual void StartDateFieldUpdating(PXCache sender, PXFieldUpdatingEventArgs e) { EPActivityFilter rowFilter = Filter.Current; EPActivityApprove row = (EPActivityApprove)e.Row; if (rowFilter == null || e.NewValue == null) { return; } if (((DateTime)e.NewValue).Date < rowFilter.FromDate || ((DateTime)e.NewValue).Date > rowFilter.TillDate) { sender.RaiseExceptionHandling <EPActivityApprove.startDate>(row, rowFilter.FromDate, new PXSetPropertyException(Messages.StartDateOutOfRange)); e.Cancel = true; } }
protected virtual void EPActivityFilter_RowSelected(PXCache sender, PXRowSelectedEventArgs e) { EPActivityApprove totals = Totals.Select(); EPActivityFilter row = (EPActivityFilter)e.Row; if (totals != null && row != null) { row.BillableTime = totals.TimeBillable - totals.OvertimeBillable; row.BillableOvertime = totals.OvertimeBillable; row.BillableTotal = totals.TimeBillable; row.RegularTime = totals.TimeSpent - totals.OvertimeSpent; row.RegularOvertime = totals.OvertimeSpent; row.RegularTotal = totals.TimeSpent; } }
protected virtual void EPActivityApprove_Date_FieldUpdated(PXCache cache, PXFieldUpdatedEventArgs e) { EPActivityApprove row = (EPActivityApprove)e.Row; if (row == null) { return; } if (row.Date != null) { TempData.Cache.SetValue <CRActivityMaint.EPTempData.lastEnteredDate>(TempData.Current, row.Date); } UpdateReportedInTimeZoneIDIfNeeded(cache, row, (DateTime?)e.OldValue, row.Date); }
protected virtual void EPActivityApprove_RowDeleting(PXCache sender, PXRowDeletingEventArgs e) { EPActivityApprove row = (EPActivityApprove)e.Row; if (row == null) { return; } if (row.UIStatus == CR.ActivityStatusListAttribute.Approved || row.Released == true) { Filter.View.Ask((string.Format(Messages.ActivityIs, sender.GetValueExt <EPActivityApprove.uistatus>(row))), MessageButtons.OK); e.Cancel = true; } else if (row.TimeCardCD != null) { Filter.View.Ask(Messages.ActivityAssignedToTimeCard, MessageButtons.OK); e.Cancel = true; } }
protected virtual void EPActivityApprove_RowPersisting(PXCache sender, PXRowPersistingEventArgs e) { EPActivityApprove row = (EPActivityApprove)e.Row; if (row == null) { return; } if (row.IsApprove == true) { sender.SetValueExt <EPActivity.uistatus>(row, ActivityStatusListAttribute.Approved); row.ApprovedDate = Accessinfo.BusinessDate; } else if (row.IsReject == true) { sender.SetValueExt <EPActivity.uistatus>(row, ActivityStatusListAttribute.Rejected); } else if (row.UIStatus == ActivityStatusListAttribute.Rejected || row.UIStatus == ActivityStatusListAttribute.Approved) { sender.SetValueExt <EPActivity.uistatus>(row, ActivityStatusListAttribute.Completed); } }
protected virtual int?GetTimeBillable(EPActivityApprove row, int?OldTimeSpent) { if (row.TimeCardCD == null && row.Billed != true) { if (row.IsBillable != true) { return(null); } else if ((OldTimeSpent ?? 0) == 0 || OldTimeSpent == row.TimeBillable) { return(row.TimeSpent); } else { return(row.TimeBillable); } } else { return(row.TimeBillable); } }
protected virtual void EPActivityApprove_Hold_FieldUpdated(PXCache cache, PXFieldUpdatedEventArgs e) { EPActivityApprove row = (EPActivityApprove)e.Row; if (row == null) { return; } if (row.UIStatus == CR.ActivityStatusListAttribute.Approved) { cache.RaiseExceptionHandling <EPActivityApprove.hold>(row, null, new PXSetPropertyException(Messages.Approved, PXErrorLevel.RowWarning)); } if (row.Hold == true) { cache.SetValueExt <EPActivity.uistatus>(row, ActivityStatusListAttribute.Open); } else { cache.SetValueExt <EPActivity.uistatus>(row, ActivityStatusListAttribute.Completed); } }
protected virtual void EPActivityApprove_ProjectTaskID_FieldDefaulting(PXCache cache, PXFieldDefaultingEventArgs e) { EPActivityApprove row = (EPActivityApprove)e.Row; if (row == null) { return; } if (Filter.Current.ProjectTaskID != null) { e.NewValue = Filter.Current.ProjectTaskID; e.Cancel = true; return; } if (row.ParentTaskNoteID != null) { EPActivityApprove rowParentTask = PXSelect <EPActivityApprove> .Search <EPActivityApprove.noteID>(this, row.ParentTaskNoteID); if (rowParentTask != null && rowParentTask.ProjectID == row.ProjectID) { e.NewValue = rowParentTask.ProjectTaskID; e.Cancel = true; } } EPEarningType earningRow = (EPEarningType)PXSelectorAttribute.Select <EPActivityApprove.earningTypeID>(cache, row); if (e.NewValue == null && earningRow != null && earningRow.ProjectID == row.ProjectID) { PMTask defTask = PXSelectorAttribute.Select(cache, e.Row, cache.GetField(typeof(EPTimeCardSummary.projectTaskID)), earningRow.TaskID) as PMTask; if (defTask != null && defTask.VisibleInEP == true) { e.NewValue = earningRow.TaskID; e.Cancel = true; } } }
protected virtual void EPActivityApprove_RowPersisting(PXCache sender, PXRowPersistingEventArgs e) { EPActivityApprove row = (EPActivityApprove)e.Row; if (row == null || e.Operation == PXDBOperation.Delete) { return; } if (row.IsApproved == true) { sender.SetValueExt <EPActivityApprove.approvalStatus>(row, ActivityStatusListAttribute.Approved); row.ApprovedDate = Accessinfo.BusinessDate; } else if (row.IsReject == true) { sender.SetValueExt <EPActivityApprove.approvalStatus>(row, ActivityStatusListAttribute.Rejected); } else if (row.ApprovalStatus == ActivityStatusListAttribute.Rejected || row.ApprovalStatus == ActivityStatusListAttribute.Approved) { sender.SetValueExt <EPActivityApprove.approvalStatus>(row, ActivityStatusListAttribute.PendingApproval); } }
protected virtual void EPActivityApprove_Hold_FieldUpdated(PXCache cache, PXFieldUpdatedEventArgs e) { EPActivityApprove row = (EPActivityApprove)e.Row; if (row == null) { return; } if (row.ApprovalStatus == ActivityStatusListAttribute.Approved) { cache.RaiseExceptionHandling <EPActivityApprove.hold>(row, null, new PXSetPropertyException(Messages.Approved, PXErrorLevel.RowWarning)); } if (row.RefNoteID != null) { CRActivity parent = (CRActivity)Parent.View.SelectSingleBound(new[] { row }); if (parent != null) { parent.UIStatus = row.Hold == true ? ActivityStatusListAttribute.Open : ActivityStatusListAttribute.Completed; Parent.Update(parent); } } }
protected virtual void EPActivityApprove_ProjectID_FieldVerifying(PXCache sender, PXFieldVerifyingEventArgs e) { EPActivityApprove row = (EPActivityApprove)e.Row; if (row == null) { return; } if (e.NewValue != null && e.NewValue is int) { PMProject proj = PXSelect <PMProject> .Search <PMProject.contractID>(sender.Graph, e.NewValue); if (proj != null) { if (proj.IsCompleted == true) { var ex = new PXSetPropertyException(PM.Messages.ProjectIsCompleted); ex.ErrorValue = proj.ContractCD; throw ex; } if (proj.IsCancelled == true) { var ex = new PXSetPropertyException(PM.Messages.ProjectIsCanceled); ex.ErrorValue = proj.ContractCD; throw ex; } if (proj.Status == Contract.status.Expired) { var ex = new PXSetPropertyException(PM.Messages.ProjectIsSuspended); ex.ErrorValue = proj.ContractCD; throw ex; } } } }
public static bool RecordCostTrans(RegisterEntry registerEntry, List <EPActivityApprove> activities, out bool activityAdded) { registerEntry.FieldVerifying.AddHandler <PMTran.inventoryID>((PXCache sender, PXFieldVerifyingEventArgs e) => { e.Cancel = true; }); //restriction should be applicable only for budgeting. EmployeeCostEngine costEngine = new EmployeeCostEngine(registerEntry); registerEntry.Views.Caches.Add(typeof(EPActivityApprove)); PXCache activityCache = registerEntry.Caches <EPActivityApprove>(); registerEntry.Document.Cache.Insert(); bool success = true; activityAdded = false; for (int i = 0; i < activities.Count; i++) { //Check the UNMERGED state of Released (it could be set to true just now by the calling code): EPActivityApprove activity = PXSelect <EPActivityApprove> .Search <EPActivityApprove.noteID>(registerEntry, activities[i].NoteID); if (activity.Released == true) //activity can be released to PM via Timecard prior to releasing the case. { continue; } try { if (activity.ProjectTaskID != null) //cost transactions are created only if project is set. { EPEmployee employee = PXSelect <EPEmployee> .Search <EPEmployee.userID>(registerEntry, activity.OwnerID); activity.LabourItemID = costEngine.GetLaborClass(activity); if (activity.LabourItemID == null) { throw new PXException(Messages.CannotFindLabor, employee.AcctName); } activityCache.Update(activity); var cost = costEngine.CalculateEmployeeCost(activity.TimeCardCD, activity.EarningTypeID, activity.LabourItemID, activity.ProjectID, activity.ProjectTaskID, activity.CertifiedJob, activity.UnionID, employee.BAccountID, activity.Date.Value); if (cost == null) { throw new PXException(Messages.EmployeeCostRateNotFound); } EPSetup epsetup = PXSelect <EPSetup> .Select(registerEntry); if (epsetup.PostingOption != EPPostOptions.DoNotPost) { registerEntry.CreateTransaction(activity, employee.BAccountID, activity.Date.Value, activity.TimeSpent, activity.TimeBillable, cost.Rate, cost.OvertimeMultiplier); } activity.EmployeeRate = cost.Rate; activityAdded = true; } activity.Released = true; activity.ApprovalStatus = ActivityStatusAttribute.Released; if (activity.RefNoteID != null) { PXUpdate < Set <CRActivity.isLocked, True>, CRActivity, Where <CRActivity.noteID, Equal <Required <CRActivity.noteID> > > > .Update(registerEntry, activity.RefNoteID); } activityCache.Update(activity); } catch (Exception e) { PXProcessing <EPActivityApprove> .SetError(i, e is PXOuterException?e.Message + "\r\n" + String.Join("\r\n", ((PXOuterException)e).InnerMessages) : e.Message); success = false; } } if (activityAdded) { registerEntry.Save.Press(); } else { activityCache.Persist(PXDBOperation.Update); registerEntry.SelectTimeStamp(); } return(success); }