select *
from rpt.f_f30_r6_5301_2020_pg(
cast($1 as int8), 
$2, 
cast($3 as int8), 
cast($4 as int8), 
cast($5 as int8), 
cast($6 as int8), 
cast($7 as int8), 
cast(to_timestamp($8,'dd.mm.yyyy') as timestamp), 
cast(to_timestamp($9,'dd.mm.yyyy') as timestamp), 
cast($10 as int8))
order by 1
