Пример #1
0
        public virtual void UpdateServiceOrderDetail(PXCache cache, CRActivity crActivityRow, PXDBOperation operation)
        {
            FSServiceOrder fsServiceOrderRow = GetServiceOrderRecord(cache.Graph, crActivityRow);

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

                if (pmTimeActivityRow == null)
                {
                    return;
                }

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

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

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

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

                if (graphServiceOrder.IsDirty)
                {
                    graphServiceOrder.Save.Press();
                }
            }
        }
 protected virtual IAddressBase GetToAddress(FSServiceOrder order, FSAppointmentDet line)
 {
     /*if (order.WillCall == true && line.SiteID != null && !(line.POCreate == true && line.POSource == INReplenishmentSource.DropShipToOrder))
      *  return GetFromAddress(order, line); // will call
      * else*/
     return(GetToAddress(order));
 }
        public static void Process(FSServiceOrder doc)
        {
            List <FSServiceOrder> list = new List <FSServiceOrder>();

            list.Add(doc);
            Process(list, false);
        }
        protected virtual void _(Events.RowSelected <CROpportunity> e)
        {
            if (e.Row == null)
            {
                return;
            }

            CROpportunity crOpportunityRow = (CROpportunity)e.Row;
            PXCache       cache            = e.Cache;

            FSxCROpportunity fsxCROpportunityRow = cache.GetExtension <FSxCROpportunity>(crOpportunityRow);

            FSServiceOrder fsServiceOrderRow = CRExtensionHelper.GetRelatedServiceOrder(Base, cache, crOpportunityRow, fsxCROpportunityRow.SOID);
            FSSrvOrdType   fsSrvOrdTypeRow   = null;

            if (fsServiceOrderRow != null)
            {
                fsSrvOrdTypeRow = CRExtensionHelper.GetServiceOrderType(Base, fsServiceOrderRow.SrvOrdType);
            }

            EnableDisableExtensionFields(cache, fsxCROpportunityRow, fsServiceOrderRow);
            EnableDisableActions(cache, crOpportunityRow, fsxCROpportunityRow, fsServiceOrderRow, fsSrvOrdTypeRow);
            SetPersistingChecks(cache, crOpportunityRow, fsxCROpportunityRow, fsSrvOrdTypeRow);

            HideOrShowFieldsActionsByInventoryFeature();
        }
            protected virtual void FSAppointment_taxZoneID_FieldDefaulting(PXCache sender, PXFieldDefaultingEventArgs e)
            {
                var row = e.Row as FSAppointment;

                if (row == null)
                {
                    return;
                }

                FSServiceOrder fsServiceOrderRow = ((AppointmentEntryBase)sender.Graph).ServiceOrderRelated.Current;

                if (fsServiceOrderRow == null)
                {
                    return;
                }

                var customerLocation = (Location)PXSelect <Location,
                                                           Where <Location.bAccountID, Equal <Required <Location.bAccountID> >,
                                                                  And <Location.locationID, Equal <Required <Location.locationID> > > > > .
                                       Select(sender.Graph, row.BillCustomerID, fsServiceOrderRow.BillLocationID);

                if (customerLocation != null)
                {
                    if (!string.IsNullOrEmpty(customerLocation.CTaxZoneID))
                    {
                        e.NewValue = customerLocation.CTaxZoneID;
                    }
                    else
                    {
                        var address = (Address)PXSelect <Address,
                                                         Where <Address.addressID, Equal <Required <Address.addressID> > > > .
                                      Select(sender.Graph, customerLocation.DefAddressID);

                        if (address != null && !string.IsNullOrEmpty(address.PostalCode))
                        {
                            e.NewValue = TaxBuilderEngine.GetTaxZoneByZip(sender.Graph, address.PostalCode);
                        }
                    }
                }
                if (e.NewValue == null)
                {
                    var branchLocationResult = (PXResult <Branch, BAccount, Location>) PXSelectJoin <Branch,
                                                                                                     InnerJoin <BAccount, On <BAccount.bAccountID, Equal <Branch.bAccountID> >,
                                                                                                                InnerJoin <Location, On <Location.locationID, Equal <BAccount.defLocationID> > > >,
                                                                                                     Where <
                                                                                                         Branch.branchID, Equal <Required <Branch.branchID> > > >
                                               .Select(sender.Graph, row.BranchID);

                    var branchLocation = (Location)branchLocationResult;

                    if (branchLocation != null && branchLocation.VTaxZoneID != null)
                    {
                        e.NewValue = branchLocation.VTaxZoneID;
                    }
                    else
                    {
                        e.NewValue = row.TaxZoneID;
                    }
                }
            }
