<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author: niminmin
    $Date: 2020-6-24
    $Revision: 1.0  
    $Purpose: 会计核销租金转罚维护入口页面
-->
<a:screen xmlns:a="http://www.leaf-framework.org/application" trace="true">
    <a:init-procedure>
    </a:init-procedure>
    <a:view>
        <a:link id="con_rent_trans_penalty_detail_link"
                url="${/request/@context_path}/modules/cont/CON7000/con_rent_trans_penalty_create_detail.lview"/>
        <a:link id="con_rent_trans_penalty_detail_readonly_link"
                url="${/request/@context_path}/modules/cont/CON7000/con_rent_trans_penalty_create_detail_readonly.lview"/>
        <script type="text/javascript"><![CDATA[
        function contractQueryScreen_query() {
            $('contractQueryScreen_mainDs').query();
        }

        function contractQueryScreen_reset() {
            $('contractQueryScreen_paraDs').reset();
        }

        function seedetail_apply_num(value, record, name) {
            if (record.get('record_id')) {
                var url;
                if (record.get('status') == 'NEW') {
                    url = $('con_rent_trans_penalty_detail_link').getUrl() + '?record_id=' + record.get('record_id') + '&contract_id=' + record.get('contract_id');
                } else {
                    url = $('con_rent_trans_penalty_detail_readonly_link').getUrl() + '?record_id=' + record.get('record_id') + '&contract_id=' + record.get('contract_id');
                }
                return '<a href="javascript:openWindow(\'' + url + '\');">' + value + '</a>';
            }
        }

        function openWindow(url) {
            new Leaf.Window({
                id: 'con_rent_trans_penalty_detail_link_winid',
                params: {
                    function: 'CON7001',
                    winId: 'con_rent_trans_penalty_detail_link_winid'
                },
                url: url,
                title: '违约金调整维护',
                fullScreen: true
            }).on('close', function () {
                contractQueryScreen_query();
            });
        }

        ]]></script>
        <a:dataSets>
            <a:dataSet id="yes_or_no_ds" lookupCode="YES_NO"/>
            <a:dataSet id="apply_status_ds">
                <a:datas>
                    <a:record code_value="NEW" code_value_name="新建"/>
                    <a:record code_value="CANCEL" code_value_name="取消"/>
                    <a:record code_value="REJECT" code_value_name="审批拒绝"/>
                    <a:record code_value="APPROVED" code_value_name="审批通过"/>
                    <a:record code_value="APPROVING" code_value_name="审批中"/>
                </a:datas>
            </a:dataSet>
            <a:dataSet id="contractQueryScreen_paraDs">
                <a:fields>
                    <a:field name="contract_number" typeCase="upper"/>
                    <a:field name="apply_number" typeCase="upper"/>
                    <a:field name="contract_name"/>
                    <a:field name="date_from"/>
                    <a:field name="date_to"/>
                    <a:field name="bp_id_tenant"/>
                    <a:field name="bp_name" lovGridHeight="330" lovHeight="470" lovLabelWidth="120"
                             lovService="cont.CON701.hls_bp_master_v_all_lov?bp_category=TENANT" lovWidth="700"
                             title="承租人">
                        <a:mapping>
                            <a:map from="bp_id" to="bp_id_tenant"/>
                            <a:map from="bp_name" to="bp_name"/>
                        </a:mapping>
                    </a:field>
                    <!--代理商-->
                    <a:field name="bp_id_agent_level1"/>
                    <a:field name="bp_agent" lovGridHeight="330" lovHeight="470" lovLabelWidth="120"
                             lovService="cont.CON701.hls_bp_master_v_all_lov?bp_category=AGENT" lovWidth="700"
                             title="代理商">
                        <a:mapping>
                            <a:map from="bp_id" to="bp_id_agent_level1"/>
                            <a:map from="bp_name" to="bp_agent"/>
                        </a:mapping>
                    </a:field>

                    <a:field name="status"/>
                    <a:field name="status_n" displayField="code_value_name" options="apply_status_ds"
                             returnField="status" valueField="code_value"/>
                </a:fields>
            </a:dataSet>
            <a:dataSet id="contractQueryScreen_mainDs" autoQuery="true" fetchAll="true" autoPageSize="true"
                       model="cont.CON7001.con_rent_trans_penalty_modify_query"
                       queryDataSet="contractQueryScreen_paraDs" selectable="true" selectionModel="single">
            </a:dataSet>
        </a:dataSets>
        <a:screenBody>
            <a:screenTopToolbar>
                <a:screenTitle/>
                <a:gridButton click="contractQueryScreen_query" text="HLS.QUERY"/>
                <a:gridButton click="contractQueryScreen_reset" text="HLS.RESET"/>
            </a:screenTopToolbar>
            <a:form column="4" labelWidth="100" marginWidth="40" title="HLS.QUERY_TITLE">
                <a:textField name="contract_number" bindTarget="contractQueryScreen_paraDs" prompt="合同编号"/>
                <a:textField name="apply_number" bindTarget="contractQueryScreen_paraDs" prompt="申请编号"/>
                <a:textField name="contract_name" bindTarget="contractQueryScreen_paraDs" prompt="合同名称"/>
                <a:lov name="bp_name" bindTarget="contractQueryScreen_paraDs" prompt="承租人"/>
                <a:lov name="bp_agent" bindTarget="contractQueryScreen_paraDs" prompt="代理店"/>
                <a:comboBox name="status_n" bindTarget="contractQueryScreen_paraDs" prompt="申请状态"/>

            </a:form>
            <a:grid id="contractQueryScreen_mainDs_grid" bindTarget="contractQueryScreen_mainDs" marginHeight="150"
                    marginWidth="40" navBar="true">
                <a:columns>
                    <a:column name="apply_number" prompt="申请编号" width="120" align="center"
                              renderer="seedetail_apply_num"/>
                    <a:column name="contract_number" prompt="合同编号" width="120" align="center"/>
                    <a:column name="contract_name" prompt="合同名称" width="340" align="center"/>
                    <a:column name="bp_name" prompt="承租人名称" width="200" align="center"/>
                    <a:column name="bp_agent" prompt="代理店" width="200" align="center"/>
                    <a:column name="lease_start_date" prompt="起租日" width="120" align="center"/>
                    <a:column name="status_n" prompt="申请状态" width="120" align="center"/>
                </a:columns>
            </a:grid>
        </a:screenBody>
    </a:view>
</a:screen>
