Diversen nav opmerkingen

This commit is contained in:
2018-05-06 20:39:59 +02:00
parent a3d200c38b
commit c7846f9a80
16 changed files with 126 additions and 82 deletions
@@ -31,11 +31,17 @@ class vatController extends MY_Controller {
{
$vats = Vat::getVats( $archive );
$this->json($vats);
$this->json( $vats );
}
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 =
$this->Invoices_model->getOutstandingPerProject( $project->id );
$project->vatrate = Vat::getCurrentVat();
$this->json( $project );
}
+4 -5
View File
@@ -23,7 +23,7 @@ class FileUpload extends MY_Controller {
$this->load->library( $libraries );
}
public function upload( $foreignID, $tablename )
public function upload( $foreignID )
{
$config['upload_path'] = MYROOTPATH . 'documents/temp';
$config['allowed_types'] = '*';
@@ -43,7 +43,7 @@ class FileUpload extends MY_Controller {
$this->setStoragename();
$this->persistDocument( $data['upload_data'], $foreignID, $tablename );
$this->persistDocument( $data['upload_data'], $foreignID );
$this->renameDocument( $data['upload_data']['full_path'] );
}
@@ -55,15 +55,14 @@ class FileUpload extends MY_Controller {
$this->storagename = sha1( random_string( 'alnum', 16 ) );
}
private function persistDocument( $data, $foreignID, $tablename )
private function persistDocument( $data, $foreignID )
{
$file = [
'storagename' => $this->storagename,
'originalname' => $data['file_name'],
'user_id' => USERID,
'uploaddate' => date( 'Y-m-d H:i:s' ),
'foreign_id' => $foreignID,
'foreign_table' => $tablename
'foreign_id' => $foreignID
];
Document::create( $file );
+1 -1
View File
@@ -16,7 +16,7 @@ class MY_Controller extends CI_Controller {
{
parent::__construct();
$this->version = '0.10.AA';
$this->version = '0.02.00';
$this->load->library( 'beheer/session/RetrieveUserSession' );
+6
View File
@@ -41,6 +41,11 @@ class Project extends BaseModel {
return $this->hasMany( 'Reservation' );
}
public function vat()
{
return $this->belongsTo('Vat');
}
public function projectleader()
{
return $this->belongsTo( 'User', 'projectleader_id' );
@@ -112,6 +117,7 @@ class Project extends BaseModel {
->with( 'projectcosts.external' )
->with( 'invoices.payments' )
->with( 'invoices.vat' )
->with( 'vat' )
->with( 'customer' );
return $project;
@@ -14,7 +14,12 @@ class ReservationTotals {
$sql = "SELECT Q5.project_id AS projectID, external_id AS externalID,
costs, reservation, payed, (reservation - payed) AS saldo,
(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 (
SELECT COALESCE(reservation, 0) AS reservation, costs, payed, Q2.external_id, Q2.project_id
FROM (
@@ -75,6 +75,17 @@
</div>
</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>
<div class="col-md-8">
<h4><span data-bind="text:(totalBudget() - totalHours())"></span></h4>
@@ -7,16 +7,16 @@
<div class="panel-body panel-body-project">
<table class="table table-sm">
<thead>
<th class="table-cyanish-header">
<th class="table-cyanish-header" width="40%">
naam
</th>
<th class="table-cyanish-header align-right">
<th class="table-cyanish-header align-right" width="20%">
tarief
</th>
<th class="table-cyanish-header align-right">
<th class="table-cyanish-header align-right" width="25%">
budget
</th>
<th class="table-cyanish-header" width="40px">
<th class="table-cyanish-header" width="15%">
&nbsp;&nbsp;
</th>
</thead>
@@ -1,4 +1,4 @@
<div class="col-md-6">
<div class="col-md-8">
<table class="table table-condensed">
<thead>
<tr>
@@ -8,8 +8,8 @@
<th>&nbsp;</th>
</tr>
</thead>
<tbody>
<tr data-bind="foreach:documents">
<tbody data-bind="foreach:documents">
<tr>
<td>
<span data-bind="text:fullname"></span>
</td>
@@ -25,6 +25,7 @@
</td>
</tr>
</tbody>
<tfoot>
<tr></tr>
</tfoot>
</table>
@@ -32,19 +33,5 @@
<button class="upload-btn">voeg bestand toe</button>
<input type="file" name="userfile" data-bind="event:{change:addDocument}" id="fileinput"/>
</div>
</div>
<div class="col-md-6">
<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>
+25 -28
View File
@@ -45,39 +45,36 @@
sluit
</button>
</div>
<div class="tab-pane animation-slide-top"
id="dashboard"
data-bind="visible:activeTab()=='DASHBOARD'">
<?php $this->load->view( 'modals/partials/_dashboard' ); ?>
</div>
<div class="tab-pane animation-slide-top"
id="financial"
data-bind="visible:activeTab()=='FINANCIAL'">
<?php $this->load->view( 'modals/partials/_financials' ); ?>
</div>
<div class="tab-pane animation-slide-top"
id="employees"
data-bind="visible:activeTab()=='EMPLOYEES'">
<div class="row" data-bind="fadeVisible:customerID()">
<div class="col-md-5" data-bind="fadeVisible:customerID()">
<?php $this->load->view( 'modals/partials/_projectemployees' ); ?>
</div>
<div class="col-md-7">
<?php $this->load->view( 'modals/partials/_hours' ); ?>
<div id="project-scroller">
<div class="tab-pane animation-slide-top"
id="dashboard"
data-bind="visible:activeTab()=='DASHBOARD'">
<?php $this->load->view( 'modals/partials/_dashboard' ); ?>
</div>
<div class="tab-pane animation-slide-top"
id="financial"
data-bind="visible:activeTab()=='FINANCIAL'">
<?php $this->load->view( 'modals/partials/_financials' ); ?>
</div>
<div class="tab-pane animation-slide-top"
id="employees"
data-bind="visible:activeTab()=='EMPLOYEES'">
<div class="row" data-bind="fadeVisible:customerID()">
<div class="col-md-5" data-bind="fadeVisible:customerID()">
<?php $this->load->view( 'modals/partials/_projectemployees' ); ?>
</div>
<div class="col-md-7">
<?php $this->load->view( 'modals/partials/_hours' ); ?>
</div>
</div>
</div>
</div>
<div class="tab-pane animation-slide-top"
id="files"
data-bind="visible:activeTab()=='FILES'">
<div class="row" data-bind="fadeVisible:customerID()">
<div class="col-md-4">
<div class="tab-pane animation-slide-top"
id="files"
data-bind="visible:activeTab()=='FILES'">
<div class="row" data-bind="fadeVisible:customerID()">
<?php $this->load->view( 'modals/partials/_projectfiles' ); ?>
</div>
<div class="col-md-4">
<?php $this->load->view( 'modals/partials/_projectcomments' ); ?>
</div>
</div>
</div>
</div>
+8 -3
View File
@@ -1,6 +1,6 @@
<div class="VAT">
<div class="row">
<div class="col-md-4">
<div class="col-md-2">
<table class="table table-condensed">
<thead>
<tr>
@@ -11,10 +11,15 @@
<tbody data-bind="foreach:vats">
<tr>
<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">&#x25;</span>
</div>
</td>
<td width="60px">
<i class="icon fa-sellsy"></i>
<i class="icon fa-edit" data-bind="click:$root.toggleEdit"></i>
<i class="icon fa-trash redish" data-bind="$root.removeVat"></i>
</td>