--"set dateformat dmy "+"select * from [rpt].[EMC_EvnUslugaDiag_MP]("+params["paramLpu"].value+","+params["paramMedStaffFact"].value+","+params["paramMedStaffFactMedServiceDop"].value+",'"+params["paramBegDate"].value+"','"+params["paramEndDate"].value+"',"+params["paramLpuBuilding"].value+","+params["paramLpuUnit"].value+","+params["paramLpuSection"].value+","+params["paramLpuSectionProfile"].value+","+params["paramLpuBuildingDop"].value+","+params["paramLpuUnitDop"].value+","+params["paramLpuSectionDop"].value+","+params["paramLpuSectionProfileDop"].value+")"

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