Example #1
0
	function list_data($hal = 0) {
		$paging = new MyPagina;
		$paging->rows_on_page = 20;
		$paging->sql = "SELECT id, nama, alamat FROM ref_perujuk ORDER BY nama";
		$paging->get_page_result();
		$paging->hal = $hal;
		$_SESSION[hal] = $hal;
		$paging->get_page_result();

		$data = $paging->data;
		$no = $paging->start_number();
		$navi = $paging->navi();

		$table = new Table;
		$table->tbody_height = 420;
		$table->addTh("No", "Nama", "Alamat", "Hapus");
		$table->addExtraTh(" style=\"width: 50px;\"", " style=\"width: 200px;\"", "", " style=\"width: 70px;\" ");
		for($i=0;$i<sizeof($data);$i++) {
			$table->addRow(
				($no+$i), 
				$data[$i][nama], 
				$data[$i][alamat], 
				"<a href=\"javascript:void(0)\" title=\"Hapus\" onclick=\"hapus_perujuk('".$data[$i][id]."', this)\" class=\"tombol_hapus\"><img src=\"".IMAGES_URL."remove.png\" alt=\"Hapus\" border=\"0\" /></a>");
			$table->addExtraTd(
				" onclick=\"xajax_get_perujuk('".$data[$i][id]."')\" ", 
				" onclick=\"xajax_get_perujuk('".$data[$i][id]."')\" ", 
				" onclick=\"xajax_get_perujuk('".$data[$i][id]."')\" ");
		}
		$ret = $table->build();
		$objResponse = new xajaxResponse();
		$objResponse->addAssign("navi", "innerHTML", $navi);
		$objResponse->addAssign("list_data", "innerHTML", $ret);
		return $objResponse;
	}
Example #2
0
	function list_kamar($hal = 0) {
		$paging = new MyPagina;
	    
        $paging->sql = "select p.nama as bangsal,
                               k.id as kamar_id,
                               k.nama as nama_kamar, 
                               rk.nomor as no_kamar,
                               rk.status as status 
                               from kamar k, ref_kamar rk,
                               pelayanan p 
                               where k.id = rk.kamar_id and k.pelayanan_id = p.id
                               and p.jenis = 'RAWAT INAP'
                               order by p.nama, k.kelas, k.nama";
            
		
		
		$paging->rows_on_page = 15;
		$paging->hal = $hal;
		$_SESSION[modul_setting][no_kamar][hal] = $hal;
		$paging->get_page_result();

		$data = $paging->data;
		$no = $paging->start_number();
		$navi = $paging->navi();

		$table = new Table;
		$table->tbody_height = 350;
		$table->addTh(
			"No", 
			"Nama Bangsal", 
			"Nama Kamar", 
			"No Bed",
            "Status",
			"Hapus"
		);
		$table->addExtraTh("style=\"width:50px;\"","style=\"width:200px;\"","","","","","","style=\"width:70px;\"");
		$kon = new Konek;
		for($i=0;$i<sizeof($data);$i++) {
			$table->addRow(
				($no+$i), 
				$data[$i][bangsal], 
				$data[$i][nama_kamar],
				$data[$i][no_kamar],
                $data[$i][status], 
				"<a href=\"javascript:void(0)\" title=\"Hapus\" onclick=\"hapus_kamar('".$data[$i][id]."', this)\" class=\"tombol_hapus\"><img src=\"".IMAGES_URL."remove.png\" alt=\"Hapus\" border=\"0\" /></a>"
			);
			$table->addOnclickTd(
				"xajax_get_info('".$data[$i][id]."')", 
				"xajax_get_info('".$data[$i][id]."')", 
				"xajax_get_info('".$data[$i][id]."')", 
				"xajax_get_info('".$data[$i][id]."')", 
				"xajax_get_info('".$data[$i][id]."')"
			);
		}
		$buka = $table->build();
		$objResponse = new xajaxResponse();
		$objResponse->addAssign("navi", "innerHTML", $navi);
		$objResponse->addAssign("list_kamar", "innerHTML", $buka);
		return $objResponse;
	}
Example #3
0
	function list_data($hal = 0) {
		$_SESSION[hal] = $hal;
		$objResponse = new xajaxResponse();
		$paging = new MyPagina;
		$paging->rows_on_page = 20;

		$paging->sql = "
			SELECT 
				d.id as id, 
				d.nama as nama, 
				spc.id as spc_id, 
				spc.nama as spc_nama, 
				sub.id as sub_id, 
				sub.nama as sub_nama, 
				d.telp as telp, 
				d.aktif as aktif,
				CASE 
					WHEN (d.aktif = '1') THEN 'Ya'
					ELSE 'Tidak'
				END AS aktif_nama
				FROM 
					dokter d 
					JOIN subspesialisasi sub ON (sub.id = d.subspesialisasi_id)
					JOIN spesialisasi spc ON (spc.id = sub.spesialisasi_id)
				ORDER BY 
					spc.nama, sub.nama, d.nama
			";
		$paging->hal = $hal;
		$paging->get_page_result();
		$_SESSION[modul_setting][dokter][hal] = $hal;
		$data = $paging->data;
		$no = $paging->start_number();
		$navi = $paging->navi();

		$tabel = new Table;
		$tabel->tbody_height = 380;
		$tabel->addTh("No", "Nama", "Spesialisasi/<br />Sub Spesialisasi", "Telp", "Aktif", "Hapus");
		$tabel->addExtraTh(" style=\"width:50px;\"", "style=\"width:200px;\"", "", "", "", " style=\"width:70px;\" ");

		for($i=0;$i<sizeof($data);$i++) {
			$tabel->addRow(
				($no+$i), 
				$data[$i][nama], 
				$data[$i][spc_nama] . "<br />" . $data[$i][sub_nama], 
				$data[$i][telp], $data[$i][aktif_nama], 
				"<a href=\"javascript:void(0)\" title=\"Hapus\" onclick=\"hapus_dokter('".$data[$i][id]."', this)\" class=\"tombol_hapus\"><img src=\"".IMAGES_URL."remove.png\" alt=\"Hapus\" border=\"0\" /></a>");
			$tabel->addOnclickTd(
				"xajax_get_dokter('".$data[$i][id]."')", 
				"xajax_get_dokter('".$data[$i][id]."')", 
				"xajax_get_dokter('".$data[$i][id]."')", 
				"xajax_get_dokter('".$data[$i][id]."')"
			);
		}
		$buka = $tabel->build();
		$objResponse->addAssign("list_data", "innerHTML", $buka);
		$objResponse->addAssign("navi", "innerHTML", $navi);
		return $objResponse;
	}
Example #4
0
	function list_data($hal = 0, $prop_id = "", $kab_id = "") {
		$_SESSION[setting_kecamatan][hal] = $hal;
		//$all_id = @explode("|", $prop_kab_id);
		if($prop_id) $s .= " AND p.id = '".$prop_id."'";
		if($kab_id) $s .= " AND k.id = '".$kab_id."'";

		$objResponse = new xajaxResponse();
		$paging = new MyPagina;
		$paging->rows_on_page = 20;
		$paging->setOnclickValue($prop_id, $kab_id);
		//$paging->onclick2_value = "'" . $prop_kab_id . "'";
		$paging->sql = "
			SELECT 
				kec.id AS id, 
				p.id AS prop_id,
				p.nama AS prop, 
				k.id AS kab_id,
				k.nama AS kab,
				kec.nama AS nama,
				COUNT(d.id) as jml_desa
			FROM 
				ref_kecamatan kec 
				JOIN ref_kabupaten k ON (k.id = kec.kabupaten_id)
				JOIN ref_propinsi p ON (p.id = k.propinsi_id) 
				LEFT JOIN ref_desa d ON (d.kecamatan_id = kec.id)
			WHERE
				1=1
				$s
			GROUP BY kec.id
			ORDER BY p.nama, k.nama, kec.nama
			
		";
		$paging->hal = $hal;
		$paging->get_page_result();

		$data = $paging->data;
		$no = $paging->start_number();
		$navi = $paging->navi();

		$tabel = new Table;
		$tabel->tbody_height = 370;
		$tabel->addTh("No", "Propinsi", "Kabupaten", "Kecamatan", "Jml<br />Kelurahan", "Hapus");
		$tabel->addExtraTh(" style=\"width: 50px;\"", " style=\"width: 200px;\"", "", "", "style=\"width: 100px;\"", " style=\"width: 70px;\" ");

		for($i=0;$i<sizeof($data);$i++) {
			if($data[$i][prop_id] != $data[$i-1][prop_id]) $prop = $data[$i][prop];
			else $prop = "";
			if($data[$i][kab_id] != $data[$i-1][kab_id]) $kab = $data[$i][kab];
			else $kab = "";
			$tabel->addRow(($no+$i), $prop, $kab, $data[$i][nama], $data[$i][jml_desa], "<a href=\"javascript:void(0)\" title=\"Hapus\" onclick=\"hapus_kecamatan('".$data[$i][id]."', this)\" class=\"tombol_hapus\"><img src=\"".IMAGES_URL."remove.png\" alt=\"Hapus\" border=\"0\" /></a>");
			$tabel->addOnclickTd("xajax_get_kecamatan('".$data[$i][id]."')","xajax_get_kecamatan('".$data[$i][id]."')", "xajax_get_kecamatan('".$data[$i][id]."')", "xajax_get_kecamatan('".$data[$i][id]."')");
		}

		$buka = $tabel->build();
		$objResponse->addAssign("list_data", "innerHTML", $buka);
		$objResponse->addAssign("navi", "innerHTML", $navi);
		return $objResponse;
	}
Example #5
0
	function list_data($hal = 0) {
		$paging = new MyPagina;
		$paging->rows_on_page = 20;
		$paging->sql = "SELECT 
			p.id as id, 
			p.nama as nama,
			p.username as username,
			pg.nama as `group`,
			pel.nama as pelayanan
		FROM 
			pengguna p
			JOIN pengguna_group pg ON (pg.id = p.pengguna_group_id)
			LEFT JOIN pelayanan pel ON (pel.id = p.pelayanan_id)
		WHERE pg.id <> 1
		ORDER BY 
			pg.nama,
			p.nama";

		$paging->get_page_result();
		$paging->hal = $hal;
		$_SESSION[hal] = $hal;
		$paging->get_page_result();

		$data = $paging->data;
		$no = $paging->start_number();
		$navi = $paging->navi();

		$table = new Table;
		$table->tbody_height = 300;
		$table->addTh("No", "Nama", "Username", "Group", "Bangsal/<br />Klinik", "Hapus");
		$table->addExtraTh(" style=\"width: 50px;\"", "", "", "", "", " style=\"width: 70px;\" ");
		for($i=0;$i<sizeof($data);$i++) {
			$table->addRow(
				($no+$i), 
				$data[$i][nama], 
				$data[$i][username], 
				$data[$i][group], 
				$data[$i][pelayanan], 
				"<a href=\"javascript:void(0)\" title=\"Hapus\" onclick=\"hapus_pengguna('".$data[$i][id]."', this)\" class=\"tombol_hapus\"><img src=\"".IMAGES_URL."remove.png\" alt=\"Hapus\" border=\"0\" /></a>");

			$table->addOnclickTd(
				"xajax_get_pengguna('".$data[$i][id]."')", 
				"xajax_get_pengguna('".$data[$i][id]."')", 
				"xajax_get_pengguna('".$data[$i][id]."')", 
				"xajax_get_pengguna('".$data[$i][id]."')", 
				"xajax_get_pengguna('".$data[$i][id]."')"
			);
		}
		$ret = $table->build();
		$objResponse = new xajaxResponse();
		$objResponse->addAssign("navi", "innerHTML", $navi);
		$objResponse->addAssign("list_data", "innerHTML", $ret);
		return $objResponse;
	}
Example #6
0
	function list_data($hal = 0) {
		$paging = new MyPagina;
		$paging->sql = "
			SELECT 
				pel.id as id, 
				pel.jenis as jenis,
				pel.nama as nama,
				spc.nama as spec,
				pel.hari_buka as hari_buka
			FROM 
				pelayanan pel
				JOIN spesialisasi spc ON (spc.id = pel.spesialisasi_id)
			WHERE
				pel.jenis IN ('RAWAT JALAN', 'RAWAT INAP')
			ORDER BY pel.jenis, spc.nama";
		$paging->rows_on_page = 20;
		$paging->hal = $hal;
		$paging->get_page_result();
		$_SESSION[hal] = $hal;
		$data = $paging->data;
		$no = $paging->start_number();
		$navi = $paging->navi();

		$table = new Table;
		$table->addTh("No", "Jenis<br />Pelayanan", "Spesialisasi", "Nama Poliklinik/<br />Bangsal", "Hari Buka<br />Seminggu", "Hapus");
		$table->addExtraTh("style=\"width:50px;\"","","","","","style=\"width:70px;\"");
		for($i=0;$i<sizeof($data);$i++) {
			if($data[$i][jenis] == $data[$i-1][jenis])
				$jenis = "";
			else 
				$jenis = $data[$i][jenis];
			$table->addRow(
				($no+$i), 
				$jenis, 
				$data[$i][spec], 
				$data[$i][nama], 
				$data[$i][hari_buka], 
				"<input type=\"button\" value=\"[  x  ]\" name=\"hapus\" class=\"inputan\" onclick=\"xajax_hapus_pelayanan_confirm('".$data[$i][id]."', '".addslashes($data[$i][nama])."')\" />"
			);
			$table->addOnclickTd(
				"xajax_get_pelayanan('".$data[$i][id]."')", 
				"xajax_get_pelayanan('".$data[$i][id]."')", 
				"xajax_get_pelayanan('".$data[$i][id]."')", 
				"xajax_get_pelayanan('".$data[$i][id]."')", 
				"xajax_get_pelayanan('".$data[$i][id]."')"
			);
		}
		$ret = $table->build();
		$objResponse = new xajaxResponse();
		$objResponse->addAssign("navi", "innerHTML", $navi);
		$objResponse->addAssign("list_data", "innerHTML", $ret);
		return $objResponse;
	}
Example #7
0
	function list_data_lab($hal = 0) {
		$paging = new MyPagina;
		$paging->sql = "
			SELECT 
				ls.id as id,
				ls.nama as nama,
				ls.biaya_bhp as biaya_bhp,
				lsd.biaya_jasa as biaya_jasa,
				lsd.kelas as kelas
			FROM 
				lab_specimen ls
				JOIN lab_specimen_detil lsd ON (lsd.tingkat = ls.tingkat)			
			ORDER BY 
				ls.nama
			";
			
		$paging->rows_on_page = 15;
		$paging->hal = $hal;
		$_SESSION[modul_setting][lab_spesimen][hal] = $hal;
		$paging->get_page_result();

		$data = $paging->data;
		$no = $paging->start_number();
		$navi = $paging->navi();

		$table = new Table;
		$table->tbody_height = 350;
		$table->addTh("No","Nama","Biaya_bhp","Biaya Jasa","Kelas","Hapus");
		$table->addExtraTh("style=\"width:50px;\"","style=\"width:200px;\"","","","");
		$kon = new Konek;
		for($i=0;$i<sizeof($data);$i++) {
			$table->addRow(
				($no+$i), 
				$data[$i][nama],
				$data[$i][biaya_bhp], 
				$data[$i][biaya_jasa],
				$data[$i][kelas], 
				"<a href=\"javascript:void(0)\" title=\"Hapus\" onclick=\"hapus_kamar('".$data[$i][id]."', this)\" class=\"tombol_hapus\"><img src=\"".IMAGES_URL."remove.png\" alt=\"Hapus\" border=\"0\" /></a>"
			);
			$table->addOnclickTd(
				"xajax_get_info('".$data[$i][id]."')", 
				"xajax_get_info('".$data[$i][id]."')", 
				"xajax_get_info('".$data[$i][id]."')", 
				"xajax_get_info('".$data[$i][id]."')", 
				"xajax_get_info('".$data[$i][id]."')"
			);
		}
		$buka = $table->build();
		$objResponse = new xajaxResponse();
		$objResponse->addAssign("navi", "innerHTML", $navi);
		$objResponse->addAssign("list_data_lab", "innerHTML", $buka);
		return $objResponse;
	}
Example #8
0
	function list_data($hal = 0) {
		$paging = new MyPagina;
		$paging->sql = "
			SELECT 
				pel.id as id, 
				pel.nama as nama,
				spc.nama as spec,
				pel.hari_buka as hari_buka,
                pel.tarif as tarif
			FROM 
				pelayanan pel
				JOIN spesialisasi spc ON (spc.id = pel.spesialisasi_id)
			WHERE
				pel.jenis ='RAWAT JALAN'
			ORDER BY spc.nama";
		$paging->rows_on_page = 20;
		$paging->hal = $hal;
		$paging->get_page_result();
		$_SESSION[hal] = $hal;
		$data = $paging->data;
		$no = $paging->start_number();
		$navi = $paging->navi();

		$table = new Table;
		$table->tbody_height = 390;
		$table->addTh("No", "Nama Poliklinik", "Spesialisasi", "Hari Buka<br />Seminggu", "Tarif","Hapus");
		$table->addExtraTh("style=\"width:50px;\"","","","","","style=\"width:70px;\"");
		for($i=0;$i<sizeof($data);$i++) {
			$table->addRow(
				($no+$i), 
				$data[$i][nama], 
				$data[$i][spec], 
				$data[$i][hari_buka],$data[$i][tarif], 
				"<a href=\"javascript:void(0)\" title=\"Hapus\" onclick=\"hapus_pelayanan('".$data[$i][id]."', this)\" class=\"tombol_hapus\"><img src=\"".IMAGES_URL."remove.png\" alt=\"Hapus\" border=\"0\" /></a>"
			);
			$table->addOnclickTd(
				"xajax_get_pelayanan('".$data[$i][id]."')", 
				"xajax_get_pelayanan('".$data[$i][id]."')", 
				"xajax_get_pelayanan('".$data[$i][id]."')", 
				"xajax_get_pelayanan('".$data[$i][id]."')",
                "xajax_get_pelayanan('".$data[$i][id]."')"                
			);
		}
		$ret = $table->build();
		$objResponse = new xajaxResponse();
		$objResponse->addAssign("navi", "innerHTML", $navi);
		$objResponse->addAssign("list_data", "innerHTML", $ret);
		return $objResponse;
	}
Example #9
0
	function list_data($hal = 0) {
		$_SESSION[setting_propinsi][hal] = $hal;
		$objResponse = new xajaxResponse();
		$paging = new MyPagina;
		$paging->rows_on_page = 20;
		$paging->sql = "
			SELECT 
				p.id AS id, 
				p.nama AS nama, 
				COUNT(k.id) AS jml_kab
			FROM 
				ref_propinsi p 
				LEFT JOIN ref_kabupaten k ON (k.propinsi_id = p.id) 
			GROUP BY 
				p.id 
			ORDER BY 
				p.nama
		";
		$paging->hal = $hal;
		$paging->get_page_result();

		$data = $paging->data;
		$no = $paging->start_number();
		$navi = $paging->navi();

		$tabel = new Table;
		$tabel->tbody_height = 420;
		$tabel->addTh("No", "Propinsi", "Jml<br />Kabupaten", "Hapus");
		$tabel->addExtraTh(" style=\"width: 50px;\"", "", " style=\"width: 100px;\"", " style=\"width: 70px;\" ");

		for($i=0;$i<sizeof($data);$i++) {
			$tabel->addRow(($no+$i), $data[$i][nama], $data[$i][jml_kab], "<a href=\"javascript:void(0)\" title=\"Hapus\" onclick=\"hapus_propinsi('".$data[$i][id]."', this)\" class=\"tombol_hapus\"><img src=\"".IMAGES_URL."remove.png\" alt=\"Hapus\" border=\"0\" /></a>");
			$tabel->addOnclickTd("xajax_get_propinsi('".$data[$i][id]."')", "xajax_get_propinsi('".$data[$i][id]."')", "xajax_get_propinsi('".$data[$i][id]."')");
		}

		$buka = $tabel->build();
		$objResponse->addAssign("list_data", "innerHTML", $buka);
		$objResponse->addAssign("navi", "innerHTML", $navi);
		return $objResponse;
	}
Example #10
0
	function list_data($hal = 0) {
		$_SESSION[setting_imunisasi][hal] = $hal;
		$objResponse = new xajaxResponse();
		$paging = new MyPagina;
		$paging->rows_on_page = 20;
		$paging->sql = "
		SELECT 
			id as id,
			nama as nama,
			sebab_sakit as sebab_sakit
		FROM
			imunisasi
		ORDER BY 
			nama
		";
		$paging->hal = $hal;
		$paging->get_page_result();		
		$data = $paging->data;
		$no = $paging->start_number();
		$navi = $paging->navi();

		$tabel = new Table;
		$tabel->tbody_height = 350;
		$tabel->addTh("No", "Nama", "Sebab Sakit", "Hapus");
		$tabel->addExtraTh(" style=\"width:50px;\"", "style=\"width:200px;\"", "", " style=\"width:70px;\"");

		for($i=0;$i<sizeof($data);$i++) {
			$tabel->addRow(($i+1), $data[$i][nama], $data[$i][sebab_sakit], "<a href=\"javascript:void(0)\" title=\"Hapus\" onclick=\"hapus_imunisasi('".$data[$i][id]."', this)\" class=\"tombol_hapus\"><img src=\"".IMAGES_URL."remove.png\" alt=\"Hapus\" border=\"0\" /></a>");
			$tabel->addOnclickTd(
				"xajax_get_imunisasi('".$data[$i][id]."')", 
				"xajax_get_imunisasi('".$data[$i][id]."')", 
				"xajax_get_imunisasi('".$data[$i][id]."')"
			);
		}

		$buka = $tabel->build();
		$objResponse->addAssign("list_data", "innerHTML", $buka);
		$objResponse->addAssign("navi", "innerHTML", $navi);
		return $objResponse;
	}
