<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author: gaoyang  
    $Date: 2013-6-8 下午02:48:34  
    $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.FIN_STATEMENT_TEMPLET_ID,
                    t1.FIN_STATEMENT_TEMPLET_CODE,
                    t1.FIN_STATEMENT_TEMPLET_NAME,
                    t1.BP_ID,
                    t1.BP_CODE,
                    t1.BP_NAME,
                    t1.BP_CATEGORY,
                    t1.BP_TYPE,
                    t1.PROJECT_ID,
                    t1.PROJECT_NUMBER,
                    t1.PROJECT_NAME,
                    t1.currency_code,
                    t1.CURRENCY_NAME,
                    t1.FIN_NET_CASH_INFLOW,
                    t1.fin_monthly_payment,
                    t1.fin_months,
                    t1.total_monthly_payment,
                    t1.fin_rate,
                    t1.fin_turnover,
                    t1.fin_liquidity_ratio,
                    t1.fin_leverage,
                    t1.fin_data,
                    t1.fin_evaluation,
                    t1.fin_note
                FROM
                    RSC_FIN_STATEMENT_PRJ_HDS_V t1 #WHERE_CLAUSE#
            ]]></bm:query-sql>
        </bm:operation> -->
        <bm:operation name="query">
            <bm:query-sql><![CDATA[
         	
        	  select b.bp_id,
			       b.bp_code,
			       b.bp_name,
			       b.bp_category,
			       b.bp_type,
			       b.fin_net_cash_inflow,
			       b.fin_monthly_payment,
			       b.fin_months,
			       b.fin_monthly_payment * b.fin_months total_monthly_payment,
			       (case
			         when b.fin_monthly_payment <> 0 and b.fin_months <> 0 then
			          b.fin_net_cash_inflow / (b.fin_monthly_payment * b.fin_months)
			         else
			          null
			       end) fin_rate,
			       b.fin_turnover,
			       b.fin_liquidity_ratio,
			       b.fin_leverage,
			       b.fin_data,
			       b.fin_evaluation,
			       b.fin_note
			       from hls_bp_master b 
			       #WHERE_CLAUSE#
        	
         ]]></bm:query-sql>
        </bm:operation>
    </bm:operations>
    <bm:fields>
        <bm:field name="bp_id" databaseType="NUMBER" datatype="java.lang.Long" physicalName="BP_ID" prompt="RSC_FIN_STATEMENT_PRJ_HDS_V.BP_ID"/>
        <bm:field name="bp_code" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="BP_CODE" prompt="HLS.BP_CODE"/>
        <bm:field name="bp_name" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="BP_NAME" prompt="HLS.BP_NAME"/>
        <bm:field name="bp_category" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="BP_CATEGORY" prompt="RSC_FIN_STATEMENT_PRJ_HDS_V.BP_CATEGORY"/>
        <bm:field name="bp_type" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="BP_TYPE" prompt="HLS.BP_TYPE"/>
        <bm:field name="fin_net_cash_inflow" databaseType="NUMBER" datatype="java.lang.Double" physicalName="FIN_NET_CASH_INFLOW"/>
        <bm:field name="fin_monthly_payment" databaseType="NUMBER" datatype="java.lang.Double" physicalName="FIN_MONTHLY_PAYMENT"/>
        <bm:field name="total_monthly_payment" databaseType="NUMBER" datatype="java.lang.Double" physicalName="TOTAL_MONTHLY_PAYMENT"/>
        <bm:field name="fin_rate" databaseType="NUMBER" datatype="java.lang.Double" physicalName="FIN_RATE"/>
        <bm:field name="fin_months" databaseType="NUMBER" datatype="java.lang.Long" physicalName="FIN_MONTHS"/>
        <bm:field name="fin_turnover" databaseType="CLOB" datatype="java.lang.String" physicalName="FIN_TURNOVER"/>
        <bm:field name="fin_liquidity_ratio" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="FIN_LIQUIDITY_RATIO"/>
        <bm:field name="fin_leverage" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="FIN_LEVERAGE"/>
        <bm:field name="fin_data" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="FIN_DATA"/>
        <bm:field name="fin_evaluation" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="FIN_EVALUATION"/>
        <bm:field name="fin_note" databaseType="CLOB" datatype="java.lang.String" physicalName="FIN_NOTE"/>
    </bm:fields>
    <bm:query-fields>
        <!-- <bm:query-field field="fin_statement_templet_id" queryOperator="="/> -->
        <bm:query-field name="bp_id" queryExpression="b.bp_id=${@bp_id}"/>
        <!-- <bm:query-field name="creation_date_from" queryExpression="t1.creation_date &gt;=${@creation_date_from}"/>
        <bm:query-field name="creation_date_to" queryExpression="t1.creation_date &lt;=${@creation_date_to}"/> -->
    </bm:query-fields>
</bm:model>
