diff --git a/application/controllers/beheer/vatController.php b/application/controllers/beheer/vatController.php
new file mode 100644
index 0000000..5213a82
--- /dev/null
+++ b/application/controllers/beheer/vatController.php
@@ -0,0 +1,36 @@
+load->model( $models );
+ $this->load->library( $libraries );
+ }
+
+ public function index()
+ {
+
+ }
+
+ public function getVats( $archive )
+ {
+ $vats = Vat::getVats( $archive );
+
+ $this->json($vats);
+ }
+}
\ No newline at end of file
diff --git a/application/models/eloquent/Invoice.php b/application/models/eloquent/Invoice.php
new file mode 100644
index 0000000..0c25d85
--- /dev/null
+++ b/application/models/eloquent/Invoice.php
@@ -0,0 +1,25 @@
+belongsTo( 'Project' );
+ }
+
+ public function payments()
+ {
+ return $this->hasMany( 'Payment' );
+ }
+
+ public function vat()
+ {
+ return $this->belongsTo( 'Vat' );
+ }
+}
\ No newline at end of file
diff --git a/application/models/eloquent/Payment.php b/application/models/eloquent/Payment.php
index 376d9d8..9099ef0 100644
--- a/application/models/eloquent/Payment.php
+++ b/application/models/eloquent/Payment.php
@@ -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 )
diff --git a/application/models/eloquent/Project.php b/application/models/eloquent/Project.php
index 9d4a3ca..642f792 100644
--- a/application/models/eloquent/Project.php
+++ b/application/models/eloquent/Project.php
@@ -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;
diff --git a/application/models/eloquent/Projectcost.php b/application/models/eloquent/Projectcost.php
new file mode 100644
index 0000000..c8301d1
--- /dev/null
+++ b/application/models/eloquent/Projectcost.php
@@ -0,0 +1,21 @@
+belongsTo( 'Project' );
+ }
+
+ public function external()
+ {
+ return $this->belongsTo( 'External' );
+ }
+
+}
\ No newline at end of file
diff --git a/application/models/eloquent/Vat.php b/application/models/eloquent/Vat.php
new file mode 100644
index 0000000..9f17907
--- /dev/null
+++ b/application/models/eloquent/Vat.php
@@ -0,0 +1,30 @@
+hasMany( 'Invoice' );
+ }
+
+ public static function getVats( $archive )
+ {
+ if ( $archive == 'F' )
+ {
+ $vats = vat::whereArchive( 'F' )->get();
+ }
+ else
+ {
+ $vats = Vat::get();
+ }
+
+ return $vats;
+ }
+
+}
\ No newline at end of file
diff --git a/application/views/modals/partials/_hours.php b/application/views/modals/partials/_hours.php
index cdd548e..1b75e13 100644
--- a/application/views/modals/partials/_hours.php
+++ b/application/views/modals/partials/_hours.php
@@ -65,7 +65,7 @@
diff --git a/application/views/modals/partials/_invoices.php b/application/views/modals/partials/_invoices.php
new file mode 100644
index 0000000..9138cc1
--- /dev/null
+++ b/application/views/modals/partials/_invoices.php
@@ -0,0 +1,182 @@
+
+
+
+ facturen
+
+
+
+
+
+
+
+ factuurnummer
+
+
+ factuurdatum
+
+
+ bedrag (excl)
+
+
+ bedrag (incl)
+
+
+ prognose(excl)
+
+
+ prognose datum
+
+
+ btw tarief
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ %
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ datum
+
+
+ bedrag
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/application/views/modals/partials/_payments.php b/application/views/modals/partials/_payments.php
deleted file mode 100644
index f71e5d4..0000000
--- a/application/views/modals/partials/_payments.php
+++ /dev/null
@@ -1,75 +0,0 @@
-
-
-
- betalingen
-
-
-
-
-
-
- offertenummer
-
-
- datum
-
-
- bedrag
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/application/views/modals/partials/_projectcosts.php b/application/views/modals/partials/_projectcosts.php
index 8193ced..5d38a8d 100644
--- a/application/views/modals/partials/_projectcosts.php
+++ b/application/views/modals/partials/_projectcosts.php
@@ -23,50 +23,49 @@
-
+