<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author: gaoyang  
    $Date: 2013-4-18 下午05:30:04  
    $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 d.column_code,
       lower(d.column_name) column_name,
       d.column_name upper_column_name,
       d.prompt,
       d.data_type,
       d.validation_type,
       d.validation_sql,
       d.input_mode,
       d.display_order,
       decode(sign(d.display_order), '-1', 'true', '1', 'false', 'false') lock_column,
       d.price_list,
       d.layout_area_seq,
       d.precision,
       d.allow_format,
       d.allow_decimal,
       d.zero_fill,
       d.default_value,
       d.alignment,
       d.lov_return_vcode,
       nvl(d.width,100) width,
       nvl(p.show_column_code,'N') show_column_code,
       (case when d.validation_type in ('TEXTFIELD','TEXTAREA') then
       	decode(sys_parameter_pkg.value('SYS_GRID_SHOW_TITLE',${/session/@user_id},${/session/@role_id},${/session/@company_id}),'Y','true','false')
       else 'false'
       end) sys_grid_show_title,
       sys_parameter_pkg.value('SYS_GRID_COL_UNDERLINE',${/session/@user_id},${/session/@role_id},${/session/@company_id}) sys_grid_col_underline,
       d.enabled_flag,
       nvl((select q.display_flag from hls_fin_calc_config_quote q 
       where q.calc_session_id=${@calc_session_id} and q.layout_area_seq='L' and q.column_name=d.column_name),d.display_flag) display_flag,
       d.lower_limit,
   	   d.upper_limit
  from hls_fin_calc_config d,hls_price_list p
  #WHERE_CLAUSE#
 order by d.display_order,d.column_name
]]></bm:query-sql>
        </bm:operation>
    </bm:operations>
    <bm:fields>
        <bm:field name="column_code" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="COLUMN_CODE" required="true"/>
        <bm:field name="column_name" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="COLUMN_NAME" required="true"/>
        <bm:field name="upper_column_name" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="UPPER_COLUMN_NAME" required="true"/>
        <bm:field name="prompt" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="PROMPT"/>
        <bm:field name="data_type" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="DATA_TYPE"/>
        <bm:field name="validation_type" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="VALIDATION_TYPE"/>
        <bm:field name="validation_sql" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="VALIDATION_SQL"/>
        <bm:field name="input_mode" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="INPUT_MODE"/>
        <bm:field name="display_order" databaseType="NUMBER" datatype="java.lang.Long" physicalName="DISPLAY_ORDER"/>
        <bm:field name="lock_column" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="LOCK_COLUMN"/>
        <bm:field name="price_list" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="PRICE_LIST" required="true"/>
        <bm:field name="layout_area_seq" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="LAYOUT_AREA_SEQ" required="true"/>
        <bm:field name="precision" databaseType="NUMBER" datatype="java.lang.Long" physicalName="PRECISION"/>
        <bm:field name="allow_format" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="ALLOW_FORMAT"/>
        <bm:field name="allow_decimal" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="ALLOW_DECIMAL"/>
        <bm:field name="default_value" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="DEFAULT_VALUE"/>
        <bm:field name="alignment" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="ALIGNMENT"/>
        <bm:field name="width" databaseType="NUMBER" datatype="java.lang.Long" physicalName="WIDTH"/>
        <bm:field name="show_column_code" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="show_column_code"/>
        <bm:field name="zero_fill" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="ZERO_FILL"/>
        <bm:field name="lov_return_vcode" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="LOV_RETURN_VCODE"/>
        <bm:field name="sys_grid_show_title" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="SYS_GRID_SHOW_TITLE"/>
        <bm:field name="sys_grid_col_underline" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="SYS_GRID_COL_UNDERLINE"/>
        <bm:field name="enabled_flag" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="ENABLED_FLAG"/>
        <bm:field name="display_flag" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="DISPLAY_FLAG"/>
        <bm:field name="lower_limit" databaseType="NUMBER" datatype="java.lang.Double" physicalName="LOWER_LIMIT"/>
        <bm:field name="upper_limit" databaseType="NUMBER" datatype="java.lang.Double" physicalName="UPPER_LIMIT"/>
    </bm:fields>
    <bm:query-fields>
        <bm:query-field field="enabled_flag" queryExpression="d.enabled_flag=${@enabled_flag}"/>
        <bm:query-field field="display_flag" queryExpression="d.display_flag=${@display_flag}"/>
    </bm:query-fields>
    <bm:data-filters>
        <bm:data-filter enforceOperations="query" expression=" ((d.column_name not in('BTB_INTEREST','BTB_FEE') and nvl((select h.hd_user_col_v06 from hls_fin_calculator_hd h where h.calc_session_id=${@calc_session_id}),'N')!='Y') OR nvl((select h.hd_user_col_v06 from hls_fin_calculator_hd h where h.calc_session_id=${@calc_session_id}),'N')='Y')"></bm:data-filter>
        <bm:data-filter name="query" expression="(d.price_list =nvl(${@price_list},(select h.price_list from hls_fin_calculator_hd h where h.calc_session_id=${@calc_session_id})) and d.layout_area_seq = &apos;L&apos; and lower(d.column_name)=nvl(${@column_name},lower(d.column_name)) and d.price_list=p.price_list)"/>
    </bm:data-filters>
</bm:model>
