[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: rounded values in templates - linetotal



* Giovanni Biscuolo [2013-06-12 16:09:07 +0200]:

> I'm using LedgerSMB ver. 1.3.25-1 from Debian testing (jessie)
> 
> in my sales orders and sales invoices linetotal prices al always rounded to
> the .05 next lower value, e.g 28.32 becomes 28.30, 14.16 becomes 14.15 and
> 25.38 becomes 25.35
> 
> is there please a way to "switch off" this behaviuor of rounding totals
> 
> in /etc/ledgersmb.conf I've setted decimal_places=2, I need 2 decimal places
> but *no* rounding

actually I found the code that should round amounts in
"/usr/share/ledgersmb/LedgerSMB.pm", sub round_amount:

.................
#!/usr/bin/perl
use warnings;
use strict;
use Math::BigFloat;

my $amount = '14.16';

if ($amount >= 0) { 
    Math::BigFloat->round_mode('+inf'); 
} 
else { 
    Math::BigFloat->round_mode('-inf'); 
} 

print Math::BigFloat->new($amount)->ffround( -2 )."\n";
......................

and the result is "14.16" as aspected

...but in my sales orders (and invoices) a value as "14.16" is converted to a
linetotal of "14.15"

any hint please?

Ciao
Giovanni

-- 
Giovanni Biscuolo

Xelera - IT infrastructures
http://xelera.eu/contact-us/

Attachment: signature.asc
Description: Digital signature

------------------------------------------------------------------------------
This SF.net email is sponsored by Windows:

Build for Windows Store.

http://p.sf.net/sfu/windows-dev2dev
_______________________________________________
Ledger-smb-users mailing list
..hidden..
https://lists.sourceforge.net/lists/listinfo/ledger-smb-users