<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author: ZLF  
    $Date: 2014-11-17 下午7:42:52  
    $Revision: 1.0  
    $Purpose: 
-->
<a:screen xmlns:a="http://www.leaf-framework.org/application">
    <a:init-procedure>
        <a:model-query model="cont.CON620.get_contract_info" rootPath="contract"/>
        <a:model-query model="cont.CON620.get_tenant_info" rootPath="tenant"/>
        <a:model-query model="cont.CON620.get_sysdate" rootPath="sysdate"/>
        <a:model-query model="cont.CON620.get_dun_person_record" rootPath="dun_info"/>
    </a:init-procedure>
    <a:view>
        <script type="text/javascript"><![CDATA[
    	function close()
    	{
    		$('con_dun_record_window').close();
    		$('CON620_contract_result_ds').query();
    	}
    	
    	function onUpdate_unit_idDs(ds,record,name,value,oldValue)
            {
                /* if(name=='dun_unit_id_desc')
                {
                    record.set('dun_person_id_desc','');
                    record.set('dun_person_id','');
                    record.getField('dun_person_id_desc').setLovPara('unit_id',record.get('dun_unit_id'));
                } */
                if(name == 'dun_unit_id')
                {
                 	record.set('dun_person_id_desc','');
                    record.set('dun_person_id','');
                    record.getField('dun_person_id_desc').setLovPara('unit_id',value); 
                }
            }
            
            
    ]]></script>
        <a:dataSets>
            <a:dataSet id="unit_ds" autoCount="false" fetchAll="true" loadData="true" model="exp.EXP1020.exp_org_position_unit_select"/>
            <a:dataSet id="lookup_ds" lookupCode="CONTACT_WAYS"/>
            <a:dataSet id="contract_ds" autoCreate="true">
                <a:fields>
                    <a:field name="contract_id" defaultValue="${/model/contract/record/@contract_id}"/>
                </a:fields>
            </a:dataSet>
            <a:dataSet id="CON601_contract_dun_record_ds" autoQuery="true" model="cont.CON620.con_dun_record_for_query" queryDataSet="contract_ds">
                <a:fields>
                    <a:field name="contact_ways_desc" displayField="code_value_name" options="lookup_ds" returnField="contact_ways" valueField="code_value"/>
                    <a:field name="bp_id_tenant_desc" defaultValue="${/model/contract/record/@bp_id_tenant_desc}"/>
                    <a:field name="contract_number" defaultValue="${/model/contract/record/@contract_number}"/>
                    <a:field name="bp_id_agent_desc" defaultValue="${/model/contract/record/@bp_id_agent_desc}"/>
                    <a:field name="contract_id" defaultValue="${/model/contract/record/@contract_id}"/>
                    <a:field name="contact_date" defaultValue="${/model/sysdate/record/@sys_date}"/>
                    <a:field name="dun_unit_id_desc" defaultValue="${/model/dun_info/record/@unit_id_desc}"/>
                    <a:field name="dun_person_id_desc" defaultValue="${/model/dun_info/record/@employee_id_desc}"/>
                    <a:field name="dun_person_id" defaultValue="${/model/dun_info/record/@employee_id}"/>
                    <a:field name="dun_unit_id" defaultValue="${/model/dun_info/record/@unit_id}"/>
                    <a:field name="contact_person" defaultValue="${/model/tenant/record/@contact_person}"/>
                    <a:field name="phone" defaultValue="${/model/tenant/record/@phone}"/>
                    <a:field name="phone_extra" defaultValue="${/model/tenant/record/@phone_extra}"/>
                    <a:field name="cell_phone" defaultValue="${/model/tenant/record/@cell_phone}"/>
                    <a:field name="fax_number" defaultValue="${/model/tenant/record/@fax_number}"/>
                    <a:field/>
                    <a:field name="dun_unit_id_desc" displayField="org_unit_description_display" options="unit_ds" returnField="dun_unit_id" valueField="unit_id"/>
                    <a:field name="dun_person_id_desc" lovGridHeight="350" lovHeight="500" lovService="cont.CON620.exp_emp_assign_e_v" lovWidth="500">
                        <a:mapping>
                            <a:map from="employee_id" to="dun_person_id"/>
                            <a:map from="employee_name2" to="dun_person_id_desc"/>
                        </a:mapping>
                    </a:field>
                    <a:field name="dun_unit_id"/>
                </a:fields>
                <a:events>
                    <a:event name="update" handler="onUpdate_unit_idDs"/>
                </a:events>
            </a:dataSet>
        </a:dataSets>
        <a:screenBody>
            <a:screenTopToolbar>
                <a:screenTitle/>
                <a:gridButton click="close" text="关闭"/>
            </a:screenTopToolbar>
            <a:grid id="CON601_contract_dun_record" bindTarget="CON601_contract_dun_record_ds" marginHeight="265" marginWidth="30" navBar="true">
                <a:columns>
                    <!--<a:column name="bp_id_tenant_desc" align="center" lock="true" prompt="承租人名称" width="150"/>
                    <a:column name="contract_number" align="center" lock="true" prompt="HLS.CONTRACT_NUMBER" width="150"/>-->
                    <!--<a:column name="bp_id_agent_desc" align="center" lock="true" prompt="经销商" width="150"/>-->
                    <a:column name="contact_date" align="center" prompt="催收日期" renderer="Leaf.formatDate" width="120"/>
                    <a:column name="dun_unit_id_desc" align="center" prompt="催收部门" width="120"/>
                    <a:column name="dun_person_id_desc" align="center" prompt="催收人" width="160"/>
                    <a:column name="contact_person" align="center" prompt="联系人" width="100"/>
                    <a:column name="cell_phone" align="center" prompt="手机" width="100"/>
                    <a:column name="phone" align="center" prompt="工作电话" width="100"/>
                    <a:column name="phone_extra" align="center" prompt="家庭电话" width="100"/>
                    <a:column name="fax_number" align="center" prompt="传真" width="100"/>
                    <a:column name="contact_ways_desc" align="center" prompt="催收方式" width="100"/>
                    <a:column name="dun_message" align="center" prompt="催收结果" width="250"/>
                    <a:column name="dun_after_message" align="center" prompt="后续措施" width="250"/>
                    <a:column name="promised_return_date" align="center" prompt="承诺还款日期" renderer="Leaf.formatDate" width="150"/>
                    <a:column name="promised_return_amount" align="right" prompt="承诺还款金额" renderer="Leaf.formatMoney" width="150"/>
                </a:columns>
                <a:editors>
                    <a:comboBox id="dun_com"/>
                    <a:datePicker id="dun_df"/>
                    <a:textField id="dun_tf"/>
                    <a:numberField id="dun_nf"/>
                    <a:lov id="dun_lov"/>
                </a:editors>
            </a:grid>
        </a:screenBody>
    </a:view>
    <script type="text/javascript"><![CDATA[
    	Leaf.onReady(init);
        function init() {
            $('CON601_contract_dun_record_ds').setQueryParameter('contract_id', '${/parameter/@contract_id}');
            $('CON601_contract_dun_record_ds').query();
        }
       ]]></script>
</a:screen>
