COC for CustTable and Creating Display methods

 [ExtensionOf(tableStr(CustTable))]


final class BAS_OrderStatistics_Extension

{

    public display real totalInvoicedAmount()

    {

        SalesLine sl;

        select sum(LineAmount) from sl

            where sl.CustAccount==this.AccountNum && sl.SalesStatus==SalesStatus::Invoiced;

        return sl.LineAmount;

     }


    public display int  CountInvoiced()

    {

        SalesLine sl;

        select count(LineAmount) from sl

            where sl.CustAccount==this.AccountNum && sl.SalesStatus==SalesStatus::Invoiced;

        return sl.LineAmount;

    }


    public display real totalOpenOrderAmount()

    {

        SalesLine sl;

        select sum(LineAmount) from sl

            where sl.CustAccount==this.AccountNum && sl.SalesStatus==SalesStatus::Backorder;

        return sl.LineAmount;

    }


    public display int  CountOpen()

    {

        SalesLine sl;

        select count(LineAmount) from sl

            where sl.CustAccount==this.AccountNum && sl.SalesStatus==SalesStatus::Backorder;

        return sl.LineAmount;

    }


    public display real totalDeliveredAmount()

    {

        SalesLine sl;

        select sum(LineAmount) from sl

            where sl.CustAccount==this.AccountNum && sl.SalesStatus==SalesStatus::Delivered;

        return sl.LineAmount;

    }


    public display int  CountDelivered()

    {

        SalesLine sl;

        select count(LineAmount) from sl

            where sl.CustAccount==this.AccountNum && sl.SalesStatus==SalesStatus::Delivered;

        return sl.LineAmount;

    }


}


Comments

Popular posts from this blog

How to Create a wizard in x++ d365

how to post trade agreement journals automatically using x++ code

X++ code to CREATE AND POST A TRADE AGREEMENT IN MICROSOFT DYNAMICS 365 in D365 F & O