<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author: wangguangfan2864  
    $Date: 2011-9-6 下午01:40:45  
    $Revision: 1.0  
    $Purpose: SAP科目属性定义BM
-->
<bm:model xmlns:bm="http://www.leaf-framework.org/schema/bm" xmlns:f="leaf.database.features" alias="t1" baseTable="GLD_ACCOUNTS">
    <bm:fields>
        <bm:field name="account_set_id" databaseType="NUMBER" datatype="java.lang.Long" physicalName="ACCOUNT_SET_ID" prompt="GLD_ACCOUNTS.ACCOUNT_SET_ID"/>
        <bm:field name="account_id" databaseType="NUMBER" datatype="java.lang.Long" physicalName="ACCOUNT_ID" prompt="GLD_ACCOUNTS.ACCOUNT_ID"/>
        <bm:field name="account_code" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="ACCOUNT_CODE" prompt="GLD_ACCOUNTS.ACCOUNT_CODE"/>
        <bm:field name="description_id" databaseType="NUMBER" datatype="java.lang.Long" multiLanguage="true" multiLanguageDescField="description" physicalName="DESCRIPTION_ID" prompt="GLD_ACCOUNTS.DESCRIPTION_ID"/>
        <bm:field name="account_type" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="ACCOUNT_TYPE" prompt="GLD_ACCOUNTS.ACCOUNT_TYPE"/>
        <bm:field name="enabled_flag" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="ENABLED_FLAG" prompt="GLD_ACCOUNTS.ENABLED_FLAG"/>
        <bm:field name="summary_flag" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="SUMMARY_FLAG" prompt="GLD_ACCOUNTS.SUMMARY_FLAG"/>
        <bm:field name="description" databaseType="VARCHAR" datatype="java.lang.String" prompt="GLD_ACCOUNTS.DESCRIPTION"/>
        <bm:field name="sap_account_type" datatype="java.lang.String" expression="(select hsa.sap_account_type from hls_sap_accounts_attr hsa where hsa.account_set_id = t1.account_set_id and hsa.account_id = t1.account_id)" forInsert="false" forUpdate="false"/>
        <bm:field name="dr_account_category" datatype="java.lang.String" expression="(select hsa.dr_account_category from hls_sap_accounts_attr hsa where hsa.account_set_id = t1.account_set_id and hsa.account_id = t1.account_id)" forInsert="false" forUpdate="false"/>
        <bm:field name="cr_account_category" datatype="java.lang.String" expression="(select hsa.cr_account_category from hls_sap_accounts_attr hsa where hsa.account_set_id = t1.account_set_id and hsa.account_id = t1.account_id)" forInsert="false" forUpdate="false"/>
        <bm:field name="gl_identity" datatype="java.lang.String" expression="(select hsa.gl_identity from hls_sap_accounts_attr hsa where hsa.account_set_id = t1.account_set_id and hsa.account_id = t1.account_id)" forInsert="false" forUpdate="false"/>
        <bm:field name="sap_account_group" datatype="java.lang.String" expression="(select hsa.sap_account_group from hls_sap_accounts_attr hsa where hsa.account_set_id = t1.account_set_id and hsa.account_id = t1.account_id)" forInsert="false" forUpdate="false"/>
        <bm:field name="sap_account_type_name" datatype="java.lang.String" expression="(select fd.description_text from hls_sap_accounts_attr hsa,sys_code_values_v scv, sys_code_values sc, fnd_descriptions fd where hsa.account_id = t1.account_id and scv.code_value = hsa.sap_account_type and sc.code_value = scv.code_value and sc.code_value_name_id = fd.description_id and sc.code_id= scv.code_id and scv.code = &apos;HLS_SAP_ACCOUNT_TYPE&apos; and fd.language = ${/session/@lang})" forInsert="false" forUpdate="false"/>
        <bm:field name="dr_account_category_name" datatype="java.lang.String" expression="(select fd.description_text from hls_sap_accounts_attr hsa, sys_code_values_v scv, sys_code_values sc, fnd_descriptions fd where hsa.account_id = t1.account_id and scv.code_value = hsa.dr_account_category and sc.code_value = scv.code_value and sc.code_value_name_id = fd.description_id and sc.code_id= scv.code_id and scv.code = &apos;HLS_SAP_DR_ACCOUNT_CATEGORY&apos; and fd.language = ${/session/@lang})" forInsert="false" forUpdate="false"/>
        <bm:field name="cr_account_category_name" datatype="java.lang.String" expression="(select fd.description_text from hls_sap_accounts_attr hsa, sys_code_values_v scv, sys_code_values sc, fnd_descriptions fd where hsa.account_id = t1.account_id and scv.code_value = hsa.cr_account_category and sc.code_value = scv.code_value and sc.code_value_name_id = fd.description_id and sc.code_id= scv.code_id and scv.code = &apos;HLS_SAP_CR_ACCOUNT_CATEGORY&apos; and fd.language = ${/session/@lang})" forInsert="false" forUpdate="false"/>
        <bm:field name="gl_identity_name" datatype="java.lang.String" expression="(select fd.description_text from hls_sap_accounts_attr hsa, sys_code_values_v scv, sys_code_values sc, fnd_descriptions fd where hsa.account_id = t1.account_id and scv.code_value = hsa.gl_identity and sc.code_value = scv.code_value and sc.code_value_name_id = fd.description_id and sc.code_id= scv.code_id and scv.code = &apos;HLS_SAP_GL_IDENTITY&apos; and fd.language = ${/session/@lang})" forInsert="false" forUpdate="false"/>
        <bm:field name="sap_account_group_name" datatype="java.lang.String" expression="(select fd.description_text from hls_sap_accounts_attr hsa, sys_code_values_v scv, sys_code_values sc, fnd_descriptions fd where hsa.account_id = t1.account_id and scv.code_value = hsa.sap_account_group and sc.code_value = scv.code_value and sc.code_value_name_id = fd.description_id and sc.code_id= scv.code_id and scv.code = &apos;HLS_SAP_ACCOUNT_GROUP&apos; and fd.language = ${/session/@lang})" forInsert="false" forUpdate="false"/>
        <bm:field name="cash_flow_flag" datatype="java.lang.String" expression="(select hsa.cash_flow_flag from hls_sap_accounts_attr hsa where hsa.account_set_id = t1.account_set_id and hsa.account_id = t1.account_id)" forInsert="false" forUpdate="false"/>
        <bm:field name="trade_partner_flag" datatype="java.lang.String" expression="(select hsa.trade_partner_flag from hls_sap_accounts_attr hsa where hsa.account_set_id = t1.account_set_id and hsa.account_id = t1.account_id)" forInsert="false" forUpdate="false"/>
    </bm:fields>
    <bm:primary-key>
        <bm:pk-field name="account_id"/>
    </bm:primary-key>
    <bm:query-fields>
        <bm:query-field field="account_set_id" queryOperator="="/>
        <bm:query-field field="account_code" queryOperator="like"/>
        <bm:query-field name="account_description" queryExpression="exists(select 1 from fnd_descriptions fd where t1.description_id=fd.description_id and fd.description_text like ${@account_description} and fd.language = ${/session/@lang})"/>
    </bm:query-fields>
    <bm:features>
        <f:standard-who/>
        <f:multi-language-storage/>
    </bm:features>
</bm:model>