Penggantian Label untuk LAB alat TMS30
This commit is contained in:
parent
059f5ce04a
commit
871a5e1cde
@ -3,7 +3,45 @@ namespace App\Controllers;
|
|||||||
|
|
||||||
class PrintLabel extends BaseController {
|
class PrintLabel extends BaseController {
|
||||||
|
|
||||||
|
public function splitName($fullName) {
|
||||||
|
$words = explode(' ', $fullName); // Pisahkan nama berdasarkan spasi
|
||||||
|
$line1 = '';
|
||||||
|
$line2 = '';
|
||||||
|
|
||||||
|
// Tambahkan kata-kata ke baris pertama hingga mencapai batas 20 karakter
|
||||||
|
foreach ($words as $word) {
|
||||||
|
if (strlen($line1 . ' ' . $word) <= 27) {
|
||||||
|
$line1 .= (empty($line1) ? '' : ' ') . $word;
|
||||||
|
} else {
|
||||||
|
// Setelah line1 penuh, pindahkan kata ke line2
|
||||||
|
if (strlen($line2 . ' ' . $word) <= 19) {
|
||||||
|
$line2 .= (empty($line2) ? '' : ' ') . $word;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Jika Line 2 lebih dari 19 karakter, hapus kata terakhir sampai sesuai
|
||||||
|
while (strlen($line2) > 19) {
|
||||||
|
$wordsLine2 = explode(' ', $line2);
|
||||||
|
array_pop($wordsLine2); // Hapus kata terakhir
|
||||||
|
$line2 = implode(' ', $wordsLine2); // Gabungkan kembali
|
||||||
|
}
|
||||||
|
|
||||||
|
// Kembalikan kedua baris sebagai array
|
||||||
|
return ['line1' => $line1, 'line2' => $line2];
|
||||||
|
}
|
||||||
|
|
||||||
public function labelPostek($sample, $title, $name, $sex, $age, $barcode, $uhid, $bv, $collection_date) {
|
public function labelPostek($sample, $title, $name, $sex, $age, $barcode, $uhid, $bv, $collection_date) {
|
||||||
|
$fixName = $this->splitName($name);
|
||||||
|
$name1 = $fixName['line1'];
|
||||||
|
$name2 = $fixName['line2'];
|
||||||
|
|
||||||
|
if ($sex == 'M') {
|
||||||
|
$jarak = '42';
|
||||||
|
} else {
|
||||||
|
$jarak = '53';
|
||||||
|
}
|
||||||
|
|
||||||
// Printer Posteck
|
// Printer Posteck
|
||||||
$sampleLabel ="N
|
$sampleLabel ="N
|
||||||
OD
|
OD
|
||||||
@ -11,18 +49,37 @@ q400
|
|||||||
Q200,10+0
|
Q200,10+0
|
||||||
I8,A,001
|
I8,A,001
|
||||||
D10
|
D10
|
||||||
A4,3,0,2,1,1,N,\"$title.$name\"
|
A4,3,0,2,1,1,N,\"$title.$name1\"
|
||||||
A4,25,0,2,1,1,N,\"$sex {$age}Y\"
|
A$jarak,20,0,2,1,1,N,\"$name2\"
|
||||||
A4,55,0,2,1,1,N,\"$sample\"
|
A325,25,0,2,1,1,N,\"$sex {$age}Y\"
|
||||||
A4,75,0,2,1,1,N,\"Chapter\"
|
A4,47,0,2,1,1,N,\"$sample\"
|
||||||
B149,35,0,1,3,8,70,N,\"$barcode\"
|
A265,47,0,2,1,1,N,\"Chapter\"
|
||||||
A195,110,0,2,1,1,N,\"SAM# $barcode\"
|
B37,70,0,1,4,8,70,N,\"$barcode\"
|
||||||
A4,140,0,2,1,1,N,\"RM : $uhid\"
|
A130,145,0,1,1,1,N,\"SAM# $barcode\"
|
||||||
A4,160,0,2,1,1,N,\"VN : $bv\"
|
A4,167,0,2,1,1,N,\"RM:$uhid\"
|
||||||
A195,156,0,2,1,1,N,\"$collection_date\"
|
A195,167,0,2,1,1,N,\"$collection_date\"
|
||||||
|
|
||||||
P1
|
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;
|
return $sampleLabel;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user