Example #11
0
	function buka_langsung_bayar($idkk) {
		unset($_SESSION[igd][langsung_bayar]);
		$kon = new Konek;
		//$kon->debug = 1;
		$objResponse = new xajaxResponse;
		//get data pasien
		$kon->sql = "
			SELECT
				CONCAT_WS('-', SUBSTRING(p.id, 1,2), SUBSTRING(p.id, 3,2), SUBSTRING(p.id, 5,2), SUBSTRING(p.id, 7,2)) as id_display,
				p.nama as nama,
				p.tgl_lahir as tgl_lahir,
				CONCAT(p.alamat, ' ', IF(p.rt = '','',CONCAT(' RT ', p.rt)), IF(p.rw = '','',CONCAT(' RW ', p.rw)), ', ', des.nama, ', ', kec.nama, ', ', kab.nama) as alamat,
				kk.tgl_periksa as tgl_periksa,
				CONCAT_WS(' - ', pel.jenis, pel.nama) as nama_pelayanan,
				p.sex as jk,
				CONCAT_WS(' - ', kk.cara_bayar, kk.jenis_askes, rper.nama) as cara_bayar,
				kk.nomor as nomor
			FROM
				kunjungan_kamar kk
				JOIN kunjungan k ON (k.id = kk.kunjungan_id)
				JOIN pasien p ON (p.id = k.pasien_id)
				JOIN kamar kmr ON (kmr.id = kk.kamar_id)
				JOIN pelayanan pel ON (pel.id = kmr.pelayanan_id)
				JOIN ref_desa des ON (des.id = p.desa_id)
				JOIN ref_kecamatan kec ON (kec.id = des.kecamatan_id)
				JOIN ref_kabupaten kab ON (kab.id = kec.kabupaten_id)
				JOIN ref_propinsi prop ON (prop.id = kab.propinsi_id)
				LEFT JOIN ref_perusahaan rper ON (rper.id = kk.perusahaan_id)
			WHERE
				kk.id = '".$idkk."'
			GROUP BY
				p.id
		";
		$kon->execute();
		$data_pasien = $kon->getOne();
		$arr_usia = hitungUmur($data_pasien[tgl_lahir], $data_pasien[tgl_periksa]);
		$data_pasien[usia] = empty($arr_usia[tahun])?"":$arr_usia[tahun] . " thn ";
		$data_pasien[usia] .= empty($arr_usia[bulan])?"":$arr_usia[bulan] . " bln ";
		$data_pasien[usia] .= empty($arr_usia[hari])?"":$arr_usia[hari] . " hr ";
		$objResponse->addClear("modal_lb", "style.display");
		$objResponse->addAssign("lb_id_kunjungan_kamar", "value", $idkk);
		$objResponse->addAssign("lb_no_rm", "innerHTML", $data_pasien[id_display]);
		$objResponse->addAssign("lb_pasien", "innerHTML", $data_pasien[nama]);
		$objResponse->addAssign("lb_sex", "innerHTML", $data_pasien[jk]);
		$objResponse->addAssign("lb_usia", "innerHTML", $data_pasien[usia]);
		$objResponse->addAssign("lb_alamat", "innerHTML", $data_pasien[alamat]);
		$objResponse->addAssign("lb_tgl_periksa", "innerHTML", tanggalIndo($data_pasien[tgl_periksa], 'j F Y'));
		$objResponse->addAssign("lb_cara_bayar", "innerHTML", $data_pasien[cara_bayar]);
		$objResponse->addAssign("lb_pelayanan", "innerHTML", $data_pasien[nama_pelayanan]);
		$objResponse->addAssign("lb_nomor", "innerHTML", empty($data_pasien[nomor])?"-":$data_pasien[nomor]);

		//BIKIN SESSION UNTUK DICETAK
		$_SESSION[igd][langsung_bayar][data_px] = $data_pasien;

		$tabel = new Table;
		$tabel->cellspacing = "0";
		$tabel->scroll = false;
		$tabel->extra_table = "style=\"width:9cm;\"";
		$tabel->addTh("No", "Jasa", "Biaya");
		$tabel->addExtraTh("style=\"width:0.7cm;\"", "style=\"width:6.5cm;\"", "");
		//get data karcis
		$kon->sql = "
			SELECT
				kb.nama as nama,
				kb.bayar_bhp+kb.bayar_jasa as bayar,
				kb.mampu_bayar_bhp+kb.mampu_bayar_jasa as mampu_bayar,
				kwd.kwitansi_id as kwitansi_id
			FROM
				kunjungan_bayar kb
				JOIN kunjungan_kamar kk ON (kk.id = kb.kunjungan_kamar_id)
				LEFT JOIN kwitansi_detil kwd ON (kwd.kunjungan_bayar_id = kb.id)
			WHERE
				kb.karcis_id IS NOT NULL
				AND kk.id = '".$idkk."'
			GROUP BY
				kb.id
			ORDER BY kb.id
		";
		$kon->execute();
		$data_karcis = $kon->getAll();
		if(!empty($data_karcis)) {
			$tabel->addRow("","<b>Karcis</b>","");
			for($i=0;$i<sizeof($data_karcis);$i++) {
				$tabel->addRow(
					($i+1),
					$data_karcis[$i][nama],
					uangIndo($data_karcis[$i][bayar])
				);
				$total += $data_karcis[$i][bayar];
				$sudah_dibayar += $data_karcis[$i][mampu_bayar];
				//belum bayar
				if(!$data_karcis[$i][kwitansi_id]) $kurang += $data_karcis[$i][bayar];
			}
		}

		//get data tindakan
		$kon->sql = "
			SELECT
				kki.nama as nama,
				SUM(kb.bayar_jasa) as bayar,
				SUM(kb.mampu_bayar_jasa) as mampu_bayar,
				kwd.kwitansi_id as kwitansi_id
			FROM
				kunjungan_kamar_icopim kki 
				JOIN kunjungan_bayar kb ON (kb.kunjungan_kamar_icopim_id = kki.id)
				LEFT JOIN kwitansi_detil kwd ON (kwd.kunjungan_bayar_id = kb.id)
			WHERE
				kb.icopim_detil_id IS NOT NULL
				AND kki.kunjungan_kamar_id = '".$idkk."'
			GROUP BY
				kki.id
			ORDER BY kki.id
		";
		$kon->execute();
		$data_tindakan = $kon->getAll();
		if(!empty($data_tindakan)) {
			$tabel->addRow("","<b>Tindakan</b>","");
			for($i=0;$i<sizeof($data_tindakan);$i++) {
				$tabel->addRow(
					($i+1),
					$data_tindakan[$i][nama],
					uangIndo($data_tindakan[$i][bayar])
				);
				$total += $data_tindakan[$i][bayar];
				$sudah_dibayar += $data_tindakan[$i][mampu_bayar];
				//belum bayar
				if(!$data_tindakan[$i][kwitansi_id]) $kurang += $data_tindakan[$i][bayar];
			}
		}


		//get data bhp
		$kon->sql = "
			SELECT
				kb.nama as nama,
				kb.bayar_bhp as bayar,
				kb.mampu_bayar_bhp as mampu_bayar,
				kwd.kwitansi_id as kwitansi_id
			FROM
				kunjungan_bayar kb
				JOIN kunjungan_kamar kk ON (kk.id = kb.kunjungan_kamar_id)
				LEFT JOIN kwitansi_detil kwd ON (kwd.kunjungan_bayar_id = kb.id)
			WHERE
				kb.bhp_id IS NOT NULL
				AND kk.id = '".$idkk."'
			GROUP BY
				kb.id
			ORDER BY kb.id
		";
		$kon->execute();
		$data_bhp = $kon->getAll();
		if(!empty($data_bhp)) {
			$tabel->addRow("","<b>Bahan Habis Pakai</b>","");
			for($i=0;$i<sizeof($data_bhp);$i++) {
				$tabel->addRow(
					($i+1),
					$data_bhp[$i][nama],
					uangIndo($data_bhp[$i][bayar])
				);
				$total += $data_bhp[$i][bayar];
				$sudah_dibayar += $data_bhp[$i][mampu_bayar];
				//belum bayar
				if(!$data_bhp[$i][kwitansi_id]) $kurang += $data_bhp[$i][bayar];
			}
		}
		
		$tabel->addRow("","<b>Total</b>", uangIndo($total));
		$tabel_jasa = $tabel->build();
		$tabel_jasa .= "<br />Terbilang : <i>" . terbilang($total) . "</i>";
		$objResponse->addAssign("lb_list_jasa", "innerHTML", $tabel_jasa);
		$objResponse->addScriptCall("disable_mainbar", "#E5E6E1");
		return $objResponse;
	}
Example #12
0
	function get_lap_rl1($val) {
		$objResponse = new xajaxResponse;
		$kon = new Konek;
		$sql = "
			SELECT
				id,
				nama as nama_lain
			FROM
				pelayanan
			WHERE
				jenis = 'RAWAT INAP'
		";
		$kon->sql = $sql;
		$kon->execute();
		$data = $kon->getAll();
		$baru = array();
		$s = 0;
		
		/*
			I : 1 januari - 31 maret
			II : 1 april - 30 juni
			III : 1 juli - 30 september
			IV : 1 oktober - 31 desember
		*/

		switch($val[tw]) {
			case "I" : 
				$tgl_awal = $val[tahun] . "-01-01";
				$tgl_akhir = $val[tahun] . "-03-31";
				$tgl_start_bln = 1;
			break;
			case "II" : 
				$tgl_awal = $val[tahun] . "-04-01";
				$tgl_akhir = $val[tahun] . "-06-30";
				$tgl_start_bln = 4;
			break;
			case "III" : 
				$tgl_awal = $val[tahun] . "-07-01";
				$tgl_akhir = $val[tahun] . "-09-30";
				$tgl_start_bln = 7;
			break;
			default : 
				$tgl_awal = $val[tahun] . "-10-01";
				$tgl_akhir = $val[tahun] . "-12-31";
				$tgl_start_bln = 10;
			break;
		}
		$selisih_hari = datediff("d", $tgl_awal, $tgl_akhir);
		for($i=0;$i<sizeof($data);$i++) {
			$baru[$i][nama] = $data[$i][nama_lain];
			/* 
			get px awal triwulan ~ pasien sisa / pasien yg masih dirawat
			syarat : tgl masuk < tgl_awal 
					 tgl_keluar > tgl_awal
			*/
			$kon->sql = "
				SELECT 
					COUNT(kk.id) as jml
				FROM
					kunjungan_kamar kk
					JOIN kamar kmr ON (kmr.id = kk.kamar_id)
					JOIN kunjungan k ON (k.id = kk.kunjungan_id)
				WHERE
					kmr.pelayanan_id = '".$data[$i][id]."'
					AND (DATE(kk.tgl_daftar) < '".$tgl_awal."' AND (DATE(kk.tgl_keluar) >= '".$tgl_awal."' OR kk.tgl_keluar IS NULL))
			";
			$kon->execute();
			$px_awal = $kon->getOne();
			$baru[$i][px_awal] = $px_awal[jml];
			$total[px_awal] += $baru[$i][px_awal];

			/* 
			get px masuk
			ASUMSI SEMENTARA : PASIEN PINDAHAN DIHITUNG
			syarat : tgl masuk diantara tgl_awal dan tgl_keluar
			*/
			$kon->sql = "
				SELECT 
					COUNT(kk.id) as jml
				FROM
					kunjungan_kamar kk
					JOIN kamar kmr ON (kmr.id = kk.kamar_id)
					JOIN kunjungan k ON (k.id = kk.kunjungan_id)
				WHERE
					kmr.pelayanan_id = '".$data[$i][id]."'
					AND (DATE(kk.tgl_daftar) BETWEEN '".$tgl_awal."' AND '".$tgl_akhir."')
			";
			$kon->execute();
			$px_masuk = $kon->getOne();
			$baru[$i][px_masuk] = $px_masuk[jml];
			$total[px_masuk] += $baru[$i][px_masuk];

			/* 
			get px keluar 
			syarat : tgl keluar diantara tgl_awal dan tgl_keluar dan keadaan keluar = sembuh, belum sembuh
			*/
			$kon->sql = "
				SELECT 
					COUNT(kk.id) as jml,
					k.keadaan_keluar as keadaan_keluar
				FROM
					kunjungan_kamar kk
					JOIN kamar kmr ON (kmr.id = kk.kamar_id)
					JOIN kunjungan k ON (k.id = kk.kunjungan_id)
				WHERE
					kmr.pelayanan_id = '".$data[$i][id]."'
					AND (DATE(kk.tgl_keluar) BETWEEN '".$tgl_awal."' AND '".$tgl_akhir."')
				GROUP BY kk.id
			";
			$kon->execute();
			$px_keluar = $kon->getAll();
			for($j=0;$j<sizeof($px_keluar);$j++) {
				switch($px_keluar[$j][keadaan_keluar]) {
					case "MATI < 48 JAM" :
						$baru[$i][px_keluar_mati_kurang_dari] += $px_keluar[$j][jml];
					break;
					case "MATI >= 48 JAM" :
						$baru[$i][px_keluar_mati_lebih_dari] += $px_keluar[$j][jml];
					break;
					default :
						$baru[$i][px_keluar_hidup] += $px_keluar[$j][jml];
					break;
				}
			}
			$total[px_keluar_mati_kurang_dari] += $baru[$i][px_keluar_mati_kurang_dari];
			$total[px_keluar_mati_lebih_dari] += $baru[$i][px_keluar_mati_lebih_dari];
			$total[px_keluar_hidup] += $baru[$i][px_keluar_hidup];
			$baru[$i][px_keluar_mati] = $baru[$i][px_keluar_mati_kurang_dari] + $baru[$i][px_keluar_mati_lebih_dari];
			$total[px_keluar_mati] += $baru[$i][px_keluar_mati];

			/* 
			get jumlah lama dirawat ~ lamanya seorang pasien dirawat
			syarat : tgl keluar diantara tgl_awal dan tgl_keluar 
					 hitung tgl_keluar-tanggal_daftar
					 
			cara : cari dulu px yg keluar pada tw tsb
				   hitung tgl_keluar-tanggal_daftar
				   jika tgl_keluar = tgl_daftar -> dihitung 1 hari lama dirawat
			*/
			$kon->sql = "
				SELECT 
					kk.id as kkid,
					CASE
						WHEN (DATE(kk.tgl_daftar) = DATE(kk.tgl_keluar)) THEN 1
						ELSE DATEDIFF(kk.tgl_keluar, kk.tgl_daftar)
					END as jml
				FROM
					kunjungan_kamar kk
					JOIN kamar kmr ON (kmr.id = kk.kamar_id)
				WHERE
					kmr.pelayanan_id = '".$data[$i][id]."'
					AND (DATE(kk.tgl_keluar) BETWEEN '".$tgl_awal."' AND '".$tgl_akhir."')
				GROUP BY kk.id
			";
			$kon->execute();
			$ld = $kon->getAll();
			for($j=0;$j<sizeof($ld);$j++) {
				$baru[$i][lama_dirawat] += $ld[$j][jml];
			}
			$total[lama_dirawat] += $baru[$i][lama_dirawat];

			/* 
			get px akhir triwulan ~ pasien sisa / pasien yg masih dirawat
			syarat : tgl masuk < tgl_akhir 
					 tgl_keluar > tgl_akhir
			*/
			$kon->sql = "
				SELECT 
					COUNT(kk.id) as jml
				FROM
					kunjungan_kamar kk
					JOIN kamar kmr ON (kmr.id = kk.kamar_id)
					JOIN kunjungan k ON (k.id = kk.kunjungan_id)
				WHERE
					kmr.pelayanan_id = '".$data[$i][id]."'
					AND (DATE(kk.tgl_daftar) < '".$tgl_akhir."' AND (DATE(kk.tgl_keluar) > '".$tgl_akhir."' OR kk.tgl_keluar IS NULL))
			";
			$kon->execute();
			$px_akhir = $kon->getOne();
			$baru[$i][px_akhir] = $px_akhir[jml];
			$total[px_akhir] += $baru[$i][px_akhir];

			/* 
			get jumlah hari perawatan ~ pasien sisa per hari
			sampe sini
			*/
			//sampe sini 7/4/2007 
			for($j=0;$j<=$selisih_hari;$j++) {
				$tgl = @date("Y-m-d", @mktime(1, 1, 1, $tgl_start_bln, ($j+1), $val[tahun]));
				$kon->sql = "
					SELECT 
						COUNT(kk.id) as jml,
						kmr.kelas as kelas
					FROM
						kunjungan_kamar kk
						JOIN kamar kmr ON (kmr.id = kk.kamar_id)
						JOIN kunjungan k ON (k.id = kk.kunjungan_id)
					WHERE
						kmr.pelayanan_id = '".$data[$i][id]."'
						AND (DATE(kk.tgl_daftar) <= '".$tgl."' AND (DATE(kk.tgl_keluar) > '".$tgl."' OR kk.tgl_keluar IS NULL))
					GROUP BY kmr.kelas
				";
				$kon->execute();
				$px_hari_ini[$j] = $kon->getAll();
				for($k=0;$k<sizeof($px_hari_ini[$j]);$k++) {
					switch($px_hari_ini[$j][$k][kelas]) {
						case "I" :
							$baru[$i][hp_kelas_i] += $px_hari_ini[$j][$k][jml];
						break;
						case "II" :
							$baru[$i][hp_kelas_ii] += $px_hari_ini[$j][$k][jml];
						break;
						case "III" :
							$baru[$i][hp_kelas_iii] += $px_hari_ini[$j][$k][jml];
						break;
						case "VIP" :
							$baru[$i][hp_kelas_vip] += $px_hari_ini[$j][$k][jml];
						break;
						default :
							$baru[$i][hp_kelas_tanpa_kelas] += $px_hari_ini[$j][$k][jml];
						break;
					}
				}
			}
			$total[hp_kelas_i] += $baru[$i][hp_kelas_i];
			$total[hp_kelas_ii] += $baru[$i][hp_kelas_ii];
			$total[hp_kelas_iii] += $baru[$i][hp_kelas_iii];
			$total[hp_kelas_vip] += $baru[$i][hp_kelas_vip];
			$total[hp_kelas_tanpa_kelas] += $baru[$i][hp_kelas_tanpa_kelas];
			$baru[$i][hp_total] +=$baru[$i][hp_kelas_i] + $baru[$i][hp_kelas_ii] + $baru[$i][hp_kelas_iii] + $baru[$i][hp_kelas_vip] + $baru[$i][hp_kelas_tanpa_kelas];
			$total[hp_total] += $baru[$i][hp_total];
		}
		$tabel_all = new Table;
		$tabel_all->scroll = false;
		$tabel_all->extra_table = "style=\"width:27cm;margin:0\"";
		$tabel_all->cellspacing="0";
		$tabel_all->css_table="";
		$tabel_all->anime_bg_color="";
		$tabel_header = new Table;
		$tabel_header->scroll = false;
		$tabel_header->extra_tr_th = "";
		$tabel_header->cellspacing="0";
		$tabel_header->css_table="";
		$tabel_header->anime_bg_color="";
		$tabel_header->extra_table = "style=\"width:27cm;border:0;\"";
		$tabel_header->addTh("","DATA KEGIATAN RUMAH SAKIT<br />TRIWULAN : ".$val[tw]."<br />TAHUN : ".$val[tahun]."");
		//$tabel_header->addExtraTh("colspan=\"3\"");
		$tabel_header->addRow("","","Formulir RL1");
		//$tabel_header->addExtraTh();
		$tabel_header->addRow($_SESSION[setting][rs_nama], "", "No. Kode RS : " . $_SESSION[setting][rs_kode]);
		//$tabel_header->addExtraTh("colspan=\"3\"");

		$tabel_isi = new Table;
		$tabel_isi->scroll = false;
		$tabel_isi->cellspacing="0";
		$tabel_isi->extra_table = "style=\"width:27cm;font-size:7pt;\"";
		$tabel_header->css_table="";
		$tabel_isi->addTh(
			"No.", 
			"JENIS PELAYANAN", 
			"Pasien<br />Awal<br />Triwulan", 
			"Pasien<br />Masuk", 
			"Pasien<br />Keluar<br />Hidup", 
			"Pasien Keluar Mati", 
			"Jumlah<br />Lama<br />Dirawat", 
			"Pasien<br />Akhir<br />Triwulan",
			"Jumlah<br />Hari Pe-<br />rawatan",
			"Rincian Hari Perawatan per Kelas",
			"No."
		);
		$tabel_isi->addExtraTh(
			"rowspan=\"2\"", 
			"rowspan=\"2\"", 
			"rowspan=\"2\"", 
			"rowspan=\"2\"", 
			"rowspan=\"2\"", 
			"colspan=\"3\"", 
			"rowspan=\"2\"", 
			"rowspan=\"2\"",
			"rowspan=\"2\"", 
			"colspan=\"5\"", 
			"rowspan=\"2\""
		);
		$tabel_isi->addTh("&lt; 48 jam", "&ge; 48 jam", "jumlah", "Kelas<br />Utama", "Kelas I", "Kelas II", "Kelas III", "Tanpa<br />Kelas");
		$tabel_isi->addTh("1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16", "17");
		for($i=0;$i<sizeof($baru);$i++) {
			$tabel_isi->addRow(
				($i+1),
				$baru[$i][nama],
				$baru[$i][px_awal],
				$baru[$i][px_masuk],
				$baru[$i][px_keluar_hidup],
				$baru[$i][px_keluar_mati_kurang_dari],
				$baru[$i][px_keluar_mati_lebih_dari],
				$baru[$i][px_keluar_mati],
				$baru[$i][lama_dirawat],
				$baru[$i][px_akhir],
				$baru[$i][hp_total],
				$baru[$i][hp_kelas_vip],
				$baru[$i][hp_kelas_i],
				$baru[$i][hp_kelas_ii],
				$baru[$i][hp_kelas_iii],
				$baru[$i][hp_kelas_tanpa_kelas],
				($i+1)
			);
		}
		$tabel_isi->addRow(
			99,
			"TOTAL",
			$total[px_awal],
			$total[px_masuk],
			$total[px_keluar_hidup],
			$total[px_keluar_mati_kurang_dari],
			$total[px_keluar_mati_lebih_dari],
			$total[px_keluar_mati],
			$total[lama_dirawat],
			$total[px_akhir],
			$total[hp_total],
			$total[hp_kelas_vip],
			$total[hp_kelas_i],
			$total[hp_kelas_ii],
			$total[hp_kelas_iii],
			$total[hp_kelas_tanpa_kelas],
			99
		);
		$ret_tabel_header = $tabel_header->build();
		$ret_tabel_isi = $tabel_isi->build();
		$tabel_all->addRow($ret_tabel_header);
		$tabel_all->addRow($ret_tabel_isi);
		$ret = $tabel_all->build();
		unset($_SESSION[rekmed][lap_rl1]);
		$cetak = new Cetak;
		$tanda_tangan = $cetak->setTandaTangan();
		$ret .= $tanda_tangan;
		$_SESSION[rekmed][lap_rl1] = $ret;
		$objResponse->addAssign("list_data", "innerHTML", $ret);
		return $objResponse;
	}
	function get_kunjungan($val) {
		unset($_SESSION[rekmed][rekap_kunjungan_rajal_per_cara_bayar]);
		$tgl_start = @date("Y-m-d", @mktime(1,1,1,$val[tgl_periksa_bln_start], $val[tgl_periksa_tgl_start], $val[tgl_periksa_thn_start]));
		$tgl_end = @date("Y-m-d", @mktime(1,1,1,$val[tgl_periksa_bln_end], $val[tgl_periksa_tgl_end], $val[tgl_periksa_thn_end]));
		$title = "Rekapitulasi Jumlah Cara Pembayaran di Unit Rawat Jalan";
		
		if($val[tampilkan] == "hari") {
			$selisih = datediff('d', $tgl_start, $tgl_end);
		} elseif($val[tampilkan] == "bulan") {
			$selisih = datediff('m', $tgl_start, $tgl_end);
		} else {
			$selisih = datediff('y', $tgl_start, $tgl_end);
		}
		if($val[tampilkan] == "hari") {
			$tanggal_awal = tanggalIndo($tgl_start, "j F Y");
			$tanggal_akhir = tanggalIndo($tgl_end, "j F Y");
		} elseif($val[tampilkan] == "bulan") {
			$tanggal_awal = tanggalIndo($tgl_start, "F Y");
			$tanggal_akhir = tanggalIndo($tgl_end, "F Y");
		} else {
			$tanggal_awal = tanggalIndo($tgl_start, "Y");
			$tanggal_akhir = tanggalIndo($tgl_end, "Y");
		}

		$title .= "\nPeriode " . $tanggal_awal . " s.d. " . $tanggal_akhir;

		$arr_tgl_start = explode("-",$tgl_start);
		$tgl_start_tgl = $arr_tgl_start[2];
		$tgl_start_bln = $arr_tgl_start[1];
		$tgl_start_thn = $arr_tgl_start[0];

		$arr_tgl_end = explode("-",$tgl_end);
		$tgl_end_tgl = $arr_tgl_end[2];
		$tgl_end_bln = $arr_tgl_end[1];
		$tgl_end_thn = $arr_tgl_end[0];

		$objResponse = new xajaxResponse();
		$kon = new Konek;
	
		for($i=0;$i<=$selisih;$i++) {
			if($val[tampilkan] == "hari") {
				$tgl[$i] = @date("Y-m-d", @mktime(1, 1, 1, $tgl_start_bln, ($i+$tgl_start_tgl), $tgl_start_thn));
				$data[$i][tgl_periksa] = tanggalIndo($tgl[$i], "j M Y");
				$_SESSION[rekmed][rekap_kunjungan_rajal_per_cara_bayar][label_tick][$i] = @date("j", @mktime(1, 1, 1,$tgl_start_bln, ($tgl_start_tgl+$i), $tgl_start_thn));
				$label_x[$i] = @date("M Y", @mktime(1, 1, 1, $tgl_start_bln, ($tgl_start_tgl+$i), $tgl_start_thn));
				$where = " AND DATE(kk.tgl_periksa) = '" . $tgl[$i] . "'";
			} elseif($val[tampilkan] == "bulan") {
				$tgl[$i] = @date("Y-m-d", @mktime(1, 1, 1, ($tgl_start_bln+$i), 1, $tgl_start_thn));
				$data[$i][tgl_periksa] = tanggalIndo($tgl[$i], "M Y");
				$_SESSION[rekmed][rekap_kunjungan_rajal_per_cara_bayar][label_tick][$i] = @date("M y", @mktime(1, 1, 1, ($tgl_start_bln+$i), 1, $tgl_start_thn));
				$label_x[$i] = @date("Y", @mktime(1, 1, 1, ($tgl_start_bln+$i), 1, $tgl_start_thn));
				$where = " AND EXTRACT(YEAR_MONTH FROM kk.tgl_periksa) = EXTRACT(YEAR_MONTH FROM '" . $tgl[$i] . "')";
			} else {
				$tgl[$i] = @date("Y-m-d", @mktime(1, 1, 1, 1, 1, ($tgl_start_thn + $i)));
				$data[$i][tgl_periksa] = tanggalIndo($tgl[$i], "Y");
				$_SESSION[rekmed][rekap_kunjungan_rajal_per_cara_bayar][label_tick][$i] = @date("Y", @mktime(1, 1, 1, 1, 1, ($tgl_start_thn+$i)));
				$label_x[$i] = "Tahun";
				$where = " AND YEAR(kk.tgl_periksa) = YEAR('" . $tgl[$i] . "')";
			}
			$sql = "
				SELECT
					kk.cara_bayar as nama, 
					COUNT(kk.id) as jml
				FROM
					kunjungan_kamar kk 
					JOIN kamar kmr ON (kmr.id = kk.kamar_id)
					JOIN pelayanan pel ON (pel.id = kmr.pelayanan_id)
				WHERE
					pel.jenis = 'RAWAT JALAN'
					$where
				GROUP BY
					kk.cara_bayar
				ORDER BY
					kk.cara_bayar
				";
			$kon->sql = $sql;
			$kon->execute();
			$baru[$i] = $kon->getAll();
		}
		$_SESSION[rekmed][rekap_kunjungan_rajal_per_cara_bayar][title] = $title . "\nPeriode " . tanggalIndo($tgl_start, "j F Y") . " s.d. " . tanggalIndo($tgl_end, "j F Y");
		$labelx = @array_unique($label_x);
		$_SESSION[rekmed][rekap_kunjungan_rajal_per_cara_bayar][label_x] = @implode(", ",$labelx);
		
		$new = array();
		for($i=0;$i<sizeof($baru);$i++) {
			for($s=0;$s<sizeof($baru[$i]);$s++) {
				$new[jml][$baru[$i][$s][nama]][$i] = $baru[$i][$s][jml];
			}
		}
		$table = new Table;
		$table->scroll = false;
		$table->addExtraTh("style=\"width:300px;\"");
		$table->Th[0][] = "Cara Pembayaran/ Periode";
		$table->Th[1][] = "1";
		for($i=0;$i<=$selisih;$i++) {
			$table->Th[0][] = $data[$i][tgl_periksa];
			$table->Th[1][] = ($i+2);
		}
		$_SESSION[rekmed][rekap_kunjungan_rajal_per_cara_bayar][th_0] = $table->Th[0];
		$_SESSION[rekmed][rekap_kunjungan_rajal_per_cara_bayar][th_1] = $table->Th[1];
		$cb = array('UMUM','JAMSOSTEK','DANA REKSA DESA','KONTRAK','LAIN-LAIN','ASKES');

		for($i=0;$i<sizeof($cb);$i++) {
			$table->Row[$i][] = $cb[$i];
			$_SESSION[rekmed][rekap_kunjungan_rajal_per_cara_bayar][cb][$i] = $cb[$i];
			for($s=0;$s<=$selisih;$s++) {
				if(!$new[jml][$cb[$i]][$s]) $new[jml][$cb[$i]][$s]=0;
				$table->Row[$i][] = $new[jml][$cb[$i]][$s];
				$_SESSION[rekmed][rekap_kunjungan_rajal_per_cara_bayar][jml][$i][] = $new[jml][$cb[$i]][$s];
			}
			$_SESSION[rekmed][rekap_kunjungan_rajal_per_cara_bayar][row][$i] = $table->Row[$i];
		}

		$ret = $table->build();
		$objResponse->addAssign("list_data", "innerHTML", $ret);
		$_SESSION[rekmed][rekap_kunjungan_rajal_per_cara_bayar][graph] = "<img src=\"" . URL . "rekmed/rekap_kunjungan_rajal_per_cara_bayar_graph_line/?md5=".md5(date("Ymdhis"))."\" alt=\"Kunjungan\" />";
		$_SESSION[rekmed][rekap_kunjungan_rajal_per_cara_bayar][title] = $title;
		$objResponse->addAssign("title", "innerHTML", nl2br($_SESSION[rekmed][rekap_kunjungan_rajal_per_cara_bayar][title]));
		$objResponse->addAssign("graph", "innerHTML", $_SESSION[rekmed][rekap_kunjungan_rajal_per_cara_bayar][graph]);
		return $objResponse;
	}
