protected override List <PXResult <CSAnswers, CSAttributeGroup, InventoryItem> > SelectInventoryWithAttributes() { Type sumDecimalFields = BqlCommand.Compose(BqlHelper.GetDecimalFieldsAggregate <INSiteStatus>(Base, true).ToArray()); Type select = BqlTemplate.OfCommand < Select5 <CSAnswers, InnerJoin <CSAttributeGroup, On <CSAnswers.attributeID, Equal <CSAttributeGroup.attributeID> >, InnerJoin <InventoryItem, On <CSAnswers.refNoteID, Equal <InventoryItem.noteID>, And <CSAttributeGroup.entityClassID, Equal <InventoryItem.itemClassID> > >, LeftJoin <INSiteStatus, On <INSiteStatus.inventoryID, Equal <InventoryItem.inventoryID>, And <INSiteStatus.subItemID, Equal <InventoryItem.defaultSubItemID>, And <Where <INSiteStatus.siteID, Equal <Current <EntryHeader.siteID> >, Or <Current <EntryHeader.siteID>, IsNull> > > > >, LeftJoin <INLocationStatus, On <INLocationStatus.inventoryID, Equal <InventoryItem.inventoryID>, And <INLocationStatus.subItemID, Equal <InventoryItem.defaultSubItemID>, And <INLocationStatus.siteID, Equal <Current <EntryHeader.siteID> >, And <INLocationStatus.locationID, Equal <Current <EntryHeader.locationID> > > > > > > > > >, Where <CSAttributeGroup.isActive, Equal <True>, And <CSAttributeGroup.entityType, Equal <Constants.DACName <InventoryItem> >, And <CSAttributeGroup.attributeCategory, Equal <CSAttributeGroup.attributeCategory.variant>, And <InventoryItem.templateItemID, Equal <Current <EntryHeader.templateItemID> > > > > >, Aggregate <GroupBy <InventoryItem.inventoryID, GroupBy <CSAnswers.refNoteID, GroupBy <CSAnswers.attributeID, BqlPlaceholder.A> > > >, OrderBy <Asc <InventoryItem.inventoryID, Asc <CSAnswers.refNoteID, Asc <CSAnswers.attributeID> > > > > > .Replace <BqlPlaceholder.A>(sumDecimalFields) .ToType(); var view = new PXView(Base, true, BqlCommand.CreateInstance(select)); using (new PXFieldScope(view, typeof(InventoryItem.inventoryID), typeof(CSAnswers.attributeID), typeof(CSAnswers.value), typeof(INSiteStatus), typeof(INLocationStatus))) { return(view.SelectMulti().Cast <PXResult <CSAnswers, CSAttributeGroup, InventoryItem> >().ToList()); } }
public virtual SourceValuesCollectionItem GetBranchIDsValueFromField( PXGraph graph, PXCache attributeCache, object extRow, SourceSpecificationItem calendarOrganizationIdSourceSpec) { bool? result = null; object branchID = null; if (calendarOrganizationIdSourceSpec.BranchSourceType != null || calendarOrganizationIdSourceSpec.BranchSourceFormula != null) { PXCache cache = GetSourceCache(graph, attributeCache, calendarOrganizationIdSourceSpec.BranchSourceType); object row = GetSourceRow(cache, extRow); if (calendarOrganizationIdSourceSpec.BranchSourceFormula != null) { BqlFormula.Verify(cache, row, calendarOrganizationIdSourceSpec.BranchSourceFormula, ref result, ref branchID); } else { branchID = BqlHelper.GetOperandValue(cache, row, calendarOrganizationIdSourceSpec.BranchSourceType); } } return(new SourceValuesCollectionItem() { SpecificationItem = calendarOrganizationIdSourceSpec, BranchIDs = ((int?)branchID).SingleToList() }); }
public virtual TKeyWithKeyWithSourceValues GetIDsValueFromField( PXGraph graph, PXCache attributeCache, object extRow, TSourceSpecificationItem sourceSpecification, Type fieldType, Action <TKeyWithKeyWithSourceValues, List <int?> > setter) { int?value = null; if (fieldType != null) { PXCache cache = GetSourceCache(graph, attributeCache, fieldType); object row = GetSourceRow(cache, extRow); value = (int?)BqlHelper.GetOperandValue(cache, row, fieldType); } var item = new TKeyWithKeyWithSourceValues() { SpecificationItem = sourceSpecification, }; setter(item, value.SingleToList()); return(item); }
public void Verify(PXCache cache, object item, List <object> pars, ref bool?result, ref object value) { value = BqlHelper.GetOperandValue <TOrganizationIDField>(cache, item); result = (int?)value == GetOrganizationID(cache.Graph); if (pars != null) { pars.Add(BqlHelper.GetParameterValue(cache.Graph, BranchIDParameter)); } }
public virtual string GetHeaderMasterFinPeriodID(PXCache cache, object row) { if (HeaderFindingMode == HeaderFindingModes.Parent) { object parentRow = PXParentAttribute.SelectParent(cache, row, BqlCommand.GetItemType(HeaderMasterFinPeriodIDType)); return((string)BqlHelper.GetOperandValue(cache.Graph, parentRow, HeaderMasterFinPeriodIDType)); } return((string)BqlHelper.GetCurrentValue(cache.Graph, HeaderMasterFinPeriodIDType)); }
protected int?GetOrganizationIDRestrictinValue(PXGraph graph) { bool?useMasterCalendarParamValue = (bool?)BqlHelper.GetParameterValue(graph, UseMasterCalendarParameter); if (useMasterCalendarParamValue == true) { return(FinPeriod.organizationID.MasterValue); } return((int?)BqlHelper.GetParameterValue(graph, BranchIDParameter) ?? (int?)BqlHelper.GetParameterValue(graph, OrganizationIDParameter)); }
public virtual void _(Events.FieldVerifying <EPExpenseClaimDetails.curyEmployeePart> e) { EPExpenseClaimDetails receipt = (EPExpenseClaimDetails)e.Row; decimal?newValue = (decimal?)e.NewValue; if (newValue != null) { string paidWith = (string)BqlHelper.GetValuePendingOrRow <EPExpenseClaimDetails.paidWith>(e.Cache, receipt); VerifyEmployeePartIsZeroForCorpCardReceipt(paidWith, newValue); } }
public virtual SourceValuesCollectionItem GetOrganizationIDsValueFromField( PXGraph graph, PXCache attributeCache, object extRow, SourceSpecificationItem sourceSpecification) { int?organizationID = null; if (sourceSpecification.OrganizationSourceType != null) { PXCache cache = GetSourceCache(graph, attributeCache, sourceSpecification.OrganizationSourceType); object row = GetSourceRow(cache, extRow); organizationID = (int?)BqlHelper.GetOperandValue(cache, row, sourceSpecification.OrganizationSourceType); } return(new SourceValuesCollectionItem() { SpecificationItem = sourceSpecification, OrganizationIDs = organizationID.SingleToList() }); }
public virtual int?GetCalendarOrganizationID(PXGraph graph, PXCache attributeCache, object extRow) { if (!GetSourcesSpecification(attributeCache, extRow).SpecificationItems.Any()) { return(FinPeriod.organizationID.MasterValue); } SourceValuesCollectionItem mainSourceValuesItem = GetEvaluatedPrimaryOrganizationIDsValuesItem(graph, attributeCache, extRow); List <int?> organizationIDs = mainSourceValuesItem != null ? mainSourceValuesItem.OrganizationIDs : GetEvaluatedOrganizationIDsValues(graph, attributeCache, extRow).OrganizationIDs; if (IsIDsUndefined(organizationIDs) && (UseMasterOrganizationIDByDefault || (UseMasterCalendarSourceType != null && (bool?)BqlHelper.GetCurrentValue(graph, UseMasterCalendarSourceType, extRow) == true))) { return(FinPeriod.organizationID.MasterValue); } return(organizationIDs.FirstOrDefault()); }
public virtual TKey GetKey(PXGraph graph, PXCache attributeCache, object extRow) { if (UseMasterCalendarSourceType != null && (bool?)BqlHelper.GetCurrentValue(graph, UseMasterCalendarSourceType, extRow) == true) { return(new TKey() { OrganizationID = MasterValue }); } if (!GetSourcesSpecification(attributeCache, extRow).SpecificationItems.Any() || GetSourcesSpecification(attributeCache, extRow).SpecificationItems.All(spec => !spec.IsAnySourceSpecified)) { return(GetDefaultPeriodKey()); } TKeyWithKeyWithSourceValues rawMainKeyWithSourceValues = GetRawMainKeyWithSourceValues(graph, attributeCache, extRow); return(rawMainKeyWithSourceValues != null ? rawMainKeyWithSourceValues.Key : GetKeys(graph, attributeCache, extRow).ConsolidatedKey); }
protected int?GetOrganizationID(PXGraph graph) { int?branchID = (int?)BqlHelper.GetParameterValue(graph, BranchIDParameter); return(PXAccess.GetParentOrganizationID(branchID)); }