Пример #1
0
        protected virtual void openAppointment()
        {
            if (Base.Activities.Current != null)
            {
                FSxPMTimeActivity fsxPMTimeActivityRow = Base.Activities.Cache.GetExtension <FSxPMTimeActivity>(Base.Activities.Current);

                AppointmentEntry graph            = PXGraph.CreateInstance <AppointmentEntry>();
                FSAppointment    fsAppointmentRow = (FSAppointment)PXSelect <FSAppointment,
                                                                             Where <
                                                                                 FSAppointment.appointmentID, Equal <Required <FSAppointment.appointmentID> > > >
                                                    .Select(Base, fsxPMTimeActivityRow.AppointmentID);

                if (fsAppointmentRow != null)
                {
                    graph.AppointmentRecords.Current = graph.AppointmentRecords.Search <FSAppointment.refNbr>(fsAppointmentRow.RefNbr, fsAppointmentRow.SrvOrdType);

                    if (graph.AppointmentRecords.Current != null)
                    {
                        throw new PXRedirectRequiredException(graph, null)
                              {
                                  Mode = PXBaseRedirectException.WindowMode.NewWindow
                              };
                    }
                }
            }
        }
Пример #2
0
        protected virtual void NormalizeTimecard()
        {
            foreach (TimeCardMaint.EPTimecardDetail item in Base.Activities.Select())
            {
                FSxPMTimeActivity fsxPMTimeActivityRow = Base.Activities.Cache.GetExtension <FSxPMTimeActivity>(item);

                if (fsxPMTimeActivityRow.AppointmentID != null)
                {
                    Base.Activities.Cache.SetValue <FSxPMTimeActivity.lastBillable>(item, item.IsBillable);
                    Base.Activities.Cache.SetValue <TimeCardMaint.EPTimecardDetail.isBillable>(item, true);
                }
            }

            Base.normalizeTimecard.Press();

            foreach (TimeCardMaint.EPTimecardDetail item in Base.Activities.Select())
            {
                FSxPMTimeActivity fsxPMTimeActivityRow = Base.Activities.Cache.GetExtension <FSxPMTimeActivity>(item);

                if (fsxPMTimeActivityRow.AppointmentID != null)
                {
                    Base.Activities.Cache.SetValue <TimeCardMaint.EPTimecardDetail.isBillable>(item, fsxPMTimeActivityRow.LastBillable);
                    Base.Activities.Cache.SetValue <FSxPMTimeActivity.lastBillable>(item, false);
                    Base.Activities.Cache.SetStatus(item, PXEntryStatus.Updated);
                    Base.Save.Press();
                }
            }
        }
        private void UpdateSODetServiceRow(
            ServiceOrderEntry graphServiceOrder,
            FSSODetService fsSODetServiceRow,
            PMTimeActivity pmTimeActivity,
            FSxPMTimeActivity fsxPMTimeActivity)
        {
            //TODO SD-7788
            //**************************************************************
            // Update all FSSODetService fields but key fields *************
            //**************************************************************
            if (fsSODetServiceRow.LineType != ID.LineType_ServiceTemplate.SERVICE)
            {
                graphServiceOrder.ServiceOrderDetServices.SetValueExt <FSSODetService.lineType>(fsSODetServiceRow, ID.LineType_ServiceTemplate.SERVICE);
            }

            if (fsSODetServiceRow.InventoryID != fsxPMTimeActivity.ServiceID)
            {
                graphServiceOrder.ServiceOrderDetServices.SetValueExt <FSSODetService.inventoryID>(fsSODetServiceRow, fsxPMTimeActivity.ServiceID);
            }

            if (fsSODetServiceRow.ProjectID != pmTimeActivity.ProjectID)
            {
                graphServiceOrder.ServiceOrderDetServices.SetValueExt <FSSODetService.projectID>(fsSODetServiceRow, pmTimeActivity.ProjectID);
            }

            if (fsSODetServiceRow.ProjectTaskID != pmTimeActivity.ProjectTaskID)
            {
                graphServiceOrder.ServiceOrderDetServices.SetValueExt <FSSODetService.projectTaskID>(fsSODetServiceRow, pmTimeActivity.ProjectTaskID);
            }

            if (fsSODetServiceRow.CostCodeID != pmTimeActivity.CostCodeID)
            {
                graphServiceOrder.ServiceOrderDetServices.SetValueExt <FSSODetService.costCodeID>(fsSODetServiceRow, pmTimeActivity.CostCodeID);
            }
        }
Пример #4
0
        public virtual void UpdateServiceOrderDetail(PXCache cache, CRActivity crActivityRow, PXDBOperation operation)
        {
            FSServiceOrder fsServiceOrderRow = GetServiceOrderRecord(cache.Graph, crActivityRow);

            if (fsServiceOrderRow != null)
            {
                PMTimeActivity pmTimeActivityRow = PXSelect <PMTimeActivity,
                                                             Where <
                                                                 PMTimeActivity.refNoteID, Equal <Required <PMTimeActivity.refNoteID> > > >
                                                   .Select(Base, crActivityRow.NoteID);

                if (pmTimeActivityRow == null)
                {
                    return;
                }

                FSxPMTimeActivity fsxPMTimeActivityRow = PXCache <PMTimeActivity> .GetExtension <FSxPMTimeActivity>(pmTimeActivityRow);

                ServiceOrderEntry graphServiceOrder = PXGraph.CreateInstance <ServiceOrderEntry>();

                //Load existing ServiceOrder
                graphServiceOrder.ServiceOrderRecords.Current = graphServiceOrder.ServiceOrderRecords
                                                                .Search <FSServiceOrder.refNbr>(fsServiceOrderRow.RefNbr, fsServiceOrderRow.SrvOrdType);

                //Update ServiceOrder detail
                InsertUpdateDeleteSODet(graphServiceOrder, pmTimeActivityRow, fsxPMTimeActivityRow, operation);

                if (graphServiceOrder.IsDirty)
                {
                    graphServiceOrder.Save.Press();
                }
            }
        }
Пример #5
0
        public static void PMTimeActivity_RowSelected_Handler(PXCache cache, PMTimeActivity pmTimeActivityRow)
        {
            FSxPMTimeActivity fsxPMTimeActivityRow = cache.GetExtension <FSxPMTimeActivity>(pmTimeActivityRow);

            PXUIFieldAttribute.SetEnabled <FSxPMTimeActivity.appointmentID>(cache, pmTimeActivityRow, false);
            PXUIFieldAttribute.SetEnabled <FSxPMTimeActivity.appointmentCustomerID>(cache, pmTimeActivityRow, false);
            PXUIFieldAttribute.SetEnabled <FSxPMTimeActivity.sOID>(cache, pmTimeActivityRow, false);
            PXUIFieldAttribute.SetEnabled <FSxPMTimeActivity.appEmpID>(cache, pmTimeActivityRow, false);
            PXUIFieldAttribute.SetEnabled <FSxPMTimeActivity.serviceID>(cache, pmTimeActivityRow, false);
        }
Пример #6
0
        public static void PMTimeActivity_RowPersisting_Handler(PXCache cache, PXGraph graph, PMTimeActivity pmTimeActivityRow, PXRowPersistingEventArgs e)
        {
            FSxPMTimeActivity fsxPMTimeActivityRow = PXCache <PMTimeActivity> .GetExtension <FSxPMTimeActivity>(pmTimeActivityRow);

            if (e.Operation == PXDBOperation.Delete &&
                graph.Accessinfo.ScreenID != SharedFunctions.SetScreenIDToDotFormat(ID.ScreenID.APPOINTMENT))
            {
                if (fsxPMTimeActivityRow.AppointmentID != null &&
                    fsxPMTimeActivityRow.AppEmpID != null)
                {
                    PXUpdate <Set <FSAppointmentEmployee.trackTime, False>,
                              FSAppointmentEmployee,
                              Where <
                                  FSAppointmentEmployee.appointmentID, Equal <Required <FSAppointmentEmployee.appointmentID> >,
                                  And <FSAppointmentEmployee.lineNbr, Equal <Required <FSAppointmentEmployee.lineNbr> > > > >
                    .Update(graph, fsxPMTimeActivityRow.AppointmentID, fsxPMTimeActivityRow.AppEmpID);
                }
            }

            if ((e.Operation == PXDBOperation.Insert || e.Operation == PXDBOperation.Update) &&
                graph.Accessinfo.ScreenID != SharedFunctions.SetScreenIDToDotFormat(ID.ScreenID.APPOINTMENT))
            {
                if (fsxPMTimeActivityRow.AppointmentID != null &&
                    fsxPMTimeActivityRow.AppEmpID != null &&
                    fsxPMTimeActivityRow.ServiceID != null &&
                    (int?)cache.GetValueOriginal <EPActivityApprove.timeSpent>(pmTimeActivityRow) != pmTimeActivityRow.TimeSpent)
                {
                    AppointmentEntry graphAppointmentEntry = PXGraph.CreateInstance <AppointmentEntry>();

                    FSAppointment fsAppointmentRow = PXSelect <FSAppointment,
                                                               Where <FSAppointment.appointmentID, Equal <Required <FSAppointment.appointmentID> > > >
                                                     .Select(graph, fsxPMTimeActivityRow.AppointmentID);

                    FSAppointmentEmployee fsAppointmentEmployeeRow = PXSelect <FSAppointmentEmployee,
                                                                               Where <
                                                                                   FSAppointmentEmployee.appointmentID, Equal <Required <FSAppointmentEmployee.appointmentID> >,
                                                                                   And <FSAppointmentEmployee.lineNbr, Equal <Required <FSAppointmentEmployee.lineNbr> > > > >
                                                                     .Select(graph, fsxPMTimeActivityRow.AppointmentID, fsxPMTimeActivityRow.AppEmpID);

                    fsAppointmentRow = graphAppointmentEntry.AppointmentRecords.Current = graphAppointmentEntry.AppointmentRecords.Search <FSAppointment.appointmentID>
                                                                                              (fsAppointmentRow.AppointmentID, fsAppointmentRow.SrvOrdType);

                    graphAppointmentEntry.SkipTimeCardUpdate = true;
                    fsAppointmentEmployeeRow.ActualDuration  = pmTimeActivityRow.TimeSpent;
                    AppointmentDateTimeHelper.UpdateStaffActualDateTimeEndFromActualDuration(fsAppointmentEmployeeRow);
                    fsAppointmentEmployeeRow.EarningType = pmTimeActivityRow.EarningTypeID;
                    fsAppointmentEmployeeRow             = graphAppointmentEntry.AppointmentEmployees.Update(fsAppointmentEmployeeRow);
                    graphAppointmentEntry.Save.Press();
                }
            }
        }
        private void UpdateSubject(PXCache cache, PMTimeActivity pmTimeActivityRow, CRActivity crActivityRow)
        {
            FSxPMTimeActivity fsxPMTimeActivityRow = cache.GetExtension <FSxPMTimeActivity>(pmTimeActivityRow);

            //Clean the Subject
            if (crActivityRow.Subject != null)
            {
                int positionPipe = crActivityRow.Subject.IndexOf("|");

                if (positionPipe != -1)
                {
                    crActivityRow.Subject = crActivityRow.Subject.Substring(positionPipe + 1).Trim();

                    if (crActivityRow.Subject == string.Empty)
                    {
                        crActivityRow.Subject = null;
                    }
                }
            }

            if (fsxPMTimeActivityRow.ServiceID != null)
            {
                InventoryItem inventoryItemRow = PXSelect <InventoryItem,
                                                           Where <
                                                               InventoryItem.inventoryID, Equal <Required <InventoryItem.inventoryID> > > >
                                                 .Select(Base, fsxPMTimeActivityRow.ServiceID);

                if (inventoryItemRow != null)
                {
                    if (inventoryItemRow.ItemType == INItemTypes.ServiceItem)
                    {
                        if (string.IsNullOrWhiteSpace(crActivityRow.Subject))
                        {
                            crActivityRow.Subject = string.Empty;
                        }

                        crActivityRow.Subject = TX.ModuleName.SERVICE_DESCRIPTOR + inventoryItemRow.Descr + " | " + crActivityRow.Subject;
                    }
                }
            }
        }
Пример #8
0
        /// <summary>
        /// Update ApprovedTime and actualDuration fields in the <c>AppointmentDetInfo</c> lines.
        /// </summary>
        public virtual void UpdateAppointmentFromApprovedTimeCard(PXCache cache)
        {
            FSxPMTimeActivity fsxPMTimeActivityRow = null;

            var graphAppointmentEntry = PXGraph.CreateInstance <AppointmentEntry>();

            foreach (TimeCardMaint.EPTimecardDetail ePTimeCardDetailRow in this.Base.Activities.Select())
            {
                fsxPMTimeActivityRow = this.Base.Activities.Cache.GetExtension <FSxPMTimeActivity>(ePTimeCardDetailRow);

                if (fsxPMTimeActivityRow.LogLineNbr.HasValue == false)
                {
                    continue;
                }

                FSAppointment fsAppointmentRow = PXSelect <FSAppointment,
                                                           Where <
                                                               FSAppointment.appointmentID, Equal <Required <FSAppointment.appointmentID> > > >
                                                 .Select(Base, fsxPMTimeActivityRow.AppointmentID);

                FSAppointmentLog fsAppointmentLogRow = PXSelect <FSAppointmentLog,
                                                                 Where <
                                                                     FSAppointmentLog.docID, Equal <Required <FSAppointmentLog.docID> >,
                                                                     And <FSAppointmentLog.lineNbr, Equal <Required <FSAppointmentLog.lineNbr> > > > >
                                                       .Select(Base, fsxPMTimeActivityRow.AppointmentID, fsxPMTimeActivityRow.LogLineNbr);

                graphAppointmentEntry.SkipTimeCardUpdate = true;

                fsAppointmentRow = graphAppointmentEntry.AppointmentRecords.Current = graphAppointmentEntry.AppointmentRecords.Search <FSAppointment.appointmentID>
                                                                                          (fsAppointmentRow.AppointmentID, fsAppointmentRow.SrvOrdType);

                fsAppointmentLogRow.TimeCardCD   = ePTimeCardDetailRow.TimeCardCD;
                fsAppointmentLogRow.ApprovedTime = true;
                fsAppointmentLogRow = graphAppointmentEntry.LogRecords.Update(fsAppointmentLogRow);

                graphAppointmentEntry.Save.Press();
            }
        }
        private void InsertUpdateDeleteSODet(
            ServiceOrderEntry graphServiceOrder,
            PMTimeActivity pmTimeActivityRow,
            FSxPMTimeActivity fsxPMTimeActivityRow,
            PXDBOperation operation)
        {
            FSSODetService fsSODetServiceRow;

            graphServiceOrder.ServiceOrderDetServices.Current = graphServiceOrder.ServiceOrderDetServices
                                                                .Search <FSSODet.sourceNoteID>(pmTimeActivityRow.NoteID);
            if (graphServiceOrder.ServiceOrderDetServices.Current != null)
            {
                if (operation == PXDBOperation.Delete || fsxPMTimeActivityRow.ServiceID == null)
                {
                    graphServiceOrder.ServiceOrderDetServices.Delete(graphServiceOrder.ServiceOrderDetServices.Current);
                    return;
                }
            }
            else
            {
                //This line does not require appointment
                if (fsxPMTimeActivityRow.ServiceID == null)
                {
                    return;
                }

                //Insert a new SODet line
                fsSODetServiceRow = new FSSODetService();

                //Assign the PMTimeActivity reference to the new FSSODet line
                fsSODetServiceRow.SourceNoteID = pmTimeActivityRow.NoteID;

                graphServiceOrder.ServiceOrderDetServices.Current = graphServiceOrder.ServiceOrderDetServices.Insert(fsSODetServiceRow);
            }

            //Update the SODet line
            UpdateSODetServiceRow(graphServiceOrder, graphServiceOrder.ServiceOrderDetServices.Current, pmTimeActivityRow, fsxPMTimeActivityRow);
        }
Пример #10
0
        public static void InsertUpdateEPActivityApprove(
            PXGraph graph,
            EmployeeActivitiesEntry graphEmployeeActivitiesEntry,
            FSAppointmentEmployee fsAppointmentEmployeeRow,
            FSAppointment fsAppointmentRow,
            FSServiceOrder fsServiceOrderRow,
            EPActivityApprove epActivityApproveRow,
            TMEPEmployee epEmployeeRow)
        {
            if (epActivityApproveRow != null &&
                (epActivityApproveRow.ApprovalStatus == ActivityStatusListAttribute.Approved || epActivityApproveRow.TimeCardCD != null))
            {
                return;
            }

            FSAppointmentDetService fsAppointmentDetServiceRow =
                PXSelectJoin <FSAppointmentDetService,
                              InnerJoin <FSSODet,
                                         On <FSSODet.sODetID, Equal <FSAppointmentDetService.sODetID> > >,
                              Where <
                                  FSSODet.lineRef, Equal <Required <FSSODet.lineRef> >,
                                  And <FSSODet.sOID, Equal <Required <FSAppointment.sOID> > > > >
                .Select(graph, fsAppointmentEmployeeRow.ServiceLineRef, fsAppointmentRow.SOID);

            if (fsAppointmentDetServiceRow != null &&
                fsAppointmentDetServiceRow.Status == ID.Status_AppointmentDet.CANCELED)
            {
                return;
            }

            if (epActivityApproveRow == null)
            {
                epActivityApproveRow         = new EPActivityApprove();
                epActivityApproveRow.OwnerID = epEmployeeRow.PKID;
                epActivityApproveRow         = graphEmployeeActivitiesEntry.Activity.Insert(epActivityApproveRow);
            }

            graphEmployeeActivitiesEntry.Activity.SetValueExt <EPActivityApprove.hold>(epActivityApproveRow, false);
            epActivityApproveRow.Date          = SharedFunctions.GetCustomDateTime(fsAppointmentRow.ExecutionDate, fsAppointmentEmployeeRow.ActualDateTimeBegin);
            epActivityApproveRow.EarningTypeID = fsAppointmentEmployeeRow.EarningType;
            epActivityApproveRow.TimeSpent     = fsAppointmentEmployeeRow.ActualDuration;
            epActivityApproveRow.Summary       = GetDescriptionToUseInEPActivityApprove(fsAppointmentRow, fsAppointmentEmployeeRow, fsAppointmentDetServiceRow);
            epActivityApproveRow.CostCodeID    = fsAppointmentEmployeeRow?.CostCodeID;

            FSxPMTimeActivity fsxPMTimeActivityRow = PXCache <PMTimeActivity> .GetExtension <FSxPMTimeActivity>((PMTimeActivity)epActivityApproveRow);

            fsxPMTimeActivityRow.SOID                  = fsAppointmentRow.SOID;
            fsxPMTimeActivityRow.AppointmentID         = fsAppointmentRow.AppointmentID;
            fsxPMTimeActivityRow.AppointmentCustomerID = fsServiceOrderRow.CustomerID;
            fsxPMTimeActivityRow.AppEmpID              = fsAppointmentEmployeeRow.LineNbr;

            if (fsAppointmentEmployeeRow.ServiceLineRef != null)
            {
                fsxPMTimeActivityRow.ServiceID = fsAppointmentDetServiceRow == null ? null : fsAppointmentDetServiceRow.InventoryID;
            }

            epActivityApproveRow = graphEmployeeActivitiesEntry.Activity.Update(epActivityApproveRow);

            graphEmployeeActivitiesEntry.Activity.SetValueExt <EPActivityApprove.projectID>(epActivityApproveRow, fsServiceOrderRow.ProjectID);
            graphEmployeeActivitiesEntry.Activity.SetValueExt <EPActivityApprove.projectTaskID>(epActivityApproveRow, GetProjectTaskIDToUseInEPActivityApprove(fsAppointmentRow, fsAppointmentEmployeeRow, fsAppointmentDetServiceRow));
            graphEmployeeActivitiesEntry.Activity.SetValueExt <EPActivityApprove.isBillable>(epActivityApproveRow, false);
            graphEmployeeActivitiesEntry.Activity.SetValueExt <EPActivityApprove.approvalStatus>(epActivityApproveRow, GetStatusToUseInEPActivityApprove());
            graphEmployeeActivitiesEntry.Activity.SetValueExt <EPActivityApprove.labourItemID>(epActivityApproveRow, fsAppointmentEmployeeRow.LaborItemID);

            graphEmployeeActivitiesEntry.Save.Press();
        }
Пример #11
0
        public static void PMTimeActivity_RowPersisting_Handler(PXCache cache, PXGraph graph, PMTimeActivity pmTimeActivityRow, PXRowPersistingEventArgs e)
        {
            FSxPMTimeActivity fsxPMTimeActivityRow = PXCache <PMTimeActivity> .GetExtension <FSxPMTimeActivity>(pmTimeActivityRow);

            if (e.Operation == PXDBOperation.Delete &&
                graph.Accessinfo.ScreenID != SharedFunctions.SetScreenIDToDotFormat(ID.ScreenID.APPOINTMENT))
            {
                if (fsxPMTimeActivityRow.AppointmentID != null &&
                    fsxPMTimeActivityRow.LogLineNbr != null)
                {
                    PXUpdate <
                        Set <FSAppointmentLog.trackTime, False>,
                        FSAppointmentLog,
                        Where <
                            FSAppointmentLog.docID, Equal <Required <FSAppointmentLog.docID> >,
                            And <FSAppointmentLog.lineNbr, Equal <Required <FSAppointmentLog.lineNbr> > > > >
                    .Update(graph, fsxPMTimeActivityRow.AppointmentID, fsxPMTimeActivityRow.LogLineNbr);
                }
            }

            if ((e.Operation == PXDBOperation.Insert || e.Operation == PXDBOperation.Update) &&
                !IsAccessedFromAppointment(graph.Accessinfo.ScreenID))
            {
                if (fsxPMTimeActivityRow.AppointmentID != null &&
                    fsxPMTimeActivityRow.LogLineNbr != null &&
                    (
                        (int?)cache.GetValueOriginal <EPActivityApprove.timeSpent>(pmTimeActivityRow) != pmTimeActivityRow.TimeSpent ||
                        (int?)cache.GetValueOriginal <EPActivityApprove.timeBillable>(pmTimeActivityRow) != pmTimeActivityRow.TimeBillable ||
                        (bool?)cache.GetValueOriginal <EPActivityApprove.isBillable>(pmTimeActivityRow) != pmTimeActivityRow.IsBillable))
                {
                    AppointmentEntry graphAppointmentEntry = PXGraph.CreateInstance <AppointmentEntry>();

                    FSAppointment fsAppointmentRow = PXSelect <FSAppointment,
                                                               Where <
                                                                   FSAppointment.appointmentID, Equal <Required <FSAppointment.appointmentID> > > >
                                                     .Select(graph, fsxPMTimeActivityRow.AppointmentID);

                    FSAppointmentLog fsAppointmentLogRow = PXSelect <FSAppointmentLog,
                                                                     Where <
                                                                         FSAppointmentLog.docID, Equal <Required <FSAppointmentLog.docID> >,
                                                                         And <FSAppointmentLog.lineNbr, Equal <Required <FSAppointmentLog.lineNbr> > > > >
                                                           .Select(graph, fsxPMTimeActivityRow.AppointmentID, fsxPMTimeActivityRow.LogLineNbr);

                    fsAppointmentRow = graphAppointmentEntry.AppointmentRecords.Current = graphAppointmentEntry.AppointmentRecords.Search <FSAppointment.appointmentID>
                                                                                              (fsAppointmentRow.AppointmentID, fsAppointmentRow.SrvOrdType);

                    graphAppointmentEntry.SkipTimeCardUpdate = true;
                    fsAppointmentLogRow.TimeDuration         = pmTimeActivityRow.TimeSpent;
                    fsAppointmentLogRow.EarningType          = pmTimeActivityRow.EarningTypeID;

                    FSSrvOrdType fsSrvOrdTypeRow = graphAppointmentEntry.ServiceOrderTypeSelected.Current;

                    if (fsSrvOrdTypeRow != null &&
                        fsSrvOrdTypeRow.PostTo == ID.SrvOrdType_PostTo.PROJECTS &&
                        fsSrvOrdTypeRow.BillingType == ID.SrvOrdType_BillingType.COST_AS_COST &&
                        fsSrvOrdTypeRow.CreateTimeActivitiesFromAppointment == true)
                    {
                        fsAppointmentLogRow.IsBillable           = pmTimeActivityRow.IsBillable;
                        fsAppointmentLogRow.BillableTimeDuration = pmTimeActivityRow.TimeBillable;
                    }

                    fsAppointmentLogRow = graphAppointmentEntry.LogRecords.Update(fsAppointmentLogRow);
                    graphAppointmentEntry.Save.Press();
                }
            }
        }
