diveren. mail peter 16-02-2020
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user