/// <summary>
        /// Gets the information of the Appointment and AppointmentInventoryItem using as reference the [appointmentID] and [appointmentInventoryItemID].
        /// </summary>
        private SharedClasses.AppointmentInventoryItemInfo GetAppointmentInventoryItemInfo(int?appointmentID, int?appDetID, int index)
        {
            PXResult <FSAppointment, FSServiceOrder, FSSrvOrdType, FSAppointmentInventoryItem, FSAppointmentDet> bqlResult =
                (PXResult <FSAppointment, FSServiceOrder, FSSrvOrdType, FSAppointmentInventoryItem, FSAppointmentDet>)
                PXSelectReadonly2 <FSAppointment,
                                   InnerJoin <FSServiceOrder,
                                              On <FSServiceOrder.sOID, Equal <FSAppointment.sOID>,
                                                  And <FSAppointment.appointmentID, Equal <Required <FSAppointment.appointmentID> > > >,
                                              InnerJoin <FSSrvOrdType,
                                                         On <FSSrvOrdType.srvOrdType, Equal <FSAppointment.srvOrdType> >,
                                                         InnerJoin <FSAppointmentInventoryItem,
                                                                    On <FSAppointmentInventoryItem.appointmentID, Equal <FSAppointment.appointmentID>,
                                                                        And <FSAppointmentInventoryItem.appDetID, Equal <Required <FSAppointmentInventoryItem.appDetID> > > >,
                                                                    InnerJoin <FSAppointmentDet,
                                                                               On <FSAppointmentDet.sODetID, Equal <FSAppointmentInventoryItem.sODetID> > > > > > >
                .Select(this, appointmentID, appDetID);

            SharedClasses.AppointmentInventoryItemInfo appointmentInfoToReturn = new SharedClasses.AppointmentInventoryItemInfo();

            if (bqlResult != null)
            {
                FSAppointment              fsAppointmentRow              = (FSAppointment)bqlResult;
                FSServiceOrder             fsServiceOrderRow             = (FSServiceOrder)bqlResult;
                FSSrvOrdType               fsSrvOrdTypeRow               = (FSSrvOrdType)bqlResult;
                FSAppointmentInventoryItem fsAppointmentInventoryItemRow = (FSAppointmentInventoryItem)bqlResult;
                FSAppointmentDet           fsAppointmentDetRow           = (FSAppointmentDet)bqlResult;

                appointmentInfoToReturn = new SharedClasses.AppointmentInventoryItemInfo(fsAppointmentRow, fsServiceOrderRow, fsSrvOrdTypeRow, fsAppointmentDetRow, fsAppointmentInventoryItemRow, index);
            }

            return(appointmentInfoToReturn);
        }
Exemplo n.º 2
0
        public static void Process(FSAppointment doc)
        {
            List <FSAppointment> list = new List <FSAppointment>();

            list.Add(doc);
            Process(list, false);
        }
        /// <summary>
        /// Allows to calculate the <c>RefNbr</c> sequence when trying to insert a new register.
        /// </summary>
        protected override bool SetRefNbr(PXCache cache, object row)
        {
            FSAppointment fsAppointmentRow = (FSAppointment)row;

            if (fsAppointmentRow.SOID == null || fsAppointmentRow.SOID < 0)
            {
                return(false);
            }

            FSAppointment fsAppointmentRow_tmp = PXSelectReadonly <FSAppointment,
                                                                   Where <
                                                                       FSAppointment.sOID, Equal <Current <FSAppointment.sOID> > >,
                                                                   OrderBy <
                                                                       Desc <FSAppointment.appointmentID> > >
                                                 .SelectWindowed(cache.Graph, 0, 1);

            string refNbr = string.Empty;

            if (fsAppointmentRow_tmp != null)
            {
                refNbr = fsAppointmentRow_tmp.RefNbr;
            }

            fsAppointmentRow.RefNbr = SharedFunctions.GetNextRefNbr(fsAppointmentRow.SORefNbr, refNbr);

            return(true);
        }
Exemplo n.º 4
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
                              };
                    }
                }
            }
        }
Exemplo n.º 5
0
        private static bool IsNecessaryToUpdateTimeCards(
            PXCache appointmentCache,
            AppointmentCore.AppointmentEmployees_View appointmentEmployees,
            FSAppointment fsAppointmentRow)
        {
            DateTime?oldActualDateTimeBegin = (DateTime?)appointmentCache.GetValueOriginal <FSAppointment.actualDateTimeBegin>(fsAppointmentRow);
            DateTime?oldActualDateTimeEnd   = (DateTime?)appointmentCache.GetValueOriginal <FSAppointment.actualDateTimeEnd>(fsAppointmentRow);
            DateTime?oldExecutionDate       = (DateTime?)appointmentCache.GetValueOriginal <FSAppointment.executionDate>(fsAppointmentRow);
            string   oldDocDesc             = (string)appointmentCache.GetValueOriginal <FSAppointment.docDesc>(fsAppointmentRow);
            bool     appointmentModified    = false;

            if (fsAppointmentRow.ActualDateTimeBegin != oldActualDateTimeBegin ||
                fsAppointmentRow.ActualDateTimeEnd != oldActualDateTimeEnd ||
                fsAppointmentRow.ExecutionDate != oldExecutionDate ||
                fsAppointmentRow.DocDesc != oldDocDesc)
            {
                appointmentModified = true;
            }

            if (fsAppointmentRow.Status == ID.Status_Appointment.COMPLETED &&
                (
                    (string)appointmentCache.GetValueOriginal <FSAppointment.status>(fsAppointmentRow) != ID.Status_Appointment.COMPLETED ||
                    appointmentEmployees.Cache.IsInsertedUpdatedDeleted ||
                    appointmentModified))
            {
                return(true);
            }

            return(false);
        }
        protected virtual IEnumerable contracts()
        {
            int?currentContractPeriodID = -1;

            var results = PXSelectJoin <ContractPeriodToPost,
                                        LeftJoin <FSServiceOrder,
                                                  On <FSServiceOrder.billServiceContractID, Equal <ContractPeriodToPost.serviceContractID>,
                                                      And <FSServiceOrder.billContractPeriodID, Equal <ContractPeriodToPost.contractPeriodID>,
                                                           And <FSServiceOrder.allowInvoice, Equal <False>,
                                                                And <FSServiceOrder.status, Equal <FSServiceOrder.status.Open> > > > >,
                                                  LeftJoin <FSAppointment,
                                                            On <FSAppointment.billServiceContractID, Equal <ContractPeriodToPost.serviceContractID>,
                                                                And <FSAppointment.billContractPeriodID, Equal <ContractPeriodToPost.contractPeriodID>,
                                                                     And <FSAppointment.status, NotEqual <FSAppointment.status.Closed>,
                                                                          And <FSAppointment.status, NotEqual <FSAppointment.status.Canceled> > > > >,
                                                            InnerJoinSingleTable <Customer,
                                                                                  On <Customer.bAccountID, Equal <ContractPeriodToPost.billCustomerID>,
                                                                                      And <Match <Customer, Current <AccessInfo.userName> > > > > > >,
                                        Where2 <
                                            Where <CurrentValue <InvoiceContractPeriodFilter.customerID>, IsNull,
                                                   Or <ContractPeriodToPost.billCustomerID, Equal <CurrentValue <InvoiceContractPeriodFilter.customerID> > > >,
                                            And2 <
                                                Where <CurrentValue <InvoiceContractPeriodFilter.upToDate>, IsNull,
                                                       Or <ContractPeriodToPost.endPeriodDate, LessEqual <CurrentValue <InvoiceContractPeriodFilter.upToDate> > > >,
                                                And <
                                                    Where <CurrentValue <InvoiceContractPeriodFilter.serviceContractID>, IsNull,
                                                           Or <ContractPeriodToPost.serviceContractID, Equal <CurrentValue <InvoiceContractPeriodFilter.serviceContractID> > > > > > >,
                                        OrderBy <
                                            Asc <ContractPeriodToPost.serviceContractID,
                                                 Asc <ContractPeriodToPost.contractPeriodID,
                                                      Asc <FSServiceOrder.sOID,
                                                           Asc <FSAppointment.appointmentID> > > > > >
                          .Select(this);

            foreach (PXResult <ContractPeriodToPost, FSServiceOrder, FSAppointment> it in results)
            {
                ContractPeriodToPost contractPeriodToPostRow = (ContractPeriodToPost)it;
                FSServiceOrder       fsServiceOrderRow       = (FSServiceOrder)it;
                FSAppointment        fsAppointmentRow        = (FSAppointment)it;

                if (fsServiceOrderRow?.SOID != null || fsAppointmentRow?.AppointmentID != null)
                {
                    continue;
                }
                else
                {
                    if (currentContractPeriodID != contractPeriodToPostRow.ContractPeriodID)
                    {
                        yield return(new PXResult <ContractPeriodToPost>(it));
                    }

                    currentContractPeriodID = contractPeriodToPostRow.ContractPeriodID;
                }
            }

            Contracts.Cache.IsDirty = false;
            Contracts.View.RequestRefresh();
        }
