Diversen nav opmerkingen
This commit is contained in:
@@ -31,11 +31,17 @@ class vatController extends MY_Controller {
|
|||||||
{
|
{
|
||||||
$vats = Vat::getVats( $archive );
|
$vats = Vat::getVats( $archive );
|
||||||
|
|
||||||
$this->json($vats);
|
$this->json( $vats );
|
||||||
}
|
}
|
||||||
|
|
||||||
public function addVat()
|
public function addVat()
|
||||||
{
|
{
|
||||||
Vat::create([]);
|
Vat::create( [] );
|
||||||
|
}
|
||||||
|
|
||||||
|
public function saveVat( $vatID )
|
||||||
|
{
|
||||||
|
$vatrate = $this->input->post( 'vatrate' );
|
||||||
|
Vat::whereId( $vatID )->update( ['vatrate' => $vatrate] );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -41,8 +41,6 @@ class ProjectsController extends MY_Controller {
|
|||||||
$project->invoiceDetails =
|
$project->invoiceDetails =
|
||||||
$this->Invoices_model->getOutstandingPerProject( $project->id );
|
$this->Invoices_model->getOutstandingPerProject( $project->id );
|
||||||
|
|
||||||
$project->vatrate = Vat::getCurrentVat();
|
|
||||||
|
|
||||||
$this->json( $project );
|
$this->json( $project );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ class FileUpload extends MY_Controller {
|
|||||||
$this->load->library( $libraries );
|
$this->load->library( $libraries );
|
||||||
}
|
}
|
||||||
|
|
||||||
public function upload( $foreignID, $tablename )
|
public function upload( $foreignID )
|
||||||
{
|
{
|
||||||
$config['upload_path'] = MYROOTPATH . 'documents/temp';
|
$config['upload_path'] = MYROOTPATH . 'documents/temp';
|
||||||
$config['allowed_types'] = '*';
|
$config['allowed_types'] = '*';
|
||||||
@@ -43,7 +43,7 @@ class FileUpload extends MY_Controller {
|
|||||||
|
|
||||||
$this->setStoragename();
|
$this->setStoragename();
|
||||||
|
|
||||||
$this->persistDocument( $data['upload_data'], $foreignID, $tablename );
|
$this->persistDocument( $data['upload_data'], $foreignID );
|
||||||
|
|
||||||
$this->renameDocument( $data['upload_data']['full_path'] );
|
$this->renameDocument( $data['upload_data']['full_path'] );
|
||||||
}
|
}
|
||||||
@@ -55,15 +55,14 @@ class FileUpload extends MY_Controller {
|
|||||||
$this->storagename = sha1( random_string( 'alnum', 16 ) );
|
$this->storagename = sha1( random_string( 'alnum', 16 ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
private function persistDocument( $data, $foreignID, $tablename )
|
private function persistDocument( $data, $foreignID )
|
||||||
{
|
{
|
||||||
$file = [
|
$file = [
|
||||||
'storagename' => $this->storagename,
|
'storagename' => $this->storagename,
|
||||||
'originalname' => $data['file_name'],
|
'originalname' => $data['file_name'],
|
||||||
'user_id' => USERID,
|
'user_id' => USERID,
|
||||||
'uploaddate' => date( 'Y-m-d H:i:s' ),
|
'uploaddate' => date( 'Y-m-d H:i:s' ),
|
||||||
'foreign_id' => $foreignID,
|
'foreign_id' => $foreignID
|
||||||
'foreign_table' => $tablename
|
|
||||||
];
|
];
|
||||||
|
|
||||||
Document::create( $file );
|
Document::create( $file );
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ class MY_Controller extends CI_Controller {
|
|||||||
{
|
{
|
||||||
parent::__construct();
|
parent::__construct();
|
||||||
|
|
||||||
$this->version = '0.10.AA';
|
$this->version = '0.02.00';
|
||||||
|
|
||||||
$this->load->library( 'beheer/session/RetrieveUserSession' );
|
$this->load->library( 'beheer/session/RetrieveUserSession' );
|
||||||
|
|
||||||
|
|||||||
@@ -41,6 +41,11 @@ class Project extends BaseModel {
|
|||||||
return $this->hasMany( 'Reservation' );
|
return $this->hasMany( 'Reservation' );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function vat()
|
||||||
|
{
|
||||||
|
return $this->belongsTo('Vat');
|
||||||
|
}
|
||||||
|
|
||||||
public function projectleader()
|
public function projectleader()
|
||||||
{
|
{
|
||||||
return $this->belongsTo( 'User', 'projectleader_id' );
|
return $this->belongsTo( 'User', 'projectleader_id' );
|
||||||
@@ -112,6 +117,7 @@ class Project extends BaseModel {
|
|||||||
->with( 'projectcosts.external' )
|
->with( 'projectcosts.external' )
|
||||||
->with( 'invoices.payments' )
|
->with( 'invoices.payments' )
|
||||||
->with( 'invoices.vat' )
|
->with( 'invoices.vat' )
|
||||||
|
->with( 'vat' )
|
||||||
->with( 'customer' );
|
->with( 'customer' );
|
||||||
|
|
||||||
return $project;
|
return $project;
|
||||||
|
|||||||
@@ -14,7 +14,12 @@ class ReservationTotals {
|
|||||||
$sql = "SELECT Q5.project_id AS projectID, external_id AS externalID,
|
$sql = "SELECT Q5.project_id AS projectID, external_id AS externalID,
|
||||||
costs, reservation, payed, (reservation - payed) AS saldo,
|
costs, reservation, payed, (reservation - payed) AS saldo,
|
||||||
(costs - payed) AS saldoToPay, PRJ.projectnumber, EXT.contactperson,
|
(costs - payed) AS saldoToPay, PRJ.projectnumber, EXT.contactperson,
|
||||||
ROUND(( (other_revenue * (100 + (SELECT vatrate from vats where active='T' LIMIT 1))) / 100 ), 0) other_revenue
|
ROUND(( (other_revenue * (100 + (
|
||||||
|
SELECT vatrate
|
||||||
|
FROM vats VTS
|
||||||
|
JOIN projects P
|
||||||
|
ON VTS.id = P.vat_id
|
||||||
|
WHERE P.id = PRJ.id LIMIT 1))) / 100 ), 0) other_revenue
|
||||||
FROM (
|
FROM (
|
||||||
SELECT COALESCE(reservation, 0) AS reservation, costs, payed, Q2.external_id, Q2.project_id
|
SELECT COALESCE(reservation, 0) AS reservation, costs, payed, Q2.external_id, Q2.project_id
|
||||||
FROM (
|
FROM (
|
||||||
|
|||||||
@@ -75,6 +75,17 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="divider"></div>
|
<div class="divider"></div>
|
||||||
|
<label class="col-md-4 col-form-label">BTW percentage</label>
|
||||||
|
<div class="col-md-3">
|
||||||
|
<select class="form-control form-control-sm"
|
||||||
|
data-bind="options:vats,
|
||||||
|
optionsText:'vatrate',
|
||||||
|
optionsValue:'id',
|
||||||
|
value:vat_id,
|
||||||
|
event:{change:$root.saveProject},
|
||||||
|
optionsCaption:'selecteer btw ...'"></select>
|
||||||
|
</div>
|
||||||
|
<div class="divider"></div>
|
||||||
<label class="col-md-4 col-form-label">te besteden uren</label>
|
<label class="col-md-4 col-form-label">te besteden uren</label>
|
||||||
<div class="col-md-8">
|
<div class="col-md-8">
|
||||||
<h4><span data-bind="text:(totalBudget() - totalHours())"></span></h4>
|
<h4><span data-bind="text:(totalBudget() - totalHours())"></span></h4>
|
||||||
|
|||||||
@@ -7,16 +7,16 @@
|
|||||||
<div class="panel-body panel-body-project">
|
<div class="panel-body panel-body-project">
|
||||||
<table class="table table-sm">
|
<table class="table table-sm">
|
||||||
<thead>
|
<thead>
|
||||||
<th class="table-cyanish-header">
|
<th class="table-cyanish-header" width="40%">
|
||||||
naam
|
naam
|
||||||
</th>
|
</th>
|
||||||
<th class="table-cyanish-header align-right">
|
<th class="table-cyanish-header align-right" width="20%">
|
||||||
tarief
|
tarief
|
||||||
</th>
|
</th>
|
||||||
<th class="table-cyanish-header align-right">
|
<th class="table-cyanish-header align-right" width="25%">
|
||||||
budget
|
budget
|
||||||
</th>
|
</th>
|
||||||
<th class="table-cyanish-header" width="40px">
|
<th class="table-cyanish-header" width="15%">
|
||||||
|
|
||||||
</th>
|
</th>
|
||||||
</thead>
|
</thead>
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
<div class="col-md-6">
|
<div class="col-md-8">
|
||||||
<table class="table table-condensed">
|
<table class="table table-condensed">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
@@ -8,8 +8,8 @@
|
|||||||
<th> </th>
|
<th> </th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody data-bind="foreach:documents">
|
||||||
<tr data-bind="foreach:documents">
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
<span data-bind="text:fullname"></span>
|
<span data-bind="text:fullname"></span>
|
||||||
</td>
|
</td>
|
||||||
@@ -25,6 +25,7 @@
|
|||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
|
<tfoot>
|
||||||
<tr></tr>
|
<tr></tr>
|
||||||
</tfoot>
|
</tfoot>
|
||||||
</table>
|
</table>
|
||||||
@@ -32,19 +33,5 @@
|
|||||||
<button class="upload-btn">voeg bestand toe</button>
|
<button class="upload-btn">voeg bestand toe</button>
|
||||||
<input type="file" name="userfile" data-bind="event:{change:addDocument}" id="fileinput"/>
|
<input type="file" name="userfile" data-bind="event:{change:addDocument}" id="fileinput"/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
|
||||||
<div class="col-md-6">
|
|
||||||
<hr/>
|
<hr/>
|
||||||
<!-- <button data-bind="click:addComment" class="upload-btn">-->
|
|
||||||
<!-- voeg commentaar toe-->
|
|
||||||
<!-- </button>-->
|
|
||||||
<!-- ko foreach: comments -->
|
|
||||||
<div data-bind="click:$root.editComment" class="pointer">
|
|
||||||
<span class="badge badge-info" style="width:100%; text-align:left;">
|
|
||||||
<span data-bind="text:fullname"></span> |
|
|
||||||
<span data-bind="text:comment_date"></span>
|
|
||||||
</span>
|
|
||||||
</div>
|
|
||||||
<div data-bind="html:comment,click:$root.editComment" class="comment-text pointer"></div>
|
|
||||||
<!-- /ko -->
|
|
||||||
</div>
|
</div>
|
||||||
@@ -45,39 +45,36 @@
|
|||||||
sluit
|
sluit
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
<div class="tab-pane animation-slide-top"
|
<div id="project-scroller">
|
||||||
id="dashboard"
|
<div class="tab-pane animation-slide-top"
|
||||||
data-bind="visible:activeTab()=='DASHBOARD'">
|
id="dashboard"
|
||||||
<?php $this->load->view( 'modals/partials/_dashboard' ); ?>
|
data-bind="visible:activeTab()=='DASHBOARD'">
|
||||||
</div>
|
<?php $this->load->view( 'modals/partials/_dashboard' ); ?>
|
||||||
<div class="tab-pane animation-slide-top"
|
</div>
|
||||||
id="financial"
|
<div class="tab-pane animation-slide-top"
|
||||||
data-bind="visible:activeTab()=='FINANCIAL'">
|
id="financial"
|
||||||
<?php $this->load->view( 'modals/partials/_financials' ); ?>
|
data-bind="visible:activeTab()=='FINANCIAL'">
|
||||||
</div>
|
<?php $this->load->view( 'modals/partials/_financials' ); ?>
|
||||||
<div class="tab-pane animation-slide-top"
|
</div>
|
||||||
id="employees"
|
<div class="tab-pane animation-slide-top"
|
||||||
data-bind="visible:activeTab()=='EMPLOYEES'">
|
id="employees"
|
||||||
<div class="row" data-bind="fadeVisible:customerID()">
|
data-bind="visible:activeTab()=='EMPLOYEES'">
|
||||||
<div class="col-md-5" data-bind="fadeVisible:customerID()">
|
<div class="row" data-bind="fadeVisible:customerID()">
|
||||||
<?php $this->load->view( 'modals/partials/_projectemployees' ); ?>
|
<div class="col-md-5" data-bind="fadeVisible:customerID()">
|
||||||
</div>
|
<?php $this->load->view( 'modals/partials/_projectemployees' ); ?>
|
||||||
<div class="col-md-7">
|
</div>
|
||||||
<?php $this->load->view( 'modals/partials/_hours' ); ?>
|
<div class="col-md-7">
|
||||||
|
<?php $this->load->view( 'modals/partials/_hours' ); ?>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="tab-pane animation-slide-top"
|
<div class="tab-pane animation-slide-top"
|
||||||
id="files"
|
id="files"
|
||||||
data-bind="visible:activeTab()=='FILES'">
|
data-bind="visible:activeTab()=='FILES'">
|
||||||
<div class="row" data-bind="fadeVisible:customerID()">
|
<div class="row" data-bind="fadeVisible:customerID()">
|
||||||
<div class="col-md-4">
|
|
||||||
<?php $this->load->view( 'modals/partials/_projectfiles' ); ?>
|
<?php $this->load->view( 'modals/partials/_projectfiles' ); ?>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-4">
|
|
||||||
<?php $this->load->view( 'modals/partials/_projectcomments' ); ?>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<div class="VAT">
|
<div class="VAT">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-md-4">
|
<div class="col-md-2">
|
||||||
<table class="table table-condensed">
|
<table class="table table-condensed">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
@@ -11,10 +11,15 @@
|
|||||||
<tbody data-bind="foreach:vats">
|
<tbody data-bind="foreach:vats">
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
<input type="text" data-bind="text:vatrate" />
|
<div class="percentage-sign-holder">
|
||||||
|
<input type="text"
|
||||||
|
class="form-control percentage-input"
|
||||||
|
data-bind="textInput:vatrate,
|
||||||
|
event:{keyup:$root.validateNumber.bind($data, 'vatrate')}">
|
||||||
|
<span class="percentage-sign">%</span>
|
||||||
|
</div>
|
||||||
</td>
|
</td>
|
||||||
<td width="60px">
|
<td width="60px">
|
||||||
<i class="icon fa-sellsy"></i>
|
|
||||||
<i class="icon fa-edit" data-bind="click:$root.toggleEdit"></i>
|
<i class="icon fa-edit" data-bind="click:$root.toggleEdit"></i>
|
||||||
<i class="icon fa-trash redish" data-bind="$root.removeVat"></i>
|
<i class="icon fa-trash redish" data-bind="$root.removeVat"></i>
|
||||||
</td>
|
</td>
|
||||||
|
|||||||
+5
-1
@@ -215,7 +215,7 @@ th.focus-green{
|
|||||||
}
|
}
|
||||||
.percentage-sign {
|
.percentage-sign {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
right: 15px;
|
right: 12px;
|
||||||
z-index: 10;
|
z-index: 10;
|
||||||
top: 7px;
|
top: 7px;
|
||||||
}
|
}
|
||||||
@@ -382,3 +382,7 @@ th.focus-green{
|
|||||||
color: red;
|
color: red;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#project-scroller {
|
||||||
|
overflow: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -19,6 +19,10 @@ dbo.vatDataService = {
|
|||||||
.done( function () {
|
.done( function () {
|
||||||
callback();
|
callback();
|
||||||
} );
|
} );
|
||||||
|
},
|
||||||
|
|
||||||
|
saveVat: function ( vatID, vatrate ) {
|
||||||
|
$.post( 'index.php/beheer/vatController/saveVat/' + vatID, {vatrate: vatrate} );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -34,6 +34,7 @@ $( function () {
|
|||||||
archive : ko.observable( false ),
|
archive : ko.observable( false ),
|
||||||
startdate : ko.observable( null ),
|
startdate : ko.observable( null ),
|
||||||
enddate : ko.observable( null ),
|
enddate : ko.observable( null ),
|
||||||
|
vat_id : ko.observable(),
|
||||||
projectname : ko.observable(),
|
projectname : ko.observable(),
|
||||||
busy : false,
|
busy : false,
|
||||||
ownRevenue : ko.observable(),
|
ownRevenue : ko.observable(),
|
||||||
@@ -58,6 +59,10 @@ $( function () {
|
|||||||
init: function () {
|
init: function () {
|
||||||
var vm = dbo.editProjectModal;
|
var vm = dbo.editProjectModal;
|
||||||
|
|
||||||
|
vm.busy = true;
|
||||||
|
|
||||||
|
$( "#project-scroller" ).height( $( window ).height() - 100 );
|
||||||
|
|
||||||
dbo.customerDataService.getAllCustomers( 'F', function ( data ) {
|
dbo.customerDataService.getAllCustomers( 'F', function ( data ) {
|
||||||
vm.customers( data );
|
vm.customers( data );
|
||||||
dbo.userDataService.getAllUsers( 'F', function ( data ) {
|
dbo.userDataService.getAllUsers( 'F', function ( data ) {
|
||||||
@@ -71,6 +76,8 @@ $( function () {
|
|||||||
vm.refreshProject();
|
vm.refreshProject();
|
||||||
|
|
||||||
vm.activeTab( 'DASHBOARD' );
|
vm.activeTab( 'DASHBOARD' );
|
||||||
|
|
||||||
|
vm.busy = false;
|
||||||
} );
|
} );
|
||||||
} );
|
} );
|
||||||
} );
|
} );
|
||||||
@@ -287,6 +294,7 @@ $( function () {
|
|||||||
vm.callback = callback;
|
vm.callback = callback;
|
||||||
|
|
||||||
dbo.projectDataService.addProject( function ( data ) {
|
dbo.projectDataService.addProject( function ( data ) {
|
||||||
|
console.log( data );
|
||||||
vm.projectID = data;
|
vm.projectID = data;
|
||||||
|
|
||||||
vm.showProject( true );
|
vm.showProject( true );
|
||||||
@@ -365,11 +373,13 @@ $( function () {
|
|||||||
projectleader_id: vm.projectleaderID(),
|
projectleader_id: vm.projectleaderID(),
|
||||||
projectname : vm.projectname(),
|
projectname : vm.projectname(),
|
||||||
startdate : vm.startdate(),
|
startdate : vm.startdate(),
|
||||||
enddate : vm.enddate()
|
enddate : vm.enddate(),
|
||||||
|
vat_id : vm.vat_id()
|
||||||
}
|
}
|
||||||
|
|
||||||
dbo.projectDataService.saveProject( vm.projectID, submitDATA, function ( data ) {
|
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;
|
vm.busy = true;
|
||||||
|
|
||||||
dbo.projectDataService.getProject( vm.projectID, function ( data ) {
|
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.id = data.id
|
||||||
vm.projectleaderID( data.projectleader_id );
|
vm.projectleaderID( data.projectleader_id );
|
||||||
@@ -734,13 +744,14 @@ $( function () {
|
|||||||
vm.enddate( dbo.helpers.mysql2date( data.enddate ) );
|
vm.enddate( dbo.helpers.mysql2date( data.enddate ) );
|
||||||
vm.projectnumber( data.projectnumber );
|
vm.projectnumber( data.projectnumber );
|
||||||
vm.projectname( data.projectname );
|
vm.projectname( data.projectname );
|
||||||
|
vm.vat_id( data.vat_id );
|
||||||
vm.totalRevenues( dbo.helpers.numberWithPoints( Math.round( Number( data.invoiceDetails.totalrevenue ) ) ) );
|
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.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.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.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.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.projectEmployees.removeAll();
|
||||||
vm.projecthours.removeAll();
|
vm.projecthours.removeAll();
|
||||||
@@ -798,10 +809,10 @@ $( function () {
|
|||||||
toForecasting: function () {
|
toForecasting: function () {
|
||||||
var vm = dbo.editProjectModal;
|
var vm = dbo.editProjectModal;
|
||||||
|
|
||||||
vm.totalForecast(0);
|
vm.totalForecast( 0 );
|
||||||
vm.toForecast( vm.toInvoice );
|
vm.toForecast( vm.toInvoice );
|
||||||
_.each( vm.forecasts(), function ( p ) {
|
_.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( vm.toForecast() - Number( p.forecastamount() ) );
|
||||||
} );
|
} );
|
||||||
vm.toForecast( dbo.helpers.numberWithPoints( Number( vm.toForecast() ) ) );
|
vm.toForecast( dbo.helpers.numberWithPoints( Number( vm.toForecast() ) ) );
|
||||||
@@ -978,7 +989,7 @@ $( function () {
|
|||||||
|
|
||||||
refreshDocuments: function () {
|
refreshDocuments: function () {
|
||||||
var vm = dbo.editProjectModal;
|
var vm = dbo.editProjectModal;
|
||||||
|
console.log( vm.projectID );
|
||||||
dbo.documentsDataService.getdocuments( vm.projectID, function ( data ) {
|
dbo.documentsDataService.getdocuments( vm.projectID, function ( data ) {
|
||||||
vm.documents.removeAll();
|
vm.documents.removeAll();
|
||||||
|
|
||||||
|
|||||||
@@ -7,6 +7,7 @@
|
|||||||
|
|
||||||
|
|
||||||
dbo.vatInit = function () {
|
dbo.vatInit = function () {
|
||||||
|
var timeout;
|
||||||
|
|
||||||
if ( dbo.vatModel !== undefined ) {
|
if ( dbo.vatModel !== undefined ) {
|
||||||
|
|
||||||
@@ -35,7 +36,7 @@ dbo.vatInit = function () {
|
|||||||
vm.vats.removeAll();
|
vm.vats.removeAll();
|
||||||
|
|
||||||
_.each( data, function ( p ) {
|
_.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() );
|
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 ) {
|
Vat: function ( data, inEdit = false ) {
|
||||||
this.id = data.id;
|
this.id = data.id;
|
||||||
this.vatrate = ko.observable( data.vatrate );
|
this.vatrate = ko.observable( data.vatrate || 0 );
|
||||||
this.inEdit = ko.observable( inEdit );
|
this.inEdit = ko.observable( inEdit );
|
||||||
},
|
},
|
||||||
|
|
||||||
removeVat : function(){
|
removeVat: function () {
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -96,17 +96,14 @@ dbo.reservationsInit = function () {
|
|||||||
self.payed = dbo.helpers.numberWithPoints( data.payed );
|
self.payed = dbo.helpers.numberWithPoints( data.payed );
|
||||||
self.saldo = dbo.helpers.numberWithPoints( data.saldo );
|
self.saldo = dbo.helpers.numberWithPoints( data.saldo );
|
||||||
self.saldoToPay = dbo.helpers.numberWithPoints( data.saldoToPay );
|
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