From 7e2192c1d1c46bc93eedca0fd2fe70295be2f8b4 Mon Sep 17 00:00:00 2001 From: mikael-zakaria Date: Tue, 3 Dec 2024 21:31:31 +0800 Subject: [PATCH] update Prints Controller --- app/Controllers/Prints.php | 72 +++++++++++++++++++++----------------- 1 file changed, 39 insertions(+), 33 deletions(-) diff --git a/app/Controllers/Prints.php b/app/Controllers/Prints.php index 30b771a..b729cd8 100644 --- a/app/Controllers/Prints.php +++ b/app/Controllers/Prints.php @@ -18,45 +18,49 @@ class Prints extends BaseController { // $endSection = "^XZ"; public function sample($access, $sample) { - - // $access = (string) $access; - // $sample = (string) $sample; - - // Buka Mapping Drive PC LAB - // exec('net use L: \\\\10.148.5.20\\Labelshare /user:Administrator 2>&1', $output, $return_var); - // $pathNetworkFolder = 'L:/Sampling_Labels/'; - - // 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/'; $time = microtime(true); $logTime = date('d-m-Y_H_i_s', $time) . sprintf('_%03d', ($time - floor($time)) * 1000); - $filename = "sample_".$logTime; -// Printer Posteck -// $sampleLable ="N -// OD -// q400 -// Q200,10+0 -// I8,A,001 -// D10 -// A4,3,0,2,1,1,N,\"Mr.I Putu Agus Ariesta Adi Wawan\" -// A4,25,0,2,1,1,N,\"M 29Y\" -// A4,55,0,2,1,1,N,\"SAMPLE\" -// A4,75,0,2,1,1,N,\"Chapter\" -// B149,35,0,1,3,8,70,N,\"24020840\" -// A199,110,0,2,1,1,N,\"LAB 24020840\" -// A4,140,0,2,1,1,N,\"UH : 1B094943\" -// A4,160,0,2,1,1,N,\"BV : BV035725\" -// A195,156,0,2,1,1,N,\"03/12/2024 07:10\" + $roles = ['Analis', 'Sampling']; -// P1 -// "; + // Ruang Analis Printer POSTEK + if (in_array('Analis', $roles)) { -// Printer Zebra -$sampleLable ="N + // 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/'; + + // Printer Posteck + $sampleLable ="N +OD +q400 +Q200,10+0 +I8,A,001 +D10 +A4,3,0,2,1,1,N,\"Mr.I Putu Agus Ariesta Adi Wawan\" +A4,25,0,2,1,1,N,\"M 29Y\" +A4,55,0,2,1,1,N,\"SAMPLE\" +A4,75,0,2,1,1,N,\"Chapter\" +B149,35,0,1,3,8,70,N,\"24020840\" +A199,110,0,2,1,1,N,\"LAB 24020840\" +A4,140,0,2,1,1,N,\"UH : 1B094943\" +A4,160,0,2,1,1,N,\"BV : BV035725\" +A195,156,0,2,1,1,N,\"03/12/2024 07:10\" + +P1 +"; + + // Ruang Analis Printer Zebra + } else if (in_array('', $roles)) { + + // 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/'; + + // Printer Zebra + $sampleLable ="N OD q400 Q185,10+0 @@ -74,6 +78,8 @@ A195,156,0,2,1,1,N,\"03/12/2024 07:10\" P1 "; + } + $fullPath = $pathNetworkFolder . $filename; // Tulis file ke folder tujuan @@ -86,7 +92,7 @@ P1 } // Hapus Koneksi - exec('net use S: /delete 2>&1', $output, $return_var); + exec('net use L: /delete 2>&1', $output, $return_var); return $this->response->setJSON( [ 'message' => "Print Berhasil",