<?xml version="1.0" encoding="UTF-8"?>
<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 hn_cond_change_approver t1
          WHERE t1.approval_id = ${@approval_id}
            AND t1.approve_status = 'agree') || '/' ||
       (SELECT COUNT(1)
           FROM hn_cond_change_approver t1
          WHERE t1.approval_id = ${@approval_id})) agree_perecent,
       ((SELECT COUNT(1)
           FROM hn_cond_change_approver t1
          WHERE t1.approval_id = ${@approval_id}
            AND t1.approve_status = 'refuse') || '/' ||
       (SELECT COUNT(1)
           FROM hn_cond_change_approver t1
          WHERE t1.approval_id = ${@approval_id})) refuse_perecent,
       ((SELECT COUNT(1)
           FROM hn_cond_change_approver t1
          WHERE t1.approval_id = ${@approval_id}
            AND t1.approve_status = 'discuss') || '/' ||
       (SELECT COUNT(1)
           FROM hn_cond_change_approver t1
          WHERE t1.approval_id = ${@approval_id})) discuss_perecent,
       ((SELECT COUNT(1)
           FROM hn_cond_change_approver t1
          WHERE t1.approval_id = ${@approval_id}
            AND t1.approve_status = 'leave') || '/' ||
       (SELECT COUNT(1)
           FROM hn_cond_change_approver t1
          WHERE t1.approval_id = ${@approval_id})) leave_perecent,
       hn_csh_payment_req_pkg.get_approver_name(${@approval_id},
                                                       'agree') agree_name,
       hn_csh_payment_req_pkg.get_approver_name(${@approval_id},
                                                       'refuse') refuse_name,
       hn_csh_payment_req_pkg.get_approver_name(${@approval_id},
                                                       'discuss') discuss_name,
       hn_csh_payment_req_pkg.get_approver_name(${@approval_id},
                                                       'leave') leave_name
  FROM dual
            ]]></bm:query-sql>
        </bm:operation>
    </bm:operations>
</bm:model>
