示例#1
0
        public void UpdateTranDeductibleFromInventory(IRUTROTableLine line, IRUTROTable document)
        {
            if (line == null)
            {
                return;
            }

            InventoryItem item = PXSelect <InventoryItem, Where <InventoryItem.inventoryID, Equal <Required <InventoryItem.inventoryID> > > > .Select(Base, line.GetInventoryID());

            InventoryItemRUTROT itemRR = RUTROTHelper.GetExtensionNullable <InventoryItem, InventoryItemRUTROT>(item);

            if (itemRR == null)
            {
                return;
            }

            if (document?.IsRUTROTDeductible == true)
            {
                line.IsRUTROTDeductible = itemRR.IsRUTROTDeductible == true;
            }
            else
            {
                line.IsRUTROTDeductible = false;
            }

            if (itemRR.RUTROTItemType != null)
            {
                line.RUTROTItemType = itemRR.RUTROTItemType;
            }
            if (itemRR.RUTROTWorkTypeID != null)
            {
                line.RUTROTWorkTypeID = itemRR.RUTROTWorkTypeID;
            }
        }
示例#2
0
        public void CheckRUTROTLine(PXCache sender, IRUTROTable document, IRUTROTableLine line, RUTROT rutrot)
        {
            if (line != null && document != null && rutrot != null)
            {
                if (document.IsRUTROTDeductible == true)
                {
                    if (line.GetInventoryID() != null)
                    {
                        string        value = rutrot.RUTROTType;
                        InventoryItem item  = (InventoryItem)PXSelect <InventoryItem, Where <InventoryItem.inventoryID, Equal <Required <InventoryItem.inventoryID> > > > .Select(Base, line.GetInventoryID());

                        InventoryItemRUTROT itemRR = RUTROTHelper.GetExtensionNullable <InventoryItem, InventoryItemRUTROT>(item);
                        if (!RUTROTHelper.IsItemMatchRUTROTType(value, item, itemRR, itemRR?.IsRUTROTDeductible == true))
                        {
                            Base.Transactions.Cache.RaiseExceptionHandling <SOLine.inventoryID>(line, item.InventoryCD, new PXSetPropertyException <SOLine.inventoryID>(RUTROTMessages.LineDoesNotMatchDoc));
                            throw new PXSetPropertyException <SOLine.inventoryID>(RUTROTMessages.LineDoesNotMatchDoc);
                        }
                    }
                }
            }
        }