<?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:model-query defaultWhereClause="t1.function_code = ${/parameter/@function_code}" model="cus.CUS100.cus_default_function_name" rootPath="default_function_name"/> </a:init-procedure> <a:view> <a:link id="con_contract_get_layout_code_link_id" model="cont.CON500.con_contract_get_layout_code" modelaction="update"/> <a:link id="leg451_legal_fee_create_link_id" model="leg.LEG450.leg_legal_fee_create" modelaction="batch_update"/> <!-- <a:link id="leg_legal_fee_delete_link_id" model="leg.LEG450.leg_legal_fee_create" modelaction="delete"/> --> <a:link id="leg_fee_create_link_id" url="${/request/@context_path}/modules/leg/LEG600/leg_fee_create.lsc"/> <a:link id="leg_legal_fee_delete_link_id" url="${/request/@context_path}/modules/leg/LEG450/leg_fee_dml.lsc"/> <a:link id="hls_bp_master_modify_link" url="${/request/@context_path}/modules/hls/HLS214N/hls_bp_master_modify.lview"/> <a:link id="leg_legal_fee_modify_link_id" url="${/request/@context_path}/modules/leg/LEG450/leg_legal_fee_modify.lview"/> <script type="text/javascript"><![CDATA[ //保存前调用 /* function leg451_check(ds_id) { var records = $(ds_id).getSelected(); for (var i = 0;i < records.length;i++) { var legal_number =records[i].get('legal_number') ; var law_office_n =records[i].get('law_office_n') ; var cf_item_n =records[i].get('cf_item_n') ; var vat_amount = records[i].get('vat_amount') == undefined ? 0 : records[i].get('vat_amount'); var net_amount = records[i].get('net_amount') == undefined ? 0 : records[i].get('net_amount'); var amount = records[i].get('amount') == undefined ? 0 : records[i].get('amount'); var tax_rate = records[i].get('tax_rate') == undefined ? 0 : records[i].get('tax_rate'); if (amount <= 0 || vat_amount < 0 || net_amount < 0) { Leaf.showMessage('${l:PROMPT}', '金额小于零不合法!'); return; } if (parseFloat(amount) != parseFloat(vat_amount) + parseFloat(net_amount)) { Leaf.showMessage('${l:PROMPT}', '含税金额不等于不含税金额加税额!'); return; } if(tax_rate == 0){ Leaf.showMessage('${l:PROMPT}', law_office_n+'的'+cf_item_n+'(标为红色)税率未维护,请维护!'); return; } } } */ function create_cashflow() { var ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'con_contract'); var param = new Object(); var datas = []; var records = $(ds_id).getSelected(); for (var i = 0;i < records.length;i++) { if (records[i].get('legal_fee_id')) { data = {}; data['legal_fee_id'] = records[i].get('legal_fee_id'); data['_status'] = 'update'; datas.push(data); } } param['details'] = datas; var url_l = $('leg451_legal_fee_create_link_id').getUrl(); Leaf.request({ url: url_l, para: datas, success: function() { window['${/parameter/@layout_code}_unlock_layout_dynamic_window'](); $(ds_id).query(); }, error: function() { window['${/parameter/@layout_code}_unlock_layout_dynamic_window'](); }, failure: function() { window['${/parameter/@layout_code}_unlock_layout_dynamic_window'](); }, scope: this }); } window['${/parameter/@layout_code}_user_button2_layout_dynamic_click'] = function() { var ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'con_contract'); var tax_rate_count = 0; var records = $(ds_id).getSelected(); for (var i = 0;i < records.length;i++) { if (records[i].dirty == true) { Leaf.showMessage('${l:PROMPT}', '请先保存再确认'); return; } } if (!records.length) { Leaf.showMessage('${l:PROMPT}', '请至少选择一条记录'); return; } var param = new Object(); var datas = []; if (records.length == 0) { Leaf.showInfoMessage('信息', '请至少选择一行!', null, 200, 100); } //校验 // leg451_check(ds_id); for (var i = 0;i < records.length;i++) { var legal_number = records[i].get('legal_number'); var bp_id_n = records[i].get('bp_id_n'); var cf_item_n = records[i].get('cf_item_n'); var vat_amount = records[i].get('vat_amount') == undefined ? 0 : records[i].get('vat_amount'); var net_amount = records[i].get('net_amount') == undefined ? 0 : records[i].get('net_amount'); var amount = records[i].get('amount') == undefined ? 0 : records[i].get('amount'); var tax_rate = records[i].get('tax_rate') == undefined ? -99 : records[i].get('tax_rate'); if (amount <= 0 || vat_amount < 0 || net_amount < 0) { Leaf.showMessage('${l:PROMPT}', '金额小于零不合法!'); return; } var sum_amount = vat_amount+net_amount; if (parseFloat(amount.toFixed(2)) != parseFloat(sum_amount.toFixed(2)) ){ Leaf.showMessage('${l:PROMPT}', '含税金额不等于不含税金额加税额!'); return; } if (tax_rate == -99) { // Leaf.showMessage('${l:PROMPT}', bp_id_n + '的' + cf_item_n + '(标为红色)税率未维护,请维护!', null, 350); tax_rate_count = tax_rate_count + 1; } } if (tax_rate_count >= 1) { Leaf.showConfirm('${l:PROMPT}', bp_id_n + '的' + cf_item_n + '(标为红色)税率为0或为维护,是否确认生成现金流?', function() { create_cashflow(); }, function() { }, 350, 120); } else { Leaf.showConfirm('${l:PROMPT}', '是否确认生成现金流?', function() { create_cashflow(); }, function() { }); } }; //导出 window['${/parameter/@layout_code}_user_button1_layout_dynamic_click'] = function() { var ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'con_contract'); var grid_id = ds_id.replace('ds', 'layout_grid_id'); $(grid_id)._export('xls', '${/model/default_function_name/record/@function_name}'); }; function open_bp_win(ds_id, record_id) { var record = $(ds_id).findById(record_id); var param = record.data; maintain_type = 'CREATE'; param['url_title'] = 'BP费率维护'; param['maintain_type'] = maintain_type; param['cond_para2'] = param['bp_type']; param['function_code'] = 'HLS214D'; param['function_usage'] = 'MODIFY'; param['url_title'] = '${l:HLS212.BP_MASTER_MAINTAIN}'; hls_doc_get_layout_code('con_contract_get_layout_code_link_id', param, 'hls_bp_master_modify_link', ds_id); } function open_contract_win(ds_id, record_id) { var record = $(ds_id).findById(record_id); var param = record.data; maintain_type = 'CREATE'; param['function_code'] = 'LEG450D'; param['function_usage'] = 'CREATE'; param['url_title'] = '法务费用创建'; url_l = 'leg_legal_fee_modify_link_id'; param['maintain_type'] = maintain_type; hls_doc_get_layout_code('con_contract_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 == 'legal_number') { if (!record.get('tax_rate') && record.get('vat_flag') == 'Y') { return '<a style="color:red" href="javascript:open_contract_win(\'' + record.ds.id + '\',\'' + record.id + '\')">' + value + '</a>'; } else { return '<a href="javascript:open_contract_win(\'' + record.ds.id + '\',\'' + record.id + '\')">' + value + '</a>'; } } else if (name == 'bp_id_n' && value) { if (!record.get('tax_rate') && record.get('vat_flag') == 'Y') { //return '<a style="color:red" href="javascript:open_bp_win(\'' + record.ds.id + '\',\'' + record.id + '\')">' + value + '</a>'; return '<a style="color:red" href=#>' + value + '</a>'; } else { // return '<a href="javascript:open_bp_win(\'' + record.ds.id + '\',\'' + record.id + '\')">' + value + '</a>'; return value; } } else if (name == 'cashflow_flag' && value == 'Y') { return '<a style="color:red" href=#>' + value + '</a>'; } return value; }; /* function leg450_open_contract_win(record_id, name, type) { var ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'leg_legal_letter'); var legal_record = $(ds_id).getCurrentRecord(); var url_id = 'leg_uploadFile_id'; if (type == '1') { url_id = 'leg_uploadFile_id'; } else { url_id = 'leg_downloadFile_id'; } var url = $(url_id).getUrl() + '?table_name=LEG_LEGAL_LETTER&header_id=' + legal_record.data['legal_letter_id']; new Leaf.Window({ url: url, title: '附件', id: 'leg_legal_letter_id', width: 850, height: 400 }); } window['${/parameter/@layout_code}_dynamic_link_renderer'] = function(value, record, name, config_record) { if (name == 'attachment') { return '<a href="javascript:leg450_open_contract_win(\'' + record.id + '\',\'' + 'attachment' + '\',' + '2' + ')">' + '附件' + '</a>'; } return value; }; */ /* window['${/parameter/@layout_code}_on_layout_dynamic_update'] = function(ds, record, name, value, old_value, bp_seq) { var ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'leg_legal_fee'); if(ds.id == ds_id && name=='tax_rate' && value){ var amount = parseFloat(record.get('amount')); var tax_rate = parseFloat(value); var net_amount = (amount/(1+tax_rate)).toFixed(2); var tax_rate_field = record.getField('tax_rate'); if(value){ if (tax_rate < 0 || tax_rate > 1) { Leaf.showMessage('提示', '税率应在0到1之间!', null, 350); record.set('tax_rate', null); tax_rate_field.setValue(null); record.set('vat_fee', null); record.set('net_fee', null); return; } record.set('vat_amount',(amount - net_amount).toFixed(2)); record.set('net_amount',net_amount); }else{ record.set('vat_amount',''); record.set('net_amount',amount); } } else if (ds.id == ds_id && name == 'amount' && record.get('tax_rate')) { var tax_rate = parseFloat(record.get('tax_rate')== undefined ? 0 : record.get('tax_rate')); var amount = parseFloat(value); var net_amount = (amount/(1+tax_rate)).toFixed(2); var tax_rate_field = record.getField('tax_rate'); if (value) { if (tax_rate < 0 || tax_rate > 1) { Leaf.showMessage('提示', '税率应在0到1之间!', null, 350); record.set('tax_rate', null); tax_rate_field.setValue(null); record.set('vat_fee', null); record.set('net_fee', null); return; } record.set('vat_amount', (amount - net_amount).toFixed(2)); record.set('net_amount', net_amount); } else { record.set('vat_amount', ''); record.set('net_amount', amount); } } }; */ ]]></script> <a:screen-include screen="modules/cont/CON500/con_contract_get_layout_code.lview"/> </a:view> </a:screen>