Example #14
0
	function buka_tbi($idkk) {
		unset($_SESSION[ranap][kunjungan][jasa_cetak]);
		$kon = new Konek;
		//$kon->debug = 1;
		$objResponse = new xajaxResponse;
		//get data pasien
		$kon->sql = "
			SELECT
				CONCAT_WS('-', SUBSTRING(p.id, 1,2), SUBSTRING(p.id, 3,2), SUBSTRING(p.id, 5,2), SUBSTRING(p.id, 7,2)) as id_display,
				p.nama as nama,
				p.tgl_lahir as tgl_lahir,
				CONCAT(p.alamat, ' ', IF(p.rt = '','',CONCAT(' RT ', p.rt)), IF(p.rw = '','',CONCAT(' RW ', p.rw)), ', ', des.nama, ', ', kec.nama, ', ', kab.nama) as alamat,
				kk.tgl_periksa as tgl_periksa,
				pel.nama as nama_pelayanan,
				p.sex as jk,
				kk.cara_bayar as cara_bayar,
				kk.jenis_askes as jenis_askes, 
				kk.nomor as nomor
			FROM
				kunjungan_kamar kk
				JOIN kunjungan k ON (k.id = kk.kunjungan_id)
				JOIN pasien p ON (p.id = k.pasien_id)
				JOIN kamar kmr ON (kmr.id = kk.kamar_id)
				JOIN pelayanan pel ON (pel.id = kmr.pelayanan_id)
				JOIN ref_desa des ON (des.id = p.desa_id)
				JOIN ref_kecamatan kec ON (kec.id = des.kecamatan_id)
				JOIN ref_kabupaten kab ON (kab.id = kec.kabupaten_id)
				JOIN ref_propinsi prop ON (prop.id = kab.propinsi_id)
			WHERE
				kk.id = '".$idkk."'
			GROUP BY
				p.id
		";
		$kon->execute();
		$data_pasien = $kon->getOne();
		$arr_usia = hitungUmur($data_pasien[tgl_lahir], $data_pasien[tgl_periksa]);
		$usia = empty($arr_usia[tahun])?"":$arr_usia[tahun] . " thn ";
		$usia .= empty($arr_usia[bulan])?"":$arr_usia[bulan] . " bln ";
		$usia .= empty($arr_usia[hari])?"":$arr_usia[hari] . " hr ";

		$tabel = new Table;
		$tabel->scroll = false;
		$tabel->css_table = "";
		$tabel->cellspacing = "5";
		$tabel->anime_bg_color = "";
		$tabel->extra_table = "style=\"width:10cm;\"";
		$tabel->addRow("Bangsal", $data_pasien[nama_pelayanan]);
		$tabel->addExtraTd("style=\"width:3cm\"");
		$tabel->addRow("No. RM", $data_pasien[id_display]);
		$tabel->addRow("Nama", $data_pasien[nama]);
		$tabel->addRow("Usia", $usia);
		$tabel->addRow("Jenis Kelamin", $data_pasien[jk]);
		$tabel->addRow("Alamat", $data_pasien[alamat]);
		$tabel->addRow("Tgl Periksa", tanggalIndo($data_pasien[tgl_periksa], 'j F Y'));
		$tabel->addRow("Cara Pembayaran", $data_pasien[cara_bayar]);
		$tabel->addRow("Jenis Askes", empty($data_pasien[jenis_askes])?"-":$data_pasien[jenis_askes]);
		$tabel->addRow("Nomor", empty($data_pasien[nomor])?"-":$data_pasien[nomor]);
		$tabel_pasien = $tabel->build();
		
		$tabel = new Table;
		$tabel->scroll = false;
		$tabel->extra_table = "style=\"width:10cm;\"";
		$tabel->addTh("No", "Jasa", "Harga");
		$tabel->addExtraTh("style=\"width:0.7cm;\"", "style=\"width:6.5cm;\"", "");
		//get data tindakan
		$kon->sql = "
			SELECT
				CONCAT(i.kode, ' - ', i.nama) as nama
			FROM
				icopim i 
				JOIN kunjungan_kamar_icopim kki ON (kki.icopim_id = i.id)
				JOIN kunjungan_kamar kk ON (kk.id = kki.kunjungan_kamar_id)
			WHERE
				kk.id = '".$idkk."'
			GROUP BY
				kki.id
		";
		$kon->execute();
		$data_tindakan = $kon->getAll();
		if(!empty($data_tindakan)) {
			$tabel->addRow("","<b>Tindakan</b>","");
			for($i=0;$i<sizeof($data_tindakan);$i++) {
				$tabel->addRow(
					($i+1),
					" - " . $data_tindakan[$i][nama],
					""
				);
			}
		}


		//get data bhp
		$kon->sql = "
			SELECT
				b.nama as nama
			FROM
				bhp b 
				JOIN kunjungan_kamar_bhp kkb ON (kkb.bhp_id = b.id)
				JOIN kunjungan_kamar kk ON (kk.id = kkb.kunjungan_kamar_id)
			WHERE
				kk.id = '".$idkk."'
			GROUP BY
				kkb.id
		";
		$kon->execute();
		$data_bhp = $kon->getAll();
		if(!empty($data_bhp)) {
			$tabel->addRow("","<b>Bahan Habis Pakai</b>","");
			for($i=0;$i<sizeof($data_bhp);$i++) {
				$tabel->addRow(
					($i+1),
					" - " . $data_bhp[$i][nama],
					""
				);
			}
		}

		//get data imunisasi
		$kon->sql = "
			SELECT
				im.nama as nama
			FROM
				imunisasi im 
				JOIN kunjungan_kamar_imunisasi kkim ON (kkim.imunisasi_id = im.id)
				JOIN kunjungan_kamar kk ON (kk.id = kkim.kunjungan_kamar_id)
			WHERE
				kk.id = '".$idkk."'
			GROUP BY
				kkim.id
		";
		$kon->execute();
		$data_imunisasi = $kon->getAll();
		if(!empty($data_imunisasi)) {
			$tabel->addRow("","<b>Imunisasi</b>","");
			for($i=0;$i<sizeof($data_imunisasi);$i++) {
				$tabel->addRow(
					($i+1),
					" - " . $data_imunisasi[$i][nama],
					""
				);
			}
		}
		$tabel->addRow("","<b>Total</b>","");
		$tabel_jasa = $tabel->build();

		$modal = new Modal;
		$modal->cetak_lebar = 400;
		$modal->cetak_tinggi = 600;
		$modal->setTitle("Daftar Pemberian Tindakan, BHP, dan Imunisasi");
		$modal->setContent($tabel_pasien);
		$modal->setContent($tabel_jasa);
		$modal->setCloseButtonOnclick("tutup_daftar_tbi()");
		$modal->setPrintButtonUrl(URL . "ranap/kunjungan_jasa_cetak/");
		$modal_cnt = $modal->build();
		$_SESSION[ranap][kunjungan][jasa_cetak] = $tabel_pasien . $tabel_jasa;
		$objResponse->addClear("list_daftar_tbi", "style.display");
		$objResponse->addAssign("list_daftar_tbi", "innerHTML", $modal_cnt);
		return $objResponse;
	}
