Exemplo n.º 1
0
        protected virtual void _(Events.RowPersisting <TimeCardMaint.EPTimecardDetail> e)
        {
            if (e.Row == null)
            {
                return;
            }

            TimeCardHelper.PMTimeActivity_RowPersisting_Handler(e.Cache, Base, (PMTimeActivity)e.Row, e.Args);
        }
Exemplo n.º 2
0
        protected virtual void EPActivityApprove_RowPersisting(PXCache cache, PXRowPersistingEventArgs e)
        {
            if (e.Row == null)
            {
                return;
            }

            TimeCardHelper.PMTimeActivity_RowPersisting_Handler(cache, Base, (PMTimeActivity)e.Row, e);
        }
        protected virtual void _(Events.RowPersisting <EPActivityApprove> e)
        {
            if (e.Row == null)
            {
                return;
            }

            TimeCardHelper.PMTimeActivity_RowPersisting_Handler(e.Cache, Base, (PMTimeActivity)e.Row, e.Args);
        }
Exemplo n.º 4
0
        protected virtual void _(Events.RowSelected <TimeCardMaint.EPTimecardDetail> e)
        {
            if (e.Row == null ||
                !TimeCardHelper.IsTheTimeCardIntegrationEnabled(Base))
            {
                return;
            }

            TimeCardMaint.EPTimecardDetail epTimeCardDetailRow = (TimeCardMaint.EPTimecardDetail)e.Row;
            TimeCardHelper.PMTimeActivity_RowSelected_Handler(e.Cache, epTimeCardDetailRow);
        }
Exemplo n.º 5
0
        protected virtual void EPActivityApprove_RowSelected(PXCache cache, PXRowSelectedEventArgs e)
        {
            if (e.Row == null ||
                !TimeCardHelper.IsTheTimeCardIntegrationEnabled(Base))
            {
                return;
            }

            EPActivityApprove epActivityApproveRow = (EPActivityApprove)e.Row;

            TimeCardHelper.PMTimeActivity_RowSelected_Handler(cache, epActivityApproveRow);
        }
        protected virtual void _(Events.RowSelected <EPActivityApprove> e)
        {
            if (e.Row == null ||
                !TimeCardHelper.IsTheTimeCardIntegrationEnabled(Base))
            {
                return;
            }

            EPActivityApprove epActivityApproveRow = (EPActivityApprove)e.Row;

            TimeCardHelper.PMTimeActivity_RowSelected_Handler(e.Cache, epActivityApproveRow);
        }
Exemplo n.º 7
0
        protected virtual void _(Events.RowSelected <EPTimeCard> e)
        {
            if (e.Row == null)
            {
                return;
            }

            EPTimeCard epTimeCardRow = (EPTimeCard)e.Row;

            bool enableEmpTimeCardIntegration = (bool)TimeCardHelper.IsTheTimeCardIntegrationEnabled(Base);

            PXUIFieldAttribute.SetVisible <FSxPMTimeActivity.appointmentID>(Base.Activities.Cache, Base.Activities.Current, enableEmpTimeCardIntegration);
            PXUIFieldAttribute.SetVisible <FSxPMTimeActivity.appointmentCustomerID>(Base.Activities.Cache, Base.Activities.Current, enableEmpTimeCardIntegration);
            PXUIFieldAttribute.SetVisible <FSxPMTimeActivity.sOID>(Base.Activities.Cache, Base.Activities.Current, enableEmpTimeCardIntegration);
            PXUIFieldAttribute.SetVisible <FSxPMTimeActivity.logLineNbr>(Base.Activities.Cache, Base.Activities.Current, enableEmpTimeCardIntegration);
            PXUIFieldAttribute.SetVisible <FSxPMTimeActivity.serviceID>(Base.Activities.Cache, Base.Activities.Current, enableEmpTimeCardIntegration);
        }
Exemplo n.º 8
0
        protected virtual void EPTimeCard_RowPersisted(PXCache cache, PXRowPersistedEventArgs e)
        {
            if (e.Row == null ||
                !TimeCardHelper.IsTheTimeCardIntegrationEnabled(Base))
            {
                return;
            }

            EPTimeCard epTimeCardRow = (EPTimeCard)e.Row;

            if (epTimeCardRow.IsApproved == true &&
                (bool)cache.GetValueOriginal <EPTimeCard.isApproved>(epTimeCardRow) == false &&
                e.TranStatus == PXTranStatus.Open)
            {
                UpdateAppointmentFromApprovedTimeCard(cache);
            }
        }
