protected virtual void EPSummaryFilter_RowSelected(PXCache sender, PXRowSelectedEventArgs e) { EPSummaryFilter row = (EPSummaryFilter)e.Row; if (row != null) { row.RegularTime = 0; row.RegularOvertime = 0; row.RegularTotal = 0; foreach (PXResult <EPSummaryApprove, EPEarningType> item in Summary.Select()) { EPSummaryApprove rowActivity = (EPSummaryApprove)item; EPEarningType rowEarningType = (EPEarningType)item; if (rowEarningType.IsOvertime == true) { row.RegularOvertime += rowActivity.TimeSpent.GetValueOrDefault(0); } else { row.RegularTime += rowActivity.TimeSpent.GetValueOrDefault(0); } row.RegularTotal = row.RegularTime + row.RegularOvertime; } } }
protected virtual void EPSummaryApprove_RowPersisting(PXCache sender, PXRowPersistingEventArgs e) { EPSummaryApprove row = (EPSummaryApprove)e.Row; if (row == null || e.Operation == PXDBOperation.Delete) { return; } if (row.IsApprove == true && row.IsReject == true) { return; } PXResultset <PMTimeActivity> activityList = PXSelectJoin < PMTimeActivity, InnerJoin <EPTimeCard, On <Required <EPTimeCardSummary.timeCardCD>, Equal <EPTimeCard.timeCardCD>, And <EPTimeCard.weekId, Equal <PMTimeActivity.weekID> > >, InnerJoin <CREmployee, On <EPTimeCard.employeeID, Equal <CREmployee.bAccountID>, And <CREmployee.userID, Equal <PMTimeActivity.ownerID> > > > >, Where < Required <EPTimeCardSummary.earningType>, Equal <PMTimeActivity.earningTypeID>, And <Required <EPTimeCardSummary.projectID>, Equal <PMTimeActivity.projectID>, And <Required <EPTimeCardSummary.projectTaskID>, Equal <PMTimeActivity.projectTaskID>, And <Required <EPTimeCardSummary.isBillable>, Equal <PMTimeActivity.isBillable>, And2 <Where <Required <EPTimeCardSummary.parentNoteID>, Equal <PMTimeActivity.parentTaskNoteID>, Or <Required <EPTimeCardSummary.parentNoteID>, IsNull, And <PMTimeActivity.parentTaskNoteID, IsNull> > >, And <PMTimeActivity.trackTime, Equal <True>, And <PMTimeActivity.released, Equal <False>, And <PMTimeActivity.trackTime, Equal <True>, And <PMTimeActivity.approverID, IsNotNull, And <Where <PMTimeActivity.approvalStatus, NotEqual <ActivityStatusListAttribute.canceled>, And <PMTimeActivity.approvalStatus, NotEqual <ActivityStatusListAttribute.open> > > > > > > > > > > > > > .Select(this, row.TimeCardCD, row.EarningType, row.ProjectID, row.ProjectTaskID, row.IsBillable, row.ParentNoteID, row.ParentNoteID); foreach (PMTimeActivity act in activityList) { if (row.IsApprove == true) { if (act.ApprovalStatus != ActivityStatusListAttribute.Approved) { activity.Cache.SetValueExt <PMTimeActivity.approvalStatus>(act, ActivityStatusListAttribute.Approved); activity.Cache.SetValueExt <PMTimeActivity.approvedDate>(act, Accessinfo.BusinessDate); } } else if (row.IsReject == true) { if (act.ApprovalStatus != ActivityStatusListAttribute.Rejected) { activity.Cache.SetValueExt <PMTimeActivity.approvalStatus>(act, ActivityStatusListAttribute.Rejected); } } activity.Cache.Persist(act, PXDBOperation.Update); } }
protected virtual void EPSummaryApprove_RowSelected(PXCache sender, PXRowSelectedEventArgs e) { EPSummaryApprove row = (EPSummaryApprove)e.Row; if (row == null) { return; } PXUIFieldAttribute.SetEnabled(sender, row, false); if (row.HasComplite != null || row.HasReject != null || row.HasApprove != null) { PXUIFieldAttribute.SetEnabled <EPSummaryApprove.isApprove>(sender, row, true); PXUIFieldAttribute.SetEnabled <EPSummaryApprove.isReject>(sender, row, true); } if (row.HasOpen != null) { sender.RaiseExceptionHandling <EPSummaryApprove.weekId>(row, null, new PXSetPropertyException(EP.Messages.HasOpenActivity, PXErrorLevel.RowWarning)); } }