<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author: Feng  
    $Date: 2013-10-15 下午4:57:53  
    $Revision: 1.0  
    $Purpose: 
-->
<bm:model xmlns:bm="http://www.leaf-framework.org/schema/bm" xmlns:f="leaf.database.features" alias="t1" baseTable="FRS_REPORTS_FORMULAS_LNS" defaultOrderBy="formula_line_num">
    <bm:fields>
        <bm:field name="formula_id" databaseType="NUMBER" datatype="java.lang.Long" physicalName="FORMULA_ID" prompt="FRS_REPORTS_FORMULAS_LNS.FORMULA_ID"/>
        <bm:field name="formula_line_id" databaseType="NUMBER" datatype="java.lang.Long" physicalName="FORMULA_LINE_ID" prompt="FRS_REPORTS_FORMULAS_LNS.FORMULA_LINE_ID"/>
        <bm:field name="formula_line_num" databaseType="NUMBER" datatype="java.lang.Long" physicalName="FORMULA_LINE_NUM" prompt="FRS_REPORTS_FORMULAS_LNS.FORMULA_LINE_NUM"/>
        <bm:field name="column_id" databaseType="NUMBER" datatype="java.lang.Long" physicalName="COLUMN_ID" prompt="FRS_REPORTS_FORMULAS_LNS.COLUMN_ID"/>
        <bm:field name="line_id" databaseType="NUMBER" datatype="java.lang.Long" physicalName="LINE_ID" prompt="FRS_REPORTS_FORMULAS_LNS.LINE_ID"/>
        <bm:field name="operation" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="OPERATION" prompt="FRS_REPORTS_FORMULAS_LNS.OPERATION"/>
        <bm:field name="line_description" expression="(select fd.description_text from fnd_descriptions fd,frs_reports_lines frl where frl.line_id = t1.line_id and frl.description_id = fd.description_id and fd.language = ${/session/@lang})" forInsert="false" forUpdate="false"/>
        <bm:field name="line_num" expression="(select frl.line_num from frs_reports_lines frl where frl.line_id = t1.line_id)" forInsert="false" forUpdate="false"/>
        <bm:field name="account_code" expression="(SELECT gav.account_code FROM gld_accounts_vl     gav, frs_reports_lines frl WHERE gav.account_id = frl.account_id AND frl.line_id = t1.line_id)" forInsert="false" forUpdate="false"/>
        <bm:field name="account_description" expression="(SELECT gav.description FROM gld_accounts_vl     gav, frs_reports_lines frl WHERE gav.account_id = frl.account_id AND frl.line_id = t1.line_id)" forInsert="false" forUpdate="false"/>
        <bm:field name="column_num" expression="(select frc.column_num from frs_reports_columns frc where frc.column_id = t1.column_id)" forInsert="false" forUpdate="false"/>
        <bm:field name="column_description" expression="(select fd.description_text from fnd_descriptions fd,frs_reports_columns frc where frc.column_id = t1.column_id and frc.description_id = fd.description_id and fd.language = ${/session/@lang})" forInsert="false" forUpdate="false"/>
        <bm:field name="data_element_name" expression="(SELECT scv.code_name FROM sys_code_values_v   scv, frs_reports_columns frc WHERE scv.code = &apos;DATA_ELEMENT&apos; AND scv.code_value = frc.data_element_code AND frc.column_id = t1.column_id AND scv.code_enabled_flag = &apos;Y&apos; AND scv.code_value_enabled_flag = &apos;Y&apos;)" forInsert="false" forUpdate="false"/>
        <bm:field name="period_offset_num" expression="(select frc.period_offset_num from frs_reports_columns frc where frc.column_id = t1.column_id)" forInsert="false" forUpdate="false"/>
        <bm:field name="formula_type" expression="(select &apos;L&apos; from dual)" forInsert="false" forUpdate="false"/>
    </bm:fields>
    <bm:features>
        <f:standard-who/>
    </bm:features>
    <bm:primary-key>
        <bm:pk-field name="formula_line_id"/>
    </bm:primary-key>
    <bm:query-fields>
        <bm:query-field field="formula_id" queryExpression="formula_id = ${@formula_id}"/>
    </bm:query-fields>
</bm:model>