Пример #6
0
        /// <summary>
        /// Returns the set of contacts of a customer.
        /// </summary>
        private static PXResultset <Contact> ReturnsContactList(PXGraph graph, int?appointmentID)
        {
            FSServiceOrder fsServiceOrderRow = (FSServiceOrder)PXSelectJoin <FSServiceOrder,
                                                                             InnerJoin <FSAppointment,
                                                                                        On <
                                                                                            FSServiceOrder.sOID, Equal <FSAppointment.sOID>,
                                                                                            And <
                                                                                                FSServiceOrder.srvOrdType, Equal <FSAppointment.srvOrdType> > > >,
                                                                             Where <
                                                                                 FSAppointment.appointmentID, Equal <Required <FSAppointment.appointmentID> > > >
                                               .Select(graph, appointmentID);

            if (fsServiceOrderRow == null || fsServiceOrderRow.CustomerID == null)
            {
                return(null);
            }

            PXResultset <Contact> bqlResultSet = PXSelect <Contact,
                                                           Where <
                                                               Contact.bAccountID, Equal <Required <Contact.bAccountID> >,
                                                               And <
                                                                   Contact.contactType, Equal <ContactTypesAttribute.person>,
                                                                   And <
                                                                       Contact.isActive, Equal <True> > > > >
                                                 .Select(graph, fsServiceOrderRow.CustomerID);

            return(bqlResultSet);
        }
Пример #7
0
        private void CreateServiceOrderDocument(CRCaseMaint graphCRCaseMaint, CRCase crCaseRow, FSCreateServiceOrderOnCaseFilter fsCreateServiceOrderOnCaseFilterRow)
        {
            if (graphCRCaseMaint == null ||
                crCaseRow == null ||
                fsCreateServiceOrderOnCaseFilterRow == null)
            {
                return;
            }

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

            FSServiceOrder newServiceOrderRow = CRExtensionHelper.InitNewServiceOrder(CreateServiceOrderFilter.Current.SrvOrdType, ID.SourceType_ServiceOrder.CASE);

            graphServiceOrderEntry.ServiceOrderRecords.Current = graphServiceOrderEntry.ServiceOrderRecords.Insert(newServiceOrderRow);

            CRExtensionHelper.UpdateServiceOrderHeader(
                graphServiceOrderEntry,
                Base.Case.Cache,
                crCaseRow,
                fsCreateServiceOrderOnCaseFilterRow,
                graphServiceOrderEntry.ServiceOrderRecords.Current,
                true);

            graphServiceOrderEntry.ServiceOrderRecords.Current.SourceID     = crCaseRow.CaseID;
            graphServiceOrderEntry.ServiceOrderRecords.Current.SourceRefNbr = crCaseRow.CaseCD;

            if (!Base.IsContractBasedAPI)
            {
                throw new PXRedirectRequiredException(graphServiceOrderEntry, null);
            }
        }
