<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author: qianming  
    $Date: 2015-7-17 下午5:17:23  
    $Revision: 1.0  
    $Purpose: 合同保险信息维护
-->
<a:screen xmlns:a="http://www.leaf-framework.org/application">
    <a:view>
        <a:link id="con_contract_insurance_link_id" url="${/request/@context_path}/modules/cont/CON511/con_contract_insurance.lview"/>
        <script type="text/javascript"><![CDATA[
        	function bgfl_con_contract_insurance_v_query(){
        	    $('bgfl_con_contract_insurance_v_result_ds').query();
        	}
        	function bgfl_con_contract_insurance_v_reset(){
        	    $('bgfl_con_contract_insurance_v_query_ds').reset();
        	}
        	function bgfl_con_contract_insurance_v_modify(){
        	    open_window($('bgfl_con_contract_insurance_v_result_ds').getCurrentRecord().get('contract_id'),$('bgfl_con_contract_insurance_v_result_ds').getCurrentRecord().get('contract_number'));
        	}
        	function open_window(contract_id,contract_number){
        	    new Leaf.Window({
                    id: 'con_contract_insurance_win_id',
                    params: {
                        contract_id: contract_id,
                        contract_number:contract_number
                    },
                    url: $('con_contract_insurance_link_id').getUrl(),
                    title: '',
                    fullScreen: true
                }).on('close',bgfl_con_contract_insurance_v_query);
        	}
        	function bgfl_con_contract_insurance_v_render(value,record,name){
        	    if(name === 'edit'){
        	        return '<a href="javascript:open_window('+record.get('contract_id')+',\''+record.get('contract_number')+'\')">维护</a>';
        	    }
        	}
        	function bgfl_con_contract_insurance_v_save(){
        	    $('bgfl_con_contract_insurance_v_result_ds').submit();
        	}
		]]></script>
        <a:dataSets>
            <a:dataSet id="lease_item_insurance_way_ds">
                <a:datas>
                    <a:record name="first" value="承租人自保"/>
                    <a:record name="second" value="我司代为投保"/>
                    <a:record name="third" value="不投保"/>
                </a:datas>
            </a:dataSet>
            <a:dataSet id="lease_item_insurance_party_ds">
                <a:datas>
                    <a:record name="first_party" value="我司支付"/>
                    <a:record name="second_party" value="代收代付"/>
                    <a:record name="third_party" value="--"/>
                </a:datas>
            </a:dataSet>
            <a:dataSet id="bgfl_con_contract_insurance_v_query_ds" autoCreate="true">
                <a:fields>
                    <a:field name="bp_id"/>
                    <a:field name="bp_name" lovHeight="500" lovLabelWidth="110" lovService="cont.CON511.hls_bp_master_for_lov?bp_category=TENANT" lovWidth="650">
                        <a:mapping>
                            <a:map from="bp_name" to="bp_name"/>
                            <a:map from="bp_id" to="bp_id"/>
                        </a:mapping>
                    </a:field>
                    <a:field name="unit_id"/>
                    <a:field name="unit_name" lovHeight="500" lovService="cont.CON511.exp_org_unit_for_lov?org_unit_type=SALES" lovWidth="600">
                        <a:mapping>
                            <a:map from="unit_name" to="unit_name"/>
                            <a:map from="unit_id" to="unit_id"/>
                        </a:mapping>
                    </a:field>
                    <a:field name="lease_item_insurance_way_n" displayField="value" options="lease_item_insurance_way_ds" returnField="lease_item_insurance_way" valueField="name"/>
                    <a:field name="lease_item_insurance_party_n" displayField="value" options="lease_item_insurance_party_ds" returnField="lease_item_insurance_party" valueField="name"/>
                    <a:field name="insurace_end_days"/>
                </a:fields>
            </a:dataSet>
            <a:dataSet id="bgfl_con_contract_insurance_v_result_ds" autoPageSize="true" autoQuery="true" model="cont.CON511.bgfl_con_contract_insurance_v" queryDataSet="bgfl_con_contract_insurance_v_query_ds" selectable="true" selectionModel="single"/>
        </a:dataSets>
        <a:screenBody>
            <a:screenTopToolbar>
                <a:screenTitle/>
                <a:gridButton click="bgfl_con_contract_insurance_v_query" text="HLS.QUERY"/>
                <a:gridButton click="bgfl_con_contract_insurance_v_reset" text="HLS.RESET"/>
                <a:gridButton click="bgfl_con_contract_insurance_v_save" text="HLS.SAVE"/>
                <a:gridButton click="bgfl_con_contract_insurance_v_modify" text="HLS.MODIFY"/>
            </a:screenTopToolbar>
            <a:form column="4" labelWidth="110" marginWidth="35" title="HLS.QUERY_TITLE">
                <a:textField name="contract_number" bindTarget="bgfl_con_contract_insurance_v_query_ds" prompt="合同编号" typeCase="true"/>
                <a:lov name="bp_name" bindTarget="bgfl_con_contract_insurance_v_query_ds" prompt="承租人"/>
                <a:lov name="unit_name" bindTarget="bgfl_con_contract_insurance_v_query_ds" prompt="负责部门"/>
                <a:numberField name="insurace_end_days" allowDecimals="false" allowNegative="false" bindTarget="bgfl_con_contract_insurance_v_query_ds" prompt="&lt;font color=&apos;red&apos;&gt;保费到期预警天数"/>
                <a:datePicker name="lease_end_date_from" bindTarget="bgfl_con_contract_insurance_v_query_ds" prompt="租赁计划结束日从"/>
                <a:datePicker name="lease_end_date_to" bindTarget="bgfl_con_contract_insurance_v_query_ds" prompt="租赁计划结束日至"/>
                <a:comboBox name="lease_item_insurance_way_n" bindTarget="bgfl_con_contract_insurance_v_query_ds" prompt="投保方式"/>
                <a:comboBox name="lease_item_insurance_party_n" bindTarget="bgfl_con_contract_insurance_v_query_ds" prompt="保费来源"/>
                <a:numberField name="lease_item_insurance_term_from" allowDecimals="false" allowNegative="false" bindTarget="bgfl_con_contract_insurance_v_query_ds" prompt="保费收取期数从"/>
                <a:numberField name="lease_item_insurance_term_to" allowDecimals="false" allowNegative="false" bindTarget="bgfl_con_contract_insurance_v_query_ds" prompt="保费收取期数至"/>
                <a:datePicker name="max_insurance_date_to_from" bindTarget="bgfl_con_contract_insurance_v_query_ds" prompt="保险到期日从"/>
                <a:datePicker name="max_insurance_date_to_to" bindTarget="bgfl_con_contract_insurance_v_query_ds" prompt="保险到期日至"/>
            </a:form>
            <a:grid id="bgfl_con_contract_insurance_v_grid_id" bindTarget="bgfl_con_contract_insurance_v_result_ds" marginHeight="220" marginWidth="35" navBar="true">
                <a:columns>
                    <a:column name="contract_number" lock="true" prompt="合同编号" width="120"/>
                    <a:column name="bp_name" lock="true" prompt="承租人" showTitle="true" width="180"/>
                    <a:column name="contract_status_n" align="center" prompt="合同状态" width="100"/>
                    <a:column name="unit_name" prompt="负责部门" showTitle="true" width="100"/>
                    <a:column name="lease_end_date" align="center" prompt="租赁计划结束日期" width="100"/>
                    <a:column name="lease_item_insurance_way_n" prompt="投保形式" width="100"/>
                    <a:column name="lease_item_insurance_party_n" prompt="保费来源" width="100"/>
                    <a:column name="lease_item_insurance_term" align="center" prompt="保费收取期限(按月)" width="120"/>
                    <a:column name="max_insurance_date_to" align="center" prompt="保险到期日" renderer="Leaf.formatDate" width="80"/>
                    <a:column name="lease_item_insurance_note" editor="bgfl_con_contract_insurance_v_tf_id" prompt="备注" showTitle="true" width="180"/>
                    <a:column name="edit" align="center" prompt="投保" renderer="bgfl_con_contract_insurance_v_render" width="60"/>
                </a:columns>
                <a:editors>
                    <a:textField id="bgfl_con_contract_insurance_v_tf_id"/>
                </a:editors>
            </a:grid>
        </a:screenBody>
    </a:view>
</a:screen>
