<?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 *
   from (
              select (select cc.contract_number
                  from con_contract cc
                 where cc.contract_id = ctn.ref_contract_id) contract_number,

               ctn.transaction_amount,
               to_char(cw.creation_date, 'YYYY-MM-DD') creation_date,
               (select v.code_value_name
                  from sys_code_values_v v
                 where v.code = 'DEPOSIT_TRANS_TYPE'
                   and v.code_value = ctn.deposit_trans_type) deposit_trans_type_n,
                    ctn.transaction_num transaction_number,
          (select t.bp_name
          from hls_bp_master t, con_contract ct
         where t.bp_id = ct.bp_id_tenant
           and ct.contract_id = ctn.ref_contract_id) bp_id_telnet_n,
           (select v.code_value_name
                  from sys_code_values_v v
                 where v.code = 'CSH513_WRITE_OFF_TYPE'
                   and v.code_value = cw.write_off_type) write_off_type_n
          from csh_write_off cw ,csh_transaction ctn
         where cw.write_off_id = ${@source_doc_id}
         and ctn.transaction_id=cw.csh_transaction_id) v

                ]]></bm:query-sql>
        </bm:operation>
    </bm:operations>
</bm:model>