<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author: chenlingfeng  
    $Date: 2017-5-25 下午3:09:26  
    $Revision: 1.0  
    $Purpose: 租赁业务模式分布情况表
-->
<bm:model xmlns:bm="http://www.leaf-framework.org/schema/bm">
    <bm:operations>
        <bm:operation name="query">
            <bm:query-sql><![CDATA[
                SELECT
                    t1.description,
                    t1.document_type_amount,
                    ROUND(t1.document_type_amount / t1.sum_amount, 4)*100 percentage
                FROM
                    (SELECT
                        hdt.description,
                        ROUND(hn_report_pkg.get_due_amount_balance(p_con_document_type => hdt.document_type, p_due_date_to => to_date(${@due_date_to},'yyyy-mm-dd')) / 100000000, 2) document_type_amount,
                        ROUND(hn_report_pkg.get_due_amount_balance(p_due_date_to => to_date(${@due_date_to},'yyyy-mm-dd')) / 100000000, 2) sum_amount
                    FROM
                        hls_document_type hdt
                    WHERE
                        hdt.document_category = 'CONTRACT' AND
                        hdt.business_type    IN ('LEASE', 'LEASEBACK') AND
                        hdt.enabled_flag      = 'Y'
                    ) t1
            ]]></bm:query-sql>
            <bm:parameters>
                <bm:parameter name="due_date_to"/>
            </bm:parameters>
        </bm:operation>
    </bm:operations>
</bm:model>
