web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Unanswered

Display Purchase Order Status and PO Type fields in Rdp report X++ - D365

(0) ShareShare
ReportReport
Posted on by 70

Hi all,

I'm developing a report on Purchase Order and I want to show fields like PO Status and PO Type and Item Type. based on the PurchId field. 


Here is my code . I'm using multi select filter on PO Status and PurchId and Item ID

class CFZPOHistoryStatusReportDP extends SrsReportDataProviderPreProcessTempDB
{

    CFZPOHistoryStatusReportHeaderTmp     cfzPOHistoryStatusReportHeaderTmp;
    CFZPOHistoryStatusReportLinesTmp      cfzPOHistoryStatusReportLinesTmp;
    
    CFZPOHistoryStatusReportContract      contract;

    TransDate       fFromdate, tTodate;
    CompanyInfo     companyInfo;


    List            listSiteId, listPurchName, listLocationId, listPurchId, listPOStatus, listDepartment, listBrand, listCategory, listSubCategory;
    ListEnumerator  enumPurchId, enumPOStatus;
    //RetailStoreId   retailStoreId;

    //AX Tables

    //CustTrans           custTrans;
    VendTrans           vendTrans;
    PurchTable          purchTable;
    PurchLine           purchLine;
    VendInvoiceTrans    vendInvoiceTrans;
    InventDim           inventDim;
    InvoiceId           invoiceId;
    InventTable         inventTable;
    VendInvoiceJour     vendInvoiceJour;
    InventLocation      inventLocation;
    VendPackingSlipTrans vendPackingSlipTrans;
    VendTable           vendTable;
    PurchId             purchIDVar;
    PurchStatus         purchStatusVar;
    //VendPackingSlipJour vendPackingSlipJour;
    //TaxTrans            taxTrans;
    //TaxTable            taxTable;
                
        // CFZPOHistoryStatusReportHeaderTmp get and set
    [SRSReportDataSetAttribute(tablestr('CFZPOHistoryStatusReportHeaderTmp'))]
    public CFZPOHistoryStatusReportHeaderTmp getCFZPOHistoryStatusReportHeaderTmp()
    {
        //select data from table buffer
        select * from cfzPOHistoryStatusReportHeaderTmp;

        //return the buffer
        return cfzPOHistoryStatusReportHeaderTmp;
    }

    // CFZPOHistoryStatusReportLinesTmp get and set
    [SRSReportDataSetAttribute(tablestr('CFZPOHistoryStatusReportLinesTmp'))]
    public CFZPOHistoryStatusReportLinesTmp getCFZPOHistoryStatusReportLinesTmp()
    {
        //select data from table buffer
        select * from cfzPOHistoryStatusReportLinesTmp;

        //return the buffer
        return cfzPOHistoryStatusReportLinesTmp;
    }

    public void processreport()
    {
    
        contract    = this.parmDataContract() as CFZPOHistoryStatusReportContract;

        fFromdate       = contract.parmFromDate();
        tTodate         = contract.parmToDate();
        listSiteId      = contract.parmSiteId();
        listLocationId  = contract.parmInventLocationId();
        listPurchName   = contract.parmPurchName();
        listPurchId     = contract.parmPONumber();
        listPOStatus    = contract.parmPOStatus();
        listDepartment  = contract.parmDepartment();
        listBrand       = contract.parmBrand();
        listCategory    = contract.parmCategory();
        listSubCategory = contract.parmSubCategory();
       
        this.HeaderTmp();
        this.LinesTmp();
    }

    private void HeaderTmp()
    {

        cfzPOHistoryStatusReportHeaderTmp.clear();
        companyInfo = CompanyInfo::find();
        cfzPOHistoryStatusReportHeaderTmp.ReportName     = "Purchase Order History Status Report";
        cfzPOHistoryStatusReportHeaderTmp.CompanyName    = companyinfo.Name;

        cfzPOHistoryStatusReportHeaderTmp.insert();

    }

