From 924ed2354a9103d4f567e7681a193ec4c19f6f25 Mon Sep 17 00:00:00 2001 From: mahdahar <89adham@gmail.com> Date: Mon, 9 Dec 2024 13:10:16 +0700 Subject: [PATCH] first refactor printLabel printResult --- app/Config/Routes.php | 6 +- app/Controllers/PrintLabel.php | 150 ++++++ app/Controllers/PrintResult.php | 265 ++++++++++ app/Controllers/PrinterController.php | 548 -------------------- app/Views/admin/dashboard.php | 2 +- app/Views/admin/dashboard_viewAccess.php | 14 +- app/Views/fo/dashboard.php | 2 +- app/Views/fo/dashboard_viewAccess.php | 2 + app/Views/sampling/dashboard.php | 2 +- app/Views/sampling/dashboard_viewAccess.php | 2 + app/Views/user/dashboard.php | 2 +- app/Views/user/dashboard_viewAccess.php | 2 + 12 files changed, 435 insertions(+), 562 deletions(-) create mode 100644 app/Controllers/PrintLabel.php create mode 100644 app/Controllers/PrintResult.php delete mode 100644 app/Controllers/PrinterController.php diff --git a/app/Config/Routes.php b/app/Config/Routes.php index 232a10c..2f5bb91 100644 --- a/app/Config/Routes.php +++ b/app/Config/Routes.php @@ -92,6 +92,6 @@ $routes->group('fo', ['filter' => 'role:fo'], static function ($routes) { }); // Printers -$routes->get('prints/single_sample/(:any)/(:any)', 'PrinterController::printSingleSampleBarcode/$1/$2'); -$routes->get('prints/all_sample/(:any)', 'PrinterController::printAllSampleBarcode/$1'); -$routes->get('prints/result_test/(:any)', 'PrinterController::printResultTest/$1'); \ No newline at end of file +$routes->get('printLabel/single/(:any)/(:any)', 'PrintLabel::printSingle/$1/$2'); +$routes->get('printLabel/all/(:any)', 'PrintLabel::printAll/$1'); +$routes->get('printResult/(:any)', 'PrintResult::printResultTest/$1'); \ No newline at end of file diff --git a/app/Controllers/PrintLabel.php b/app/Controllers/PrintLabel.php new file mode 100644 index 0000000..f4e3829 --- /dev/null +++ b/app/Controllers/PrintLabel.php @@ -0,0 +1,150 @@ +&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 printSingle($access, $sampletype) { + + $time = microtime(true); + $logTime = date('d-m-Y_H_i_s', $time) . sprintf('_%03d', ($time - floor($time)) * 1000); + $filename = "sample_".$logTime; + + $role = session()->get('userrole'); + $networkPath = ""; + + $db = \Config\Database::connect(); + $sql = "select p.PATNUMBER as UHID, sr.HOSTORDERNUMBER as BV, p.NAME, p.SEX, +DATEDIFF(YEAR, BirthDate, GETDATE()) - + CASE WHEN MONTH(BirthDate) > MONTH(GETDATE()) OR (MONTH(BirthDate) = MONTH(GETDATE()) AND DAY(BirthDate) > DAY(GETDATE())) THEN 1 + ELSE 0 END AS AGE, +ds.FULLTEXT, st.SAMPLETYPE+right(sr.SP_ACCESSNUMBER,5) as BARCODE, getdate() as COLLDATE +from SP_TUBES st +left join SP_REQUESTS sr on st.SP_ACCESSNUMBER=sr.SP_ACCESSNUMBER +left join PATIENTS p on p.PATID=sr.PATID +left join DICT_SAMPLES_TYPES ds on ds.SAMPCODE=st.SAMPLETYPE +where st.SP_ACCESSNUMBER='$access' AND ds.SAMPCODE = '$sampletype'"; + + $query = $db->query($sql); + $results = $query->getResultArray(); + $item = $results[0]; + + $uhid = substr($item['UHID'], -10); + $bv = $item['BV']; + $sex = $item['SEX'] == 1 ? "M" : "F"; + $title = $item['SEX'] == 1 ? "Mr" : "Mrs"; + $name = $item['NAME']; + $sample = $item['FULLTEXT']; + $barcode = $item['BARCODE']; + $age = $item['AGE']; + $colldate = $item['COLLDATE']; + + // Ruang Analis Printer POSTEK C168/200s + if ($role === 'admin' || $role === 'user') { + //$printer = $this->printerLab(); + $label = $this->labelPostek($sample, $title, $name, $sex, $age, $barcode, $uhid, $bv ); + } else if ($role === 'sampling') { + //$printer = $this->printerSampling(); + $label = $this->labelZebra($sample, $title, $name, $sex, $age, $barcode, $uhid, $bv ); + } else { + // Eksekusi Kode Berikut Apabila Role Bukan Analis atau Sampling + return $this->response->setJSON([ + 'message' => "Akses Tidak Berwenang", + 'error' => "Hak Akses Anda Tidak Dikenali", + 'status' => false, + ]); + } + + $folder = "C:/data/"; + $fullPath = $folder . $filename; + + // Tulis file ke folder tujuan + if (!file_put_contents($fullPath, $label)) { + + //exec('net use '. $letterPath .' /delete 2>&1', $output, $return_var); + // Eksekusi Kode Berikut Apabila Ada Error + return $this->response->setJSON([ + 'error' => $output, + 'message' => "Gagal Melakukan Print, Mohon Ulangi Atau Cek Koneksi Printer Anda", + 'status' => false, + ]); + + } else { + + // Hapus Koneksi + //exec('net use '. $letterPath .' /delete 2>&1', $output, $return_var); + return $this->response->setJSON( [ + 'message' => "Print Berhasil", + 'status' => true, + ]); + } + } + + public function printAll($access) { + $db = \Config\Database::connect(); + $sql = "select SAMPLETYPE from SP_TUBES where SP_ACCESSNUMBER='$access'"; + $query = $db->query($sql); + $results = $query->getResultArray(); + foreach($results as $data) { + $sample = $data['SAMPLETYPE']; + $this->printSingle($access, $sample); + } + } +} \ No newline at end of file diff --git a/app/Controllers/PrintResult.php b/app/Controllers/PrintResult.php new file mode 100644 index 0000000..9dfff25 --- /dev/null +++ b/app/Controllers/PrintResult.php @@ -0,0 +1,265 @@ + +
+ + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
CLINICAL LABORATORY
UHID:1BCJJAJSDKSample ID:LAB2420076951
Name:Ni Luh Putu Eka Putri Saraswati Specimen:Serum
Age/Gender:22 year(s) / MaleCollection Date/Time:26-10-2024 / 11:55:04
Speciality:Result Date/Time:26-10-2024 / 11:52:04
+ +
+ +
+
+ + + + + + + + + + + "; + + $resultTest =""; + + $item = end($access); + + $resultNoteandSpecimen = " +
+ +
ParameterResultUnitNormal RangeNotes
+ + + + + + +
Notes
+ ".$item['RESVALUE']." +
+ +
+ + + + + + + + +
Collection datetime : - 
Reception datetime  : - 
+ "; + $footerPage = " + + "; + $lastDiv="
"; + + + $tempChapEng = ""; + $tempChapInd = ""; + + array_pop($access); + + $i=0; + foreach ($access as $item) { + + if ($tempChapEng != $item['chap_eng']) { + $tempChapEng = $item['chap_eng']; + $tempChapInd = $item['chap_ind']; + + $i++; + // Untuk Chapter + $resultTest .= " + + +
".$tempChapEng."
+
 ".$tempChapInd."
