Files
simrs-jatim/keuangan/form_restitusi.php
2024-04-19 14:04:41 +07:00

223 lines
7.0 KiB
PHP

<?php
$ss = $db->query('SELECT * FROM m_shift order by idshift ASC');
$arr_shift = array(''=>'Pilih Shift');
foreach($ss->fetchAll() as $ds){
$arr_shift[$ds['idshift']] = $ds['nama_shift'];
}
array_push($form_plugin['ui_plugins_js'],$floatthead_js);
array_push($form_plugin['ui_plugins_js'],$sweetalert_js);
array_push($form_plugin['ui_plugins_js'],$jspm_js);
?>
<div class="container-fluid">
<form id="frm_identitas">
<div class="row">
<div class="col-md-6">
<div class="card">
<div class="card-header">Form Restitusi</div>
<div class="card-body">
<input type="hidden" name="st_rajal" value="" id="st_rajal">
<input type="hidden" name="idxdaftar" value="" id="idxdaftar">
<input type="hidden" name="tempat" value="" id="tempat">
<div class="form-group row">
<label class="col-sm-4">No Billing</label>
<div class="col-sm-8">
<input type="text" name="input[nobill]" value="" class="form-control form-control-sm mask-decimal" id="nobill">
</div>
</div>
<div class="form-group row">
<label class="col-sm-4">No MR</label>
<div class="col-sm-8">
<input type="text" name="input[nomr]" value="" class="form-control form-control-sm" id="nomr" readonly="true">
</div>
</div>
<div class="form-group row">
<label class="col-sm-4">Nama Pasien</label>
<div class="col-sm-8">
<input type="text" name="input[nama]" value="" class="form-control form-control-sm" id="nama" readonly="true">
</div>
</div>
<div class="form-group row">
<label class="col-sm-4">Alamat</label>
<div class="col-sm-8">
<input type="text" name="input[alamat]" value="" class="form-control form-control-sm" id="alamat" readonly="true">
</div>
</div>
<div class="form-group row">
<label class="col-sm-4">No Telepon</label>
<div class="col-sm-8">
<input type="text" name="input[no_telepon]" value="" class="form-control form-control-sm" id="no_telepon" readonly="true">
</div>
</div>
<div class="form-group row">
<label class="col-sm-4">Tempat Layanan</label>
<div class="col-sm-8">
<input type="text" name="input[tempat_layanan]" value="" class="form-control form-control-sm" id="tempat_layanan" readonly="true">
</div>
</div>
</div>
<!-- <div class="card-footer text-right">
<button class="btn btn-primary" type="button" onclick="simpanIdentitas()"><i class="fa fa-hdd-o"></i> Tambah</button>
</div> -->
</div>
</div>
<div class="col-md-6">
<div class="card">
<div class="card-header">Form Restitusi</div>
<div class="card-body">
<div class="form-group row">
<label class="col-sm-4">Ket. Restitusi</label>
<div class="col-sm-8">
<textarea class="form-control" name="input[keterangan]" col="5" row="5"></textarea>
</div>
</div>
<div class="form-group row">
<label class="col-sm-4">Total Restitusi</label>
<div class="col-sm-8">
<h4 id="total_restitusi"></h4>
</div>
</div>
</div>
<div class="card-footer text-right">
<button class="btn btn-primary" type="button" id="btn_simpan_restitusi" onclick="simpan()" disabled=""><i class="fa fa-tasks"></i> Simpan</button>
</div>
</div>
</div>
</div>
</form>
<hr>
<div class="row"><div class="col-sm-12">
<form id="form_billing">
<div class="wrapper" style="overflow:auto;height:360px">
<table class="table table-bordered table-striped table-sm" id="table_tarif">
<thead>
<tr class="bg-success text-white">
<th style="width:5%"><input type="checkbox" class="cb_global"></th>
<th style="width:5%">No</th>
<th style="width:10%">Kode Tarif</th>
<th style="width:25%">Uraian</th>
<th style="width:10%">Jumlah</th>
</tr>
</thead>
<tbody>
</tbody>
</table>
</div>
</form>
</div></div>
</div>
</div>
</div>
<?php
$js_init = $jspm_init;
$js_init .= '
function print_tindakan(nomor)
{
rajal = $("#st_rajal").val();
nomr = $("#nomr").val();
idxdaftar = $("#idxdaftar").val();
nobill = $("#nobill").val();
jspm_print("'._BASE_.'print_nota_restitusi.php?rajal_status="+rajal+"&nomr="+nomr+"&idxdaftar="+idxdaftar+"&nobill="+nobill+"&nonota="+nomor,"modal-preview","Nota Tindakan "+nomr+".pdf",0);
$("#modal-preview").on("hidden.bs.modal",function(e){ window.location.reload(); });
}
const Toast = Swal.mixin({
toast: true,
position: "top-end",
showConfirmButton: false,
timer: 3000
});
$("#nobill").on("keypress",function(e){
if(e.which == 13 || e.keyCode == 13)
{
e.preventDefault();
cari();
}
});
$(".cb_global").click(function(){
st_cek = $(this).prop("checked");
if(st_cek == true) {
$(".cb_restitusi").each(function(e){
$(this).trigger("click");
});
}
else {
$(".cb_restitusi").each(function(e){
$(this).trigger("click");
});
}
})
jumlah_cek = 0;
$("#table_tarif").delegate(".cb_restitusi","click",function(){
no = $(this).data("no");
jumlah = parseFloat($("#restitusi-"+no).val());
st_check = $(this).prop("checked");
if(st_check == true) {
jumlah_cek += jumlah;
}
else {
jumlah_cek -= jumlah;
}
$("#total_restitusi").text(accounting.formatMoney(jumlah_cek));
if(jumlah_cek > 0) {
$("#btn_simpan_restitusi").prop("disabled",false);
}
else {
$("#btn_simpan_restitusi").prop("disabled",true);
}
});
function cari() {
$("#nomr,#nama,#alamat,#no_telepon").val("");
$.post("'._BASE_.'keuangan/restitusi.php?page=cari",$("#frm_identitas").serialize(),function(data)
{
if(data.type != undefined) {
Toast.fire({title:data.message,type:data.type});
}
else {
$("#nomr").val(data.data_pasien.nomr).prop("readonly",true);
$("#nama").val(data.data_pasien.nama).prop("readonly",true);
$("#alamat").val(data.data_pasien.alamat).prop("readonly",true);
$("#no_telepon").val(data.data_pasien.notelp).prop("readonly",true);
$("#tempat_layanan").val(data.data_pasien.tempat_layanan).prop("readonly",true);
$("#kode_tarif").trigger("focus");
$("#st_rajal").val(data.data_pasien.st_rajal);
$("#idxdaftar").val(data.data_pasien.idxdaftar);
$("#tempat").val(data.data_pasien.kode_tempat);
$("#table_tarif tbody").html(data.list_tarif);
}
},"json");
}
function simpan() {
nama = $("#nama").val();
alamat = $("#alamat").val();
no_telepon = $("#no_telepon").val();
if(nama == "" || alamat == "" || no_telepon == "") {
Toast.fire({title:"Identitas belum terisi dengan lengkap",type:"error"});
}
else {
form_identitas = $("#frm_identitas").serialize();
form_billing = $("#form_billing").serialize();
$.post("'._BASE_.'keuangan/restitusi.php?page=billing",form_identitas+"&"+form_billing,function(data){
if(data.type == "error") {
Toast.fire({title:data.message,type:data.type});
}
else {
Toast.fire({title:data.message,type:data.type,onClose : function() {
print_tindakan(data.nonota);
reset_form();
}});
}
},"json");
}
}
function reset_form() {
$("#frm_identitas").trigger("reset");
$("#table_tarif tbody").html("");
}
';
?>