<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author: gaoyang  
    $Date: 2013-5-17 上午09:55:35  
    $Revision: 1.0  
    $Purpose: 
-->
<bm:model xmlns:e="leaf.service.exception" xmlns:o="leaf.database.local.oracle" xmlns:bm="http://www.leaf-framework.org/schema/bm" xmlns:f="leaf.database.features" alias="t1" baseTable="RSC_FIN_INDICATOR_FORMULA" defaultOrderBy="line_number">
    <bm:fields>
        <bm:field name="fin_indicator_formula_id" databaseType="NUMBER" datatype="java.lang.Long" physicalName="FIN_INDICATOR_FORMULA_ID" prompt="RSC_FIN_INDICATOR_FORMULA.FIN_INDICATOR_FORMULA_ID"/>
        <bm:field name="fin_statement_templet_id" databaseType="NUMBER" datatype="java.lang.Long" physicalName="FIN_STATEMENT_TEMPLET_ID" prompt="RSC_FIN_INDICATOR_FORMULA.FIN_STATEMENT_TEMPLET_ID"/>
        <bm:field name="line_number" databaseType="NUMBER" datatype="java.lang.Long" physicalName="LINE_NUMBER" prompt="RSC_FIN_INDICATOR_FORMULA.LINE_NUMBER"/>
        <bm:field name="indicator_name" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="INDICATOR_NAME" prompt="RSC_FIN_INDICATOR_FORMULA.INDICATOR_NAME"/>
        <bm:field name="indicator_type" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="INDICATOR_TYPE" prompt="RSC_FIN_INDICATOR_FORMULA.INDICATOR_TYPE"/>
        <bm:field name="indicator_formula" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="INDICATOR_FORMULA" prompt="RSC_FIN_INDICATOR_FORMULA.INDICATOR_FORMULA"/>
        <bm:field name="indicator_value" databaseType="NUMBER" datatype="java.lang.Long" physicalName="INDICATOR_VALUE" prompt="RSC_FIN_INDICATOR_FORMULA.INDICATOR_VALUE"/>
        <bm:field name="reference_results" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="REFERENCE_RESULTS" prompt="RSC_FIN_INDICATOR_FORMULA.REFERENCE_RESULTS"/>
        <bm:field name="enabled_flag" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="ENABLED_FLAG" prompt="HLS.ENABLED_FLAG"/>
        <bm:field name="ref_v01" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="REF_V01" prompt="RSC_FIN_INDICATOR_FORMULA.REF_V01"/>
        <bm:field name="ref_v02" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="REF_V02" prompt="RSC_FIN_INDICATOR_FORMULA.REF_V02"/>
        <bm:field name="ref_v03" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="REF_V03" prompt="RSC_FIN_INDICATOR_FORMULA.REF_V03"/>
        <bm:field name="ref_v04" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="REF_V04" prompt="RSC_FIN_INDICATOR_FORMULA.REF_V04"/>
        <bm:field name="ref_v05" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="REF_V05" prompt="RSC_FIN_INDICATOR_FORMULA.REF_V05"/>
        <bm:field name="ref_n01" databaseType="NUMBER" datatype="java.lang.Long" physicalName="REF_N01" prompt="RSC_FIN_INDICATOR_FORMULA.REF_N01"/>
        <bm:field name="ref_n02" databaseType="NUMBER" datatype="java.lang.Long" physicalName="REF_N02" prompt="RSC_FIN_INDICATOR_FORMULA.REF_N02"/>
        <bm:field name="ref_n03" databaseType="NUMBER" datatype="java.lang.Long" physicalName="REF_N03" prompt="RSC_FIN_INDICATOR_FORMULA.REF_N03"/>
        <bm:field name="ref_n04" databaseType="NUMBER" datatype="java.lang.Long" physicalName="REF_N04" prompt="RSC_FIN_INDICATOR_FORMULA.REF_N04"/>
        <bm:field name="ref_n05" databaseType="NUMBER" datatype="java.lang.Long" physicalName="REF_N05" prompt="RSC_FIN_INDICATOR_FORMULA.REF_N05"/>
        <bm:field name="ref_d01" databaseType="DATE" datatype="java.util.Date" physicalName="REF_D01" prompt="RSC_FIN_INDICATOR_FORMULA.REF_D01"/>
        <bm:field name="ref_d02" databaseType="DATE" datatype="java.util.Date" physicalName="REF_D02" prompt="RSC_FIN_INDICATOR_FORMULA.REF_D02"/>
        <bm:field name="ref_d03" databaseType="DATE" datatype="java.util.Date" physicalName="REF_D03" prompt="RSC_FIN_INDICATOR_FORMULA.REF_D03"/>
        <bm:field name="ref_d04" databaseType="DATE" datatype="java.util.Date" physicalName="REF_D04" prompt="RSC_FIN_INDICATOR_FORMULA.REF_D04"/>
        <bm:field name="ref_d05" databaseType="DATE" datatype="java.util.Date" physicalName="REF_D05" prompt="RSC_FIN_INDICATOR_FORMULA.REF_D05"/>
        <bm:field name="percent_flag" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="PERCENT_FLAG" prompt="HLS.PERCENT_FLAG"/>
        <bm:field name="first_indicator_formula" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="FIRST_INDICATOR_FORMULA" prompt="RSC_FIN_INDICATOR_FORMULA.FIRST_INDICATOR_FORMULA"/>
        <bm:field name="indicator_code" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="INDICATOR_CODE" prompt="RSC_FIN_INDICATOR_FORMULA.INDICATOR_CODE"/>
        <bm:field name="first_indicator_formula_desc" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="FIRST_INDICATOR_FORMULA_DESC"/>
        <bm:field name="indicator_formula_desc" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="INDICATOR_FORMULA_DESC"/>
        <bm:field name="five_class_flag" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="five_class_flag"/>
    </bm:fields>
    <bm:features>
        <f:standard-who/>
        <o:sequence-pk/>
    </bm:features>
    <bm:primary-key>
        <bm:pk-field name="fin_indicator_formula_id"/>
    </bm:primary-key>
    <bm:query-fields>
        <bm:query-field field="enabled_flag" queryOperator="="/>
        <bm:query-field field="fin_statement_templet_id" queryOperator="="/>
    </bm:query-fields>
    <bm:operations>
        <bm:operation name="insert">
            <bm:parameters>
                <bm:parameter name="fin_indicator_formula_id" input="false" output="true" outputPath="@fin_indicator_formula_id"/>
            </bm:parameters>
            <bm:update-sql><![CDATA[
        		begin
        		
				  rsc_fin_indicator_formula_pkg.ins_fin_indicator_formula(p_fin_indicator_formula_id=>${@fin_indicator_formula_id},
              p_fin_statement_templet_id=>${@fin_statement_templet_id},
              p_line_number=>${@line_number},
              p_indicator_type=>${@indicator_type},
              p_indicator_name=>${@indicator_name},
              p_indicator_formula=>${@indicator_formula},
              p_indicator_value=>${@indicator_value},
              p_reference_results=>${@reference_results},
              p_enabled_flag=>${@enabled_flag},
              p_user_id=>${/session/@user_id},
              p_ref_v01=>${@ref_v01},
              p_ref_v02=>${@ref_v02},
              p_ref_v03=>${@ref_v03},
              p_ref_v04=>${@ref_v04},
              p_ref_v05=>${@ref_v05},
              p_ref_n01=>${@ref_n01},
              p_ref_n02=>${@ref_n02},
              p_ref_n03=>${@ref_n03},
              p_ref_n04=>${@ref_n04},
              p_ref_n05=>${@ref_n05},
              p_ref_d01=>${@ref_d01},
              p_ref_d02=>${@ref_d02},
              p_ref_d03=>${@ref_d03},
              p_ref_d04=>${@ref_d04},
              p_ref_d05=>${@ref_d05},
              p_percent_flag=>${@percent_flag},
              p_first_indicator_formula=>${@first_indicator_formula},
              p_indicator_code=>${@indicator_code},
              p_five_class_flag       => ${@five_class_flag});

				end;
        	]]></bm:update-sql>
        </bm:operation>
        <bm:operation name="update">
            <bm:update-sql><![CDATA[
        		begin
        		
				  rsc_fin_indicator_formula_pkg.upd_fin_indicator_formula(p_fin_indicator_formula_id=>${@fin_indicator_formula_id},
              p_fin_statement_templet_id=>${@fin_statement_templet_id},
              p_line_number=>${@line_number},
              p_indicator_type=>${@indicator_type},
              p_indicator_name=>${@indicator_name},
              p_indicator_formula=>${@indicator_formula},
              p_indicator_value=>${@indicator_value},
              p_reference_results=>${@reference_results},
              p_enabled_flag=>${@enabled_flag},
              p_user_id=>${/session/@user_id},
              p_ref_v01=>${@ref_v01},
              p_ref_v02=>${@ref_v02},
              p_ref_v03=>${@ref_v03},
              p_ref_v04=>${@ref_v04},
              p_ref_v05=>${@ref_v05},
              p_ref_n01=>${@ref_n01},
              p_ref_n02=>${@ref_n02},
              p_ref_n03=>${@ref_n03},
              p_ref_n04=>${@ref_n04},
              p_ref_n05=>${@ref_n05},
              p_ref_d01=>${@ref_d01},
              p_ref_d02=>${@ref_d02},
              p_ref_d03=>${@ref_d03},
              p_ref_d04=>${@ref_d04},
              p_ref_d05=>${@ref_d05},
              p_percent_flag=>${@percent_flag},
              p_first_indicator_formula=>${@first_indicator_formula},
              p_indicator_code=>${@indicator_code},
              p_five_class_flag       => ${@five_class_flag});

				end;
        	]]></bm:update-sql>
        </bm:operation>
    </bm:operations>
    <!-- <e:exception-descriptor-config>
        <e:exception-descriptor exception="java.sql.SQLException" handleClass="leaf.database.SQLExceptionDescriptor">
            <e:error-message code="1" message="RSC302.FORMULA_NUMBER_REPEATED"/>
        </e:exception-descriptor>
    </e:exception-descriptor-config> -->
</bm:model>
