<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author: sf
    $Date: 2019-10-20 下午03:50:31
    $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
                    --应付我司开户名
                     (SELECT hbbc.bank_full_name
                        FROM hls_bp_master_bank_account hbbc
                        WHERE hbbc.bank_account_id=V.bp_bank_account_id
                       ) agent_bank_name,
                       --代理商名称
                       (SELECT bp_name
                          FROM hls_bp_master hbm,hls_bp_master_bank_account hbbc
                          WHERE hbm.bp_id = hbbc.bp_id
                             AND hbbc.bank_account_id=v.bp_bank_account_id) agent_name,
                     --应付我司开户行
                     (SELECT HBBc.bank_account_name
                        FROM HLS_BP_MASTER_BANK_ACCOUNT HBBC
                       WHERE HBBC.BANK_ACCOUNT_ID = V.BP_BANK_ACCOUNT_ID) agent_account_name,
                     --应付我司开户账号
                     (SELECT HBBC.BANK_ACCOUNT_NUM
                        FROM HLS_BP_MASTER_BANK_ACCOUNT HBBC
                       WHERE HBBC.BANK_ACCOUNT_ID = V.BP_BANK_ACCOUNT_ID) AGENT_BANK_NUM,
                     --厂商开户名
                     (SELECT hbbc.bank_account_name
                        FROM hls_bp_master_bank_account hbbc
                        WHERE hbbc.bank_account_id=v.vender_bank_account_id
                       )  vender_account_name,
                     --厂商开户行
                     (SELECT hbbc.bank_full_name
                        FROM hls_bp_master_bank_account hbbc
                        WHERE hbbc.bank_account_id=v.vender_bank_account_id
                       ) vender_bank_name,
                     --厂商名称
                     (SELECT bp_name
                        FROM hls_bp_master hbm,hls_bp_master_bank_account hbbc
                        WHERE hbm.bp_id=hbbc.bp_id
                          AND  hbbc.bank_account_id=V.vender_bank_account_id) vender_name,
                     --应付我司开户账号
                     (SELECT HBBC.BANK_ACCOUNT_NUM
                        FROM HLS_BP_MASTER_BANK_ACCOUNT HBBC
                       WHERE HBBC.BANK_ACCOUNT_ID = V.VENDER_BANK_ACCOUNT_ID) VENDER_BANK_NUM,
                      ( to_char(SYSDATE,'yyyy')||'年'||to_char(SYSDATE,'mm')||'月'||to_char(SYSDATE,'dd')||'日') current_date

                      FROM CSH_PAYMENT_REQ_LN V
                      #WHERE_CLAUSE#

                   --  WHERE V.PAYMENT_REQ_ID = 2512561  AND ROWNUM <= 1



                ]]></bm:query-sql>
        </bm:operation>
    </bm:operations>
    <bm:data-filters>
        <bm:data-filter enforceOperations="query" expression="v.payment_req_id =${@payment_req_id}"/>
    </bm:data-filters>
  <!--  <bm:query-fields>
        <bm:query-field name="payment_req_id" queryOperator="="/>
    </bm:query-fields>-->

</bm:model>
