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();
        }
        public virtual void SetPersistingChecks(PXCache cache,
                                                CROpportunity crOpportunityRow,
                                                FSxCROpportunity fsxCROpportunityRow,
                                                FSSrvOrdType fsSrvOrdTypeRow)
        {
            if (fsxCROpportunityRow.SDEnabled == true)
            {
                PXDefaultAttribute.SetPersistingCheck <FSxCROpportunity.srvOrdType>(cache, crOpportunityRow, PXPersistingCheck.NullOrBlank);
                PXDefaultAttribute.SetPersistingCheck <FSxCROpportunity.branchLocationID>(cache, crOpportunityRow, PXPersistingCheck.NullOrBlank);

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

                if (fsSrvOrdTypeRow != null &&
                    fsSrvOrdTypeRow.Behavior != ID.Behavior_SrvOrderType.INTERNAL_APPOINTMENT)
                {
                    PXDefaultAttribute.SetPersistingCheck <CROpportunity.bAccountID>(cache, crOpportunityRow, PXPersistingCheck.NullOrBlank);
                    PXDefaultAttribute.SetPersistingCheck <CROpportunity.locationID>(cache, crOpportunityRow, PXPersistingCheck.NullOrBlank);
                }
            }
            else
            {
                PXDefaultAttribute.SetPersistingCheck <FSxCROpportunity.srvOrdType>(cache, crOpportunityRow, PXPersistingCheck.Nothing);
                PXDefaultAttribute.SetPersistingCheck <FSxCROpportunity.branchLocationID>(cache, crOpportunityRow, PXPersistingCheck.Nothing);
                PXDefaultAttribute.SetPersistingCheck <CROpportunity.bAccountID>(cache, crOpportunityRow, PXPersistingCheck.Nothing);
                PXDefaultAttribute.SetPersistingCheck <CROpportunity.locationID>(cache, crOpportunityRow, PXPersistingCheck.Nothing);
            }
        }
示例#3
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);
            }
        }
示例#4
0
        private void SetPersistingChecks(
            PXCache cache,
            CRCase crCaseRow,
            FSxCRCase fsxCRCaseRow,
            FSSrvOrdType fsSrvOrdTypeRow)
        {
            if (fsxCRCaseRow.SDEnabled == true)
            {
                PXDefaultAttribute.SetPersistingCheck <FSxCRCase.srvOrdType>(cache, crCaseRow, PXPersistingCheck.NullOrBlank);
                PXDefaultAttribute.SetPersistingCheck <FSxCRCase.branchLocationID>(cache, crCaseRow, PXPersistingCheck.NullOrBlank);

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

                if (fsSrvOrdTypeRow != null &&
                    fsSrvOrdTypeRow.Behavior != ID.Behavior_SrvOrderType.INTERNAL_APPOINTMENT)
                {
                    PXDefaultAttribute.SetPersistingCheck <CROpportunity.bAccountID>(cache, crCaseRow, PXPersistingCheck.NullOrBlank);
                    if (PXAccess.FeatureInstalled <FeaturesSet.accountLocations>() == true)
                    {
                        PXDefaultAttribute.SetPersistingCheck <CROpportunity.locationID>(cache, crCaseRow, PXPersistingCheck.NullOrBlank);
                    }
                }
            }
            else
            {
                PXDefaultAttribute.SetPersistingCheck <FSxCROpportunity.srvOrdType>(cache, crCaseRow, PXPersistingCheck.Nothing);
                PXDefaultAttribute.SetPersistingCheck <FSxCROpportunity.branchLocationID>(cache, crCaseRow, PXPersistingCheck.Nothing);
                PXDefaultAttribute.SetPersistingCheck <CROpportunity.bAccountID>(cache, crCaseRow, PXPersistingCheck.Nothing);
                PXDefaultAttribute.SetPersistingCheck <CROpportunity.locationID>(cache, crCaseRow, PXPersistingCheck.Nothing);
            }
        }
        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);
            }
        }
        public virtual void openAppointmentBoard()
        {
            if (Base.Opportunity == null || Base.Opportunity.Current == null)
            {
                return;
            }

            if (Base.IsDirty)
            {
                Base.Save.Press();
            }

            FSxCROpportunity fsxCROpportunityRow = Base.Opportunity.Cache.GetExtension <FSxCROpportunity>(Base.Opportunity.Current);

            if (fsxCROpportunityRow != null && fsxCROpportunityRow.SOID != null)
            {
                CRExtensionHelper.LaunchEmployeeBoard(Base, fsxCROpportunityRow.SOID);
            }
        }
        public virtual void viewServiceOrder()
        {
            if (Base.Opportunity == null || Base.Opportunity.Current == null)
            {
                return;
            }

            if (Base.IsDirty)
            {
                Base.Save.Press();
            }

            FSxCROpportunity fsxCROpportunityRow = Base.Opportunity.Cache.GetExtension <FSxCROpportunity>(Base.Opportunity.Current);

            if (fsxCROpportunityRow != null && fsxCROpportunityRow.SOID != null)
            {
                CRExtensionHelper.LaunchServiceOrderScreen(Base, fsxCROpportunityRow.SOID);
            }
        }
示例#8
0
        protected void CRCase_RowSelected(PXCache cache, PXRowSelectedEventArgs e)
        {
            if (e.Row == null)
            {
                return;
            }

            CRCase    crCaseRow    = (CRCase)e.Row;
            FSxCRCase fsxCRCaseRow = cache.GetExtension <FSxCRCase>(crCaseRow);

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

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

            EnableDisableCustomFields(cache, crCaseRow, fsxCRCaseRow, fsServiceOrderRow, fsSrvOrdTypeRow);
            EnableDisableActions(cache, crCaseRow, fsxCRCaseRow, fsServiceOrderRow, fsSrvOrdTypeRow);
            SetPersistingChecks(cache, crCaseRow, fsxCRCaseRow, fsSrvOrdTypeRow);
        }