Compare commits
17 Commits
main
...
zakaprinte
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
dd67e426b6 | ||
|
|
87dca8e44c | ||
|
|
ce87b52d49 | ||
|
|
7e2192c1d1 | ||
|
|
51b64e3f9f | ||
|
|
a4330028a3 | ||
|
|
a08eb80886 | ||
|
|
6b075d3341 | ||
|
|
403e5ca620 | ||
|
|
ce3fc19b49 | ||
|
|
0ba9e41a42 | ||
|
|
7048368066 | ||
|
|
a853722cd1 | ||
|
|
376edb0f3c | ||
|
|
3057b27897 | ||
|
|
fcea573284 | ||
|
|
ddfb6a9b66 |
@ -22,6 +22,15 @@ $routes->get('/tubes/unreceive/(:any)/(:any)', 'Tubes::unreceive/$1/$2');
|
||||
$routes->get('/tubes/unreceiveAll/(:any)', 'Tubes::unreceiveAll/$1');
|
||||
$routes->post('/tubes/comment/(:any)/(:any)', 'Tubes::comment/$1/$2');
|
||||
|
||||
$routes->get('/prints/sample/(:any)/(:any)', 'Prints::sample/$1/$2');
|
||||
// $routes->get('/prints/sample/(:any)/(:any)', 'Prints::sample/$1/$2');
|
||||
|
||||
// Pages
|
||||
$routes->get('/', 'Pages::dashboard_index');
|
||||
$routes->get('/userroles/', 'Pages::userroles_index');
|
||||
$routes->get('/users/', 'Pages::users_index');
|
||||
$routes->get('/changePass/', 'Pages::changePass');
|
||||
|
||||
$routes->get('/dashboard/viewAccess/(:any)', 'Dashboard::viewAccess/$1');
|
||||
|
||||
// Auth
|
||||
|
||||
250
app/Controllers/Prints.php
Normal file
250
app/Controllers/Prints.php
Normal file
@ -0,0 +1,250 @@
|
||||
<?php
|
||||
|
||||
namespace App\Controllers;
|
||||
|
||||
class Prints extends BaseController {
|
||||
|
||||
// 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) {
|
||||
|
||||
$time = microtime(true);
|
||||
$logTime = date('d-m-Y_H_i_s', $time) . sprintf('_%03d', ($time - floor($time)) * 1000);
|
||||
$filename = "sample_".$logTime;
|
||||
|
||||
$role='Analis';
|
||||
$rolesType = ['Analis', 'Sampling'];
|
||||
$networkPath = "";
|
||||
|
||||
// Ruang Analis Printer POSTEK
|
||||
if (!in_array($role, $rolesType)) {
|
||||
|
||||
// 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,
|
||||
]);
|
||||
|
||||
} else if (in_array($role, $rolesType)) {
|
||||
|
||||
// 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,\"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,\"$filename\"
|
||||
|
||||
P1
|
||||
";
|
||||
|
||||
// Ruang Analis Printer Zebra
|
||||
} else if (in_array($role, $rolesType)) {
|
||||
|
||||
// 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,\"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
|
||||
";
|
||||
}
|
||||
|
||||
$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 allSample() {
|
||||
|
||||
$data=5;
|
||||
|
||||
$role='Analis';
|
||||
$rolesType = ['Analis', 'Sampling'];
|
||||
$networkPath = "";
|
||||
|
||||
// Ruang Analis Printer POSTEK
|
||||
if (!in_array($role, $rolesType)) {
|
||||
|
||||
// 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,
|
||||
]);
|
||||
|
||||
} else if (in_array($role, $rolesType)) {
|
||||
|
||||
// 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++) {
|
||||
|
||||
$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,\"$filename\"
|
||||
|
||||
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 (in_array($role, $rolesType)) {
|
||||
|
||||
// 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:';
|
||||
|
||||
for ($i=0; $i<$data; $i++) {
|
||||
|
||||
$time = microtime(true);
|
||||
$logTime = date('d-m-Y_H_i_s', $time) . sprintf('_%03d', ($time - floor($time)) * 1000);
|
||||
$filename = "sample_".$logTime;
|
||||
|
||||
// Printer Zebra
|
||||
$sampleLable ="N
|
||||
OD
|
||||
q400
|
||||
Q185,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
|
||||
";
|
||||
$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,
|
||||
]);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Hapus Koneksi
|
||||
exec('net use '. $letterPath .' /delete 2>&1', $output, $return_var);
|
||||
return $this->response->setJSON(
|
||||
[
|
||||
'message' => "Print Berhasil",
|
||||
'status' => true,
|
||||
]
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@ -45,10 +45,10 @@ $name = $row['NAME'];
|
||||
}
|
||||
echo "<td>$sampletext</td>";
|
||||
echo "<td>
|
||||
<button class='badge text-bg-dark'><i class='bi bi-printer'></i></button>
|
||||
<button class='badge text-bg-success' onclick='collect($sampletype, $accessnumber)'>Coll.</button>
|
||||
<button class='badge text-bg-warning' onclick='uncollect($sampletype, $accessnumber)'>Un-Coll.</button>
|
||||
<button class='badge text-bg-primary' onclick='unreceive($sampletype, $accessnumber)'>Un-Rec.</button>
|
||||
<span class='badge text-bg-dark' onclick='print($sampletype, $accessnumber)'><i class='bi bi-printer'></i></span>
|
||||
<span class='badge text-bg-success' onclick='collect($sampletype, $accessnumber)'>Coll.</span>
|
||||
<span class='badge text-bg-warning' onclick='uncollect($sampletype, $accessnumber)'>Un-Coll.</span>
|
||||
<span class='badge text-bg-primary' onclick='unreceive($sampletype, $accessnumber)'>Un-Rec.</span>
|
||||
</td> ";
|
||||
echo "<td id='comment$sampletype'>$comment <i class='bi bi-pencil-square' role='button' onclick='comment($sampletype, $accessnumber, \"$sampletext\", \"$comment\")'></i></td>";
|
||||
echo " </tr>";
|
||||
@ -74,8 +74,32 @@ $name = $row['NAME'];
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
|
||||
function print(sample, access) {
|
||||
|
||||
const url = '<?=base_url();?>prints/sample/'+access.toString()+'/'+sample.toString();
|
||||
|
||||
fetch(url)
|
||||
.then(response => response.json()) // Mengonversi response menjadi JSON (atau gunakan .text() jika formatnya teks)
|
||||
.then(data => {
|
||||
|
||||
if (data['status']) {
|
||||
console.log(data['message']);
|
||||
} else {
|
||||
console.log(data['message']+"\n"+data['error']);
|
||||
message = data['message']+"\n"+data['error'];
|
||||
alert(message);
|
||||
}
|
||||
|
||||
})
|
||||
.catch(error => {
|
||||
console.error('Error:', error);
|
||||
});
|
||||
}
|
||||
|
||||
function collect(sample, access) {
|
||||
sample = sample.toString().padStart(3,'0');
|
||||
|
||||
const url = '<?=base_url();?>tubes/collect/'+access+'/'+sample;
|
||||
fetch(url)
|
||||
.then(data => {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user