<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author: liuguocai  
    $Date: 2015-12-15 上午11:10:48  
    $Revision: 1.0  
    $Purpose: 
-->
<bm:model xmlns:o="leaf.database.local.oracle" xmlns:bm="http://www.leaf-framework.org/schema/bm" xmlns:f="leaf.database.features">
    <bm:fields>
        <bm:field name="agree_perecent"/>
        <bm:field name="refuse_perecent"/>
        <bm:field name="agree_name"/>
        <bm:field name="refuse_name"/>
        <bm:field name="discuss_perecent"/>
        <bm:field name="leave_perecent"/>
        <bm:field name="discuss_name"/>
        <bm:field name="leave_name"/>
    </bm:fields>
    <bm:operations>
        <bm:operation name="query">
            <bm:query-sql><![CDATA[
                SELECT ((SELECT COUNT(1)
           FROM prj_project_approver t1
          WHERE t1.approval_id = ${@approval_id}
            AND t1.approve_status = 'agree') || '/' ||
       (SELECT COUNT(1)
           FROM prj_project_approver t1
          WHERE t1.approval_id = ${@approval_id}
          and t1.approve_status not in  ('leave'))) agree_perecent,
       ((SELECT COUNT(1)
           FROM prj_project_approver t1
          WHERE t1.approval_id = ${@approval_id}
            AND t1.approve_status = 'refuse') || '/' ||
       (SELECT COUNT(1)
           FROM prj_project_approver t1
          WHERE t1.approval_id = ${@approval_id}
          and t1.approve_status not in ('leave'))) refuse_perecent,
       ((SELECT COUNT(1)
           FROM prj_project_approver t1
          WHERE t1.approval_id = ${@approval_id}
            AND t1.approve_status = 'discuss') || '/' ||
       (SELECT COUNT(1)
           FROM prj_project_approver t1
          WHERE t1.approval_id = ${@approval_id}
          and t1.approve_status not in ('leave'))) discuss_perecent,
       ((SELECT COUNT(1)
           FROM prj_project_approver t1
          WHERE t1.approval_id = ${@approval_id}
            AND t1.approve_status = 'leave') || '/' ||
       (SELECT COUNT(1)
           FROM prj_project_approver t1
          WHERE t1.approval_id = ${@approval_id})) leave_perecent,
       sdic_prj_approver_summary_pkg.get_approver_name(${@approval_id},
                                                       'agree') agree_name,
       sdic_prj_approver_summary_pkg.get_approver_name(${@approval_id},
                                                       'refuse') refuse_name,
       sdic_prj_approver_summary_pkg.get_approver_name(${@approval_id},
                                                       'discuss') discuss_name,
       sdic_prj_approver_summary_pkg.get_approver_name(${@approval_id},
                                                       'leave') leave_name
  FROM dual
            ]]></bm:query-sql>
        </bm:operation>
    </bm:operations>
</bm:model>
