Skip to main content

Notifications

Announcements

No record found.

Finance | Project Operations, Human Resources, ...
Answered

Adding extra fields to posted VAT form

(0) ShareShare
ReportReport
Posted on by 7
Hi, 
 
There is a requirement for extra fields on Posted VAT/ Posted sales tax form.
 
I want to add 7 extra fields on the posted VAT form which is under tax module
Tax > Inquiries and Reports > Sales Tax inquiries > Posted sales tax
 
The fields are -
Invoice number
Gross Amount
Vat Code Description
Customer/Supplier code
Customer/Supplier name
Description from sales/purchase invoice line
Country region code of customer/vendor
 
Gross amount I got from display method, but for other fields, I need the filed to be filterable also, hence I'm not able to add display methods for these fields.
 
Since, these fields i can fetch from vendtrans, custtrans and ledger trans table, i think i would need to update taxtrans table by adding these fields as physical fields on taxtrans table and updating them but im not able to get a trigger point where i can call this update or any other approach would be appreciated.
 
Many thanks.
Please guide.
  • Suggested answer
    Adding extra fields to posted VAT form
    Thanks, Martin.
     
    We went with a batch job first to update the fields every 15 min but later on, the client said they didn't want a filter explicitly so we went ahead with display methods.
  • Verified answer
    Martin Dráb Profile Picture
    Martin Dráb 230,371 Most Valuable Professional on at
    Adding extra fields to posted VAT form
    I don't agree your only option to get values from either customers or vendors is using computed columns. The most natural approach would be using an union query.
  • Adding extra fields to posted VAT form
    Hi Martin, thanks for your reply. 
     
    I went with the view approach initially, but i have most of the fields where the information is being fetch from vendor or customer in the same field itself, so i'll have to write computed columns for each of the fields like customer or vendor name , customer or vendor code, or country code.
     
    The computed columns are getting complicated. so i was thinking of doing a SysExtensionSerializerMap:postInsert() way, where we create a child table and insert the records post insert in parent table, but that also is not giving me results since the records are not written on the table before transaction is completed, so i don't get trans table or journals to fetch the data from.
     
    Hence, i thought of going with update approach but i'm not able to find a trigger point to hit the update.
    For now, i wrote it under FormletterService class, it is working but i dont know if it can disturb any other process also, since even while creating a PO, it goes through the same classes.
     
    [ExtensionOf(classStr(FormletterService))]
    final class FormletterService_Extension
    {
        /// <summary>
        /// Creates totals, posts the journal and prints.
        /// </summary>
        /// <param name = "_printout">A <c>PrintOut</c> value.</param>
        protected void processJournal(Printout _printout)
        {
            
            next processJournal(_printout);

            if (ordersPosted)
            {
                TaxTrans taxTrans = TaxTrans::find(VendInvoiceJour::findRecId(journal.recid).LedgerVoucher, VendInvoiceJour::findRecId(journal.recid).InvoiceDate, true);
                if (taxTrans)
                {
                    ttsbegin;
                    InvoiceId invoiceID = VendInvoiceJour::findRecId(journal.recid).InvoiceId;
                    taxTrans.customInvoiceId = invoiceID;
                    taxTrans.update();
                    Info(strFmt('invoice id %1', taxTrans.customInvoiceId));
                    ttscommit;
                }
            }

        }
    }
     
    Regarding InvoiceID on TaxTrans table, it is there but its not getting populated.
    but there is a method to fetch the invoice number on taxtrans table which is sourceinvoiceno(), which i thought of using during update.
     
    can you please help me out, i m stuck in this approach part.
  • Martin Dráb Profile Picture
    Martin Dráb 230,371 Most Valuable Professional on at
    Adding extra fields to posted VAT form
    The ability to filter doesn't necessarily require the fields to be in the same table - you could use a join table or view instead. For example, you could combine information from several related tables in a view and join this view with TaxTrans.
     
    But the first step must be different - you need to think about the queries to fetch the data, e.g. which tables to use, what the relations are and whether a single value can be obtained at all.
     
    For example, you want to get "Description from sales invoice line" and you want to use CustTrans table, but invoice line is CustInvoiceLine, isn't it? If you actually want CustInvoiceLine, you can use a relation over SourceDocumentLine.
     
    Regarding Invoice number, don't you already have it in TaxTrans.InvoiceId?

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

Congratulations 2024 Spotlight Honorees!

Kudos to all of our 2024 community stars! 🎉

Meet the Top 10 leaders for December!

Congratulations to our December super stars! 🥳

Get Started Blogging in the Community

Hosted or syndicated blogging is available! ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,642 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,371 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans