<?xml version="1.0" encoding="UTF-8"?>
<bm:model xmlns:bm="http://www.leaf-framework.org/schema/bm" needAccessControl="false">
    <bm:operations>
        <bm:operation name="query">
            <bm:query-sql><![CDATA[
         select t1.*,
                (select hm.bp_name
                 from hls_bp_master hm
                 where hm.bp_id = t1.bp_id_tenant) bp_id_tenant_name,
                decode(substr((t1.confirmed_rate*100),1,1),'.','0'||(t1.confirmed_rate*100),(t1.confirmed_rate*100))||'%'confirmed_rate
         from con_debts_confirmed_tmp t1 where t1.session_id=${/session/@session_id}
            ]]></bm:query-sql>
        </bm:operation>
        <bm:operation name="update">
            <bm:update-sql><![CDATA[
		        begin
		           con_bad_debts_confirmed_pkg.calc_bad_debts_confirmed(
		           p_session_id   =>${/session/@session_id},
                                 p_calc_date     =>to_date(${@end_date},'yyyy-mm-dd'),
                                 p_user_id      =>${/session/@user_id});
		        end;
        ]]></bm:update-sql>
        </bm:operation>
    </bm:operations>
<!--    <bm:query-fields>-->
<!--        <bm:query-field name="contract_id" queryExpression="t.contract_id = ${@contract_id}"/>-->
<!--    </bm:query-fields>-->
</bm:model>
