query('SELECT * FROM m_cara_bayar'); $arr_cara_bayar = array('' => 'Pilih'); foreach ($m_cara_bayar->fetchAll() as $ds) { $arr_cara_bayar[$ds['id_cara_bayar']] = $ds['nama_cara_bayar']; } $m_penjamin = $db->query('SELECT * FROM m_penjamin where aktif = 1::bit order by id_penjamin'); $arr_penjamin = array(); foreach ($m_penjamin->fetchAll() as $ds) { $arr_penjamin[$ds['id_penjamin']] = trim($ds['nama_penjamin']); } echo $jquery_validation_js; echo $sweetalert_js; array_push($form_plugin['ui_plugins_js'], $jspm_js); $js_init .= $jspm_rawprint; $js_init .= $jspm_init; $roles_verifikator = (array_key_exists('role_verifikator', $_SESSION)) ? explode(',', $_SESSION['role_verifikator']) : []; $tgl_request_krs = (array_key_exists('tgl_request_krs', $_REQUEST)) ? $_REQUEST['tgl_request_krs'] : date('Y-m-d'); ?>
Cart Bayar Rawat Inap
query('DELETE from tmp_cartbayar where IP = \'' . getRealIpAddr() . '\''); $myquery = 'SELECT distinct a.nomr, b.nama, b.alamat, b.jeniskelamin, b.tgllahir, b.parent_nomr, c.statusbayar, e.nama as carabayar, c.noruang, d.nama as ruang, c.nott, a.nobill, (select sum(tarifrs * qty) from t_billranap where nobill = a.nobill and t_billranap.status <> \'BATAL\') as tottarifrs, (select sum(discount) from t_bayarranap where nobill = a.nobill) as discount, (select sum(coalesce(costsharing_pelayanan,0)+coalesce(costsharing_anastesi,0)+coalesce(costsharing_sarana,0)) as total from t_billranap where nobill = a.nobill and t_billranap.status <> \'BATAL\') as totcostsharing, (select sum(deposit) from t_deposit where t_deposit.nobill::integer = a.nobill and t_deposit.st_batal is null group by nobill) as deposit, c.masukrs, d.kelas, c.keluarrs, c.tgl_pindah, d.idx_ruang,t.uraian_tarif FROM t_billranap a JOIN m_pasien b ON a.nomr = b.nomr JOIN t_admission c ON a.IDXDAFTAR = c.id_admission JOIN m_ruang d ON c.noruang = d.no JOIN m_carabayar e ON c.statusbayar = e.KODE JOIN t_bayarranap f ON a.idxbill = f.idxbill LEFT JOIN m_tarif_rs t on a.kodetarif = t.kode_tarif WHERE a.IDXDAFTAR = ' . $_REQUEST['idxb'] . ' and a.NOBILL = ' . $_REQUEST['nobill'] . ' and a.STATUS!=\'BATAL\''; $get = $db->query($myquery); $all_userdata = $get->fetchAll(); $userdata = $all_userdata[0]; if (_DBTYPE_ == 'mysqli') { $sql_asuransi = 'SELECT idxdaftar, sum( if (carabayar = 1 AND kodetarif != \'DEPOSIT\',qty * tarifrs,0)) as total_tagihan, sum( if (carabayar > 1 AND kodetarif != \'DEPOSIT\',askes,0)) as total_asuransi FROM t_billranap WHERE IDXDAFTAR = \'' . $_REQUEST['idxb'] . '\' group by idxdaftar'; } else { $sql_asuransi = 'SELECT idxdaftar, sum( case when (carabayar = 1 AND kodetarif != \'DEPOSIT\') then qty * tarifrs else 0 end) as total_tagihan, sum( case when (carabayar > 1 AND kodetarif != \'DEPOSIT\') then askes else 0 end) as total_asuransi FROM t_billranap WHERE IDXDAFTAR = \'' . $_REQUEST['idxb'] . '\' group by idxdaftar'; } $sql_asuransi = $db->query($sql_asuransi); $d_asuransi = $sql_asuransi->fetchAll()[0]; $deposit = $userdata['deposit']; $a2 = $userdata['tottarifrs'] - $d_asuransi['total_asuransi'] - $userdata['totcostsharing'] - $deposit; $class_col_identitas = ($page_akses['verif'] == 1) ? 'col-md-8' : 'col-md-12'; $hidden_entritindakan = ($page_akses['verif'] == 1) ? '' : ''; $sudah_admkl = false; $sudah_akomodasi = false; $sudah_pembulatan = false; foreach ($all_userdata as $row_bill) { if (preg_match("/AKOMODASI/", $row_bill['uraian_tarif'])) { $sudah_akomodasi = true; } if (preg_match("/ADMINISTRASI/", $row_bill['uraian_tarif'])) { $sudah_admkl = true; } if (preg_match("/PEMBULATAN/", $row_bill['uraian_tarif'])) { $sudah_pembulatan = true; } } ?>
diff($d2)->format('%a') + 1); } else { $jml_hari_rawat = 0; } echo '
'; $d_none = ($page_akses['piutang'] == 1) ? 'd-none' : ''; ?>
Tarif Tindakan
Penambahan tindakan sudah terkunci.
'; } else { ?>
query($str_query_piutang_pribadi); if ($cek_trans_piutang->numRows() > 0) { ?>
Informasi Piutang
'; echo $end_hidden_entritindakan; ?>

Rp
Rp
Rp
Acc No
Rp
Rp
Rp
Rp
SIMPAN '; } if ($page_akses['piutang']) { echo ''; } } if (in_array($_SESSION['ROLES'], $roles_verifikator)) { if ($page_akses['verif']) { if ($sudah_akomodasi == false) { echo ''; // echo ''; } else { echo ''; } if ($sudah_pembulatan == false) { // echo ''; } else { // echo ''; } } if ($page_akses['piutang']) { echo ''; } } ?>
'; if ($page_akses['kasir'] || $page_akses['verif']) { echo ''; } else { echo ''; } echo ' '; if ($page_akses['piutang'] == 1) { echo ''; } echo ''; $order_by = ''; if ($page_akses['verif'] == false) { $where_verif = 'AND b.status_verifikasi = 1'; $order_by = 'ORDER BY b.nonota desc'; } else { $where_verif = 'AND (b.status_verifikasi is null or b.status_verifikasi = 0)'; $order_by = 'ORDER BY b.nonota desc'; } $where_carabayar = $where_bayar = $where_piutang = ''; if ($page_akses['kasir'] == true) { $where_carabayar = ' AND h.st_carabayar = 1'; $where_bayar = ' AND h.status = \'TRX\''; } elseif ($page_akses['piutang'] == true) { $where_carabayar = ' AND h.st_carabayar = 2'; $where_piutang = ' AND (select count(id_piutang) from t_piutang where nobilling = b.nobill and idxbill = b.idxbill and (st_piutang != \'BATAL\' or st_piutang is null)) = 0'; } // if($page_akses['d'] == true) { // $where_batal = " AND b.status = 'BATAL' "; // } // else { $where_batal = " AND (b.status is null OR b.status = 'SELESAI')"; // } $sql = "SELECT DISTINCT case when (b.kodetarif in ('DEPOSIT','IURBEA')) then b.kodetarif else a.uraian_tarif end as nama_jasa, b.nonota, b.idxbill, b.carabayar as kdcarabayar, h.status as st_bayar,h.st_carabayar, h.kd_penjamin, b.idxbill, b.tanggal, b.qty, b.tarifrs, c.nama as carabayar, b.nobill,b.idxdaftar,a.kode_tarif, cb.nama_cara_bayar, p.nama_penjamin, b.status_verifikasi, h.jmbayar, h.tglbayar, b.status,b.alasan_batal,h.deposit,h.totaskes,coalesce(h.totcostsharing_pelayanan,0) as totcostsharing_pelayanan,coalesce(h.totcostsharing_anastesi,0) as totcostsharing_anastesi,coalesce(h.totcostsharing_sarana,0) as totcostsharing_sarana,h.discount,h.total_iurbea,tp.jml_piutang, tp.st_piutang,obb.idxbill as status_orderbatal,obb_piutang.idxbill as status_orderbatalpiutang,obb_bayar.idxbill as status_orderbatalbayar,obb_verif.idxbill as status_orderbatalverif FROM t_billranap b JOIN t_bayarranap h on b.IDXBILL = h.IDXBILL JOIN m_carabayar c on c.KODE = b.CARABAYAR LEFT JOIN m_tarif_rs a on a.kode_tarif=b.KODETARIF LEFT JOIN t_billrajal tb on tb.IDXDAFTAR=b.IDXDAFTAR LEFT JOIN m_tarif_rs x on x.kode_tarif=tb.KODETARIF LEFT JOIN m_cara_bayar cb on cb.id_cara_bayar = h.st_carabayar LEFT JOIN m_penjamin p on p.id_penjamin = h.kd_penjamin LEFT JOIN ( select idxbill, count(id_piutang) as jml_piutang, st_piutang from t_piutang where nobilling = '{$_REQUEST['nobill']}' and st_billing = 'IRNA' and st_piutang is null group by idxbill,st_billing,st_piutang) tp on b.idxbill = tp.idxbill LEFT JOIN (select idxbill from t_orderbatalbill obb where nobill = '{$_REQUEST['nobill']}' and billing = 'RANAP' and (st_orderbatal_tindakan = 1 and st_batal_tindakan is null)) obb on obb.idxbill = b.idxbill LEFT JOIN (select idxbill from t_orderbatalbill obbv where nobill = '{$_REQUEST['nobill']}' and billing = 'RANAP' and (st_orderbatal_verifikasi = 1 and st_batal_verif is null)) obb_verif on obb_verif.idxbill = b.idxbill LEFT JOIN (select idxbill from t_orderbatalbill obb2 where nobill = '{$_REQUEST['nobill']}' and billing = 'RANAP' and (st_orderbatal_piutang = 1 and st_batal_piutang is null)) obb_piutang on obb_piutang.idxbill = b.idxbill LEFT JOIN (select idxbill from t_orderbatalbill obb3 where nobill = '{$_REQUEST['nobill']}' and billing = 'RANAP' and (st_orderbatal_bayar = 1 and st_batal_bayar is null)) obb_bayar on obb_bayar.idxbill = b.idxbill WHERE b.idxdaftar='{$_REQUEST['idxb']}' and b.nobill='{$_REQUEST['nobill']}' and h.STATUS !='BATAL' and b.tarifrs > 0 $where_batal $where_verif $where_carabayar $where_piutang $where_bayar $order_by"; $qry = $db->query($sql); $total = 0; $bill_terorderbatal = 0; foreach ($qry->fetchAll() as $data) { if ($page_akses['verif'] == true && $data['status_orderbatal'] > 0) { $bill_terorderbatal++; continue; } if (($page_akses['piutang'] == true && $data['status_orderbatalpiutang'] > 0) || ($page_akses['piutang'] == true && $data['status_orderbatalverif'] > 0)) { $bill_terorderbatal++; continue; } if (($page_akses['kasir'] == true && $data['status_orderbatalbayar'] > 0) || ($page_akses['kasir'] == true && $data['status_orderbatalverif'] > 0)) { $bill_terorderbatal++; continue; } $jumlah_biaya = $data['tarifrs'] - $data['total_iurbea'] - $data['deposit'] - $data['totaskes'] - $data['totcostsharing_pelayanan'] - $data['totcostsharing_anastesi'] - $data['totcostsharing_sarana'] - $data['discount']; $st_verif = ($data['status_verifikasi'] == 1) ? 'Verif' : 'Verif '; if ($page_akses['piutang'] == true) { $st_bayar = ($data['kd_penjamin'] == '') ? '' : 'Piutang '; } else { $st_bayar = ($data['tglbayar'] == '' || $data['tglbayar'] == '0000-00-00' || $data['tglbayar'] == '0001-01-01') ? ' Bayar' : 'Lunas'; } // $status_orderbatal = ($data['status'] == 'BATAL') ? '
Diorder batal dengan alasan : '.$data['alasan_batal'].'' : ''; $jasa = $js['uraian_tarif']; if ($page_akses['verif'] == 0 and $data['nama_jasa'] == 'DEPOSIT') { $st_verif = ($data['status_verifikasi'] == 1 && $data['st_bayar'] == 'TRX') ? '' : '
Lunas
'; } else { if ($data['status_verifikasi'] == 1) { if ($data['st_bayar'] == 'TRX') { $st_verif = '
Verif
'; } elseif ($data['st_bayar'] == 'LUNAS') { $st_verif = '
Lunas
'; } } } if ($data['nama_jasa'] != 'DEPOSIT') { $total += $jumlah_biaya; } // jika user verifikator dan belum diverifikasi if ($page_akses['verif'] == 1 && ($data['status_verifikasi'] == NULL or $data['status_verifikasi'] == 0)) { $hidden_form = ''; $checkbox = ''; $html_temp = ''; $html_temp .= ''; } // jika user verifikator dan sudah diverfikasi else { $checkbox = ''; $cb_bill = ( ($page_akses['verif'] == 1 && $data['status_verifikasi'] == TRUE) or ($page_akses['piutang'] == 1 && $data['jml_piutang'] > 0) or ($page_akses['kasir'] == 1 && $data['st_bayar'] == 'LUNAS') ) ? '' : (($page_akses['piutang']) ? '' : $checkbox); $html_temp = ' '; if ($page_akses['piutang']) { $drop_carabayar = ''; } else { $drop_carabayar = ''; } $html_temp .= ''; if ($page_akses['piutang']) { $html_temp .= ''; } $html_temp .= ''; } echo $html_temp; } $button_akhir = ''; if ($page_akses['verif'] == 1) { $btn_disabled_verif = ($sudah_akomodasi) ? '' : 'disabled="disabled" title="Belum ada tarif akomodasi"'; // $btn_disabled_verif = ($sudah_admkl) ? '' : 'disabled="disabled" title="Belum ada tarif Jasa Administrasi"'; $button_akhir = ''; } // if($page_akses['d'] == 1 && $page_akses['verif'] == 1) // { // $button_akhir .= ''; // } // if($page_akses['d'] == 1 && $page_akses['kasir'] == 1) // { // $button_akhir .= ''; // } $colspan_verif = ($page_akses['verif']) ? 5 : 5; echo ''; ?>
#Tanggal Nonota Kode Tarif Nama Tarif Tarif Carabayar'; if ($page_akses['piutang'] != 1) { echo form_dropdown('st_carabayar', $arr_cara_bayar, '', 'class="form-control input-sm" id="carabayar-global" style="width:100%" '); } echo 'Penjamin
' . form_dropdown('kd_penjamin', $arr_penjamin, '', 'class="form-control input-sm" id="penjamin-global" onchange="changePenjaminGlobal(this)" style="width:100%"') . '
Aksi
' . $checkbox . $hidden_form . ' ' . $data['tanggal'] . ' ' . $data['nonota'] . ' ' . $data['kode_tarif'] . ' ' . $data['nama_jasa'] . ' Rp.' . format_uang($jumlah_biaya) . ' ' . ( ($data['lunas'] != 1) ? form_dropdown('st_carabayar[' . $data['idxbill'] . ']', $arr_cara_bayar, '', 'class="form-control input-sm st_carabayar" id="carabayar-' . $data['idxbill'] . '" data-idx="' . $data['idxbill'] . '" data-total="' . str_replace(',', '.', $jumlah_biaya) . '" style="width:100%" ') : '' ) . ' ' . $data['nama_cara_bayar'] . ' '; if ($page_akses['v'] && $data['status_verifikasi'] == true && $data['jmbayar'] == 0) { if ($data['nama_jasa'] == 'DEPOSIT') { $html_temp .= ''; } } else { if ($data['nama_jasa'] == 'DEPOSIT') { $btn_print_deposit = ''; $html_temp .= $btn_print_deposit; } } $html_temp .= '
' . $cb_bill . ' ' . $data['tanggal'] . ' ' . $data['nonota'] . ' ' . $data['kode_tarif'] . '' . $data['nama_jasa'] . ' ' . "Rp. " . format_uang($jumlah_biaya) . ' ' . $data['nama_cara_bayar'] . ' ' . $drop_carabayar . ' ' . form_dropdown('kd_penjamin[' . $data['idxbill'] . ']', $arr_penjamin, '', 'class="form-control input-sm kd_penjamin" id="penjamin-' . $data['idxbill'] . '" style="width:100%"') . ' ' . $st_verif . '
TOTAL Rp. ' . format_uang($total) . ' ' . $button_akhir . '
0) ? 1 : 0) . '; var dt_tarif = ' . json_encode($js_tarif_data) . '; $("#btnTambahAkomodasi,#trig_ako").on("click",function(){ $("#akomodasi-modal").modal("show"); }); $("#btnTambahPembulatan").on("click",function(){ $("#modal-pembulatan").modal("show"); }); var akomodasi = [] function hitungAkomodasi() { total_tarif = 0; akomodasi = []; $(".tarif_ako").each(function(e){ var tarif = $(this).find(":selected").val(); var split_tarif = tarif.split("|"); var split_id = $(this).prop("id").split("-"); var jml = $("#jml_hari-"+split_id[1]).val(); var ruang = $("#ruang-"+split_id[1]).val(); var nott = $("#nott-"+split_id[1]).val(); var jumlah = parseFloat(jml) * parseFloat(dt_tarif[split_tarif[0]]); $("#jml_total-"+split_id[1]).text(accounting.formatMoney(jumlah)); total_tarif += jumlah; if(akomodasi.length > 0) { /*for(i = 0; i < akomodasi.length; i++) { if(split_tarif[0] == akomodasi[i][0]) { break; } else {*/ akomodasi.push([split_tarif[0],jml,ruang,nott,dt_tarif[split_tarif[0]],split_tarif[1],parseFloat(jml)]); /* } }*/ } else { akomodasi.push([split_tarif[0],jml,ruang,nott,dt_tarif[split_tarif[0]],split_tarif[1],parseFloat(jml)]); } }); $("#total_tarif").val(accounting.formatMoney(total_tarif)); $("#btnSimpanAkomodasi").prop("disabled",false); } function simpanAkomodasi(elm) { var idx = $(elm).data("ix"); var dokter = null; var kriteria = null; var kompleksitas = null; var disc = $(elm).data("disc"); var adm = $(elm).data("adm"); var nomr = $(elm).data("nomr"); var carabayar = $(elm).data("carabayar"); //update tanggal keluarrs tgl_krs = $("#tgl_krs").val(); $.post("' . _BASE_ . 'include/master.php?keluar_rs=1",{tgl_krs,idx},function(data){ console.log(data.message,data.type); },"json"); var i = 0; akomodasi.forEach(async function (v){ kode = v[0]; qty = v[1]; poly = v[2]; nott = v[3]; tarif = v[4]; id = v[5]; faktor= v[6]; const p1 = await $.post("' . _BASE_ . 'save_tmp_cartbayar.php",{kode,dokter,poly,id,faktor},function(data){ }); handleSubmit(p1,null,i,idx,nomr,carabayar,nott,poly); i++; }); } function handleSubmit(proses1, proses2, index, id_admission,nomr,carabayar,nott,poly) { if(index == (akomodasi.length - 1)) { /*window.location= "' . _BASE_ . 'index.php?link=34a&idxb="+id_admission+"&nobill=' . $userdata['nobill'] . '";*/ tgl_request_krs = "' . $tgl_request_krs . '"; const p2 = $.post("' . _BASE_ . 'cartbill_save_bayar_ranap.php",{nomr:nomr,noruang:poly,idxdaftar:id_admission,carabayar,nott,tgl_request_krs},function(data){ print_akomodasi(data.nonota); },"json"); } } function simpanPembulatan(elm) { $("#btnSimpanPembulatan").prop("disabled",true); JobToast.fire({title:"Data sedang diproses, harap menunggu",imageUrl:"' . _BASE_ . 'assets/images/Rolling-1s-44px.gif",imageWidth:"44",imageHeight:"44",animation:false}); var idx = $(elm).data("ix"); var dokter = null; var kriteria = null; var kompleksitas = null; var disc = $(elm).data("disc"); var adm = $(elm).data("adm"); var nomr = $(elm).data("nomr"); var carabayar = $(elm).data("carabayar"); kode = "' . $_SESSION['tarif_pembulatan'] . '"; qty = 1; poly = $(elm).data("ruang"); nott = $(elm).data("nott"); tarif_tunai = parseFloat($("#nilai_pembulatan").val().replace(/,/g,".")); tarif_piutang = parseFloat($("#nilai_pembulatan_piutang").val().replace(/,/g,".")); id = $(elm).data("kode"); faktor= 1; if( (tarif_tunai*1) > 0) { const p1 = $.post("' . _BASE_ . 'save_tmp_cartbayar_pembulatan.php",{kode,dokter,poly,id,faktor,tarif:tarif_tunai},function(data){ }); const p2 = $.post("' . _BASE_ . 'cartbill_save_bayar_ranap.php",{nomr:nomr,noruang:poly,idxdaftar:idx,carabayar,nott,piutang:0,unit:' . $_SESSION['KDUNIT'] . '},function(data){ }); } if( (tarif_piutang*1) > 0) { const p1_p = $.post("' . _BASE_ . 'save_tmp_cartbayar_pembulatan.php",{kode,dokter,poly,id,faktor,tarif:tarif_piutang},function(data){ }); const p2_p = $.post("' . _BASE_ . 'cartbill_save_bayar_ranap.php",{nomr:nomr,noruang:poly,idxdaftar:idx,carabayar,nott,piutang:1,unit:' . $_SESSION['KDUNIT'] . '},function(data){ }); } setTimeout(function(){ /* window.location.href = "' . _BASE_ . 'index.php?link=34a&idxb="+idx+"&nobill=' . $userdata['nobill'] . '"; */ var form_bill = $("#form_update_carabayar").serialize(); $.post("' . _BASE_ . 'include/master.php",form_bill+"&verif_billranap=1",function(data){ JobToast.close(); Toast.fire({title:data.message,type:data.type,onClose: () => { if(data.type == "success") { window.location.reload(); } else { Toast.fire({title:"Verifikasi gagal, silakan coba kembali. Atau hubungi administrator",type:"error"}); $("#btnSimpanPembulatan").prop("disabled",false); } } }); },"json"); },200); } $akomodasi = $("#akomodasi-template").html(); $cartbill = $("#cartbill-template").html(); $pembulatan = $("#pembulatan-template").html(); $list_piutang = $("#list_piutang-template").html(); $("body").append($akomodasi).append($cartbill).append($pembulatan).append($list_piutang); $("#list_piutang_rajal").on("click",function(){ $("#modal-list_piutang").modal("show"); }); '; ?>