<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author: hty
    $Date: 2018/5/17 21:49
    $Revision: 1.0 
-->
<bm:model xmlns:bm="http://www.leaf-framework.org/schema/bm" needAccessControl="false">
    <bm:operations>
        <bm:operation name="query">
            <bm:query-sql>
                <![CDATA[
                    SELECT
                        SUM (NVL(ccc.due_amount, 0)) sumDueAmount,
                        SUM (NVL(ccc.principal, 0)) sumPrincipal,
                        SUM (NVL(ccc.interest, 0)) sumInterest,
                        ccc.due_date
                    FROM
                        con_contract_cashflow ccc
                    WHERE
                        ccc.cf_item = '1'
                    AND ccc.cf_type = 1
                    AND ccc.due_date IS NOT NULL
                    AND TO_CHAR (CCC.DUE_DATE, 'yyyy') = TO_CHAR (SYSDATE, 'yyyy')
                    AND EXISTS (
                        SELECT
                            1
                        FROM
                            con_contract cc
                        WHERE
                            ccc.contract_id = cc.contract_id
                        AND cc.contract_status = 'INCEPT'
                    )
                    GROUP BY
                        ccc.due_date
                    ORDER BY
                        ccc.due_date
                ]]></bm:query-sql>
        </bm:operation>
    </bm:operations>
    <bm:fields>
        <bm:field name="sumDueAmount" databaseType="NUMBER" datatype="java.lang.Double" forDisplay="true" forQuery="true" physicalName="sumDueAmount" prompt="员工号"/>
        <bm:field name="sumPrincipal" databaseType="NUMBER" datatype="java.lang.Double" forDisplay="true" forQuery="true" physicalName="sumPrincipal" prompt="名称"/>
        <bm:field name="sumInterest" databaseType="NUMBER" datatype="java.lang.Double" forDisplay="true" physicalName="sumInterest" prompt="邮箱地址"/>
        <bm:field name="due_date" databaseType="DATE" datatype="java.util.Date" forDisplay="true" physicalName="due_date" prompt="邮箱地址"/>

    </bm:fields>
</bm:model>