Update Printer Barcode Ruang Sampling Bali, Nama File Barcode dan Views Sidebar All Role

This commit is contained in:
mikael-zakaria 2025-03-07 01:02:05 +07:00
parent 28dd621273
commit 4c99e3e017
5 changed files with 75 additions and 61 deletions

View File

@ -128,13 +128,14 @@ $routes->group('fo', ['filter' => 'role:fo'], static function ($routes) {
$routes->get('dashboard/viewAccess/(:any)', 'FoController::viewAccess/$1');
});
// Printers
// Printers Bali
$routes->get('printLabel/collection/(:any)', 'PrintLabel::labelCollection/$1');
$routes->get('printLabel/single/(:any)/(:any)', 'PrintLabel::printSingle/$1/$2');
$routes->get('printLabel/collection/(:any)', 'PrintLabel::labelPostekCollection/$1');
$routes->get('printLabel/all/(:any)', 'PrintLabel::printAll/$1');
$routes->get('printResult/(:any)', 'PrintResult::printResultTest/$1');
$routes->get('printLabelSby/single/(:any)/(:any)', 'PrintLabelSby::printSingle/$1/$2');
// Printers Surabaya
$routes->get('printLabelSby/collection/(:any)', 'PrintLabelSby::labelZebraCollection/$1');
$routes->get('printLabelSby/single/(:any)/(:any)', 'PrintLabelSby::printSingle/$1/$2');
$routes->get('printLabelSby/all/(:any)', 'PrintLabelSby::printAll/$1');
$routes->get('printResult/(:any)', 'PrintResult::printResultTest/$1');

View File

