<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author: WCS  
    $Date: 2014-11-13 下午05:15:58  
    $Revision: 1.0  
    $Purpose: 
-->
<a:screen xmlns:a="http://www.leaf-framework.org/application">
    <a:view>
        <a:link id="con_contract_terminate_submit" model="cont.CON761.con_contract_terminate_submit" modelaction="execute"/>
        <a:link id="con_contract_terminate_link" url="${/request/@context_path}/modules/cont/CON761/con_contract_terminate.lview"/>
        <script type="text/javascript"><![CDATA[
			function con761_head_save(){
			    $('con_contract_teminate_detail_head_ds').submit();
			}
			
			function con761_detail_submit(){
			    var contract_id=$('con_contract_teminate_detail_head_ds').getCurrentRecord().get('contract_id');			    
			    var contract_number=$('con_contract_teminate_detail_head_ds').getCurrentRecord().get('contract_number');
			 	Leaf.request({
			 	    url:$('con_contract_terminate_submit').getUrl(),
			 	    para:{
			 	        contract_id:contract_id,
			 	        contract_number:contract_number
			 	    },
			 	    success:function() {
			 	        var url=$('con_contract_terminate_link').getUrl();
			 	        Leaf.go(url);
			 	    },
			 	    scope: this
			 	});
			}
		]]></script>
        <a:dataSets>
            <a:dataSet id="con_contract_teminate_detail_head_ds" autoCreate="true" autoQuery="true" model="cont.CON761.con_contract_v" queryUrl="${/request/@context_path}/autocrud/cont.CON761.con_contract_v/query?contract_id=${/parameter/@contract_id}"/>
            <a:dataSet id="con_contract_teminate_detail_result_ds" autoQuery="true" model="cont.CON761.con_contract_cashflow_lv" queryUrl="${/request/@context_path}/autocrud/cont.CON761.con_contract_cashflow_lv/query?contract_id=${/parameter/@contract_id}"><![CDATA[
            
            ]]></a:dataSet>
            <a:dataSet id="con_contract_teminate_detail_result_v2_ds" autoQuery="true" model="cont.CON761.con_contract_cashflow_received_lv" queryUrl="${/request/@context_path}/autocrud/cont.CON761.con_contract_cashflow_received_lv/query?contract_id=${/parameter/@contract_id}"/>
            <a:dataSet id="con_contract_teminate_detail_unreceived_result_ds" autoQuery="true" model="cont.CON761.con_contract_cashflow_received_lv" queryUrl="${/request/@context_path}/autocrud/cont.CON761.con_contract_cashflow_unreceived_lv/query?contract_id=${/parameter/@contract_id}"/>
            <a:dataSet id="con_contract_teminate_detail_zero_result_ds" autoQuery="true" model="cont.CON761.con_contract_cashflow_zero_lv" queryUrl="${/request/@context_path}/autocrud/cont.CON761.con_contract_cashflow_zero_lv/query?contract_id=${/parameter/@contract_id}"/>
            <a:dataSet id="con_contract_teminate_detail_total_amount_ds" autoQuery="true" model="cont.CON761.con_contract_total_cashflow" queryUrl="${/request/@context_path}/autocrud/cont.CON761.con_contract_total_cashflow/query?contract_id=${/parameter/@contract_id}"/>
        </a:dataSets>
        <a:screenBody>
            <a:screenTopToolbar>
                <a:screenTitle/>
                <!-- <a:gridButton click="" text="后退"/>
                <a:gridButton click="" text="前进"/> -->
                <a:gridButton click="con761_head_save" text="保存"/>
                <a:gridButton click="con761_detail_submit" text="提交"/>
            </a:screenTopToolbar>
            <a:form column="4" labelWidth="120" marginWidth="50" title="基础信息">
                <a:textField name="contract_number" bindTarget="con_contract_teminate_detail_head_ds" prompt="合同编号" readOnly="true"/>
                <a:textField name="contract_name" bindTarget="con_contract_teminate_detail_head_ds" prompt="HLS.CONTRACT_NAME" readOnly="true"/>
                <a:textField name="bp_name" bindTarget="con_contract_teminate_detail_head_ds" prompt="承租人名称" readOnly="true"/>
                <a:comboBox name="document_type_desc" bindTarget="con_contract_teminate_detail_head_ds" prompt="合同类型" readOnly="true" width="200"/>
                <a:numberField name="contract_terminate_other_fee" bindTarget="con_contract_teminate_detail_head_ds" prompt="其他费用"/>
            </a:form>
            <a:form bindTarget="con_contract_teminate_detail_total_amount_ds" column="4" labelWidth="120" marginWidth="50" title="最后费用">
                <a:numberField name="leave_due_amount" bindTarget="con_contract_teminate_detail_total_amount_ds" prompt="留购金" readOnly="true"/>
                <a:numberField name="zero_due_amount" bindTarget="con_contract_teminate_detail_total_amount_ds" prompt="多退少补" readOnly="true"/>
                <a:numberField name="unreceived_amount" bindTarget="con_contract_teminate_detail_total_amount_ds" prompt="最后应付费用" readOnly="true" style="color:red"/>
                <a:textField name="other_fee" bindTarget="con_contract_teminate_detail_total_amount_ds" prompt="过户费用及违章费用" readOnly="true" width="200"/>
                <!-- <a:comboBox name="document_type_desc" bindTarget="con_contract_teminate_detail_total_amount_ds" prompt="合同类型" readOnly="true"/> -->
            </a:form>
            <a:form>
                <a:hBox>
                    <a:grid bindTarget="con_contract_teminate_detail_result_ds" height="300" marginWidth="900" navBar="true">
                        <a:toolBar>
                            <h3 style="color:black; text-align:left;font-weight:bold;font-size:10px;"><![CDATA[保险费等费用结算]]></h3>
                        </a:toolBar>
                        <a:columns>
                            <a:column name="cf_item_n" align="center" prompt="现金流项目" width="100"/>
                            <a:column name="estimated_due_amount" align="right" prompt="预估金额" renderer="Leaf.formatNumber" width="80"/>
                            <a:column name="due_amount" align="right" prompt="实际金额" renderer="Leaf.formatNumber" width="80"/>
                            <a:column name="received_amount" align="right" prompt="已付金额" renderer="Leaf.formatNumber" width="80"/>
                        </a:columns>
                    </a:grid>
                    <a:grid bindTarget="con_contract_teminate_detail_result_v2_ds" height="300" marginWidth="900" navBar="true">
                        <a:toolBar>
                            <h3 style="color:black; text-align:left;font-weight:bold;font-size:10px;"><![CDATA[已收费用]]></h3>
                        </a:toolBar>
                        <a:columns>
                            <a:column name="cf_item_n" align="center" prompt="现金流项目" width="100"/>
                            <a:column name="times" align="center" prompt="期数" width="80"/>
                            <a:column name="due_amount" align="right" prompt="应收金额" renderer="Leaf.formatNumber" width="80"/>
                            <a:column name="received_amount" align="right" prompt="已收金额" renderer="Leaf.formatNumber" width="80"/>
                        </a:columns>
                    </a:grid>
                    <a:grid bindTarget="con_contract_teminate_detail_unreceived_result_ds" height="300" marginWidth="900" navBar="true">
                        <a:toolBar>
                            <h3 style="color:black; text-align:left;font-weight:bold;font-size:10px;"><![CDATA[应收费用]]></h3>
                        </a:toolBar>
                        <a:columns>
                            <a:column name="cf_item_n" align="center" prompt="现金流项目" width="100"/>
                            <a:column name="times" align="center" prompt="期数" width="80"/>
                            <a:column name="due_amount" align="right" prompt="应收金额" renderer="Leaf.formatNumber" width="80"/>
                            <a:column name="received_amount" align="right" prompt="已收金额" renderer="Leaf.formatNumber" width="80"/>
                        </a:columns>
                    </a:grid>
                </a:hBox>
            </a:form>
        </a:screenBody>
    </a:view>
</a:screen>
