Hi there,
I've just inherited our current KoolReport project and I'm in the process of upgrading our KoolReport Pro from version 5.7.1 to the latest (6.6.3) and the dashboard module from version 2.0.0 to 4.8.3, and upgrading the box from PHP 7.4 to 8.2.
I'm currently in the process of comparing the two systems to make sure the data is the same and I've noticed that on the Trend widgets the sum value across the period is much lower than when I'm adding up the individual data points, in fact it doesn't even correlate to any single data point.
Here is the Raw SQL I'm using in my dataSource:
SELECT
CAST(oh_datetime AS DATETIME2(0)) AS 'oh_datetime',
CAST(SUM(oli_gross) AS DECIMAL(9,2)) AS 'total'
FROM order_header
LEFT JOIN order_line_item ON (oh_id = oli_oh_id)
WHERE
oh_os_id IN (1,2,3,4,5,6)
AND
oh_ec_id IS NOT NULL
GROUP BY
CAST(oh_datetime AS DATETIME2(0))
And here is the fields() method:
protected function fields(): array
{
return [
$this->group(DateTime::create("oh_datetime")),
$this->sum(
Currency::create("total")
->label('Order Total')
->GBP()
->symbol()
),
];
}
Let me know if you need anymore information and I hope that makes sense, I'm unsure what you would require!
Kind regards, Sam