Skip to main content

Notifications

Announcements

No record found.

Business Central forum
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.
Categories:
  • Suggested answer
    YUN ZHU Profile Picture
    YUN ZHU 64,563 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 64,563 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

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... 288,584 Super User

#2
Martin Dráb Profile Picture

Martin Dráb 225,864 Super User

#3
nmaenpaa Profile Picture

nmaenpaa 101,148

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans