Permasalahan ini saya alami saat ikut membantu mengembangkan sistem informasi RSU. salah satu proses yang dibutuhkan oleh pengguna adalah hasil/output proses pendaftaran yang di inputkan bagian/petugas pendaftaran adalah cetak langsung printer, tanpa meng KLIK tombol. cetakan langsung ke printer ada tiga jenis/macam : label, tracer RM untuk bagian tracer (tempatnya berbeda dengan bagian pendaftaran) dan di pendaftaran adalah label.
maka saya dan teman-teman mengolah dan menganalisa proses.
1. Tanamkan program berbasis web (apache) di komputer bagian tracer. pastikan setting php_printer.dll dan extension=php_printer.dll di komputer tracer terlebih dahulu.
2. copy kan file php_printer.dll ke folder xampp/php/ext
php_printer.dll harus disesuaikan dengan versi php yang digunakan.
3. Installkan program untuk mencetak langsung ke printer.
adapun kodingnya sbb :
<?php
// $printer2 = printer_open("\\\DESKTOP-GQCTL0H\EPSON L565 Series"); //open printer ZDesigner GC420t (EPL)
$antrian='';
$row='';
$tanggal = date("d-m-Y");
$jam = date("H:i:s");
$var_magin_left = 5;
$nama = @isset($_GET['nama']) ? @$_GET['nama'] : '';
$rm = @isset($_GET['no_rm']) ? @$_GET['no_rm'] : '';
$tgllahir = @isset($_GET['tgllhr']) ? @$_GET['tgllhr'] : '';
$no_urut = @isset($_GET['no_urut']) ? @$_GET['no_urut'] : '';
$status = @isset($_GET['status']) ? @$_GET['status'] : '';
$klinik = @isset($_GET['klinik']) ? $_GET['klinik'] : '';
$dokter = @isset($_GET['dokter']) ? $_GET['dokter'] : '';
$bayar = @isset($_GET['cara_bayar']) ? $_GET['cara_bayar'] : '';
$alamat = @isset($_GET['alamat']) ? $_GET['alamat'] : '';
$umur = @isset($_GET['umur']) ? $_GET['umur'] : '';
$jk = @isset($_GET['jk']) ? $_GET['jk'] : '';
$p = printer_open('Honeywell PC42t (203 dpi) - DP');
printer_set_option($p, PRINTER_MODE, "RAW"); // mode disobek (gak ngegulung kertas)
//then the width
printer_set_option( $p,PRINTER_RESOLUTION_Y, 940);
printer_start_doc($p);
printer_start_page($p);
$font = printer_create_font("Arial Black", 35, 10, PRINTER_FW_NORMAL, false, false, false, 0);//Font Style , Ukuran Font
printer_select_font($p, $font);
printer_draw_text($p, $nama ,50,-5);//LEFT , TOP
//printer_draw_text($p, "",250,20);
// Header Bon
$font2 = printer_create_font("Arial Black", 30, 10, PRINTER_FW_NORMAL, false, false, false, 0);//Font Style , Ukuran Font
printer_select_font($p, $font2);
printer_draw_text($p, "RM : ".$rm, 50, 30); //x , y
printer_draw_text($p, "( ".$jk." )", 350, 30); //x , y (Jejeran dengan RM)
$font3 = printer_create_font("Arial", 30, 10, PRINTER_FW_NORMAL, false, false, false, 0);//Font Style , Ukuran Font
printer_select_font($p, $font3);
printer_draw_text($p, $tgllahir, 50, 60);// x=50, y=100
printer_draw_text($p, $umur." th", 350, 60); //jejeran sama tgl lahir
$font4 = printer_create_font("Arial", 30, 10, PRINTER_FW_NORMAL, false, false, false, 0);//Font Style , Ukuran Font
printer_select_font($p, $font4);
printer_draw_text($p, $alamat, 50, 100);
printer_end_page($p);
printer_end_doc($p);
printer_start_doc($p);
printer_start_page($p);
printer_close($p);
//Label kedua
$p1 = printer_open('Honeywell PC42t (203 dpi) - DP');
printer_set_option($p1, PRINTER_MODE, "RAW"); // mode disobek (gak ngegulung kertas)
//then the width
printer_set_option( $p1,PRINTER_RESOLUTION_Y, 940);
printer_start_doc($p1);
printer_start_page($p1);
$font1 = printer_create_font("Arial Black", 35, 10, PRINTER_FW_NORMAL, false, false, false, 0);//Font Style , Ukuran Font
printer_select_font($p1, $font1);
printer_draw_text($p1, $nama ,50,-5);//LEFT , TOP
//printer_draw_text($p, "",250,20);
// Header Bon
$font21 = printer_create_font("Arial Black", 30, 10, PRINTER_FW_NORMAL, false, false, false, 0);//Font Style , Ukuran Font
printer_select_font($p1, $font21);
printer_draw_text($p1, "RM : ".$rm, 50, 30); //x , y
printer_draw_text($p1, "( ".$jk." )", 350, 30); //x , y (Jejeran dengan RM)
$font31 = printer_create_font("Arial", 30, 10, PRINTER_FW_NORMAL, false, false, false, 0);//Font Style , Ukuran Font
printer_select_font($p1, $font31);
printer_draw_text($p1, $tgllahir, 50, 60);// x=50, y=100
printer_draw_text($p1, $umur." th", 350, 60); //jejeran sama tgl lahir
$font41 = printer_create_font("Arial", 30, 10, PRINTER_FW_NORMAL, false, false, false, 0);//Font Style , Ukuran Font
printer_select_font($p1, $font41);
printer_draw_text($p1, $alamat , 50, 100);
printer_end_page($p1);
printer_end_doc($p1);
printer_start_doc($p1);
printer_start_page($p1);
printer_close($p1);
//label ketiga
$p4 = printer_open('Honeywell PC42t (203 dpi) - DP');
printer_set_option($p4, PRINTER_MODE, "RAW"); // mode disobek (gak ngegulung kertas)
//then the width
printer_set_option( $p4,PRINTER_RESOLUTION_Y, 940);
printer_start_doc($p4);
printer_start_page($p4);
$font4 = printer_create_font("Arial Black", 35, 10, PRINTER_FW_NORMAL, false, false, false, 0);//Font Style , Ukuran Font
printer_select_font($p4, $font4);
printer_draw_text($p4, $nama,50,-5);//LEFT , TOP
//printer_draw_text($p, "",250,20);
// Header Bon
$font24 = printer_create_font("Arial Black", 30, 10, PRINTER_FW_NORMAL, false, false, false, 0);//Font Style , Ukuran Font
printer_select_font($p4, $font24);
printer_draw_text($p4, "RM : ".$rm, 50, 30); //x , y
printer_draw_text($p4, "( ".$jk." )", 350, 30); //x , y (Jejeran dengan RM)
$font34 = printer_create_font("Arial", 30, 10, PRINTER_FW_NORMAL, false, false, false, 0);//Font Style , Ukuran Font
printer_select_font($p4, $font34);
printer_draw_text($p4, $tgllahir, 50, 60);// x=50, y=100
printer_draw_text($p4, $umur." thn", 350, 60); //jejeran sama tgl lahir
$font44 = printer_create_font("Arial", 30, 10, PRINTER_FW_NORMAL, false, false, false, 0);//Font Style , Ukuran Font
printer_select_font($p4, $font44);
printer_draw_text($p4, $alamat, 50, 100);
printer_end_page($p4);
printer_end_doc($p4);
printer_start_doc($p4);
printer_start_page($p4);
printer_close($p4);
//Untuk yang POS
$antrian='';
$row='';
$tanggal = date("d-m-Y");
$jam = date("H:i:s");
$var_magin_left = 5;
$p2 = printer_open('POS-90');
printer_set_option($p2, PRINTER_MODE, "RAW"); // mode disobek (gak ngegulung kertas)
//then the width
printer_set_option( $p2,PRINTER_RESOLUTION_Y, 940);
printer_start_doc($p2);
printer_start_page($p2);
$font = printer_create_font("Tahoma", 30, 15, PRINTER_FW_NORMAL, false, false, false, 0);
printer_select_font($p2, $font);
printer_draw_text($p2, "Tarcer Rekam Medik",100,0);//LEFT , TOP
$font1 = printer_create_font("Arial Black", 35, 15, PRINTER_FW_NORMAL, false, false, false, 0);
printer_select_font($p2, $font1);
printer_draw_text($p2, $rm ,50,30);//LEFT , TOP
printer_draw_text($p2, $no_urut ,350,30);//LEFT , TOP
printer_draw_text($p2, $nama ,50,70);//LEFT , TOP
$font5 = printer_create_font("Tahoma", 30, 15, PRINTER_FW_NORMAL, false, false, false, 0);
printer_select_font($p2, $font5);
printer_draw_text($p2, $status ,50,100);//LEFT , TOP
printer_draw_text($p2, $klinik ,50,130);//LEFT , TOP
printer_draw_text($p2, $dokter ,50,160);//LEFT , TOP
printer_draw_text($p2, $bayar ,50,190);//LEFT , TOP
printer_draw_text($p2, $tanggal,50,220);//LEFT , TOP
printer_draw_text($p2, $jam,250,220);//LEFT , TOP
printer_end_page($p2);
printer_end_doc($p2);
printer_start_doc($p2);
printer_start_page($p2);
printer_close($p2);
?>
kemudian pada modul pendaftaran ditanamkan script untuk mengirimkan data ke komputer tracer. bisa dengan menggunakan array maupun dengan cara yang lain. sertakan beserta url (ip address komputer tracer.
Pastikan setting printer yang dibutuhkan, dan sesuaikan pada script diatas.
Demikian beberapa langkah untuk bisa mencetak langsung ke printer di tempat yang berbeda.