public virtual IEnumerable Stores() { KCProcessingEntry filter = ProcessingEntry.Current; PXSelectReadonly <KCSiteMaster> existingStores = new PXSelectReadonly <KCSiteMaster>(this); if (filter == null) { yield break; } bool found = false; foreach (KCStore item in stores.Cache.Inserted) { found = true; item.Entity = filter.Entity; item.DateFrom = filter.DateFrom; item.DateTo = filter.DateTo; yield return(item); } if (found) { yield break; } foreach (KCSiteMaster result in existingStores.Select()) { KCStore store = new KCStore { SiteMasterCD = result.SiteMasterCD, AccountId = result.AccountId, Descr = result.Descr, Entity = filter.Entity, DateFrom = filter.DateFrom, DateTo = filter.DateTo }; yield return(stores.Insert(store)); } stores.Cache.IsDirty = false; }
public virtual IEnumerable screens() { bool found = false; foreach (Screen item in Screens.Cache.Inserted) { found = true; yield return(item); } if (found) { yield break; } foreach (Screen screen in GetAllScreensWithAttachmentsSupport(this)) { yield return(Screens.Insert(screen)); } Screens.Cache.IsDirty = false; }
public virtual IEnumerable stores() { KCBulkProductSyncConfig filter = Config.Current; if (filter == null) { yield break; } bool found = false; foreach (KCStore item in Stores.Cache.Inserted) { found = true; item.Entity = KCConstants.Product; yield return(item); } if (found) { yield break; } foreach (KCSiteMaster result in StoreConfig.Select()) { KCStore store = new KCStore { SiteMasterCD = result.SiteMasterCD, AccountId = result.AccountId, Descr = result.Descr, Entity = KCConstants.Product }; yield return(Stores.Insert(store)); } Stores.Cache.IsDirty = false; }
protected virtual IEnumerable initemlist() { INSiteFilter filter = Filter.Current; if (filter == null) { yield break; } bool found = false; foreach (INUpdateStdCostRecord item in INItemList.Cache.Inserted) { found = true; yield return(item); } if (found) { yield break; } if (Filter.Current.SiteID == null) { //Non-Stock: PXSelectBase <InventoryItem> inventoryItems = new PXSelect <InventoryItem, Where <InventoryItem.stkItem, Equal <boolFalse>, And <InventoryItem.itemStatus, NotEqual <INItemStatus.inactive>, And <InventoryItem.itemStatus, NotEqual <INItemStatus.toDelete>, And <InventoryItem.pendingStdCostDate, LessEqual <Current <INSiteFilter.pendingStdCostDate> > > > > > >(this); foreach (InventoryItem item in inventoryItems.Select()) { INUpdateStdCostRecord record = new INUpdateStdCostRecord(); record.InventoryID = item.InventoryID; record.RecordID = 1; record.InvtAcctID = item.InvtAcctID; record.InvtSubID = item.InvtSubID; record.PendingStdCost = item.PendingStdCost; record.PendingStdCostDate = item.PendingStdCostDate; record.StdCost = item.StdCost; yield return(INItemList.Insert(record)); } PXSelectBase <INItemSite> itemSites = new PXSelectJoin <INItemSite, InnerJoin <InventoryItem, On <InventoryItem.inventoryID, Equal <INItemSite.inventoryID>, And <Match <InventoryItem, Current <AccessInfo.userName> > > > >, Where <INItemSite.valMethod, Equal <INValMethod.standard>, And <INItemSite.siteStatus, Equal <INItemStatus.active>, And <InventoryItem.itemStatus, NotEqual <INItemStatus.inactive>, And <InventoryItem.itemStatus, NotEqual <INItemStatus.toDelete>, And <INItemSite.pendingStdCostDate, LessEqual <Current <INSiteFilter.pendingStdCostDate> > > > > > > >(this); foreach (INItemSite item in itemSites.Select()) { INUpdateStdCostRecord record = new INUpdateStdCostRecord(); record.InventoryID = item.InventoryID; record.SiteID = item.SiteID; record.RecordID = item.SiteID; record.InvtAcctID = item.InvtAcctID; record.InvtSubID = item.InvtSubID; record.PendingStdCost = item.PendingStdCost; record.PendingStdCostDate = item.PendingStdCostDate; record.StdCost = item.StdCost; record.StdCostOverride = item.StdCostOverride; yield return(INItemList.Insert(record)); } } else { //Stock PXSelectBase <INItemSite> s = new PXSelectJoin <INItemSite, InnerJoin <InventoryItem, On <InventoryItem.inventoryID, Equal <INItemSite.inventoryID>, And <Match <InventoryItem, Current <AccessInfo.userName> > > > >, Where <INItemSite.valMethod, Equal <INValMethod.standard>, And <INItemSite.siteStatus, Equal <INItemStatus.active>, And <INItemSite.siteID, Equal <Current <INSiteFilter.siteID> >, And <InventoryItem.itemStatus, NotEqual <INItemStatus.inactive>, And <InventoryItem.itemStatus, NotEqual <INItemStatus.toDelete>, And <Where <INItemSite.pendingStdCostDate, LessEqual <Current <INSiteFilter.pendingStdCostDate> >, Or <Current <INSiteFilter.revalueInventory>, Equal <boolTrue> > > > > > > > > >(this); foreach (INItemSite item in s.Select()) { INUpdateStdCostRecord record = new INUpdateStdCostRecord(); record.InventoryID = item.InventoryID; record.SiteID = item.SiteID; record.RecordID = item.SiteID; record.InvtAcctID = item.InvtAcctID; record.InvtSubID = item.InvtSubID; record.PendingStdCost = item.PendingStdCost; record.PendingStdCostDate = item.PendingStdCostDate; record.StdCost = item.StdCost; record.StdCostOverride = item.StdCostOverride; yield return(INItemList.Insert(record)); } } }