<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author: MUMU  
    $Date: 2013-9-13 上午9:29:29  
    $Revision: 1.0  
    $Purpose: 
-->
<bm:model xmlns:bm="http://www.leaf-framework.org/schema/bm" xmlns:f="leaf.database.features" alias="t1" baseTable="GLD_JOURNAL_HEADERS" needAccessControl="false">
    <bm:fields>
        <bm:field name="journal_header_id" databaseType="NUMBER" datatype="java.lang.Long" physicalName="JOURNAL_HEADER_ID" prompt="GLD_JOURNAL_HEADERS.JOURNAL_HEADER_ID"/>
        <bm:field name="journal_num" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="JOURNAL_NUM" prompt="GLD_JOURNAL_HEADERS.JOURNAL_NUM"/>
        <bm:field name="journal_date" databaseType="DATE" datatype="java.util.Date" physicalName="JOURNAL_DATE" prompt="GLD_JOURNAL_HEADERS.JOURNAL_DATE"/>
        <bm:field name="period_name" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="PERIOD_NAME" prompt="GLD_JOURNAL_HEADERS.PERIOD_NAME"/>
        <bm:field name="period_year" databaseType="NUMBER" datatype="java.lang.Long" physicalName="PERIOD_YEAR" prompt="GLD_JOURNAL_HEADERS.PERIOD_YEAR"/>
        <bm:field name="period_num" databaseType="NUMBER" datatype="java.lang.Long" physicalName="PERIOD_NUM" prompt="GLD_JOURNAL_HEADERS.PERIOD_NUM"/>
        <bm:field name="source_code" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="SOURCE_CODE" prompt="GLD_JOURNAL_HEADERS.SOURCE_CODE"/>
        <bm:field name="category_code" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="CATEGORY_CODE" prompt="GLD_JOURNAL_HEADERS.CATEGORY_CODE"/>
        <bm:field name="category_code_desc" expression="(select description from hls_document_type where document_type = t1.category_code and enabled_flag=&apos;Y&apos;)" forInsert="false" forUpdate="false"/>
        <bm:field name="currency_code" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="CURRENCY_CODE" prompt="GLD_JOURNAL_HEADERS.CURRENCY_CODE"/>
        <bm:field name="currency_code_desc" expression="(select currency_name from gld_currency_vl where currency_code = t1.currency_code and enabled_flag=&apos;Y&apos;)" forInsert="false" forUpdate="false"/>
        <bm:field name="exchange_rate_type" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="EXCHANGE_RATE_TYPE" prompt="GLD_JOURNAL_HEADERS.EXCHANGE_RATE_TYPE"/>
        <bm:field name="exchange_rate" databaseType="NUMBER" datatype="java.lang.Long" physicalName="EXCHANGE_RATE" prompt="GLD_JOURNAL_HEADERS.EXCHANGE_RATE"/>
        <bm:field name="attachment_num" databaseType="NUMBER" datatype="java.lang.Long" physicalName="ATTACHMENT_NUM" prompt="GLD_JOURNAL_HEADERS.ATTACHMENT_NUM"/>
        <bm:field name="total_amount_dr" databaseType="NUMBER" datatype="java.lang.Long" physicalName="TOTAL_AMOUNT_DR" prompt="GLD_JOURNAL_HEADERS.TOTAL_AMOUNT_DR"/>
        <bm:field name="total_amount_cr" databaseType="NUMBER" datatype="java.lang.Long" physicalName="TOTAL_AMOUNT_CR" prompt="GLD_JOURNAL_HEADERS.TOTAL_AMOUNT_CR"/>
        <bm:field name="total_amount_fuc_dr" databaseType="NUMBER" datatype="java.lang.Long" physicalName="TOTAL_AMOUNT_FUC_DR" prompt="GLD_JOURNAL_HEADERS.TOTAL_AMOUNT_FUC_DR"/>
        <bm:field name="total_amount_fuc_cr" databaseType="NUMBER" datatype="java.lang.Long" physicalName="TOTAL_AMOUNT_FUC_CR" prompt="GLD_JOURNAL_HEADERS.TOTAL_AMOUNT_FUC_CR"/>
        <!-- <bm:field name="status" databaseType="VARCHAR2" datatype="java.lang.String" lookupCode="GLD_JE_STATUS" lookupField="status_desc" physicalName="STATUS" prompt="GLD_JOURNAL_HEADERS.STATUS" forInsert="false" forUpdate="false"/> -->
        <bm:field name="description" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="DESCRIPTION" prompt="GLD_JOURNAL_HEADERS.DESCRIPTION"/>
        <bm:field name="company_id" databaseType="NUMBER" datatype="java.lang.Long" physicalName="COMPANY_ID" prompt="GLD_JOURNAL_HEADERS.COMPANY_ID"/>
        <bm:field name="posted_by" databaseType="NUMBER" datatype="java.lang.Long" physicalName="POSTED_BY" prompt="GLD_JOURNAL_HEADERS.POSTED_BY"/>
        <bm:field name="approved_date" databaseType="DATE" datatype="java.util.Date" physicalName="APPROVED_DATE" prompt="GLD_JOURNAL_HEADERS.APPROVED_DATE"/>
        <bm:field name="approved_by" databaseType="NUMBER" datatype="java.lang.Long" physicalName="APPROVED_BY" prompt="GLD_JOURNAL_HEADERS.APPROVED_BY"/>
        <bm:field name="approved_name" expression="(select description from sys_user where user_id = t1.approved_by)" forInsert="false" forUpdate="false"/>
        <bm:field name="created_name" expression="(select description from sys_user where user_id = t1.created_by)" forInsert="false" forUpdate="false"/>
        <!-- <bm:field name="reversed_journal_header_id" databaseType="NUMBER" datatype="java.lang.Long" physicalName="REVERSED_JOURNAL_HEADER_ID" prompt="GLD_JOURNAL_HEADERS.REVERSED_JOURNAL_HEADER_ID"/> -->
        <!-- <bm:field name="reversed_flag" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="REVERSED_FLAG" prompt="GLD_JOURNAL_HEADERS.REVERSED_FLAG"/> -->
        <!-- <bm:field name="reversed_date" databaseType="DATE" datatype="java.util.Date" physicalName="REVERSED_DATE" prompt="GLD_JOURNAL_HEADERS.REVERSED_DATE"/> -->
    </bm:fields>
    <bm:features>
        <f:standard-who/>
    </bm:features>
    <bm:primary-key>
        <bm:pk-field name="journal_header_id"/>
    </bm:primary-key>
    <bm:query-fields>
        <bm:query-field field="journal_num" queryExpression="journal_num like &apos;%&apos;||${@journal_num}||&apos;%&apos;"/>
        <bm:query-field field="source_code" queryExpression="source_code like &apos;%&apos;||${@source_code}||&apos;%&apos;"/>
        <bm:query-field field="description" queryExpression="description like &apos;%&apos;||${@description}||&apos;%&apos;"/>
        <bm:query-field field="category_code" queryOperator="="/>
        <!--         <bm:query-field field="status" queryOperator="="/> -->
        <bm:query-field field="period_year" queryOperator="="/>
        <bm:query-field field="journal_header_id" queryOperator="="/>
        <bm:query-field field="period_name" queryOperator="="/>
        <bm:query-field field="created_by" queryOperator="="/>
        <bm:query-field field="approved_by" queryOperator="="/>
        <bm:query-field name="total_amount_dr_from" queryExpression="total_amount_dr &gt;= ${@total_amount_dr_from}"/>
        <bm:query-field name="total_amount_dr_to" queryExpression="total_amount_dr &lt;= ${@total_amount_dr_to}"/>
        <bm:query-field name="journal_date_from" queryExpression="t1.journal_date &gt;= to_date(${@journal_date_from},&apos;yyyy-mm-dd&apos;)"/>
        <bm:query-field name="journal_date_to" queryExpression="t1.journal_date &lt;= to_date(${@journal_date_to},&apos;yyyy-mm-dd&apos;)"/>
    </bm:query-fields>
    <bm:data-filters>
        <bm:data-filter enforceOperations="query" expression="t1.company_id = ${/session/@company_id}"/>
        <!-- <bm:data-filter enforceOperations="query" expression="t1.reversed_flag is null"/> -->
        <!--  <bm:data-filter enforceOperations="query" expression="t1.status = &apos;C&apos;"/> -->
    </bm:data-filters>
</bm:model>
