Report generation logic