/C_ARDAYSSALESOUTSTDGOVW(P_DisplayCurrency=%27EUR%27)/Results?sap-client=100&$skip=0&$top=1&$select=DaysSalesOutstanding%2cDaysSalesOutstanding_E
/C_ARDAYSSALESOUTSTDGOVW(P_DisplayCurrency=%27EUR%27)/Results?sap-client=100&$skip=0&$top=12&$orderby=EvaluationTimeFrameInMonths%20desc&$select=EvaluationTimeFrameInMonths%2cCalendarMonthName%2cDaysSalesOutstanding%2cDaysSalesOutstanding_F%2cDaysSalesOutstanding_E%2cBestPossibleDaysSalesOutstndng%2cBestPossibleDaysSalesOutstndng_F%2cBestPossibleDaysSalesOutstndng_E
<div id="mySimpleTemplate" data-type="text/x-handlebars-template">
<div class="charts-card-template">
<div class="header" style="padding-left: 16px">
<div style="height: 30px text-align: left;">
<span style="font-weight: bold; font-size: 24px; float: left; display: inline; padding-top: 16px">
Days Sales Outstanding
</span>
</div>
<div style="text-align: left;">
<span style=" font-size: 14px; clear: left; float: left; display: inline; padding-top: 4px">
by month, one year
</span>
</div>
</div>
<div id="user-registrations-chart" style="padding-top: 100px">
</div>
<script type="text/javascript">
var oData = sap.deck.renderers.context.currentlyRendering.renderer.model.oData;
//var statistics = oData.Statistics;
var statistics = oData.dataSets[0].data.d.results;
var data = [];
// Removed code from the template
/* for (var i = 0; i < statistics.length; i++) {
for (var j = 0; j < statistics[i].connectionList.length; j++) {
if (data.find(function(elem) {
return elem.key === statistics[i].connectionList[j].key;
})) {
data[j].value += statistics[i].connectionList[j].value;
} else {
data.push({
key: statistics[i].connectionList[j].key,
value: statistics[i].connectionList[j].value
});
}
} */
// End of removed code
// Inserted new code
for (var i = 0; i < statistics.length; i++) {
data.push({
key: statistics[i].CalendarMonthName,
value: statistics[i].DaysSalesOutstanding
});
}
var arrayOfZeroValues = data.filter(function(item) {
return item.value === 0;
});
// End of inserted code
if (arrayOfZeroValues.length === data.length) {
var chart = document.getElementById("user-registrations-chart");
chart.style.fontSize = "20px";
chart.style.textAlign = "center";
chart.innerHTML = "No Data";
} else {
var margin = {
top: 20,
right: 20,
bottom: 70,
left: 65
},
width = 330 - margin.left - margin.right,
height = 350 - margin.top - margin.bottom;
var values = data.map(function(d) {
return d.value;
});
var keys = data.map(function(d) {
return d.key;
});
var x = d3.scale.ordinal().rangeRoundBands([0, width], .1).domain(keys);
var y = d3.scale.linear().range([height, 0]).domain([0, d3.max(values)]);
var xAxis = d3.svg.axis().scale(x).orient("bottom");
var yAxis = d3.svg.axis().scale(y).orient("left");
var svg = d3.select("#user-registrations-chart").append("svg").attr("width", width + margin.left + margin.right).attr("height", height + margin.top + margin.bottom).append("g").attr("transform", "translate(" + margin.left + "," + margin.top + ")");
svg.append("g").attr("class", "x axis").attr("transform", "translate(0," + height + ")").call(xAxis).append("text").attr("dy", "+4em").attr("dx", "+8.5em").style("text-anchor", "middle").text("Months").style("font-size", "15px").style("font-weight", "bold");
svg.append("g").attr("class", "y axis").call(yAxis).append("text").attr("transform", "translate(-20,40) rotate(-90)").attr("y", 0).attr("dy", "-2.3em").attr("dx", "-2.5em").style("text-anchor", "end").text("Days").style("font-size", "15px").style("font-weight", "bold");
var bars = svg.selectAll("rect").data(data).enter().append("rect").attr("x", function(d) {
return x(d.key) + 5;
}).attr("y", function(d) {
return y(d.value);
}).attr("width", function(d) {
return x.rangeBand() - 10;
}).attr("height", function(d) {
return height - y(d.value) - 0.5;
}).style("fill", "#B1E0FD");
}
svg.selectAll('g.x.axis g text').each(function (d) {
var el = d3.select(this);
var splitText= d.split('/').reverse();
el.text('');
for (var i = 0; i < splitText.length; i++) {
var tspan = el.append('tspan').text(splitText[i]);
if (i > 0) {
tspan.attr('x', 0).attr('dy', '15');
}
}
});
</script>
</div>
</div>
<div id="mySimpleTemplate" data-type="text/x-handlebars-template">
<div class="charts-card-template">
<div >
<span style="font-weight: bold; font-size: 24px; float: left; display: inline; padding:16px">
Days Sales Outstanding
</span>
</div>
<div style="clear:both;">
</div>
<hr>
<div>
<span style="float:left;margin-left:16px;margin-top:10px;padding-bottom:10px">
This card shows the total days sales outstanding by month for the last 12 months
</span>
</div>
<div style="clear:both;">
</div>
<hr>
<div >
<span id="dso-kpi" style="float:left;margin-left:16px;margin-top:10px;">
</span>
</div>
<div style="clear:both;">
</div>
<div >
<span id="dso-unit" style="float:left;margin-left:16px;margin-top:0px;">
Average DSO
</span>
</div>
<script type="text/javascript">
var oData = sap.deck.renderers.context.currentlyRendering.renderer.model.oData;
var dsokpi = document.getElementById("dso-kpi");
var dsokpivalue = document.createElement('span');
dsokpivalue.innerHTML = oData.dataSets[1].data.d.results[0].DaysSalesOutstanding;
dsokpi.appendChild(dsokpivalue);
</script>
</div>
</div>
html, body{
height: 100vh;
font-family: Helvetica;
}
.charts-card-template{
background: linear-gradient(to bottom right,#589CCE,#226596);
color: #FFF;
width: 100%;
height: 100vh;
display: block;
margin: auto;
}
.header {
background-color: solid #CEDDEC;
height: 40px;
padding-left: 16px;
border-bottom: 0,5px solid #CEDDEC;
}
hr{
margin: 0;
}
#card-info{
font-size: 15px;
padding: 10px 15px;
}
#no-data{
font-size: 20px;
text-align:center;
}
svg{
display: block;
margin: auto;
}
.axis text {
font-size:12px;
stroke: #CEDDEC;
fill: #fff;
shape-rendering: crispEdges;
stroke-width: 0;
}
.axis path, .axis line {
fill: none;
stroke: #CEDDEC;
shape-rendering: crispEdges;
}
.x.axis .tick text {
transform: rotate(-45deg) translate(-18px,5px);
}
/* new entries */
#dso-kpi{
font-family:72,72full,Arial,Helvetica,sans-serif;
font-weight: 400;
font-size: 40px;
background-color: none;
}
#dso-unit{
font-weight: 400;
font-size: 12px;
background-color: none;
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
23 | |
13 | |
11 | |
10 | |
9 | |
8 | |
7 | |
7 | |
6 | |
6 |