Diversen nav opmerkingen
This commit is contained in:
@@ -19,6 +19,10 @@ dbo.vatDataService = {
|
||||
.done( function () {
|
||||
callback();
|
||||
} );
|
||||
},
|
||||
|
||||
saveVat: function ( vatID, vatrate ) {
|
||||
$.post( 'index.php/beheer/vatController/saveVat/' + vatID, {vatrate: vatrate} );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -34,6 +34,7 @@ $( function () {
|
||||
archive : ko.observable( false ),
|
||||
startdate : ko.observable( null ),
|
||||
enddate : ko.observable( null ),
|
||||
vat_id : ko.observable(),
|
||||
projectname : ko.observable(),
|
||||
busy : false,
|
||||
ownRevenue : ko.observable(),
|
||||
@@ -58,6 +59,10 @@ $( function () {
|
||||
init: function () {
|
||||
var vm = dbo.editProjectModal;
|
||||
|
||||
vm.busy = true;
|
||||
|
||||
$( "#project-scroller" ).height( $( window ).height() - 100 );
|
||||
|
||||
dbo.customerDataService.getAllCustomers( 'F', function ( data ) {
|
||||
vm.customers( data );
|
||||
dbo.userDataService.getAllUsers( 'F', function ( data ) {
|
||||
@@ -71,6 +76,8 @@ $( function () {
|
||||
vm.refreshProject();
|
||||
|
||||
vm.activeTab( 'DASHBOARD' );
|
||||
|
||||
vm.busy = false;
|
||||
} );
|
||||
} );
|
||||
} );
|
||||
@@ -287,6 +294,7 @@ $( function () {
|
||||
vm.callback = callback;
|
||||
|
||||
dbo.projectDataService.addProject( function ( data ) {
|
||||
console.log( data );
|
||||
vm.projectID = data;
|
||||
|
||||
vm.showProject( true );
|
||||
@@ -365,11 +373,13 @@ $( function () {
|
||||
projectleader_id: vm.projectleaderID(),
|
||||
projectname : vm.projectname(),
|
||||
startdate : vm.startdate(),
|
||||
enddate : vm.enddate()
|
||||
enddate : vm.enddate(),
|
||||
vat_id : vm.vat_id()
|
||||
}
|
||||
|
||||
dbo.projectDataService.saveProject( vm.projectID, submitDATA, function ( data ) {
|
||||
vm.projectID = data;
|
||||
vm.refreshProject();
|
||||
// vm.projectID = data.projectID;
|
||||
} );
|
||||
},
|
||||
|
||||
@@ -725,7 +735,7 @@ $( function () {
|
||||
vm.busy = true;
|
||||
|
||||
dbo.projectDataService.getProject( vm.projectID, function ( data ) {
|
||||
var totalRevenuesIncl = Math.round( (data.invoiceDetails.totalrevenue * (data.vatrate + 100)) / 100 );
|
||||
var totalRevenuesIncl = Math.round( (data.invoiceDetails.totalrevenue * (Number( data.vat.vatrate ) + 100)) / 100 );
|
||||
|
||||
vm.id = data.id
|
||||
vm.projectleaderID( data.projectleader_id );
|
||||
@@ -734,13 +744,14 @@ $( function () {
|
||||
vm.enddate( dbo.helpers.mysql2date( data.enddate ) );
|
||||
vm.projectnumber( data.projectnumber );
|
||||
vm.projectname( data.projectname );
|
||||
vm.vat_id( data.vat_id );
|
||||
vm.totalRevenues( dbo.helpers.numberWithPoints( Math.round( Number( data.invoiceDetails.totalrevenue ) ) ) );
|
||||
vm.totalRevenuesIncl( dbo.helpers.numberWithPoints( totalRevenuesIncl ));
|
||||
vm.totalRevenuesIncl( dbo.helpers.numberWithPoints( totalRevenuesIncl ) );
|
||||
vm.totalInvoiced( dbo.helpers.numberWithPoints( Math.round( Number( data.invoiceDetails.totalinvoiced ) ) ) );
|
||||
vm.outstanding( dbo.helpers.numberWithPoints( Math.round( Number( totalRevenuesIncl ) ) - Math.round( Number( data.invoiceDetails.totalinvoiced ) ) ) );
|
||||
vm.outstandingInvoices( dbo.helpers.numberWithPoints( Math.round( Number( data.invoiceDetails.totalinvoiced ) ) - Math.round( Number( data.invoiceDetails.payed ) ) ) );
|
||||
vm.payed( dbo.helpers.numberWithPoints( Math.round( Number( data.invoiceDetails.payed ) ) ) );
|
||||
vm.toInvoice = Math.round( totalRevenuesIncl - Number( data.invoiceDetails.totalinvoiced ) );
|
||||
vm.toInvoice = Math.round( totalRevenuesIncl - Number( data.invoiceDetails.totalinvoiced ) );
|
||||
|
||||
vm.projectEmployees.removeAll();
|
||||
vm.projecthours.removeAll();
|
||||
@@ -798,10 +809,10 @@ $( function () {
|
||||
toForecasting: function () {
|
||||
var vm = dbo.editProjectModal;
|
||||
|
||||
vm.totalForecast(0);
|
||||
vm.totalForecast( 0 );
|
||||
vm.toForecast( vm.toInvoice );
|
||||
_.each( vm.forecasts(), function ( p ) {
|
||||
vm.totalForecast( vm.totalForecast() + Number( p.forecastamount() ));
|
||||
vm.totalForecast( vm.totalForecast() + Number( p.forecastamount() ) );
|
||||
vm.toForecast( vm.toForecast() - Number( p.forecastamount() ) );
|
||||
} );
|
||||
vm.toForecast( dbo.helpers.numberWithPoints( Number( vm.toForecast() ) ) );
|
||||
@@ -978,7 +989,7 @@ $( function () {
|
||||
|
||||
refreshDocuments: function () {
|
||||
var vm = dbo.editProjectModal;
|
||||
|
||||
console.log( vm.projectID );
|
||||
dbo.documentsDataService.getdocuments( vm.projectID, function ( data ) {
|
||||
vm.documents.removeAll();
|
||||
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
|
||||
|
||||
dbo.vatInit = function () {
|
||||
var timeout;
|
||||
|
||||
if ( dbo.vatModel !== undefined ) {
|
||||
|
||||
@@ -35,7 +36,7 @@ dbo.vatInit = function () {
|
||||
vm.vats.removeAll();
|
||||
|
||||
_.each( data, function ( p ) {
|
||||
vm.vats( new vm.Vat( p ) );
|
||||
vm.vats.push( new vm.Vat( p ) );
|
||||
} )
|
||||
} );
|
||||
},
|
||||
@@ -44,13 +45,26 @@ dbo.vatInit = function () {
|
||||
this.inEdit( !this.inEdit() );
|
||||
},
|
||||
|
||||
validateNumber: function ( field ) {
|
||||
var self = this;
|
||||
|
||||
self[field]( dbo.helpers.validateNumber( self[field](), true ) );
|
||||
if ( timeout ) {
|
||||
clearTimeout( timeout );
|
||||
timeout = null;
|
||||
}
|
||||
timeout = setTimeout( function () {
|
||||
dbo.vatDataService.saveVat( self.id, self.vatrate() );
|
||||
}, 700 );
|
||||
},
|
||||
|
||||
Vat: function ( data, inEdit = false ) {
|
||||
this.id = data.id;
|
||||
this.vatrate = ko.observable( data.vatrate );
|
||||
this.vatrate = ko.observable( data.vatrate || 0 );
|
||||
this.inEdit = ko.observable( inEdit );
|
||||
},
|
||||
|
||||
removeVat : function(){
|
||||
removeVat: function () {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -96,17 +96,14 @@ dbo.reservationsInit = function () {
|
||||
self.payed = dbo.helpers.numberWithPoints( data.payed );
|
||||
self.saldo = dbo.helpers.numberWithPoints( data.saldo );
|
||||
self.saldoToPay = dbo.helpers.numberWithPoints( data.saldoToPay );
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
dbo.reservationsModel.init();
|
||||
|
||||
ko.applyBindings( dbo.reservationsModel, document.getElementById( "RESERVATIONS" ) );
|
||||
}
|
||||
|
||||
dbo.reservationsModel.init();
|
||||
|
||||
ko.applyBindings(
|
||||
dbo.reservationsModel, document.getElementById( "RESERVATIONS" ) );
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user