From e00f0182694dc7b3ab01127805e40cb715c1f7ae Mon Sep 17 00:00:00 2001 From: Irka Date: Tue, 12 Aug 2014 16:24:19 +0200 Subject: [PATCH] MT#8387 Fix incorrect rounding for cents. --- share/templates/invoice/default/invoice_template_aux.tt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/share/templates/invoice/default/invoice_template_aux.tt b/share/templates/invoice/default/invoice_template_aux.tt index 9823590372..7be7ba5745 100644 --- a/share/templates/invoice/default/invoice_template_aux.tt +++ b/share/templates/invoice/default/invoice_template_aux.tt @@ -131,8 +131,8 @@ money_signs = money_signs || '2'; base = 10; full = Math.int(amount / 100); -# cent = Math.int( amount % 100) ; - cent = Math.int( amount % 100) * ( base.power( money_signs - 2) ) ; +# -2 because now amount is in cents, so we need to shift to signs amount, additional to current 2. + cent = ( ( amount - full ) * ( base.power( money_signs - 2) ) ); cents = String.new(cent); cents = cents.format("%.0f",cents); cents_format_string = "%0" _ money_signs _ "d";