<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author: weiwuzhen  
    $Date: 2016-6-21 下午2:58:19  
    $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 pq.document_id, --合同ID
       ln.times, --期数
       ln.due_date, --租金支付日
       decode(ln.principal,0,'0',to_char( ln.principal,'FM999,999,999,990.00')) principal, --租赁成本
       decode(ln.interest,0,'0',to_char( ln.interest,'FM999,999,999,990.00')) interest  , --租赁利息
       decode(ln.lease_charge,0,'0',to_char( ln.lease_charge,'FM999,999,999,990.00'))lease_charge, --手续费
       decode(to_number(nvl(ln.principal, 0)) + to_number(nvl(ln.interest, 0)) +
       to_number(nvl(ln.lease_charge, 0)),0,'0',to_char( to_number(nvl(ln.principal, 0)) + to_number(nvl(ln.interest, 0)) +
       to_number(nvl(ln.lease_charge, 0)),'FM999,999,999,990.00'))sum_row_amount --行合计
  from prj_quotation pq, hls_fin_calculator_ln ln
 where pq.document_category = 'PROJECT'
   and pq.quotation_type = 'MAJOR'
   and pq.main_contract_flag = 'Y'
   and pq.calc_session_id = ln.calc_session_id
   and pq.document_id=${/parameter/@project_id}
   order by ln.due_date
   ]]></bm:query-sql>
        </bm:operation>
    </bm:operations>
    <!--  <bm:fields>
        <bm:field name="document_id" databaseType="NUMBER" datatype="java.lang.Long" physicalName="DOCUMENT_ID" required="true"/>
        <bm:field name="times" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="TIMES"/>
        <bm:field name="due_date" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="DUE_DATE"/>
        <bm:field name="principal" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="PRINCIPAL"/>
        <bm:field name="interest" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="INTEREST"/>
        <bm:field name="lease_charge" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="LEASE_CHARGE"/>
        <bm:field name="sum_row_amount" databaseType="NUMBER" datatype="java.lang.Long" physicalName="SUM_ROW_AMOUNT"/>
    </bm:fields> -->
</bm:model>
