select 
* 
from rpt.RegPL_InternalReport_pg(
 cast($1 as bigint), 
 cast($2 as  bigint), 
 cast($3 as  bigint),
 cast(null 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($13 as  bigint),
 cast($14 as  bigint),
 cast(null as bigint),
 cast($15 as 	timestamp),
 cast($16 as 	timestamp), 
 cast($17 as  bigint), 
 cast($18 as  bigint),
 cast($19 as  bigint), 
 cast($20 as  int),
 cast($21 as  bigint),
 cast($22 as  bigint),
 cast($23 as  bigint),
 cast($24 as  bigint)) order by RowNum
