rapportrage dbois
This commit is contained in:
@@ -29,4 +29,11 @@ body{
|
||||
padding-left:10px !important;
|
||||
padding-right:10px !important;
|
||||
}
|
||||
.table-info > th{
|
||||
color:#fff !important;
|
||||
}
|
||||
.table-info > td{
|
||||
background-color: #c2f5ff;
|
||||
color: #000;
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
/**
|
||||
* Created by Pensare Software.
|
||||
* User: Theo Weijmer
|
||||
* Date: 14/02/2018
|
||||
* Time: 11:14
|
||||
*/
|
||||
|
||||
|
||||
dbo.reportsDataService = {
|
||||
|
||||
getUsedYears: function ( callback ) {
|
||||
$.getJSON( 'index.php/reports/reportsdefaultcontroller/getUsedYears' )
|
||||
.done( function ( data ) {
|
||||
callback( data );
|
||||
} );
|
||||
},
|
||||
|
||||
getEmployeeHours: function ( employeeID, year, callback ) {
|
||||
$.getJSON( 'index.php/reports/EmployeeHoursController/getMonthlyEmployeeHoursPerProject/' + employeeID + '/' + year )
|
||||
.done( function ( data ) {
|
||||
callback( data );
|
||||
} )
|
||||
}
|
||||
|
||||
|
||||
|
||||
// getHoursPerEmployee
|
||||
|
||||
}
|
||||
@@ -704,7 +704,7 @@ $( function () {
|
||||
totalHours += Number( p.hours() );
|
||||
}
|
||||
} );
|
||||
return totalHours;
|
||||
return totalHours.toFixed(2);
|
||||
} );
|
||||
|
||||
dbo.editProjectModal.totalRevenue = ko.pureComputed( function () {
|
||||
|
||||
@@ -17,10 +17,22 @@ dbo.monthlyemployeehoursInit = function () {
|
||||
|
||||
uniqueEmployees: ko.observableArray( [] ),
|
||||
sluggy : ko.observable( 'euro' ),
|
||||
years : ko.observableArray( [] ),
|
||||
selectedYear : ko.observable(),
|
||||
currentTab : false,
|
||||
|
||||
init: function () {
|
||||
var vm = dbo.monthlyEmployeeHoursModel;
|
||||
|
||||
dbo.reportsDataService.getUsedYears( function ( data ) {
|
||||
vm.years.removeAll();
|
||||
$.each( data, function ( i, p ) {
|
||||
vm.years.push( {id: p.year, year: p.year} );
|
||||
} );
|
||||
|
||||
vm.selectedYear( (new Date()).getFullYear() );
|
||||
} );
|
||||
|
||||
vm.initModule();
|
||||
},
|
||||
|
||||
@@ -29,18 +41,76 @@ dbo.monthlyemployeehoursInit = function () {
|
||||
dbo.userDataService.getUniqueProjectEmployees( function ( data ) {
|
||||
vm.uniqueEmployees.removeAll();
|
||||
$.each( data, function ( i, p ) {
|
||||
vm.uniqueEmployees.push(new vm.UniqueEmployee(p) )
|
||||
vm.uniqueEmployees.push( new vm.UniqueEmployee( p ) )
|
||||
} );
|
||||
} );
|
||||
},
|
||||
|
||||
refreshTab: function () {
|
||||
var vm = dbo.monthlyEmployeeHoursModel;
|
||||
|
||||
if ( vm.currentTab == false ) return;
|
||||
|
||||
console.log( vm.currentTab );
|
||||
|
||||
dbo.reportsDataService.getEmployeeHours( vm.currentTab.id, vm.selectedYear(), function ( data ) {
|
||||
vm.currentTab.myData( data );
|
||||
vm.currentTab.totalJanuari( 0 );
|
||||
vm.currentTab.totalFebruari( 0 );
|
||||
vm.currentTab.totalMaart( 0 );
|
||||
vm.currentTab.totalApril( 0 );
|
||||
vm.currentTab.totalMei( 0 );
|
||||
vm.currentTab.totalJuni( 0 );
|
||||
vm.currentTab.totalJuli( 0 );
|
||||
vm.currentTab.totalAugustus( 0 );
|
||||
vm.currentTab.totalSeptember( 0 );
|
||||
vm.currentTab.totalOktober( 0 );
|
||||
vm.currentTab.totalNovember( 0 );
|
||||
vm.currentTab.totalDecember( 0 );
|
||||
vm.currentTab.totalTotal( 0 );
|
||||
vm.currentTab.totalTotalOtheryears( 0 );
|
||||
var totalHoursChart = [];
|
||||
var projectChart = [];
|
||||
$.each( vm.currentTab.myData(), function ( i, q ) {
|
||||
vm.currentTab.tarif( q.tarif );
|
||||
vm.currentTab.totalJanuari( vm.currentTab.totalJanuari() + q.januari );
|
||||
vm.currentTab.totalFebruari( vm.currentTab.totalFebruari() + q.februari );
|
||||
vm.currentTab.totalMaart( vm.currentTab.totalMaart() + q.maart );
|
||||
vm.currentTab.totalApril( vm.currentTab.totalApril() + q.april );
|
||||
vm.currentTab.totalMei( vm.currentTab.totalMei() + q.mei );
|
||||
vm.currentTab.totalJuni( vm.currentTab.totalJuni() + q.juni );
|
||||
vm.currentTab.totalJuli( vm.currentTab.totalJuli() + q.juli );
|
||||
vm.currentTab.totalAugustus( vm.currentTab.totalAugustus() + q.augustus );
|
||||
vm.currentTab.totalSeptember( vm.currentTab.totalSeptember() + q.september );
|
||||
vm.currentTab.totalOktober( vm.currentTab.totalOktober() + q.oktober );
|
||||
vm.currentTab.totalNovember( vm.currentTab.totalNovember() + q.november );
|
||||
vm.currentTab.totalDecember( vm.currentTab.totalDecember() + q.december );
|
||||
vm.currentTab.totalTotal( vm.currentTab.totalTotal() + q.totalyear );
|
||||
vm.currentTab.totalTotalOtheryears( vm.currentTab.totalTotalOtheryears() + q.totalotheryears );
|
||||
totalHoursChart.push(q.totalhours);
|
||||
projectChart.push(q.projectname)
|
||||
} );
|
||||
var chartData = [vm.currentTab.totalJanuari(), vm.currentTab.totalFebruari(), vm.currentTab.totalMaart(), vm.currentTab.totalApril(), vm.currentTab.totalMei(), vm.currentTab.totalJuni(), vm.currentTab.totalJuli(), vm.currentTab.totalAugustus(), vm.currentTab.totalSeptember(), vm.currentTab.totalOktober(), vm.currentTab.totalNovember(), vm.currentTab.totalDecember()]
|
||||
dbo.charts.drawHoursChart( 'hours-per-month-' + vm.currentTab.slug, chartData, dbo.charts.monthLabels, 'uren per maand', '#f28f25' );
|
||||
dbo.charts.drawHoursChart( 'hours-per-project-' + vm.currentTab.slug, totalHoursChart, projectChart, 'uren per project', '#0daef0' );
|
||||
} );
|
||||
},
|
||||
|
||||
setActivetab: function ( tab ) {
|
||||
var vm = dbo.monthlyEmployeeHoursModel;
|
||||
|
||||
$.each( vm.uniqueEmployees(), function ( i, p ) {
|
||||
if ( tab == p.slug ) {
|
||||
vm.currentTab = p;
|
||||
|
||||
vm.refreshTab();
|
||||
}
|
||||
} )
|
||||
|
||||
vm.sluggy( tab );
|
||||
},
|
||||
|
||||
UniqueEmployee : function(data){
|
||||
UniqueEmployee: function ( data ) {
|
||||
var vm = dbo.monthlyEmployeeHoursModel;
|
||||
var self = this;
|
||||
|
||||
@@ -48,15 +118,28 @@ dbo.monthlyemployeehoursInit = function () {
|
||||
self.fullname = data.fullname;
|
||||
self.slug = data.slug;
|
||||
|
||||
self.myData = ko.observableArray([]);
|
||||
self.tarif = ko.observable( 0 );
|
||||
|
||||
for(var i=1; i<5; i++){
|
||||
self.myData.push( new vm.Detail(data.fullname));
|
||||
}
|
||||
self.totalJanuari = ko.observable( 0 );
|
||||
self.totalFebruari = ko.observable( 0 );
|
||||
self.totalMaart = ko.observable( 0 );
|
||||
self.totalApril = ko.observable( 0 );
|
||||
self.totalMei = ko.observable( 0 );
|
||||
self.totalJuni = ko.observable( 0 );
|
||||
self.totalJuli = ko.observable( 0 );
|
||||
self.totalAugustus = ko.observable( 0 );
|
||||
self.totalSeptember = ko.observable( 0 );
|
||||
self.totalOktober = ko.observable( 0 );
|
||||
self.totalNovember = ko.observable( 0 );
|
||||
self.totalDecember = ko.observable( 0 );
|
||||
self.totalTotal = ko.observable( 0 );
|
||||
self.totalOtheryears = ko.observable( 0 );
|
||||
self.totalTotalOtheryears = ko.observable( 0 );
|
||||
|
||||
self.myData = ko.observableArray( [] );
|
||||
},
|
||||
|
||||
Detail : function(data){
|
||||
console.log( data );
|
||||
Detail: function ( data ) {
|
||||
this.test = data;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -7,15 +7,17 @@
|
||||
|
||||
dbo.charts = {
|
||||
|
||||
drawHoursVsBudget : function(hours, budget, element){
|
||||
monthLabels : ['januari', 'februari', 'maart', 'april', 'mei', 'juni', 'juli', 'augustus', 'september', 'oktober', 'november', 'december'],
|
||||
|
||||
drawHoursVsBudget: function ( hours, budget, element ) {
|
||||
var ctx = document.getElementById( element ).getContext( '2d' );
|
||||
|
||||
var myChart = new Chart(ctx, {
|
||||
type: 'bar',
|
||||
data: {
|
||||
labels: ["uren", "budget"],
|
||||
var myChart = new Chart( ctx, {
|
||||
type : 'bar',
|
||||
data : {
|
||||
labels : ["uren", "budget"],
|
||||
datasets: [{
|
||||
data: [hours, budget],
|
||||
data : [hours, budget],
|
||||
backgroundColor: [
|
||||
'#f3a921', '#f2770c'
|
||||
]
|
||||
@@ -23,35 +25,35 @@ dbo.charts = {
|
||||
},
|
||||
options: {
|
||||
maintainAspectRatio: false,
|
||||
scales: {
|
||||
scales : {
|
||||
yAxes: [{
|
||||
ticks: {
|
||||
beginAtZero:true
|
||||
beginAtZero: true
|
||||
}
|
||||
}]
|
||||
},
|
||||
legend:{
|
||||
display : false,
|
||||
legend : {
|
||||
display: false,
|
||||
},
|
||||
title: {
|
||||
display: true,
|
||||
text: 'Uren vs budget',
|
||||
fontSize:16,
|
||||
title : {
|
||||
display : true,
|
||||
text : 'Uren vs budget',
|
||||
fontSize : 16,
|
||||
fontColor: '#b2b2b2'
|
||||
}
|
||||
}
|
||||
});
|
||||
} );
|
||||
},
|
||||
|
||||
drawInvoicesVsPayed : function(offer, invoice, payed, element){
|
||||
drawInvoicesVsPayed: function ( offer, invoice, payed, element ) {
|
||||
var ctx = document.getElementById( element ).getContext( '2d' );
|
||||
|
||||
var myChart = new Chart(ctx, {
|
||||
type: 'bar',
|
||||
data: {
|
||||
labels: ["offerte", "facturen", "betaald"],
|
||||
var myChart = new Chart( ctx, {
|
||||
type : 'bar',
|
||||
data : {
|
||||
labels : ["offerte", "facturen", "betaald"],
|
||||
datasets: [{
|
||||
data: [offer, invoice, payed],
|
||||
data : [offer, invoice, payed],
|
||||
backgroundColor: [
|
||||
'#f3a921', '#f2770c', '#72221a'
|
||||
]
|
||||
@@ -59,23 +61,61 @@ dbo.charts = {
|
||||
},
|
||||
options: {
|
||||
maintainAspectRatio: false,
|
||||
scales: {
|
||||
scales : {
|
||||
yAxes: [{
|
||||
ticks: {
|
||||
beginAtZero:true
|
||||
beginAtZero: true
|
||||
}
|
||||
}]
|
||||
},
|
||||
legend:{
|
||||
display : false,
|
||||
legend : {
|
||||
display: false,
|
||||
},
|
||||
title: {
|
||||
display: true,
|
||||
text: 'offerte vs facuren vs betalingen',
|
||||
fontSize:16,
|
||||
title : {
|
||||
display : true,
|
||||
text : 'offerte vs facuren vs betalingen',
|
||||
fontSize : 16,
|
||||
fontColor: '#b2b2b2'
|
||||
}
|
||||
}
|
||||
});
|
||||
} );
|
||||
},
|
||||
|
||||
drawHoursChart: function (element, chartData, labels, title, colors) {
|
||||
console.log( chartData );
|
||||
var ctx = document.getElementById( element ).getContext( '2d' );
|
||||
|
||||
var myChart = new Chart( ctx, {
|
||||
type : 'bar',
|
||||
data : {
|
||||
labels : labels,
|
||||
datasets: [{
|
||||
data : chartData,
|
||||
backgroundColor: colors,
|
||||
}]
|
||||
},
|
||||
options: {
|
||||
maintainAspectRatio: false,
|
||||
scales : {
|
||||
yAxes: [{
|
||||
ticks: {
|
||||
beginAtZero: true
|
||||
}
|
||||
}]
|
||||
},
|
||||
legend : {
|
||||
display: false,
|
||||
fontColor: '#ffffff',
|
||||
},
|
||||
title : {
|
||||
display : true,
|
||||
text : title,
|
||||
fontSize : 16,
|
||||
fontColor: '#ffffff'
|
||||
}
|
||||
}
|
||||
|
||||
} );
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user