|
@@ -1,4 +1,5 @@
|
|
|
let JV = require('./jpc_value_define');
|
|
|
+let JE = require('./jpc_rte');
|
|
|
let JpcFieldHelper = require('./helper/jpc_helper_field');
|
|
|
let JpcBandHelper = require('./helper/jpc_helper_band');
|
|
|
let JpcBand = require('./jpc_band');
|
|
@@ -325,7 +326,7 @@ JpcCrossTabSrv.prototype.createNew = function(){
|
|
|
//...
|
|
|
return rst;
|
|
|
};
|
|
|
- JpcCrossTabResult.outputAsSimpleJSONPage = function(rptTpl, dataObj, page, bands, controls, $CURRENT_RPT) {
|
|
|
+ JpcCrossTabResult.outputAsSimpleJSONPage = function(rptTpl, dataObj, page, bands, controls, $CURRENT_RPT, customizeCfg) {
|
|
|
let me = this, rst = [], tabRstLst = [];
|
|
|
let unitFactor = JpcCommonHelper.getUnitFactor(rptTpl);
|
|
|
if (me.paging_option === JV.PAGING_OPTION_INFINITY) {
|
|
@@ -363,11 +364,11 @@ JpcCrossTabSrv.prototype.createNew = function(){
|
|
|
JpcBandHelper.setBandArea(bands, rptTpl, me.pageStatusLst[page - 1]);
|
|
|
//2. start to output detail-part
|
|
|
//2.1 Row-Tab
|
|
|
- tabRstLst.push(me.outputRowTab(rptTpl, dataObj, page, bands, unitFactor, controls));
|
|
|
+ tabRstLst.push(me.outputRowTab(rptTpl, dataObj, page, bands, unitFactor, controls, $CURRENT_RPT, customizeCfg));
|
|
|
//2.2 Col-Tab
|
|
|
- tabRstLst.push(me.outputColTab(rptTpl, dataObj, page, bands, unitFactor, controls));
|
|
|
+ tabRstLst.push(me.outputColTab(rptTpl, dataObj, page, bands, unitFactor, controls, $CURRENT_RPT, customizeCfg));
|
|
|
//2.3 Content-Tab
|
|
|
- tabRstLst.push(me.outputContent(rptTpl, dataObj, page, bands, unitFactor, controls));
|
|
|
+ tabRstLst.push(me.outputContent(rptTpl, dataObj, page, bands, unitFactor, controls, $CURRENT_RPT, customizeCfg));
|
|
|
//2.4 Sum-Tab Row
|
|
|
//2.4 Sum-tab Col
|
|
|
tabRstLst.push(me.outputTabSum(rptTpl, dataObj, page, bands, unitFactor, JV.NODE_CROSS_COL_SUM, controls));
|
|
@@ -383,7 +384,7 @@ JpcCrossTabSrv.prototype.createNew = function(){
|
|
|
}
|
|
|
return rst;
|
|
|
};
|
|
|
- JpcCrossTabResult.outputRowTab = function(rptTpl, dataObj, page, bands, unitFactor, controls) {
|
|
|
+ JpcCrossTabResult.outputRowTab = function(rptTpl, dataObj, page, bands, unitFactor, controls, $CURRENT_RPT, customizeCfg) {
|
|
|
let me = this, rst = [];
|
|
|
let tab = rptTpl[JV.NODE_CROSS_INFO][JV.NODE_CROSS_ROW];
|
|
|
let band = bands[tab[JV.PROP_BAND_NAME]];
|
|
@@ -394,12 +395,26 @@ JpcCrossTabSrv.prototype.createNew = function(){
|
|
|
let data_details = dataObj[JV.DATA_DETAIL_DATA];
|
|
|
let valuesIdx = me.dispValueIdxLst_Row[page - 1];
|
|
|
let serialsIdx = me.dispSerialIdxLst_Row[page - 1];
|
|
|
+ let flexiblePrecisionRefObj = null, flexibleRefField = null;
|
|
|
for (let i = 0; i < me.row_fields_idx.length; i++) {
|
|
|
let tab_field = tab_fields[i];
|
|
|
let data_field = data_details[me.row_fields_idx[i]];
|
|
|
+ let map_data_field = JE.F(tab_field[JV.PROP_FIELD_ID], $CURRENT_RPT);
|
|
|
if (!(tab_field[JV.PROP_HIDDEN])) {
|
|
|
let rows = valuesIdx.length;
|
|
|
for (let rowIdx = 0; rowIdx < rows; rowIdx++) {
|
|
|
+ if (map_data_field && map_data_field[JV.PROP_PRECISION] && map_data_field.flexiblePrecisionRefObj) {
|
|
|
+ if (flexiblePrecisionRefObj === null) {
|
|
|
+ flexiblePrecisionRefObj = {};
|
|
|
+ flexibleRefField = JE.F(map_data_field[JV.PROP_PRECISION][JV.PROP_FLEXIBLE_REF_FILED_ID], $CURRENT_RPT);
|
|
|
+ for (let decimalObj of map_data_field.flexiblePrecisionRefObj) {
|
|
|
+ flexiblePrecisionRefObj["refUnit_" + decimalObj.unit] = decimalObj.decimal;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ JpcFieldHelper.resetFlexibleFormat(tab_field, flexibleRefField, flexiblePrecisionRefObj, valuesIdx[rowIdx], customizeCfg);
|
|
|
+ } else {
|
|
|
+ if (rowIdx === 0) JpcFieldHelper.resetFormat(tab_field, map_data_field, customizeCfg);
|
|
|
+ }
|
|
|
rst.push(me.outputTabField(band, tab_field, data_field, valuesIdx[rowIdx], serialsIdx[rowIdx], rows, rowIdx, 1, 0, unitFactor, true, controls));
|
|
|
}
|
|
|
}
|
|
@@ -408,7 +423,7 @@ JpcCrossTabSrv.prototype.createNew = function(){
|
|
|
}
|
|
|
return rst;
|
|
|
};
|
|
|
- JpcCrossTabResult.outputColTab = function(rptTpl, dataObj, page, bands, unitFactor, controls) {
|
|
|
+ JpcCrossTabResult.outputColTab = function(rptTpl, dataObj, page, bands, unitFactor, controls, $CURRENT_RPT, customizeCfg) {
|
|
|
let me = this, rst = [], firstTextOutput = true;
|
|
|
let tab = rptTpl[JV.NODE_CROSS_INFO][JV.NODE_CROSS_COL];
|
|
|
let band = bands[tab[JV.PROP_BAND_NAME]];
|
|
@@ -418,12 +433,26 @@ JpcCrossTabSrv.prototype.createNew = function(){
|
|
|
let tab_fields = tab[JV.TAB_CROSS_FIELDS];
|
|
|
let data_details = dataObj[JV.DATA_DETAIL_DATA];
|
|
|
let valuesIdx = me.dispValueIdxLst_Col[page - 1];
|
|
|
+ let flexiblePrecisionRefObj = null, flexibleRefField = null;
|
|
|
for (let i = 0; i < me.col_fields_idx.length; i++) {
|
|
|
let tab_field = tab_fields[i];
|
|
|
let data_field = data_details[me.col_fields_idx[i]];
|
|
|
+ let map_data_field = JE.F(tab_field[JV.PROP_FIELD_ID], $CURRENT_RPT);
|
|
|
if (!(tab_field[JV.PROP_HIDDEN])) {
|
|
|
let cols = valuesIdx.length;
|
|
|
for (let colIdx = 0; colIdx < cols; colIdx++) {
|
|
|
+ if (map_data_field && map_data_field[JV.PROP_PRECISION] && map_data_field.flexiblePrecisionRefObj) {
|
|
|
+ if (flexiblePrecisionRefObj === null) {
|
|
|
+ flexiblePrecisionRefObj = {};
|
|
|
+ flexibleRefField = JE.F(map_data_field[JV.PROP_PRECISION][JV.PROP_FLEXIBLE_REF_FILED_ID], $CURRENT_RPT);
|
|
|
+ for (let decimalObj of map_data_field.flexiblePrecisionRefObj) {
|
|
|
+ flexiblePrecisionRefObj["refUnit_" + decimalObj.unit] = decimalObj.decimal;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ JpcFieldHelper.resetFlexibleFormat(tab_field, flexibleRefField, flexiblePrecisionRefObj, valuesIdx[colIdx], customizeCfg);
|
|
|
+ } else {
|
|
|
+ if (colIdx === 0) JpcFieldHelper.resetFormat(tab_field, map_data_field, customizeCfg);
|
|
|
+ }
|
|
|
rst.push(me.outputTabField(band, tab_field, data_field, valuesIdx[colIdx], -1, 1, 0, cols, colIdx, unitFactor, false, controls));
|
|
|
//2. output texts
|
|
|
if (firstTextOutput) {
|
|
@@ -444,7 +473,7 @@ JpcCrossTabSrv.prototype.createNew = function(){
|
|
|
}
|
|
|
return rst;
|
|
|
};
|
|
|
- JpcCrossTabResult.outputContent = function (rptTpl, dataObj, page, bands, unitFactor, controls) {
|
|
|
+ JpcCrossTabResult.outputContent = function (rptTpl, dataObj, page, bands, unitFactor, controls, $CURRENT_RPT, customizeCfg) {
|
|
|
let me = this, rst = [];
|
|
|
let tab = rptTpl[JV.NODE_CROSS_INFO][JV.NODE_CROSS_CONTENT];
|
|
|
let band = bands[tab[JV.PROP_BAND_NAME]];
|
|
@@ -454,14 +483,28 @@ JpcCrossTabSrv.prototype.createNew = function(){
|
|
|
let tab_fields = tab[JV.TAB_CROSS_FIELDS];
|
|
|
let data_details = dataObj[JV.DATA_DETAIL_DATA];
|
|
|
let contentValuesIdx = me.dispValueIdxLst_Content[page - 1];
|
|
|
+ let flexiblePrecisionRefObj = null, flexibleRefField = null;
|
|
|
for (let i = 0; i < tab_fields.length; i++) {
|
|
|
let tab_field = tab_fields[i];
|
|
|
let data_field = data_details[me.content_fields_idx[i]];
|
|
|
+ let map_data_field = JE.F(tab_field[JV.PROP_FIELD_ID], $CURRENT_RPT);
|
|
|
if (!(tab_field[JV.PROP_HIDDEN])) {
|
|
|
let rows = contentValuesIdx.length;
|
|
|
for (let rowIdx = 0; rowIdx < rows; rowIdx++) {
|
|
|
let cols = contentValuesIdx[rowIdx].length;
|
|
|
for (let colIdx = 0; colIdx < cols; colIdx++) {
|
|
|
+ if (map_data_field && map_data_field[JV.PROP_PRECISION] && map_data_field.flexiblePrecisionRefObj) {
|
|
|
+ if (flexiblePrecisionRefObj === null) {
|
|
|
+ flexiblePrecisionRefObj = {};
|
|
|
+ flexibleRefField = JE.F(map_data_field[JV.PROP_PRECISION][JV.PROP_FLEXIBLE_REF_FILED_ID], $CURRENT_RPT);
|
|
|
+ for (let decimalObj of map_data_field.flexiblePrecisionRefObj) {
|
|
|
+ flexiblePrecisionRefObj["refUnit_" + decimalObj.unit] = decimalObj.decimal;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ JpcFieldHelper.resetFlexibleFormat(tab_field, flexibleRefField, flexiblePrecisionRefObj, contentValuesIdx[rowIdx][colIdx], customizeCfg);
|
|
|
+ } else {
|
|
|
+ if (colIdx === 0) JpcFieldHelper.resetFormat(tab_field, map_data_field, customizeCfg);
|
|
|
+ }
|
|
|
rst.push(me.outputTabField(band, tab_field, data_field, contentValuesIdx[rowIdx][colIdx], -1, rows, rowIdx, cols, colIdx, unitFactor, true, controls));
|
|
|
}
|
|
|
}
|