diff --git a/application/controllers/dashboard/DashboardController.php b/application/controllers/dashboard/DashboardController.php index df734f2..fd70734 100644 --- a/application/controllers/dashboard/DashboardController.php +++ b/application/controllers/dashboard/DashboardController.php @@ -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; + } + } diff --git a/application/core/MY_Controller.php b/application/core/MY_Controller.php index 2aba7bb..ae0d771 100644 --- a/application/core/MY_Controller.php +++ b/application/core/MY_Controller.php @@ -16,7 +16,7 @@ class MY_Controller extends CI_Controller { { parent::__construct(); - $this->version = '1.00.40'; + $this->version = '1.00.50'; $this->load->library( 'beheer/session/RetrieveUserSession' ); diff --git a/application/models/eloquent/Offer.php b/application/models/eloquent/Offer.php index 87545f3..7f155d9 100644 --- a/application/models/eloquent/Offer.php +++ b/application/models/eloquent/Offer.php @@ -46,7 +46,8 @@ class Offer extends BaseModel { public static function getOffersWithoutProject() { - $offersWithoutProject = Offer::orderBy( 'startdate' ) + $offersWithoutProject = Offer::selectRAW('offers.*, CONCAT(offernumber, " ", offername) AS fulloffer') + ->orderBy( 'startdate' ) // ->whereNull('rejectdate') // ->whereNull('project_id') ->whereArchive( 'F' ) diff --git a/application/views/pages/dashboard_view.php b/application/views/pages/dashboard_view.php index 4c3095d..e0e5e47 100644 --- a/application/views/pages/dashboard_view.php +++ b/application/views/pages/dashboard_view.php @@ -1,8 +1,11 @@
Mollis Egestas Fusce Parturient
+Ultricies Ligula Risus
+Mollis Egestas Fusce Parturient
+Ultricies Ligula Risus
+Mollis Egestas Fusce Parturient
+Ultricies Ligula Risus
+