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 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 EPActivityFilter_TillDate_FieldUpdated(PXCache sender, PXFieldUpdatedEventArgs e) { EPActivityFilter row = (EPActivityFilter)e.Row; if (row != null && e.ExternalCall && row.FromDate != null && row.FromDate > row.TillDate) { row.FromDate = row.TillDate; } }
protected virtual void EPActivityApprove_RowSelected(PXCache sender, PXRowSelectedEventArgs e) { EPActivityApprove row = (EPActivityApprove)e.Row; EPActivityFilter rowFilter = (EPActivityFilter)Filter.Current; if (row == null || rowFilter == null) { return; } if (row.Released == true) { PXUIFieldAttribute.SetEnabled(sender, row, false); EPStartDateAttribute.SetTimeEnabled <EPActivityApprove.startDate>(sender, row, false); EPStartDateAttribute.SetDateEnabled <EPActivityApprove.startDate>(sender, row, false); } else if (row.UIStatus == CR.ActivityStatusListAttribute.Open || row.UIStatus == CR.ActivityStatusListAttribute.Completed) { PXUIFieldAttribute.SetEnabled(sender, row, true); PXUIEnabledAttribute.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 == PMProject.ProjectBaseType.Project); } else { PXUIFieldAttribute.SetEnabled <EPActivityApprove.projectTaskID>(sender, row, rowFilter.ProjectTaskID == null); } EPStartDateAttribute.SetTimeEnabled <EPActivityApprove.startDate>(sender, row, true); EPStartDateAttribute.SetDateEnabled <EPActivityApprove.startDate>(sender, row, true); PXUIFieldAttribute.SetEnabled <EPActivityApprove.uistatus>(sender, row, false); PXUIFieldAttribute.SetEnabled <EPActivityApprove.approverID>(sender, row, false); PXUIFieldAttribute.SetEnabled <EPActivityApprove.timeCardCD>(sender, row, false); } else { PXUIFieldAttribute.SetEnabled(sender, row, false); EPStartDateAttribute.SetTimeEnabled <EPActivityApprove.startDate>(sender, row, false); EPStartDateAttribute.SetDateEnabled <EPActivityApprove.startDate>(sender, row, false); PXUIFieldAttribute.SetEnabled <EPActivityApprove.hold>(sender, row, true); } PXUIFieldAttribute.SetEnabled <EPActivityApprove.approvalStatus>(sender, row, false); if (row.UIStatus == CR.ActivityStatusListAttribute.Rejected) { sender.RaiseExceptionHandling <EPActivityApprove.hold>(row, null, new PXSetPropertyException(Messages.Rejected, PXErrorLevel.RowWarning)); } }
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 IEnumerable activity() { List <object> args = new List <object>(); EPActivityFilter filterRow = Filter.Current; if (filterRow == null) { return(null); } PXSelectBase <EPActivityApprove> cmd; cmd = new PXSelectJoin <EPActivityApprove , LeftJoin <EPEarningType, On <EPEarningType.typeCD, Equal <EPActivityApprove.earningTypeID> > , LeftJoin <CRCase, On <CRCase.noteID, Equal <EPActivityApprove.refNoteID> > , LeftJoin <Contract, On <CRCase.contractID, Equal <Contract.contractID> > > > > , Where <EPActivityApprove.owner, Equal <Current <EPActivityFilter.ownerID> > , And <EPActivityApprove.isCorrected, Equal <False> , And <EPActivityApprove.trackTime, Equal <True> , And <EPActivityApprove.classID, NotEqual <CRActivityClass.emailRouting> , And <EPActivityApprove.classID, NotEqual <CRActivityClass.task> , And <EPActivityApprove.classID, NotEqual <CRActivityClass.events> > > > > > > , OrderBy <Desc <EPActivityApprove.startDate> > >(this); if (filterRow.FromDate != null) { cmd.WhereAnd <Where <EPActivityApprove.startDate, GreaterEqual <Required <EPActivityFilter.fromDate> > > >(); args.Add(filterRow.FromDate); } if (filterRow.TillDate != null) { cmd.WhereAnd <Where <EPActivityApprove.startDate, Less <Required <EPActivityFilter.tillDate> > > >(); args.Add(filterRow.TillDate.Value.AddDays(1)); } if (filterRow.ProjectID != null) { cmd.WhereAnd <Where <EPActivityApprove.projectID, Equal <Current <EPActivityFilter.projectID> > > >(); } if (filterRow.ProjectTaskID != null) { cmd.WhereAnd <Where <EPActivityApprove.projectTaskID, Equal <Current <EPActivityFilter.projectTaskID> > > >(); } if (filterRow.IncludeReject == true) { cmd.WhereOr <Where <EPActivityApprove.uistatus, Equal <CR.ActivityStatusListAttribute.rejected> > >(); } return(cmd.Select(args.ToArray())); }