Skip to main content
Business Central forum
Answered

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

editSubscribe (2) ShareShare
ReportReport
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.
Categories:
Attachments
  • Suggested answer
    YUN ZHU Profile Picture
    YUN ZHU 60,087 Super User 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 60,087 Super User 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

Helpful resources

Quick Links

New Blog Features Released!

Check out the new community blog features for viewers and authors…

Setting Up Knowledge Sources for Copilot…

Look at how configuring a comprehensive knowledge base is crucial…

Demystifying Copilot with Georg Glantschnig…

Industry experts answer burning questions directly from our amazing Community…

Leaderboard

#1
Andre Arnaud de Calavon Profile Picture

Andre Arnaud de Cal... 283,130 Super User

#2
Martin Dráb Profile Picture

Martin Dráb 222,689 Super User

#3
nmaenpaa Profile Picture

nmaenpaa 101,138

Featured topics

Product updates

Dynamics 365 release plans