Пример #8
0
        private void EnableDisableCustomFields(
            PXCache cache,
            CRCase crCaseRow,
            FSxCRCase fsxCRCaseRow,
            FSServiceOrder fsServiceOrderRow,
            FSSrvOrdType fsSrvOrdTypeRow)
        {
            bool isSMSetup = GetFSSetup() != null;

            if (fsSrvOrdTypeRow != null)
            {
                bool isAnInternalSrvOrdType = fsSrvOrdTypeRow.Behavior == ID.Behavior_SrvOrderType.INTERNAL_APPOINTMENT;

                PXUIFieldAttribute.SetEnabled <CRCase.customerID>(
                    cache,
                    null,
                    isAnInternalSrvOrdType ||
                    (!isAnInternalSrvOrdType && fsServiceOrderRow == null));
            }
            else
            {
                PXUIFieldAttribute.SetEnabled <CRCase.customerID>(
                    cache,
                    null,
                    true);
            }
        }
Пример #9
0
        protected override void _(Events.FieldSelecting <Extensions.ContactAddress.Document, Extensions.ContactAddress.Document.allowOverrideContactAddress> e)
        {
            var row = e.Row as Extensions.ContactAddress.Document;

            if (row == null)
            {
                return;
            }

            FSSrvOrdType   fSSrvOrdTypeRow   = (FSSrvOrdType)GetSrvOrdTypeView().Current;
            FSServiceOrder fsServiceOrderRow = (FSServiceOrder)e.Cache.GetMain <Extensions.ContactAddress.Document>(row);

            if (fSSrvOrdTypeRow == null || fsServiceOrderRow == null)
            {
                return;
            }

            if (
                (fSSrvOrdTypeRow.AppAddressSource == ID.SrvOrdType_AppAddressSource.BUSINESS_ACCOUNT &&
                 (row.LocationID == null)
                )
                ||
                (fSSrvOrdTypeRow.AppAddressSource == ID.SrvOrdType_AppAddressSource.CUSTOMER_CONTACT &&
                 (row.ContactID == null)
                )
                ||
                (fSSrvOrdTypeRow.AppAddressSource == ID.SrvOrdType_AppAddressSource.BRANCH_LOCATION &&
                 fsServiceOrderRow.BranchLocationID == null
                )
                )
            {
                e.ReturnValue = false;
            }
        }
        /// <summary>
        /// Try to get the appropriate ServiceOrderType from this sources:
        /// a. <c>FSServiceOrder</c>
        /// b. <c>FSWrkProcessRow</c>
        /// c. <c>FSSetup</c>
        /// </summary>
        /// <param name="fsWrkProcessRow"><c>FSWrkProcess</c> row.</param>
        /// <param name="fsServiceOrderRow">FSServiceOrder row.</param>
        private string GetSrvOrdType(FSWrkProcess fsWrkProcessRow, FSServiceOrder fsServiceOrderRow)
        {
            // a) Try to retrieve the ServiceOrderType from the ServiceOrder row
            if (fsWrkProcessRow.SOID != null &&
                fsServiceOrderRow != null &&
                !string.IsNullOrEmpty(fsServiceOrderRow.SrvOrdType))
            {
                return(fsServiceOrderRow.SrvOrdType);
            }

            // b) Try to retrieve the ServiceOrderType from the WrkProcess row
            if (!string.IsNullOrEmpty(fsWrkProcessRow.SrvOrdType) &&
                !string.IsNullOrWhiteSpace(fsWrkProcessRow.SrvOrdType))
            {
                return(fsWrkProcessRow.SrvOrdType);
            }

            // c) Try to retrieve the Default ServiceOrderType from the Setup row
            FSSetup fsSetupRow = PXSetup <FSSetup> .Select(this);

            if (fsSetupRow != null &&
                !string.IsNullOrEmpty(fsSetupRow.DfltSrvOrdType))
            {
                return(fsSetupRow.DfltSrvOrdType);
            }

            return(null);
        }
