97 lines
4.1 KiB
PHP
97 lines
4.1 KiB
PHP
<?php
|
|
include '../core/main.php';
|
|
|
|
$page = $_REQUEST['page'];
|
|
|
|
if($page == 'cari')
|
|
{
|
|
$nobill = preg_replace("/\./", '', $_REQUEST['input']['nobill']);
|
|
|
|
$tmp_identitas = $db->query("SELECT a.nobill,a.nomr,a.idxdaftar,a.kodetarif,t.uraian_tarif,a.idxbill,a.tarifrs,b.kdpoly as kode_tempat,c.nama,c.alamat,c.notelp,d.nama as tempat_layanan,1 as st_rajal, case when r.idxrestitusi is not null then 1 else 0 end as st_restitusi from
|
|
t_billrajal a
|
|
join t_bayarrajal aa on a.idxbill = aa.idxbill
|
|
JOIN t_pendaftaran b on a.idxdaftar = b.idxdaftar
|
|
join m_pasien c on a.nomr = c.nomr
|
|
join m_ruang d on b.kdpoly = d.no
|
|
join m_tarif_rs t on a.kodetarif = t.kode_tarif
|
|
left join t_billrestitusi r on a.idxbill = r.idxbill_rajal and r.sistem = 'IRJA'
|
|
where a.nobill = '$nobill' and b.status = 0 and aa.lunas = 1
|
|
UNION
|
|
SELECT a.nobill,a.nomr,a.idxdaftar,a.kodetarif,t.uraian_tarif,a.idxbill,a.tarifrs,b.noruang as kode_tempat,c.nama,c.alamat,c.notelp,d.nama as tempat_layanan,0 as st_rajal, case when r.idxrestitusi is not null then 1 else 0 end as st_restitusi from
|
|
t_billranap a
|
|
join t_bayarranap aa on a.idxbill = aa.idxbill
|
|
JOIN t_admission b on a.idxdaftar = b.id_admission
|
|
join m_pasien c on a.nomr = c.nomr
|
|
join m_ruang d on b.noruang = d.no
|
|
join m_tarif_rs t on a.kodetarif = t.kode_tarif
|
|
left join t_billrestitusi r on a.idxbill = r.idxbill_ranap and r.sistem = 'IRNA'
|
|
where a.nobill = '$nobill' and b.keluarrs is not null and aa.lunas = 1
|
|
");
|
|
if($tmp_identitas->numRows() > 0)
|
|
{
|
|
$arr_pasien = [];
|
|
$i = 0;
|
|
$html_tindakan = '';
|
|
foreach($tmp_identitas->fetchAll() as $row) {
|
|
if($i == 0) {
|
|
$arr_pasien = $row;
|
|
}
|
|
$cb_restitusi = ($row['st_restitusi'] == 1) ? '' : '<input type="checkbox" class="cb_restitusi" name="cb_restitusi[]" value="'.$row['idxbill'].'" data-no="'.$row['idxbill'].'">';
|
|
$hidden_form = '<input type="hidden" name="detil['.$row['idxbill'].'][tarifrs]" value="'.$row['tarifrs'].'" id="restitusi-'.$row['idxbill'].'">';
|
|
$html_tindakan .= '<tr><td>'.$hidden_form.$cb_restitusi.'</td><td>'.($i+1).'</td><td>'.$row['kodetarif'].'</td><td>'.$row['uraian_tarif'].'</td><td>'.$row['tarifrs'].'</td></tr>';
|
|
$i++;
|
|
}
|
|
|
|
echo json_encode(['data_pasien'=>$arr_pasien,'list_tarif'=>$html_tindakan]);
|
|
exit;
|
|
}
|
|
else {
|
|
echo json_encode(['message'=>'No Billing tidak ditemukan','type'=>'error']);
|
|
exit;
|
|
}
|
|
}
|
|
else if($page == 'billing') {
|
|
|
|
$idxdaftar = $_REQUEST['idxdaftar'];
|
|
$tempat = $_REQUEST['tempat'];
|
|
$st_rajal = $_REQUEST['st_rajal'];
|
|
$identitas = $_REQUEST['input'];
|
|
$detil = $_REQUEST['detil'];
|
|
$cb_restitusi = $_REQUEST['cb_restitusi'];
|
|
$last_nonota = lastNoNota();
|
|
|
|
$arr_error = [];
|
|
$tanggal = date('Y-m-d H:i:s');
|
|
$shift = $_SESSION['SHIFT'];
|
|
$nip = $_SESSION['NIP'];
|
|
foreach($cb_restitusi as $idxbill) {
|
|
$i = 0;
|
|
|
|
if($st_rajal == 0) {
|
|
$query_bill = "INSERT into t_billrestitusi(kodetarif,nomr,tempatlayanan,tanggal,shift,nip,idxdaftar,nobill,kddokter,keterangan, carabayar,aps,unit,qty,jasa_sarana,jasa_pelayanan,jasa_anastesi,tarifrs,nonota,sistem,idxbill_ranap)
|
|
SELECT kodetarif,nomr,$tempat,'$tanggal',$shift,'$nip',idxdaftar,nobill,kddokter,'{$identitas['keterangan']}',carabayar,aps,unit,qty,jasa_sarana,jasa_pelayanan,jasa_anastesi,tarifrs,$last_nonota,'IRNA',idxbill from t_billranap where idxbill = $idxbill";
|
|
}
|
|
else {
|
|
$query_bill = "INSERT into t_billrestitusi(kodetarif,nomr,tempatlayanan,tanggal,shift,nip,idxdaftar,nobill,kddokter,keterangan, carabayar,aps,unit,qty,jasa_sarana,jasa_pelayanan,jasa_anastesi,tarifrs,nonota,sistem,idxbill_rajal)
|
|
SELECT kodetarif,nomr,$tempat,'$tanggal',$shift,'$nip',idxdaftar,nobill,kddokter,'{$identitas['keterangan']}',carabayar,aps,unit,qty,jasa_sarana,jasa_pelayanan,jasa_anastesi,tarifrs,$last_nonota,'IRJA',idxbill from t_billrajal where idxbill = $idxbill";
|
|
}
|
|
|
|
$save_restitusi = execute($query_bill);
|
|
if(!$save_restitusi) {
|
|
$arr_error[] = $idxbill;
|
|
}
|
|
}
|
|
|
|
if($last_nonota != null && empty($arr_error)) {
|
|
$msg = 'Restitusi berhasil disimpan';
|
|
$type = 'success';
|
|
}
|
|
else {
|
|
$msg = 'Restitusi gagal disimpan';
|
|
$type = 'error';
|
|
}
|
|
|
|
echo json_encode(['message'=>$msg, 'type'=>$type, 'nonota' => $last_nonota]);
|
|
exit;
|
|
}
|
|
?>
|