protected virtual void INItemSiteReplenishment_RowSelected(PXCache sender, PXRowSelectedEventArgs e)
        {
            INItemSiteReplenishment row = (INItemSiteReplenishment)e.Row;

            PXUIFieldAttribute.SetEnabled <INItemSiteReplenishment.safetyStockSuggested>(sender, null, false);
            PXUIFieldAttribute.SetEnabled <INItemSiteReplenishment.minQtySuggested>(sender, null, false);
            PXUIFieldAttribute.SetEnabled <INItemSiteReplenishment.maxQtySuggested>(sender, null, false);
            PXUIFieldAttribute.SetEnabled <INItemSiteReplenishment.demandPerDayAverage>(sender, null, false);
            PXUIFieldAttribute.SetEnabled <INItemSiteReplenishment.demandPerDayMSE>(sender, null, false);
            PXUIFieldAttribute.SetEnabled <INItemSiteReplenishment.demandPerDayMAD>(sender, null, false);
        }
        protected virtual IEnumerable UpdateReplenishment(PXAdapter adapter)
        {
            foreach (PXResult <INItemSite> r in adapter.Get())
            {
                INItemSite s = r;
                if (s.SubItemOverride == true && insetup.Current.UseInventorySubItem == true)
                {
                    foreach (INItemSiteReplenishment rep in this.subitemrecords.View.SelectMulti(new object[] { s }))
                    {
                        INItemSiteReplenishment upd = PXCache <INItemSiteReplenishment> .CreateCopy(rep);

                        upd.SafetyStock = s.SafetyStock ?? 0m;
                        upd.MinQty      = s.MinQty ?? 0m;
                        upd.MaxQty      = s.MaxQty ?? 0m;
                        upd.TransferERQ = s.TransferERQ ?? 0m;
                        this.subitemrecords.Update(upd);
                    }
                }
                yield return(s);
            }
        }
        public static void DefaultSubItemReplenishment(PXGraph graph, INItemSite itemsite)
        {
            if (itemsite == null)
            {
                return;
            }

            foreach (INItemSiteReplenishment r in
                     PXSelect <INItemSiteReplenishment,
                               Where <INItemSiteReplenishment.siteID, Equal <Current <INItemSite.siteID> >,
                                      And <INItemSiteReplenishment.inventoryID, Equal <Current <INItemSite.inventoryID> > > > >
                     .SelectMultiBound(graph, new object[] { itemsite }))
            {
                graph.Caches[typeof(INItemSiteReplenishment)].Delete(r);
            }

            foreach (INSubItemRep r in
                     PXSelect <INSubItemRep,
                               Where <INSubItemRep.inventoryID, Equal <Current <INItemSite.inventoryID> >,
                                      And <INSubItemRep.replenishmentClassID, Equal <Current <INItemSite.replenishmentClassID> > > > >
                     .Select(graph, itemsite.InventoryID))
            {
                INItemSiteReplenishment sr = new INItemSiteReplenishment();
                sr.InventoryID = r.InventoryID;
                sr.SiteID      = itemsite.SiteID;
                sr.SubItemID   = r.SubItemID;
                sr.SafetyStock = r.SafetyStock;
                sr.MinQty      = r.MinQty;
                sr.MaxQty      = r.MaxQty;
                sr.TransferERQ = r.TransferERQ;
                sr.ItemStatus  = r.ItemStatus;
                graph.Caches[typeof(INItemSiteReplenishment)].Insert(sr);
            }
            if (graph.Caches[typeof(INItemSiteReplenishment)].IsDirty)
            {
                graph.Views.Caches.Add(typeof(INItemSiteReplenishment));
            }
        }