diveren. mail peter 16-02-2020

This commit is contained in:
Theo Weijmer
2020-02-21 11:52:59 +01:00
parent 8bcb01c902
commit 4bdf52a34a
7 changed files with 229 additions and 76 deletions
@@ -8,6 +8,8 @@
class DashboardController extends MY_Controller {
private $invoiceOverviews = [];
public function __construct()
{
parent::__construct();
@@ -44,6 +46,8 @@ class DashboardController extends MY_Controller {
$outstandings = $this->Invoices_model->getTotalsOutstandingPerProject( FALSE );
$this->setInvoiceOverview();
$this->json( [
'totalOwp' => round( $totalOwp, 0 ),
'revenuesThisYear' => $this->getRevenuesThisYear(),
@@ -51,10 +55,11 @@ class DashboardController extends MY_Controller {
'owpNextyear' => round( $totalOwp - $currentFinancialYear ),
'revenuesNextyear' => round( $currentFinancialYear / 0.4 ),
'totalRevenues' => round( $totalRevenues ),
'outstandings' => $this->getInvoiceOverview(),
'outstandings' => $this->invoiceOverviews,
'costsToPay' => $this->reservations(),
'invoiced' => $this->getInvoiced(),
'totalChance' => $this->getChanceRevenues()
'totalChance' => $this->getChanceRevenues(),
'totalPayment' => $this->getTotalpayment()
] );
}
@@ -76,7 +81,7 @@ class DashboardController extends MY_Controller {
return $totalRevenue;
}
private function getInvoiceOverview()
private function setInvoiceOverview()
{
$projects = Project::whereArchive( 'F' )->get();
@@ -84,10 +89,8 @@ class DashboardController extends MY_Controller {
{
$invoiceOverview = new InvoiceOverview( $project, date( 'Y' ) );
$invoiceOverviews[] = $invoiceOverview->getProjectDetails();
$this->invoiceOverviews[] = $invoiceOverview->getProjectDetails();
}
return $invoiceOverviews;
}
private function reservations()
@@ -137,4 +140,15 @@ class DashboardController extends MY_Controller {
return $totalChance;
}
private function getTotalPayment()
{
$totalPayment = 0;
foreach($this->invoiceOverviews as $invoiceOverview)
{
$totalPayment += str_replace( '.', '', $invoiceOverview['projectPayment']);
}
return $totalPayment;
}
}