<?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:model-query fetchAll="true" model="basic.hls_division_for_lov" rootPath="hls_division_path"/>
    </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="create_rent_trans_penalty_change_link" model="cont.CON7000.create_rent_trans_penalty_change" modelaction="execute"/>
        <script type="text/javascript"><![CDATA[
            function contractQueryScreen_query() {
                $('contractQueryScreen_mainDs').query();
            }
            
            function contractQueryScreen_reset() {
                $('contractQueryScreen_paraDs').reset();
            }
            
            function contractQueryScreen_add() {
                var records = $('contractQueryScreen_mainDs').getSelected();
                var record = records[0],
                    contract_id = record.get('contract_id');
                Leaf.showConfirm('特别注意', '<span style="color: #ff0000; ">该操作将导致合同在违约金调整期间无法进行后续操作，请谨慎操作！！！如果需要取消违约金调整，请一定点击取消按钮！！！</span>', function () {
                    Leaf.Masker.mask(Ext.getBody());
                    Leaf.request({
                        url: $('create_rent_trans_penalty_change_link').getUrl(),
                        para: {
                            contract_id: contract_id
                        },
                        success: function (res) {
                            Leaf.Masker.unmask(Ext.getBody());
                           var url = $('con_rent_trans_penalty_detail_link').getUrl();
                            var param = record.data;
                            param['record_id'] = res.result.record_id;
                            param['contract_id'] = contract_id;
                            param['function'] = 'CON7000';
                            param['winId'] = 'con_rent_trans_penalty_detail_link_winid';
                            new Leaf.Window({
                                id: 'con_rent_trans_penalty_detail_link_winid',
                                params:param,
                                url: url,
                                title: '罚息调整',
                                fullScreen: true
                            }).on('close',function(){
                                contractQueryScreen_query()
                            });
                        },
                        failure: function () {
                            Leaf.Masker.unmask(Ext.getBody());
                         //   $('et_create').enable(); //按钮启用
                        },
                        error: function () {
                            Leaf.Masker.unmask(Ext.getBody());
                          //  $('et_create').enable(); //按钮启用
                        },
                        scope: this
                    });
                }, function () {
                   // $('et_create').enable(); //按钮启用
                }, 300, 150);
            }
        ]]></script>
        <a:dataSets>
            <a:dataSet id="yes_or_no_ds" lookupCode="YES_NO"/>
            <a:dataSet id="contract_status_ds" lookupCode="CON500_CONTRACT_STATUS"/>
            <a:dataSet id="hls_division_ds">
                <a:datas dataSource="/model/hls_division_path"/>
            </a:dataSet>
            <a:dataSet id="contractQueryScreen_paraDs">
                <a:fields>
                    <a:field name="contract_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="division_n" displayField="description" options="hls_division_ds" returnField="division" valueField="division"/>
                    <a:field name="contract_status"/>
                    <a:field name="contract_status_desc" displayField="code_value_name" options="contract_status_ds" returnField="contract_status" valueField="code_value"/>
                </a:fields>
            </a:dataSet>
            <a:dataSet id="contractQueryScreen_mainDs" autoQuery="true" fetchAll="true" autoPageSize="true" model="cont.CON7000.con_rent_trans_penalty_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:gridButton id="et_create" click="contractQueryScreen_add" text="HLS.CREATE"/>
            </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="contract_name" bindTarget="contractQueryScreen_paraDs" prompt="合同名称"/>
                <a:lov name="bp_name" bindTarget="contractQueryScreen_paraDs" prompt="承租人名称"/>
                <a:comboBox name="division_n" bindTarget="contractQueryScreen_paraDs" prompt="租赁物"/>
            </a:form>
            <a:grid id="contractQueryScreen_mainDs_grid" bindTarget="contractQueryScreen_mainDs" marginHeight="130" marginWidth="40" navBar="true">
                <a:columns>
                    <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="division_n" prompt="租赁物" width="120" align="center"/>
                    <a:column name="lease_start_date"  prompt="起租日" width="120" align="center"/>
                    <a:column name="contract_status_n" prompt="合同状态" width="120" align="center"/>
                </a:columns>
            </a:grid>
        </a:screenBody>
    </a:view>
</a:screen>
