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

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

Multiple invoice in payment

(0) ShareShare
ReportReport
Posted on by 2,626

Hello Guys,

I am integrating Payment Journal in AX using X++. It is working properly. But for one invoice on voucher.

In AX one voucher line can be applied for multiple Invoices.i am not getting any idea to integrate for multiple invoice number for single line.if Any idea please suggest.

If my point is not clear please let me know.

*This post is locked for comments

I have the same question (0)
  • André Arnaud de Calavon Profile Picture
    301,069 Super User 2025 Season 2 on at

    Hi Vikas,

    You can have a look at the already existing payment proposal functionality in AX AOT. It is generating payment journals with a link to the invoices.

    The class SpecTransManager can be used to mark the invoices against the payment.

  • Vikas Gupta Profile Picture
    2,626 on at

    Hello Andre,

    As per your suggestion i have used SpectranManager class.please have a look following code and your opinion on this.

    Public Static void Isys_Payment()

    {

      //--------------------

           DimensionStorage dimensionStorage;

           DimensionAttribute deparmentDimensionAttribute;

           DimensionAttributeValue newDepartmentValue;

       Ledger Led;

       DimensionAttributeValueSetStorage valueset;

       DimensionDefault res;

       int i;

       DimensionAttribute dimensionAttribute;

       DimensionAttributeValue dimensionAttributeValue;

       container conatrr;

       container conval;

       str dimvalue;

       CustTable cust;

       SpecTrans insertSpecTrans;

               SpecTransManager insertSpecTrans1;

       //--------------------

       AxLedgerJournalTable    journalTable;

       AxLedgerJournalTrans    journalTrans;

       container               acctPattern;

       container               acctPattern1;

       container               offSetAcctPattern;

       DataAreaId areaid="USMF";

       LedgerJournalTable      ledgerJournalTable;

       ledgerJournalCheckPost  ledgerJournalCheckPost;

       LedgerDimensionAccount  ledgerDim;

       DimensionAttributeValueSetStorage  dimstorage;

        DimensionDefault D;

       DimensionDefault df;

       DimensionValueService ser;

       DimensionValueContract s1;

       Counter retryCount;

       CustInvoiceJour custInvoicejour;

       #define.RMax(5)

       ;

       journalTable = new AxLedgerJournalTable();

       journalTrans = new AxLedgerJournalTrans();

       //Journal Name

       journalTable.parmJournalType(LedgerJournalType::Payment);

       journalTable.parmJournalName("SLSPAY");

       journalTable.save();

       journalTrans.parmJournalNum(journalTable.ledgerJournalTable().JournalNum);

       journalTrans.parmTransDate(systemDateGet());

       journalTrans.parmCurrencyCode("USD");

       //journalTrans.parmAmountCurDebit(200);

       journalTrans.parmAccountType(LedgerJournalACType::Cust);

       journalTrans.parmLedgerDimension(DimensionStorage::getDynamicAccount("US-027",LedgerJournalACType::Cust));

       journalTrans.parmMarkedInvoice("*");

       //------------------------------------------------------

        conatrr=["BusinessUnit","CostCenter","Department","ItemGroup"];

        conval=["001","010","022","Audio"];

       valueset=new DimensionAttributeValueSetStorage();

       for (i=1;i<=conLen(conatrr);i++)

       {

           dimensionAttribute=dimensionAttribute::findByName(conPeek(conatrr,i));

           if(dimensionAttribute.RecId==0)

           {

               continue;

           }

           dimvalue=conPeek(conval,i);

           if(dimvalue!="")

           {

               dimensionAttributeValue =dimensionAttributeValue::findByDimensionAttributeAndValue(dimensionAttribute,dimvalue,false,true);

               valueset.addItem(dimensionAttributeValue);

           }

           res=valueset.save();

           journalTrans.parmDefaultDimension(res);

       }

       insertSpecTrans1=SpecTransManager::construct(insertSpecTrans);

    insertSpecTrans1.insertLine("USMF",tableNum(LedgerJournalTrans),CustTransOpen::findRefId(custInvoicejour.custTrans).RecId).RecId,insertSpecTrans.SpecRecId,CustTransOpenLine::findByRefId(custInvoicejour.custTrans().RecId).RecId,220);

       journalTrans.save();

           info(strFmt("Payment No. %1.", journalTable.ledgerJournalTable().JournalNum));

    }

  • Suggested answer
    Community Member Profile Picture
    on at

    I think there is issue in the job given above..

    I think

    insertSpecTrans1.insertLine() method should be called inside loop so that we can insert all the invoice lines in specTrans table.

    please review the job once again and update with your findings

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…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Martin Dráb Profile Picture

Martin Dráb 4 Most Valuable Professional

#1
Priya_K Profile Picture

Priya_K 4

#3
MyDynamicsNAV Profile Picture

MyDynamicsNAV 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans