<?xml version="1.0" encoding="UTF-8"?>
<!--
  create by nyl  2014-12-3 
  for contract context create
-->
<a:screen xmlns:a="http://www.leaf-framework.org/application" customizationEnabled="true" dynamiccreateenabled="true" trace="true">
    <a:init-procedure/>
    <a:view>
        <a:link id="legal_get_layout_code_link_id" model="cont.CON500.con_contract_get_layout_code" modelaction="update"/>
        <a:link id="con_contract_update_link_id" url="${/request/@context_path}/modules/cont/CON301/con_contract_query_n.lview"/>
        <a:link id="leg400_print_link" url="${/request/@context_path}/modules/leg/LEG400/leg_content_print_detail.lview"/>
        <script type="text/javascript"><![CDATA[
            function open_contract_win(ds_id, record_id) {
                var record = $(ds_id).findById(record_id);
            
                var param = record.data; // new Object();
            
                maintain_type = 'READONLY';
                param['function_code'] = 'CON301R';
                param['function_usage'] = 'MODIFY';
                param['url_title'] = '合同明细';
                url_l = 'con_contract_update_link_id';
                param['maintain_type'] = maintain_type;
            
            
                hls_doc_get_layout_code('legal_get_layout_code_link_id', param, url_l, ds_id);
            
            }
            
            function open_legal_win(ds_id, record_id) {
                /*  var record = $(ds_id).findById(record_id);
                 var param = record.data;
                 maintain_type = 'CREATE';
                 param['function_code'] = 'LEG441';
                 param['function_usage'] = 'CREATE';
                 param['url_title'] = '法务费用创建';
                 url_l = 'leg_dunning_notice_create_link_id';
                 param['maintain_type'] = maintain_type;
                 hls_doc_get_layout_code('legal_get_layout_code_link_id', param, url_l,ds_id); */
            
            }
            
            window['${/parameter/@layout_code}_dynamic_link_renderer'] = function(value, record, name, config_record) {
            
                if (name == 'contract_number') {
                    return '<a   href="javascript:open_contract_win(\'' + record.ds.id + '\',\'' + record.id + '\')">' + value + '</a>';
            
                }
                if (name == 'legal_number') {
                    return '<a   href="javascript:open_legal_win(\'' + record.ds.id + '\',\'' + record.id + '\')">' + value + '</a>';
            
                }
            
            
                return value;
            };
            
            //
            window['${/parameter/@layout_code}_user_button1_layout_dynamic_click'] = function() {
            
                var con_contract_ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'con_contract');
                var con_contract_record = $(con_contract_ds_id).getCurrentRecord();
            
                var contract_id = con_contract_record.get('contract_id');
                var law_id = con_contract_record.get('law_id');
                var param = new Object();
                param['law_id'] = con_contract_record.get('law_id');
                param['contract_id'] = con_contract_record.get('contract_id');
                param['winid'] = 'leg_print_detail_winid';
                param['function'] = 'LEG400';
                var win = new Leaf.Window({
                    id: 'leg_print_detail_winid',
                    params: param,
                    url: $('leg400_print_link').getUrl(),
                    title: '法务文本打印',
                    width: 900,
                    height: 450
                });
            
            
            };
        ]]></script>
        <a:screen-include screen="modules/cont/CON500/con_contract_get_layout_code.lview"/>
    </a:view>
</a:screen>