prework
This commit is contained in:
parent
11111aeed3
commit
bb24ef6d49
@ -16,10 +16,11 @@ $routes->get('/', 'Home::index');
|
||||
$routes->match(['get','post'],'/login', 'Auth::login', ['filter' => 'guest']);
|
||||
$routes->get('/logout', 'Auth::logout');
|
||||
|
||||
$routes->get('result/(:any)', 'Result::show/$1');
|
||||
$routes->get('label/coll/(:any)', 'Label::coll/$1');
|
||||
$routes->get('label/dispatch/(:any)/(:any)', 'Label::dispatch/$1/$2');
|
||||
$routes->get('label/all/(:any)', 'Label::print_all/$1');
|
||||
$routes->get('result/(:any)', 'Result::show/$1');
|
||||
|
||||
// ------------------------------------------------------Page Based on Role------------------------------------------------------ //
|
||||
$routes->group('admin', ['filter' => 'role:1'], function($routes) {
|
||||
$routes->get('/', 'Admin::index');
|
||||
@ -28,6 +29,7 @@ $routes->group('admin', ['filter' => 'role:1'], function($routes) {
|
||||
$routes->post('user/create', 'User::create');
|
||||
$routes->post('user/update', 'User::update');
|
||||
$routes->post('user/delete', 'User::delete');
|
||||
$routes->get('result/invalidate/(:any)', 'Result::invalidate/$1');
|
||||
});
|
||||
|
||||
$routes->group('doctor', ['filter' => 'role:2'], function($routes) {
|
||||
@ -44,4 +46,6 @@ $routes->group('cs', ['filter' => 'role:4'], function($routes) {
|
||||
|
||||
// ------------------------------------------------------For API------------------------------------------------------ //
|
||||
// $routes->get('/api/dashboard', 'ApiDashboard::index');
|
||||
$routes->get('api/specimen/(:any)', 'Specimen::show/$1');
|
||||
$routes->get('api/specimen/(:any)', 'Specimen::show/$1');
|
||||
$routes->post('api/specimen/collect/(:any)', 'Specimen::collect/$1');
|
||||
$routes->post('api/specimen/unreceive/(:any)', 'Specimen::unreceive/$1');
|
||||
@ -110,4 +110,8 @@ class Admin extends BaseController
|
||||
public function modal_specimen() {
|
||||
return view('admin/modal_specimen');
|
||||
}
|
||||
|
||||
public function result_show() {
|
||||
return view('result/result_show');
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,8 +1,10 @@
|
||||
<?php
|
||||
namespace App\Controllers;
|
||||
use CodeIgniter\API\ResponseTrait;
|
||||
|
||||
class Result extends BaseController {
|
||||
|
||||
use ResponseTrait;
|
||||
|
||||
public function show($accessnumber) {
|
||||
$db = db_connect();
|
||||
$data['accessnumber'] = $accessnumber;
|
||||
@ -10,7 +12,16 @@ class Result extends BaseController {
|
||||
->query("SELECT STATS FROM GDC_CMOD.dbo.V_DASHBOARD_DEV WHERE SP_ACCESSNUMBER='$accessnumber'")
|
||||
->getResultArray();
|
||||
$data['status'] = $result[0]['STATS'];
|
||||
return view('result/show',$data);
|
||||
return view('result/result_show',$data);
|
||||
}
|
||||
|
||||
public function invalidate($accessnumber) {
|
||||
$db = db_connect();
|
||||
$sql = "update GDC_CMOD.dbo.CM_REQUESTS set ISVAL=null, VALUSER=null, VALDATE=null,
|
||||
ISVAL2=null, VAL2USER=null, VAL2DATE=null where ACCESSNUMBER='$accessnumber'";
|
||||
$result = $db->query($sql);
|
||||
$data = ['status' => 'success', 'message' => 'Data updated successfully', 'data' => "$accessnumber" ];
|
||||
|
||||
return $this->response->setJSON($data);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,7 +1,10 @@
|
||||
<?php
|
||||
namespace App\Controllers;
|
||||
use CodeIgniter\API\ResponseTrait;
|
||||
|
||||
class Specimen extends BaseController {
|
||||
use ResponseTrait;
|
||||
|
||||
public function show($access) {
|
||||
$db = \Config\Database::connect();
|
||||
|
||||
@ -53,5 +56,57 @@ class Specimen extends BaseController {
|
||||
|
||||
return $this->response->setJSON($data);
|
||||
}
|
||||
|
||||
public function collect($accessnumber) {
|
||||
$db = \Config\Database::connect();
|
||||
$input = $this->request->getJSON(true);
|
||||
$samplenumber = $input['samplenumber'];
|
||||
$status = $input['status'];
|
||||
$userid = $input['userid'];
|
||||
$sql = "if not exists (select * from GDC_CMOD.dbo.TUBES where ACCESSNUMBER='$accessnumber' and TUBENUMBER='$samplenumber' and STATUS='$status')
|
||||
begin
|
||||
update GDC_CMOD.dbo.TUBES set USERID='$userid',STATUS='$status', COLLECTIONDATE=getdate() where ACCESSNUMBER='$accessnumber' and TUBENUMBER='$samplenumber'
|
||||
end";
|
||||
$db->query($sql);
|
||||
$sql = "INSERT INTO GDC_CMOD.dbo.AUDIT_TUBES(ACCESSNUMBER, TUBENUMBER, USERID, STATUS, LOGDATE)
|
||||
VALUES ('$accessnumber', '$samplenumber', '$userid', '$status', getdate())";
|
||||
$db->query($sql);
|
||||
return $this->respondCreated([ 'status' => 'success', 'message' => 'Data updated successfully', 'data' => "$accessnumber-$samplenumber" ], 201);
|
||||
}
|
||||
|
||||
public function unreceive($accessnumber) {
|
||||
$db = \Config\Database::connect();
|
||||
$input = $this->request->getJSON(true);
|
||||
$samplenumber = $input['samplenumber'];
|
||||
// update firebird
|
||||
$sql = "select r.EXTERNALORDERNUMBER, dt.TESTCODE, do.HISCODE from glendb.dbo.TESTS t
|
||||
left join glendb.dbo.DICT_TESTS dt on dt.TESTID=t.TESTID
|
||||
left join glendb.dbo.REQUESTS r on r.REQUESTID=t.REQUESTID
|
||||
left join glendb.dbo.DICT_TEST_SAMPLES dts on dts.TESTID=t.TESTID
|
||||
left join glendb.dbo.DICT_SAMPLES_TYPES ds on ds.SAMPTYPEID=dts.SAMPTYPEID
|
||||
left join GDC_CMOD.dbo.DICT_TESTS_ORDER do on do.TESTCODE=dt.TESTCODE
|
||||
where t.DEPTH=0
|
||||
and r.ACCESSNUMBER='$req' and ds.SAMPCODE='$samplenumber'";
|
||||
$rows = $db->query($sql)->getResultArray();
|
||||
$his_test = '';
|
||||
foreach( $rows as $row ) {
|
||||
$hon = $row['EXTERNALORDERNUMBER'];
|
||||
$testcode = $row['TESTCODE'];
|
||||
$hiscode = $row['HISCODE'];
|
||||
$his_test .= "'$hiscode',";
|
||||
$lis_test .= "'$testcode',";
|
||||
}
|
||||
$his_test = rtrim($his_test,',');
|
||||
$lis_test = rtrim($lis_test,',');
|
||||
$conn = odbc_connect('GLENEAGLES','','');
|
||||
$sql = "UPDATE TDL_ORDERDT SET ODD_NRECEIVED=NULL , ODD_DTRECEIVE=NULL WHERE ODR_CNOLAB='$hon' and ODD_CPRODUCTCODE IN ($his_test)";
|
||||
$rs = odbc_exec($conn,$sql);
|
||||
if (!$rs) {exit("Error in Update FB");}
|
||||
|
||||
$sql = "update SP_TUBES set TUBESTATUS=0 where SP_ACCESSNUMBER='$accessnumber' and SAMPLETYPE='$samplenumber' ";
|
||||
$db->query($sql);
|
||||
$sql = "update SP_TESTS set SP_TESTSTATUS=NULL where SP_ACCESSNUMBER='$req' and SP_TESTCODE in ($lis_test)";
|
||||
$db->query($sql);
|
||||
return $this->respondCreated([ 'status' => 'success', 'message' => 'Data updated successfully', 'data' => "$accessnumber-$samplenumber" ], 201);
|
||||
}
|
||||
}
|
||||
|
||||
@ -127,14 +127,22 @@
|
||||
.Suspend {
|
||||
background-color: purple;
|
||||
}
|
||||
|
||||
.btn-xs {
|
||||
font-size : 0.7rem;
|
||||
}
|
||||
</style>
|
||||
|
||||
<?= $this->renderSection('css'); ?>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<body class="d-flex flex-column min-vh-100">
|
||||
<?= $this->renderSection('content'); ?>
|
||||
|
||||
<footer class="bg-dark text-white mt-auto py-1 px-3 fs-6">
|
||||
<small>© 2025 - 5Panda</small>
|
||||
</footer>
|
||||
|
||||
|
||||
<script>
|
||||
console.log("salam 5panda" );
|
||||
</script>
|
||||
|
||||
@ -68,16 +68,15 @@
|
||||
<th>S</th>
|
||||
<th style='width:7%;'>Order Datetime</th>
|
||||
<th>Patient Name</th>
|
||||
<th>No Lab</th>
|
||||
<th>No Register</th>
|
||||
<th style='width:10%;'>Reff</th>
|
||||
<th>Doctor</th>
|
||||
<th style='width:10%;'>Tests</th>
|
||||
<th style='width:7%;'>No Lab</th>
|
||||
<th style='width:7%;'>No Register</th>
|
||||
<th style='width:8%;'>Reff</th>
|
||||
<th style='width:8%;'>Doctor</th>
|
||||
<th style='width:15%;'>Tests</th>
|
||||
<th style='width:5%;'>Result To</th>
|
||||
<th style='width:8%;'>Validation</th>
|
||||
<th style='width:5%;'>Status</th>
|
||||
<th style='width:8%;'></th>
|
||||
<th style='width:6%;'></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@ -95,6 +94,8 @@
|
||||
case 9: $class = 'PenVerification'; break;
|
||||
default: $class = ''; break;
|
||||
}
|
||||
$tests = esc($row['tests']);
|
||||
$tests = str_replace(",", ", ", $tests);
|
||||
?>
|
||||
<tr>
|
||||
<!--
|
||||
@ -110,17 +111,23 @@
|
||||
-->
|
||||
<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['doc']) ?> </td> <td> <?= esc($row['tests']) ?> </td> <td> <?= esc($row['odr_cresult_to']) ?> </td>
|
||||
<td> <h6> <span class="px-3 py-2 badge text-success border border-success bg-success-subtle"> <?=$row['val'];?> </span> </h6>
|
||||
<a href="#" class="text-primary">Result</a><br> <a href="#" class="text-primary" disabled>Invalidation</a><br>
|
||||
<td> <?= esc($row['doc']) ?> </td> <td> <?= $tests; ?> </td> <td> <?= esc($row['odr_cresult_to']) ?> </td>
|
||||
<td data-acc="<?=$row['sp_accessnumber'];?>">
|
||||
<h6> <span class="px-3 py-2 badge bg-success"> <?=$row['val'];?> </span> </h6>
|
||||
<?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>
|
||||
<?php }?>
|
||||
</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="text-primary">Preview</a> <br/>
|
||||
<a href="#" class="text-danger">Print</a> | <a href="#" class="text-danger">Eng</a> <br/>
|
||||
<a href="#" class="text-primary">Pdf</a>
|
||||
<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>
|
||||
<td> <input type="checkbox" name="printed"> Printed<br> <input type="checkbox" name="hardcopy"> Hardcopy </td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
</tbody>
|
||||
@ -158,14 +165,14 @@
|
||||
order: [[0, 'asc'], [3, 'asc']],
|
||||
paging: false,
|
||||
scrollCollapse: true,
|
||||
scrollY: '75vh',
|
||||
scrollY: '70vh',
|
||||
columnDefs: [{
|
||||
className: 'text-center',
|
||||
targets: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11]
|
||||
targets: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
|
||||
}, // semua kolom di tengah
|
||||
{
|
||||
className: 'text-start',
|
||||
targets: [12]
|
||||
targets: [11]
|
||||
}
|
||||
],
|
||||
responsive: true,
|
||||
@ -191,7 +198,61 @@
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
function invalidate(accessnumber) {
|
||||
if(confirm("Are you sure?")) {
|
||||
$.get(`<?=base_url('admin/result/invalidate/');?>/${accessnumber}`);
|
||||
|
||||
const cell = document.querySelector(`[data-acc="${accessnumber}"]`);
|
||||
if(cell){
|
||||
cell.querySelector(".badge").textContent = "0";
|
||||
const btn = cell.querySelector(".invalidate-btn");
|
||||
if (btn) btn.remove();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function collect(accessnumber, samplenumber, status) {
|
||||
// toggle checkbox
|
||||
const row = document.getElementById(`row-${accessnumber}-${samplenumber}`);
|
||||
const checkbox = row.querySelector('.coll-checkbox');
|
||||
checkbox.checked = status;
|
||||
|
||||
$.ajax({
|
||||
url: `<?=base_url('api/specimen/collect');?>/${accessnumber}`,
|
||||
type: "POST",
|
||||
contentType: "application/json; charset=utf-8",
|
||||
dataType: "json",
|
||||
data: JSON.stringify({ samplenumber:samplenumber, status:status, userid:"<?=session('userid');?>" }),
|
||||
success: function(response) {
|
||||
console.log("Success:", response);
|
||||
},
|
||||
error: function(xhr, status, error) {
|
||||
console.error("Error:", status, error);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function unreceive(accessnumber, samplenumber) {
|
||||
// toggle checkbox
|
||||
const row = document.getElementById(`row-${accessnumber}-${samplenumber}`);
|
||||
const checkbox = row.querySelector('.recv-checkbox');
|
||||
checkbox.checked = status;
|
||||
|
||||
$.ajax({
|
||||
url: `<?=base_url('api/specimen/unreceive');?>/${accessnumber}`,
|
||||
type: "POST",
|
||||
contentType: "application/json; charset=utf-8",
|
||||
dataType: "json",
|
||||
data: JSON.stringify({ samplenumber:samplenumber }),
|
||||
success: function(response) {
|
||||
console.log("Success:", response);
|
||||
},
|
||||
error: function(xhr, status, error) {
|
||||
console.error("Error:", status, error);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// Untuk Koment Value
|
||||
function commentValue() {
|
||||
|
||||
@ -65,26 +65,26 @@
|
||||
</td>
|
||||
</tr>
|
||||
{{#samples}}
|
||||
<tr>
|
||||
<tr id='row-{{accessnumber}}-{{sampcode}}'>
|
||||
<td>{{sampcode}}</td>
|
||||
<td>{{name}}</td>
|
||||
<td class='text-center'>
|
||||
<input type="checkbox" class="form-check-input"
|
||||
<input type="checkbox" class="form-check-input coll-checkbox"
|
||||
{{#is_coll}}checked{{/is_coll}}
|
||||
disabled
|
||||
>
|
||||
</td>
|
||||
<td class='text-center'>
|
||||
<input type="checkbox" class="form-check-input"
|
||||
<input type="checkbox" class="form-check-input recv-checkbox"
|
||||
{{#is_recv}}checked{{/is_recv}}
|
||||
disabled
|
||||
>
|
||||
</td>
|
||||
<td>
|
||||
<button class="btn btn-sm btn-secondary px-2 py-1"><i class="bi bi-printer"></i></button>
|
||||
<button class="btn btn-success px-2 py-1" onclick=""><h6 class="p-0 m-0">Coll.</h6></button>
|
||||
<button class="btn btn-warning px-2 py-1" onclick=""><h6 class="p-0 m-0">Un-Coll.</h6></button>
|
||||
<button class="btn btn-warning px-2 py-1" onclick=""><h6 class="p-0 m-0">Un-Recv.</h6></button>
|
||||
<button class="btn btn-success px-2 py-1" onclick="collect({{accessnumber}}, {{sampcode}}, 1)"><h6 class="p-0 m-0">Coll.</h6></button>
|
||||
<button class="btn btn-warning px-2 py-1" onclick="collect({{accessnumber}}, {{sampcode}}, 0)"><h6 class="p-0 m-0">Un-Coll.</h6></button>
|
||||
<button class="btn btn-warning px-2 py-1" onclick="unreceive({{accessnumber}}, {{sampcode}})"><h6 class="p-0 m-0">Un-Recv.</h6></button>
|
||||
</td>
|
||||
<td>
|
||||
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Responsive HTML Iframe Demo</title>
|
||||
<title>Result Preview</title>
|
||||
<script src="https://cdn.tailwindcss.com"></script>
|
||||
<script>
|
||||
tailwind.config = {
|
||||
@ -45,7 +45,7 @@ if(strpos(strtolower($status), "verif") !== false) { $verif = 1; }
|
||||
<?php if($verif == 0) { ?>
|
||||
<div class="absolute inset-0 flex items-center justify-center pointer-events-none z-20">
|
||||
<span class="text-7xl font-black text-gray-600 opacity-20 transform rotate-[-30deg] select-none">
|
||||
Trial - please contact 5panda
|
||||
Unverified
|
||||
</span>
|
||||
</div>
|
||||
<?php } ?>
|
||||
Loading…
x
Reference in New Issue
Block a user