Загрузка данных


#if ("${!contract_number}" != "" && "${!contract_number}" != "null" && "${!contract_number}" != "$contract_number")
    AND contract.number ILIKE '%' || replace(:contract_number, chr(92), chr(92) || chr(92)) || '%' ESCAPE chr(92)
#end

#if ("${!client_full_name}" != "" && "${!client_full_name}" != "null" && "${!client_full_name}" != "$client_full_name")
    AND (coalesce(apdi.last_name, '') || ' ' || coalesce(apdi.first_name, '') || ' ' || coalesce(apdi.middle_name, '')) ILIKE '%' || :client_full_name || '%'
#end

#if ("${!contract_activity_type}" != "" && "${!contract_activity_type}" != "null" && "${!contract_activity_type}" != "$contract_activity_type")
    AND sat.service_type = cast(:contract_activity_type AS ourpension.service_type)
#end

#if ("${!account_number}" != "" && "${!account_number}" != "null" && "${!account_number}" != "$account_number")
    AND sh.number ILIKE '%' || :account_number || '%'
#end

#if ("${!created_at_from}" != "" && "${!created_at_from}" != "null" && "${!created_at_from}" != "$created_at_from")
    AND td.version >= to_date(:created_at_from, 'YYYY-MM-DD')
#end

#if ("${!created_at_to}" != "" && "${!created_at_to}" != "null" && "${!created_at_to}" != "$created_at_to")
    AND td.version < to_date(:created_at_to, 'YYYY-MM-DD') + interval '1 day'
#end