jpc_report.js 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449
  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. if (params.pageSize) rptTpl[JV.NODE_MAIN_INFO][JV.NODE_PAGE_INFO][JV.PROP_PAGE_SIZE] = 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. rptTpl[JV.NODE_MAIN_INFO][JV.NODE_PAGE_INFO][JV.PROP_PAGE_SIZE] = params.pageSize;
  176. if (params.pageSize) rptTpl[JV.NODE_MAIN_INFO][JV.NODE_PAGE_INFO][JV.PROP_PAGE_SIZE] = params.pageSize;
  177. if (params.orientation && (params.orientation !== 'null')) rptTpl[JV.NODE_MAIN_INFO][JV.NODE_PAGE_INFO][JV.PROP_ORIENTATION] = params.orientation;
  178. if (params.custCfg) setupCustomizeCfg(params.custCfg, rptTpl, defProperties);
  179. const dftOption = params.option || JV.PAGING_OPTION_NORMAL;
  180. printCom.initialize(rptTpl);
  181. // console.log(rptTpl);
  182. const dftSplitArchives = [];
  183. if (params.splitArchives[tplIdx]) {
  184. dftSplitArchives.push(params.splitArchives[tplIdx]);
  185. }
  186. // printCom.analyzeData(ctx.helper, rptTpl, tplData, defProperties, dftOption, outputType, customSelect, params.splitArchives);
  187. printCom.analyzeData(ctx.helper, rptTpl, tplData, defProperties, dftOption, outputType, customSelect, dftSplitArchives);
  188. const maxPages = printCom.totalPages;
  189. let pageRst = null;
  190. // console.log(maxPages);
  191. if (maxPages > 0) {
  192. pageRst = printCom.outputAsSimpleJSONPageArray(ctx.helper, rptTpl, tplData, 1, maxPages, defProperties, params.custCfg, customSelect);
  193. } else {
  194. pageRst = printCom.outputAsPreviewPage(rptTpl, defProperties);
  195. }
  196. pageRst.id = rptTpl.id;
  197. if (tplData.splitArcPages) {
  198. pageRst.splitArcPages = tplData.splitArcPages;
  199. pageRst.splitArcPagesInfo = tplData.splitArcPagesInfo;
  200. }
  201. rptPageRstArray.push(pageRst);
  202. }
  203. return rptPageRstArray;
  204. } catch (ex) {
  205. console.log(`'报表数据异常(getMultiRptsCommon): project_id ${params.project_id}, tender_id: ${params.tender_id}, stage_id: ${params.stage_id}`);
  206. console.log(ex);
  207. } finally {
  208. //
  209. }
  210. }
  211. async getPreviewPagesWithDiscreteDataCommon(ctx, rawRptTpl, pageSize, baseDir, customSelect) {
  212. // 此方法是要获取带离散数据的预览页面
  213. const rptTpl = JSON.parse(rawRptTpl.rpt_content);
  214. let params = null;
  215. if (ctx.params) {
  216. params = {};
  217. params.tender_id = ctx.params.id;
  218. params.detail_id = ctx.params.did;
  219. }
  220. const rptDataUtil = new rptDataExtractor();
  221. rptDataUtil.initialize(rptTpl);
  222. const filter = rptDataUtil.getDataRequestFilter();
  223. const source_type = rawRptTpl.source_type;
  224. const rawDataObj = await ctx.service.report.getReportData(source_type, params, filter.tables, filter.memFieldKeys,
  225. rptTpl[JV.NODE_CUSTOM_DEFINE], null);
  226. try {
  227. const printCom = JpcEx.createNew();
  228. rptTpl[JV.NODE_MAIN_INFO][JV.NODE_PAGE_INFO][JV.PROP_PAGE_SIZE] = pageSize;
  229. const defProperties = RPT_DEF_PROPERTIES;
  230. const tplData = rptDataUtil.assembleData(ctx, rawDataObj, baseDir, printCom, customSelect);
  231. setupSomeDftCustomizeCfg(rptTpl);
  232. printCom.initialize(rptTpl);
  233. printCom.analyzeData(ctx.helper, rptTpl, tplData, defProperties, JV.PAGING_OPTION_NORMAL, JV.OUTPUT_TYPE_NORMAL, customSelect, []);
  234. const maxPages = printCom.totalPages;
  235. let pageRst = null;
  236. //
  237. if (maxPages > 0) {
  238. pageRst = printCom.outputAsSimpleJSONPageArray(ctx.helper, rptTpl, tplData, 1, 1, defProperties, params.custCfg, customSelect);
  239. } else {
  240. pageRst = printCom.outputAsPreviewPage(rptTpl, defProperties);
  241. }
  242. return pageRst;
  243. } catch (ex) {
  244. console.log('报表数据异常, tender id: ' + params.tender_id);
  245. console.log(ex);
  246. }
  247. }
  248. async getAllPreviewPagesCommon(rawRptTpl, pageSize) {
  249. const printCom = JpcEx.createNew();
  250. const defProperties = RPT_DEF_PROPERTIES;
  251. const rptTpl = JSON.parse(rawRptTpl.rpt_content);
  252. rptTpl[JV.NODE_MAIN_INFO][JV.NODE_PAGE_INFO][JV.PROP_PAGE_SIZE] = pageSize;
  253. setupSomeDftCustomizeCfg(rptTpl);
  254. printCom.initialize(rptTpl);
  255. const pageRst = printCom.outputAsPreviewPage(rptTpl, defProperties);
  256. return pageRst;
  257. }
  258. }
  259. return JpcReport;
  260. };
  261. function setupCustomizeCfg(customizeCfg, rptTpl, defProperties) {
  262. const tmpObj = {};
  263. // 1. 字体
  264. const newFonts = [];
  265. for (const font of defProperties.fonts) {
  266. const copyFont = {};
  267. copyFont.ID = font.ID;
  268. for (const fontProp of JV.FONT_PROPS) {
  269. copyFont[fontProp] = font[fontProp];
  270. }
  271. newFonts.push(copyFont);
  272. tmpObj[font.ID] = copyFont;
  273. }
  274. const private_setup_font = function(propStr, newFont) {
  275. if (tmpObj[propStr]) {
  276. tmpObj[propStr].Name = newFont.Name;
  277. tmpObj[propStr].FontHeight = String(newFont.FontHeight);
  278. tmpObj[propStr].FontBold = newFont.FontBold;
  279. tmpObj[propStr].FontItalic = newFont.FontItalic;
  280. tmpObj[propStr].FontUnderline = newFont.FontUnderline;
  281. }
  282. };
  283. for (const custFont of customizeCfg.fonts) {
  284. switch (custFont.CfgDispName) {
  285. case '表标题':
  286. private_setup_font('ReportTitle_Main', custFont);
  287. break;
  288. case '列标题':
  289. private_setup_font('HeaderColumn', custFont);
  290. private_setup_font('FooterColumn', custFont);
  291. break;
  292. case '正文内容':
  293. private_setup_font('Content', custFont);
  294. break;
  295. case '合计':
  296. private_setup_font('GrandTotal', custFont);
  297. private_setup_font('SectionTotal', custFont);
  298. break;
  299. case '表眉/表脚':
  300. private_setup_font('Header', custFont);
  301. private_setup_font('Footer', custFont);
  302. break;
  303. default:
  304. break;
  305. }
  306. }
  307. // 1.1 窄体
  308. if (tmpObj.Content_Narrow) {
  309. if (customizeCfg.isNarrow) {
  310. tmpObj.Content_Narrow.Name = 'Arial Narrow';
  311. } else {
  312. if (tmpObj.Content) {
  313. tmpObj.Content_Narrow.Name = tmpObj.Content.Name;
  314. } else {
  315. tmpObj.Content_Narrow.Name = '宋体';
  316. }
  317. }
  318. }
  319. defProperties.fonts = newFonts;
  320. // 2. 页边距
  321. rptTpl[JV.NODE_MAIN_INFO][JV.NODE_MARGINS][JV.PROP_LEFT] = customizeCfg.margins[JV.PROP_LEFT] / 10;
  322. rptTpl[JV.NODE_MAIN_INFO][JV.NODE_MARGINS][JV.PROP_RIGHT] = customizeCfg.margins[JV.PROP_RIGHT] / 10;
  323. rptTpl[JV.NODE_MAIN_INFO][JV.NODE_MARGINS][JV.PROP_TOP] = customizeCfg.margins[JV.PROP_TOP] / 10;
  324. rptTpl[JV.NODE_MAIN_INFO][JV.NODE_MARGINS][JV.PROP_BOTTOM] = customizeCfg.margins[JV.PROP_BOTTOM] / 10;
  325. // 3. 边框宽度
  326. if (customizeCfg.hasOwnProperty('borderThick')) {
  327. for (let i = 0; i < defProperties.styles.length; i++) {
  328. const style = defProperties.styles[i];
  329. if (style.ID === 'BORDER_ALL_AROUND') {
  330. for (const border of style.border_style) {
  331. border.LineWeight = customizeCfg.borderThick;
  332. }
  333. }
  334. }
  335. }
  336. // 4. 边框竖线
  337. if (!(customizeCfg.showVerticalLine)) {
  338. const private_copy_border = function(src) {
  339. const rst = {};
  340. rst.Position = src.Position;
  341. rst.LineWeight = src.LineWeight;
  342. rst.DashStyle = src.DashStyle;
  343. rst.Color = src.Color;
  344. return rst;
  345. };
  346. const newStyles = [];
  347. for (let i = 0; i < defProperties.styles.length; i++) {
  348. const style = defProperties.styles[i];
  349. newStyles.push(style);
  350. if (style.ID === 'BORDER_ALL_AROUND') {
  351. const newStyle = {};
  352. newStyle.ID = style.ID;
  353. newStyle.CfgDispName = style.CfgDispName;
  354. newStyle.border_style = [];
  355. for (const border of style.border_style) {
  356. const newBorder = private_copy_border(border);
  357. newStyle.border_style.push(newBorder);
  358. if (border.Position === 'Left' || border.Position === 'Right') {
  359. newBorder.LineWeight = 0;
  360. }
  361. }
  362. newStyles[newStyles.length - 1] = newStyle;
  363. }
  364. }
  365. defProperties.styles = newStyles;
  366. }
  367. // 5. 补0
  368. const private_Setup_Format = function(tabFields) {
  369. if (tabFields) {
  370. for (const tabField of tabFields) {
  371. if (tabField[JV.PROP_FORMAT]) {
  372. tabField[JV.PROP_FORMAT] = tabField[JV.PROP_FORMAT].replace(new RegExp('#', 'gm'), '0');
  373. }
  374. }
  375. }
  376. };
  377. if (customizeCfg.fillZero) {
  378. if (rptTpl[JV.NODE_FLOW_INFO]) {
  379. 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]);
  380. 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]);
  381. 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]);
  382. 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]);
  383. if (rptTpl[JV.NODE_FLOW_INFO][JV.NODE_DISCRETE_INFO]) {
  384. for (const discrete of rptTpl[JV.NODE_FLOW_INFO][JV.NODE_DISCRETE_INFO]) {
  385. private_Setup_Format(discrete[JV.PROP_DISCRETE_FIELDS]);
  386. }
  387. }
  388. if (rptTpl[JV.NODE_FLOW_INFO_EX]) {
  389. 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]);
  390. 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]);
  391. 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]);
  392. 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]);
  393. 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]);
  394. if (rptTpl[JV.NODE_FLOW_INFO_EX][JV.NODE_DISCRETE_INFO]) {
  395. for (const discrete of rptTpl[JV.NODE_FLOW_INFO_EX][JV.NODE_DISCRETE_INFO]) {
  396. private_Setup_Format(discrete[JV.PROP_DISCRETE_FIELDS]);
  397. }
  398. }
  399. }
  400. } else if (rptTpl[JV.NODE_BILL_INFO]) {
  401. 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]);
  402. if (rptTpl[JV.NODE_BILL_INFO][JV.NODE_DISCRETE_INFO]) {
  403. for (const discrete of rptTpl[JV.NODE_BILL_INFO][JV.NODE_DISCRETE_INFO]) {
  404. private_Setup_Format(discrete[JV.PROP_DISCRETE_FIELDS]);
  405. }
  406. }
  407. } else if (rptTpl[JV.NODE_CROSS_INFO]) {
  408. 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]);
  409. 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]);
  410. 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]);
  411. 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]);
  412. 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]);
  413. 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]);
  414. if (rptTpl[JV.NODE_CROSS_INFO][JV.NODE_DISCRETE_INFO]) {
  415. for (const discrete of rptTpl[JV.NODE_CROSS_INFO][JV.NODE_DISCRETE_INFO]) {
  416. private_Setup_Format(discrete[JV.PROP_DISCRETE_FIELDS]);
  417. }
  418. }
  419. }
  420. }
  421. }
  422. function setupSomeDftCustomizeCfg(rptTpl) {
  423. rptTpl[JV.NODE_MAIN_INFO][JV.NODE_MARGINS][JV.PROP_LEFT] = 1.5;
  424. rptTpl[JV.NODE_MAIN_INFO][JV.NODE_MARGINS][JV.PROP_RIGHT] = 1.5;
  425. rptTpl[JV.NODE_MAIN_INFO][JV.NODE_MARGINS][JV.PROP_TOP] = 1.5;
  426. rptTpl[JV.NODE_MAIN_INFO][JV.NODE_MARGINS][JV.PROP_BOTTOM] = 1.5;
  427. }