Skip to content

Fix group sum floating (decimal) issue

There's a solution to the current group sum floating point issue using Javascript. Basically, it can be resolved with a custom javascript. See below code sample:

<?php
...
$dg->set_group_summary('amount','###mysum###');
...
?>

<script>
function mysum(val, name, record)
{
// this will round sum to 2 decimal
return parseFloat(parseFloat(val||0) + parseFloat((record[name]||0))).toFixed(2);
}
</script>


Feedback and Knowledge Base