<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author: LR  
    $Date: 2013-8-13 下午02:09:30  
    $Revision: 1.0  
    $Purpose: 
-->
<ns1:model xmlns:s="leaf.plugin.script" xmlns:ns1="http://www.leaf-framework.org/schema/bm" alias="t1" extend="cont.CON500.con_contract_v" extendMode="reference" needAccessControl="false">
    <ns1:fields>
        <ns1:field name="contract_id" forInsert="true"/>
        <ns1:field name="contract_number" displayWidth="100" forDisplay="true" forQuery="true" prompt="HLS.CONTRACT_NUMBER"/>
        <!--<ns1:field name="contract_name" displayWidth="250" forDisplay="true" forQuery="true" prompt="HLS.CONTRACT_NAME"/>-->
        <ns1:field name="bp_name" displayWidth="150" forDisplay="true" prompt="客户名称"/>
        <ns1:field name="bp_id_agent_level1_n" displayWidth="150" forDisplay="true" forQuery="true" prompt="代理商名称"/>
    </ns1:fields>
    <ns1:query-fields>
        <ns1:query-field field="contract_number" queryOperator="like"/>
        <ns1:query-field field="contract_name" queryOperator="like"/>
        <ns1:query-field field="bp_id_agent_level1_n" queryOperator="like"/>
    </ns1:query-fields>
    <ns1:data-filters>
        <ns1:data-filter expression="( exists (select 1 from aut_trx_user_authorize a1,aut_owner_user_authorize a2 where a1.trx_category = &apos;CONTRACT&apos; and a1.trx_id = t1.contract_id  and trunc(sysdate) between a1.start_date and nvl(a1.end_date,trunc(sysdate)) and a1.user_id = a2.owner_user_id and a1.trx_category = a2.trx_category  and a2.authorized_user_id = ${/session/@user_id} and trunc(sysdate) between a2.start_date and nvl(a2.end_date,trunc(sysdate))))"/>
    </ns1:data-filters>
    <ns1:features>
        <s:bm-script><![CDATA[
            var cx = Packages.leaf.javascript.Context.getCurrentContext();
            Packages.leaf.plugin.script.engine.ScriptImportor.defineExternScript(cx, this, $ctx.getData(), "aut_authority_bm_validate.js");
        ]]></s:bm-script>
    </ns1:features>
</ns1:model>
