<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author: Foreinyel  
    $Date: 2014-4-29 上午9:11:34  
    $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 rownum rownums,v.* from(
                SELECT
                    cr.colpay_id,
                    cr.contract_id,
                    cl.contract_number,
                    cr.colpay_number,
                    cl.contract_name,
                    cl.employee_id_n,
                    cl.contract_status_n,
                    cl.bp_id_tenant,
                    cl.bp_id_tenant_n,
                    cl.company_id,
                    cl.lease_start_date,
                    cl.project_id_c,
                    cl.employee_id,
                    cl.lease_organization,
                    cl.lease_organization_n,
                    cl.document_type,
                    cl.contract_status,
                    cl.finance_amount,
                    to_char(cr.colpay_date,'yyyy-mm-dd')colpay_date,
                    cr.colpay_status,
                    (select code_value_name from sys_code_values_v cv where cv.code = 'CON763_AUDITION_STATUS' and cv.code_value = cr.colpay_status)colpay_status_n,
                    cr.fee_type,
                    (select ci.cf_item_desc from hls_cashflow_item_v ci where ci.cf_item = cr.fee_type)fee_type_desc,
                    cr.note,
                    cr.amount,
                    cr.submitter
                FROM
                    con_contract_colpay_req cr,
                    con_contract_lv cl
                where cl.contract_id = cr.contract_id
                    
                order by cr.colpay_id asc
                )v
                #WHERE_CLAUSE#
            ]]></bm:query-sql>
        </bm:operation>
    </bm:operations>
    <bm:query-fields>
        <bm:query-field name="contract_id" queryExpression="v.contract_id = ${@contract_id}"/>
        <bm:query-field name="contract_number" queryExpression="v.contract_number = ${@contract_number}"/>
        <bm:query-field name="contract_name" queryExpression="v.contract_name like ${@contract_name}"/>
        <bm:query-field name="lease_start_date_from" queryExpression="v.lease_start_date &gt;= to_date(${@lease_start_date_from},&apos;yyyy-mm-dd&apos;)"/>
        <bm:query-field name="lease_start_date_to" queryExpression="v.lease_start_date &lt;= to_date(${@lease_start_date_to},&apos;yyyy-mm-dd&apos;)"/>
        <bm:query-field name="bp_id_tenant" queryExpression="v.bp_id_tenant = ${@bp_id_tenant}"/>
        <bm:query-field name="project_number" queryExpression="v.project_id_c = ${@project_number}"/>
        <bm:query-field name="employee_id" queryExpression="v.employee_id = ${@employee_id}"/>
        <bm:query-field name="lease_organozation" queryExpression="v.lease_organozation = ${@lease_organozation}"/>
        <bm:query-field name="document_type" queryExpression="v.document_type = ${@document_type}"/>
        <bm:query-field name="contract_status" queryExpression="v.contract_status = ${@contract_status}"/>
        <bm:query-field name="finance_amount_from" queryExpression="v.finance_amount &gt;= ${@finance_amount_from}"/>
        <bm:query-field name="finance_amount_to" queryExpression="v.finance_amount &lt; = ${@finance_amount_to}"/>
        <bm:query-field name="fee_type" queryExpression="v.fee_type = ${@fee_type}"/>
        <bm:query-field name="colpay_status" queryExpression="v.colpay_status = ${@colpay_status}"/>
        <bm:query-field name="sys_user" queryExpression="v.submitter = ${@sys_user}"/>
        <bm:query-field name="colpay_number" queryExpression="v.colpay_number = ${@colpay_number}"/>
    </bm:query-fields>
</bm:model>
