예제 #1
0
        /// <summary>
        /// Checks if the all Appointment Service lines are approved by a Time Card, then sets Time Register to true and completes the appointment.
        /// </summary>
        public static void CheckTimeCardAppointmentApprovalsAndComplete(AppointmentEntry graphAppointmentEntry, PXCache cache, FSAppointment fsAppointmentRow)
        {
            bool allLinesApprovedByTimeCard = true;
            bool isEmployeeLines            = false;

            if (fsAppointmentRow.Status == ID.Status_Appointment.COMPLETED)
            {
                foreach (FSAppointmentEmployee fsAppointmentEmployeeRow in graphAppointmentEntry.AppointmentEmployees.Select()
                         .Where(y => ((FSAppointmentEmployee)y).Type == BAccountType.EmployeeType &&
                                ((FSAppointmentEmployee)y).TrackTime == true))
                {
                    isEmployeeLines            = true;
                    allLinesApprovedByTimeCard = allLinesApprovedByTimeCard && (bool)fsAppointmentEmployeeRow.ApprovedTime;

                    if (!allLinesApprovedByTimeCard)
                    {
                        break;
                    }
                }

                if (allLinesApprovedByTimeCard && isEmployeeLines)
                {
                    fsAppointmentRow.TimeRegistered = true;
                    fsAppointmentRow.Status         = ID.Status_Appointment.COMPLETED;
                }
            }
        }
예제 #2
0
        /// <summary>
        /// Reassign the positions of the appointments in a route beginning from a given position.
        /// </summary>
        private static void ReassignAppointmentPositionsInRoute(int?routeDocumentID, int?initialPosition)
        {
            if (routeDocumentID == null || initialPosition <= 0)
            {
                return;
            }

            AppointmentEntry appointmentEntryGraph = PXGraph.CreateInstance <AppointmentEntry>();

            var fsAppointmentSet = PXSelect <FSAppointment,
                                             Where <
                                                 FSAppointment.routeDocumentID, Equal <Required <FSRouteDocument.routeDocumentID> >,
                                                 And <FSAppointment.routePosition, GreaterEqual <Required <FSAppointment.routePosition> > > >,
                                             OrderBy <
                                                 Asc <FSAppointment.routePosition> > >
                                   .Select(appointmentEntryGraph, routeDocumentID, initialPosition);

            if (fsAppointmentSet != null)
            {
                foreach (FSAppointment fsAppointmentRowInRoute in fsAppointmentSet)
                {
                    fsAppointmentRowInRoute.RoutePosition = initialPosition;
                    appointmentEntryGraph.AppointmentRecords.Update(fsAppointmentRowInRoute);
                    initialPosition = initialPosition + 1;
                }

                appointmentEntryGraph.SkipServiceOrderUpdate = true;
                appointmentEntryGraph.Save.Press();
            }
        }
예제 #3
0
        public static void Process(List <FSAppointment> list, bool isMassProcess)
        {
            AppointmentEntry appointmentEntryGraph = PXGraph.CreateInstance <AppointmentEntry>();

            for (int i = 0; i < list.Count; i++)
            {
                try
                {
                    appointmentEntryGraph.Clear();
                    appointmentEntryGraph.AppointmentRecords.Current = PXSelect <FSAppointment, Where <FSAppointment.srvOrdType, Equal <Required <FSAppointment.srvOrdType> >, And <FSAppointment.refNbr, Equal <Required <FSAppointment.refNbr> > > > > .Select(appointmentEntryGraph, list[i].SrvOrdType, list[i].RefNbr);

                    appointmentEntryGraph.CalculateExternalTax(appointmentEntryGraph.AppointmentRecords.Current);
                    PXProcessing <FSAppointment> .SetInfo(i, ActionsMessages.RecordProcessed);
                }
                catch (Exception e)
                {
                    if (isMassProcess)
                    {
                        PXProcessing <FSAppointment> .SetError(i, e is PXOuterException?e.Message + "\r\n" + String.Join("\r\n", ((PXOuterException)e).InnerMessages) : e.Message);
                    }
                    else
                    {
                        throw new PXMassProcessException(i, e);
                    }
                }
            }
        }
