perbaikan label dan tambah ruang sampling
This commit is contained in:
parent
403e5ca620
commit
6b075d3341
@ -4,112 +4,52 @@ namespace App\Controllers;
|
||||
|
||||
class Prints extends BaseController {
|
||||
|
||||
// public function sample($access, $sample) {
|
||||
// // Path shared printer menggunakan format yang lebih jelas
|
||||
// // $printerPath = '\\\\10.148.5.20\\POSTEKCLAB'; // Path ke printer yang dibagikan
|
||||
// $fullPath = '\\\\10.148.5.20\\Labelshare'; // Path ke printer yang dibagikan
|
||||
|
||||
// // Data ZPL untuk mencetak label
|
||||
// // $startSection = "^XA\n^PW400\n^LL224\n";
|
||||
// // $nameSection = "^FO10,2\n^A0N,23,23\n^FD MRS. I PUTU AYU PUTRI PERTIWI ^FS\n";
|
||||
// // $yearSection = "^FO12,25\n^A0N,22,22\n^FD F 24Y ^FS\n";
|
||||
// // $labelBarcodeSection = "^FO85,50\n^BY2,2.0,45\n^BCN,100,N,N,N\n^FD25082257^FS\n";
|
||||
// // $numberCodeSection = "^FO374,43\n^A0B,25,25\n^FD 25082257 ^FS\n";
|
||||
// // $sampleSection = "^FO19,45\n^A0B,27,27\n^FD $sample ^FS\n";
|
||||
// // $parameterSection = "^FO10,165\n^A0N,23,23\n^FD PSA, HDL, LDL, BUN, SGOT ^FS\n";
|
||||
// // $lisNumSection = "^FO10,195\n^A0N,17,20\n^FD LIS 4112082257 ^FS\n";
|
||||
// // $hisNumSection = "^FO10,210\n^A0N,20,20\n^FD HIS 01241101855 ^FS\n";
|
||||
// // $numSampleSection = "^FO240,200\n^A0N,27,27\n^FD $access 115 ^FS\n";
|
||||
// // $endSection = "^XZ";
|
||||
|
||||
// $printCoba ="N
|
||||
// N
|
||||
// OD
|
||||
// q400
|
||||
// Q224,24+0
|
||||
// I8,A,001
|
||||
// D10
|
||||
// A10,3,0,3,1,1,N,'MRS. MIKAELA LETTA XABRIANA'
|
||||
// A10,25,0,1,1,1,N,'M 22Y'
|
||||
// A10,65,0,1,1,1,N,'SERUMAH'
|
||||
// A288,65,0,1,1,1,N,'2402084063'
|
||||
// B90,30,0,1,2,8,70,N,'2402084063'
|
||||
// A10,110,0,2,1,1,N,'PSA,HDL,LDL,BUN,SGOT'
|
||||
// A10,131,0,1,1,1,N,'LIS : 0978658'
|
||||
// A10,145,0,1,1,1,N,'HIS : 1252434'
|
||||
// A250,140,0,3,1,1,N,'2402084063'
|
||||
|
||||
// P1
|
||||
// ";
|
||||
|
||||
// // $messagesToPrint = $startSection.$nameSection.$yearSection.$labelBarcodeSection.$numberCodeSection.$sampleSection.$parameterSection.$parameterSection.$lisNumSection.$hisNumSection.$numSampleSection.$endSection;
|
||||
// $messagesToPrint = $printCoba;
|
||||
|
||||
// // Membuat file sementara untuk ZPL
|
||||
// $tempFile = tempnam(sys_get_temp_dir(), 'cpcl');
|
||||
|
||||
// // Menulis data ZPL ke dalam file sementara
|
||||
// file_put_contents($tempFile, $messagesToPrint);
|
||||
|
||||
// // Membuat perintah untuk mengirim file ZPL ke printer
|
||||
// $command = "copy /b $tempFile $printerPath";
|
||||
|
||||
// // Menjalankan perintah untuk mengirimkan file ke printer
|
||||
// exec($command, $output, $status);
|
||||
|
||||
// // Memeriksa status eksekusi dan menampilkan pesan yang sesuai
|
||||
// if ($status === 0) {
|
||||
// unlink($tempFile);
|
||||
// return $this->response->setJSON(
|
||||
// [
|
||||
// 'message' => "Label Dicetak",
|
||||
// 'status' => true,
|
||||
// ]
|
||||
// );
|
||||
// } else {
|
||||
// $output = json_encode($output); // Konversi ke JSON
|
||||
// return $this->response->setJSON(
|
||||
// [
|
||||
// 'error' => $output,
|
||||
// 'message' => "Label Gagal Dicetak",
|
||||
// 'status' => false,
|
||||
// ]
|
||||
// );
|
||||
// }
|
||||
|
||||
|
||||
// }
|
||||
// Data ZPL untuk mencetak label
|
||||
// $startSection = "^XA\n^PW400\n^LL224\n";
|
||||
// $nameSection = "^FO10,2\n^A0N,23,23\n^FD MRS. I PUTU AYU PUTRI PERTIWI ^FS\n";
|
||||
// $yearSection = "^FO12,25\n^A0N,22,22\n^FD F 24Y ^FS\n";
|
||||
// $labelBarcodeSection = "^FO85,50\n^BY2,2.0,45\n^BCN,100,N,N,N\n^FD25082257^FS\n";
|
||||
// $numberCodeSection = "^FO374,43\n^A0B,25,25\n^FD 25082257 ^FS\n";
|
||||
// $sampleSection = "^FO19,45\n^A0B,27,27\n^FD $sample ^FS\n";
|
||||
// $parameterSection = "^FO10,165\n^A0N,23,23\n^FD PSA, HDL, LDL, BUN, SGOT ^FS\n";
|
||||
// $lisNumSection = "^FO10,195\n^A0N,17,20\n^FD LIS 4112082257 ^FS\n";
|
||||
// $hisNumSection = "^FO10,210\n^A0N,20,20\n^FD HIS 01241101855 ^FS\n";
|
||||
// $numSampleSection = "^FO240,200\n^A0N,27,27\n^FD $access 115 ^FS\n";
|
||||
// $endSection = "^XZ";
|
||||
|
||||
public function sample($access, $sample) {
|
||||
|
||||
$access = (string) $access;
|
||||
$sample = (string) $sample;
|
||||
// $access = (string) $access;
|
||||
// $sample = (string) $sample;
|
||||
|
||||
// Buka Mapping Drive
|
||||
// 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.5.20\\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;
|
||||
|
||||
$sampleLable ="N
|
||||
$sampleLable ="N
|
||||
OD
|
||||
q400
|
||||
Q224,24+0
|
||||
I8,A,001
|
||||
D10
|
||||
A10,3,0,3,1,1,N,\"MRS. MIKAELA LETTA XABRIANA\"
|
||||
A10,25,0,1,1,1,N,\"M 22Y\"
|
||||
A10,65,0,1,1,1,N,\"$access\"
|
||||
A288,65,0,1,1,1,N,\"2402084063\"
|
||||
B90,30,0,1,2,8,70,N,\"2402084063\"
|
||||
A10,110,0,2,1,1,N,\"PSA,HDL,LDL,BUN,SGOT\"
|
||||
A10,131,0,1,1,1,N,\"LIS : 0978658\"
|
||||
A10,145,0,1,1,1,N,\"HIS : 1252434\"
|
||||
A250,140,0,3,1,1,N,\"$sample\"
|
||||
A2,2,0,2,1,1,N,\"MRS.MIKAELA LETTA XABRIANA\"
|
||||
A2,25,0,2,1,1,N,\"M 22Y\"
|
||||
A2,60,0,2,1,1,N,\"SERUM\"
|
||||
A290,60,0,2,1,1,N,\"24020840\"
|
||||
B110,30,0,1,2,8,70,N,\"24020840\"
|
||||
A2,110,0,2,1,1,N,\"PSA,HDL,LDL,BUN,SGOT\"
|
||||
A2,131,0,1,1,1,N,\"LIS : 0978658\"
|
||||
A2,145,0,1,1,1,N,\"HIS : 1252434\"
|
||||
A270,140,0,2,1,1,N,\"02-12-2024\"
|
||||
|
||||
P1
|
||||
";
|
||||
@ -126,7 +66,7 @@ P1
|
||||
}
|
||||
|
||||
// Hapus Koneksi
|
||||
exec('net use L: /delete 2>&1', $output, $return_var);
|
||||
exec('net use S: /delete 2>&1', $output, $return_var);
|
||||
return $this->response->setJSON(
|
||||
[
|
||||
'message' => "Print Berhasil",
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user