public void processReport()
{
while select assetBook
join assetTable
where assetBook.AssetId == assetTable.AssetId
&& assetBook.Status == AssetStatus::Open
{
tmpFixedAsset.clear();
tmpFixedAsset.AssetName = assetTable.Name;
tmpFixedAsset.AssetNumber = assetTable.AssetId;
tmpFixedAsset.FAGroup = assetTable.AssetGroup;
tmpFixedAsset.MajorType = assetTable.MajorType;
tmpFixedAsset.DatePurchased = assetBook.AcquisitionDate;
tmpFixedAsset.Status = assetBook.Status;
tmpFixedAsset.Convention = assetBook.DepreciationConvention;
tmpFixedAsset.Life = assetBook.LifeTime;
tmpFixedAsset.RemainingLife = assetBook.LifeTimeRest;
tmpFixedAsset.Location = assetTable.Location;
tmpFixedAsset.ProjectNumber = assetTable.MaintenanceInfo1;
tmpFixedAsset.TagNumber = assetTable.MaintenanceInfo2;
tmpFixedAsset.DepreciationMethod = assetBook.Depreciation;
while select sum(AmountCur) from assetTrans
where assetTrans.AssetId == assetBook.AssetId
&& assetTrans.BookId == assetBook.BookId
&& (assetTrans.TransType == AssetTransType::Acquisition
|| assetTrans.TransType == AssetTransType::AcquisitionAdj
|| assetTrans.TransType == AssetTransType::WriteUpAdj
|| assetTrans.TransType == AssetTransType::WriteDownAdj)
{
tmpFixedAsset.AcquisitionCost = assetTrans.AmountCur;
netBookValue = assetTrans.AmountCur;
}
while select sum(AmountCur) from assetTrans
where assetTrans.AssetId == assetBook.AssetId
&& assetTrans.BookId == assetBook.BookId
&& assetTrans.TransType == AssetTransType::Depreciation
|| assetTrans.TransType == AssetTransType::DepreciationAdj
|| assetTrans.TransType == AssetTransType::ExtraordinaryDepreciation
{
tmpFixedAsset.AccumulatedDepreciation = assetTrans.AmountCur;
tmpFixedAsset.NetBookValue = assetTrans.AmountCur + netBookValue;
}
while select sum(AmountCur) from assetTrans
where assetTrans.AssetId == assetBook.AssetId
&& assetTrans.BookId == assetBook.BookId
&& assetTrans.TransDate > mkDate(1, 1, year(today()))
&& assetTrans.TransDate <= today()
&& (assetTrans.TransType == AssetTransType::Depreciation
|| assetTrans.TransType == AssetTransType::DepreciationAdj
|| assetTrans.TransType == AssetTransType::ExtraordinaryDepreciation)
{
tmpFixedAsset.YTDDepreciation = assetTrans.AmountCur;
}
tmpFixedAsset.insert();
}
}