예제 #4
0
        /// <summary>
        /// Checks if the all Appointment Service lines are approved by a Time Card, then sets Time Register to true and completes the appointment.
        /// </summary>
        public static void CheckTimeCardAppointmentApprovalsAndComplete(AppointmentEntry graphAppointmentEntry, PXCache cache, FSAppointment fsAppointmentRow)
        {
            bool allLinesApprovedByTimeCard = true;
            bool isEmployeeLines            = false;

            if (fsAppointmentRow.Status == ID.Status_Appointment.COMPLETED)
            {
                var employeesLogs = graphAppointmentEntry.LogRecords.Select().RowCast <FSAppointmentLog>()
                                    .Where(y => y.BAccountType == BAccountType.EmployeeType &&
                                           y.TrackTime == true);

                foreach (FSAppointmentLog fsAppointmentLogRow in employeesLogs)
                {
                    isEmployeeLines            = true;
                    allLinesApprovedByTimeCard = allLinesApprovedByTimeCard && (bool)fsAppointmentLogRow.ApprovedTime;

                    if (!allLinesApprovedByTimeCard)
                    {
                        break;
                    }
                }

                if (allLinesApprovedByTimeCard && isEmployeeLines)
                {
                    fsAppointmentRow.TimeRegistered = true;
                    fsAppointmentRow.Status         = ID.Status_Appointment.COMPLETED;
                }
            }
        }
예제 #5
0
        public virtual IEnumerable Process(PXAdapter adapter)
        {
            if (Filter.Current != null &&
                Filter.Current.AppointmentID != null)
            {
                AppointmentEntry graphAppointment = PXGraph.CreateInstance <AppointmentEntry>();

                graphAppointment.AppointmentRecords.Current = graphAppointment.AppointmentRecords.Search <FSAppointment.appointmentID>(Filter.Current.AppointmentID, Filter.Current.SrvOrdType);
                graphAppointment.SkipLongOperation          = this.IsMobile;

                graphAppointment.LogActionFilter.Current     = Filter.Current;
                graphAppointment.LogActionFilter.View.Answer = WebDialogResult.OK;

                if (Filter.Current.Me == true)
                {
                    PressActionButton(graphAppointment, Filter.Current.Action, Filter.Current.Type);
                }
                else
                {
                    throw new PXRowPersistingException(null, null, TX.Error.CANNOT_PERFORM_LOG_ACTION_RECORD_NOT_SELECTED);
                }
            }

            return(adapter.Get());
        }
예제 #6
0
        /// <summary>
        /// Adds the Employee(s) belonging to the Appointment's Service Area as recipients in the Email template generated by Appointment.
        /// </summary>
        private static void AddGeoZoneStaffRecipient(AppointmentEntry graphAppointmentEntry, NotificationRecipient recSetup, RecipientList recipients)
        {
            List <FSGeoZoneEmp> geoZoneEmpList = new List <FSGeoZoneEmp>();

            if (graphAppointmentEntry.ServiceOrderRelated.Current.PostalCode != null)
            {
                FSGeoZonePostalCode fsGeoZoneRow = StaffSelectionHelper.GetMatchingGeoZonePostalCode(graphAppointmentEntry, graphAppointmentEntry.ServiceOrderRelated.Current.PostalCode);

                if (fsGeoZoneRow != null)
                {
                    var fsGeoZonePostalCodeSet = PXSelectJoin <FSGeoZonePostalCode,
                                                               InnerJoin <FSGeoZoneEmp,
                                                                          On <FSGeoZoneEmp.geoZoneID, Equal <FSGeoZonePostalCode.geoZoneID> > >,
                                                               Where <
                                                                   FSGeoZonePostalCode.postalCode, Equal <Required <FSGeoZonePostalCode.postalCode> > > >
                                                 .Select(graphAppointmentEntry, fsGeoZoneRow.PostalCode);

                    foreach (PXResult <FSGeoZonePostalCode, FSGeoZoneEmp> bqlResult in fsGeoZonePostalCodeSet)
                    {
                        geoZoneEmpList.Add((FSGeoZoneEmp)bqlResult);
                    }
                }
            }

            List <FSGeoZoneEmp> fsGeoZoneEmpGroupByEmployeeID = geoZoneEmpList.GroupBy(x => x.EmployeeID).Select(grp => grp.First()).ToList();

            if (fsGeoZoneEmpGroupByEmployeeID.Count > 0)
            {
                foreach (FSGeoZoneEmp fsGeoZoneEmpRow in fsGeoZoneEmpGroupByEmployeeID)
                {
                    AddEmployeeStaffRecipient(graphAppointmentEntry, fsGeoZoneEmpRow.EmployeeID, BAccountType.EmployeeType, recSetup, recipients);
                }
            }
        }
