Simple SSRS RDP Report with DP Class and Contract Class in Ax 2012

SSRSScreen

Contract Class

class Bill_TabMethodContract
{
CustName custName;
Description address;
}

[DataMemberAttribute(“CustName”)]
public CustName parmCustName(CustName _custName = custName)
{
custName = _custName;
return custName;
}

DP Class

[ SRSReportQueryAttribute (querystr(Bill_TabMethod_SSRS)),
SRSReportParameterAttribute(classstr(Bill_TabMethodContract))
]
class Bill_TabMethodDP extends SRSReportDataProviderBase
{
Bill_TabMethodTmp bill_TabMethodTmp;

}

[SRSReportDataSetAttribute(“Bill_TabMethodTmp”)]
public bill_TabMethodTmp getBill_TabMethodTmp()
{
select * from bill_TabMethodTmp;
return bill_TabMethodTmp;
}

[SysEntryPointAttribute(false)]
public void processReport()
{
BIll_Child billChild;
BillChildParm billchildparm;

QueryRun queryRun;
Query query;
Bill_TabMethod billbuffer;
Bill_TabMethodContract srsBill_TabMethodContract;
CustName custName;
QueryBuildDataSource queryBuildDataSource;
QueryBuildRange queryBuildRange;

query = this.parmQuery();

srsBill_TabMethodContract = this.parmDataContract() as Bill_TabMethodContract;
custName = srsBill_TabMethodContract.parmCustName();

// Add parameters to the query.
queryBuildDataSource = query.dataSourceTable(tablenum(Bill_TabMethod));

if(custName)
{
queryBuildRange = queryBuildDataSource.findRange(fieldnum(Bill_TabMethod, CustName));
if (!queryBuildRange)
{
queryBuildRange = queryBuildDataSource.addRange(fieldnum(Bill_TabMethod, CustName));
}
// If an account number has not been set, then use the parameter value to set it.
if(!queryBuildRange.value())
queryBuildRange.value(custName);
}

queryRun = new QueryRun(query);

while(queryRun.next())
{
billbuffer = queryRun.get(tableNum(Bill_TabMethod));

bill_TabMethodTmp.CustName=billbuffer.CustName;
bill_TabMethodTmp.ItemName=billbuffer.ItemName;
bill_TabMethodTmp.Price=billbuffer.Price;
bill_TabMethodTmp.Quatity=billbuffer.Quatity;
bill_TabMethodTmp.Discount=billbuffer.Discount;
bill_TabMethodTmp.Vat=billbuffer.Vat;
bill_TabMethodTmp.TotalAmt=billbuffer.TotalAmt;
bill_TabMethodTmp.NetAmt=billbuffer.NetAmt;

bill_TabMethodTmp.insert();

}

}

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s