Contract class:
class GITS_FixedAssetCardCodeContract
{
AssetId assetId;
AssetAcquisitionDate fromdate;
AssetAcquisitionDate todate;
[
DataMemberAttribute(identifierStr(fromDate)),
SysOperationLabelAttribute('From Date'),
SysOperationDisplayOrderAttribute('1')
]
public AssetAcquisitionDate parmFromDate(AssetAcquisitionDate _FromDate = FromDate)
{
FromDate = _FromDate;
return FromDate;
}
[
DataMemberAttribute(identifierStr(toDate)),
SysOperationLabelAttribute ('To Date'),
SysOperationDisplayOrderAttribute('2')
]
public AssetAcquisitionDate parmToDate(AssetAcquisitionDate _ToDate = ToDate)
{
ToDate = _ToDate;
return ToDate;
}
[
DataMemberAttribute('assetId'),
SysOperationLabelAttribute('Asset Code'),
SysOperationDisplayOrderAttribute('3')
]
public AssetId parmAssetId(AssetId _assetId= assetId)
{
assetId = _assetId;
return assetId;
}
public boolean validate()
{
boolean result = true;
if (!fromDate || !toDate || toDate < fromDate)
{
result = checkFailed("Invalid Date");
}
return result;
}
}
DP class:
[
SRSReportQueryAttribute(querystr(GITS_FixedAssetQuery)),
SRSReportParameterAttribute(classStr(GITS_FixedAssetContract))
]
class GITS_FixedAssetDP extends SRSReportDataProviderBase
{
GITS_FixedAssetContract contract;
GITS_FixedAssetDetailsTmp fixedAssetTemp;
AssetTable assetTable;
AssetBook assetBook;
CompanyInfo companyinfo;
// AssetId assetId;
AssetRoomNumber roomNumber;
[SRSReportDataSetAttribute('GITS_FixedAssetDetailsTmp')]
public GITS_FixedAssetDetailsTmp getLineFixedAssetDetails()
{
select * from fixedAssetTemp;
return fixedAssetTemp;
}
[SysEntryPointAttribute(False)]
public void processReport()
{
contract = this.parmDataContract() as GITS_FixedAssetContract;
roomNumber = contract.parmAssetRoomNumber();
Query query = this.parmQuery();
QueryRun qr;
QueryBuildRange qbr;
query.dataSourceTable(tableNum(AssetTable)).addRange(fieldNum(AssetTable,Roomnumber)).value(roomNumber);
companyinfo = CompanyInfo::find();
qr = new QueryRun(Query);
while(qr.next())
{
assetTable=qr.get(tableNum(AssetTable));
assetBook=qr.get(tableNum(AssetBook));
fixedAssetTemp.clear();
fixedAssetTemp.CompanyLogo = FormLetter::companyLogo();
fixedAssetTemp.CompanyName = companyinfo.name();
fixedAssetTemp.RoomNumber = assetTable.RoomNumber;
fixedAssetTemp.AssetcCode = assetTable.AssetId;
fixedAssetTemp.AssetDescription = assetTable.Name;
fixedAssetTemp.LocationDirectorate = assetTable.Location;
fixedAssetTemp.AssetValue = assetBook.AcquisitionPrice;
fixedAssetTemp.AssetAcqDate = assetBook.AcquisitionDate;
fixedAssetTemp.insert();
}
}
}