예제 #7
0
        public virtual void PressActionButton(AppointmentEntry graph, string action, string type)
        {
            if (action == ID.LogActions.START)
            {
                if (type == ID.Type_Log.SERVICE)
                {
                    graph.startItemLine.PressButton();
                }
                else if (type == ID.Type_Log.TRAVEL)
                {
                    graph.startTravel.PressButton();
                }
                else if (type == ID.Type_Log.STAFF_ASSIGMENT)
                {
                    graph.startStaff.PressButton();
                }
                else if (type == ID.Type_Log.SERV_BASED_ASSIGMENT)
                {
                    graph.startItemLine.PressButton();
                }
            }
            else if (action == ID.LogActions.COMPLETE)
            {
                if (type == ID.Type_Log.SERVICE)
                {
                    graph.completeItemLine.PressButton();
                }
                else if (type == ID.Type_Log.TRAVEL)
                {
                    graph.completeTravel.PressButton();
                }
            }

            graph.Unload();
        }
        protected virtual void CloneMultipleAppointments(CloneAppointmentProcess graph)
        {
            DateTime fromDate = (DateTime)graph.Filter.Current.ScheduledFromDate;
            DateTime toDate   = (DateTime)graph.Filter.Current.ScheduledToDate;

            if (fromDate > toDate)
            {
                throw new ArgumentException(TX.Error.END_DATE_LESSER_THAN_START_DATE);
            }

            AppointmentEntry graphOriginalAppointment = PXGraph.CreateInstance <AppointmentEntry>();

            graphOriginalAppointment.AppointmentSelected.Current = graphOriginalAppointment.AppointmentRecords.Search <FSAppointment.appointmentID>
                                                                       (AppointmentSelected.Current.AppointmentID, AppointmentSelected.Current.SrvOrdType);

            AppointmentEntry graphNewAppointment = PXGraph.CreateInstance <AppointmentEntry>();

            for (DateTime i = (DateTime)fromDate; i <= toDate; i = i.AddDays(1))
            {
                if ((i.DayOfWeek == DayOfWeek.Monday && (bool)graph.Filter.Current.ActiveOnMonday) ||
                    (i.DayOfWeek == DayOfWeek.Thursday && (bool)graph.Filter.Current.ActiveOnThursday) ||
                    (i.DayOfWeek == DayOfWeek.Wednesday && (bool)graph.Filter.Current.ActiveOnWednesday) ||
                    (i.DayOfWeek == DayOfWeek.Tuesday && (bool)graph.Filter.Current.ActiveOnTuesday) ||
                    (i.DayOfWeek == DayOfWeek.Friday && (bool)graph.Filter.Current.ActiveOnFriday) ||
                    (i.DayOfWeek == DayOfWeek.Saturday && (bool)graph.Filter.Current.ActiveOnSaturday) ||
                    (i.DayOfWeek == DayOfWeek.Sunday && (bool)graph.Filter.Current.ActiveOnSunday))
                {
                    graph.Filter.Current.ScheduledDate = i;
                    graph.CloneAppointment(graphOriginalAppointment, graphNewAppointment);
                }
            }
        }
예제 #9
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
                              };
                    }
                }
            }
        }
        public AppointmentInq()
        {
            Appointments.Cache.AllowDelete = false;
            Appointments.Cache.AllowInsert = false;
            Appointments.Cache.AllowUpdate = false;

            CreateNew.SetEnabled(AppointmentEntry.IsReadyToBeUsed(this, this.Accessinfo.ScreenID));
        }
        private void CloneResources(AppointmentEntry graphOriginalAppointment, AppointmentEntry graphNewAppointment, FSAppointment newFSAppointmentRow)
        {
            foreach (FSAppointmentResource originalAppointmentResource in graphOriginalAppointment.AppointmentResources.Select())
            {
                FSAppointmentResource fsAppointmentResourceRow = PXCache <FSAppointmentResource> .CreateCopy(originalAppointmentResource);

                fsAppointmentResourceRow.AppointmentID = newFSAppointmentRow.AppointmentID;
                fsAppointmentResourceRow.RefNbr        = null;
                graphNewAppointment.AppointmentResources.Insert(fsAppointmentResourceRow);
            }
        }