Пример #11
0
            private int?GetAcct(PXGraph graph,
                                IFSSODetBase fsSODetBase,
                                FSAppointmentDet fsAppointmentInventoryItem,
                                FSServiceOrder fsServiceOrderRow,
                                FSSrvOrdType fsSrvOrdTypeRow)
            {
                int?acctID = null;

                if (fsSODetBase != null)
                {
                    if (fsSODetBase.AcctID != null)
                    {
                        acctID = fsSODetBase.AcctID;
                    }
                    else
                    {
                        acctID = ServiceOrderCore.Get_TranAcctID_DefaultValue(graph,
                                                                              fsSrvOrdTypeRow.SalesAcctSource,
                                                                              fsSODetBase.InventoryID,
                                                                              fsSODetBase.SiteID,
                                                                              fsServiceOrderRow);
                    }
                }
                else if (fsAppointmentInventoryItem != null)
                {
                    acctID = ServiceOrderCore.Get_TranAcctID_DefaultValue(graph,
                                                                          fsSrvOrdTypeRow.SalesAcctSource,
                                                                          fsAppointmentInventoryItem.InventoryID,
                                                                          fsAppointmentInventoryItem.SiteID,
                                                                          fsServiceOrderRow);
                }

                return(acctID);
            }
        /// <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);
        }
Пример #13
0
        protected virtual IEnumerable fixedDemand()
        {
            PXView select = new PXView(Base, false, Base.FixedDemand.View.BqlSelect);

            Int32         totalrow = 0;
            Int32         startrow = PXView.StartRow;
            List <object> result   = select.Select(PXView.Currents, PXView.Parameters, PXView.Searches,
                                                   PXView.SortColumns, PXView.Descendings, PXView.Filters, ref startrow, PXView.MaximumRows, ref totalrow);

            PXView.StartRow = 0;

            foreach (PXResult <POFixedDemand, InventoryItem, Vendor, POVendorInventory, CRLocation, SOOrder, SOLineSplit, SOLine, INItemClass, FSServiceOrder> rec in result)
            {
                var demand = (POFixedDemand)rec;
                var item   = (InventoryItem)rec;
                var vendor = (Vendor)rec;
                var price  = (POVendorInventory)rec;
                Base.EnumerateAndPrepareFixedDemandRow(demand, item, vendor, price);

                FSServiceOrder fsServiceOrderRow = (FSServiceOrder)rec;
                SOOrder        soOrderRow        = (SOOrder)rec;

                if (fsServiceOrderRow.CustomerID != null)
                {
                    soOrderRow.CustomerID = fsServiceOrderRow.CustomerID;
                }

                FSxPOFixedDemand fSxPOFixedDemandRow = Base.FixedDemand.Cache.GetExtension <FSxPOFixedDemand>(demand);
                fSxPOFixedDemandRow.FSRefNbr = fsServiceOrderRow.RefNbr;
            }

            return(result);
        }
        /// <summary>
        /// Check the ManageRooms value on Setup to check/hide the Rooms Values options.
        /// </summary>
        private void HideRooms()
        {
            bool isRoomManagementActive = ServiceManagementSetup.IsRoomManagementActive(this, SetupRecord?.Current);

            FSServiceOrder fsServiceOrderRow = ServiceOrderRelated.SelectSingle();

            PXUIFieldAttribute.SetVisible <FSServiceOrder.roomID>(this.ServiceOrderRelated.Cache, fsServiceOrderRow, isRoomManagementActive);
        }