Exemplo n.º 7
0
        public virtual void FillAppointmentSOFields(PXCache cache, ARTran arTranRow)
        {
            if (arTranRow.SOOrderType != null &&
                arTranRow.SOOrderNbr != null &&
                arTranRow.SOOrderLineNbr != null)
            {
                PXResult <SOLine, SOOrder, FSServiceOrder, FSAppointment> bqlResult =
                    (PXResult <SOLine, SOOrder, FSServiceOrder, FSAppointment>)
                    PXSelectJoin <SOLine,
                                  InnerJoin <SOOrder,
                                             On <
                                                 SOOrder.orderNbr, Equal <SOLine.orderNbr>,
                                                 And <SOOrder.orderType, Equal <SOLine.orderType> > >,
                                             LeftJoin <FSServiceOrder,
                                                       On <
                                                           Where2 <
                                                               Where <
                                                                   FSServiceOrder.refNbr, Equal <FSxSOOrder.soRefNbr>,
                                                                   And <FSServiceOrder.srvOrdType, Equal <FSxSOOrder.srvOrdType> > >,
                                                               Or <FSServiceOrder.sOID, Equal <FSxSOLine.sOID> > > >,
                                                       LeftJoin <FSAppointment,
                                                                 On <
                                                                     FSAppointment.appointmentID, Equal <FSxSOLine.appointmentID> > > > >,
                                  Where <
                                      SOLine.orderType, Equal <Required <SOLine.orderType> >,
                                      And <SOLine.orderNbr, Equal <Required <SOLine.orderNbr> >,
                                           And <SOLine.lineNbr, Equal <Required <SOLine.lineNbr> > > > > >
                    .Select(cache.Graph, arTranRow.SOOrderType, arTranRow.SOOrderNbr, arTranRow.SOOrderLineNbr);

                SOLine         soLineRow         = (SOLine)bqlResult;
                FSServiceOrder fsServiceOrderRow = (FSServiceOrder)bqlResult;
                FSAppointment  fsAppointmentRow  = (FSAppointment)bqlResult;

                if (soLineRow != null)
                {
                    FSxARTran fsxARTranRow = cache.GetExtension <FSxARTran>(arTranRow);

                    if (fsServiceOrderRow != null &&
                        fsServiceOrderRow.SOID != null)
                    {
                        fsxARTranRow.SOID = fsServiceOrderRow.SOID;

                        fsxARTranRow.BillCustomerID     = fsServiceOrderRow.CustomerID;
                        fsxARTranRow.CustomerLocationID = fsServiceOrderRow.LocationID;

                        fsxARTranRow.ServiceOrderDate = fsServiceOrderRow.OrderDate;
                    }

                    if (fsAppointmentRow != null &&
                        fsAppointmentRow.AppointmentID != null)
                    {
                        fsxARTranRow.AppointmentID   = fsAppointmentRow.AppointmentID;
                        fsxARTranRow.AppointmentDate = fsAppointmentRow.ScheduledDateTimeBegin;
                    }
                }
            }
        }
