181 lines
7.2 KiB
PHP
181 lines
7.2 KiB
PHP
<?php
|
|
include("../core/main.php");
|
|
require _DOCROOT_.'vendor/autoload.php';
|
|
use \Verot\Upload\Upload;
|
|
|
|
ini_set('upload_max_filesize', '8M');
|
|
ini_set('memory_limit', '1024M');
|
|
|
|
function file_save($file,$nomr,$noktp,$jenis){
|
|
|
|
// handle upload
|
|
$handle = new upload($file);
|
|
$handle->file_max_size = '8M';
|
|
$handle->file_new_name_body = $nomr.'_'.$jenis.'_'.$noktp;
|
|
$handle->allowed = array('application/pdf','image/jpeg','image/png');
|
|
if ($handle->uploaded) {
|
|
$base_upload_dir = '../dokumen/';
|
|
$nomr_dir = makeDir($base_upload_dir.$nomr.'/',0777);
|
|
$date_dir = makeDir($base_upload_dir.$nomr.'/'.date('Ymd'),0777);
|
|
|
|
$handle->process($base_upload_dir.$nomr.'/'.date('Ymd').'/');
|
|
if ($handle->processed) {
|
|
$handle->clean();
|
|
// dd("Name : ".$handle->file_dst_name);
|
|
return $handle->file_dst_pathname;
|
|
} else {
|
|
return $handle->error;
|
|
}
|
|
}
|
|
else {
|
|
return false;
|
|
}
|
|
|
|
}
|
|
|
|
$_SESSION['hal']="2";
|
|
$nomr=$_POST['NOMRKEY'];
|
|
if($_GET['edit']=="ok"){
|
|
if(empty($_POST['PENDIDIKAN'])){
|
|
$pendidikan = "NULL";
|
|
}else{
|
|
$pendidikan = $_POST['PENDIDIKAN'];
|
|
}
|
|
if(empty($_POST['AGAMA'])){
|
|
$agama = "NULL";
|
|
}else{
|
|
$agama = $_POST['AGAMA'];
|
|
}
|
|
if(empty($_POST['STATUS'])){
|
|
$status = "NULL";
|
|
}else{
|
|
$status = $_POST['STATUS'];
|
|
}
|
|
|
|
$m_provinsi = $db->query("SELECT * from m_provinsi where idprovinsi = {$_POST['PROVINSIHIDDEN']} ");
|
|
$dt_provinsi = $m_provinsi->fetchFirst()['namaprovinsi'];
|
|
|
|
$m_kota = $db->query("SELECT * from m_kota where idkota = {$_POST['KOTAHIDDEN']}");
|
|
$dt_kota = $m_kota->fetchFirst()['namakota'];
|
|
|
|
$m_kecamatan = $db->query('SELECT * from m_kecamatan where idkecamatan = '.$_POST['KECAMATANHIDDEN']);
|
|
$dt_kecamatan = $m_kecamatan->fetchFirst()['namakecamatan'];
|
|
|
|
$m_kelurahan = $db->query('SELECT * from m_kelurahan where idkelurahan = '.$_POST['KELURAHANHIDDEN']);
|
|
$dt_kelurahan = $m_kelurahan->fetchFirst()['namakelurahan'];
|
|
|
|
$m_status_pasien = $db->query('SELECT * from m_status_pasien where id_status = '.$status);
|
|
$dt_status = $m_status_pasien->fetchFirst()['nama_status'];
|
|
|
|
$m_agama_pasien = $db->query('SELECT * from m_agama_pasien where id_agama = '.$agama);
|
|
$dt_agama = $m_agama_pasien->fetchFirst()['nama_agama'];
|
|
|
|
$m_pendidikan_pasien = $db->query('SELECT * from m_pendidikan_pasien where id_pendidikan = '.$pendidikan);
|
|
$dt_pendidikan = $m_pendidikan_pasien->fetchFirst()['nama_pendidikan'];
|
|
|
|
$tmpTGLLAHIR = date('Y-m-d', strtotime(str_replace('/','-',$_POST['TGLLAHIR'])));
|
|
$arr_update_pas = [
|
|
'NOMR' => $_POST['NOMRKEY'],
|
|
'NAMA' => preg_replace("/\'/",'`',$_POST['NAMA']),
|
|
'TEMPAT' => preg_replace("/\'/",'`',$_POST['TEMPAT']),
|
|
'TGLLAHIR' => $tmpTGLLAHIR,
|
|
'JENISKELAMIN' => $_POST['JENISKELAMIN'],
|
|
'ALAMAT' => preg_replace("/\'/",'`',$_POST['ALAMAT']),
|
|
'KELURAHAN' => ['value'=>$_POST['KELURAHANHIDDEN'],'type'=>'number'],
|
|
'KDKECAMATAN' => ['value'=>$_POST['KECAMATANHIDDEN'],'type'=>'number'],
|
|
'KOTA' => ['value'=>$_POST['KOTAHIDDEN'],'type'=>'number'],
|
|
'KDPROVINSI' => ['value'=>$_POST['PROVINSIHIDDEN'],'type'=>'number'],
|
|
'NOTELP' => $_POST['NOTELP'],
|
|
'notelpkantor' => $_POST['notelpkantor'],
|
|
'notelprumah1' => $_POST['notelprumah1'],
|
|
'notelprumah2' => $_POST['notelprumah2'],
|
|
'no_hp' => $_POST['no_hp'],
|
|
'NOKTP' => $_POST['NOKTP'],
|
|
'sim' => $_POST['sim'],
|
|
'paspor' => $_POST['paspor'],
|
|
'SUAMI_ORTU' => preg_replace("/\'/",'`',$_POST['SUAMI_ORTU']),
|
|
'PEKERJAAN' => $_POST['PEKERJAAN'],
|
|
'STATUS' => ['value'=>$status,'type'=>'number'],
|
|
'AGAMA' => ['value'=>$agama,'type'=>'number'],
|
|
'PENDIDIKAN' => ['value'=>$pendidikan,'type'=>'number'],
|
|
// 'KDCARABAYAR' => ['value'=>$_POST['KDCARABAYAR'],'type'=>'number'],
|
|
'NIP' => $_SESSION['NIP'],
|
|
'ALAMAT_KTP' => preg_replace("/\'/",'`',$_POST['ALAMAT_KTP']),
|
|
'kepercayaan' => $_POST['kepercayaan'],
|
|
'agama_lain' => $_POST['agama_lain'],
|
|
'st_disabilitas' => ['value'=>$_POST['st_disabilitas'],'type'=>'number'],
|
|
'disabilitas' => $_POST['disabilitas'],
|
|
'bahasa' => $_POST['bahasa'],
|
|
'hambatan_komunikasi' => $_POST['hambatan_komunikasi'],
|
|
'kebangsaan' => $_POST['kebangsaan'],
|
|
'suku' => $_POST['suku'],
|
|
'txt_kelurahan' => preg_replace("/\'/",'`',$dt_kelurahan),
|
|
'txt_kecamatan' => preg_replace("/\'/",'`',$dt_kecamatan),
|
|
'txt_kota' => preg_replace("/\'/",'`',$dt_kota),
|
|
'txt_provinsi' => preg_replace("/\'/",'`',$dt_provinsi),
|
|
'txt_status' => preg_replace("/\'/",'`',$dt_status),
|
|
'txt_agama' => $dt_agama,
|
|
'txt_pendidikan' => $dt_pendidikan,
|
|
'nama_ayah' => $_POST['nama_ayah_kandung'],
|
|
'nama_ibu' => $_POST['nama_ibu_kandung'],
|
|
'pendidikan_ayah' => $_POST['pendidikan_ayah'],
|
|
'pendidikan_ibu' => $_POST['pendidikan_ibu'],
|
|
'st_identitas_ortu' => ['value'=>$_POST['st_identitas_ortu'],'type'=>'number'],
|
|
'updated_at'=>date('Y-m-d H:i:s'),
|
|
'ktp_file' => (($_FILES['ktp_file']) ? file_save($_FILES['ktp_file'],$_POST['NOMRKEY'],str_replace("_", '', $_POST['NOKTP']),'KTP') : ''),
|
|
'kk_file' => (($_FILES['kk_file']) ? file_save($_FILES['kk_file'],$_POST['NOMRKEY'],str_replace("_", '', $_POST['NOKTP']),'KK') : ''),
|
|
];
|
|
$sqlupdate_pasien = "UPDATE m_pasien ".bind_sql($arr_update_pas,1)." WHERE NOMR = '".trim($_POST['NOMRKEY'])."' ";
|
|
execute($sqlupdate_pasien);
|
|
?>
|
|
<script language="javascript">
|
|
alert("Edit Data Pasien Sukses");
|
|
window.location="<?php echo _BASE_; ?>index.php?link=21";
|
|
</script>
|
|
|
|
<?php
|
|
}
|
|
/*
|
|
if($_POST['NOMRKEY'] =="" || $_POST['KDDOKTER'] =="" || $_POST['KDPOLY'] =="" || $_POST['KDRUJUK'] =="" || $_POST['KDCARABAYAR'] =="" || $_POST['SHIFT'] ==""){
|
|
|
|
?>
|
|
<script language="javascript">
|
|
alert("Maaf Input Pendaftaran Belum Lengkap");
|
|
window.location="<?php echo _BASE_;?>index.php?link=24&nomr=<?php echo $nomr; ?>";
|
|
</script>
|
|
<?php
|
|
}
|
|
$sqlinsert_pendaftaran = " INSERT INTO t_pendaftaran (NOMR, TGLREG, KDDOKTER, KDPOLY, KDRUJUK, KDCARABAYAR, NOJAMINAN, SHIFT, `STATUS`, PASIENBARU, NIP) VALUES('".trim($_POST['NOMRKEY'])."','".trim($_POST['TGLREG'])."',".trim($_POST['KDDOKTER']).",".trim($_POST['KDPOLY']).",".trim($_POST['KDRUJUK']).",".trim($_POST['KDCARABAYAR']).",'".trim($_POST['NOJAMINAN'])."',".trim($_POST['SHIFT']).",0,".$_POST['PASIENBARU'].",'".trim($_SESSION['NIP'])."')";
|
|
$db->query($sqlinsert_pendaftaran);
|
|
|
|
$sqlupdate_pasien = "UPDATE m_pasien SET
|
|
NOMR = '".$_POST['NOMRKEY']."'
|
|
NAMA = '".trim($_POST['NAMA'])."',
|
|
TEMPAT = '".trim($_POST['TEMPAT'])."',
|
|
TGLLAHIR = '".trim($tmpTGLLAHIR)."',
|
|
JENISKELAMIN = '".trim($_POST['JENISKELAMIN'])."',
|
|
ALAMAT = '".trim($_POST['ALAMAT'])."',
|
|
KELURAHAN = '".trim($_POST['KELURAHANHIDDEN'])."',
|
|
KDKECAMATAN = ".trim($_POST['KECAMATANHIDDEN']).",
|
|
KOTA = '".trim($_POST['KOTAHIDDEN'])."',
|
|
NOTELP = '".trim($_POST['NOTELP'])."',
|
|
NOKTP = '".trim($_POST['NOKTP'])."',
|
|
SUAMI_ORTU = '".trim($_POST['SUAMI_ORTU'])."',
|
|
PEKERJAAN = '".trim($_POST['PEKERJAAN'])."',
|
|
STATUS = ".$status.",
|
|
AGAMA = ".$agama.",
|
|
PENDIDIKAN = ".$pendidikan.",
|
|
KDCARABAYAR = ".trim($_POST['KDCARABAYAR']).",
|
|
NIP = '".trim($_SESSION['NIP'])."'
|
|
WHERE NOMR = '".trim($_POST['NOMRKEY'])."' ";
|
|
$db->query($sqlupdate_pasien);
|
|
|
|
?>
|
|
<script language="javascript">
|
|
alert("Update Data Sukses ");
|
|
window.location="<?php echo _BASE_;?>index.php?link=2";
|
|
</script>
|
|
<?php
|
|
// header('location:../?link=21');
|
|
*/
|
|
?>
|