select * 
from
rpt.han_pers_evnUsluga_pg
(cast($1 as bigint),
cast($2 as bigint),
cast($3 as bigint),
cast($4 as bigint),
cast($5 as bigint),
CAST( to_timestamp($6, 'DD.MM.YYYY') as timestamp), 
CAST( to_timestamp($7, 'DD.MM.YYYY') as timestamp),
cast($8 as bigint),
cast($9 as int) ,  -- 1 выписки, 2 услуги
cast($10 as int) 
)
