//获取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 type = 0; ///绑定费用类型 var gettype = function (type) { switch (type) { case 1: $('#txtTitle').html('项目其他措施费付款单'); 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(''); 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(''); break; case 12: $('#txtTitle').html('例行培训学习费付款单'); listtypeoptions.push(''); break; case 13: $('#txtTitle').html('汽车费付款单'); listtypeoptions.push(''); break; case 14: $('#txtTitle').html('招聘费付款单'); listtypeoptions.push(''); break; case 15: $('#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(''); 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(''); break; case 20: $('#txtTitle').html('会务费,保险费,劳保用品等其他可控管理费付款单'); listtypeoptions.push(''); listtypeoptions.push(''); listtypeoptions.push(''); listtypeoptions.push(''); listtypeoptions.push(''); listtypeoptions.push(''); 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(''); 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(''); listtypeoptions.push(''); listtypeoptions.push(''); break; case 30: $('#txtTitle').html('管理人员工作餐付款单'); listtypeoptions.push(''); break; case 31: $('#txtTitle').html('年会、旅游付款单'); listtypeoptions.push(''); listtypeoptions.push(''); break; case 32: $('#txtTitle').html('其他福利费付款单'); listtypeoptions.push(''); break; case 33: $('#txtTitle').html('业务单位往来款付款单'); listtypeoptions.push(''); break; case 34: $('#txtTitle').html('项目投标保证金付款单'); listtypeoptions.push(''); break; case 35: $('#txtTitle').html('银行间资金划转付款单'); listtypeoptions.push(''); break; case 36: $('#txtTitle').html('备用金提取付款单'); listtypeoptions.push(''); break; case 37: $('#txtTitle').html('行政罚款支出付款单'); listtypeoptions.push(''); break; case 38: $('#txtTitle').html('计划外支出付款单'); listtypeoptions.push(''); break; case 39: $('#txtTitle').html('个人备用金借款单'); listtypeoptions.push(''); break; case 40: $('#txtTitle').html('项目内部借款付款单'); listtypeoptions.push(''); break; case 41: $('#txtTitle').html('项目主材付款单'); listtypeoptions.push(''); listtypeoptions.push(''); listtypeoptions.push(''); listtypeoptions.push(''); listtypeoptions.push(''); listtypeoptions.push(''); listtypeoptions.push(''); break; case 42: $('#txtTitle').html('项目辅材付款单'); listtypeoptions.push(''); listtypeoptions.push(''); listtypeoptions.push(''); listtypeoptions.push(''); break; case 43: $('#txtTitle').html('项目施工费/措施费付款单'); listtypeoptions.push(''); listtypeoptions.push(''); break; case 44: $('#txtTitle').html('办公消耗品付款单'); listtypeoptions.push(''); break; case 45: $('#txtTitle').html('房产付款单'); listtypeoptions.push(''); break; case 46: $('#txtTitle').html('机械设备付款单'); listtypeoptions.push(''); break; case 47: $('#txtTitle').html('电器/仪器/机具付款单'); listtypeoptions.push(''); listtypeoptions.push(''); listtypeoptions.push(''); break; case 48: $('#txtTitle').html('行政办公设备/车辆付款单'); listtypeoptions.push(''); listtypeoptions.push(''); break; case 49: $('#txtTitle').html('设备维修、改装、运输费用付款单'); listtypeoptions.push(''); listtypeoptions.push(''); listtypeoptions.push(''); break; case 50: $('#txtTitle').html('设备部劳务班组费用付款单'); listtypeoptions.push(''); break; case 51: $('#txtTitle').html('周转材料付款单'); listtypeoptions.push(''); break; case 52: $('#txtTitle').html('设备维修配件、改装配件、桩机配件采购付款单'); listtypeoptions.push(''); listtypeoptions.push(''); listtypeoptions.push(''); break; case 53: $('#txtTitle').html('节假日福利费付款单'); listtypeoptions.push(''); break; case 55: $('#txtTitle').html('差旅费付款单'); listtypeoptions.push(''); break; case 56: $('#txtTitle').html('项目差旅费付款单'); listtypeoptions.push(''); break; case 57: $('#txtTitle').html('项目生产类押金付款单'); listtypeoptions.push(''); break; case 58: $('#txtTitle').html('非生产类押金付款单'); listtypeoptions.push(''); break; case 19041: $('#txtTitle').html('IPO费用(差旅住宿)付款单'); listtypeoptions.push(''); break; case 19042: $('#txtTitle').html('IPO费用(非差旅住宿)付款单'); listtypeoptions.push(''); break; case 19043: $('#txtTitle').html('礼品、酒付款单'); listtypeoptions.push(''); listtypeoptions.push(''); break; case 19044: $('#txtTitle').html('电脑、打印机维修付款单'); listtypeoptions.push(''); listtypeoptions.push(''); break; case 19045: $('#txtTitle').html('办公/职工宿舍房租、水电、物业付款单'); listtypeoptions.push(''); listtypeoptions.push(''); listtypeoptions.push(''); break; case 19046: $('#txtTitle').html('会务费、保险费等其他可控管理费付款单'); listtypeoptions.push(''); listtypeoptions.push(''); listtypeoptions.push(''); listtypeoptions.push(''); listtypeoptions.push(''); listtypeoptions.push(''); listtypeoptions.push(''); break; case 19047: $('#txtTitle').html('研发其他费用付款单'); listtypeoptions.push(''); listtypeoptions.push(''); listtypeoptions.push(''); listtypeoptions.push(''); listtypeoptions.push(''); listtypeoptions.push(''); listtypeoptions.push(''); listtypeoptions.push(''); listtypeoptions.push(''); break; case 19048: $('#txtTitle').html('保险理赔款付款单'); listtypeoptions.push(''); break; case 19049: $('#txtTitle').html('保理、承兑等金融手续费付款单'); listtypeoptions.push(''); listtypeoptions.push(''); listtypeoptions.push(''); break; case 190410: $('#txtTitle').html('个税付款单'); listtypeoptions.push(''); break; case 190411: $('#txtTitle').html('公积金付款单'); listtypeoptions.push(''); break; case 190412: $('#txtTitle').html('市内交通费付款单'); listtypeoptions.push(''); break; case 190413: $('#txtTitle').html('项目市内交通费付款单'); listtypeoptions.push(''); break; case 190414: $('#txtTitle').html('行政罚款付款单'); listtypeoptions.push(''); break; case 190415: $('#txtTitle').html('房租费用付款单'); listtypeoptions.push(''); break; case 190416: $('#txtTitle').html('社保第三方代缴付款单'); listtypeoptions.push(''); break; case 190417: $('#txtTitle').html('公积金第三方代缴付款单'); listtypeoptions.push(''); break; case 19091: $('#txtTitle').html('劳务工资付款单'); document.getElementById('girdtable').rows[0].cells[0].innerHTML = '项目'; $.ajax({ url: "/DropDown/ProjectDropDownForProcurementOrder", async: false, cache: false, dataType: "json", success: function (data) { listtypeoptions.push(""); $.each(data, function (i, r) { listtypeoptions.push(''); }); } }); break; } if ($.trim(sysid) == '') { $('select[name="fm_otherexpenditureinfo_dtl.ExpenditureTypeName"]').eq(0).html(listtypeoptions.join('')); $('select[name="fm_otherexpenditureinfo_dtl.ExpenditureTypeName"]').eq(0).trigger("chosen:updated"); } if (listtypeoptions.length <= 1)//只有一项一下,禁用选择 { $('select[name="fm_otherexpenditureinfo_dtl.ExpenditureTypeName"]').attr('disabled', 'disabled'); } } // 金额转大写 var changeMoneyToChinese = function (money) { //汉字的数字 var cnNums = new Array('零', '壹', '贰', '叁', '肆', '伍', '陆', '柒', '捌', '玖'); //基本单位 var cnIntRadice = new Array('', '拾', '佰', '仟'); //对应整数部分扩展单位 var cnIntUnits = new Array('', '万', '亿', '兆'); //对应小数部分单位 var cnDecUnits = new Array('角', '分', '毫', '厘'); //整数金额时后面跟的字符 var cnInteger = '整'; //整型完以后的单位 var cnIntLast = '元'; //最大处理的数字 var maxNum = 999999999999999.9999; //金额整数部分 var integerNum; //金额小数部分 var decimalNum; //输出的中文金额字符串 var chineseStr = ''; //分离金额后用的数组,预定义 var parts; if (money == '') { return ''; } money = parseFloat(money); if (money >= maxNum) { //超出最大处理数字 toastr.warning("付款总额超出最大范围"); return ''; } if (money == 0) { chineseStr = cnNums[0] + cnIntLast + cnInteger; return chineseStr; } //转换为字符串 money = money.toString(); if (money.indexOf('.') == -1) { integerNum = money; decimalNum = ''; } else { parts = money.split('.'); integerNum = parts[0]; decimalNum = parts[1].substr(0, 4); } //获取整型部分转换 if (parseInt(integerNum, 10) > 0) { var zeroCount = 0; var IntLen = integerNum.length; for (var i = 0; i < IntLen; i++) { var n = integerNum.substr(i, 1); var p = IntLen - i - 1; var q = p / 4; var m = p % 4; if (n == '0') { zeroCount++; } else { if (zeroCount > 0) { chineseStr += cnNums[0]; } //归零 zeroCount = 0; chineseStr += cnNums[parseInt(n)] + cnIntRadice[m]; } if (m == 0 && zeroCount < 4) { chineseStr += cnIntUnits[q]; } } chineseStr += cnIntLast; } //小数部分 if (decimalNum != '') { var decLen = decimalNum.length; for (var i = 0; i < decLen; i++) { var n = decimalNum.substr(i, 1); if (n != '0') { chineseStr += cnNums[Number(n)] + cnDecUnits[i]; } } } if (chineseStr == '') { chineseStr += cnNums[0] + cnIntLast + cnInteger; } else if (decimalNum == '') { chineseStr += cnInteger; } return chineseStr; } //获取默认单据号与名称 var getusername = function (type) { if ($.trim(sysid) == '') { $.ajax({ url: "/oa/General/GetLoad", async: false, cache: false, dataType: "json", success: function (data) { $('input[name="fm_otherexpenditureinfo.Code"]').val(data.orderCode); $('select[name="fm_otherexpenditureinfo.DepartmentID"]').val(data.deptid); $('select[name="fm_otherexpenditureinfo.DepartmentID"]').trigger("chosen:updated"); $('input[name="fm_otherexpenditureinfo.dept_name"]').val(data.deptname); $('input[name="fm_otherexpenditureinfo.dept_id"]').val(data.deptid); switch (type) { case 1: $('input[name="fm_otherexpenditureinfo.Title"]').val('项目其他措施费付款(' + data.username + ')'); break; case 2: $('input[name="fm_otherexpenditureinfo.Title"]').val('项目汽车费付款(' + data.username + ')'); break; case 3: $('input[name="fm_otherexpenditureinfo.Title"]').val('项目劳保费付款(' + data.username + ')'); break; case 4: $('input[name="fm_otherexpenditureinfo.Title"]').val('项目其他间接费付款(' + data.username + ')'); break; case 5: $('input[name="fm_otherexpenditureinfo.Title"]').val('项目无票支出付款(' + data.username + ')'); break; case 6: $('input[name="fm_otherexpenditureinfo.Title"]').val('项目备用金借款(' + data.username + ')'); break; case 7: $('input[name="fm_otherexpenditureinfo.Title"]').val('项目招待费付款(' + data.username + ')'); break; case 8: $('input[name="fm_otherexpenditureinfo.Title"]').val('咨询顾问费付款(' + data.username + ')'); break; case 9: $('input[name="fm_otherexpenditureinfo.Title"]').val('审计费付款(' + data.username + ')'); break; case 10: $('input[name="fm_otherexpenditureinfo.Title"]').val('招待费付款(' + data.username + ')'); break; case 11: $('input[name="fm_otherexpenditureinfo.Title"]').val('外部培训学习费付款(' + data.username + ')'); break; case 12: $('input[name="fm_otherexpenditureinfo.Title"]').val('例行培训学习费付款(' + data.username + ')'); break; case 13: $('input[name="fm_otherexpenditureinfo.Title"]').val('汽车费付款(' + data.username + ')'); break; case 14: $('input[name="fm_otherexpenditureinfo.Title"]').val('招聘费付款(' + data.username + ')'); break; case 15: $('input[name="fm_otherexpenditureinfo.Title"]').val('办公费付款(' + data.username + ')'); break; case 16: $('input[name="fm_otherexpenditureinfo.Title"]').val('办公室装修付款(' + data.username + ')'); break; case 17: $('input[name="fm_otherexpenditureinfo.Title"]').val('办公物业水电费付款(' + data.username + ')'); break; case 18: $('input[name="fm_otherexpenditureinfo.Title"]').val('对外捐赠付款(' + data.username + ')'); break; case 19: $('input[name="fm_otherexpenditureinfo.Title"]').val('文化建设费付款(' + data.username + ')'); break; case 20: $('input[name="fm_otherexpenditureinfo.Title"]').val('会务费,保险费,劳保用品等其他可控管理费付款(' + data.username + ')'); break; case 21: $('input[name="fm_otherexpenditureinfo.Title"]').val('行政管理无票支出付款(' + data.username + ')'); break; case 22: $('input[name="fm_otherexpenditureinfo.Title"]').val('社保银行扣缴付款(' + data.username + ')'); break; case 23: $('input[name="fm_otherexpenditureinfo.Title"]').val('税金付款(' + data.username + ')'); break; case 24: $('input[name="fm_otherexpenditureinfo.Title"]').val('利息付款(' + data.username + ')'); $("input[name='fm_otherexpenditureinfo.IsInPlan']:eq(0)").parent().parent().siblings(".form-item-title").text("是否金融机构"); break; case 25: $('input[name="fm_otherexpenditureinfo.Title"]').val('还款、转贷付款(' + data.username + ')'); break; case 26: $('input[name="fm_otherexpenditureinfo.Title"]').val('内部借款付款(' + data.username + ')'); break; case 27: $('input[name="fm_otherexpenditureinfo.Title"]').val('研发费用付款(' + data.username + ')'); break; case 28: $('input[name="fm_otherexpenditureinfo.Title"]').val('信息化建设付款(' + data.username + ')'); break; case 29: $('input[name="fm_otherexpenditureinfo.Title"]').val('工资、年终各类评优付款(' + data.username + ')'); break; case 30: $('input[name="fm_otherexpenditureinfo.Title"]').val('管理人员工作餐付款(' + data.username + ')'); break; case 31: $('input[name="fm_otherexpenditureinfo.Title"]').val('年会、旅游付款(' + data.username + ')'); break; case 32: $('input[name="fm_otherexpenditureinfo.Title"]').val('其他福利费付款(' + data.username + ')'); break; case 33: $('input[name="fm_otherexpenditureinfo.Title"]').val('业务单位往来款付款(' + data.username + ')'); break; case 34: $('input[name="fm_otherexpenditureinfo.Title"]').val('项目投标保证金付款(' + data.username + ')'); var projectId = getUrlParam("projectid"); if (projectId != null && projectId != 0) { $('input[name="fm_otherexpenditureinfo.ProjectID"]').val(projectId); } break; case 35: $('input[name="fm_otherexpenditureinfo.Title"]').val('银行间资金划转付款(' + data.username + ')'); break; case 36: $('input[name="fm_otherexpenditureinfo.Title"]').val('备用金提取付款(' + data.username + ')'); break; case 37: $('input[name="fm_otherexpenditureinfo.Title"]').val('行政罚款支出付款(' + data.username + ')'); break; case 38: $('input[name="fm_otherexpenditureinfo.Title"]').val('计划外支出付款(' + data.username + ')'); break; case 39: $('input[name="fm_otherexpenditureinfo.Title"]').val('个人备用金借款(' + data.username + ')'); break; case 40: $('input[name="fm_otherexpenditureinfo.Title"]').val('项目内部借款付款(' + data.username + ')'); break; case 41: $('input[name="fm_otherexpenditureinfo.Title"]').val('项目主材付款(' + data.username + ')'); break; case 42: $('input[name="fm_otherexpenditureinfo.Title"]').val('项目辅材付款(' + data.username + ')'); break; case 43: $('input[name="fm_otherexpenditureinfo.Title"]').val('项目施工费/措施费付款(' + data.username + ')'); break; case 44: $('input[name="fm_otherexpenditureinfo.Title"]').val('办公消耗品付款(' + data.username + ')'); break; case 45: $('input[name="fm_otherexpenditureinfo.Title"]').val('房产付款(' + data.username + ')'); break; case 46: $('input[name="fm_otherexpenditureinfo.Title"]').val('机械设备付款(' + data.username + ')'); break; case 47: $('input[name="fm_otherexpenditureinfo.Title"]').val('电器/仪器/机具付款(' + data.username + ')'); break; case 48: $('input[name="fm_otherexpenditureinfo.Title"]').val('行政办公设备/车辆付款(' + data.username + ')'); break; case 49: $('input[name="fm_otherexpenditureinfo.Title"]').val('设备维修/改装/运输费用付款(' + data.username + ')'); break; case 50: $('input[name="fm_otherexpenditureinfo.Title"]').val('设备部劳务班组费用付款(' + data.username + ')'); break; case 51: $('input[name="fm_otherexpenditureinfo.Title"]').val('周转材料付款(' + data.username + ')'); break; case 52: $('input[name="fm_otherexpenditureinfo.Title"]').val('设备维修配件/改装配件/桩机配件采购付款(' + data.username + ')'); break; case 53: $('input[name="fm_otherexpenditureinfo.Title"]').val('节假日福利费付款(' + data.username + ')'); break; case 55: $('input[name="fm_otherexpenditureinfo.Title"]').val('差旅费付款(' + data.username + ')'); break; case 56: $('input[name="fm_otherexpenditureinfo.Title"]').val('项目差旅费付款(' + data.username + ')'); break; case 57: $('input[name="fm_otherexpenditureinfo.Title"]').val('项目生产类押金付款(' + data.username + ')'); break; case 58: $('input[name="fm_otherexpenditureinfo.Title"]').val('非生产类押金付款(' + data.username + ')'); break; case 19041: $('input[name="fm_otherexpenditureinfo.Title"]').val('IPO费用(差旅住宿)付款(' + data.username + ')'); break; case 19042: $('input[name="fm_otherexpenditureinfo.Title"]').val('IPO费用(非差旅住宿)付款(' + data.username + ')'); break; case 19043: $('input[name="fm_otherexpenditureinfo.Title"]').val('礼品、酒付款(' + data.username + ')'); break; case 19044: $('input[name="fm_otherexpenditureinfo.Title"]').val('电脑、打印机维修付款(' + data.username + ')'); break; case 19045: $('input[name="fm_otherexpenditureinfo.Title"]').val('办公/职工宿舍房租、水电、物业付款(' + data.username + ')'); break; case 19046: $('input[name="fm_otherexpenditureinfo.Title"]').val('会务费、保险费等其他可控管理费付款(' + data.username + ')'); break; case 19047: $('input[name="fm_otherexpenditureinfo.Title"]').val('研发其他费用付款(' + data.username + ')'); break; case 19048: $('input[name="fm_otherexpenditureinfo.Title"]').val('保险理赔款付款(' + data.username + ')'); break; case 19049: $('input[name="fm_otherexpenditureinfo.Title"]').val('保理、承兑等金融手续费付款(' + data.username + ')'); break; case 190410: $('input[name="fm_otherexpenditureinfo.Title"]').val('个税付款(' + data.username + ')'); break; case 190411: $('input[name="fm_otherexpenditureinfo.Title"]').val('公积金付款(' + data.username + ')'); break; case 190412: $('input[name="fm_otherexpenditureinfo.Title"]').val('市内交通费付款(' + data.username + ')'); break; case 190413: $('input[name="fm_otherexpenditureinfo.Title"]').val('项目市内交通费付款(' + data.username + ')'); break; case 190414: $('input[name="fm_otherexpenditureinfo.Title"]').val('行政罚款付款(' + data.username + ')'); break; case 190415: $('input[name="fm_otherexpenditureinfo.Title"]').val('房租费用付款(' + data.username + ')'); break; case 190416: $('input[name="fm_otherexpenditureinfo.Title"]').val('社保第三方代缴付款(' + data.username + ')'); break; case 190417: $('input[name="fm_otherexpenditureinfo.Title"]').val('公积金第三方代缴付款(' + data.username + ')'); break; case 19091: $('input[name="fm_otherexpenditureinfo.Title"]').val('劳务工资付款(' + data.username + ')'); break; } //// 处理部门项目部不展示,职能部展示 var titl = $('input[name="fm_otherexpenditureinfo.Title"]').val(); if (titl.indexOf("项目") != -1) { $('input[name="fm_otherexpenditureinfo.dept_name"]').css('display', 'none'); } $('#fm_otherexpenditureinfo_dept_id').css('display', 'none'); // $(".annex").css('display', 'none'); } }); } } //ERP获取关联单号已付款金额 var allAmount = 0;//总付款金额 var fkMoney = 0;//已付款金额 var syMoney = 0;//剩余金额 var getpaymoney = function (code) { $.ajax({ url: "/oa/General/GetMoney?orderCode=" + code + "&sysid=" + sysid, async: false, cache: false, dataType: "json", success: function (data) { allAmount = parseFloat(data.allamount); fkMoney = parseFloat(data.paymoney); syMoney = parseFloat(data.balance); } }); } //计算总金额 var countmoney = function () { type = parseInt(getUrlParam('type')); if ($.trim(sysid) != '' && initItems != null) { type = parseInt(initItems.ExpenditureBusinessTypeID); } var count = 0; $.each($('input[name="fm_otherexpenditureinfo_dtl.ExpenditureNotContainTaxAmount"]'), function () { var val = $.trim($(this).val()); val = isNaN(val) ? 0 : val; val = val == '' ? 0 : parseFloat(val); count += val; }); if (type == 41 || type == 42 || type == 43 || type == 44 || type == 45 || type == 46 || type == 47 || type == 48 || type == 50 || type == 51 || type == 52) { if (sysid == '') { var nmoney = allAmount - fkMoney; $('input[name="fm_otherexpenditureinfo.TotalExpenditure"]').val(nmoney); $('input[name="fm_otherexpenditureinfo.CapitalizationTotalExpenditure"]').val(changeMoneyToChinese(nmoney)); if (nmoney <= 0) { $('button[onclick="WF_Submit()"],button[onclick="WF_Save()"]').parent().hide() } } else { var nmoeny = parseFloat($('input[name="fm_otherexpenditureinfo.TotalExpenditure"]').val()); syMoney = nmoeny > syMoney ? syMoney : nmoeny; $('input[name="fm_otherexpenditureinfo.TotalExpenditure"]').val(syMoney); $('input[name="fm_otherexpenditureinfo.CapitalizationTotalExpenditure"]').val(changeMoneyToChinese(syMoney)); } } else { $('input[name="fm_otherexpenditureinfo.TotalExpenditure"]').val(count); $('input[name="fm_otherexpenditureinfo.CapitalizationTotalExpenditure"]').val(changeMoneyToChinese(count)); } } //选择税率后重新计算 $(document).on('change', $('input[name="fm_otherexpenditureinfo_dtl.ExpenditureNotContainTaxAmount"]'), function () { countmoney(); }); //删除事件回调操作 deleteMethod = function () { countmoney(); } var orderCode = ''; //添加事件回调操作 createMethod = function () { var ntr = $('select[name="fm_otherexpenditureinfo_dtl.ExpenditureTypeName"]').length; if (ntr > 0) { $('select[name="fm_otherexpenditureinfo_dtl.ExpenditureTypeName"]').eq(ntr - 1).html(listtypeoptions.join('')); $('select[name="fm_otherexpenditureinfo_dtl.ExpenditureTypeName"]').eq(ntr - 1).trigger("chosen:updated"); if (listtypeoptions.length <= 1)//只有一项一下,禁用选择 { $('select[name="fm_otherexpenditureinfo_dtl.ExpenditureTypeName"]').eq(ntr - 1).attr('disabled', 'disabled'); } $('select[name="fm_otherexpenditureinfo_dtl.ExpenditureTypeName"]').eq(ntr - 1).chosen(); } var inputs = ''; $('input[name="fm_otherexpenditureinfo_dtl.FundsCostSubjectsName"]').eq(ntr - 1).after(inputs); //财务科目选择后触发 $('input[name="fm_otherexpenditureinfo_dtl.FundsCostSubjectsName"]').eq(ntr - 1).bind('focus', function (i, r) { getCWinfo(this); }); var type = parseInt(getUrlParam('type')); if ($.trim(sysid) != '' && initItems != null) { type = parseInt(initItems.ExpenditureBusinessTypeID); } changeTextarea(); } //动态添加CSS样式 function addCSS() { var str_style = 'td{ position:relative;}\ .bl{position: relative;}\ .bl .back {position: absolute;top: 0;right: 5px;display: inline-block;}\ .bl .backdtl {position: absolute;top: 2px;right:10px;display: inline-block;}'; 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_otherexpenditureinfo_dtl.Remarks"]').each(function (i, input) { var value = $.trim($(this).val()); var textarea = createTextarea("fm_otherexpenditureinfo_dtl", "remarks"); 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 setCompanyInfo = function (id, name, UserName, Phone, BankName, BankDeposit, BankAccount) { $('#fm_otherexpenditureinfo_IncomeUnitID').val($.trim(id)); $('#fm_otherexpenditureinfo_IncomeUnitName').val(name); $('#fm_otherexpenditureinfo_AccountOpenBankAccount').val(BankName); $('#fm_otherexpenditureinfo_CashBankName').val(BankDeposit); $('#fm_otherexpenditureinfo_ReceivablesAccount').val(BankAccount); layer.closeAll(); } //收入单位选择 var getmaterielinfo = function () { layer.open({ type: 2, title: '收款单位', shadeClose: true, shade: 0.4, area: ['90%', '90%'], content: "/oa/General/company" }); } //客户单位选择 var getCustomerinfo = function () { layer.open({ type: 2, title: '客户单位', shadeClose: true, shade: 0.4, area: ['90%', '90%'], content: "/Customer/Search" }); } SetCustomer = function (data) { $AccountOpenBankAccount = $('#fm_otherexpenditureinfo_AccountOpenBankAccount'); $CashBankName = $('#fm_otherexpenditureinfo_CashBankName'); $ReceivablesAccount = $('#fm_otherexpenditureinfo_ReceivablesAccount'); $('#fm_otherexpenditureinfo_IncomeUnitName').val(data.Name); $AccountOpenBankAccount.val(data.AccountName); $CashBankName.val(data.OpenBank); $ReceivablesAccount.val(data.BankCardNumber); $('#fm_otherexpenditureinfo_IncomeUnitID').val(data.Id || ""); if (data.AccountName == null || data.AccountName == "") $AccountOpenBankAccount.removeAttr("disabled"); else $AccountOpenBankAccount.attr("disabled", "disabled"); if (data.OpenBank == null || data.OpenBank == "") $CashBankName.removeAttr("disabled"); else $CashBankName.attr("disabled", "disabled"); if (data.BankCardNumber == null || data.BankCardNumber == "") $ReceivablesAccount.removeAttr("disabled"); else $ReceivablesAccount.attr("disabled", "disabled"); layer.closeAll(); } 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_otherexpenditureinfo_dtl.FundsCostSubjectsName"]').val(SubjectName); $(thisobj).parent().parent().find('input[name="fm_otherexpenditureinfo_dtl.FundsCostSubjectsID"]').val(SubjectEncode); layer.closeAll(); } //项目改为手动填写 var changeProjectInput = function () { var $input_project = $('#fm_otherexpenditureinfo_ProjectID'); var disable = $input_project.prop("disabled"); var isEdit = $input_project.hasClass("edit"); var $parent = $input_project.parent(); var str_input = ''; var $input = $(str_input); $input.prop("disabled", disable); isEdit && $input.addClass("edit"); $parent.html($input); } function JsonDateToDate(jsondate) { var date = new Date(parseInt(jsondate.replace("/Date(", "").replace(")/", ""), 10)); return date; } Date.prototype.Format = function (formatStr) { var str = formatStr; var Week = ['日', '一', '二', '三', '四', '五', '六']; var mt = this.getMonth() + 1; str = str.replace(/yyyy|YYYY/, this.getFullYear()); str = str.replace(/yy|YY/, (this.getYear() % 100) > 9 ? (this.getYear() % 100).toString() : '0' + (this.getYear() % 100)); str = str.replace(/MM/, mt > 9 ? mt : '0' + mt); str = str.replace(/M/g, mt); str = str.replace(/w|W/g, Week[this.getDay()]); str = str.replace(/dd|DD/, this.getDate() > 9 ? this.getDate().toString() : '0' + this.getDate()); str = str.replace(/d|D/g, this.getDate()); str = str.replace(/hh|HH/, this.getHours() > 9 ? this.getHours().toString() : '0' + this.getHours()); str = str.replace(/h|H/g, this.getHours()); str = str.replace(/mm/, this.getMinutes() > 9 ? this.getMinutes().toString() : '0' + this.getMinutes()); str = str.replace(/m/g, this.getMinutes()); str = str.replace(/ss|SS/, this.getSeconds() > 9 ? this.getSeconds().toString() : '0' + this.getSeconds()); str = str.replace(/s|S/g, this.getSeconds()); return str; } var getinfo = function (ntype, sorderCode) { var url = ''; if (ntype == 3) { url = '/OA/General/GetInOrderByordeCode?orderCode=' + sorderCode; } else { url = '/OA/General/FindSettlementModelByCode?orderCode=' + sorderCode; } $.ajax({ url: url, async: false, cache: false, dataType: "json", success: function (data) { $('.subtradd_js').hide(); var arytrs = []; var allmoney = 0; if (ntype == 3) { $.each(data, function (i, r) { var html = '