diversen
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
defined( 'BASEPATH' ) OR exit( 'No direct script access allowed' );
|
||||
|
||||
/**
|
||||
* Created by Pensare Software.
|
||||
* User: Theo Weijmer
|
||||
* Date: 23/01/2018
|
||||
* Time: 19:35
|
||||
*/
|
||||
class vatController extends MY_Controller {
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
|
||||
if ( AUTHENTICATED == FALSE ) die( 'NO ACCESS' );
|
||||
|
||||
$models = [];
|
||||
$libraries = [];
|
||||
|
||||
$this->load->model( $models );
|
||||
$this->load->library( $libraries );
|
||||
}
|
||||
|
||||
public function index()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function getVats( $archive )
|
||||
{
|
||||
$vats = Vat::getVats( $archive );
|
||||
|
||||
$this->json($vats);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
/**
|
||||
* Created by Pensare Software.
|
||||
* User: Theo Weijmer
|
||||
* Date: 23/01/2018
|
||||
* Time: 15:58
|
||||
*/
|
||||
|
||||
class Invoice extends BaseModel {
|
||||
|
||||
public function project()
|
||||
{
|
||||
return $this->belongsTo( 'Project' );
|
||||
}
|
||||
|
||||
public function payments()
|
||||
{
|
||||
return $this->hasMany( 'Payment' );
|
||||
}
|
||||
|
||||
public function vat()
|
||||
{
|
||||
return $this->belongsTo( 'Vat' );
|
||||
}
|
||||
}
|
||||
@@ -10,9 +10,9 @@ class Payment extends BaseModel {
|
||||
|
||||
protected $table = "payments";
|
||||
|
||||
public function offer()
|
||||
public function invoice()
|
||||
{
|
||||
return $this->belongsTo( 'Offer' );
|
||||
return $this->belongsTo( 'Invoice' );
|
||||
}
|
||||
|
||||
public static function savePayment( $paymentID, $payment )
|
||||
|
||||
@@ -21,6 +21,16 @@ class Project extends BaseModel {
|
||||
return $this->hasMany( 'Projectemployee' );
|
||||
}
|
||||
|
||||
public function projectcosts()
|
||||
{
|
||||
return $this->hasMany( 'Projectcost' );
|
||||
}
|
||||
|
||||
public function invoices()
|
||||
{
|
||||
return $this->hasMany( 'Invoice' );
|
||||
}
|
||||
|
||||
public function projectleader()
|
||||
{
|
||||
return $this->belongsTo( 'User', 'projectleader_id' );
|
||||
@@ -66,17 +76,16 @@ class Project extends BaseModel {
|
||||
}] )
|
||||
->with( [
|
||||
'offers' => function ( $q ) {
|
||||
$q->whereArchive( 'F' )
|
||||
->with( [
|
||||
'payments' => function ( $q ) {
|
||||
$q->selectRaw( '*' );
|
||||
}] );
|
||||
$q->whereArchive( 'F' );
|
||||
}] )
|
||||
->with( [
|
||||
'projectemployees.user' => function ( $q ) {
|
||||
$q->selectRaw( "id, CONCAT(firstname, ' ', middlename, ' ', lastname) AS fullname" );
|
||||
}] )
|
||||
->with( 'projectemployees.projecthours' )
|
||||
->with( 'projectcosts.external' )
|
||||
->with( 'invoices.payments' )
|
||||
->with( 'invoices.vat' )
|
||||
->with( 'customer' );
|
||||
|
||||
return $project;
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
/**
|
||||
* Created by Pensare Software.
|
||||
* User: Theo Weijmer
|
||||
* Date: 23/01/2018
|
||||
* Time: 11:37
|
||||
*/
|
||||
|
||||
class Projectcost extends BaseModel {
|
||||
|
||||
public function project()
|
||||
{
|
||||
return $this->belongsTo( 'Project' );
|
||||
}
|
||||
|
||||
public function external()
|
||||
{
|
||||
return $this->belongsTo( 'External' );
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
/**
|
||||
* Created by Pensare Software.
|
||||
* User: Theo Weijmer
|
||||
* Date: 23/01/2018
|
||||
* Time: 19:37
|
||||
*/
|
||||
|
||||
class Vat extends BaseModel {
|
||||
|
||||
public function invoices()
|
||||
{
|
||||
return $this->hasMany( 'Invoice' );
|
||||
}
|
||||
|
||||
public static function getVats( $archive )
|
||||
{
|
||||
if ( $archive == 'F' )
|
||||
{
|
||||
$vats = vat::whereArchive( 'F' )->get();
|
||||
}
|
||||
else
|
||||
{
|
||||
$vats = Vat::get();
|
||||
}
|
||||
|
||||
return $vats;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -65,7 +65,7 @@
|
||||
<tr>
|
||||
<td colspan="5">
|
||||
<button class="btn btn-primary btn-round btn-sm" data-bind="click:newProjecthour">
|
||||
nieuwe projecturen
|
||||
nieuwe uren
|
||||
</button>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
@@ -0,0 +1,182 @@
|
||||
<div class="panel panel-bordered panel-primary panel-line">
|
||||
<div class="panel-heading panel-heading-project">
|
||||
<h3 class="">
|
||||
facturen
|
||||
</h3>
|
||||
</div>
|
||||
<div class="panel-body panel-body-project">
|
||||
<table class="table table-sm">
|
||||
<thead>
|
||||
<th class="table-cyanish-header"> </th>
|
||||
<th class="table-cyanish-header">
|
||||
factuurnummer
|
||||
</th>
|
||||
<th class="table-cyanish-header">
|
||||
factuurdatum
|
||||
</th>
|
||||
<th class="table-cyanish-header">
|
||||
bedrag (excl)
|
||||
</th>
|
||||
<th class="table-cyanish-header">
|
||||
bedrag (incl)
|
||||
</th>
|
||||
<th class="table-cyanish-header">
|
||||
prognose(excl)
|
||||
</th>
|
||||
<th class="table-cyanish-header">
|
||||
prognose datum
|
||||
</th>
|
||||
<th class="table-cyanish-header">
|
||||
btw tarief
|
||||
</th>
|
||||
<th class="table-cyanish-header" width="40px">
|
||||
|
||||
</th>
|
||||
</thead>
|
||||
<tbody data-bind="foreach:invoices">
|
||||
<tr>
|
||||
<td>
|
||||
<i class="icon fa-chevron-right" data-bind="visible: ! showPayments(), click:$root.togglePayments"></i>
|
||||
<i class="icon fa-chevron-down" data-bind="visible:showPayments(), click:$root.togglePayments"></i>
|
||||
</td>
|
||||
<td>
|
||||
<span data-bind="text:invoicenumber, visible:! inEdit()"></span>
|
||||
<input type="text"
|
||||
class="form-control form-control-sm"
|
||||
placeholder="factuurnummer"
|
||||
data-bind="textInput:invoicenumber, visible:inEdit,
|
||||
event:{change:$root.saveInvoice}"/>
|
||||
</td>
|
||||
<td>
|
||||
<span data-bind="text:invoicedate, visible:! inEdit()"></span>
|
||||
<input type="text"
|
||||
class="form-control form-control-sm"
|
||||
placeholder="start"
|
||||
data-bind="datepicker:{dateFormat: 'dd-mm-yy' },
|
||||
value:invoicedate, visible:inEdit,
|
||||
event:{change:$root.saveInvoice}"/>
|
||||
</td>
|
||||
<td class="align-right">
|
||||
<span data-bind=" visible: ! inEdit()">
|
||||
<i class="icon fa-euro"></i>
|
||||
<span data-bind="text:invoiceamount"></span>
|
||||
</span>
|
||||
<input type="text"
|
||||
class="form-control form-control-sm align-right"
|
||||
paceholder="bedrag"
|
||||
data-bind="textInput:invoiceamount, visible:inEdit,
|
||||
event:{change:$root.saveInvoice,keyup:$root.validateNumber.bind($data, 'invoiceamount')}"/>
|
||||
</td>
|
||||
<td>
|
||||
<i class="icon fa-euro"></i>
|
||||
<span data-bind="text:inclBtw"></span>
|
||||
</td>
|
||||
<td class="align-right">
|
||||
<span data-bind=" visible: ! inEdit()">
|
||||
<i class="icon fa-euro"></i>
|
||||
<span data-bind="text:forecastamount"></span>
|
||||
</span>
|
||||
<input type="text"
|
||||
class="form-control form-control-sm align-right"
|
||||
paceholder="bedrag"
|
||||
data-bind="textInput:forecastamount, visible:inEdit,
|
||||
event:{change:$root.saveInvoice,keyup:$root.validateNumber.bind($data, 'forecastamount')}"/>
|
||||
</td>
|
||||
<td>
|
||||
<span data-bind="text:forecastdate, visible:! inEdit()"></span>
|
||||
<input type="text"
|
||||
class="form-control form-control-sm"
|
||||
placeholder="start"
|
||||
data-bind="datepicker:{dateFormat: 'dd-mm-yy' },
|
||||
value:forecastdate, visible:inEdit,
|
||||
event:{change:$root.saveInvoice}"/>
|
||||
</td>
|
||||
<td>
|
||||
<span data-bind="visible:! inEdit()">
|
||||
<span data-bind="text:dbo.helpers.findArrayElement('id', 'vatrate', vat_id(), $root.vats())"></span>
|
||||
%
|
||||
</span>
|
||||
<select class="form-control form-control-sm"
|
||||
data-bind="options:$root.vats,
|
||||
optionsText:'vatrate',
|
||||
optionsValue:'id',
|
||||
value:vat_id,
|
||||
optionsCaption:'btw',
|
||||
visible:inEdit(),
|
||||
event:{change:$root.saveInvoice}">
|
||||
</select>
|
||||
</td>
|
||||
<td>
|
||||
<i class="icon fa-edit pointer" title="wijzig" data-bind="click:$root.editInvoice"></i>
|
||||
<i class="icon fa-trash redish pointer" title="verwijder"
|
||||
data-bind="click:$root.removeInvoice"></i>
|
||||
</td>
|
||||
</tr>
|
||||
<tr data-bind="visible:showPayments()">
|
||||
<td colspan="8">
|
||||
<table class="table table-condensed">
|
||||
<thead>
|
||||
<th> </th>
|
||||
<th class="table-cyanish-header-light">
|
||||
datum
|
||||
</th>
|
||||
<th class="table-cyanish-header-light">
|
||||
bedrag
|
||||
</th>
|
||||
<th class="table-cyanish-header-light">
|
||||
</th>
|
||||
</thead>
|
||||
<tbody data-bind="foreach:payments">
|
||||
<tr>
|
||||
<td> </td>
|
||||
<td>
|
||||
<span data-bind="text:paymentdate, visible:! inEdit()"></span>
|
||||
<input type="text"
|
||||
class="form-control form-control-sm"
|
||||
placeholder="start"
|
||||
data-bind="datepicker:{dateFormat: 'dd-mm-yy' },
|
||||
value:paymentdate, visible:inEdit,
|
||||
event:{change:$root.savePayment}"/>
|
||||
</td>
|
||||
<td>
|
||||
<span data-bind=" visible: ! inEdit()">
|
||||
<i class="icon fa-euro"></i>
|
||||
<span data-bind="text:paymentamount"></span>
|
||||
</span>
|
||||
<input type="text"
|
||||
class="form-control form-control-sm align-right"
|
||||
paceholder="bedrag"
|
||||
data-bind="textInput:paymentamount, visible:inEdit,
|
||||
event:{change:$root.saveInvoice,
|
||||
keyup:$root.validateNumber.bind($data, 'paymentamount')}"/>
|
||||
</td>
|
||||
<td>
|
||||
<i class="icon fa-edit pointer" title="wijzig" data-bind="click:$root.editPayment"></i>
|
||||
<i class="icon fa-trash redish pointer" title="verwijder"
|
||||
data-bind="click:$root.removePayment"></i>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
<tfoot>
|
||||
<td colspan="4">
|
||||
<button class="btn btn-primary btn-round btn-sm" data-bind="click:$root.newPayment">
|
||||
nieuwe betaling
|
||||
</button>
|
||||
</td>
|
||||
</tfoot>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
<tfoot>
|
||||
<tr>
|
||||
<td colspan="5">
|
||||
<button class="btn btn-primary btn-round btn-sm" data-bind="click:newInvoice">
|
||||
nieuwe factuur
|
||||
</button>
|
||||
</td>
|
||||
</tr>
|
||||
</tfoot>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
@@ -1,75 +0,0 @@
|
||||
<div class="panel panel-bordered panel-primary panel-line">
|
||||
<div class="panel-heading panel-heading-project">
|
||||
<h3 class="">
|
||||
betalingen
|
||||
</h3>
|
||||
</div>
|
||||
<div class="panel-body panel-body-project">
|
||||
<table class="table table-sm">
|
||||
<thead>
|
||||
<th class="table-cyanish-header">
|
||||
offertenummer
|
||||
</th>
|
||||
<th class="table-cyanish-header">
|
||||
datum
|
||||
</th>
|
||||
<th class="table-cyanish-header">
|
||||
bedrag
|
||||
</th>
|
||||
<th class="table-cyanish-header" width="40px">
|
||||
|
||||
</th>
|
||||
</thead>
|
||||
<tbody data-bind="foreach:payments">
|
||||
<tr>
|
||||
<td>
|
||||
<span data-bind="text:offernumber, visible:! inEdit()"></span>
|
||||
<select class="form-control form-control-sm"
|
||||
data-bind="options:$root.offers,
|
||||
optionsText:'offernumber',
|
||||
optionsValue:'id',
|
||||
value:offer_id,
|
||||
optionsCaption:'offerte',
|
||||
visible: inEdit(),
|
||||
event:{change:$root.savePayment}">
|
||||
</select>
|
||||
</td>
|
||||
<td>
|
||||
<span data-bind="text:paymentdate, visible:! inEdit()"></span>
|
||||
<input type="text"
|
||||
class="form-control form-control-sm"
|
||||
placeholder="start"
|
||||
data-bind="datepicker:{dateFormat: 'dd-mm-yy' },
|
||||
value:paymentdate, visible:inEdit,
|
||||
event:{change:$root.savePayment}"/>
|
||||
</td>
|
||||
<td class="align-right">
|
||||
<span data-bind=" visible: ! inEdit()">
|
||||
<i class="icon fa-euro"></i>
|
||||
<span data-bind="text:paymentamount"></span>
|
||||
</span>
|
||||
<input type="text"
|
||||
class="form-control form-control-sm align-right"
|
||||
paceholder="bedrag"
|
||||
data-bind="textInput:paymentamount, visible:inEdit,
|
||||
event:{change:$root.savePayment,keyup:$root.validateNumber.bind($data, 'paymentamount')}"/>
|
||||
</td>
|
||||
<td>
|
||||
<i class="icon fa-edit pointer" title="wijzig" data-bind="click:$root.editPayment"></i>
|
||||
<i class="icon fa-trash redish pointer" title="verwijder"
|
||||
data-bind="click:$root.removePayment"></i>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
<tfoot>
|
||||
<tr>
|
||||
<td colspan="5">
|
||||
<button class="btn btn-primary btn-round btn-sm" data-bind="click:newPayment">
|
||||
nieuwe betaling
|
||||
</button>
|
||||
</td>
|
||||
</tr>
|
||||
</tfoot>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
@@ -23,50 +23,49 @@
|
||||
|
||||
</th>
|
||||
</thead>
|
||||
<tbody data-bind="foreach:projecthours">
|
||||
<tbody data-bind="foreach:projectcosts">
|
||||
<tr>
|
||||
<td>
|
||||
<span data-bind="text:fullname, visible:! inEdit()"></span>
|
||||
<span data-bind="text:contactperson, visible:! inEdit()"></span>
|
||||
<select class="form-control form-control-sm"
|
||||
data-bind="options:$root.projectEmployees,
|
||||
optionsText:'fullname',
|
||||
data-bind="options:$root.externals,
|
||||
optionsText:'contactperson',
|
||||
optionsValue:'id',
|
||||
value:projectemployee_id,
|
||||
optionsCaption:'medewerker',
|
||||
value:external_id,
|
||||
optionsCaption:'extern',
|
||||
visible: inEdit(),
|
||||
event:{change:$root.saveProjecthour}">
|
||||
event:{change:$root.saveProjectcosts}">
|
||||
</select>
|
||||
</td>
|
||||
<td class="align-right">
|
||||
<span data-bind=" visible: ! inEdit()">
|
||||
<span data-bind="text:hours"></span>
|
||||
uur
|
||||
<span data-bind="text:description"></span>
|
||||
</span>
|
||||
<input type="text"
|
||||
class="form-control form-control-sm align-right"
|
||||
paceholder="uren"
|
||||
data-bind="textInput:hours, visible:inEdit,
|
||||
event:{change:$root.saveProjecthour,keyup:$root.validateNumber.bind($data, 'hours')}"/>
|
||||
paceholder="omschrijving"
|
||||
data-bind="textInput:description, visible:inEdit,
|
||||
event:{change:$root.saveProjectcosts"/>
|
||||
</td>
|
||||
<td>
|
||||
<span data-bind="text:hourdate, visible:! inEdit()"></span>
|
||||
<span data-bind="text:date, visible:! inEdit()"></span>
|
||||
<input type="text"
|
||||
class="form-control form-control-sm"
|
||||
placeholder="start"
|
||||
data-bind="datepicker:{dateFormat: 'dd-mm-yy' },
|
||||
value:hourdate, visible:inEdit,
|
||||
event:{change:$root.saveProjecthour}"/>
|
||||
value:date, visible:inEdit,
|
||||
event:{change:$root.saveProjectcosts}"/>
|
||||
</td>
|
||||
<td class="align-right">
|
||||
<span data-bind=" visible: ! inEdit()">
|
||||
<i class="icon fa-euro"></i>
|
||||
<span data-bind="text:paymentamount"></span>
|
||||
<span data-bind="text:costs"></span>
|
||||
</span>
|
||||
<input type="text"
|
||||
class="form-control form-control-sm align-right"
|
||||
paceholder="bedrag"
|
||||
data-bind="textInput:paymentamount, visible:inEdit,
|
||||
event:{change:$root.savePayment,keyup:$root.validateNumber.bind($data, 'paymentamount')}"/>
|
||||
data-bind="textInput:costs, visible:inEdit,
|
||||
event:{change:$root.saveProjectcosts,keyup:$root.validateNumber.bind($data, 'costs')}"/>
|
||||
</td>
|
||||
<td>
|
||||
<i class="icon fa-edit pointer" title="wijzig" data-bind="click:$root.editProjecthour"></i>
|
||||
@@ -78,8 +77,8 @@
|
||||
<tfoot>
|
||||
<tr>
|
||||
<td colspan="5">
|
||||
<button class="btn btn-primary btn-round btn-sm" data-bind="click:newProjecthour">
|
||||
nieuwe projecturen
|
||||
<button class="btn btn-primary btn-round btn-sm" data-bind="click:newProjectcost">
|
||||
nieuwe projectkosten
|
||||
</button>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
@@ -2,120 +2,160 @@
|
||||
<button class="btn btn-danger" data-bind="click:closeProject" style="position:absolute">
|
||||
sluit
|
||||
</button>
|
||||
|
||||
<div class="container" style="margin-top:15px;padding-top:15px;">
|
||||
<div class="row" form-inline>
|
||||
<div class="col-md-3">
|
||||
<div class="form-group row">
|
||||
<label class="col-md-3 col-form-label">klant</label>
|
||||
<div class="col-md-9">
|
||||
<select class="form-control form-control-sm"
|
||||
data-bind="options:customers,
|
||||
optionsText:'name',
|
||||
optionsValue: 'id',
|
||||
value:customerID,
|
||||
disable:offers().length > 0,
|
||||
optionsCaption:'selecteer klant',
|
||||
event:{change:saveProject},
|
||||
css:{'is-invalid': ! customerID()}"></select>
|
||||
<small class="invalid-feedback"
|
||||
data-bind="style:{display: ! customerID() ? 'block' : 'none'}">
|
||||
selecteer een klant
|
||||
</small>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-3">
|
||||
<div class="form-group row">
|
||||
<label class="col-md-5 col-form-label">projectleider</label>
|
||||
<div class="col-md-7">
|
||||
<select class="form-control form-control-sm"
|
||||
data-bind="options:users,
|
||||
<div class="nav-tabs-horizontal nav-tabs-animate nav-tab-reverse">
|
||||
<ul class="nav nav-tabs nav-tabs-solid">
|
||||
<li class="nav-item" role="presentation">
|
||||
<a class="nav-link active"
|
||||
data-toggle="tab"
|
||||
href="#dashboard">
|
||||
<i class="icon fa-area-chart"></i>
|
||||
algemeen</a>
|
||||
</li>
|
||||
<li class="nav-item" role="presentation">
|
||||
<a class="nav-link"
|
||||
data-toggle="tab"
|
||||
href="#financial"
|
||||
aria-control="financial"
|
||||
role="tab">
|
||||
<i class="icon fa-euro"></i>
|
||||
financieel</a>
|
||||
</li>
|
||||
<li class="nav-item" role="presentation">
|
||||
<a class="nav-link"
|
||||
data-toggle="tab"
|
||||
href="#employees"
|
||||
aria-control="employees"
|
||||
role="tab">
|
||||
<i class="icon fa-user-circle"></i>
|
||||
medewerkers</a>
|
||||
</li>
|
||||
<li class="nav-item" role="presentation">
|
||||
<a class="nav-link"
|
||||
data-toggle="tab"
|
||||
href="#files"
|
||||
aria-control="files"
|
||||
role="tab">
|
||||
<i class="icon fa-files"></i>
|
||||
bestanden en opmerkingen</a>
|
||||
</li>
|
||||
</ul>
|
||||
<div class="tab-content">
|
||||
<div class="tab-pane animation-slide-top active" id="dashboard">
|
||||
<div class="row" form-inline>
|
||||
<div class="col-md-3">
|
||||
<div class="form-group row">
|
||||
<label class="col-md-3 col-form-label">klant</label>
|
||||
<div class="col-md-9">
|
||||
<select class="form-control form-control-sm"
|
||||
data-bind="options:customers,
|
||||
optionsText:'name',
|
||||
optionsValue: 'id',
|
||||
value:customerID,
|
||||
disable:offers().length > 0,
|
||||
optionsCaption:'selecteer klant',
|
||||
event:{change:saveProject},
|
||||
css:{'is-invalid': ! customerID()}"></select>
|
||||
<small class="invalid-feedback"
|
||||
data-bind="style:{display: ! customerID() ? 'block' : 'none'}">
|
||||
selecteer een klant
|
||||
</small>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-3">
|
||||
<div class="form-group row">
|
||||
<label class="col-md-5 col-form-label">projectleider</label>
|
||||
<div class="col-md-7">
|
||||
<select class="form-control form-control-sm"
|
||||
data-bind="options:users,
|
||||
optionsText:'fullname',
|
||||
optionsValue:'id',
|
||||
value:projectleaderID,
|
||||
optionsCaption:'projectleider',
|
||||
event:{change:saveProject}">
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-3">
|
||||
<div class="form-group row">
|
||||
<label class="col-md-5 col-form-label">begin project</label>
|
||||
<div class="col-md-7">
|
||||
<div class="input-group input-group-icon">
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-3">
|
||||
<div class="form-group row">
|
||||
<label class="col-md-5 col-form-label">begin project</label>
|
||||
<div class="col-md-7">
|
||||
<div class="input-group input-group-icon">
|
||||
<span class="input-group-addon">
|
||||
<i class="icon fa-calendar"></i>
|
||||
</span>
|
||||
<input type="text"
|
||||
placeholder="start project"
|
||||
class="form-control form-control-sm"
|
||||
readonly
|
||||
data-bind="datepicker:{dateFormat: 'dd-mm-yy' },
|
||||
<input type="text"
|
||||
placeholder="start project"
|
||||
class="form-control form-control-sm"
|
||||
readonly
|
||||
data-bind="datepicker:{dateFormat: 'dd-mm-yy' },
|
||||
value:startdate,
|
||||
event:{change:saveProject}">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-3">
|
||||
<div class="form-group row">
|
||||
<label class="col-md-5 col-form-label">eind project</label>
|
||||
<div class="col-md-7">
|
||||
<div class="input-group input-group-icon">
|
||||
<div class="col-md-3">
|
||||
<div class="form-group row">
|
||||
<label class="col-md-5 col-form-label">eind project</label>
|
||||
<div class="col-md-7">
|
||||
<div class="input-group input-group-icon">
|
||||
<span class="input-group-addon">
|
||||
<i class="icon fa-calendar"></i>
|
||||
</span>
|
||||
<input type="text"
|
||||
placeholder="eind project"
|
||||
class="form-control form-control-sm"
|
||||
readonly
|
||||
data-bind="datepicker:{dateFormat: 'dd-mm-yy' },
|
||||
<input type="text"
|
||||
placeholder="eind project"
|
||||
class="form-control form-control-sm"
|
||||
readonly
|
||||
data-bind="datepicker:{dateFormat: 'dd-mm-yy' },
|
||||
value:enddate,
|
||||
event:{change:saveProject}">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="tab-pane animation-slide-top" id="financial">
|
||||
<div class="row" data-bind="fadeVisible:customerID()">
|
||||
<div class="col-md-7">
|
||||
<?php $this->load->view( 'modals/partials/_projectoffers' ); ?>
|
||||
</div>
|
||||
<div class="col-md-5">
|
||||
<?php $this->load->view( 'modals/partials/_projectcosts' ); ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-md-9">
|
||||
<?php $this->load->view( 'modals/partials/_invoices' ); ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="tab-pane animation-slide-top" id="employees">
|
||||
<div class="row" data-bind="fadeVisible:customerID()">
|
||||
<div class="col-md-6" data-bind="fadeVisible:customerID()">
|
||||
<?php $this->load->view( 'modals/partials/_projectemployees' ); ?>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<?php $this->load->view( 'modals/partials/_hours' ); ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="tab-pane animation-slide-top" id="files">
|
||||
<div class="row" data-bind="fadeVisible:customerID()">
|
||||
<div class="col-md-4">
|
||||
<?php $this->load->view( 'modals/partials/_projectfiles' ); ?>
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
<?php $this->load->view( 'modals/partials/_projectcomments' ); ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- <div class="container">-->
|
||||
<!-- <div class="row">-->
|
||||
<!-- <div class="col-md-12">-->
|
||||
<!-- <div class="project-page-header">-->
|
||||
<!-- <h3>nieuw / wijzigen project-->
|
||||
<!-- <button class="btn btn-default pull-right" data-bind="click:closeProject">x</button>-->
|
||||
<!-- </h3>-->
|
||||
<!-- </div>-->
|
||||
<!-- </div>-->
|
||||
<!-- </div>-->
|
||||
<!-- </div>-->
|
||||
<div class="row" data-bind="fadeVisible:customerID()">
|
||||
<div class="col-md-6">
|
||||
<?php $this->load->view( 'modals/partials/_projectoffers' ); ?>
|
||||
</div>
|
||||
<div class="col-md-6" data-bind="fadeVisible:customerID()">
|
||||
<?php $this->load->view( 'modals/partials/_projectemployees' ); ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row" data-bind="fadeVisible:customerID()">
|
||||
<div class="col-md-4">
|
||||
<?php $this->load->view('modals/partials/_payments'); ?>
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
<?php $this->load->view('modals/partials/_hours'); ?>
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
<?php $this->load->view('modals/partials/_projectcosts'); ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row" data-bind="fadeVisible:customerID()">
|
||||
<div class="col-md-4">
|
||||
<?php $this->load->view('modals/partials/_projectfiles'); ?>
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
<?php $this->load->view('modals/partials/_projectcomments'); ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
@@ -92,4 +92,5 @@
|
||||
<script src="js/lib/dataservices/commentsDataservice.js"></script>
|
||||
<script src="js/lib/dataservices/documentsDataservice.js"></script>
|
||||
<script src="js/lib/dataservices/projectsDataservice.js"></script>
|
||||
<script src="js/lib/dataservices/vatDataservice.js"></script>
|
||||
<script src="js/lib/helpers.js"></script>
|
||||
@@ -48,6 +48,10 @@
|
||||
background-color: #0099B8;
|
||||
color: #fff !important;
|
||||
}
|
||||
.table-cyanish-header-light {
|
||||
background-color: #54CDE3;
|
||||
color: #fff !important;
|
||||
}
|
||||
|
||||
.table-indigoish-header {
|
||||
background-color: #4D64FA;
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
/**
|
||||
* Created by Pensare Software.
|
||||
* User: Theo Weijmer
|
||||
* Date: 23/01/2018
|
||||
* Time: 19:33
|
||||
*/
|
||||
|
||||
dbo.vatDataService = {
|
||||
|
||||
getVats: function ( archive = 'F', callback ) {
|
||||
$.getJSON( 'index.php/beheer/vatController/getVats/' + archive )
|
||||
.done( function ( data ) {
|
||||
callback( data );
|
||||
} );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -36,7 +36,7 @@ dbo.helpers = {
|
||||
}
|
||||
}
|
||||
|
||||
pointedString = dbo.helpers.reverseString( pointedString );
|
||||
pointedString = dbo.helpers.reverseString( pointedString );
|
||||
|
||||
return pointedString;
|
||||
},
|
||||
@@ -51,17 +51,29 @@ dbo.helpers = {
|
||||
return valid;
|
||||
},
|
||||
|
||||
findArrayElement: function ( toFind, element, value, array ) {
|
||||
console.log( array );
|
||||
if ( !Array.isArray( array ) ) return null;
|
||||
console.log( value );
|
||||
var foundValue = null
|
||||
$.each( array, function ( i, p ) {
|
||||
if ( p[toFind] == value ) foundValue = p[element];
|
||||
} );
|
||||
console.log( foundValue );
|
||||
return foundValue;
|
||||
},
|
||||
|
||||
reverseString: function ( string = '' ) {
|
||||
string = string.toString();
|
||||
if ( string.length == 0 ) return '';
|
||||
return string.split( '' ).reverse().join( '' );
|
||||
},
|
||||
|
||||
mysql2date : function(date){
|
||||
if( ! date ) return null;
|
||||
if( date.length != 10 ) return null;
|
||||
mysql2date: function ( date ) {
|
||||
if ( !date ) return null;
|
||||
if ( date.length != 10 ) return null;
|
||||
|
||||
var dateParts = date.split("-");
|
||||
var dateParts = date.split( "-" );
|
||||
|
||||
var newDate = dateParts[2] + '-' + dateParts[1] + '-' + dateParts[0];
|
||||
|
||||
|
||||
@@ -13,12 +13,15 @@ $( function () {
|
||||
projectEmployees: ko.observableArray( [] ),
|
||||
customers : ko.observableArray( [] ),
|
||||
users : ko.observableArray( [] ),
|
||||
payments : ko.observableArray( [] ),
|
||||
invoices : ko.observableArray( [] ),
|
||||
projecthours : ko.observableArray( [] ),
|
||||
offerFiles : ko.observableArray( [] ),
|
||||
offerComments : ko.observableArray( [] ),
|
||||
projectFiles : ko.observableArray( [] ),
|
||||
projectComments : ko.observableArray( [] ),
|
||||
externals : ko.observableArray( [] ),
|
||||
projectcosts : ko.observableArray( [] ),
|
||||
vats : ko.observableArray( [] ),
|
||||
showProject : ko.observable( false ),
|
||||
projectID : null,
|
||||
callback : null,
|
||||
@@ -36,11 +39,31 @@ $( function () {
|
||||
vm.customers( data );
|
||||
dbo.userDataService.getAllUsers( 'F', function ( data ) {
|
||||
vm.users( data );
|
||||
vm.refreshProject();
|
||||
dbo.externalDataService.getAllExternals( 'F', function ( data ) {
|
||||
dbo.vatDataService.getVats( 'F', function ( data ) {
|
||||
vm.vats( data )
|
||||
vm.refreshProject();
|
||||
} );
|
||||
} );
|
||||
} );
|
||||
} );
|
||||
},
|
||||
|
||||
togglePayments: function () {
|
||||
this.showPayment( !this.showPayment() );
|
||||
|
||||
var showPayments = sessionStorage.showPayments || [];
|
||||
|
||||
if ( this.showPayment() ) {
|
||||
showPayments.push( this.id );
|
||||
} else {
|
||||
var index = showPayments.indexOf( this.id );
|
||||
showPayments.splice( index, 1 );
|
||||
}
|
||||
|
||||
sessionStorage.setItem( "showPayment", showPayments );
|
||||
},
|
||||
|
||||
editProjectemployee: function () {
|
||||
var self = this;
|
||||
var vm = dbo.editProjectModal;
|
||||
@@ -85,6 +108,25 @@ $( function () {
|
||||
service.newOffer( vm.projectID, vm.customerID() );
|
||||
},
|
||||
|
||||
newInvoice: function () {
|
||||
var vm = dbo.editProjectModal;
|
||||
|
||||
var invoice = {
|
||||
id : 0,
|
||||
project_id : vm.projectID,
|
||||
invoicenumber : '',
|
||||
invoicedate : null,
|
||||
invoiceamount : 0,
|
||||
forecastamount: 0,
|
||||
forecastdate : null,
|
||||
inEdit : true,
|
||||
showPayments : false,
|
||||
payments : []
|
||||
}
|
||||
|
||||
vm.invoices.push( new vm.Invoice( invoice ) );
|
||||
},
|
||||
|
||||
newPayment: function () {
|
||||
var vm = dbo.editProjectModal;
|
||||
|
||||
@@ -113,6 +155,21 @@ $( function () {
|
||||
vm.projecthours.push( new vm.Projecthour( projecthour ) );
|
||||
},
|
||||
|
||||
newProjectcost: function () {
|
||||
var vm = dbo.editProjectModal;
|
||||
|
||||
var projectcost = {
|
||||
id : 0,
|
||||
external_id: null,
|
||||
description: '',
|
||||
date : null,
|
||||
costs : 0,
|
||||
inEdit : true
|
||||
};
|
||||
|
||||
vm.projectcosts.push( new vm.Projectcost( projectcost ) );
|
||||
},
|
||||
|
||||
editOffer: function () {
|
||||
var service = dbo.offersService;
|
||||
service.vm = dbo.editProjectModal;
|
||||
@@ -406,14 +463,19 @@ $( function () {
|
||||
} );
|
||||
} );
|
||||
|
||||
vm.projectcosts.removeAll();
|
||||
$.each( data.projectcosts, function ( i, p ) {
|
||||
vm.projectcosts.push( new vm.Projectcost( p ) );
|
||||
} );
|
||||
|
||||
vm.offers.removeAll();
|
||||
vm.payments.removeAll();
|
||||
$.each( data.offers, function ( i, p ) {
|
||||
vm.offers.push( new dbo.offersService.Offer( p ) );
|
||||
} );
|
||||
|
||||
$.each( p.payments, function ( z, q ) {
|
||||
vm.payments.push( new vm.Payment( q, p ) );
|
||||
} );
|
||||
vm.invoices.removeAll();
|
||||
$.each( data.invoices, function ( i, p ) {
|
||||
vm.invoices.push( new vm.Invoice( p ) );
|
||||
} );
|
||||
|
||||
vm.busy = false;
|
||||
@@ -432,18 +494,6 @@ $( function () {
|
||||
self.inEdit = ko.observable( sessionStorage.editEmployee == data.id );
|
||||
},
|
||||
|
||||
Payment: function ( data, offer = false ) {
|
||||
var inEdit = sessionStorage.editPayment == data.id;
|
||||
if ( !inEdit ) inEdit = data.inEdit || false;
|
||||
|
||||
this.id = data.id;
|
||||
this.offer_id = ko.observable( data.offer_id );
|
||||
this.offernumber = ko.observable( offer ? offer.offernumber : null );
|
||||
this.paymentdate = ko.observable( dbo.helpers.mysql2date( data.paymentdate ) );
|
||||
this.paymentamount = ko.observable( data.paymentamount );
|
||||
this.inEdit = ko.observable( inEdit );
|
||||
},
|
||||
|
||||
Projecthour: function ( data, fullname ) {
|
||||
var inEdit = sessionStorage.editPayment == data.id;
|
||||
if ( !inEdit ) inEdit = data.inEdit || false;
|
||||
@@ -454,6 +504,58 @@ $( function () {
|
||||
this.hourdate = ko.observable( dbo.helpers.mysql2date( data.hourdate ) );
|
||||
this.hours = ko.observable( data.hours );
|
||||
this.inEdit = ko.observable( inEdit );
|
||||
},
|
||||
|
||||
Projectcost: function ( data ) {
|
||||
this.id = data.id;
|
||||
this.external_id = ko.observable( data.external_id );
|
||||
this.contactperson = ko.observable( data.external ? data.external.contactperson : '' );
|
||||
this.description = ko.observable( data.description );
|
||||
this.date = ko.observable( dbo.helpers.mysql2date( data.date ) );
|
||||
this.costs = ko.observable( data.costs );
|
||||
this.inEdit = ko.observable( data.inEdit || false );
|
||||
},
|
||||
|
||||
Invoice: function ( data ) {
|
||||
var vm = dbo.editProjectModal;
|
||||
var self = this;
|
||||
var inEdit = sessionStorage.editInvoice == data.id;
|
||||
if ( !inEdit ) inEdit = data.inEdit || false;
|
||||
|
||||
self.id = data.id;
|
||||
self.project_id = ko.observable( data.project_id );
|
||||
self.invoicenumber = ko.observable( data.invoicenumber );
|
||||
self.invoicedate = ko.observable( dbo.helpers.mysql2date( data.invoicedate ) );
|
||||
self.invoiceamount = ko.observable( data.invoiceamount.toFixed(2) );
|
||||
self.forecastamount = ko.observable( data.forecastamount.toFixed(2) );
|
||||
self.forecastdate = ko.observable( dbo.helpers.mysql2date( data.forecastdate ) );
|
||||
self.vat_id = ko.observable( data.vat_id );
|
||||
|
||||
self.inEdit = ko.observable( inEdit );
|
||||
self.showPayments = ko.observable( data.showPayments || false );
|
||||
|
||||
self.inclBtw = ko.pureComputed(function(){
|
||||
if( ! self.vat_id() ) return self.invoiceamount();
|
||||
|
||||
return (Number(self.invoiceamount()) + (self.invoiceamount() *
|
||||
(dbo.helpers.findArrayElement('id', 'vatrate', self.vat_id(), this.vats()) /100))).toFixed(2);
|
||||
}, dbo.editProjectModal)
|
||||
|
||||
self.payments = ko.observableArray( [] );
|
||||
$.each( data.payments, function ( i, p ) {
|
||||
self.payments.push( new vm.Payment( p, self.invoicenumber ) );
|
||||
} );
|
||||
},
|
||||
|
||||
Payment: function ( data, invoicenumber = '' ) {
|
||||
var inEdit = sessionStorage.editPayment == data.id;
|
||||
if ( !inEdit ) inEdit = data.inEdit || false;
|
||||
|
||||
this.id = data.id;
|
||||
this.invoicenumber = ko.observable( invoicenumber );
|
||||
this.paymentdate = ko.observable( dbo.helpers.mysql2date( data.paymentdate ) );
|
||||
this.paymentamount = ko.observable( data.paymentamount );
|
||||
this.inEdit = ko.observable( inEdit );
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user