[ic] rounding off

Andre Muller andrem at technoware.nl
Sun Jul 18 16:37:55 EDT 2004


Stefan Hornburg wrote:
> On Sun, 18 Jul 2004 21:48:19 +0200
> Andre Muller <andrem at technoware.nl> wrote:
> 
> 
>>Guys,
>>
>>Is there an ic function to round off amounts to 2 decimal digits? I have 
>>some calculations to do which results into something like 
>>€8.36134453781512, which looks quite odd on checkout ;)
>>Any suggestions?
> 
> 
> catalog.cfg:
> 
> CodeDef two_digits Filter
> CodeDef two_digits Routine <<EOR
> 
> sub {
>      my $val = shift;
> 
>      return sprintf('%.2f', $val);
> }
> EOR
> 
> [filter two_digits]8.361344[/filter]
> 
> or
> 
> [filter op=two_digits interpolate=1] ... ITL ... [/filter]
> 
> (untested)
> 
> 	Racke
> 
> 

Thanks Racke, it works!


More information about the interchange-users mailing list