Пример #15
0
        public virtual void UpdateBillingInfoInDocs(int?currentCustomerID, int?currentBillingCycleID)
        {
            var tempGraph       = new PXGraph();
            var cutOffDateCache = new Dictionary <BillingCycleIDAndDate, DateTime?>();

            var resultSet = PXSelectJoin <FSServiceOrder,
                                          CrossJoinSingleTable <FSSetup,
                                                                LeftJoin <FSCustomerBillingSetup,
                                                                          On <
                                                                              FSCustomerBillingSetup.customerID, Equal <FSServiceOrder.billCustomerID>,
                                                                              And <
                                                                                  Where2 <
                                                                                      Where <FSSetup.customerMultipleBillingOptions, Equal <False>,
                                                                                             And <FSCustomerBillingSetup.srvOrdType, IsNull,
                                                                                                  And <FSCustomerBillingSetup.active, Equal <True> > > >,
                                                                                      Or <
                                                                                          Where <FSSetup.customerMultipleBillingOptions, Equal <True>,
                                                                                                 And <FSCustomerBillingSetup.srvOrdType, Equal <FSServiceOrder.srvOrdType>,
                                                                                                      And <FSCustomerBillingSetup.active, Equal <True> > > > > > > > > >,
                                          Where2 <
                                              Where <FSServiceOrder.postedBy, IsNull>,
                                              And <
                                                  Where2 <
                                                      Where <Required <FSServiceOrder.billCustomerID>, IsNotNull,
                                                             And <FSServiceOrder.billCustomerID, Equal <Required <FSServiceOrder.billCustomerID> > > >,
                                                      Or <
                                                          Where2 <
                                                              Where <Required <FSServiceOrder.billCustomerID>, IsNull>,
                                                              And <
                                                                  Where2 <
                                                                      Where2 <
                                                                          Where <FSServiceOrder.cBID, IsNull,
                                                                                 And <FSCustomerBillingSetup.cBID, IsNotNull> >,
                                                                          Or <
                                                                              Where <FSServiceOrder.cBID, IsNotNull,
                                                                                     And <FSCustomerBillingSetup.cBID, IsNull> > > >,
                                                                      Or <
                                                                          Where2 <
                                                                              Where <
                                                                                  FSServiceOrder.cBID, NotEqual <FSCustomerBillingSetup.cBID>,
                                                                                  Or <
                                                                                      Where <
                                                                                          FSCustomerBillingSetup.cBID, IsNotNull,
                                                                                          And <
                                                                                              FSServiceOrder.cutOffDate, IsNull> > > >,
                                                                              Or <
                                                                                  Where <
                                                                                      FSCustomerBillingSetup.billingCycleID, Equal <Required <FSCustomerBillingSetup.billingCycleID> > > > > > > > > > > > > >
                            .Select(tempGraph, currentCustomerID, currentCustomerID, currentCustomerID, currentBillingCycleID);

            foreach (PXResult <FSServiceOrder, FSSetup, FSCustomerBillingSetup> result in resultSet)
            {
                FSServiceOrder         fsServiceOrderRow         = (FSServiceOrder)result;
                FSCustomerBillingSetup fsCustomerBillingSetupRow = (FSCustomerBillingSetup)result;

                UpdateBillingInfoInDoc(tempGraph, fsServiceOrderRow, fsCustomerBillingSetupRow.CBID, fsCustomerBillingSetupRow.BillingCycleID, currentBillingCycleID != null, currentCustomerID != null, cutOffDateCache);
            }
        }
        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();
        }
        public static FSServiceOrder InitNewServiceOrder(string srvOrdType, string sourceType)
        {
            FSServiceOrder fsServiceOrderRow = new FSServiceOrder();

            fsServiceOrderRow.SrvOrdType = srvOrdType;
            fsServiceOrderRow.SourceType = sourceType;

            return(fsServiceOrderRow);
        }
Пример #18
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;
                    }
                }
            }
        }
