Discount amount above 1000 appears incorrect in PDF

The product_discount field of Line Items shows incorrect in PDF’s when the value is more than 1000.

For example, if the value is 1000 then it will appear in the PDF (either a Quote or an Invoice) as 1.0 instead of 1000.
If the value is 4700 then it will show up in the PDF as 4.0

The product discount field is of type Currency and is available by default, In the CRM itself it’s displayed correctly. This issue occurs with PDF’s only.

Any ideas how to fix it?


Off of the top of my head, It is possible there be an issue/conflict with the value for the “1000s Seperator”.

What values do you have for the “1000s separator” and the “Decimal Symbol” in Admin > locale ?

Also, which values do you have for these two in the “Advanced” section of your User profile? (Can be accessed by clicking your username on top-right of the CRM)

Hi John,

These are my settings:

Admin > locale

Decimal Symbol: .
1000s Separator: ,

Advanced section

Decimal Symbol: .
1000s Separator: ,

So in both sections the settings for these two variables are the same.

In the resulting PDF all the values seem to be correct except for the discount amount.
The discount percentage does not have any problems.

This issue still remains. Any ideas on how to fix this?

I noticed someone already reported this as a bug almost 2 years ago:

Edit: and someone created a topic about the same issue 4 months ago:

I confirm that the issue is still there. Have the same problem.

Any chance to fix it? May be community needs more info from us, please advise.

Can’t attach images


I found solution which worked for me.

Open /modules/AOS_PDF_Templates/templateParser.php
Find code. It starts at line 91 at my installation

foreach ($repl_arr as $name => $value) {
            if (strpos($name, 'product_discount') > 0) {
                if ($value != '' && $value != '0.00') {
                    if ($repl_arr['aos_products_quotes_discount'] == 'Percentage') {
                        $sep = get_number_seperators();
                        $value = rtrim(rtrim(format_number($value), '0'), $sep[1]);//.$app_strings['LBL_PERCENTAGE_SYMBOL'];
                    } else {
//                        $value = currency_format_number($value, $params = array('currency_symbol' => false));
                } else {
                    $value = '';

Comment line

$value = currency_format_number($value, $params = array('currency_symbol' => false));

and it works

1 Like

Nice workaround.