Пример #12
0
        public static void InsertUpdateEPActivityApprove(PXGraph graph,
                                                         EmployeeActivitiesEntry graphEmployeeActivitiesEntry,
                                                         FSAppointmentLog fsAppointmentLogRow,
                                                         FSAppointment fsAppointmentRow,
                                                         FSServiceOrder fsServiceOrderRow,
                                                         EPActivityApprove epActivityApproveRow,
                                                         TMEPEmployee epEmployeeRow)
        {
            if (epActivityApproveRow != null &&
                (epActivityApproveRow.ApprovalStatus == ActivityStatusListAttribute.Approved || epActivityApproveRow.TimeCardCD != null))
            {
                return;
            }

            FSAppointmentDet fsAppointmentDetServiceRow =
                PXSelect <FSAppointmentDet,
                          Where <
                              FSAppointmentDet.lineRef, Equal <Required <FSAppointmentDet.lineRef> >,
                              And <FSAppointmentDet.appointmentID, Equal <Required <FSAppointmentDet.appointmentID> > > > >
                .Select(graph, fsAppointmentLogRow.DetLineRef, fsAppointmentRow.AppointmentID);

            if (fsAppointmentDetServiceRow != null &&
                fsAppointmentDetServiceRow.IsCanceledNotPerformed == true)
            {
                return;
            }

            if (epActivityApproveRow == null)
            {
                epActivityApproveRow         = new EPActivityApprove();
                epActivityApproveRow.OwnerID = epEmployeeRow.PKID;
                epActivityApproveRow         = graphEmployeeActivitiesEntry.Activity.Insert(epActivityApproveRow);
            }

            graphEmployeeActivitiesEntry.Activity.SetValueExt <EPActivityApprove.hold>(epActivityApproveRow, false);
            epActivityApproveRow.Date          = PXDBDateAndTimeAttribute.CombineDateTime(fsAppointmentRow.ExecutionDate, fsAppointmentLogRow.DateTimeBegin);
            epActivityApproveRow.EarningTypeID = fsAppointmentLogRow.EarningType;
            epActivityApproveRow.TimeSpent     = fsAppointmentLogRow.TimeDuration;
            epActivityApproveRow.Summary       = GetDescriptionToUseInEPActivityApprove(fsAppointmentRow, fsAppointmentLogRow, fsAppointmentDetServiceRow);
            epActivityApproveRow.CostCodeID    = fsAppointmentLogRow?.CostCodeID;

            FSxPMTimeActivity fsxPMTimeActivityRow = PXCache <PMTimeActivity> .GetExtension <FSxPMTimeActivity>((PMTimeActivity)epActivityApproveRow);

            fsxPMTimeActivityRow.SOID                  = fsAppointmentRow.SOID;
            fsxPMTimeActivityRow.AppointmentID         = fsAppointmentRow.AppointmentID;
            fsxPMTimeActivityRow.AppointmentCustomerID = fsServiceOrderRow.CustomerID;
            fsxPMTimeActivityRow.LogLineNbr            = fsAppointmentLogRow.LineNbr;

            if (fsAppointmentLogRow.DetLineRef != null)
            {
                fsxPMTimeActivityRow.ServiceID = fsAppointmentDetServiceRow == null ? null : fsAppointmentDetServiceRow.InventoryID;
            }

            epActivityApproveRow = graphEmployeeActivitiesEntry.Activity.Update(epActivityApproveRow);

            graphEmployeeActivitiesEntry.Activity.SetValueExt <EPActivityApprove.projectID>(epActivityApproveRow, fsServiceOrderRow.ProjectID);
            graphEmployeeActivitiesEntry.Activity.SetValueExt <EPActivityApprove.projectTaskID>(epActivityApproveRow, GetProjectTaskIDToUseInEPActivityApprove(fsAppointmentRow, fsAppointmentLogRow, fsAppointmentDetServiceRow));
            graphEmployeeActivitiesEntry.Activity.SetValueExt <EPActivityApprove.isBillable>(epActivityApproveRow, fsAppointmentLogRow.IsBillable);
            graphEmployeeActivitiesEntry.Activity.SetValueExt <EPActivityApprove.timeBillable>(epActivityApproveRow, fsAppointmentLogRow.BillableTimeDuration);
            graphEmployeeActivitiesEntry.Activity.SetValueExt <EPActivityApprove.approvalStatus>(epActivityApproveRow, GetStatusToUseInEPActivityApprove());
            graphEmployeeActivitiesEntry.Activity.SetValueExt <EPActivityApprove.labourItemID>(epActivityApproveRow, fsAppointmentLogRow.LaborItemID);
        }