<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author: ZLF  
    $Date: 2015-1-21 下午3:09:38  
    $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 cc.contract_number,
       '-' bp_info,
       bm.bp_name,
       decode(bm.bp_class, 'NP', '自然人', '企业') bp_type,
       bm.id_card_no,
       bm.REF_V03,
       '' industry,
       '' bp_size,
       '' gs_reg_num,
       bm.tax_registry_num,
       '-' lease_title,
       '' lease_use_adress,
       '-' rent_info,
       cc.lease_item_amount / 10000 lease_item_amount, --车款，融资额
       (nvl(cc.total_rental, 0) + nvl(cc.down_payment, 0)) / 10000 rental_total, --租金总额
       cc.lease_charge / 10000 lease_charge, --手续费
       nvl(cc.other_fee2,0)/10000 other_fee2, --其他一次性支出
       '人民币' currency,
       '-' guarantee_info,
       '' guarantee_1,
       '' guarantee_2,
       '' guarantee_3,
       '' guarantee_4,
       '-' others_info,
       decode(cc.business_type, 'LEASE', '直接租赁', '售后回租') business_type,
       '' trans_info,
       to_char(cc.signing_date, 'YYYY-MM-DD') signing_date,
       12 / cc.annual_pay_times * cc.lease_times lease_month,
       '' add_info,
       bm.business_license_num,
       (select hi.full_name from con_contract_lease_item cli,hls_lease_item hi where  cli.contract_id = cc.contract_id and hi.lease_item_id = cli.lease_item_id and rownum=1) lease_name,
       (select count(*) from con_contract_lease_item cli where cli.contract_id = cc.contract_id) lease_num
  from con_contract cc, hls_bp_master bm
    #WHERE_CLAUSE#
   ]]></bm:query-sql>
        </bm:operation>
    </bm:operations>
    <bm:data-filters>
        <bm:data-filter enforceOperations="query" expression="cc.data_class = &apos;NORMAL&apos; and cc.bp_id_tenant = bm.bp_id"/>
    </bm:data-filters>
    <bm:query-fields>
        <bm:query-field name="signing_date_from" queryExpression="cc.signing_date &gt;= to_date(${@signing_date_from},&apos;YYYY-MM-DD&apos;)"/>
        <bm:query-field name="signing_date_to" queryExpression="cc.signing_date &lt;= to_date(${@signing_date_to},&apos;YYYY-MM-DD&apos;)"/>
        <bm:query-field name="incept_confirm_date_from" queryExpression="trunc(cc.incept_confirm_date) &gt;= to_date(${@incept_confirm_date_from},&apos;YYYY-MM-DD&apos;)"/>
        <bm:query-field name="incept_confirm_date_to" queryExpression="trunc(cc.incept_confirm_date) &lt;= to_date(${@incept_confirm_date_to},&apos;YYYY-MM-DD&apos;)"/>
        <bm:query-field name="contract_number" queryExpression="cc.contract_number = ${@contract_number}"/>
        <bm:query-field name="bp_id" queryExpression="bm.bp_id = ${@bp_id}"/>
    </bm:query-fields>
</bm:model>
