<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author: ZLF  
    $Date: 2014-12-8 上午11:04:41  
    $Revision: 1.0  
    $Purpose: 
-->
<bm:model xmlns:bm="http://www.leaf-framework.org/schema/bm">
    <bm:operations>
        <bm:operation name="execute">
            <bm:update-sql><![CDATA[
                BEGIN
                    hlcm_comsn_reconcilia_pkg.insert_comsn_reconcilia_temp(p_session_id => ${/session/@session_id},
                                                                       p_policy_hd_id => ${@policy_hd_id},
                                                                       p_user_id => ${/session/@user_id});
                END;
            ]]></bm:update-sql>
        </bm:operation>
        <bm:operation name="query">
            <bm:query-sql><![CDATA[
                select count(1) count
                  from hlcm_comsn_reconcilia_temp t
                 where t.session_id = ${/session/@session_id}
                   and not exists
                 (select 1
                          from hlcm_comsn_reconcilia r
                         where r.contract_id = t.contract_id
                           and r.wfl_status in ('NEW', 'APPROVING', 'APPROVED'))
            ]]></bm:query-sql>
        </bm:operation>
    </bm:operations>
    <bm:fields>
        <bm:field name="count"/>
    </bm:fields>
</bm:model>
