Skip to main content

Notifications

Announcements

No record found.

Small and medium business | Business Central, N...
Answered

I want to add a column in the Vendor ledger entries table for VAT.

Posted on by 21
I want to add a column to the vendor ledger entries table where we have all the invoices and when we click in the Posted date field an invoice is opened via Posted Purchase Invoice which has a field called total VAT.
 
But I want this Total VAT field to be shown in the Vendor ledger entries table so that I don't have to open invoices again and again to view the VAT amount.
  • Suggested answer
    YUN ZHU Profile Picture
    YUN ZHU 73,647 Super User 2024 Season 2 on at
    I want to add a column in the Vendor ledger entries table for VAT.
    Hi, Because Payment generally does not generate VAT, I only calculated the type of Invoice. If you need to calculate Credit Memo, you need to add a condition and get the value from the Sales Cr.Memo Header
     
    Thanks.
    ZHU
  • Community member Profile Picture
    Community member 21 on at
    I want to add a column in the Vendor ledger entries table for VAT.
    can you help me understand the first if condition logic here?
     if Rec."Document Type" = Rec."Document Type"::Invoice then
                if PurchInvHeader.Get(Rec."Document No.") then begin
                    PurchInvHeader.CalcFields(Amount, "Amount Including VAT");
                    TotalVAT := PurchInvHeader."Amount Including VAT" - PurchInvHeader.Amount;
                end;
     
  • Community member Profile Picture
    Community member 21 on at
    I want to add a column in the Vendor ledger entries table for VAT.
    Thanks a lot I was stuck on this for a week or more.

    Thank You very much you are brilliant.
  • Verified answer
    YUN ZHU Profile Picture
    YUN ZHU 73,647 Super User 2024 Season 2 on at
    I want to add a column in the Vendor ledger entries table for VAT.
    Hi, If you want to display the following field, I hope the following scheme can give you some tips.
    For example,
    pageextension 50122 MyExtension7 extends "Vendor Ledger Entries"
    {
        layout
        {
            addafter("Posting Date")
            {
                field(TotalVAT; TotalVAT)
                {
                    Caption = 'Total VAT';
                    ApplicationArea = All;
                }
            }
        }
    
        trigger OnAfterGetRecord()
        var
            PurchInvHeader: Record "Purch. Inv. Header";
        begin
            TotalVAT := 0;
            if Rec."Document Type" = Rec."Document Type"::Invoice then
                if PurchInvHeader.Get(Rec."Document No.") then begin
                    PurchInvHeader.CalcFields(Amount, "Amount Including VAT");
                    TotalVAT := PurchInvHeader."Amount Including VAT" - PurchInvHeader.Amount;
                end;
        end;
    
        var
            TotalVAT: Decimal;
    }
     
    Thanks.
    ZHU

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

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

#2
Martin Dráb Profile Picture

Martin Dráb 230,198 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans