http://dynamicsaxlounge.com/2013/08/28/dynamics-ax-2012-reporting-cookbook-for-ssrs-dynamics-ax-2012/ --- nice link
srsreportdataproviderpreprocess - To debug the code we need to extend DP class with this instead of SRSReportDataProviderBase
https://drive.google.com/file/d/0Bz2gDlDZfIivNTlvdmxjUmpFNXM/edit?usp=sharing - To get SSRS PDF Learning Doc.
srsreportdataproviderpreprocess - To debug the code we need to extend DP class with this instead of SRSReportDataProviderBase
https://drive.google.com/file/d/0Bz2gDlDZfIivNTlvdmxjUmpFNXM/edit?usp=sharing - To get SSRS PDF Learning Doc.
DP :
[
SRSReportQueryAttribute(queryStr(VendInvoiceReportQry)),
SRSReportParameterAttribute(classStr(VendorInvoiceContract))
]
class VendorInvoiceDP extends SRSReportDataProviderbase
{
QueryRun queryRun;
VendorInvoiceTmp vendorInvoiceTmp;
Query q;
VendorInvoiceId vendInvoiceId;
}
|
private Query buildQuery(Query _query,VendorInvoiceId _vendInvoiceId)
{
if(_vendInvoiceId!="")
_query.dataSourceTable(tablenum(VendInvHeader), 1).addRange(fieldnum(VendInvHeader,VendorInvoiceId)).value(queryValue(_vendInvoiceId));
return
_query;
}
|
private void
getReportParameters()
{
VendorInvoiceContract
vendorInvoiceContract = this.parmDataContract();
if
(vendorInvoiceContract)
{
vendInvoiceId=vendorInvoiceContract.parmVendInvoiceId();
}
}
|
[
SRSReportDataSetAttribute(tableStr(VendorInvoiceTmp))
]
public VendorInvoiceTmp
getVendorInvoiceTmp()
{
select
* from vendorInvoiceTmp;
return
vendorInvoiceTmp;
}
|
public void
InsertintoVendorInvoiceTmp( VendInvHeader vendInvHeader,VendInvoiceLine
vendInvoiceLine)
{
vendorInvoiceTmp.ItemId =
vendInvoiceLine.ItemId;
vendorInvoiceTmp.ItemName =
vendInvoiceLine.ItemName;
vendorInvoiceTmp.Quantity
=vendInvoiceLine.Quantity;
vendorInvoiceTmp.insert();
}
|
[SysEntryPointAttribute]
public void
processReport()
{
VendInvHeader vendInvHeader;
VendInvoiceLine vendInvoiceLine;
;
this.getReportParameters();
queryRun = new
QueryRun(this.buildQuery(this.parmQuery(),vendInvoiceId));
while(queryRun.next())
{
vendInvHeader=queryrun.get(tableNum(VendInvHeader));
vendInvoiceLine=queryrun.get(tableNum(VendInvoiceLine));
this.InsertintoVendorInvoiceTmp(vendInvHeader,vendInvoiceLine);
}
}
|
Controller :
class VendorInvoiceController extends SrsReportRunController
{
#define.ReportName('VendInvoiceReport.PrecisionDesign1')
VendorInvoiceContract
vendorInvoiceContract;
VendInvHeader vendInvHeader ;
}
|
protected void
prePromptModifyContract()
{
if
(this.parmArgs() &&
this.parmArgs().record() &&
this.parmArgs().dataset() == tableNum(VendInvHeader))
{
vendInvHeader =
this.parmArgs().record();
}
if
(!vendorInvoiceContract)
{
vendorInvoiceContract =
this.parmReportContract().parmRdpContract();
}
vendorInvoiceContract.parmVendInvoiceId(vendInvHeader.VendorInvoiceId);
super();
}
|
public void
setRange(Args _args, Query _query)
{
QueryBuildDataSource qbds;
QueryBuildRange qbr;
if
(_args && _args.dataset())
{
switch(_args.dataset())
{
case
tableNum(VendInvHeader) :
vendInvHeader =
_args.record();
break;
}
}
qbds = _query.dataSourceTable(tableNum(VendInvHeader));
qbds.clearRanges();
qbr = qbds.findRange(fieldName2id(tableNum(VendInvHeader),fieldStr(VendInvHeader,VendorInvoiceId)));
if
(!qbr)
{
qbr = qbds.addRange(fieldNum(VendInvHeader, VendorInvoiceId));
}
if(vendInvHeader)
{
qbr.value(vendInvHeader.VendorInvoiceId);
}
}
|
public boolean
showQueryValues(str parameterName)
{
return
true;
}
|
public static
VendorInvoiceController construct(Args _args)
{
VendorInvoiceController controller=new VendorInvoiceController();
controller.parmArgs(_args);
return
controller;
}
|
public static
void main(Args _args)
{
VendorInvoiceController controller = new VendorInvoiceController();
controller.parmReportName(#ReportName);
controller.parmArgs(_args);
controller.setRange(_args,
controller.parmReportContract().parmQueryContracts().lookup(controller.getFirstQueryContractKey()));
controller.parmShowDialog(false);
controller.startOperation();
}
|
Contract :
[DataContractAttribute]
{
VendorInvoiceId VendInvId;
}
|
[
DataMemberAttribute('VendorInvoiceId')
]
public VendorInvoiceId
parmVendInvoiceId(VendorInvoiceId _VendInvId = VendInvId)
{
VendInvId = _VendInvId;
return
VendInvId;
}
|
public boolean
validate()
{
boolean isValid = true;
if(!VendInvId)
throw
error("Select Vendor Invoice Id");
return
isValid;
}
|
No comments:
Post a Comment