Wednesday 9 January 2019

How to get an invoice number of a payment in dynamics AX 2012 / D365 F&O X++

Below is the code I have written  in D365 F&O for getting the invoice numbers for payments which are settled with the invoices.

Please change the code according to your requirement.

class VendTransTest
{
    /// <summary>
    /// Runs the class with the specified arguments.
    /// </summary>
    /// <param name = "_args">The specified arguments.</param>
    public static void main(Args _args)
    {
       
        VendTrans               vendTransPayment, vendTransinvoice;
        TransDate               fromTransDate = 01\01\2018;
        TransDate               toTransDate = str2Date("12/31/2018", 213);
        ;
        while select vendTransPayment where vendTransPayment.TransType == LedgerTransType::Payment
                                &&  vendTransPayment.TransDate >= fromTransDate
                                && vendTransPayment.TransDate <= toTransDate
        {
                         
                while select vendTransinvoice where vendTransinvoice.LastSettleVoucher == vendTransPayment.Voucher
                 {
                            info(vendTransinvoice.invoice);
                 }

            }
        }
       
    }

}

@Rahul 

No comments:

Post a Comment

Adding a newline into a string in C# and X++

Below is the sample code we can use for  adding a newline after every occurrence of "@" symbol in the string in C#   using System...