예제 #12
0
        /// <summary>
        /// Add the Customer info as a recipient in the Email template generated by Appointment.
        /// </summary>
        private static void AddCustomerRecipient(AppointmentEntry graphAppointmentEntry, NotificationRecipient recSetup, RecipientList recipients)
        {
            NotificationRecipient recipient = null;

            Customer customerRow = PXSelect <Customer,
                                             Where <
                                                 Customer.bAccountID, Equal <Required <Customer.bAccountID> > > >
                                   .Select(graphAppointmentEntry, graphAppointmentEntry.ServiceOrderRelated.Current.CustomerID);

            if (customerRow == null)
            {
                return;
            }

            FSxCustomer fsxCustomerRow = PXCache <Customer> .GetExtension <FSxCustomer>(customerRow);

            if (fsxCustomerRow.SendAppNotification == true)
            {
                if (graphAppointmentEntry.ServiceOrderRelated.Current.EMail != null)
                {
                    recipient = new NotificationRecipient()
                    {
                        Active = true,
                        Email  = graphAppointmentEntry.ServiceOrderRelated.Current.EMail,
                        Hidden = recSetup.Hidden,
                        Format = recSetup.Format
                    };
                }
                else
                {
                    Contact srvOrdContactRow = PXSelect <Contact,
                                                         Where <
                                                             Contact.contactID, Equal <Required <Contact.contactID> > > >
                                               .Select(graphAppointmentEntry, graphAppointmentEntry.ServiceOrderRelated.Current.ContactID);

                    if (srvOrdContactRow != null && srvOrdContactRow.EMail != null)
                    {
                        recipient = new NotificationRecipient()
                        {
                            Active = true,
                            Email  = srvOrdContactRow.EMail,
                            Hidden = recSetup.Hidden,
                            Format = recSetup.Format
                        };
                    }
                }

                if (recipient != null)
                {
                    recipients.Add(recipient);
                }
            }
        }
예제 #13
0
        public virtual void CloneEmployees(AppointmentEntry graphOriginalAppointment, AppointmentEntry graphNewAppointment, FSAppointment newFSAppointmentRow)
        {
            foreach (FSAppointmentEmployee originalAppointmentEmployee in graphOriginalAppointment.AppointmentServiceEmployees.Select())
            {
                FSAppointmentEmployee fsAppointmentEmployeeRow = PXCache <FSAppointmentEmployee> .CreateCopy(originalAppointmentEmployee);

                fsAppointmentEmployeeRow.AppointmentID = newFSAppointmentRow.AppointmentID;
                fsAppointmentEmployeeRow.RefNbr        = null;
                fsAppointmentEmployeeRow.NoteID        = null;

                graphNewAppointment.AppointmentServiceEmployees.Insert(fsAppointmentEmployeeRow);
            }
        }
예제 #14
0
        /// <summary>
        /// Add the Employee(s) info as a recipient(s) in the Email template generated by Appointment.
        /// </summary>
        private static void AddEmployeeStaffRecipient(AppointmentEntry graphAppointmentEntry,
                                                      int?bAccountID,
                                                      string type,
                                                      NotificationRecipient recSetup,
                                                      RecipientList recipients)
        {
            NotificationRecipient recipient = null;
            Contact contactRow = null;

            if (type == BAccountType.EmployeeType)
            {
                contactRow = PXSelectJoin <Contact,
                                           InnerJoin <BAccount,
                                                      On <
                                                          BAccount.parentBAccountID, Equal <Contact.bAccountID>,
                                                          And <BAccount.defContactID, Equal <Contact.contactID> > > >,
                                           Where <
                                               BAccount.bAccountID, Equal <Required <BAccount.bAccountID> >,
                                               And <
                                                   BAccount.type, Equal <Required <BAccount.type> > > > >
                             .Select(graphAppointmentEntry, bAccountID, type);
            }
            else if (type == BAccountType.VendorType)
            {
                contactRow = PXSelectJoin <Contact,
                                           InnerJoin <BAccount,
                                                      On <
                                                          Contact.contactID, Equal <BAccount.defContactID> > >,
                                           Where <
                                               BAccount.bAccountID, Equal <Required <BAccount.bAccountID> >,
                                               And <
                                                   BAccount.type, Equal <Required <BAccount.type> > > > >
                             .Select(graphAppointmentEntry, bAccountID, type);
            }

            if (contactRow != null && contactRow.EMail != null)
            {
                recipient = new NotificationRecipient()
                {
                    Active = true,
                    Email  = contactRow.EMail,
                    Hidden = recSetup.Hidden,
                    Format = recSetup.Format
                };

                if (recipient != null)
                {
                    recipients.Add(recipient);
                }
            }
        }
