- $sql = "SELECT CONCAT(YEAR(tran_date), '/', WEEK(tran_date)) AS week_name,
- SUM(IF (c.ctype = 4, amount * -1, 0)) AS sales,
- SUM(IF (c.ctype = 6, amount, 0)) AS costs
- FROM
+ $sep = $SysPrefs->dateseps[user_date_sep()];
+ $sql = "SELECT week_name, sales, costs
+ FROM(SELECT DATE_FORMAT(tran_date, '%Y{$sep}%u') AS week_name,
+ SUM(IF(c.ctype = 4, amount * -1, 0)) AS sales,
+ SUM(IF(c.ctype = 6, amount, 0)) AS costs FROM