<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author: wujun  
    $Date: 2016年11月17日16:00:00
    $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
                    *
                FROM
                    (SELECT
                        hpccr.change_req_id,
                        hpccr.change_req_number, --变更编号
                        cc.contract_number,      --支付表编号
                        cc.contract_name,        --支付表名称
                        cc.bp_id_tenant,
                        (SELECT hbm.bp_name FROM hls_bp_master hbm WHERE hbm.bp_id=cc.bp_id_tenant
                        ) bp_name, --承租人名称
                        cc.employee_id,
                        (SELECT ee.name FROM exp_employees ee WHERE ee.employee_id = cc.employee_id
                        ) manager,       --项目经理
                        hpccr.req_status --变更审批状态
                    FROM
                        hn_payment_cond_change_req hpccr,
                        hn_con_payment_con_hd hcpch,
                        con_contract cc
                    WHERE
                        hpccr.hd_id       = hcpch.hd_id AND
                        hcpch.contract_id = cc.contract_id AND
                        hpccr.req_status <> 'CANCEL'
                    ) t1 #WHERE_CLAUSE#
                ORDER BY
                    t1.change_req_number
            ]]></bm:query-sql>
        </bm:operation>
    </bm:operations>
    <bm:query-fields>
        <bm:query-field name="change_req_number" queryExpression="t1.change_req_number like &apos;%&apos;||${@change_req_number}||&apos;%&apos;"/>
        <bm:query-field name="contract_number" queryExpression="t1.contract_number like &apos;%&apos;||${@contract_number}||&apos;%&apos;"/>
        <bm:query-field name="contract_name" queryExpression="t1.contract_name like &apos;%&apos;||${@contract_name}||&apos;%&apos;"/>
        <bm:query-field name="bp_name" queryExpression="t1.bp_name like &apos;%&apos;||${@bp_name}||&apos;%&apos;"/>
        <bm:query-field name="manager" queryExpression="t1.manager like &apos;%&apos;||${@manager}||&apos;%&apos;"/>
        <bm:query-field name="req_status_n" queryExpression="t1.req_status like &apos;%&apos;||${@req_status}||&apos;%&apos;"/>
    </bm:query-fields>
</bm:model>
