Scenario:
- Purchase Order Quantity = 2
- Total Amount = 2000
Expected:
- System should create 2 fixed asset Id's
- Each asset value (Unit cost) = 1000
After invoice posting, the created asset IDs do not have correctly distributed quantities and unit costs.
2 COMP-000051 1000
1 COMP-000052 0
PurchPackingSlipJournalPost class and customized the createFixedAsset() methodfinal class ROJ_PurchPackingSlipJournalCreate_Extension
{
protected AssetId createFixedAsset(
PurchParmLine _purchParmLine,
PurchParmLine_Asset _purchParmLine_Asset)
{
AssetId assetId = next createFixedAsset(_purchParmLine, _purchParmLine_Asset);
{
return assetId;
}
purchLine.ROJ_SplitQuantity == NoYes::Yes))
{
return assetId;
}
AmountCur totalAmount = purchLine.LineAmount;
{
return assetId;
}
AssetTable existingAsset;
select firstOnly forUpdate existingAsset
where existingAsset.AssetId == assetId;
{
ttsBegin;
existingAsset.delete();
ttsCommit;
}
AmountCur runningTotal = 0;
AmountCur assetValue;
for (int i = 1; i <= qty; i++)
{
ttsBegin;
NumberSeq numberSeq;
newAsset.initValue();
newAsset.Name = purchLine.itemName()
newAsset.PurchLineRecId = purchLine.RecId;
newAsset.Quantity = 1;
newAsset.UnitCost = assetValue;
newAsset.initFromAssetGroupId(newAsset.AssetGroup);
if (numberSeq)
{
newAsset.AssetId = numberSeq.num();
numberSeq.used();
}
{
assetValue = totalAmount - runningTotal;
}
else
{
assetValue = perAssetAmount;
runningTotal += perAssetAmount;
}
where assetBook.AssetId == newAsset.AssetId
&& assetBook.BookId == bookId;
{
assetBook.AcquisitionPrice = assetValue;
assetBook.update();
}
assetTrans.AssetId = newAsset.AssetId;
assetTrans.BookId = bookId;
assetTrans.TransType = AssetTransType::Acquisition;
assetTrans.AmountMST = assetValue;
assetTrans.TransDate = systemDateGet();
}
}
1 COMP-000051 1000
1 COMP-000052 1000

Report
All responses (
Answers (