<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author: DJ  
    $Date: 2013-5-6 下午3:05:38  
    $Revision: 1.0  
    $Purpose: 
-->
<bm:model xmlns:o="leaf.database.local.oracle" xmlns:e="leaf.service.exception" xmlns:f="leaf.database.features" xmlns:bm="http://www.leaf-framework.org/schema/bm" alias="t1" baseTable="CSH_BANK_ACCOUNT">
    <bm:fields>
        <bm:field name="bank_account_id" databaseType="NUMBER" datatype="java.lang.Long" physicalName="BANK_ACCOUNT_ID"/>
        <bm:field name="bank_account_code" databaseType="VARCHAR2" datatype="java.lang.String" forUpdate="true" physicalName="BANK_ACCOUNT_CODE" prompt="HLS.BANK_ACCOUNT_CODE"/>
        <bm:field name="bank_account_name" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="BANK_ACCOUNT_NAME" prompt="HLS.BANK_ACCOUNT_NAME"/>
        <bm:field name="bank_account_num" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="BANK_ACCOUNT_NUM" prompt="HLS.BANK_ACCOUNT_NUM"/>
        <bm:field name="bank_full_name" databaseType="VARCHAR2" datatype="java.lang.String" forInsert="false" forUpdate="false" physicalName="BANK_FULL_NAME" prompt="HLS.BANK_FULL_NAME"/>
        <bm:field name="bank_branch_code" databaseType="VARCHAR2" datatype="java.lang.String" forInsert="false" forUpdate="false" physicalName="BANK_BRANCH_CODE" prompt="HLS.BANK_BRANCH_CODE"/>
        <bm:field name="bank_branch_name" databaseType="VARCHAR2" datatype="java.lang.String" forInsert="false" forUpdate="false" physicalName="BANK_BRANCH_NAME" prompt="HLS.BANK_BRANCH_NAME"/>
        <bm:field name="bank_branch_id" databaseType="NUMBER" datatype="java.lang.Long" physicalName="BANK_BRANCH_ID"/>
        <bm:field name="company_id" databaseType="NUMBER" datatype="java.lang.Long" physicalName="COMPANY_ID"/>
        <bm:field name="currency_code" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="CURRENCY_CODE"/>
        <bm:field name="currency_name" forInsert="false" forUpdate="false" prompt="HLS.CURRENCY"/>
        <bm:field name="zero_amounts_allowed" forInsert="false" forUpdate="false"/>
        <bm:field name="precision" databaseType="NUMBER" datatype="java.lang.Long" forInsert="false" forUpdate="false" physicalName="PRECISION"/>
        <bm:field name="enabled_flag" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="ENABLED_FLAG" prompt="HLS.ENABLED_FLAG"/>
        <bm:field name="cash_account_id" databaseType="NUMBER" datatype="java.lang.Long" physicalName="CASH_ACCOUNT_ID"/>
        <bm:field name="cash_account_code" forInsert="false" forUpdate="false" prompt="CSH101.CSH_BANK_ACCOUNT.CASH_ACCOUNT_CODE"/>
        <bm:field name="responsibility_center_id" databaseType="NUMBER" datatype="java.lang.Long" physicalName="RESPONSIBILITY_CENTER_ID"/>
        <bm:field name="responsibility_center_name" forInsert="false" forUpdate="false" prompt="HLS.RESPONSIBILITY_CENTER_NAME"/>
        <bm:field name="bank_account_type" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="BANK_ACCOUNT_TYPE"/>
        <bm:field name="bank_account_type_name" forInsert="false" forUpdate="false" prompt="HLS.BANK_ACCOUNT_TYPE_NAME"/>
        <bm:field name="is_company_account" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="IS_COMPANY_ACCOUNT" prompt="CSH101.CSH_BANK_ACCOUNT.IS_COMPANY_ACCOUNT"/>
        <bm:field name="settlement_flag" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="SETTLEMENT_FLAG" prompt="CSH101.CSH_BANK_ACCOUNT.SETTLEMENT_FLAG"/>
        <bm:field name="repayment_flag" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="REPAYMENT_FLAG" prompt="CSH101.CSH_BANK_ACCOUNT.REPAYMENT_FLAG"/>
        <bm:field name="loan_flag" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="LOAN_FLAG" prompt="CSH101.CSH_BANK_ACCOUNT.LOAN_FLAG"/>
        <bm:field name="settlement_flag_n" databaseType="VARCHAR2" datatype="java.lang.String" forInsert="false" forUpdate="false"/>
        <bm:field name="repayment_flag_n" databaseType="VARCHAR2" datatype="java.lang.String" forInsert="false" forUpdate="false"/>
        <bm:field name="loan_flag_n" databaseType="VARCHAR2" datatype="java.lang.String" forInsert="false" forUpdate="false"/>
        <bm:field name="company_short_name" databaseType="VARCHAR2" datatype="java.lang.String" forInsert="false" forUpdate="false" physicalName="COMPANY_SHORT_NAME"/>
        <bm:field name="spd_project_name"/>
        <bm:field name="spd_project_number"/>
        <bm:field name="spd_feeno"/>
        <bm:field name="spd_payment_flag"/>
        <bm:field name="spd_receipt_flag"/>
    </bm:fields>
    <bm:operations>
        <bm:operation name="query">
            <bm:query-sql><![CDATA[
    			select t1.bank_account_id,
				       t1.bank_branch_id,
				       t1.bank_branch_code,
				       t1.bank_branch_name,
				       t1.bank_full_name,
				       t1.zero_amounts_allowed,
				       t1.bank_account_code,
				       t1.bank_account_name,
				       t1.bank_account_num,
				       t1.company_id,
				       (select t.company_short_name from fnd_companies t where t.company_id = t1.company_id) company_short_name,
				       t1.currency_code,
				       t1.currency_name,
				       t1.precision,
				       t1.enabled_flag,
				       t1.cash_account_id,
				       t1.cash_account_code,
				       t1.responsibility_center_id,
				       t1.responsibility_center_name,
				       t1.bank_account_type,
				       t1.bank_account_type_name,
				       t1.is_company_account,
				       t1.settlement_flag,
				       t1.repayment_flag,
				       t1.loan_flag,
				       decode(t1.settlement_flag,'Y','是','N','否') settlement_flag_n,
				       decode(t1.repayment_flag,'Y','是','N','否') repayment_flag_n,
				       decode(t1.loan_flag,'Y','是','N','否') loan_flag_n,
				       t1.spd_feeno,
				       t1.spd_payment_flag,
				       t1.spd_project_name,
				       t1.spd_project_number,
				       t1.spd_receipt_flag
				       
				  from csh_bank_account_v t1
				  #WHERE_CLAUSE#
    		]]></bm:query-sql>
        </bm:operation>
    </bm:operations>
    <bm:data-filters>
        <bm:data-filter name="bank_branch_id" enforceOperations="query" expression="bank_branch_id=${@bank_branch_id}"/>
    </bm:data-filters>
    <bm:features>
        <f:standard-who/>
        <o:sequence-pk/>
    </bm:features>
    <bm:primary-key>
        <bm:pk-field name="bank_account_id"/>
    </bm:primary-key>
    <e:exception-descriptor-config>
        <e:exception-descriptor exception="java.sql.SQLException" handleClass="leaf.database.SQLExceptionDescriptor">
            <e:error-message code="1" message="CSH101.ERROR.BANK_ACCOUNT_CODE_REPEATED"/>
        </e:exception-descriptor>
    </e:exception-descriptor-config>
</bm:model>
