jpc_report.js 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455
  1. 'use strict';
  2. /**
  3. * Created by Tony on 2023/4/14.
  4. */
  5. const BaseService = require('../base/base_service');
  6. const JpcEx = require('../reports/rpt_component/jpc_ex');
  7. const JV = require('../reports/rpt_component/jpc_value_define');
  8. const rpt_xl_util = require('../reports/util/rpt_excel_util');
  9. const rptDataExtractor = require('../reports/util/rpt_calculation_data_util');
  10. const RPT_DEF_PROPERTIES = require('../const/report_defined_properties');
  11. const needCustomTables = [
  12. 'mem_custom_select',
  13. 'mem_gather_stage_bills', 'mem_gather_deal_bills', 'mem_gather_stage_pay', 'mem_gather_tender_info',
  14. 'mem_stage_sum_bills', 'mem_stage_sum_pay',
  15. 'mem_jh_gather_im_change', 'mem_jh_im_change', 'mem_jh_gather_stage_bills_compare',
  16. 'mem_material_sum_gl',
  17. ];
  18. const sourceTypeConst = require('../const/source_type');
  19. module.exports = app => {
  20. class JpcReport extends BaseService {
  21. /**
  22. * 构造函数
  23. *
  24. * @param {Object} ctx - egg全局变量
  25. * @return {void}
  26. */
  27. constructor(ctx) {
  28. super(ctx);
  29. this.tableName = '';
  30. this.dataId = '';
  31. }
  32. async getAllPagesCommon(ctx, rptTpl, params, option, outputType, baseDir, customSelect) {
  33. const rptDataUtil = new rptDataExtractor();
  34. rptDataUtil.initialize(rptTpl);
  35. const filter = rptDataUtil.getDataRequestFilter();
  36. const rawDataObj = await ctx.service.report.getReportData(rptTpl.source_type, params, filter.tables, filter.memFieldKeys,
  37. rptTpl[JV.NODE_CUSTOM_DEFINE], customSelect);
  38. // console.log(rawDataObj);
  39. try {
  40. const printCom = JpcEx.createNew();
  41. setupPageSize(rptTpl, params.pageSize);
  42. if (params.orientation && (params.orientation !== 'null')) rptTpl[JV.NODE_MAIN_INFO][JV.NODE_PAGE_INFO][JV.PROP_ORIENTATION] = params.orientation;
  43. const defProperties = RPT_DEF_PROPERTIES;
  44. const tplData = rptDataUtil.assembleData(ctx, rawDataObj, baseDir, printCom, customSelect);
  45. if (params.custCfg) {
  46. setupCustomizeCfg(params.custCfg, rptTpl, defProperties);
  47. } else {
  48. // setupCustomizeCfg(defProperties, rptTpl, defProperties);
  49. }
  50. const dftOption = params.option || JV.PAGING_OPTION_NORMAL;
  51. printCom.initialize(rptTpl);
  52. printCom.analyzeData(ctx.helper, rptTpl, tplData, defProperties, dftOption, outputType, customSelect, params.splitArchives);
  53. const maxPages = printCom.totalPages;
  54. let pageRst = null;
  55. if (maxPages > 0) {
  56. pageRst = printCom.outputAsSimpleJSONPageArray(ctx.helper, rptTpl, tplData, 1, maxPages, defProperties, params.custCfg, customSelect);
  57. } else {
  58. pageRst = printCom.outputAsPreviewPage(rptTpl, defProperties);
  59. }
  60. pageRst.id = params.rpt_tpl_id;
  61. if (tplData.splitArcPages) {
  62. pageRst.splitArcPages = tplData.splitArcPages;
  63. pageRst.splitArcPagesInfo = tplData.splitArcPagesInfo;
  64. }
  65. return pageRst;
  66. } catch (ex) {
  67. console.log('报表数据异常, tender id: ' + params.tender_id);
  68. console.log(ex);
  69. }
  70. }
  71. async getMultiRptsCommon(ctx, params, outputType, baseDir) {
  72. for (let idx = 0; idx < params.rpt_ids.length; idx++) {
  73. params.rpt_ids[idx] = parseInt(params.rpt_ids[idx]); // 转换一下,以防万一
  74. }
  75. const rptTpls = await ctx.service.rptTpl.getAllTplByIds(params.rpt_ids);
  76. rptTpls.sort(function(rpt1, rpt2) {
  77. return params.rpt_ids.indexOf(rpt1.id) - params.rpt_ids.indexOf(rpt2.id);
  78. });
  79. for (let rtIdx = 0; rtIdx < rptTpls.length; rtIdx++) {
  80. const newRptTpl = JSON.parse(rptTpls[rtIdx].rpt_content);
  81. newRptTpl.id = rptTpls[rtIdx].id;
  82. newRptTpl.source_type = rptTpls[rtIdx].source_type || sourceTypeConst.defaultSourceType;
  83. rptTpls[rtIdx] = newRptTpl;
  84. }
  85. const rptDataUtil = new rptDataExtractor();
  86. const filterTables = [];
  87. const memFieldKeys = {};
  88. let customSelect = {};
  89. let customDefine = {};
  90. for (const rptTpl of rptTpls) {
  91. rptDataUtil.initialize(rptTpl);
  92. const filter = rptDataUtil.getDataRequestFilter();
  93. // console.log(filter);
  94. for (const table of filter.tables) {
  95. if (filterTables.indexOf(table) < 0 && needCustomTables.indexOf(table) < 0) {
  96. filterTables.push(table);
  97. }
  98. // memFieldKeys[table] = [];
  99. }
  100. for (const tableKeyProp in filter.memFieldKeys) {
  101. if (needCustomTables.indexOf(tableKeyProp) >= 0) continue;
  102. if (!memFieldKeys.hasOwnProperty(tableKeyProp)) {
  103. memFieldKeys[tableKeyProp] = [];
  104. }
  105. for (const mfKey of filter.memFieldKeys[tableKeyProp]) {
  106. if (memFieldKeys[tableKeyProp].indexOf(mfKey) < 0) {
  107. memFieldKeys[tableKeyProp].push(mfKey);
  108. }
  109. }
  110. }
  111. // 输出报表的时候要把客户选择的数据的参数加进来
  112. let finCustomSelect = {};
  113. if (rptTpl[JV.NODE_CUSTOM_DEFINE]) {
  114. finCustomSelect = rptTpl[JV.NODE_CUSTOM_DEFINE] && rptTpl[JV.NODE_CUSTOM_DEFINE][JV.NODE_CUS_AUDIT_SELECT].enable
  115. ? await ctx.service.rptCustomDefine.getCustomDefine(params.tender_id, params.stage_id, rptTpl.id)
  116. : await ctx.service.rptCustomDefine.getCustomDefine(params.tender_id, -1, rptTpl.id);
  117. }
  118. if (finCustomSelect) {
  119. customDefine = rptTpl[JV.NODE_CUSTOM_DEFINE];
  120. customSelect = finCustomSelect;
  121. }
  122. }
  123. const rawDataObj = await ctx.service.report.getReportData(rptTpls[0].source_type, params, filterTables, memFieldKeys, customDefine, customSelect);
  124. // const rawDataObj = await ctx.service.report.getReportData(rptTpls[0].source_type, params, filterTables, memFieldKeys, {}, {});
  125. try {
  126. const rptPageRstArray = [];
  127. // 2. 一个一个模板创建数据
  128. // let defProperties = await ctx.service.rptPreDefineCfg.getCfgById('Administrator');
  129. // defProperties = JSON.parse(defProperties[0].defined_content);
  130. const defProperties = RPT_DEF_PROPERTIES;
  131. for (let tplIdx = 0; tplIdx < rptTpls.length; tplIdx++) {
  132. const rptTpl = (rptTpls[tplIdx]._doc) ? rptTpls[tplIdx]._doc : rptTpls[tplIdx];
  133. rptDataUtil.initialize(rptTpl);
  134. let customSelect = rptTpl[JV.NODE_CUSTOM_DEFINE] && rptTpl[JV.NODE_CUSTOM_DEFINE][JV.NODE_CUS_AUDIT_SELECT].enable
  135. ? await ctx.service.rptCustomDefine.getCustomDefine(params.tender_id, params.stage_id, rptTpl.id)
  136. : await ctx.service.rptCustomDefine.getCustomDefine(params.tender_id, -1, rptTpl.id);
  137. if (rptTpl[JV.NODE_CUSTOM_DEFINE] && rptTpl[JV.NODE_CUSTOM_DEFINE][JV.NODE_CUS_CHANGE_SELECT] && rptTpl[JV.NODE_CUSTOM_DEFINE][JV.NODE_CUS_CHANGE_SELECT].enable) {
  138. customSelect = { tid: params.tender_id, rid: params.rpt_tpl_id, sid: -1, change_select: params.customSelect[tplIdx].change_select };
  139. }
  140. // 从汇总的rawDataObj中拷贝所需数据表至curRawDataObj,以供后续使用
  141. const curRawDataObj = {};
  142. const filter = rptDataUtil.getDataRequestFilter();
  143. for (const table of filter.tables) {
  144. curRawDataObj[table] = ctx.helper.clone(rawDataObj[table]);
  145. }
  146. // 如果是用户交互类型的表,则应该单独获取数据
  147. if ((params.customSelect && params.customSelect[tplIdx]) || rptTpl[JV.NODE_CUSTOM_DEFINE][JV.NODE_CUS_OPTION]) {
  148. const cfTables = [],
  149. cmFieldKeys = [];
  150. const curFilter = rptDataUtil.getDataRequestFilter();
  151. for (const table of curFilter.tables) {
  152. if (needCustomTables.indexOf(table) >= 0) {
  153. cfTables.push(table);
  154. }
  155. }
  156. for (const tableKeyProp in filter.memFieldKeys) {
  157. if (needCustomTables.indexOf(tableKeyProp) < 0) continue;
  158. if (!cmFieldKeys.hasOwnProperty(tableKeyProp)) {
  159. cmFieldKeys[tableKeyProp] = [];
  160. }
  161. for (const mfKey of filter.memFieldKeys[tableKeyProp]) {
  162. if (cmFieldKeys[tableKeyProp].indexOf(mfKey) < 0) {
  163. cmFieldKeys[tableKeyProp].push(mfKey);
  164. }
  165. }
  166. }
  167. const customRawDataObj = await ctx.service.report.getReportData(rptTpl.source_type, params, cfTables, cmFieldKeys,
  168. rptTpl[JV.NODE_CUSTOM_DEFINE], customSelect);
  169. for (const prop in customRawDataObj) {
  170. curRawDataObj[prop] = customRawDataObj[prop];
  171. }
  172. }
  173. const tplData = rptDataUtil.assembleData(ctx, curRawDataObj, baseDir, null, customSelect);
  174. const printCom = JpcEx.createNew();
  175. setupPageSize(rptTpl, params.pageSize);
  176. if (params.orientation && (params.orientation !== 'null')) rptTpl[JV.NODE_MAIN_INFO][JV.NODE_PAGE_INFO][JV.PROP_ORIENTATION] = params.orientation;
  177. if (params.custCfg) setupCustomizeCfg(params.custCfg, rptTpl, defProperties);
  178. const dftOption = params.option || JV.PAGING_OPTION_NORMAL;
  179. printCom.initialize(rptTpl);
  180. // console.log(rptTpl);
  181. const dftSplitArchives = [];
  182. if (params.splitArchives && params.splitArchives[tplIdx]) {
  183. dftSplitArchives.push(params.splitArchives[tplIdx]);
  184. }
  185. // printCom.analyzeData(ctx.helper, rptTpl, tplData, defProperties, dftOption, outputType, customSelect, params.splitArchives);
  186. printCom.analyzeData(ctx.helper, rptTpl, tplData, defProperties, dftOption, outputType, customSelect, dftSplitArchives);
  187. const maxPages = printCom.totalPages;
  188. let pageRst = null;
  189. // console.log(maxPages);
  190. if (maxPages > 0) {
  191. pageRst = printCom.outputAsSimpleJSONPageArray(ctx.helper, rptTpl, tplData, 1, maxPages, defProperties, params.custCfg, customSelect);
  192. } else {
  193. pageRst = printCom.outputAsPreviewPage(rptTpl, defProperties);
  194. }
  195. pageRst.id = rptTpl.id;
  196. if (tplData.splitArcPages) {
  197. pageRst.splitArcPages = tplData.splitArcPages;
  198. pageRst.splitArcPagesInfo = tplData.splitArcPagesInfo;
  199. }
  200. rptPageRstArray.push(pageRst);
  201. }
  202. return rptPageRstArray;
  203. } catch (ex) {
  204. console.log(`'报表数据异常(getMultiRptsCommon): project_id ${params.project_id}, tender_id: ${params.tender_id}, stage_id: ${params.stage_id}`);
  205. console.log(ex);
  206. } finally {
  207. //
  208. }
  209. }
  210. async getPreviewPagesWithDiscreteDataCommon(ctx, rawRptTpl, pageSize, baseDir, customSelect) {
  211. // 此方法是要获取带离散数据的预览页面
  212. const rptTpl = JSON.parse(rawRptTpl.rpt_content);
  213. let params = null;
  214. if (ctx.params) {
  215. params = {};
  216. params.tender_id = ctx.params.id;
  217. params.detail_id = ctx.params.did;
  218. }
  219. const rptDataUtil = new rptDataExtractor();
  220. rptDataUtil.initialize(rptTpl);
  221. const filter = rptDataUtil.getDataRequestFilter();
  222. const source_type = rawRptTpl.source_type;
  223. const rawDataObj = await ctx.service.report.getReportData(source_type, params, filter.tables, filter.memFieldKeys,
  224. rptTpl[JV.NODE_CUSTOM_DEFINE], null);
  225. try {
  226. const printCom = JpcEx.createNew();
  227. setupPageSize(rptTpl, pageSize);
  228. const defProperties = RPT_DEF_PROPERTIES;
  229. const tplData = rptDataUtil.assembleData(ctx, rawDataObj, baseDir, printCom, customSelect);
  230. setupSomeDftCustomizeCfg(rptTpl);
  231. printCom.initialize(rptTpl);
  232. printCom.analyzeData(ctx.helper, rptTpl, tplData, defProperties, JV.PAGING_OPTION_NORMAL, JV.OUTPUT_TYPE_NORMAL, customSelect, []);
  233. const maxPages = printCom.totalPages;
  234. let pageRst = null;
  235. //
  236. if (maxPages > 0) {
  237. pageRst = printCom.outputAsSimpleJSONPageArray(ctx.helper, rptTpl, tplData, 1, 1, defProperties, params.custCfg, customSelect);
  238. } else {
  239. pageRst = printCom.outputAsPreviewPage(rptTpl, defProperties);
  240. }
  241. return pageRst;
  242. } catch (ex) {
  243. console.log('报表数据异常, tender id: ' + params.tender_id);
  244. console.log(ex);
  245. }
  246. }
  247. async getAllPreviewPagesCommon(rawRptTpl, pageSize) {
  248. const printCom = JpcEx.createNew();
  249. const defProperties = RPT_DEF_PROPERTIES;
  250. const rptTpl = JSON.parse(rawRptTpl.rpt_content);
  251. setupPageSize(rptTpl, pageSize);
  252. setupSomeDftCustomizeCfg(rptTpl);
  253. printCom.initialize(rptTpl);
  254. const pageRst = printCom.outputAsPreviewPage(rptTpl, defProperties);
  255. return pageRst;
  256. }
  257. }
  258. return JpcReport;
  259. };
  260. function setupPageSize(rptTpl, pageSize) {
  261. // 如果模板设置的是A3,那么就不改动它的页规格(防止没有空间给流水数据,导致爆内存)
  262. if (rptTpl[JV.NODE_MAIN_INFO][JV.NODE_PAGE_INFO][JV.PROP_PAGE_SIZE] !== 'A3' && pageSize) {
  263. rptTpl[JV.NODE_MAIN_INFO][JV.NODE_PAGE_INFO][JV.PROP_PAGE_SIZE] = pageSize;
  264. }
  265. }
  266. function setupCustomizeCfg(customizeCfg, rptTpl, defProperties) {
  267. const tmpObj = {};
  268. // 1. 字体
  269. const newFonts = [];
  270. for (const font of defProperties.fonts) {
  271. const copyFont = {};
  272. copyFont.ID = font.ID;
  273. for (const fontProp of JV.FONT_PROPS) {
  274. copyFont[fontProp] = font[fontProp];
  275. }
  276. newFonts.push(copyFont);
  277. tmpObj[font.ID] = copyFont;
  278. }
  279. const private_setup_font = function(propStr, newFont) {
  280. if (tmpObj[propStr]) {
  281. tmpObj[propStr].Name = newFont.Name;
  282. tmpObj[propStr].FontHeight = String(newFont.FontHeight);
  283. tmpObj[propStr].FontBold = newFont.FontBold;
  284. tmpObj[propStr].FontItalic = newFont.FontItalic;
  285. tmpObj[propStr].FontUnderline = newFont.FontUnderline;
  286. }
  287. };
  288. for (const custFont of customizeCfg.fonts) {
  289. switch (custFont.CfgDispName) {
  290. case '表标题':
  291. private_setup_font('ReportTitle_Main', custFont);
  292. break;
  293. case '列标题':
  294. private_setup_font('HeaderColumn', custFont);
  295. private_setup_font('FooterColumn', custFont);
  296. break;
  297. case '正文内容':
  298. private_setup_font('Content', custFont);
  299. break;
  300. case '合计':
  301. private_setup_font('GrandTotal', custFont);
  302. private_setup_font('SectionTotal', custFont);
  303. break;
  304. case '表眉/表脚':
  305. private_setup_font('Header', custFont);
  306. private_setup_font('Footer', custFont);
  307. break;
  308. default:
  309. break;
  310. }
  311. }
  312. // 1.1 窄体
  313. if (tmpObj.Content_Narrow) {
  314. if (customizeCfg.isNarrow) {
  315. tmpObj.Content_Narrow.Name = 'Arial Narrow';
  316. } else {
  317. if (tmpObj.Content) {
  318. tmpObj.Content_Narrow.Name = tmpObj.Content.Name;
  319. } else {
  320. tmpObj.Content_Narrow.Name = '宋体';
  321. }
  322. }
  323. }
  324. defProperties.fonts = newFonts;
  325. // 2. 页边距
  326. rptTpl[JV.NODE_MAIN_INFO][JV.NODE_MARGINS][JV.PROP_LEFT] = customizeCfg.margins[JV.PROP_LEFT] / 10;
  327. rptTpl[JV.NODE_MAIN_INFO][JV.NODE_MARGINS][JV.PROP_RIGHT] = customizeCfg.margins[JV.PROP_RIGHT] / 10;
  328. rptTpl[JV.NODE_MAIN_INFO][JV.NODE_MARGINS][JV.PROP_TOP] = customizeCfg.margins[JV.PROP_TOP] / 10;
  329. rptTpl[JV.NODE_MAIN_INFO][JV.NODE_MARGINS][JV.PROP_BOTTOM] = customizeCfg.margins[JV.PROP_BOTTOM] / 10;
  330. // 3. 边框宽度
  331. if (customizeCfg.hasOwnProperty('borderThick')) {
  332. for (let i = 0; i < defProperties.styles.length; i++) {
  333. const style = defProperties.styles[i];
  334. if (style.ID === 'BORDER_ALL_AROUND') {
  335. for (const border of style.border_style) {
  336. border.LineWeight = customizeCfg.borderThick;
  337. }
  338. }
  339. }
  340. }
  341. // 4. 边框竖线
  342. if (!(customizeCfg.showVerticalLine)) {
  343. const private_copy_border = function(src) {
  344. const rst = {};
  345. rst.Position = src.Position;
  346. rst.LineWeight = src.LineWeight;
  347. rst.DashStyle = src.DashStyle;
  348. rst.Color = src.Color;
  349. return rst;
  350. };
  351. const newStyles = [];
  352. for (let i = 0; i < defProperties.styles.length; i++) {
  353. const style = defProperties.styles[i];
  354. newStyles.push(style);
  355. if (style.ID === 'BORDER_ALL_AROUND') {
  356. const newStyle = {};
  357. newStyle.ID = style.ID;
  358. newStyle.CfgDispName = style.CfgDispName;
  359. newStyle.border_style = [];
  360. for (const border of style.border_style) {
  361. const newBorder = private_copy_border(border);
  362. newStyle.border_style.push(newBorder);
  363. if (border.Position === 'Left' || border.Position === 'Right') {
  364. newBorder.LineWeight = 0;
  365. }
  366. }
  367. newStyles[newStyles.length - 1] = newStyle;
  368. }
  369. }
  370. defProperties.styles = newStyles;
  371. }
  372. // 5. 补0
  373. const private_Setup_Format = function(tabFields) {
  374. if (tabFields) {
  375. for (const tabField of tabFields) {
  376. if (tabField[JV.PROP_FORMAT]) {
  377. tabField[JV.PROP_FORMAT] = tabField[JV.PROP_FORMAT].replace(new RegExp('#', 'gm'), '0');
  378. }
  379. }
  380. }
  381. };
  382. if (customizeCfg.fillZero) {
  383. if (rptTpl[JV.NODE_FLOW_INFO]) {
  384. if (rptTpl[JV.NODE_FLOW_INFO][JV.NODE_FLOW_CONTENT]) private_Setup_Format(rptTpl[JV.NODE_FLOW_INFO][JV.NODE_FLOW_CONTENT][JV.PROP_FLOW_FIELDS]);
  385. if (rptTpl[JV.NODE_FLOW_INFO][JV.NODE_FLOW_PAGE_SUM]) private_Setup_Format(rptTpl[JV.NODE_FLOW_INFO][JV.NODE_FLOW_PAGE_SUM][JV.PROP_SUM_FIELDS]);
  386. if (rptTpl[JV.NODE_FLOW_INFO][JV.NODE_FLOW_SEG_SUM]) private_Setup_Format(rptTpl[JV.NODE_FLOW_INFO][JV.NODE_FLOW_SEG_SUM][JV.PROP_SUM_FIELDS]);
  387. if (rptTpl[JV.NODE_FLOW_INFO][JV.NODE_FLOW_GROUP] && rptTpl[JV.NODE_FLOW_INFO][JV.NODE_FLOW_GROUP][JV.PROP_GROUP_LINES]) private_Setup_Format(rptTpl[JV.NODE_FLOW_INFO][JV.NODE_FLOW_GROUP][JV.PROP_GROUP_LINES][JV.PROP_SUM_FIELDS]);
  388. if (rptTpl[JV.NODE_FLOW_INFO][JV.NODE_DISCRETE_INFO]) {
  389. for (const discrete of rptTpl[JV.NODE_FLOW_INFO][JV.NODE_DISCRETE_INFO]) {
  390. private_Setup_Format(discrete[JV.PROP_DISCRETE_FIELDS]);
  391. }
  392. }
  393. if (rptTpl[JV.NODE_FLOW_INFO_EX]) {
  394. if (rptTpl[JV.NODE_FLOW_INFO_EX][JV.NODE_FLOW_CONTENT]) private_Setup_Format(rptTpl[JV.NODE_FLOW_INFO_EX][JV.NODE_FLOW_CONTENT][JV.PROP_FLOW_FIELDS]);
  395. if (rptTpl[JV.NODE_FLOW_INFO_EX][JV.NODE_FLOW_PAGE_SUM]) private_Setup_Format(rptTpl[JV.NODE_FLOW_INFO_EX][JV.NODE_FLOW_PAGE_SUM][JV.PROP_SUM_FIELDS]);
  396. if (rptTpl[JV.NODE_FLOW_INFO_EX][JV.NODE_FLOW_SEG_SUM]) private_Setup_Format(rptTpl[JV.NODE_FLOW_INFO_EX][JV.NODE_FLOW_SEG_SUM][JV.PROP_SUM_FIELDS]);
  397. if (rptTpl[JV.NODE_FLOW_INFO_EX][JV.NODE_FLOW_GROUP]) private_Setup_Format(rptTpl[JV.NODE_FLOW_INFO_EX][JV.NODE_FLOW_GROUP][JV.PROP_SUM_FIELDS]);
  398. if (rptTpl[JV.NODE_FLOW_INFO_EX][JV.NODE_FLOW_GROUP] && rptTpl[JV.NODE_FLOW_INFO_EX][JV.NODE_FLOW_GROUP][JV.PROP_GROUP_LINES]) private_Setup_Format(rptTpl[JV.NODE_FLOW_INFO_EX][JV.NODE_FLOW_GROUP][JV.PROP_GROUP_LINES][JV.PROP_SUM_FIELDS]);
  399. if (rptTpl[JV.NODE_FLOW_INFO_EX][JV.NODE_DISCRETE_INFO]) {
  400. for (const discrete of rptTpl[JV.NODE_FLOW_INFO_EX][JV.NODE_DISCRETE_INFO]) {
  401. private_Setup_Format(discrete[JV.PROP_DISCRETE_FIELDS]);
  402. }
  403. }
  404. }
  405. } else if (rptTpl[JV.NODE_BILL_INFO]) {
  406. if (rptTpl[JV.NODE_BILL_INFO][JV.NODE_BILL_CONTENT]) private_Setup_Format(rptTpl[JV.NODE_BILL_INFO][JV.NODE_BILL_CONTENT][JV.PROP_BILL_FIELDS]);
  407. if (rptTpl[JV.NODE_BILL_INFO][JV.NODE_DISCRETE_INFO]) {
  408. for (const discrete of rptTpl[JV.NODE_BILL_INFO][JV.NODE_DISCRETE_INFO]) {
  409. private_Setup_Format(discrete[JV.PROP_DISCRETE_FIELDS]);
  410. }
  411. }
  412. } else if (rptTpl[JV.NODE_CROSS_INFO]) {
  413. if (rptTpl[JV.NODE_CROSS_INFO][JV.NODE_CROSS_CONTENT]) private_Setup_Format(rptTpl[JV.NODE_CROSS_INFO][JV.NODE_CROSS_CONTENT][JV.TAB_CROSS_FIELDS]);
  414. if (rptTpl[JV.NODE_CROSS_INFO][JV.NODE_CROSS_ROW]) private_Setup_Format(rptTpl[JV.NODE_CROSS_INFO][JV.NODE_CROSS_ROW][JV.TAB_CROSS_FIELDS]);
  415. if (rptTpl[JV.NODE_CROSS_INFO][JV.NODE_CROSS_COL]) private_Setup_Format(rptTpl[JV.NODE_CROSS_INFO][JV.NODE_CROSS_COL][JV.TAB_CROSS_FIELDS]);
  416. if (rptTpl[JV.NODE_CROSS_INFO][JV.NODE_CROSS_COL_SUM]) private_Setup_Format(rptTpl[JV.NODE_CROSS_INFO][JV.NODE_CROSS_COL_SUM][JV.TAB_CROSS_FIELDS]);
  417. if (rptTpl[JV.NODE_CROSS_INFO][JV.NODE_CROSS_ROW_EXT]) private_Setup_Format(rptTpl[JV.NODE_CROSS_INFO][JV.NODE_CROSS_ROW_EXT][JV.TAB_CROSS_FIELDS]);
  418. if (rptTpl[JV.NODE_CROSS_INFO][JV.NODE_CROSS_ROW_SUM_EXT]) private_Setup_Format(rptTpl[JV.NODE_CROSS_INFO][JV.NODE_CROSS_ROW_SUM_EXT][JV.TAB_CROSS_FIELDS]);
  419. if (rptTpl[JV.NODE_CROSS_INFO][JV.NODE_DISCRETE_INFO]) {
  420. for (const discrete of rptTpl[JV.NODE_CROSS_INFO][JV.NODE_DISCRETE_INFO]) {
  421. private_Setup_Format(discrete[JV.PROP_DISCRETE_FIELDS]);
  422. }
  423. }
  424. }
  425. }
  426. }
  427. function setupSomeDftCustomizeCfg(rptTpl) {
  428. rptTpl[JV.NODE_MAIN_INFO][JV.NODE_MARGINS][JV.PROP_LEFT] = 1.5;
  429. rptTpl[JV.NODE_MAIN_INFO][JV.NODE_MARGINS][JV.PROP_RIGHT] = 1.5;
  430. rptTpl[JV.NODE_MAIN_INFO][JV.NODE_MARGINS][JV.PROP_TOP] = 1.5;
  431. rptTpl[JV.NODE_MAIN_INFO][JV.NODE_MARGINS][JV.PROP_BOTTOM] = 1.5;
  432. }