示例#1
0
        protected virtual void INComponent_RowSelected(PXCache sender, PXRowSelectedEventArgs e)
        {
            var component = e.Row as INComponent;

            SetComponentControlsState(sender, component);

            InventoryHelper.CheckZeroDefaultTerm <INComponent.deferredCode, INComponent.defaultTerm>(sender, component);
        }
        protected override void InventoryItem_RowSelected(PXCache sender, PXRowSelectedEventArgs e)
        {
            base.InventoryItem_RowSelected(sender, e);

            var item = e.Row as InventoryItem;

            if (item == null)
            {
                return;
            }

            //Multiple Components are not supported for CashReceipt Deferred Revenue:
            DRDeferredCode dc = PXSelect <DRDeferredCode, Where <DRDeferredCode.deferredCodeID, Equal <Current <InventoryItem.deferredCode> > > > .Select(this);

            PXUIFieldAttribute.SetEnabled <POVendorInventory.isDefault>(this.VendorItems.Cache, null, true);

            //Initial State for Components:
            Components.Cache.AllowDelete = false;
            Components.Cache.AllowInsert = false;
            Components.Cache.AllowUpdate = false;

            SetDefaultTermControlsState(sender, item);

            if (item.IsSplitted == true)
            {
                Components.Cache.AllowDelete = true;
                Components.Cache.AllowInsert = true;
                Components.Cache.AllowUpdate = true;
                item.TotalPercentage         = SumComponentsPercentage();
                PXUIFieldAttribute.SetEnabled <InventoryItem.useParentSubID>(sender, item, true);
            }
            else
            {
                PXUIFieldAttribute.SetEnabled <InventoryItem.useParentSubID>(sender, item, false);
                item.UseParentSubID  = false;
                item.TotalPercentage = 100;
            }
            if (item.NonStockReceipt == true)
            {
                PXUIFieldAttribute.SetRequired <InventoryItem.postClassID>(sender, true);
            }
            else
            {
                PXUIFieldAttribute.SetRequired <InventoryItem.postClassID>(sender, false);
            }
            InventoryHelper.CheckZeroDefaultTerm <InventoryItem.deferredCode, InventoryItem.defaultTerm>(sender, item);
            PXUIFieldAttribute.SetVisible <InventoryItem.taxCalcMode>(sender, item, item.ItemType == INItemTypes.ExpenseItem);

            sender.Adjust <PXUIFieldAttribute>(item).For <InventoryItem.completePOLine>(fa => fa.Enabled = (item.TemplateItemID == null))
            .SameFor <InventoryItem.nonStockReceipt>()
            .SameFor <InventoryItem.nonStockShip>();
        }