<?xml version="1.0" encoding="UTF-8"?>
<bm:model xmlns:bm="http://www.leaf-framework.org/schema/bm" needAccessControl="false" baseTable="CSH_DEPOSIT_CASHFLOW" alias="t">
    <bm:operations>
        <bm:operation name="query">
            <bm:query-sql><![CDATA[
                Select
                    t.deposit_cashflow_id,
                    t.return_id,
                    t.deposit_source_type,
                    t.transaction_id,
                    (Select c.transaction_num
                     From csh_transaction c
                     Where c.transaction_id = t.transaction_id) transaction_num,
                    to_char(t.transaction_date, 'yyyy-mm-dd') transaction_date,
                    t.transaction_amount,
                    t.transaction_deposit_amount,
                    t.contract_id,
                    (Select cc.contract_number
                     From con_contract cc
                     Where cc.contract_id = t.contract_id)      contract_number,
					(select cc.search_term_1
                              from con_contract cc
                             where cc.contract_id = t.contract_id) AS vender_contract_number,
                    (select p.project_number
                               from prj_project_lease_item  pi,
                                    prj_project             p,
                                    con_contract_lease_item ci
                              where pi.source_project_id = p.project_id
                                and pi.project_lease_item_id = ci.project_lease_item_id
                                and ci.contract_id = t.contract_id) AS vender_project_number,
                    t.creation_date,
                    t.created_by,
                    t.last_updated_by,
                    t.last_update_date,
                    (Select c.transaction_num
                     From csh_transaction c
                     Where c.transaction_id = t.source_csh_trx_id) source_transaction_num
                From csh_deposit_cashflow t
                #WHERE_CLAUSE#
                order by t.transaction_date
                ]]></bm:query-sql>
        </bm:operation>
    </bm:operations>
    <bm:data-filters>
        <bm:data-filter name="query" expression="t.return_id = ${@return_id}"/>
    </bm:data-filters>
    <!--<bm:query-fields>
        <bm:query-field name="return_id" queryExpression="t1.return_id = ${@return_id}"/>
    </bm:query-fields>-->
</bm:model>