예제 #15
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 InsertEmployeeLinkedToService(AppointmentEntry graphAppointmentEntry, List <string> employeeList, string lineRef)
 {
     foreach (string employeeID in employeeList)
     {
         int employeeIntID = -1;
         if (int.TryParse(employeeID, out employeeIntID))
         {
             FSAppointmentEmployee fsAppointmentEmployeeRow = new FSAppointmentEmployee();
             fsAppointmentEmployeeRow.EmployeeID     = employeeIntID;
             fsAppointmentEmployeeRow.ServiceLineRef = lineRef;
             graphAppointmentEntry.AppointmentEmployees.Insert(fsAppointmentEmployeeRow);
         }
     }
 }
        private void CloneEmployees(AppointmentEntry graphOriginalAppointment, AppointmentEntry graphNewAppointment, FSAppointment newFSAppointmentRow)
        {
            foreach (FSAppointmentEmployee originalAppointmentEmployee in graphOriginalAppointment.AppointmentEmployees.Select())
            {
                FSAppointmentEmployee fsAppointmentEmployeeRow = PXCache <FSAppointmentEmployee> .CreateCopy(originalAppointmentEmployee);

                fsAppointmentEmployeeRow.AppointmentID       = newFSAppointmentRow.AppointmentID;
                fsAppointmentEmployeeRow.RefNbr              = null;
                fsAppointmentEmployeeRow.ActualDuration      = null;
                fsAppointmentEmployeeRow.ActualDateTimeBegin = null;
                fsAppointmentEmployeeRow.ActualDateTimeEnd   = null;

                graphNewAppointment.AppointmentEmployees.Insert(fsAppointmentEmployeeRow);
            }
        }
        protected virtual void openAppointment()
        {
            AppointmentEntry graphAppointment = PXGraph.CreateInstance <AppointmentEntry>();

            if (ClosingAppointmentRecords.Current != null && ClosingAppointmentRecords.Current.RefNbr != null)
            {
                graphAppointment.AppointmentRecords.Current = graphAppointment.AppointmentRecords.Search <FSAppointment.refNbr>
                                                                  (ClosingAppointmentRecords.Current.RefNbr, ClosingAppointmentRecords.Current.SrvOrdType);

                throw new PXRedirectRequiredException(graphAppointment, null)
                      {
                          Mode = PXBaseRedirectException.WindowMode.NewWindow
                      };
            }
        }
예제 #19
0
        public static void AssignAppointmentEmployeeByList(AppointmentEntry graphAppointmentEntry, List <string> employeeList, List <string> soDetIDList)
        {
            employeeList.Reverse();

            if (employeeList.Count > 0 && soDetIDList.Count <= 0)
            {
                for (int i = 0; i < employeeList.Count; i++)
                {
                    FSAppointmentEmployee fsAppointmentEmployeeRow = new FSAppointmentEmployee();

                    fsAppointmentEmployeeRow = graphAppointmentEntry.AppointmentServiceEmployees.Insert(fsAppointmentEmployeeRow);
                    graphAppointmentEntry.AppointmentServiceEmployees.Cache.SetValueExt <FSAppointmentEmployee.employeeID>(fsAppointmentEmployeeRow, (int?)Convert.ToInt32(employeeList[i]));
                }
            }
        }
예제 #20
0
        private static void SearchAndDeleteEPActivity(AppointmentEntry graphAppointmentEntry,
                                                      FSAppointmentLog fsAppointmentLogRow,
                                                      EmployeeActivitiesEntry graphEmployeeActivitiesEntry)
        {
            EPActivityApprove epActivityApproveRow = null;
            TMEPEmployee      epEmployeeRow        = null;

            FindTMEmployee(graphAppointmentEntry, fsAppointmentLogRow.BAccountID, ref epEmployeeRow);
            FindEPActivityApprove(graphAppointmentEntry, fsAppointmentLogRow, epEmployeeRow, ref epActivityApproveRow);

            if (epActivityApproveRow != null)
            {
                DeleteEPActivityApprove(graphEmployeeActivitiesEntry, epActivityApproveRow);
            }
        }