@ -3,6 +3,20 @@ namespace App\Controllers;
class PrintLabel extends BaseController {
public function printerLab() {
exec('net use L: \\\\10.148.5.20\\Labelshare /user:Administrator 2>&1', $output, $return_var);
$pathNetworkFolder = 'L:/Sampling_Labels/';
$letterPath = 'L:';
return array($pathNetworkFolder, $letterPath);
}
public function printerSampling() {
exec('net use S: \\\\10.148.3.169\\Labelshare /user:Administrator 2>&1', $output, $return_var);
$pathNetworkFolder = 'S:/Sampling_Labels/';
$letterPath = 'S:';
return array($pathNetworkFolder, $letterPath);
}
public function splitName($fullName) {
$words = explode(' ', $fullName); // Pisahkan nama berdasarkan spasi
$line1 = '';
@ -32,13 +46,12 @@ class PrintLabel extends BaseController {
}
// Untuk Ruang Laboratorium
public function labelPostekCollection($access) {
public function labelCollection($access) {
$time = microtime(true);
$logTime = date('d-m-Y_H_i_s', $time) . sprintf('_%03d', ($time - floor($time)) * 1000);
$filename = "sample_".$logTime;
$filename = "collection(".$access.")_".$logTime;
$role = session()->get('userrole');
$networkPath = "";
$db = \Config\Database::connect();
@ -86,6 +99,10 @@ class PrintLabel extends BaseController {
$jarak = '53';
}
$label="";
$role = session()->get('userrole');
// Ruang Analis Printer POSTEK C168/200s
if ($role == 'admin' || $role == 'user') {
$label = "N
OD
q400
@ -104,11 +121,29 @@ A195,164,0,2,1,1,N,\"$collectiondate\"
P1
";
// Ruang Analis Printer POSTEK C168/200s
if ($role === 'admin' || $role === 'user') {
$printer = $this->printerLab();
} else if ($role === 'sampling') {
} else if ($role == 'sampling') {
$label = "N
OD
q400
Q185,10+0
I8,A,001
D10
A4,3,0,2,1,1,N,\"$title.$name1\"
A$jarak,20,0,2,1,1,N,\"$name2\"
A4,42,0,1,1,1,N,\"DoB: $birthdate\"
A337,42,0,1,1,1,N,\"$sex {$age}Y\"
B15,57,0,1,4,8,70,N,\"$access\"
A120,132,0,1,1,1,N,\"REQ# $access\"
A4,164,0,2,1,1,N,\"RM:$uhid\"
A4,147,0,2,1,1,N,\"VN:$bv\"
A195,164,0,2,1,1,N,\"$collectiondate\"
P1
";
$printer = $this->printerSampling();
} else {
// Eksekusi Kode Berikut Apabila Role Bukan Analis atau Sampling
return $this->response->setJSON([
@ -176,69 +211,47 @@ A195,165,0,2,1,1,N,\"$collection_date\"
P1
";
// $sampleLabel ="N
// OD
// q400
// Q200,10+0
// I8,A,001
// D10
// A4,3,0,2,1,1,N,\"$title.$name\"
// A4,25,0,2,1,1,N,\"$sex {$age}Y\"
// A4,55,0,2,1,1,N,\"$sample\"
// A4,75,0,2,1,1,N,\"Chapter\"
// B149,35,0,1,3,8,70,N,\"$barcode\"
// A195,110,0,2,1,1,N,\"SAM# $barcode\"
// A4,140,0,2,1,1,N,\"RM : $uhid\"
// A4,160,0,2,1,1,N,\"VN : $bv\"
// A195,156,0,2,1,1,N,\"$collection_date\"
// P1
// ";
return $sampleLabel;
}
// Untuk Ruang Sampling
public function labelZebra($sample, $title, $name, $sex, $age, $barcode, $uhid, $bv, $collection_date) {
public function labelZebra($sample, $title, $name, $sex, $age, $barcode, $uhid, $bv, $collection_date, $birthdate) {
$fixName = $this->splitName($name);
$name1 = $fixName['line1'];
$name2 = $fixName['line2'];
if ($sex == 'M') {
$jarak = '42';
} else {
$jarak = '53';
}
$sampleLabel ="N
OD
q400
Q185,10+0
I8,A,001
D10
A4,3,0,2,1,1,N,\"$title.$name\"
A4,25,0,2,1,1,N,\"$sex {$age}Y\"
A4,55,0,2,1,1,N,\"$sample\"
A4,75,0,2,1,1,N,\"Chapter\"
B149,35,0,1,3,8,70,N,\"$barcode\"
A195,110,0,2,1,1,N,\"SAM# $barcode\"
A4,140,0,2,1,1,N,\"RM : $uhid\"
A4,160,0,2,1,1,N,\"VN : $bv\"
A195,156,0,2,1,1,N,\"$collection_date\"
A4,3,0,2,1,1,N,\"$title.$name1\"
A$jarak,20,0,2,1,1,N,\"$name2\"
A325,25,0,2,1,1,N,\"$sex {$age}Y\"
A4,47,0,2,1,1,N,\"$sample\"
A204,47,0,2,1,1,N,\"DoB: $birthdate\"
B37,68,0,1,4,8,70,N,\"$barcode\"
A115,143,0,2,1,1,N,\"SAM# $barcode\"
A4,165,0,2,1,1,N,\"RM:$uhid\"
A195,165,0,2,1,1,N,\"$collection_date\"
P1
";
}
public function printerLab() {
exec('net use L: \\\\10.148.5.20\\Labelshare /user:Administrator 2>&1', $output, $return_var);
$pathNetworkFolder = 'L:/Sampling_Labels/';
$letterPath = 'L:';
return array($pathNetworkFolder, $letterPath);
}
public function printerSampling() {
exec('net use S: \\\\10.148.3.169\\Labelshare /user:Administrator 2>&1', $output, $return_var);
$pathNetworkFolder = 'S:/Sampling_Labels/';
$letterPath = 'S:';
return array($pathNetworkFolder, $letterPath);
return $sampleLabel;
}
public function printSingle($access, $sampletype) {
$time = microtime(true);
$logTime = date('d-m-Y_H_i_s', $time) . sprintf('_%03d', ($time - floor($time)) * 1000);
$filename = "sample_".$logTime;
$filename = "sample(".$sampletype.")_".$logTime;
$role = session()->get('userrole');
$networkPath = "";
@ -296,7 +309,7 @@ P1
$label = $this->labelPostek($sample, $title, $name, $sex, $age, $barcode, $uhid, $bv, $collectiondate, $birthdate);
} else if ($role === 'sampling') {
$printer = $this->printerSampling();
$label = $this->labelZebra($sample, $title, $name, $sex, $age, $barcode, $uhid, $bv, $collectiondate);
$label = $this->labelZebra($sample, $title, $name, $sex, $age, $barcode, $uhid, $bv, $collectiondate, $birthdate);
} else {
// Eksekusi Kode Berikut Apabila Role Bukan Analis atau Sampling
return $this->response->setJSON([
@ -341,6 +354,6 @@ P1
$sample = $data['SAMPLETYPE'];
$this->printSingle($access, $sample);
}
$this->labelPostekCollection($access);
$this->labelCollection($access);
}
}

View File

@ -35,7 +35,7 @@ class PrintLabelSby extends BaseController {
$time = microtime(true);
$logTime = date('d-m-Y_H_i_s', $time) . sprintf('_%03d', ($time - floor($time)) * 1000);
$filename = "sample_".$logTime;
$filename = "collection(".$access.")_".$logTime;
$role = session()->get('userrole');
$networkPath = "";
@ -171,7 +171,7 @@ class PrintLabelSby extends BaseController {
$time = microtime(true);
$logTime = date('d-m-Y_H_i_s', $time) . sprintf('_%03d', ($time - floor($time)) * 1000);
$filename = "sample_".$logTime;
$filename = "sample(".$sampletype.")_".$logTime;
$role = session()->get('userrole');
$networkPath = "";

View File

@ -3,7 +3,7 @@
<div class="sb-sidenav-menu">
<div class="nav">
<div class="sb-sidenav-menu-heading">Main</div>
<a class="nav-link" href="<?=base_url();?>user/"><div class="sb-nav-link-icon"><i class="bi bi-speedometer"></i></div>Dashboard</a>
<a class="nav-link" href="<?=base_url();?>fo/"><div class="sb-nav-link-icon"><i class="bi bi-speedometer"></i></div>Dashboard</a>
<a class="nav-link" href="<?=base_url();?>changePass/"><div class="sb-nav-link-icon"><i class="bi bi-key"></i></div>Change Password</a>
</div>
</div>

View File

@ -3,7 +3,7 @@
<div class="sb-sidenav-menu">
<div class="nav">
<div class="sb-sidenav-menu-heading">Main</div>
<a class="nav-link" href="<?=base_url();?>user/"><div class="sb-nav-link-icon"><i class="bi bi-speedometer"></i></div>Dashboard</a>
<a class="nav-link" href="<?=base_url();?>sampling/"><div class="sb-nav-link-icon"><i class="bi bi-speedometer"></i></div>Dashboard</a>
<a class="nav-link" href="<?=base_url();?>changePass/"><div class="sb-nav-link-icon"><i class="bi bi-key"></i></div>Change Password</a>
</div>
</div>