<?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>
        <script type="text/javascript"><![CDATA[
        Leaf.onReady(function(){
            var winId = '${/parameter/@winId}';
            if(!winId){
                /*Ext.fly('con7000_back_id').setStyle({
                    display: 'none'
                });*/
                $('con7000_back_id').hide();
            }
        });

        function con7000_back() {
            if('${/parameter/@winId}'){
                $('${/parameter/@winId}').close();
            }
        }
        function con7000_csh_write_off_ds_load(ds) {
            var records = ds.getAll();
            if(records.length){
                records.forEach(function(v,i){
                    if(v.data.trans_pently_flag == 'Y'){
                        setTimeout(function() {
                            ds.select(v);
                        }, 1);
                    }
                });
            }
        }
        function con7000_csh_write_off_ds_beforeselect(ds, record) {
            if(record.get('trans_pently_flag') == 'N'){
                return false;
            }else{
                return true;
            }
        }
        function con7000_csh_write_off_ds_unselect(ds, record) {
            return false;
        }
        ]]></script>
        <a:dataSets>
            <a:dataSet id="con_rent_trans_penalty_hd_ds" autoPageSize="true" autoQuery="true"
                       model="cont.CON7001.con_rent_trans_penalty_modify_query"
                       queryUrl="${/request/@context_path}/autocrud/cont.CON7001.con_rent_trans_penalty_modify_query/query?record_id=${/parameter/@record_id}">
            </a:dataSet>
            <a:dataSet id="con7000_csh_write_off_ds" autoPageSize="true" autoQuery="true"
                       model="cont.CON7001.con_rent_trans_penalty_csh_write_off"
                       queryUrl="${/request/@context_path}/autocrud/cont.CON7001.con_rent_trans_penalty_csh_write_off/query?contract_id=${/parameter/@contract_id}&amp;record_id=${/parameter/@record_id}"
                       selectable="true" showCheckAll="false">
                <a:events>
                    <a:event name="load" handler="con7000_csh_write_off_ds_load"/>
                    <a:event name="beforeselect" handler="con7000_csh_write_off_ds_beforeselect"/>
                    <a:event name="unselect" handler="con7000_csh_write_off_ds_unselect"/>
                </a:events>
            </a:dataSet>
            <a:dataSet id="con7000_gld_write_off_ds" autoPageSize="true" autoQuery="true"
                       model="cont.CON7001.con_rent_trans_penalty_gld_write_off"
                       queryUrl="${/request/@context_path}/autocrud/cont.CON7001.con_rent_trans_penalty_gld_write_off/query?record_id=${/parameter/@record_id}"/>
        </a:dataSets>
        <a:screenBody>
            <a:screenTopToolbar>
                <a:gridButton id="con7000_back_id" click="con7000_back" text="HLS.EXIT"/>
            </a:screenTopToolbar>
            <a:form labelWidth="100" marginWidth="200" title="合同信息">
                <a:box column="4" labelWidth="115">
                    <a:textField name="apply_number" prompt="申请编号" readOnly="true"
                                 bindTarget="con_rent_trans_penalty_hd_ds"/>
                    <a:textField name="contract_number" prompt="合同编号" readOnly="true"
                                 bindTarget="con_rent_trans_penalty_hd_ds"/>
                    <a:textField name="contract_name" prompt="合同名称" readOnly="true"
                                 bindTarget="con_rent_trans_penalty_hd_ds"/>
                    <a:textField name="bp_name" prompt="承租人名称" readOnly="true"
                                 bindTarget="con_rent_trans_penalty_hd_ds"/>
                </a:box>
                <a:box column="3" labelWidth="115">
                    <a:textField name="bp_agent" prompt="代理店" readOnly="true"
                                 bindTarget="con_rent_trans_penalty_hd_ds"/>
                    <a:textField name="apply_date" prompt="申请时间" readOnly="true"
                                 bindTarget="con_rent_trans_penalty_hd_ds"/>
                    <a:textField name="applyer" prompt="申请人" readOnly="true" bindTarget="con_rent_trans_penalty_hd_ds"/>
                </a:box>
                <a:box column="1">
                    <a:textArea name="description" bindTarget="con_rent_trans_penalty_hd_ds" prompt="变更理由及说明"
                                marginWidth="300" readOnly="true"/>
                </a:box>
            </a:form>
            <a:tabPanel marginHeight="150" marginWidth="170">
                <a:tabs>
                    <a:tab prompt="营业违约金核销明细" width="150">
                        <a:grid id="con7000_csh_write_off_grid" bindTarget="con7000_csh_write_off_ds" marginHeight="130"
                                marginWidth="200" navBar="true">
                            <a:columns>
                                <a:column name="times" prompt="回数" width="70" align="center"/>
                                <a:column name="due_date" prompt="预定支付日" width="120" align="center"
                                          renderer="Leaf.formatDate"/>
                                <a:column name="due_amount" prompt="应收金额" width="100" align="right"/>
                                <a:column name="cf_item_n" prompt="应收项目" width="100" align="center"/>
                                <a:column name="transaction_type" prompt="收款类型" width="120" align="center"/>
                                <a:column name="transaction_date" prompt="实际收款日" width="120" align="center"/>
                                <a:column name="transaction_num" prompt="现金事务编号" width="120" align="center"/>
                                <a:column name="write_off_date" prompt="核销日期" width="120" align="center"/>
                                <a:column name="received_amount" prompt="实收金额" width="120" align="center"/>
                                <a:column name="unreceived_amount" prompt="未收金额" width="116" align="center"/>
                            </a:columns>
                        </a:grid>
                    </a:tab>
                </a:tabs>
            </a:tabPanel>
            <a:tabPanel marginHeight="150" marginWidth="170">
                <a:tabs>
                    <a:tab prompt="营业违-对应-会计核销明细" width="180">
                        <a:grid id="con7000_gld_write_off_grid" bindTarget="con7000_gld_write_off_ds" marginHeight="200"
                                marginWidth="200" navBar="true">
                            <a:columns>
                                <a:column name="gld_times" prompt="回数" width="120" align="center"/>
                                <a:column name="gld_cf_item" prompt="应收项目" width="340" align="center"/>
                                <a:column name="gld_write_off_amount" prompt="会计核销金额" width="200" align="center"/>
                            </a:columns>
                        </a:grid>
                    </a:tab>
                </a:tabs>
            </a:tabPanel>
        </a:screenBody>
    </a:view>
</a:screen>