예제 #21
0
        /// <summary>
        /// Add the Employee email that has assigned the salesperson as a recipient in the Email template generated by Appointment.
        /// </summary>
        private static void AddSalespersonRecipient(AppointmentEntry graphAppointmentEntry, NotificationRecipient recSetup, RecipientList recipients)
        {
            NotificationRecipient recipient = null;
            bool?appNotification            = false;

            PXResult <SalesPerson, EPEmployee, BAccount, Contact> bqlResult =
                (PXResult <SalesPerson, EPEmployee, BAccount, Contact>) PXSelectJoin <SalesPerson,
                                                                                      InnerJoin <EPEmployee,
                                                                                                 On <EPEmployee.salesPersonID, Equal <SalesPerson.salesPersonID> >,
                                                                                                 InnerJoin <BAccount,
                                                                                                            On <BAccount.bAccountID, Equal <EPEmployee.bAccountID> >,
                                                                                                            InnerJoin <Contact,
                                                                                                                       On <BAccount.parentBAccountID, Equal <Contact.bAccountID>,
                                                                                                                           And <BAccount.defContactID, Equal <Contact.contactID> > > > > >,
                                                                                      Where <
                                                                                          SalesPerson.salesPersonID, Equal <Required <FSAppointment.salesPersonID> > > >
                .Select(graphAppointmentEntry, graphAppointmentEntry.AppointmentRecords.Current.SalesPersonID);

            Contact     contactRow     = (Contact)bqlResult;
            BAccount    baccountRow    = (BAccount)bqlResult;
            EPEmployee  epEmployeeRow  = (EPEmployee)bqlResult;
            SalesPerson SalespersonRow = (SalesPerson)bqlResult;

            if (epEmployeeRow != null && SalespersonRow != null)
            {
                FSxEPEmployee fsxEpEmployeeRow = PXCache <EPEmployee> .GetExtension <FSxEPEmployee>(epEmployeeRow);

                appNotification = fsxEpEmployeeRow.SendAppNotification;

                if (appNotification == true)
                {
                    if (contactRow != null && contactRow.EMail != null)
                    {
                        recipient = new NotificationRecipient()
                        {
                            Active = true,
                            Email  = contactRow.EMail,
                            Hidden = recSetup.Hidden,
                            Format = recSetup.Format
                        };
                        if (recipient != null)
                        {
                            recipients.Add(recipient);
                        }
                    }
                }
            }
        }
예제 #22
0
        private static void InsertEmployeeLinkedToService(AppointmentEntry graphAppointmentEntry, List <string> employeeList, string lineRef)
        {
            foreach (string employeeID in employeeList)
            {
                int employeeIntID = -1;

                if (int.TryParse(employeeID, out employeeIntID))
                {
                    FSAppointmentEmployee fsAppointmentEmployeeRow = new FSAppointmentEmployee();
                    fsAppointmentEmployeeRow = graphAppointmentEntry.AppointmentServiceEmployees.Insert(fsAppointmentEmployeeRow);

                    graphAppointmentEntry.AppointmentServiceEmployees.Cache.SetValueExt <FSAppointmentEmployee.employeeID>(fsAppointmentEmployeeRow, employeeIntID);
                    graphAppointmentEntry.AppointmentServiceEmployees.Cache.SetValueExt <FSAppointmentEmployee.serviceLineRef>(fsAppointmentEmployeeRow, lineRef);
                }
            }
        }
        private void CloneServices(AppointmentEntry sourceAppointmentGraph, AppointmentEntry newAppointmentGraph, FSAppointment newAppointmentRow)
        {
            foreach (FSAppointmentDetService sourceRow in sourceAppointmentGraph.AppointmentDetServices.Select())
            {
                FSSODet fsSODetRow = ServiceOrderCore.GetSODetFromAppointmentDet(sourceAppointmentGraph, sourceRow);

                if (fsSODetRow != null &&
                    (fsSODetRow.Status == ID.Status_AppointmentDet.CANCELED ||
                     fsSODetRow.Status == ID.Status_AppointmentDet.COMPLETED))
                {
                    continue;
                }

                FSAppointmentDetService newRow = PXCache <FSAppointmentDetService> .CreateCopy(sourceRow);

                newRow.ActualDuration      = 0;
                newRow.ActualDateTimeBegin = null;
                newRow.ActualDateTimeEnd   = null;
                newRow.Qty = 0;

                newRow = AppointmentEntry.InsertServicePartLine <FSAppointmentDetService, FSAppointmentDetService>(
                    newAppointmentGraph.AppointmentDetServices.Cache,
                    newRow,
                    sourceAppointmentGraph.AppointmentDetServices.Cache,
                    sourceRow,
                    null,
                    sourceRow.SODetID,
                    copyTranDate: false,
                    tranDate: sourceRow.TranDate,
                    SetValuesAfterAssigningSODetID: true,
                    copyingFromQuote: false);

                PXNoteAttribute.CopyNoteAndFiles(
                    sourceAppointmentGraph.AppointmentDetServices.Cache,
                    sourceRow,
                    newAppointmentGraph.AppointmentDetServices.Cache,
                    newRow,
                    copyNotes: true,
                    copyFiles: false);


                newAppointmentGraph.AppointmentDetServices.SetValueExt <FSAppointmentDetService.acctID>(newRow, sourceRow.AcctID);
                newAppointmentGraph.AppointmentDetServices.SetValueExt <FSAppointmentDetService.subID>(newRow, sourceRow.SubID);

                AppointmentCore.UpdateAppointmentsInfoInServiceOrder(newAppointmentGraph.AppointmentDetServices.Cache, newRow, ServiceOrderRelated);
            }
        }
