Esempio n. 1
0
        public PXLicensedGraph()
        {
            var licence = (ClientLicencingSetup)LicenceSetup.SelectWindowed(0, 1, this.GetType().Name);

            if (licence == null)
            {
                throw new PXException("Customization '{0}' requires a licence.", this.GetType().Name);
            }
            else if (licence.IsValid != true)
            {
                throw new PXException("Customization '{0}' key is invalid.", this.GetType().Name);
            }
        }
        public virtual object GetExpenseAccountSub(PXCache sender, PXFieldDefaultingEventArgs e, InventoryItem item, int?siteID,
                                                   GetAccountSubUsingPostingClassDelegate GetAccountSubUsingPostingClass,
                                                   GetAccountSubFromItemDelegate GetAccountSubFromItem)
        {
            object expenseAccountSubID = null;

            if (item != null && item.StkItem != true)
            {
                var insetup = (INSetup)PXSetup <INSetup> .SelectWindowed(sender.Graph, 0, 1);

                if (item.NonStockReceipt == true && PXAccess.FeatureInstalled <FeaturesSet.inventory>() && insetup != null && insetup.UpdateGL == true)
                {
                    INPostClass postClass = INPostClass.PK.Find(sender.Graph, item.PostClassID);
                    if (postClass != null)
                    {
                        var site = INSite.PK.Find(sender.Graph, siteID);
                        try
                        {
                            expenseAccountSubID = GetAccountSubUsingPostingClass(item, site, postClass);
                        }
                        catch (PXMaskArgumentException)
                        {
                        }
                    }
                    else
                    {
                        expenseAccountSubID = null;
                    }
                }
                else
                {
                    expenseAccountSubID = GetAccountSubFromItem(item);
                }
            }

            return(expenseAccountSubID);
        }