The problem is that your template is referencing the same db handle as the one that is being used for the fetchrow loop. If you remove the [im_status_report ... line from the intranetstatus file, the problem should go away. I haven't tried it, but there is also another handle available inside the fetchrow loop and it doesn't appear to be in use. You could try changing your template to use:
[im_status_report $db2 ...