Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics AX forum
Answered

Relationship between the VendInvoiceInfoTable and TaxTrans tables

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

  • Mea_ Profile Picture
    Mea_ 60,274 on at
    RE: Relationship between the VendInvoiceInfoTable and TaxTrans tables

    Could you please mark any answer(s) that helped you as verified to close this thread ?

  • Josan_ec Profile Picture
    Josan_ec 45 on at
    RE: Relationship between the VendInvoiceInfoTable and TaxTrans tables

    Thank you very much, this is what I needed.

  • Verified answer
    Mea_ Profile Picture
    Mea_ 60,274 on at
    RE: Relationship between the VendInvoiceInfoTable and TaxTrans tables

    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
    Josan_ec 45 on at
    RE: Relationship between the VendInvoiceInfoTable and TaxTrans tables

    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.

  • Mea_ Profile Picture
    Mea_ 60,274 on at
    RE: Relationship between the VendInvoiceInfoTable and TaxTrans tables

    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
    Josan_ec 45 on at
    RE: Relationship between the VendInvoiceInfoTable and TaxTrans tables

    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?

  • Suggested answer
    Mea_ Profile Picture
    Mea_ 60,274 on at
    RE: Relationship between the VendInvoiceInfoTable and TaxTrans tables

    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
    Josan_ec 45 on at
    RE: Relationship between the VendInvoiceInfoTable and TaxTrans tables

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

  • Mea_ Profile Picture
    Mea_ 60,274 on at
    RE: Relationship between the VendInvoiceInfoTable and TaxTrans tables

    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
    Josan_ec 45 on at
    RE: Relationship between the VendInvoiceInfoTable and TaxTrans tables

    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?

Helpful resources

Quick Links

Replay now available! Dynamics 365 Community Call (CRM Edition)

Catch up on the first D365 Community Call held on 7/10

Community Spotlight of the Month

Kudos to Saurav Dhyani!

Congratulations to the June Top 10 community leaders!

These stars go above and beyond . . .

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 287,914 Super User

#2
Martin Dráb Profile Picture

Martin Dráb 225,549 Super User

#3
nmaenpaa Profile Picture

nmaenpaa 101,148

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans