add custom report functionality
This commit is contained in:
parent
1440f01024
commit
7dbc288553
@ -24,6 +24,7 @@ $routes->get('/entry/daily', 'PageController::entryDaily', ['filter' => AuthFilt
|
||||
$routes->get('/entry/monthly', 'PageController::entryMonthly', ['filter' => AuthFilter::class]);
|
||||
$routes->get('/report', 'PageController::report', ['filter' => AuthFilter::class]);
|
||||
$routes->get('/report/merged', 'PageController::reportMerged', ['filter' => AuthFilter::class]);
|
||||
$routes->get('/report/custom1', 'PageController::reportCustom1', ['filter' => AuthFilter::class]);
|
||||
|
||||
$routes->group('api', ['filter' => AuthFilter::class], function ($routes) {
|
||||
$routes->get('dashboard/recent', 'Api\DashboardApiController::getRecent');
|
||||
|
||||
@ -259,8 +259,8 @@ class EntryApiController extends BaseController
|
||||
return $this->failValidationErrors(['test_id' => 'Required', 'month' => 'Required']);
|
||||
}
|
||||
|
||||
// Get test details
|
||||
$test = $this->testModel->find($testId);
|
||||
// Get test details with department name
|
||||
$test = $this->testModel->findWithDept($testId);
|
||||
if (!$test) {
|
||||
return $this->failNotFound('Test not found');
|
||||
}
|
||||
@ -318,6 +318,7 @@ class EntryApiController extends BaseController
|
||||
'controlName' => $c['controlName'],
|
||||
'lot' => $c['lot'],
|
||||
'producer' => $c['producer'],
|
||||
'expDate' => $c['expDate'],
|
||||
'mean' => $c['mean'],
|
||||
'sd' => $c['sd'],
|
||||
'results' => $resultsArray
|
||||
@ -327,8 +328,11 @@ class EntryApiController extends BaseController
|
||||
$data = [
|
||||
'test' => [
|
||||
'testId' => $test['testId'],
|
||||
'testCode' => $test['testCode'] ?? null,
|
||||
'testName' => $test['testName'],
|
||||
'testUnit' => $test['testUnit']
|
||||
'testUnit' => $test['testUnit'],
|
||||
'testMethod' => $test['testMethod'] ?? null,
|
||||
'deptName' => $test['deptName'] ?? null
|
||||
],
|
||||
'month' => $month,
|
||||
'controls' => $controlsWithData
|
||||
|
||||
@ -47,7 +47,11 @@ class PageController extends BaseController {
|
||||
return view('report/view');
|
||||
}
|
||||
|
||||
public function reportMerged() {
|
||||
public function reportMerged() {
|
||||
return view('report/merged');
|
||||
}
|
||||
|
||||
public function reportCustom1() {
|
||||
return view('report/custom1');
|
||||
}
|
||||
}
|
||||
|
||||
@ -53,4 +53,26 @@ class MasterTestsModel extends BaseModel {
|
||||
|
||||
return $builder->get()->getResultArray();
|
||||
}
|
||||
|
||||
|
||||
public function findWithDept($testId) {
|
||||
$builder = $this->builder();
|
||||
$builder->select('
|
||||
master_tests.test_id as testId,
|
||||
master_tests.test_code as testCode,
|
||||
master_tests.test_name as testName,
|
||||
master_tests.test_unit as testUnit,
|
||||
master_tests.test_method as testMethod,
|
||||
master_tests.cva,
|
||||
master_tests.ba,
|
||||
master_tests.tea,
|
||||
master_depts.dept_name as deptName
|
||||
');
|
||||
$builder->join('master_depts', 'master_depts.dept_id = master_tests.dept_id', 'left');
|
||||
$builder->where('master_tests.test_id', $testId);
|
||||
$builder->where('master_tests.deleted_at', null);
|
||||
$builder->groupBy('master_tests.test_id, master_depts.dept_name');
|
||||
|
||||
return $builder->get()->getRowArray();
|
||||
}
|
||||
}
|
||||
|
||||
@ -159,13 +159,20 @@
|
||||
Standard Report
|
||||
</a>
|
||||
</li>
|
||||
<li class="mb-1 min-h-0">
|
||||
<li class="mb-1 min-h-0">
|
||||
<a class="flex items-center gap-3 px-4 py-3 rounded-lg <?= uri_string() === 'report/merged' ? 'bg-primary/10 text-primary font-medium' : 'opacity-70 hover:bg-base-200 hover:opacity-100' ?> transition-colors h-full"
|
||||
href="<?= base_url('/report/merged') ?>">
|
||||
<i class="fa-solid fa-chart-simple w-5"></i>
|
||||
Merged Report
|
||||
</a>
|
||||
</li>
|
||||
<li class="mb-1 min-h-0">
|
||||
<a class="flex items-center gap-3 px-4 py-3 rounded-lg <?= uri_string() === 'report/custom1' ? 'bg-primary/10 text-primary font-medium' : 'opacity-70 hover:bg-base-200 hover:opacity-100' ?> transition-colors h-full"
|
||||
href="<?= base_url('/report/custom1') ?>">
|
||||
<i class="fa-solid fa-file-lines w-5"></i>
|
||||
Custom 1
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
</aside>
|
||||
|
||||
1008
app/Views/report/custom1.php
Normal file
1008
app/Views/report/custom1.php
Normal file
File diff suppressed because it is too large
Load Diff
Loading…
x
Reference in New Issue
Block a user