Пример #19
0
        public virtual void CreateServiceOrderDocument(OpportunityMaint graphOpportunityMaint, CROpportunity crOpportunityRow, FSCreateServiceOrderFilter fsCreateServiceOrderFilterRow)
        {
            if (graphOpportunityMaint == null ||
                crOpportunityRow == null ||
                fsCreateServiceOrderFilterRow == null)
            {
                return;
            }

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

            FSServiceOrder newServiceOrderRow = CRExtensionHelper.InitNewServiceOrder(fsCreateServiceOrderFilterRow.SrvOrdType, ID.SourceType_ServiceOrder.OPPORTUNITY);

            CRSetup crSetupRow = GetCRSetup();

            graphServiceOrderEntry.ServiceOrderRecords.Current = graphServiceOrderEntry.ServiceOrderRecords.Insert(newServiceOrderRow);

            CRExtensionHelper.UpdateServiceOrderHeader(graphServiceOrderEntry,
                                                       Base.Opportunity.Cache,
                                                       crOpportunityRow,
                                                       fsCreateServiceOrderFilterRow,
                                                       graphServiceOrderEntry.ServiceOrderRecords.Current,
                                                       Base.Opportunity_Contact.Current,
                                                       Base.Opportunity_Address.Current,
                                                       true);

            SharedFunctions.CopyNotesAndFiles(Base.Opportunity.Cache,
                                              graphServiceOrderEntry.ServiceOrderRecords.Cache,
                                              crOpportunityRow, graphServiceOrderEntry.ServiceOrderRecords.Current,
                                              crSetupRow.CopyNotes,
                                              crSetupRow.CopyFiles);

            foreach (CROpportunityProducts crOpportunityProductsRow in graphOpportunityMaint.Products.Select())
            {
                if (crOpportunityProductsRow.InventoryID != null)
                {
                    InventoryItem inventoryItemRow = SharedFunctions.GetInventoryItemRow(graphServiceOrderEntry, crOpportunityProductsRow.InventoryID);

                    if (inventoryItemRow.StkItem == true &&
                        graphServiceOrderEntry.ServiceOrderTypeSelected.Current.PostTo == ID.SrvOrdType_PostTo.ACCOUNTS_RECEIVABLE_MODULE)
                    {
                        throw new PXException(TX.Error.STOCKITEM_NOT_HANDLED_BY_SRVORDTYPE, inventoryItemRow.InventoryCD);
                    }

                    FSxCROpportunityProducts fsxCROpportunityProductsRow = graphOpportunityMaint.Products.Cache.GetExtension <FSxCROpportunityProducts>(crOpportunityProductsRow);
                    CRExtensionHelper.InsertFSSODetFromOpportunity(graphServiceOrderEntry, graphOpportunityMaint.Products.Cache, crSetupRow, crOpportunityProductsRow, fsxCROpportunityProductsRow, inventoryItemRow);
                }
            }

            graphServiceOrderEntry.ServiceOrderRecords.Current.SourceRefNbr = crOpportunityRow.OpportunityID;

            if (!Base.IsContractBasedAPI)
            {
                throw new PXRedirectRequiredException(graphServiceOrderEntry, null);
            }
        }
 protected void DeleteUnpersistedServiceOrderRelated(FSAppointment fsAppointmentRow)
 {
     // Deleting unpersisted FSServiceOrder record
     if (fsAppointmentRow.SOID < 0)
     {
         FSServiceOrder fsServiceOrderRow = ServiceOrderRelated.SelectSingle();
         ServiceOrderRelated.Delete(fsServiceOrderRow);
         fsAppointmentRow.SOID = null;
     }
 }
Пример #21
0
        protected virtual void _(Events.FieldUpdated <FSServiceOrder, FSServiceOrder.branchLocationID> e)
        {
            FSServiceOrder row = e.Row;

            if (row == null)
            {
                return;
            }

            SetDefaultContactAndAddress(e.Cache, e.Row, row.ContactID, row.LocationID, (int?)e.OldValue, ContacAddressCallerEnum.BranchLocationID);
        }
 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;
 }
 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;
 }
Пример #24
0
        public virtual void EnableDisableActions(PXCache cache,
                                                 CRCase crCaseRow,
                                                 FSxCRCase fsxCRCaseRow,
                                                 FSServiceOrder fsServiceOrderRow,
                                                 FSSrvOrdType fsSrvOrdTypeRow)
        {
            bool isSMSetup = GetFSSetup() != null;

            CreateServiceOrder.SetEnabled(isSMSetup && crCaseRow != null && !string.IsNullOrWhiteSpace(crCaseRow.CaseCD) && fsServiceOrderRow == null);
            ViewServiceOrder.SetEnabled(isSMSetup && crCaseRow != null && !string.IsNullOrWhiteSpace(crCaseRow.CaseCD) && fsServiceOrderRow != null);
            OpenAppointmentBoard.SetEnabled(fsServiceOrderRow != null);
        }
