var $type = 0;
var $nmoney = 0;//申请剩余报销额度
var $applycode = '';//申请单号
//获取href里面的参数
function getUrlParam(name) {
var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)"); //构造一个含有目标参数的正则表达式对象
var r = window.location.search.substr(1).match(reg); //匹配目标参数
if (r != null) return unescape(r[2]); return null; //返回参数值
}
var listtypeoptions = [];
///绑定费用类型
var gettype = function (type) {
switch (type) {
case 1:
$('#txtTitle').html('项目差旅费报销单');
listtypeoptions.push('');
listtypeoptions.push('');
listtypeoptions.push('');
break;
case 2:
$('#txtTitle').html('项目其他措施费报销单');
listtypeoptions.push('');
break;
case 3:
$('#txtTitle').html('项目汽车报销单');
listtypeoptions.push('');
break;
case 4:
$('#txtTitle').html('项目劳保费报销单');
listtypeoptions.push('');
break;
case 5:
$('#txtTitle').html('差旅费报销单');
listtypeoptions.push('');
listtypeoptions.push('');
listtypeoptions.push('');
break;
case 6:
$('#txtTitle').html('外部培训学习费报销单');
listtypeoptions.push('');
break;
case 7:
$('#txtTitle').html('例行培训学习费报销单');
listtypeoptions.push('');
break;
case 8:
$('#txtTitle').html('项目招待费报销单');
listtypeoptions.push('');
break;
case 9:
$('#txtTitle').html('汽车费报销单');
listtypeoptions.push('');
break;
case 10:
$('#txtTitle').html('招聘费报销单');
listtypeoptions.push('');
break;
case 11:
$('#txtTitle').html('办公费报销单');
listtypeoptions.push('');
//listtypeoptions.push('');
listtypeoptions.push('');
listtypeoptions.push('');
listtypeoptions.push('');
listtypeoptions.push('');
listtypeoptions.push('');
listtypeoptions.push('');
listtypeoptions.push('');
listtypeoptions.push('');
listtypeoptions.push('');
listtypeoptions.push('');
listtypeoptions.push('');
break;
case 12:
$('#txtTitle').html('办公物业水电费报销单');
listtypeoptions.push('');
break;
case 13:
$('#txtTitle').html('文化建设费报销单');
listtypeoptions.push('');
break;
case 14:
$('#txtTitle').html('会务费,保险费,劳保用品等其他可控管理费报销单');
listtypeoptions.push('');
listtypeoptions.push('');
listtypeoptions.push('');
listtypeoptions.push('');
listtypeoptions.push('');
listtypeoptions.push('');
listtypeoptions.push('');
break;
case 15:
$('#txtTitle').html('行政管理无票支出报销单');
listtypeoptions.push('');
break;
case 16:
$('#txtTitle').html('研发费用报销单');
listtypeoptions.push('');
break;
case 17:
$('#txtTitle').html('招待费报销单');
listtypeoptions.push('');
break;
case 18:
$('#txtTitle').html('项目无票支出报销单');
listtypeoptions.push('');
break;
case 19:
$('#txtTitle').html('项目辅材报销单');
listtypeoptions.push('');
listtypeoptions.push('');
listtypeoptions.push('');
listtypeoptions.push('');
break;
case 20:
$('#txtTitle').html('市内交通费报销单');
listtypeoptions.push('');
break;
case 21:
$('#txtTitle').html('项目市内交通费报销单');
listtypeoptions.push('');
break;
case 22:
$('#txtTitle').html('项目其他间接费报销单');
listtypeoptions.push('');
break;
case 23:
$('#txtTitle').html('节假日福利费报销单');
listtypeoptions.push('');
break;
case 24:
$('#txtTitle').html('其他福利费报销单');
listtypeoptions.push('');
break;
case 25:
$('#txtTitle').html('管理人员工作餐报销单');
listtypeoptions.push('');
break;
case 26:
$('#txtTitle').html('项目福利费报销单');
listtypeoptions.push('');
break;
case 27:
$('#txtTitle').html('零星材料报销单');
listtypeoptions.push('');
break;
case 28:
$('#txtTitle').html('低值易耗品报销单');
listtypeoptions.push('');
break;
case 29:
$('#txtTitle').html('项目低值易耗品报销单');
listtypeoptions.push('');
break;
case 30:
$('#txtTitle').html('信息化建设报销单');
listtypeoptions.push('');
break;
case 19041:
$('#txtTitle').html('咨询顾问费报销单');
listtypeoptions.push('');
break;
case 19042:
$('#txtTitle').html('审计费报销单');
listtypeoptions.push('');
break;
case 19043:
$('#txtTitle').html('IPO费用差旅住宿报销单');
listtypeoptions.push('');
break;
case 19044:
$('#txtTitle').html('IPO费用非差旅住宿报销单');
listtypeoptions.push('');
break;
case 19045:
$('#txtTitle').html('礼品、酒报销单');
listtypeoptions.push('');
break;
case 19046:
$('#txtTitle').html('电脑、打印机维修报销单');
listtypeoptions.push('');
break;
case 19047:
$('#txtTitle').html('办公/职工宿舍房租、水电、物业报销单');
listtypeoptions.push('');
break;
case 19048:
$('#txtTitle').html('可控管理费报销单');
listtypeoptions.push('');
break;
case 19049:
$('#txtTitle').html('保理、承兑等金融手续费报销单');
listtypeoptions.push('');
break;
case 190410:
$('#txtTitle').html('研发其他费用报销单');
listtypeoptions.push('');
break;
case 190411:
$('#txtTitle').html('办公室装修费用报销单');
listtypeoptions.push('');
break;
case 190412:
$('#txtTitle').html('会务费、保险费等其他可控管理费报销单');
listtypeoptions.push('');
listtypeoptions.push('');
listtypeoptions.push('');
break;
case 190413:
$('#txtTitle').html('行政罚款报销单');
listtypeoptions.push('');
break;
case 190414:
$('#txtTitle').html('房租费用报销单');
listtypeoptions.push('');
break;
}
if ($.trim(sysid) == '') {
$('select[name="fm_reimbursement_dtl.treeName"]').eq(0).html(listtypeoptions.join(''));
$('select[name="fm_reimbursement_dtl.treeName"]').eq(0).trigger("chosen:updated");
}
if (listtypeoptions.length <= 1)//只有一项一下,禁用选择
{
$('select[name="fm_reimbursement_dtl.treeName"]').attr('disabled', 'disabled');
}
//// 处理部门项目部不展示,职能部展示
var titl = $('#txtTitle').html();
if (titl.indexOf("项目") != -1) {
$('input[name="fm_reimbursement.dept_name"]').css('display', 'none');
}
$('input[name="fm_reimbursement.dept_id"]').css('display', 'none');
}
//根据申请申请单号查询剩余报销金额
var GetBaoXiaoYuMoney = function (applycode, ordercode) {
$.ajax({
url: "/oa/FM_reimbursement/GetYuMoney?applycode=" + applycode + "&&ordercode=" + ordercode, async: false, cache: false, dataType: "json",
success: function (data) {
console.log(data);
$nmoney = parseFloat(data);
}
});
}
//获取默认单据号与名称
var getusername = function (type) {
if ($.trim(sysid) == '') {
$.ajax({
url: "/oa/FM_reimbursement/GetLoad", async: false, cache: false, dataType: "json",
success: function (data) {
$('input[name="fm_reimbursement.orderCode"]').val(data.orderCode);
$('input[name="fm_reimbursement.dept_id"]').val(data.deptid);
$('input[name="fm_reimbursement.dept_name"]').val(data.deptname);
switch (type) {
case 1:
$('input[name="fm_reimbursement.name"]').val('项目差旅费报销(' + data.username + ')');
break;
case 2:
$('input[name="fm_reimbursement.name"]').val('项目其他措施费报销(' + data.username + ')');
break;
case 3:
$('input[name="fm_reimbursement.name"]').val('项目汽车费报销(' + data.username + ')');
break;
case 4:
$('input[name="fm_reimbursement.name"]').val('项目劳保费报销(' + data.username + ')');
break;
case 5:
$('input[name="fm_reimbursement.name"]').val('差旅费报销(' + data.username + ')');
break;
case 6:
$('input[name="fm_reimbursement.name"]').val('外部培训学习费报销(' + data.username + ')');
break;
case 7:
$('input[name="fm_reimbursement.name"]').val('例行培训学习费报销(' + data.username + ')');
break;
case 8:
$('input[name="fm_reimbursement.name"]').val('项目招待费报销(' + data.username + ')');
break;
case 9:
$('input[name="fm_reimbursement.name"]').val('汽车费报销(' + data.username + ')');
break;
case 10:
$('input[name="fm_reimbursement.name"]').val('招聘费报销(' + data.username + ')');
break;
case 11:
$('input[name="fm_reimbursement.name"]').val('办公费报销(' + data.username + ')');
break;
case 12:
$('input[name="fm_reimbursement.name"]').val('办公物业水电费报销(' + data.username + ')');
break;
case 13:
$('input[name="fm_reimbursement.name"]').val('文化建设费报销(' + data.username + ')');
break;
case 14:
$('input[name="fm_reimbursement.name"]').val('会务费,保险费,劳保用品等其他可控管理费报销(' + data.username + ')');
break;
case 15:
$('input[name="fm_reimbursement.name"]').val('行政管理无票支出报销(' + data.username + ')');
break;
case 16:
$('input[name="fm_reimbursement.name"]').val('研发费用报销(' + data.username + ')');
break;
case 17:
$('input[name="fm_reimbursement.name"]').val('招待费报销(' + data.username + ')');
break;
case 18:
$('input[name="fm_reimbursement.name"]').val('项目无票支出报销(' + data.username + ')');
break;
case 19:
$('input[name="fm_reimbursement.name"]').val('项目辅材报销(' + data.username + ')');
break;
case 20:
$('input[name="fm_reimbursement.name"]').val('市内交通费报销(' + data.username + ')');
break;
case 21:
$('input[name="fm_reimbursement.name"]').val('项目市内交通费报销(' + data.username + ')');
break;
case 22:
$('input[name="fm_reimbursement.name"]').val('项目其他间接费报销(' + data.username + ')');
break;
case 23:
$('input[name="fm_reimbursement.name"]').val('节假日福利费报销(' + data.username + ')');
break;
case 24:
$('input[name="fm_reimbursement.name"]').val('其他福利费报销(' + data.username + ')');
break;
case 25:
$('input[name="fm_reimbursement.name"]').val('管理人员工作餐报销(' + data.username + ')');
break;
case 26:
$('input[name="fm_reimbursement.name"]').val('项目福利费报销(' + data.username + ')');
break;
case 27:
$('input[name="fm_reimbursement.name"]').val('零星材料报销(' + data.username + ')');
break;
case 28:
$('input[name="fm_reimbursement.name"]').val('低值易耗品报销(' + data.username + ')');
break;
case 29:
$('input[name="fm_reimbursement.name"]').val('项目低值易耗品报销(' + data.username + ')');
break;
case 30:
$('input[name="fm_reimbursement.name"]').val('信息化建设报销(' + data.username + ')');
break;
case 19041:
$('input[name="fm_reimbursement.name"]').val('咨询顾问费报销(' + data.username + ')');
break;
case 19042:
$('input[name="fm_reimbursement.name"]').val('审计费报销(' + data.username + ')');
break;
case 19043:
$('input[name="fm_reimbursement.name"]').val('IPO费用差旅住宿报销(' + data.username + ')');
break;
case 19044:
$('input[name="fm_reimbursement.name"]').val('IPO费用非差旅住宿报销(' + data.username + ')');
break;
case 19045:
$('input[name="fm_reimbursement.name"]').val('礼品、酒报销(' + data.username + ')');
break;
case 19046:
$('input[name="fm_reimbursement.name"]').val('电脑、打印机维修报销(' + data.username + ')');
break;
case 19047:
$('input[name="fm_reimbursement.name"]').val('办公/职工宿舍房租、水电、物业报销(' + data.username + ')');
break;
case 19048:
$('input[name="fm_reimbursement.name"]').val('可控管理费报销(' + data.username + ')');
break;
case 19049:
$('input[name="fm_reimbursement.name"]').val('保理、承兑等金融手续费报销(' + data.username + ')');
break;
case 190410:
$('input[name="fm_reimbursement.name"]').val('研发其他费用报销(' + data.username + ')');
break;
case 190411:
$('input[name="fm_reimbursement.name"]').val('办公室装修费用报销(' + data.username + ')');
break;
case 190412:
$('input[name="fm_reimbursement.name"]').val('会务费、保险费等其他可控管理费报销(' + data.username + ')');
break;
case 190413:
$('input[name="fm_reimbursement.name"]').val('行政罚款报销(' + data.username + ')');
break;
case 190414:
$('input[name="fm_reimbursement.name"]').val('房租费用报销(' + data.username + ')');
break;
}
}
});
}
}
var listzxw = [];//成本中心
//获取成本中心
var getcbzx = function () {
$.ajax({
url: "/oa/FM_reimbursement/GetCBZXW", async: false, cache: false, dataType: "json",
success: function (data) {
listzxw.push('');
var nobjectid = $('#fm_reimbursement_objectid').val();
console.log(nobjectid);
$.each(data, function (i, r) {
var isselect = '';
if ($.trim(sysid) == '' && ((parseInt(r.isselect) == 1 && parseInt(r.typeforcost) == 0) || ($.trim(nobjectid) != '' && parseInt(nobjectid) > 0 && parseInt(r.typeforcost) == 1 && parseInt(r.costid
) == parseInt(nobjectid)))) {
isselect = 'selected';
}
listzxw.push('');
});
if ($.trim(sysid) == '') {
$('select[name="fm_reimbursement_dtl.costname"]').html(listzxw.join(''));
$('select[name="fm_reimbursement_dtl.costname"]').trigger("chosen:updated");
}
}
});
}
//计算总金额
var countmoney = function () {
var count = 0;
var applymoney = 0;
$.each($('input[name="fm_reimbursement_dtl.applymoney"]'), function () {
//实际报销金额是否显示
var obj = $(this).parent().parent().find('input[name="fm_reimbursement_dtl.money"]').parent().css('display');
//实际报销金额是否可编辑
var isdisabled = $(this).parent().parent().find('input[name="fm_reimbursement_dtl.money"]').attr('disabled');
if (obj == 'none' || isdisabled == 'disabled') {
var val = $.trim($(this).val());
val = isNaN(val) ? 0 : val;
val = val == '' ? 0 : parseFloat(val);
applymoney += val;
var taxrate = parseInt($(this).parent().parent().find('select[name="fm_reimbursement_dtl.taxrate"]').val()) * 0.01;
var tax = (val / (1 + taxrate) * taxrate).toFixed(2);;
$(this).parent().parent().find('input[name="fm_reimbursement_dtl.tax"]').val(tax);
}
else {
applymoney = initItems.applymoney;
var val = $(this).parent().parent().find('input[name="fm_reimbursement_dtl.money"]').val();
val = isNaN(val) ? 0 : val;
val = val == '' ? 0 : parseFloat(val);
count += val;
var taxrate = parseInt($(this).parent().parent().find('select[name="fm_reimbursement_dtl.taxrate"]').val()) * 0.01;
var tax = (val / (1 + taxrate) * taxrate).toFixed(2);;
$(this).parent().parent().find('input[name="fm_reimbursement_dtl.tax"]').val(tax);
}
});
if ($applycode != '' && ($type == 8 || $type == 17)) {
if (applymoney > $nmoney || count > $nmoney) {
layer.alert('报销总金额不能超出申请总金额', { icon: 5 });
return false;
}
}
if (applymoney != 0) {
$('input[name="fm_reimbursement.applymoney"]').val(applymoney.toFixed(2));
}
if (count != 0) {
$('input[name="fm_reimbursement.money"]').val(count.toFixed(2));
}
}
//选择计算金额
$(document).on('change', $('input[name="fm_reimbursement_dtl.applymoney"],input[name="fm_reimbursement_dtl.money"],select[name="fm_reimbursement_dtl.taxrate"]'), function (i, r) {
countmoney();
});
var thisobj = null;
//财务科目
var getCWinfo = function (obj) {
thisobj = obj;
layer.open({
type: 2,
title: '财务科目',
shadeClose: true,
shade: 0.4,
area: ['90%', '90%'],
content: "/Article/CWindex"
});
}
//选择财务科目后触发
var setCWInfo = function (SubjectEncode, SubjectName) {
$(thisobj).parent().parent().find('input[name="fm_reimbursement_dtl.costtype"]').val(SubjectName);
$(thisobj).parent().parent().find('input[name="fm_reimbursement_dtl.costtypeid"]').val(SubjectEncode);
layer.closeAll();
}
//删除事件回调操作
deleteMethod = function () {
countmoney();
}
//添加事件回调操作
createMethod = function () {
// chkNum();
var ntr = $('select[name="fm_reimbursement_dtl.treeName"]').length;
$('select[name="fm_reimbursement_dtl.treeName"]').eq(ntr - 1).html(listtypeoptions.join(''));
$('select[name="fm_reimbursement_dtl.treeName"]').eq(ntr - 1).trigger("chosen:updated");
if (listtypeoptions.length <= 1)//只有一项一下,禁用选择
{
$('select[name="fm_reimbursement_dtl.treeName"]').eq(ntr - 1).attr('disabled', 'disabled');
$('select[name="fm_reimbursement_dtl.treeName"]').eq(ntr - 1).chosen();
}
$('select[name="fm_reimbursement_dtl.taxrate"]').eq(ntr - 1).chosen();
var inputs = '';
$('input[name="fm_reimbursement_dtl.costtype"]').eq(ntr - 1).after(inputs);
//财务科目选择后触发
$('input[name="fm_reimbursement_dtl.costtype"]').eq(ntr - 1).bind('focus', function (i, r) {
getCWinfo(this);
});
if ($type == 1 || $type == 5 || $type == 20 || $type == 21 || $type == 8 || $type == 17) {
var costid = $('select[name="fm_reimbursement_dtl.costname"]').find('option:selected').attr('costid');
var typeforcost = $('select[name="fm_reimbursement_dtl.costname"]').find('option:selected').attr('typeforcost');
inputs = '';
inputs += '';
$('select[name="fm_reimbursement_dtl.costname"]').after(inputs);
$('select[name="fm_reimbursement_dtl.costname"]').eq(ntr - 1).html(listzxw.join(''));
$('select[name="fm_reimbursement_dtl.costname"]').eq(ntr - 1).chosen();
//成本中心选择后触发
$('select[name="fm_reimbursement_dtl.costname"]').eq(ntr - 1).bind('change', function () {
var costid = $('select[name="fm_reimbursement_dtl.costname"]').eq(ntr - 1).find('option:selected').attr('costid');
var typeforcost = $('select[name="fm_reimbursement_dtl.costname"]').eq(ntr - 1).find('option:selected').attr('typeforcost');
$(this).parent().parent().find('input[name="fm_reimbursement_dtl.costid"]').val(costid);
$(this).parent().parent().find('input[name="fm_reimbursement_dtl.typeforcost"]').val(typeforcost);
});
}
changeTextarea();
}
//动态添加CSS样式
function addCSS() {
var str_style = 'td{ position:relative;}';
if (document.all) { // document.createStyleSheet(url)
window.style = str_style;
document.createStyleSheet("javascript:style");
} else { //document.createElement(style)
var style = document.createElement('style');
style.type = 'text/css';
style.innerHTML = str_style;
document.getElementsByTagName('HEAD').item(0).appendChild(style);
}
}
//把input改为textarea
function changeTextarea() {
//用途
$('input[name="fm_reimbursement_dtl.costusage"]').each(function (i, input) {
var value = $.trim($(this).val());
var textarea = createTextarea("fm_reimbursement_dtl", "costusage");
textarea.style.right = "0px";
//var value = "";
//if (childrenItems.length > i && childrenItems[i].hasOwnProperty("costusage"))
// value = childrenItems[i].costusage
changeInputCell(input, textarea, value);
})
//业务内容
$('input[name="fm_reimbursement_dtl.remarks"]').each(function (i, input) {
var value = $.trim($(this).val());
var textarea = createTextarea("fm_reimbursement_dtl", "remarks");
textarea.style.left = "0px";
changeInputCell(input, textarea, value);
})
}
//替换表格控件元素
function changeInputCell(input, newInput, value) {
value = value || "";
var $input = $(input);
var $newInput = $(newInput);
var parent = input.parentNode;
$newInput.val(value);
var hasEdit = $input.hasClass("edit");
var isDisbale = $input.prop("disabled");
isDisbale && newInput.setAttribute("disabled", "disabled");
newInput.innerHTML = value;
$input.remove();
parent.appendChild(newInput);
}
//创建textarea
function createTextarea(table, name) {
var textarea = document.createElement("textarea");
textarea.className = "tex_inp";
textarea.id = table + "_" + name;
textarea.name = table + "." + name;
textarea.setAttribute("field", name);
return textarea;
}
///数据加载
var initData = function () {
//chkNum();
addCSS();
changeTextarea();
var url = window.location.href;
var type = parseInt(getUrlParam('type'));
var ApplyCode = '';
var orderType = 0;
var dept_name = "", dept_id = 0;
if ($.trim(sysid) != '' && initItems != null) {
var sprintbtn = '
表单打印';
sprintbtn += '
审核意见打印';
$('input[name="fm_reimbursement_dtl.tax"]').each(function () {
if ($(this).val() == "") {
$(this).val("0");
}
});
dept_id = initItems.dept_id;
dept_name = initItems.dept_name;
type = parseInt(initItems.type);
ApplyCode = initItems.ApplyCode;
orderType = parseInt(initItems.orderType);
}
//// 处理部门项目部不展示,职能部展示
var titl = $('#txtTitle').html();
if (titl.indexOf("项目") != -1) {
$('input[name="fm_reimbursement.dept_name"]').css('display', 'none');
}
$('input[name="fm_reimbursement.dept_id"]').css('display', 'none');
$type = type;
var inputs = '';
$('input[name="fm_reimbursement.orderCode"]').after(inputs);
ApplyCode = ApplyCode == '' ? $.trim(getUrlParam('orderCode')) : ApplyCode;
$('input[name="fm_reimbursement.ApplyCode"]').val(ApplyCode);
$('input[name="fm_reimbursement.ApplyCode"]').attr('disabled', 'disabled');
var ot = $.trim(getUrlParam('orderType'));
if (ot != '') {
orderType = parseInt(ot);
}
var lbtype = '';
switch (orderType) {
case 1: lbtype = '合同单号'; break;
case 2: lbtype = '申请单号'; break;
}
if ($.trim(ApplyCode) == '') {
$('input[name="fm_reimbursement.ApplyCode"]').parent().parent().remove();
}
else {
$('input[name="fm_reimbursement.ApplyCode"]').parent().parent().find('label').html(lbtype);
}
inputs = '';
$('input[name="fm_reimbursement.orderCode"]').after(inputs);
var projectid = $.trim(getUrlParam('projectid'));
projectid = projectid == '' ? 0 : projectid;
projectid = parseInt(projectid);
if (projectid > 0) {
$('#fm_reimbursement_objectid').val(projectid);
$('#fm_reimbursement_objectid').attr('disabled', 'disabled');
$('#fm_reimbursement_objectid').trigger("chosen:updated");
}
gettype(type);
getusername(type);
if (type == 1 || type == 5 || type == 20 || type == 21 || type == 8 || type == 17) {
getcbzx();
}
if ($.trim(sysid) != '' && initItems.Children != null && initItems.Children != undefined && initItems.Children.length > 0) {
$.each(initItems.Children, function (i, r) {
$('select[name="fm_reimbursement_dtl.treeName"]').eq(i).html(listtypeoptions.join(''));
$('select[name="fm_reimbursement_dtl.treeName"]').eq(i).val(r.treeName);
$('select[name="fm_reimbursement_dtl.treeName"]').eq(i).trigger("chosen:updated");
var inputs = '';
$('input[name="fm_reimbursement_dtl.costtype"]').eq(i).after(inputs);
if (type == 1 || type == 5 || type == 20 || type == 21 || type == 8 || type == 17) {
inputs = '';
inputs += '';
$('select[name="fm_reimbursement_dtl.costname"]').eq(i).after(inputs);
$('select[name="fm_reimbursement_dtl.costname"]').eq(i).html(listzxw.join(''));
$('select[name="fm_reimbursement_dtl.costname"]').eq(i).val(r.costname);
$('select[name="fm_reimbursement_dtl.costname"]').eq(i).trigger("chosen:updated");
}
});
}
$('input[name="fm_reimbursement.IsInPlan"]:eq(0)').attr("value", '1');
$('input[name="fm_reimbursement.IsInPlan"]:eq(1)').attr("value", '2');
if ($.trim(sysid) != '' && initItems != null) {
var sprintbtn = '
表单打印';
sprintbtn += '
审核意见打印';
$('#txtTitle').append(sprintbtn);
}
if (sysid == '') {
var inputs = '';
$('input[name="fm_reimbursement_dtl.costtype"]').after(inputs);
if (type == 1 || type == 5 || type == 20 || type == 21 || type == 8 || type == 17) {
var costid = $('select[name="fm_reimbursement_dtl.costname"]').find('option:selected').attr('costid');
var typeforcost = $('select[name="fm_reimbursement_dtl.costname"]').find('option:selected').attr('typeforcost');
inputs = '';
inputs += '';
$('select[name="fm_reimbursement_dtl.costname"]').after(inputs);
}
}
//成本中心选择后触发
$('select[name="fm_reimbursement_dtl.costname"]').bind('change', function () {
var costid = $('select[name="fm_reimbursement_dtl.costname"]').find('option:selected').attr('costid');
var typeforcost = $('select[name="fm_reimbursement_dtl.costname"]').find('option:selected').attr('typeforcost');
$(this).parent().parent().find('input[name="fm_reimbursement_dtl.costid"]').val(costid);
$(this).parent().parent().find('input[name="fm_reimbursement_dtl.typeforcost"]').val(typeforcost);
});
//财务科目选择后触发
$('input[name="fm_reimbursement_dtl.costtype"]').bind('focus', function (i, r) {
getCWinfo(this);
});
//添加更新字段
$('input[name="fm_reimbursement.money"],input[name="fm_reimbursement.applymoney"],input[name="fm_reimbursement_dtl.money"],input[name="fm_reimbursement_dtl.applymoney"],input[name="fm_reimbursement_dtl.tax"]').addClass('edit');
$applycode = sysid == '' ? $.trim(ApplyCode) : $.trim(initItems.ApplyCode);
var sordercode = $('#fm_reimbursement_orderCode').val();
//// edit by zyyao 2019/4/18 行政代高管和顾问 发起 招待和住宿
if ($applycode != '' && ($type == 8 || $type == 17)) {
GetBaoXiaoYuMoney($applycode, sordercode);
}
}