Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

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

How to get project Settelment Amount for Each ProjectInvoiced

(0) ShareShare
ReportReport
Posted on by 1,881

Dears,

I'm trying to get the settlement amount for projects invoices. I'm getting only one settled amount but not all invoices settled amount. I create a static method to find settlement amount with SalesId as input parameter in ProjInvoiceItem table so I can use it from anywhere. Please find below code.

//ProjInvoiceItem table
public display AmountCur amountSettled()
{
    CustTrans   custTrans;
    ProjInvoiceItem projInvoiceItem;
    ProjInvoiceJour projInvoiceJour;
    AmountCur amntCur;
    SalesTable salesTable;

 while select  sum(SettleAmountCur) from custTrans  where custTrans.Invoice == this.ProjInvoiceId

    {
        amntCur = custTrans.SettleAmountCur;
           }

    return amntCur;
    }  
 /* while select firstOnly projInvoiceItem join projInvoiceJour where projInvoiceItem.ProjInvoiceId == projInvoiceJour.ProjInvoiceId
        && projInvoiceJour.InvoiceDate == this.InvoiceDate
    {

     amntCur = projInvoiceJour.amountSettled();
    }

    return amntCur; 
}*/
//ProjInvoiceItem table
public static ProjInvoiceItem findFromSalesId(SalesId _salesID)
{
    ProjInvoiceItem    projInvoiceItem;
    

    if(_salesID)
    {
   select firstOnly projInvoiceItem index hint InvoiceIdx
        where projInvoiceItem.SalesId == _salesID;
    }
    return projInvoiceItem;
}

//test job
static void stlledAmount(Args _args)
{

    info(strFmt("Amount %1", ProjInvoiceItem::findFromSalesId("SO008350").amountSettled()));
}//I need to see all invoices settled amount which belongs the specific SO. 


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

🌸 Community Spring Festival 2025 Challenge 🌸

WIN Power Platform Community Conference 2025 tickets!

Jonas ”Jones” Melgaard – Community Spotlight

We are honored to recognize Jonas "Jones" Melgaard as our April 2025…

Kudos to the March Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 294,261 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 233,013 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,158 Moderator

Leaderboard

Product updates

Dynamics 365 release plans