Skip to content
Snippets Groups Projects
Commit c0847807 authored by Johannes Hörmann's avatar Johannes Hörmann
Browse files

fix turnover chart - Months & Documentation

parent 62d9918e
No related branches found
No related tags found
No related merge requests found
......@@ -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(
......
......@@ -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])
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment