Announcements
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
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
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?
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.
This form uses classes and several methods for accessing data, it is complicated to follow the trail.
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.
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?
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
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.
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
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.
Congratulations to our community stars!
Expanding mentorship, skilling, and AI innovation
These are the community rock stars!
Stay up to date on forum activity by subscribing.