We are having an issue when a number comes in formatted with commas ex: 2,500 to be in the footer as a sum value.
when we do the sum it is getting the error
Warning: A non-numeric value encountered in /iworq/iworq/vendor/koolreport/core/src/core/DataStore.php on line 564
I have a band aid fix of doing
/**
* Return the sum of a field
*
* Examples: $totalSales = $dataStore->sum("saleAmount");
*
* @param string $colName Name of column you want to sum
*
* @return float Sum of column
*/
public function sum($colName)
{
$sum = 0;
foreach ($this->rows as $row) {
if(!is_int($row[$colName])){
$sum += (int) str_replace(',', '', $row[$colName]);
} else {
$sum += $row[$colName];
}
}
return $sum;
}
But we update our composer often and was wondering if we could get a more permanent fix to this. Thanks