<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author: gaoyang  
    $Date: 2013-9-30 下午02:37:53  
    $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 h.contract_id,
			       h.contract_number,
			       h.contract_name,
			       h.company_id,
		           h.lease_channel,
		           h.lease_organization,
			       con_aging_bucket_analysis_pkg.get_aging_bucket_forecast_amt(
            	   p_aging_bucket_id      => ${@aging_bucket_id},
                   p_aging_bucket_line_id => ${@aging_bucket_line_id},
                   p_contract_id          => h.contract_id,
                   p_analysis_date        => ${@analysis_date},
                   p_user_id              => ${/session/@user_id}) ${:@aging_bucket_id}
  				from con_contract h
  				#WHERE_CLAUSE#
          ]]></bm:query-sql>
        </bm:operation>
    </bm:operations>
    <bm:fields>
        <bm:field name="contract_id" databaseType="NUMBER" datatype="java.lang.Long" physicalName="CONTRACT_ID"/>
        <bm:field name="company_id" databaseType="NUMBER" datatype="java.lang.Long" physicalName="COMPANY_ID"/>
        <bm:field name="contract_number" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="CONTRACT_NUMBER"/>
        <bm:field name="contract_name" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="CONTRACT_NAME"/>
        <bm:field name="lease_channel" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="LEASE_CHANNEL"/>
        <bm:field name="lease_organization" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="LEASE_ORGANIZATION"/>
    </bm:fields>
    <bm:query-fields>
        <bm:query-field name="contract_number_from" queryExpression="h.contract_number &gt;= ${@contract_number_from}"/>
        <bm:query-field name="contract_number_to" queryExpression="h.contract_number &lt;= ${@contract_number_to}"/>
        <bm:query-field field="company_id" queryOperator="="/>
        <bm:query-field field="lease_channel" queryOperator="="/>
        <bm:query-field field="lease_organization" queryOperator="="/>
    </bm:query-fields>
</bm:model>