Exemplo n.º 8
0
        protected virtual void _(Events.RowUpdated <FSAppointment> e)
        {
            if (!e.Cache.ObjectsEqual <FSAppointment.srvOrdType>(e.Row, e.OldRow) && ((FSAppointment)e.OldRow).SrvOrdType == null)
            {
                InitServiceOrderRelated((FSAppointment)e.Row);
            }

            FSAppointment fsAppointmentRow = (FSAppointment)e.Row;
        }
Exemplo n.º 9
0
 protected void DeleteUnpersistedServiceOrderRelated(FSAppointment fsAppointmentRow)
 {
     // Deleting unpersisted FSServiceOrder record
     if (fsAppointmentRow.SOID < 0)
     {
         FSServiceOrder fsServiceOrderRow = ServiceOrderRelated.SelectSingle();
         ServiceOrderRelated.Delete(fsServiceOrderRow);
         fsAppointmentRow.SOID = null;
     }
 }
Exemplo n.º 10
0
        public virtual Waypoint GetWaypointFromAppointment(FSSetup fsSetupRow, FSAppointment fsAppointmentRow, string address)
        {
            Waypoint wp = new Waypoint();

            GLocation[] results;

            if (fsAppointmentRow.MapLatitude == null || fsAppointmentRow.MapLongitude == null)
            {
                results = Geocoder.Geocode(address, fsSetupRow.MapApiKey);

                if (results.Length > 0)
                {
                    fsAppointmentRow.MapLatitude  = (decimal)results[0].LatLng.Latitude;
                    fsAppointmentRow.MapLongitude = (decimal)results[0].LatLng.Longitude;
                }
            }

            if (fsAppointmentRow.MapLatitude != null && fsAppointmentRow.MapLongitude != null)
            {
                if (fsAppointmentRow.Confirmed == true &&
                    fsAppointmentRow.ScheduledDateTimeBegin.HasValue)
                {
                    TimeWindow tm = new TimeWindow();
                    wp.timeWindows = new List <TimeWindow>();

                    tm.startTimeSec = (int)fsAppointmentRow.ScheduledDateTimeBegin.Value.TimeOfDay.TotalSeconds;
                    tm.stopTimeSec  = (int)fsAppointmentRow.ScheduledDateTimeBegin.Value.TimeOfDay.TotalSeconds;

                    wp.timeWindows.Add(tm);
                }

                wp.name           = fsAppointmentRow.AppointmentID.ToString();
                wp.serviceTimeSec = (int)((fsAppointmentRow.ScheduledDateTimeEnd - fsAppointmentRow.ScheduledDateTimeBegin).Value.TotalSeconds);
                wp.location       = new RouteLocation()
                {
                    latitude = (double)fsAppointmentRow.MapLatitude, longitude = (double)fsAppointmentRow.MapLongitude
                };

                if (fsAppointmentRow.PrimaryDriver != null)
                {
                    wp.tagsIncludeAnd = new List <string>()
                    {
                        fsAppointmentRow.PrimaryDriver.ToString()
                    };
                    wp.priority = 99;
                }
            }
            else
            {
                return(null);
            }

            return(wp);
        }
Exemplo n.º 11
0
        protected virtual void _(Events.RowSelected <FSAppointment> e)
        {
            if (e.Row == null)
            {
                return;
            }

            FSAppointment fsAppointmentRow = (FSAppointment)e.Row;

            LoadServiceOrderRelated(fsAppointmentRow);
        }
