Jump to content

[SOLVED] Invoice pdf not displaying actual vat rate.


Nickovitshj

Recommended Posts

Solution:

My solution isn't best practice but it actually works. Maybe someone with more knowledge can elaborate on this.

In following file: classes/pdf/HTMLTemplateInvoice.php
Go to line 180:

// Set tax_code
            $taxes = OrderDetail::getTaxListStatic($id);
            $tax_temp = array();
            foreach ($taxes as $tax) {
                $obj = new Tax($tax['id_tax']);
                $translator = Context::getContext()->getTranslator();
                $tax_temp[] = $translator->trans(
                    '%taxrate%%space%%',
                    array(
                        '%taxrate%' => ($obj->rate + 0),
                        '%space%' => ' ',
                    ),
                    'Shop.Pdf'
                );
            }

And replace this with:

// Set tax_code
            $taxes = OrderDetail::getTaxListStatic($id);
            $tax_temp = array();
            foreach ($taxes as $tax) {
                $obj = new Tax($tax['id_tax']);
                $translator = Context::getContext()->getTranslator();
                $tax_temp[] = $translator->trans(
                    '%taxrate%%nothing%%',
                    array(
                        '%taxrate%' => ($obj->rate + 0),
                        '%nothing%' => '',
                    ),
                    'Shop.Pdf'
                );
            }

The issue was that it translated the following variable: '%taxrate%%space%%' into '%Vatrate%%space%%'
But the translated variable doesn't exist, thus in the invoice pdf it didn't show the value it's supposed to.

 

With my "ugly" fix it now shows the actual vat rate %

Screenshot 2021-04-27 at 13.24.52.png

Link to comment
Share on other sites

  • Nickovitshj changed the title to [SOLVED] Invoice pdf not displaying actual vat rate.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...