|
|
@@ -403,7 +403,7 @@ function getMultiRptsCommon(user_id, prj_id, rpt_ids, pageSize, orientation, cus
|
|
|
});
|
|
|
}
|
|
|
|
|
|
-function getSummaryReportPages(user_id, prjIds, rpt_id, pageSize, orientation, customizeCfg, option, outputType, cb) {
|
|
|
+function getBillsSummaryReportPages(user_id, prjIds, rpt_id, pageSize, orientation, customizeCfg, option, outputType, cb) {
|
|
|
let rptTpl = null;
|
|
|
rptTplDataFacade.getBudgetSummayDatas(prjIds).then(function(summaryRawDataRst) {
|
|
|
rptTplFacade.getRptTemplate(rpt_id).then(function(rptTpl) {
|
|
|
@@ -442,6 +442,45 @@ function getSummaryReportPages(user_id, prjIds, rpt_id, pageSize, orientation, c
|
|
|
});
|
|
|
}
|
|
|
|
|
|
+function getGljSummaryReportPages(user_id, prjIds, rpt_id, pageSize, orientation, customizeCfg, option, outputType, cb) {
|
|
|
+ let rptTpl = null;
|
|
|
+ rptTplDataFacade.getGLJSummayDatas(prjIds).then(function(summaryRawDataRst) {
|
|
|
+ rptTplFacade.getRptTemplate(rpt_id).then(function(rptTpl) {
|
|
|
+ let rptDataUtil = new rptDataExtractor();
|
|
|
+ rptDataUtil.initialize((rptTpl._doc)?rptTpl._doc:rptTpl);
|
|
|
+ try {
|
|
|
+ let tplData = rptDataUtil.assembleData(summaryRawDataRst);
|
|
|
+ let printCom = JpcEx.createNew();
|
|
|
+ if (pageSize) rptTpl[JV.NODE_MAIN_INFO][JV.NODE_PAGE_INFO][JV.PROP_PAGE_SIZE] = pageSize;
|
|
|
+ //console.log("orientation: " + (orientation === 'null'));
|
|
|
+ if (orientation && (orientation !== 'null')) rptTpl[JV.NODE_MAIN_INFO][JV.NODE_PAGE_INFO][JV.PROP_ORIENTATION] = orientation;
|
|
|
+ let defProperties = rptUtil.getReportDefaultCache();
|
|
|
+ if (customizeCfg) setupCustomizeCfg(customizeCfg, rptTpl, defProperties);
|
|
|
+ let dftOption = option||JV.PAGING_OPTION_NORMAL;
|
|
|
+ printCom.initialize(rptTpl);
|
|
|
+ printCom.analyzeData(rptTpl, tplData, defProperties, dftOption, outputType);
|
|
|
+ let maxPages = printCom.totalPages;
|
|
|
+ let pageRst = null;
|
|
|
+ if (maxPages > 0) {
|
|
|
+ pageRst = printCom.outputAsSimpleJSONPageArray(rptTpl, tplData, 1, maxPages, defProperties, customizeCfg);
|
|
|
+ } else {
|
|
|
+ pageRst = printCom.outputAsPreviewPage(rptTpl, defProperties);
|
|
|
+ }
|
|
|
+ if (pageRst) {
|
|
|
+ cb(null, pageRst);
|
|
|
+ } else {
|
|
|
+ cb('Have errors while on going...', null);
|
|
|
+ }
|
|
|
+ } catch (ex) {
|
|
|
+ console.log("报表数据异常: userId " + user_id + ", project id: " + prj_id);
|
|
|
+ console.log(ex);
|
|
|
+ cb('Exception occurs while on going...', null);
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ });
|
|
|
+}
|
|
|
+
|
|
|
module.exports = {
|
|
|
getReportAllPages: function (req, res) {
|
|
|
let params = JSON.parse(req.body.params),
|
|
|
@@ -511,7 +550,21 @@ module.exports = {
|
|
|
});
|
|
|
},
|
|
|
|
|
|
- getSummaryReportPages: function (req, res) {
|
|
|
+ getBillSummaryReportPages: function (req, res) {
|
|
|
+ let params = JSON.parse(req.body.params),
|
|
|
+ rpt_id = params.rpt_tpl_id,
|
|
|
+ prjIds = params.prjIds,
|
|
|
+ pageSize = params.pageSize,
|
|
|
+ orientation = params.orientation,
|
|
|
+ customizeCfg = params.custCfg
|
|
|
+ ;
|
|
|
+ let user_id = req.session.sessionUser.id;
|
|
|
+ getBillsSummaryReportPages(user_id, prjIds, rpt_id, pageSize, orientation, customizeCfg, null, JV.OUTPUT_TYPE_NORMAL, function (err, pageRst) {
|
|
|
+ callback(req, res, err, pageRst);
|
|
|
+ });
|
|
|
+ },
|
|
|
+
|
|
|
+ getGljSummaryReportPages: function (req, res) {
|
|
|
let params = JSON.parse(req.body.params),
|
|
|
rpt_id = params.rpt_tpl_id,
|
|
|
prjIds = params.prjIds,
|
|
|
@@ -520,7 +573,7 @@ module.exports = {
|
|
|
customizeCfg = params.custCfg
|
|
|
;
|
|
|
let user_id = req.session.sessionUser.id;
|
|
|
- getSummaryReportPages(user_id, prjIds, rpt_id, pageSize, orientation, customizeCfg, null, JV.OUTPUT_TYPE_NORMAL, function (err, pageRst) {
|
|
|
+ getGljSummaryReportPages(user_id, prjIds, rpt_id, pageSize, orientation, customizeCfg, null, JV.OUTPUT_TYPE_NORMAL, function (err, pageRst) {
|
|
|
callback(req, res, err, pageRst);
|
|
|
});
|
|
|
},
|