+ + + "; + + } + + // Melebihi batas Kertas + if($i % 24 == 0) { + $resultTest .= ""; + $fullPage .= $headPage.$resultTest.$footerPage.$lastDiv; + $i=0; + $resultTest = ""; + } + + $i++; + if ($item['RESTYPE'] == "CE"){ + $resvalue = $item['RESULT']; + } else { + $resvalue = $item['RESVALUE']; + } + $resultTest .= " + + +
 ".$item["test_eng"]."
+
  ".$item["test_ind"]."
+ + " . $resvalue . " + " . $item["UNIT"] . " + " . $item["REFRANGE"] . " + " . " " . " + + "; + + + // Melebihi batas Kertas + if($i % 24 == 0) { + $resultTest .= ""; + $fullPage .= $headPage.$resultTest.$footerPage.$lastDiv; + $i=0; + $resultTest = ""; + } + + } + + $resultTest .= " + + ".$resultNoteandSpecimen." + "; + + $fullPage .= $headPage.$resultTest.$footerPage.$lastDiv; + + return $fullPage; + } + + public function printResultTest($access) { + $db = \Config\Database::connect(); + $sql = " + select dc.CHAPID, dc.FULLTEXT as chap_eng,dc.FULLTEXT as chap_ind, + RESULT=case when cr.RESTYPE in('NM','TX') then cr.RESVALUE when cr.RESTYPE='CE' then tx.FULLTEXT end, + cr.*, cdt.TEXT1 as test_eng, cdt.TEXT2 as test_ind + from cmod.dbo.CM_RESULTS cr + left join REQUESTS r on r.ACCESSNUMBER=cr.ACCESSNUMBER + left join cmod.dbo.CM_DICT_TESTS cdt on cr.TESTCODE=cdt.TESTCODE + left join DICT_TESTS dt on dt.TESTCODE=cr.TESTCODE and dt.ENDVALIDDATE is null + left join TESTS t on t.REQUESTID = r.REQUESTID and t.TESTID=dt.TESTID + left join DICT_TEXTS tx on tx.TEXTID=t.CODEDRESULTID + left join DICT_CHAPTERS dc on dc.CHAPID=dt.CHAPID and dc.ENDVALIDDATE is null + left join cmod.dbo.CM_DICT_CHAPTERS cdc on cdc.CHAPCODE=dc.CHAPCODE + where cr.ACCESSNUMBER='$access' + ORDER BY + CASE + WHEN cr.TESTCODE = 'NOTE' THEN 1 + ELSE 0 + END, + t.TESTORDER; + "; + + $query = $db->query($sql); + $results = $query->getResultArray(); + + + $data_urine = array_filter($results, function($item) { + $chapterid = $item["CHAPID"]; + $tesscode = $item['TESTCODE']; + // Memfilter data dengan CHAPID 3, 61, atau 62 + return $chapterid == 3 || $chapterid == 61 || $chapterid == 62 || $tesscode == 'NOTE'; + }); + + // Seleksi data yang mengandung "FESES" + $data_feces = array_filter($results, function($item) { + $chapterid = $item["CHAPID"]; + $tesscode = $item['TESTCODE']; + // Memfilter data yang 4 + return $chapterid == 4 || $tesscode == 'NOTE'; + }); + // Seleksi data yang tidak mengandung "urine" dan "feces" + $data_others = array_filter($results, function($item) { + $chapterid = $item["CHAPID"]; + $tesscode = $item['TESTCODE']; + // Memfilter data yang bukan 61 atau 3 + return $chapterid !== 3 && $chapterid !== 4 && $chapterid !== 61 && $chapterid !== 62 || $tesscode == 'NOTE'; + }); + + $fullPage = ""; + + if ($data_urine != null && count($data_urine) > 1) { + $fullPage .= $this->otherTests($data_urine); + } + if ($data_feces != null && count($data_feces) > 1) { + $fullPage .= $this->otherTests($data_feces); + } + if ($data_others != null && count($data_others) > 1) { + $fullPage .= $this->otherTests($data_others); + } + + return view('result_report', ['data' => $fullPage]); + } + +} \ No newline at end of file diff --git a/app/Controllers/PrinterController.php b/app/Controllers/PrinterController.php deleted file mode 100644 index 817f5ae..0000000 --- a/app/Controllers/PrinterController.php +++ /dev/null @@ -1,548 +0,0 @@ -get('userrole'); - $networkPath = ""; - - $db = \Config\Database::connect(); - $sql = "select p.PATNUMBER as UHID, sr.HOSTORDERNUMBER as BV, p.NAME, p.SEX, p.BIRTHDATE, st.SAMPLETYPE, ds.FULLTEXT, st.SAMPLETYPE+right(sr.SP_ACCESSNUMBER,5) as barcode - from SP_TUBES st - left join SP_REQUESTS sr on st.SP_ACCESSNUMBER=sr.SP_ACCESSNUMBER - left join PATIENTS p on p.PATID=sr.PATID - left join DICT_SAMPLES_TYPES ds on ds.SAMPCODE=st.SAMPLETYPE - where st.SP_ACCESSNUMBER='$access' AND ds.FULLTEXT = '$sample'"; - - $query = $db->query($sql); - $results = $query->getResultArray(); - $item = $results[0]; - - $uhid = substr($item['UHID'], -10); - $bv = $item['BV']; - $sex = $item['SEX'] == 1 ? "M" : "F"; - $title = $item['SEX'] == 1 ? "Mr" : "Mrs"; - $name = $item['NAME']; - $sample = $item['FULLTEXT']; - $barcode = $item['barcode']; - - // Ruang Analis Printer POSTEK C168/200s - if ($role === 'admin' || $role === 'user') { - - // Buka Mapping Drive PC Laboratorium - exec('net use L: \\\\10.148.5.20\\Labelshare /user:Administrator 2>&1', $output, $return_var); - $pathNetworkFolder = 'L:/Sampling_Labels/'; - $letterPath = 'L:'; - - // Printer Posteck - $sampleLable ="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 USIA\" -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\" -A199,110,0,2,1,1,N,\"LAB $barcode\" -A4,140,0,2,1,1,N,\"UH : $uhid\" -A4,160,0,2,1,1,N,\"BV : $bv\" -A195,156,0,2,1,1,N,\"Tgl Coll\" - -P1 -"; - - // Ruang Analis Printer Zebra - } else if ($role === 'sampling') { - - // Buka Mapping Drive PC Sampling - exec('net use S: \\\\10.148.3.169\\Labelshare /user:Administrator 2>&1', $output, $return_var); - $pathNetworkFolder = 'S:/Sampling_Labels/'; - $letterPath = 'S:'; - - // Printer Zebra - $sampleLable ="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 USIA\" -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\" -A199,110,0,2,1,1,N,\"LAB $barcode\" -A4,140,0,2,1,1,N,\"UH : $uhid\" -A4,160,0,2,1,1,N,\"BV : $bv\" -A195,156,0,2,1,1,N,\"Tgl Coll\" - -P1 -"; - } else { - // Eksekusi Kode Berikut Apabila Role Bukan Analis atau Sampling - return $this->response->setJSON([ - 'message' => "Akses Tidak Berwenang", - 'error' => "Hak Akses Anda Tidak Dikenali", - 'status' => false, - ]); - } - - $fullPath = $pathNetworkFolder . $filename; - - // Tulis file ke folder tujuan - if (!file_put_contents($fullPath, $sampleLable)) { - - exec('net use '. $letterPath .' /delete 2>&1', $output, $return_var); - // Eksekusi Kode Berikut Apabila Ada Error - return $this->response->setJSON([ - 'error' => $output, - 'message' => "Gagal Melakukan Print, Mohon Ulangi Atau Cek Koneksi Printer Anda", - 'status' => false, - ]); - - } else { - - // Hapus Koneksi - exec('net use '. $letterPath .' /delete 2>&1', $output, $return_var); - return $this->response->setJSON( - [ - 'message' => "Print Berhasil", - 'status' => true, - ] - ); - } - } - - public function printAllSampleBarcode($access) { - - $role = session()->get('userrole'); - $networkPath = ""; - - $db = \Config\Database::connect(); - $sql = "select p.PATNUMBER as UHID, sr.HOSTORDERNUMBER as BV, p.NAME, p.SEX, p.BIRTHDATE, st.SAMPLETYPE, ds.FULLTEXT, st.SAMPLETYPE+right(sr.SP_ACCESSNUMBER,5) as barcode - from SP_TUBES st - left join SP_REQUESTS sr on st.SP_ACCESSNUMBER=sr.SP_ACCESSNUMBER - left join PATIENTS p on p.PATID=sr.PATID - left join DICT_SAMPLES_TYPES ds on ds.SAMPCODE=st.SAMPLETYPE - where st.SP_ACCESSNUMBER='$access'"; - - $query = $db->query($sql); - $results = $query->getResultArray(); - - // Ruang Analis Printer POSTEK - if ($role === 'admin' || $role === 'user') { - - // Buka Mapping Drive PC Laboratorium - exec('net use L: \\\\10.148.5.20\\Labelshare /user:Administrator 2>&1', $output, $return_var); - $pathNetworkFolder = 'L:/Sampling_Labels/'; - $letterPath = 'L:'; - - // for ($i=0; $i<$data; $i++) { - - foreach($results as $item) { - - $time = microtime(true); - $logTime = date('d-m-Y_H_i_s', $time) . sprintf('_%03d', ($time - floor($time)) * 1000); - $filename = "sample_".$logTime; - - $uhid = substr($item['UHID'], -10); - $bv = $item['BV']; - $sex = $item['SEX'] == 1 ? "M" : "F"; - $title = $item['SEX'] == 1 ? "Mr" : "Mrs"; - $name = $item['NAME']; - $sample = $item['FULLTEXT']; - $barcode = $item['barcode']; - - // Printer Posteck - $sampleLable ="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 USIA\" -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\" -A199,110,0,2,1,1,N,\"LAB $barcode\" -A4,140,0,2,1,1,N,\"UH : $uhid\" -A4,160,0,2,1,1,N,\"BV : $bv\" -A195,156,0,2,1,1,N,\"Tgl Coll\" - -P1 -"; - $fullPath = $pathNetworkFolder . $filename; - - // Tulis file ke folder tujuan - if (!file_put_contents($fullPath, $sampleLable)) { - - exec('net use '. $letterPath .' /delete 2>&1', $output, $return_var); - // Eksekusi Kode Berikut Apabila Ada Error - return $this->response->setJSON([ - 'error' => $output, - 'message' => "Gagal Melakukan Print, Mohon Ulangi Atau Cek Koneksi Printer Anda", - 'status' => false, - ]); - } - } - - // Ruang Analis Printer Zebra - } else if ($role === 'sampling') { - - // Buka Mapping Drive PC Sampling - exec('net use S: \\\\10.148.3.169\\Labelshare /user:Administrator 2>&1', $output, $return_var); - $pathNetworkFolder = 'S:/Sampling_Labels/'; - $letterPath = 'S:'; - - foreach($results as $item) { - - $time = microtime(true); - $logTime = date('d-m-Y_H_i_s', $time) . sprintf('_%03d', ($time - floor($time)) * 1000); - $filename = "sample_".$logTime; - - $uhid = substr($item['UHID'], -10); - $bv = $item['BV']; - $sex = $item['SEX'] == 1 ? "M" : "F"; - $title = $item['SEX'] == 1 ? "Mr" : "Mrs"; - $name = $item['NAME']; - $sample = $item['FULLTEXT']; - $barcode = $item['barcode']; - - // Printer Zebra - $sampleLable ="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 USIA\" -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\" -A199,110,0,2,1,1,N,\"LAB $barcode\" -A4,140,0,2,1,1,N,\"UH : $uhid\" -A4,160,0,2,1,1,N,\"BV : $bv\" -A195,156,0,2,1,1,N,\"Tgl Coll\" - -P1 -"; - $fullPath = $pathNetworkFolder . $filename; - - // Tulis file ke folder tujuan - if (!file_put_contents($fullPath, $sampleLable)) { - - exec('net use '. $letterPath .' /delete 2>&1', $output, $return_var); - // Eksekusi Kode Berikut Apabila Ada Error - return $this->response->setJSON([ - 'error' => $output, - 'message' => "Gagal Melakukan Print, Mohon Ulangi Atau Cek Koneksi Printer Anda", - 'status' => false, - ]); - - } - } - - } else { - // Eksekusi Kode Berikut Apabila Role Bukan Analis atau Sampling - return $this->response->setJSON([ - 'message' => "Akses Tidak Berwenang", - 'error' => "Hak Akses Anda Tidak Dikenali", - 'status' => false, - ]); - } - - // Hapus Koneksi - exec('net use '. $letterPath .' /delete 2>&1', $output, $return_var); - return $this->response->setJSON( - [ - 'message' => "Print Berhasil", - 'status' => true, - ] - ); - - } - - public function otherTests($access){ - - $fullPage=""; - $headPage = " -
-
- - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CLINICAL LABORATORY
UHID:1BCJJAJSDKSample ID:LAB2420076951
Name:Ni Luh Putu Eka Putri Saraswati Specimen:Serum
Age/Gender:22 year(s) / MaleCollection Date/Time:26-10-2024 / 11:55:04
Speciality:Result Date/Time:26-10-2024 / 11:52:04
- -
- -
-
- - - - - - - - - - - "; - - $resultTest =""; - - $item = end($access); - - $resultNoteandSpecimen = " -
- -
ParameterResultUnitNormal RangeNotes
- - - - - - -
Notes
- ".$item['RESVALUE']." -
- -
- - - - - - - - -
Collection datetime : - 
Reception datetime  : - 
- "; - $footerPage = " - - "; - $lastDiv="
"; - - - $tempChapEng = ""; - $tempChapInd = ""; - - array_pop($access); - - $i=0; - foreach ($access as $item) { - - if ($tempChapEng != $item['chap_eng']) { - $tempChapEng = $item['chap_eng']; - $tempChapInd = $item['chap_ind']; - - $i++; - // Untuk Chapter - $resultTest .= " - - -
".$tempChapEng."
-
 ".$tempChapInd."
- - - "; - - } - - // Melebihi batas Kertas - if($i % 24 == 0) { - $resultTest .= "
"; - $fullPage .= $headPage.$resultTest.$footerPage.$lastDiv; - $i=0; - $resultTest = ""; - } - - $i++; - if ($item['RESTYPE'] == "CE"){ - $resvalue = $item['RESULT']; - } else { - $resvalue = $item['RESVALUE']; - } - $resultTest .= " - - -
 ".$item["test_eng"]."
-
  ".$item["test_ind"]."
- - " . $resvalue . " - " . $item["UNIT"] . " - " . $item["REFRANGE"] . " - " . " " . " - - "; - - - // Melebihi batas Kertas - if($i % 24 == 0) { - $resultTest .= ""; - $fullPage .= $headPage.$resultTest.$footerPage.$lastDiv; - $i=0; - $resultTest = ""; - } - - } - - $resultTest .= " - - ".$resultNoteandSpecimen." - "; - - $fullPage .= $headPage.$resultTest.$footerPage.$lastDiv; - - return $fullPage; - } - - public function printResultTest($access) { - $db = \Config\Database::connect(); - $sql = " - select dc.CHAPID, dc.FULLTEXT as chap_eng,dc.FULLTEXT as chap_ind, - RESULT=case when cr.RESTYPE in('NM','TX') then cr.RESVALUE when cr.RESTYPE='CE' then tx.FULLTEXT end, - cr.*, cdt.TEXT1 as test_eng, cdt.TEXT2 as test_ind - from cmod.dbo.CM_RESULTS cr - left join REQUESTS r on r.ACCESSNUMBER=cr.ACCESSNUMBER - left join cmod.dbo.CM_DICT_TESTS cdt on cr.TESTCODE=cdt.TESTCODE - left join DICT_TESTS dt on dt.TESTCODE=cr.TESTCODE and dt.ENDVALIDDATE is null - left join TESTS t on t.REQUESTID = r.REQUESTID and t.TESTID=dt.TESTID - left join DICT_TEXTS tx on tx.TEXTID=t.CODEDRESULTID - left join DICT_CHAPTERS dc on dc.CHAPID=dt.CHAPID and dc.ENDVALIDDATE is null - left join cmod.dbo.CM_DICT_CHAPTERS cdc on cdc.CHAPCODE=dc.CHAPCODE - where cr.ACCESSNUMBER='$access' - ORDER BY - CASE - WHEN cr.TESTCODE = 'NOTE' THEN 1 - ELSE 0 - END, - t.TESTORDER; - "; - - $query = $db->query($sql); - $results = $query->getResultArray(); - - - $data_urine = array_filter($results, function($item) { - $chapterid = $item["CHAPID"]; - $tesscode = $item['TESTCODE']; - // Memfilter data dengan CHAPID 3, 61, atau 62 - return $chapterid == 3 || $chapterid == 61 || $chapterid == 62 || $tesscode == 'NOTE'; - }); - - // Seleksi data yang mengandung "FESES" - $data_feces = array_filter($results, function($item) { - $chapterid = $item["CHAPID"]; - $tesscode = $item['TESTCODE']; - // Memfilter data yang 4 - return $chapterid == 4 || $tesscode == 'NOTE'; - }); - // Seleksi data yang tidak mengandung "urine" dan "feces" - $data_others = array_filter($results, function($item) { - $chapterid = $item["CHAPID"]; - $tesscode = $item['TESTCODE']; - // Memfilter data yang bukan 61 atau 3 - return $chapterid !== 3 && $chapterid !== 4 && $chapterid !== 61 && $chapterid !== 62 || $tesscode == 'NOTE'; - }); - - $fullPage = ""; - - if ($data_urine != null && count($data_urine) > 1) { - $fullPage .= $this->otherTests($data_urine); - } - if ($data_feces != null && count($data_feces) > 1) { - $fullPage .= $this->otherTests($data_feces); - } - if ($data_others != null && count($data_others) > 1) { - $fullPage .= $this->otherTests($data_others); - } - - return view('result_report', ['data' => $fullPage]); - } - -} \ No newline at end of file diff --git a/app/Views/admin/dashboard.php b/app/Views/admin/dashboard.php index 38183d2..d4d50f1 100644 --- a/app/Views/admin/dashboard.php +++ b/app/Views/admin/dashboard.php @@ -204,7 +204,7 @@ function viewAccess(access) { } function resultPdfAccess(access, event) { event.stopPropagation(); // Mencegah klik pada dieksekusi - let url = 'prints/result_test/'+access; + let url = 'printResult/'+access; window.open(url, '_blank'); } diff --git a/app/Views/admin/dashboard_viewAccess.php b/app/Views/admin/dashboard_viewAccess.php index d113dc3..4d7ed0f 100644 --- a/app/Views/admin/dashboard_viewAccess.php +++ b/app/Views/admin/dashboard_viewAccess.php @@ -34,10 +34,12 @@ $name = $row['NAME']; + $sampletext"; echo " - + @@ -76,10 +78,10 @@ $name = $row['NAME']; diff --git a/app/Views/fo/dashboard_viewAccess.php b/app/Views/fo/dashboard_viewAccess.php index f5c1758..361ba6a 100644 --- a/app/Views/fo/dashboard_viewAccess.php +++ b/app/Views/fo/dashboard_viewAccess.php @@ -34,10 +34,12 @@ $name = $row['NAME']; + dieksekusi - let url = 'prints/result_test/'+access; + let url = 'printResult/'+access; window.open(url, '_blank'); } diff --git a/app/Views/sampling/dashboard_viewAccess.php b/app/Views/sampling/dashboard_viewAccess.php index d113dc3..c2c1b3b 100644 --- a/app/Views/sampling/dashboard_viewAccess.php +++ b/app/Views/sampling/dashboard_viewAccess.php @@ -34,10 +34,12 @@ $name = $row['NAME']; + dieksekusi - let url = 'prints/result_test/'+access; + let url = 'printResult/'+access; window.open(url, '_blank'); } diff --git a/app/Views/user/dashboard_viewAccess.php b/app/Views/user/dashboard_viewAccess.php index d113dc3..c2c1b3b 100644 --- a/app/Views/user/dashboard_viewAccess.php +++ b/app/Views/user/dashboard_viewAccess.php @@ -34,10 +34,12 @@ $name = $row['NAME']; +