Cấu trúc cơ bản của Report DataProvider


18/09/2020- duocnt    794 Views    

Ý NGHĨA.

 - Cấu trúc cơ bản cần có khi tạo 1 class SSRS Report DataProvider.

Code X++.

[SrsReportParameterAttribute(classStr(InternalTransferBookReportContract))]
class InternalTransferBookReportDP extends SRSReportDataProviderBase
{
    InternalTransferBookReportContract      _contract;
    TransferBookHeaderReportTmp             _headerTmp;
    TransferBookLineReportTmp               _lineTmp;
    InternalTransferBookETD                 _bookId;
    ProductInternalTransferBookHeader       _header;
    ProductInternalTransferBookLine         _line;
 
    ///<summary>
    ///
    ///</summary>
    public void processReport()
    {
        super();
        _contract   = this.parmDataContract() as InternalTransferBookReportContract;
        _bookId     =  _contract.parmBookId();
 
        //Header data
        _header =   ProductInternalTransferBookHeader::findIndex(_bookId);
        _headerTmp.clear();
        _headerTmp.BookId   =  _header.BookId;
        _headerTmp.ProdPoolId       =  _header.ProdPoolId;
        _headerTmp.WarehouseReceipt =   _header.WarehouseReceipt;
        _headerTmp.ReceiptBy        =  _header.ReceiptBy;
        _headerTmp.TransDate        =  _header.CreatedDateTime;
        _headerTmp.TransBy          =  _header.CreatedBy;
        _headerTmp.insert();
 
 
        //Line Data
        _lineTmp.clear();
        while select _line where _line.BookId == _bookId
        {
            _lineTmp.ProductionId   =  _line.ProductionId;
            _lineTmp.SalesId        =  _line.SalesId;
            _lineTmp.ItemId         =  _line.ItemId;
            _lineTmp.ItemName       =  _line.ItemName;
            _lineTmp.ItemFG         =  _line.ItemFG;
            _lineTmp.ItemFGName     =  _line.ItemFGName;
            _lineTmp.SalesQty       =  _line.SalesQty;
            _lineTmp.BOMQty         =  _line.BOMQty;
            _lineTmp.QtyIssue       =  _line.QtyIssue;
            _lineTmp.TotalQty       =  _line.TotalQty;
            _lineTmp.Balance        =  _line.Balance;
            _lineTmp.insert();
        }
 
    }
 
    ///<summary>
    /// Dataset 1(Header)
    ///</summary>
    ///<returns></returns>
    [SRSReportDataSetAttribute(tablestr("TransferBookHeaderReportTmp"))]
    public TransferBookHeaderReportTmp headerData()
    {
        return _headerTmp;
    }
 
    ///<summary>
    /// Dataset 2(Line)
    ///</summary>
    ///<returns></returns>
    [SRSReportDataSetAttribute(tablestr("TransferBookLineReportTmp"))]
    public TransferBookLineReportTmp lineData()
    {
        return _lineTmp;
    }
}

Góp ý kiến

;
;