Exemplo n.º 12
0
        /// <summary>
        /// Gets the value of a WildCard field.
        /// </summary>
        /// <returns>Returns the string value of the field.</returns>
        private static string GetWildCardFieldValue(PXGraph graph, object objectRow, string fieldName)
        {
            #region FSAppointment fields

            // WildCard_AssignedEmployeesList
            if (fieldName.ToUpper() == typeof(FSAppointment.wildCard_AssignedEmployeesList).Name.ToUpper())
            {
                StringBuilder names = new StringBuilder();
                names = FSAppointment.GetsEmployeesContactInfo(graph, true, false, ((FSAppointment)objectRow).AppointmentID);

                return(names.ToString());
            }
            else if (fieldName.ToUpper() == typeof(FSAppointment.wildCard_AssignedEmployeesCellPhoneList).Name.ToUpper())
            {
                // WildCard_AssignedEmployeesCellPhoneList
                StringBuilder names = new StringBuilder();
                names = GetsEmployeesContactInfo(graph, false, true, ((FSAppointment)objectRow).AppointmentID);
                return(names.ToString());
            }
            else if (fieldName.ToUpper() == typeof(FSAppointment.wildCard_CustomerPrimaryContact).Name.ToUpper())
            {
                // WildCard_CustomerPrimaryContact
                StringBuilder names = new StringBuilder();

                PXResultset <Contact> bqlResultSet = ReturnsContactList(graph, ((FSAppointment)objectRow).AppointmentID);

                if (bqlResultSet == null)
                {
                    return(names.ToString());
                }

                names = ConcatenatesContactInfo(bqlResultSet, true, false);
                return(names.ToString());
            }
            else if (fieldName.ToUpper() == typeof(FSAppointment.wildCard_CustomerPrimaryContactCell).Name.ToUpper())
            {
                // WildCard_CustomerPrimaryContactCell
                StringBuilder names = new StringBuilder();

                PXResultset <Contact> bqlResultSet = ReturnsContactList(graph, ((FSAppointment)objectRow).AppointmentID);

                if (bqlResultSet == null)
                {
                    return(names.ToString());
                }

                names = ConcatenatesContactInfo(bqlResultSet, false, true);
                return(names.ToString());
            }

            #endregion

            return(null);
        }
 public DocLineExt(PXResult <FSSODet, FSServiceOrder, FSSrvOrdType, FSSODetSplit, INItemPlan> soDetLine)
 {
     this.docLine        = (IDocLine)(FSSODet)soDetLine;
     this.fsPostDoc      = null;
     this.fsServiceOrder = (FSServiceOrder)soDetLine;
     this.fsSrvOrdType   = (FSSrvOrdType)soDetLine;
     this.fsAppointment  = null;
     this.fsPostInfo     = null;
     this.fsSODet        = (FSSODet)soDetLine;
     this.fsSODetSplit   = (FSSODetSplit)soDetLine;
     this.inItemPlan     = (INItemPlan)soDetLine;
 }
 public DocLineExt(PXResult <FSAppointmentInventoryItem, FSAppointment, FSServiceOrder, FSSrvOrdType, FSPostDoc, FSPostInfo, INItemPlan> appointmentDetLine)
 {
     this.docLine        = (IDocLine)(FSAppointmentInventoryItem)appointmentDetLine;
     this.fsPostDoc      = (FSPostDoc)appointmentDetLine;
     this.fsServiceOrder = (FSServiceOrder)appointmentDetLine;
     this.fsSrvOrdType   = (FSSrvOrdType)appointmentDetLine;
     this.fsAppointment  = (FSAppointment)appointmentDetLine;
     this.fsPostInfo     = (FSPostInfo)appointmentDetLine;
     this.fsSODet        = null;
     this.fsSODetSplit   = null;
     this.inItemPlan     = (INItemPlan)appointmentDetLine;
 }
Exemplo n.º 15
0
        protected virtual void _(Events.RowInserted <FSAppointment> e)
        {
            FSAppointment fsAppointmentRow = (FSAppointment)e.Row;
            PXCache       cache            = e.Cache;

            if (fsAppointmentRow == null || string.IsNullOrEmpty(fsAppointmentRow.SrvOrdType))
            {
                return;
            }

            InitServiceOrderRelated(fsAppointmentRow);
            SharedFunctions.InitializeNote(cache, e.Args);
        }
Exemplo n.º 16
0
 public DocLineExt(PXResult <FSAppointmentDet, FSAppointment, FSServiceOrder, FSSrvOrdType, FSPostDoc, FSPostInfo, PMTask> appointmentDetLine)
 {
     this.docLine        = (IDocLine)(FSAppointmentDet)appointmentDetLine;
     this.fsPostDoc      = (FSPostDoc)appointmentDetLine;
     this.fsServiceOrder = (FSServiceOrder)appointmentDetLine;
     this.fsSrvOrdType   = (FSSrvOrdType)appointmentDetLine;
     this.fsAppointment  = (FSAppointment)appointmentDetLine;
     this.fsPostInfo     = (FSPostInfo)appointmentDetLine;
     this.fsSODet        = null;
     this.fsSODetSplit   = null;
     this.inItemPlan     = null;
     this.pmTask         = (PMTask)appointmentDetLine;
 }
