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));
        }
Esempio n. 2
0
        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);
        }