Example #15
0
	function list_data($hal=0, $val="") {
		if($val[pasien_id]) {
			$s = "p.id = '".$val[pasien_id]."'";
		} elseif($val[nama]) {
			$s = "p.nama LIKE '%".$val[nama]."%'";
		} elseif ($val[telp]){
            $s = "p.telp LIKE '%".$val[telp]."%'";
		}
		
		$tgl_periksa_dari = $val[tgl_mulai_thn] . "-" . $val[tgl_mulai_bln] . "-" . $val[tgl_mulai_tgl];
		$tgl_periksa_sampai = $val[tgl_selesai_thn] . "-" . $val[tgl_selesai_bln] . "-" . $val[tgl_selesai_tgl];
			
		$paging = new MyPagina;
        $kon = new Konek;
		$paging->setOnclickValue("xajax.getFormValues('form_kunjungan')");
		
		
		if ($val[pasien_id]=='' AND $val[nama]=='' AND $val[telp]=='')
		{
		//pemilihan untuk list
		if ($val[cara_masuk_p]=='RAWAT JALAN')
		{
			$sql = "
			SELECT
					k.id as id_kunjungan,
					kk.id as id_kunjungan_kamar,
                    kk.kunjungan_id as kunjungan_id,
					k.kunjungan_ke as kunjungan_ke,
					kk.no_antrian as no_antrian,
					CONCAT_WS('-', SUBSTRING(p.id, 1,2), SUBSTRING(p.id, 3,2), SUBSTRING(p.id, 5,2), SUBSTRING(p.id, 7,2)) as no_rm,
					p.id as pasien_id,
					p.nama as nama,
					pel.nama as pelayanan,
				CASE 
					WHEN jenis = 'PASIEN LUAR' THEN 'PASIEN LUAR'
					WHEN jenis = 'IGD' THEN 'IRD'
					ELSE CONCAT_WS(' - ', jenis, kmr.nama)
				END as asal,
					kmr.nama as kamar,
					kk.tgl_periksa as tgl_periksa,
					d.nama as pengirim,
					kk.kelanjutan as kelanjutan
				FROM
					kunjungan k
					JOIN pasien p ON (p.id = k.pasien_id)
					JOIN kunjungan_kamar kk ON (kk.kunjungan_id = k.id)
					JOIN kamar kmr ON (kmr.id = kk.kamar_id)
					JOIN pelayanan pel ON (pel.id = kmr.pelayanan_id)
					LEFT JOIN dokter d ON (d.id = kk.dokter_id)
				WHERE
					DATE(kk.tgl_periksa) BETWEEN '".$tgl_periksa_dari."' AND '".$tgl_periksa_sampai."'
					AND pel.jenis = 'RAWAT JALAN'
			 		
				ORDER BY
					kmr.nama, d.nama, kk.no_antrian
		";
		}
		elseif ($val[cara_masuk_p]=='RAWAT INAP')
		{
			$sql = "
			SELECT
					k.id as id_kunjungan,
					kk.id as id_kunjungan_kamar,
                    kk.kunjungan_id as kunjungan_id,
					k.kunjungan_ke as kunjungan_ke,
					kk.no_antrian as no_antrian,
					CONCAT_WS('-', SUBSTRING(p.id, 1,2), SUBSTRING(p.id, 3,2), SUBSTRING(p.id, 5,2), SUBSTRING(p.id, 7,2)) as no_rm,
					p.id as pasien_id,
					p.nama as nama,
					pel.nama as pelayanan,
				CASE 
					WHEN jenis = 'PASIEN LUAR' THEN 'PASIEN LUAR'
					WHEN jenis = 'IGD' THEN 'IRD'
					ELSE CONCAT_WS(' - ', jenis, kmr.nama)
				END as asal,
					kmr.nama as kamar,
					kk.tgl_periksa as tgl_periksa,
					d.nama as pengirim,
					kk.kelanjutan as kelanjutan
				FROM
					kunjungan k
					JOIN pasien p ON (p.id = k.pasien_id)
					JOIN kunjungan_kamar kk ON (kk.kunjungan_id = k.id)
					JOIN kamar kmr ON (kmr.id = kk.kamar_id)
					JOIN pelayanan pel ON (pel.id = kmr.pelayanan_id)
					LEFT JOIN dokter d ON (d.id = kk.dokter_id)
				WHERE
					DATE(kk.tgl_periksa) BETWEEN '".$tgl_periksa_dari."' AND '".$tgl_periksa_sampai."'
					AND pel.jenis = 'RAWAT INAP'
			 		
				ORDER BY
					kmr.nama, d.nama, kk.no_antrian
		";
		}
		elseif ($val[cara_masuk_p]=='PASIEN LUAR')
		{
			$sql = "
			SELECT 
                kk.kunjungan_id as kunjungan_id,
				rk.id as id_kunjungan_radio,
				CONCAT_WS('-', SUBSTRING(p.id, 1,2), SUBSTRING(p.id, 3,2), SUBSTRING(p.id, 5,2), SUBSTRING(p.id, 7,2)) as no_rm,
				p.id as pasien_id,
				p.nama as nama,
				CASE 
					WHEN cara_masuk = 'PASIEN LUAR' THEN 'PASIEN LUAR'
					WHEN cara_masuk = 'IGD' THEN 'IRD'
					ELSE CONCAT_WS(' - ', cara_masuk, kmr.nama)
				END as asal,
				rk.tgl_periksa as tgl_periksa,
				pengirim as pengirim
			FROM 
				radio_kunjungan rk
				JOIN pasien p ON (p.id = rk.pasien_id)
				LEFT JOIN kunjungan_kamar kk ON (kk.id = rk.kunjungan_kamar_id)
				LEFT JOIN kamar kmr ON (kmr.id = kk.kamar_id)
			WHERE
				DATE(rk.tgl_periksa) BETWEEN '".$tgl_periksa_dari."' AND '".$tgl_periksa_sampai."'
				AND rk.cara_masuk = 'PASIEN LUAR'
			ORDER BY 
				rk.id DESC
		";
		}
		elseif ($val[cara_masuk_p]=='IGD')
		{
			$sql = "
			SELECT
					k.id as id_kunjungan,
					kk.id as id_kunjungan_kamar,
                    kk.kunjungan_id as kunjungan_id,
					k.kunjungan_ke as kunjungan_ke,
					kk.no_antrian as no_antrian,
					CONCAT_WS('-', SUBSTRING(p.id, 1,2), SUBSTRING(p.id, 3,2), SUBSTRING(p.id, 5,2), SUBSTRING(p.id, 7,2)) as no_rm,
					p.id as pasien_id,
					p.nama as nama,
					pel.nama as pelayanan,
				CASE 
					WHEN jenis = 'PASIEN LUAR' THEN 'PASIEN LUAR'
					WHEN jenis = 'IGD' THEN 'IRD'
					ELSE CONCAT_WS(' - ', jenis, kmr.nama)
				END as asal,
					kmr.nama as kamar,
					kk.tgl_periksa as tgl_periksa,
					d.nama as pengirim,
					kk.kelanjutan as kelanjutan
				FROM
					kunjungan k
					JOIN pasien p ON (p.id = k.pasien_id)
					JOIN kunjungan_kamar kk ON (kk.kunjungan_id = k.id)
					JOIN kamar kmr ON (kmr.id = kk.kamar_id)
					JOIN pelayanan pel ON (pel.id = kmr.pelayanan_id)
					LEFT JOIN dokter d ON (d.id = kk.dokter_id)
				WHERE
					DATE(kk.tgl_periksa) BETWEEN '".$tgl_periksa_dari."' AND '".$tgl_periksa_sampai."'
					AND pel.jenis = 'IGD'
			 		
				ORDER BY
					kmr.nama, d.nama, kk.no_antrian
		";
		}
		}
		else
		{
			$sql = "
			SELECT
					k.id as id_kunjungan,
					kk.id as id_kunjungan_kamar,
                    kk.kunjungan_id as kunjungan_id,
					k.kunjungan_ke as kunjungan_ke,
					kk.no_antrian as no_antrian,
					CONCAT_WS('-', SUBSTRING(p.id, 1,2), SUBSTRING(p.id, 3,2), SUBSTRING(p.id, 5,2), SUBSTRING(p.id, 7,2)) as no_rm,
					p.id as pasien_id,
					p.nama as nama,
					pel.nama as pelayanan,
				CASE 
					WHEN jenis = 'PASIEN LUAR' THEN 'PASIEN LUAR'
					WHEN jenis = 'IGD' THEN 'IRD'
					ELSE CONCAT_WS(' - ', jenis, kmr.nama)
				END as asal,
					kmr.nama as kamar,
					kk.tgl_periksa as tgl_periksa,
					d.nama as pengirim,
					kk.kelanjutan as kelanjutan
				FROM
					kunjungan k
					JOIN pasien p ON (p.id = k.pasien_id)
					JOIN kunjungan_kamar kk ON (kk.kunjungan_id = k.id)
					JOIN kamar kmr ON (kmr.id = kk.kamar_id)
					JOIN pelayanan pel ON (pel.id = kmr.pelayanan_id)
					LEFT JOIN dokter d ON (d.id = kk.dokter_id)
				WHERE
					$s
				ORDER BY
					kmr.nama, d.nama, kk.no_antrian
		";
		}
		$paging->sql = $sql;
		$paging->rows_on_page = 10;
		$paging->hal = $hal;
		$paging->get_page_result();

		$_SESSION[radio_kunjungan][hal] = $hal;

		$data = $paging->data;
		$no = $paging->start_number();
		$navi = $paging->navi();

		$table = new Table;
		$table->tbody_height = 310;
		$table->addTh(
			"No", 
			"No.<br />Kjg",
			"No. RM", 
			"Pasien", 
			"Tgl<br />Periksa",
			"Asal<br />Pasien",
			"Dokter<br />Pengirim", 
			"Status Bayar"
			/*,"Hapus"*/
		);
		//$table->addExtraTh("style=\"width:50px;\"","style=\"width:50px;\"","style=\"width:80px;\"","style=\"width:200px;\"","","","","","","","style=\"width:70px;\"");
		$table->addExtraTh("style=\"width:50px;\"","style=\"width:50px;\"","style=\"width:80px;\"","style=\"width:200px;\"","","","","");
		for($i=0;$i<sizeof($data);$i++) {
		  
                  //get data radio
            	$kon->sql = "
            		SELECT
            			kb.nama as nama,
            			kb.bayar_bhp+kb.bayar_jasa as bayar,
            			kb.mampu_bayar_bhp+kb.mampu_bayar_jasa as mampu_bayar,
            			kwd.kwitansi_id as kwitansi_id,
                        kw.status as status
            		FROM
            			kunjungan_bayar kb
            			JOIN radio_kunjungan lk ON (lk.id = kb.lab_kunjungan_id)
            			JOIN kunjungan_kamar kk ON (kk.id = lk.kunjungan_kamar_id)
            			LEFT JOIN kwitansi_detil kwd ON (kwd.kunjungan_bayar_id = kb.id)
                        LEFT JOIN kwitansi kw ON  (kw.id = kwd.kwitansi_id)
            		WHERE
            			kb.radio_specimen_id IS NOT NULL
            			AND kk.kunjungan_id = '".$data[$i][kunjungan_id]."'
            		GROUP BY
            			kb.id
            		ORDER BY kb.id
            	";
            	$kon->execute();
        		$data_r = $kon->getOne();
                if(!empty($data_r)){
                    if (!empty($data_r[status])){
                        $status_bayar = "<font color = blue><b>LUNAS</b></font>";
                    }    
                    else {
                        $status_bayar = "<font color = red><b>BELUM LUNAS</b></font>";                        
                    }        
                }else 
                {$status_bayar = "<font color = red><b>BELUM LUNAS</b></font>";}
          
          	$table->addRow(
				($no+$i), 
				$data[$i][id_kunjungan_radio], 
				$data[$i][no_rm], 
				$data[$i][nama], 
				tanggalIndo($data[$i][tgl_periksa], 'j M Y'), 
				$data[$i][asal], 
				$data[$i][pengirim], 
				$status_bayar
				/*,"<input type=\"button\" value=\"[  x  ]\" name=\"hapus\" class=\"inputan\" onclick=\"xajax_hapus_kunjungan_kamar_confirm('".$data[$i][id_kunjungan]."','".$data[$i][id_kunjungan_kamar]."', this)\" />"*/
				);
			if ($val[cara_masuk_p]=='PASIEN LUAR')
			{
				$table->addOnclickTd(
					"xajax_buka_kunjungan('".$data[$i][id_kunjungan_radio]."')",
					"xajax_buka_kunjungan('".$data[$i][id_kunjungan_radio]."')",
					"xajax_buka_kunjungan('".$data[$i][id_kunjungan_radio]."')",
					"xajax_buka_kunjungan('".$data[$i][id_kunjungan_radio]."')",
					"xajax_buka_kunjungan('".$data[$i][id_kunjungan_radio]."')",
					"xajax_buka_kunjungan('".$data[$i][id_kunjungan_radio]."')",
					"xajax_buka_kunjungan('".$data[$i][id_kunjungan_radio]."')"
				);
			}
			else
			{
				$table->addOnclickTd(
					"buka_daftar_penunjang('".$data[$i][id_kunjungan_kamar]."')",
					"buka_daftar_penunjang('".$data[$i][id_kunjungan_kamar]."')",
					"buka_daftar_penunjang('".$data[$i][id_kunjungan_kamar]."')",
					"buka_daftar_penunjang('".$data[$i][id_kunjungan_kamar]."')",
					"buka_daftar_penunjang('".$data[$i][id_kunjungan_kamar]."')",
					"buka_daftar_penunjang('".$data[$i][id_kunjungan_kamar]."')",
					"buka_daftar_penunjang('".$data[$i][id_kunjungan_kamar]."')"
				);	
			}
			
		}
		$ret = $table->build();
		$objResponse = new xajaxResponse();
		//$objResponse->addAssign("debug", "innerHTML", $sql);
/*
BIKIN SESSION HAK DAN SIFAT, AGAR NGIRIT MEMORI DI MODAL KUNJUNGAN
*/
		$kon = new Konek;
		$kon->sql = "SELECT id, nama FROM hak ORDER BY nama";
		$kon->execute();
		$_SESSION[radio][hak] = $kon->getAll();

		$kon->sql = "SELECT * FROM sifat";
		$kon->execute();
		$_SESSION[radio][sifat] = $kon->getAll();


		$objResponse->addAssign("navi", "innerHTML", $navi);
		$objResponse->addAssign("list_data", "innerHTML", $ret);
		return $objResponse;
	}
Example #16
0
	function get_lap_rl2a($val) {
		$objResponse = new xajaxResponse;
		$dtd = array('292.0','292.2','292.4','292.6','292.8');
		$dtd_kecuali = implode("','", $dtd);
		switch($val[tw]) {
			case "IV" :
				$s = " AND kk.tgl_keluar BETWEEN '".$val[tahun]."-10-01' AND '".$val[tahun]."-12-31'";
			break;
			case "III" :
				$s = " AND kk.tgl_keluar BETWEEN '".$val[tahun]."-07-01' AND '".$val[tahun]."-09-30'";
			break;
			case "II" :
				$s = " AND kk.tgl_keluar BETWEEN '".$val[tahun]."-04-01' AND '".$val[tahun]."-06-30'";
			break;
			default :
				$s = " AND kk.tgl_keluar BETWEEN '".$val[tahun]."-01-01' AND '".$val[tahun]."-03-31'";
			break;
		}

		$kon = new Konek;
		$sql = "
			SELECT
				i.no_dtd as no_dtd,
				i.kode_icd as kode_icd,
				i.gol_sebab_sakit as gol_sebab_sakit,
				p.tgl_lahir as tgl_lahir,
				kk.tgl_keluar as tgl_keluar,
				p.sex as sex,
				k.keadaan_keluar as keadaan_keluar
			FROM
				kunjungan_kamar kk
				JOIN kunjungan k ON (k.id = kk.kunjungan_id)
				JOIN pasien p ON (p.id = k.pasien_id)
				JOIN kamar kmr ON (kmr.id = kk.kamar_id)
				JOIN pelayanan pel ON (pel.id = kmr.pelayanan_id)
				JOIN icd i ON (i.id = kk.diagnosa_utama_id)
			WHERE
				kk.tgl_keluar IS NOT NULL
				AND pel.jenis = 'RAWAT INAP'
				AND kk.kelanjutan IN ('DIRUJUK', 'PULANG')
				AND i.no_dtd NOT IN ('" . $dtd_kecuali . "')
				$s
			ORDER BY i.no_dtd
		";
		//$objResponse->addAssign("debug", "innerHTML", $sql);
		$kon->sql = $sql;
		$kon->execute();
		$data = $kon->getAll();
		$baru = array();
		$s = 0;
		for($i=0;$i<sizeof($data);$i++) {
			$umur = hitungUmur($data[$i][tgl_lahir], $data[$i][tgl_keluar]);
			$umur_tahun = $umur[tahun];
			$umur_hari = $umur[hari];
			if($data[$i][no_dtd] == $data[$i-1][no_dtd]) {
				//bikin anak
				//nggabungin kode icd
				if($baru[$s][kode_icd] != $data[$i][kode_icd]) $baru[$s][kode_icd] = $baru[$s][kode_icd] . ", " . $data[$i][kode_icd];

				if($umur[tahun] > 64) {
					$baru[$s]['nam_lima'] += 1;
					$total['nam_lima'] += 1;
				} elseif ($umur[tahun] > 44) {
					$baru[$s]['pat_lima'] += 1;
					$total['pat_lima'] += 1;
				} elseif ($umur[tahun] > 24) {
					$baru[$s]['dua_lima'] += 1;
					$total['dua_lima'] += 1;
				} elseif ($umur[tahun] > 14) {
					$baru[$s]['lima_belas'] += 1;
					$total['lima_belas'] += 1;
				} elseif ($umur[tahun] > 4) {
					$baru[$s]['lima'] += 1;
					$total['lima'] += 1;
				} elseif ($umur[tahun] >=1) {
					$baru[$s]['satu'] += 1;
					$total['satu'] += 1;
				} elseif ($umur[hari] > 27) {
					$baru[$s]['dua_lapan'] += 1;
					$total['dua_lapan'] += 1;
				} else {
					$baru[$s]['nol'] += 1;
					$total['nol'] += 1;
				}
				//sex
				if($data[$i][sex] == "LAKI-LAKI") {
					$baru[$s][sex_laki] += 1;
					$total['sex_laki'] += 1;
					$total['total'] += 1;
				} else {
					$baru[$s][sex_prp] += 1;
					$total['sex_prp'] += 1;
					$total['total'] += 1;
				}
				if($data[$i][keadaan_keluar] == "MATI < 48 JAM" || $data[$i][keadaan_keluar] == "MATI >= 48 JAM") {
					$baru[$s][mati] += 1;
					$total['mati'] += 1;
				}
				$baru[$s][total] = $baru[$s][sex_prp] + $baru[$s][sex_laki];
			} else {
				//bikin embok
				if($i!=0) {
					$s++;
				}
				$baru[$s][no_dtd] = $data[$i][no_dtd];
				$baru[$s][kode_icd] = $data[$i][kode_icd];
				$baru[$s][gol_sebab_sakit] = $data[$i][gol_sebab_sakit];
				$baru[$s][tgl_lahir] = $data[$i][tgl_lahir];
				$baru[$s][tgl_keluar] = $data[$i][tgl_keluar];
				if($umur[tahun] > 64) {
					$baru[$s]['nam_lima'] = 1;
					$total['nam_lima'] += 1;
				} elseif ($umur[tahun] > 44) {
					$baru[$s]['pat_lima'] = 1;
					$total['pat_lima'] += 1;
				} elseif ($umur[tahun] > 24) {
					$baru[$s]['dua_lima'] = 1;
					$total['dua_lima'] += 1;
				} elseif ($umur[tahun] > 14) {
					$baru[$s]['lima_belas'] = 1;
					$total['lima_belas'] += 1;
				} elseif ($umur[tahun] > 4) {
					$baru[$s]['lima'] = 1;
					$total['lima'] += 1;
				} elseif ($umur[tahun] >=1) {
					$baru[$s]['satu'] = 1;
					$total['satu'] += 1;
				} elseif ($umur[hari] > 27) {
					$baru[$s]['dua_lapan'] = 1;
					$total['dua_lapan'] += 1;
				} else {
					$baru[$s]['nol'] = 1;
					$total['nol'] += 1;
				}

				//sex
				if($data[$i][sex] == "LAKI-LAKI") {
					$baru[$s][sex_laki] = 1;
					$total['sex_laki'] += 1;
					$total['total'] += 1;
				} else {
					$baru[$s][sex_prp] = 1;
					$total['sex_prp'] += 1;
					$total['total'] += 1;
				}
				if($data[$i][keadaan_keluar] == "MATI < 48 JAM" || $data[$i][keadaan_keluar] == "MATI >= 48 JAM") {
					$baru[$s][mati] = 1;
					$total['mati'] += 1;
				}
				$baru[$s][total] = $baru[$s][sex_prp] + $baru[$s][sex_laki];
			}
		}
		$tabel_all = new Table;
		$tabel_all->scroll = false;
		$tabel_all->extra_table = "style=\"width:21.5cm;margin:0\"";
		$tabel_all->cellspacing="0";
		$tabel_all->css_table="";
		$tabel_all->anime_bg_color="";
		$tabel_header = new Table;
		$tabel_header->scroll = false;
		$tabel_header->extra_tr_th = "";
		$tabel_header->cellspacing="0";
		$tabel_header->css_table="";
		$tabel_header->anime_bg_color="";
		$tabel_header->extra_table = "style=\"width:20cm;border:0;\"";
		$tabel_header->addTh("","DATA KEADAAN MORBIDITAS PASIEN RAWAT INAP RUMAH SAKIT<br />TRIWULAN : ".$val[tw]." TAHUN : ".$val[tahun],"");
		//$tabel_header->addExtraTh("colspan=\"3\"");
		$tabel_header->addRow("","","Formulir RL2a");
		//$tabel_header->addExtraTh();
		$tabel_header->addRow($_SESSION[setting][rs_nama], "", "No. Kode RS : " . $_SESSION[setting][rs_kode]);
		//$tabel_header->addExtraTh("colspan=\"3\"");

		$tabel_isi = new Table;
		$tabel_isi->scroll = false;
		$tabel_isi->cellspacing="0";
		$tabel_isi->extra_table = "style=\"width:20cm;font-size:7pt;\"";
		$tabel_header->css_table="";
		$tabel_isi->addTh(
			"NO. URUT", 
			"NO. DTD", 
			"NO. DAFTAR TERPERINCI", 
			"GOLONGAN SEBAB-SEBAB SAKIT", 
			"PASIEN KELUAR (HIDUP &amp; MATI) MENURUT GOLONGAN UMUR", 
			"PASIEN KELUAR (HIDUP &amp; MATI) MENURUT SEX", 
			"JUMLAH PASIEN KELUAR <br />(13 + 14)", 
			"JUMLAH PASIEN KELUAR MATI"
		);
		$tabel_isi->addExtraTh("rowspan=\"2\"", "rowspan=\"2\"", "rowspan=\"2\"", "rowspan=\"2\"", "colspan=\"8\"", "colspan=\"2\"", "rowspan=\"2\"", "rowspan=\"2\"");
		$tabel_isi->addTh("0-28 HR", "28 HR - &lt;1 TH", "1-4 TH", "5-14 TH", "15-24 TH", "25-44 TH", "45-64 TH", "65+ TH", "LK", "PR");
		$tabel_isi->addTh("1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16");
		for($i=0;$i<sizeof($baru);$i++) {
			$tabel_isi->addRow(
				($i+1),
				$baru[$i][no_dtd],
				$baru[$i][kode_icd],
				$baru[$i][gol_sebab_sakit],
				$baru[$i][nol],
				$baru[$i][dua_lapan],
				$baru[$i][satu],
				$baru[$i][lima],
				$baru[$i][lima_belas],
				$baru[$i][dua_lima],
				$baru[$i][pat_lima],
				$baru[$i][nam_lima],
				$baru[$i][sex_laki],
				$baru[$i][sex_prp],
				$baru[$i][total],
				$baru[$i][mati]
			);
		}
		$tabel_isi->addRow(
			"","","","Total", 
			$total[nol], 
			$total[dua_lapan], 
			$total[satu], 
			$total[lima], 
			$total[lima_belas], 
			$total[dua_lima], 
			$total[pat_lima], 
			$total[nam_lima], 
			$total[sex_laki], 
			$total[sex_prp], 
			$total[total], 
			$total[mati]
		);
		$ret_tabel_header = $tabel_header->build();
		$ret_tabel_isi = $tabel_isi->build();
		$tabel_all->addRow($ret_tabel_header);
		$tabel_all->addRow($ret_tabel_isi);
		$ret = $tabel_all->build();
		unset($_SESSION[rekmed][lap_rl2a]);
		$cetak = new Cetak;
		$tanda_tangan = $cetak->setTandaTangan();
		$ret .= $tanda_tangan;
		$_SESSION[rekmed][lap_rl2a] = $ret;
		$objResponse->addAssign("list_data", "innerHTML", $ret);
		return $objResponse;
	}