Exemplo n.º 17
0
 private static object GetProjectTaskIDToUseInEPActivityApprove(FSAppointment fsAppointmentRow,
                                                                FSAppointmentLog fsAppointmentLogRow,
                                                                FSAppointmentDet fsAppointmentDetRow)
 {
     if (fsAppointmentLogRow != null && fsAppointmentLogRow.DetLineRef != null && fsAppointmentDetRow != null)
     {
         return(fsAppointmentDetRow.ProjectTaskID);
     }
     else
     {
         return(fsAppointmentRow.DfltProjectTaskID);
     }
 }
Exemplo n.º 18
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();
                }
            }
        }
Exemplo n.º 19
0
 private static object GetProjectTaskIDToUseInEPActivityApprove(
     FSAppointment fsAppointmentRow,
     FSAppointmentEmployee fsAppointmentEmployeeRow,
     FSAppointmentDetService fsAppointmentDetServiceRow)
 {
     if (fsAppointmentEmployeeRow != null && fsAppointmentEmployeeRow.ServiceLineRef != null && fsAppointmentDetServiceRow != null)
     {
         return(fsAppointmentDetServiceRow.ProjectTaskID);
     }
     else
     {
         return(fsAppointmentRow.DfltProjectTaskID);
     }
 }
        protected virtual IEnumerable createNew(PXAdapter adapter)
        {
            var graph = PXGraph.CreateInstance <AppointmentEntry>();

            FSAppointment fsAppointmentRow = (FSAppointment)graph.AppointmentRecords.Cache.CreateInstance();

            graph.AppointmentRecords.Insert(fsAppointmentRow);
            graph.AppointmentRecords.Cache.IsDirty = false;

            throw new PXRedirectRequiredException(graph, null)
                  {
                      Mode = PXBaseRedirectException.WindowMode.Same
                  };
        }
Exemplo n.º 21
0
        public virtual void openAppointmentByService()
        {
            if (Services.Current == null)
            {
                return;
            }

            FSAppointment fsAppointmentRow = PXSelect <FSAppointment,
                                                       Where <
                                                           FSAppointment.appointmentID, Equal <Required <FSAppointment.appointmentID> > > >
                                             .SelectSingleBound(this, null, Services.Current.AppointmentID);

            openAppointment(fsAppointmentRow);
        }
Exemplo n.º 22
0
        public virtual void openAppointmentByPickUpDeliveryItem()
        {
            if (PickUpDeliveryItems.Current == null)
            {
                return;
            }

            FSAppointment fsAppointmentRow = PXSelect <FSAppointment,
                                                       Where <
                                                           FSAppointment.appointmentID, Equal <Required <FSAppointment.appointmentID> > > >
                                             .SelectSingleBound(this, null, PickUpDeliveryItems.Current.AppointmentID);

            openAppointment(fsAppointmentRow);
        }
Exemplo n.º 23
0
 private static int?GetTimeSpentToUseInEPActivityApprove(
     FSAppointment fsAppointmentRow,
     FSAppointmentEmployee fsAppointmentEmployeeRow)
 {
     if (fsAppointmentEmployeeRow != null &&
         fsAppointmentEmployeeRow.ServiceLineRef != null)
     {
         return(fsAppointmentEmployeeRow.ActualDuration);
     }
     else
     {
         return((int?)(fsAppointmentRow.ActualDateTimeEnd - fsAppointmentRow.ActualDateTimeBegin).Value.TotalMinutes);
     }
 }