    private void LinesTmp()
    {
        enumPurchID = listPurchId.getEnumerator();
        while(enumPurchId.moveNext())
        {
            purchIDVar = enumPurchId.current();

           // while select * from purchtable where purchtable.PurchId == purchIDVar
            //while select purchTable  
            //    where purchTable.PurchId == purchIDVar
            //        join purchLine                     
            //        where purchLine.PurchId == purchTable.PurchId
            //       // join vendTable
            //       // where vendTable.AccountNum == purchTable.OrderAccount
            //        join inventDim
            //        where inventDim.inventDimId == purchLine.InventDimId
            //        join inventTable
            //        where inventTable.ItemId == purchLine.ItemId                      
            //        join vendPackingSlipTrans
            //        where vendPackingSlipTrans.ItemId == inventTable.ItemId

            while select purchLine
                where purchLine.PurchId == purchIDVar
                    join purchTable
                    where purchTable.PurchId == purchLine.PurchId
                   // join vendTable
                   // where vendTable.AccountNum == purchTable.OrderAccount
                    join inventDim
                    where inventDim.inventDimId == purchLine.InventDimId
                    join inventTable
                    where inventTable.ItemId == purchLine.ItemId
                    outer join vendPackingSlipTrans
                    where vendPackingSlipTrans.ItemId == inventTable.ItemId

                 
            {
                cfzPOHistoryStatusReportLinesTmp.clear();
                cfzPOHistoryStatusReportLinesTmp.FromDate             = fFromdate;
                cfzPOHistoryStatusReportLinesTmp.ToDate               = tTodate;
                cfzPOHistoryStatusReportLinesTmp.PurchId              = purchTable.PurchId;
                cfzPOHistoryStatusReportLinesTmp.PurchName            = purchTable.PurchName;
                cfzPOHistoryStatusReportLinesTmp.DlvDate              = purchLine.deliveryDate;
                cfzPOHistoryStatusReportLinesTmp.CreationDate         = DateTimeUtil::date(purchTable.CreatedDateTime);
                cfzPOHistoryStatusReportLinesTmp.ItemId               = purchLine.ItemId;
                cfzPOHistoryStatusReportLinesTmp.ItemName             = InventTable::find(purchLine.ItemId).itemName();
                cfzPOHistoryStatusReportLinesTmp.InventLocationName   = InventLocation::find(purchTable.InventLocationId).Name;
                cfzPOHistoryStatusReportLinesTmp.PurchPrice           = PurchLine::find(purchLine.PurchId).PurchPrice; 
                cfzPOHistoryStatusReportLinesTmp.Color                = inventDim.InventColorId;
                cfzPOHistoryStatusReportLinesTmp.PurchUnit            = purchLine.PurchUnit;
                cfzPOHistoryStatusReportLinesTmp.QtyOrdered           = vendPackingSlipTrans.Ordered;
                cfzPOHistoryStatusReportLinesTmp.Qty                  = vendPackingSlipTrans.Qty;
                cfzPOHistoryStatusReportLinesTmp.QtyReceived          = vendPackingSlipTrans.ReceivedQty_IN;
                cfzPOHistoryStatusReportLinesTmp.QtyPending           = vendPackingSlipTrans.Ordered-vendPackingSlipTrans.Qty;

                if(purchIDVar)

                    cfzPOHistoryStatusReportLinesTmp.PurchaseType     = purchTable.PurchaseType;
                  




                cfzPOHistoryStatusReportLinesTmp.insert();
            }
 

            
        
        }
        

           
    }

}

Please guide me

Thanks

I have the same question (0)
  • Dynamics365 Profile Picture
    70 on at
    RE: Display Purchase Order Status and PO Type fields in Rdp report X++ - D365

    Hi Nikolaos Mäenpää

    My issue is resolved.

    Thanks for your help and time

  • nmaenpaa Profile Picture
    101,160 Moderator on at
    RE: Display Purchase Order Status and PO Type fields in Rdp report X++ - D365

    Where do you want to shot PO status, PO type and Item type? On the report? Or on the report dialog?

    Do you have some problems with your code?

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Abhilash Warrier – Community Spotlight

We are honored to recognize Abhilash Warrier as our Community Spotlight honoree for…

Leaderboard > Finance | Project Operations, Human Resources, AX, GP, SL

#1
CA Neeraj Kumar Profile Picture

CA Neeraj Kumar 2,257

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 913 Super User 2025 Season 2

#3
Sohaib Cheema Profile Picture

Sohaib Cheema 611 User Group Leader

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans