public static string GetDefaultLotSerClass(PXGraph graph) { INLotSerClass lotSerClass = PXSelect <INLotSerClass, Where <INLotSerClass.lotSerTrack, Equal <INLotSerTrack.notNumbered> > > .Select(graph); if (lotSerClass == null) { PXCache cache = graph.Caches <INLotSerClass>(); INLotSerClass lotser = (INLotSerClass)cache.CreateInstance(); lotser.LotSerClassID = DfltLotSerialClass; lotser.LotSerTrack = INLotSerTrack.NotNumbered; cache.Insert(lotser); return(lotser.LotSerClassID); } else { return(lotSerClass.LotSerClassID); } }
protected virtual void OnNewCombination() { string[] attributeIdentifiers = _templateAttributes.Keys.ToArray(); if (attributeIdentifiers == null) { throw new PXArgumentException(nameof(attributeIdentifiers)); } if (_attributeValues == null) { throw new PXArgumentException(nameof(_attributeValues)); } if (_attributeValues.Length != attributeIdentifiers.Length) { throw new PXArgumentException($"{nameof(_attributeValues)}.{nameof(_attributeValues.Length)}"); } PXCache itemCache = _graph.Caches <INAttributeDescriptionItem>(); var description = new List <string>(); for (int attributeIndex = 0; attributeIndex < attributeIdentifiers.Length; attributeIndex++) { var newItem = (INAttributeDescriptionItem)itemCache.CreateInstance(); newItem.TemplateID = _template.InventoryID; newItem.GroupID = _numberOfCombination; newItem.AttributeID = attributeIdentifiers[attributeIndex]; newItem.ValueID = _attributeValues[attributeIndex]; newItem = (INAttributeDescriptionItem)itemCache.Insert(newItem); string valueDescription = CRAttribute.Attributes[newItem.AttributeID].Values .Where(v => v.ValueID == newItem.ValueID).FirstOrDefault()?.Description; description.Add(valueDescription); } PXCache groupCache = _graph.Caches <INAttributeDescriptionGroup>(); var newGroup = (INAttributeDescriptionGroup)groupCache.CreateInstance(); newGroup.TemplateID = _template.InventoryID; newGroup.GroupID = _numberOfCombination; newGroup.Description = string.Join(Separator, description); newGroup = (INAttributeDescriptionGroup)groupCache.Insert(newGroup); }
private void CreateCustomerProcessingCenterRecord(CustomerPaymentMethod customerPM, CCSynchronizeCard syncCard) { PXCache customerProcessingCenterCache = Caches[typeof(CustomerProcessingCenterID)]; customerProcessingCenterCache.ClearQueryCacheObsolete(); PXSelectBase <CustomerProcessingCenterID> checkRecordExist = new PXSelectReadonly <CustomerProcessingCenterID, Where <CustomerProcessingCenterID.cCProcessingCenterID, Equal <Required <CreditCardsFilter.processingCenterId> >, And <CustomerProcessingCenterID.bAccountID, Equal <Required <CustomerProcessingCenterID.bAccountID> >, And <CustomerProcessingCenterID.customerCCPID, Equal <Required <CustomerProcessingCenterID.customerCCPID> > > > > >(this); CustomerProcessingCenterID cProcessingCenter = checkRecordExist.SelectSingle(syncCard.CCProcessingCenterID, syncCard.BAccountID, syncCard.CustomerCCPID); if (cProcessingCenter == null) { cProcessingCenter = customerProcessingCenterCache.CreateInstance() as CustomerProcessingCenterID; cProcessingCenter.BAccountID = syncCard.BAccountID; cProcessingCenter.CCProcessingCenterID = syncCard.CCProcessingCenterID; cProcessingCenter.CustomerCCPID = syncCard.CustomerCCPID; customerProcessingCenterCache.Insert(cProcessingCenter); customerProcessingCenterCache.Persist(PXDBOperation.Insert); } }
protected void CreateCustomerProcessingCenterRecord(V2.TranProfile input) { PXCache customerProcessingCenterCache = Base.Caches[typeof(CustomerProcessingCenterID)]; customerProcessingCenterCache.ClearQueryCacheObsolete(); PXSelectBase <CustomerProcessingCenterID> checkRecordExist = new PXSelectReadonly <CustomerProcessingCenterID, Where <CustomerProcessingCenterID.cCProcessingCenterID, Equal <Required <CustomerProcessingCenterID.cCProcessingCenterID> >, And <CustomerProcessingCenterID.bAccountID, Equal <Required <CustomerProcessingCenterID.bAccountID> >, And <CustomerProcessingCenterID.customerCCPID, Equal <Required <CustomerProcessingCenterID.customerCCPID> > > > > >(Base); CustomerProcessingCenterID cProcessingCenter = checkRecordExist.SelectSingle(SelectedProcessingCenter, SelectedBAccount, input.CustomerProfileId); if (cProcessingCenter == null) { cProcessingCenter = customerProcessingCenterCache.CreateInstance() as CustomerProcessingCenterID; cProcessingCenter.BAccountID = SelectedBAccount; cProcessingCenter.CCProcessingCenterID = SelectedProcessingCenter; cProcessingCenter.CustomerCCPID = input.CustomerProfileId; customerProcessingCenterCache.Insert(cProcessingCenter); customerProcessingCenterCache.Persist(PXDBOperation.Insert); } }
private PXFieldState CreateFieldStateForFieldValue(object returnState, string entityType, string cacheName, string fieldName) { Type type = GraphHelper.GetType(entityType); if (type != null) { Type cachetype = GraphHelper.GetType(cacheName); if (cachetype == null) { return(null); } PXCache cache = this.Caches[cachetype]; PXDBAttributeAttribute.Activate(cache); PXFieldState state = cache.GetStateExt(null, fieldName) as PXFieldState; if (state != null) { if (returnState == null) { object item = cache.CreateInstance(); object newValue; cache.RaiseFieldDefaulting(fieldName, item, out newValue); if (newValue != null) { cache.RaiseFieldSelecting(fieldName, item, ref newValue, false); } state.Value = newValue; } else { state.Value = returnState; } state.Enabled = true; } return(state); } return(null); }
public RMReportRange(PXGraph graph, string dimensionName, RMReportConstants.WildcardMode wildcardMode, RMReportConstants.BetweenMode betweenMode) { _cache = graph.Caches[typeof(T)]; _instance = (T)_cache.CreateInstance(); _ranges = new Dictionary <string, List <T> >(); _rangeSegments = new Dictionary <string, HashSet <T> >(); Dimension dim = PXSelect <Dimension, Where <Dimension.dimensionID, Equal <Required <Dimension.dimensionID> > > > .Select(graph, dimensionName); if (dim != null && dim.Length != null) { _wildcard = new String(RMReportConstants.DefaultWildcardChar, (int)dim.Length); } else { _wildcard = ""; } _wildcardMode = wildcardMode; _betweenMode = betweenMode; }
public void CreateCustomerPaymentMethodRecord(CCSynchronizeCard item) { PXCache customerPaymentMethodCache = Caches[typeof(CustomerPaymentMethod)]; CustomerPaymentMethod customerPM = customerPaymentMethodCache.CreateInstance() as CustomerPaymentMethod; customerPM.BAccountID = item.BAccountID; customerPM.CustomerCCPID = item.CustomerCCPID; customerPM.Descr = item.CardNumber; customerPM.PaymentMethodID = item.PaymentMethodID; customerPM.CashAccountID = item.CashAccountID; customerPM.CCProcessingCenterID = item.CCProcessingCenterID; if (item.ExpirationDate != null) { customerPaymentMethodCache.SetValueExt <CustomerPaymentMethod.expirationDate>(customerPM, item.ExpirationDate); } customerPaymentMethodCache.Insert(customerPM); customerPaymentMethodCache.Persist(PXDBOperation.Insert); customerPM = customerPaymentMethodCache.Current as CustomerPaymentMethod; CreateCustomerPaymentMethodDetailRecord(customerPM, item); CreateCustomerProcessingCenterRecord(customerPM, item); }
private void CreateActivity(int classId, Guid?refNoteID, string typeCode, Guid?owner, PXRedirectHelper.WindowMode windowMode = PXRedirectHelper.WindowMode.NewWindow) { var graphType = CRActivityPrimaryGraphAttribute.GetGraphType(classId); if (!PXAccess.VerifyRights(graphType)) { throw new AccessViolationException(CR.Messages.FormNoAccessRightsMessage(graphType)); } CRActivity activity = null; var cache = CreateInstanceCache <CRActivity>(graphType); if (cache == null) { return; } if (owner == null) { owner = EmployeeMaint.GetCurrentEmployeeID(cache.Graph); } Action <object> initializeHandler = delegate(object act1) { var act = act1 as CRActivity; if (act == null) { return; } act.ClassID = classId; act.RefNoteID = refNoteID; if (!string.IsNullOrEmpty(typeCode)) { act.Type = typeCode; } act.OwnerID = owner; }; EntityHelper helper = new EntityHelper(cache.Graph); var type = helper.GetEntityRowType(refNoteID); var entity = helper.GetEntityRow(type, refNoteID); Type entityGraphType = null; if (type != null) { PXPrimaryGraphAttribute.FindPrimaryGraph(cache.Graph.Caches[type], ref entity, out entityGraphType); } if (entityGraphType != null) { PXGraph entry = PXGraph.CreateInstance(entityGraphType); PXCache <CRActivity> activityCache = entry.Caches[typeof(CRActivity)] as PXCache <CRActivity>; if (activityCache != null) { entry.Views[entry.PrimaryView].Cache.Current = entity; activity = (CRActivity)activityCache.CreateInstance(); if (initializeHandler != null) { initializeHandler(activity); } activity = activityCache.InitNewRow(activity); } } if (activity == null) { activity = (CRActivity)cache.CreateInstance(); initializeHandler(activity); activity = ((PXCache <CRActivity>)cache).InitNewRow(activity); } cache.Update(activity); PXRedirectHelper.TryRedirect(cache.Graph, windowMode); }
protected void ViewCount() { if (pageid != null) { Guid currentwikipage = new Guid(pageid); PXGraph article = PXGraph.CreateInstance(typeof(KBArticleMaint)); PXCache responsesummary = article.Caches[typeof(KBResponseSummary)]; PXCache responses = article.Caches[typeof(KBResponse)]; PXResult <WikiPage, WikiPageLanguage, WikiRevision> result = (PXResult <WikiPage, WikiPageLanguage, WikiRevision>) PXSelectJoin <WikiPage, InnerJoin <WikiPageLanguage, On <WikiPageLanguage.pageID, Equal <WikiPage.pageID> >, InnerJoin <WikiRevision, On <WikiRevision.pageID, Equal <WikiPage.pageID> > > >, Where <WikiPage.pageID, Equal <Required <WikiPage.pageID> > > > .SelectWindowed(new PXGraph(), 0, 1, currentwikipage); Guid userId = PXAccess.GetUserID(); PXResult <KBResponseSummary> resultsummary = (PXResult <KBResponseSummary>) PXSelect <KBResponseSummary, Where <KBResponseSummary.pageID, Equal <Required <KBResponseSummary.pageID> > > > .SelectWindowed(article, 0, 1, currentwikipage); PXResult <KBResponse> resnonse = (PXResult <KBResponse>) PXSelect <KBResponse, Where <KBResponse.userID, Equal <Required <KBResponse.userID> >, And <KBResponse.pageID, Equal <Required <KBResponse.pageID> > > > > .SelectWindowed(article, 0, 1, userId, currentwikipage); if (result != null) { WikiPage wp = result[typeof(WikiPage)] as WikiPage; WikiPageLanguage wpl = result[typeof(WikiPageLanguage)] as WikiPageLanguage; KBResponseSummary kbrs = responsesummary.CreateInstance() as KBResponseSummary; KBResponse newresnonse = responses.CreateInstance() as KBResponse; if (resultsummary != null) { kbrs = resultsummary[typeof(KBResponseSummary)] as KBResponseSummary; } if (resnonse != null) { newresnonse = resnonse[typeof(KBResponse)] as KBResponse; } if (wp != null && wpl != null) { if (kbrs == null || kbrs.PageID == null) { kbrs.PageID = currentwikipage; kbrs.Views = 1; kbrs.Markcount = 0; kbrs.Marksummary = 0; kbrs.CreatedByID = wp.CreatedByID; kbrs.CreatedByScreenID = "WP00000"; kbrs.CreatedDateTime = wp.CreatedDateTime; kbrs.LastModifiedByID = wp.LastModifiedByID; kbrs.LastModifiedByScreenID = "WP00000"; kbrs.LastModifiedDateTime = wp.LastModifiedDateTime; kbrs.tstamp = wp.tstamp; responsesummary.Insert(kbrs); responsesummary.PersistInserted(kbrs); responsesummary.Clear(); } else { kbrs.Views++; responsesummary.Update(kbrs); responsesummary.PersistUpdated(kbrs); responsesummary.Clear(); } if (newresnonse == null || newresnonse.PageID == null) { newresnonse.PageID = currentwikipage; newresnonse.RevisionID = 1; newresnonse.OldMark = 0; newresnonse.NewMark = 0; newresnonse.Date = PXTimeZoneInfo.Now; newresnonse.UserID = userId; newresnonse.Summary = ""; newresnonse.CreatedByID = wp.CreatedByID; newresnonse.CreatedByScreenID = "WP00000"; newresnonse.CreatedDateTime = wp.CreatedDateTime; newresnonse.LastModifiedByID = wp.LastModifiedByID; newresnonse.LastModifiedByScreenID = "WP00000"; newresnonse.LastModifiedDateTime = wp.LastModifiedDateTime; newresnonse.tstamp = wp.tstamp; responses.Insert(newresnonse); responses.PersistInserted(newresnonse); responses.Clear(); } } } } }
protected void Rate_PageRate(object sender, EventArgs e) { Filltables(); Guid currentwikipage = new Guid(pageid); PXGraph article = PXGraph.CreateInstance(typeof(KBArticleMaint)); PXCache response = article.Caches[typeof(KBResponse)]; PXCache responsesummary = article.Caches[typeof(KBResponseSummary)]; PXResult <WikiPage, WikiPageLanguage, WikiRevision> result = (PXResult <WikiPage, WikiPageLanguage, WikiRevision>) PXSelectJoin <WikiPage, InnerJoin <WikiPageLanguage, On <WikiPageLanguage.pageID, Equal <WikiPage.pageID> >, InnerJoin <WikiRevision, On <WikiRevision.pageID, Equal <WikiPage.pageID> > > >, Where <WikiPage.pageID, Equal <Required <WikiPage.pageID> > >, OrderBy <Desc <WikiRevision.pageRevisionID> > > .SelectWindowed(new PXGraph(), 0, 1, currentwikipage); Guid userId = PXAccess.GetUserID(); PXResult <KBResponseSummary> resultsummary = (PXResult <KBResponseSummary>) PXSelect <KBResponseSummary, Where <KBResponseSummary.pageID, Equal <Required <KBResponseSummary.pageID> > > > .SelectWindowed(article, 0, 1, currentwikipage); PXResult <KBResponse> resnonse = (PXResult <KBResponse>) PXSelect <KBResponse, Where <KBResponse.userID, Equal <Required <KBResponse.userID> >, And <KBResponse.pageID, Equal <Required <KBResponse.pageID> > > > > .SelectWindowed(article, 0, 1, userId, currentwikipage); if (result != null) { WikiPage wp = result[typeof(WikiPage)] as WikiPage; WikiPageLanguage wpl = result[typeof(WikiPageLanguage)] as WikiPageLanguage; KBResponseSummary kbrs = responsesummary.CreateInstance() as KBResponseSummary; KBResponse newresnonse = response.CreateInstance() as KBResponse; if (resultsummary != null) { kbrs = resultsummary[typeof(KBResponseSummary)] as KBResponseSummary; } if (resnonse != null) { newresnonse = resnonse[typeof(KBResponse)] as KBResponse; if (wp != null && wpl != null && newresnonse.NewMark != null) { if (newresnonse.OldMark != 0) { kbrs.Marksummary = kbrs.Marksummary - newresnonse.OldMark; kbrs.Marksummary = kbrs.Marksummary + newresnonse.NewMark; } else { kbrs.Markcount = kbrs.Markcount + 1; kbrs.Marksummary = kbrs.Marksummary + newresnonse.NewMark; } int AvRate = (int)((int)kbrs.Marksummary / (int)kbrs.Markcount); Int32 Marksummary = (int)kbrs.Marksummary; Int32 Markcount = (int)kbrs.Markcount; double dAvRate = (double)Marksummary / (double)Markcount; kbrs.AvRate = dAvRate; responsesummary.Update(kbrs); responsesummary.PersistUpdated(kbrs); responsesummary.Clear(); newresnonse.PageID = currentwikipage; newresnonse.RevisionID = 1; newresnonse.OldMark = newresnonse.NewMark; newresnonse.Date = PXTimeZoneInfo.Now; newresnonse.Summary = ""; newresnonse.CreatedByID = wp.CreatedByID; newresnonse.CreatedByScreenID = "WP00000"; newresnonse.CreatedDateTime = wp.CreatedDateTime; newresnonse.LastModifiedByID = wp.LastModifiedByID; newresnonse.LastModifiedByScreenID = "WP00000"; newresnonse.LastModifiedDateTime = wp.LastModifiedDateTime; response.Update(newresnonse); response.PersistUpdated(newresnonse); response.Clear(); } } else { if (wp != null && wpl != null && newresnonse.NewMark != null) { newresnonse.PageID = currentwikipage; newresnonse.RevisionID = 1; newresnonse.OldMark = newresnonse.NewMark; newresnonse.Date = PXTimeZoneInfo.Now; newresnonse.UserID = userId; newresnonse.Summary = ""; newresnonse.CreatedByID = wp.CreatedByID; newresnonse.CreatedByScreenID = "WP00000"; newresnonse.CreatedDateTime = wp.CreatedDateTime; newresnonse.LastModifiedByID = wp.LastModifiedByID; newresnonse.LastModifiedByScreenID = "WP00000"; newresnonse.LastModifiedDateTime = wp.LastModifiedDateTime; if (kbrs == null || kbrs.PageID == null) { kbrs.PageID = currentwikipage; kbrs.CreatedByID = wp.CreatedByID; kbrs.CreatedByScreenID = "WP00000"; kbrs.CreatedDateTime = wp.CreatedDateTime; kbrs.LastModifiedByID = wp.LastModifiedByID; kbrs.LastModifiedByScreenID = "WP00000"; kbrs.LastModifiedDateTime = wp.LastModifiedDateTime; kbrs.Markcount = 1; kbrs.Marksummary = newresnonse.NewMark; int AvRate = (int)((int)kbrs.Marksummary / (int)kbrs.Markcount); Int32 Marksummary = (int)kbrs.Marksummary; Int32 Markcount = (int)kbrs.Markcount; double dAvRate = (double)Marksummary / (double)Markcount; kbrs.AvRate = dAvRate; responsesummary.Insert(kbrs); responsesummary.PersistInserted(kbrs); responsesummary.Clear(); } else { kbrs.Markcount = kbrs.Markcount + 1; kbrs.Marksummary = kbrs.Marksummary + newresnonse.NewMark; responsesummary.Update(kbrs); responsesummary.PersistUpdated(kbrs); responsesummary.Clear(); } response.Insert(newresnonse); response.PersistInserted(newresnonse); response.Clear(); } } string path = PXUrl.SiteUrlWithPath(); path += path.EndsWith("/") ? "" : "/"; var url = string.Format("{0}Wiki/{1}?pageid={2}", path, this.ResolveClientUrl("~/Wiki/ShowWiki.aspx"), pageid); url = url + "&rateid=" + Rate.Value; throw new Exception("Redirect0:" + url); } }
public static void Update(PXGraph graph, int?vendorID, int?vendorLocationID, string curyID, int?inventoryID, int?subItemID, string uom, decimal curyCost) { if (curyCost <= 0 || string.IsNullOrEmpty(uom) || vendorID == null || vendorLocationID == null) { return; } PXCache cache = graph.Caches[typeof(POVendorInventoryPriceUpdate)]; foreach (PXResult <InventoryItem, Vendor, Company> r in PXSelectJoin <InventoryItem, LeftJoinSingleTable <Vendor, On <Vendor.bAccountID, Equal <Required <Vendor.bAccountID> > >, CrossJoin <Company> >, Where <InventoryItem.inventoryID, Equal <Required <InventoryItem.inventoryID> > > > . Select(graph, vendorID, inventoryID)) { InventoryItem item = r; Vendor vendor = r; Company company = r; if (item.InventoryID == null || vendor.BAccountID == null || (item.StkItem == true && subItemID == null)) { continue; } INSetup setup = PXSetupOptional <INSetup> .Select(graph); int?savedSubItemID = item.StkItem == true ? subItemID : null; POVendorInventoryPriceUpdate vendorPrice = (POVendorInventoryPriceUpdate)cache.CreateInstance(); vendorPrice.InventoryID = inventoryID; vendorPrice.SubItemID = savedSubItemID; vendorPrice.VendorID = vendorID; vendorPrice.VendorLocationID = vendorLocationID; vendorPrice.PurchaseUnit = uom; vendorPrice = (POVendorInventoryPriceUpdate)cache.Insert(vendorPrice); if (item.StkItem != true) { vendorPrice.SubItemID = savedSubItemID; } vendorPrice.CuryID = curyID; cache.Normalize(); vendorPrice.Active = true; vendorPrice.LastPrice = curyCost; } }
private PXFieldState CreateFieldStateForFieldValue(object returnState, string entityType, string cacheName, string fieldName) { Type type = GraphHelper.GetType(entityType); if (type != null) { Type cachetype = GraphHelper.GetType(cacheName); if (cachetype == null) { return(null); } PXCache cache = this.Caches[cachetype]; PXDBAttributeAttribute.Activate(cache); PXFieldState state = cache.GetStateExt(null, fieldName) as PXFieldState; if (state != null) { state.DescriptionName = null; } var attr = cache.GetAttributes(null, fieldName); if (attr != null) { var timeListAttribute = attr.FirstOrDefault(a => a is PXTimeListAttribute) as PXTimeListAttribute; var intAttribute = attr.FirstOrDefault(a => a is PXIntAttribute) as PXIntAttribute; if (timeListAttribute != null && intAttribute != null) { state = PXTimeState.CreateInstance((PXIntState)state, null, null); state.SelectorMode = PXSelectorMode.Undefined; } } if (state != null) { if (returnState == null) { object item = cache.CreateInstance(); object newValue; cache.RaiseFieldDefaulting(fieldName, item, out newValue); if (newValue != null) { cache.RaiseFieldSelecting(fieldName, item, ref newValue, false); } state.Value = newValue; } else { state.Value = returnState; } state.Enabled = true; PXView view; if (state.ViewName != null && this.Views.TryGetValue(state.ViewName, out view) && view.BqlSelect.GetTables()[0] == typeof(EPEmployee)) { state.ViewName = "Employee"; } } if (attr != null) { var intListAttribute = attr.FirstOrDefault(a => a.GetType().IsSubclassOf(typeof(PXIntListAttribute))) as PXIntListAttribute; if (intListAttribute != null) { return(state); } } state = PXFieldState.CreateInstance((state as PXStringState)?.AllowedValues != null ? state : state.Value, state.DataType, state.PrimaryKey, state.Nullable, state.Required == true ? 1 : state.Required == null ? 0 : -1, state.Precision, state.Length, state.DefaultValue, fieldName, state.DescriptionName, state.DisplayName, state.Error, state.ErrorLevel, true, true, false, PXUIVisibility.Visible, state.ViewName, state.FieldList, state.HeaderList); return(state); } return(null); }
public static void Update(PXGraph graph, int?vendorID, int?vendorLocationID, string curyID, int?inventoryID, int?subItemID, string uom, decimal curyCost) { if (curyCost <= 0 || string.IsNullOrEmpty(uom) || vendorID == null || vendorLocationID == null) { return; } PXCache cache = graph.Caches[typeof(POVendorInventoryPriceUpdate)]; foreach (PXResult <InventoryItem, Vendor, Company> r in PXSelectJoin <InventoryItem, LeftJoin <Vendor, On <Vendor.bAccountID, Equal <Required <Vendor.bAccountID> > >, CrossJoin <Company> >, Where <InventoryItem.inventoryID, Equal <Required <InventoryItem.inventoryID> > > > . Select(graph, vendorID, inventoryID)) { InventoryItem item = r; Vendor vendor = r; Company company = r; if (item.InventoryID == null || vendor.BAccountID == null || (item.StkItem == true && subItemID == null)) { continue; } INSetup setup = new PXSetup <INSetup>(graph).Current; int?savedSubItemID = item.StkItem == true ? subItemID : null; POVendorInventory existVendorPrice = PXSelectReadonly <POVendorInventory, Where <POVendorInventory.inventoryID, Equal <Required <POVendorInventory.inventoryID> >, And <POVendorInventory.subItemID, Equal <Required <POVendorInventory.subItemID> >, And <POVendorInventory.purchaseUnit, Equal <Required <POVendorInventory.purchaseUnit> >, And <POVendorInventory.vendorID, Equal <Required <POVendorInventory.vendorID> >, And <POVendorInventory.vendorLocationID, Equal <Required <POVendorInventory.vendorLocationID> > > > > > > > .SelectWindowed(graph, 0, 1, item.InventoryID, savedSubItemID, uom, vendorID, vendorLocationID); string priceCuryID = (existVendorPrice != null ? existVendorPrice.CuryID : vendor.CuryID) ?? company.BaseCuryID; POVendorInventoryPriceUpdate vendorPrice = (POVendorInventoryPriceUpdate)cache.CreateInstance(); vendorPrice.InventoryID = inventoryID; vendorPrice.SubItemID = savedSubItemID; vendorPrice.VendorID = vendorID; vendorPrice.VendorLocationID = vendorLocationID; vendorPrice.PurchaseUnit = uom; vendorPrice = (POVendorInventoryPriceUpdate)cache.Insert(vendorPrice); if (item.StkItem != true) { vendorPrice.SubItemID = savedSubItemID; } vendorPrice.CuryID = priceCuryID; cache.Normalize(); vendorPrice.Active = true; Decimal cost = ConventCury(graph, vendor.CuryRateTypeID, curyID, curyCost, priceCuryID); vendorPrice.LastPrice = ConvertUOM(graph, item, uom, cost, item.PurchaseUnit); } }