Example #17
0
	function list_data($jenis = "BELUM", $limit = 5, $auto = "0", $tgl="") {
		if($jenis == "BELUM") $s .= " AND trc.cetak = 'BELUM' ";
		elseif($jenis == "SUDAH") $s .= " AND trc.cetak = 'SUDAH' ";
		if($tgl) $s .= "AND DATE(trc.tgl_keluar) = '".$tgl."' ";
		$kon = new Konek;
		$sql = "
			SELECT 
				k.id as id_kunjungan,
				kk.id as id_kunjungan_kamar,
				CONCAT_WS('-', SUBSTRING(p.id, 1,2), SUBSTRING(p.id, 3,2), SUBSTRING(p.id, 5,2), SUBSTRING(p.id, 7,2)) as no_rm,
				p.id as pasien_id,
				p.nama as nama,
				kmr.nama as kamar,
				kk.tgl_daftar as tgl_daftar,
				kk.tgl_periksa as tgl_periksa,
				d.nama as nama_dokter,
				trc.cetak as tercetak
			FROM 
				kunjungan k
				JOIN pasien p ON (p.id = k.pasien_id)
				JOIN kunjungan_kamar kk ON (kk.kunjungan_id = k.id)
				JOIN tracer trc ON (trc.kunjungan_kamar_id = kk.id)
				JOIN kamar kmr ON (kmr.id = kk.kamar_id)
				LEFT JOIN dokter d ON (d.id = kk.dokter_id)
			WHERE
				trc.cetak IS NOT NULL
				$s
			ORDER BY 
				kk.id
		";
		$kon->sql = $sql;
		$kon->execute();
		$data = $kon->getAll();

		$table = new Table;
		$table->tbody_height = 340;
		$table->addTh(
			"No", 
			"No.<br />Kjg",
			"No. RM", 
			"Pasien", 
			"Pelayanan", 
			"Dokter", 
			"Tgl<br />Daftar",
			"Tgl<br />Periksa",
			"Tracer<br />Tercetak",
			"Cetak<br />Sendiri"
		);
		$table->addExtraTh("style=\"width:50px;\"","style=\"width:50px;\"","style=\"width:80px;\"","style=\"width:200px;\"","","","","","","style=\"width:50px;\"");
		for($i=0;$i<sizeof($data);$i++) {
			$table->addRow(
				($i+1), 
				$data[$i][id_kunjungan], 
				$data[$i][no_rm], 
				$data[$i][nama], 
				$data[$i][kamar], 
				$data[$i][nama_dokter], 
				tanggalIndo($data[$i][tgl_daftar], 'j M Y'), 
				tanggalIndo($data[$i][tgl_periksa], 'j M Y'), 
				$data[$i][tercetak], 
				"<a href=\"javascript:void(0)\" title=\"Cetak ini saja\" style=\"display:block;\" onclick=\"cetak('".URL."filing/cetak_tracer_cetak/?kkid=".$data[$i][id_kunjungan_kamar]."',350,300)\"><img src=\"".IMAGES_URL."printer_hitam.png\" alt=\"Cetak\" border=\"0\" /></a>");
			$table->addOnclickTd(
				"xajax_list_semua_kunjungan('0', '".$data[$i][pasien_id]."')",
				"xajax_list_semua_kunjungan('0', '".$data[$i][pasien_id]."')",
				"xajax_list_semua_kunjungan('0', '".$data[$i][pasien_id]."')",
				"xajax_list_semua_kunjungan('0', '".$data[$i][pasien_id]."')",
				"xajax_list_semua_kunjungan('0', '".$data[$i][pasien_id]."')",
				"xajax_list_semua_kunjungan('0', '".$data[$i][pasien_id]."')",
				"xajax_list_semua_kunjungan('0', '".$data[$i][pasien_id]."')",
				"xajax_list_semua_kunjungan('0', '".$data[$i][pasien_id]."')",
				"xajax_list_semua_kunjungan('0', '".$data[$i][pasien_id]."')"
			);
		}
		$ret = $table->build();
		$objResponse = new xajaxResponse();
		//$objResponse->addAssign("debug", "innerHTML", $auto);
		$objResponse->addAssign("navi", "innerHTML", $navi);
		$objResponse->addAssign("list_data", "innerHTML", $ret);

		//jika ada pasien dan auto cetak dihidupkan, maka jalankan skrip membuka window cetak
		if(!empty($data) && $auto == "1") {
			$tgl = str_replace("-", "|", $tgl);
			$objResponse->addScriptCall("cetak_tracer", URL . "filing/cetak_tracer_cetak/?jenis=" . $jenis . "&limit=" . $limit . "&tgl=" . $tgl, 350, 600);
		}
		return $objResponse;
	}
Example #18
0
	function list_data($hal = 0, $val) {
		if(!empty($val)) {
			$val[cari_nama] = addslashes($val[cari_nama]);
			$q = " AND (kode_icd_group LIKE '%".$val[cari_nama]."%' OR kode_icd LIKE '%".$val[cari_nama]."%' OR no_dtd LIKE '%".$val[cari_nama]."%' OR nama LIKE '%".$val[cari_nama]."%' OR gol_sebab_sakit LIKE '%".$val[cari_nama]."%')";
		}
		$objResponse = new xajaxResponse();
		$paging = new MyPagina;
		$paging->setOnclickValue("xajax.getFormValues('form_icd')");

		$paging->sql = "
			SELECT 
				id,
				REPLACE(kode_icd_group, '".$val[cari_nama]."','<b>".$val[cari_nama]."</b>') as kode_icd_group,
				REPLACE(kode_icd, '".$val[cari_nama]."','<b>".$val[cari_nama]."</b>') as kode_icd,
				REPLACE(no_dtd, '".$val[cari_nama]."','<b>".$val[cari_nama]."</b>') as no_dtd,
				REPLACE(nama, '".$val[cari_nama]."','<b>".$val[cari_nama]."</b>') as nama,
				REPLACE(gol_sebab_sakit, '".$val[cari_nama]."','<b>".$val[cari_nama]."</b>') as gol_sebab_sakit
			FROM 
				icd 
			WHERE 
				1=1 
				$q
			ORDER BY
				kode_icd
		";
		$paging->rows_on_page = 20;
		$paging->hal = $hal;
		$paging->get_page_result();

		$data = $paging->data;
		$no = $paging->start_number();
		$navi = $paging->navi();
		$_SESSION[modul_setting][penyakit][hal] = $hal;

		$tabel = new Table;
		$tabel->tbody_height = 300;
		$tabel->addTh("No", "Kode ICD Group", "Kode ICD", "No. DTD", "Nama Penyakit", "Gol. Sebab Sakit", "Hapus");
		$tabel->addExtraTh(" style=\"width: 50px;\"", " style=\"width: 50px;\"", " style=\"width: 70px;\" ", " style=\"width: 70px;\" ", "", "", " style=\"width: 70px;\" ");

		for($i=0;$i<sizeof($data);$i++) {
			$tabel->addExtraTr("id=\"tr_".$i."\"");
			$tabel->addRow(
				($no+$i), 
				$data[$i][kode_icd_group], 
				$data[$i][kode_icd], 
				$data[$i][no_dtd], 
				$data[$i][nama], 
				$data[$i][gol_sebab_sakit], 
				"<a href=\"javascript:void(0)\" title=\"Hapus\" onclick=\"hapus_icd('".$data[$i][id]."', 'tr_".$i."')\" class=\"tombol_hapus\"><img src=\"".IMAGES_URL."remove.png\" alt=\"Hapus\" border=\"0\" /></a>");
			$tabel->addOnclickTd(
				"xajax_get_icd('".$data[$i][id]."')", 
				"xajax_get_icd('".$data[$i][id]."')", 
				"xajax_get_icd('".$data[$i][id]."')", 
				"xajax_get_icd('".$data[$i][id]."')", 
				"xajax_get_icd('".$data[$i][id]."')", 
				"xajax_get_icd('".$data[$i][id]."')"
			);
		}

		$buka = $tabel->build();
		$objResponse->addAssign("list_data", "innerHTML", $buka);
		$objResponse->addAssign("navi", "innerHTML", $navi);
		return $objResponse;
	}
Example #19
0
<?php
$_TITLE = "Kwitansi-" . $_GET[id_kwitansi];
$objResponse = new xajaxResponse;
/* Preparing Detail Transactions */
$tabel = new Table;
$tabel->cellspacing = "0";
$tabel->scroll = false;
$tabel->extra_table = "style=\"width:100%;\"";
$tabel->addTh("No", "Keterangan", "Jumlah Biaya", "Biaya Tagihan");
$tabel->addExtraTh("style=\"width:0.7cm;\"", "style=\"width:6cm;\"", "");
/* End Detail Prepared */

$id_kwitansi = explode("-", $_GET[id_kwitansi]);
$tempat_pembayaran = $id_kwitansi[0];
$no_kwitansi = $id_kwitansi[1];

$kon = new Konek;
//get data kwitansi
$kon->sql = "SELECT tgl FROM  kwitansi WHERE  id = '".$no_kwitansi."'";
$kon->execute();
$data_kw = $kon->getOne();


$idk  = $_COOKIE[idk];
$lama = $_COOKIE[lama];
$kamar_id = $_COOKIE[kamar_id];
$objResponse->addAlert($kamar_id);
  //bayar kamar
         if ($lama==0) : 
          //cek dulu dikunjungan kamar
          //$objResponse->addAlert($data_pasien[lama_dirawat]);
Example #20
0
	function list_data($hal=0, $val="") {	  
	   $kon = new konek;
       	if($val[pasien_id]) {
			$q = " p.no_rm = '".$val[pasien_id]."' ";
		} elseif($val[nama]) {
			$tgl_daftar_dari = $val[tgl_mulai_thn] . "-" . $val[tgl_mulai_bln] . "-" . $val[tgl_mulai_tgl];
			$tgl_daftar_sampai = $val[tgl_selesai_thn] . "-" . $val[tgl_selesai_bln] . "-" . $val[tgl_selesai_tgl]; 
			$q = " p.nama LIKE '%".$val[nama]."%' AND DATE(kk.tgl_daftar) BETWEEN '".$tgl_daftar_dari."' AND '".$tgl_daftar_sampai."' ";
		} elseif ($val[pilih]){
			$tgl_daftar_dari = $val[tgl_mulai_thn] . "-" . $val[tgl_mulai_bln] . "-" . $val[tgl_mulai_tgl];
			$tgl_daftar_sampai = $val[tgl_selesai_thn] . "-" . $val[tgl_selesai_bln] . "-" . $val[tgl_selesai_tgl];
			$q = " DATE(kk.tgl_daftar) BETWEEN '".$tgl_daftar_dari."' AND '".$tgl_daftar_sampai."' ";
        }elseif ($val[telp]){
            $q = " p.telp LIKE '%".$val[telp]."%' ";
		}
		//$tgl_daftar_dari = $val[tgl_mulai_thn] . "-" . $val[tgl_mulai_bln] . "-" . $val[tgl_mulai_tgl];
		//$tgl_daftar_sampai = $val[tgl_selesai_thn] . "-" . $val[tgl_selesai_bln] . "-" . $val[tgl_selesai_tgl];
		$paging = new MyPagina;
		$paging->setOnclickValue("xajax.getFormValues('form_kunjungan')");
		$sql = "
			SELECT 
				k.id as id_kunjungan,
				kk.id as id_kunjungan_kamar,
				k.kunjungan_ke as kunjungan_ke,
				kk.no_antrian as no_antrian,
				CONCAT_WS('-', SUBSTRING(p.id, 1,2), SUBSTRING(p.id, 3,2), SUBSTRING(p.id, 5,2), SUBSTRING(p.id, 7,2)) as no_rm,
				p.id as pasien_id,
				p.nama as nama,
				pel.nama as pelayanan,
				kmr.nama as kamar,
				kk.tgl_daftar as tgl_daftar,
				kk.tgl_periksa as tgl_periksa,
				d.nama as dokter,
				kk.kelanjutan as kelanjutan,
				pel.jenis as jenis
			FROM 
				kunjungan k
				JOIN pasien p ON (p.id = k.pasien_id)
				JOIN kunjungan_kamar kk ON (kk.kunjungan_id = k.id)
				JOIN kamar kmr ON (kmr.id = kk.kamar_id)
				JOIN pelayanan pel ON (pel.id = kmr.pelayanan_id)

				LEFT JOIN dokter d ON (d.id = kk.dokter_id)
			WHERE
				$q
			ORDER BY 
				k.id DESC, kk.id ASC
		";
		$paging->sql = $sql;
		$paging->rows_on_page = 20;
		$paging->hal = $hal;
		$paging->get_page_result();

		$_SESSION[hal] = $hal;

		$data = $paging->data;
		$no = $paging->start_number();
		$navi = $paging->navi();

		$table = new Table;
		$table->tbody_height = 310;
		$table->anime_bg_color = "";
		$table->addTh(
			"No", 
			"No.<br />Kjg",
			"No. RM", 
			"Pasien", 
			"Kjg<br />Ke", 
			"No<br />Antri", 
			"Pelayanan", 
			"Dokter", 
			"Tgl<br />Daftar",
			"Tgl<br />Periksa",
            "Kunjungan <br/>Terakhir",
			"Kelanjutan",
			"Hapus"
		);
		$table->addExtraTh("style=\"width:30px;\"","style=\"width:30px;\"","style=\"width:80px;\"","style=\"width:200px;\"","","","","","","","","style=\"width:70px;\"");
		for($i=0;$i<sizeof($data);$i++) {
		     $kunj_sbl = $data[$i][kunjungan_ke]-1 ; 
            $sql_kunjungan = "select kk.tgl_daftar as tgl_daftar from kunjungan k,pasien p, kunjungan_kamar kk
                             where p.id = k.pasien_id 
                             and k.id = kk.kunjungan_id
                             and p.id = '".$data[$i][pasien_id]."'
                             and LAST_INSERT_ID(k.id) 
                             and k.kunjungan_ke ='".$kunj_sbl."'
                             ORDER BY k.id DESC LIMIT 1";
            $kon->sql = $sql_kunjungan;
            $kon->execute();
            $k = $kon->getOne();
            
            if (empty($k[tgl_daftar])):
               $tgl_daftar = '-';
            else:
               $tgl_daftar = $k[tgl_daftar];
            endif;
            
			if($data[$i][jenis] == 'RAWAT INAP') {
				$table->addExtraTr("style=\"background-color:#dcdcdc\"");
			} else $table->addExtraTr();
			$table->addRow(
				($no+$i), 
				$data[$i][id_kunjungan], 
				$data[$i][no_rm], 
				$data[$i][nama], 
				$data[$i][kunjungan_ke], 
				$data[$i][no_antrian], 
				$data[$i][kamar], 
				$data[$i][dokter], 
				tanggalIndo($data[$i][tgl_daftar], 'j M Y'), 
				tanggalIndo($data[$i][tgl_periksa], 'j M Y'), 
                $tgl_daftar,
				$data[$i][kelanjutan], 
				"<a href=\"javascript:void(0)\" title=\"Hapus\" onclick=\"hapus_kunjungan_kamar('".$data[$i][id_kunjungan]."','".$data[$i][id_kunjungan_kamar]."', this)\" class=\"tombol_hapus\"><img src=\"".IMAGES_URL."remove.png\" alt=\"Hapus\" border=\"0\" /></a>");
			if($data[$i][jenis] == 'RAWAT INAP') {
				//jika rawat inap, maka diedit
				$table->addOnclickTd(
					"xajax_buka_edit_ranap('".$data[$i][id_kunjungan_kamar]."', '".$data[$i-1][id_kunjungan_kamar]."')",
					"xajax_buka_edit_ranap('".$data[$i][id_kunjungan_kamar]."', '".$data[$i-1][id_kunjungan_kamar]."')",
					"xajax_buka_edit_ranap('".$data[$i][id_kunjungan_kamar]."', '".$data[$i-1][id_kunjungan_kamar]."')",
					"xajax_buka_edit_ranap('".$data[$i][id_kunjungan_kamar]."', '".$data[$i-1][id_kunjungan_kamar]."')",
					"xajax_buka_edit_ranap('".$data[$i][id_kunjungan_kamar]."', '".$data[$i-1][id_kunjungan_kamar]."')",
					"xajax_buka_edit_ranap('".$data[$i][id_kunjungan_kamar]."', '".$data[$i-1][id_kunjungan_kamar]."')",
					"xajax_buka_edit_ranap('".$data[$i][id_kunjungan_kamar]."', '".$data[$i-1][id_kunjungan_kamar]."')",
					"xajax_buka_edit_ranap('".$data[$i][id_kunjungan_kamar]."', '".$data[$i-1][id_kunjungan_kamar]."')",
					"xajax_buka_edit_ranap('".$data[$i][id_kunjungan_kamar]."', '".$data[$i-1][id_kunjungan_kamar]."')",
					"xajax_buka_edit_ranap('".$data[$i][id_kunjungan_kamar]."', '".$data[$i-1][id_kunjungan_kamar]."')",
					"xajax_buka_edit_ranap('".$data[$i][id_kunjungan_kamar]."', '".$data[$i-1][id_kunjungan_kamar]."')"
				);

			} elseif($data[$i][kelanjutan] == "DIRAWAT" && $data[$i][pasien_id] == $data[$i+1][pasien_id] && $data[$i+1][jenis] == 'RAWAT INAP') {
				$table->addOnclickTd(
					"alert('Pasien sudah mendaftar rawat inap')",
					"alert('Pasien sudah mendaftar rawat inap')",
					"alert('Pasien sudah mendaftar rawat inap')",
					"alert('Pasien sudah mendaftar rawat inap')",
					"alert('Pasien sudah mendaftar rawat inap')",
					"alert('Pasien sudah mendaftar rawat inap')",
					"alert('Pasien sudah mendaftar rawat inap')",
					"alert('Pasien sudah mendaftar rawat inap')",
					"alert('Pasien sudah mendaftar rawat inap')",
					"alert('Pasien sudah mendaftar rawat inap')",
					"alert('Pasien sudah mendaftar rawat inap')"
				);
			} else {
				$table->addOnclickTd(
					"xajax_buka_daftar_ranap('".$data[$i][id_kunjungan_kamar]."')",
					"xajax_buka_daftar_ranap('".$data[$i][id_kunjungan_kamar]."')",
					"xajax_buka_daftar_ranap('".$data[$i][id_kunjungan_kamar]."')",
					"xajax_buka_daftar_ranap('".$data[$i][id_kunjungan_kamar]."')",
					"xajax_buka_daftar_ranap('".$data[$i][id_kunjungan_kamar]."')",
					"xajax_buka_daftar_ranap('".$data[$i][id_kunjungan_kamar]."')",
					"xajax_buka_daftar_ranap('".$data[$i][id_kunjungan_kamar]."')",
					"xajax_buka_daftar_ranap('".$data[$i][id_kunjungan_kamar]."')",
					"xajax_buka_daftar_ranap('".$data[$i][id_kunjungan_kamar]."')",
					"xajax_buka_daftar_ranap('".$data[$i][id_kunjungan_kamar]."')",
					"xajax_buka_daftar_ranap('".$data[$i][id_kunjungan_kamar]."')"
				);
			}
		}
		$ret = $table->build();
		$objResponse = new xajaxResponse();
		//$objResponse->addAssign("debug", "innerHTML", $sql);
		$objResponse->addAssign("navi", "innerHTML", $navi);
		$objResponse->addAssign("list_data", "innerHTML", $ret);
		return $objResponse;
	}
