コード例 #1
0
        public virtual object SetExpenseAccountSub(PXCache sender, PXFieldDefaultingEventArgs e, InventoryItem item, int?siteID,
                                                   GetAccountSubUsingPostingClassDelegate GetAccountSubUsingPostingClass,
                                                   GetAccountSubFromItemDelegate GetAccountSubFromItem)
        {
            object expenseAccountSubID = null;

            expenseAccountSubID = GetExpenseAccountSub(sender, e, item, siteID, GetAccountSubUsingPostingClass, GetAccountSubFromItem);

            e.NewValue = expenseAccountSubID;
            e.Cancel   = true;

            return(expenseAccountSubID);
        }
コード例 #2
0
 public virtual object GetExpenseAccountSub(PXCache sender, PXFieldDefaultingEventArgs e, int?inventoryID, int?siteID,
                                            GetAccountSubUsingPostingClassDelegate GetAccountSubUsingPostingClass,
                                            GetAccountSubFromItemDelegate GetAccountSubFromItem)
 {
     if (inventoryID != null)
     {
         InventoryItem item = PX.Objects.IN.InventoryItem.PK.Find(sender.Graph, inventoryID);
         if (item != null && item.StkItem != true)
         {
             return(GetExpenseAccountSub(sender, e, item, siteID, GetAccountSubUsingPostingClass, GetAccountSubFromItem));
         }
     }
     return(null);
 }
コード例 #3
0
        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);
        }