Style 1.
[
SRSReportQueryAttribute (querystr(CustTableQry)),
SRSReportParameterAttribute(classstr(CustContractClass))
]
class CustTableRDP extends SRSReportDataProviderBase
{
CustTableTmp custTableTmp;
}
*********************************
[
SysEntryPointAttribute(false)
]
public void processReport()
{
QueryRun queryRun;
Query query;
CustTable custTable;
CustContractClass CustContractClass;
AccountNum accountNum;
QueryBuildDataSource queryBuildDataSource;
QueryBuildRange queryBuildRange;
query = this.parmQuery();
CustContractClass = this.parmDataContract() as CustContractClass;
accountNum = CustContractClass.parmAccountNum();
// Add parameters to the query.
queryBuildDataSource = query.dataSourceTable(tablenum(CustTable));
if(accountNum)
{
queryBuildRange = queryBuildDataSource.findRange(fieldnum(CustTable, AccountNum));
if (!queryBuildRange)
{
queryBuildRange = queryBuildDataSource.addRange(fieldnum(CustTable, AccountNum));
}
// If an account number has not been set, then use the parameter value to set it.
if(!queryBuildRange.value())
queryBuildRange.value(accountNum);
}
queryRun = new QueryRun(query);
while(queryRun.next())
{
custTable = queryRun.get(tableNum(CustTable));
this.insertTmpTable(CustTable);
}
}
________________________________________________
/// This method inserts data into the temporary table.
/// Table buffer of CustTable table.
private void insertTmpTable(CustTable _custTable)
{
custTableTmp.AccountNum = _custTable.AccountNum;
custTableTmp.Blocked = _custTable.Blocked;
custTableTmp.PriceGroup = _custTable.PriceGroup;
custTableTmp.Currency = _custTable.Currency;
custTableTmp.insert();
}
____________________________________________
[SRSReportDataSetAttribute("CustTableTmp")]
public custTableTmp getcustTableTmp()
{
select * from custTableTmp;
return custTableTmp;
}
Styel 2
// *************Alternative code sample*************//
SSRS report DP class And Contract Class Example
/// <summary>
/// The <c>LedgerJournalDP</c> class declares the variables, tables, and so on, that are used in the
/// <c>LedgerJournal</c> report.
/// </summary>
[
SRSReportQueryAttribute(queryStr(HcmWareHouseQry)),
SRSReportParameterAttribute(classStr(WareHouseReportContract))
]
public class WarehouseReportDP extends SRSReportDataProviderBase
{
WarehouseTmp WarehouseTmp;
TransDate fromDate;
TransDate toDate;
}
private Query buildQuery( Query _query,
FromDate _fromDate,
ToDate _toDate)
{
if(_fromDate && _toDate)
_query.dataSourceTable(tablenum(HcmWarehouseHeaderTable),1).addRange(fieldnum(HcmWarehouseHeaderTable, InvoiceDate)).value(queryRange(_fromDate,_toDate));
return _query;
}
private void getReportParameters()
{
WareHouseReportContract WareHouseReportContract = this.parmDataContract();
fromDate = WareHouseReportContract.parmFromDate();
toDate = WareHouseReportContract.parmTodate();
}
// <summary>
/// Executes temporary table.
/// </summary>
/// <returns>
/// The temporary table <c>LedgerJournalTmp</c>.
/// </returns>
[
SRSReportDataSetAttribute('WarehouseTmp')
]
public WarehouseTmp getWarehouseTmp()
{
select WarehouseTmp;
return WarehouseTmp;
}
private void insertWarehouseTmp(
HcmWarehouseHeaderTable _HcmWarehouseHeaderTable,
HcmWarehouseLinesTable _HcmWarehouseLinesTable)
{
WarehouseTmp.Logo = _HcmWarehouseHeaderTable.image();
WarehouseTmp.WarehouseID = _HcmWarehouseHeaderTable.WarehouseID;
WarehouseTmp.InvoiceNumber = _HcmWarehouseHeaderTable.InvoiceNumber;
WarehouseTmp.InvoiceDate = _HcmWarehouseHeaderTable.InvoiceDate;
WarehouseTmp.VendName = _HcmWarehouseHeaderTable.VendName;
WarehouseTmp.VendorAccount = _HcmWarehouseHeaderTable.VendorAccount;
WarehouseTmp.Address = _HcmWarehouseHeaderTable.vendorAddress();
WarehouseTmp.SerialNumber = _HcmWarehouseLinesTable.SerialNumber;
WarehouseTmp.ITAssetCode = _HcmWarehouseLinesTable.ITAssetCode;
WarehouseTmp.Type = _HcmWarehouseLinesTable.Type;
WarehouseTmp.Manufacturer = _HcmWarehouseLinesTable.Manufacturer;
WarehouseTmp.Model = _HcmWarehouseLinesTable.Model;
WarehouseTmp.ProductDescription = _HcmWarehouseLinesTable.ProductDescription;
WarehouseTmp.BaseConfiguration = _HcmWarehouseLinesTable.BaseConfiguration;
WarehouseTmp.ProductSerialNumber = _HcmWarehouseLinesTable.ProductSerialNumber;
WarehouseTmp.Quantity = _HcmWarehouseLinesTable.Quantity;
WarehouseTmp.AcquisitionCost = _HcmWarehouseLinesTable.AcquisitionCost;
WarehouseTmp.WarrantyPeriod = _HcmWarehouseLinesTable.WarrantyPeriod;
WarehouseTmp.insert();
}
[SysEntryPointAttribute(false)]
public void processReport()
{
HcmWarehouseHeaderTable HcmWarehouseHeaderTable;
HcmWarehouseLinesTable HcmWarehouseLinesTable;
WareHouseReportContract contract;
QueryRun queryRun;
this.getReportParameters();
queryRun = new QueryRun(this.buildQuery(this.parmQuery(),fromDate,toDate));
while (queryRun.next())
{
HcmWarehouseHeaderTable = queryRun.get(tableNum(HcmWarehouseHeaderTable)) as HcmWarehouseHeaderTable;
HcmWarehouseLinesTable = queryRun.get(tableNum(HcmWarehouseLinesTable)) as HcmWarehouseLinesTable;
this.insertWarehouseTmp(HcmWarehouseHeaderTable, HcmWarehouseLinesTable);
}
}
/// <summary>
/// The <c>LedgerJournalContract</c> class is the Data Contract class for the <c>LedgerJournal</c> SSRS
/// report.
/// </summary>
[
DataContractAttribute,
SysOperationGroupAttribute('PrintOut', "@SYS12608", '1')
]
public class WareHouseReportContract
{
TransDate fromDate;
TransDate toDate;
}
/// <summary>
/// Gets or sets the value of the datacontract parameter ShowAccrualTrans.
/// </summary>
/// <param name=”_showAccrualTrans”>
/// The new value of the datacontract parameter ShowAccrualTrans; optional.
/// </param>
/// <returns>
/// The current value of datacontract parameter ShowAccrualTrans
/// </returns>
[
DataMemberAttribute('fromDate'),
SysOperationLabelAttribute(literalstr("FromDate")),
SysOperationHelpTextAttribute(literalstr("FromDate")),
SysOperationGroupMemberAttribute('PrintOut'),
SysOperationDisplayOrderAttribute('2')
]
public TransDate parmFromDate(TransDate _fromDate = fromDate)
{
fromDate = _fromDate;
return fromDate;
}
// <summary>
/// Gets or sets the value of the datacontract parameter Specification.
/// </summary>
/// <param name=”_specification”>
/// The new value of the datacontract parameter Specification; optional.
/// </param>
/// <returns>
/// The current value of datacontract parameter Specification
/// </returns>
[
DataMemberAttribute('todate'),
SysOperationLabelAttribute(literalstr("Todate")),
SysOperationHelpTextAttribute(literalstr("Todate")),
SysOperationGroupMemberAttribute('PrintOut'),
SysOperationDisplayOrderAttribute('3')
]
public TransDate parmTodate(TransDate _todate = todate)
{
todate = _todate;
return todate;
}
Regards,
[
SRSReportQueryAttribute (querystr(CustTableQry)),
SRSReportParameterAttribute(classstr(CustContractClass))
]
class CustTableRDP extends SRSReportDataProviderBase
{
CustTableTmp custTableTmp;
}
*********************************
[
SysEntryPointAttribute(false)
]
public void processReport()
{
QueryRun queryRun;
Query query;
CustTable custTable;
CustContractClass CustContractClass;
AccountNum accountNum;
QueryBuildDataSource queryBuildDataSource;
QueryBuildRange queryBuildRange;
query = this.parmQuery();
CustContractClass = this.parmDataContract() as CustContractClass;
accountNum = CustContractClass.parmAccountNum();
// Add parameters to the query.
queryBuildDataSource = query.dataSourceTable(tablenum(CustTable));
if(accountNum)
{
queryBuildRange = queryBuildDataSource.findRange(fieldnum(CustTable, AccountNum));
if (!queryBuildRange)
{
queryBuildRange = queryBuildDataSource.addRange(fieldnum(CustTable, AccountNum));
}
// If an account number has not been set, then use the parameter value to set it.
if(!queryBuildRange.value())
queryBuildRange.value(accountNum);
}
queryRun = new QueryRun(query);
while(queryRun.next())
{
custTable = queryRun.get(tableNum(CustTable));
this.insertTmpTable(CustTable);
}
}
________________________________________________
/// This method inserts data into the temporary table.
/// Table buffer of CustTable table.
private void insertTmpTable(CustTable _custTable)
{
custTableTmp.AccountNum = _custTable.AccountNum;
custTableTmp.Blocked = _custTable.Blocked;
custTableTmp.PriceGroup = _custTable.PriceGroup;
custTableTmp.Currency = _custTable.Currency;
custTableTmp.insert();
}
____________________________________________
[SRSReportDataSetAttribute("CustTableTmp")]
public custTableTmp getcustTableTmp()
{
select * from custTableTmp;
return custTableTmp;
}
Styel 2
// *************Alternative code sample*************//
SSRS report DP class And Contract Class Example
/// <summary>
/// The <c>LedgerJournalDP</c> class declares the variables, tables, and so on, that are used in the
/// <c>LedgerJournal</c> report.
/// </summary>
[
SRSReportQueryAttribute(queryStr(HcmWareHouseQry)),
SRSReportParameterAttribute(classStr(WareHouseReportContract))
]
public class WarehouseReportDP extends SRSReportDataProviderBase
{
WarehouseTmp WarehouseTmp;
TransDate fromDate;
TransDate toDate;
}
private Query buildQuery( Query _query,
FromDate _fromDate,
ToDate _toDate)
{
if(_fromDate && _toDate)
_query.dataSourceTable(tablenum(HcmWarehouseHeaderTable),1).addRange(fieldnum(HcmWarehouseHeaderTable, InvoiceDate)).value(queryRange(_fromDate,_toDate));
return _query;
}
private void getReportParameters()
{
WareHouseReportContract WareHouseReportContract = this.parmDataContract();
fromDate = WareHouseReportContract.parmFromDate();
toDate = WareHouseReportContract.parmTodate();
}
// <summary>
/// Executes temporary table.
/// </summary>
/// <returns>
/// The temporary table <c>LedgerJournalTmp</c>.
/// </returns>
[
SRSReportDataSetAttribute('WarehouseTmp')
]
public WarehouseTmp getWarehouseTmp()
{
select WarehouseTmp;
return WarehouseTmp;
}
private void insertWarehouseTmp(
HcmWarehouseHeaderTable _HcmWarehouseHeaderTable,
HcmWarehouseLinesTable _HcmWarehouseLinesTable)
{
WarehouseTmp.Logo = _HcmWarehouseHeaderTable.image();
WarehouseTmp.WarehouseID = _HcmWarehouseHeaderTable.WarehouseID;
WarehouseTmp.InvoiceNumber = _HcmWarehouseHeaderTable.InvoiceNumber;
WarehouseTmp.InvoiceDate = _HcmWarehouseHeaderTable.InvoiceDate;
WarehouseTmp.VendName = _HcmWarehouseHeaderTable.VendName;
WarehouseTmp.VendorAccount = _HcmWarehouseHeaderTable.VendorAccount;
WarehouseTmp.Address = _HcmWarehouseHeaderTable.vendorAddress();
WarehouseTmp.SerialNumber = _HcmWarehouseLinesTable.SerialNumber;
WarehouseTmp.ITAssetCode = _HcmWarehouseLinesTable.ITAssetCode;
WarehouseTmp.Type = _HcmWarehouseLinesTable.Type;
WarehouseTmp.Manufacturer = _HcmWarehouseLinesTable.Manufacturer;
WarehouseTmp.Model = _HcmWarehouseLinesTable.Model;
WarehouseTmp.ProductDescription = _HcmWarehouseLinesTable.ProductDescription;
WarehouseTmp.BaseConfiguration = _HcmWarehouseLinesTable.BaseConfiguration;
WarehouseTmp.ProductSerialNumber = _HcmWarehouseLinesTable.ProductSerialNumber;
WarehouseTmp.Quantity = _HcmWarehouseLinesTable.Quantity;
WarehouseTmp.AcquisitionCost = _HcmWarehouseLinesTable.AcquisitionCost;
WarehouseTmp.WarrantyPeriod = _HcmWarehouseLinesTable.WarrantyPeriod;
WarehouseTmp.insert();
}
[SysEntryPointAttribute(false)]
public void processReport()
{
HcmWarehouseHeaderTable HcmWarehouseHeaderTable;
HcmWarehouseLinesTable HcmWarehouseLinesTable;
WareHouseReportContract contract;
QueryRun queryRun;
this.getReportParameters();
queryRun = new QueryRun(this.buildQuery(this.parmQuery(),fromDate,toDate));
while (queryRun.next())
{
HcmWarehouseHeaderTable = queryRun.get(tableNum(HcmWarehouseHeaderTable)) as HcmWarehouseHeaderTable;
HcmWarehouseLinesTable = queryRun.get(tableNum(HcmWarehouseLinesTable)) as HcmWarehouseLinesTable;
this.insertWarehouseTmp(HcmWarehouseHeaderTable, HcmWarehouseLinesTable);
}
}
/// <summary>
/// The <c>LedgerJournalContract</c> class is the Data Contract class for the <c>LedgerJournal</c> SSRS
/// report.
/// </summary>
[
DataContractAttribute,
SysOperationGroupAttribute('PrintOut', "@SYS12608", '1')
]
public class WareHouseReportContract
{
TransDate fromDate;
TransDate toDate;
}
/// <summary>
/// Gets or sets the value of the datacontract parameter ShowAccrualTrans.
/// </summary>
/// <param name=”_showAccrualTrans”>
/// The new value of the datacontract parameter ShowAccrualTrans; optional.
/// </param>
/// <returns>
/// The current value of datacontract parameter ShowAccrualTrans
/// </returns>
[
DataMemberAttribute('fromDate'),
SysOperationLabelAttribute(literalstr("FromDate")),
SysOperationHelpTextAttribute(literalstr("FromDate")),
SysOperationGroupMemberAttribute('PrintOut'),
SysOperationDisplayOrderAttribute('2')
]
public TransDate parmFromDate(TransDate _fromDate = fromDate)
{
fromDate = _fromDate;
return fromDate;
}
// <summary>
/// Gets or sets the value of the datacontract parameter Specification.
/// </summary>
/// <param name=”_specification”>
/// The new value of the datacontract parameter Specification; optional.
/// </param>
/// <returns>
/// The current value of datacontract parameter Specification
/// </returns>
[
DataMemberAttribute('todate'),
SysOperationLabelAttribute(literalstr("Todate")),
SysOperationHelpTextAttribute(literalstr("Todate")),
SysOperationGroupMemberAttribute('PrintOut'),
SysOperationDisplayOrderAttribute('3')
]
public TransDate parmTodate(TransDate _todate = todate)
{
todate = _todate;
return todate;
}
Regards,
No comments:
Post a Comment