MainAccount = this.getLedgerDimensionSegmentDescription(generalJournalAccountEntry.LedgerDimension , "MainAccount");
MainAccountCode = this.getLedgerDimensionSegmentValue(generalJournalAccountEntry.LedgerDimension , "MainAccount");
Dimensions = this.getLedgerDimensions(generalJournalAccountEntry.LedgerDimension);
public str getLedgerDimensionSegmentValue(RefRecId _ledgerDimension, Name _dimensionName)
{
DimensionStorage dimensionStorage;
DimensionStorageSegment segment;
int segmentCount, segmentIndex;
int hierarchyCount, hierarchyIndex;
str segmentName, segmentDescription;
SysDim segmentValue;
;
dimensionStorage = DimensionStorage::findById(_ledgerDimension);
if (dimensionStorage == null)
{
throw error("@SYS83964");
}
hierarchyCount = dimensionStorage.hierarchyCount();
//Loop through hierarchies to get individual segments
for(hierarchyIndex = 1; hierarchyIndex <= hierarchyCount; hierarchyIndex++)
{
segmentCount = dimensionStorage.segmentCountForHierarchy(hierarchyIndex);
//Loop through segments and display required values
for (segmentIndex = 1; segmentIndex <= segmentCount; segmentIndex++)
{
// Get segment
segment = dimensionStorage.getSegmentForHierarchy(hierarchyIndex, segmentIndex);
// Get the segment information
if (segment.parmDimensionAttributeValueId() != 0 &&
DimensionAttribute::find(DimensionAttributeValue::find(segment.parmDimensionAttributeValueId())
.DimensionAttribute).Name == _DimensionName)
{
segmentValue = segment.parmDisplayValue();
segmentDescription = segment.getName();
}
}
}
return segmentValue;
}
public str getLedgerDimensionValue(RefRecId _ledgerDimension, Name _dimensionName)
{
DimensionStorage dimensionStorage;
DimensionStorageSegment segment;
int segmentCount, segmentIndex;
int hierarchyCount, hierarchyIndex;
str segmentName, segmentDescription;
SysDim segmentValue;
;
dimensionStorage = DimensionStorage::findById(_ledgerDimension);
if (dimensionStorage == null)
{
throw error("@SYS83964");
}
hierarchyCount = dimensionStorage.hierarchyCount();
//Loop through hierarchies to get individual segments
for(hierarchyIndex = 1; hierarchyIndex <= hierarchyCount; hierarchyIndex++)
{
segmentCount = dimensionStorage.segmentCountForHierarchy(hierarchyIndex);
//Loop through segments and display required values
for (segmentIndex = 1; segmentIndex <= segmentCount; segmentIndex++)
{
// Get segment
segment = dimensionStorage.getSegmentForHierarchy(hierarchyIndex, segmentIndex);
// Get the segment information
if (segment.parmDimensionAttributeValueId() != 0 &&
DimensionAttribute::find(DimensionAttributeValue::find(segment.parmDimensionAttributeValueId())
.DimensionAttribute).Name == _DimensionName)
{
segmentValue = segment.parmDisplayValue();
segmentDescription = segment.getName();
}
}
}
// return segmentValue + " (" + segmentDescription + ")";
return segmentValue + " - " + segmentDescription;
}
public str getLedgerDimensions(RefRecId _ledgerDimension)
{
str ret;
DimensionAttribute dimensionAttribute;
#define.empty('')
#define.colon(': ')
#define.comma(', ')
while select dimensionAttribute
where dimensionAttribute.ReportColumnName != #empty
&& ((dimensionAttribute.Type == DimensionAttributeType::ExistingList) ||
(dimensionAttribute.Type == DimensionAttributeType::CustomList))
{
if(this.getLedgerDimensionSegmentDescription(_ledgerDimension, dimensionAttribute.Name))
{
ret += dimensionAttribute.ReportColumnName + #colon + this.getLedgerDimensionSegmentDescription(_ledgerDimension,dimensionAttribute.Name) + #comma;
}
}
return ret;
}
public str getLedgerDimensionSegmentDescription(RefRecId _ledgerDimension, Name _dimensionName)
{
DimensionStorage dimensionStorage;
DimensionStorageSegment segment;
int segmentCount, segmentIndex;
int hierarchyCount, hierarchyIndex;
str segmentName, segmentDescription;
SysDim segmentValue;
;
dimensionStorage = DimensionStorage::findById(_ledgerDimension);
if (dimensionStorage == null)
{
throw error("@SYS83964");
}
hierarchyCount = dimensionStorage.hierarchyCount();
//Loop through hierarchies to get individual segments
for(hierarchyIndex = 1; hierarchyIndex <= hierarchyCount; hierarchyIndex++)
{
segmentCount = dimensionStorage.segmentCountForHierarchy(hierarchyIndex);
//Loop through segments and display required values
for (segmentIndex = 1; segmentIndex <= segmentCount; segmentIndex++)
{
// Get segment
segment = dimensionStorage.getSegmentForHierarchy(hierarchyIndex, segmentIndex);
// Get the segment information
if (segment.parmDimensionAttributeValueId() != 0 &&
DimensionAttribute::find(DimensionAttributeValue::find(segment.parmDimensionAttributeValueId())
.DimensionAttribute).Name == _DimensionName)
{
segmentValue = segment.parmDisplayValue();
segmentDescription = segment.getName();
}
}
}
// return segmentValue + " (" + segmentDescription + ")";
return segmentDescription;
}
No comments:
Post a Comment