예제 #24
0
        /// <summary>
        /// Add the Vendor(s) info as a recipient(s) in the Email template generated by Appointment.
        /// </summary>
        private static void AddVendorStaffRecipient(AppointmentEntry graphAppointmentEntry,
                                                    FSAppointmentEmployee fsAppointmentEmployee,
                                                    NotificationRecipient recSetup,
                                                    RecipientList recipients)
        {
            //TODO: AC-142850 6082 validate Vendor's AppNotification flag

            /*
             *  select * from Contact
             *  inner join BAccount on (BAccount.BAccountID = Contact.BAccountID
             *              and BAccount.DefContactID = Contact.ContactID)
             *  where
             *  BAccount.BAccountID = xx
             *  and BAccount.Type = 'VE'
             */

            //BAccountType.VendorType
        }
예제 #25
0
        public static void AssignAppointmentRoom(AppointmentEntry graphAppointmentEntry, FSWrkProcess fsWrkProcessRow, FSServiceOrder fsServiceOrderRow = null)
        {
            if (string.IsNullOrEmpty(fsWrkProcessRow.RoomID) == false &&
                string.IsNullOrWhiteSpace(fsWrkProcessRow.RoomID) == false)
            {
                graphAppointmentEntry.ServiceOrderRelated.SetValueExt <FSServiceOrder.roomID>
                    (graphAppointmentEntry.ServiceOrderRelated.Current, fsWrkProcessRow.RoomID);

                if (fsServiceOrderRow == null)
                {
                    fsServiceOrderRow = GetServiceOrder(graphAppointmentEntry, fsWrkProcessRow);
                }

                if (fsServiceOrderRow != null)
                {
                    graphAppointmentEntry.ServiceOrderRelated.Cache.SetStatus(graphAppointmentEntry.ServiceOrderRelated.Current, PXEntryStatus.Updated);
                }
            }
        }
예제 #26
0
        public virtual IEnumerable ProcessAllForMeRecords(PXAdapter adapter)
        {
            if (Filter.Current != null &&
                Filter.Current.AppointmentID != null)
            {
                AppointmentEntry graphAppointment = PXGraph.CreateInstance <AppointmentEntry>();

                graphAppointment.AppointmentRecords.Current = graphAppointment.AppointmentRecords.Search <FSAppointment.appointmentID>(Filter.Current.AppointmentID, Filter.Current.SrvOrdType);
                graphAppointment.SkipLongOperation          = this.IsMobile;

                graphAppointment.LogActionFilter.Current     = (FSLogActionFilter)Filter.Cache.CreateCopy(Filter.Current);
                graphAppointment.LogActionFilter.View.Answer = WebDialogResult.OK;
                graphAppointment.LogActionFilter.Cache.SetValueExt <FSLogActionFilter.me>(graphAppointment.LogActionFilter.Current, true);

                PressActionButton(graphAppointment, Filter.Current.Action, Filter.Current.Type);
            }

            return(adapter.Get());
        }
예제 #27
0
        public virtual void CloneEmployees(AppointmentEntry graphOriginalAppointment, AppointmentEntry graphNewAppointment, FSAppointment newFSAppointmentRow, Dictionary <string, string> itemLineRef)
        {
            foreach (FSAppointmentEmployee originalAppointmentEmployee in graphOriginalAppointment.AppointmentServiceEmployees.Select())
            {
                FSAppointmentEmployee fsAppointmentEmployeeRow = PXCache <FSAppointmentEmployee> .CreateCopy(originalAppointmentEmployee);

                fsAppointmentEmployeeRow.AppointmentID = newFSAppointmentRow.AppointmentID;
                fsAppointmentEmployeeRow.RefNbr        = null;
                fsAppointmentEmployeeRow.NoteID        = null;

                if (string.IsNullOrEmpty(fsAppointmentEmployeeRow.ServiceLineRef) == false &&
                    itemLineRef.ContainsKey(fsAppointmentEmployeeRow.ServiceLineRef) == true)
                {
                    fsAppointmentEmployeeRow.ServiceLineRef = itemLineRef[fsAppointmentEmployeeRow.ServiceLineRef];
                }

                graphNewAppointment.AppointmentServiceEmployees.Insert(fsAppointmentEmployeeRow);
            }
        }
