<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author: hand  
    $Date: 2016-5-14 下午2:19:40  
    $Revision: 1.0  
    $Purpose: 
-->
<a:screen xmlns:a="http://www.leaf-framework.org/application">
    <a:init-procedure/>
    <a:view>
        <a:link id="hls_doc_file_print_confirm" url="${/request/@context_path}/modules/hls/HLS811/hls_doc_file_print_con_confirm.lview"/>
        <a:link id="con_settle_list_link_id" model="cont.CON557.con_settle_list" modelaction="update"/>
        <a:link id="con_settle_list_execute_link_id" model="cont.CON557.con_settle_list" modelaction="execute"/>
        <script type="text/javascript"><![CDATA[
            var settle_flag = 'N';
            
            // function submit_con_settle_list_result_ds() {
                // $('con_settle_list_result_ds').submit();
            // }
            
            // function con_contract_query_ds_update(ds, record, name, value, oldvalue) {
            //
            // if (name == 'contract_id') {
            // $('document_lend_record_ln_query_ds').setQueryParameter('contract_id', value);
            // $('document_lend_record_ln_query_ds').query();
            
            // }
            // }
            
            function con_settle_list_add(ds, res, index) {
                var date = new Date();
                var year = date.getFullYear();
                var month = date.getMonth() + 1;
                var day = date.getDate();
                var dd = year + '-' + month + '-' + day;
                res.set('settle_time', dd);
            }
            
            function con_contract_query_ds_indexchange(dataSet, record) {

                var contract_id = record.get('contract_id');
                $('document_lend_record_ln_query_ds').setQueryParameter('contract_id', contract_id);
                $('document_lend_record_ln_query_ds').query();
            }
            
            function to_back() {
                $('reg_settlement_query_win').close();
            }
            
            // function contract_print() {
                //
                // var record = $('con_settle_list_result_ds').getCurrentRecord();
            
                // if (Ext.isEmpty(record)) {
                        // Leaf.showMessage('${l:HLS.PROMPT}', '请先保存！');
                        // return;
                // }
                // var document_id = record.get('con_settle_list_id');
                // if (Ext.isEmpty(record.get('con_settle_list_id'))) {
                      // Leaf.showMessage('${l:HLS.PROMPT}', '请先保存！');
                        // return;
                // }
                // new Leaf.Window({
                    // id: '${/parameter/@layout_code}_con_contract_content_confirm_win_id',
                    // params: {
                        // document_id: document_id,
                        // document_table: 'CON_SETTLE_LIST'
                    // },
                    // url: $('hls_doc_file_print_confirm').getUrl(),
                    // title: '合同文本生成',
                    // width: 1300,
                    // height: 550
                // });
            // }
            
            // function settle_settlement() {
                // var record = $('con_settle_list_result_ds').getCurrentRecord();
            
                // if (Ext.isEmpty(record)) {
                    // Leaf.showMessage('${l:HLS.PROMPT}', '请先保存！');
                    // return;
                // }
                // var document_id = record.get('con_settle_list_id');
                  // if (Ext.isEmpty(record.get('con_settle_list_id'))) {
                      // Leaf.showMessage('${l:HLS.PROMPT}', '请先保存！');
                        // return;
                // }
                // Leaf.request({
                    // url: $('con_settle_list_execute_link_id').getUrl(),
                    // para: {
                        // document_id: document_id,
                        // document_table: 'CON_SETTLE_LIST'
                    // },
                    // success: function(data) {
                        // if (data.result.v_exists > 0) {
                            // Leaf.request({
                                // url: $('con_settle_list_link_id').getUrl(),
                                // para: {
                                    // contract_id: ${/parameter/@contract_id},
                                    // settle : 'Y'
                                // },
                                // success: function() {
                                    // Leaf.SideBar.show({
                                        // msg: '操作成功',
                                        // duration: 2000
                                    // });
                                // },
                                // sync: true
                            // });
                        // } else {
                            // Leaf.showMessage('${l:HLS.PROMPT}', '请先打印文件！');
                        // }
            
                    // },
                    // sync: true
                // });
            // }
            
            function con_settle_list_submitsuccess(ds, res) {
                ds.query();
            }
        ]]></script>
        <a:dataSets>
            <a:dataSet id="prj_cdd_item_data_ds" autoQuery="true" fetchAll="true" model="cont.CON557.prj_cdd_item_data_lv" queryUrl="${/request/@context_path}/autocrud/cont.CON557.prj_cdd_item_data_lv/query?contract_id=${/parameter/@contract_id}"/>
            <a:dataSet id="con_settle_list_result_ds" autoCreate="true" autoQuery="true" model="cont.CON557.con_settle_list" queryUrl="${/request/@context_path}/autocrud/cont.CON557.con_settle_list/query?contract_id=${/parameter/@contract_id}">
                <a:fields>
                    <a:field name="con_settle_list_id" readOnly="true"/>
                    <a:field name="contract_id" defaultValue="${/parameter/@contract_id}" readOnly="true"/>
                    <a:field name="settle_person" readOnly="true"/>
                    <a:field name="settle_time" readOnly="true"/>
                    <a:field name="note" readOnly="true"/>
                    <a:field name="list1" checkedValue="Y" defaultValue="N" readOnly="true" uncheckedValue="N"/>
                    <a:field name="list2" checkedValue="Y" readOnly="true" uncheckedValue="N"/>
                    <a:field name="list3" checkedValue="Y" readOnly="true" uncheckedValue="N"/>
                    <a:field name="list4" checkedValue="Y" readOnly="true" uncheckedValue="N"/>
                    <a:field name="list5" readOnly="true"/>
                    <a:field name="list6" readOnly="true"/>
                    <a:field name="other1" readOnly="true"/>
                    <a:field name="other1_n" displayField="description" options="prj_cdd_item_data_ds" readOnly="true" returnField="other1" valueField="cdd_item_id"/>
                    <a:field name="other2" readOnly="true"/>
                    <a:field name="other2_n" displayField="description" options="prj_cdd_item_data_ds" readOnly="true" returnField="other2" valueField="cdd_item_id"/>
                    <a:field name="other3" readOnly="true"/>
                    <a:field name="other3_n" displayField="description" options="prj_cdd_item_data_ds" readOnly="true" returnField="other3" valueField="cdd_item_id"/>
                    <a:field name="other4" readOnly="true"/>
                    <a:field name="other4_n" displayField="description" options="prj_cdd_item_data_ds" readOnly="true" returnField="other4" valueField="cdd_item_id"/>
                    <a:field name="other5" readOnly="true"/>
                    <a:field name="other6" readOnly="true"/>
                </a:fields>
                <a:events>
                    <a:event name="add" handler="con_settle_list_add"/>
                    <a:event name="submitsuccess" handler="con_settle_list_submitsuccess"/>
                </a:events>
            </a:dataSet>
            <a:dataSet id="con_contract_ds" autoQuery="true" model="cont.CON557.reg_settlement_con_contract" queryUrl="${/request/@context_path}/autocrud/cont.CON557.reg_settlement_con_contract/query?contract_id=${/parameter/@contract_id}" selectable="true" selectionModel="single">
                <a:fields>
                    <a:field name="contract_id" readOnly="true"/>
                    <a:field name="contract_number" readOnly="true"/>
                    <a:field name="contract_name" readOnly="true"/>
                    <a:field name="bp_name" readOnly="true"/>
                    <!--   <a:field name="bp_type_desc"/> -->
                    <a:field name="hls_lease_channel_desc" readOnly="true"/>
                    <a:field name="reg_status" readOnly="true"/>
                    <a:field name="archive_status" readOnly="true"/>
                    <a:field name="business_type_desc" readOnly="true"/>
                    <a:field name="invoice_agent_desc" readOnly="true"/>
                    <a:field name="docu_number_reg" readOnly="true"/>
                    <a:field name="docu_numberr_archive" readOnly="true"/>
                    <a:field name="bp_class_desc" readOnly="true"/>
                    <a:field name="archive_status_n" readOnly="true"/>
                    <a:field name="reg_status_n" readOnly="true"/>
                    <a:field name="division_desc" readOnly="true"/>
                    <a:field/>
                </a:fields>
                <a:events>
                    <a:event name="indexchange" handler="con_contract_query_ds_indexchange"/>
                </a:events>
            </a:dataSet>
            <a:dataSet id="document_lend_record_ln_query_ds" model="cont.CON557.reg_settlement_con_contract_record_query" selectionModel="single">
                <a:fields>
                    <!--  <a:field name="lend_flag" checkedValue="Y" uncheckedValue="N"/>
                    <a:field name="docu_number"/>
                    <a:field name="chest_number"/> -->
                    <a:field name="cdd_item" readOnly="true"/>
                    <a:field name="templet_head_id" readOnly="true"/>
                    <a:field name="contract_id" readOnly="true"/>
                    <a:field name="lend_flag" checkedValue="Y" readOnly="true" uncheckedValue="N"/>
                    <a:field name="document_id" readOnly="true"/>
                    <a:field name="cdd_item_id" readOnly="true"/>
                    <a:field name="description" readOnly="true"/>
                    <a:field name="return_date" readOnly="true"/>
                    <a:field name="doc_type" readOnly="true"/>
                    <a:field name="doc_type_n" readOnly="true"/>
                    <a:field name="paper_content_flag" checkedValue="Y" readOnly="true" uncheckedValue="N"/>
                    <a:field name="borrowed_flag" checkedValue="Y" readOnly="true" uncheckedValue="N"/>
                </a:fields>
            </a:dataSet>
            <a:dataSet id="contract_lease_item_ds" autoQuery="true" model="cont.CON555B.con_contract_lease_item" queryUrl="${/request/@context_path}/autocrud/cont.CON555B.con_contract_lease_item/query?contract_id=${/parameter/@contract_id}">
                <a:fields>
                    <a:field name="license_number" readOnly="true"/>
                    <a:field name="item_frame_number" readOnly="true"/>
                    <a:field name="color_of_apprearance" readOnly="true"/>
                    <a:field name="item_engine_number" readOnly="true"/>
                    <a:field name="mortgage_date" readOnly="true"/>
                </a:fields>
            </a:dataSet>
        </a:dataSets>
        <a:screenBody>
            <a:screenTopToolbar>
                <a:gridButton click="to_back" text="退回"/>
                <a:gridButton click="submit_con_settle_list_result_ds" style="display:none;" text="保存"/>
                <a:gridButton click="settle_settlement" style="display:none;" text="确认结清"/>
                <a:gridButton click="contract_print" style="display:none;" text="打印结清文件"/>
            </a:screenTopToolbar>
            <a:form column="4" labelWidth="120" marginWidth="60" title="结清信息">
                <a:textField name="settle_person" bindTarget="con_settle_list_result_ds" prompt="结清操作人员"/>
                <a:datePicker name="settle_time" bindTarget="con_settle_list_result_ds" prompt="结清日期"/>
                <a:textField name="note" bindTarget="con_settle_list_result_ds" colspan="2" prompt="备注" width="380"/>
            </a:form>
            <a:form column="5" labelWidth="120" marginWidth="60" title="登记证归档入库">
                <a:textField name="license_number" bindTarget="contract_lease_item_ds" prompt="车牌"/>
                <a:textField name="item_frame_number" bindTarget="contract_lease_item_ds" prompt="车架号"/>
                <a:textField name="color_of_apprearance" bindTarget="contract_lease_item_ds" prompt="颜色"/>
                <a:textField name="item_engine_number" bindTarget="contract_lease_item_ds" prompt="发动机号"/>
                <a:datePicker name="mortgage_date" bindTarget="contract_lease_item_ds" prompt="抵押日期"/>
            </a:form>
            <a:form column="5" labelWidth="120" marginWidth="60" title="结清清单">
                <a:checkBox name="list1" bindTarget="con_settle_list_result_ds" colspan="2" prompt="登记证"/>
                <a:comboBox name="other1_n" bindTarget="con_settle_list_result_ds" colspan="3" prompt="其他"/>
                <!--      <a:checkBox name="list2" bindTarget="con_settle_list_result_ds" colspan="2" prompt="保单"/>
                <a:comboBox name="other2_n" bindTarget="con_settle_list_result_ds" colspan="3" prompt="其他"/> -->
                <a:checkBox name="list3" bindTarget="con_settle_list_result_ds" colspan="2" prompt="购车发票"/>
                <a:comboBox name="other3_n" bindTarget="con_settle_list_result_ds" colspan="3" prompt="其他"/>
                <a:checkBox name="list4" bindTarget="con_settle_list_result_ds" colspan="2" prompt="其他"/>
                <a:comboBox name="other4_n" bindTarget="con_settle_list_result_ds" colspan="3" prompt="其他"/>
            </a:form>
            <!--  <a:hBox>
                <a:button click="submit_con_settle_list_result_ds" text="保存"/>
                <a:button text="重置"/>
            </a:hBox> -->
            <a:grid id="hui_con_contract_query_grid" bindTarget="con_contract_ds" height="140" marginWidth="60" navBar="true">
                <a:columns>
                    <a:column name="contract_number" prompt="合同编号" width="160"/>
                    <!--   <a:column name="contract_name" prompt="合同名称" width="200"/> -->
                    <a:column name="bp_name" prompt="承租人名称" width="100"/>
                    <a:column name="invoice_agent_desc" prompt="代理商" width="100"/>
                    <a:column name="business_type_desc" prompt="业务类型" width="100"/>
                    <a:column name="division_desc" prompt="产品线" width="100"/>
                    <a:column name="bp_class_desc" prompt="客户类别" width="100"/>
                    <!--  <a:column name="bp_type_desc" prompt="承租人类型" width="120"/> -->
                    <a:column name="hls_lease_channel_desc" prompt="商业模式" width="100"/>
                    <!--    <a:column name="contract_id" prompt="承租人类型" width="120"/> -->
                    <!--   <a:column name="reg_status" prompt="文件类型" width="100"/>
                     <a:column name="archive_status" prompt="文件类型" width="100"/> -->
                    <a:column name="docu_numberr_archive" prompt="合同箱编号" width="120"/>
                    <a:column name="archive_status_n" prompt="合同归档状态" width="120"/>
                    <a:column name="reg_status_n" prompt="登记证归档状态" width="120"/>
                    <a:column name="docu_number_reg" prompt="登记证箱编号" width="120"/>
                </a:columns>
            </a:grid>
            <a:grid bindTarget="document_lend_record_ln_query_ds" height="160" marginWidth="60" navBar="true">
                <a:columns>
                    <a:column name="description" prompt="文档名称" width="400"/>
                    <a:column name="lend_flag" editor="document_lend_record_add_cb" prompt="是否借阅" width="80"/>
                    <a:column name="paper_content_flag" editor="document_lend_record_add_cb" prompt="是否归档" width="80"/>
                    <a:column name="doc_type_n" prompt="文件类型" width="100"/>
                </a:columns>
                <a:editors>
                    <a:checkBox id="document_lend_record_add_cb"/>
                    <a:datePicker id="document_lend_record_add_dp"/>
                </a:editors>
            </a:grid>
        </a:screenBody>
    </a:view>
</a:screen>
