Could you try extract this to another template and use here and in report template?