annual_comp_sumtable_view_sum.js 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606
  1. var locat = (window.location+'').split('/');
  2. $(function(){if('fhsms'== locat[3]){locat = locat[0]+'//'+locat[2];}else{locat = locat[0]+'//'+locat[2]+'/'+locat[3];};});
  3. $(getTop(globalThis).hangge());
  4. var editflag = 0;
  5. var recordData = new Object();
  6. var recordBeforeValue = new Object();
  7. $(function(){
  8. tableInit();
  9. //highlightInit();
  10. });
  11. function tableInit(){
  12. //行内小计列
  13. //setRowSumCell(e);
  14. //预防、修复小中大修分别计算总和
  15. $('.threeNum').each(function(index,e){
  16. setPreTotalCell(e);
  17. });
  18. //数字格式化
  19. $('td.num').each(function(index,e){
  20. var num = $(e).html();
  21. num = numFormat(num);
  22. $(e).html(num);
  23. });
  24. //每行的合计
  25. $('.rowSum').each(function(index,e){
  26. var temp = $(e).attr("class").split(' ');
  27. var classname = temp[2];
  28. //console.log("index:"+index + ",e:"+e + ",classname:"+classname);
  29. setRowTotalCell(e, classname);
  30. });
  31. //计划费用万元格式化
  32. $('td.wnum').each(function(index,e){
  33. var num = $(e).html();
  34. //单位 元=>万元
  35. num = num/10000;
  36. num = numFormat(num);
  37. $(e).html(num);
  38. });
  39. //公司小计
  40. var subtotal = $('.subtotal').find('td[totalType="subtotal"]');
  41. for(var i=0; i<subtotal.length; i++){
  42. var companyid = subtotal.eq(i).parent().attr("id");
  43. var var1=subtotal.eq(i).attr("class");
  44. var var2=var1.split(' ');
  45. var classname = var2[1];
  46. setSubTotalCell(companyid,classname,i);
  47. }
  48. //公司里程小计
  49. var subtotal = $('.subtotal').find('td[totalType="km_subtotal"]');
  50. for(var i=0; i<subtotal.length; i++){
  51. var companyid = subtotal.eq(i).parent().attr("id");
  52. var var1=subtotal.eq(i).attr("class");
  53. var var2=var1.split(' ');
  54. var classname = var2[1];
  55. setKmSubTotalCell(companyid,classname,i);
  56. }
  57. //小计序号
  58. $('.totaltr').find('.indexCell').html($('.edittr').length+1);
  59. //留痕标红
  60. //setRecordInfo();
  61. //数字格式化-里程格式化
  62. $('td.kmnum').each(function(index,e){
  63. var num = $(e).html();
  64. if(""!= num){
  65. num = Number(num).toFixed(3) ;
  66. }
  67. $(e).html(num);
  68. });
  69. $("input.editInput").each(function(index,e){
  70. var num = $(e).val();
  71. if(num.indexOf("input") != -1){
  72. num = numFormat(num);
  73. $(e).val(num);
  74. }
  75. });
  76. //预防小修、中修、大修 小计
  77. $('.fourNum').each(function(index,e){
  78. setYFTotalCell(e);
  79. });
  80. $('.sevenNum').each(function(index,e){
  81. setYHJHTotalCell(e);
  82. });
  83. $('.3Num').each(function(index,e){
  84. setXJCell(e);
  85. });
  86. // 修复养护小修、中修、大修 小计
  87. $('.eightNum').each(function(index,e){
  88. setXFYHTotalCell(e);
  89. });
  90. // 计划养护汇总-合计
  91. $('.eightNumJHHZ').each(function(index,e){
  92. eightNumJHHZ(e);
  93. });
  94. //小计行的总计列
  95. var totalcells = $('.totaltr').find('.sumCell');
  96. for(var i=0; i<totalcells.length; i++){
  97. /*if(i==14){
  98. setTotalCell(i);
  99. }*/
  100. setTotalCell(i);
  101. }
  102. //里程的总计列
  103. var totalkmcells = $('.totaltr').find('.sumkmCell');
  104. for(var i=0; i<totalkmcells.length; i++){
  105. setKMTotalCell(i);
  106. }
  107. //百分比初始化
  108. $('#Form table tbody tr').each(function(index,e){
  109. //setTrPercentCell(e);
  110. setTrPercentCell2(e);
  111. setTrKmPercentCell2(e);
  112. });
  113. //除法
  114. $('#Form table tbody tr').each(function(index,e){
  115. //setTrPercentCell(e);
  116. setTrDivisionCell(e);
  117. });
  118. }
  119. //明细表input失焦后操作(计算公司审批费用小计)
  120. function editValue(e){
  121. if(!$(e).attr('readonly')){
  122. //公司小计
  123. var subtotal = $('.edittr').find('td[tType="subtotal"]');
  124. for(var i=0; i<subtotal.length; i++){
  125. var companyid = subtotal.eq(i).parent().attr("id");
  126. var var1=subtotal.eq(i).attr("class");
  127. var var2=var1.split(' ');
  128. var classname = var2[2];
  129. setSTotalCell(companyid,classname,i);
  130. }
  131. //小计行的总计列
  132. var totalcells = $('.totaltr').find('.sumCell');
  133. for(var i=0; i<totalcells.length; i++){
  134. setTotalCell(i);
  135. }
  136. }
  137. }
  138. function setSTotalCell(companyid,classname,index){
  139. var totalvalue = 0;
  140. for(var i=0; i<$('.edittr.date.'+companyid).length; i++){
  141. var subcellval = $('.edittr.date.'+companyid).eq(i).find('.AUDIT_FEE').find("INPUT").val();
  142. if(typeof(subcellval) != "undefined")
  143. totalvalue += Number(subcellval);
  144. }
  145. if(totalvalue != 0){
  146. $('.edittr').find('td[tType="subtotal"]').eq(index).html(numFormat(totalvalue) + '');
  147. }
  148. }
  149. function editTable(){
  150. if(editflag == 0){
  151. $('#editbutton').html('编辑中');
  152. $(".editInput").removeAttr("readonly");
  153. $("#savebutton").removeAttr("disabled");
  154. editflag = 1;
  155. }else if(editflag == 1){
  156. $('#editbutton').html('编辑');
  157. $(".editInput").attr("readonly","readonly" );
  158. $("#savebutton").attr("disabled","disabled");
  159. editflag = 0;
  160. }
  161. }
  162. function saveTable(type,year){
  163. $("#savebutton").attr("disabled","disabled");
  164. if(editflag == 1){
  165. $('#editbutton').html('编辑');
  166. $(".editInput").attr("readonly","readonly");
  167. editflag = 0;
  168. }
  169. var tabledata = dataResult();
  170. $.ajax({
  171. type : "get",
  172. url : locat+'/annualPlanKG/saveData.do?data='+JSON.stringify(tabledata)+'&TABLETYPE='+type+'&YEAR='+year,
  173. dataType : 'json',
  174. success : function(data){
  175. if(JSON.stringify(recordData) != "{}") saveRecordInfo();
  176. //保存后更新input原始值
  177. for(var i=0;i<$('.editInput').length;i++){
  178. var e = $('.editInput')[i];
  179. $(e).attr('value',$(e).val());
  180. }
  181. if(data.msg == 'success'){
  182. getTop(globalThis).hangge();
  183. bootbox.dialog({
  184. message: "<span class='bigger-110'>保存成功!</span>",
  185. buttons:
  186. {
  187. "button" :
  188. {
  189. "label" : "确定",
  190. "className" : "btn-sm btn-success",
  191. "callback" : function(){
  192. var selfhref = self.location.href;
  193. self.location.href = selfhref;
  194. }
  195. }
  196. }
  197. });
  198. }else{
  199. getTop(globalThis).hangge();
  200. bootbox.dialog({
  201. message: "<span class='bigger-110'>"+data.msg+"</span>",
  202. buttons:
  203. {
  204. "button" :
  205. {
  206. "label" : "确定",
  207. "className" : "btn-sm btn-success"
  208. }
  209. }
  210. });
  211. }
  212. }
  213. });
  214. }
  215. function dataResult(){
  216. var mapArry = $("#Form").serializeArray();
  217. var dataArry = [];
  218. var cellcount = $('.edittr:eq(0) >td').length;
  219. var recordcount = $('.edittr.date').length;
  220. for(var i=0; i<recordcount; i++){
  221. var recordmap = new Object();
  222. for(var j=0; j<5; j++){
  223. recordmap[mapArry[i*5+j].name] = mapArry[i*5+j].value;
  224. }
  225. dataArry.push(recordmap);
  226. }
  227. return dataArry;
  228. }
  229. function setRowTotalCell(e, classname){
  230. var totalvalue = 0;
  231. for(var i=0; i<$(e).parent().find("td[class*="+classname+"]").length; i++){
  232. /* if(i=="14"){
  233. debugger;
  234. }*/
  235. if($(e).parent().find("td[class*="+classname+"]").eq(i)[0].className.indexOf("kmnum") == -1){
  236. console.log("******className****"+$(e).parent().find("td[class*="+classname+"]").eq(i)[0].className);
  237. var subcellval;
  238. if($(e).parent().find("td[class*="+classname+"]").eq(i).find("INPUT").length > 0){
  239. subcellval = $(e).parent().find("td[class*="+classname+"]").eq(i).val();
  240. //console.log("INPUT:" + "i:"+i+",subcellval:"+ subcellval);
  241. }else{
  242. subcellval = $(e).parent().find("td[class*="+classname+"]").eq(i).html();
  243. }
  244. if(typeof(subcellval) != "undefined" && subcellval != "")
  245. //console.log("i:"+i+",subcellval:"+ subcellval);
  246. totalvalue += Number(subcellval);
  247. }
  248. }
  249. if(totalvalue != 0 && totalvalue != 'NaN'){
  250. $(e).html(numFormat(totalvalue) + '');
  251. //console.log("totalvalue:"+ numFormat(totalvalue));
  252. }
  253. }
  254. function setPreTotalCell(e){
  255. var totalvalue = 0;
  256. var num1 = $(e).parent().find("."+$(e).attr("num3")).html();
  257. var num2 = $(e).parent().find("."+$(e).attr("num4")).html();
  258. var num3 = $(e).parent().find("."+$(e).attr("num5")).html();
  259. if(typeof(num1) != "undefined" && typeof(num2) != "undefined" && typeof(num3) != "undefined"){
  260. totalvalue = Number(num1) + Number(num2) + Number(num3);
  261. }
  262. if(totalvalue != 0){
  263. $(e).html(numFormat(totalvalue) + '');
  264. }
  265. }
  266. function setSubTotalCell(companyid,classname,index){
  267. var totalvalue = 0;
  268. for(var i=0; i<$('.edittr.'+companyid +' .'+classname).length; i++){
  269. var subcellval;
  270. //
  271. if(classname!="AUDIT_FEE"){
  272. if($('.edittr.'+companyid +' .'+classname).eq(i).find("INPUT").length > 0){
  273. subcellval = $('.edittr.'+companyid +' .'+classname).eq(i).val();
  274. }else{
  275. subcellval = $('.edittr.'+companyid +' .'+classname).eq(i).html();
  276. }
  277. }
  278. else{
  279. subcellval = $('.edittr.'+companyid +' .'+classname).eq(i).html().split("<input")[1].split(" ")[1].replace("value=","").replace("\"","").replace("\"","");
  280. }
  281. if(typeof(subcellval) != "undefined")
  282. totalvalue += Number(subcellval);
  283. }
  284. if(totalvalue != 0){
  285. $('.subtotal').find('td[totalType="subtotal"]').eq(index).html(numFormat(totalvalue) + '');
  286. }
  287. }
  288. function setKmSubTotalCell(companyid,classname,index){
  289. var totalvalue = 0;
  290. for(var i=0; i<$('.edittr.'+companyid +' .'+classname).length; i++){
  291. var subcellval;
  292. if($('.edittr.'+companyid +' .'+classname).eq(i).find("INPUT").length > 0){
  293. subcellval = $('.edittr.'+companyid +' .'+classname).eq(i).val();
  294. }else{
  295. subcellval = $('.edittr.'+companyid +' .'+classname).eq(i).html();
  296. }
  297. if(typeof(subcellval) != "undefined")
  298. totalvalue += Number(subcellval);
  299. }
  300. if(totalvalue != 0){
  301. $('.subtotal').find('td[totalType="km_subtotal"]').eq(index).html(Number(totalvalue).toFixed(3) + '');
  302. }
  303. }
  304. function setTotalCell(index){
  305. if(index < $('.totaltr').find('.sumCell').length){
  306. var totalvalue = 0;
  307. for(var i=0; i<$('.subtotal').length; i++){
  308. var editcellval;
  309. if($('.subtotal').eq(i).find('td[totalType="subtotal"]').eq(index).find("INPUT").length > 0){
  310. editcellval = $('.edittr').eq(i).find('td[totalType="subtotal"]').eq(index).val();
  311. }else{
  312. editcellval = $('.subtotal').eq(i).find('td[totalType="subtotal"]').eq(index).html();
  313. }
  314. if(typeof(editcellval) != "undefined")
  315. totalvalue += Number(editcellval);
  316. }
  317. for(var i=0; i<$('.edittr').length; i++){
  318. var rycellval=0;
  319. var myArray=new Array();
  320. myArray = $('.edittr').eq(i).attr("class").split(" ");
  321. //加上无小计
  322. if(myArray != null && myArray.length > 0){
  323. if(myArray[1] == "006" || myArray[1] == "013" ){
  324. console.log($('.edittr').eq(i).find('td[totalType="sum"]').eq(index)[0].className.split(" ")[2]);
  325. if($('.edittr').eq(i).find('td[totalType="sum"]').eq(index)[0].className.split(" ")[2]==("AUDIT_FEE")){
  326. rycellval = $('.edittr').eq(i).find('td[totalType="sum"]').eq(index).html().split("<input")[1].split(" ")[1].replace("value=","").replace("\"","").replace("\"","");
  327. }
  328. else{
  329. if($('.edittr').eq(i).find('td[totalType="sum"]').eq(index).find("INPUT").length > 0){
  330. rycellval = $('.edittr').eq(i).find('td[totalType="sum"]').eq(index).val();
  331. }else{
  332. rycellval = $('.edittr').eq(i).find('td[totalType="sum"]').eq(index).html();
  333. }
  334. }
  335. break;
  336. }
  337. }
  338. }
  339. totalvalue += Number(rycellval);
  340. if(totalvalue != 0){
  341. $('.totaltr').find('.sumCell').eq(index).html(numFormat(totalvalue) + '');
  342. }
  343. }
  344. }
  345. function setKMTotalCell(index){
  346. if(index < $('.totaltr').find('.sumkmCell').length){
  347. var totalvalue = 0;
  348. for(var i=0; i<$('.edittr').length; i++){
  349. var editcellval;
  350. if($('.edittr').eq(i).find('td[totalType="kmsum"]').eq(index).find("INPUT").length > 0){
  351. editcellval = $('.edittr').eq(i).find('td[totalType="kmsum"]').eq(index).val();
  352. }else{
  353. editcellval = $('.edittr').eq(i).find('td[totalType="kmsum"]').eq(index).html();
  354. }
  355. if(typeof(editcellval) != "undefined")
  356. totalvalue += Number(editcellval);
  357. }
  358. if(totalvalue != 0){
  359. $('.totaltr').find('.sumkmCell').eq(index).html(Number(totalvalue).toFixed(3) + '');
  360. }
  361. }
  362. }
  363. function setSubtotal(tr){
  364. // $(tr).find("td>.subtotal").each(function(index,e){
  365. // var name = $(e).attr("name");
  366. var totalNum;
  367. $(tr).find("td[name='PREVENTION_DESIGN']").each(function(index,e){
  368. var num = $(e).text();
  369. totalNum = totalNum + num;
  370. });
  371. //$(e).val(totalNum);
  372. // });
  373. }
  374. function setTrPercentCell(tr){
  375. $(tr).find("td>.percentCell").each(function(index,e){
  376. if(e.tagName == "INPUT"){
  377. var num1 = $(tr).find("td>."+$(e).attr("num1")).val();
  378. var num2 = $(tr).find("td>."+$(e).attr("num2")).val();
  379. var result = percentage(num1, num2);
  380. $(e).val(result);
  381. }else if(e.tagName == "SPAN"){
  382. var num1 = $(tr).find("td>."+$(e).attr("num1")).html();
  383. var num2 = $(tr).find("td>."+$(e).attr("num2")).html();
  384. var result = percentage(num1, num2);
  385. $(e).html(result);
  386. }
  387. });
  388. }
  389. function setTrPercentCell2(tr){
  390. $(tr).find("td.percentCell").each(function(index,e){
  391. var num1 = $(tr).find("td."+$(e).attr("num1")).html();
  392. var num2 = $(tr).find("td."+$(e).attr("num2")).html();
  393. var result = percentage(num1, num2);
  394. $(e).html(result);
  395. });
  396. }
  397. function setTrKmPercentCell2(tr){
  398. $(tr).find("td.percentKmCell").each(function(index,e){
  399. var num1 = $(tr).find("td."+$(e).attr("num1")).html();
  400. var num2 = $(tr).find("td."+$(e).attr("num2")).html();
  401. var result = percentagekm(num1, num2);
  402. $(e).html(result);
  403. });
  404. }
  405. function setTrDivisionCell(tr){
  406. $(tr).find("td.divisionCell").each(function(index,e){
  407. var num1 = $(tr).find("td."+$(e).attr("num1")).html();
  408. var num2 = $(tr).find("td."+$(e).attr("num2")).html();
  409. var result = division(num1, num2);
  410. $(e).html(result);
  411. });
  412. }
  413. function percentage(num1, num2){
  414. var percent = "";
  415. if(!isNaN(Number(num1)) && !isNaN(Number(num2)) && Number(num2) != "0" )
  416. // percent = Math.round(Number(num1) / Number(num2) * 10000) / 100.00 + "%";
  417. // percent = Math.round(Number(num1) / Number(num2) * 100) + "%";
  418. percent = Math.round(Number(num1) / Number(num2) * 100);
  419. return percent;
  420. }
  421. function percentagekm(num1, num2){
  422. var percent = "";
  423. if(!isNaN(Number(num1)) && !isNaN(Number(num2)) && Number(num2) != "0" )
  424. percent = (Number(num1) / Number(num2)).toFixed(1);
  425. return percent;
  426. }
  427. function division(num1, num2){
  428. var percent = "";
  429. if(!isNaN(Number(num1)) && !isNaN(Number(num2)) && Number(num2) != "0" )
  430. percent = (Number(num1) / Number(num2)).toFixed(1);
  431. return percent;
  432. }
  433. function numFormat(num){
  434. if(!isNaN(Number(num)) && Number(num) != "0"){
  435. if(num<10) num = Number(num).toFixed(1);
  436. else num = Math.round(Number(num));
  437. }
  438. return num;
  439. }
  440. //预防小修、中修、大修小计
  441. function setYFTotalCell(e){
  442. var totalvalue = 0;
  443. var num1 = $(e).parent().find("."+$(e).attr("num6")).html();
  444. var num2 = $(e).parent().find("."+$(e).attr("num7")).html();
  445. var num3 = $(e).parent().find("."+$(e).attr("num8")).html();
  446. var num4 = $(e).parent().find("."+$(e).attr("num9")).html();
  447. if(typeof(num1) != "undefined" && typeof(num2) != "undefined"
  448. && typeof(num3) != "undefined"&& typeof(num4) != "undefined"){
  449. totalvalue = Number(num1) + Number(num2) + Number(num3) + Number(num4);
  450. }
  451. if(totalvalue != 0){
  452. $(e).html(numFormat(totalvalue) + '');
  453. }
  454. }
  455. //修复养护小修、中修、大修小计
  456. function setXFYHTotalCell(e){
  457. var totalvalue = 0;
  458. var num1 = $(e).parent().find("."+$(e).attr("num10")).html();
  459. var num2 = $(e).parent().find("."+$(e).attr("num11")).html();
  460. var num3 = $(e).parent().find("."+$(e).attr("num12")).html();
  461. var num4 = $(e).parent().find("."+$(e).attr("num13")).html();
  462. var num5 = $(e).parent().find("."+$(e).attr("num14")).html();
  463. var num6 = $(e).parent().find("."+$(e).attr("num15")).html();
  464. var num7 = $(e).parent().find("."+$(e).attr("num16")).html();
  465. var num8 = $(e).parent().find("."+$(e).attr("num17")).html();
  466. //num17下有文本框时取name为$(e).attr("num24")的input值
  467. var tdInput = $(e).parent().find("."+$(e).attr("num17"));
  468. if($(tdInput).find('input').length > 0){
  469. num8 = $(tdInput).find('input[name="'+$(e).attr("num17")+'"]').val();
  470. }
  471. if(typeof(num1) != "undefined" && typeof(num2) != "undefined"
  472. && typeof(num3) != "undefined"&& typeof(num4) != "undefined"
  473. && typeof(num5) != "undefined"&& typeof(num6) != "undefined"
  474. && typeof(num7) != "undefined"&& typeof(num8) != "undefined"){
  475. totalvalue = Number(num1) + Number(num2) + Number(num3) + Number(num4)
  476. +Number(num5) + Number(num6) + Number(num7) + Number(num8);
  477. }
  478. if(totalvalue != 0){
  479. $(e).html(numFormat(totalvalue) + '');
  480. }
  481. }
  482. function eightNumJHHZ(e){
  483. var totalvalue = 0;
  484. var num1 = $(e).parent().find("."+$(e).attr("num10")).html();
  485. var num2 = $(e).parent().find("."+$(e).attr("num11")).html();
  486. var num3 = $(e).parent().find("."+$(e).attr("num12")).html();
  487. var num4 = $(e).parent().find("."+$(e).attr("num13")).html();
  488. var num5 = $(e).parent().find("."+$(e).attr("num14")).html();
  489. var num6 = $(e).parent().find("."+$(e).attr("num15")).html();
  490. var num7 = $(e).parent().find("."+$(e).attr("num16")).html();
  491. var num8 = $(e).parent().find("."+$(e).attr("num17")).html();
  492. //num17下有文本框时取name为$(e).attr("num24")的input值
  493. var tdInput = $(e).parent().find("."+$(e).attr("num17"));
  494. if($(tdInput).find('input').length > 0){
  495. num8 = $(tdInput).find('input[name="'+$(e).attr("num17")+'"]').val();
  496. }
  497. if(num8 == ""){
  498. num8 = $(e).parent().find("."+$(e).attr("num18")).html();
  499. }
  500. if(typeof(num1) != "undefined" && typeof(num2) != "undefined"
  501. && typeof(num3) != "undefined"&& typeof(num4) != "undefined"
  502. && typeof(num5) != "undefined"&& typeof(num6) != "undefined"
  503. && typeof(num7) != "undefined"&& typeof(num8) != "undefined"){
  504. totalvalue = Number(num1) + Number(num2) + Number(num3) + Number(num4)
  505. +Number(num5) + Number(num6) + Number(num7) + Number(num8);
  506. }
  507. if(totalvalue != 0){
  508. $(e).html(numFormat(totalvalue) + '');
  509. }
  510. }
  511. function setYHJHTotalCell(e){
  512. var totalvalue = 0;
  513. var num1 = $(e).parent().find("."+$(e).attr("num18")).html();
  514. var num2 = $(e).parent().find("."+$(e).attr("num19")).html();
  515. var num3 = $(e).parent().find("."+$(e).attr("num20")).html();
  516. var num4 = $(e).parent().find("."+$(e).attr("num21")).html();
  517. var num5 = $(e).parent().find("."+$(e).attr("num22")).html();
  518. var num6 = $(e).parent().find("."+$(e).attr("num23")).html();
  519. var num7 = $(e).parent().find("."+$(e).attr("num24")).html();
  520. if(typeof(num1) != "undefined" && typeof(num2) != "undefined"
  521. && typeof(num3) != "undefined"&& typeof(num4) != "undefined"
  522. && typeof(num5) != "undefined"&& typeof(num6) != "undefined"&& typeof(num7) != "undefined"){
  523. totalvalue = Number(num1) + Number(num2) + Number(num3) + Number(num4)
  524. +Number(num5) + Number(num6) + Number(num7) ;
  525. }
  526. if(totalvalue != 0){
  527. $(e).html(numFormat(totalvalue) + '');
  528. }
  529. }
  530. function setXJCell(e){
  531. var totalvalue = 0;
  532. var num1 = $(e).parent().find("."+$(e).attr("num3")).html();
  533. var num2 = $(e).parent().find("."+$(e).attr("num4")).html();
  534. var num3 = $(e).parent().find("."+$(e).attr("num5")).html();
  535. if(typeof(num1) != "undefined" && typeof(num2) != "undefined"
  536. && typeof(num3) != "undefined"){
  537. totalvalue = Number(num1) + Number(num2) + Number(num3) ;
  538. }
  539. if(totalvalue != 0){
  540. $(e).html(numFormat(totalvalue) + '');
  541. }
  542. }
  543. //获取本网站的顶级节点,解决被其他网站iframe引入时发生的跨域问题
  544. function getTop(obj){
  545. var tp = obj;
  546. //alert(obj.name);
  547. if (tp.mainFrame == undefined) {
  548. tp = tp.parent;
  549. return getTop(tp);
  550. } else {
  551. return tp;
  552. }
  553. }