Jump to content

Display specific VAT number depending on client address


unrealindeed

Recommended Posts

Hi All,

I'm hoping someone can help me with VAT number display options.

Our company has 2 VAT numbers, one for Ireland (our base country and default VAT number) and one for UK.

Is it possible to add both VAT numbers to WHMCS and have the system display the UK VAT number on invoices (and pdf invoices) ONLY if the client's country is set to UK? I cannot see anything in docs that suggests this is possible, it may involve adding some sort of hook, would anyone know how to implement such a feature? I don't want to have to hardcode a UK VAT number into all invoices when it will only be relevant to UK address based customers.

Thank you :)

Link to comment
Share on other sites

Solution:

In templates/$template/invoicepdf.tpl

Replace:

if ($taxCode) {
    $pdf->Cell(180, 4, $taxIdLabel . ': ' . trim($taxCode), 0, 1, 'R');
}

with:

if ($taxCode) {
    if ($clientsdetails["countrycode"] == "GB")
    {
        $taxIdLabel = 'UK VAT Number';
        $taxCode = 'GBXXXXXXXXX';
    }
    $pdf->Cell(180, 4, $taxIdLabel . ': ' . trim($taxCode), 0, 1, 'R');
}

 

In  In templates/$template/viewinvoice.tpl

Replace:

{$payto}
{if $taxCode}<br />{$taxIdLabel}: {$taxCode}{/if}

with:

{$payto}
{if $taxCode}<br />
	{if $clientsdetails.countrycode eq "GB"}
		{assign var="taxIdLabel" value="UK VAT Number"}
		{assign var="taxCode" value="GBXXXXXXXX"}
	{/if}
	{$taxIdLabel}: {$taxCode}
{/if}

 

Link to comment
Share on other sites

  • 2 months later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated