<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author: zhangxing5129  
    $Date: 2015-11-12 下午03:25:51  
    $Revision: 1.0  
    $Purpose: 其他数据
-->
<bm:model xmlns:bm="http://www.leaf-framework.org/schema/bm" needAccessControl="false">
    <bm:operations>
        <bm:operation name="query">
            <bm:query-sql><![CDATA[
                SELECT
                    (SELECT
                        COUNT(1)
                    FROM
                        (SELECT
                            *
                        FROM
                            (SELECT
                                b.contract_id,
                                b.contract_number,
                                b.bp_id_tenant,
                                b.bp_id_tenant_n,
                                MAX(a.due_date) last_date,
                                MAX(a.due_date) - TRUNC(sysdate) days
                            FROM
                                con_contract_cashflow a,
                                con_contract_lv b
                            WHERE
                                a.contract_id     = b.contract_id AND
                                b.data_class      = 'NORMAL' AND
                                a.cf_type         = 1 AND
                                b.contract_status = 'INCEPT'
                            GROUP BY
                                b.contract_id,
                                b.contract_number,
                                b.bp_id_tenant,
                                b.bp_id_tenant_n
                            )
                        WHERE
                            days <= 15
                        )
                    ) contract_warn_count
                    -- yonda_to_do_list_pkg.untransact_insurance_count(p_company_id => 1) untransact_insurance_count,
                    --yonda_to_do_list_pkg.insurance_continue_count(p_company_id => 1) insurance_continue_count
                FROM
                    dual
            ]]></bm:query-sql>
        </bm:operation>
    </bm:operations>
</bm:model>
