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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

Relationship between the VendInvoiceInfoTable and TaxTrans tables

(0) ShareShare
ReportReport
Posted on by 45

Respected

I need to find a relationship between the VendInvoiceInfoTable and TaxTrans tables or, failing that, which tables I need to relate in order to do it.

Your help please

Thank you

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    Mea_ Profile Picture
    60,286 on at

    Hi Josan_ec,

    TaxTrans holds posted tax, so it is connected to  VendInvoiceJournal not to VendInvoiceInfoTable. To join this 2 tables you can use next join

    TaxTrans.TransDate == VendInvoiceJournal .InvoiceDate &&

    TaxTrans.Voucher    == VendInvoiceJournal .LedgerVoucher

  • Josan_ec Profile Picture
    45 on at

    Thanks for replying, I explain a little better what I need:

    In the Form VendEditInvoiceTotals are shown totals of a Purchase Order, I need to show the tax breakdown. That Form uses the VendInvoiceInfoTable as Data Source.

    Can you tell me what to do?

  • Mea_ Profile Picture
    60,286 on at

    For not posted order you can find tax information in TaxUncommitted table. You can put breakpoint into \Data Dictionary\Tables\TmpTaxWorkTrans\Methods\loadFromTaxUncommitted  to see how AX selects data when you click totals on unposted invoice. Generally speaking it's done base on SourceDocumentRecord.

  • Josan_ec Profile Picture
    45 on at

    This form uses classes and several methods for accessing data, it is complicated to follow the trail.

  • Suggested answer
    Mea_ Profile Picture
    60,286 on at

    Yep, that's what we do as developers. Anyway you can try to use

    PurchTotals::getTax(purchTable).tmpTaxWorkTrans();

    This method returns temporary table that contains all tax transactions for purchase order.

  • Josan_ec Profile Picture
    45 on at

    Thanks for your answer, I already filled the TmpTaxWorkTrans table but the VendInvoiceInfoLine field has value 0 in all records and I can not relate it to the VendInvoiceInfoLine table ... any idea?

  • Mea_ Profile Picture
    60,286 on at

    I just checked cross-references and there is no code to populate this field. Looks strange but anyway you can join them using PurchLine that you can find from VendInvoiceInfoLine , there is a relation TmpTaxWorkTrans.SourceRecId  == PurchLine.RecId && SourceTableId.TableId == PurchLine.TableId

  • Josan_ec Profile Picture
    45 on at

    Thanks again, but my interest is to take the tax by invoice and the PurchTable is only the Purchase Order, so my need to tie it with VendInvoiceInfoTable or VendInvoiceInfoLine.

  • Verified answer
    Mea_ Profile Picture
    60,286 on at

    Here you go

    PurchTotals purchTotals = PurchTotals::newParmTable(vendInvoiceInfoTable, PurchUpdate::All, AccountOrder::None, vendInvoiceInfoTable.ParmId, '', DocumentStatus::Invoice);
    purchTotals.calc();
    tmpTaxWorkTrans = purchTotals.tax().tmpTaxWorkTrans();

    You need to set PurchUpdate and DocumentStatus you want.

    Now SourceTableId == VendInvoiceInfoLine.TableId and SourceRecId== VendInvoiceInfoLine.RecId

  • Josan_ec Profile Picture
    45 on at

    Thank you very much, this is what I needed.

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Women in Power Builds Momentum

Expanding mentorship, skilling, and AI innovation

Congratulations to the June Top 10 Community Leaders

These are the community rock stars!

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans