<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author: gaoyang  
    $Date: 2013-12-4 上午11:14:47  
    $Revision: 1.0  
    $Purpose: 
-->
<bm:model xmlns:bm="http://www.leaf-framework.org/schema/bm" xmlns:f="leaf.database.features" alias="t1" baseTable="HLS_JOURNAL_HEADER_V" defaultOrderBy="t1.period_name desc,t1.journal_num">
    <bm:fields>
        <bm:field name="journal_header_id" databaseType="NUMBER" datatype="java.lang.Long" physicalName="JOURNAL_HEADER_ID" prompt="HLS_JOURNAL_HEADER_V.JOURNAL_HEADER_ID"/>
        <bm:field name="source_table" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="SOURCE_TABLE" prompt="HLS_JOURNAL_HEADER_V.SOURCE_TABLE"/>
        <bm:field name="source_id" databaseType="NUMBER" datatype="java.lang.Long" physicalName="SOURCE_ID" prompt="HLS_JOURNAL_HEADER_V.SOURCE_ID"/>
        <bm:field name="company_id" databaseType="NUMBER" datatype="java.lang.Long" physicalName="COMPANY_ID" prompt="HLS_JOURNAL_HEADER_V.COMPANY_ID"/>
        <bm:field name="je_company_id" databaseType="NUMBER" datatype="java.lang.Long" physicalName="JE_COMPANY_ID" prompt="HLS_JOURNAL_HEADER_V.JE_COMPANY_ID"/>
        <bm:field name="js_company_short_name" expression="(select c.company_short_name from fnd_companies_vl c where c.company_id=je_company_id)"/>
        <bm:field name="journal_num" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="JOURNAL_NUM" prompt="HLS_JOURNAL_HEADER_V.JOURNAL_NUM"/>
        <bm:field name="journal_date" databaseType="DATE" datatype="java.util.Date" physicalName="JOURNAL_DATE" prompt="HLS_JOURNAL_HEADER_V.JOURNAL_DATE"/>
        <bm:field name="period_set_code" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="PERIOD_SET_CODE" prompt="HLS_JOURNAL_HEADER_V.PERIOD_SET_CODE"/>
        <bm:field name="internal_period_num" databaseType="NUMBER" datatype="java.lang.Long" physicalName="INTERNAL_PERIOD_NUM" prompt="HLS_JOURNAL_HEADER_V.INTERNAL_PERIOD_NUM"/>
        <bm:field name="period_name" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="PERIOD_NAME" prompt="HLS_JOURNAL_HEADER_V.PERIOD_NAME"/>
        <bm:field name="period_year" databaseType="NUMBER" datatype="java.lang.Long" physicalName="PERIOD_YEAR" prompt="HLS_JOURNAL_HEADER_V.PERIOD_YEAR"/>
        <bm:field name="period_num" databaseType="NUMBER" datatype="java.lang.Long" physicalName="PERIOD_NUM" prompt="HLS_JOURNAL_HEADER_V.PERIOD_NUM"/>
        <bm:field name="je_template_set_code" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="JE_TEMPLATE_SET_CODE" prompt="HLS_JOURNAL_HEADER_V.JE_TEMPLATE_SET_CODE"/>
        <bm:field name="je_transaction_code" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="JE_TRANSACTION_CODE" prompt="HLS_JOURNAL_HEADER_V.JE_TRANSACTION_CODE"/>
        <bm:field name="je_transaction_desc" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="JE_TRANSACTION_DESC" prompt="HLS_JOURNAL_HEADER_V.JE_TRANSACTION_DESC"/>
        <bm:field name="currency_code" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="CURRENCY_CODE" prompt="HLS_JOURNAL_HEADER_V.CURRENCY_CODE"/>
        <bm:field name="currency_desc" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="CURRENCY_DESC" prompt="HLS_JOURNAL_HEADER_V.CURRENCY_DESC"/>
        <bm:field name="exchange_rate_quotation" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="EXCHANGE_RATE_QUOTATION" prompt="HLS_JOURNAL_HEADER_V.EXCHANGE_RATE_QUOTATION"/>
        <bm:field name="exchange_rate_type" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="EXCHANGE_RATE_TYPE" prompt="HLS_JOURNAL_HEADER_V.EXCHANGE_RATE_TYPE"/>
        <bm:field name="exchange_rate_type_desc" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="EXCHANGE_RATE_TYPE_DESC" prompt="HLS_JOURNAL_HEADER_V.EXCHANGE_RATE_TYPE_DESC"/>
        <bm:field name="exchange_rate" databaseType="NUMBER" datatype="java.lang.Double" physicalName="EXCHANGE_RATE" prompt="HLS_JOURNAL_HEADER_V.EXCHANGE_RATE"/>
        <bm:field name="attachment_num" databaseType="NUMBER" datatype="java.lang.Long" physicalName="ATTACHMENT_NUM" prompt="HLS_JOURNAL_HEADER_V.ATTACHMENT_NUM"/>
        <bm:field name="total_amount_dr" databaseType="NUMBER" datatype="java.lang.Double" physicalName="TOTAL_AMOUNT_DR" prompt="HLS_JOURNAL_HEADER_V.TOTAL_AMOUNT_DR"/>
        <bm:field name="total_amount_cr" databaseType="NUMBER" datatype="java.lang.Double" physicalName="TOTAL_AMOUNT_CR" prompt="HLS_JOURNAL_HEADER_V.TOTAL_AMOUNT_CR"/>
        <bm:field name="total_amount_fuc_dr" databaseType="NUMBER" datatype="java.lang.Double" physicalName="TOTAL_AMOUNT_FUC_DR" prompt="HLS_JOURNAL_HEADER_V.TOTAL_AMOUNT_FUC_DR"/>
        <bm:field name="total_amount_fuc_cr" databaseType="NUMBER" datatype="java.lang.Double" physicalName="TOTAL_AMOUNT_FUC_CR" prompt="HLS_JOURNAL_HEADER_V.TOTAL_AMOUNT_FUC_CR"/>
        <bm:field name="description" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="DESCRIPTION" prompt="HLS_JOURNAL_HEADER_V.DESCRIPTION"/>
        <bm:field name="approved_date" databaseType="DATE" datatype="java.util.Date" physicalName="APPROVED_DATE" prompt="HLS_JOURNAL_HEADER_V.APPROVED_DATE"/>
        <bm:field name="approved_by" databaseType="NUMBER" datatype="java.lang.Long" physicalName="APPROVED_BY" prompt="HLS_JOURNAL_HEADER_V.APPROVED_BY"/>
        <bm:field name="post_gl_status" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="POST_GL_STATUS" prompt="HLS_JOURNAL_HEADER_V.POST_GL_STATUS"/>
        <bm:field name="post_gl_status_desc" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="POST_GL_STATUS_DESC" prompt="HLS_JOURNAL_HEADER_V.POST_GL_STATUS_DESC"/>
        <bm:field name="post_gl_date" databaseType="DATE" datatype="java.util.Date" physicalName="POST_GL_DATE" prompt="HLS_JOURNAL_HEADER_V.POST_GL_DATE"/>
        <bm:field name="post_gl_by" databaseType="NUMBER" datatype="java.lang.Long" physicalName="POST_GL_BY" prompt="HLS_JOURNAL_HEADER_V.POST_GL_BY"/>
        <bm:field name="post_gl_log" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="POST_GL_LOG" prompt="HLS_JOURNAL_HEADER_V.POST_GL_LOG"/>
        <bm:field name="je_batch_id" databaseType="NUMBER" datatype="java.lang.Long" physicalName="JE_BATCH_ID" prompt="HLS_JOURNAL_HEADER_V.JE_BATCH_ID"/>
        <bm:field name="reversed_journal_header_id" databaseType="NUMBER" datatype="java.lang.Long" physicalName="REVERSED_JOURNAL_HEADER_ID" prompt="HLS_JOURNAL_HEADER_V.REVERSED_JOURNAL_HEADER_ID"/>
        <bm:field name="reversed_flag" databaseType="VARCHAR2" datatype="java.lang.String" lookupCode="HLS_REVERSED_FLAG" lookupField="reversed_flag_desc" physicalName="REVERSED_FLAG" prompt="HLS_JOURNAL_HEADER_V.REVERSED_FLAG"/>
        <bm:field name="reversed_flag_desc" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="REVERSED_FLAG_DESC"/>
        <bm:field name="reversed_date" databaseType="DATE" datatype="java.util.Date" physicalName="REVERSED_DATE" prompt="HLS_JOURNAL_HEADER_V.REVERSED_DATE"/>
        <bm:field name="external_journal_hd_id" databaseType="NUMBER" datatype="java.lang.Long" physicalName="EXTERNAL_JOURNAL_HD_ID" prompt="HLS_JOURNAL_HEADER_V.EXTERNAL_JOURNAL_HD_ID"/>
        <bm:field name="external_journal_num" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="EXTERNAL_JOURNAL_NUM" prompt="HLS_JOURNAL_HEADER_V.EXTERNAL_JOURNAL_NUM"/>
        <bm:field name="status" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="STATUS" prompt="HLS_JOURNAL_HEADER_V.STATUS"/>
        <bm:field name="status_desc" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="STATUS_DESC" prompt="HLS_JOURNAL_HEADER_V.STATUS_DESC"/>
    </bm:fields>
    <bm:features>
        <f:standard-who/>
    </bm:features>
    <bm:query-fields>
        <bm:query-field field="journal_num" queryOperator="like"/>
        <bm:query-field name="journal_date_from" datatype="java.util.Date" queryExpression="t1.journal_date &gt;= ${@journal_date_from}"/>
        <bm:query-field name="journal_date_to" datatype="java.util.Date" queryExpression="t1.journal_date &lt;= ${@journal_date_to}"/>
        <bm:query-field field="external_journal_num" queryOperator="like"/>
        <bm:query-field field="je_transaction_code" queryOperator="="/>
        <bm:query-field name="total_amount_dr_from" datatype="java.lang.Double" queryExpression="nvl(t1.total_amount_dr,t1.total_amount_cr) &gt;= ${@total_amount_dr_from}"/>
        <bm:query-field name="total_amount_dr_to" datatype="java.lang.Double" queryExpression="nvl(t1.total_amount_dr,t1.total_amount_cr) &lt;= ${@total_amount_dr_to}"/>
        <bm:query-field field="post_gl_status" queryExpression="nvl(t1.post_gl_status,&apos;N&apos;)=${@post_gl_status}"/>
        <bm:query-field field="company_id" queryOperator="="/>
        <bm:query-field field="currency_code" queryOperator="="/>
        <bm:query-field field="je_company_id" queryOperator="="/>
        <bm:query-field field="status" queryOperator="="/>
        <bm:query-field name="query_reversed_flag" queryExpression="(${@query_reversed_flag}=&apos;Y&apos; and nvl(t1.reversed_flag,&apos;N&apos;)=&apos;N&apos;)"/>
        <bm:query-field name="status_list_flag" queryExpression="(${@status_list_flag}=&apos;Y&apos; and t1.status in (&apos;U&apos;,&apos;B&apos;))"/>
        <bm:query-field name="gld_flag" queryExpression="exists (select 1 from gld_je_transaction d where d.je_transaction_code = t1.je_transaction_code and d.gld_flag = ${@gld_flag})"/>
        <bm:query-field name="export_flag" queryExpression="t1.export_flag=${@export_flag}"/>
    </bm:query-fields>
    <bm:data-filters>
        <bm:data-filter enforceOperations="query" expression=" exists  (select 1           from hls_journal_detail_v dv,fnd_responsibility_centers_vl cen          where dv.journal_header_id = t1.journal_header_id          and dv.responsibility_center_id=cen.responsibility_center_id(+)          and nvl(cen.responsibility_center_code,&apos; &apos;) between                nvl(${@responsibility_center_code_from},                    nvl(cen.responsibility_center_code,&apos; &apos;)) and                nvl(${@responsibility_center_code_to},                    nvl(cen.responsibility_center_code,&apos; &apos;))           and dv.account_code between                nvl(${@account_code_from}, dv.account_code) and                nvl(${@account_code_to}, dv.account_code)           and ( ${@reference1} is null or dv.reference1 like nvl(${@reference1}, dv.reference1))           and  ( ${@project_name} is null or dv.project_name like &apos;%&apos;||nvl(${@project_name},dv.project_name)||&apos;%&apos; )          and ( ${@bp_id_tenant} is null or dv.bp_id_tenant = ${@bp_id_tenant}))"/>
    </bm:data-filters>
</bm:model>