Exemplo n.º 9
0
        public static void InsertUpdateDeleteTimeActivities(
            AppointmentEntry graphAppointmentEntry,
            PXCache appointmentCache,
            FSAppointment fsAppointmentRow,
            FSServiceOrder fsServiceOrderRow,
            AppointmentCore.AppointmentEmployees_View appointmentEmployees,
            List <FSAppointmentEmployee> deleteReleatedTimeActivity,
            List <FSAppointmentEmployee> createReleatedTimeActivity)
        {
            if (!TimeCardHelper.IsTheTimeCardIntegrationEnabled(graphAppointmentEntry) ||
                (fsAppointmentRow.Status != ID.Status_Appointment.COMPLETED &&
                 fsAppointmentRow.Status != ID.Status_Appointment.MANUAL_SCHEDULED))
            {
                return;
            }

            if (PXAccess.FeatureInstalled <FeaturesSet.timeReportingModule>() == false)
            {
                return;
            }

            EmployeeActivitiesEntry graphEmployeeActivitiesEntry = PXGraph.CreateInstance <EmployeeActivitiesEntry>();

            if (IsNecessaryToUpdateTimeCards(appointmentCache, appointmentEmployees, fsAppointmentRow))
            {
                foreach (FSAppointmentEmployee fsAppointmentEmployee in appointmentEmployees.Select().Where(y => ((FSAppointmentEmployee)y).Type == BAccountType.EmployeeType))
                {
                    EPActivityApprove epActivityApproveRow    = null;
                    EPActivityApprove oldEPActivityApproveRow = null;
                    TMEPEmployee      epEmployeeRow           = null;
                    int?oldEmployeeIDValue;

                    FindTMEmployee(graphAppointmentEntry, fsAppointmentEmployee.EmployeeID, ref epEmployeeRow);
                    FindEPActivityApprove(graphAppointmentEntry, fsAppointmentEmployee, epEmployeeRow, ref epActivityApproveRow);

                    if (fsAppointmentEmployee.TrackTime == true)
                    {
                        oldEmployeeIDValue = (int?)graphAppointmentEntry.AppointmentEmployees.Cache.GetValueOriginal <FSAppointmentEmployee.employeeID>(fsAppointmentEmployee);
                        if (oldEmployeeIDValue != fsAppointmentEmployee.EmployeeID)
                        {
                            TMEPEmployee oldEPEmployeeRow = null;
                            FindTMEmployee(graphAppointmentEntry, oldEmployeeIDValue, ref oldEPEmployeeRow);
                            FindEPActivityApprove(graphAppointmentEntry, fsAppointmentEmployee, oldEPEmployeeRow, ref oldEPActivityApproveRow);
                            DeleteEPActivityApprove(graphEmployeeActivitiesEntry, oldEPActivityApproveRow);
                        }

                        InsertUpdateEPActivityApprove(graphAppointmentEntry, graphEmployeeActivitiesEntry, fsAppointmentEmployee, fsAppointmentRow, fsServiceOrderRow, epActivityApproveRow, epEmployeeRow);
                    }
                    else
                    {
                        if (epActivityApproveRow != null)
                        {
                            DeleteEPActivityApprove(graphEmployeeActivitiesEntry, epActivityApproveRow);
                        }
                    }
                }

                foreach (FSAppointmentEmployee fsAppointmentEmployee in appointmentEmployees.Cache.Deleted)
                {
                    if (fsAppointmentEmployee.Type == BAccountType.EmployeeType)
                    {
                        SearchAndDeleteEPActivity(graphAppointmentEntry, fsAppointmentEmployee, graphEmployeeActivitiesEntry);
                    }
                }
            }
            else if ((string)appointmentCache.GetValueOriginal <FSAppointment.status>(fsAppointmentRow) == ID.Status_Appointment.COMPLETED &&
                     fsAppointmentRow.Status == ID.Status_Appointment.MANUAL_SCHEDULED)
            {
                foreach (FSAppointmentEmployee fsAppointmentEmployee in appointmentEmployees.Select().Where(y => ((FSAppointmentEmployee)y).Type == BAccountType.EmployeeType))
                {
                    SearchAndDeleteEPActivity(graphAppointmentEntry, fsAppointmentEmployee, graphEmployeeActivitiesEntry);
                }

                foreach (FSAppointmentEmployee fsAppointmentEmployee in appointmentEmployees.Cache.Deleted)
                {
                    if (fsAppointmentEmployee.Type == BAccountType.EmployeeType)
                    {
                        SearchAndDeleteEPActivity(graphAppointmentEntry, fsAppointmentEmployee, graphEmployeeActivitiesEntry);
                    }
                }
            }

            if (deleteReleatedTimeActivity != null)
            {
                //Deleting time activities related with cancelled service lines
                foreach (FSAppointmentEmployee fsAppointmentEmployee in deleteReleatedTimeActivity)
                {
                    if (fsAppointmentEmployee.Type == BAccountType.EmployeeType)
                    {
                        SearchAndDeleteEPActivity(graphAppointmentEntry, fsAppointmentEmployee, graphEmployeeActivitiesEntry);
                    }
                }
            }

            if (createReleatedTimeActivity != null)
            {
                //Creating time activities related with re-opened service lines
                foreach (FSAppointmentEmployee fsAppointmentEmployee in createReleatedTimeActivity)
                {
                    TMEPEmployee epEmployeeRow = null;
                    FindTMEmployee(graphAppointmentEntry, fsAppointmentEmployee.EmployeeID, ref epEmployeeRow);
                    InsertUpdateEPActivityApprove(graphAppointmentEntry, graphEmployeeActivitiesEntry, fsAppointmentEmployee, fsAppointmentRow, fsServiceOrderRow, null, epEmployeeRow);
                }
            }
        }