Tuesday, 16 July 2013

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;
   // HcmAssetStatus  HcmAssetStatus;
 }
 private Query buildQuery(    Query                   _query,
                             FromDate                _fromDate,
                             ToDate                  _toDate)
                            // ,HcmAssetStatus          _HcmAssetStatus )
    {
    if(_fromDate && _toDate)
        _query.dataSourceTable(tablenum(HcmWarehouseHeaderTable),1).addRange(fieldnum(HcmWarehouseHeaderTable, InvoiceDate)).value(queryRange(_fromDate,_toDate));

       // _query.dataSourceTable(tablenum(HcmWarehouseHeaderTable), 1).addRange(fieldnum(HcmWarehouseLinesTable, AssetStatus)).value(queryvalue(HcmAssetStatus));
        return _query;
    }
 private void getReportParameters()
{
    WareHouseReportContract WareHouseReportContract = this.parmDataContract();
    // if (InvoicedSales_BaseClassContract)
    //{
        fromDate         = WareHouseReportContract.parmFromDate();
        toDate           = WareHouseReportContract.parmTodate();
       // HcmAssetStatus   = WareHouseReportContract.parmHcmAssetStatus();
    //}
}
 // <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;
   // NoYes showAccrualTrans;
  //  boolean isAccrualPrinted;
  //  Voucher prevVoucher;
   // contract = this.parmDataContract() as LedgerJournalContract;
   // showAccrualTrans = contract.parmShowAccrualTrans();
     this.getReportParameters();
    //queryRun = new QueryRun(this.parmQuery());
    queryRun = newQueryRun(this.buildQuery(this.parmQuery(),fromDate,toDate));//,HcmAssetStatus));
     while (queryRun.next())
    {
        HcmWarehouseHeaderTable = queryRun.get(tableNum(HcmWarehouseHeaderTable)) asHcmWarehouseHeaderTable;
        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;
   // HcmAssetStatus  HcmAssetStatus;
 }
 /// <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;
}


No comments:

Post a Comment