private void runWithAssetGroupId(NoYes parmendOfYearOnly,AssetGroupId assetGroupId)
{
TmpDateSum tmpDateSum;
AssetTable assetTable;
AssetBook assetBook;
AssetBookTable assetBookTable;
//main account
AssetLedgerAccounts assetLedgerAccounts;
MainAccountNum mainAccountNum;
while select assetTable
join assetBook
join assetBookTable
where
assetTable.AssetGroup == assetGroupId
&& assetTable.AssetId == assetBook.AssetId
&& assetBook.BookId == assetBookTable.BookId
&& assetBook.Depreciation == NoYes::Yes
&& assetBookTable.CurrentOperationsTax == CurrentOperationsTax
&& assetBook.Status == AssetStatus::Open
{
lineTMP.clear();
assetLedgerAccounts = AssetLedgerAccounts::find(assetBook.BookId,AssetParameters::find().PostingProfile,enum2int(AssetTransType::Depreciation),TableGroupAll::GroupId,assetTable.AssetGroup);
mainAccountNum = MainAccount::find(DimensionAttributeValueCombination::find(assetLedgerAccounts.OffsetLedgerDimension).MainAccount).MainAccountId;
//Method calculation provided by AX
tmpDateSum.setTmpData(assetBook.initDepreciationProfile());
//set header line
lineTMP.AssetGroupId = assetTable.AssetGroup;
lineTMP.AssetId = assetTable.AssetId;
lineTMP.MainAccount = mainAccountNum;
lineTMP.rGrossFa = assetBook.AcquisitionPrice;
//cut off date
while select tmpDateSum
where
tmpDateSum.TmpNumerals01 != 0
&& tmpDateSum.TransDate <= endYearDate
{
lineTMP.Period = tmpDateSum.TransDate;
lineTMP.rAccDepr = tmpDateSum.TmpNumerals01;
lineTMP.rDeprExp = tmpDateSum.Total;
lineTMP.rNetBookvalue = tmpDateSum.TmpNumerals02;
lineTMP.insert();
}
}
}
Like this:
Like Loading...
Related