Tuesday, July 16, 2013

SSRS Report Sample Controller Class

class NSGEmployeePayslipReportController extends SrsReportRunController
{

}
/// <summary>
/// Set SRS Report query range based on caller.
/// </summary>
/// <param name="_args">
/// The <c>Args</c> object.
/// </param>
/// <param name="_query">
/// The <c>Controller</c> object.
/// </param>
public void setRange(Args _args, Query _query)

{
// HcmWorker HcmWorker;
QueryBuildDataSource qbds;

QueryBuildRange qbr;

NsgSalaryCalculationTrans _NsgSalaryCalculationTrans;

_NsgSalaryCalculationTrans = _args.record();

 
qbds = _query.dataSourceTable(tableNum(EmpPayroll));

qbr = qbds.findRange(fieldName2id(tableNum(EmpPayroll),fieldStr(EmpPayroll, SalaryTransId)));

if (!qbr)
{
qbr = qbds.addRange(fieldNum(EmpPayroll, SalaryTransId));

}

qbr.value(_NsgSalaryCalculationTrans.SalaryTransId);

}


public static NSGEmployeePayslipReportController construct(Args _args)
{
NSGEmployeePayslipReportController controller = new NSGEmployeePayslipReportController();

controller.parmReportName(ssrsReportStr(EmpDetailedPayslip, PrecisionDesign1));

controller.parmArgs(_args);
return controller;
}


public static void main(Args _args)
{
NsgSalaryCalculationTrans _NsgSalaryCalculationTrans;
 
NSGEmployeePayslipReportController controller = new NSGEmployeePayslipReportController();

controller.parmReportName(ssrsReportStr(EmpDetailedPayslip, PrecisionDesign1));


controller.parmArgs(_args);
 
if(_args.dataset() == tableNum(NsgSalaryCalculationTrans))
{
_NsgSalaryCalculationTrans = _args.record();
 
// _args.record(NsgSalaryCalculationTrans::find(_args.record().RecId));
//hcmWorkerLoc = NsgSalaryCalculationTrans::find(_args.record().RecId);
//controller.parmShowDialog(false);


controller.setRange(_args, controller.parmReportContract().parmQueryContracts().lookup(controller.getFirstQueryContractKey()));
}
 

 
 
//// controller.parmReportName(#reportName);
//controller.parmArgs(_args);
//controller.setRange(_args, controller.parmReportContract().parmQueryContracts().lookup(controller.getFirstQueryContractKey()));


controller.startOperation();
 
//controller.parmArgs(_args);
////NSGMonthlySalaryReportController::run(controller);
//NSGEmployeePayslipReportController::construct(_args).startOperation();

}
 
 

No comments:

Post a Comment