<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author: liukang  
    $Date: 2016-05-11 下午1:28:49  
    $Revision: 1.0  
    $Purpose: 提前结清审批页面  虚拟节点
-->
<a:screen xmlns:a="http://www.leaf-framework.org/application">
    <a:init-procedure><![CDATA[
    ]]></a:init-procedure>
    <a:view package="leaf.ui.std" template="default">
        <!-- <a:link id="attachment_downloadFile_link" url="${/request/@context_path}/downloadFile.lview"/> -->
        <a:link id="et_attachment_uploadFile_id" url="${/request/@context_path}/uploadFile.lview"/>
        <div/>
        <script type="text/javascript"><![CDATA[
            function Screen_exit() {
                if ($L.CmpManager.get('zj_wfl_approve_win')) {
                    $('zj_wfl_approve_win').close();
                } else {
                    window.close();
                }
            }
            
            
            // function open_attachment_window() {
                // var val = $('early_terminationDs').getAt(0).get('et_agreement_id');
                // var url = $('attachment_downloadFile_link').getUrl() + '?table_name=CON_CONTRACT_ET_HD&header_id=' + val;
                // var win = new Leaf.Window({
                    // url: url,
                    // title: '附件查看',
                    // id: 'approve_downloadFile_id',
                    // width: 850,
                    // height: 400
                // });
                // win.on('close', function() {});
            // }
            
            
            function detail_attachment() {
                var val = $('early_terminationDs').getAt(0).get('et_agreement_id');
                var url = $('et_attachment_uploadFile_id').getUrl() + '?table_name=CON_CONTRACT_ET_HD&header_id=' + val;
                var win = new Leaf.Window({
                    url: url,
                    title: '${l:HLS.SUPPORTING_DOCUMENT}',
                    id: 'et_uploadFile_id',
                    width: 850,
                    height: 400
                });
                win.on('close', function() {});
            }
        ]]></script>
        <a:dataSets>
            <!-- <a:dataSet id="contract_et_Screen_mainDs2" model="cont.CON370.con_contract_et_hd_maintain_query"/> -->
            <a:dataSet id="contract_et_Screen_mainDs" autoQuery="true" model="cont.CON370.con_contract_et_hd_info_query" queryUrl="${/request/@context_path}/autocrud/cont.CON370.con_contract_et_hd_info_query/query?contract_id=${/parameter/@contract_id}">
                <a:fields>
                    <a:field name="contract_id"/>
                    <a:field name="contract_number" readOnly="true"/>
                    <a:field name="contract_name" readOnly="true"/>
                    <a:field name="document_type_desc" readOnly="true"/>
                    <a:field name="document_category_desc" readOnly="true"/>
                    <a:field name="bp_name" readOnly="true"/>
                    <a:field name="received_times" readOnly="true"/>
                    <a:field name="status_desc" readOnly="true"/>
                    <a:field name="inception_of_lease" readOnly="true"/>
                    <a:field name="et_type_dis" readOnly="true"/>
                    <a:field name="et_profile_desc" readOnly="true"/>
                    <a:field name="overdue_status" readOnly="true"/>
                    <a:field name="termination_date" readOnly="true"/>
                </a:fields>
            </a:dataSet>
            <a:dataSet id="et_pay_method_ds" lookupCode="ET_PAY_METHOD"/>
            <a:dataSet id="early_terminationDs" autoQuery="true" model="cont.CON370.con_contract_et_hd" queryUrl="${/request/@context_path}/autocrud/cont.CON370.con_contract_et_hd/query?contract_id=${/parameter/@contract_id}&amp;et_agreement_id=${/parameter/@et_agreement_id}">
                <a:fields>
                    <a:field name="et_agreement_id"/>
                    <a:field name="contract_id"/>
                    <a:field name="pay_method"/>
                    <a:field name="pay_method_desc" displayField="code_value_name" options="et_pay_method_ds" returnField="pay_method" valueField="code_value"/>
                </a:fields>
            </a:dataSet>
            <a:dataSet id="receivedAmountDs" autoQuery="true" fetchAll="true" model="cont.CON370.con_contract_received_amount" queryUrl="${/request/@context_path}/autocrud/cont.CON370.con_contract_received_amount/query?contract_id=${/parameter/@contract_id}">
                <a:fields>
                    <a:field name="contract_id"/>
                </a:fields>
            </a:dataSet>
            <a:dataSet id="unreceivedAmountDs" autoQuery="true" fetchAll="true" model="cont.CON370.con_contract_unreceived_amount" queryUrl="${/request/@context_path}/autocrud/cont.CON370.con_contract_unreceived_amount/query?contract_id=${/parameter/@contract_id}&amp;et_agreement_id=${/parameter/@et_agreement_id}">
                <a:fields>
                    <a:field name="et_agreement_id"/>
                    <a:field name="contract_id"/>
                </a:fields>
            </a:dataSet>
        </a:dataSets>
        <a:screenBody>
            <a:screenTopToolbar>
                <a:gridButton click="Screen_exit" text="HLS.EXIT"/>
                <a:gridButton click="detail_attachment" text="附件上传及查看"/>
            </a:screenTopToolbar>
            <a:form column="4" labelWidth="110" marginWidth="30" title="基础信息">
                <a:textField name="contract_number" bindTarget="contract_et_Screen_mainDs" prompt="合同编码"/>
                <a:textField name="contract_name" bindTarget="contract_et_Screen_mainDs" prompt="合同名称"/>
                <a:textField name="document_type_desc" bindTarget="contract_et_Screen_mainDs" prompt="合同类型"/>
                <a:textField name="document_category_desc" bindTarget="contract_et_Screen_mainDs" prompt="合同类别"/>
                <a:textField name="bp_name" bindTarget="contract_et_Screen_mainDs" prompt="承租人名称"/>
                <a:textField name="received_times" bindTarget="contract_et_Screen_mainDs" prompt="已还款期数"/>
                <a:textField name="status_desc" bindTarget="contract_et_Screen_mainDs" prompt="合同状态"/>
                <a:textField name="inception_of_lease" bindTarget="contract_et_Screen_mainDs" prompt="起租日期"/>
                <a:textField name="et_type_dis" bindTarget="contract_et_Screen_mainDs" prompt="提前结清类型"/>
                <a:textField name="et_profile_desc" bindTarget="contract_et_Screen_mainDs" prompt="提前结清规则" readonly="true"/>
                <a:textField name="overdue_status" bindTarget="contract_et_Screen_mainDs" prompt="是否逾期"/>
                <a:datePicker name="termination_date" bindTarget="contract_et_Screen_mainDs" prompt="提前结清日" renderer="Leaf.formatDate"/>
            </a:form>
            <div id="detail_flag_id">
                <a:form title="费用欠款">
                    <a:form column="4" labelWidth="110" marginWidth="30">
                        <a:numberField name="penalty" allowDecimals="true" allowFormat="true" bindTarget="early_terminationDs" decimalPrecision="2" prompt="罚息" readOnly="true"/>
                        <a:numberField name="collecting_fee" allowDecimals="true" allowFormat="true" bindTarget="early_terminationDs" decimalPrecision="2" prompt="催收费用" readOnly="true"/>
                        <a:numberField name="assessment_fee" allowDecimals="true" allowFormat="true" bindTarget="early_terminationDs" decimalPrecision="2" prompt="评估费" readOnly="true"/>
                        <a:numberField name="take_back_fee" allowDecimals="true" allowFormat="true" bindTarget="early_terminationDs" decimalPrecision="2" prompt="收车费用" readOnly="true"/>
                        <a:numberField name="damages_fee" allowDecimals="true" allowFormat="true" bindTarget="early_terminationDs" decimalPrecision="2" prompt="赔偿金" readOnly="true"/>
                        <a:numberField name="collection_fee" allowDecimals="true" allowFormat="true" bindTarget="early_terminationDs" decimalPrecision="2" prompt="上门催收费用" readOnly="true"/>
                        <a:numberField name="loy_fee" allowDecimals="true" allowFormat="true" bindTarget="early_terminationDs" decimalPrecision="2" prompt="律师信费费用" readOnly="true"/>
                    </a:form>
                </a:form>
                <a:form title="提前结清信息">
                    <a:form column="4" labelWidth="110" marginWidth="45">
                        <!-- <a:numberField name="overdue_amount" allowDecimals="true" allowFormat="true" bindTarget="early_terminationDs" decimalPrecision="2" prompt="逾期租金" readOnly="true"/>
                        <a:numberField name="overdue_principal" allowDecimals="true" allowFormat="true" bindTarget="early_terminationDs" decimalPrecision="2" prompt="逾期本金" readOnly="true"/>
                        <a:numberField name="overdue_interest" allowDecimals="true" allowFormat="true" bindTarget="early_terminationDs" decimalPrecision="2" prompt="逾期利息" readOnly="true"/>
                        <a:numberField name="penalty" allowDecimals="true" allowFormat="true" bindTarget="early_terminationDs" decimalPrecision="2" prompt="罚息" readOnly="true"/>
                        <a:numberField name="et_fee" allowDecimals="true" allowFormat="true" bindTarget="early_terminationDs" decimalPrecision="2" prompt="多退少补金额" readOnly="true"/>
                        <a:numberField name="undue_amount" allowDecimals="true" allowFormat="true" bindTarget="early_terminationDs" decimalPrecision="2" prompt="未到期租金" readOnly="true"/>
                        <a:numberField name="undue_principal" allowDecimals="true" allowFormat="true" bindTarget="early_terminationDs" decimalPrecision="2" prompt="未到期本金" readOnly="true"/>
                        <a:numberField name="undue_interest" allowDecimals="true" allowFormat="true" bindTarget="early_terminationDs" decimalPrecision="2" prompt="未到期利息" readOnly="true"/>
                        <a:numberField name="residual_value" allowDecimals="true" allowFormat="true" bindTarget="early_terminationDs" decimalPrecision="2" prompt="留购金" readOnly="true"/>
                        <a:numberField name="ref_n05" allowDecimals="true" allowFormat="true" bindTarget="early_terminationDs" decimalPrecision="2" prompt="退还保证金" readOnly="true"/>
                        <a:numberField name="ref_n06" allowDecimals="true" allowFormat="true" bindTarget="early_terminationDs" decimalPrecision="2" prompt="未收牌照费" readOnly="true"/>
                        <a:numberField name="ref_n07" allowDecimals="true" allowFormat="true" bindTarget="early_terminationDs" decimalPrecision="2" prompt="已支出拖车费" readOnly="true"/>
                        <a:numberField name="ref_n08" allowDecimals="true" allowFormat="true" bindTarget="early_terminationDs" decimalPrecision="2" prompt="未支付保险费" readOnly="true"/>
                        <a:numberField name="ref_n09" allowDecimals="true" allowFormat="true" bindTarget="early_terminationDs" decimalPrecision="2" prompt="未收手续费" readOnly="true"/>
                        <a:numberField name="et_total_amount" allowDecimals="true" allowFormat="true" bindTarget="early_terminationDs" decimalPrecision="2" prompt="提前结清费用合计" readOnly="true"/>
                        <a:numberField name="others_fee" allowDecimals="true" allowFormat="true" bindTarget="early_terminationDs" decimalPrecision="2" prompt="其它费用" readOnly="true"/>
                        <a:textField name="note" bindTarget="early_terminationDs" prompt="其它费用说明" readOnly="true"/>
                        <a:checkBox name="deposit_deduction_flag" bindTarget="early_terminationDs" prompt="是否抵扣保证金"/>
                        <a:checkBox name="balance_deduction_flag" bindTarget="early_terminationDs" prompt="是否抵扣多退少补"/>
                        <a:numberField name="total_amount" allowDecimals="true" allowFormat="true" bindTarget="early_terminationDs" decimalPrecision="2" prompt="扣除其它费用合计" readOnly="true"/> -->
                        <a:numberField name="overdue_amount" allowDecimals="true" allowFormat="true" bindTarget="early_terminationDs" decimalPrecision="2" prompt="逾期租金" readOnly="true"/>
                        <a:numberField name="debt_fee" allowDecimals="true" allowFormat="true" bindTarget="early_terminationDs" decimalPrecision="2" prompt="费用欠款" readOnly="true"/>
                        <a:numberField name="unpay_insurance_fee" allowDecimals="true" allowFormat="true" bindTarget="early_terminationDs" decimalPrecision="2" prompt="未支付保险" readOnly="true"/>
                        <a:numberField name="unpay_travel_tax" allowDecimals="true" allowFormat="true" bindTarget="early_terminationDs" decimalPrecision="2" prompt="未支付车船税" readOnly="true"/>
                        <a:numberField name="unpay_gps_fee" allowDecimals="true" allowFormat="true" bindTarget="early_terminationDs" decimalPrecision="2" prompt="未支付GPS服务费" readOnly="true"/>
                        <a:numberField name="undue_principal" allowDecimals="true" allowFormat="true" bindTarget="early_terminationDs" decimalPrecision="2" prompt="未逾期剩余本金" readOnly="true"/>
                        <a:numberField name="et_fee" allowDecimals="true" allowFormat="true" bindTarget="early_terminationDs" decimalPrecision="2" prompt="手续费" readOnly="true"/>
                        <a:numberField name="defaults_fee" allowDecimals="true" allowFormat="true" bindTarget="early_terminationDs" decimalPrecision="2" prompt="违约金" readOnly="true"/>
                        <a:numberField name="overdue_interest" allowDecimals="true" allowFormat="true" bindTarget="early_terminationDs" decimalPrecision="2" prompt="当月利息" readOnly="true"/>
                        <a:numberField name="ref_n05" allowDecimals="true" allowFormat="true" bindTarget="early_terminationDs" decimalPrecision="2" prompt="未退还保证金" readOnly="true"/>
                        <a:numberField name="et_total_amount" allowDecimals="true" allowFormat="true" bindTarget="early_terminationDs" decimalPrecision="2" prompt="试算金额" readOnly="true"/>
                        <a:textField name="test_employee" allowDecimals="true" allowFormat="true" bindTarget="early_terminationDs" decimalPrecision="2" prompt="试算人员" readOnly="true"/>
                        <a:comboBox name="pay_method_desc" bindTarget="early_terminationDs" prompt="还款方式" readOnly="true"/>
                        <a:textField name="note_s" allowDecimals="true" allowFormat="true" bindTarget="early_terminationDs" decimalPrecision="2" prompt="备注" readOnly="true"/>
                    </a:form>
                    <a:tabPanel marginHeight="400" marginWidth="45">
                        <a:tabs>
                            <a:tab prompt="未收金额" width="110">
                                <a:grid bindTarget="unreceivedAmountDs" marginHeight="430" marginWidth="100" navBar="true">
                                    <a:columns>
                                        <a:column name="times" prompt="期数"/>
                                        <a:column name="cf_type_dis" prompt="类型"/>
                                        <a:column name="due_amount" align="right" prompt="应收金额" renderer="Leaf.formatMoney"/>
                                        <a:column name="received_amount" align="right" prompt="已收金额" renderer="Leaf.formatMoney"/>
                                        <a:column name="due_date" prompt="预定支付日期"/>
                                        <a:column name="principal" align="right" prompt="本金" renderer="Leaf.formatMoney"/>
                                        <a:column name="interest" align="right" prompt="利息" renderer="Leaf.formatMoney"/>
                                        <a:column name="cf_status_dis" prompt="现金流状态"/>
                                    </a:columns>
                                </a:grid>
                            </a:tab>
                            <a:tab prompt="已收金额" width="110">
                                <a:grid bindTarget="receivedAmountDs" marginHeight="430" marginWidth="100" navBar="true">
                                    <a:columns>
                                        <a:column name="times" prompt="期数"/>
                                        <a:column name="cf_type_dis" prompt="类型"/>
                                        <a:column name="due_amount" align="right" prompt="应收金额" renderer="Leaf.formatMoney"/>
                                        <a:column name="received_amount" align="right" prompt="未收金额" renderer="Leaf.formatMoney"/>
                                        <a:column name="due_date" prompt="预定支付日期"/>
                                        <a:column name="received_principal" align="right" prompt="已收本金" renderer="Leaf.formatMoney"/>
                                        <a:column name="received_interest" align="right" prompt="已收利息" renderer="Leaf.formatMoney"/>
                                        <a:column name="cf_status_dis" prompt="现金流状态"/>
                                    </a:columns>
                                </a:grid>
                            </a:tab>
                        </a:tabs>
                    </a:tabPanel>
                </a:form>
            </div>
        </a:screenBody>
        <!-- <script type="text/javascript"><![CDATA[
            Leaf.onReady(init);
            function init() {
                var record = $('contract_et_Screen_mainDs').getCurrentRecord();
                $('early_terminationDs').setQueryParameter('et_agreement_id', record.get('et_agreement_id'));
                $('early_terminationDs').query();
                $('unreceivedAmountDs').setQueryParameter('contract_id', record.get('contract_id'));
                $('unreceivedAmountDs').setQueryParameter('et_agreement_id', record.get('et_agreement_id'));
                $('unreceivedAmountDs').query();
                $('receivedAmountDs').setQueryParameter('contract_id', record.get('contract_id'));
                $('receivedAmountDs').query();
            }
        ]]></script> -->
    </a:view>
</a:screen>