Пример #25
0
        public virtual void EnableDisableCustomFields(PXCache cache,
                                                      CROpportunity crOpportunityRow,
                                                      FSxCROpportunity fsxCROpportunityRow,
                                                      FSServiceOrder fsServiceOrderRow,
                                                      FSSrvOrdType fsSrvOrdTypeRow)
        {
            bool isSMSetup = GetFSSetup() != null;

            PXUIFieldAttribute.SetEnabled <FSxCROpportunity.sDEnabled>(cache, null, isSMSetup && fsServiceOrderRow == null);
            PXUIFieldAttribute.SetEnabled <FSxCROpportunity.srvOrdType>(cache, null, isSMSetup && fsxCROpportunityRow.SDEnabled == true && fsServiceOrderRow == null);
            PXUIFieldAttribute.SetEnabled <FSxCROpportunity.branchLocationID>(cache, null, isSMSetup && fsxCROpportunityRow.SDEnabled == true);
        }
Пример #26
0
        private void EnableDisableActions(
            PXCache cache,
            CRCase crCaseRow,
            FSxCRCase fsxCRCaseRow,
            FSServiceOrder fsServiceOrderRow,
            FSSrvOrdType fsSrvOrdTypeRow)
        {
            bool isSMSetup = GetFSSetup() != null;

            CreateServiceOrder.SetEnabled(isSMSetup && crCaseRow != null && crCaseRow.CaseID > 0 && fsServiceOrderRow == null);
            ViewServiceOrder.SetEnabled(isSMSetup && crCaseRow != null && crCaseRow.CaseID > 0 && fsServiceOrderRow != null);
            OpenAppointmentBoard.SetEnabled(fsServiceOrderRow != null);
        }
Пример #27
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;
 }
Пример #28
0
        public static FSServiceOrder GetRelatedServiceOrder(PXGraph graph, PXCache chache, IBqlTable crTable, int?sOID)
        {
            FSServiceOrder fsServiceOrderRow = null;

            if (sOID != null && chache.GetStatus(crTable) != PXEntryStatus.Inserted)
            {
                fsServiceOrderRow = PXSelect <FSServiceOrder,
                                              Where <
                                                  FSServiceOrder.sOID, Equal <Required <FSServiceOrder.sOID> > > >
                                    .Select(graph, sOID);
            }

            return(fsServiceOrderRow);
        }
        protected virtual IAddressBase GetFromAddress(FSServiceOrder order)
        {
            FSAddress returnAdrress = PXSelectJoin <FSAddress,
                                                    InnerJoin <
                                                        FSBranchLocation,
                                                        On <FSBranchLocation.branchLocationAddressID, Equal <FSAddress.addressID> > >,
                                                    Where <
                                                        FSBranchLocation.branchLocationID, Equal <Required <FSBranchLocation.branchLocationID> > > >
                                      .Select(Base, order.BranchLocationID)
                                      .RowCast <FSAddress>()
                                      .FirstOrDefault();

            return(returnAdrress);
        }
Пример #30
0
        public ContractInvoiceLine(PXResult <FSSODet, FSServiceOrder> row) : this((IDocLine)(FSSODet)row)
        {
            FSSODet        fsSODetRow        = (FSSODet)row;
            FSServiceOrder fsServiceOrderRow = (FSServiceOrder)row;

            SOID    = fsSODetRow.SOID;
            SODetID = fsSODetRow.SODetID;

            BillingRule      = fsSODetRow.BillingRule;
            ContractRelated  = fsSODetRow.ContractRelated;
            Qty              = fsSODetRow.ContractRelated == true ? fsSODetRow.EstimatedQty : fsSODetRow.BillableQty;
            OverageItemPrice = fsSODetRow.CuryExtraUsageUnitPrice;
            SalesPersonID    = fsServiceOrderRow.SalesPersonID;
            Commissionable   = fsServiceOrderRow.Commissionable;
        }