jumlah_iurbea) {
Toast.fire({title:"Jumlah alokasi melebihi jumlah iurbea",type:"error"});
}
else {
jumlah_cek += jumlah;
$("#alokasi-"+no).val(jumlah);
}
}
else {
jumlah_cek -= jumlah;
$("#alokasi-"+no).val("");
}
hitungAlokasi();
});
$("#table_alokasi").delegate(".alokasi","keyup",function(){
hitungAlokasi();
});
$("#nobill").on("keypress",function(e){
if(e.which == 13 || e.keyCode == 13)
{
e.preventDefault();
cari_alokasi();
}
});
function cari_alokasi() {
if($("#nobill").val() == ""){
Toast.fire({title:"No Bill belum diisi",type:"error"});
}
else {
$(".loading-spinner").css("display","block");
$.post("'._BASE_.'jaspel/iurbea.php?page=cari_alokasi",$("#frm_report").serialize(),function(data)
{
if(data.type == "error") {
Toast.fire({title:data.message,type:data.type});
}
else {
$("#biaya_ditempati").val(accounting.formatMoney(data.nominal_naik_kelas)).prop("readonly",true);
$("#biaya_sesuai_hak").val(accounting.formatMoney(data.nominal_hak_kelas)).prop("readonly",true);
$("#selisih_biaya").val(accounting.formatMoney(data.selisih_biaya)).prop("readonly",true);
$("#idxdaftar").val(data.idxdaftar);
$("#carabayar").val(data.kdcarabayar);
$("#ruang").val(data.noruang);
$("#nott").val(data.nott);
$("#status").val(data.nama_carabayar);
$("#tgl_mrs").val(data.masukrs);
$("#tgl_krs").val(data.keluarrs);
$("#nama_pasien").val(data.nama_pasien);
$("#norm").val(data.nomr);
$("#alamat").val(data.alamat);
$("#kelas,#kelas_ditempati").val(data.kelas);
$("#naik_kelas").val(data.kode_kelas);
$("#ruangan").val(data.ruangan);
$("#jml_biaya_total").val(accounting.formatMoney(data.total_biaya));
if(data.hak_kelas != false){
if(data.status_naik)
{
$("#txt_hak_kelas").val(data.hak_kelas.keterangan);
$("#hak_kelas").val(data.hak_kelas.kode);
}
else if(data.status_naik == "invalid"){
Toast.fire({title:"Kelas ditempati tidak sesuai prosedur E-Klaim",type:"error",onClose : function(){
reset();
}});
}
else {
$("#txt_hak_kelas").val(data.hak_kelas.keterangan);
$("#hak_kelas").val(data.hak_kelas.kode);
Toast.fire({title:"Tidak terindikasi iurbea",type:"error",onClose : function(){
reset();
}});
}
}
else {
Toast.fire({title:"Pencarian Peserta gagal.",type:"error"});
}
$("#table_alokasi tbody").html(data.list);
$(".mask-money").inputmask("numeric", {
radixPoint: ",",
groupSeparator: ".",
digits: 0,
autoGroup: true,
prefix: "",
rightAlign: false,
oncleared: function (e) { $(e.currentTarget).val(""); }
});
}
$(".loading-spinner").css("display","none");
},"json");
}
}
function simpan_alokasi() {
nobill = $("#nobill").val().replace(/\./g,"");
form_data = $("#list_alokasi").serialize()+"&nobill="+nobill;
jumlah_iurbea = parseFloat($("#selisih_biaya").val().replace(/\./g,""));
jumlah_alokasi = parseFloat($("#alokasi_tarif").val().replace(/\./g,""));
if(jumlah_iurbea >= jumlah_alokasi) {
$.post("'._BASE_.'jaspel/pembatalan_iurbea.php?page=save_alokasi",form_data,function(data){
Toast.fire({title:data.message,type:data.type,onClose : function(){
window.location.reload();
}});
},"json");
}
else {
Toast.fire({title:"Jumlah alokasi melebihi jumlah iurbea",type:"error"});
}
}
function hitungAlokasi() {
jumlah_alokasi = 0;
jumlah_iurbea = parseFloat($("#selisih_biaya").val().replace(/\./g,""));
$(".alokasi").each(function(){
jumlah_tarif = parseFloat($(this).data("tarif").replace(/\./g,""));
jumlah = parseFloat($(this).val().replace(/\./g,""));
if(jumlah != "" && jumlah > 0) {
if(jumlah > jumlah_tarif) {
Toast.fire({title:"Jumlah alokasi melebihi jumlah tarif",type:"error"});
$(this).val(accounting.formatMoney(jumlah_tarif));
jumlah_alokasi += jumlah_tarif;
}
else if( (jumlah_alokasi+jumlah) > jumlah_iurbea) {
Toast.fire({title:"Jumlah alokasi melebihi jumlah iurbea",type:"error"});
}
else {
jumlah_alokasi += jumlah;
}
}
});
$("#alokasi_tarif").val(accounting.formatMoney(jumlah_alokasi));
}
';
?>