Example #21
0
	function cari_bhp($hal = 0, $val) {
		$val[bhp] = addslashes($val[bhp]);
		$q = " AND nama LIKE '%".$val[bhp]."%' ";
		$paging = new MyPagina;
		$paging->rows_on_page = 10;
		$paging->hal = $hal;
		
		/*$paging->sql = "
			SELECT 
				id as id,
				REPLACE(nama, '".$val[bhp]."','<b>".$val[bhp]."</b>') as nama_replace,
				nama as nama,
				biaya as biaya
			FROM 
				bhp
			WHERE
				1=1
				$q
			ORDER BY 
				nama
			";*/
		$paging->sql = "select db_apotek.ms_barang.id as id, db_apotek.ms_barang.kd_barang as kd_barang,db_apotek.ms_barang.nama as nama,
          barang_unit.stok as stok, db_apotek.barang_unit.fld02 as biaya from db_apotek.ms_barang, db_apotek.barang_unit 
where db_apotek.ms_barang.id = db_apotek.barang_unit.barang_id";  

		 $paging->onclick_func = "xajax_cari_obat";
         $paging->setOnclickValue("xajax.getFormValues('cari_obat')");
         $paging->get_page_result();

         $bhp_data = $paging->data;
         $bhp_no = $paging->start_number();
         $bhp_navi = $paging->navi();


         $objResponse = new xajaxResponse();

         $table = new Table;
         $table->tbody_height = 200;
         $table->addTh("No", "Obat", "Harga");
         $table->addExtraTh("style=\"width:30px\"", "", "");
         for($i = 0; $i < sizeof($bhp_data); $i++) {
            $table->addRow(($bhp_no + $i), $bhp_data[$i]['nama'], uangIndo($bhp_data[$i]['biaya']));
            $table->addOnclickTd("xajax_get_bhp(".$bhp_data[$i]['id'].", '".addslashes($bhp_data[$i]['nama']).
               "', '".($bhp_data[$i]['biaya'])."');", "xajax_get_bhp(".$bhp_data[$i]['id'].", '".
               addslashes($bhp_data[$i]['nama'])."', '".($bhp_data[$i]['biaya'])."');",
               "xajax_get_bhp(".$bhp_data[$i]['id'].", '".addslashes($bhp_data[$i]['nama']).
               "', '".($bhp_data[$i]['biaya'])."');");
         }
         $tabel = $table->build();
         $objResponse->addAssign("bhp_navi", "innerHTML", $bhp_navi);
         $objResponse->addAssign("list_bhp", "innerHTML", $tabel);
		return $objResponse;
	}
Example #22
0
	function cari_kendaraan() {
		$objResponse = new xajaxResponse;
		$table = new Table;
		$table->tbody_height = 200;
		$table->addTh("No", "Jenis Kendaraan");
		$table->addExtraTh("style=\"width:30px\"", "");
		$table->addRow("1", "SEWA AMBULANCE");
		$table->addOnclickTd("xajax_get_kendaraan('SEWA AMBULANCE');","xajax_get_kendaraan('SEWA AMBULANCE', xajax.getFormValues('input_kunjungan'));");
		$table->addRow("2", "SEWA MOBIL JENAZAH");
		$table->addOnclickTd("xajax_get_kendaraan('SEWA MOBIL JENAZAH');","xajax_get_kendaraan('SEWA MOBIL JENAZAH', xajax.getFormValues('input_kunjungan'));");
		$tabel = $table->build();
		$objResponse->addAssign("list_kendaraan","innerHTML", $tabel);
		return $objResponse;
	}
	function buka_langsung_bayar($idkw) {
		unset($_SESSION[kasir][kunjungan][jasa_cetak]);
		$kon = new Konek;
		//$kon->debug = 1;
		$objResponse = new xajaxResponse;
		//get data pasien
		$sql = "
			SELECT
				k.id as kunjungan_id,
				CONCAT_WS('-', SUBSTRING(p.id, 1,2), SUBSTRING(p.id, 3,2), SUBSTRING(p.id, 5,2), SUBSTRING(p.id, 7,2)) as id_display,
				p.nama as nama,
				p.tgl_lahir as tgl_lahir,
				CONCAT(p.alamat, ' ', IF(p.rt = '','',CONCAT(' RT ', p.rt)), IF(p.rw = '','',CONCAT(' RW ', p.rw)), ', ', des.nama, ', ', kec.nama, ', ', kab.nama) as alamat,
				kk.tgl_daftar as tgl_daftar,
				kk.tgl_periksa as tgl_periksa,
				pel.nama as nama_pelayanan,
				p.sex as jk,
				CONCAT_WS(' - ', kk.cara_bayar, kk.jenis_askes, rper.nama) as cara_bayar,
				kk.nomor as nomor
			FROM
				kunjungan_kamar kk
				JOIN kunjungan k ON (k.id = kk.kunjungan_id)
				JOIN pasien p ON (p.id = k.pasien_id)
				JOIN kamar kmr ON (kmr.id = kk.kamar_id)
				JOIN pelayanan pel ON (pel.id = kmr.pelayanan_id)
				JOIN kunjungan_bayar kb ON (kb.kunjungan_kamar_id = kk.id)
				JOIN kwitansi_detil kwd ON (kwd.kunjungan_bayar_id = kb.id)
				JOIN kwitansi kw ON (kw.id = kwd.kwitansi_id)
				JOIN ref_desa des ON (des.id = p.desa_id)
				JOIN ref_kecamatan kec ON (kec.id = des.kecamatan_id)
				JOIN ref_kabupaten kab ON (kab.id = kec.kabupaten_id)
				JOIN ref_propinsi prop ON (prop.id = kab.propinsi_id)
				LEFT JOIN ref_perusahaan rper ON (rper.id = kk.perusahaan_id)
			WHERE
				kw.id = '".$idkw."'
			GROUP BY
				p.id
		";
		//$objResponse->addAssign("debug", "innerHTML", $sql);
		$kon->sql = $sql;
		$kon->execute();
		$data_pasien = $kon->getOne();
		$arr_usia = hitungUmur($data_pasien[tgl_lahir], $data_pasien[tgl_periksa]);
		$data_pasien[usia] = empty($arr_usia[tahun])?"":$arr_usia[tahun] . " thn ";
		$data_pasien[usia] .= empty($arr_usia[bulan])?"":$arr_usia[bulan] . " bln ";
		$data_pasien[usia] .= empty($arr_usia[hari])?"":$arr_usia[hari] . " hr ";
		$objResponse->addClear("modal_lb", "style.display");
		$objResponse->addAssign("lb_id_kunjungan", "value", $data_pasien[kunjungan_id]);
		$objResponse->addAssign("lb_id_kwitansi", "value", $idkw);
		$objResponse->addAssign("lb_no_rm", "innerHTML", $data_pasien[id_display]);
		$objResponse->addAssign("lb_pasien", "innerHTML", $data_pasien[nama]);
		$objResponse->addAssign("lb_sex", "innerHTML", $data_pasien[jk]);
		$objResponse->addAssign("lb_usia", "innerHTML", $data_pasien[usia]);
		$objResponse->addAssign("lb_alamat", "innerHTML", $data_pasien[alamat]);
		$objResponse->addAssign("lb_tgl_daftar", "innerHTML", tanggalIndo($data_pasien[tgl_daftar], 'j F Y'));
		$objResponse->addAssign("lb_cara_bayar", "innerHTML", $data_pasien[cara_bayar]);
		$objResponse->addAssign("lb_nomor", "innerHTML", empty($data_pasien[nomor])?"-":$data_pasien[nomor]);
	
		//BIKIN SESSION UNTUK DICETAK
		$_SESSION[igd][langsung_bayar][data_px] = $data_pasien;

		$tabel = new Table;
		$tabel->cellspacing = "0";
		$tabel->scroll = false;
		$tabel->extra_table = "style=\"width:9cm;\"";
		$tabel->addTh("No", "Jasa", "Biaya");
		$tabel->addExtraTh("style=\"width:0.7cm;\"", "style=\"width:6.5cm;\"", "");
		//get data karcis
		$kon->sql = "
			SELECT
				kb.nama as nama,
				kb.bayar_bhp+kb.bayar_jasa as bayar,
				kb.mampu_bayar_bhp+kb.mampu_bayar_jasa as mampu_bayar,
				kwd.kwitansi_id as kwitansi_id
			FROM
				kunjungan_bayar kb
				JOIN kwitansi_detil kwd ON (kwd.kunjungan_bayar_id = kb.id)
				JOIN kunjungan_kamar kk ON (kk.id = kb.kunjungan_kamar_id)
			WHERE
				kb.karcis_id IS NOT NULL
				AND kwd.kwitansi_id = '".$idkw."'
			GROUP BY
				kb.id
			ORDER BY kb.id
		";
		$kon->execute();
		$data_karcis = $kon->getAll();
		if(!empty($data_karcis)) {
			$tabel->addRow("","<b>Karcis</b>","");
			for($i=0;$i<sizeof($data_karcis);$i++) {
				$tabel->addRow(
					($i+1),
					$data_karcis[$i][nama],
					uangIndo($data_karcis[$i][bayar])
				);
				$total += $data_karcis[$i][bayar];
				$sudah_dibayar += $data_karcis[$i][mampu_bayar];
				//belum bayar
				$kurang += $data_karcis[$i][bayar]-$data_karcis[$i][mampu_bayar];
			}
		}

		//get data tindakan
		$kon->sql = "
			SELECT
				kki.nama as nama,
				SUM(kb.bayar_jasa) as bayar,
				SUM(kb.mampu_bayar_jasa) as mampu_bayar,
				kwd.kwitansi_id as kwitansi_id
			FROM
				kunjungan_kamar_icopim kki 
				JOIN kunjungan_bayar kb ON (kb.kunjungan_kamar_icopim_id = kki.id)
				JOIN kwitansi_detil kwd ON (kwd.kunjungan_bayar_id = kb.id)
				JOIN kunjungan_kamar kk ON (kk.id = kki.kunjungan_kamar_id)
			WHERE
				kb.icopim_detil_id IS NOT NULL
				AND kwd.kwitansi_id = '".$idkw."'
			GROUP BY
				kki.id
			ORDER BY kki.id
		";
		$kon->execute();
		$data_tindakan = $kon->getAll();
		if(!empty($data_tindakan)) {
			$tabel->addRow("","<b>Tindakan</b>","");
			for($i=0;$i<sizeof($data_tindakan);$i++) {
				$tabel->addRow(
					($i+1),
					$data_tindakan[$i][nama],
					uangIndo($data_tindakan[$i][bayar])
				);
				$total += $data_tindakan[$i][bayar];
				$sudah_dibayar += $data_tindakan[$i][mampu_bayar];
				//belum bayar
				$kurang += $data_tindakan[$i][bayar]-$data_tindakan[$i][mampu_bayar];
			}
		}

		//get data specimen
		$kon->sql = "
			SELECT
				kb.nama as nama,
				kb.bayar_bhp+kb.bayar_jasa as bayar,
				kb.mampu_bayar_bhp+kb.mampu_bayar_jasa as mampu_bayar,
				kwd.kwitansi_id as kwitansi_id
			FROM
				kunjungan_bayar kb
				JOIN lab_kunjungan lk ON (lk.id = kb.lab_kunjungan_id)
				JOIN kunjungan_kamar kk ON (kk.id = lk.kunjungan_kamar_id)
				JOIN kwitansi_detil kwd ON (kwd.kunjungan_bayar_id = kb.id)
			WHERE
				kb.lab_specimen_id IS NOT NULL
				AND kwd.kwitansi_id = '".$idkw."'
			GROUP BY
				kb.id
			ORDER BY kb.id
		";
		$kon->execute();
		$data_specimen = $kon->getAll();
		if(!empty($data_specimen)) {
			$tabel->addRow("","<b>Pemeriksaan Specimen</b>","");
			for($i=0;$i<sizeof($data_specimen);$i++) {
				$tabel->addRow(
					($i+1),
					$data_specimen[$i][nama],
					uangIndo($data_specimen[$i][bayar])
				);
				$total += $data_specimen[$i][bayar];
				$sudah_dibayar += $data_specimen[$i][mampu_bayar];
				//belum bayar
				$kurang += $data_specimen[$i][bayar]-$data_specimen[$i][mampu_bayar];
			}
		}

		//get data radio
		$kon->sql = "
			SELECT
				kb.nama as nama,
				kb.bayar_bhp+kb.bayar_jasa as bayar,
				kb.mampu_bayar_bhp+kb.mampu_bayar_jasa as mampu_bayar,
				kwd.kwitansi_id as kwitansi_id
			FROM
				kunjungan_bayar kb
				JOIN radio_kunjungan lk ON (lk.id = kb.lab_kunjungan_id)
				JOIN kunjungan_kamar kk ON (kk.id = lk.kunjungan_kamar_id)
				JOIN kwitansi_detil kwd ON (kwd.kunjungan_bayar_id = kb.id)
			WHERE
				kb.radio_specimen_id IS NOT NULL
				AND kwd.kwitansi_id = '".$idkw."'
			GROUP BY
				kb.id
			ORDER BY kb.id
		";
		$kon->execute();
		$data_radio = $kon->getAll();
		if(!empty($data_radio)) {
			$tabel->addRow("","<b>Pemeriksaan Radiologi</b>","");
			for($i=0;$i<sizeof($data_radio);$i++) {
				$tabel->addRow(
					($i+1),
					$data_radio[$i][nama],
					uangIndo($data_radio[$i][bayar])
				);
				$total += $data_radio[$i][bayar];
				$sudah_dibayar += $data_radio[$i][mampu_bayar];
				//belum bayar
				$kurang += $data_radio[$i][bayar]-$data_radio[$i][mampu_bayar];
			}
		}

		//get data bhp
		$kon->sql = "
			SELECT
				kb.nama as nama,
				kb.bayar_bhp as bayar,
				kb.mampu_bayar_bhp as mampu_bayar,
				kwd.kwitansi_id as kwitansi_id
			FROM
				kunjungan_bayar kb
				JOIN kunjungan_kamar kk ON (kk.id = kb.kunjungan_kamar_id)
				JOIN kwitansi_detil kwd ON (kwd.kunjungan_bayar_id = kb.id)
			WHERE
				kb.bhp_id IS NOT NULL
				AND kwd.kwitansi_id = '".$idkw."'
			GROUP BY
				kb.id
			ORDER BY kb.id
		";
		$kon->execute();
		$data_bhp = $kon->getAll();
		if(!empty($data_bhp)) {
			$tabel->addRow("","<b>Bahan Habis Pakai</b>","");
			for($i=0;$i<sizeof($data_bhp);$i++) {
				$tabel->addRow(
					($i+1),
					$data_bhp[$i][nama],
					uangIndo($data_bhp[$i][bayar])
				);
				$total += $data_bhp[$i][bayar];
				$sudah_dibayar += $data_bhp[$i][mampu_bayar];
				//belum bayar
				$kurang += $data_bhp[$i][bayar]-$data_bhp[$i][mampu_bayar];
			}
		}

		//get data kendaraan
		$kon->sql = "
			SELECT
				kkd.nama as nama,
				SUM(kb.bayar_bhp+kb.bayar_jasa) as bayar,
				SUM(kb.mampu_bayar_bhp+kb.mampu_bayar_jasa) as mampu_bayar,
				kwd.kwitansi_id as kwitansi_id
			FROM
				kunjungan_kendaraan kkd 
				JOIN kunjungan_bayar kb ON (kb.kunjungan_kendaraan_id = kkd.id)
				JOIN kwitansi_detil kwd ON (kwd.kunjungan_bayar_id = kb.id)
				JOIN kunjungan_kamar kk ON (kk.id = kb.kunjungan_kamar_id)
			WHERE
				kwd.kwitansi_id = '".$idkw."'
			GROUP BY
				kkd.id
			ORDER BY kkd.id
		";
		$kon->execute();
		$data_kendaraan = $kon->getAll();
		if(!empty($data_kendaraan)) {
			$tabel->addRow("","<b>Sewa Kendaraan</b>","");
			for($i=0;$i<sizeof($data_kendaraan);$i++) {
				$tabel->addRow(
					($i+1),
					$data_kendaraan[$i][nama],
					uangIndo($data_kendaraan[$i][bayar])
				);
				$total += $data_kendaraan[$i][bayar];
				$sudah_dibayar += $data_kendaraan[$i][mampu_bayar];
				//belum bayar
				$kurang += $data_kendaraan[$i][bayar]-$data_kendaraan[$i][mampu_bayar];
			}
		}

		$tabel->addRow("","<b>Total</b>", uangIndo($total));
		$tabel_jasa = $tabel->build();
		$objResponse->addAssign("lb_list_jasa", "innerHTML", $tabel_jasa);

		$objResponse->addAssign("lb_total_display", "value", uangIndo($total));
		$objResponse->addAssign("lb_total_display", "title", terbilang($total));
		$objResponse->addAssign("lb_sudah_dibayar", "value", $sudah_dibayar);
		$objResponse->addAssign("lb_sudah_dibayar_display", "value", uangIndo($sudah_dibayar));
		$objResponse->addAssign("lb_sudah_dibayar_display", "title", terbilang($sudah_dibayar));
		$objResponse->addAssign("lb_kurang_display", "value", uangIndo($kurang));
		$objResponse->addAssign("lb_kurang", "value", $kurang);
		$objResponse->addAssign("lb_kurang_display", "title", terbilang($kurang));
		$objResponse->addAssign("lb_mampu_bayar", "value", $kurang);
		$objResponse->addAssign("mampu_terbilang", "innerHTML", terbilang($kurang));
		$objResponse->addScriptCall("disable_mainbar", "#E5E6E1");
		$objResponse->addScriptCall("fokus", "lb_mampu_bayar");

		//get data kwitansi :
		$kon->sql = "
			SELECT
				CONCAT_WS('-', kw.tempat_pembayaran, kw.id) as no_kwitansi,
				kw.bayar as mampu_bayar,
				kw.tgl as tgl
			FROM
				kunjungan_bayar kb
				JOIN kwitansi_detil kwd ON (kwd.kunjungan_bayar_id = kb.id)
				JOIN kwitansi kw ON (kw.id = kwd.kwitansi_id)
				JOIN kunjungan_kamar kk ON (kk.id = kb.kunjungan_kamar_id)
			WHERE
				kw.id = '".$idkw."'
			GROUP BY
				kw.id
			ORDER BY 
				kw.id
		";
		$kon->execute();
		$data_kw = $kon->getAll();

		if($kurang) {
			//ada yang belum dibayar
			$objResponse->addAssign("lb_simpan", "style.display", "");
		}

		if(!empty($data_kw)) {
			//ada yang sudah dibayar
			for($i=0;$i<sizeof($data_kw);$i++) {
				$kw .= "<br /><input type=\"button\" name=\"lb_cetak\" id=\"lb_cetak\" value=\"Cetak Kwitansi ".$data_kw[$i][no_kwitansi]."\" class=\"inputan\" onclick=\"cetak_kwitansi('".$data_kw[$i][no_kwitansi]."');\" /> <br /> <em>Rp.&nbsp;".uangIndo($data_kw[$i][mampu_bayar])."&nbsp;-&nbsp;".tanggalIndo($data_kw[$i][tgl], "j F Y H:i")."</em><br />";
			}
			$objResponse->addAssign("fieldset_lb_button_kwitansi", "style.display", "");
			$objResponse->addAssign("lb_button_kwitansi", "innerHTML", $kw);
			if(!$kurang) $objResponse->addAssign("lb_simpan", "style.display", "none");
		} else {
			$objResponse->addAssign("fieldset_lb_button_kwitansi", "style.display", "none");
		}

		return $objResponse;
	}
