// get URL params
var getUrlParams = function getUrlParams(sParam) {
var sPageURL = decodeURIComponent(window.location.search.substring(1)),
sURLVariables = sPageURL.split('&'),
sParamsName,
i;
for (i = 0; i < sURLVariables.length; i++) {
sParamsName = sURLVariables[i].split('=');
if (sParamsName[0] === sParam) {
return sParamsName[1] === undefined ? true : sParamsName[1];
}
}
};
// page variables
var ws_url = '/fs/getdata.php';
var site = 2;
var country = getUrlParams('country');
var aifmd = getUrlParams('audience');
var days = 90; // chart data from x days to today
var showChart = false; // true or false
var chartWidth = 868;
var chartHeight = 130;
var chartColor = '112, 112, 114';
// text variables
var textContent = [];
textContent[0] = 'Rücknahmepreis';
textContent[1] = 'Weitere Informationen';
textContent[2] = 'ISIN';
textContent[3] = 'WKN';
textContent[4] = 'Name';
textContent[5] = 'Ausgabepreis';
textContent[6] = 'Währung';
textContent[7] = 'Preis vom';
textContent[8] = 'Suche';
textContent[9] = 'Anzeige:';
textContent[10] = 'Zeilen';
textContent[11] = 'Anzahl:';
textContent[12] = 'von';
textContent[13] = 'Akkumulierter thesaurierter Ertrag vom';
textContent[14] = 'EUR';
textContent[15] = 'ISIN:';
textContent[16] = 'WKN:';
textContent[17] = 'Zwischengewinn';
textContent[18] = 'Aktiengewinn';
textContent[19] = 'Aktiengewinn 2';
textContent[20] = 'Immobiliengewinn';
textContent[21] = 'Ertragsverwendung';
textContent[22] = 'Thesaurierend';
textContent[23] = 'Ausschüttend';
textContent[24] = 'name_deu';
textContent[25] = 'Preischart der letzten 90 Tage';
textContent[26] = 'Tage';
textContent[27] = 'Zur Zeit ist für diesen Fonds leider kein Chart verfügbar.';
textContent[28] = '
Für Ihre Auswahl stehen momentan keine Daten zur Verfügung
';
textContent[29] = 'ATE';
textContent[30] = 'vom';
// Required variables for the chart
var chartLabel = [];
var chartData = [];
var lineChartData = {
labels: [],
datasets: [{
label: textContent[0],
fillColor: "rgba(" + chartColor + ", 0.2)",
strokeColor: "rgba(" + chartColor + ", 1)",
pointColor: "rgba(" + chartColor + ", 1)",
data: []
}]
}
// init function after page load
$(function() {
if (!showChart) {
$('#box').css('height', '450px');
$('#chart').css('visibility', 'hidden');
}
$.ajax({
url: ws_url + '?m=getList&site=' + site + '&country=' + country + '&aifmd=' + aifmd,
dataType: 'json',
success: function(json) {
json = json[0].data;
$('#columns').html(textContent[28]);
$('#columns').columns({
data: json,
size: 100,
schema: [
{"header": "", "key": "isin", "template": 'i'},
{"header": textContent[2], "key": "isin"},
{"header": textContent[3], "key": "wkn"},
{"header": textContent[4], "key": "fullname"},
{"header": textContent[5], "key": "ausgabekurs", "template": '{{ausgabekurs}}
'},
{"header": textContent[0], "key": "ruecknahmekurs", "template": '{{ruecknahmekurs}}
'},
{"header": textContent[6], "key": "waehrung", "template": '{{waehrung}}
'},
{"header": textContent[7], "key": "preis_vom"},
{"header": "", "key": "umbrella", "hide": true}
],
sortableFields: ["id"],
template: '{{#search}}' +
'' +
'' +
'
' +
'{{/search}}' +
'{{#table}}' +
'' +
'
' +
'' +
'{{#headers}}' +
'{{#sortable}}' +
'| ' +
'{{header}}' +
' | ' +
'{{/sortable}}' +
'{{#notSortable}}' +
'' +
'{{header}}' +
' | ' +
'{{/notSortable}}' +
'{{#sortedUp}}' +
'' +
'{{header}} ▲' +
' | ' +
'{{/sortedUp}}' +
'{{#sortedDown}}' +
'' +
'{{header}} ▼' +
' | ' +
'{{/sortedDown}}' +
'{{/headers}}' +
'' +
'' +
'{{#rows}}' +
'{{{.}}}' +
'{{/rows}}' +
'' +
'
' +
'' +
'
' +
'{{/table}}',
showRows: [5, 10, 15, 25, 40, 100]
});
$('#data').columns({
data: json,
search: false,
table: false
});
if (country.toLowerCase() == "de") {
$('#deSpecial').css('visibility', 'visible');
}
}
});
});
// display details
function displayDetails(Obj, isin, country) {
nr = parseInt($(Obj.parentNode.parentNode).attr('data-columns-row-id')) + 1;
var data = {};
if ($('#details' + nr).attr('data-visible')) {
// close details
$('#animation' + nr).animate({
height: '0px'
},
500,
function() {
$(Obj).html('i');
$('#details' + nr).remove();
}
);
} else {
// show details
$(Obj).html('x');
$('#data').columns('setQuery', isin);
data = $('#data').columns('getObject').data[0];
var ate = '';
$('#details' + nr).remove();
$(Obj.parentNode.parentNode).after('
');
if (data.ate_datum != '' && data.ate_ertrag != '' && country.toLowerCase() == "de") {
ate = '| ' + textContent[13] + ' ' + data.ate_datum + ' | ' + data.ate_ertrag + ' ' + textContent[14] + ' |
';
}
$('#details' + nr).html(
'' +
'' +
' ' + data.fullname + ' ' + textContent[15] + ' ' + data.isin + ' / ' + textContent[16] + ' ' + data.wkn + ' ' +
' ' +
'| ' + textContent[5] + ' | ' + data.ausgabekurs + ' ' + data.waehrung + ' | ' +
'| ' + textContent[0] + ' | ' + data.ruecknahmekurs + ' ' + data.waehrung + ' | ' +
'| ' + textContent[7] + ' | ' + data.preis_vom + ' | ' +
'| ' + textContent[17] + ' | ' + data.zwischengewinn + ' ' + data.waehrung + ' | ' +
'| ' + textContent[18] + ' | ' + data.aktiengewinn + ' % | ' +
'| ' + textContent[19] + ' | ' + data.aktiengewinn2 + ' % | ' +
'| ' + textContent[20] + ' | ' + data.immobiliengewinn + ' % | ' +
'| ' + textContent[21] + ' | ' + ((data.thes_aus == 'T') ? textContent[22] : textContent[23]) + ' | ' +
ate +
' ' +
' ' +
' ' +
' ' +
' | '
);
// fonds documents
$.ajax({
url: ws_url + '?m=getDetails&country=' + country + '&id=' + data.id,
dataType: 'json',
async: false,
success: function(result) {
if ($('#tabs' + nr).tabs("instance") != undefined) {
$('#tabs' + nr).tabs("destroy");
$('#tabs' + nr).html('');
}
language = '';
doc = '';
i = 1;
lang = result[0].languages;
data = result[0].data;
if (lang.length > 0 ) {
$.each(lang, function(key, val) {
language += '' +
'' + val[textContent[24]] + '' +
'';
kid = '';
vkp = '';
jb = '';
hjb = '';
sr = '';
mr = '';
all = '';
doc += '';
$.each(data, function(dataKey, dataVal) {
if ( val['lang'] == dataVal['lang'] ) {
if (dataVal['typ'] == 'KID' || dataVal['typ'] == 'VVKP') {
kid += '
';
} else if (dataVal['typ'] == 'VKP') {
vkp += '
';
} else if (dataVal['typ'] == 'JB') {
jb += '
';
} else if (dataVal['typ'] == 'HJB') {
hjb += '
';
} else if (dataVal['typ'] == 'SR') {
sr += '
';
} else if (dataVal['typ'] == 'MR') {
mr += '
';
} else {
docdatum = ' - ' + ((dataVal['doc_date'] != '00.00.0000') ? dataVal['doc_date'] : (dataVal['upload_datum'] != '00.00.0000') ? dataVal['upload_datum'] : '');
docdatum = ((docdatum != ' - ') ? docdatum : '');
all += '
';
}
}
});
doc += kid + vkp + jb + hjb + sr + mr + all + '
';
i++;
});
$('#tabs' + nr).append('');
$('#tabs' + nr).append(doc);
}
$('#tabs' + nr).tabs({
active: 0
});
}
});
// fonds chart
if (showChart) {
$('#chart' + nr).html('');
$('#chart' + nr).html('' + textContent[25] + '
');
$.ajax({
url: ws_url + '?m=getChart&site=' + site + '&country=' + country + '&isin=' + isin + '&days=' + days,
dataType: 'json',
success: function(result) {
result = result[0].data;
chartLabel = [];
chartData = [];
if (result.length > 0) {
$.each(result, function(key, val) {
chartLabel[key] = val['date'];
chartData[key] = val['ruecknahmekurs'];
});
lineChartData['labels'] = chartLabel;
lineChartData['datasets'][0]['data'] = chartData;
var ctx = document.getElementById("canvas" + nr).getContext("2d");
window.myLine = new Chart(ctx).Line(lineChartData, {
animation: false,
scaleFontSize: 10,
scaleLineColor: "rgba(70, 70, 72, .4)",
scaleGridLineColor : "rgba(70, 70, 72,.07)",
scaleFontColor: "#464648",
responsive: false,
pointDotRadius : 1,
datasetStrokeWidth : 1,
pointDot : false,
showTooltips: false
});
} else {
$('#chart' + nr).html('' + textContent[25] + ' ' + days + ' ' + textContent[26] + '
' + textContent[27] + '
');
}
}
});
}
$('#animation' + nr).animate({ height: $('#animation' + nr)[0].scrollHeight }, 500 );
}
}
// Display Special Fonds
function displaySpecial() {
if ($('#specialData').attr('data-visible')) {
// close details
$('#specialData').animate({
height: '0px'
},
500,
function() {
$('#specialData').removeAttr('data-visible');
$('#specialData').html('');
}
);
} else {
$('#specialData').attr('data-visible', 'true');
$.ajax({
url: ws_url + '?m=getSpecial&site=' + site,
dataType: 'json',
success: function(result) {
data = result[0].data;
rData = '';
line = 'ui-table-rows-even';
responseData = '' +
'' +
'' +
'| ' + textContent[4] + ' | ' +
'' + textContent[3] + ' | ' +
'' + textContent[2] + ' | ' +
'' + textContent[29] + ' | ' +
'' + textContent[30] + ' | ' +
'
' +
'' +
'';
$.each(data, function(dataKey, dataVal) {
if (dataVal['ate_ertrag'] != '' && dataVal['ate_datum'] != '') {
rData += '' +
'| ' + dataVal['fullname'] + ' | ' +
'' + dataVal['wkn'] + ' | ' +
'' + dataVal['isin'] + ' | ' +
'' + dataVal['ate_ertrag'] + ' ' + textContent[14] + ' | ' +
'' + dataVal['ate_datum'] + ' | ' +
'
';
line = (line == 'ui-table-rows-even') ? 'ui-table-rows-odd' : 'ui-table-rows-even';
}
});
$('#specialData').html(responseData + rData + '
');
$('#specialData').animate({ height: $('#specialData')[0].scrollHeight }, 500 );
}
});
}
}