Perbaikan Label(RM, VN, Colldate) dan Hasil Result

This commit is contained in:
mikael-zakaria 2024-12-17 08:42:59 +08:00
parent a184263214
commit 736ea4d356
2 changed files with 33 additions and 27 deletions

View File

@ -3,7 +3,7 @@ namespace App\Controllers;
class PrintLabel extends BaseController { class PrintLabel extends BaseController {
public function labelPostek($sample, $title, $name, $sex, $age, $barcode, $uhid, $bv ) { public function labelPostek($sample, $title, $name, $sex, $age, $barcode, $uhid, $bv, $collection_date) {
// Printer Posteck // Printer Posteck
$sampleLabel ="N $sampleLabel ="N
OD OD
@ -14,19 +14,19 @@ D10
A4,3,0,2,1,1,N,\"$title.$name\" A4,3,0,2,1,1,N,\"$title.$name\"
A4,25,0,2,1,1,N,\"$sex {$age}Y\" A4,25,0,2,1,1,N,\"$sex {$age}Y\"
A4,55,0,2,1,1,N,\"$sample\" A4,55,0,2,1,1,N,\"$sample\"
A4,75,0,2,1,1,N,\"\" A4,75,0,2,1,1,N,\"Chapter\"
B149,35,0,1,3,8,70,N,\"$barcode\" B149,35,0,1,3,8,70,N,\"$barcode\"
A199,110,0,2,1,1,N,\"LAB $barcode\" A195,110,0,2,1,1,N,\"SAM# $barcode\"
A4,140,0,2,1,1,N,\"UH : $uhid\" A4,140,0,2,1,1,N,\"RM : $uhid\"
A4,160,0,2,1,1,N,\"BV : $bv\" A4,160,0,2,1,1,N,\"VN : $bv\"
A195,156,0,2,1,1,N,\"Tgl Coll\" A195,156,0,2,1,1,N,\"$collection_date\"
P1 P1
"; ";
return $sampleLabel; return $sampleLabel;
} }
public function labelZebra($sample, $title, $name, $sex, $age, $barcode, $uhid, $bv ) { public function labelZebra($sample, $title, $name, $sex, $age, $barcode, $uhid, $bv, $collection_date) {
$sampleLabel ="N $sampleLabel ="N
OD OD
q400 q400
@ -36,12 +36,12 @@ D10
A4,3,0,2,1,1,N,\"$title.$name\" A4,3,0,2,1,1,N,\"$title.$name\"
A4,25,0,2,1,1,N,\"$sex {$age}Y\" A4,25,0,2,1,1,N,\"$sex {$age}Y\"
A4,55,0,2,1,1,N,\"$sample\" A4,55,0,2,1,1,N,\"$sample\"
A4,75,0,2,1,1,N,\"\" A4,75,0,2,1,1,N,\"Chapter\"
B149,35,0,1,3,8,70,N,\"$barcode\" B149,35,0,1,3,8,70,N,\"$barcode\"
A199,110,0,2,1,1,N,\"LAB $barcode\" A195,110,0,2,1,1,N,\"SAM# $barcode\"
A4,140,0,2,1,1,N,\"UH : $uhid\" A4,140,0,2,1,1,N,\"RM : $uhid\"
A4,160,0,2,1,1,N,\"BV : $bv\" A4,160,0,2,1,1,N,\"VN : $bv\"
A195,156,0,2,1,1,N,\"Tgl Coll\" A195,156,0,2,1,1,N,\"$collection_date\"
P1 P1
"; ";
@ -72,15 +72,15 @@ P1
$db = \Config\Database::connect(); $db = \Config\Database::connect();
$sql = "select p.PATNUMBER as UHID, sr.HOSTORDERNUMBER as BV, p.NAME, p.SEX, $sql = "select p.PATNUMBER as UHID, sr.HOSTORDERNUMBER as BV, p.NAME, p.SEX,
DATEDIFF(YEAR, BirthDate, GETDATE()) - DATEDIFF(YEAR, BirthDate, GETDATE()) -
CASE WHEN MONTH(BirthDate) > MONTH(GETDATE()) OR (MONTH(BirthDate) = MONTH(GETDATE()) AND DAY(BirthDate) > DAY(GETDATE())) THEN 1 CASE WHEN MONTH(BirthDate) > MONTH(GETDATE()) OR (MONTH(BirthDate) = MONTH(GETDATE()) AND DAY(BirthDate) > DAY(GETDATE())) THEN 1
ELSE 0 END AS AGE, ELSE 0 END AS AGE,
ds.FULLTEXT, st.SAMPLETYPE+right(sr.SP_ACCESSNUMBER,5) as BARCODE, getdate() as COLLDATE ds.FULLTEXT, st.SAMPLETYPE+right(sr.SP_ACCESSNUMBER,5) as BARCODE, sr.COLLECTIONDATE
from SP_TUBES st from SP_TUBES st
left join SP_REQUESTS sr on st.SP_ACCESSNUMBER=sr.SP_ACCESSNUMBER left join SP_REQUESTS sr on st.SP_ACCESSNUMBER=sr.SP_ACCESSNUMBER
left join PATIENTS p on p.PATID=sr.PATID left join PATIENTS p on p.PATID=sr.PATID
left join DICT_SAMPLES_TYPES ds on ds.SAMPCODE=st.SAMPLETYPE left join DICT_SAMPLES_TYPES ds on ds.SAMPCODE=st.SAMPLETYPE
where st.SP_ACCESSNUMBER='$access' AND ds.SAMPCODE = '$sampletype'"; where st.SP_ACCESSNUMBER='$access' AND ds.SAMPCODE = '$sampletype'";
$query = $db->query($sql); $query = $db->query($sql);
$results = $query->getResultArray(); $results = $query->getResultArray();
@ -94,15 +94,21 @@ where st.SP_ACCESSNUMBER='$access' AND ds.SAMPCODE = '$sampletype'";
$sample = $item['FULLTEXT']; $sample = $item['FULLTEXT'];
$barcode = $item['BARCODE']; $barcode = $item['BARCODE'];
$age = $item['AGE']; $age = $item['AGE'];
$colldate = $item['COLLDATE']; $collectiondate = $item['COLLECTIONDATE'];
$date = \DateTime::createFromFormat('Y-m-d H:i:s.v', $collectiondate);
if ($date) {
$collectiondate = $date->format('d/m/Y H:i');
} else {
$collectiondate = "";
}
// Ruang Analis Printer POSTEK C168/200s // Ruang Analis Printer POSTEK C168/200s
if ($role === 'admin' || $role === 'user') { if ($role === 'admin' || $role === 'user') {
$printer = $this->printerLab(); $printer = $this->printerLab();
$label = $this->labelPostek($sample, $title, $name, $sex, $age, $barcode, $uhid, $bv ); $label = $this->labelPostek($sample, $title, $name, $sex, $age, $barcode, $uhid, $bv, $collectiondate);
} else if ($role === 'sampling') { } else if ($role === 'sampling') {
$printer = $this->printerSampling(); $printer = $this->printerSampling();
$label = $this->labelZebra($sample, $title, $name, $sex, $age, $barcode, $uhid, $bv ); $label = $this->labelZebra($sample, $title, $name, $sex, $age, $barcode, $uhid, $bv, $collectiondate);
} else { } else {
// Eksekusi Kode Berikut Apabila Role Bukan Analis atau Sampling // Eksekusi Kode Berikut Apabila Role Bukan Analis atau Sampling
return $this->response->setJSON([ return $this->response->setJSON([
@ -133,7 +139,7 @@ where st.SP_ACCESSNUMBER='$access' AND ds.SAMPCODE = '$sampletype'";
// Hapus Koneksi // Hapus Koneksi
//exec('net use '. $letterPath .' /delete 2>&1', $output, $return_var); //exec('net use '. $letterPath .' /delete 2>&1', $output, $return_var);
return $this->response->setJSON( [ return $this->response->setJSON( [
'message' => "Print Berhasil", 'message' => "Print Berhasil!" ,
'status' => true, 'status' => true,
]); ]);
} }

View File

@ -169,7 +169,7 @@ class PrintResult extends BaseController {
<td align='right'>dr. I Komang Parwata Sp.PK</td> <td align='right'>dr. I Komang Parwata Sp.PK</td>
</tr> </tr>
<tr> <tr>
<td>Mrs. Gst Ayu Riska Mastari</td> <td>Mrs. Gusti Ayu Riska Mastari</td>
<td align='right'>Reg. No: 570/SIPDS/0001/I/DPMPTSP/2023</td> <td align='right'>Reg. No: 570/SIPDS/0001/I/DPMPTSP/2023</td>
</tr> </tr>
</table> </table>