<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author: weiwuzhen  
    $Date: 2016-4-27 上午10:52:06  
    $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 
  ' '||'租赁标的物为'|| (SDIC_INDIVIDUAL_PKG.string_combination(' SELECT pi.lease_itme_name  FROM PRJ_CHANCE_LEASE_ITEM Pi
   WHERE Pi.chance_id=',P.chance_id,'、')||'，'||'项目名称为') lease_itme_name,--租赁标的物 
    (SDIC_INDIVIDUAL_PKG.string_combination(' SELECT pi.lease_project_name  FROM PRJ_CHANCE_LEASE_ITEM Pi
   WHERE Pi.chance_id=',P.chance_id,'、')||'，'||'项目规模为'） lease_project_name,--项目名称
   SDIC_INDIVIDUAL_PKG.string_combination(' SELECT pi.lease_amount  FROM PRJ_CHANCE_LEASE_ITEM Pi
   WHERE Pi.chance_id=',P.chance_id,'、')||'。' lease_amount,--项目规模
   (select trim(to_char(HD.LEASE_TERM,'FM999,999,990.09999')) from prj_quotation q,HLS_FIN_CALCULATOR_HD HD where q.document_id=p.chance_id
   and q.document_category='CHANCE'
   AND Q.QUOTATION_TYPE='MAJOR'
   AND HD.CALC_SESSION_ID=Q.CALC_SESSION_ID) payment_term,--租赁期限
     (select V.code_value_name from prj_quotation q,HLS_FIN_CALCULATOR_HD HD, SYS_CODE_VALUES_V V where q.document_id=p.chance_id
   and q.document_category='CHANCE'
   AND Q.QUOTATION_TYPE='MAJOR'
   AND HD.CALC_SESSION_ID=Q.CALC_SESSION_ID
   AND HD.ANNUAL_PAY_TIMES=V.code_value
  AND V.code='HLS500_ANNUAL_PAY_TIMES'
  and v.code_enabled_flag='Y'
  and v.code_value_enabled_flag='Y' ) payment_time  --支付频率  
 FROM PRJ_CHANCE P
 #WHERE_CLAUSE#
 
 ]]></bm:query-sql>
        </bm:operation>
    </bm:operations>
    <bm:query-fields>
        <bm:query-field name="chance_id" queryExpression="chance_id=${@chance_id}"/>
    </bm:query-fields>
</bm:model>
