<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author: gaoyang  
    $Date: 2013-9-13 下午03:33:28  
    $Revision: 1.0  
    $Purpose: 
-->
<bm:model xmlns:s="leaf.plugin.script" xmlns:bm="http://www.leaf-framework.org/schema/bm">
    <bm:operations>
        <bm:operation name="query">
            <bm:query-sql><![CDATA[
                SELECT
                    t1.chance_id,
                    t1.chance_number,
                    t1.bp_name,
                    t1.document_category,
                    t1.document_type,
                    t1.industry,
                    (SELECT c.description FROM hls_stat_class c WHERE c.class_id=t1.industry
                    ) industry_n
                FROM
                    prj_chance t1 #WHERE_CLAUSE#
                ORDER BY
                    t1.chance_number DESC
            ]]></bm:query-sql>
        </bm:operation>
    </bm:operations>
    <bm:fields>
        <bm:field name="chance_id"/>
        <bm:field name="chance_number" displayWidth="210" forDisplay="true" forQuery="true" prompt="HLS.LEASE_CHANCE_CODE"/>
        <bm:field name="bp_name" displayWidth="210" forDisplay="true" forQuery="true" prompt="HLS.BP_NAME"/>
        <bm:field name="document_category"/>
        <bm:field name="document_type"/>
        <bm:field name="industry"/>
        <bm:field name="industry_n"/>
    </bm:fields>
    <bm: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>
    </bm:features>
    <bm:query-fields>
        <bm:query-field field="chance_number" queryOperator="like"/>
        <bm:query-field field="bp_name" queryOperator="like"/>
    </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.chance_status not in (&apos;CLOSED&apos;)"/>
    </bm:data-filters>
</bm:model>
