2072 lines
114 KiB
PHP
2072 lines
114 KiB
PHP
<?php
|
|
$m_cara_bayar = $db->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');
|
|
?>
|
|
<script src="js/jquery.calculation.js" language="JavaScript" type="text/javascript"></script>
|
|
<script language="javascript">
|
|
function printIt() {
|
|
content = document.getElementById('print_selection');
|
|
w = window.open('about:blank');
|
|
w.document.write(content.innerHTML);
|
|
w.document.writeln("<script>");
|
|
w.document.writeln("window.print()");
|
|
w.document.writeln("</" + "script>");
|
|
}
|
|
</script>
|
|
<script language="javascript" type="text/javascript">
|
|
arr_kd_penjamin_changed = Array();
|
|
|
|
function changePenjamin(elm) {
|
|
var kel_penjamin = $(".kd_penjamin");
|
|
var this_penjamin = $(elm).prop("id");
|
|
var this_nilai = $(elm).find(":selected").val();
|
|
|
|
for (i = 0; i < kel_penjamin.length; i++) {
|
|
var this_id = $(kel_penjamin[i]).prop("id");
|
|
if (jQuery.inArray(this_id, arr_kd_penjamin_changed) !== -1) {
|
|
return true;
|
|
} else {
|
|
var nilai_awal = $(kel_penjamin[i]).find(":selected").val();
|
|
|
|
if (this_nilai != nilai_awal) {
|
|
kel_penjamin[i].value = this_nilai;
|
|
}
|
|
var nilai_akhir = $(kel_penjamin[i]).find(":selected").val();
|
|
var status = $(kel_penjamin[i]).find(":selected").text();
|
|
var idx = $(kel_penjamin[i]).data("idx");
|
|
|
|
arr_kd_penjamin_changed.push(this_id);
|
|
$(kel_penjamin[i]).trigger("change");
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
function changePenjaminGlobal(elm) {
|
|
penjamin_global = $(elm).find(":selected").val();
|
|
$(".kd_penjamin").val(penjamin_global).trigger("change");
|
|
}
|
|
|
|
const Toast = Swal.mixin({
|
|
toast: true,
|
|
position: "top-end",
|
|
showConfirmButton: false,
|
|
timer: 3000
|
|
});
|
|
const JobToast = Swal.mixin({
|
|
toast: true,
|
|
position: "top-end",
|
|
showConfirmButton: false,
|
|
});
|
|
$(document).ready(function () {
|
|
$('#formbayar').validate({
|
|
submitHandler: function (form) {
|
|
var no_medrek = $('#no_medrek').val();
|
|
$.post('<?php echo _BASE_ . 'include/process.php'?>', $("#formbayar").serialize(), function (data) {
|
|
$('#simpan').hide();
|
|
$('#print').append(data);
|
|
//$('#check_medrek').val(data);
|
|
//$.unblockUI();
|
|
});
|
|
}
|
|
});
|
|
$("#simpan").on("click", function () {
|
|
$(this).prop("disabled", true);
|
|
$("#formbayar").validate();
|
|
form_list = $("#form_update_carabayar").serialize();
|
|
is_piutang = "<?php echo $page_akses['piutang']; ?>";
|
|
JobToast.fire({
|
|
title: "Data sedang diproses, harap menunggu",
|
|
imageUrl: "<?php echo _BASE_ . 'assets/images/Rolling-1s-44px.gif';?>",
|
|
imageWidth: "44",
|
|
imageHeight: "44",
|
|
animation: false
|
|
});
|
|
|
|
if (is_piutang == '1') {
|
|
jml_cekbox = $(".cb_bill").length;
|
|
jml_dicek = 0;
|
|
$(".cb_bill").each(function (e) {
|
|
is_checked = $(this).prop("checked");
|
|
if (is_checked) {
|
|
jml_dicek += 1;
|
|
}
|
|
});
|
|
|
|
if (jml_dicek != jml_cekbox) {
|
|
valid_cek = false;
|
|
JobToast.close();
|
|
Toast.fire({title: "Silakan centang semua tagihan terlebih dahulu", type: "error"});
|
|
} else {
|
|
valid_cek = true;
|
|
}
|
|
} else {
|
|
valid_cek = true;
|
|
}
|
|
|
|
if (valid_cek == true) {
|
|
$.post('<?php echo _BASE_ . 'include/master.php'; ?>', $("#formbayar").serialize() + "&bayar_bill_ranap=1&kasir=<?php echo $page_akses['kasir']; ?>&piutang=<?php echo $page_akses['piutang'] . (array_key_exists('tgl_request_krs', $_REQUEST) ? '&tgl_request_krs=' . $_REQUEST['tgl_request_krs'] : ''); ?>&" + form_list, function (data) {
|
|
JobToast.close();
|
|
Toast.fire({
|
|
title: data.message, type: data.type, onClose: () => {
|
|
if (data.type == 'success') {
|
|
if (data.nobayar != 'piutang') {
|
|
print_pembayaran(data.nobayar);
|
|
} else {
|
|
window.location.reload();
|
|
}
|
|
} else if (data == 'error') {
|
|
Toast.fire({title: "Data pembayaran gagal disimpan", type: "info"});
|
|
$("#simpan").prop("disabled", false);
|
|
} else {
|
|
Toast.fire({title: 'Data pembayaran belum dicentang', type: 'error'});
|
|
$("#simpan").prop("disabled", false);
|
|
return false;
|
|
}
|
|
}
|
|
});
|
|
}, "json");
|
|
}
|
|
});
|
|
|
|
$('#batal_bayar').click(function () {
|
|
idxbill = Array();
|
|
$(".cb_bill").each(function () {
|
|
if ($(this).is(":checked") == true) {
|
|
idxbill.push($(this).val());
|
|
}
|
|
});
|
|
|
|
if (idxbill.length > 0) {
|
|
Swal.fire({
|
|
title: 'Anda yakin?',
|
|
html: "Anda ingin membatalkan billing tersebut",
|
|
type: 'warning',
|
|
showCancelButton: true,
|
|
confirmButtonColor: '#3085d6',
|
|
cancelButtonColor: '#d33',
|
|
confirmButtonText: 'Ya, Batalkan!'
|
|
}).then((result) => {
|
|
if (result.value) {
|
|
nomr = $("#nomr").val();
|
|
$.post('<?php echo _BASE_;?>include/master.php', {
|
|
batal_bill_ranap: true,
|
|
idxbill,
|
|
nomr
|
|
}, function (data) {
|
|
print_restitusi(data.nonota);
|
|
}, "json");
|
|
}
|
|
});
|
|
} else {
|
|
Toast.fire({title: "Centang beberapa bill terlebih dahulu", type: "error"});
|
|
}
|
|
});
|
|
|
|
$('.verif').click(function () {
|
|
var id_elm = $(this).attr('id');
|
|
var nobill = $(this).attr('svn');
|
|
var nomr = $('#nomr').val();
|
|
var kode = $(this).attr('kode');
|
|
var idxbill = $(this).attr('idxbill');
|
|
var idxdaftar = $(this).attr('idxdaftar');
|
|
var st_carabayar = $("#carabayar-" + idxbill).find(":selected").val();
|
|
var kd_penjamin = $("#penjamin-" + idxbill).find(":selected").val();
|
|
$.post('<?php echo _BASE_;?>include/master.php', {
|
|
verifikasi_ranap: true,
|
|
idxbill,
|
|
nobill,
|
|
nomr,
|
|
kode,
|
|
idxdaftar,
|
|
st_carabayar,
|
|
kd_penjamin
|
|
}, function (data) {
|
|
$(this).prop("disabled", true);
|
|
|
|
Toast.fire({
|
|
title: data.message,
|
|
type: data.type,
|
|
onClose: () => {
|
|
if (data.type == 'success') {
|
|
window.location.reload();
|
|
}
|
|
}
|
|
});
|
|
|
|
}, "json");
|
|
});
|
|
jml_status_piutang = 0;
|
|
jml_status_tunai = 0;
|
|
$("#verif_bill").click(function () {
|
|
jml_status_piutang = 0;
|
|
jml_status_tunai = 0;
|
|
// cek orderbatal
|
|
|
|
if (dt_orderbatalbill > 0) {
|
|
Toast.fire({
|
|
title: "Maaf, masih terdapat <?php echo(($page_akses['kasir'] == true) ? 'pembayaran/verifikasi tunai' : (($page_akses['piutang'] == true) ? 'piutang/verifikasi piutang' : 'tindakan')); ?> yang diorder batal, batalkan <?php echo(($page_akses['kasir'] == true) ? 'pembayaran/verifikasi tunai' : (($page_akses['piutang'] == true) ? 'piutang/verifikasi piutang' : 'tindakan')); ?> tersebut terlebih dahulu",
|
|
type: "error"
|
|
});
|
|
return false;
|
|
}
|
|
// cek centang
|
|
st_centang = 0;
|
|
st_tak_centang = 0;
|
|
$(".cb_bill").each(function (e, v) {
|
|
is_centang = $(this).prop("checked");
|
|
|
|
if (is_centang) {
|
|
st_centang++;
|
|
} else {
|
|
st_tak_centang++;
|
|
}
|
|
});
|
|
|
|
if (st_tak_centang > 0) {
|
|
Toast.fire({title: "Maaf, ada beberapa transaksi belum dicentang.", type: "error"});
|
|
} else {
|
|
// cek pilihan carabayar
|
|
jml_status_piutang = 0;
|
|
jml_status_tunai = 0;
|
|
st_pilih = 0;
|
|
st_tak_pilih = 0;
|
|
$(".st_carabayar").each(function (e, v) {
|
|
is_pilih = $(this).find(":selected").val();
|
|
idx = $(this).data("idx");
|
|
|
|
if (is_pilih == '') {
|
|
st_tak_pilih++;
|
|
} else {
|
|
st_pilih++;
|
|
if (is_pilih == 1) {
|
|
// jml_status_tunai += parseFloat(accounting.formatMoney($("#hiden_total_bayar_"+idx).val(),'',2,'','.'));
|
|
jml_status_tunai += parseFloat($("#hiden_total_bayar_" + idx).val());
|
|
} else {
|
|
// jml_status_piutang += parseFloat(accounting.formatMoney($("#hiden_total_bayar_"+idx).val(),'',2,'','.'));
|
|
jml_status_piutang += parseFloat($("#hiden_total_bayar_" + idx).val());
|
|
}
|
|
}
|
|
});
|
|
|
|
if (st_tak_pilih > 0) {
|
|
Toast.fire({title: "Maaf, ada beberapa transaksi belum dipilih carabayarnya.", type: "error"});
|
|
} else {
|
|
/*
|
|
hitung_pembulatan();
|
|
|
|
setTimeout(function() {
|
|
nilai_bulat_piutang = parseFloat($("#bulat_piutang").val());
|
|
if(jml_status_piutang > 0) {
|
|
$("#nilai_pembulatan_piutang").val(nilai_bulat_piutang);
|
|
}
|
|
nilai_pembulatan = parseFloat($("#bulat_tunai").val());
|
|
|
|
if(jml_status_tunai > 0) {
|
|
$("#nilai_pembulatan").val(nilai_pembulatan);
|
|
}
|
|
|
|
if((nilai_pembulatan*1) > 0 || (nilai_bulat_piutang*1) > 0) {
|
|
$("#modal-pembulatan").modal("show");
|
|
}
|
|
else {*/
|
|
// console.log("Tidak ada pembulatan");
|
|
var form_bill = $("#form_update_carabayar").serialize();
|
|
$.post("<?php echo _BASE_; ?>include/master.php", form_bill + "&verif_billranap=1", function (data) {
|
|
Toast.fire({
|
|
title: data.message, type: data.type, onClose: () => {
|
|
if (data.type == "success") {
|
|
window.location.reload();
|
|
}
|
|
}
|
|
});
|
|
}, "json");
|
|
/*}
|
|
},200);*/
|
|
}
|
|
}
|
|
});
|
|
$(".bayarDeposito").click(function () {
|
|
idxbill = $(this).data("idxbill");
|
|
idxdaftar = $(this).data("idxdaftar");
|
|
|
|
$.post('<?php echo _BASE_;?>ranap/save_deposito.php?page=bayar', {idxbill, idxdaftar}, function (data) {
|
|
Toast.fire({
|
|
title: data.message, type: data.type, onClose: () => {
|
|
if (data.type == 'success') {
|
|
print_deposit(data.nobayar);
|
|
window.location.reload();
|
|
}
|
|
}
|
|
});
|
|
}, "json");
|
|
});
|
|
$('.bayar_bill').click(function () {
|
|
var idxdaftar = $(this).data("idxdaftar");
|
|
var nobill = $(this).data("nobill");
|
|
var idxbill = $(this).data("idxbill");
|
|
$.post('<?php echo _BASE_; ?>include/master.php', {
|
|
bayar_bill_ranap_peritem: true,
|
|
idxbill
|
|
}, function (data) {
|
|
Toast.fire({
|
|
title: data.message, type: data.type, onClose: () => {
|
|
if (data.type == 'success') {
|
|
print_pembayaran(data.nobayar);
|
|
// window.location.reload();
|
|
}
|
|
}
|
|
});
|
|
}, "json");
|
|
});
|
|
|
|
$('#edit_carabayar').click(function () {
|
|
var idxbill = $(this).attr('id');
|
|
var oldval = $(this).attr('oldval');
|
|
$("span[id^='text_carabayar_'],span[id^='text_penjamin_']").hide();
|
|
$(".st_carabayar").show();
|
|
$(".kd_penjamin").select2().show();
|
|
$('#save_carabayar').css({'display': 'inline'});
|
|
$(this).css({'display': 'none'});
|
|
});
|
|
$('#save_carabayar').click(function () {
|
|
$.post('<?php echo _BASE_;?>update_carabayar_billranap.php', $('#form_update_carabayar').serialize(), function (data) {
|
|
if (!data) {
|
|
location.reload();
|
|
}
|
|
});
|
|
});
|
|
$('#keringanan_biaya').keyup(function () {
|
|
var val = $(this).val();
|
|
var nilai_keringanan = parseFloat(val.replace(/\./g, ""));
|
|
|
|
if (nilai_keringanan > 0) {
|
|
$("#approval").collapse('show');
|
|
$('#approval_req').addClass('required');
|
|
|
|
var tottarif = parseFloat($("#total").val().replace(/\./g, ""));
|
|
|
|
if (nilai_keringanan > tottarif) {
|
|
$(this).val(tottarif);
|
|
alert("Jumlah melebihi total yang harus dibayar!!!");
|
|
}
|
|
} else {
|
|
$("#approval").collapse('hide');
|
|
$('#approval_req').removeClass('required');
|
|
}
|
|
|
|
calc_total();
|
|
});
|
|
$('.calc').keyup(function () {
|
|
counttotal();
|
|
});
|
|
|
|
function counttotal() {
|
|
$("#hide_grandtotal").calc(
|
|
"total - asuransi - keringanan_biaya - deposit ", {
|
|
total: $("#hide_total"),
|
|
keringanan_biaya: $("#keringanan_biaya"),
|
|
deposit: $('#hide_deposit'),
|
|
asuransi: $('#hide_asuransi')
|
|
},
|
|
function (s) {
|
|
return s.toFixed(0);
|
|
},
|
|
function ($this) {
|
|
var sums = $this.val();
|
|
//alert(sums);
|
|
$('#total_bayar').val(accounting.formatMoney(sums));
|
|
}
|
|
);
|
|
}
|
|
|
|
function calc_total() {
|
|
var tottarif = parseFloat($("#total").val().replace(/\./g, ""));
|
|
var asuransi = parseFloat($("#asuransi").val().replace(/\./g, ""));
|
|
var keringanan = parseFloat($("#keringanan_biaya").val().replace(/\./g, ""));
|
|
var deposit = parseFloat($("#deposit").val().replace(/\./g, ""));
|
|
var totakhir = tottarif - asuransi - keringanan - deposit;
|
|
|
|
$("#total_bayar1").val(accounting.formatMoney(totakhir));
|
|
}
|
|
|
|
$(".st_carabayar").on("change", function () {
|
|
|
|
var nilai = $(this).find(":selected").val();
|
|
var status = $(this).find(":selected").text();
|
|
var status_val = $(this).val();
|
|
var idx = $(this).data("idx");
|
|
/*
|
|
if(status == 'Piutang' || status_val == 2)
|
|
{
|
|
penjamin_global = $("#penjamin-global").find(":selected").val();
|
|
|
|
var data_penjamin = "<?php // echo preg_replace("/\"/","\\\"",preg_replace("/\n/",'',form_dropdown('kd_penjamin[{idx}]',$arr_penjamin,'','class="form-control input-sm kd_penjamin" id="penjamin-{idx}" onchange="changePenjamin(this)"'))); ?>";
|
|
var res_penjamin = data_penjamin.replace('{idx}',idx);
|
|
var regex_penjamin = new RegExp('value="'+penjamin_global+'"');
|
|
var res_penjamin = res_penjamin.replace(regex_penjamin,'value="'+penjamin_global+'" selected');
|
|
hitung_total();
|
|
}
|
|
else {
|
|
var data_penjamin = "<?php // echo preg_replace("/\"/","\\\"",preg_replace("/\n/",'',form_dropdown('kd_penjamin[{idx}]',array(),'','class="form-control input-sm kd_penjamin" id="penjamin-{idx}" style="width:100%"'))); ?>";
|
|
var res_penjamin = data_penjamin.replace('{idx}',idx);
|
|
hitung_total();
|
|
}
|
|
|
|
$("#penjamin_wrapper_"+idx).html(res_penjamin);
|
|
$("select.kd_penjamin").css("width","100%").select2();
|
|
*/
|
|
hitung_total();
|
|
});
|
|
|
|
cek_carabayar = [];
|
|
total_tunai = 0;
|
|
total_piutang = 0;
|
|
|
|
function hitung_total() {
|
|
cek_carabayar = [];
|
|
$("[id^=carabayar-]").each(function () {
|
|
var idx = $(this).data("idx");
|
|
var jumlah = $(this).data("total");
|
|
if ($(this).val() != '') {
|
|
var status = ($(this).val() == '2') ? 'Piutang' : 'Tunai';
|
|
} else {
|
|
var status = $(this).find(":selected").text();
|
|
}
|
|
var status_val = ($(this).val() != '') ? $(this).val() : $(this).find(":selected").val();
|
|
if (status_val != '') {
|
|
cek_carabayar.push([idx, status, jumlah]);
|
|
}
|
|
});
|
|
total_tunai = 0;
|
|
total_piutang = 0;
|
|
$.each(cek_carabayar, function (k, v) {
|
|
if (v[0] == undefined) {
|
|
console.log("----");
|
|
} else {
|
|
if (v[1] == 'Tunai') {
|
|
total_tunai += v[2];
|
|
} else if (v[1] == 'Piutang') {
|
|
total_piutang += v[2];
|
|
}
|
|
}
|
|
});
|
|
|
|
$("#jumlah_bayar").val(accounting.formatMoney(total_tunai, '', 2, '.', ','));
|
|
$("#piutang").val(accounting.formatMoney(total_piutang, '', 2, '.', ','));
|
|
}
|
|
|
|
$(".st_carabayar").hide();
|
|
// $(".kd_penjamin").select2("destroy").hide();
|
|
total_tarif = 0;
|
|
cek_bill = Array();
|
|
$(".cb_bill").on("click", function () {
|
|
this_row_carabayar = $(this).data("row_carabayar");
|
|
var carabayar = (this_row_carabayar) ? this_row_carabayar : $('#carabayar-global').find(":selected").val();
|
|
var stcek = $(this).is(":checked");
|
|
var id = $(this).data("idbill");
|
|
var tottarif = $(this).data("total");
|
|
var deposit = parseFloat($("#deposit").val().replace(/\./g, ""));
|
|
if (stcek == true) {
|
|
status_carabayar = (carabayar == 1) ? '1' : '2';
|
|
$("#carabayar-" + id).val(status_carabayar).trigger("change");
|
|
total_tarif = total_tarif + tottarif;
|
|
cek_bill.push(id);
|
|
} else {
|
|
$("#carabayar-" + id).val("").trigger("change");
|
|
if (total_tarif > 0) {
|
|
total_tarif = total_tarif - tottarif;
|
|
}
|
|
for (i = 0; i < cek_bill.length; i++) {
|
|
if (cek_bill[i] == id) {
|
|
cek_bill.splice(i, 1);
|
|
}
|
|
}
|
|
}
|
|
/* hitung bayar dan piutang bukan lewat checkbox
|
|
/*
|
|
$("#checkbox_bill").val(JSON.stringify(cek_bill));
|
|
var total_harus_bayar = 0;
|
|
if(total_tarif > 0){
|
|
total_harus_bayar = total_tarif - deposit;
|
|
}
|
|
|
|
$("#jumlah_bayar").val(accounting.formatMoney(total_harus_bayar));
|
|
var total = parseFloat($("#total").val().replace(/\./g,""));
|
|
var piutang = total - (deposit + total_harus_bayar);
|
|
$("#piutang").val(accounting.formatMoney(piutang));
|
|
*/
|
|
});
|
|
|
|
$("#cb_all").on("click", function () {
|
|
var stcek = $(this).prop("checked");
|
|
$('.cb_bill').trigger("click");
|
|
});
|
|
|
|
$("#carabayar-global").on("change", function () {
|
|
glob_val = $(this).find(":selected").val();
|
|
glob_status = $(this).find(":selected").text();
|
|
$(".st_carabayar").val(glob_val).trigger("change");
|
|
|
|
if (glob_status == 'Piutang') {
|
|
var data_penjamin = "<?php echo preg_replace("/\"/", "\\\"", preg_replace("/\n/", '', form_dropdown('kd_penjamin', $arr_penjamin, '', 'class="form-control input-sm" id="penjamin-global" onchange="changePenjaminGlobal(this)"'))); ?>";
|
|
} else {
|
|
var data_penjamin = "<?php echo preg_replace("/\"/", "\\\"", preg_replace("/\n/", '', form_dropdown('kd_penjamin', array(), '', 'class="form-control input-sm" id="penjamin-global"'))); ?>";
|
|
}
|
|
$("#penjamin_global").html(data_penjamin);
|
|
$("#penjamin-global").css("width", "100%").select2();
|
|
});
|
|
|
|
$('.print_deposit').click(function () {
|
|
// print_deposit($(this).prop("id"));
|
|
});
|
|
|
|
$('.tindakan').click(function () {
|
|
var nomr = $('#nomr').val();
|
|
var idxdaftar = $('#id_admission').val();
|
|
var carabayar = $('#st_bayar').val();
|
|
var query = $("#tarif_query").val();
|
|
var tgl_request_krs = "<?php echo $tgl_request_krs; ?>";
|
|
if (query == '') {
|
|
Toast.fire({title: 'Pencarian Tarif', text: 'Isikan keyword pencarian!', type: 'error'});
|
|
} else {
|
|
$("#modal-cartbill .modal-title").text("Tarif Tindakan");
|
|
$("#modal-cartbill .modal-dialog").css("max-width", "98%");
|
|
$("#modal-cartbill .btn-success").css("display", "none");
|
|
$("#modal-cartbill .modal-body").load('daftar_tindakan_klinik.php?nomr=' + nomr + '&idx=' + idxdaftar + '&carabayar=' + carabayar + '&query=' + query + '&st_rajal=0&tgl_request_krs=' + tgl_request_krs);
|
|
$("#modal-cartbill").modal("show");
|
|
|
|
$("#modal-cartbill").on("hidden.bs.modal", function () {
|
|
window.location.reload();
|
|
});
|
|
}
|
|
});
|
|
});
|
|
|
|
function hitung_pembulatan() {
|
|
setelah_bulat = 0;
|
|
|
|
jml_status_tunai_math = (((jml_status_tunai + Number.EPSILON) * 100) / 100).toFixed(2);
|
|
jml_status_piutang_math = (((jml_status_piutang + Number.EPSILON) * 100) / 100).toFixed(2);
|
|
/*
|
|
console.log('%c Sebelum dibulatakan : %c Piutang '+jml_status_piutang+' %c Tunai '+jml_status_tunai,
|
|
'background:#ddd;color:#000;padding:4x;border-radius:2px',
|
|
'background:#6f6;color:#000;padding:4x;border-radius:2px',
|
|
'background:#f66;color:#000;padding:4x;border-radius:2px'
|
|
);
|
|
|
|
console.log('%c Pembulatan Math : %c Piutang '+jml_status_piutang_math+' %c Tunai '+jml_status_tunai_math,
|
|
'background:#ddd;color:#000;padding:4x;border-radius:2px',
|
|
'background:#6f6;color:#000;padding:4x;border-radius:2px',
|
|
'background:#f66;color:#000;padding:4x;border-radius:2px'
|
|
);
|
|
*/
|
|
if (jml_status_piutang_math > 0) {
|
|
$.post("<?php echo _BASE_ . 'include/master.php'; ?>", {
|
|
hitung_pembulatan: 1,
|
|
total_biaya: jml_status_piutang_math
|
|
}, function (data) {
|
|
$("#bulat_piutang").val(data.hasil.pembulatan);
|
|
/*console.log('%c Hasil hitung piutang : %c '+data.hasil.pembulatan+' | '+data.hasil.setelah_pembulatan,
|
|
'background:#ddd;color:#000;padding:4x;border-radius:2px',
|
|
'background:#6f6;color:#000;padding:4x;border-radius:2px'
|
|
);*/
|
|
setelah_bulat += data.hasil.setelah_pembulatan;
|
|
}, "json");
|
|
/*
|
|
$.post("<?php echo _BASE_ . 'include/master.php'; ?>",{hitung_pembulatan:1,total_biaya:jml_status_piutang_math},function(data){
|
|
console.log('%c Hasil hitung piutang math: %c '+data.hasil.pembulatan+' | '+data.hasil.setelah_pembulatan,
|
|
'background:#ddd;color:#000;padding:4x;border-radius:2px',
|
|
'background:#6f6;color:#000;padding:4x;border-radius:2px'
|
|
);
|
|
},"json");
|
|
*/
|
|
}
|
|
|
|
if (jml_status_tunai_math > 0) {
|
|
$.post("<?php echo _BASE_ . 'include/master.php'; ?>", {
|
|
hitung_pembulatan: 1,
|
|
total_biaya: jml_status_tunai_math
|
|
}, function (data) {
|
|
$("#bulat_tunai").val(data.hasil.pembulatan);
|
|
/*console.log('%c Hasil hitung tunai : %c '+data.hasil.pembulatan+' | '+data.hasil.setelah_pembulatan,
|
|
'background:#ddd;color:#000;padding:4x;border-radius:2px',
|
|
'background:#6f6;color:#000;padding:4x;border-radius:2px'
|
|
);*/
|
|
setelah_bulat += data.hasil.setelah_pembulatan;
|
|
}, "json");
|
|
/*
|
|
$.post("<?php echo _BASE_ . 'include/master.php'; ?>",{hitung_pembulatan:1,total_biaya:jml_status_tunai_math},function(data){
|
|
console.log('%c Hasil hitung tunai math : %c '+data.hasil.pembulatan+' | '+data.hasil.setelah_pembulatan,
|
|
'background:#ddd;color:#000;padding:4x;border-radius:2px',
|
|
'background:#6f6;color:#000;padding:4x;border-radius:2px'
|
|
);
|
|
},"json");
|
|
*/
|
|
}
|
|
|
|
setTimeout(function () {
|
|
/*console.log(jml_status_tunai,jml_status_piutang);
|
|
console.log(setelah_bulat);*/
|
|
$("#total_biaya_pembulatan").val((parseFloat(jml_status_tunai_math) + parseFloat(jml_status_piutang_math)));
|
|
$("#total_setelah_bulat").val(setelah_bulat);
|
|
}, 200);
|
|
}
|
|
|
|
function printRaw(rajal_status, nomr, idxdaftar, nobill, nobayar, aps) {
|
|
petugas = $("#petugas").val();
|
|
tanggal = $("#tanggal").val();
|
|
$.post("<?php echo _BASE_;?>keuangan/print_kuitansi.php", {
|
|
rajal_status,
|
|
nomr,
|
|
idxdaftar,
|
|
nobill,
|
|
nobayar,
|
|
aps,
|
|
tanggal,
|
|
petugas,
|
|
raw: 1
|
|
}, function (print_command) {
|
|
jspm_print_raw(print_command);
|
|
});
|
|
}
|
|
|
|
function print_deposit(nobayar) {
|
|
jspm_print('<?php echo _BASE_; ?>print_kuitansi_uangmuka.php?nobayar=' + nobayar, 'modal-preview', 'Uang Muka ' + nobayar + '.pdf', 0);
|
|
}
|
|
|
|
function print_pembayaran(nobayar) {
|
|
var nomr = $("#nomr").val();
|
|
var nobill = $("#nobill_bayar").val();
|
|
var idxdaftar = $("#id_admission").val();
|
|
var tanggal = $("#tanggal").val();
|
|
var petugas = $("#petugas").val();
|
|
|
|
jspm_print('<?php echo _BASE_; ?>keuangan/print_kuitansi.php?nomr=' + nomr + '&nobill=' + nobill + '&idxdaftar=' + idxdaftar + '&rajal_status=0&tanggal=' + tanggal + "&nobayar=" + nobayar + "&petugas=" + petugas, 'modal-cartbill', 'Kuitansi Rawat Inap ' + nomr + '.pdf', 0);
|
|
|
|
cek_tombol_cetak = $("#cetak_raw").length;
|
|
if (cek_tombol_cetak > 0) {
|
|
$("#cetak_raw").remove();
|
|
}
|
|
$("#modal-cartbill .modal-footer").append("<button type=\"button\" id=\"cetak_raw\" class=\"btn btn-primary\" onclick=\"printRaw(0," + nomr + "," + idxdaftar + "," + nobill + ",'" + nobayar + "',0)\"><i class=\"fa fa-print\"></i> Cetak</button>");
|
|
}
|
|
|
|
function print_restitusi(nonota) {
|
|
jspm_print('<?php echo _BASE_; ?>print_nota_restitusi.php?nonota=' + nonota + '&rajal_status=0', 'modal-cartbill', 'Nota Restitusi ' + nonota + '.pdf', 0);
|
|
}
|
|
|
|
function printRawAkomodasi(rajal_status, nomr, idxdaftar, nobill, nonota, aps) {
|
|
$.post("<?php echo _BASE_;?>print_nota_tindakan.php", {
|
|
rajal_status,
|
|
nomr,
|
|
idxdaftar,
|
|
nobill,
|
|
nonota,
|
|
aps,
|
|
raw: 1
|
|
}, function (print_command) {
|
|
jspm_print_raw(print_command);
|
|
});
|
|
}
|
|
|
|
function print_akomodasi(nonota) {
|
|
var nomr = $("#nomr").val();
|
|
var nobill = $("#nobill_bayar").val();
|
|
var idxdaftar = $("#id_admission").val();
|
|
|
|
jspm_print('<?php echo _BASE_; ?>print_nota_tindakan.php?rajal_status=0&nomr=' + nomr + '&idxdaftar=' + idxdaftar + '&nobill=' + nobill + '&nonota=' + nonota, 'modal-cartbill', 'Nota Tindakan ' + nomr + '.pdf', 0);
|
|
|
|
cek_tombol_cetak = $("#cetak_raw").length;
|
|
if (cek_tombol_cetak > 0) {
|
|
$("#cetak_raw").remove();
|
|
}
|
|
$("#modal-cartbill .modal-footer").append("<button type=\"button\" id=\"cetak_raw\" class=\"btn btn-primary\" onclick=\"printRawAkomodasi(0," + nomr + "," + idxdaftar + "," + nobill + ",'" + nonota + "',0)\"><i class=\"fa fa-print\"></i> Cetak</button>");
|
|
}
|
|
</script>
|
|
<style>
|
|
.buton_edit {
|
|
cursor: pointer;
|
|
color: #03C;
|
|
}
|
|
|
|
input.error {
|
|
border: 1px solid #F00;
|
|
}
|
|
|
|
label.error {
|
|
color: #F00;
|
|
font-weight: bold;
|
|
}
|
|
</style>
|
|
<div align="center">
|
|
<div id="frame">
|
|
<div id="frame_title">
|
|
<h5>Cart Bayar Rawat Inap</h5></div>
|
|
<fieldset class="fieldset">
|
|
<?php
|
|
$db->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) ? '' : '<!--';
|
|
$end_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;
|
|
}
|
|
}
|
|
|
|
|
|
?>
|
|
<form name="bayar" action="include/process.php" id="formbayar" method="post">
|
|
<input type="hidden" name="hide_total" id="hide_total" value="<?php echo $userdata['tottarifrs']; ?>"/>
|
|
<input type="hidden" name="hide_deposit" id="hide_deposit" value="<?php echo $deposit; ?>"/>
|
|
<input type="hidden" name="hide_grandtotal" id="hide_grandtotal" value=""/>
|
|
<input type="hidden" name="hide_asuransi" id="hide_asuransi"
|
|
value="<?php echo $d_asuransi['total_asuransi']; ?>"/>
|
|
<input type="hidden" id="tanggal" value="<?php echo date('Y-m-d'); ?>"/>
|
|
<input type="hidden" name="petugas" id="petugas" value="<?php echo $_SESSION['NIP']; ?>"/>
|
|
<input type="hidden" name="idxranap" value="<?php echo $_REQUEST['idxb']; ?>"/>
|
|
<input type="hidden" name="nobill" value="<?php echo $userdata['nobill']; ?>" id="nobill_bayar"/>
|
|
<input type="hidden" name="nomr" value="<?php echo $userdata['nomr']; ?>" id="nomr"/>
|
|
<input type="hidden" name="id_admission" value="<?php echo $_REQUEST['idxb']; ?>" id="id_admission"/>
|
|
<input type="hidden" name="cb_bill" value="" id="checkbox_bill">
|
|
<input type="hidden" name="statusbayar" value="<?php echo $userdata['statusbayar']; ?>" id="st_bayar">
|
|
<input type="hidden" name="shift" value="<?php echo $_SESSION['SHIFT']; ?>">
|
|
|
|
<div class="container-fluid">
|
|
<div class="row">
|
|
<div class="<?php echo $class_col_identitas; ?>">
|
|
<?php
|
|
$a = datediff($userdata['tgllahir'], date("Y-m-d"));
|
|
if ($userdata['keluarrs'] != null) {
|
|
$d1 = new Datetime($userdata['masukrs']);
|
|
$d2 = new Datetime($userdata['keluarrs']);
|
|
$jml_hari_rawat = ($d1->diff($d2)->format('%a') + 1);
|
|
} else {
|
|
$jml_hari_rawat = 0;
|
|
}
|
|
echo '<div class="row text-left">
|
|
<div class="col-sm-4">
|
|
<div class="form-group">
|
|
<label>No RM</label>
|
|
<input type="text" class="form-control form-control-sm" value="' . $userdata['nomr'] . '" disabled>
|
|
</div>
|
|
<div class="form-group">
|
|
<label>Nama Pasien</label>
|
|
<input type="text" class="form-control form-control-sm" value="' . $userdata['nama'] . '" disabled>
|
|
</div>
|
|
<div class="form-group">
|
|
<label>Alamat</label>
|
|
<input type="text" class="form-control form-control-sm" value="' . $userdata['alamat'] . '" disabled>
|
|
</div>
|
|
<div class="form-group">
|
|
<label>Tanggal Lahir</label>
|
|
<input type="text" class="form-control form-control-sm" value="' . date_to_id($userdata['tgllahir']) . '" disabled>
|
|
</div>
|
|
</div>
|
|
<div class="col-sm-4">
|
|
<div class="form-group">
|
|
<label>Umur</label>
|
|
<input type="text" class="form-control form-control-sm" value="' . $a['years'] . ' tahun ' . $a['months'] . ' bulan ' . $a['days'] . ' hari" disabled>
|
|
</div>
|
|
<div class="form-group">
|
|
<label>Jenis Kelamin</label>
|
|
<input type="text" class="form-control form-control-sm" value="' . jeniskelamin($userdata['jeniskelamin']) . '" disabled>
|
|
</div>
|
|
<div class="form-group">
|
|
<label>Jenis Pembayaran</label>
|
|
<input type="text" class="form-control form-control-sm" value="' . $userdata['carabayar'] . '" disabled>
|
|
</div>
|
|
<div class="form-group">
|
|
<label>Ruang / No TT</label>
|
|
<input type="text" class="form-control form-control-sm" value="' . $userdata['ruang'] . ' / ' . $userdata['nott'] . '" disabled>
|
|
</div>
|
|
</div>
|
|
<div class="col-sm-4">
|
|
<div class="form-group">
|
|
<label>No. Billing</label>
|
|
<input type="text" class="form-control form-control-sm" style="font-weight:bold;font-size:16px" value="' . $userdata['nobill'] . '" disabled>
|
|
</div>
|
|
<div class="form-group">
|
|
<label>Tanggal MRS</label>
|
|
<input type="text" class="form-control form-control-sm" value="' . datetime_to_dateid($userdata['masukrs']) . '" disabled>
|
|
</div>
|
|
<div class="form-group">
|
|
<label>Tanggal <span id="trig_ako">KRS</span></label>
|
|
<input type="text" class="form-control form-control-sm" value="' . (($userdata['keluarrs'] != null) ? datetime_to_dateid($userdata['keluarrs']) : '') . '" disabled>
|
|
</div>
|
|
<div class="form-group">
|
|
<label>Jumlah Hari Rawat</label>
|
|
<input type="text" class="form-control form-control-sm" value="' . $jml_hari_rawat . '" disabled>
|
|
</div>
|
|
</div>
|
|
</div>';
|
|
$d_none = ($page_akses['piutang'] == 1) ? 'd-none' : '';
|
|
?>
|
|
</div>
|
|
<?php echo $hidden_entritindakan; ?>
|
|
<div class="col-md-4">
|
|
<div class="card">
|
|
<h5 class="card-header">Tarif Tindakan</h5>
|
|
<div class="card-body">
|
|
<div class="row">
|
|
<div class="col-md-12">
|
|
<div class="input-group">
|
|
<?php
|
|
if ($sudah_admkl) {
|
|
echo '<div class="alert alert-info">Penambahan tindakan sudah terkunci.</div>';
|
|
}
|
|
else {
|
|
?>
|
|
<input type="text" name="query" id="tarif_query" class="form-control"
|
|
placeholder="">
|
|
<div class="input-group-append"><input type="button"
|
|
name="tindakan_poly"
|
|
class="tindakan btn btn-outline-secondary"
|
|
id="<?php echo $userdata['noruang']; ?>"
|
|
value="Cari Tarif"/></div>
|
|
</div>
|
|
<?php } ?>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<?php
|
|
$str_query_piutang_pribadi = "SELECT pas.nomr,br.nobill,pas.nama, sum(br.tarifrs) as jumlah from t_billrajal br
|
|
join m_tarif_rs t on br.kodetarif = t.kode_tarif
|
|
join t_piutang p on p.idxbill = br.idxbill
|
|
join t_pendaftaran tp on br.idxdaftar = tp.idxdaftar
|
|
join m_pasien pas on tp.nomr = pas.nomr
|
|
where p.st_billing = 'IRJA' and p.kode_penjamin = 5
|
|
and p.st_piutang is null and br.idxdaftar = {$_REQUEST['idxb']}
|
|
group by pas.nomr,br.nobill,pas.nama";
|
|
$cek_trans_piutang = $db->query($str_query_piutang_pribadi);
|
|
if ($cek_trans_piutang->numRows() > 0) {
|
|
?>
|
|
<div class="card">
|
|
<h5 class="card-header">Informasi Piutang</h5>
|
|
<div class="card-body">
|
|
<div class="row">
|
|
<div class="col-md-12">
|
|
<button id="list_piutang_rajal" class="btn btn-sm btn-primary">Piutang
|
|
R.Jalan/R. Darurat
|
|
</button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<?php
|
|
}
|
|
echo '</div>';
|
|
echo $end_hidden_entritindakan; ?>
|
|
</div>
|
|
</div>
|
|
<hr>
|
|
<div class="row">
|
|
<div class="col-sm-4">
|
|
<div class="form-group row text-left <?php echo $d_none; ?>">
|
|
<label class="form-control-label col-sm-4">Total Biaya</label>
|
|
<div class="col-sm-8">
|
|
<div class="input-group">
|
|
<span class="input-group-prepend"><span class="input-group-text"
|
|
id="basic-addon1">Rp</span></span>
|
|
<input type="text" id="total" readonly="readonly" style="text-align:right"
|
|
name="total" class="form-control calc" size="10"
|
|
value="<?php echo format_uang($userdata['tottarifrs']); ?>"/>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="form-group row text-left d-none">
|
|
<label class="form-control-label col-sm-4">Di Bayar Asuransi </label>
|
|
<div class="col-sm-8">
|
|
<div class="input-group">
|
|
<span class="input-group-prepend"><span class="input-group-text"
|
|
id="basic-addon1">Rp</span></span>
|
|
<input type="text" id="asuransi" readonly="readonly" style="text-align:right"
|
|
name="asuransi" class="form-control calc" size="10"
|
|
value="<?php echo format_uang($d_asuransi['total_asuransi']); ?>"/>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="form-group row text-left <?php echo ($userdata['totcostsharing'] > 0) ? '' : 'd-none'; ?>">
|
|
<label class="form-control-label col-sm-4">Keringanan Biaya</label>
|
|
<div class="col-sm-8">
|
|
<div class="input-group">
|
|
<span class="input-group-prepend"><span class="input-group-text"
|
|
id="basic-addon1">Rp</span></span>
|
|
<input type="text" style="text-align:right"
|
|
value="<?php echo format_uang($userdata['totcostsharing']); ?>"
|
|
id="keringanan_biaya" name="keringanan_biaya"
|
|
class="form-control calc mask-money" size="10" readonly="true"/>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="form-group row text-left collapse" id="approval">
|
|
<label class="form-control-label col-sm-4">Approval</label>
|
|
<div class="col-sm-8">
|
|
<div class="input-group">
|
|
<span class="input-group-prepend"><span class="input-group-text"
|
|
id="basic-addon1">Acc No</span></span>
|
|
<input type="text" class="form-control" size="100" name="approval"
|
|
id="approval_req" title="*" value=""/>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
|
|
</div>
|
|
<div class="col-sm-4">
|
|
<div class="form-group row text-left <?php echo $d_none; ?>">
|
|
<label class="form-control-label col-sm-4">Deposit</label>
|
|
<div class="col-sm-8">
|
|
<div class="input-group">
|
|
<span class="input-group-prepend"><span class="input-group-text"
|
|
id="basic-addon1">Rp</span></span>
|
|
<input type="text" style="text-align:right" readonly="readonly" name="deposit"
|
|
id="deposit" class="form-control calc" size="10"
|
|
value="<?php echo format_uang($deposit); ?>"/>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="form-group row text-left <?php echo $d_none; ?>">
|
|
<label class="form-control-label col-sm-4">Jml. harus dibayar</label>
|
|
<div class="col-sm-8">
|
|
<div class="input-group">
|
|
<span class="input-group-prepend"><span class="input-group-text"
|
|
id="basic-addon1">Rp</span></span>
|
|
<input type="text" style="text-align:right" readonly="readonly"
|
|
name="total_bayar1" id="total_bayar1" class="form-control calc" size="10"
|
|
value="<?php echo format_uang($a2); ?>"/>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
</div>
|
|
<div class="col-sm-4">
|
|
<div class="form-group row text-left <?php echo ($page_akses['piutang'] == 1) ? $d_none : ''; ?>">
|
|
<label class="form-control-label col-sm-4">Jml. Tunai</label>
|
|
<div class="col-sm-8">
|
|
<div class="input-group">
|
|
<span class="input-group-prepend"><span class="input-group-text"
|
|
id="basic-addon1">Rp</span></span>
|
|
<input type="text" style="text-align:right" readonly="readonly"
|
|
name="jumlah_bayar" id="jumlah_bayar" class="form-control calc" size="10"
|
|
value=""/>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="form-group row text-left <?php echo ($page_akses['piutang'] == 1) ? '' : $d_none; ?>">
|
|
<label class="form-control-label col-sm-4">Jml. Piutang</label>
|
|
<div class="col-sm-8">
|
|
<div class="input-group">
|
|
<span class="input-group-prepend"><span class="input-group-text"
|
|
id="basic-addon1">Rp</span></span>
|
|
<input type="text" style="text-align:right" readonly="readonly" name="piutang"
|
|
id="piutang" class="form-control calc" size="10" value=""/>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="form-group row text-left">
|
|
<label class="form-control-label col-sm-4"> </label>
|
|
<div class="col-sm-8">
|
|
<?php
|
|
if ($_SESSION['ROLES'] == 2 && $page_akses['v'] == 1) {
|
|
if ($page_akses['kasir']) {
|
|
echo '<button type="button" name="Submit" id="simpan" class="btn btn-primary btn-sm"><i class="fa fa-money"></i> SIMPAN </button>';
|
|
}
|
|
if ($page_akses['piutang']) {
|
|
echo '<button type="button" name="Submit" id="simpan" class="btn btn-danger btn-sm"><i class="fa fa-money"></i> SIMPAN PIUTANG </button>';
|
|
}
|
|
}
|
|
if (in_array($_SESSION['ROLES'], $roles_verifikator)) {
|
|
if ($page_akses['verif']) {
|
|
if ($sudah_akomodasi == false) {
|
|
echo '<button type="button" id="btnTambahAkomodasi" class="btn btn-outline-success btn-sm"><i class="fa fa-calculator"></i> AKOMODASI</button>';
|
|
// echo '<button type="button" id="btnTambahAkomodasiNew" class="btn btn-outline-success btn-sm"><i class="fa fa-calculator"></i> AKOMODASI New</button>';
|
|
} else {
|
|
echo '<label class="label label-info"><p>Akomodasi Sudah Dientrikan!</p></label>';
|
|
}
|
|
if ($sudah_pembulatan == false) {
|
|
// echo '<button type="button" id="btnTambahPembulatan" class="btn btn-outline-info btn-sm"><i class="fa fa-calculator"></i> PEMBULATAN</button>';
|
|
} else {
|
|
// echo '<label class="label label-info"><p>Pembulatan Sudah Dientrikan!</p></label>';
|
|
}
|
|
}
|
|
if ($page_akses['piutang']) {
|
|
echo '<button type="button" name="Submit" id="simpan" class="btn btn-danger btn-sm"><i class="fa fa-money"></i> SIMPAN PIUTANG </button>';
|
|
}
|
|
}
|
|
?>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</form>
|
|
</fieldset>
|
|
</div>
|
|
|
|
<div class="container-fluid">
|
|
<form id="form_update_carabayar">
|
|
<input type="hidden" name="nobill" value="<?php echo $_REQUEST['nobill']; ?>"/>
|
|
<input type="hidden" name="id_admission" value="<?php echo $_REQUEST['idxb']; ?>"/>
|
|
<input type="hidden" id="bulat_tunai" value=""/>
|
|
<input type="hidden" id="bulat_piutang" value=""/>
|
|
<table border="0" cellpadding="0" cellspacing="0" class="table table-bordered table-striped table-sm">
|
|
|
|
<?php
|
|
echo '<tr class="bg-success text-white">';
|
|
if ($page_akses['kasir'] || $page_akses['verif']) {
|
|
echo '<th style="width:3%">#</th>';
|
|
} else {
|
|
echo '<th style="width:3%"><input type="checkbox" id="cb_all" class=""></th>';
|
|
}
|
|
|
|
echo '
|
|
<th style="width:7%; text-align:center;">Tanggal </th>
|
|
<th style="width:5%">Nonota</th>
|
|
<th style="width:10%">Kode Tarif</th>
|
|
<th style="width:15%">Nama Tarif</th>
|
|
<th style="width:7%; text-align:center;">Tarif</th>
|
|
<th style="width:10%; text-align:center;">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 '</th>';
|
|
if ($page_akses['piutang'] == 1) {
|
|
echo '<th style="width:12%; text-align:center;">Penjamin<div id="penjamin_global">' . form_dropdown('kd_penjamin', $arr_penjamin, '', 'class="form-control input-sm" id="penjamin-global" onchange="changePenjaminGlobal(this)" style="width:100%"') . '</div></th>';
|
|
}
|
|
|
|
echo '<th style="width:5%; text-align:center;">Aksi</th>
|
|
</tr>';
|
|
|
|
$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) ? '<span class="bg-success text-white p-2">Verif<i class="fa fa-check"></i></span>' : '<span class="bg-danger text-white p-2">Verif <i class="fa fa-times"></i></span>';
|
|
if ($page_akses['piutang'] == true) {
|
|
$st_bayar = ($data['kd_penjamin'] == '') ? '' : '<span class="bg-success text-white p-2">Piutang <i class="fa fa-check"></i></span>';
|
|
} else {
|
|
$st_bayar = ($data['tglbayar'] == '' || $data['tglbayar'] == '0000-00-00' || $data['tglbayar'] == '0001-01-01') ? '<span class="bg-danger text-white p-2"><i class="fa fa-times"></i> Bayar</span>' : '<span class="bg-success text-white p-1"><i class="fa fa-check"></i>Lunas</span>';
|
|
}
|
|
|
|
// $status_orderbatal = ($data['status'] == 'BATAL') ? '<br><small><span class="bg-yellow text-white p-1">Diorder batal dengan alasan : '.$data['alasan_batal'].'</span></small>' : '';
|
|
$jasa = $js['uraian_tarif'];
|
|
|
|
if ($page_akses['verif'] == 0 and $data['nama_jasa'] == 'DEPOSIT') {
|
|
$st_verif = ($data['status_verifikasi'] == 1 && $data['st_bayar'] == 'TRX') ? '<button type="button" class="bayarDeposito btn btn-primary btn-sm" data-idxbill="' . $data['idxbill'] . '" data-idxdaftar="' . $data['idxdaftar'] . '">Bayar</button>' : '<div class="bg-success text-white p-1 m-1">Lunas <i class="fa fa-money"></i></div>';
|
|
} else {
|
|
if ($data['status_verifikasi'] == 1) {
|
|
if ($data['st_bayar'] == 'TRX') {
|
|
$st_verif = '<div class="bg-success text-white p-1 m-1">Verif <i class="fa fa-check"></i></div>';
|
|
} elseif ($data['st_bayar'] == 'LUNAS') {
|
|
$st_verif = '<div class="bg-success text-white p-1 m-1">Lunas <i class="fa fa-money"></i></div>';
|
|
}
|
|
}
|
|
}
|
|
|
|
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 = '<input type="hidden" name="total[' . $data['idxbill'] . ']" id="hiden_total_bayar_' . $data['idxbill'] . '" value="' . $jumlah_biaya . '" />';
|
|
|
|
$checkbox = '<input type="checkbox" class="cb_bill" data-idbill="' . $data['idxbill'] . '" name="cb_bill[]" data-total="' . ($jumlah_biaya) . '" value="' . $data['idxbill'] . '">';
|
|
$html_temp = '<tr>
|
|
<td>' . $checkbox . $hidden_form . '</td>
|
|
<td>' . $data['tanggal'] . '</td>
|
|
<td>' . $data['nonota'] . '</td>
|
|
<td>' . $data['kode_tarif'] . '</td>
|
|
<td>' . $data['nama_jasa'] . '</td>
|
|
<td class="text-right"> Rp.' . format_uang($jumlah_biaya) . '</td>
|
|
<td>
|
|
<input type="hidden" name="idxbill[' . $data['idxbill'] . ']" value="' . $data['idxbill'] . '" />
|
|
' . (
|
|
($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%" ') : ''
|
|
) . '
|
|
<span class="d-none" id="text_carabayar_' . $data['idxbill'] . '">' . $data['nama_cara_bayar'] . '</span>
|
|
</td>';
|
|
$html_temp .= '<td align="center"> ';
|
|
|
|
if ($page_akses['v'] && $data['status_verifikasi'] == true && $data['jmbayar'] == 0) {
|
|
if ($data['nama_jasa'] == 'DEPOSIT') {
|
|
$html_temp .= '<input type="button" name="BayarDeposito" value="Bayar Deposito" class="btn btn-outline-success btn-sm bayarDeposito" data-idxdaftar="' . $data['idxdaftar'] . '" data-idxbill="' . $data['idxbill'] . '" id="bayarverif_' . $data['nobill'] . '"/>';
|
|
}
|
|
} else {
|
|
if ($data['nama_jasa'] == 'DEPOSIT') {
|
|
$btn_print_deposit = '<input type="button" name="print" value="Print" class="btn btn-outline-primary print_deposit btn-sm" id="' . $data['idxdaftar'] . '" />';
|
|
$html_temp .= $btn_print_deposit;
|
|
}
|
|
}
|
|
|
|
$html_temp .= '</td> </tr>';
|
|
|
|
} // jika user verifikator dan sudah diverfikasi
|
|
else {
|
|
$checkbox = '<input type="hidden" class="cb_bill" data-idbill="' . $data['idxbill'] . '" name="cb_bill[]" data-total="' . ($jumlah_biaya) . '" value="' . $data['idxbill'] . '">';
|
|
$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']) ? '<input type="checkbox" class="cb_bill" data-idbill="' . $data['idxbill'] . '" name="cb_bill[]" data-total="' . ($jumlah_biaya) . '" value="' . $data['idxbill'] . '" data-row_carabayar="' . $data['st_carabayar'] . '">' : $checkbox);
|
|
$html_temp = '<tr>
|
|
<td>' . $cb_bill . '</td>
|
|
<td>' . $data['tanggal'] . '</td>
|
|
<td>' . $data['nonota'] . '</td>
|
|
<td>' . $data['kode_tarif'] . '</td>
|
|
';
|
|
if ($page_akses['piutang']) {
|
|
$drop_carabayar = '<input type="hidden" id="carabayar-' . $data['idxbill'] . '" data-idx="' . $data['idxbill'] . '" data-total="' . str_replace(',', '.', $jumlah_biaya) . '" name="st_carabayar[' . $data['idxbill'] . ']" value="' . $data['st_carabayar'] . '" class="st_carabayar">';
|
|
} else {
|
|
$drop_carabayar = '';
|
|
}
|
|
$html_temp .= '<td>' . $data['nama_jasa'] . '</td>
|
|
<td class="text-right">' . "Rp. " . format_uang($jumlah_biaya) . '</td>
|
|
<td align="center">
|
|
<input type="hidden" name="idxbill[' . $data['idxbill'] . ']" value="' . $data['idxbill'] . '" />
|
|
<span id="text_carabayar_' . $data['idxbill'] . '">' . $data['nama_cara_bayar'] . '</span>
|
|
' . $drop_carabayar . '
|
|
</td>';
|
|
if ($page_akses['piutang']) {
|
|
$html_temp .= '<td valign="top" style="padding-top:7px;" id="penjamin_wrapper_' . $data['idxbill'] . '">
|
|
' . form_dropdown('kd_penjamin[' . $data['idxbill'] . ']', $arr_penjamin, '', 'class="form-control input-sm kd_penjamin" id="penjamin-' . $data['idxbill'] . '" style="width:100%"') . '
|
|
</td>';
|
|
}
|
|
$html_temp .= '<td align="center">' . $st_verif . '</td>
|
|
</tr>';
|
|
|
|
}
|
|
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 = '<button type="button" class="btn btn-outline-primary" id="verif_bill" '.$btn_disabled_verif.'>Verifikasi</button>';
|
|
}
|
|
// if($page_akses['d'] == 1 && $page_akses['verif'] == 1)
|
|
// {
|
|
// $button_akhir .= '<button type="button" class="btn btn-danger" id="batal_verif_bill">Batal Verif</button>';
|
|
// }
|
|
// if($page_akses['d'] == 1 && $page_akses['kasir'] == 1)
|
|
// {
|
|
// $button_akhir .= '<button type="button" class="btn btn-danger" id="batal_bayar">Batal Bayar</button>';
|
|
// }
|
|
$colspan_verif = ($page_akses['verif']) ? 5 : 5;
|
|
echo '<tr class="table-secondary">
|
|
<td colspan="' . $colspan_verif . '" class="text-right pr-3">TOTAL</td>
|
|
<td class="text-right"> Rp. ' . format_uang($total) . '</td>
|
|
<td colspan="2" class="text-right pr-3">' . $button_akhir . '</td>
|
|
</tr>';
|
|
?>
|
|
</table>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
<template id="akomodasi-template">
|
|
<div class="modal fade akomodasi-modal-lg" id="akomodasi-modal" role="dialog" aria-labelledby="akomodasiModal"
|
|
aria-hidden="true">
|
|
<div class="modal-dialog modal-lg" style="max-width: 85%">
|
|
<div class="modal-content">
|
|
<div class="modal-header">
|
|
<h5 class="modal-title">Tambah Akomodasi</h5>
|
|
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
|
<span aria-hidden="true">×</span>
|
|
</button>
|
|
</div>
|
|
<div class="modal-body">
|
|
<form id="akomodasi-form">
|
|
|
|
<table class="table table-bordered table-striped table-sm">
|
|
<thead>
|
|
<tr class="bg-success text-white">
|
|
<th width="5%">No</th>
|
|
<th width="10%">Nama Ruang</th>
|
|
<th width="10%">Tanggal Masuk</th>
|
|
<th width="10%">Tanggal Keluar</th>
|
|
<th width="10%">Jumlah Hari</th>
|
|
<th width="10%">Jumlah Hari Split</th>
|
|
<th width="40%">Tarif</th>
|
|
<th width="10%">Jumlah Akomodasi</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
<?php
|
|
$tgl_masuk = new DateTime($userdata['masukrs']);
|
|
$tgl_pulang = new DateTime($tgl_request_krs);
|
|
$tgl_pulang->add(new DateInterval('P2D'));
|
|
|
|
$selisih = $tgl_pulang->diff($tgl_masuk);
|
|
$jumlah_hari_rawat = $selisih->format("%a");
|
|
if($jumlah_hari_rawat == 0)
|
|
{
|
|
$jumlah_hari_rawat = 1;
|
|
}
|
|
|
|
$total_hari_rawat = 0;
|
|
if($userdata['tgl_pindah'] != '') {
|
|
|
|
$query_ruang = "SELECT *,r.nama||' '||r.kelas as nama_ruang,r.idx_ruang,r.kelas,rh.tgl_pindah as tanggal_pindah from t_admission_ruanghist rh join m_ruang r on r.no = rh.no_ruang_asal
|
|
WHERE rh.tgl_batal is null and idx_admission = ".$_REQUEST['idxb']." ORDER BY id_ruanghist";
|
|
|
|
$tmp_ruang = $db->query( $query_ruang );
|
|
$sudah_plus_satu = false;
|
|
$jml_ruang = $tmp_ruang->numRows();
|
|
|
|
if($tmp_ruang->numRows() > 0)
|
|
{
|
|
$i = 1;
|
|
$js_tarif_data = array();
|
|
$arr_lama_ruang_pindah = [];
|
|
foreach($tmp_ruang->fetchAll() as $row)
|
|
{
|
|
$cut_off = '2024-01-31';
|
|
$tarif_akomodasi = "SELECT *,(select nilai from m_tarifdetil where komponen like '%SARANA%' and kode_tarif = m_tarif_rs.kode_tarif) as jasa_sarana, (select nilai from m_tarifdetil where komponen like '%LAYANAN%' and kode_tarif = m_tarif_rs.kode_tarif) as jasa_pelayanan,pengguna from m_tarif_rs join m_tarifpengguna on m_tarif_rs.kode_tarif = m_tarifpengguna.kode_tarif join m_tarifkelas on m_tarif_rs.kelas_tarif = m_tarifkelas.kelas where (kelompok_tarif in('PERAWATAN') or kelompok_tarif in('AKOMODASI')) and (m_tarif_rs.kelas_tarif like '".trim($row['idx_ruang'])."%' or m_tarif_rs.kelas_tarif like 'REGULER%') and m_tarif_rs.aktif = 1";
|
|
$tmp_tarif = $db->query($tarif_akomodasi);
|
|
if($tmp_tarif->numRows() > 0)
|
|
{
|
|
$arr_tarif = array();
|
|
foreach($tmp_tarif->fetchAll() as $ds) {
|
|
$arr_tarif[$ds['kode_tarif'].'|'.$ds['id_tarif']] = $ds['kode_tarif'].' - '.$ds['uraian_tarif'].' - '.$ds['kelas'].' (Rp. '.format_uang($ds['jumlah']).')';
|
|
$js_tarif_data[$ds['kode_tarif']] = $ds['jumlah'];
|
|
}
|
|
}
|
|
|
|
if($row['tanggal_pindah'] != NULL && datetime_to_date_en($row['tanggal_pindah']) != '0000-00-00')
|
|
{
|
|
$d1 = new DateTime($row['tgl_awal']);
|
|
$d2 = new DateTime($row['tanggal_pindah']);
|
|
$jam = explode(':',datetime_to_time($row['tanggal_pindah']));
|
|
$diff = $d2->diff($d1);
|
|
$jml_hari = (datetime_to_date_en($row['tgl_awal']) != datetime_to_date_en($row['tanggal_pindah'])) ? 1 : $diff->format('%a');
|
|
$jml_hari2 = ($diff->format('%a') == 0) ? 1 : $diff->format('%a');
|
|
$lama = 0 ;
|
|
|
|
if($d1->format('Y-m-d') == $d2->format('Y-m-d'))
|
|
{
|
|
// jika tanggal pindah sama dengan tanggal masuk dan tidak ada ruang pindah
|
|
$lama += ($tmp_ruang->numRows() <= 1 || $diff->format('%h') >= 6 ) ? 1 : 0;
|
|
|
|
// jika vip maka tanggal pindah pada hari yang sama plus satu
|
|
if(preg_match("/VIP/", $row['kelas']) && $lama == 0) {
|
|
$lama += 1;
|
|
$sudah_plus_satu = true;
|
|
}
|
|
$arr_lama_ruang_pindah[$i] = $diff->format('%h');
|
|
}
|
|
elseif($d1->format('Y-m-d') != $d2->format('Y-m-d'))
|
|
{
|
|
if($i == 1) {
|
|
// jika record pertama
|
|
$lama = round(abs(strtotime($d2->format('Y-m-d')) - strtotime($d1->format('Y-m-d')))/86400);
|
|
|
|
// cek jam pindah
|
|
if($jam[0] >= 12) {
|
|
$lama += 1;
|
|
$sudah_plus_satu = true;
|
|
}
|
|
$arr_lama_ruang_pindah[$i] = $jam[0];
|
|
}
|
|
else {
|
|
// record selanjutnya
|
|
if($sudah_plus_satu == true) {
|
|
$lama = round(abs(strtotime($d2->format('Y-m-d')) - strtotime($d1->format('Y-m-d')))/86400);
|
|
$arr_lama_ruang_pindah[$i] = $jam[0];
|
|
}
|
|
else {
|
|
// $jam_awal = explode(":", datetime_to_time($row['tgl_awal']));
|
|
// if($diff->format('%h') > 6){
|
|
// $lama += 1;
|
|
// }
|
|
// var_dump($lama);
|
|
// if($jml_hari2 + $lama > ($jml_hari2+1)) {
|
|
// $lama = $jml_hari2 + 1;
|
|
// }
|
|
// else {
|
|
$lama = $jml_hari2 + $lama;
|
|
// }
|
|
// var_dump($lama);
|
|
|
|
if($sudah_plus_satu == false && $arr_lama_ruang_pindah[$i-1] != 0 && $arr_lama_ruang_pindah[$i-1] > 6 && $d1->format('H') < 12)
|
|
{
|
|
$lama += 1;
|
|
$sudah_plus_satu = true;
|
|
}
|
|
$arr_lama_ruang_pindah[$i] = $jam[0];
|
|
}
|
|
// log_message('error','sudah_plus_satu = '.$sudah_plus_satu.' | Lama dirawat sejak tgl '.$row['tgl_awal'].' s/d '.$row['tanggal_pindah'].' = '.$lama.' / '.$jml_hari2);
|
|
|
|
}
|
|
}
|
|
// jika tidak terjadi perpindahan, set tanggal pulang = hari ini
|
|
if($row['no_ruang_asal'] == $row['no_ruang_pindah'])
|
|
{
|
|
$d3 = new DateTime($tgl_request_krs);
|
|
$diff2 = $d3->diff($d1);
|
|
$lama2 = $diff2->format('%a');
|
|
if($d1->format('Y-m-d') == $d3->format('Y-m-d'))
|
|
{
|
|
$lama2 += 1;
|
|
}
|
|
$lama_split = '';
|
|
echo '<tr><td>'.$i.'</td>
|
|
<td>'.$row['nama_ruang'].'<input type="hidden" id="ruang-'.$i.'" value="'.$row['no_ruang_asal'].'"><input type="hidden" id="nott-'.$i.'" value="'.$row['no_tt_asal'].'"></td>
|
|
<td>'.$d1->format('d-m-Y').'</td>
|
|
<td>'.$d3->format('d-m-Y H:i:s').'</td>
|
|
<td>'.$lama2.'<input type="hidden" id="jml_hari-'.$i.'" value="'.(!empty($lama_split) ? $lama_split : $lama2).'"></td>
|
|
<td>'.(!empty($lama_split) ? $lama_split : 0).'</td>
|
|
<td>'.form_dropdown('kode_tarif['.$i.']',$arr_tarif,'','class="form-control tarif_ako" id="tarif_ako-'.$i.'" style="width:100%"').'</td>
|
|
<td class="text-right"><span id="jml_total-'.$i.'"></td></tr>';
|
|
}
|
|
else {
|
|
if($diff->format('%h') <= 3 && $i == 1 && $jml_hari2 == 0) {
|
|
continue;
|
|
}
|
|
|
|
$lama_split= '';
|
|
$tgl_pindah = $d2->format('d-m-Y H:i:s');
|
|
if ($row['tgl_awal'] <= $cut_off && $row['tgl_pindah'] >= $cut_off){
|
|
$d1 = new DateTime($row['tgl_awal']);
|
|
$d22 = new DateTime($cut_off);
|
|
|
|
$diff = $d22->diff($d1);
|
|
$lama_split = $diff->days + 1;
|
|
if ($cut_off == $d2->format('Y-m-d')){
|
|
$lama_split = $lama_split - 1;
|
|
}
|
|
$tgl_pindah = date('d-m-Y', strtotime($cut_off));
|
|
}
|
|
|
|
echo '<tr><td>'.$i.'</td>
|
|
<td>'.$row['nama_ruang'].'<input type="hidden" id="ruang-'.$i.'" value="'.$row['no_ruang_asal'].'"><input type="hidden" id="nott-'.$i.'" value="'.$row['no_tt_asal'].'"></td>
|
|
<td>'.$d1->format('d-m-Y').'</td>
|
|
<td>'.$tgl_pindah.'</td>
|
|
<td>'.$lama.'<input type="hidden" id="jml_hari-'.$i.'" value="'.(!empty($lama_split) ? $lama_split : $lama).'"></td>
|
|
<td>'.(!empty($lama_split) ? $lama_split : 0).'</td>
|
|
<td>'.form_dropdown('kode_tarif['.$i.']',$arr_tarif,'','class="form-control tarif_ako" id="tarif_ako-'.$i.'" style="width:100%"').'</td>
|
|
<td class="text-right"><span id="jml_total-'.$i.'"></td></tr>';
|
|
|
|
//kondisi 1
|
|
if($row['tgl_awal'] <= $cut_off && $row['tgl_pindah'] >= $cut_off){
|
|
$d1 = new DateTime($cut_off);
|
|
$d22 = new DateTime($row['tgl_pindah']);
|
|
|
|
$diff = $d22->diff($d1);
|
|
$lama_split = $diff->days + 1;
|
|
|
|
$i = $i + 1;
|
|
//$d1->format('d-m-Y')
|
|
echo '<tr><td>'.$i.'</td>
|
|
<td>'.$row['nama_ruang'].'<input type="hidden" id="ruang-'.$i.'" value="'.$row['no_ruang_asal'].'"><input type="hidden" id="nott-'.$i.'" value="'.$row['no_tt_asal'].'"></td>
|
|
<td>'.date('d-m-Y', strtotime($cut_off)).'</td>
|
|
<td>'.$d2->format('d-m-Y H:i:s').'</td>
|
|
<td>'.$lama.'<input type="hidden" id="jml_hari-'.$i.'" value="'.(!empty($lama_split) ? $lama_split : $lama).'"></td>
|
|
<td>'.(!empty($lama_split) ? $lama_split : 0).'</td>
|
|
<td>'.form_dropdown('kode_tarif['.$i.']',$arr_tarif,'','class="form-control tarif_ako" id="tarif_ako-'.$i.'" style="width:100%"').'</td>
|
|
<td class="text-right"><span id="jml_total-'.$i.'"></td></tr>';
|
|
}
|
|
|
|
//kondisi 2
|
|
if($row['tgl_awal'] <= $cut_off && empty($row['tgl_pindah'])){
|
|
$currdate = new DateTime(date('Y-m-d'));
|
|
$d1 = new DateTime($cut_off);
|
|
$d22 = new DateTime(date('Y-m-d'));
|
|
|
|
$diff = $d22->diff($d1);
|
|
$lama_split = $diff->days + 1;
|
|
//$d1->format('d-m-Y')
|
|
echo '<tr><td>'.$i.'</td>
|
|
<td>'.$row['nama_ruang'].'<input type="hidden" id="ruang-'.$i.'" value="'.$row['no_ruang_asal'].'"><input type="hidden" id="nott-'.$i.'" value="'.$row['no_tt_asal'].'"></td>
|
|
<td>'.date('d-m-Y', strtotime($cut_off)).'</td>
|
|
<td>'.$d2->format('d-m-Y H:i:s').'</td>
|
|
<td>'.$lama.'<input type="hidden" id="jml_hari-'.$i.'" value="'.(!empty($lama_split) ? $lama_split : $lama).'"></td>
|
|
<td>'.(!empty($lama_split) ? $lama_split : 0).'</td>
|
|
<td>'.form_dropdown('kode_tarif['.$i.']',$arr_tarif,'','class="form-control tarif_ako" id="tarif_ako-'.$i.'" style="width:100%"').'</td>
|
|
<td class="text-right"><span id="jml_total-'.$i.'"></td></tr>';
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
}
|
|
else {
|
|
$d1 = new DateTime(datetime_to_date_en($row['tgl_awal']));
|
|
$currdate = new DateTime($tgl_request_krs." ".date('H:i:s'));
|
|
$diff = $currdate->diff($d1);
|
|
|
|
$jam = explode(':',datetime_to_time($row['tgl_awal']));
|
|
|
|
$jam_pulang = explode(":", datetime_to_time($tgl_request_krs." ".date('H:i:s')));
|
|
if($jam_pulang[0] != 0 && $jam_pulang[0] < 12){
|
|
$lama = $diff->format('%a');
|
|
}
|
|
else {
|
|
$lama = $diff->format('%a');
|
|
}
|
|
if( ($sudah_plus_satu == false && ($i < $jml_ruang)) || ($sudah_plus_satu == false && $i == $jml_ruang && $jml_ruang == 2) )
|
|
{
|
|
$lama += 1;
|
|
$sudah_plus_satu = true;
|
|
if(($total_hari_rawat+$lama) > $jumlah_hari_rawat){
|
|
$lama--;
|
|
}
|
|
}
|
|
|
|
$lama_split = '';
|
|
$tgl_pindah = $currdate->format('d-m-Y');
|
|
if($row['tgl_awal'] <= $cut_off && ($row['tgl_pindah'] >= $cut_off || empty($row['tgl_pindah']))){
|
|
if ($row['tgl_awal'] <= $cut_off && empty($row['tgl_pindah'])) {
|
|
$d11 = $d1;
|
|
$d22 = new DateTime($cut_off);
|
|
$currdate = new DateTime($tgl_request_krs . " " . date('H:i:s'));
|
|
|
|
$diff_split = $d22->diff($d11);
|
|
$lama_split = $diff_split->days + 1;
|
|
if (empty($row['tgl_pindah'])){
|
|
$lama_split = $lama_split - 1;
|
|
}
|
|
$tgl_pindah = date('d-m-Y', strtotime($cut_off));
|
|
}
|
|
}
|
|
|
|
echo '<tr><td>'.$i.'</td>
|
|
<td>'.$row['nama_ruang'].'<input type="hidden" id="ruang-'.$i.'" value="'.$row['no_ruang_asal'].'"><input type="hidden" id="nott-'.$i.'" value="'.$row['no_tt_asal'].'"></td>
|
|
<td>'.$d1->format('d-m-Y').'</td>
|
|
<td>'.$tgl_pindah.'</td>
|
|
<td>'.$lama.'<input type="hidden" id="jml_hari-'.$i.'" value="'.(!empty($lama_split) ? $lama_split : $lama).'"></td>
|
|
<td>'.(!empty($lama_split) ? $lama_split : 0).'</td>
|
|
<td>'.form_dropdown('kode_tarif['.$i.']',$arr_tarif,'','class="form-control tarif_ako" id="tarif_ako-'.$i.'" style="width:100%"').'</td>
|
|
<td class="text-right"><span id="jml_total-'.$i.'"></td></tr>';
|
|
|
|
//kondisi 1
|
|
if($row['tgl_awal'] <= $cut_off && $row['tgl_pindah'] >= $cut_off){
|
|
$d11 = new DateTime($cut_off);
|
|
$currdate = new DateTime($tgl_request_krs." ".date('H:i:s'));
|
|
|
|
$diff_split = $currdate->diff($d11);
|
|
$lama_split = $diff_split->days;
|
|
|
|
$i = $i + 11;
|
|
//$d1->format('d-m-Y')
|
|
echo '<tr><td>'.$i.'</td>
|
|
<td>'.$row['nama_ruang'].'<input type="hidden" id="ruang-'.$i.'" value="'.$row['no_ruang_asal'].'"><input type="hidden" id="nott-'.$i.'" value="'.$row['no_tt_asal'].'"></td>
|
|
<td>'.date('d-m-Y', strtotime($cut_off)).'</td>
|
|
<td>'.$currdate->format('d-m-Y').'</td>
|
|
<td>'.$lama.'<input type="hidden" id="jml_hari-'.$i.'" value="'.(!empty($lama_split) ? $lama_split : $lama).'"></td>
|
|
<td>'.(!empty($lama_split) ? $lama_split : 0).'</td>
|
|
<td>'.form_dropdown('kode_tarif['.$i.']',$arr_tarif,'','class="form-control tarif_ako" id="tarif_ako-'.$i.'" style="width:100%"').'</td>
|
|
<td class="text-right"><span id="jml_total-'.$i.'"></td></tr>';
|
|
}
|
|
|
|
//kondisi 2
|
|
if($row['tgl_awal'] <= $cut_off && empty($row['tgl_pindah'])){
|
|
$d11 = new DateTime($cut_off);
|
|
// $currdate = $currdate->format('Y-m-d');
|
|
|
|
$diff_split = $currdate->diff($d11);
|
|
$lama_split = $diff_split->days;
|
|
|
|
$i = $i + 11;
|
|
//$d1->format('d-m-Y')
|
|
echo '<tr><td>'.$i.'</td>
|
|
<td>'.$row['nama_ruang'].'<input type="hidden" id="ruang-'.$i.'" value="'.$row['no_ruang_asal'].'"><input type="hidden" id="nott-'.$i.'" value="'.$row['no_tt_asal'].'"></td>
|
|
<td>'.date('d-m-Y', strtotime($cut_off)).'</td>
|
|
<td>'.$currdate->format('d-m-Y').'</td>
|
|
<td>'.$lama.'<input type="hidden" id="jml_hari-'.$i.'" value="'.(!empty($lama_split) ? $lama_split : $lama).'"></td>
|
|
<td>'.(!empty($lama_split) ? $lama_split : 0).'</td>
|
|
<td>'.form_dropdown('kode_tarif['.$i.']',$arr_tarif,'','class="form-control tarif_ako" id="tarif_ako-'.$i.'" style="width:100%"').'</td>
|
|
<td class="text-right"><span id="jml_total-'.$i.'"></td></tr>';
|
|
}
|
|
}
|
|
$total_hari_rawat += $lama;
|
|
$i++;
|
|
}
|
|
}
|
|
}
|
|
else {
|
|
$d1 = new DateTime($userdata['masukrs']);
|
|
$currdate = new DateTime($tgl_request_krs);
|
|
$d2 = new DateTime($tgl_request_krs);
|
|
$d2->add(new DateInterval('P1D'));
|
|
$diff = $d2->diff($d1);
|
|
$lama = $diff->format('%a');
|
|
// if($d1->format('Y-m-d') == $currdate->format('Y-m-d'))
|
|
// {
|
|
$lama += 1;
|
|
// }
|
|
|
|
$tarif_akomodasi = "SELECT *,(select nilai from m_tarifdetil where komponen like '%SARANA%' and kode_tarif = m_tarif_rs.kode_tarif) as jasa_sarana, (select nilai from m_tarifdetil where komponen like '%LAYANAN%' and kode_tarif = m_tarif_rs.kode_tarif) as jasa_pelayanan,pengguna from m_tarif_rs join m_tarifpengguna on m_tarif_rs.kode_tarif = m_tarifpengguna.kode_tarif join m_tarifkelas on m_tarif_rs.kelas_tarif = m_tarifkelas.kelas where (kelompok_tarif in('PERAWATAN') or kelompok_tarif in('AKOMODASI')) and (m_tarif_rs.kelas_tarif like '" . trim($userdata['idx_ruang']) . "%' or m_tarif_rs.kelas_tarif like 'REGULER%') and m_tarif_rs.aktif = 1";
|
|
$tmp_tarif = $db->query($tarif_akomodasi);
|
|
if ($tmp_tarif->numRows() > 0) {
|
|
$arr_tarif = array();
|
|
foreach ($tmp_tarif->fetchAll() as $ds) {
|
|
$arr_tarif[$ds['kode_tarif'] . '|' . $ds['id_tarif']] = $ds['kode_tarif'] . ' - ' . $ds['uraian_tarif'] . ' - ' . $ds['kelas'] . ' (Rp. ' . format_uang($ds['jumlah']) . ')';
|
|
$js_tarif_data[$ds['kode_tarif']] = $ds['jumlah'];
|
|
}
|
|
}
|
|
|
|
$tgl_masuk = date('Y-m-d', strtotime($userdata['masukrs']));
|
|
$tgl_pindah = '';
|
|
$lama_split = '';
|
|
$cut_off = '2024-01-31';
|
|
$tgl_pindah = $currdate->format('d-m-Y');
|
|
if ($tgl_masuk <= '2024-01-31' && empty($tgl_pindah)) {
|
|
$d11 = $d1;
|
|
$d22 = new DateTime($cut_off);
|
|
$currdate = new DateTime($tgl_request_krs . " " . date('H:i:s'));
|
|
|
|
$diff_split = $d22->diff($d11);
|
|
$lama_split = $diff_split->days + 1;
|
|
$tgl_pindah = date('d-m-Y', strtotime($cut_off));
|
|
}
|
|
$i = 1;
|
|
echo '<tr><td>' . $i . '</td>
|
|
<td>' . $userdata['ruang'] . '<input type="hidden" id="ruang-' . $i . '" value="' . $userdata['noruang'] . '"><input type="hidden" id="nott-' . $i . '" value="' . $row['nott'] . '"></td>
|
|
<td>' . $d1->format('d-m-Y') . '</td>
|
|
<td>' . $tgl_pindah . '</td>
|
|
<td>' . $lama . '<input type="hidden" id="jml_hari-' . $i . '" value="' . (!empty($lama_split) ? $lama_split : $lama) . '"></td>
|
|
<td>' . (!empty($lama_split) ? $lama_split : 0) . '</td>
|
|
<td>' . form_dropdown('kode_tarif[' . $i . ']', $arr_tarif, '', 'class="form-control tarif_ako" id="tarif_ako-' . $i . '" style="width:100%"') . '</td>
|
|
<td class="text-right"><span id="jml_total-' . $i . '"></td></tr>';
|
|
|
|
//kondisi 1
|
|
if ($tgl_masuk <= '2024-01-31' && empty($tgl_pindah)) {
|
|
$d11 = new DateTime($cut_off);
|
|
|
|
$currdate = new DateTime($tgl_request_krs . " " . date('H:i:s'));
|
|
|
|
$diff_split = $currdate->diff($d11);
|
|
$lama_split = $diff_split->days + 1;
|
|
$i = $i + 1;
|
|
//$d1->format('d-m-Y')
|
|
echo '<tr><td>' . $i . '</td>
|
|
<td>' . $userdata['ruang'] . '<input type="hidden" id="ruang-' . $i . '" value="' . $userdata['noruang'] . '"><input type="hidden" id="nott-' . $i . '" value="' . $row['nott'] . '"></td>
|
|
<td>' . date('d-m-Y', strtotime($cut_off)) . '</td>
|
|
<td>' . $currdate->format('d-m-Y') . '</td>
|
|
<td>' . $lama . '<input type="hidden" id="jml_hari-' . $i . '" value="' . (!empty($lama_split) ? $lama_split : $lama) . '"></td>
|
|
<td>' . (!empty($lama_split) ? $lama_split : 0) . '</td>
|
|
<td>' . form_dropdown('kode_tarif[' . $i . ']', $arr_tarif, '', 'class="form-control tarif_ako" id="tarif_ako-' . $i . '" style="width:100%"') . '</td>
|
|
<td class="text-right"><span id="jml_total-' . $i . '"></td></tr>';
|
|
|
|
}
|
|
|
|
$total_hari_rawat += $lama;
|
|
}
|
|
?>
|
|
</tbody>
|
|
</table>
|
|
<div class="form-group row">
|
|
<label class="form-control-label col-sm-4 text-right">Tanggal KRS</label>
|
|
<div class="col-sm-3">
|
|
<input type="text" name="tgl_krs" id="tgl_krs" value="<?php echo $tgl_request_krs." ".date('H:i:s'); ?>" class="mask-date-default datepicker-default form-control" readonly>
|
|
</div>
|
|
</div>
|
|
<div class="form-group row">
|
|
<label class="col-form-label col-sm-4 pt-0" style="text-align:right">Jumlah Hari Rawat</label>
|
|
<div class="col-sm-3 pt-0" style="text-align:left">
|
|
<?php
|
|
echo $jumlah_hari_rawat." hari";
|
|
?>
|
|
<input type="hidden" name="qty" id="jml_hari_rawat" value="<?php echo $jumlah_hari_rawat; ?>">
|
|
<?php
|
|
if($total_hari_rawat != $jumlah_hari_rawat) {
|
|
// echo '<div class="pull-right">
|
|
// <button type="button" class="btn btn-sm btn-outline-warning" id="btn_fix_hari_rawat" title="Jika jumlah hari rawat tidak sama dengan total, maka klik tombol ini">Perbaikan</button>
|
|
// </div>';
|
|
}
|
|
?>
|
|
</div>
|
|
</div>
|
|
<div class="form-group row">
|
|
<label class="col-form-label col-sm-4 pt-0" style="text-align:right">Total Biaya Akomodasi</label>
|
|
<div class="col-sm-3 pt-0" style="text-align:left" id="total_biaya">
|
|
<input type="text" name="totaltarif" id="total_tarif" readonly="true" class="form-control">
|
|
</div>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
<div class="modal-footer">
|
|
<button type="button" class="btn btn-success" onclick="hitungAkomodasi()"><i
|
|
class="fa fa-calculator"></i> Hitung
|
|
</button>
|
|
<button type="button" class="btn btn-success" id="btnSimpanAkomodasi"
|
|
onclick="simpanAkomodasi(this)" data-ix="<?php echo $_REQUEST['idxb']; ?>" data-kode=""
|
|
data-ruang="<?php echo $userdata['noruang']; ?>" data-tarif="0" data-disc="0" data-adm="0"
|
|
data-nomr="<?php echo $userdata['nomr']; ?>"
|
|
data-carabayar="<?php echo $userdata['statusbayar']; ?>"
|
|
data-nott="<?php echo $userdata['nott']; ?>" disabled><i class="fa fa-save"></i> Simpan
|
|
</button>
|
|
<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<script type="text/javascript">
|
|
$("#btn_fix_hari_rawat").click(function () {
|
|
idxdaftar = $("#id_admission").val();
|
|
$.post("<?php echo _BASE_ . 'include/master.php';?>", {koreksi_hari_rawat: 1, idxdaftar}, function (data) {
|
|
Toast.fire({
|
|
title: "Koreksi hari rawat " + data.message, type: data.type, onClose: function () {
|
|
window.location.reload();
|
|
}
|
|
});
|
|
}, "json");
|
|
});
|
|
</script>
|
|
</template>
|
|
<template id="cartbill-template">
|
|
<div class="modal fade modal-cartbill-lg" id="modal-cartbill" tabindex="-1" role="dialog"
|
|
aria-labelledby="modalCartbill" aria-hidden="true">
|
|
<div class="modal-dialog " style="max-width: 90%">
|
|
<div class="modal-content">
|
|
<div class="modal-header">
|
|
<h5 class="modal-title">Preview Hasil</h5>
|
|
<button type="button" class="close" data-dismiss="modal" aria-label="Close"
|
|
onclick="window.location.reload()">
|
|
<span aria-hidden="true">×</span>
|
|
</button>
|
|
</div>
|
|
<div class="modal-body" id="print_body">
|
|
</div>
|
|
<div class="modal-footer">
|
|
<button type="button" class="btn btn-success" data-dismiss="modal">Print</button>
|
|
<button type="button" class="btn btn-secondary" data-dismiss="modal"
|
|
onclick="window.location.reload()">Close
|
|
</button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</template>
|
|
<template id="pembulatan-template">
|
|
<div class="modal fade modal-pembulatan-lg" id="modal-pembulatan" tabindex="-1" role="dialog"
|
|
aria-labelledby="modalCartbill" aria-hidden="true">
|
|
<div class="modal-dialog " style="max-width: 50%">
|
|
<div class="modal-content">
|
|
<div class="modal-header">
|
|
<h5 class="modal-title">Pembulatan</h5>
|
|
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
|
<span aria-hidden="true">×</span>
|
|
</button>
|
|
</div>
|
|
<div class="modal-body" id="print_body">
|
|
<form id="pembulatan-form">
|
|
<?php
|
|
$tarif_pembulatan = $db->query("SELECT * from m_tarif_rs where kode_tarif = '" . $_SESSION['tarif_pembulatan'] . "'");
|
|
$data_tarif_pembulatan = ($tarif_pembulatan->numRows() > 0) ? $tarif_pembulatan->fetchFirst() : [];
|
|
?>
|
|
<div class="form-group row">
|
|
<label class="form-control-label col-sm-4">Total Biaya</label>
|
|
<div class="col-sm-4">
|
|
<input type="text" class="form-control" name="pembulatan[total_biaya]" value=""
|
|
id="total_biaya_pembulatan" readonly=>
|
|
</div>
|
|
</div>
|
|
<div class="form-group row">
|
|
<label class="form-control-label col-sm-4">Pembulatan Tunai</label>
|
|
<div class="col-sm-4">
|
|
<input type="text" class="form-control" name="pembulatan[pembulatan]" value=""
|
|
id="nilai_pembulatan" readonly>
|
|
</div>
|
|
</div>
|
|
<div class="form-group row">
|
|
<label class="form-control-label col-sm-4">Pembulatan Piutang</label>
|
|
<div class="col-sm-4">
|
|
<input type="text" class="form-control" name="pembulatan[pembulatan]" value=""
|
|
id="nilai_pembulatan_piutang" readonly>
|
|
</div>
|
|
</div>
|
|
<div class="form-group row">
|
|
<label class="form-control-label col-sm-4">Total Setelah Pembulatan</label>
|
|
<div class="col-sm-4">
|
|
<input type="text" class="form-control" name="pembulatan[total_setelah_bulat]" value=""
|
|
id="total_setelah_bulat" readonly>
|
|
</div>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
<div class="modal-footer">
|
|
<button type="button" class="btn btn-success" id="btnSimpanPembulatan"
|
|
onclick="simpanPembulatan(this)" data-ix="<?php echo $_REQUEST['idxb']; ?>"
|
|
data-kode="<?php echo $data_tarif_pembulatan['id_tarif']; ?>"
|
|
data-ruang="<?php echo $userdata['noruang']; ?>"
|
|
data-nomr="<?php echo $userdata['nomr']; ?>"
|
|
data-carabayar="<?php echo $userdata['statusbayar']; ?>"
|
|
data-nott="<?php echo $userdata['nott']; ?>" <?php ($nilai_pembulatan > 0) ? '' : 'disabled'; ?>>
|
|
<i class="fa fa-save"></i> Simpan
|
|
</button>
|
|
<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</template>
|
|
<template id="list_piutang-template">
|
|
<div class="modal fade modal-cartbill-lg" id="modal-list_piutang" tabindex="-1" role="dialog"
|
|
aria-labelledby="modalPiutang" aria-hidden="true">
|
|
<div class="modal-dialog " style="max-width: 90%">
|
|
<div class="modal-content">
|
|
<div class="modal-header">
|
|
<h5 class="modal-title">Info Piutang R.Jalan / R.Darurat</h5>
|
|
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
|
<span aria-hidden="true">×</span>
|
|
</button>
|
|
</div>
|
|
<div class="modal-body" id="list_piutang">
|
|
<table class="table table-sm table-striped table-bordered">
|
|
<thead>
|
|
<tr>
|
|
<th>NoMR</th>
|
|
<th>No Billing</th>
|
|
<th>Nama Pasien</th>
|
|
<th>Jumlah</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
<?php
|
|
$cek_trans_piutang = $db->query($str_query_piutang_pribadi);
|
|
if ($cek_trans_piutang->numRows() > 0) {
|
|
$no = 1;
|
|
foreach ($cek_trans_piutang->fetchAll() as $piutang_rajal) {
|
|
echo '<tr><td>' . $piutang_rajal['nomr'] . '</td><td>' . $piutang_rajal['nobill'] . '</td>
|
|
<td>' . $piutang_rajal['nama'] . '</td><td>' . format_uang($piutang_rajal['jumlah']) . '</td></tr>';
|
|
$no++;
|
|
}
|
|
}
|
|
?>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
<div class="modal-footer">
|
|
<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</template>
|
|
<?php
|
|
if ($page_akses['piutang'] == true) {
|
|
$js_init .= '$("#piutang").val("' . format_uang($total) . '");';
|
|
}
|
|
$js_init .= '
|
|
var dt_orderbatalbill = ' . (($bill_terorderbatal > 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");
|
|
});
|
|
';
|
|
|
|
?>
|
|
<template id="order-poct-detail-template">
|
|
<div class="modal fade order-poct-detail-modal-lg" id="order-poct-detail-modal" tabindex="-1" role="dialog"
|
|
aria-labelledby="HistLabModal" aria-hidden="true">
|
|
<div class="modal-dialog modal-lg" style="max-width: 80%">
|
|
<div class="modal-content">
|
|
<div class="modal-header">
|
|
<h5 class="modal-title">Detail Order Poct</h5>
|
|
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
|
<span aria-hidden="true">×</span>
|
|
</button>
|
|
</div>
|
|
<div class="modal-body"></div>
|
|
<div class="modal-footer">
|
|
<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</template>
|
|
|
|
<script>
|
|
$(document).ready(function () {
|
|
$("body").append($("#order-poct-detail-template").html());
|
|
});
|
|
$("#btnTambahAkomodasiNew,#trig_ako").on("click", function () {
|
|
var id_admission = '<?= $_REQUEST['idxb'] ?>';
|
|
var idx_daftar = '<?= $_REQUEST['idxb'] ?>';
|
|
var nobill = '<?=$_REQUEST['nobill'] ?>';
|
|
var keluar = '<?= $_REQUEST['tgl_request_krs'] ?>';
|
|
$.post('<?php echo _BASE_;?>ranap/akomodasi_verif.php', {
|
|
id_admission: id_admission,
|
|
idx_daftar: idx_daftar,
|
|
nobill: nobill,
|
|
keluar: keluar
|
|
}, function (data) {
|
|
$("#order-poct-detail-modal .modal-body").html(data);
|
|
$("#order-poct-detail-modal").modal("show");
|
|
});
|
|
});
|
|
</script>
|