jpc_report.js 23 KB

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