Exemplo n.º 24
0
 public virtual void OnApptEndTimeChangeUpdateLogEndTime(FSAppointment fsAppointmentRow, FSSrvOrdType fsSrvOrdTypeRow,
                                                         AppointmentCore.AppointmentLog_View logRecords)
 {
     if (fsAppointmentRow != null && fsSrvOrdTypeRow?.OnEndTimeChangeUpdateLogEndTime == true)
     {
         foreach (FSAppointmentLog fsAppointmentLogRow in logRecords.Select().RowCast <FSAppointmentLog>()
                  .Where(_ => _.KeepDateTimes == false && _.Type != ID.Type_Log.TRAVEL))
         {
             FSAppointmentLog copy = (FSAppointmentLog)logRecords.Cache.CreateCopy(fsAppointmentLogRow);
             copy.DateTimeEnd = fsAppointmentRow.ActualDateTimeEnd;
             logRecords.Cache.Update(copy);
         }
     }
 }
Exemplo n.º 25
0
        /// <summary>
        /// Reassign the selected appointment <c>RefNbr</c> to the selected RouteDocumentID from the SmartPanel.
        /// </summary>
        /// <param name="fsRouteDocumentRow">New RouteDocumentID where the appointment is going to be assigned.</param>
        /// <param name="refNbr"><c>RefNbr</c> of the appointment to be assigned.</param>
        /// <param name="srvOrdType"><c>SrvOrdType</c> of the appointment to be assigned.</param>
        public static void ReassignAppointmentToRoute(FSRouteDocument fsRouteDocumentRow, string refNbr, string srvOrdType)
        {
            using (PXTransactionScope ts = new PXTransactionScope())
            {
                var graphAppointmentEntry = PXGraph.CreateInstance <AppointmentEntry>();

                FSAppointment fsAppointmentRow = graphAppointmentEntry.AppointmentRecords.Search <FSAppointment.refNbr>(refNbr, srvOrdType);

                int?originalRouteDocumentID     = fsAppointmentRow.RouteDocumentID;
                int?originalAppointmentPosition = fsAppointmentRow.RoutePosition;

                fsAppointmentRow.RoutePosition = null;

                if (fsRouteDocumentRow != null)
                {
                    fsAppointmentRow.RouteID                = fsRouteDocumentRow.RouteID;
                    fsAppointmentRow.RouteDocumentID        = fsRouteDocumentRow.RouteDocumentID;
                    fsAppointmentRow.ScheduledDateTimeBegin = fsRouteDocumentRow.TimeBegin != null ? fsRouteDocumentRow.TimeBegin : fsRouteDocumentRow.Date;
                }
                else
                {
                    fsAppointmentRow.RouteID         = null;
                    fsAppointmentRow.RouteDocumentID = null;

                    //Clear vehicle and driver if exist
                    fsAppointmentRow.VehicleID = null;

                    FSAppointmentEmployee fsAppointmentEmployeeRow = PXSelect <FSAppointmentEmployee,
                                                                               Where <
                                                                                   FSAppointmentEmployee.appointmentID, Equal <Required <FSAppointmentEmployee.appointmentID> >,
                                                                                   And <
                                                                                       FSAppointmentEmployee.isDriver, Equal <True> > > >
                                                                     .Select(graphAppointmentEntry, fsAppointmentRow.AppointmentID);

                    if (fsAppointmentEmployeeRow != null)
                    {
                        graphAppointmentEntry.AppointmentServiceEmployees.Delete(fsAppointmentEmployeeRow);
                    }
                }

                fsAppointmentRow.IsReassigned = true;
                graphAppointmentEntry.AppointmentRecords.Update(fsAppointmentRow);
                graphAppointmentEntry.SelectTimeStamp();
                graphAppointmentEntry.Save.Press();

                ReassignAppointmentPositionsInRoute(originalRouteDocumentID, originalAppointmentPosition);
                ts.Complete();
            }
        }
Exemplo n.º 26
0
 protected virtual void LoadServiceOrderRelated(FSAppointment fsAppointmentRow)
 {
     if (fsAppointmentRow.SrvOrdType != null && fsAppointmentRow.SOID != null &&
         (ServiceOrderRelated.Current == null ||
          (ServiceOrderRelated.Current.SOID != fsAppointmentRow.SOID &&
           fsAppointmentRow.SOID > 0)
         )
         )
     {
         ServiceOrderRelated.Current     = ServiceOrderRelated.SelectSingle(fsAppointmentRow.SOID);
         fsAppointmentRow.BillCustomerID = ServiceOrderRelated.Current?.BillCustomerID;
         fsAppointmentRow.BranchID       = ServiceOrderRelated.Current?.BranchID;
         fsAppointmentRow.CuryID         = ServiceOrderRelated.Current?.CuryID;
     }
 }
