schedule_plan.js 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527
  1. /**
  2. * 进度台账相关js
  3. *
  4. * @author Ellisran
  5. * @date 2020/11/6
  6. * @version
  7. */
  8. function getTenderId() {
  9. return window.location.pathname.split('/')[2];
  10. }
  11. $(function () {
  12. autoFlashHeight();
  13. if(schedule && !schedule.mode) {
  14. $('#mode').modal('show');
  15. }
  16. // 初始化台账
  17. const ledgerSpread = SpreadJsObj.createNewSpread($('#ledger-spread')[0]);
  18. const treeSetting = {
  19. id: 'ledger_id',
  20. pid: 'ledger_pid',
  21. order: 'order',
  22. level: 'level',
  23. rootId: -1,
  24. fullPath: 'full_path',
  25. //treeCacheKey: 'ledger_bills_fold' + '_' + getTenderId(),
  26. // markFoldKey: 'bills-fold',
  27. // markFoldSubKey: window.location.pathname.split('/')[2],
  28. };
  29. const static_cols = [
  30. {title: '编号', colSpan: '1', rowSpan: '2', field: 'code', hAlign: 0, width: 145, formatter: '@', readOnly: true, cellType: 'tree'},
  31. {title: '名称', colSpan: '1', rowSpan: '2', field: 'name', hAlign: 0, width: 185, formatter: '@', readOnly: true},
  32. {title: '单位', colSpan: '1', rowSpan: '2', field: 'unit', hAlign: 1, width: 50, formatter: '@', readOnly: true},
  33. {title: '经济指标', colSpan: '1', rowSpan: '2', field: 'dgn_price', hAlign: 2, width: 60, type: 'Number', readOnly: true},
  34. {title: '总设计|工程量', colSpan: '2|1', rowSpan: '1|1', field: 'dgn_qty1', hAlign: 2, width: 70, type: 'Number', readOnly: true},
  35. {title: '|金额(元)', colSpan: '|1', rowSpan: '|1', field: 'total_price', hAlign: 2, width: 70, type: 'Number', readOnly: true},
  36. ];
  37. const ledgerSpreadSetting = {
  38. emptyRows: 0,
  39. headRows: 2,
  40. headRowHeight: [25, 25],
  41. defaultRowHeight: 21,
  42. headerFont: '12px 微软雅黑',
  43. font: '12px 微软雅黑',
  44. // readOnly: true,
  45. localCache: {
  46. key: 'ledger-bills',
  47. colWidth: true,
  48. }
  49. };
  50. const monthsCols = [];
  51. const calcCols = ['total_price'];
  52. if(scheduleMonth.length > 0) {
  53. for (const sm of scheduleMonth) {
  54. const readOnly = sm.stage_gcl_used !== 0 || sm.stage_tp_used !== 0;
  55. const yearmonth = sm.yearmonth.split('-')[0] + '年' + parseInt(sm.yearmonth.split('-')[1]) + '月';
  56. const cols = {title: yearmonth + '|计划工程量', colSpan: '2|1', rowSpan: '1|1', field: sm.yearmonth+'_gcl', hAlign: 2, width: 90, type: 'Number', readOnly: readOnly ? readOnly : 'readOnly.gcl'};
  57. const cols2 = {title: '|计划金额(元)', colSpan: '|1', rowSpan: '|1', field: sm.yearmonth+'_tp', hAlign: 2, width: 90, type: 'Number', readOnly: readOnly ? readOnly : 'readOnly.tp'};
  58. monthsCols.push(cols);
  59. monthsCols.push(cols2);
  60. // calcCols.push(sm.yearmonth+'_gcl');
  61. calcCols.push(sm.yearmonth+'_tp');
  62. }
  63. }
  64. treeSetting.calcFields = calcCols;
  65. const ledgerTree = createNewPathTree('filter', treeSetting);
  66. const spreadHeaderCols = static_cols.concat(monthsCols);
  67. ledgerSpreadSetting.cols = spreadHeaderCols;
  68. const ledgerCol = {
  69. readOnly: {
  70. tp: function (data) {
  71. let flag = data.is_leaf;
  72. if (data.is_leaf) {
  73. flag = schedule && schedule.mode === mode.tp;
  74. }
  75. return !flag;
  76. },
  77. gcl: function (data) {
  78. let flag = data.is_leaf;
  79. if (data.is_leaf) {
  80. flag = schedule && schedule.mode === mode.gcl;
  81. }
  82. return !flag;
  83. },
  84. },
  85. };
  86. sjsSettingObj.setFxTreeStyle(ledgerSpreadSetting, sjsSettingObj.FxTreeStyle.jz);
  87. if (thousandth) sjsSettingObj.setTpThousandthFormat(ledgerSpreadSetting);
  88. SpreadJsObj.initSpreadSettingEvents(ledgerSpreadSetting, ledgerCol);
  89. SpreadJsObj.initSheet(ledgerSpread.getActiveSheet(), ledgerSpreadSetting);
  90. SpreadJsObj.selChangedRefreshBackColor(ledgerSpread.getActiveSheet());
  91. postData('/tender/' + getTenderId() + '/schedule/ledger/load', {}, function (data) {
  92. // let treeData = [];
  93. // for(const sl of selectedLedgerList) {
  94. // const one = _.find(data, { 'ledger_id' : sl });
  95. // treeData.push(one);
  96. // }
  97. // treeData = setLeafData(treeData);
  98. // console.log(treeData);
  99. // let treeData = data;
  100. const calcList = ['total_price'];
  101. const showList = ['ledger_id', 'ledger_pid', 'order', 'level', 'tender_id', 'full_path',
  102. 'code', 'name', 'unit', 'dgn_qty1', 'dgn_qty2', 'dgn_price', 'quantity', 'total_price'];
  103. for (const m of monthList) {
  104. showList.push(m + '_tp');
  105. showList.push(m + '_gcl');
  106. // calcList.push(m + '_tp');
  107. // calcList.push(m + '_gcl');
  108. }
  109. console.log(showList);
  110. const baseLedgerTree = createNewPathTree('base', {
  111. id: 'ledger_id',
  112. pid: 'ledger_pid',
  113. order: 'order',
  114. level: 'level',
  115. rootId: -1,
  116. fullPath: 'full_path',
  117. calcFields: calcList,
  118. calcFun: function (node) {
  119. node.dgn_price = ZhCalc.round(ZhCalc.div(node.total_price, node.dgn_qty1), 2);
  120. }
  121. });
  122. const newLedgerList = setMonthToLedger(data.bills, data.slm);
  123. baseLedgerTree.loadDatas(newLedgerList);
  124. treeCalc.calculateAll(baseLedgerTree);
  125. console.log(baseLedgerTree);
  126. for (const d of baseLedgerTree.nodes) {
  127. if (!d.b_code) {
  128. const one = _.find(selectedLedgerList, function (item) {
  129. return item === d.ledger_id;
  130. });
  131. if(one) {
  132. ledgerTree.addData(d, showList);
  133. }
  134. }
  135. }
  136. // console.log(ledgerTree);
  137. ledgerTree.sortTreeNode(true);
  138. treeCalc.calculateAll(ledgerTree);
  139. console.log(ledgerTree);
  140. SpreadJsObj.loadSheetData(ledgerSpread.getActiveSheet(), SpreadJsObj.DataType.Tree, ledgerTree);
  141. }, null, true);
  142. const ledgerSpreadObj = {
  143. refreshTree: function (sheet, data) {
  144. SpreadJsObj.massOperationSheet(sheet, function () {
  145. const tree = sheet.zh_tree;
  146. // 处理删除
  147. if (data.delete) {
  148. data.delete.sort(function (x, y) {
  149. return y.deleteIndex - x.deleteIndex;
  150. });
  151. for (const d of data.delete) {
  152. sheet.deleteRows(d.deleteIndex, 1);
  153. }
  154. }
  155. // 处理新增
  156. if (data.create) {
  157. const newNodes = data.create;
  158. if (newNodes) {
  159. newNodes.sort(function (a, b) {
  160. return a.index - b.index;
  161. });
  162. for (const node of newNodes) {
  163. sheet.addRows(node.index, 1);
  164. SpreadJsObj.reLoadRowData(sheet, tree.nodes.indexOf(node), 1);
  165. }
  166. }
  167. }
  168. // 处理更新
  169. if (data.update) {
  170. const rows = [];
  171. for (const u of data.update) {
  172. rows.push(tree.nodes.indexOf(u));
  173. }
  174. SpreadJsObj.reLoadRowsData(sheet, rows);
  175. }
  176. // 处理展开
  177. if (data.expand) {
  178. const expanded = [];
  179. for (const e of data.expand) {
  180. if (expanded.indexOf(e) === -1) {
  181. const posterity = tree.getPosterity(e);
  182. for (const p of posterity) {
  183. sheet.setRowVisible(tree.nodes.indexOf(p), p.visible);
  184. expanded.push(p);
  185. }
  186. }
  187. }
  188. }
  189. });
  190. },
  191. editEnded: function (e, info) {
  192. if (info.sheet.zh_setting) {
  193. const select = SpreadJsObj.getSelectObject(info.sheet);
  194. const col = info.sheet.zh_setting.cols[info.col];
  195. const validText = is_numeric(info.editingText) ? parseFloat(info.editingText) : (info.editingText ? trimInvalidChar(info.editingText) : null);
  196. const orgValue = select[col.field];
  197. if (orgValue == validText || ((!orgValue || orgValue === '') && (validText === ''))) {
  198. SpreadJsObj.reLoadRowData(info.sheet, info.row);
  199. return;
  200. }
  201. if (isNaN(validText)) {
  202. toastr.error('不能输入其它非数字类型字符');
  203. SpreadJsObj.reLoadRowData(info.sheet, info.row);
  204. return;
  205. }
  206. const yearmonth = col.field.split('_')[0];
  207. const mode = col.field.split('_')[1];
  208. let plan_gcl = 0;
  209. let plan_tp = 0;
  210. // 判断输入位数,提示
  211. if (mode === 'tp') {
  212. const reg = new RegExp('^([-]?)\\d+(\\.\\d{0,'+ parseInt(tenderInfo.decimal.tp) +'})?$');
  213. if (validText !== null && (!reg.test(validText))) {
  214. toastr.error('输入金额小数位数不能大于' + tenderInfo.decimal.tp + '位');
  215. SpreadJsObj.reLoadRowData(info.sheet, info.row);
  216. return;
  217. }
  218. plan_gcl = select.dgn_price && select.dgn_price !== 0 ? ZhCalc.round(ZhCalc.div(validText, select.dgn_price), tenderInfo.decimal.up) : 0;
  219. plan_tp = validText;
  220. } else {
  221. const reg = new RegExp('^([-]?)\\d+(\\.\\d{0,'+ parseInt(tenderInfo.decimal.up) +'})?$');
  222. if (validText !== null && (!reg.test(validText))) {
  223. toastr.error('输入工程量小数位数不能大于' + tenderInfo.decimal.up + '位');
  224. SpreadJsObj.reLoadRowData(info.sheet, info.row);
  225. return;
  226. }
  227. plan_gcl = validText;
  228. plan_tp = select.dgn_price && select.dgn_price !== 0 ? ZhCalc.round(ZhCalc.mul(validText, select.dgn_price), tenderInfo.decimal.tp) : 0;
  229. }
  230. select[col.field] = validText;
  231. const updateData = {
  232. lid: select.ledger_id,
  233. yearmonth,
  234. plan_gcl,
  235. plan_tp,
  236. };
  237. console.log(updateData);
  238. postData(window.location.pathname + '/save', {type: 'ledger_edit', postData: updateData}, function (result) {
  239. if (mode === 'tp') {
  240. select[yearmonth + '_gcl'] = plan_gcl;
  241. } else {
  242. select[yearmonth + '_tp'] = plan_tp;
  243. }
  244. const nodes = treeCalc.calculateParent(info.sheet.zh_tree, select);
  245. SpreadJsObj.reLoadNodesData(info.sheet, nodes);
  246. SpreadJsObj.reLoadRowData(info.sheet, info.row);
  247. },function () {
  248. select[col.field] = orgValue;
  249. const nodes = treeCalc.calculateParent(info.sheet.zh_tree, select);
  250. SpreadJsObj.reLoadNodesData(info.sheet, nodes);
  251. SpreadJsObj.reLoadRowData(info.sheet, info.row);
  252. })
  253. }
  254. },
  255. deletePress: function (sheet) {
  256. return;
  257. },
  258. clipboardPasted(e, info) {
  259. const hint = {
  260. cellError: {type: 'error', msg: '粘贴内容超出了表格范围'},
  261. numberExpr: {type: 'error', msg: '不能粘贴其它非数字类型字符'},
  262. };
  263. const range = info.cellRange;
  264. if (range.rowCount > 1 || range.colCount > 1) {
  265. toastMessageUniq(hint.cellError);
  266. SpreadJsObj.reLoadSheetHeader(ledgerSpread.getActiveSheet());
  267. SpreadJsObj.reLoadSheetData(ledgerSpread.getActiveSheet());
  268. return;
  269. }
  270. const select = SpreadJsObj.getSelectObject(info.sheet);
  271. const col = info.sheet.zh_setting.cols[range.col];
  272. const validText = is_numeric(info.pasteData.text) ? parseFloat(info.pasteData.text) : (info.pasteData.text ? trimInvalidChar(info.pasteData.text) : null);
  273. const orgValue = select[col.field];
  274. if (orgValue == validText || ((!orgValue || orgValue === '') && (validText === ''))) {
  275. SpreadJsObj.reLoadRowData(info.sheet, info.row);
  276. return;
  277. }
  278. if (isNaN(validText)) {
  279. toastr.error('不能粘贴其它非数字类型字符');
  280. SpreadJsObj.reLoadRowData(info.sheet, info.cellRange.row, info.cellRange.rowCount);
  281. return;
  282. }
  283. const yearmonth = col.field.split('_')[0];
  284. const mode = col.field.split('_')[1];
  285. let plan_gcl = 0;
  286. let plan_tp = 0;
  287. // 判断输入位数,提示
  288. if (mode === 'tp') {
  289. const reg = new RegExp('^([-]?)\\d+(\\.\\d{0,'+ parseInt(tenderInfo.decimal.tp) +'})?$');
  290. if (validText !== null && (!reg.test(validText))) {
  291. toastr.error('粘贴的金额小数位数不能大于' + tenderInfo.decimal.tp + '位');
  292. SpreadJsObj.reLoadRowData(info.sheet, info.cellRange.row, info.cellRange.rowCount);
  293. return;
  294. }
  295. plan_gcl = select.dgn_price && select.dgn_price !== 0 ? ZhCalc.round(ZhCalc.div(validText, select.dgn_price), tenderInfo.decimal.up) : 0;
  296. plan_tp = validText;
  297. } else {
  298. const reg = new RegExp('^([-]?)\\d+(\\.\\d{0,'+ parseInt(tenderInfo.decimal.up) +'})?$');
  299. if (validText !== null && (!reg.test(validText))) {
  300. toastr.error('粘贴的工程量小数位数不能大于' + tenderInfo.decimal.up + '位');
  301. SpreadJsObj.reLoadRowData(info.sheet, info.cellRange.row, info.cellRange.rowCount);
  302. return;
  303. }
  304. plan_gcl = validText;
  305. plan_tp = select.dgn_price && select.dgn_price !== 0 ? ZhCalc.round(ZhCalc.mul(validText, select.dgn_price), tenderInfo.decimal.tp) : 0;
  306. }
  307. select[col.field] = validText;
  308. const updateData = {
  309. lid: select.ledger_id,
  310. yearmonth,
  311. plan_gcl,
  312. plan_tp,
  313. };
  314. postData(window.location.pathname + '/save', {type: 'ledger_edit', postData: updateData}, function (result) {
  315. if (mode === 'tp') {
  316. select[yearmonth + '_gcl'] = plan_gcl;
  317. } else {
  318. select[yearmonth + '_tp'] = plan_tp;
  319. }
  320. const nodes = treeCalc.calculateParent(info.sheet.zh_tree, select);
  321. SpreadJsObj.reLoadNodesData(info.sheet, nodes);
  322. SpreadJsObj.reLoadRowData(info.sheet, info.cellRange.row, info.cellRange.rowCount);
  323. },function () {
  324. select[col.field] = orgValue;
  325. const nodes = treeCalc.calculateParent(info.sheet.zh_tree, select);
  326. SpreadJsObj.reLoadNodesData(info.sheet, nodes);
  327. SpreadJsObj.reLoadRowData(info.sheet, info.cellRange.row, info.cellRange.rowCount);
  328. })
  329. },
  330. };
  331. ledgerSpread.bind(spreadNS.Events.EditEnded, ledgerSpreadObj.editEnded);
  332. SpreadJsObj.addDeleteBind(ledgerSpread, ledgerSpreadObj.deletePress);
  333. ledgerSpread.bind(spreadNS.Events.ClipboardPasted, ledgerSpreadObj.clipboardPasted);
  334. // 进度计算方式选择
  335. $('.mode-select').on('click', function () {
  336. const _self = $(this);
  337. postData(window.location.pathname + '/save', {type: 'mode', postData: $(this).data('mode')}, function (result) {
  338. _self.addClass('disabled').attr('disabled', true);
  339. _self.parents('.col-6').siblings('.col-6').find('button').removeClass('disabled').removeAttr('disabled');
  340. $('#mode-tips').show();
  341. $('#mode-cancel').show();
  342. $('#mode').modal('hide');
  343. schedule.mode = _self.data('mode');
  344. SpreadJsObj.reLoadSheetData(ledgerSpread.getActiveSheet());
  345. })
  346. });
  347. // 月份添加
  348. $('#add-month').click(function () {
  349. const range = $('#month-range').val();
  350. if(range === '') {
  351. toastr.error('请选择计划周期时间');
  352. return;
  353. }
  354. const addMonthList = [];
  355. const cycle = range.split(' ~ ');
  356. if(cycle.length === 1) {
  357. addMonthList.push(cycle[0]);
  358. } else {
  359. // 多个月份
  360. const back_year = parseInt(cycle[1].split('-')[0]);
  361. const back_month = parseInt(cycle[1].split('-')[1]);
  362. const front_year = parseInt(cycle[0].split('-')[0]);
  363. const front_month = parseInt(cycle[0].split('-')[1]);
  364. if(back_year > front_year) {
  365. const num = getDistanceMonth(cycle[0], cycle[1]);
  366. let j = 1;
  367. for (let i = 0; i <= num; i++) {
  368. if(front_month + i > 12*j) {
  369. j = j + 1;
  370. }
  371. const m = (front_month + i)%12 === 0 ? 12 : (front_month + i)%12;
  372. addMonthList.push((front_year + (j-1)) + '-' + (m < 10 ? '0' + m : m));
  373. }
  374. } else if (back_year === front_year) {
  375. // 小于1年并没有跨年
  376. for (let i = front_month; i <= back_month; i++) {
  377. addMonthList.push(back_year + '-' + (i < 10 ? '0' + i : i));
  378. }
  379. }
  380. }
  381. // 判断是否已添加本月份
  382. if (addMonthList.length > 0) {
  383. const hadmonth = [];
  384. for (const m of addMonthList) {
  385. const one = _.find(scheduleMonth, { yearmonth: m });
  386. console.log(one, m);
  387. if (one) {
  388. hadmonth.push(m);
  389. }
  390. }
  391. if (hadmonth.length > 0) {
  392. let html = '';
  393. for (const hm of hadmonth) {
  394. html += `<div class="alert alert-danger">${hm} 已创建</div>`;
  395. }
  396. $('#add-month-error-list').html(html);
  397. $('#add-month-error-list').show();
  398. return;
  399. }
  400. } else {
  401. toastr.error('请选择计划周期时间');
  402. return;
  403. }
  404. $('#add-month-error-list').html('');
  405. $('#add-month-error-list').hide();
  406. const _self = $(this);
  407. postData(window.location.pathname + '/save', {type: 'addmonth', postData: addMonthList}, function (result) {
  408. _self.addClass('disabled').attr('disabled', true);
  409. toastr.success('新增成功');
  410. setTimeout(function () {
  411. window.location.reload();
  412. }, 500)
  413. })
  414. });
  415. $('#month-table input[type="checkbox"]').click(function () {
  416. const selectedMonth = [];
  417. $('#month-table input:checkbox:checked').each(function () {
  418. selectedMonth.push('「' + $(this).parents('td').siblings('td').text() + '」');
  419. });
  420. if(selectedMonth.length > 0) {
  421. $('#del-month-list').text(selectedMonth.join(''));
  422. $('#del-month-list').parent().show();
  423. $('#del-month').removeAttr('disabled');
  424. } else {
  425. $('#del-month-list').parent().hide();
  426. $('#del-month').attr('disabled', true);
  427. }
  428. });
  429. $('#del-month').click(function () {
  430. const selectedMonth = [];
  431. $('#month-table input:checkbox:checked').each(function () {
  432. selectedMonth.push($(this).parents('td').siblings().text());
  433. });
  434. if (selectedMonth.length === 0) {
  435. toastr.error('请选择删除的计划周期');
  436. return;
  437. }
  438. const _self = $(this);
  439. postData(window.location.pathname + '/save', {type: 'delmonth', postData: selectedMonth}, function (result) {
  440. _self.addClass('disabled').attr('disabled', true);
  441. toastr.success('删除成功');
  442. setTimeout(function () {
  443. window.location.reload();
  444. }, 500)
  445. })
  446. });
  447. $.subMenu({
  448. menu: '#sub-menu', miniMenu: '#sub-mini-menu', miniMenuList: '#mini-menu-list',
  449. toMenu: '#to-menu', toMiniMenu: '#to-mini-menu',
  450. key: 'menu.1.0.0',
  451. miniHint: '#sub-mini-hint', hintKey: 'menu.hint.1.0.1',
  452. callback: function (info) {
  453. if (info.mini) {
  454. $('.panel-title').addClass('fluid');
  455. $('#sub-menu').removeClass('panel-sidebar');
  456. } else {
  457. $('.panel-title').removeClass('fluid');
  458. $('#sub-menu').addClass('panel-sidebar');
  459. }
  460. ledgerSpread.refresh();
  461. autoFlashHeight();
  462. }
  463. });
  464. });
  465. // 月份间隔
  466. function getDistanceMonth(startTime,endTime){
  467. startTime = new Date(startTime);
  468. endTime = new Date(endTime);
  469. var dateToMonth = 0;
  470. var startDate=startTime.getDate() + startTime.getHours()/24 + startTime.getMinutes()/24/60;
  471. var endDate=endTime.getDate() +endTime.getHours()/24 + endTime.getMinutes()/24/60;
  472. if(endDate >= startDate){
  473. dateToMonth = 0;
  474. }else{
  475. dateToMonth = -1;
  476. }
  477. let yearToMonth = (endTime.getYear() - startTime.getYear()) * 12;
  478. let monthToMonth = endTime.getMonth() - startTime.getMonth();
  479. return yearToMonth + monthToMonth + dateToMonth;
  480. }
  481. function setLeafData(tree) {
  482. const newtree = [];
  483. for (const t of tree) {
  484. const child = _.find(tree, { 'ledger_pid': t.ledger_id });
  485. if (!child && !t.is_leaf) {
  486. t.is_leaf = true;
  487. }
  488. newtree.push(t);
  489. }
  490. return newtree;
  491. }
  492. function setMonthToLedger(ledgerList, slm) {
  493. if (slm.length > 0) {
  494. for(const s of slm) {
  495. const index = _.findIndex(ledgerList, { 'ledger_id': s.lid });
  496. if (index && index !== -1) {
  497. ledgerList[index][s.yearmonth + '_tp'] = s.plan_tp;
  498. ledgerList[index][s.yearmonth + '_gcl'] = s.plan_gcl;
  499. }
  500. }
  501. }
  502. return ledgerList;
  503. }
  504. const is_numeric = (value) => {
  505. if (typeof(value) === 'object') {
  506. return false;
  507. } else {
  508. return !Number.isNaN(Number(value)) && value.toString().trim() !== '';
  509. }
  510. };