<?xml version="1.0" encoding="UTF-8"?> <!-- $Author: wangwei $Date: 2016-1-6 上午11:04:17 $Revision: 1.0 $Purpose:其他业务明细 --> <a:screen xmlns:a="http://www.leaf-framework.org/application" customizationEnabled="true" dynamiccreateenabled="true" trace="true"> <a:view> <a:link id="sdic100d_con_contract_get_layout_code_link_id" model="cont.CON500.con_contract_get_layout_code" modelaction="update"/> <a:link id="sdic100d_get_special_fields_link_id" model="cont.CON500.con_contract_get_special_fields" modelaction="update"/> <a:link id="hls_bp_master_modify_link" url="${/request/@context_path}/modules/hls/HLS214N/hls_bp_master_modify.lview"/> <a:link id="sdic100d_cdd_uploadFile_id" url="${/request/@context_path}/uploadFile.lview"/> <a:link id="sdic100d_cdd_downloadFile_id" url="${/request/@context_path}/downloadFile.lview"/> <a:link id="sdic100d_submit_other_contract_link_id" model="sdic.SDIC100.submit_other_contract" modelaction="update"/> <a:link id="sdic100d_con_cf_info_upload_link_id" url="${/request/@context_path}/modules/sdic/SDIC100/other_con_cf_info_upload.lview"/> <a:link id="sdic120d_contract_close_link_id" model="sdic.SDIC120.sdic_other_con_close" modelaction="update"/> <a:link id="sdic100d_other_con_get_base_rate" model="sdic.SDIC100.other_con_get_base_rate" modelaction="query"/> <script type="text/javascript"><![CDATA[ //excel导入 window['${/parameter/@layout_code}_user_button1_layout_dynamic_click'] = function() { var head_record_ds=get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'sdic_other_contract'); var head_record=$(head_record_ds).getAt(0); var cf_ds = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'sdic_other_contract_cf'); var url_l = $('sdic100d_con_cf_info_upload_link_id').getUrl(); if(head_record.get('contract_id')){ var win = new Leaf.Window({ id: 'other_con_cf_info_handle_win', url: url_l, params: { 'contract_id':head_record.get('contract_id'), 'winid': 'other_con_cf_info_handle_win', 'session_id': '${/session/@session_id}', 'parent_ds_id': cf_ds }, title: '应收应付导入', width: 430, height: 290 }); win.on('close', function() { $(cf_ds).setQueryParameter('contract_id',head_record.get('contract_id')); $(cf_ds).query(); }); }else{ Leaf.showMessage('${l:HLS.PROMPT}', '请先保存数据!'); return; } }; //关闭合同 window['${/parameter/@layout_code}_user_button2_layout_dynamic_click'] = function() { var head_record_ds=get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'sdic_other_contract'); var head_record=$(head_record_ds).getAt(0); Leaf.showConfirm('${HLS.PROMPT}', '确认关闭当前合同吗?', function() { Leaf.request({ url: $('sdic120d_contract_close_link_id').getUrl(), para: { contract_id: head_record.get('contract_id') }, success: function(res) { window['${/parameter/@layout_code}_unlock_layout_dynamic_window'](); Leaf.SideBar.show({ msg: '${l:HLS.SUBMIT_SUCCESS}', duration: 2000 }); $('${/parameter/@winid}').close(); }, error: function() { window['${/parameter/@layout_code}_unlock_layout_dynamic_window'](); }, failure: function() { window['${/parameter/@layout_code}_unlock_layout_dynamic_window'](); } }); }, function() { window['${/parameter/@layout_code}_unlock_layout_dynamic_window'](); }); } //保存前调用,生成单据编号 window['${/parameter/@layout_code}_on_layout_dynamic_before_submit'] = function(ds, record) { window['${/parameter/@layout_code}_lock_layout_dynamic_window'](); var check_flag = false; if (record.get('contract_number')) { $('${/parameter/@layout_code}_virtual_ds').setSubmitParameter('document_id', record.get('contract_id')); $('${/parameter/@layout_code}_virtual_ds').setSubmitParameter('document_category', 'OTHER_CONTRACT'); return true; } Leaf.request({ url: $('sdic100d_get_special_fields_link_id').getUrl(), para: { document_category: record.get('document_category'), document_type: record.get('document_type') }, success: function(res) { var document_number = res.result.document_number; record.set('contract_number', document_number); check_flag = true; }, error: function() { window['${/parameter/@layout_code}_unlock_layout_dynamic_window'](); }, failure: function() { window['${/parameter/@layout_code}_unlock_layout_dynamic_window'](); }, sync: true, scope: this }); return check_flag; }; //商业伙伴信息 function opwn_bp_more_info(name, record_id) { var bp_ds = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'sdic_other_contract_bp'); var bp_record = $(bp_ds).findById(record_id); var param = bp_record.data; param['document_id'] = bp_record.get('bp_id'); param['cond_para2'] = bp_record.get('bp_type'); param['function_code'] = 'HLS306'; param['function_usage'] = 'QUERY'; param['url_title'] = '${l:HLS212.BP_MASTER_MAINTAIN}'; hls_doc_get_layout_code('sdic100d_con_contract_get_layout_code_link_id', param, 'hls_bp_master_modify_link'); } //报价 function quote_link(name, record_id,query_only) { window['${/parameter/@layout_code}_lock_layout_dynamic_window']; var head_ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'sdic_other_contract'); var head_record = $(head_ds_id).getAt(0); var prj_quotation_ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'prj_quotation'); //var prj_quotation_record = $(prj_quotation_ds_id).getCurrentRecord(); var prj_quotation_record = $(prj_quotation_ds_id).findById(record_id); var calc_recreate_L_formula; var saveData = []; if(query_only=='Y'){ url = $('${/parameter/@layout_code}_hls_fin_calculator_readonly_link_id').getUrl(); new Leaf.Window({ id: '${/parameter/@layout_code}_hls_fin_calc_readonly_link_winid', params: { document_id: head_record.get('contract_id'), document_category: head_record.get('document_category'), maintain_type: 'READONLY', calc_session_id: prj_quotation_record.get('calc_session_id'), winId: '${/parameter/@layout_code}_hls_fin_calc_readonly_link_winid', global_flag: 'Y', calc_type: 'CLASSIC_CALCULATOR' }, url: url, fullScreen: true, draggable: true }); window['${/parameter/@layout_code}_unlock_layout_dynamic_window']; return; }else{ url = $('${/parameter/@layout_code}_hls_fin_calculator_update_link_id').getUrl(); prj_quotation_record.set('to_doc_table', 'HLS_FIN_CALCULATOR_HD'); prj_quotation_record.set('function_code', '${/parameter/@function_code}'); prj_quotation_record.set('function_usage', '${/parameter/@function_usage}'); prj_quotation_record.set('document_id', head_record.get('contract_id')); if (prj_quotation_record.get('quotation_id') && !prj_quotation_record.get('calc_session_id')) { calc_recreate_L_formula = 'Y'; prj_quotation_record.set('_status', 'update'); } else if (prj_quotation_record.get('quotation_id') && prj_quotation_record.get('calc_session_id')) { calc_recreate_L_formula = 'N'; prj_quotation_record.set('_status', 'execute'); } else if (!head_record.get('contract_id')) { Leaf.showMessage('${l:HLS.PROMPT}', '${l:HLS.EXECUTE_AFTER_SAVE}'); return; } else { calc_recreate_L_formula = 'Y'; prj_quotation_record.set('_status', 'insert'); } prj_quotation_record.set('from_doc_table', 'PRJ_QUOTATION'); prj_quotation_record.set('from_doc_pk', prj_quotation_record.get('quotation_id')); prj_quotation_record.set('calculate_flag', 'N'); saveData.push(prj_quotation_record.data); Leaf.request({ url: $('${/parameter/@layout_code}_hls_fin_doc_quotation_link_id').getUrl(), para: saveData, success: function(res) { window['${/parameter/@layout_code}_unlock_layout_dynamic_window']; var quotation_id = prj_quotation_record.get('quotation_id') || res.result.quotation_id; var win = new Leaf.Window({ id: '${/parameter/@layout_code}_hls_fin_calc_quotation_link_winid', params: { document_id: head_record.get('contract_id'), document_category: '${/parameter/@document_category}', maintain_type: '${/parameter/@maintain_type}', calc_session_id: res.result.record.calc_session_id, quotation_id: quotation_id, dsId: prj_quotation_ds_id, winId: '${/parameter/@layout_code}_hls_fin_calc_quotation_link_winid', global_flag: 'Y', id_num: 0, calc_type: 'CLASSIC_CALCULATOR', recreate_L_formula: calc_recreate_L_formula }, url: url, // title: '${l:HLS.FIN_CALCULATOR}', fullScreen: true, draggable: true }); win.on('close', function() { $(prj_quotation_ds_id).setQueryParameter('contract_id', head_record.get('contract_id')); //$(hls_fin_calculator_ln_ds_id).setQueryParameter('project_id', project_id); $(prj_quotation_ds_id).query(); //$(hls_fin_calculator_ln_ds_id).query(); window['${/parameter/@layout_code}_unlock_layout_dynamic_window']; }); }, failure: function() { window['${/parameter/@layout_code}_unlock_layout_dynamic_window']; }, error: function() { window['${/parameter/@layout_code}_unlock_layout_dynamic_window']; }, scope: this }); } } //保存submitsuccess调用 window['${/parameter/@layout_code}_on_layout_dynamic_submitsuccess'] = function(ds, record, res) { window['${/parameter/@layout_code}_lock_layout_dynamic_window'](); var ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'sdic_other_contract'); var cdd_item_ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'prj_cdd_item_doc_ref'); if (ds_id && cdd_item_ds_id) { record = $(ds_id).getAt(0); var prj_cdd_item_doc_ref_ds = $(cdd_item_ds_id); prj_cdd_item_doc_ref_ds.setQueryParameter('cdd_list_id', record.get('cdd_list_id')); prj_cdd_item_doc_ref_ds.query(); } window['${/parameter/@layout_code}_unlock_layout_dynamic_window'](); }; function upload_file(id, name, query_only) { var record = window['${/parameter/@layout_code}_hls_link_render_record'][id + '---' + name]; if (record.get('check_id')) { var url; if (query_only == 'Y') { url = $('sdic100d_cdd_downloadFile_id').getUrl() + '?table_name=PRJ_CDD_ITEM_CHECK&header_id=' + record.get('check_id'); } else { url = $('sdic100d_cdd_uploadFile_id').getUrl() + '?table_name=PRJ_CDD_ITEM_CHECK&header_id=' + record.get('check_id'); } var win = new Leaf.Window({ url: url, title: '${l:HLS.SUPPORTING_DOCUMENT}', id: 'prj500_cdd_uploadFile_screen_id', width: 850, height: 400 }); win.on('close', function() { record.ds.query(); }); } else { Leaf.showMessage('${l:HLS.PROMPT}', '请先保存!'); } }; //超链接渲染 window['${/parameter/@layout_code}_dynamic_link_renderer'] = function(value, record, name, config_record) { var link_function = ''; window['${/parameter/@layout_code}_hls_link_render_record'][record.id + '---' + name] = record; if (name === 'more' && !record.isNew) { return '<a href="javascript:opwn_bp_more_info(\'' + name + '\',\'' + record.id + '\')">明细</a>'; } else if (name === 'quote' && !record.isNew){ return '<a href="javascript:quote_link(\'' + name + '\',\'' + record.id + '\',\'' + config_record.get('query_only') + '\')">报价</a>'; }if (name == 'attachment') { link_function = 'upload_file'; if (record.get('attach_count') == 0 || !record.get('attach_count')) { return '<a href="javascript:window[\'' + link_function + '\'](\'' + record.id + '\',\'' + name + '\',\'' + config_record.get('query_only') + '\');">' + config_record.get('prompt') + '</a>'; } else { return '<a href="javascript:window[\'' + link_function + '\'](\'' + record.id + '\',\'' + name + '\',\'' + config_record.get('query_only') + '\');">' + config_record.get('prompt') + '(' + record.get('attach_count') + ')' + '</a>'; } } else if (name == 'attach_file_name') { if (value != null) { var link = '${/request/@context_path}/atm_download.lsc?attachment_id='; var str = value.split(';;'); var url = ''; for (var i = 0;i < str.length;i++) { var temp = str[i].split('--'); if (!Leaf.isEmpty(temp[0])) { url = url + '<a href=' + link + temp[1] + '>' + temp[0] + '</a>' + ','; } } return url; } } else { return ''; } }; window['${/parameter/@layout_code}_submit_approval_layout_dynamic_click'] = function() { window['${/parameter/@layout_code}_SAVE_LAYOUT_DYNAMIC_CLICK'](submit_wfl); }; //提交审批 function submit_wfl(){ var ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'sdic_other_contract'); var head_record = $(ds_id).getAt(0); Leaf.showConfirm('${HLS.PROMPT}', '确认提交审批吗?', function() { window['${/parameter/@layout_code}_lock_layout_dynamic_window'](); Leaf.request({ url: $('sdic100d_submit_other_contract_link_id').getUrl(), para: { contract_id: head_record.get('contract_id') }, success: function(res) { window['${/parameter/@layout_code}_unlock_layout_dynamic_window'](); Leaf.SideBar.show({ msg: '${l:HLS.SUBMIT_SUCCESS}', duration: 2000 }); $('${/parameter/@winid}').close(); }, failure: function() { window['${/parameter/@layout_code}_unlock_layout_dynamic_window'](); }, error: function() { window['${/parameter/@layout_code}_unlock_layout_dynamic_window'](); }, scope: this }); }, function() { window['${/parameter/@layout_code}_unlock_layout_dynamic_window'](); }); } //更新时调用 window['${/parameter/@layout_code}_on_layout_dynamic_update'] = function(ds, record, name, value, old_valuess) { var ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'sdic_other_contract'); if (ds.id == ds_id) { //获取基准利率 if (name == 'base_rate_type' || name == "contract_start_date" || name == "contract_end_date" || name == 'interest_period') { if (record.get('base_rate_type') && (name == 'base_rate_type' || name == "contract_start_date" || name == "contract_end_date") && (record.get('base_rate_type') == 'FIXED' || record.get('base_rate_type') == 'PBOC' || record.get('base_rate_type') == 'LPR')) { if (record.get('contract_start_date') && record.get('contract_end_date') && record.get('base_rate_type')) { Leaf.request({ url: $('sdic100d_other_con_get_base_rate').getUrl(), para: { base_rate_type: record.get('base_rate_type'), loan_date_to: record.get('contract_end_date'), loan_date_from: record.get('contract_start_date'), currency: record.get('currency') }, success: function(data) { if (data.result.record && !data.result.record.length) { record.set('base_rate', data.result.record.base_rate); } else { record.set('base_rate', ''); } }, failure: function() { }, error: function() { }, scope: this }); } } else if (record.get('base_rate_type') && (name == 'base_rate_type' || name == "interest_period" || name == 'contract_start_date')) { if (record.get('interest_period') && record.get('base_rate_type') && record.get('contract_start_date')) { Leaf.request({ url: $('sdic100d_other_con_get_base_rate').getUrl(), para: { base_rate_type: record.get('base_rate_type'), interest_period: record.get('interest_period'), loan_date_from: record.get('contract_start_date'), loan_date_to: record.get('contract_end_date'), currency: record.get('currency') }, success: function(data) { if (data.result.record && !data.result.record.length) { record.set('base_rate', data.result.record.base_rate); } else { record.set('base_rate', ''); } }, failure: function() { }, error: function() { }, scope: this }); } } } //获取利率 if (name == 'base_rate' || name == "int_rate_fixing_way" || name == 'int_rate_fixing_range') { if ((record.get('base_rate') || record.get('base_rate') == 0) && record.get('int_rate_fixing_way') && record.get('int_rate_fixing_range')) { var int_rate = 0; //下调 if (record.get('int_rate_fixing_way') == 'DECREASE') { record.set('int_rate', minus(record.get('base_rate'), record.get('int_rate_fixing_range'))); //上调 } else if (record.get('int_rate_fixing_way') == 'PLUS') { record.set('int_rate', plus(record.get('base_rate'), record.get('int_rate_fixing_range'))); //下浮 } else if (record.get('int_rate_fixing_way') == 'FLOATING_DOWNWARD') { record.set('int_rate', mul(record.get('base_rate'), minus(1, record.get('int_rate_fixing_range')))); } //上浮 else if (record.get('int_rate_fixing_way') == 'MUTIPLY') { record.set('int_rate', mul(record.get('base_rate'), plus(1, record.get('int_rate_fixing_range')))); } if(record.get('int_rate')<0){ Leaf.showMessage('提示','注意合同利率为负数'); } } } } }; ]]></script> <a:screen-include screen="modules/cont/CON500/con_contract_get_layout_code.lview"/> </a:view> </a:screen>