Here is the report code btw....
----------
DROP PROCEDURE IF EXISTS sp_DBR_janitor_tracking
$$
CREATE PROCEDURE sp_DBR_janitor_tracking
()
BEGIN
create temporary table janitor_times
as
select modelreference, date(starttime) as startdate, avg(timestampdiff(SECOND, starttime, endtime)) as avg_time from newcomputerrepair.janitor_tracking where starttime >= date_sub(now(), interval 30 day) and dayname(starttime) not in ('Saturday', 'Sunday') and timestampdiff(SECOND, starttime, endtime) > 0 group by date(starttime), modelreference order by modelreference, starttime asc;
set @counter=1;
REPEAT
set @modelreference = (select modelreference from janitor_times order by modelreference limit 1);
select 'dbr.chart', 'Line' , @modelreference, 1500;
SELECT 'dbr.chart.options', 'imagechart';
select 'dbr.chart.options', 'showvalues', 0;
select 'dbr.chart.options', 'chartRightMargin', 30;
select date_format(startdate, '%m/%d') startdate, avg_time from janitor_times where modelreference = @modelreference;
delete from janitor_times where modelreference = @modelreference;
UNTIL (select count(*) from janitor_times)=0 END REPEAT;
END
$$
-----------------