= to_date(coalesce($P{fechaInicio},h.fechaemision),'dd-mm-yyyy')
and h.fechaemision <= to_date(coalesce($P{fechaFin},h.fechaemision),'dd-mm-yyyy')
and h.ccentrocontrol = coalesce($P{idCentroControl}, h.ccentrocontrol)
and a.tipoautorizacion = coalesce($P{idAutorizacion}, a.tipoautorizacion)
group by y.description, b.description, c.description, d.description, e.description
having count(h.ctramite) > 0
order by
centro, tipotramite, categoria, usoactividad)]]>