-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added statistic for amount development
Fixes #31
- Loading branch information
1 parent
72d1d39
commit 4231b69
Showing
7 changed files
with
60 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
<?php | ||
|
||
namespace App\Http\Controllers; | ||
|
||
use Framework\Authentication\Auth; | ||
use Framework\Database\Database; | ||
use Framework\Routing\BaseController; | ||
use Framework\Routing\ControllerInterface; | ||
|
||
class AmountDevelopmentStatsController extends BaseController implements ControllerInterface | ||
{ | ||
public function execute(): void | ||
{ | ||
Auth::checkRole('Maintainer'); | ||
|
||
$dataSet = Database::unprepared('SELECT year, SUM(amount) AS amount FROM deliveryNotes GROUP BY year ORDER BY year ASC'); | ||
$data = []; | ||
if ($dataSet !== false) { | ||
while ($row = $dataSet->fetch_assoc()) { | ||
$data[$row['year']] = $row['amount']; | ||
} | ||
} | ||
|
||
view('statistics.amountDevelopment', ['data' => $data]); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<?php use Framework\Facades\Format; ?> | ||
<?= component('layout.header') ?> | ||
|
||
<h1><?= __('AmountDevelopment') ?></h1> | ||
|
||
<table class="scrollable"> | ||
<tr> | ||
<th class="center"><?= __('Year') ?></th> | ||
<th class="center"><?= __('Amount') ?></th> | ||
</tr> | ||
<?php foreach ($data as $year => $amount): ?> | ||
<tr> | ||
<td class="center"><?= $year ?></td> | ||
<td class="center"><?= Format::decimal($amount) ?></td> | ||
</tr> | ||
<?php endforeach ?> | ||
</table> | ||
|
||
<?= component('chart.line', [ | ||
'chartName' => 'amountDevelopment', | ||
'xTitle' => __('Year'), | ||
'yTitle' => __('inX', setting('massUnit')), | ||
'dataSet' => [['label' => __('Amount'), 'data' => $data]], | ||
]) ?> | ||
|
||
<?= component('layout.footer') ?> |