Jump to content

EC Reverse Charge - Statement on Invoices


ehuk

Recommended Posts

This is a small 'hack' which will add the statement "This supply is subject to the reverse charge." to the bottom of PDF invoices if the customer is in an EC state and there is no tax applied to the invoice (i.e. the tax is reverse charged).

 

This is required for EC invoices and something that WHMCS doesn't do out of the box. Its not very elegant, but it does work. As we are UK Based, the United Kingdom is isn't in the country array, so if you are based in Germany, add UK and remove Germany. Customize as you will.

 

Simply add this to the bottom of invoicepdf.tpl:

 

function wordsExist(&$string, $words) {
   foreach($words as &$word) {
       if(stripos($string, $word) !== false) {
           return true;
       }
   }
   return false;
}

$reverse_charge = $clientsdetails["country"];

# Show reverse charge text if country matches array AND there is no tax rate
if( wordsExist($reverse_charge, array('Austria','Belgium','Bulgaria','Croatia','Cyprus','Czech Republic','Denmark','Estonia','Finland','France','Germany','Greece','Hungary','Ireland','Italy','Latvia','Lithuania','Luxembourg','Malta','Netherlands','Poland','Portugal','Romania','Slovakia','Slovenia','Spain','Sweden')) && !$taxrate )
   {
       $pdf->SetFont('freesans','',14);
       $pdf->Ln(10);
       $pdf->Cell(180,4," This supply is subject to the reverse charge.",'','','C');
   }

 

Hope this helps.

Link to comment
Share on other sites

may i can improve it just a little!!

 

# Company Country [Modify it to match your country]
$companyCountry = "United Kingdom";

# Client Country
$clientCountry = $clientsdetails["country"];

# Reverse Charge Countries
$reverseCountries = array('United Kingdom','Austria','Belgium','Bulgaria','Croatia','Cyprus','Czech Republic','Denmark','Estonia','Finland','France','Germany','Greece','Hungary','Ireland','Italy','Latvia','Lithuania','Luxembourg','Malta','Netherlands','Poland','Portugal','Romania','Slovakia','Slovenia','Spain','Sweden');
$deleteCompanyCountry = array_diff($reverseCountries, [$companyCountry]);
$reverseCountries = array_values($deleteCompanyCountry);

# Show reverse charge text if country matches array AND there is no tax rate
if( in_array($clientCountry, $reverseCountries) && !$taxrate ){
   $pdf->SetFont('freesans','',14);
   $pdf->Ln(10);
   $pdf->Cell(180,4," This supply is subject to the reverse charge.",'','','C');
}

Link to comment
Share on other sites

  • 2 weeks 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