diversen dashboard
This commit is contained in:
@@ -42,16 +42,68 @@ class DashboardController extends MY_Controller {
|
||||
$available += $project['budgetAvailable'];
|
||||
}
|
||||
|
||||
$outstandings = $this->Invoices_model-> getTotalsOutstandingPerProject();
|
||||
$outstandings = $this->Invoices_model->getTotalsOutstandingPerProject(FALSE);
|
||||
|
||||
$this->json( [
|
||||
'totalOwp' => round( $totalOwp, 0 ),
|
||||
'revenuesThisYear' => $this->getRevenuesThisYear(),
|
||||
'currentFinancialYear' => round( $currentFinancialYear ),
|
||||
'owpNextyear' => round( $totalOwp - $currentFinancialYear ),
|
||||
'revenuesNextyear' => round( $totalOwp / 0.4 ),
|
||||
'revenuesNextyear' => round( $currentFinancialYear / 0.4 ),
|
||||
'totalRevenues' => round( $totalRevenues ),
|
||||
'outstandings' => $outstandings
|
||||
'outstandings' => $this->getInvoiceOverview(),
|
||||
'costsToPay' => $this->reservations()
|
||||
] );
|
||||
}
|
||||
|
||||
private function getRevenuesThisYear()
|
||||
{
|
||||
$year = date('Y');
|
||||
$sql = QEmployeeHours::fire( FALSE, $year );
|
||||
|
||||
$query = $this->db->query( $sql );
|
||||
|
||||
$result = $query->result();
|
||||
|
||||
$totalRevenue = 0;
|
||||
foreach($result as $revenue)
|
||||
{
|
||||
$totalRevenue += $revenue->revenues;
|
||||
}
|
||||
|
||||
return $totalRevenue;
|
||||
}
|
||||
|
||||
private function getInvoiceOverview( )
|
||||
{
|
||||
$projects = Project::whereArchive('F')->get();
|
||||
|
||||
foreach($projects as $project)
|
||||
{
|
||||
$invoiceOverview = new InvoiceOverview( $project, date('Y') );
|
||||
|
||||
$invoiceOverviews[] = $invoiceOverview->getProjectDetails();
|
||||
}
|
||||
|
||||
return $invoiceOverviews;
|
||||
}
|
||||
|
||||
private function reservations()
|
||||
{
|
||||
$sql = ReservationTotals::fire();
|
||||
|
||||
$query = $this->db->query( $sql );
|
||||
|
||||
$results = $query->result();
|
||||
|
||||
$costsToPay = 0;
|
||||
foreach($results as $result)
|
||||
{
|
||||
$toPay = $result->other_revenue - $result->costs + $result->saldoToPay;
|
||||
$costsToPay += $toPay;
|
||||
}
|
||||
|
||||
return $costsToPay;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user