This commit is contained in:
mahdahar 2025-11-24 11:13:25 +07:00
parent bb24ef6d49
commit e68c88b600
5 changed files with 57 additions and 34 deletions

View File

@ -20,6 +20,7 @@ $routes->get('label/coll/(:any)', 'Label::coll/$1');
$routes->get('label/dispatch/(:any)/(:any)', 'Label::dispatch/$1/$2'); $routes->get('label/dispatch/(:any)/(:any)', 'Label::dispatch/$1/$2');
$routes->get('label/all/(:any)', 'Label::print_all/$1'); $routes->get('label/all/(:any)', 'Label::print_all/$1');
$routes->get('result/(:any)', 'Result::show/$1'); $routes->get('result/(:any)', 'Result::show/$1');
$routes->post('result/validate', 'Result::res_validate');
// ------------------------------------------------------Page Based on Role------------------------------------------------------ // // ------------------------------------------------------Page Based on Role------------------------------------------------------ //
$routes->group('admin', ['filter' => 'role:1'], function($routes) { $routes->group('admin', ['filter' => 'role:1'], function($routes) {

View File

@ -3,16 +3,15 @@ namespace App\Controllers;
use CodeIgniter\RESTful\ResourceController; use CodeIgniter\RESTful\ResourceController;
class ApiDashboard extends ResourceController class ApiDashboard extends ResourceController {
{ public function index() {
public function index()
{
$date1 = $this->request->getVar('date1'); $date1 = $this->request->getVar('date1');
$date2 = $this->request->getVar('date2'); $date2 = $this->request->getVar('date2');
$db = \Config\Database::connect(); $db = \Config\Database::connect();
$sql = "SELECT * from GDC_CMOD.dbo.V_DASHBOARD_DEV $sql = "SELECT * from GDC_CMOD.dbo.V_DASHBOARD_DEV where
where COLLECTIONDATE between '$date1 00:00' and '$date2 23:59' and ODR_DDATE between '$date1 00:00' and '$date2 23:59'"; COLLECTIONDATE between '$date1 00:00' and '$date2 23:59'
and ODR_DDATE between '$date1 00:00' and '$date2 23:59'";
$query = $db->query($sql); $query = $db->query($sql);
$results = $query->getResultArray(); $results = $query->getResultArray();

View File

@ -8,10 +8,14 @@ class Result extends BaseController {
public function show($accessnumber) { public function show($accessnumber) {
$db = db_connect(); $db = db_connect();
$data['accessnumber'] = $accessnumber; $data['accessnumber'] = $accessnumber;
$sql = "SELECT d.STATS, r.ISVAL2 FROM GDC_CMOD.dbo.V_DASHBOARD_DEV d
left join GDC_CMOD.dbo.CM_REQUESTS r ON r.ACCESSNUMBER=d.SP_ACCESSNUMBER
WHERE d.SP_ACCESSNUMBER='$accessnumber'";
$result = $db $result = $db
->query("SELECT STATS FROM GDC_CMOD.dbo.V_DASHBOARD_DEV WHERE SP_ACCESSNUMBER='$accessnumber'") ->query($sql)
->getResultArray(); ->getResultArray();
$data['status'] = $result[0]['STATS']; $data['status'] = $result[0]['STATS'];
$data['verif'] = $result[0]['ISVAL2'];
return view('result/result_show',$data); return view('result/result_show',$data);
} }
@ -24,4 +28,16 @@ class Result extends BaseController {
return $this->response->setJSON($data); return $this->response->setJSON($data);
} }
public function res_validate() {
$input = $this->request->getJSON(true);
$accessnumber = $input['accessnumber'];
$userid = $input['userid'];
$db = db_connect();
$sql = "update GDC_CMOD.dbo.CM_REQUESTS set ISVAL2=1, VAL2USER='$userid', VAL2DATE=GETDATE() where ACCESSNUMBER='$accessnumber'";
$result = $db->query($sql);
$data = ['status' => 'success', 'message' => 'Data updated successfully', 'data' => "$accessnumber" ];
return $this->response->setJSON($data);
}
} }

View File

@ -65,7 +65,7 @@
<table id="datatables" class="table table-sm table-hover table-bordered align-middle table-striped"> <table id="datatables" class="table table-sm table-hover table-bordered align-middle table-striped">
<thead class="table-primary"> <thead class="table-primary">
<tr> <tr>
<th>S</th> <th style="width:1%;">S</th>
<th style='width:7%;'>Order Datetime</th> <th style='width:7%;'>Order Datetime</th>
<th>Patient Name</th> <th>Patient Name</th>
<th style='width:7%;'>No Lab</th> <th style='width:7%;'>No Lab</th>
@ -74,9 +74,8 @@
<th style='width:8%;'>Doctor</th> <th style='width:8%;'>Doctor</th>
<th style='width:15%;'>Tests</th> <th style='width:15%;'>Tests</th>
<th style='width:5%;'>Result To</th> <th style='width:5%;'>Result To</th>
<th style='width:8%;'>Validation</th> <th style='width:10%;'>Validation</th>
<th style='width:5%;'>Status</th> <th style='width:4%;'>Status</th>
<th style='width:8%;'></th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
@ -111,23 +110,27 @@
--> -->
<td> <?= esc($row['statscode']) ?> </td> <td> <?= esc($row['reqdate']) ?> </td> <td> <?= esc($row['patname']) ?> </td> <td> <?= esc($row['statscode']) ?> </td> <td> <?= esc($row['reqdate']) ?> </td> <td> <?= esc($row['patname']) ?> </td>
<td> <?= esc($row['sp_accessnumber']) ?> </td> <td> <?= esc($row['hostordernumber']) ?> </td> <td> <?= esc($row['reff']) ?> </td> <td> <?= esc($row['sp_accessnumber']) ?> </td> <td> <?= esc($row['hostordernumber']) ?> </td> <td> <?= esc($row['reff']) ?> </td>
<td> <?= esc($row['doc']) ?> </td> <td> <?= $tests; ?> </td> <td> <?= esc($row['odr_cresult_to']) ?> </td> <td> <?= esc($row['doc']) ?> </td> <td> <?= $tests; ?> </td>
<td>
<?= esc($row['odr_cresult_to']) ?> <br/>
<input type="checkbox" name="printed"> Printed
</td>
<td data-acc="<?=$row['sp_accessnumber'];?>"> <td data-acc="<?=$row['sp_accessnumber'];?>">
<h6> <span class="px-3 py-2 badge bg-success"> <?=$row['val'];?> </span> </h6> <span class="border border-success rounded p-1 mb-2 me-2"> <?=$row['val'];?> </span>
<?php if($row['val'] == 1) { ?>
<a href="<?=base_url('result/'.$row['sp_accessnumber']);?>" target="_blank" class="btn btn-xs btn-outline-primary px-1 py-0 mb-1">Verify</a> <br/>
<?php } else { echo "<br />"; } ?>
<?php if($row['val'] == 2) { ?>
<a href="http://glenlis/spooler_db/main_dev.php?acc=<?=$row['sp_accessnumber'];?>" target="_blank" class="btn btn-xs btn-primary py-0 px-1">Ind</a> |
<a href="http://glenlis/spooler_db/main_dev.php?acc=<?=$row['sp_accessnumber'];?>&eng=1" target="_blank" class="btn btn-xs btn-primary py-0 px-1">Eng</a> |
<a href="#" class="btn btn-xs btn-secondary py-0 px-1">Pdf</a> <br />
<?php } ?>
<?php if ($row['val'] != 0) {?> <?php if ($row['val'] != 0) {?>
<a href="#" class="btn btn-xs btn-secondary py-0 px-2 invalidate-btn" onclick="invalidate('<?=$row['sp_accessnumber'];?>'); return false;">Invalidate</a><br> <a href="#" class="btn btn-xs btn-secondary py-0 px-2 invalidate-btn" onclick="invalidate('<?=$row['sp_accessnumber'];?>'); return false;">Invalidate</a><br>
<?php }?> <?php }?>
</td> </td>
<td class="pointercol <?= esc($class) ?>" data-access="<?= $row['sp_accessnumber'] ?>" data-bs-toggle="modal" data-bs-target="#detailModal"> <?= esc($row['stats']) ?> </td> <td class="pointercol <?= esc($class) ?>" data-access="<?= $row['sp_accessnumber'] ?>" data-bs-toggle="modal" data-bs-target="#detailModal"> <?= esc($row['stats']) ?> </td>
<td>
<a href="<?=base_url('result/'.$row['sp_accessnumber']);?>" target="_blank" class="btn btn-xs btn-primary py-0 px-2">Preview</a> <br/>
<?php if($row['val'] != 0) { ?>
<a href="http://glenlis/spooler_db/main_dev.php?acc=<?=$row['sp_accessnumber'];?>" target="_blank" class="btn btn-xs btn-primary py-0 px-1">Print</a> |
<a href="http://glenlis/spooler_db/main_dev.php?acc=<?=$row['sp_accessnumber'];?>&eng=1" target="_blank" class="btn btn-xs btn-primary py-0 px-1">Eng</a> |
<a href="#" class="btn btn-xs btn-secondary py-0 px-1">Pdf</a> <br />
<input type="checkbox" name="printed"> Printed
<?php } ?>
</td>
</tr> </tr>
<?php endforeach; ?> <?php endforeach; ?>
</tbody> </tbody>
@ -168,11 +171,11 @@
scrollY: '70vh', scrollY: '70vh',
columnDefs: [{ columnDefs: [{
className: 'text-center', className: 'text-center',
targets: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10] targets: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
}, // semua kolom di tengah }, // semua kolom di tengah
{ {
className: 'text-start', className: 'text-start',
targets: [11] targets: [10]
} }
], ],
responsive: true, responsive: true,

View File

@ -3,7 +3,7 @@
<head> <head>
<meta charset="UTF-8"> <meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Result Preview</title> <title>Result <?=$accessnumber?></title>
<script src="https://cdn.tailwindcss.com"></script> <script src="https://cdn.tailwindcss.com"></script>
<script> <script>
tailwind.config = { tailwind.config = {
@ -19,9 +19,6 @@
</head> </head>
<?php <?php
$userid = session('userid'); $userid = session('userid');
$verif = 0;
if(strpos(strtolower($status), "verif") !== false) { $verif = 1; }
?> ?>
<body class="bg-gray-50 flex items-start justify-center"> <body class="bg-gray-50 flex items-start justify-center">
@ -88,18 +85,25 @@ if(strpos(strtolower($status), "verif") !== false) { $verif = 1; }
function validate() { function validate() {
const ok = confirm('Are you sure?'); const ok = confirm('Are you sure?');
if (!ok) return; if (!ok) return;
fetch('inc/result_validate.php?accessnumber=<?=$accessnumber;?>&userid=<?=$userid;?>', { const postData = {
method: 'GET' accessnumber: '<?=$accessnumber;?>',
}) userid: '<?=$userid?>'
};
fetch('<?=base_url("result/validate");?>', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify(postData)
})
.then(function (response) { .then(function (response) {
if (!response.ok) throw new Error('Failed to send data'); if (!response.ok) throw new Error('Failed to send data');
//return response.json(); //return response.json();
}) })
.then(function (data) { .then(function (data) {
location.reload(); //location.reload();
}) })
.catch(function (error) { .catch(function (error) {
alert('Error: ' + error.message); alert('Error: ' + error.message);
}); });
} }
<?php }?> <?php }?>