Exemplo n.º 27
0
 private static DateTime?GetDateToUseInEPActivityApprove(
     FSAppointment fsAppointmentRow,
     FSAppointmentEmployee fsAppointmentEmployeeRow)
 {
     if (fsAppointmentEmployeeRow != null &&
         fsAppointmentEmployeeRow.ServiceLineRef != null &&
         fsAppointmentEmployeeRow.ActualDateTimeBegin != null)
     {
         return(SharedFunctions.GetCustomDateTime(fsAppointmentRow.ExecutionDate, fsAppointmentEmployeeRow.ActualDateTimeBegin));
     }
     else
     {
         return(SharedFunctions.GetCustomDateTime(fsAppointmentRow.ExecutionDate, fsAppointmentRow.ActualDateTimeBegin));
     }
 }
Exemplo n.º 28
0
 public virtual void VerifyLogActionBaseOnAppointmentStatus(FSAppointment fsAppointmentRow, string type)
 {
     if (fsAppointmentRow.Status == ID.Status_Appointment.AUTOMATIC_SCHEDULED ||
         fsAppointmentRow.Status == ID.Status_Appointment.MANUAL_SCHEDULED ||
         fsAppointmentRow.Status == ID.Status_Appointment.COMPLETED)
     {
         if (type != ID.Type_Log.TRAVEL)
         {
             throw new PXException(PXMessages.LocalizeFormatNoPrefix(TX.Error.LOG_ACTION_NOT_ALLOWED_BY_STATUS
                                                                     , TX.Status_Appointment.AUTOMATIC_SCHEDULED
                                                                     , TX.Status_Appointment.MANUAL_SCHEDULED
                                                                     , TX.Status_Appointment.COMPLETED));
         }
     }
 }
Exemplo n.º 29
0
        public ContractInvoiceLine(PXResult <FSAppointmentDet, FSSODet, FSAppointment> row) : this((IDocLine)(FSAppointmentDet)row)
        {
            FSAppointmentDet fsAppointmentDetRow = (FSAppointmentDet)row;
            FSAppointment    fsAppointmentRow    = (FSAppointment)row;
            FSSODet          fsSODetRow          = (FSSODet)row;

            AppointmentID = fsAppointmentDetRow.AppointmentID;
            AppDetID      = fsAppointmentDetRow.AppDetID;

            BillingRule      = fsSODetRow.BillingRule;
            ContractRelated  = fsAppointmentDetRow.ContractRelated;
            Qty              = fsAppointmentDetRow.ContractRelated == true ? fsAppointmentDetRow.Qty : fsAppointmentDetRow.BillableQty;
            OverageItemPrice = fsAppointmentDetRow.OverageItemPrice;
            SalesPersonID    = fsAppointmentRow.SalesPersonID;
            Commissionable   = fsAppointmentRow.Commissionable;
        }
Exemplo n.º 30
0
 public AppointmentInventoryItemInfo(FSAppointment fsAppointmentRow,
                                     FSServiceOrder fsServiceOrderRow,
                                     FSSrvOrdType fsSrvOrdTypeRow,
                                     FSAppointmentDet fsAppointmentDet,
                                     FSAppointmentDet fsAppointmentInventoryItemRow,
                                     int index)
 {
     this.FSAppointmentRow           = fsAppointmentRow;
     this.FSServiceOrderRow          = fsServiceOrderRow;
     this.FSSrvOrdTypeRow            = fsSrvOrdTypeRow;
     this.FSAppointmentDet           = fsAppointmentDet;
     this.FSAppointmentInventoryItem = fsAppointmentInventoryItemRow;
     this.AppointmentID = fsAppointmentRow.AppointmentID;
     this.ServiceType   = fsAppointmentDet.ServiceType;
     this.Index         = index;
 }