select * from rpt.han_diag_leavetype_s_pg(
cast($1 as bigint),
cast($2 as varchar),
cast($3 as bigint),
cast($4 as bigint),
cast($5 as bigint),
cast($6 as bigint),
cast($7 as bigint),
cast($8 as bigint),
cast($9 as bigint),
cast($10 as bigint),
cast($11 as bigint),
cast($12 as bigint),
CAST(TO_TIMESTAMP($13,'DD.MM.YYYY') AS TIMESTAMP),
CAST(TO_TIMESTAMP($14,'DD.MM.YYYY') AS TIMESTAMP),
cast($15 as bigint),
CAST($16 AS TIME),
cast($17 as int),
cast($18 as int),
cast($19 as int),
cast($20 as bigint),
dbo.GetDiagCodeByID(cast($21 as bigint)),
dbo.GetDiagCodeByID(cast($22 as bigint))) order by "Diag_Code"
