action-cetak.js 1.32 KB
Newer Older
Indra Raja's avatar
Indra Raja committed
1 2 3 4

$('#cetak').on('click', function (e) {
    //alert("kepanggil");
    e.preventDefault();
Azy Mushofy Anwary's avatar
Azy Mushofy Anwary committed
5 6 7 8 9 10 11 12 13
    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;
    }
Indra Raja's avatar
Indra Raja committed
14 15 16 17 18
    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>' +
Azy Mushofy Anwary's avatar
Azy Mushofy Anwary committed
19
        '<h1>' + kode_poli_cetak + '-' + antrian + '</h1>' +
Indra Raja's avatar
Indra Raja committed
20
        '<h3>Nama Pasien : ' + nama_pasien_cetak + '</h3>' +
Azy Mushofy Anwary's avatar
Azy Mushofy Anwary committed
21 22
        '<h3>' + nama_poli_cetak + '</h3>' +
        '<h3> ' + nama_dokter_cetak + '</h3>' +
Indra Raja's avatar
Indra Raja committed
23
        '<h3>Jumlah yang sedang dalam antrian : ' + sisa_antrian + '</h3>' +
Azy Mushofy Anwary's avatar
Azy Mushofy Anwary committed
24
        '<h4  style=text-align: right>    ' + new Date().toLocaleString("en-US", { timeZone: "Asia/Jakarta" }) + '</h4style=text-align:>' +
Indra Raja's avatar
Indra Raja committed
25 26 27 28 29 30 31 32 33 34 35 36
        '</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);
    }

})