Friday, February 28, 2014

Report SSRS DP,COntract,Controller class

//DP class

[
    SRSReportParameterAttribute(classstr(PurchContractClass))
]
public class PurchDPClass extends SRSReportDataProviderBase
{
    PurchTmp    purchTmp;
}


Method :

[SRSReportDataSetAttribute('PurchTmp')]
public purchTmp getpurchTmp()
{
    select * from purchTmp;
    return purchTmp;
}

Method  1:
[SysEntryPointAttribute(false)]
public void processReport()
{
    PurchTable  purchTable;
    PurchLine   purchLine;
    PurchContractClass purchContractClass;
    PurchId     purchId;
    PurchStatus purchStatus;
    InclTax     inclTax;

    purchContractClass = this.parmDataContract() as PurchContractClass;
    purchId = purchContractClass.parmPurchId();
    //purchStatus = purchContractClass.parmPurchStatus();
    //inclTax = purchContractClass.parmInclTax();

     while select purchTable where purchTable.PurchId == purchId
    {
        purchTmp.PurchId = purchTable.PurchId;
        purchTmp.InvoiceAccount = purchTable.InvoiceAccount;
        purchTmp.PurchName = purchTable.PurchName;
        purchTmp.InclTax = purchTable.InclTax;
        purchTmp.PaymMode = purchTable.PaymMode;
        purchTmp.PurchStatus = purchTable.PurchStatus;
        purchTmp.CurrencyCode = purchTable.CurrencyCode;
       
        select purchId from purchLine where purchLine.PurchId == purchTable.PurchId;
       
        purchTmp.itemid = purchLine.ItemId;
        purchTmp.VendGroup = purchLine.VendGroup;
        purchTmp.LineNumber = purchLine.LineNumber;
        purchTmp.PurchQty = purchLine.PurchQty;
       
        purchTmp.insert();
    }
}

//Contract Class:

[DataContractAttribute]
public class PurchContractClass
{
    PurchId     purchId;
    PurchStatus purchStatus;
    InclTax     inclTax;
}

Method 1:
[DataMemberAttribute("PurchId")]
public PurchId parmPurchId(PurchId _purchId = purchId)
{
    purchId = _purchId;
    return purchId;
}

Method 2:
[DataMemberAttribute("InclTax")]
public InclTax parmInclTax(InclTax _inclTax = inclTax)
{
    inclTax = _inclTax;
    return inclTax;
}

Method 3:

[DataMemberAttribute("PurchStatus")]
public PurchStatus parmPurchStatus(PurchStatus _purchStatus = purchStatus)
{
    purchStatus = _purchStatus;
    return purchStatus;
}


// Controller Class

class PurchControllerClass extends SrsReportRunController
{
     RecordSortedList       journalList;


     PurchView      purchview;
     //CWBProjInvoiceContract CWBProjInvoicecontract;
}

protected void initArgs(Args _args)
{
    args = new Args();

     if (_args.object() &&
        _args.object() is RecordSortedList)
    {
        journalList = _args.object();
    }
    else if (_args.record())
    {
        journalList = new RecordSortedList(tableNum(PurchView));
        journalList.ins(_args.record());
    }

    journalList.first(purchview);

    this.parmReportName("PurchReport.PurchReportDesign");
    this.parmShowDialog(false);

    this.parmArgs(_args);
}

protected void preRunModifyContract()
{
    PurchContractClass contract;
    contract = this.parmReportContract().parmRdpContract() as PurchContractClass;

    contract.parmPurchId(purchview.PurchId);
    contract.parmVendAccount(purchview.InvoiceAccount);
    ////contract.parmPurchStatus(purchview.PurchStatus);
    //contract.parm(purchview.PurchId);
}

public static void main(Args _args)
{
   PurchControllerClass controller = new PurchControllerClass();
    ;


   controller.parmReportName("PurchReport.PurchReportDesign");
   //controller.parmArgs(_args);
    controller.initArgs(_argsssssss);

    controller.startOperation();
}

No comments:

Post a Comment

Convert Call stack to readable format in D365FO X++

//Input --container _xppCallStack = xSession::xppCallStack();  Public static str POL_formatXppCallStack(container _xppCallStack, int _skipFr...