<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author: Administrator  
    $Date: 2016-5-13 上午10:18:39  
    $Revision: 1.0  
    $Purpose: 
-->
<bm:model xmlns:bm="http://www.leaf-framework.org/schema/bm">
    <bm:operations>
        <bm:operation name="query">
            <bm:query-sql><![CDATA[
select * from (
select ln.payment_req_id,
ln.payment_req_ln_id,
ln.amount_paid,
(select bp.bp_name from hls_bp_master bp where bp.bp_id=ln.bp_id) bp_name,
(select cc.contract_number from con_contract cc where cc.contract_id=ln.ref_doc_id) contract_number,
(select cc.contract_name from con_contract cc where cc.contract_id=ln.ref_doc_id) contract_name,
(select ci.description from con_contract_cashflow ccc,hls_cashflow_item ci
 where ccc.cashflow_id=ln.ref_doc_line_id
 and ccc.cf_item=ci.cf_item) cf_item_desc,
av.bank_code,
av.bank_full_name,
av.bank_short_name,
av.bank_branch_name,
av.bank_account_code,
av.bank_account_num,av.bank_account_name,
lb.amount,
lb.pay_way,
(select cvv.code_value_name from sys_code_values_v cvv where cvv.code_value=lb.pay_way
and cvv.code_enabled_flag='Y'
and cvv.code_value_enabled_flag='Y'
and cvv.code='CSH502_PAY_WAY') pay_way_desc,
lb.pay_type,
(select cvv.code_value_name from sys_code_values_v cvv where cvv.code_value=lb.pay_type
and cvv.code_enabled_flag='Y'
and cvv.code_value_enabled_flag='Y'
and cvv.code='CSH502_TRANSFER_WAY') pay_type_desc,
lb.invoice_info
from csh_payment_req_ln ln,csh_payment_req_ln_bank lb,
csh_bank_account_v av where ln.payment_req_ln_id=lb.payment_req_ln_id
and av.bank_account_id=lb.bank_account_id) t1 
#WHERE_CLAUSE#

]]></bm:query-sql>
        </bm:operation>
    </bm:operations>
    <bm:query-fields>
        <bm:query-field name="payment_req_ln_id" queryExpression="t1.payment_req_ln_id=${@payment_req_ln_id}"/>
    </bm:query-fields>
</bm:model>
