Diversen dashboard
This commit is contained in:
@@ -42,23 +42,25 @@ class DashboardController extends MY_Controller {
|
||||
$available += $project['budgetAvailable'];
|
||||
}
|
||||
|
||||
$outstandings = $this->Invoices_model->getTotalsOutstandingPerProject(FALSE);
|
||||
$outstandings = $this->Invoices_model->getTotalsOutstandingPerProject( FALSE );
|
||||
|
||||
$this->json( [
|
||||
'totalOwp' => round( $totalOwp, 0 ),
|
||||
'revenuesThisYear' => $this->getRevenuesThisYear(),
|
||||
'revenuesThisYear' => $this->getRevenuesThisYear(),
|
||||
'currentFinancialYear' => round( $currentFinancialYear ),
|
||||
'owpNextyear' => round( $totalOwp - $currentFinancialYear ),
|
||||
'revenuesNextyear' => round( $currentFinancialYear / 0.4 ),
|
||||
'totalRevenues' => round( $totalRevenues ),
|
||||
'outstandings' => $this->getInvoiceOverview(),
|
||||
'costsToPay' => $this->reservations()
|
||||
'outstandings' => $this->getInvoiceOverview(),
|
||||
'costsToPay' => $this->reservations(),
|
||||
'invoiced' => $this->getInvoiced(),
|
||||
'totalChance' => $this->getChanceRevenues()
|
||||
] );
|
||||
}
|
||||
|
||||
private function getRevenuesThisYear()
|
||||
{
|
||||
$year = date('Y');
|
||||
$year = date( 'Y' );
|
||||
$sql = QEmployeeHours::fire( FALSE, $year );
|
||||
|
||||
$query = $this->db->query( $sql );
|
||||
@@ -66,7 +68,7 @@ class DashboardController extends MY_Controller {
|
||||
$result = $query->result();
|
||||
|
||||
$totalRevenue = 0;
|
||||
foreach($result as $revenue)
|
||||
foreach ( $result as $revenue )
|
||||
{
|
||||
$totalRevenue += $revenue->revenues;
|
||||
}
|
||||
@@ -74,13 +76,13 @@ class DashboardController extends MY_Controller {
|
||||
return $totalRevenue;
|
||||
}
|
||||
|
||||
private function getInvoiceOverview( )
|
||||
private function getInvoiceOverview()
|
||||
{
|
||||
$projects = Project::whereArchive('F')->get();
|
||||
$projects = Project::whereArchive( 'F' )->get();
|
||||
|
||||
foreach($projects as $project)
|
||||
foreach ( $projects as $project )
|
||||
{
|
||||
$invoiceOverview = new InvoiceOverview( $project, date('Y') );
|
||||
$invoiceOverview = new InvoiceOverview( $project, date( 'Y' ) );
|
||||
|
||||
$invoiceOverviews[] = $invoiceOverview->getProjectDetails();
|
||||
}
|
||||
@@ -97,7 +99,7 @@ class DashboardController extends MY_Controller {
|
||||
$results = $query->result();
|
||||
|
||||
$costsToPay = 0;
|
||||
foreach($results as $result)
|
||||
foreach ( $results as $result )
|
||||
{
|
||||
$toPay = $result->other_revenue - $result->costs + $result->saldoToPay;
|
||||
$costsToPay += $toPay;
|
||||
@@ -106,4 +108,33 @@ class DashboardController extends MY_Controller {
|
||||
return $costsToPay;
|
||||
}
|
||||
|
||||
private function getInvoiced()
|
||||
{
|
||||
$invoiced = Invoice::getInvoiced( date( 'Y' ) );
|
||||
|
||||
$totalInvoiced = 0;
|
||||
foreach ( $invoiced as $invoice )
|
||||
{
|
||||
$totalInvoiced += ROUND( ( $invoice->invoiceamount * 1.21 ), 0 );
|
||||
}
|
||||
|
||||
return $totalInvoiced;
|
||||
}
|
||||
|
||||
private function getChanceRevenues()
|
||||
{
|
||||
$offers = Offer::getAllOffers( FALSE, 'F', '', 'id', 'desc' );
|
||||
|
||||
$totalChance = 0;
|
||||
foreach ( $offers as $offer )
|
||||
{
|
||||
$totalChance +=
|
||||
ROUND(
|
||||
( $offer->own_revenue + $offer->other_revenue ) *
|
||||
( $offer->acceptance_chance / 100 ), 0 );
|
||||
}
|
||||
|
||||
return $totalChance;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user