<?php
mysql_connect("dbhost", "dbuser", "dbpassword");
mysql_select_db("dbname");
$bagianWhere = "";
if (isset($_POST['nimCat']))
{
$nim = $_POST['nim'];
if (empty($bagianWhere))
{
$bagianWhere .= "nim = '$nim'";
}
}
if (isset($_POST['namaCat']))
{
$namamhs = $_POST['nama'];
if (empty($bagianWhere))
{
$bagianWhere .= "namamhs LIKE '%$namamhs%'";
}
else
{
$bagianWhere .= " AND namamhs LIKE '%$namamhs%'";
}
}
if (isset($_POST['alamatCat']))
{
$alamat = $_POST['alamat'];
if (empty($bagianWhere))
{
$bagianWhere .= "alamat LIKE '%$alamat%'";
}
else
{
$bagianWhere .= " AND alamat LIKE '%$alamat%'";
}
}
if (isset($_POST['sexCat']))
{
$sex = $_POST['sex'];
if (empty($bagianWhere))
{
$bagianWhere .= "sex = '$sex'";
}
else
{
$bagianWhere .= " AND sex = '$sex'";
}
}
$query = "SELECT * FROM mhs WHERE ".$bagianWhere;
$hasil = mysql_query($query);
echo "<table border='1'>";
echo "<tr><td>NIM</td><td>Nama Mahasiswa</td><td>Alamat</td><td>Jenis Kelamin</td></tr>";
while ($data = mysql_fetch_array($hasil))
{
echo "<tr><td>".$data['nim']."</td><td>".$data['namamhs']."</td><td>".$data['alamat']."</td><td>".$data['sex']."</td></tr>";
}
echo "</table>";
?>
<h1>Cari Data Mahasiswa</h1>
<p>Pilih kategori pencarian</p>
<form method="post" action="proses.php">
<table>
<tr><td><input type="checkbox" name="nimCat"> NIM</td><td><input type="text" name="nim"></td></tr>
<tr><td><input type="checkbox" name="namaCat"> Nama Mahasiswa</td><td><input type="text" name="nama"></td></tr>
<tr><td><input type="checkbox" name="alamatCat"> Alamat</td><td><input type="text" name="alamat"></td></tr>
<tr><td><input type="checkbox" name="sexCat"> Jenis Kelamin</td><td><input type="radio" name="sex" value="L"> Laki-Laki <input type="radio" name="sex" value="P"> Perempuan</td></tr>
<tr><td></td><td><input type="submit" name="submit" value="Submit"></td></tr>
</table>
</form>
elseif($_GET[act]=="terbaru"){
?>
<div class="table-header">
DATA PESANAN TERBARU
</div>
<div class="row-fluid">
<table id="myTable" class="table table-striped table-bordered table-hover">
<thead>
<tr>
<th class="center" width="85px">No Invoice</th>
<th class="center" width="90px">Tanggal</th>
<th class="center" width="100px">Nama Petugas</th>
<th class="center" width="85px">Berat Total</th>
<th class="center" width="85px">Total Harga</th>
<th class="center" width="120px">Nama Konsultan</th>
<th class="center" width="150px">Nama Jalan</th>
<th class="center" width="85px">Nama Kurir</th>
<th class="center" width="100px">Status</th>
<th class="hidden-480 center" width="75px">Aksi</th>
</tr>
</thead>
<tbody>
<?php
$qry = mysql_query("SELECT a.*, b.nama_konsultan, c.nama, d.nama_jalan, e.nama_kurir FROM invoice a LEFT JOIN konsultan b ON a.id_konsultan=b.id_konsultan LEFT JOIN user c ON a.id_user=c.id_user LEFT JOIN jalan d ON a.id_jalan=d.id_jalan LEFT JOIN kurir e ON a.id_kurir=e.id_kurir WHERE a.status =1 AND a.tanggal='$now' and a.id_kurir=$uUser ORDER BY a.no_invoice ASC");
$hitmax = mysql_num_rows(qry);
while ($d = mysql_fetch_array($qry)){
$angka = getValue("total_biaya","invoice","no_invoice='$d[no_invoice]'");
$rp = rupiah($angka);
$brt = getValue("total_berat","invoice","no_invoice='$d[no_invoice]'");
$br = berat($brt);
$petugas = getValue("nama","user","id_user='$d[no_invoice]'");
$konsultan = getValue("nama_konsultan","konsultan","id_konsultan='$d[no_invoice]'");
$jalan = getValue("nama_jalan","jalan","id_jalan='$d[no_invoice]'");
$kurir = getValue("nama_kurir","kurir","id_kurir='$d[no_invoice]'");
$tgl = getTglIndo($d[tanggal]);
$arStt = array(
'1' => "<div class='btn btn-mini btn-yellow'> Prepare <i class='icon-refresh'></i> </div>",
'2' => "<div class='btn btn-mini btn-info'> On Proccess <i class='icon-gift'> </i></div>",
'3' => "<div class='btn btn-mini btn-success'> Delivered <i class='icon-ok'></i> </div>",
'4' => "<div class='btn btn-mini btn-danger'> Return <i class='icon-ban-circle'></i> </div>",
);
$ptA = $d['status'];
$stAktif = $arStt[$ptA];
?>
<script>
function new_win(clicked_id)
{
window.open("infoinvoice.php?noinv="+clicked_id+"","mywin","width=1000,height=500,screenX=50,left=50,screenY=50,top=50,status=yes,menubar=yes");
}
</script>
<tr>
<?php
$no++;
echo "
<td class='center'><a href='#' id='$d[no_invoice]' onClick='new_win(this.id)'>$d[no_invoice]</a></td>
<td class='center'>$tgl</td>
<td class='center'>$d[nama]</td>
<td class='center'><b>$rp</b></td>
<td class='center'><b>$br</b></td>
<td class='center'>$d[nama_konsultan]</td>
<td class='center'>$d[nama_jalan]</td>
<td class='center'>$d[nama_kurir]</td>
<td class='center'>$stAktif</td>
<td class='center'>
<div class='inline position-relative'>
<button class='btn btn-mini btn-primary dropdown-toggle' data-toggle='dropdown' data-rel='tooltip' data-original-title='Aksi'><i class='icon-cog icon-only bigger-110'></i></button>
<ul class='dropdown-menu dropdown-icon-only dropdown-yellow pull-right dropdown-caret dropdown-close'>
<li><a href='?page=$page&act=3&id=$d[no_invoice]' class='tooltip-success' data-rel='tooltip' data-original-title='Delivered'>
<span class='green'><i class='icon-refresh bigger-120'></i></span>
</a>
</li>
</ul>
</div></td>";
?>
</tr>
<?php
}
?>
</tbody>
</table>
</div>
<form>
<table>
<tr>
<td><input name="txtname" type="text" value="Your Name"></td>
</tr>
<tr>
<td><input name="txtcom" type="text" value="Company"></td>
</tr>
<tr>
<td><input name="txtweb" type="text" value="Website"></td>
</tr>
<tr>
<td><input name="txtphone" type="text" value="Phone Number"></td>
</tr>
<tr>
<td><input name="txtemail" type="text" value="Your Email"></td>
</tr>
<tr>
<td><textarea cols="30" name="txtmessage" rows="10"></textarea></td>
</tr>
<tr>
<td><input type="submit" value="Submit"></td>
</tr>
</table>
</form>
<?php
include "../../koneksi.php";
$term = $_GET['term'];
$sql = "SELECT * FROM tb_pasien WHERE nomor_rekam_medis LIKE '%".$term."%'";
$hs = mysql_query($sql);
$json = array();
while($data = mysql_fetch_array($hs)){
$json[] = array(
'label' => $data['nomor_rekam_medis'] ." - ". $data['nama_pasien'],
'value' => $data['nomor_rekam_medis'],
'nama_pasien' => $data['nama_pasien'],
'jenis_kelamin_pasien' => $data['jenis_kelamin_pasien']
);
}
header("Content-Type: application/json");
echo json_encode($json);
?>
<?php
$aksi="module/transaksi_pasien/transaksi_pasien_aksi.php";
switch(isset($_GET["aksi"]) ? $_GET["aksi"] :'"'){
default:
?>
<hr/>
<div class="box box-solid box-primary">
<div class="box-header">
<h3 class="btn btn disabled box-title">
<i class="fa fa-user-md"></i>
Data Pasien </h3>
<a class="btn btn-primary pull-right" href="?module=transaksi_pasien&aksi=tambah">
<i class="fa fa-plus"></i> Tambah Data</a>
</div>
<div class="box-body">
<table id="example1" class="table table-bordered table-striped">
<thead>
<tr class="text-blue">
<th>TGL/JAM INPUT</th>
<th>MR</th>
<th>NAMA PASIEN</th>
<th>JK</th>
<th>NAMA POLI</th>
<th>NAMA BAGIAN</th>
<th>AKSI</th>
</tr>
</thead>
<tbody>
<?php
$sql = "SELECT * FROM tb_pasien a, tb_distribusi b, tb_poli c, tb_bagian d where a.id_pasien=b.id_pasien AND b.id_poli=c.id_poli AND b.id_bagian=d.id_bagian AND status_distribusi='TERIMA' order by tanggal_input DESC";
$tampil = mysql_query($sql);
$no=1;
while ($data = mysql_fetch_array($tampil)) {
$Kode = $data['nomor_rekam_medis'];?>
<tr>
<td><?php echo date('d-m-Y', strtotime($data['tanggal_input'])) .", ". $data['jam_input']; ?></td>
<td><?php echo $data['nomor_rekam_medis']; ?></td>
<td><?php echo $data['nama_pasien']; ?></td>
<td><?php echo $data['jenis_kelamin_pasien']; ?></td>
<td><?php echo $data['poli']; ?></td>
<td><?php echo $data['bagian']; ?></td>
<td align="center"> |
<a class="fa fa-pencil-square-o edit" data-toggle="tooltip" title="Edit Data <?php echo $data['id_pasien'];?>" href="?module=transaksi_pasien&aksi=edit&id_pasien=<?php echo $data['id_pasien'];?>"></a> |
<a class="fa fa-trash hapus" data-toggle="tooltip" title="Hapus Semua Data pasien" href="<?php echo $aksi ?>?module=transaksi_pasien&aksi=hapus&id_distribusi=<?php echo $data['id_distribusi'];?>"></a> |
<a class="fa fa-motorcycle beset" data-toggle="tooltip" title="Antar <?php echo $data['id_pasien'];?>" href="?module=transaksi_antar&aksi=edit&id_pasien=<?php echo $data['id_pasien'];?>"></i></a> |
<a class="fa fa-undo kembali" data-toggle="tooltip" title="Kembali <?php echo $data['id_pasien'];?>" href="?module=transaksi_kembali&aksi=edit&id_pasien=<?php echo $data['id_pasien'];?>"></i></a> |
<a class="fa fa-bed beset" data-toggle="tooltip" title="Rawat <?php echo $data['id_pasien'];?>" href="?module=transaksi_rawat&aksi=edit1&id_pasien=<?php echo $data['id_pasien'];?>"></i></a> |
</td>
<?php
}
?>
</tr>
</tbody>
</table>
</div>
</div>
<?php
break;
case "tambah":
?>
<form class="form-horizontal" role="form" method="post" action="<?php echo $aksi?>?module=transaksi_pasien&aksi=tambah" >
<div class="row">
<div class="col-md-12">
<div class="box box-success">
<div class="box-header with-border">
<h3 class="box-title">DATA PASIEN</h3>
<div class="box-tools pull-right">
<button class="btn btn-box-tool" data-widget="collapse"><i class="fa fa-minus"></i></button>
<button class="btn btn-box-tool" data-widget="remove"><i class="fa fa-times"></i></button>
</div>
</div>
<div class="box-body">
<form class="form-horizontal" action="<?php echo $aksi?>?module=kelas&aksi=tambah" role="form" method="post">
<div class="form-group">
<label class="col-sm-4 control-label">Tanggal Register</label>
<div><div class="col-sm-2">
<?php
date_default_timezone_set("Asia/Jakarta");
$jam_input = date("H:i:s");
$tanggal_input = date("d-m-Y");
?>
<input type="text" class="form-control" readonly name="jam_input" value="<?php echo"$jam_input";?>">
</div>
<div class="col-sm-2">
<div class="input-group">
<div class="input-group-addon">
<i class="fa fa-calendar"> </i>
</div>
<input type="text" class="form-control" readonly name="tanggal_input" value="<?php echo date('d-m-Y');?>">
</div><!-- /.input group -->
</div></div>
</div>
<div class="form-group">
<label class="col-sm-4 control-label">Rekam Medis</label>
<div class="col-sm-2">
<input type="text" autofocus required class="form-control" data-toggle="tooltip" title="Nomor Rekam Medis" onkeypress="return hanyaAngka(event)" required="required" name="nomor_rekam_medis" id="nomor_rekam_medis" placeholder="Nomor Rekam Medis" maxlength="6">
</div>
</div>
<div class="form-group">
<label class="col-sm-4 control-label">Nama Pasien</label>
<div class="col-sm-4">
<input type="text" class="form-control" data-toggle="tooltip" title="Nama Pasien" required="required" name="nama_pasien" id="nama_pasien" placeholder="Nama Pasien">
<input type="text" class="form-control" data-toggle="tooltip" title="Nama Pasien" required="required" name="jenis_kelamin_pasien" id="jenis_kelamin_pasien" placeholder="Nama Pasien">
</div>
</div>
<div class="form-group">
<label class="col-sm-4 control-label">Jenis Kelamin</label>
<div class="col-sm-4">
<input name="jenis_kelamin_pasien" type="radio" value="LAKI-LAKI" checked id="jenis_kelamin_pasien"> LAKI-LAKI
<input name="jenis_kelamin_pasien" type="radio" value="PEREMPUAN" id="jenis_kelamin_pasien"> PEREMPUAN
</div>
</div>
<div class="form-group">
<label class="col-sm-4 control-label">Nama Poli</label>
<div class="col-sm-3">
<select name="id_poli" id="poli" class="form-control">
<option value=" "> -- Pilih Poli -- </option>
<?php
$sondang=mysql_query("select * from tb_poli");
while($b=mysql_fetch_array($sondang)){
?>
<option value="<?php echo $b['id_poli']; ?>"><?php echo $b['poli'] ?></option>
<?php
}
?>
</select>
</div>
</div>
<div class="form-group">
<label class="col-sm-4 control-label">Nama Bagian</label>
<div class="col-sm-3">
<select name="id_bagian" id="bagian" class="form-control">
<option value=" "> -- Pilih Bagian -- </option>
<?php
$sondang=mysql_query("select * from tb_bagian");
while($b=mysql_fetch_array($sondang)){
?>
<option value="<?php echo $b['id_bagian']; ?>"><?php echo $b['bagian'] ?></option>
<?php
}
?>
</select>
</div>
</div>
<div class="form-group">
<label class="col-sm-4"></label>
<div class="col-sm-5">
<button type="submit"name="submit" class="btn btn-primary" onclick="sweet()"><i class="glyphicon glyphicon-floppy-disk"></i> Simpan</button>
<button type="reset" class="btn btn-danger"><i class="fa fa-refresh"></i><i> Batal</i></button>
<button type="button" class="btn btn-danger" onclick="history.back(-1)"><i class="glyphicon glyphicon-arrow-left"></i> Back</button>
</div>
</div>
</div>
</div>
</div>
<?php
break;
case "edit":
$data=mysql_query("SELECT * FROM tb_pasien a, tb_distribusi b, tb_poli c, tb_bagian d where a.id_pasien=b.id_pasien AND b.id_poli=c.id_poli AND b.id_bagian=d.id_bagian AND a.id_pasien='$_GET[id_pasien]'");
$edit=mysql_fetch_array($data);
?>
<form class="form-horizontal" action="<?php echo $aksi?>?module=transaksi_pasien&aksi=edit" role="form" method="post">
<div class="row">
<div class="col-md-12">
<div class="box box-success">
<div class="box-header with-border">
<h3 class="box-title">Data Pasien</h3>
<div class="box-tools pull-right">
<button class="btn btn-box-tool" data-widget="collapse"><i class="fa fa-minus"></i></button>
<button class="btn btn-box-tool" data-widget="remove"><i class="fa fa-times"></i></button>
</div>
</div>
<div class="box-body">
<form class="form-horizontal" action="<?php echo $aksi?>?module=transaksi_pasien&aksi=edit" role="form" method="post">
<div class="form-group">
<label class="col-sm-3 control-label">Tanggal Register</label>
<div><div class="col-sm-3">
<?php
date_default_timezone_set("Asia/Jakarta");
$jam_input = date("H:i:s");
?>
<input type="text" class="form-control" readonly name="jam_input" value="<?php echo"$jam_input";?>">
</div>
<div class="col-sm-5">
<div class="input-group">
<div class="input-group-addon">
<i class="fa fa-calendar"> </i>
</div>
<input type="text" class="form-control" required="required" data-toggle="tooltip" name="tanggal_input" id="tanggal_input" value="<?php echo $edit['tanggal_input'];?>">
</div><!-- /.input group -->
</div></div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">Rekam Medis</label>
<div class="col-sm-8">
<input type="hidden" class="form-control" readonly name="id_pasien" value="<?php echo $_GET['id_pasien']; ?>">
<input type="text" class="form-control" required="required" name="nomor_rekam_medis"value="<?php echo $edit['nomor_rekam_medis']; ?>">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">Nama Pasien</label>
<div class="col-sm-8">
<input type="text" class="form-control" required="required" name="nama_pasien"value="<?php echo $edit['nama_pasien']; ?>">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">Jenis Kelamin</label>
<div class="col-sm-8">
<input class="minimal" name="jenis_kelamin_pasien" type="radio" value="LAKI-LAKI" <?php if(($edit['jenis_kelamin_pasien'])== "LAKI-LAKI")
{echo "checked=\"checked\"";};?>/> LAKI-LAKI
<input class="minimal" name="jenis_kelamin_pasien" type="radio" value="PEREMPUAN" <?php if(($edit['jenis_kelamin_pasien'])== "PEREMPUAN")
{echo "checked=\"checked\"";};?>/> PEREMPUAN
</div></div>
<div class="form-group">
<label class="col-sm-3 control-label">Poli</label>
<div class="col-sm-8">
<select name="id_poli" id="poli" class="form-control">
<?php
$cur_poli=$edit['id_poli'];
$q=mysql_query("select * from tb_poli");
while($row=mysql_fetch_array($q)){
$selected='';
if($row['id_poli']==$cur_poli){$selected='selected';}else{$selected='';}
echo "<option value='".$row['id_poli']."' ".$selected.">". $row['id_poli']." / ".$row['poli']."</option>";
?>
<?php }?>
</select>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">Bagian</label>
<div class="col-sm-8">
<select name="id_bagian" id="bagian" class="form-control">
<?php
$cur_bagian=$edit['id_bagian'];
$q=mysql_query("select * from tb_bagian");
while($row=mysql_fetch_array($q)){
$selected='';
if($row['id_bagian']==$cur_bagian){$selected='selected';}else{$selected='';}
echo "<option value='".$row['id_bagian']."' ".$selected.">". $row['id_bagian']." / ".$row['bagian']."</option>";
?>
<?php }?>
</select>
</div>
</div>
<div class="form-group">
<label class="col-sm-4"></label>
<div class="col-sm-7">
<button type="submit"name="submit" class="btn btn-primary" onclick="sweet()"><i class="glyphicon glyphicon-floppy-disk"></i> Simpan</button>
<input type="reset" class="btn btn-warning" value="Batal" onclick="window.history.back();">
</div>
</div>
</div>
<div id="yyy" style="min-width: 400px; height: 400px; margin: 0 auto"></div>
</div></div>
</div></div>
<?php
break;
}
?>
<!--<script src="../aset/plugins/jQuery/jq.js"></script> -->
<link rel="stylesheet" href="../aset/plugins/jQuery/jquery-ui-1.10.3.custom.css" type="text/css" media="" />
<script src="../aset/plugins/jquery/jquery-2.2.4.min.js" type="text/javascript"></script>
<script src="../aset/plugins/jQuery/jquery-ui-1.10.3.custom.min.js"></script>
<script src="../aset/dist/js/bootstrap.min.js" type="text/javascript"></script>
<script>
function hanyaAngka(evt) {
var charCode = (evt.which) ? evt.which : event.keyCode
if (charCode > 31 && (charCode < 48 || charCode > 57))
return false;
return true;
}
</script>
<script>
$(document).ready(function () {
$("#poli").select2({
placeholder: "--Pilih Poli--",
theme: "bootstrap"
});
});
$(document).ready(function () {
$("#id_unit").select2({
placeholder: "Pilih Bagian",
theme: "bootstrap"
});
});
$(document).ready(function () {
$("#bagian").select2({
placeholder: "--Pilih Bagian--",
theme: "bootstrap"
});
});
$(document).ready(function () {
$("#pendidikan").select2({
placeholder: "Please Select",
theme: "bootstrap"
});
});
$(document).ready(function () {
$("#pekerjaan").select2({
placeholder: "Please Select",
theme: "bootstrap"
});
});
$(document).ready(function () {
$("#status_nikah").select2({
placeholder: "Please Select",
theme: "bootstrap"
});
});
$(document).ready(function () {
$("#unit").select2({
placeholder: "Please Select",
theme: "bootstrap"
});
});
$(document).ready(function () {
$("#agama").select2({
placeholder: "Please Select",
theme: "bootstrap"
});
});
</script>
<script>
var $jnoc = jQuery.noConflict();
$jnoc(function() {
$jnoc( "#nomor_rekam_medis" ).autocomplete({
source: "module/transaksi_pasien/load_data.php",
minLength: 2,
select: function( event, ui ) {
$jnoc('#nama_pasien').val(ui.item.nama_pasien);
$jnoc('#jenis_kelamin_pasien').val(ui.item.jenis_kelamin_pasien);
}
});
});
</script>