
$('#cetak').on('click', function (e) {
    //alert("kepanggil");
    e.preventDefault();
    var no_antrian = no_antrian_cetak.toString().length;
    var antrian;
    if (no_antrian == 1) {
        antrian = '00' + no_antrian_cetak.toString();
    } else if (no_antrian == 2) {
        antrian = '0' + no_antrian_cetak.toString();
    } else {
        antrian = no_antrian_cetak;
    }
    var w = window.open('', '', 'width=300,height=400');
    w.document.write('<html><body><table border="" >' +
        '<tr><th><h1>SELAMAT DATANG</h1><h2> Di Rumah Sakit</h2></th></tr></thead>' +
        '<tbody><tr>' +
        '<th><h2>ANTRIAN</h2>' +
        '<h1>' + kode_poli_cetak + '-' + antrian + '</h1>' +
        '<h3>Nama Pasien : ' + nama_pasien_cetak + '</h3>' +
        '<h3>' + nama_poli_cetak + '</h3>' +
        '<h3> ' + nama_dokter_cetak + '</h3>' +
        '<h3>Jumlah yang sedang dalam antrian : ' + sisa_antrian + '</h3>' +
        '<h4  style=text-align: right>    ' + new Date().toLocaleString("en-US", { timeZone: "Asia/Jakarta" }) + '</h4style=text-align:>' +
        '</th></tr></tbody></table></body></html>');
    w.window.print();
    w.document.close();
    w.window.onafterprint = function () {

        setTimeout(function () {
            w.close()
            window.location = baseURL + "/queue/beranda"
        }, 3000);
    }

})