398 lines
22 KiB
PHP
398 lines
22 KiB
PHP
<?php
|
|
include '../core/main.php';
|
|
include _DOCROOT_.'/report/Report.php';
|
|
|
|
use \Dompdf\Dompdf;
|
|
|
|
$page = array_key_exists('page', $_REQUEST) ? $_REQUEST['page'] : '';
|
|
|
|
if($page == 'cari')
|
|
{
|
|
$by = $_POST['by'];
|
|
$jenis = $_POST['jenis'];
|
|
$petugas = $_POST['petugas'];
|
|
$tanggal = $_POST['tanggal'];
|
|
$shift = $_POST['shift'];
|
|
if($jenis == '') {
|
|
echo json_encode(['message'=>'Error! Access Denied','type'=>'error']);
|
|
exit;
|
|
}
|
|
elseif($_POST['nobill'] == '') {
|
|
echo json_encode(['message'=>'Error! No Billing Belum Terisi','type'=>'error']);
|
|
exit;
|
|
}
|
|
elseif($by == 'rajal' && $_POST['nobukti'] == '') {
|
|
echo json_encode(['message'=>'Error! No Bukti Belum Terisi','type'=>'error']);
|
|
exit;
|
|
}
|
|
$nobill = preg_replace("/\./", "", $_POST['nobill']);
|
|
$nobukti = preg_replace("/\./", "", $_POST['nobukti']);
|
|
if($by == 'iurbea') {
|
|
if(strlen($nobukti) < 7) {
|
|
$nobukti = str_pad($nobukti, 7, '0', STR_PAD_LEFT);
|
|
}
|
|
$where_nonota = ($nobukti != '') ? "and a.user_bayar = '$petugas' and date(a.tgl_bayar)='$tanggal' and a.no_bayar = '$nobukti' and a.shift_bayar = $shift" : '' ;
|
|
}
|
|
else {
|
|
$where_nonota = ($nobukti != '') ? "and a.nip = '$petugas' and a.tglbayar='$tanggal' and a.nobayar = '$nobukti' and a.shift = $shift" : '' ;
|
|
}
|
|
if($by == 'rajal')
|
|
{
|
|
$query_data = "SELECT distinct a.nobill, a.nobayar, a1.nonota, a.idxbill, a.idxdaftar, a.tottarifrs, b.nama, b.alamat,b.jeniskelamin,a.nomr,
|
|
c.kdcarabayar,c.kdpoly, e.nama as namapoly, t.kode_tarif, t.uraian_tarif, a.jmbayar as jumlah, a1.alasan_batal, a1.status_verifikasi,a.lunas,tp.jml_piutang,obb.st_orderbatal_tindakan,obb.st_orderbatal_verifikasi,obb.st_orderbatal_bayar,obb.st_orderbatal_piutang,obb.st_batal_tindakan,obb.st_batal_verif,obb.st_batal_bayar,obb.st_batal_piutang,a.jmbayar
|
|
FROM t_bayarrajal a
|
|
JOIN t_billrajal a1 on a.IDXBILL = a1.IDXBILL
|
|
JOIN m_pasien b ON b.nomr = a.nomr
|
|
JOIN t_pendaftaran c ON c.IDXDAFTAR = a.IDXDAFTAR
|
|
JOIN m_ruang e ON e.no = c.KDPOLY
|
|
JOIN m_tarif_rs t ON t.kode_tarif = a1.KODETARIF
|
|
LEFT JOIN t_orderbatalbill obb on a1.idxbill = obb.idxbill and billing = 'RAJAL'
|
|
LEFT JOIN ( select idxbill, count(id_piutang) as jml_piutang, st_piutang from t_piutang where nobilling = '$nobill' and st_billing = 'IRJA' group by idxbill,st_billing,st_piutang) tp on a1.idxbill = tp.idxbill
|
|
WHERE a.NOBILL = '$nobill' $where_nonota
|
|
UNION
|
|
SELECT distinct a.nobill, a.nobayar, a1.nonota, a.idxbill, a.idxdaftar, a.tottarifrs, b.nama, b.alamat,b.jeniskelamin,a.nomr,
|
|
c.kdcarabayar,c.kdpoly, e.nama as namapoly, t.kode_tarif, t.uraian_tarif, a.jmbayar as jumlah, a1.alasan_batal, a1.status_verifikasi,a.lunas,tp.jml_piutang,obb.st_orderbatal_tindakan,obb.st_orderbatal_verifikasi,obb.st_orderbatal_bayar,obb.st_orderbatal_piutang,obb.st_batal_tindakan,obb.st_batal_verif,obb.st_batal_bayar,obb.st_batal_piutang,a.jmbayar
|
|
FROM t_bayarrajal a
|
|
JOIN t_billrajal a1 on a.IDXBILL = a1.IDXBILL
|
|
JOIN m_pasien_aps b ON b.nomr = a.nomr
|
|
JOIN t_pendaftaran_aps c ON c.IDXDAFTAR = a.IDXDAFTAR
|
|
LEFT JOIN m_ruang e ON e.no = c.KDPOLY
|
|
JOIN m_tarif_rs t ON t.kode_tarif = a1.KODETARIF
|
|
LEFT JOIN t_orderbatalbill obb on a1.idxbill = obb.idxbill and billing = 'RAJAL'
|
|
LEFT JOIN ( select idxbill, count(id_piutang) as jml_piutang, st_piutang from t_piutang where nobilling = '$nobill' and st_billing = 'IRJA' group by idxbill,st_billing,st_piutang) tp on a1.idxbill = tp.idxbill
|
|
WHERE a.NOBILL = '$nobill' $where_nonota ";
|
|
}
|
|
elseif($by == 'nonkunjungan')
|
|
{
|
|
$query_data = "SELECT distinct a.nobill, a.nobayar, a1.nonota, a.idxbill, a.idxdaftar, a.tottarifrs, b.nama, b.alamat,b.jeniskelamin,a.nomr,
|
|
c.kdcarabayar,c.kdpoly, e.nama as namapoly, t.kode_tarif, t.uraian_tarif, a.jmbayar as jumlah, a1.alasan_batal, a1.status_verifikasi,a.lunas,tp.jml_piutang,obb.st_orderbatal_tindakan,obb.st_orderbatal_verifikasi,obb.st_orderbatal_bayar,obb.st_orderbatal_piutang,obb.st_batal_tindakan,obb.st_batal_verif,obb.st_batal_bayar,obb.st_batal_piutang,a.jmbayar
|
|
FROM t_bayarrajal a
|
|
JOIN t_billrajal a1 on a.IDXBILL = a1.IDXBILL
|
|
JOIN m_pasien_aps b ON b.nomr = a.nomr
|
|
JOIN t_pendaftaran_aps c ON c.IDXDAFTAR = a.IDXDAFTAR
|
|
left JOIN m_ruang e ON e.no = c.KDPOLY
|
|
JOIN m_tarif_rs t ON t.kode_tarif = a1.KODETARIF
|
|
LEFT JOIN t_orderbatalbill obb on a1.idxbill = obb.idxbill and billing = 'RAJAL'
|
|
LEFT JOIN ( select idxbill, count(id_piutang) as jml_piutang, st_piutang from t_piutang where nobilling = '$nobill' and st_billing = 'IRJA' group by idxbill,st_billing,st_piutang) tp on a1.idxbill = tp.idxbill
|
|
WHERE a.NOBILL = '$nobill' $where_nonota and a1.aps = 1";
|
|
}
|
|
elseif($by == 'ranap') {
|
|
$query_data = "SELECT distinct a.nobill, a.nobayar, a1.nonota, a.idxbill, a.idxdaftar, a.tottarifrs, b.nama, b.alamat,b.jeniskelamin,a.nomr,
|
|
c.statusbayar as kdcarabayar,c.noruang, ".concat_sql("e.nama,' Kelas ',e.kelas")." AS namapoly, t.kode_tarif, t.uraian_tarif, a.jmbayar as jumlah, a1.alasan_batal,a1.status_verifikasi,a.lunas,tp.jml_piutang, obb.st_orderbatal_tindakan,obb.st_orderbatal_verifikasi,obb.st_orderbatal_bayar,obb.st_orderbatal_piutang,obb.st_batal_tindakan,obb.st_batal_verif,obb.st_batal_bayar,obb.st_batal_piutang,a.jmbayar
|
|
FROM t_bayarranap a
|
|
JOIN t_billranap a1 on a.IDXBILL = a1.IDXBILL
|
|
JOIN m_pasien b ON b.nomr = a.nomr
|
|
JOIN t_admission c ON c.id_admission = a.IDXDAFTAR
|
|
JOIN m_ruang e ON e.no = c.noruang
|
|
JOIN m_tarif_rs t ON t.kode_tarif = a1.KODETARIF
|
|
LEFT JOIN t_orderbatalbill obb on a1.idxbill = obb.idxbill and billing = 'RANAP'
|
|
LEFT JOIN ( select idxbill, count(id_piutang) as jml_piutang, st_piutang from t_piutang where nobilling = '$nobill' and st_billing = 'IRNA' group by idxbill,st_billing,st_piutang) tp on a1.idxbill = tp.idxbill
|
|
WHERE a.NOBILL = '$nobill' $where_nonota ";
|
|
}
|
|
elseif($by == 'nonreg') {
|
|
$query_data = "SELECT distinct a.nobill, a.nobayar, a1.nonota, a.idxbill, a.idx_nonreg as idxdaftar, a.tottarifrs, b.nama, b.alamat,null as jeniskelamin,a.no_nonreg as nomr,
|
|
a.carabayar as kdcarabayar,null as kdpoly, 'Nonreg' as namapoly, t.kode_tarif, t.uraian_tarif, a.jmbayar as jumlah, a1.alasan_batal,a1.status_verifikasi,a.lunas,tp.jml_piutang, obb.st_orderbatal_tindakan,obb.st_orderbatal_verifikasi,obb.st_orderbatal_bayar,obb.st_orderbatal_piutang,obb.st_batal_tindakan,obb.st_batal_verif,obb.st_batal_bayar,obb.st_batal_piutang,a.jmbayar
|
|
FROM t_bayarnonreg a
|
|
JOIN t_billnonreg a1 on a.IDXBILL = a1.IDXBILL
|
|
JOIN m_nonreg b ON b.no_nonreg = a.no_nonreg
|
|
JOIN m_tarif_rs t ON t.kode_tarif = a1.KODETARIF
|
|
LEFT JOIN t_orderbatalbill obb on a1.idxbill = obb.idxbill and billing = 'NONREG'
|
|
LEFT JOIN ( select idxbill, count(id_piutang) as jml_piutang, st_piutang from t_piutang where nobilling = '$nobill' and st_billing = 'NONREG' group by idxbill,st_billing,st_piutang) tp on a1.idxbill = tp.idxbill
|
|
WHERE a.NOBILL = '$nobill' and b.st_nonpasien is null $where_nonota ";
|
|
}
|
|
elseif($by == 'nonpasien') {
|
|
$query_data = "SELECT distinct a.nobill, a.nobayar, a1.nonota, a.idxbill, a.idx_nonreg as idxdaftar, a.tottarifrs, b.nama, b.alamat,null as jeniskelamin,a.no_nonreg as nomr,
|
|
a.carabayar as kdcarabayar,null as kdpoly, 'Nonreg' as namapoly, t.kode_tarif, t.uraian_tarif, a.jmbayar as jumlah, a1.alasan_batal,a1.status_verifikasi,a.lunas,tp.jml_piutang, obb.st_orderbatal_tindakan,obb.st_orderbatal_verifikasi,obb.st_orderbatal_bayar,obb.st_orderbatal_piutang,obb.st_batal_tindakan,obb.st_batal_verif,obb.st_batal_bayar,obb.st_batal_piutang,a.jmbayar
|
|
FROM t_bayarnonreg a
|
|
JOIN t_billnonreg a1 on a.IDXBILL = a1.IDXBILL
|
|
JOIN m_nonreg b ON b.no_nonreg = a.no_nonreg
|
|
JOIN m_tarif_rs t ON t.kode_tarif = a1.KODETARIF
|
|
LEFT JOIN t_orderbatalbill obb on a1.idxbill = obb.idxbill and billing = 'NONPASIEN'
|
|
LEFT JOIN ( select idxbill, count(id_piutang) as jml_piutang, st_piutang from t_piutang where nobilling = '$nobill' and st_billing = 'NONPASIEN' group by idxbill,st_billing,st_piutang) tp on a1.idxbill = tp.idxbill
|
|
WHERE a.NOBILL = '$nobill' and b.st_nonpasien = 1 $where_nonota ";
|
|
}
|
|
elseif($by == 'iurbea') {
|
|
$query_data = "SELECT a.nomr,b.nama,b.jeniskelamin,a.tgl_bayar,a.user_bayar,a.idxdaftar,a.nobill,selisih_biaya, jumlah_bayar, jumlah_bayar as jumlah,b.nama as nama_pasien,b.alamat,c.nama_pegawai,d.nama as nama_ruang,".concat_sql("d.nama,' Kelas ',d.kelas")." AS namapoly,a.no_bayar,f.masukrs as tgl_mrs,f.keluarrs as tgl_pulang, ".datediff_sql('day','f.keluarrs','f.masukrs')." as jml_hari_rawat,d.idx_ruang as kelas,cb.nama as jenis_pembayaran,t.kode_tarif,t.uraian_tarif,t.kel_kuitansi,tk1.kelas as ket_hak_kelas, tk2.kelas as ket_hak_kelas, a.nominal_hak_kelas, a.nominal_naik_kelas, a.no_sep, a.kode_grouping, a.uraian_grouping,a.nonota
|
|
FROM t_iurbea a
|
|
left join m_tarif_rs t on a.kode_tarif = t.kode_tarif
|
|
join t_admission f on f.id_admission = a.idxdaftar
|
|
join m_pasien b on a.nomr = b.nomr
|
|
join m_login c on a.user_bayar = c.nip
|
|
join m_ruang d on f.noruang = d.no
|
|
join m_carabayar cb on f.statusbayar = cb.kode
|
|
left join m_tarifkelas tk1 on a.hak_kelas = tk1.kokel
|
|
left join m_tarifkelas tk2 on a.naik_kelas = tk2.kokel
|
|
WHERE a.nobill = '$nobill' $where_nonota ";
|
|
// log_message('error',$query_data);
|
|
}
|
|
// echo '<tr><td colspan=8>',print_r($query_data),'</td></tr>';exit;
|
|
$tmp_data = $db->query($query_data);
|
|
|
|
if($tmp_data->numRows() > 0)
|
|
{
|
|
$temp_html = $tmp_pasien = $idxdaftar = $nomr = '';
|
|
$no = 1; $total = 0;
|
|
foreach($tmp_data->fetchAll() as $row)
|
|
{
|
|
|
|
if($no == 1){
|
|
$idxdaftar = $row['idxdaftar'];
|
|
$nomr = $row['nomr'];
|
|
$tmp_pasien .= '<dl class="row">
|
|
<dt class="col-sm-4">NOMR</dt><dd class="col-sm-8">'.$row['nomr'].'</dd>
|
|
<dt class="col-sm-4">Nama Pasien</dt><dd class="col-sm-8">'.$row['nama'].'</dd>
|
|
<dt class="col-sm-4">Alamat Pasien</dt><dd class="col-sm-8">'.$row['alamat'].'</dd>
|
|
<dt class="col-sm-4">Jenis Kelamin</dt><dd class="col-sm-8">'.jeniskelamin($row['jeniskelamin']).'</dd>
|
|
<dt class="col-sm-4">Klinik/Ruang</dt><dd class="col-sm-8">'.$row['namapoly'].'</dd></dl>
|
|
';
|
|
}
|
|
$hidden_form = '<input type="hidden" name="input[idxbill]" value="'.$row['idxbill'].'">';
|
|
|
|
$btnCetak = '<button type="button" id="cetak-'.$no.'" class="btn btn-sm btn-danger " onclick="cetak_bill(\''.$row['nobill'].'\','.$row['nobayar'].')">Cetak</button>';
|
|
|
|
$jumlah = ($row['jumlah'] != '') ? format_uang($row['jumlah']) : format_uang($row['jmbayar']);
|
|
$temp_html .= '<tr>
|
|
<td>'.$hidden_form.$no.'</td>
|
|
<td>'.$row['nonota'].'</td>
|
|
<td>'.$row['kode_tarif'].'</td>
|
|
<td>'.$row['uraian_tarif'].'</td>
|
|
<td>'.$jumlah.'</td>
|
|
</tr>';
|
|
$total += $row['jumlah'];
|
|
$no++;
|
|
}
|
|
|
|
echo json_encode(['pasien'=>$tmp_pasien,'data'=>$temp_html,'idxdaftar'=>$idxdaftar,'nomr'=>$nomr,'total'=>format_uang($total)]);
|
|
exit;
|
|
}
|
|
else {
|
|
echo json_encode(['data'=>'<tr><td colspan="8"><label class="bg-red">Data tidak ditemukan</label></td></tr>']);
|
|
}
|
|
|
|
}
|
|
if($page == 'cari_bill')
|
|
{
|
|
$by = $_POST['by'];
|
|
if($_POST['nobill'] == '') {
|
|
echo json_encode(['message'=>'Error! No Billing Belum Terisi','type'=>'error']);
|
|
exit;
|
|
}
|
|
elseif($by == 'rajal' && $_POST['nobukti'] == '') {
|
|
echo json_encode(['message'=>'Error! No Bukti Belum Terisi','type'=>'error']);
|
|
exit;
|
|
}
|
|
$nobill = preg_replace("/\./", "", $_POST['nobill']);
|
|
$nobukti = preg_replace("/\./", "", $_POST['nobukti']);
|
|
|
|
if(strlen($nobill) > 8) {
|
|
echo json_encode(['message'=>'Error! No Billing Tidak Ditemukan','type'=>'error']);
|
|
exit;
|
|
}
|
|
$where_nonota = ($nobukti != '') ? "and a1.nonota = '$nobukti' " : '' ;
|
|
if($by == 'rajal')
|
|
{
|
|
$query_data = "SELECT distinct a1.nobill, a1.nonota, a1.idxbill, a1.idxdaftar, a1.tarifrs, b.nama, b.alamat,b.jeniskelamin,a1.nomr,
|
|
c.kdcarabayar,c.kdpoly, e.nama as namapoly, t.kode_tarif, t.uraian_tarif, a1.tarifrs as jumlah, a1.alasan_batal, a1.status_verifikasi,tp.jml_piutang,obb.st_orderbatal_tindakan,obb.st_orderbatal_verifikasi,obb.st_orderbatal_bayar,obb.st_orderbatal_piutang,obb.st_batal_tindakan,obb.st_batal_verif,obb.st_batal_bayar,obb.st_batal_piutang
|
|
FROM t_billrajal a1
|
|
JOIN m_pasien b ON b.nomr = a1.nomr
|
|
JOIN t_pendaftaran c ON c.IDXDAFTAR = a1.IDXDAFTAR
|
|
JOIN m_ruang e ON e.no = c.KDPOLY
|
|
JOIN m_tarif_rs t ON t.kode_tarif = a1.KODETARIF
|
|
LEFT JOIN t_orderbatalbill obb on a1.idxbill = obb.idxbill and billing = 'RAJAL'
|
|
LEFT JOIN ( select idxbill, count(id_piutang) as jml_piutang, st_piutang from t_piutang where nobilling = '$nobill' and st_billing = 'IRJA' group by idxbill,st_billing,st_piutang) tp on a1.idxbill = tp.idxbill
|
|
WHERE a1.NOBILL = '$nobill' $where_nonota and a1.aps = 0 and a1.status <> 'BATAL' ";
|
|
}
|
|
elseif($by == 'nonkunjungan')
|
|
{
|
|
$query_data = "SELECT distinct a1.nobill, a1.nonota, a1.idxbill, a1.idxdaftar, a1.tarifrs, b.nama, b.alamat,b.jeniskelamin,a1.nomr,
|
|
c.kdcarabayar,c.kdpoly, e.nama_unit as namapoly, t.kode_tarif, t.uraian_tarif, a1.tarifrs as jumlah, a1.alasan_batal, a1.status_verifikasi,tp.jml_piutang,obb.st_orderbatal_tindakan,obb.st_orderbatal_verifikasi,obb.st_orderbatal_bayar,obb.st_orderbatal_piutang,obb.st_batal_tindakan,obb.st_batal_verif,obb.st_batal_bayar,obb.st_batal_piutang
|
|
FROM t_billrajal a1
|
|
JOIN m_pasien_aps b ON b.nomr = a1.nomr
|
|
JOIN t_pendaftaran_aps c ON c.IDXDAFTAR = a1.IDXDAFTAR
|
|
LEFT JOIN m_unit e ON e.kode_unit = c.unit
|
|
JOIN m_tarif_rs t ON t.kode_tarif = a1.KODETARIF
|
|
LEFT JOIN t_orderbatalbill obb on a1.idxbill = obb.idxbill and billing = 'RAJAL'
|
|
LEFT JOIN ( select idxbill, count(id_piutang) as jml_piutang, st_piutang from t_piutang where nobilling = '$nobill' and st_billing = 'IRJA' group by idxbill,st_billing,st_piutang) tp on a1.idxbill = tp.idxbill
|
|
WHERE a1.NOBILL = '$nobill' $where_nonota and a1.aps = 1 and a1.status <> 'BATAL' ";
|
|
}
|
|
elseif($by == 'ranap') {
|
|
$query_data = "SELECT distinct a1.nobill, a1.nonota, a1.idxbill, a1.idxdaftar, a1.tarifrs, b.nama, b.alamat,b.jeniskelamin,a1.nomr,
|
|
c.statusbayar as kdcarabayar,c.noruang, ".concat_sql("e.nama,' Kelas ',e.kelas")." AS namapoly, t.kode_tarif, t.uraian_tarif, a1.tarifrs as jumlah, a1.alasan_batal,a1.status_verifikasi,tp.jml_piutang, obb.st_orderbatal_tindakan,obb.st_orderbatal_verifikasi,obb.st_orderbatal_bayar,obb.st_orderbatal_piutang,obb.st_batal_tindakan,obb.st_batal_verif,obb.st_batal_bayar,obb.st_batal_piutang
|
|
FROM t_billranap a1
|
|
JOIN m_pasien b ON b.nomr = a1.nomr
|
|
JOIN t_admission c ON c.id_admission = a1.IDXDAFTAR
|
|
JOIN m_ruang e ON e.no = c.noruang
|
|
JOIN m_tarif_rs t ON t.kode_tarif = a1.KODETARIF
|
|
LEFT JOIN t_orderbatalbill obb on a1.idxbill = obb.idxbill and billing = 'RANAP'
|
|
LEFT JOIN ( select idxbill, count(id_piutang) as jml_piutang, st_piutang from t_piutang where nobilling = '$nobill' and st_billing = 'IRNA' group by idxbill,st_billing,st_piutang) tp on a1.idxbill = tp.idxbill
|
|
WHERE a1.NOBILL = '$nobill' $where_nonota and a1.status <> 'BATAL'";
|
|
}
|
|
elseif($by == 'nonreg') {
|
|
$query_data = "SELECT distinct a1.nobill, a1.nonota, a1.idxbill, a1.idx_nonreg as idxdaftar, a1.tarifrs, b.nama, b.alamat,null as jeniskelamin,a1.no_nonreg as nomr,
|
|
a1.carabayar as kdcarabayar,null as kdpoly, 'Nonreg' as namapoly, t.kode_tarif, t.uraian_tarif, a1.tarifrs as jumlah, a1.alasan_batal,a1.status_verifikasi,tp.jml_piutang, obb.st_orderbatal_tindakan,obb.st_orderbatal_verifikasi,obb.st_orderbatal_bayar,obb.st_orderbatal_piutang,obb.st_batal_tindakan,obb.st_batal_verif,obb.st_batal_bayar,obb.st_batal_piutang
|
|
FROM t_billnonreg a1
|
|
JOIN m_nonreg b ON b.no_nonreg = a1.no_nonreg
|
|
JOIN m_tarif_rs t ON t.kode_tarif = a1.KODETARIF
|
|
LEFT JOIN t_orderbatalbill obb on a1.idxbill = obb.idxbill and billing = 'NONREG'
|
|
LEFT JOIN ( select idxbill, count(id_piutang) as jml_piutang, st_piutang from t_piutang where nobilling = '$nobill' and st_billing = 'NONREG' group by idxbill,st_billing,st_piutang) tp on a1.idxbill = tp.idxbill
|
|
WHERE a1.NOBILL = '$nobill' $where_nonota and a1.status <> 'BATAL'";
|
|
}
|
|
// echo '<tr><td colspan=8>',print_r($query_data),'</td></tr>';exit;
|
|
$tmp_data = $db->query($query_data);
|
|
|
|
if($tmp_data->numRows() > 0)
|
|
{
|
|
$temp_html = $tmp_pasien = $idxdaftar = $nomr = '';
|
|
$no = 1;
|
|
foreach($tmp_data->fetchAll() as $row)
|
|
{
|
|
|
|
if($no == 1){
|
|
$idxdaftar = $row['idxdaftar'];
|
|
$nomr = $row['nomr'];
|
|
$tmp_pasien .= '<dl class="row">
|
|
<dt class="col-sm-4">NOMR</dt><dd class="col-sm-8">'.$row['nomr'].'</dd>
|
|
<dt class="col-sm-4">Nama Pasien</dt><dd class="col-sm-8">'.$row['nama'].'</dd>
|
|
<dt class="col-sm-4">Alamat Pasien</dt><dd class="col-sm-8">'.$row['alamat'].'</dd>
|
|
<dt class="col-sm-4">Jenis Kelamin</dt><dd class="col-sm-8">'.jeniskelamin($row['jeniskelamin']).'</dd>
|
|
<dt class="col-sm-4">Klinik/Ruang</dt><dd class="col-sm-8">'.$row['namapoly'].'</dd></dl>
|
|
';
|
|
}
|
|
$hidden_form = '<input type="hidden" name="input[idxbill]" value="'.$row['idxbill'].'">';
|
|
|
|
$btnCetak = '<button type="button" id="cetak-'.$no.'" class="btn btn-sm btn-danger " onclick="cetak_bill(\''.$row['nobill'].'\','.$row['nonota'].')">Cetak</button>';
|
|
|
|
|
|
$temp_html .= '<tr>
|
|
<td>'.$hidden_form.$no.'</td>
|
|
<td>'.$row['nonota'].'</td>
|
|
<td>'.$row['kode_tarif'].'</td>
|
|
<td>'.$row['uraian_tarif'].'</td>
|
|
<td>'.$row['jumlah'].'</td>
|
|
</tr>';
|
|
$no++;
|
|
}
|
|
|
|
echo json_encode(['pasien'=>$tmp_pasien,'data'=>$temp_html,'idxdaftar'=>$idxdaftar,'nomr'=>$nomr]);
|
|
exit;
|
|
}
|
|
else {
|
|
echo json_encode(['data'=>'<tr><td colspan="8"><label class="bg-red">Data tidak ditemukan</label></td></tr>','message'=>'Data Tidak Ditemukan','type'=>'error']);
|
|
}
|
|
|
|
}
|
|
elseif ($page == 'cari_deposit') {
|
|
$nobill = preg_replace("/\./", "", $_POST['nobill']);
|
|
$nobukti = preg_replace("/\./", "", $_POST['nobukti']);
|
|
$tanggal = $_POST['tanggal'];
|
|
$petugas = $_SESSION['NIP'];
|
|
$where_nonota = ($nobukti != '') ? "and d.nobill = '$nobill' and d.no_bayar = '$nobukti' " : '' ;
|
|
if($tanggal != '') {
|
|
$where_nonota .= "and date(d.tanggal) = '".$tanggal."' ";
|
|
}
|
|
if($petugas != '') {
|
|
$where_nonota .= "and user_deposit = '".$petugas."' ";
|
|
}
|
|
$query_data = "SELECT a.nomr,e.masukrs,a.nama,b.nama as ruang,c.nama as carabayar1, sum(d.deposit) as jumlah, e.id_admission as idxdaftar, br.nobill, e.noruang, d.no_bayar, d.tanggal
|
|
FROM t_admission e
|
|
JOIN m_pasien a ON e.nomr=a.nomr
|
|
JOIN m_ruang b ON e.noruang=b.no
|
|
JOIN m_carabayar c ON e.statusbayar=c.KODE
|
|
join (select distinct nobill,idxdaftar,nomr from t_billranap where nobill = $nobill) br on br.idxdaftar = e.id_admission and br.nomr = e.nomr
|
|
left JOIN t_deposit d ON e.id_admission = d.idadmission and d.st_batal is null
|
|
WHERE (e.keluarrs IS NULL or e.keluarrs is not null) $where_nonota
|
|
group by a.nomr,e.masukrs,a.nama,b.nama,c.nama,e.id_admission, br.nobill, e.noruang, d.no_bayar, d.tanggal";
|
|
|
|
$tmp_data = $db->query($query_data);
|
|
|
|
if($tmp_data->numRows() > 0)
|
|
{
|
|
$temp_html = $tmp_pasien = $idxdaftar = $nomr = '';
|
|
$no = 1;
|
|
foreach($tmp_data->fetchAll() as $row)
|
|
{
|
|
|
|
if($no == 1){
|
|
$idxdaftar = $row['idxdaftar'];
|
|
$nomr = $row['nomr'];
|
|
$tmp_pasien .= '<dl class="row">
|
|
<dt class="col-sm-4">NOMR</dt><dd class="col-sm-8">'.$row['nomr'].'</dd>
|
|
<dt class="col-sm-4">Nama Pasien</dt><dd class="col-sm-8">'.$row['nama'].'</dd>
|
|
<dt class="col-sm-4">Alamat Pasien</dt><dd class="col-sm-8">'.$row['alamat'].'</dd>
|
|
<dt class="col-sm-4">Jenis Kelamin</dt><dd class="col-sm-8">'.jeniskelamin($row['jeniskelamin']).'</dd>
|
|
<dt class="col-sm-4">Klinik/Ruang</dt><dd class="col-sm-8">'.$row['namapoly'].'</dd></dl>
|
|
';
|
|
}
|
|
|
|
$temp_html .= '<tr>
|
|
<td>'.$no.'</td>
|
|
<td>'.$row['tanggal'].'</td>
|
|
<td>'.$row['no_bayar'].'</td>
|
|
<td>'.$row['jumlah'].'</td>
|
|
</tr>';
|
|
$no++;
|
|
}
|
|
|
|
echo json_encode(['pasien'=>$tmp_pasien,'data'=>$temp_html,'idxdaftar'=>$idxdaftar,'nomr'=>$nomr]);
|
|
exit;
|
|
}
|
|
else {
|
|
echo json_encode(['data'=>'<tr><td colspan="8"><label class="bg-red">Data tidak ditemukan</label></td></tr>','message'=>'Data Tidak Ditemukan','type'=>'error']);
|
|
}
|
|
}
|
|
elseif ($page == 'cari_nota_iurbea') {
|
|
$nobill = preg_replace("/\./", "", $_POST['nobill']);
|
|
$nobukti = preg_replace("/\./", "", $_POST['nobukti']);
|
|
$where_nonota = ($nobukti != '') ? " i.nobill = '$nobill' and i.nonota = '$nobukti' " : '' ;
|
|
|
|
$query_data = "SELECT a.nomr,e.masukrs,a.nama,a.alamat,a.jeniskelamin,b.nama as ruang,c.nama as carabayar1, selisih_biaya as jumlah, e.id_admission, br.nobill, e.noruang, i.nonota, i.tgl_iurbea
|
|
FROM t_admission e
|
|
JOIN m_pasien a ON e.nomr=a.nomr
|
|
JOIN m_ruang b ON e.noruang=b.no
|
|
JOIN m_carabayar c ON e.statusbayar=c.KODE
|
|
join (select distinct nobill,idxdaftar,nomr from t_billranap where nobill = $nobill) br on br.idxdaftar = e.id_admission and br.nomr = e.nomr
|
|
left JOIN t_iurbea i ON e.id_admission = i.idxdaftar and i.st_iurbea = 1
|
|
WHERE $where_nonota ";
|
|
|
|
$tmp_data = $db->query($query_data);
|
|
|
|
if($tmp_data->numRows() > 0)
|
|
{
|
|
$temp_html = $tmp_pasien = $idxdaftar = $nomr = '';
|
|
$no = 1;
|
|
foreach($tmp_data->fetchAll() as $row)
|
|
{
|
|
|
|
if($no == 1){
|
|
$idxdaftar = $row['idxdaftar'];
|
|
$nomr = $row['nomr'];
|
|
$tmp_pasien .= '<dl class="row">
|
|
<dt class="col-sm-4">NOMR</dt><dd class="col-sm-8">'.$row['nomr'].'</dd>
|
|
<dt class="col-sm-4">Nama Pasien</dt><dd class="col-sm-8">'.$row['nama'].'</dd>
|
|
<dt class="col-sm-4">Alamat Pasien</dt><dd class="col-sm-8">'.$row['alamat'].'</dd>
|
|
<dt class="col-sm-4">Jenis Kelamin</dt><dd class="col-sm-8">'.jeniskelamin($row['jeniskelamin']).'</dd>
|
|
<dt class="col-sm-4">Klinik/Ruang</dt><dd class="col-sm-8">'.$row['ruang'].'</dd></dl>
|
|
';
|
|
}
|
|
|
|
$temp_html .= '<tr>
|
|
<td>'.$no.'</td>
|
|
<td>'.$row['tgl_iurbea'].'</td>
|
|
<td>'.$row['nonota'].'</td>
|
|
<td>'.$row['jumlah'].'</td>
|
|
</tr>';
|
|
$no++;
|
|
}
|
|
|
|
echo json_encode(['pasien'=>$tmp_pasien,'data'=>$temp_html,'idxdaftar'=>$idxdaftar,'nomr'=>$nomr]);
|
|
exit;
|
|
}
|
|
else {
|
|
echo json_encode(['data'=>'<tr><td colspan="8"><label class="bg-red">Data tidak ditemukan</label></td></tr>','message'=>'Data Tidak Ditemukan','type'=>'error']);
|
|
}
|
|
}
|
|
elseif($page == 'cetak')
|
|
{
|
|
|
|
echo '<embed src="pdf_piutang/'.$folder.'/'.$namafile.$ext.'" type="application/pdf" height="600px" width="100%">';
|
|
} |