<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author: hp  
    $Date: 2015-2-15 上午10:22:47  
    $Revision: 1.0  
    $Purpose: 
-->
<bm:model xmlns:bm="http://www.leaf-framework.org/schema/bm" alias="t1" needAccessControl="false">
    <bm:operations>
        <bm:operation name="query">
            <bm:query-sql><![CDATA[
                SELECT
                    *
                FROM
                    (SELECT
                        nvl(substr(to_char(cc.termination_date, 'yyyy-mm'), 0, 7),'##')  termination_date,
                        COUNT(1) total_quantity
                    FROM
                        con_contract cc
                    WHERE
                        1             = 1 AND
                        cc.data_class = 'NORMAL' AND 
                        cc.contract_status = 'TERMINATE'
                        and nvl(cc.hd_user_col_v10,'N') = 'N'
                        and cc.division  in ('20')
                    GROUP BY
                        nvl(substr(to_char(cc.termination_date, 'yyyy-mm'), 0, 7),'##') 
                    ORDER BY
                        nvl(substr(to_char(cc.termination_date, 'yyyy-mm'), 0, 7),'##')  ASC
                    ) t1
                WHERE
                    t1.termination_date >= NVL(${@from_termination_date},t1.termination_date) AND
                    t1.termination_date <= NVL(${@to_termination_date},t1.termination_date)
            ]]></bm:query-sql>
        </bm:operation>
    </bm:operations>
    <bm:fields>
        <bm:field name="termination_date"/>
        <bm:field name="total_quantity"/>
    </bm:fields>
</bm:model>
