我需要将General Journal(Table:LedgerJournalTable)表格的Ledger Dimension值传递给LedgerJournalTransDaily(表格:LedgerJournalTrns)表格以及组合值。 EX:
在普通日记表单中,我正在创建一个新期刊,其中包含期刊名称" Alloc"(分类帐维度类似于1003),在财务维度选项卡中,我选择成本中心(024),部门(001) ),目的(训练)之后我点击线,然后一个新表格LedgerJournalTransDaily。在来自网格的一个名为Account Num的字段中,在该段字段中,我需要分类帐维度值以及所选的组合值。比如1003-024-001-Training
提前致谢
答案 0 :(得分:2)
Offset Account Num是标题表上唯一的分类帐维度,因此我假设您要使用它,但是您可以将此逻辑应用于任何维度组合(假设分类帐帐户类型为Ledger)。要将分类帐维度与LedgerJournalTable中的分类帐维度字段组合,该过程如下:
首先,我们将从偏移分类帐维度中检索帐户编号。您可以使用简单的基本AX方法执行此操作:
<div class="alignText">
<div class="titleBoldText">Mary Smith</div>
<div id=alignCompany class="titleText">Morris Realty and Investments</div>
</div>
<div id="alignPhoto">
<div class="circle" id=image role="image">
<img src="http://placehold.it/42x42">
</div>
</div>
<br>
接下来是accountNum = DimensionStorage::ledgerDimension2AccountNum(journalTable.OffsetLedgerDimension);
上的财务维度。
背景信息:这些维度存储在字段LedgerJournalTable
中,该字段引用表DefaultDimension
。这个表本身可能看起来不太有用,但它是一个交叉引用。加入其DimensionAttributeValueSet
字段等于DimensionAttributeValueSetItem
的{{1}}表。您将看到已选择的维度属性及其显示值:
DimensionAttributeValueSet
现在我们有DimensionAttributeValueSet.RecId
条记录,现在我们还有LedgerJournalTable journalTable;
DimensionAttributeValueSet attributeValueSet;
DimensionAttributeValueSetItem attributeValueSetItem;
while select DisplayValue from attributeValueSetItem
exists join attributeValueSet
where attributeValueSet.RecId == attributeValueSetItem.DimensionAttributeValueSet
exists join journalTable
where journalTable.DefaultDimension == attributeValueSet.RecId
&& journalTable.RecId == 52565497166
{
info(attributeValueSetItem.DisplayValue);
}
和顶层维度信息存储在DimensionAttributeValueSetItem
中。我们需要所有这些表格!相当激烈吧?您可以创建一个重要的while循环来遍历每个单独的维度,将其添加到容器中,并将其与之前检索到的Account Num相结合。必须非常专门地构建容器以使用基本轴维度实用程序方法(或者至少是我所知道的)。
以下是一项简单的工作,可以有效地完成我所描述的工作。为方便起见,我亲自挑选了一本期刊。
DimensionAttributeValue
如果一切顺利,您已成功创建了一个组合!您可以通过查找刚刚在DimensionAttribute
中创建的维度进行变换。此组合现在可以是LedgerJournalTable journalTable = LedgerJournalTable::findByRecId(52565497166);
DimensionAttribute dimensionAttribute;
DimensionAttributeValue dimensionAttributeValue;
DimensionAttributeValueSet attributeValueSet;
DimensionAttributeValueSetItem attributeValueSetItem;
DimensionAttributeValueCombination davc;
AccountNum accountNum;
container newLedgerDimension;
int numOfDims;
int i;
str displayValue;
DimensionDynamicAccount dynamicDimension;
// Get Account Num.
accountNum = DimensionStorage::ledgerDimension2AccountNum(journalTable.OffsetLedgerDimension);
info(AccountNum);
// Add account to container.
newLedgerDimension = [accountNum];
// Add dimensions to the container.
while select attributeValueSetItem
join RecId from attributeValueSet
where attributeValueSet.RecId == attributeValueSetItem.DimensionAttributeValueSet
&& journalTable.DefaultDimension == attributeValueSet.RecId
join RecId, DimensionAttribute from dimensionAttributeValue
where dimensionAttributeValue.RecId == attributeValueSetItem.DimensionAttributeValue
join RecId, Name from dimensionAttribute
where dimensionAttribute.RecId == dimensionAttributeValue.DimensionAttribute
{
// Add the dimension name and dimension value
newLedgerDimension += [dimensionAttribute.Name, attributeValueSetItem.DisplayValue];
// Keep track of the number of dimensions.
++numOfDims;
}
// Combine the account and dimensions into one value.
for (i=1; i<=(numOfDims+1)*2; i+=2)
{
displayValue += conPeek(newLedgerDimension, i) + '-';
}
// The display value of the combination must be in the first index of the container.
newLedgerDimension = conIns(newLedgerDimension, 1, displayValue);
// The number of dimensions must be in the third index of the container.
newLedgerDimension = conIns(newLedgerDimension, 3, int2str(numOfDims));
info(displayValue);
// Lastly, create the dimension.
dynamicDimension = AxdDimensionUtil::getLedgerAccountId(newLedgerDimension);
info(int642str(dynamicDimension));
应注意,维度实用程序仅根据您配置的帐户结构应用适用的维度。这在General Ledger模块中配置&gt;设置&gt;会计科目表&gt;配置帐户结构。