Example #24
0
      function list_data($hal = 0, $val) {
         $paging = new MyPagina;
         $objResponse = new xajaxResponse();
		
		
		 if($val[is_cari] == "1") {
            if($val[cari_id]) {
               $q = " AND p.id = '".$val[cari_id]."' ";
            } else {
               if($val[cari_nama]) $q .= " AND p.nama LIKE '%".$val[cari_nama]."%' ";
               if($val[cari_sex]) $q .= " AND p.sex = '".$val[cari_sex]."' ";
               if($val[cari_alamat]) $q .= " AND p.alamat LIKE '%".$val[cari_alamat]."%' ";
               if($val[cari_rt]) $q .= " AND p.rt LIKE '%".$val[cari_rt]."%' ";
               if($val[cari_rw]) $q .= " AND p.rw LIKE '%".$val[cari_rw]."%' ";
               if($val[cari_telp]) $q .= " AND p.telp LIKE '%".$val[cari_telp]."%' "; 
               /*if($tgl_lahir) $q .= " AND DATE(p.tgl_lahir) = '".$tgl_lahir."' "; */
			   if ($val[tgl_lahir_thn] == "" && $val[tgl_lahir_bln] == "" && $val[tgl_lahir_tgl] == ""){
						$tgl_lahir = "";
						}
				else {
						$tgl_lahir = $val[tgl_lahir_thn] . "-" . $val[tgl_lahir_bln] . "-" . $val[tgl_lahir_tgl];   
						$q .= " AND DATE(p.tgl_lahir) = '".$tgl_lahir."' ";
					} 
               if($val[cari_desa_id]) $q .= " AND des.id = '".$val[cari_desa_id]."' ";
               elseif($val[cari_kecamatan_id]) $q .= " AND kec.id = '".$val[cari_kecamatan_id].
                     "' ";
               elseif($val[cari_kabupaten_id]) $q .= " AND kab.id = '".$val[cari_kabupaten_id].
                     "' ";
               elseif($val[cari_propinsi_id]) $q .= " AND prop.id = '".$val[cari_propinsi_id].
                     "' ";
            }
         }     
          $sql = "
				SELECT
					p.id as id,
					CONCAT_WS('-', SUBSTRING(p.id, 1,2), SUBSTRING(p.id, 3,2), SUBSTRING(p.id, 5,2), SUBSTRING(p.id, 7,2)) as id_display,
					REPLACE((p.nama), ('".$val[cari_nama]."'), ('<b>".$val[cari_nama].
            "</b>')) as nama,
					CONCAT(p.alamat, ' ', 'RT ', p.rt, '/ RW ', p.rw, '<br />',des.nama, ', ', kec.nama, ', ', kab.nama, '<br />', prop.nama) as alamat
				FROM
					pasien p
					LEFT OUTER JOIN ref_desa des ON (des.id = p.desa_id)
					LEFT OUTER JOIN ref_kecamatan kec ON (kec.id = des.kecamatan_id)
					LEFT OUTER JOIN ref_kabupaten kab ON (kab.id = kec.kabupaten_id)
					LEFT OUTER JOIN ref_propinsi prop ON (prop.id = kab.propinsi_id)
				WHERE
					1=1
					$q
				ORDER BY p.nama
				";
         //echo $sql;
         //$objResponse->addAssign("debug", "innerHTML", $sql);
         $paging->hal = $hal;
         $paging->sql = $sql;
         $paging->setOnclickValue("xajax.getFormValues('cari_pasien')");
         $paging->get_page_result();
         $data = $paging->data;
         $no = $paging->start_number();
         $navi = $paging->navi();

         $table = new Table;
         $table->tbody_height = 270;
         $table->addTh("No", "No. RM", "NAMA", "ALAMAT", "HAPUS");
         $table->addExtraTh(" style=\"width:40px\" ", " style=\"width:100px\" ", " style=\"width:200px\" ",
            "", " style=\"width:50px\" ");
         for($i = 0; $i < sizeof($data); $i++) {
            $table->addRow(($no + $i), $data[$i][id_display], $data[$i][nama], $data[$i][alamat],
               "<a href=\"javascript:void(0)\" title=\"Hapus Pasien\" onclick=\"hapus_pasien('".
               $data[$i][id]."', 'tr_".$i."')\" class=\"tombol_hapus\"><img src=\"".IMAGES_URL.
               "remove.png\" alt=\"Hapus Pasien\" border=\"0\" /></a>");
            $table->addExtraTr("id=\"tr_".$i."\"");

            $table->addOnclickTd("xajax_get_pasien('".$data[$i][id]."')",
               "xajax_get_pasien('".$data[$i][id]."')", "xajax_get_pasien('".$data[$i][id].
               "')", "xajax_get_pasien('".$data[$i][id]."')");
         }
         $ret = $table->build();
         $objResponse->addAssign("cari_navi", "innerHTML", $navi);
         $objResponse->addAssign("list_data", "innerHTML", $ret);
         return $objResponse;
      }
Example #25
0
	function list_data($val) {
		unset($_SESSION[igd][pendapatan]);
		//get data karcis dan BHP
		$objResponse = new xajaxResponse;
		$kon = new Konek;
		$title = "Laporan Pembagian Jasa IRD";
		if($val[jangka_waktu] == "tahun") {
			$q = "AND YEAR(kw.tgl) BETWEEN '".$val[thn_start]."' AND '".$val[thn_end]."'";
			$title .= "\nPeriode " . $val[thn_start] . " - " . $val[thn_end];
		} elseif($val[jangka_waktu] == "bulan") {
			$q = "AND EXTRACT(YEAR_MONTH FROM kw.tgl) BETWEEN '".$val[thn_start].$val[bln_start]."' AND '".$val[thn_end].$val[bln_end]."'";
			$title .= "\nPeriode " . bulanIndo($val[bln_start], "F") . " " . $val[thn_start] . " - " . bulanIndo($val[bln_end], "F") . " " . $val[thn_end];
		} else {
			$q = "AND DATE(kw.tgl) BETWEEN '".$val[thn_start]."-".$val[bln_start]."-".$val[tgl_start]."' AND '".$val[thn_end]."-".$val[bln_end]."-".$val[tgl_end]."'";
			$title .= "\nPeriode " . tanggalIndo($val[thn_start] . "-" . $val[bln_start] . "-" . $val[tgl_start], "j F Y") . " - " . tanggalIndo($val[thn_end] . "-" . $val[bln_end] . "-" . $val[tgl_end], "j F Y");
		}
		$sql = "
			SELECT
				kb.nama as nama,
				hak.nama as nama_hak,
				SUM(ROUND(kb.mampu_bayar_bhp * bhp_p)) as bhp_p,
				SUM(ROUND(kb.mampu_bayar_bhp * bhp_rs_adm)) as bhp_rs_adm,
				SUM(ROUND(kb.mampu_bayar_bhp * bhp_rs_op)) as bhp_rs_op,
				SUM(ROUND(kb.mampu_bayar_jasa * jasa_p)) as jasa_p,
				SUM(ROUND(kb.mampu_bayar_jasa * jasa_rs_adm)) as jasa_rs_adm,
				SUM(ROUND(kb.mampu_bayar_jasa * jasa_rs_sdm)) as jasa_rs_sdm,
				SUM(ROUND(kb.mampu_bayar_jasa * jasa_rs_kembang)) as jasa_rs_kembang,
				SUM(ROUND(kb.mampu_bayar_jasa * jasa_rs_op)) as jasa_rs_op,

				SUM(ROUND(kb.mampu_bayar_jasa * spesialis * netto)) as spesialis,
				SUM(ROUND(kb.mampu_bayar_jasa * spesialis_pendamping * netto)) as spesialis_pendamping,
				SUM(ROUND(kb.mampu_bayar_jasa * perawat_perinatologi * netto)) as perawat_perinatologi,
				SUM(ROUND(kb.mampu_bayar_jasa * dr_umum * netto)) as dr_umum,
				SUM(ROUND(kb.mampu_bayar_jasa * dr_gigi * netto)) as dr_gigi,
				SUM(ROUND(kb.mampu_bayar_jasa * assisten_non_dokter * netto)) as assisten_non_dokter,
				SUM(ROUND(kb.mampu_bayar_jasa * spesialis_anestesi * netto)) as spesialis_anestesi,
				SUM(ROUND(kb.mampu_bayar_jasa * aknest * netto)) as aknest,
				SUM(ROUND(kb.mampu_bayar_jasa * gizi * netto)) as gizi,
				SUM(ROUND(kb.mampu_bayar_jasa * fisioterapi * netto)) as fisioterapi,
				SUM(ROUND(kb.mampu_bayar_jasa * analis_pa * netto)) as analis_pa,
				SUM(ROUND(kb.mampu_bayar_jasa * bidan * netto)) as bidan,
				SUM(ROUND(kb.mampu_bayar_jasa * perawat * netto)) as perawat,
				SUM(ROUND(kb.mampu_bayar_jasa * penunjang * netto)) as penunjang,
				SUM(ROUND(kb.mampu_bayar_jasa * ugp * netto)) as ugp,
				SUM(ROUND(kb.mampu_bayar_jasa * grabaf * netto)) as grabaf,
				SUM(ROUND(kb.mampu_bayar_jasa * zakat * netto)) as zakat,
				SUM(ROUND(pajak * (kb.mampu_bayar_jasa - kb.mampu_bayar_jasa * kb.jasa_p - kb.mampu_bayar_jasa * kb.jasa_rs_op - kb.mampu_bayar_jasa * kb.jasa_rs_kembang - kb.mampu_bayar_jasa * kb.jasa_rs_adm - kb.mampu_bayar_jasa * kb.jasa_rs_sdm))) as pajak,
				SUM(kb.mampu_bayar_bhp+kb.mampu_bayar_jasa) as mampu_bayar
			FROM
				kunjungan_bayar kb
				JOIN kunjungan_kamar kk ON (kk.id = kb.kunjungan_kamar_id)
				JOIN hak ON (hak.id = kb.hak_id)
				JOIN kwitansi kw ON (kw.id = kb.kwid)
			WHERE
				(kb.karcis_id IS NOT NULL OR kb.bhp_id IS NOT NULL)
				AND kw.tempat_pembayaran = 'IRD'
				$q
			GROUP BY
				kb.karcis_id, kb.bhp_id, kb.hak_id
		";
		//$objResponse->addAssign("debug", "innerHTML", nl2br($sql));
		$kon->sql = $sql;
		$kon->execute();
		$data_karcis = $kon->getAll();

		$table = new Table;
		$table->anime_bg_color = false;
		$table->addTh("Jasa", "Pemilik", "BHP", "JASA RS", "Sp", "Sp1", "SpAn", "UGP", "GRABAF", "Prwt", /*"Ass Non Dokter", "Aknest", "Gizi", "Fisio", "Analis PA", "Bidan", */"Pnjg", "Zakat", "Pajak", "Sub Total");
		$table->addExtraTh("rowspan=\"2\"", "rowspan=\"2\"", "colspan=\"5\"", "colspan=\"5\"", "rowspan=\"2\"", "rowspan=\"2\"", "rowspan=\"2\"", "rowspan=\"2\"", "rowspan=\"2\"", "rowspan=\"2\"", "rowspan=\"2\"", "rowspan=\"2\"", "rowspan=\"2\"", "rowspan=\"2\"", "rowspan=\"2\"", "rowspan=\"2\"", "rowspan=\"2\"", "rowspan=\"2\"", "rowspan=\"2\"", "rowspan=\"2\"");
		$table->addTh("Pemda", "Adm", "Op", "Rad", "Lab", "Pemda", "Adm", "Sdm", "Bang", "Op");
		for($i=0;$i<sizeof($data_karcis);$i++) {
			$table->addRow(
				$data_karcis[$i][nama], 
				$data_karcis[$i][nama_hak],
				$data_karcis[$i][bhp_p],
				$data_karcis[$i][bhp_rs_adm],
				$data_karcis[$i][bhp_rs_op],
				"?",
				"?",
				uangIndo($data_karcis[$i][jasa_p], false),
				uangIndo($data_karcis[$i][jasa_rs_adm], false),
				uangIndo($data_karcis[$i][jasa_rs_sdm], false),
				uangIndo($data_karcis[$i][jasa_rs_kembang], false),
				uangIndo($data_karcis[$i][jasa_rs_op], false),

				uangIndo($data_karcis[$i][spesialis], false),
				uangIndo($data_karcis[$i][spesialis_pendamping], false),
				uangIndo($data_karcis[$i][spesialis_anestesi], false),
				//uangIndo($data_karcis[$i][dr_umum] + $data_karcis[$i][dr_gigi] + $data_karcis[$i][ugp], false),
				uangIndo($data_karcis[$i][ugp], false),
				uangIndo($data_karcis[$i][grabaf], false),
				//uangIndo($data_karcis[$i][perawat] + $data_karcis[$i][perawat_perinatologi], false),
				uangIndo($data_karcis[$i][perawat], false),
				/*uangIndo($data_karcis[$i][assisten_non_dokter], false),
				uangIndo($data_karcis[$i][aknest], false),
				uangIndo($data_karcis[$i][gizi], false),
				uangIndo($data_karcis[$i][fisioterapi], false),
				uangIndo($data_karcis[$i][analis_pa], false),
				uangIndo($data_karcis[$i][bidan], false),*/
				uangIndo($data_karcis[$i][penunjang], false),
				uangIndo($data_karcis[$i][zakat], false),
				uangIndo($data_karcis[$i][pajak], false),
				uangIndo($data_karcis[$i][mampu_bayar], false)

				/*
				$data_karcis[$i][assisten_non_dokter],
				$data_karcis[$i][aknest],
				$data_karcis[$i][gizi],
				$data_karcis[$i][fisioterapi],
				$data_karcis[$i][analis_pa],
				$data_karcis[$i][bidan],
				*/
			);
			$table->addExtraTr("onclick=\"setBg(this);\"");

			$total[bhp_p] += $data_karcis[$i][bhp_p];
			$total[bhp_rs_adm] += $data_karcis[$i][bhp_rs_adm];
			$total[bhp_rs_op] += $data_karcis[$i][bhp_rs_op];
			$total[jasa_p] += $data_karcis[$i][jasa_p];
			$total[jasa_rs_adm] += $data_karcis[$i][jasa_rs_adm];
			$total[jasa_rs_sdm] += $data_karcis[$i][jasa_rs_sdm];
			$total[jasa_rs_kembang] += $data_karcis[$i][jasa_rs_kembang];
			$total[jasa_rs_op] += $data_karcis[$i][jasa_rs_op];
			$total[spesialis] += $data_karcis[$i][spesialis];
			$total[spesialis_pendamping] += $data_karcis[$i][spesialis_pendamping];
			$total[spesialis_anestesi] += $data_karcis[$i][spesialis_anestesi];
			//$total[ugp] += $data_karcis[$i][dr_umum] + $data_karcis[$i][dr_gigi] + $data_karcis[$i][ugp];
			$total[ugp] += $data_karcis[$i][ugp];
			$total[grabaf] += $data_karcis[$i][grabaf];
			//$total[perawat] += $data_karcis[$i][perawat]+$data_karcis[$i][perawat_perinatologi];
			$total[perawat] += $data_karcis[$i][perawat];
			/*$total[assisten_non_dokter] += $data_karcis[$i][assisten_non_dokter];
			$total[aknest] += $data_karcis[$i][aknest];
			$total[gizi] += $data_karcis[$i][gizi];
			$total[fisioterapi] += $data_karcis[$i][fisioterapi];
			$total[analis_pa] += $data_karcis[$i][analis_pa];
			$total[bidan] += $data_karcis[$i][bidan];*/
			$total[penunjang] += $data_karcis[$i][penunjang];
			$total[zakat] += $data_karcis[$i][zakat];
			$total[pajak] += $data_karcis[$i][pajak];
			$total[mampu_bayar] += $data_karcis[$i][mampu_bayar];
		}
		$table->addTfoot(
			"Total", 
			uangIndo($total[bhp_p], false), 
			uangIndo($total[bhp_rs_adm], false), 
			uangIndo($total[bhp_rs_op], false), 
			"?", 
			"?", 
			uangIndo($total[jasa_p], false), 
			uangIndo($total[jasa_rs_adm], false), 
			uangIndo($total[jasa_rs_sdm], false), 
			uangIndo($total[jasa_rs_kembang], false), 
			uangIndo($total[jasa_rs_op], false), 
			uangIndo($total[spesialis], false), 
			uangIndo($total[spesialis_pendamping], false), 
			uangIndo($total[spesialis_anestesi], false), 
			uangIndo($total[ugp], false), 
			uangIndo($total[grabaf], false), 
			uangIndo($total[perawat], false), 
			/*uangIndo($total[assisten_non_dokter], false), 
			uangIndo($total[aknest], false), 
			uangIndo($total[gizi], false), 
			uangIndo($total[fisioterapi], false), 
			uangIndo($total[analis_pa], false), 
			uangIndo($total[bidan], false), */
			uangIndo($total[penunjang], false), 
			uangIndo($total[zakat], false), 
			uangIndo($total[pajak], false), 
			uangIndo($total[mampu_bayar], false)
			);
		$table->addExtraTfoot("colspan=\"2\"");
		$content = $table->build();
		$judul = nl2br($title);
		$objResponse->addAssign("title", "innerHTML", $judul);
		$objResponse->addAssign("list_data", "innerHTML", $content);
		$_SESSION[igd][pendapatan][title] = $judul;
		$_SESSION[igd][pendapatan][content] = $content;
		return $objResponse;
	}
Example #26
0
	function list_data($hal=0, $val="") {
		if($val[cara_bayar]) $q = " AND kk.cara_bayar = '".$val[cara_bayar]."' ";
		if($val[pasien_id]) {
			$q .= " AND p.id = '".$val[pasien_id]."' ";
		} elseif($val[nama]) {
			$q .= " AND p.nama LIKE '%".$val[nama]."%' ";
		} elseif($val[kwitansi_id]) {
			$q .= " AND kw.id = '".$val[kwitansi_id]."' ";
		} else {
			$tgl_daftar_dari = $val[tgl_mulai_thn] . "-" . $val[tgl_mulai_bln] . "-" . $val[tgl_mulai_tgl];
			$tgl_daftar_sampai = $val[tgl_selesai_thn] . "-" . $val[tgl_selesai_bln] . "-" . $val[tgl_selesai_tgl];
			$q .= " AND DATE(kk.tgl_keluar) BETWEEN '".$tgl_daftar_dari."' AND '".$tgl_daftar_sampai."' ";
		}
		if(!$val[semua]) $q .= " AND kw.status = 'ANGSUR' ";
		$paging = new MyPagina;
		$paging->setOnclickValue("xajax.getFormValues('form_kunjungan')");
		$sql = "
			SELECT 
				k.id as id_kunjungan,
				kk.id as id_kunjungan_kamar,
				CONCAT_WS('-', SUBSTRING(p.id, 1,2), SUBSTRING(p.id, 3,2), SUBSTRING(p.id, 5,2), SUBSTRING(p.id, 7,2)) as no_rm,
				p.id as pasien_id,
				REPLACE((p.nama), ('".$val[nama]."'), ('<b>".$val[nama]."</b>')) as nama,
				kk.cara_bayar as cara_bayar,
				CONCAT(p.alamat, ' ', 'RT ', p.rt, '/ RW ', p.rw, '<br />',des.nama, ', ', kec.nama, ', ', kab.nama, '<br />', prop.nama) as alamat,
				CONCAT_WS('-', kw.tempat_pembayaran, kw.id) as no_kwitansi,
				kw.id as kwitansi_id,
				kw.bayar as bayar,
				SUM(kb.bayar_bhp+kb.bayar_jasa)-kw.bayar as kurang,
				kw.tgl as tgl
			FROM 
				kunjungan k
				JOIN pasien p ON (p.id = k.pasien_id)
				JOIN kunjungan_kamar kk ON (kk.kunjungan_id = k.id)
				JOIN kamar kmr ON (kmr.id = kk.kamar_id)
				JOIN pelayanan pel ON (pel.id = kmr.pelayanan_id)
				JOIN kunjungan_bayar kb ON (kb.kunjungan_kamar_id = kk.id)
				JOIN kwitansi_detil kwd ON (kwd.kunjungan_bayar_id = kb.id)
				JOIN kwitansi kw ON (kw.id = kwd.kwitansi_id)
				JOIN ref_desa des ON (des.id = p.desa_id)
				JOIN ref_kecamatan kec ON (kec.id = des.kecamatan_id)
				JOIN ref_kabupaten kab ON (kab.id = kec.kabupaten_id)
				JOIN ref_propinsi prop ON (prop.id = kab.propinsi_id)
			WHERE
				1=1
				$q
			GROUP BY
				kw.id
			ORDER BY 
				kw.id
		";
		$paging->sql = $sql;
		$paging->rows_on_page = 20;
		$paging->hal = $hal;
		$paging->get_page_result();

		$_SESSION[keuangan_kunjungan][hal] = $hal;

		$data = $paging->data;
		$no = $paging->start_number();
		$navi = $paging->navi();

		$table = new Table;
		$table->tbody_height = 310;
		$table->addTh(
			"No", 
			"No. RM", 
			"Nama Pasien", 
			"Alamat", 
			"Cara Bayar", 
			"Nomor Kwitansi", 
			"Bayar",
			"Kurang"
		);
		$table->addExtraTh("style=\"width:20px;\"","style=\"width:100px;\"","","","","","","");
		for($i=0;$i<sizeof($data);$i++) {
			//if(!empty($baru[$i][kamar])) $kamar = implode("<br />", $baru[$i][kamar]);
			//else $kamar = $baru[$i][kamar][0];
			$table->addRow(
				($no+$i), 
				$data[$i][no_rm], 
				$data[$i][nama], 
				$data[$i][alamat], 
				$data[$i][cara_bayar], 
				$data[$i][no_kwitansi],
				uangIndo($data[$i][bayar]),
				uangIndo($data[$i][kurang])
				);
			$table->addOnclickTd(
				"xajax_buka_langsung_bayar('".$data[$i][kwitansi_id]."')",
				"xajax_buka_langsung_bayar('".$data[$i][kwitansi_id]."')",
				"xajax_buka_langsung_bayar('".$data[$i][kwitansi_id]."')",
				"xajax_buka_langsung_bayar('".$data[$i][kwitansi_id]."')",
				"xajax_buka_langsung_bayar('".$data[$i][kwitansi_id]."')",
				"xajax_buka_langsung_bayar('".$data[$i][kwitansi_id]."')",
				"xajax_buka_langsung_bayar('".$data[$i][kwitansi_id]."')",
				"xajax_buka_langsung_bayar('".$data[$i][kwitansi_id]."')"
			);
		}
		$ret = $table->build();
		$objResponse = new xajaxResponse();
		//$objResponse->addAssign("debug", "innerHTML", $val[semua]);
		$objResponse->addAssign("navi", "innerHTML", $navi);
		$objResponse->addAssign("list_data", "innerHTML", $ret);
		return $objResponse;
	}
Example #27
0
	function buka_list_kunjungan($hal=0, $pasien_id) {
		$paging = new MyPagina;
		$paging->onclick_func = "xajax_buka_list_kunjungan";
		$paging->setOnclickValue("'".$pasien_id."'");
		$paging->rows_on_page = 5;
		$paging->hal = $hal;
		$sql = "
			SELECT 
				CONCAT_WS('-', SUBSTRING(p.id, 1,2), SUBSTRING(p.id, 3,2), SUBSTRING(p.id, 5,2), SUBSTRING(p.id, 7,2)) as no_rm,
				p.nama as nama,
				p.sex as sex,
				k.id as id_kunjungan,
				kk.id as id_kunjungan_kamar,
				k.kunjungan_ke as kunjungan_ke,
				pel.jenis as jenis_pelayanan,
				pel.nama as pelayanan,
				kmr.nama as kamar,
				kk.tgl_periksa as tgl_periksa,
				CONCAT(i.kode_icd,' - ', i.nama) as diagnosa,
				d.nama as dokter
			FROM 
				kunjungan k
				JOIN pasien p ON (p.id = k.pasien_id)
				JOIN kunjungan_kamar kk ON (kk.kunjungan_id = k.id)
				JOIN kamar kmr ON (kmr.id = kk.kamar_id)
				JOIN pelayanan pel ON (pel.id = kmr.pelayanan_id)
				LEFT JOIN icd i ON (i.id = kk.diagnosa_utama_id)
				LEFT JOIN dokter d ON (d.id = kk.dokter_id)
			WHERE
				p.id = '".$pasien_id."'
			GROUP BY
				kk.id
			ORDER BY 
				kk.id
		";
		$paging->sql = $sql;
		$paging->get_page_result();

		$data = $paging->data;
		$no = $paging->start_number();
		$navi = $paging->navi();

		$table = new Table;
		$table->tbody_height = 300;
		$table->addTh(
			"No", 
			"Kunjungan Ke/<br />Tanggal Kunjung", 
			"Pemeriksaan"
		);	
		$table->addExtraTh(
			"style=\"width:30px;\"",
			"style=\"width:90px;\"",
			""
		);
		$kon = new Konek;
		for($i=0;$i<sizeof($data);$i++) {
		
			//get data tindakan
			$kon->sql = "
				SELECT
					kkic.id as kunjungan_tindakan_id,
					ic.id as tindakan_id,
					ic.nama as tindakan_nama
				FROM
					kunjungan_kamar_icopim kkic
					JOIN icopim ic ON (ic.id = kkic.icopim_id)
				WHERE
					kkic.kunjungan_kamar_id = '".$data[$i][id_kunjungan_kamar]."'
				GROUP BY 
					kkic.id
			";
			$kon->execute();
			$data_ic = $kon->getAll();

		
			//get data bhp
			$kon->sql = "
				SELECT
					kkbhp.id as kunjungan_bhp_id,
					bhp.id as bhp_id,
					bhp.nama as bhp_nama
				FROM
					kunjungan_bayar kkbhp
					JOIN bhp ON (bhp.id = kkbhp.bhp_id)
				WHERE
					kkbhp.kunjungan_kamar_id = '".$data[$i][id_kunjungan_kamar]."'
				GROUP BY 
					kkbhp.id
			";
			$kon->execute();
			$data_bhp = $kon->getAll();
			/*
			//get data im
			$kon->sql = "
				SELECT
					kki.id as kunjungan_imunisasi_id,
					im.id as imunisasi_id,
					im.nama as imunisasi_nama
				FROM
					kunjungan_kamar_imunisasi kki
					JOIN imunisasi im ON (im.id = kki.imunisasi_id)
				WHERE
					kki.kunjungan_kamar_id = '".$data[$i][id_kunjungan_kamar]."'
				GROUP BY
					kki.id
			";
			$kon->execute();
			$data_im = $kon->getAll();
			*/
			$pem = "<ul>";
			
			$pem .= "<li><b>Pelayanan :</b> " . $data[$i][jenis_pelayanan] . " - " . $data[$i][kamar] . "</li>";
			$pem .= "<li><b>Dokter :</b> " . (empty($data[$i][dokter])?"-":$data[$i][dokter]) . "</li>";
			$pem .= "<li><b>Diagnosa :</b> " . (empty($data[$i][diagnosa])?"-":"<br />".$data[$i][diagnosa]) . "</li>";
			$pem .= "<li><b>Tindakan :</b> ";
				if(!empty($data_ic)) {
					$pem .= "<ol>";
					for($j=0;$j<sizeof($data_ic);$j++) {
						$pem .= "<li>" . $data_ic[$j][tindakan_nama] . "</li>";
					}
					$pem .= "</ol>";
				} else $pem .= "-";
			$pem .= "</li>";
			$pem .= "<li><b>BHP :</b> ";
				if(!empty($data_bhp)) {
					$pem .= "<ol>";
					for($j=0;$j<sizeof($data_bhp);$j++) {
						$pem .= "<li>" . $data_bhp[$j][bhp_nama] . "</li>";
					}
					$pem .= "</ol>";
				} else $pem .= "-";
			$pem .= "</li>";
			/*
			$pem .= "<li><b>Imunisasi :</b> ";
				if(!empty($data_im)) {
					$pem .= "<ol>";
					for($j=0;$j<sizeof($data_im);$j++) {
						$pem .= "<li>" . $data_im[$j][imunisasi_nama] . "</li>";
					}
					$pem .= "</ol>";
				} else $pem .= "-";
			$pem .= "</li>";
			*/
			$pem .= "</ul>";
			$table->addRow(
				($no+$i), 
				$data[$i][kunjungan_ke] . "<hr />" . tanggalIndo($data[$i][tgl_periksa], 'j M Y'),
				$pem
				);
			/*
			$table->addOnclickTd(
				"xajax_tab_buka_kunjungan('".$data[$i][id_kunjungan_kamar]."')",
				"xajax_tab_buka_kunjungan('".$data[$i][id_kunjungan_kamar]."')",
				"xajax_tab_buka_kunjungan('".$data[$i][id_kunjungan_kamar]."')"
			);
			*/
		}
		$ret = $table->build();
		$objResponse = new xajaxResponse();
		//$objResponse->addAssign("debug", "innerHTML", $sql);
		$objResponse->addAssign("modal_list_kunjungan", "style.display", "");
		$objResponse->addAssign("tab_list_semua_kunjungan_navi", "innerHTML", $navi);
		$objResponse->addAssign("mlk_no_rm", "innerHTML", $data[0][no_rm]);
		$objResponse->addAssign("mlk_nama", "innerHTML", $data[0][nama]);
		$objResponse->addAssign("mlk_sex", "innerHTML", $data[0][sex]);
		$objResponse->addAssign("tab_list_semua_kunjungan", "innerHTML", $ret);
		$objResponse->addScriptCall("disable_mainbar", "#E5E6E1");
		return $objResponse;
	}
	function get_pasien($val) {
		$tgl_start = @date("Y-m-d", @mktime(1,1,1,$val[tgl_periksa_bln_start], $val[tgl_periksa_tgl_start], $val[tgl_periksa_thn_start]));
		$tgl_end = @date("Y-m-d", @mktime(1,1,1,$val[tgl_periksa_bln_end], $val[tgl_periksa_tgl_end], $val[tgl_periksa_thn_end]));
		
		$title = "Statistik Kunjungan Berdasar Keadaan Keluar";
		
		unset($_SESSION[rekmed][statistik_kunjungan_semua_keadaan_keluar]);

		$kon = new Konek;
		if($val[jangka_waktu] == "hari") {
			$tanggal_awal = tanggalIndo($tgl_start, "j F Y");
			$tanggal_akhir = tanggalIndo($tgl_end, "j F Y");
			$_q .= "AND DATE(kk.tgl_daftar) BETWEEN '" . $tgl_start . "' AND '" . $tgl_end . "'";
		} elseif($val[jangka_waktu] == "bulan") {
			$tanggal_awal = tanggalIndo($tgl_start, "F Y");
			$tanggal_akhir = tanggalIndo($tgl_end, "F Y");
			$_q .= "AND EXTRACT(YEAR_MONTH FROM kk.tgl_daftar) BETWEEN EXTRACT(YEAR_MONTH FROM '" . $tgl_start . "') AND EXTRACT(YEAR_MONTH FROM '" . $tgl_end . "')";
		} else {
			$tanggal_awal = tanggalIndo($tgl_start, "Y");
			$tanggal_akhir = tanggalIndo($tgl_end, "Y");
			$_q .= "AND YEAR(kk.tgl_daftar) BETWEEN YEAR('" . $tgl_start . "') AND YEAR ('" . $tgl_end . "')";
		}

		$title .= "\nPeriode " . $tanggal_awal . " s.d. " . $tanggal_akhir;
		$_SESSION[rekmed][statistik_kunjungan_semua_keadaan_keluar][title] = $title;
		$sql = "
			SELECT
				k.keadaan_keluar as nama,
				COUNT(k.id) as jml
			FROM
				kunjungan k
				JOIN kunjungan_kamar kk ON (kk.kunjungan_id = k.id)
			WHERE
				keadaan_keluar IS NOT NULL
				$_q
			GROUP BY
				1
			ORDER BY 1
		";
		$kon->sql = $sql;
		$kon->execute();
		$data = $kon->getAll();
		$objResponse = new xajaxResponse();
		//$objResponse->addAssign("debug", "innerHTML", $sql);
		$table = new Table;
		$table->scroll = false;
		$table->addTh("No", "Keadaan Keluar", "Jumlah", "%");
		$table->addExtraTh(
			"style=\"width:50px\"",
			"style=\"width:200px\"",
			"",
			"style=\"width:70px\""
		);
		$table->addTh("1", "2", "3", "4");
		for($i=0;$i<sizeof($data);$i++) {
			$total = $total+$data[$i][jml];
		}
		for($i=0;$i<sizeof($data);$i++) {
			$persen = round($data[$i][jml]/$total * 100, 2);
			$table->addRow(($i+1), $data[$i][nama], $data[$i][jml], $persen);

			$_SESSION[rekmed][statistik_kunjungan_semua_keadaan_keluar][no][$i] = ($i+1);
			$_SESSION[rekmed][statistik_kunjungan_semua_keadaan_keluar][nama][$i] = $data[$i][nama];
			$_SESSION[rekmed][statistik_kunjungan_semua_keadaan_keluar][jml][$i] = $data[$i][jml];
			$_SESSION[rekmed][statistik_kunjungan_semua_keadaan_keluar][persen][$i] = $persen;
			$persen_total += $persen;
		}
		$_SESSION[rekmed][statistik_kunjungan_semua_keadaan_keluar][total] = $total;
		$_SESSION[rekmed][statistik_kunjungan_semua_keadaan_keluar][persen_total] = round($persen_total);
		$table->addRow("", "<b>Total</b>", $_SESSION[rekmed][statistik_kunjungan_semua_keadaan_keluar][total], $_SESSION[rekmed][statistik_kunjungan_semua_keadaan_keluar][persen_total]);
		$ret = $table->build();
		if(empty($_SESSION[rekmed][statistik_kunjungan_semua_keadaan_keluar][jml])) $_SESSION[rekmed][statistik_kunjungan_semua_keadaan_keluar][jml][0] = 1;
		if(empty($_SESSION[rekmed][statistik_kunjungan_semua_keadaan_keluar][nama]))	$_SESSION[rekmed][statistik_kunjungan_semua_keadaan_keluar][nama][0] = "No Data";
		

		$objResponse->addAssign("list_data", "innerHTML", $ret);
		$objResponse->addAssign("title", "innerHTML", nl2br($_SESSION[rekmed][statistik_kunjungan_semua_keadaan_keluar][title]));
		$_SESSION[rekmed][statistik_kunjungan_semua_keadaan_keluar][graph] = "<img src=\"" . URL . "rekmed/statistik_kunjungan_semua_keadaan_keluar_graph_pie/?md5=".md5(date("Ymdhis"))."\" alt=\"Pasien\" />";
		$objResponse->addAssign("graph", "innerHTML", $_SESSION[rekmed][statistik_kunjungan_semua_keadaan_keluar][graph]);
		return $objResponse;
	}
	function get_pasien($val) {
		$tgl_start = @date("Y-m-d", @mktime(1,1,1,$val[tgl_periksa_bln_start], $val[tgl_periksa_tgl_start], $val[tgl_periksa_thn_start]));
		$tgl_end = @date("Y-m-d", @mktime(1,1,1,$val[tgl_periksa_bln_end], $val[tgl_periksa_tgl_end], $val[tgl_periksa_thn_end]));
		
		$title = "Distribusi Pasien Menurut Pekerjaan";
		
		unset($_SESSION[rekmed][statistik_pasien_semua_pekerjaan]);

		$kon = new Konek;
		if($val[jangka_waktu] == "hari") {
			$tanggal_awal = tanggalIndo($tgl_start, "j F Y");
			$tanggal_akhir = tanggalIndo($tgl_end, "j F Y");
			$_q .= "AND DATE(p.tgl_daftar) BETWEEN '" . $tgl_start . "' AND '" . $tgl_end . "'";
		} elseif($val[jangka_waktu] == "bulan") {
			$tanggal_awal = tanggalIndo($tgl_start, "F Y");
			$tanggal_akhir = tanggalIndo($tgl_end, "F Y");
			$_q .= "AND EXTRACT(YEAR_MONTH FROM p.tgl_daftar) BETWEEN EXTRACT(YEAR_MONTH FROM '" . $tgl_start . "') AND EXTRACT(YEAR_MONTH FROM '" . $tgl_end . "')";
		} else {
			$tanggal_awal = tanggalIndo($tgl_start, "Y");
			$tanggal_akhir = tanggalIndo($tgl_end, "Y");
			$_q .= "AND YEAR(p.tgl_daftar) BETWEEN YEAR('" . $tgl_start . "') AND YEAR ('" . $tgl_end . "')";
		}

		$title .= "\nPeriode " . $tanggal_awal . " s.d. " . $tanggal_akhir;
		$_SESSION[rekmed][statistik_pasien_semua_pekerjaan][title] = $title;
		$sql = "
			SELECT
				rp.id as id,
				rp.nama as nama,
				COUNT(p.id) as jml
			FROM
				ref_pekerjaan rp
				JOIN pasien p ON (p.pekerjaan_id = rp.id)
			WHERE
				1=1
				$_q
			GROUP BY
				rp.id
			ORDER BY 3 DESC
		";
		$kon->sql = $sql;
		$kon->execute();
		$data = $kon->getAll();
		$objResponse = new xajaxResponse();
		//$objResponse->addAssign("debug", "innerHTML", $sql);
		$table = new Table;
		$table->scroll = false;
		$table->addTh("No", "Pekerjaan", "Jumlah", "%");
		$table->addExtraTh(
			"style=\"width:50px\"",
			"style=\"width:200px\"",
			"",
			"style=\"width:70px\""
		);
		$table->addTh("1", "2", "3", "4");
		for($i=0;$i<sizeof($data);$i++) {
			$total = $total+$data[$i][jml];
		}
		for($i=0;$i<sizeof($data);$i++) {
			$persen = round($data[$i][jml]/$total * 100, 2);
			$table->addRow(($i+1), $data[$i][nama], $data[$i][jml], $persen);
			$table->addOnclickTd(
				"xajax_list_pasien('0', '".$data[$i][id]."', xajax.getFormValues('statistik_pasien_semua_pekerjaan'))", 
				"xajax_list_pasien('0', '".$data[$i][id]."', xajax.getFormValues('statistik_pasien_semua_pekerjaan'))", 
				"xajax_list_pasien('0', '".$data[$i][id]."', xajax.getFormValues('statistik_pasien_semua_pekerjaan'))", 
				"xajax_list_pasien('0', '".$data[$i][id]."', xajax.getFormValues('statistik_pasien_semua_pekerjaan'))");

			$_SESSION[rekmed][statistik_pasien_semua_pekerjaan][no][$i] = ($i+1);
			$_SESSION[rekmed][statistik_pasien_semua_pekerjaan][nama][$i] = $data[$i][nama];
			$_SESSION[rekmed][statistik_pasien_semua_pekerjaan][jml][$i] = $data[$i][jml];
			$_SESSION[rekmed][statistik_pasien_semua_pekerjaan][persen][$i] = $persen;
			$persen_total += $persen;
		}
		$_SESSION[rekmed][statistik_pasien_semua_pekerjaan][total] = $total;
		$_SESSION[rekmed][statistik_pasien_semua_pekerjaan][persen_total] = round($persen_total);
		$table->addRow("", "<b>Total</b>", $_SESSION[rekmed][statistik_pasien_semua_pekerjaan][total], $_SESSION[rekmed][statistik_pasien_semua_pekerjaan][persen_total]);
		$ret = $table->build();
		if(empty($_SESSION[rekmed][statistik_pasien_semua_pekerjaan][jml])) $_SESSION[rekmed][statistik_pasien_semua_pekerjaan][jml][0] = 1;
		if(empty($_SESSION[rekmed][statistik_pasien_semua_pekerjaan][nama]))	$_SESSION[rekmed][statistik_pasien_semua_pekerjaan][nama][0] = "No Data";
		

		$objResponse->addAssign("list_data", "innerHTML", $ret);
		$objResponse->addAssign("title", "innerHTML", nl2br($_SESSION[rekmed][statistik_pasien_semua_pekerjaan][title]));
		$_SESSION[rekmed][statistik_pasien_semua_pekerjaan][graph] = "<img src=\"" . URL . "rekmed/statistik_pasien_semua_pekerjaan_graph_pie/?md5=".md5(date("Ymdhis"))."\" alt=\"Pasien\" />";
		$objResponse->addAssign("graph", "innerHTML", $_SESSION[rekmed][statistik_pasien_semua_pekerjaan][graph]);
		return $objResponse;
	}
Example #30
0
	function list_data($hal = 0) {
		$paging = new MyPagina;
		$paging->sql = "
			SELECT 
				k.id as id, 
				pel.id as pelid,
				pel.nama as pel,
				k.nama as nama,
				k.jml_bed as jml_bed,
				k.kelas as kelas,
                k.tarif_umum as tarif_umum, k.tarif_asuransi
			FROM 
				pelayanan pel
				JOIN kamar k ON (k.pelayanan_id = pel.id)
			WHERE
				pel.jenis = 'RAWAT INAP'
			ORDER BY pel.nama, k.kelas, k.nama";
		$paging->rows_on_page = 15;
		$paging->hal = $hal;
		$_SESSION[modul_setting][kamar][hal] = $hal;
		$paging->get_page_result();

		$data = $paging->data;
		$no = $paging->start_number();
		$navi = $paging->navi();

		$table = new Table;
		$table->tbody_height = 350;
		$table->addTh(
			"No", 
			"Nama Bangsal", 
			"Kamar", 
			"Kelas",
			"Jml<br />TT", 
            "Tarif Umum",
            "Tarif asuransi",
			"Hapus"
		);
		$table->addExtraTh("style=\"width:50px;\"","style=\"width:200px;\"","","","","","","style=\"width:70px;\"");
		$kon = new Konek;
		for($i=0;$i<sizeof($data);$i++) {
			if($data[$i][pelid] == $data[$i-1][pelid])
				$pel = "";
			else {
				$kon->sql = "SELECT SUM(jml_bed) as jml FROM kamar WHERE pelayanan_id = '".$data[$i][pelid]."'";
				$kon->execute();
				$tt = $kon->getOne();
				$pel = "<b>" . $data[$i][pel] . "</b>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[" . $tt[jml] . " tt]";
			}
			$table->addRow(
				($no+$i), 
				$pel, 
				$data[$i][nama],
				$data[$i][kelas], 
				$data[$i][jml_bed],"<align=right>".number_format($data[$i][tarif_umum]),number_format($data[$i][tarif_asuransi]), 
				"<a href=\"javascript:void(0)\" title=\"Hapus\" onclick=\"hapus_kamar('".$data[$i][id]."', this)\" class=\"tombol_hapus\"><img src=\"".IMAGES_URL."remove.png\" alt=\"Hapus\" border=\"0\" /></a>"
			);
			$table->addOnclickTd(
				"xajax_get_kamar('".$data[$i][id]."')", 
				"xajax_get_kamar('".$data[$i][id]."')", 
				"xajax_get_kamar('".$data[$i][id]."')", 
				"xajax_get_kamar('".$data[$i][id]."')", 
				"xajax_get_kamar('".$data[$i][id]."')"
			);
		}
		$ret = $table->build();
		$objResponse = new xajaxResponse();
		$objResponse->addAssign("navi", "innerHTML", $navi);
		$objResponse->addAssign("list_data", "innerHTML", $ret);
		return $objResponse;
	}