diff --git a/entity/TurnoverTree_entity/recordcontainers/jdito/contentProcess.js b/entity/TurnoverTree_entity/recordcontainers/jdito/contentProcess.js index d12d20da8e7b6d59c27b87c298a673f940788fe6..3493235775d5b1183b589f1d210dac6c5ff5f100 100644 --- a/entity/TurnoverTree_entity/recordcontainers/jdito/contentProcess.js +++ b/entity/TurnoverTree_entity/recordcontainers/jdito/contentProcess.js @@ -8,6 +8,19 @@ import("KeywordRegistry_basic"); import("Keyword_lib"); import("system.translate"); +/** + * This content process is similar to the Turnover_entity content process. + * It is modified for the tree table. This means + * - months with no forecast or turnover are not added explicitely + * - the _addCount function adds the layerIndex to the countData, which is used... + * - ... to sort the table so that all parents are added before the childs (as the treetable needs it in this order) + * - the sort function also sorts the data by year, month and productgroup name (using TreeUtils.treeOrderBy) + * - the _addCount is modified specially for THIS tree. + * TODO: make more generic and use for both: the tree and the chart + * + * See Turnover_entity content process for more documentation + */ + var turnoverCategory = translate.text('Turnover'); var forecastCategory = translate.text('Forecast'); @@ -41,15 +54,12 @@ var columns = { groupcodeName: 8 }; -// combine both data sources - - var treeData = []; var countData = {}; turnover.forEach(function(row) { - var monthDate = new Date(row[columns.year], row[columns.month]-1); + var monthDate = new Date(row[columns.year], row[columns.month]); monthDate = datetime.toDate(monthDate.getTime(), "MMM yyyy", "UTC"); _addCount([row[columns.year], [row[columns.month], monthDate], [row[columns.groupcodeId], row[columns.groupcodeName]]], row[columns.type], row[columns.year], row[columns.month], MoneyUtils.getGross( diff --git a/entity/Turnover_entity/recordcontainers/jdito/contentProcess.js b/entity/Turnover_entity/recordcontainers/jdito/contentProcess.js index 02befbe14cce3d34c0e60f50777da046c11bfe1f..bd20eceda69bc4ed288c1090ba77ee4918831b57 100644 --- a/entity/Turnover_entity/recordcontainers/jdito/contentProcess.js +++ b/entity/Turnover_entity/recordcontainers/jdito/contentProcess.js @@ -58,7 +58,6 @@ var chartData = []; var countData = {} var monthDate; - /** * 2. Special treatment for some layers * Some data needs special treatment. You may ommit these if you don't need it. @@ -99,7 +98,7 @@ for (let y = minYear; y <= maxYear; y++) data.forEach(function(row) { // load the display value for the months - monthDate = new Date(row[columns.year], row[columns.month]); + monthDate = new Date(row[columns.year], row[columns.month]-1); monthDate = datetime.toDate(monthDate.getTime(), "MMM yyyy", "UTC"); switch(row[columns.type])