MT#8387 Fix incorrect rounding for cents.

agranig/webphone
Irka 12 years ago
parent 6bcca230fc
commit e00f018269

@ -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";

Loading…
Cancel
Save