<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author: wangwei  
    $Date: 2015-1-5 下午5:43:17  
    $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 t1.contract_id,
       t1.data_class,
       t1.contract_number,
       t1.invoice_agent_name,
       t1.invoice_agent_id,
       (select decode(t1.bp_class,'ORG',B.FIRST_NAME,'NP',B.BP_NAME
       ) from
        con_contract_bp a ,
        hls_bp_master b
        where a.bp_category='TENANT' 
        and a.contract_id=t1.contract_id
        and a.bp_id=b.bp_id ) BP_NP_NAME,
      (select decode(t1.bp_class,'ORG',B.BP_NAME,'NP',B.WORK_UNIT
       ) from
        con_contract_bp a ,
        hls_bp_master b
        where a.bp_category='TENANT' 
        and a.contract_id=t1.contract_id
        and a.bp_id=b.bp_id ) BP_ORG_NAME,
        T1.model_id_des,
        T1.model_id,
        T1.series_id_des,
        T1.series_id,
        T1.brand_id_des,
        T1.brand_id,
        T1.hd_user_col_n12, 
        t1.item_frame_number,
        t1.other_fee,
        t1.insurance_fee,
        t1.other_fee3,
        t1.deposit_ratio_v,
        t1.deposit_ratio,
        t1.finance_amount,
        t1.lease_term,
        t1.int_rate,
        t1.pmt,
        t1.submit_date,
        t1.car_payment_completed_date,
        t1.price_list,
        t1.price_list_des,
        t1.lease_charge,
        t1.lease_charge_ratio,
        t1.lease_item_amount,
        (select nvl(a.lease_charge_ratio,a.lease_charge/a.finance_amount) from 
        con_contract a where a.contract_id=t1.contract_id) lease_charge_ratio,
        (select con.int_rate from 
        con_contract con where con.contract_id=t1.contract_id) int_rate
         from con_contract_all_v t1  
          #WHERE_CLAUSE#
]]></bm:query-sql>
        </bm:operation>
    </bm:operations>
    <bm:query-fields>
        <bm:query-field name="contract_number" queryExpression="t1.contract_number like ${@contract_number}"/>
        <bm:query-field name="bp_np_name" queryExpression="t1.bp_np_name like ${@bp_np_name}"/>
        <bm:query-field name="price_list_des" queryExpression="t1.price_list_des like ${@price_list_des}"/>
    </bm:query-fields>
    <bm:data-filters>
        <bm:data-filter name="query" expression="t1.data_class = &apos;NORMAL&apos;"/>
    </bm:data-filters>
</bm:model>