예제 #28
0
        /// <summary>
        /// Add the Billing Customer info as a recipient(s) in the Email template generated by Appointment.
        /// </summary>
        private static void AddBillingRecipient(AppointmentEntry graphAppointmentEntry, NotificationRecipient recSetup, RecipientList recipients)
        {
            NotificationRecipient recipient = null;

            if (graphAppointmentEntry.ServiceOrderRelated.Current.BillCustomerID != null)
            {
                Customer customerRow = PXSelect <Customer,
                                                 Where <
                                                     Customer.bAccountID, Equal <Required <Customer.bAccountID> > > >
                                       .Select(graphAppointmentEntry, graphAppointmentEntry.ServiceOrderRelated.Current.BillCustomerID);

                if (customerRow == null)
                {
                    return;
                }

                Contact contactRow = PXSelectJoin <Contact,
                                                   InnerJoin <Customer,
                                                              On <
                                                                  Contact.bAccountID, Equal <Customer.bAccountID>,
                                                                  And <Contact.contactID, Equal <Customer.defBillContactID> > > >,
                                                   Where <
                                                       Customer.bAccountID, Equal <Required <Customer.bAccountID> > > >
                                     .Select(graphAppointmentEntry, graphAppointmentEntry.ServiceOrderRelated.Current.BillCustomerID);

                if (contactRow != null && contactRow.EMail != null)
                {
                    recipient = new NotificationRecipient()
                    {
                        Active = true,
                        Email  = contactRow.EMail,
                        Hidden = recSetup.Hidden,
                        Format = recSetup.Format
                    };
                }
            }

            if (recipient != null)
            {
                recipients.Add(recipient);
            }
        }
        private void CloneAttendees(AppointmentEntry graphOriginalAppointment, AppointmentEntry graphNewAppointment, FSAppointment newFSAppointmentRow)
        {
            foreach (FSAppointmentAttendee originalAppointmentAttendee in graphOriginalAppointment.AppointmentAttendees.Select())
            {
                FSAppointmentAttendee fsAppointmentAttendeeRow = PXCache <FSAppointmentAttendee> .CreateCopy(originalAppointmentAttendee);

                fsAppointmentAttendeeRow.AppointmentID = newFSAppointmentRow.AppointmentID;
                fsAppointmentAttendeeRow.RefNbr        = null;
                fsAppointmentAttendeeRow.NoteID        = null;
                fsAppointmentAttendeeRow = graphNewAppointment.AppointmentAttendees.Insert(fsAppointmentAttendeeRow);

                PXNoteAttribute.CopyNoteAndFiles(
                    graphOriginalAppointment.AppointmentAttendees.Cache,
                    originalAppointmentAttendee,
                    graphNewAppointment.AppointmentAttendees.Cache,
                    fsAppointmentAttendeeRow,
                    copyNotes: true,
                    copyFiles: false);
            }
        }
예제 #30
0
        public virtual IEnumerable ViewFSAppointmentSource(PXAdapter adapter)
        {
            FSAdjust fsAdjustRow = FSAdjustments.Current;

            if (fsAdjustRow != null &&
                !(String.IsNullOrEmpty(fsAdjustRow.AdjdOrderType) ||
                  String.IsNullOrEmpty(fsAdjustRow.AdjdAppRefNbr)))
            {
                AppointmentEntry graphAppointmentEntry = PXGraph.CreateInstance <AppointmentEntry>();
                graphAppointmentEntry.AppointmentRecords.Current = graphAppointmentEntry.AppointmentRecords.Search <FSAppointment.refNbr>(fsAdjustRow.AdjdAppRefNbr, fsAdjustRow.AdjdOrderType);

                if (graphAppointmentEntry.AppointmentRecords.Current != null)
                {
                    throw new PXRedirectRequiredException(graphAppointmentEntry, true, "View Appointment Source")
                          {
                              Mode = PXBaseRedirectException.WindowMode.NewWindow
                          };
                }
            }
            return(adapter.Get());
        }