Example #1
0
        public static void SetUnpersistedFSInfo(PXCache cache, PXRowSelectingEventArgs e)
        {
            if (e.Row == null)
            {
                return;
            }

            ARInvoice arInvoiceRow = (ARInvoice)e.Row;

            if (arInvoiceRow.CreatedByScreenID == null || arInvoiceRow.CreatedByScreenID.Substring(0, 2) == "FS")
            {
                // If the document was created by FS then the FS fields will be visible
                // regardless of whether there is equipment information
                return;
            }

            FSxARInvoice fsxARInvoiceRow = cache.GetExtension <FSxARInvoice>(arInvoiceRow);

            if (PXAccess.FeatureInstalled <FeaturesSet.equipmentManagementModule>() == false)
            {
                fsxARInvoiceRow.HasFSEquipmentInfo = false;
                return;
            }

            if (fsxARInvoiceRow.HasFSEquipmentInfo == null)
            {
                using (new PXConnectionScope())
                {
                    PXResultset <InventoryItem> inventoryItemSet = PXSelectJoin <InventoryItem,
                                                                                 InnerJoin <ARTran,
                                                                                            On <
                                                                                                ARTran.inventoryID, Equal <InventoryItem.inventoryID>,
                                                                                                And <ARTran.tranType, Equal <ARDocType.invoice> > >,
                                                                                            InnerJoin <SOLineSplit,
                                                                                                       On <
                                                                                                           SOLineSplit.orderType, Equal <ARTran.sOOrderType>,
                                                                                                           And <SOLineSplit.orderNbr, Equal <ARTran.sOOrderNbr>,
                                                                                                                And <SOLineSplit.lineNbr, Equal <ARTran.sOOrderLineNbr> > > >,
                                                                                                       InnerJoin <SOLine,
                                                                                                                  On <
                                                                                                                      SOLine.orderType, Equal <SOLineSplit.orderType>,
                                                                                                                      And <SOLine.orderNbr, Equal <SOLineSplit.orderNbr>,
                                                                                                                           And <SOLine.lineNbr, Equal <SOLineSplit.lineNbr> > > >,
                                                                                                                  LeftJoin <SOShipLineSplit,
                                                                                                                            On <
                                                                                                                                SOShipLineSplit.origOrderType, Equal <SOLineSplit.orderType>,
                                                                                                                                And <SOShipLineSplit.origOrderNbr, Equal <SOLineSplit.orderNbr>,
                                                                                                                                     And <SOShipLineSplit.origLineNbr, Equal <SOLineSplit.lineNbr>,
                                                                                                                                          And <SOShipLineSplit.origSplitLineNbr, Equal <SOLineSplit.splitLineNbr> > > > > > > > >,
                                                                                 Where <
                                                                                     ARTran.tranType, Equal <Required <ARInvoice.docType> >,
                                                                                     And <ARTran.refNbr, Equal <Required <ARInvoice.refNbr> >,
                                                                                          And <FSxSOLine.equipmentAction, NotEqual <ListField_EquipmentAction.None> > > > >
                                                                   .Select(cache.Graph, arInvoiceRow.DocType, arInvoiceRow.RefNbr);

                    fsxARInvoiceRow.HasFSEquipmentInfo = inventoryItemSet.Count > 0 ? true : false;
                }
            }
        }
        public virtual bool IsFSIntegrationEnabled()
        {
            if (IsActive() == false)
            {
                return(false);
            }


            ARInvoice    arInvoiceRow    = Base.Document.Current;
            FSxARInvoice fsxARInvoiceRow = Base.Document.Cache.GetExtension <FSxARInvoice>(arInvoiceRow);

            return(SM_ARInvoiceEntry.IsFSIntegrationEnabled(arInvoiceRow, fsxARInvoiceRow));
        }
        protected virtual void ARTran_RowSelected(PXCache cache, PXRowSelectedEventArgs e)
        {
            ARInvoice    arInvoiceRow    = Base.Document.Current;
            FSxARInvoice fsxARInvoiceRow = Base.Document.Cache.GetExtension <FSxARInvoice>(arInvoiceRow);

            bool fsIntegrationEnabled = IsFSIntegrationEnabled(arInvoiceRow, fsxARInvoiceRow);

            DACHelper.SetExtensionVisibleInvisible <FSxARTran>(cache, e, fsIntegrationEnabled, false);

            if (e.Row == null)
            {
                return;
            }
        }
        public static bool IsFSIntegrationEnabled(ARInvoice arInvoiceRow, FSxARInvoice fsxARInvoiceRow)
        {
            if (arInvoiceRow.CreatedByScreenID.Substring(0, 2) == "FS")
            {
                return(true);
            }

            if (fsxARInvoiceRow.HasFSEquipmentInfo == true)
            {
                return(true);
            }

            return(false);
        }