jpc_report.js 23 KB

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