2024-11-25 16:46:58 +07:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
namespace App\Controllers;
|
|
|
|
|
|
|
|
|
|
class Prints extends BaseController {
|
|
|
|
|
|
2024-12-02 13:28:32 +08:00
|
|
|
// 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";
|
2024-11-29 09:49:27 +07:00
|
|
|
|
2024-11-25 16:46:58 +07:00
|
|
|
public function sample($access, $sample) {
|
2024-11-29 16:11:22 +08:00
|
|
|
|
2024-12-02 13:28:32 +08:00
|
|
|
// $access = (string) $access;
|
|
|
|
|
// $sample = (string) $sample;
|
2024-11-29 19:08:48 +08:00
|
|
|
|
2024-12-02 13:28:32 +08:00
|
|
|
// Buka Mapping Drive PC LAB
|
2024-11-29 16:11:22 +08:00
|
|
|
exec('net use L: \\\\10.148.5.20\\Labelshare /user:Administrator 2>&1', $output, $return_var);
|
|
|
|
|
$pathNetworkFolder = 'L:/Sampling_Labels/';
|
2024-11-25 16:46:58 +07:00
|
|
|
|
2024-12-02 13:28:32 +08:00
|
|
|
// Buka Mapping Drive PC Sampling
|
2024-12-02 18:55:45 +08:00
|
|
|
// exec('net use S: \\\\10.148.5.20\\Labelshare /user:Administrator 2>&1', $output, $return_var);
|
|
|
|
|
// $pathNetworkFolder = 'S:/Sampling_Labels/';
|
2024-12-02 13:28:32 +08:00
|
|
|
|
2024-11-29 16:11:22 +08:00
|
|
|
$time = microtime(true);
|
2024-11-29 17:05:45 +08:00
|
|
|
$logTime = date('d-m-Y_H_i_s', $time) . sprintf('_%03d', ($time - floor($time)) * 1000);
|
2024-11-29 16:11:22 +08:00
|
|
|
|
2024-11-29 17:05:45 +08:00
|
|
|
$filename = "sample_".$logTime;
|
2024-12-02 19:58:45 +08:00
|
|
|
|
|
|
|
|
// 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
|
|
|
|
|
// ";
|
|
|
|
|
|
|
|
|
|
// Printer Zebra
|
|
|
|
|
$sampleLable ="N
|
2024-11-29 09:49:27 +07:00
|
|
|
OD
|
2024-11-28 10:42:16 +07:00
|
|
|
q400
|
2024-12-02 19:58:45 +08:00
|
|
|
Q185,10+0
|
2024-11-28 10:42:16 +07:00
|
|
|
I8,A,001
|
2024-11-29 09:49:27 +07:00
|
|
|
D10
|
2024-12-02 18:55:45 +08:00
|
|
|
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\"
|
2024-11-28 10:42:16 +07:00
|
|
|
|
2024-11-29 19:24:09 +08:00
|
|
|
P1
|
|
|
|
|
";
|
2024-11-29 16:11:22 +08:00
|
|
|
$fullPath = $pathNetworkFolder . $filename;
|
|
|
|
|
|
2024-11-29 09:49:27 +07:00
|
|
|
// Tulis file ke folder tujuan
|
2024-11-29 16:11:22 +08:00
|
|
|
if (!file_put_contents($fullPath, $sampleLable)) {
|
|
|
|
|
return $this->response->setJSON([
|
|
|
|
|
'error' => $output,
|
2024-11-29 17:05:45 +08:00
|
|
|
'message' => "Gagal Melakukan Print, Mohon Ulangi",
|
2024-11-29 16:11:22 +08:00
|
|
|
'status' => false,
|
|
|
|
|
]);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Hapus Koneksi
|
2024-12-02 18:55:45 +08:00
|
|
|
exec('net use L: /delete 2>&1', $output, $return_var);
|
2024-11-29 16:11:22 +08:00
|
|
|
return $this->response->setJSON(
|
|
|
|
|
[
|
2024-11-29 17:05:45 +08:00
|
|
|
'message' => "Print Berhasil",
|
2024-11-29 16:11:22 +08:00
|
|
|
'status' => true,
|
|
|
|
|
]
|
|
|
|
|
);
|
2024-11-25 16:46:58 +07:00
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|