<?xml version="1.0" encoding="UTF-8"?>
<bm:model xmlns:bm="http://www.leaf-framework.org/schema/bm">
    <bm:operations>
        <bm:operation name="query">
            <bm:query-sql><![CDATA[select 
  nvl(t.transaction_type,scv.code_value) transaction_type,
  nvl(t.transaction_category,'BUSINESS') transaction_category,
  nvl(t.write_off_type,scv.code_value) write_off_type,
  scv.code_value_name write_off_type_desc,
  t.write_off_due_amount,
  nvl(t.transaction_id,${@transaction_id}) transaction_id,
  t.document_id,
  (select cc.contract_number from con_contract cc where cc.contract_id = t.document_id and cc.data_class='NORMAL') document_id_n,
  t.bp_id,
  (select bm.bp_name from hls_bp_master bm where bm.bp_id = t.bp_id) bp_id_n,
  t.year_flag,
  t.quarter_flag,
  t.month_flag,
  t.transfer_type,
  t.description,
  t.risk_in_dec,
  (select scv.code_value_name from sys_code_values_v scv where scv.code = 'CSH_DEPOSIT_TRANSFER_TYPE' and scv.code_value = t.transfer_type) transfer_type_n
from sys_code_values_v scv,(select *from csh_write_off_temp cwo where cwo.transaction_id = ${@transaction_id}) t
where scv.code = 'CSH513_WRITE_OFF_TYPE'
and scv.code_value = ${@write_off_type}
and scv.code_value = t.write_off_type(+)
]]></bm:query-sql>
            <bm:parameters>
                <bm:parameter name="transaction_id"/>
                <bm:parameter name="write_off_type"/>
            </bm:parameters>
        </bm:operation>
    </bm:operations>
</bm:model>
