<?xml version="1.0" encoding="UTF-8"?>
<bm:model xmlns:bm="http://www.leaf-framework.org/schema/bm">
    <bm:operations>
        <bm:operation name="query">
            <bm:query-sql><![CDATA[
            select *from (
            SELECT a.column_code,a.column_id,b.*,
            (select scv.code_value_name from sys_code_values_v scv where scv.code='HLS050_DATA_TYPE' and scv.code_value=b.data_type) data_type_display,
            (select scv.code_value_name from sys_code_values_v scv where scv.code='HLS050_INPUT_MODE' and scv.code_value=b.input_mode) input_mode_display,
            (select scv.code_value_name from sys_code_values_v scv where scv.code='HLS050_VALIDATION_TYPE' and scv.code_value= b.validation_type) validation_type_display,
            (select scv.code_value_name from sys_code_values_v scv where scv.code='HLS050_ALIGNMENT' and scv.code_value= b.alignment) alignment_display,
            (select scv.code_value_name from sys_code_values_v scv where scv.code='HLS050_DISPLAY_FLAG_CHECK' and scv.code_value= b.display_flag) display_flag_dis,
            (select ci.description from hls_cashflow_item ci where ci.cf_item=b.cf_item) cf_item_display
  FROM HLS_FIN_CALC_COLUMN_CODE A, HLS_DOC_LAYOUT_CATALOG B
 WHERE A.COLUMN_NAME = B.COLUMN_NAME
   AND B.USAGE_CALCULATOR = 'Y'
   AND DECODE(A.TABLE_NAME,
              'HLS_FIN_CALCULATOR_HD',
              'H',
              'HLS_FIN_CALCULATOR_LN',
              'L') = ${@layout_area_seq}
   AND NOT EXISTS
 (SELECT 1
          FROM HLS_FIN_CALC_CONFIG C
         WHERE C.PRICE_LIST = ${@price_list}
           AND C.column_code = A.column_code)) t1
           #WHERE_CLAUSE#
           ]]></bm:query-sql>
            <bm:parameters>
                <bm:parameter name="layout_area_seq"/>
                <bm:parameter name="price_list"/>
            </bm:parameters>
        </bm:operation>
    </bm:operations>
    <bm:fields>
        <bm:field name="column_id"/>
        <bm:field name="column_code" databaseType="VARCHAR2" datatype="java.lang.String" forDisplay="true" forQuery="true" physicalName="COLUMN_CODE" prompt="HLS050.HLS_FIN_CALC_CONFIG.COLUMN_CODE"/>
        <bm:field name="column_name" databaseType="VARCHAR2" datatype="java.lang.String" forDisplay="true" forQuery="true" physicalName="COLUMN_NAME" prompt="HLS050.HLS_FIN_CALC_CONFIG.COLUMN_NAME"/>
        <bm:field name="data_type" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="DATA_TYPE"/>
        <bm:field name="system_flag" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="SYSTEM_FLAG"/>
        <bm:field name="key_field_flag" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="KEY_FIELD_FLAG"/>
        <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="display_flag_dis" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="DISPLAY_FLAG_DIS"/>
        <bm:field name="display_order" databaseType="NUMBER" datatype="java.lang.Long" physicalName="DISPLAY_ORDER"/>
        <bm:field name="prompt" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="PROMPT"/>
        <bm:field name="input_mode" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="INPUT_MODE"/>
        <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="lov_return_vcode" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="LOV_RETURN_VCODE"/>
        <bm:field name="allow_decimal" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="ALLOW_DECIMAL"/>
        <bm:field name="precision" databaseType="NUMBER" datatype="java.lang.Long" physicalName="PRECISION"/>
        <bm:field name="zero_fill" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="ZERO_FILL"/>
        <bm:field name="allow_format" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="ALLOW_FORMAT"/>
        <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="percent" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="PERCENT"/>
        <bm:field name="default_value" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="DEFAULT_VALUE"/>
        <bm:field name="upper_limit" databaseType="NUMBER" datatype="java.lang.Long" physicalName="UPPER_LIMIT"/>
        <bm:field name="lower_limit" databaseType="NUMBER" datatype="java.lang.Long" physicalName="LOWER_LIMIT"/>
        <bm:field name="cf_item" databaseType="NUMBER" datatype="java.lang.Long" physicalName="CF_ITEM"/>
        <bm:field name="usage_calculator" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="USAGE_CALCULATOR"/>
        <bm:field name="height" databaseType="NUMBER" datatype="java.lang.Long" physicalName="HEIGHT"/>
        <bm:field name="created_by" databaseType="NUMBER" datatype="java.lang.Long" physicalName="CREATED_BY"/>
        <bm:field name="creation_date" databaseType="DATE" datatype="java.util.Date" physicalName="CREATION_DATE"/>
        <bm:field name="last_updated_by" databaseType="NUMBER" datatype="java.lang.Long" physicalName="LAST_UPDATED_BY"/>
        <bm:field name="last_update_date" databaseType="DATE" datatype="java.util.Date" physicalName="LAST_UPDATE_DATE"/>
        <bm:field name="data_type_display"/>
        <bm:field name="input_mode_display"/>
        <bm:field name="validation_type_display"/>
        <bm:field name="alignment_display"/>
        <bm:field name="cf_item_display"/>
    </bm:fields>
    <bm:query-fields>
        <bm:query-field field="column_code" queryOperator="like"/>
        <bm:query-field field="column_name" queryOperator="like"/>
    </bm:query-fields>
</bm:model>
