protected virtual void OnPMDetailInventoryIDFieldUpdated(PXCache sender, PXFieldUpdatedEventArgs e)
        {
            PMDetail row = e.Row as PMDetail;

            InventoryItem item = PXSelect <InventoryItem, Where <InventoryItem.inventoryID, Equal <Required <InventoryItem.inventoryID> > > > .Select(this, row.InventoryID);

            if (item != null && row != null)
            {
                row.UOM         = item.SalesUnit;
                row.ItemFee     = item.BasePrice;
                row.Description = item.Descr;

                if (Task.Current != null && Task.Current.CustomerID != null)
                {
                    Customer customer = PXSelect <Customer, Where <Customer.bAccountID, Equal <Current <PMTask.customerID> > > > .Select(this);

                    if (customer != null && !string.IsNullOrEmpty(customer.LocaleName))
                    {
                        row.Description = PXDBLocalizableStringAttribute.GetTranslation(Caches[typeof(InventoryItem)], item, nameof(InventoryItem.Descr), customer.LocaleName);
                    }
                }

                sender.SetDefaultExt <PMDetail.curyItemFee>(e.Row);
            }
        }
        protected virtual void PMDetail_RowInserting(PXCache sender, PXRowInsertingEventArgs e)
        {
            PMDetail row = e.Row as PMDetail;

            if (row != null)
            {
                row.ContractID = Task.Current.ProjectID;

                #region Check for Uniqueness
                if (row.InventoryID.HasValue)
                {
                    PMDetail item = PXSelect <PMDetail,
                                              Where <PMDetail.inventoryID, Equal <Required <InventoryItem.inventoryID> >,
                                                     And <PMDetail.contractID, Equal <Current <PMTask.projectID> >,
                                                          And <PMDetail.taskID, Equal <Current <PMTask.taskID> > > > > > .SelectWindowed(this, 0, 1, row.InventoryID);

                    if (item != null && item.PMDetailID != row.PMDetailID)
                    {
                        sender.RaiseExceptionHandling <PMDetail.inventoryID>(row, row.InventoryID, new PXException(CT.Messages.ItemNotUnique));
                        e.Cancel = true;
                    }
                }
                #endregion
            }
        }
        protected virtual void OnPMDetailInventoryIDFieldUpdated(PXCache sender, PXFieldUpdatedEventArgs e)
        {
            PMDetail row = (PMDetail)e.Row;

            if (row == null)
            {
                return;
            }

            InventoryItem item = PXSelect <InventoryItem, Where <InventoryItem.inventoryID, Equal <Required <InventoryItem.inventoryID> > > > .Select(this, row.InventoryID);

            if (item != null)
            {
                row.UOM         = item.SalesUnit;
                row.ItemFee     = item.BasePrice;
                row.Description = item.Descr;
                PMProject project = PXSelectorAttribute.Select <PMTran.projectID>(sender, e.Row) as PMProject;

                if (project != null && project.CustomerID != null)
                {
                    AR.Customer customer = PXSelectReadonly <AR.Customer, Where <AR.Customer.bAccountID, Equal <Required <AR.Customer.bAccountID> > > > .Select(this, project.CustomerID);

                    if (!string.IsNullOrEmpty(customer?.LocaleName))
                    {
                        row.Description = PXDBLocalizableStringAttribute.GetTranslation(Caches[typeof(InventoryItem)], item, nameof(InventoryItem.Descr), customer.LocaleName);
                    }
                }
                sender.SetDefaultExt <PMDetail.curyItemFee>(e.Row);
            }
        }
        protected virtual void PMDetail_RowSelected(PXCache sender, PXRowSelectedEventArgs e)
        {
            PMDetail row = e.Row as PMDetail;

            if (row != null && Task.Current != null)
            {
                PXUIFieldAttribute.SetEnabled <PMDetail.included>(sender, row, Task.Current.IsActive != true);
            }
        }
        protected virtual void PMDetail_RowSelected(PXCache sender, PXRowSelectedEventArgs e)
        {
            PMDetail row = e.Row as PMDetail;

            if (row != null && Task.Current != null)
            {
                PXUIFieldAttribute.SetEnabled <PMDetail.included>(sender, row, Task.Current.IsActive != true);
                PXUIFieldAttribute.SetEnabled <PMDetail.accountID>(sender, e.Row, row.AccountSource != PMAccountSource.None);
                PXUIFieldAttribute.SetEnabled <PMDetail.subID>(sender, e.Row, row.AccountSource != PMAccountSource.None);
                PXUIFieldAttribute.SetEnabled <PMDetail.subMask>(sender, e.Row, row.AccountSource != PMAccountSource.None);
            }
        }