function simpan_tracer_check($value) { $cleaner = new FormCleaner; $cleaner->setValue($value); $cleaner->clean(); $val = $cleaner->getValue(); $objResponse = new xajaxResponse; if(!$val[no_rm]) { $objResponse->addAlert("Silakan Isi Nomor Rekam Medis"); $objResponse->addScriptCall("fokus", "no_rm"); } elseif(!$val[peminjam]) { $objResponse->addAlert("Silakan Isi Peminjam"); $objResponse->addScriptCall("fokus", "peminjam"); } else { $kon = new Konek; $arr_no_rm = explode("\n", $val[no_rm]); $str_no_rm = str_replace("\n", ", ", $val[no_rm]); //$objResponse->addAlert($str_no_rm); $kon->sql = " SELECT CONCAT_WS('-', SUBSTRING(trc.pasien_id, 1,2), SUBSTRING(trc.pasien_id, 3,2), SUBSTRING(trc.pasien_id, 5,2), SUBSTRING(trc.pasien_id, 7,2)) as no_rm, kmr.nama as nama_kamar, trc.peminjam as peminjam, DATE_FORMAT(trc.tgl_keluar, '%d/%m/%y') as tgl_keluar, p.nama as nama FROM tracer trc LEFT JOIN kunjungan_kamar kk ON (kk.id = trc.kunjungan_kamar_id) LEFT JOIN kamar kmr ON (kmr.id = kk.kamar_id) JOIN pasien p ON (p.id = trc.pasien_id) WHERE trc.pasien_id IN (".$str_no_rm.") AND trc.tgl_kembali IS NULL "; $kon->execute(); $data = $kon->getAll(); if(!empty($data)) { $str = "\n"; for($i=0;$i<sizeof($data);$i++) { $str .= "---------------------------------------\n"; $str .= "No RM : " . $data[$i][no_rm] . "\n"; $str .= "Pasien : " . $data[$i][nama] . "\n"; $str .= "Tgl Keluar : " . $data[$i][tgl_keluar] . "\n"; if( $data[$i][peminjam]) $str .= "Peminjam : " . $data[$i][peminjam] . "\n"; if( $data[$i][nama_kamar]) $str .= "Pelayanan : " . $data[$i][nama_kamar] . "\n"; $str .= "---------------------------------------\n"; } $objResponse->addAlert("Data Tidak Dapat Disimpan.\nNomor Rekam Medis Berikut Belum Kembali Ke Rak Penyimpanan :\n" . $str); $objResponse->addScriptCall("fokus", "no_rm"); } else { $objResponse->addScriptCall("xajax_simpan_tracer", $val, $arr_no_rm); } } return $objResponse; }
function chat_kirim_pesan_check($value) { $cleaner = new FormCleaner; $cleaner->setValue($value); $cleaner->clean(); $new_value = $cleaner->getValue(); $objResponse = new xajaxResponse; if(!$new_value[chat_pesan]) { $objResponse->addScriptCall('fokus', 'chat_pesan'); } else { $objResponse->addScriptCall("xajax_chat_kirim_pesan", $new_value); } return $objResponse; }
function simpan_kamar_check($value) { $cleaner = new FormCleaner; $cleaner->setValue($value); $cleaner->clean(); $new_value = $cleaner->getValue(); $objResponse = new xajaxResponse(); //$objResponse->addAlert(print_r($value)); if(!$new_value[pelayanan_id]) { $objResponse->addAlert("Silakan Isi Bangsal."); $objResponse->addScriptCall("fokus", "pelayanan_id"); } elseif(!$new_value[nama]) { $objResponse->addAlert("Silakan Isi Nama Kamar."); $objResponse->addScriptCall("fokus", "nama"); } elseif(!$new_value[kelas]) { $objResponse->addAlert("Silakan Isi Kelas."); $objResponse->addScriptCall("fokus", "kelas"); } elseif(!$new_value[jml_bed]) { $objResponse->addAlert("Silakan isi jumlah TT."); $objResponse->addScriptCall("fokus", "jml_bed"); } else { $objResponse->addScriptCall("xajax_simpan_kamar", $new_value); } return $objResponse; }
function simpan_pelayanan_check($value) { $cleaner = new FormCleaner; $cleaner->setValue($value); $cleaner->clean(); $new_value = $cleaner->getValue(); $objResponse = new xajaxResponse(); if(!$new_value[jenis]) { $objResponse->addAlert("Silakan Pilih Jenis Pelayanan."); $objResponse->addScriptCall("fokus", "jenis"); } elseif(!$new_value[spesialisasi_id]) { $objResponse->addAlert("Silakan Pilih Spesialisasi."); $objResponse->addScriptCall("fokus", "spesialisasi_id"); } elseif($new_value[jenis] == "RAWAT JALAN" && !$new_value[hari_buka]) { $objResponse->addAlert("Silakan Isi Hari Buka Dalam Seminggu."); $objResponse->addScriptCall("fokus", "hari_buka"); } elseif($new_value[jenis] == "RAWAT JALAN" && ($new_value[hari_buka] > 7 || $new_value[hari_buka] < 1)) { $objResponse->addAlert("Isikan Hari Buka antara 1 - 7."); $objResponse->addScriptCall("fokus", "hari_buka"); } else { $objResponse->addScriptCall("xajax_simpan_pelayanan", $new_value); } return $objResponse; }
function simpan_icd_check($value) { $objResponse = new xajaxResponse(); $clean = new FormCleaner; $clean->setValue($value); $clean->clean(); $val = $clean->getValue(); if(!$val[kode_icd_group]) { $objResponse->addAlert("Silakan Isi Kode ICD Group."); $objResponse->addScriptCall("fokus", "kode_icd_group"); } elseif(!$val[kode_icd]) { $objResponse->addAlert("Silakan Isi Kode ICD."); $objResponse->addScriptCall("fokus", "kode_icd"); } elseif(!$val[no_dtd]) { $objResponse->addAlert("Silakan Isi No. DTD."); $objResponse->addScriptCall("fokus", "no_dtd"); } elseif(!$val[nama]) { $objResponse->addAlert("Silakan Isi Nama Penyakit."); $objResponse->addScriptCall("fokus", "nama"); } elseif(!$val[gol_sebab_sakit]) { $objResponse->addAlert("Silakan Isi Golongan Sebab Sakit."); $objResponse->addScriptCall("fokus", "gol_sebab_sakit"); } else { $objResponse->addScriptCall("xajax_simpan_icd", $val); } return $objResponse; }
function simpan_radio_check($value) { $cleaner = new FormCleaner; $cleaner->setValue($value); $cleaner->clean(); $new_value = $cleaner->getValue(); $objResponse = new xajaxResponse(); //$objResponse->addAlert(print_r($value)); if(!$new_value[nama]) { $objResponse->addAlert("Silakan Isi Nama Specimen."); $objResponse->addScriptCall("fokus", "nama"); } elseif(!$new_value[biaya]) { $objResponse->addAlert("Silakan Isi Biaya."); $objResponse->addScriptCall("fokus", "biaya"); } elseif(!$new_value[tingkat]) { $objResponse->addAlert("Silakan Isi Tingkat."); $objResponse->addScriptCall("fokus", "tingkat"); } else { $objResponse->addScriptCall("xajax_simpan_radio", $new_value); } return $objResponse; }
function simpan_pasien_check($value) { $objResponse = new xajaxResponse(); $cleaner = new FormCleaner; $cleaner->setValue($value); $cleaner->clean(); $new_value = $cleaner->getValue(); $tgl_skr = strtotime(date("Y-m-d")); $tgl_periksa = strtotime($new_value[tgl_periksa_thn]."-".$new_value[tgl_periksa_bln]. "-".$new_value[tgl_periksa_tgl]); if(!$new_value[nama]) { $objResponse->addAlert("Silakan Isi Nama Pasien."); $objResponse->addScriptCall("fokus", "nama"); } elseif(!$new_value[sex]) { $objResponse->addAlert("Silakan Isi Jenis Kelamin Pasien."); $objResponse->addScriptCall("fokus", "sex"); } elseif(!$new_value[agama]) { $objResponse->addAlert("Silakan Isi Agama Pasien."); $objResponse->addScriptCall("fokus", "agama"); } elseif(!$new_value[pendidikan_id]) { $objResponse->addAlert("Silakan Isi Pendidikan Pasien."); $objResponse->addScriptCall("fokus", "pendidikan_id"); } elseif(!$new_value[pekerjaan_id]) { $objResponse->addAlert("Silakan Isi Pekerjaan Pasien."); $objResponse->addScriptCall("fokus", "pekerjaan_id"); } elseif(!$new_value[status_nikah]) { $objResponse->addAlert("Silakan Isi Status Nikah Pasien."); $objResponse->addScriptCall("fokus", "status_nikah"); } elseif(!$new_value[alamat]) { $objResponse->addAlert("Silakan Isi Alamat Pasien."); $objResponse->addScriptCall("fokus", "alamat"); } elseif(!$new_value[propinsi_id]) { $objResponse->addAlert("Silakan Isi Propinsi Pasien."); $objResponse->addScriptCall("fokus", "propinsi_id"); } elseif(!$new_value[kabupaten_id]) { $objResponse->addAlert("Silakan Isi Kabupaten Pasien."); $objResponse->addScriptCall("fokus", "kabupaten_id"); } elseif(!$new_value[kecamatan_id]) { $objResponse->addAlert("Silakan Isi Kecamatan Pasien."); $objResponse->addScriptCall("fokus", "kecamatan_id"); } elseif(!$new_value[desa_id]) { $objResponse->addAlert("Silakan Isi Kelurahan Pasien."); $objResponse->addScriptCall("fokus", "desa_id"); } elseif($tgl_periksa < $tgl_skr) { $objResponse->addAlert("Tanggal periksa tidak boleh kurang dari sekarang."); $objResponse->addScriptCall("fokus", "tgl_periksa_tgl"); } elseif(!$new_value[kamar_id]) { $objResponse->addAlert("Silakan Pilih Spesialisasi."); $objResponse->addScriptCall("fokus", "kamar_id"); } elseif(!checkdate($new_value[tgl_periksa_bln], $new_value[tgl_periksa_tgl], $new_value[tgl_periksa_thn])) { $objResponse->addAlert("Tanggal Periksa Tidak Valid."); $objResponse->addScriptCall("fokus", "tgl_periksa_tgl"); } elseif(!$new_value[cara_masuk]) { $objResponse->addAlert("Silakan Isi Cara Masuk."); $objResponse->addScriptCall("fokus", "cara_masuk"); } elseif($new_value[cara_masuk] == "RUJUKAN" && !$new_value[perujuk_id]) { $objResponse->addAlert("Silakan Isi Perujuk."); $objResponse->addScriptCall("fokus", "perujuk_id"); } elseif(!$new_value[cara_bayar]) { $objResponse->addAlert("Silakan Isi Cara Bayar."); $objResponse->addScriptCall("fokus", "cara_bayar"); } elseif(!$new_value[nama_ayah]) { $objResponse->addAlert("Silakan Isi Nama Ayah."); $objResponse->addScriptCall("fokus", "nama_ayah"); } elseif(!$new_value[nama_ibu]) { $objResponse->addAlert("Silakan Isi Nama Ibu."); $objResponse->addScriptCall("fokus", "nama_ibu"); /*} elseif(!$new_value[no_ktp_sim]) { $objResponse->addAlert("Silakan Isi No KTP/SIM."); $objResponse->addScriptCall("fokus", "no_ktp_sim"); */ } else { $objResponse->addScriptCall("xajax_simpan_pasien", $new_value); } return $objResponse; }
function simpan_kunjungan($value, $langsung_bayar = false, $tutup_modal = true) { $cleaner = new FormCleaner; $cleaner->setValue($value); $cleaner->clean(); $val = $cleaner->getValue(); $kon = new Konek; //update $kon->sql = " UPDATE kunjungan SET keadaan_keluar = '".$val[input_keadaan_keluar]."' WHERE id = '".$val[input_id_kunjungan]."' "; $kon->execute(); //update $sql = " UPDATE kunjungan_kamar SET dokter_id = NULLIF('".$val[input_dokter_id]."', ''), kelanjutan = NULLIF('".$val[input_kelanjutan]."',''), diagnosa_utama_id = NULLIF('".$val[input_diagnosa_utama]."', ''), tgl_keluar = '".$val[input_tgl_keluar_thn]."-".$val[input_tgl_keluar_bln]."-".$val[input_tgl_keluar_tgl]." ".$val[input_tgl_keluar_jam].":".$val[input_tgl_keluar_mnt].":00' WHERE id = '".$val[input_id_kunjungan_kamar]."' "; $kon->sql = $sql; $kon->execute(); $afek = $kon->affected_rows; $objResponse = new xajaxResponse(); //$objResponse->addAlert(print_r($val)); //$objResponse->addAppend("debug", "innerHTML", $mampu_bayar); //INSERT UPDATE KARCIS for($i=0;$i<sizeof($val[input_karcis]);$i++) { $kunci = key($val[input_karcis]); //get /* $kon->sql = "SELECT * FROM karcis WHERE id = '".$val[input_karcis][$kunci]."'"; $kon->execute(); $data_karcis[$i] = $kon->getOne(); $jasa_p[$i] = $data_karcis[$i][jasa_p] * $val[input_karcis_bayar][$kunci]; $jasa_rs[$i] = $data_karcis[$i][jasa_rs] * $val[input_karcis_bayar][$kunci]; $jasa_rs_op[$i] = $data_karcis[$i][jasa_rs_op] * $val[input_karcis_bayar][$kunci]; $jasa_rs_kembang[$i] = $data_karcis[$i][jasa_rs_kembang] * $val[input_karcis_bayar][$kunci]; $jasa_rs_adm[$i] = $data_karcis[$i][jasa_rs_adm] * $val[input_karcis_bayar][$kunci]; $jasa_rs_sdm[$i] = $data_karcis[$i][jasa_rs_sdm] * $val[input_karcis_bayar][$kunci]; $spesialis[$i] = $data_karcis[$i][spesialis] * $val[input_karcis_bayar][$kunci] * $data_karcis[$i][netto]; $spesialis_pendamping[$i] = $data_karcis[$i][spesialis_pendamping] * $val[input_karcis_bayar][$kunci] * $data_karcis[$i][netto]; $ugp[$i] = $data_karcis[$i][ugp] * $val[input_karcis_bayar][$kunci] * $data_karcis[$i][netto]; $grabaf[$i] = $data_karcis[$i][grabaf] * $val[input_karcis_bayar][$kunci] * $data_karcis[$i][netto]; $perawat[$i] = $data_karcis[$i][perawat] * $val[input_karcis_bayar][$kunci] * $data_karcis[$i][netto]; $penunjang[$i] = $data_karcis[$i][penunjang] * $val[input_karcis_bayar][$kunci] * $data_karcis[$i][netto]; $zakat[$i] = $data_karcis[$i][zakat] * $val[input_karcis_bayar][$kunci] * $data_karcis[$i][netto]; $pajak[$i] = $data_karcis[$i][pajak] * ($val[input_karcis_bayar][$kunci] - ($jasa_p[$i] + $jasa_rs_op[$i] + $jasa_rs_kembang[$i] + $jasa_rs_adm[$i] + $jasa_rs_sdm[$i])); //$objResponse->addAlert("pajak : " . $pajak[$i]); */ /* BAGI BAYAR => BHP+JASA */ $biaya_bhp = 0; $biaya_jasa = 0; $selisih_biaya = 0; $biaya_bhp = round($val[input_karcis_biaya_bhp][$kunci]*$val[input_karcis_biaya][$kunci]/($val[input_karcis_biaya_bhp][$kunci]+$val[input_karcis_biaya_jasa][$kunci])); $biaya_jasa = round($val[input_karcis_biaya_jasa][$kunci]*$val[input_karcis_biaya][$kunci]/($val[input_karcis_biaya_bhp][$kunci]+$val[input_karcis_biaya_jasa][$kunci])); $selisih_biaya = $val[input_karcis_biaya][$kunci]-$biaya_bhp-$biaya_jasa; $biaya_jasa += $selisih_biaya; $bayar_bhp = 0; $bayar_jasa = 0; $selisih_bayar = 0; $bayar_bhp = round($val[input_karcis_biaya_bhp][$kunci]*$val[input_karcis_bayar][$kunci]/($val[input_karcis_biaya_bhp][$kunci]+$val[input_karcis_biaya_jasa][$kunci])); $bayar_jasa = round($val[input_karcis_biaya_jasa][$kunci]*$val[input_karcis_bayar][$kunci]/($val[input_karcis_biaya_bhp][$kunci]+$val[input_karcis_biaya_jasa][$kunci])); $selisih_bayar = $val[input_karcis_bayar][$kunci]-$bayar_bhp-$bayar_jasa; $bayar_jasa += $selisih_bayar; if(!$val[input_kunjungan_karcis_id][$kunci]) { //insert $sql = " INSERT INTO kunjungan_bayar ( nama, kunjungan_kamar_id, karcis_id, hak_id, biaya_bhp, biaya_jasa, jumlah, /*bayar,*/ bayar_bhp, bhp_p, bhp_rs, bhp_rs_adm, bhp_rs_op, bayar_jasa, jasa_p, jasa_rs, jasa_rs_op, jasa_rs_kembang, jasa_rs_adm, jasa_rs_sdm, spesialis, spesialis_pendamping, ugp, grabaf, perawat, penunjang, zakat, pajak, netto ) SELECT '".$val[input_karcis_nama][$i]."', '".$val[input_id_kunjungan_kamar]."', '".$val[input_karcis][$kunci]."', '".$val[input_karcis_hak][$kunci]."', '".$biaya_bhp."', '".$biaya_jasa."', '".$val[input_karcis_jml][$kunci]."', /*'".$val[input_karcis_bayar][$kunci]."',*/ '".$bayar_bhp."', bhp_p, bhp_rs, bhp_rs_adm, bhp_rs_op, '".$bayar_jasa."', jasa_p, jasa_rs, jasa_rs_op, jasa_rs_kembang, jasa_rs_adm, jasa_rs_sdm, spesialis, spesialis_pendamping, ugp, grabaf, perawat, penunjang, zakat, pajak, netto FROM karcis WHERE id = '".$val[input_karcis][$kunci]."' "; $kon->sql = $sql; $kon->execute(); } else { //update $sql = " UPDATE kunjungan_bayar SET hak_id = '".$val[input_karcis_hak][$kunci]."', jumlah = '".$val[input_karcis_jml][$kunci]."', biaya_bhp = '".$biaya_bhp ."', biaya_jasa = '".$biaya_jasa."', /*bayar = '".$val[input_karcis_bayar][$kunci]."',*/ bayar_bhp = '".$bayar_bhp."', bayar_jasa = '".$bayar_jasa."' WHERE id = '".$val[input_kunjungan_karcis_id][$kunci]."'"; $kon->sql = $sql; $kon->execute(); //$objResponse->addAppend("debug", "innerHTML", $sql); } //$objResponse->addAppend("debug", "innerHTML", $sql); next($val[input_karcis]); } //TINDAKAN for($i=0;$i<sizeof($val[input_icopim]);$i++) { $kunci = key($val[input_icopim]); $parent = $val[input_icopim_parent][$i]; //get if(!$val[input_kunjungan_icopim_id][$kunci] && $val[input_icopim][$kunci]) { //insert $sql = "INSERT INTO kunjungan_kamar_icopim (kunjungan_kamar_id, icopim_id, nama) VALUES ('".$val[input_id_kunjungan_kamar]."', '".$val[input_icopim][$kunci]."', '".$val[input_icopim_nama][$kunci]."')"; $kon->sql = $sql; $kon->execute(); $id_kki = $kon->last_id; //$objResponse->addAppend("debug", "innerHTML", $parent . "<br /><br />"); /*diinsert satu satu*/ for($j=0;$j<sizeof($val[input_icopim_detil_field][$parent]);$j++) { $field = ""; $field = $val[input_icopim_detil_field][$parent][$j]; /* $netto = $val[input_icopim_detil_bayar][$parent][$field] * $val[input_icopim_detil_netto][$parent]; $zakat = $val[input_icopim_detil_bayar][$parent][$field] * $val[input_icopim_detil_netto][$parent] * $val[input_icopim_detil_zakat][$parent]; $pajak = $val[input_icopim_detil_bayar][$parent][$field] * $val[input_icopim_detil_pajak][$parent]; */ //$objResponse->addAppend("debug", "innerHTML", $field . " => " . $val[input_icopim_detil_bayar][$parent][$field] . "<br />"); if($field == "jasa_rumah_sakit") { $sql = "INSERT INTO kunjungan_bayar (nama, kunjungan_kamar_id, kunjungan_kamar_icopim_id, icopim_detil_id, hak_id, biaya_jasa, sifat, jumlah, bayar_jasa, jasa_p, jasa_rs, jasa_rs_op, jasa_rs_kembang, jasa_rs_adm, jasa_rs_sdm) SELECT '".$field."', '".$val[input_id_kunjungan_kamar]."', '".$id_kki."', '".$val[input_icopim_detil][$parent]."', '".$val[input_icopim_detil_hak][$parent][$j]."', '".$val[input_icopim_detil_biaya][$parent][$j]."', '".$val[input_icopim_detil_sifat][$parent][$j]."', '".$val[input_icopim_detil_jml][$parent][$j]."', '".$val[input_icopim_detil_bayar][$parent][$j]."', jasa_p, jasa_rs, jasa_rs_op, jasa_rs_kembang, jasa_rs_adm, jasa_rs_sdm FROM icopim_detil WHERE id = '".$val[input_icopim_detil][$parent]."'"; } elseif($field == "spesialis") { $sql = "INSERT INTO kunjungan_bayar (nama, kunjungan_kamar_id, kunjungan_kamar_icopim_id, icopim_detil_id, hak_id, biaya_jasa, sifat, jumlah, bayar_jasa, spesialis, pajak, zakat, netto) SELECT '".$field."', '".$val[input_id_kunjungan_kamar]."', '".$id_kki."', '".$val[input_icopim_detil][$parent]."', '".$val[input_icopim_detil_hak][$parent][$j]."', '".$val[input_icopim_detil_biaya][$parent][$j]."', '".$val[input_icopim_detil_sifat][$parent][$j]."', '".$val[input_icopim_detil_jml][$parent][$j]."', '".$val[input_icopim_detil_bayar][$parent][$j]."', netto, pajak, zakat, netto FROM icopim_detil WHERE id = '".$val[input_icopim_detil][$parent]."'"; } elseif($field == "spesialis_pendamping") { $sql = "INSERT INTO kunjungan_bayar (nama, kunjungan_kamar_id, kunjungan_kamar_icopim_id, icopim_detil_id, hak_id, biaya_jasa, sifat, jumlah, bayar_jasa, spesialis_pendamping, pajak, zakat, netto) SELECT '".$field."', '".$val[input_id_kunjungan_kamar]."', '".$id_kki."', '".$val[input_icopim_detil][$parent]."', '".$val[input_icopim_detil_hak][$parent][$j]."', '".$val[input_icopim_detil_biaya][$parent][$j]."', '".$val[input_icopim_detil_sifat][$parent][$j]."', '".$val[input_icopim_detil_jml][$parent][$j]."', '".$val[input_icopim_detil_bayar][$parent][$j]."', netto, pajak, zakat, netto FROM icopim_detil WHERE id = '".$val[input_icopim_detil][$parent]."'"; } elseif($field == "perawat_perinatologi") { $sql = "INSERT INTO kunjungan_bayar (nama, kunjungan_kamar_id, kunjungan_kamar_icopim_id, icopim_detil_id, hak_id, biaya_jasa, sifat, jumlah, bayar_jasa, perawat_perinatologi, pajak, zakat, netto) SELECT '".$field."', '".$val[input_id_kunjungan_kamar]."', '".$id_kki."', '".$val[input_icopim_detil][$parent]."', '".$val[input_icopim_detil_hak][$parent][$j]."', '".$val[input_icopim_detil_biaya][$parent][$j]."', '".$val[input_icopim_detil_sifat][$parent][$j]."', '".$val[input_icopim_detil_jml][$parent][$j]."', '".$val[input_icopim_detil_bayar][$parent][$j]."', netto, pajak, zakat, netto FROM icopim_detil WHERE id = '".$val[input_icopim_detil][$parent]."'"; } elseif($field == "dr_umum") { $sql = "INSERT INTO kunjungan_bayar (nama, kunjungan_kamar_id, kunjungan_kamar_icopim_id, icopim_detil_id, hak_id, biaya_jasa, sifat, jumlah, bayar_jasa, dr_umum, pajak, zakat, netto) SELECT '".$field."', '".$val[input_id_kunjungan_kamar]."', '".$id_kki."', '".$val[input_icopim_detil][$parent]."', '".$val[input_icopim_detil_hak][$parent][$j]."', '".$val[input_icopim_detil_biaya][$parent][$j]."', '".$val[input_icopim_detil_sifat][$parent][$j]."', '".$val[input_icopim_detil_jml][$parent][$j]."', '".$val[input_icopim_detil_bayar][$parent][$j]."', netto, pajak, zakat, netto FROM icopim_detil WHERE id = '".$val[input_icopim_detil][$parent]."'"; } elseif($field == "dr_gigi") { $sql = "INSERT INTO kunjungan_bayar (nama, kunjungan_kamar_id, kunjungan_kamar_icopim_id, icopim_detil_id, hak_id, biaya_jasa, sifat, jumlah, bayar_jasa, dr_gigi, pajak, zakat, netto) SELECT '".$field."', '".$val[input_id_kunjungan_kamar]."', '".$id_kki."', '".$val[input_icopim_detil][$parent]."', '".$val[input_icopim_detil_hak][$parent][$j]."', '".$val[input_icopim_detil_biaya][$parent][$j]."', '".$val[input_icopim_detil_sifat][$parent][$j]."', '".$val[input_icopim_detil_jml][$parent][$j]."', '".$val[input_icopim_detil_bayar][$parent][$j]."', netto, pajak, zakat, netto FROM icopim_detil WHERE id = '".$val[input_icopim_detil][$parent]."'"; } elseif($field == "assisten_non_dokter") { $sql = "INSERT INTO kunjungan_bayar (nama, kunjungan_kamar_id, kunjungan_kamar_icopim_id, icopim_detil_id, hak_id, biaya_jasa, sifat, jumlah, bayar_jasa, assisten_non_dokter, pajak, zakat, netto) SELECT '".$field."', '".$val[input_id_kunjungan_kamar]."', '".$id_kki."', '".$val[input_icopim_detil][$parent]."', '".$val[input_icopim_detil_hak][$parent][$j]."', '".$val[input_icopim_detil_biaya][$parent][$j]."', '".$val[input_icopim_detil_sifat][$parent][$j]."', '".$val[input_icopim_detil_jml][$parent][$j]."', '".$val[input_icopim_detil_bayar][$parent][$j]."', netto, pajak, zakat, netto FROM icopim_detil WHERE id = '".$val[input_icopim_detil][$parent]."'"; } elseif($field == "spesialis_anestesi") { $sql = "INSERT INTO kunjungan_bayar (nama, kunjungan_kamar_id, kunjungan_kamar_icopim_id, icopim_detil_id, hak_id, biaya_jasa, sifat, jumlah, bayar_jasa, spesialis_anestesi, pajak, zakat, netto) SELECT '".$field."', '".$val[input_id_kunjungan_kamar]."', '".$id_kki."', '".$val[input_icopim_detil][$parent]."', '".$val[input_icopim_detil_hak][$parent][$j]."', '".$val[input_icopim_detil_biaya][$parent][$j]."', '".$val[input_icopim_detil_sifat][$parent][$j]."', '".$val[input_icopim_detil_jml][$parent][$j]."', '".$val[input_icopim_detil_bayar][$parent][$j]."', netto, pajak, zakat, netto FROM icopim_detil WHERE id = '".$val[input_icopim_detil][$parent]."'"; } elseif($field == "aknest") { $sql = "INSERT INTO kunjungan_bayar (nama, kunjungan_kamar_id, kunjungan_kamar_icopim_id, icopim_detil_id, hak_id, biaya_jasa, sifat, jumlah, bayar_jasa, aknest, pajak, zakat, netto) SELECT '".$field."', '".$val[input_id_kunjungan_kamar]."', '".$id_kki."', '".$val[input_icopim_detil][$parent]."', '".$val[input_icopim_detil_hak][$parent][$j]."', '".$val[input_icopim_detil_biaya][$parent][$j]."', '".$val[input_icopim_detil_sifat][$parent][$j]."', '".$val[input_icopim_detil_jml][$parent][$j]."', '".$val[input_icopim_detil_bayar][$parent][$j]."', netto, pajak, zakat, netto FROM icopim_detil WHERE id = '".$val[input_icopim_detil][$parent]."'"; } elseif($field == "gizi") { $sql = "INSERT INTO kunjungan_bayar (nama, kunjungan_kamar_id, kunjungan_kamar_icopim_id, icopim_detil_id, hak_id, biaya_jasa, sifat, jumlah, bayar_jasa, gizi, pajak, zakat, netto) SELECT '".$field."', '".$val[input_id_kunjungan_kamar]."', '".$id_kki."', '".$val[input_icopim_detil][$parent]."', '".$val[input_icopim_detil_hak][$parent][$j]."', '".$val[input_icopim_detil_biaya][$parent][$j]."', '".$val[input_icopim_detil_sifat][$parent][$j]."', '".$val[input_icopim_detil_jml][$parent][$j]."', '".$val[input_icopim_detil_bayar][$parent][$j]."', netto, pajak, zakat, netto FROM icopim_detil WHERE id = '".$val[input_icopim_detil][$parent]."'"; } elseif($field == "fisioterapi") { $sql = "INSERT INTO kunjungan_bayar (nama, kunjungan_kamar_id, kunjungan_kamar_icopim_id, icopim_detil_id, hak_id, biaya_jasa, sifat, jumlah, bayar_jasa, fisioterapi, pajak, zakat, netto) SELECT '".$field."', '".$val[input_id_kunjungan_kamar]."', '".$id_kki."', '".$val[input_icopim_detil][$parent]."', '".$val[input_icopim_detil_hak][$parent][$j]."', '".$val[input_icopim_detil_biaya][$parent][$j]."', '".$val[input_icopim_detil_sifat][$parent][$j]."', '".$val[input_icopim_detil_jml][$parent][$j]."', '".$val[input_icopim_detil_bayar][$parent][$j]."', netto, pajak, zakat, netto FROM icopim_detil WHERE id = '".$val[input_icopim_detil][$parent]."'"; } elseif($field == "analis_pa") { $sql = "INSERT INTO kunjungan_bayar (nama, kunjungan_kamar_id, kunjungan_kamar_icopim_id, icopim_detil_id, hak_id, biaya_jasa, sifat, jumlah, bayar_jasa, analis_pa, pajak, zakat, netto) SELECT '".$field."', '".$val[input_id_kunjungan_kamar]."', '".$id_kki."', '".$val[input_icopim_detil][$parent]."', '".$val[input_icopim_detil_hak][$parent][$j]."', '".$val[input_icopim_detil_biaya][$parent][$j]."', '".$val[input_icopim_detil_sifat][$parent][$j]."', '".$val[input_icopim_detil_jml][$parent][$j]."', '".$val[input_icopim_detil_bayar][$parent][$j]."', netto, pajak, zakat, netto FROM icopim_detil WHERE id = '".$val[input_icopim_detil][$parent]."'"; } elseif($field == "bidan") { $sql = "INSERT INTO kunjungan_bayar (nama, kunjungan_kamar_id, kunjungan_kamar_icopim_id, icopim_detil_id, hak_id, biaya_jasa, sifat, jumlah, bayar_jasa, bidan, pajak, zakat, netto) SELECT '".$field."', '".$val[input_id_kunjungan_kamar]."', '".$id_kki."', '".$val[input_icopim_detil][$parent]."', '".$val[input_icopim_detil_hak][$parent][$j]."', '".$val[input_icopim_detil_biaya][$parent][$j]."', '".$val[input_icopim_detil_sifat][$parent][$j]."', '".$val[input_icopim_detil_jml][$parent][$j]."', '".$val[input_icopim_detil_bayar][$parent][$j]."', netto, pajak, zakat, netto FROM icopim_detil WHERE id = '".$val[input_icopim_detil][$parent]."'"; } elseif($field == "perawat") { $sql = "INSERT INTO kunjungan_bayar (nama, kunjungan_kamar_id, kunjungan_kamar_icopim_id, icopim_detil_id, hak_id, biaya_jasa, sifat, jumlah, bayar_jasa, perawat, pajak, zakat, netto) SELECT '".$field."', '".$val[input_id_kunjungan_kamar]."', '".$id_kki."', '".$val[input_icopim_detil][$parent]."', '".$val[input_icopim_detil_hak][$parent][$j]."', '".$val[input_icopim_detil_biaya][$parent][$j]."', '".$val[input_icopim_detil_sifat][$parent][$j]."', '".$val[input_icopim_detil_jml][$parent][$j]."', '".$val[input_icopim_detil_bayar][$parent][$j]."', netto, pajak, zakat, netto FROM icopim_detil WHERE id = '".$val[input_icopim_detil][$parent]."'"; } elseif($field == "penunjang") { $sql = "INSERT INTO kunjungan_bayar (nama, kunjungan_kamar_id, kunjungan_kamar_icopim_id, icopim_detil_id, hak_id, biaya_jasa, sifat, jumlah, bayar_jasa, penunjang, pajak, zakat, netto) SELECT '".$field."', '".$val[input_id_kunjungan_kamar]."', '".$id_kki."', '".$val[input_icopim_detil][$parent]."', '".$val[input_icopim_detil_hak][$parent][$j]."', '".$val[input_icopim_detil_biaya][$parent][$j]."', '".$val[input_icopim_detil_sifat][$parent][$j]."', '".$val[input_icopim_detil_jml][$parent][$j]."', '".$val[input_icopim_detil_bayar][$parent][$j]."', netto, pajak, zakat, netto FROM icopim_detil WHERE id = '".$val[input_icopim_detil][$parent]."'"; } else { //lain-lain } //$objResponse->addAppend("debug", "innerHTML", $sql . "<br /><br />"); $kon->sql = $sql; $kon->execute(); } } else { //UPDATE /*diinsert satu satu*/ for($j=0;$j<sizeof($val[input_icopim_detil_field][$parent]);$j++) { $field = ""; $field = $val[input_icopim_detil_field][$parent][$j]; /* $netto = $val[input_icopim_detil_bayar][$parent][$field] * $val[input_icopim_detil_netto][$parent]; $zakat = $val[input_icopim_detil_bayar][$parent][$field] * $val[input_icopim_detil_netto][$parent] * $val[input_icopim_detil_zakat][$parent]; $pajak = $val[input_icopim_detil_bayar][$parent][$field] * $val[input_icopim_detil_pajak][$parent]; */ //$objResponse->addAppend("debug", "innerHTML", $field . " => " . $val[input_icopim_detil_bayar][$parent][$field] . "<br />"); if($field == "jasa_rumah_sakit") { $sql = "UPDATE kunjungan_bayar SET hak_id = '".$val[input_icopim_detil_hak][$parent][$j]."', biaya_jasa = '".$val[input_icopim_detil_biaya][$parent][$j]."', sifat = '".$val[input_icopim_detil_sifat][$parent][$j]."', jumlah = '".$val[input_icopim_detil_jml][$parent][$j]."', bayar_jasa = '".$val[input_icopim_detil_bayar][$parent][$j]."' WHERE id = '".$val[input_kunjungan_icopim_detil_id][$parent][$j]."'"; } elseif($field == "spesialis") { $sql = "UPDATE kunjungan_bayar SET hak_id = '".$val[input_icopim_detil_hak][$parent][$j]."', biaya_jasa = '".$val[input_icopim_detil_biaya][$parent][$j]."', sifat = '".$val[input_icopim_detil_sifat][$parent][$j]."',jumlah = '".$val[input_icopim_detil_jml][$parent][$j]."', bayar_jasa = '".$val[input_icopim_detil_bayar][$parent][$j]."' WHERE id = '".$val[input_kunjungan_icopim_detil_id][$parent][$j]."'"; } elseif($field == "spesialis_pendamping") { $sql = "UPDATE kunjungan_bayar SET hak_id = '".$val[input_icopim_detil_hak][$parent][$j]."', biaya_jasa = '".$val[input_icopim_detil_biaya][$parent][$j]."', sifat = '".$val[input_icopim_detil_sifat][$parent][$j]."',jumlah = '".$val[input_icopim_detil_jml][$parent][$j]."', bayar_jasa = '".$val[input_icopim_detil_bayar][$parent][$j]."' WHERE id = '".$val[input_kunjungan_icopim_detil_id][$parent][$j]."'"; } elseif($field == "perawat_perinatologi") { $sql = "UPDATE kunjungan_bayar SET hak_id = '".$val[input_icopim_detil_hak][$parent][$j]."', biaya_jasa = '".$val[input_icopim_detil_biaya][$parent][$j]."', sifat = '".$val[input_icopim_detil_sifat][$parent][$j]."',jumlah = '".$val[input_icopim_detil_jml][$parent][$j]."', bayar_jasa = '".$val[input_icopim_detil_bayar][$parent][$j]."' WHERE id = '".$val[input_kunjungan_icopim_detil_id][$parent][$j]."'"; } elseif($field == "dr_umum") { $sql = "UPDATE kunjungan_bayar SET hak_id = '".$val[input_icopim_detil_hak][$parent][$j]."', biaya_jasa = '".$val[input_icopim_detil_biaya][$parent][$j]."', sifat = '".$val[input_icopim_detil_sifat][$parent][$j]."',jumlah = '".$val[input_icopim_detil_jml][$parent][$j]."', bayar_jasa = '".$val[input_icopim_detil_bayar][$parent][$j]."' WHERE id = '".$val[input_kunjungan_icopim_detil_id][$parent][$j]."'"; } elseif($field == "dr_gigi") { $sql = "UPDATE kunjungan_bayar SET hak_id = '".$val[input_icopim_detil_hak][$parent][$j]."', biaya_jasa = '".$val[input_icopim_detil_biaya][$parent][$j]."', sifat = '".$val[input_icopim_detil_sifat][$parent][$j]."',jumlah = '".$val[input_icopim_detil_jml][$parent][$j]."', bayar_jasa = '".$val[input_icopim_detil_bayar][$parent][$j]."' WHERE id = '".$val[input_kunjungan_icopim_detil_id][$parent][$j]."'"; } elseif($field == "assisten_non_dokter") { $sql = "UPDATE kunjungan_bayar SET hak_id = '".$val[input_icopim_detil_hak][$parent][$j]."', biaya_jasa = '".$val[input_icopim_detil_biaya][$parent][$j]."', sifat = '".$val[input_icopim_detil_sifat][$parent][$j]."',jumlah = '".$val[input_icopim_detil_jml][$parent][$j]."', bayar_jasa = '".$val[input_icopim_detil_bayar][$parent][$j]."' WHERE id = '".$val[input_kunjungan_icopim_detil_id][$parent][$j]."'"; } elseif($field == "spesialis_anestesi") { $sql = "UPDATE kunjungan_bayar SET hak_id = '".$val[input_icopim_detil_hak][$parent][$j]."', biaya_jasa = '".$val[input_icopim_detil_biaya][$parent][$j]."', sifat = '".$val[input_icopim_detil_sifat][$parent][$j]."',jumlah = '".$val[input_icopim_detil_jml][$parent][$j]."', bayar_jasa = '".$val[input_icopim_detil_bayar][$parent][$j]."' WHERE id = '".$val[input_kunjungan_icopim_detil_id][$parent][$j]."'"; } elseif($field == "aknest") { $sql = "UPDATE kunjungan_bayar SET hak_id = '".$val[input_icopim_detil_hak][$parent][$j]."', biaya_jasa = '".$val[input_icopim_detil_biaya][$parent][$j]."', sifat = '".$val[input_icopim_detil_sifat][$parent][$j]."',jumlah = '".$val[input_icopim_detil_jml][$parent][$j]."', bayar_jasa = '".$val[input_icopim_detil_bayar][$parent][$j]."' WHERE id = '".$val[input_kunjungan_icopim_detil_id][$parent][$j]."'"; } elseif($field == "gizi") { $sql = "UPDATE kunjungan_bayar SET hak_id = '".$val[input_icopim_detil_hak][$parent][$j]."', biaya_jasa = '".$val[input_icopim_detil_biaya][$parent][$j]."', sifat = '".$val[input_icopim_detil_sifat][$parent][$j]."',jumlah = '".$val[input_icopim_detil_jml][$parent][$j]."', bayar_jasa = '".$val[input_icopim_detil_bayar][$parent][$j]."' WHERE id = '".$val[input_kunjungan_icopim_detil_id][$parent][$j]."'"; } elseif($field == "fisioterapi") { $sql = "UPDATE kunjungan_bayar SET hak_id = '".$val[input_icopim_detil_hak][$parent][$j]."', biaya_jasa = '".$val[input_icopim_detil_biaya][$parent][$j]."', sifat = '".$val[input_icopim_detil_sifat][$parent][$j]."',jumlah = '".$val[input_icopim_detil_jml][$parent][$j]."', bayar_jasa = '".$val[input_icopim_detil_bayar][$parent][$j]."' WHERE id = '".$val[input_kunjungan_icopim_detil_id][$parent][$j]."'"; } elseif($field == "analis_pa") { $sql = "UPDATE kunjungan_bayar SET hak_id = '".$val[input_icopim_detil_hak][$parent][$j]."', biaya_jasa = '".$val[input_icopim_detil_biaya][$parent][$j]."', sifat = '".$val[input_icopim_detil_sifat][$parent][$j]."',jumlah = '".$val[input_icopim_detil_jml][$parent][$j]."', bayar_jasa = '".$val[input_icopim_detil_bayar][$parent][$j]."' WHERE id = '".$val[input_kunjungan_icopim_detil_id][$parent][$j]."'"; } elseif($field == "bidan") { $sql = "UPDATE kunjungan_bayar SET hak_id = '".$val[input_icopim_detil_hak][$parent][$j]."', biaya_jasa = '".$val[input_icopim_detil_biaya][$parent][$j]."', sifat = '".$val[input_icopim_detil_sifat][$parent][$j]."',jumlah = '".$val[input_icopim_detil_jml][$parent][$j]."', bayar_jasa = '".$val[input_icopim_detil_bayar][$parent][$j]."' WHERE id = '".$val[input_kunjungan_icopim_detil_id][$parent][$j]."'"; } elseif($field == "perawat") { $sql = "UPDATE kunjungan_bayar SET hak_id = '".$val[input_icopim_detil_hak][$parent][$j]."', biaya_jasa = '".$val[input_icopim_detil_biaya][$parent][$j]."', sifat = '".$val[input_icopim_detil_sifat][$parent][$j]."',jumlah = '".$val[input_icopim_detil_jml][$parent][$j]."', bayar_jasa = '".$val[input_icopim_detil_bayar][$parent][$j]."' WHERE id = '".$val[input_kunjungan_icopim_detil_id][$parent][$j]."'"; } elseif($field == "penunjang") { //penunjang $sql = "UPDATE kunjungan_bayar SET hak_id = '".$val[input_icopim_detil_hak][$parent][$j]."', biaya_jasa = '".$val[input_icopim_detil_biaya][$parent][$j]."', sifat = '".$val[input_icopim_detil_sifat][$parent][$j]."',jumlah = '".$val[input_icopim_detil_jml][$parent][$j]."', bayar_jasa = '".$val[input_icopim_detil_bayar][$parent][$j]."' WHERE id = '".$val[input_kunjungan_icopim_detil_id][$parent][$j]."'"; } else { //lain-lain } //$objResponse->addAppend("debug", "innerHTML", $field . " => " . $sql . "<br /><br />"); $kon->sql = $sql; $kon->execute(); } //endfor } next($val[input_icopim]); } //BHP for($i=0;$i<sizeof($val[input_bhp]);$i++) { $kunci = key($val[input_bhp]); /* //get $sql = "SELECT * FROM bhp WHERE id = '".$val[input_bhp][$kunci]."'"; $kon->sql = $sql; $kon->execute(); $data_bhp[$i] = $kon->getOne(); //$objResponse->addAssign("debug", "innerHTML", $sql); $bhp_p[$i] = $data_bhp[$i][bhp_p] * $val[input_bhp_bayar][$kunci]; $bhp_rs[$i] = $data_bhp[$i][bhp_rs] * $val[input_bhp_bayar][$kunci]; $bhp_rs_adm[$i] = $data_bhp[$i][bhp_rs_adm] * $val[input_bhp_bayar][$kunci]; $bhp_rs_op[$i] = $data_bhp[$i][bhp_rs_op] * $val[input_bhp_bayar][$kunci]; */ if(!$val[input_kunjungan_bhp_id][$kunci]) { //insert $sql = " INSERT INTO kunjungan_bayar ( nama, kunjungan_kamar_id, bhp_id, hak_id, biaya_bhp, sifat, jumlah, bayar_bhp, bhp_p, bhp_rs, bhp_rs_adm, bhp_rs_op ) SELECT '".$val[input_bhp_nama][$i]."', '".$val[input_id_kunjungan_kamar]."', '".$val[input_bhp][$kunci]."', '".$val[input_bhp_hak][$kunci]."', '".$val[input_bhp_biaya][$kunci]."', '".$val[input_bhp_sifat][$kunci]."', '".$val[input_bhp_jml][$kunci]."', '".$val[input_bhp_bayar][$kunci]."', bhp_p, bhp_rs, bhp_rs_adm, bhp_rs_op FROM bhp WHERE id = '".$val[input_bhp][$kunci]."' "; $kon->sql = $sql; $kon->execute(); } else { //update $sql = " UPDATE kunjungan_bayar SET hak_id = '".$val[input_bhp_hak][$kunci]."', biaya_bhp = '".$val[input_bhp_biaya][$kunci]."', sifat = '".$val[input_bhp_sifat][$kunci]."', jumlah = '".$val[input_bhp_jml][$kunci]."', bayar_bhp = '".$val[input_bhp_bayar][$kunci]."' WHERE id = '".$val[input_kunjungan_bhp_id][$kunci]."'"; $kon->sql = $sql; //$objResponse->addAssign("debug", "innerHTML", $sql); $kon->execute(); } next($val[input_bhp]); } //KENDARAAN for($i=0;$i<sizeof($val[input_kendaraan_jenis]);$i++) { $parent = key($val[input_kendaraan_jenis]); //get if(!$val[input_kunjungan_kendaraan_id][$parent] && $val[input_kendaraan_jenis][$parent]) { //insert $sql = "INSERT INTO kunjungan_kendaraan (kunjungan_kamar_id, nama, jarak_tempuh, harga_bbm, tgl) VALUES ('".$val[input_id_kunjungan_kamar]."', '".$val[input_kendaraan_jenis][$parent]."', '".$val[input_jarak_tempuh]."', '".$val[input_harga_bbm]."', NOW())"; $kon->sql = $sql; $kon->execute(); $id_kki = $kon->last_id; if($val[input_kendaraan_jenis][$parent] == "SEWA AMBULANCE") { $jasa_p = '0.75'; $jasa_rs = '0.25'; $jasa_rs_op = '0.2'; $jasa_rs_kembang = '0.025'; $jasa_rs_adm = '0.025'; } else { //SEWA MOBIL JENAZAH $jasa_p = '0.5'; $jasa_rs = '0.5'; $jasa_rs_op = '0.4'; $jasa_rs_kembang = '0.05'; $jasa_rs_adm = '0.05'; } /*diinsert satu satu*/ /* $data[bahan_habis_pakai] = round(0.5 * $biaya); $data[jasa_rumah_sakit] = round(0.25 * $biaya); $data[rumah_tangga] = round(0.0375 * $biaya); $data[sopir] = round(0.10625 * $biaya); $data[perawat] = round(0.10625 * $biaya); */ for($j=0;$j<sizeof($val[input_kendaraan_field][$parent]);$j++) { $field = ""; $field = $val[input_kendaraan_field][$parent][$j]; if($field == "jasa_rumah_sakit") { $sql = "INSERT INTO kunjungan_bayar (nama, kunjungan_kamar_id, kunjungan_kendaraan_id, hak_id, biaya_jasa, bayar_jasa, jasa_p, jasa_rs, jasa_rs_op, jasa_rs_kembang, jasa_rs_adm) VALUES ('".$field."', '".$val[input_id_kunjungan_kamar]."', '".$id_kki."', '".$val[input_kendaraan_hak][$parent][$j]."', '".$val[input_kendaraan_biaya][$parent][$j]."', '".$val[input_kendaraan_bayar][$parent][$j]."', '".$jasa_p."', '".$jasa_rs."', '".$jasa_rs_op."', '".$jasa_rs_kembang."', '".$jasa_rs_adm."')"; } elseif($field == "bahan_habis_pakai") { $sql = "INSERT INTO kunjungan_bayar (nama, kunjungan_kamar_id, kunjungan_kendaraan_id, hak_id, biaya_bhp, bayar_bhp, bhp_rs, bhp_rs_op) VALUES ('".$field."', '".$val[input_id_kunjungan_kamar]."', '".$id_kki."', '".$val[input_kendaraan_hak][$parent][$j]."', '".$val[input_kendaraan_biaya][$parent][$j]."', '".$val[input_kendaraan_bayar][$parent][$j]."', '1', '1')"; } elseif($field == "rumah_tangga") { $sql = "INSERT INTO kunjungan_bayar (nama, kunjungan_kamar_id, kunjungan_kendaraan_id, hak_id, biaya_jasa, bayar_jasa, grabaf, netto) VALUES ('".$field."', '".$val[input_id_kunjungan_kamar]."', '".$id_kki."', '".$val[input_kendaraan_hak][$parent][$j]."', '".$val[input_kendaraan_biaya][$parent][$j]."', '".$val[input_kendaraan_bayar][$parent][$j]."', '1', '1')"; } elseif($field == "sopir") { $sql = "INSERT INTO kunjungan_bayar (nama, kunjungan_kamar_id, kunjungan_kendaraan_id, hak_id, biaya_jasa, bayar_jasa, grabaf, netto) VALUES ('".$field."', '".$val[input_id_kunjungan_kamar]."', '".$id_kki."', '".$val[input_kendaraan_hak][$parent][$j]."', '".$val[input_kendaraan_biaya][$parent][$j]."', '".$val[input_kendaraan_bayar][$parent][$j]."', '1', '1')"; } elseif($field == "perawat") { $sql = "INSERT INTO kunjungan_bayar (nama, kunjungan_kamar_id, kunjungan_kendaraan_id, hak_id, biaya_jasa, bayar_jasa, perawat, netto) VALUES ('".$field."', '".$val[input_id_kunjungan_kamar]."', '".$id_kki."', '".$val[input_kendaraan_hak][$parent][$j]."', '".$val[input_kendaraan_biaya][$parent][$j]."', '".$val[input_kendaraan_bayar][$parent][$j]."', '1','1')"; } else { //lain-lain } //$objResponse->addAppend("debug", "innerHTML", $sql . "<br /><br />"); $kon->sql = $sql; $kon->execute(); } } else { //UPDATE $sqlup = "UPDATE kunjungan_kendaraan SET jarak_tempuh = '".$val[input_jarak_tempuh]."', harga_bbm = '".$val[input_harga_bbm]."' WHERE id = '".$val[input_kunjungan_kendaraan_id][$parent]."'"; $kon->sql = $sqlup; $kon->execute(); /*diinsert satu satu*/ for($j=0;$j<sizeof($val[input_kendaraan_field][$parent]);$j++) { $field = ""; $field = $val[input_kendaraan_field][$parent][$j]; //$objResponse->addAppend("debug", "innerHTML", $field . " => " . $val[input_icopim_detil_bayar][$parent][$field] . "<br />"); if($field == "jasa_rumah_sakit") { $sql = "UPDATE kunjungan_bayar SET hak_id = '".$val[input_kendaraan_hak][$parent][$j]."', biaya_jasa = '".$val[input_kendaraan_biaya][$parent][$j]."', bayar_jasa = '".$val[input_kendaraan_bayar][$parent][$j]."' WHERE id = '".$val[input_kunjungan_bayar_id][$parent][$j]."'"; } elseif($field == "bahan_habis_pakai") { $sql = "UPDATE kunjungan_bayar SET hak_id = '".$val[input_kendaraan_hak][$parent][$j]."', biaya_bhp = '".$val[input_kendaraan_biaya][$parent][$j]."', bayar_bhp = '".$val[input_kendaraan_bayar][$parent][$j]."' WHERE id = '".$val[input_kunjungan_bayar_id][$parent][$j]."'"; } elseif($field == "rumah_tangga") { $sql = "UPDATE kunjungan_bayar SET hak_id = '".$val[input_kendaraan_hak][$parent][$j]."', biaya_jasa = '".$val[input_kendaraan_biaya][$parent][$j]."', bayar_jasa = '".$val[input_kendaraan_bayar][$parent][$j]."' WHERE id = '".$val[input_kunjungan_bayar_id][$parent][$j]."'"; } elseif($field == "sopir") { $sql = "UPDATE kunjungan_bayar SET hak_id = '".$val[input_kendaraan_hak][$parent][$j]."', biaya_jasa = '".$val[input_kendaraan_biaya][$parent][$j]."', bayar_jasa = '".$val[input_kendaraan_bayar][$parent][$j]."' WHERE id = '".$val[input_kunjungan_bayar_id][$parent][$j]."'"; } elseif($field == "perawat") { $sql = "UPDATE kunjungan_bayar SET hak_id = '".$val[input_kendaraan_hak][$parent][$j]."', biaya_jasa = '".$val[input_kendaraan_biaya][$parent][$j]."', bayar_jasa = '".$val[input_kendaraan_bayar][$parent][$j]."' WHERE id = '".$val[input_kunjungan_bayar_id][$parent][$j]."'"; } else { //lain-lain } //$objResponse->addAppend("debug", "innerHTML", $field . " => " . $sql . "<br /><br />"); $kon->sql = $sql; $kon->execute(); } //endfor } next($val[input_kendaraan_jenis]); } //simpan di database apotek //pasien id $usercreated = $_SESSION["username"]; $unit_id = 4; $tgl=date("d/m/Y"); if (!$val[input_no_resep]) { $sql="insert into db_apotek.resep_head (no_resep,param_no,pasien_id,created_datetime,created_user,tgl,unit_id) values('".$val[input_no_resep]."','".$val[input_param_no]."','".$val[input_pasien_id]."',now(),'$usercreated','$tgl','$unit_id')"; $kon->sql = $sql; $kon->execute(); } else { $sql="update db_apotek.resep_head set param_no='".$val[input_param_no]."', pasien_id='".$val[input_pasien_id]."', created_datetime= now(), created_user = '******', tgl='$tgl', unit_id=4 where no_resep = '".$val[input_no_resep]."'"; $kon->sql = $sql; $kon->execute(); } //BHP for($i = 0; $i < sizeof($val[input_bhp]); $i++) { $kunci = key($val[input_bhp]); //ambil kode barang $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 from db_apotek.ms_barang where db_apotek.ms_barang.id ='".$val[input_bhp][$i]."'"; $kon->sql = $sql; $kon->execute(); $ref = $kon->getOne(); //ambil data kd_barang $date = date("d/m/Y"); $sql = "INSERT INTO db_apotek.resep (no_resep, pasien_id, kode_obat, tgl, diminta,dosis_id,ket,racikan) VALUES ('".$val[input_no_resep]."','".$val[input_pasien_id]."', '".$ref[kd_barang]. "', '$date','".$val[input_bhp_jml][$i]."','".$val[input_dosis][$i]."','".$val[input_ket][$i]."','".$val[input_bhp_sifat][$i]."')"; $kon->sql = $sql; $kon->execute(); next($val[input_bhp]); } if($afek < 0) { $objResponse->addAlert("Data Kunjungan Tidak Dapat Disimpan\nHubungi Bagian SIM."); } else { $objResponse->addScriptCall("list_data", "0"); $objResponse->addScriptCall("tutup_kunjungan"); $objResponse->addScriptCall("show_status_simpan"); } return $objResponse; }
function simpan_kunjungan($value) { $cleaner = new FormCleaner; $cleaner->setValue($value); $cleaner->clean(); $val = $cleaner->getValue(); $kon = new Konek; if($val[beri_resep]==1){ $resep="YA"; }else{ $resep="TIDAK"; } $objResponse = new xajaxResponse; //awal tambah kunjungan if($value[input_kelanjutan]=='DIRUJUK'){ $sql_kunjungan_ke = " SELECT CASE WHEN (MAX(kunjungan_ke) IS NULL) THEN '1' ELSE (MAX(kunjungan_ke) + 1) END AS kunjungan_ke FROM kunjungan WHERE pasien_id = '".$value[input_pasien_id]."' "; // $objResponse->addAssign("debug", "innerHTML", $sql_kunjungan_ke); $kon->sql = $sql_kunjungan_ke; $kon->execute(); $kunjungan_ke = $kon->getOne(); $sql_kunjungan = " INSERT INTO kunjungan( kunjungan_ke, pasien_id, perujuk_id, cara_masuk, id_petugas ) VALUES( '".$kunjungan_ke[kunjungan_ke]."', '".$value[input_pasien_id]."', NULLIF('".$value[input_dokter_id]."', ''), 'RUJUKAN', '". $_SESSION[username] ."' )"; // $objResponse->addAlert($sql_kunjungan); $kon->sql = $sql_kunjungan; $kon->execute(); $sql_last = "select * from kunjungan where LAST_INSERT_ID(id) ORDER BY id DESC LIMIT 1"; $kon->sql = $sql_last; $kon->execute(); $idk = $kon->getOne(); $id_kunjungan = $idk[id]; //no antrian $tgl_periksa = tanggalIndo($val[input_tgl_daftar],'Y-m-d'); if($val[dokter_id]) $s = " AND dokter_id = '".$val[dokter_id]."' "; else $s = " AND dokter_id IS NULL "; $kon = new Konek; $sql = " SELECT CASE WHEN (MAX(no_antrian) IS NULL) THEN '1' ELSE (MAX(no_antrian) + 1) END AS no_antrian FROM kunjungan_kamar WHERE kamar_id = '".$val[input_poli]."' AND DATE(tgl_periksa) = '".$tgl_periksa."' $s "; $kon->sql = $sql; $kon->execute(); $data_antrian = $kon->getOne(); $no_antrian = $data_antrian[no_antrian]; //$objResponse->addAssign("debug", "innerHTML", $tgl_periksa); /* masuk rajal */ $sql_kamar = "INSERT INTO kunjungan_kamar(kunjungan_id,kamar_id,no_antrian,tgl_daftar,tgl_periksa, "; $sql_kamar .="tgl_keluar,dokter_id,cara_bayar,jenis_askes,perusahaan_id, nomor, pj_nama, pj_alamat, "; $sql_kamar .="pj_telp, pj_hubungan_keluarga) select kunjungan_id,".$value[kamar_id].",'".$no_antrian."',NOW(),NOW(),NOW(),".$value[dokter_id].", cara_bayar,jenis_askes,perusahaan_id, nomor,pj_nama, pj_alamat, pj_telp, pj_hubungan_keluarga from kunjungan_kamar where id='".$value[kunjungan_kamar]."'"; $kon->sql = $sql_kamar; $kon->execute(); $sql_last = "select * from kunjungan_kamar where LAST_INSERT_ID(id) ORDER BY id DESC LIMIT 1"; $kon->sql = $sql_last; $kon->execute(); $id_kamar = $kon->getOne(); $id_kunjungan_kamar = $id_kamar[id]; //$objResponse->addAlert($sql_kamar); $kon->sql = "INSERT INTO tracer (kunjungan_kamar_id, pasien_id, keperluan, tgl_keluar, cetak) VALUES ('". $id_kunjungan_kamar."', '".$last_id."', 'PEMERIKSAAN', '".$value[tgl_periksa_thn]. "-".$value[tgl_periksa_bln]."-".$value[tgl_periksa_tgl]."', 'BELUM')"; $kon->execute(); $afek_kunjungan = $kon->affected_rows; //$objResponse->addAssign("debug", "innerHTML", $sql_kamar); if($afek_kunjungan < 0) { $objResponse->addAlert("Data Kunjungan Tidak Dapat Disimpan.\nCek kembali."); //$objResponse->addAssign("debug", "innerHTML", $sql); $objResponse->addScriptCall("fokus", "id"); } else { //tarif poli $sql = " INSERT INTO kunjungan_bayar ( nama, kunjungan_kamar_id, poli_id, hak_id, biaya_bhp, biaya_jasa, jumlah, bayar_bhp, bayar_jasa, mampu_bayar_bhp, jasa_p, jasa_rs, jasa_rs_op, jasa_rs_kembang, jasa_rs_adm, jasa_rs_sdm, spesialis, spesialis_pendamping, ugp, grabaf, perawat, penunjang, zakat, pajak, tgl ) SELECT '".$bayar_poli[nama_pel]."', '".$id_kunjungan_kamar."', '".$bayar_poli[id_poli]."', '89', biaya_bhp, '".$bayar_poli[tarif]."', '1', biaya_bhp, '".$bayar_poli[tarif]."', biaya_bhp, jasa_p, jasa_rs, jasa_rs_op, jasa_rs_kembang, jasa_rs_adm, jasa_rs_sdm, spesialis, spesialis_pendamping, ugp, grabaf, perawat, penunjang, zakat, pajak, NOW() FROM karcis WHERE id = '72' "; $kon->sql = $sql; //$objResponse->addAppend("debug", "innerHTML", $sql); $kon->execute();} }else{ //update $kon->sql = " UPDATE kunjungan SET keadaan_keluar = '".$val[input_keadaan_keluar]."',resep = '".$resep."' WHERE id = '".$val[input_id_kunjungan]."' "; $kon->execute(); //update $sql = " UPDATE kunjungan_kamar SET status_periksa = 1, dokter_id = NULLIF('".$val[input_dokter_id]."', ''), kelanjutan = NULLIF('".$val[input_kelanjutan]."',''), diagnosa_utama_id = NULLIF('".$val[input_diagnosa_utama]."', '') WHERE id = '".$val[input_id_kunjungan_kamar]."' "; $kon->sql = $sql; $kon->execute(); } //$afek = $kon->affected_rows; $afek = $kon->getJml(); $objResponse = new xajaxResponse(); //$objResponse->addAlert(print_r($val)); //$objResponse->addAppend("debug", "innerHTML", $mampu_bayar); //INSERT UPDATE KARCIS for($i = 0; $i < sizeof($val[input_karcis]); $i++) { $kunci = key($val[input_karcis]); //get /* * $kon->sql = "SELECT * FROM karcis WHERE id = '".$val[input_karcis][$kunci]."'"; * $kon->execute(); * $data_karcis[$i] = $kon->getOne(); * $jasa_p[$i] = $data_karcis[$i][jasa_p] * $val[input_karcis_bayar][$kunci]; * $jasa_rs[$i] = $data_karcis[$i][jasa_rs] * $val[input_karcis_bayar][$kunci]; * $jasa_rs_op[$i] = $data_karcis[$i][jasa_rs_op] * $val[input_karcis_bayar][$kunci]; * $jasa_rs_kembang[$i] = $data_karcis[$i][jasa_rs_kembang] * $val[input_karcis_bayar][$kunci]; * $jasa_rs_adm[$i] = $data_karcis[$i][jasa_rs_adm] * $val[input_karcis_bayar][$kunci]; * $jasa_rs_sdm[$i] = $data_karcis[$i][jasa_rs_sdm] * $val[input_karcis_bayar][$kunci]; * $spesialis[$i] = $data_karcis[$i][spesialis] * $val[input_karcis_bayar][$kunci] * $data_karcis[$i][netto]; * $spesialis_pendamping[$i] = $data_karcis[$i][spesialis_pendamping] * $val[input_karcis_bayar][$kunci] * $data_karcis[$i][netto]; * $ugp[$i] = $data_karcis[$i][ugp] * $val[input_karcis_bayar][$kunci] * $data_karcis[$i][netto]; * $grabaf[$i] = $data_karcis[$i][grabaf] * $val[input_karcis_bayar][$kunci] * $data_karcis[$i][netto]; * $perawat[$i] = $data_karcis[$i][perawat] * $val[input_karcis_bayar][$kunci] * $data_karcis[$i][netto]; * $penunjang[$i] = $data_karcis[$i][penunjang] * $val[input_karcis_bayar][$kunci] * $data_karcis[$i][netto]; * $zakat[$i] = $data_karcis[$i][zakat] * $val[input_karcis_bayar][$kunci] * $data_karcis[$i][netto]; * $pajak[$i] = $data_karcis[$i][pajak] * ($val[input_karcis_bayar][$kunci] - ($jasa_p[$i] + $jasa_rs_op[$i] + $jasa_rs_kembang[$i] + $jasa_rs_adm[$i] + $jasa_rs_sdm[$i])); * //$objResponse->addAlert("pajak : " . $pajak[$i]); */ /* BAGI BAYAR => BHP+JASA */ $biaya_bhp = 0; $biaya_jasa = 0; $selisih_biaya = 0; $biaya_bhp = round($val[input_karcis_biaya_bhp][$kunci]); $biaya_jasa = round($val[input_karcis_biaya_jasa][$kunci]); $selisih_biaya = $val[input_karcis_biaya][$kunci]-$biaya_bhp-$biaya_jasa; $biaya_jasa += $selisih_biaya; $bayar_bhp = 0; $bayar_jasa = 0; $selisih_bayar = 0; $bayar_bhp = round($val[input_karcis_biaya_bhp][$kunci]); $bayar_jasa = round($val[input_karcis_biaya_jasa][$kunci]); $selisih_bayar = $val[input_karcis_bayar][$kunci]-$bayar_bhp-$bayar_jasa; $bayar_jasa += $selisih_bayar; if(!$val[input_kunjungan_karcis_id][$kunci]) { //insert $sql = " INSERT INTO kunjungan_bayar ( nama, kunjungan_kamar_id, karcis_id, hak_id, biaya_bhp, biaya_jasa, jumlah, bayar_bhp, bhp_p, bhp_rs, bhp_rs_adm, bhp_rs_op, bayar_jasa, jasa_p, jasa_rs, jasa_rs_op, jasa_rs_kembang, jasa_rs_adm, jasa_rs_sdm, spesialis, spesialis_pendamping, ugp, grabaf, perawat, penunjang, zakat, pajak, netto ) SELECT '".$val[input_karcis_nama][$i]."', '".$val[input_id_kunjungan_kamar]."', '".$val[input_karcis][$kunci]."', '".$val[input_karcis_hak][$kunci]."', '".$biaya_bhp."', '".$biaya_jasa."', '".$val[input_karcis_jml][$kunci]."', '".$bayar_bhp."', bhp_p, bhp_rs, bhp_rs_adm, bhp_rs_op, '".$bayar_jasa."', jasa_p, jasa_rs, jasa_rs_op, jasa_rs_kembang, jasa_rs_adm, jasa_rs_sdm, spesialis, spesialis_pendamping, ugp, grabaf, perawat, penunjang, zakat, pajak, netto FROM karcis WHERE id = '".$val[input_karcis][$kunci]."' "; $kon->sql = $sql; $kon->execute(); } else { //update $sql = " UPDATE kunjungan_bayar SET hak_id = '".$val[input_karcis_hak][$kunci]."', jumlah = '".$val[input_karcis_jml][$kunci]."', biaya_bhp = '".$biaya_bhp."', biaya_jasa = '".$biaya_jasa."', bayar_bhp = '".$bayar_bhp."', bayar_jasa = '".$bayar_jasa."' WHERE id = '".$val[input_kunjungan_karcis_id][$kunci]."'"; $kon->sql = $sql; $kon->execute(); //$objResponse->addAppend("debug", "innerHTML", $sql); } //$objResponse->addAppend("debug", "innerHTML", $sql); next($val[input_karcis]); } //TINDAKAN for($i=0;$i<sizeof($val[input_icopim]);$i++) { $kunci = key($val[input_icopim]); $parent = $val[input_icopim_parent][$i]; //get if(!$val[input_kunjungan_icopim_id][$kunci] && $val[input_icopim][$kunci]) { //insert $sql = "INSERT INTO kunjungan_kamar_icopim (kunjungan_kamar_id, icopim_id, nama) VALUES ('".$val[input_id_kunjungan_kamar]."', '".$val[input_icopim][$kunci]."', '".$val[input_icopim_nama][$kunci]."')"; $kon->sql = $sql; $kon->execute(); $id_kki = $kon->last_id; //$objResponse->addAppend("debug", "innerHTML", $field . " => " . $val[input_icopim_detil_bayar][$parent][$field] . "<br />"); $sql = "INSERT INTO kunjungan_bayar (nama, kunjungan_kamar_id, kunjungan_kamar_icopim_id, icopim_detil_id, hak_id, biaya_jasa,tgl) VALUES ('".$val[input_icopim_nama][$kunci]."', '".$val[input_id_kunjungan_kamar]."', '".$id_kki."', '".$val[input_icopim_detil][$kunci]."', '".$val[input_icopim_hak][$kunci]."', '".$val[input_icopim_biaya][$kunci]."', NOW())"; $kon->sql = $sql; $kon->execute(); } else { //UPDATE /*diinsert satu satu*/ $sql = "UPDATE kunjungan_bayar SET hak_id = '".$val[input_icopim_hak][$kunci]."', biaya_jasa = '".$val[input_icopim_biaya][$kunci]."' WHERE id = '".$val[input_kunjungan_icopim_id][$kunci]."'"; //$objResponse->addAppend("debug", "innerHTML", $field . " => " . $sql . "<br /><br />"); $kon->sql = $sql; $kon->execute(); } //endfor next($val[input_icopim]); } //BHP for($i = 0; $i < sizeof($val[input_bhp]); $i++) { $kunci = key($val[input_bhp]); /* * //get * $sql = "SELECT * FROM bhp WHERE id = '".$val[input_bhp][$kunci]."'"; * $kon->sql = $sql; * $kon->execute(); * $data_bhp[$i] = $kon->getOne(); * * //$objResponse->addAssign("debug", "innerHTML", $sql); * * $bhp_p[$i] = $data_bhp[$i][bhp_p] * $val[input_bhp_bayar][$kunci]; * $bhp_rs[$i] = $data_bhp[$i][bhp_rs] * $val[input_bhp_bayar][$kunci]; * $bhp_rs_adm[$i] = $data_bhp[$i][bhp_rs_adm] * $val[input_bhp_bayar][$kunci]; * $bhp_rs_op[$i] = $data_bhp[$i][bhp_rs_op] * $val[input_bhp_bayar][$kunci]; */ if(!$val[input_kunjungan_bhp_id][$kunci]) { //insert /*$sql = " INSERT INTO kunjungan_bayar ( nama, kunjungan_kamar_id, bhp_id, hak_id, biaya_bhp, sifat, jumlah, bayar_bhp, bhp_p, bhp_rs, bhp_rs_adm, bhp_rs_op ) SELECT '".$val[input_bhp_nama][$i]."', '".$val[input_id_kunjungan_kamar]."', '".$val[input_bhp][$kunci]."', '".$val[input_bhp_hak][$kunci]."', '".$val[input_bhp_biaya][$kunci]."', '".$val[input_bhp_sifat][$kunci]."', '".$val[input_bhp_jml][$kunci]."', '".$val[input_bhp_bayar][$kunci]."', bhp_p, bhp_rs, bhp_rs_adm, bhp_rs_op FROM bhp WHERE id = '".$val[input_bhp][$kunci]."' "; $kon->sql = $sql; $kon->execute();*/ $sql = " INSERT INTO kunjungan_bayar ( nama, kunjungan_kamar_id, bhp_id, hak_id, biaya_bhp, sifat, jumlah, bayar_bhp, tgl, no_resep ) VALUES ( '".$val[input_bhp_nama][$i]."', '".$val[input_id_kunjungan_kamar]."', '".$val[input_bhp][$kunci]."', '".$val[input_bhp_hak][$kunci]."', '".$val[input_bhp_biaya][$kunci]."', '".$val[input_bhp_sifat][$kunci]."', '".$val[input_bhp_jml][$kunci]."', '".$val[input_bhp_bayar][$kunci]."', NOW(), '".$val[input_no_resep]."') "; $kon->sql = $sql; $kon->execute(); $temp .= $sql; } else { //update $sql = " UPDATE kunjungan_bayar SET hak_id = '".$val[input_bhp_hak][$kunci]."', biaya_bhp = '".$val[input_bhp_biaya][$kunci]."', sifat = '".$val[input_bhp_sifat][$kunci]."', jumlah = '".$val[input_bhp_jml][$kunci]."', bayar_bhp = '".$val[input_bhp_bayar][$kunci]."' WHERE id = '".$val[input_kunjungan_bhp_id][$kunci]."'"; $kon->sql = $sql; //$objResponse->addAssign("debug", "innerHTML", $sql); $kon->execute(); } next($val[input_bhp]); } //simpan di database apotek //pasien id $usercreated = $_SESSION["username"]; $unit_id = 4; $tgl=date("d/m/Y"); $sql="insert into db_apotek.resep_head (no_resep,param_no,pasien_id,created_datetime,created_user,tgl,unit_id,cara_masuk,flags) values('".$val[input_no_resep]."','".$val[input_param_no]."','".$val[input_pasien_id]."',now(),'$usercreated','$tgl','$unit_id','RAWAT JALAN',3)"; $kon->sql = $sql; $kon->execute(); //BHP for($i = 0; $i < sizeof($val[input_bhp]); $i++) { $kunci = key($val[input_bhp]); //ambil kode barang $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 from db_apotek.ms_barang where db_apotek.ms_barang.id ='".$val[input_bhp][$i]."'"; $kon->sql = $sql; $kon->execute(); $ref = $kon->getOne(); //ambil data kd_barang $date = date("d/m/Y"); $sql = "INSERT INTO db_apotek.resep (no_resep, pasien_id, kode_obat, tgl, diminta,dosis_id,ket,racikan,flags) VALUES ('".$val[input_no_resep]."','".$val[input_pasien_id]."', '".$ref[kd_barang]. "', '$date','".$val[input_bhp_jml][$i]."','".$val[input_dosis][$i]."','".$val[input_ket][$i]."','-',3)"; $kon->sql = $sql; $kon->execute(); next($val[input_bhp]); } if($afek < 0) { $objResponse->addAlert("Data Kunjungan Tidak Dapat Disimpan\nHubungi Bagian SIM."); } else { $objResponse->addScriptCall("list_data", "0"); $objResponse->addScriptCall("tutup_kunjungan"); $objResponse->addScriptCall("show_status_simpan"); } return $objResponse; }
function simpan_kunjungan($value) { $cleaner = new FormCleaner; $cleaner->setValue($value); $cleaner->clean(); $val = $cleaner->getValue(); $kon = new Konek; //update $kon->sql = " UPDATE kunjungan SET keadaan_keluar = '".$val[input_keadaan_keluar]."' WHERE id = '".$val[input_id_kunjungan]."' "; $kon->execute(); $sql = " UPDATE kunjungan_kamar SET kelanjutan = '".$val[input_kelanjutan]."', tgl_keluar = '".$val[input_tgl_keluar_thn]."-".$val[input_tgl_keluar_bln]."-".$val[input_tgl_keluar_tgl]." ".$val[input_tgl_keluar_jam].":".$val[input_tgl_keluar_mnt].":00' WHERE id = '".$val[input_id_kunjungan_kamar]."' "; //} $kon->sql = $sql; $kon->execute(); $afek = $kon->getJml(); $objResponse = new xajaxResponse(); //$objResponse->addAssign("debug", "innerHTML", $sql); if($afek < 0) { $objResponse->addAlert("Data Pemulangan Tidak Dapat Disimpan\nHubungi Bagian SIM."); } else { $objResponse->addScriptCall("list_data", "0"); $objResponse->addScriptCall("xajax_tutup_kunjungan"); $objResponse->addScriptCall("show_status_simpan"); } return $objResponse; }
function simpan_kunjungan($value, $langsung_bayar = false, $tutup_modal = true) { $cleaner = new FormCleaner; $cleaner->setValue($value); $cleaner->clean(); $val = $cleaner->getValue(); $kon = new Konek; //update $kon->sql = " UPDATE kunjungan SET keadaan_keluar = '".$val[input_keadaan_keluar]."' WHERE id = '".$val[input_id_kunjungan]."' "; $kon->execute(); //update $sql = " UPDATE kunjungan_kamar SET dokter_id = NULLIF('".$val[input_dokter_id]."', ''), kelanjutan = NULLIF('".$val[input_kelanjutan]."',''), diagnosa_utama_id = NULLIF('".$val[input_diagnosa_utama]."', ''), tgl_keluar = '".$val[input_tgl_keluar_thn]."-".$val[input_tgl_keluar_bln]."-".$val[input_tgl_keluar_tgl]." ".$val[input_tgl_keluar_jam].":".$val[input_tgl_keluar_mnt].":00' WHERE id = '".$val[input_id_kunjungan_kamar]."' "; $kon->sql = $sql; $kon->execute(); $afek = $kon->affected_rows; $objResponse = new xajaxResponse(); //LANGSUNG BAYAR if($langsung_bayar == true) { $id_kwitansi = bikinKwitansi(); $mampu_bayar = @round($val[mampu]/$val[total]); } else { $id_kwitansi = NULL; $mampu_bayar = 1; } //$objResponse->addAlert(print_r($val)); //$objResponse->addAppend("debug", "innerHTML", $mampu_bayar); //INSERT UPDATE KARCIS for($i=0;$i<sizeof($val[input_karcis]);$i++) { $kunci = key($val[input_karcis]); //get /* $kon->sql = "SELECT * FROM karcis WHERE id = '".$val[input_karcis][$kunci]."'"; $kon->execute(); $data_karcis[$i] = $kon->getOne(); $jasa_p[$i] = $data_karcis[$i][jasa_p] * $val[input_karcis_bayar][$kunci]; $jasa_rs[$i] = $data_karcis[$i][jasa_rs] * $val[input_karcis_bayar][$kunci]; $jasa_rs_op[$i] = $data_karcis[$i][jasa_rs_op] * $val[input_karcis_bayar][$kunci]; $jasa_rs_kembang[$i] = $data_karcis[$i][jasa_rs_kembang] * $val[input_karcis_bayar][$kunci]; $jasa_rs_adm[$i] = $data_karcis[$i][jasa_rs_adm] * $val[input_karcis_bayar][$kunci]; $jasa_rs_sdm[$i] = $data_karcis[$i][jasa_rs_sdm] * $val[input_karcis_bayar][$kunci]; $spesialis[$i] = $data_karcis[$i][spesialis] * $val[input_karcis_bayar][$kunci] * $data_karcis[$i][netto]; $spesialis_pendamping[$i] = $data_karcis[$i][spesialis_pendamping] * $val[input_karcis_bayar][$kunci] * $data_karcis[$i][netto]; $ugp[$i] = $data_karcis[$i][ugp] * $val[input_karcis_bayar][$kunci] * $data_karcis[$i][netto]; $grabaf[$i] = $data_karcis[$i][grabaf] * $val[input_karcis_bayar][$kunci] * $data_karcis[$i][netto]; $perawat[$i] = $data_karcis[$i][perawat] * $val[input_karcis_bayar][$kunci] * $data_karcis[$i][netto]; $penunjang[$i] = $data_karcis[$i][penunjang] * $val[input_karcis_bayar][$kunci] * $data_karcis[$i][netto]; $zakat[$i] = $data_karcis[$i][zakat] * $val[input_karcis_bayar][$kunci] * $data_karcis[$i][netto]; $pajak[$i] = $data_karcis[$i][pajak] * ($val[input_karcis_bayar][$kunci] - ($jasa_p[$i] + $jasa_rs_op[$i] + $jasa_rs_kembang[$i] + $jasa_rs_adm[$i] + $jasa_rs_sdm[$i])); //$objResponse->addAlert("pajak : " . $pajak[$i]); */ if(!$val[input_kunjungan_karcis_id][$kunci]) { //insert $sql = " INSERT INTO kunjungan_bayar ( nama, kunjungan_kamar_id, karcis_id, hak_id, biaya, jumlah, bayar, mampu_bayar, jasa_p, jasa_rs, jasa_rs_op, jasa_rs_kembang, jasa_rs_adm, jasa_rs_sdm, spesialis, spesialis_pendamping, ugp, grabaf, perawat, penunjang, zakat, pajak ) SELECT '".$val[input_karcis_nama][$i]."', '".$val[input_id_kunjungan_kamar]."', '".$val[input_karcis][$kunci]."', '".$val[input_karcis_hak][$kunci]."', '".$val[input_karcis_biaya][$kunci]."', '".$val[input_karcis_jml][$kunci]."', '".$val[input_karcis_bayar][$kunci]."', '".($val[input_karcis_bayar][$kunci]*$mampu_bayar)."', jasa_p, jasa_rs, jasa_rs_op, jasa_rs_kembang, jasa_rs_adm, jasa_rs_sdm, spesialis, spesialis_pendamping, ugp, grabaf, perawat, penunjang, zakat, pajak FROM karcis WHERE id = '".$val[input_karcis][$kunci]."' "; $kon->sql = $sql; $kon->execute(); } else { //update $sql = " UPDATE kunjungan_bayar SET hak_id = '".$val[input_karcis_hak][$kunci]."', biaya = '".$val[input_karcis_biaya][$kunci]."', jumlah = '".$val[input_karcis_jml][$kunci]."', bayar = '".$val[input_karcis_bayar][$kunci]."', mampu_bayar = '".($val[input_karcis_bayar][$kunci]*$mampu_bayar)."' WHERE id = '".$val[input_kunjungan_karcis_id][$kunci]."'"; $kon->sql = $sql; $kon->execute(); //$objResponse->addAppend("debug", "innerHTML", $sql); } //$objResponse->addAppend("debug", "innerHTML", $sql); next($val[input_karcis]); } //TINDAKAN for($i=0;$i<sizeof($val[input_icopim]);$i++) { $kunci = key($val[input_icopim]); $parent = $val[input_icopim_parent][$i]; //get if(!$val[input_kunjungan_icopim_id][$kunci] && $val[input_icopim][$kunci]) { //insert $sql = "INSERT INTO kunjungan_kamar_icopim (kunjungan_kamar_id, icopim_id, nama) VALUES ('".$val[input_id_kunjungan_kamar]."', '".$val[input_icopim][$kunci]."', '".$val[input_icopim_nama][$kunci]."')"; $kon->sql = $sql; $kon->execute(); $id_kki = $kon->last_id; //$objResponse->addAppend("debug", "innerHTML", $parent . "<br /><br />"); /*diinsert satu satu*/ for($j=0;$j<sizeof($val[input_icopim_detil_field][$parent]);$j++) { $field = ""; $field = $val[input_icopim_detil_field][$parent][$j]; /* $netto = $val[input_icopim_detil_bayar][$parent][$field] * $val[input_icopim_detil_netto][$parent]; $zakat = $val[input_icopim_detil_bayar][$parent][$field] * $val[input_icopim_detil_netto][$parent] * $val[input_icopim_detil_zakat][$parent]; $pajak = $val[input_icopim_detil_bayar][$parent][$field] * $val[input_icopim_detil_pajak][$parent]; */ //$objResponse->addAppend("debug", "innerHTML", $field . " => " . $val[input_icopim_detil_bayar][$parent][$field] . "<br />"); if($field == "jasa_rumah_sakit") { $sql = "INSERT INTO kunjungan_bayar (nama, kunjungan_kamar_id, kunjungan_kamar_icopim_id, icopim_detil_id, hak_id, biaya, sifat, jumlah, bayar, mampu_bayar, jasa_p, jasa_rs, jasa_rs_op, jasa_rs_kembang, jasa_rs_adm, jasa_rs_sdm) SELECT '".$field."', '".$val[input_id_kunjungan_kamar]."', '".$id_kki."', '".$val[input_icopim_detil][$parent]."', '".$val[input_icopim_detil_hak][$parent][$j]."', '".$val[input_icopim_detil_biaya][$parent][$j]."', '".$val[input_icopim_detil_sifat][$parent][$j]."', '".$val[input_icopim_detil_jml][$parent][$j]."', '".$val[input_icopim_detil_bayar][$parent][$j]."', '".($val[input_icopim_detil_bayar][$parent][$j]*$mampu_bayar)."', jasa_p, jasa_rs, jasa_rs_op, jasa_rs_kembang, jasa_rs_adm, jasa_rs_sdm FROM icopim_detil WHERE id = '".$val[input_icopim_detil][$parent]."'"; } elseif($field == "spesialis") { $sql = "INSERT INTO kunjungan_bayar (nama, kunjungan_kamar_id, kunjungan_kamar_icopim_id, icopim_detil_id, hak_id, biaya, sifat, jumlah, bayar, mampu_bayar, spesialis, pajak, zakat) SELECT '".$field."', '".$val[input_id_kunjungan_kamar]."', '".$id_kki."', '".$val[input_icopim_detil][$parent]."', '".$val[input_icopim_detil_hak][$parent][$j]."', '".$val[input_icopim_detil_biaya][$parent][$j]."', '".$val[input_icopim_detil_sifat][$parent][$j]."', '".$val[input_icopim_detil_jml][$parent][$j]."', '".$val[input_icopim_detil_bayar][$parent][$j]."', '".($val[input_icopim_detil_bayar][$parent][$j]*$mampu_bayar)."', netto, pajak, zakat FROM icopim_detil WHERE id = '".$val[input_icopim_detil][$parent]."'"; } elseif($field == "spesialis_pendamping") { $sql = "INSERT INTO kunjungan_bayar (nama, kunjungan_kamar_id, kunjungan_kamar_icopim_id, icopim_detil_id, hak_id, biaya, sifat, jumlah, bayar, mampu_bayar, spesialis_pendamping, pajak, zakat) SELECT '".$field."', '".$val[input_id_kunjungan_kamar]."', '".$id_kki."', '".$val[input_icopim_detil][$parent]."', '".$val[input_icopim_detil_hak][$parent][$j]."', '".$val[input_icopim_detil_biaya][$parent][$j]."', '".$val[input_icopim_detil_sifat][$parent][$j]."', '".$val[input_icopim_detil_jml][$parent][$j]."', '".$val[input_icopim_detil_bayar][$parent][$j]."', '".($val[input_icopim_detil_bayar][$parent][$j]*$mampu_bayar)."', netto, pajak, zakat FROM icopim_detil WHERE id = '".$val[input_icopim_detil][$parent]."'"; } elseif($field == "perawat_perinatologi") { $sql = "INSERT INTO kunjungan_bayar (nama, kunjungan_kamar_id, kunjungan_kamar_icopim_id, icopim_detil_id, hak_id, biaya, sifat, jumlah, bayar, mampu_bayar, perawat_perinatologi, pajak, zakat) SELECT '".$field."', '".$val[input_id_kunjungan_kamar]."', '".$id_kki."', '".$val[input_icopim_detil][$parent]."', '".$val[input_icopim_detil_hak][$parent][$j]."', '".$val[input_icopim_detil_biaya][$parent][$j]."', '".$val[input_icopim_detil_sifat][$parent][$j]."', '".$val[input_icopim_detil_jml][$parent][$j]."', '".$val[input_icopim_detil_bayar][$parent][$j]."', '".($val[input_icopim_detil_bayar][$parent][$j]*$mampu_bayar)."', netto, pajak, zakat FROM icopim_detil WHERE id = '".$val[input_icopim_detil][$parent]."'"; } elseif($field == "dr_umum") { $sql = "INSERT INTO kunjungan_bayar (nama, kunjungan_kamar_id, kunjungan_kamar_icopim_id, icopim_detil_id, hak_id, biaya, sifat, jumlah, bayar, mampu_bayar, dr_umum, pajak, zakat) SELECT '".$field."', '".$val[input_id_kunjungan_kamar]."', '".$id_kki."', '".$val[input_icopim_detil][$parent]."', '".$val[input_icopim_detil_hak][$parent][$j]."', '".$val[input_icopim_detil_biaya][$parent][$j]."', '".$val[input_icopim_detil_sifat][$parent][$j]."', '".$val[input_icopim_detil_jml][$parent][$j]."', '".$val[input_icopim_detil_bayar][$parent][$j]."', '".($val[input_icopim_detil_bayar][$parent][$j]*$mampu_bayar)."', netto, pajak, zakat FROM icopim_detil WHERE id = '".$val[input_icopim_detil][$parent]."'"; } elseif($field == "dr_gigi") { $sql = "INSERT INTO kunjungan_bayar (nama, kunjungan_kamar_id, kunjungan_kamar_icopim_id, icopim_detil_id, hak_id, biaya, sifat, jumlah, bayar, mampu_bayar, dr_gigi, pajak, zakat) SELECT '".$field."', '".$val[input_id_kunjungan_kamar]."', '".$id_kki."', '".$val[input_icopim_detil][$parent]."', '".$val[input_icopim_detil_hak][$parent][$j]."', '".$val[input_icopim_detil_biaya][$parent][$j]."', '".$val[input_icopim_detil_sifat][$parent][$j]."', '".$val[input_icopim_detil_jml][$parent][$j]."', '".$val[input_icopim_detil_bayar][$parent][$j]."', '".($val[input_icopim_detil_bayar][$parent][$j]*$mampu_bayar)."', netto, pajak, zakat FROM icopim_detil WHERE id = '".$val[input_icopim_detil][$parent]."'"; } elseif($field == "assisten_non_dokter") { $sql = "INSERT INTO kunjungan_bayar (nama, kunjungan_kamar_id, kunjungan_kamar_icopim_id, icopim_detil_id, hak_id, biaya, sifat, jumlah, bayar, mampu_bayar, assisten_non_dokter, pajak, zakat) SELECT '".$field."', '".$val[input_id_kunjungan_kamar]."', '".$id_kki."', '".$val[input_icopim_detil][$parent]."', '".$val[input_icopim_detil_hak][$parent][$j]."', '".$val[input_icopim_detil_biaya][$parent][$j]."', '".$val[input_icopim_detil_sifat][$parent][$j]."', '".$val[input_icopim_detil_jml][$parent][$j]."', '".$val[input_icopim_detil_bayar][$parent][$j]."', '".($val[input_icopim_detil_bayar][$parent][$j]*$mampu_bayar)."', netto, pajak, zakat FROM icopim_detil WHERE id = '".$val[input_icopim_detil][$parent]."'"; } elseif($field == "spesialis_anestesi") { $sql = "INSERT INTO kunjungan_bayar (nama, kunjungan_kamar_id, kunjungan_kamar_icopim_id, icopim_detil_id, hak_id, biaya, sifat, jumlah, bayar, mampu_bayar, spesialis_anestesi, pajak, zakat) SELECT '".$field."', '".$val[input_id_kunjungan_kamar]."', '".$id_kki."', '".$val[input_icopim_detil][$parent]."', '".$val[input_icopim_detil_hak][$parent][$j]."', '".$val[input_icopim_detil_biaya][$parent][$j]."', '".$val[input_icopim_detil_sifat][$parent][$j]."', '".$val[input_icopim_detil_jml][$parent][$j]."', '".$val[input_icopim_detil_bayar][$parent][$j]."', '".($val[input_icopim_detil_bayar][$parent][$j]*$mampu_bayar)."', netto, pajak, zakat FROM icopim_detil WHERE id = '".$val[input_icopim_detil][$parent]."'"; } elseif($field == "aknest") { $sql = "INSERT INTO kunjungan_bayar (nama, kunjungan_kamar_id, kunjungan_kamar_icopim_id, icopim_detil_id, hak_id, biaya, sifat, jumlah, bayar, mampu_bayar, aknest, pajak, zakat) SELECT '".$field."', '".$val[input_id_kunjungan_kamar]."', '".$id_kki."', '".$val[input_icopim_detil][$parent]."', '".$val[input_icopim_detil_hak][$parent][$j]."', '".$val[input_icopim_detil_biaya][$parent][$j]."', '".$val[input_icopim_detil_sifat][$parent][$j]."', '".$val[input_icopim_detil_jml][$parent][$j]."', '".$val[input_icopim_detil_bayar][$parent][$j]."', '".($val[input_icopim_detil_bayar][$parent][$j]*$mampu_bayar)."', netto, pajak, zakat FROM icopim_detil WHERE id = '".$val[input_icopim_detil][$parent]."'"; } elseif($field == "gizi") { $sql = "INSERT INTO kunjungan_bayar (nama, kunjungan_kamar_id, kunjungan_kamar_icopim_id, icopim_detil_id, hak_id, biaya, sifat, jumlah, bayar, mampu_bayar, gizi, pajak, zakat) SELECT '".$field."', '".$val[input_id_kunjungan_kamar]."', '".$id_kki."', '".$val[input_icopim_detil][$parent]."', '".$val[input_icopim_detil_hak][$parent][$j]."', '".$val[input_icopim_detil_biaya][$parent][$j]."', '".$val[input_icopim_detil_sifat][$parent][$j]."', '".$val[input_icopim_detil_jml][$parent][$j]."', '".$val[input_icopim_detil_bayar][$parent][$j]."', '".($val[input_icopim_detil_bayar][$parent][$j]*$mampu_bayar)."', netto, pajak, zakat FROM icopim_detil WHERE id = '".$val[input_icopim_detil][$parent]."'"; } elseif($field == "fisioterapi") { $sql = "INSERT INTO kunjungan_bayar (nama, kunjungan_kamar_id, kunjungan_kamar_icopim_id, icopim_detil_id, hak_id, biaya, sifat, jumlah, bayar, mampu_bayar, fisioterapi, pajak, zakat) SELECT '".$field."', '".$val[input_id_kunjungan_kamar]."', '".$id_kki."', '".$val[input_icopim_detil][$parent]."', '".$val[input_icopim_detil_hak][$parent][$j]."', '".$val[input_icopim_detil_biaya][$parent][$j]."', '".$val[input_icopim_detil_sifat][$parent][$j]."', '".$val[input_icopim_detil_jml][$parent][$j]."', '".$val[input_icopim_detil_bayar][$parent][$j]."', '".($val[input_icopim_detil_bayar][$parent][$j]*$mampu_bayar)."', netto, pajak, zakat FROM icopim_detil WHERE id = '".$val[input_icopim_detil][$parent]."'"; } elseif($field == "analis_pa") { $sql = "INSERT INTO kunjungan_bayar (nama, kunjungan_kamar_id, kunjungan_kamar_icopim_id, icopim_detil_id, hak_id, biaya, sifat, jumlah, bayar, mampu_bayar, analis_pa, pajak, zakat) SELECT '".$field."', '".$val[input_id_kunjungan_kamar]."', '".$id_kki."', '".$val[input_icopim_detil][$parent]."', '".$val[input_icopim_detil_hak][$parent][$j]."', '".$val[input_icopim_detil_biaya][$parent][$j]."', '".$val[input_icopim_detil_sifat][$parent][$j]."', '".$val[input_icopim_detil_jml][$parent][$j]."', '".$val[input_icopim_detil_bayar][$parent][$j]."', '".($val[input_icopim_detil_bayar][$parent][$j]*$mampu_bayar)."', netto, pajak, zakat FROM icopim_detil WHERE id = '".$val[input_icopim_detil][$parent]."'"; } elseif($field == "bidan") { $sql = "INSERT INTO kunjungan_bayar (nama, kunjungan_kamar_id, kunjungan_kamar_icopim_id, icopim_detil_id, hak_id, biaya, sifat, jumlah, bayar, mampu_bayar, bidan, pajak, zakat) SELECT '".$field."', '".$val[input_id_kunjungan_kamar]."', '".$id_kki."', '".$val[input_icopim_detil][$parent]."', '".$val[input_icopim_detil_hak][$parent][$j]."', '".$val[input_icopim_detil_biaya][$parent][$j]."', '".$val[input_icopim_detil_sifat][$parent][$j]."', '".$val[input_icopim_detil_jml][$parent][$j]."', '".$val[input_icopim_detil_bayar][$parent][$j]."', '".($val[input_icopim_detil_bayar][$parent][$j]*$mampu_bayar)."', netto, pajak, zakat FROM icopim_detil WHERE id = '".$val[input_icopim_detil][$parent]."'"; } elseif($field == "perawat") { $sql = "INSERT INTO kunjungan_bayar (nama, kunjungan_kamar_id, kunjungan_kamar_icopim_id, icopim_detil_id, hak_id, biaya, sifat, jumlah, bayar, mampu_bayar, perawat, pajak, zakat) SELECT '".$field."', '".$val[input_id_kunjungan_kamar]."', '".$id_kki."', '".$val[input_icopim_detil][$parent]."', '".$val[input_icopim_detil_hak][$parent][$j]."', '".$val[input_icopim_detil_biaya][$parent][$j]."', '".$val[input_icopim_detil_sifat][$parent][$j]."', '".$val[input_icopim_detil_jml][$parent][$j]."', '".$val[input_icopim_detil_bayar][$parent][$j]."', '".($val[input_icopim_detil_bayar][$parent][$j]*$mampu_bayar)."', netto, pajak, zakat FROM icopim_detil WHERE id = '".$val[input_icopim_detil][$parent]."'"; } elseif($field == "penunjang") { $sql = "INSERT INTO kunjungan_bayar (nama, kunjungan_kamar_id, kunjungan_kamar_icopim_id, icopim_detil_id, hak_id, biaya, sifat, jumlah, bayar, mampu_bayar, penunjang, pajak, zakat) SELECT '".$field."', '".$val[input_id_kunjungan_kamar]."', '".$id_kki."', '".$val[input_icopim_detil][$parent]."', '".$val[input_icopim_detil_hak][$parent][$j]."', '".$val[input_icopim_detil_biaya][$parent][$j]."', '".$val[input_icopim_detil_sifat][$parent][$j]."', '".$val[input_icopim_detil_jml][$parent][$j]."', '".$val[input_icopim_detil_bayar][$parent][$j]."', '".($val[input_icopim_detil_bayar][$parent][$j]*$mampu_bayar)."', netto, pajak, zakat FROM icopim_detil WHERE id = '".$val[input_icopim_detil][$parent]."'"; } else { //lain-lain } //$objResponse->addAppend("debug", "innerHTML", $sql . "<br /><br />"); $kon->sql = $sql; $kon->execute(); } } else { //UPDATE /*diinsert satu satu*/ for($j=0;$j<sizeof($val[input_icopim_detil_field][$parent]);$j++) { $field = ""; $field = $val[input_icopim_detil_field][$parent][$j]; /* $netto = $val[input_icopim_detil_bayar][$parent][$field] * $val[input_icopim_detil_netto][$parent]; $zakat = $val[input_icopim_detil_bayar][$parent][$field] * $val[input_icopim_detil_netto][$parent] * $val[input_icopim_detil_zakat][$parent]; $pajak = $val[input_icopim_detil_bayar][$parent][$field] * $val[input_icopim_detil_pajak][$parent]; */ //$objResponse->addAppend("debug", "innerHTML", $field . " => " . $val[input_icopim_detil_bayar][$parent][$field] . "<br />"); if($field == "jasa_rumah_sakit") { $sql = "UPDATE kunjungan_bayar SET hak_id = '".$val[input_icopim_detil_hak][$parent][$j]."', biaya = '".$val[input_icopim_detil_biaya][$parent][$j]."', sifat = '".$val[input_icopim_detil_sifat][$parent][$j]."', jumlah = '".$val[input_icopim_detil_jml][$parent][$j]."', bayar = '".$val[input_icopim_detil_bayar][$parent][$j]."', mampu_bayar = '".($val[input_icopim_detil_bayar][$parent][$j]*$mampu_bayar)."' WHERE id = '".$val[input_kunjungan_icopim_detil_id][$parent][$j]."'"; } elseif($field == "spesialis") { $sql = "UPDATE kunjungan_bayar SET hak_id = '".$val[input_icopim_detil_hak][$parent][$j]."', biaya = '".$val[input_icopim_detil_biaya][$parent][$j]."', sifat = '".$val[input_icopim_detil_sifat][$parent][$j]."',jumlah = '".$val[input_icopim_detil_jml][$parent][$j]."', bayar = '".$val[input_icopim_detil_bayar][$parent][$j]."', mampu_bayar = '".($val[input_icopim_detil_bayar][$parent][$j]*$mampu_bayar)."' WHERE id = '".$val[input_kunjungan_icopim_detil_id][$parent][$j]."'"; } elseif($field == "spesialis_pendamping") { $sql = "UPDATE kunjungan_bayar SET hak_id = '".$val[input_icopim_detil_hak][$parent][$j]."', biaya = '".$val[input_icopim_detil_biaya][$parent][$j]."', sifat = '".$val[input_icopim_detil_sifat][$parent][$j]."',jumlah = '".$val[input_icopim_detil_jml][$parent][$j]."', bayar = '".$val[input_icopim_detil_bayar][$parent][$j]."', mampu_bayar = '".($val[input_icopim_detil_bayar][$parent][$j]*$mampu_bayar)."' WHERE id = '".$val[input_kunjungan_icopim_detil_id][$parent][$j]."'"; } elseif($field == "perawat_perinatologi") { $sql = "UPDATE kunjungan_bayar SET hak_id = '".$val[input_icopim_detil_hak][$parent][$j]."', biaya = '".$val[input_icopim_detil_biaya][$parent][$j]."', sifat = '".$val[input_icopim_detil_sifat][$parent][$j]."',jumlah = '".$val[input_icopim_detil_jml][$parent][$j]."', bayar = '".$val[input_icopim_detil_bayar][$parent][$j]."', mampu_bayar = '".($val[input_icopim_detil_bayar][$parent][$j]*$mampu_bayar)."' WHERE id = '".$val[input_kunjungan_icopim_detil_id][$parent][$j]."'"; } elseif($field == "dr_umum") { $sql = "UPDATE kunjungan_bayar SET hak_id = '".$val[input_icopim_detil_hak][$parent][$j]."', biaya = '".$val[input_icopim_detil_biaya][$parent][$j]."', sifat = '".$val[input_icopim_detil_sifat][$parent][$j]."',jumlah = '".$val[input_icopim_detil_jml][$parent][$j]."', bayar = '".$val[input_icopim_detil_bayar][$parent][$j]."', mampu_bayar = '".($val[input_icopim_detil_bayar][$parent][$j]*$mampu_bayar)."' WHERE id = '".$val[input_kunjungan_icopim_detil_id][$parent][$j]."'"; } elseif($field == "dr_gigi") { $sql = "UPDATE kunjungan_bayar SET hak_id = '".$val[input_icopim_detil_hak][$parent][$j]."', biaya = '".$val[input_icopim_detil_biaya][$parent][$j]."', sifat = '".$val[input_icopim_detil_sifat][$parent][$j]."',jumlah = '".$val[input_icopim_detil_jml][$parent][$j]."', bayar = '".$val[input_icopim_detil_bayar][$parent][$j]."', mampu_bayar = '".($val[input_icopim_detil_bayar][$parent][$j]*$mampu_bayar)."' WHERE id = '".$val[input_kunjungan_icopim_detil_id][$parent][$j]."'"; } elseif($field == "assisten_non_dokter") { $sql = "UPDATE kunjungan_bayar SET hak_id = '".$val[input_icopim_detil_hak][$parent][$j]."', biaya = '".$val[input_icopim_detil_biaya][$parent][$j]."', sifat = '".$val[input_icopim_detil_sifat][$parent][$j]."',jumlah = '".$val[input_icopim_detil_jml][$parent][$j]."', bayar = '".$val[input_icopim_detil_bayar][$parent][$j]."', mampu_bayar = '".($val[input_icopim_detil_bayar][$parent][$j]*$mampu_bayar)."' WHERE id = '".$val[input_kunjungan_icopim_detil_id][$parent][$j]."'"; } elseif($field == "spesialis_anestesi") { $sql = "UPDATE kunjungan_bayar SET hak_id = '".$val[input_icopim_detil_hak][$parent][$j]."', biaya = '".$val[input_icopim_detil_biaya][$parent][$j]."', sifat = '".$val[input_icopim_detil_sifat][$parent][$j]."',jumlah = '".$val[input_icopim_detil_jml][$parent][$j]."', bayar = '".$val[input_icopim_detil_bayar][$parent][$j]."', mampu_bayar = '".($val[input_icopim_detil_bayar][$parent][$j]*$mampu_bayar)."' WHERE id = '".$val[input_kunjungan_icopim_detil_id][$parent][$j]."'"; } elseif($field == "aknest") { $sql = "UPDATE kunjungan_bayar SET hak_id = '".$val[input_icopim_detil_hak][$parent][$j]."', biaya = '".$val[input_icopim_detil_biaya][$parent][$j]."', sifat = '".$val[input_icopim_detil_sifat][$parent][$j]."',jumlah = '".$val[input_icopim_detil_jml][$parent][$j]."', bayar = '".$val[input_icopim_detil_bayar][$parent][$j]."', mampu_bayar = '".($val[input_icopim_detil_bayar][$parent][$j]*$mampu_bayar)."' WHERE id = '".$val[input_kunjungan_icopim_detil_id][$parent][$j]."'"; } elseif($field == "gizi") { $sql = "UPDATE kunjungan_bayar SET hak_id = '".$val[input_icopim_detil_hak][$parent][$j]."', biaya = '".$val[input_icopim_detil_biaya][$parent][$j]."', sifat = '".$val[input_icopim_detil_sifat][$parent][$j]."',jumlah = '".$val[input_icopim_detil_jml][$parent][$j]."', bayar = '".$val[input_icopim_detil_bayar][$parent][$j]."', mampu_bayar = '".($val[input_icopim_detil_bayar][$parent][$j]*$mampu_bayar)."' WHERE id = '".$val[input_kunjungan_icopim_detil_id][$parent][$j]."'"; } elseif($field == "fisioterapi") { $sql = "UPDATE kunjungan_bayar SET hak_id = '".$val[input_icopim_detil_hak][$parent][$j]."', biaya = '".$val[input_icopim_detil_biaya][$parent][$j]."', sifat = '".$val[input_icopim_detil_sifat][$parent][$j]."',jumlah = '".$val[input_icopim_detil_jml][$parent][$j]."', bayar = '".$val[input_icopim_detil_bayar][$parent][$j]."', mampu_bayar = '".($val[input_icopim_detil_bayar][$parent][$j]*$mampu_bayar)."' WHERE id = '".$val[input_kunjungan_icopim_detil_id][$parent][$j]."'"; } elseif($field == "analis_pa") { $sql = "UPDATE kunjungan_bayar SET hak_id = '".$val[input_icopim_detil_hak][$parent][$j]."', biaya = '".$val[input_icopim_detil_biaya][$parent][$j]."', sifat = '".$val[input_icopim_detil_sifat][$parent][$j]."',jumlah = '".$val[input_icopim_detil_jml][$parent][$j]."', bayar = '".$val[input_icopim_detil_bayar][$parent][$j]."', mampu_bayar = '".($val[input_icopim_detil_bayar][$parent][$j]*$mampu_bayar)."' WHERE id = '".$val[input_kunjungan_icopim_detil_id][$parent][$j]."'"; } elseif($field == "bidan") { $sql = "UPDATE kunjungan_bayar SET hak_id = '".$val[input_icopim_detil_hak][$parent][$j]."', biaya = '".$val[input_icopim_detil_biaya][$parent][$j]."', sifat = '".$val[input_icopim_detil_sifat][$parent][$j]."',jumlah = '".$val[input_icopim_detil_jml][$parent][$j]."', bayar = '".$val[input_icopim_detil_bayar][$parent][$j]."', mampu_bayar = '".($val[input_icopim_detil_bayar][$parent][$j]*$mampu_bayar)."' WHERE id = '".$val[input_kunjungan_icopim_detil_id][$parent][$j]."'"; } elseif($field == "perawat") { $sql = "UPDATE kunjungan_bayar SET hak_id = '".$val[input_icopim_detil_hak][$parent][$j]."', biaya = '".$val[input_icopim_detil_biaya][$parent][$j]."', sifat = '".$val[input_icopim_detil_sifat][$parent][$j]."',jumlah = '".$val[input_icopim_detil_jml][$parent][$j]."', bayar = '".$val[input_icopim_detil_bayar][$parent][$j]."', mampu_bayar = '".($val[input_icopim_detil_bayar][$parent][$j]*$mampu_bayar)."' WHERE id = '".$val[input_kunjungan_icopim_detil_id][$parent][$j]."'"; } elseif($field == "penunjang") { //penunjang $sql = "UPDATE kunjungan_bayar SET hak_id = '".$val[input_icopim_detil_hak][$parent][$j]."', biaya = '".$val[input_icopim_detil_biaya][$parent][$j]."', sifat = '".$val[input_icopim_detil_sifat][$parent][$j]."',jumlah = '".$val[input_icopim_detil_jml][$parent][$j]."', bayar = '".$val[input_icopim_detil_bayar][$parent][$j]."', mampu_bayar = '".($val[input_icopim_detil_bayar][$parent][$j]*$mampu_bayar)."' WHERE id = '".$val[input_kunjungan_icopim_detil_id][$parent][$j]."'"; } else { //lain-lain } //$objResponse->addAppend("debug", "innerHTML", $field . " => " . $sql . "<br /><br />"); $kon->sql = $sql; $kon->execute(); } //endfor } next($val[input_icopim]); } //BHP for($i=0;$i<sizeof($val[input_bhp]);$i++) { $kunci = key($val[input_bhp]); /* //get $sql = "SELECT * FROM bhp WHERE id = '".$val[input_bhp][$kunci]."'"; $kon->sql = $sql; $kon->execute(); $data_bhp[$i] = $kon->getOne(); //$objResponse->addAssign("debug", "innerHTML", $sql); $bhp_p[$i] = $data_bhp[$i][bhp_p] * $val[input_bhp_bayar][$kunci]; $bhp_rs[$i] = $data_bhp[$i][bhp_rs] * $val[input_bhp_bayar][$kunci]; $bhp_rs_adm[$i] = $data_bhp[$i][bhp_rs_adm] * $val[input_bhp_bayar][$kunci]; $bhp_rs_op[$i] = $data_bhp[$i][bhp_rs_op] * $val[input_bhp_bayar][$kunci]; */ if(!$val[input_kunjungan_bhp_id][$kunci]) { //insert $sql = " INSERT INTO kunjungan_bayar ( nama, kunjungan_kamar_id, bhp_id, hak_id, biaya, sifat, jumlah, bayar, mampu_bayar, bhp_p, bhp_rs, bhp_rs_adm, bhp_rs_op ) SELECT '".$val[input_bhp_nama][$i]."', '".$val[input_id_kunjungan_kamar]."', '".$val[input_bhp][$kunci]."', '".$val[input_bhp_hak][$kunci]."', '".$val[input_bhp_biaya][$kunci]."', '".$val[input_bhp_sifat][$kunci]."', '".$val[input_bhp_jml][$kunci]."', '".$val[input_bhp_bayar][$kunci]."', '".($val[input_bhp_bayar][$kunci]*$mampu_bayar)."', bhp_p, bhp_rs, bhp_rs_adm, bhp_rs_op FROM bhp WHERE id = '".$val[input_bhp][$kunci]."' "; $kon->sql = $sql; $kon->execute(); } else { //update $sql = " UPDATE kunjungan_bayar SET hak_id = '".$val[input_bhp_hak][$kunci]."', biaya = '".$val[input_bhp_biaya][$kunci]."', sifat = '".$val[input_bhp_sifat][$kunci]."', jumlah = '".$val[input_bhp_jml][$kunci]."', bayar = '".$val[input_bhp_bayar][$kunci]."', mampu_bayar = '".($val[input_bhp_bayar][$kunci]*$mampu_bayar)."' WHERE id = '".$val[input_kunjungan_bhp_id][$kunci]."'"; $kon->sql = $sql; //$objResponse->addAssign("debug", "innerHTML", $sql); $kon->execute(); } next($val[input_bhp]); } if($tutup_modal == true) { if($afek < 0) { $objResponse->addAlert("Data Kunjungan Tidak Dapat Disimpan\nHubungi Bagian SIM."); } else { $objResponse->addScriptCall("list_data", "0"); $objResponse->addScriptCall("tutup_kunjungan"); $objResponse->addScriptCall("show_status_simpan"); } } else { $objResponse->addScriptCall("xajax_buka_kunjungan", $val[input_id_kunjungan_kamar]); //$objResponse->addScriptCall("get_total", false); } return $objResponse; }
function simpan_kunjungan($value) { $cleaner = new FormCleaner; $cleaner->setValue($value); $cleaner->clean(); $val = $cleaner->getValue(); $kon = new Konek; //update $sql = " UPDATE kunjungan_kamar SET dokter_id = NULLIF('".$val[input_dokter_id]."', ''), diagnosa_utama_id = NULLIF('".$val[input_diagnosa_utama]."', '') WHERE id = '".$val[input_id_kunjungan_kamar]."' "; //} $kon->sql = $sql; $kon->execute(); $afek = $kon->affected_rows; $objResponse = new xajaxResponse(); //$objResponse->addAssign("debug", "innerHTML", $sql); //ins upd del tindakan $is_insert_ic = false; for($i=0;$i<sizeof($val[input_tindakan]);$i++) { if(!$val[input_kunjungan_tindakan_id][$i] && $val[input_tindakan][$i]) { //insert $arr_insert_ic[] = "('".$val[input_id_kunjungan_kamar]."','".$val[input_tindakan][$i]."')"; $is_insert_ic = true; } elseif($val[input_kunjungan_tindakan_id][$i] && $val[input_tindakan][$i]) { //update $kon->sql = "UPDATE kunjungan_kamar_icopim SET icopim_id = '".$val[input_tindakan][$i]."' WHERE id = '".$val[input_kunjungan_tindakan_id][$i]."'"; $kon->execute(); } elseif($val[input_kunjungan_tindakan_id][$i] && !$val[input_tindakan][$i]) { //delete $kon->sql = "DELETE FROM kunjungan_kamar_icopim WHERE id = '".$val[input_kunjungan_tindakan_id][$i]."'"; $kon->execute(); } } //extended insert tindakan if($is_insert_ic == true) { $inserted_ic = implode(", ", $arr_insert_ic); $kon->sql = "INSERT INTO kunjungan_kamar_icopim (kunjungan_kamar_id, icopim_id) VALUES " . $inserted_ic; $kon->execute(); } $is_insert_bhp = false; for($i=0;$i<sizeof($val[input_bhp]);$i++) { if(!$val[input_kunjungan_bhp_id][$i] && $val[input_bhp][$i]) { //insert $arr_insert_bhp[] = "('".$val[input_id_kunjungan_kamar]."','".$val[input_bhp][$i]."')"; $is_insert_bhp = true; } elseif($val[input_kunjungan_bhp_id][$i] && $val[input_bhp][$i]) { //update $kon->sql = "UPDATE kunjungan_kamar_bhp SET bhp_id = '".$val[input_bhp][$i]."' WHERE id = '".$val[input_kunjungan_bhp_id][$i]."'"; $kon->execute(); } elseif($val[input_kunjungan_bhp_id][$i] && !$val[input_bhp][$i]) { //delete $kon->sql = "DELETE FROM kunjungan_kamar_bhp WHERE id = '".$val[input_kunjungan_bhp_id][$i]."'"; $kon->execute(); } } //extended insert bhp if($is_insert_bhp == true) { $inserted_bhp = implode(", ", $arr_insert_bhp); $kon->sql = "INSERT INTO kunjungan_kamar_bhp (kunjungan_kamar_id, bhp_id) VALUES " . $inserted_bhp; $kon->execute(); } $is_insert_im = false; //ins upd del imunisasi for($i=0;$i<sizeof($val[input_imunisasi]);$i++) { if(!$val[input_kunjungan_imunisasi_id][$i] && $val[input_imunisasi][$i]) { //insert $arr_insert_im[] = "('".$val[input_id_kunjungan_kamar]."','".$val[input_imunisasi][$i]."')"; $is_insert_im = true; } elseif($val[input_kunjungan_imunisasi_id][$i] && $val[input_imunisasi][$i]) { //update $kon->sql = "UPDATE kunjungan_kamar_imunisasi SET imunisasi_id = '".$val[input_imunisasi][$i]."' WHERE id = '".$val[input_kunjungan_imunisasi_id][$i]."'"; $kon->execute(); } elseif($val[input_kunjungan_imunisasi_id][$i] && !$val[input_imunisasi][$i]) { //delete $kon->sql = "DELETE FROM kunjungan_kamar_imunisasi WHERE id = '".$val[input_kunjungan_imunisasi_id][$i]."'"; $kon->execute(); } } //extended insert im if($is_insert_im == true) { $inserted_im = implode(", ", $arr_insert_im); $kon->sql = "INSERT INTO kunjungan_kamar_imunisasi (kunjungan_kamar_id, imunisasi_id) VALUES " . $inserted_im; $kon->execute(); } if($afek < 0) { $objResponse->addAlert("Data Kunjungan Tidak Dapat Disimpan\nHubungi Bagian SIM."); } else { $objResponse->addScriptCall("list_data", "0"); $objResponse->addScriptCall("xajax_tutup_kunjungan"); $objResponse->addScriptCall("show_status_simpan"); } return $objResponse; }
function simpan_daftar_pindah_kamar_check($value) { $cleaner = new FormCleaner; $cleaner->setValue($value); $cleaner->clean(); $val = $cleaner->getValue(); $objResponse = new xajaxResponse; if(!$val[cara_bayar]) { $objResponse->addAlert('Silakan Pilih Cara Pembayaran'); $objResponse->addScriptCall('fokus', 'cara_bayar'); } elseif(!$val[pj_hubungan_keluarga]) { $objResponse->addAlert('Silakan Pilih Hubungan Keluarga Penanggung jawab'); $objResponse->addScriptCall('fokus', 'pj_hubungan_keluarga'); } elseif(!$val[pelayanan_id]) { $objResponse->addAlert('Silakan Pilih Pelayanan'); $objResponse->addScriptCall('fokus', 'pelayanan_id'); } elseif(!$val[kamar_id]) { $objResponse->addAlert('Silakan Pilih Kamar'); $objResponse->addScriptCall('fokus', 'kamar_id'); } else { $objResponse->addScriptCall("xajax_simpan_daftar_pindah_kamar", $val); } return $objResponse; }
function simpan_pasien_check($value) { $objResponse = new xajaxResponse(); $cleaner = new FormCleaner; $cleaner->setValue($value); $cleaner->clean(); $new_value = $cleaner->getValue(); $tgl_skr = strtotime(date("Y-m-d")); $tgl_periksa = strtotime($new_value[tgl_periksa_thn] . "-" . $new_value[tgl_periksa_bln] . "-" . $new_value[tgl_periksa_tgl]); if(!$new_value[nama]) { $objResponse->addAlert("Silakan Isi Nama Pasien."); $objResponse->addScriptCall("fokus", "nama"); } elseif(!checkdate($new_value[tgl_lahir_bln],$new_value[tgl_lahir_tgl],$new_value[tgl_lahir_thn])) { $objResponse->addAlert("Tanggal Lahir Tidak Valid."); $objResponse->addScriptCall("fokus", "tgl_lahir_tgl"); } elseif(!$new_value[sex]) { $objResponse->addAlert("Silakan Isi Jenis Kelamin Pasien."); $objResponse->addScriptCall("fokus", "sex"); } elseif(!$new_value[agama]) { $objResponse->addAlert("Silakan Isi Agama Pasien."); $objResponse->addScriptCall("fokus", "agama"); } elseif(!$new_value[pendidikan_id]) { $objResponse->addAlert("Silakan Isi Pendidikan Pasien."); $objResponse->addScriptCall("fokus", "pendidikan_id"); } elseif(!$new_value[pekerjaan_id]) { $objResponse->addAlert("Silakan Isi Pekerjaan Pasien."); $objResponse->addScriptCall("fokus", "pekerjaan_id"); } elseif(!$new_value[status_nikah]) { $objResponse->addAlert("Silakan Isi Status Nikah Pasien."); $objResponse->addScriptCall("fokus", "status_nikah"); } elseif(!$new_value[alamat]) { $objResponse->addAlert("Silakan Isi Alamat Pasien."); $objResponse->addScriptCall("fokus", "alamat"); } elseif(!$new_value[propinsi_id]) { $objResponse->addAlert("Silakan Isi Propinsi Pasien."); $objResponse->addScriptCall("fokus", "propinsi_id"); } elseif(!$new_value[kabupaten_id]) { $objResponse->addAlert("Silakan Isi Kabupaten Pasien."); $objResponse->addScriptCall("fokus", "kabupaten_id"); } elseif(!$new_value[kecamatan_id]) { $objResponse->addAlert("Silakan Isi Kecamatan Pasien."); $objResponse->addScriptCall("fokus", "kecamatan_id"); } elseif(!$new_value[desa_id]) { $objResponse->addAlert("Silakan Isi Kelurahan Pasien."); $objResponse->addScriptCall("fokus", "desa_id"); } elseif($tgl_periksa < $tgl_skr) { $objResponse->addAlert("Tanggal periksa tidak boleh kurang dari sekarang."); $objResponse->addScriptCall("fokus", "tgl_periksa_tgl"); } elseif(!checkdate($new_value[tgl_periksa_bln],$new_value[tgl_periksa_tgl],$new_value[tgl_periksa_thn])) { $objResponse->addAlert("Tanggal Periksa Tidak Valid."); $objResponse->addScriptCall("fokus", "tgl_periksa_tgl"); } elseif(!$new_value[kelas]) { $objResponse->addAlert("Silakan Isi Kelas."); $objResponse->addScriptCall("fokus", "kelas"); } elseif(!$new_value[cara_bayar]) { $objResponse->addAlert("Silakan Isi Cara Bayar."); $objResponse->addScriptCall("fokus", "cara_bayar"); } else { $objResponse->addScriptCall("xajax_simpan_pasien", $new_value); } return $objResponse; }
function simpan_pelayanan_check($value) { $cleaner = new FormCleaner; $cleaner->setValue($value); $cleaner->clean(); $new_value = $cleaner->getValue(); $objResponse = new xajaxResponse(); if(!$new_value[spesialisasi_id]) { $objResponse->addAlert("Silakan Pilih Spesialisasi."); $objResponse->addScriptCall("fokus", "spesialisasi_id"); } else { $objResponse->addScriptCall("xajax_simpan_pelayanan", $new_value); } return $objResponse; }
function simpan_pasien_check($value) { $objResponse = new xajaxResponse(); $cleaner = new FormCleaner; $cleaner->setValue($value); $cleaner->clean(); $new_value = $cleaner->getValue(); if(!$new_value[nama]) { $objResponse->addAlert("Silakan Isi Nama Pasien."); $objResponse->addScriptCall("fokus", "nama"); } elseif(!checkdate($new_value[tgl_lahir_bln], $new_value[tgl_lahir_tgl], $new_value[tgl_lahir_thn])) { $objResponse->addAlert("Tanggal Lahir Tidak Valid."); $objResponse->addScriptCall("fokus", "tgl_lahir_tgl"); } elseif(!$new_value[sex]) { $objResponse->addAlert("Silakan Isi Jenis Kelamin Pasien."); $objResponse->addScriptCall("fokus", "sex"); } elseif(!$new_value[agama]) { $objResponse->addAlert("Silakan Isi Agama Pasien."); $objResponse->addScriptCall("fokus", "agama"); } elseif(!$new_value[pendidikan_id]) { $objResponse->addAlert("Silakan Isi Pendidikan Pasien."); $objResponse->addScriptCall("fokus", "pendidikan_id"); } elseif(!$new_value[pekerjaan_id]) { $objResponse->addAlert("Silakan Isi Pekerjaan Pasien."); $objResponse->addScriptCall("fokus", "pekerjaan_id"); } elseif(!$new_value[status_nikah]) { $objResponse->addAlert("Silakan Isi Status Nikah Pasien."); $objResponse->addScriptCall("fokus", "status_nikah"); } elseif(!$new_value[alamat]) { $objResponse->addAlert("Silakan Isi Alamat Pasien."); $objResponse->addScriptCall("fokus", "alamat"); } elseif(!$new_value[propinsi_id]) { $objResponse->addAlert("Silakan Isi Propinsi Pasien."); $objResponse->addScriptCall("fokus", "propinsi_id"); } elseif(!$new_value[kabupaten_id]) { $objResponse->addAlert("Silakan Isi Kabupaten Pasien."); $objResponse->addScriptCall("fokus", "kabupaten_id"); } elseif(!$new_value[kecamatan_id]) { $objResponse->addAlert("Silakan Isi Kecamatan Pasien."); $objResponse->addScriptCall("fokus", "kecamatan_id"); } elseif(!$new_value[desa_id]) { $objResponse->addAlert("Silakan Isi Kelurahan Pasien."); $objResponse->addScriptCall("fokus", "desa_id"); } elseif(!$new_value[cara_masuk]) { $objResponse->addAlert("Silakan Isi Cara Masuk."); $objResponse->addScriptCall("fokus", "cara_masuk"); } elseif($new_value[cara_masuk] == "RUJUKAN" && !$new_value[perujuk_id]) { $objResponse->addAlert("Silakan Isi Perujuk."); $objResponse->addScriptCall("fokus", "perujuk_id"); } elseif(!$new_value[cara_bayar]) { $objResponse->addAlert("Silakan Isi Cara Bayar."); $objResponse->addScriptCall("fokus", "cara_bayar"); } elseif(!$new_value[nama_ayah]) { $objResponse->addAlert("Silakan Isi Nama Ayah."); $objResponse->addScriptCall("fokus", "nama_ayah"); } elseif(!$new_value[nama_ibu]) { $objResponse->addAlert("Silakan Isi Nama Ibu."); $objResponse->addScriptCall("fokus", "nama_ibu"); } elseif(!$new_value[no_ktp_sim]) { $objResponse->addAlert("Silakan Isi No KTP/SIM."); $objResponse->addScriptCall("fokus", "no_ktp_sim"); } else { /* for($i=0;$i<sizeof($new_value);$i++) { $kunci = key($new_value); $objResponse->addAppend("debug", "innerHTML", $kunci . "=>" . $new_value[$kunci] . "<br />"); next($new_value); } */ $objResponse->addScriptCall("xajax_simpan_pasien", $new_value); } return $objResponse; }
function simpan_dokter_check($value) { $objResponse = new xajaxResponse(); $cleaner = new FormCleaner; $cleaner->setValue($value); $cleaner->clean(); $new_value = $cleaner->getValue(); if(!$new_value[spesialisasi_id]) { $objResponse->addAlert("Silakan Isi Spesialisasi."); $objResponse->addScriptCall("fokus", "spesialisasi_id"); } elseif(!$new_value[subspesialisasi_id]) { $objResponse->addAlert("Silakan Isi Subspesialisasi."); $objResponse->addScriptCall("fokus", "subspesialisasi_id"); } elseif(!$new_value[nama]) { $objResponse->addAlert("Silakan Isi nama."); $objResponse->addScriptCall("fokus", "nama"); } else { $objResponse->addScriptCall("xajax_simpan_dokter", $new_value); } return $objResponse; }
function simpan_kunjungan($value, $kunjungan_baru = false) { $cleaner = new FormCleaner; $cleaner->setValue($value); $cleaner->clean(); $val = $cleaner->getValue(); if($kunjungan_baru == false) { //update $sql = " UPDATE kunjungan k JOIN kunjungan_kamar kk ON (kk.kunjungan_id = k.id) SET k.kunjungan_ke = NULLIF('".$val[input_kunjungan_ke]."',''), k.cara_masuk = NULLIF('".$val[input_cara_masuk]."',''), k.perujuk_id = NULLIF('".$val[input_perujuk_id]."', ''), kk.cara_bayar = NULLIF('".$val[input_cara_bayar]."',''), kk.nomor = '".$val[input_nomor]."', kk.pj_nama = '".$val[input_pj_nama]."', kk.pj_alamat = '".$val[input_pj_alamat]."', kk.pj_telp = '".$val[input_pj_telp]."', kk.pj_hubungan_keluarga = NULLIF('".$val[input_pj_hubungan_keluarga]."',''), kk.kamar_id = NULLIF('".$val[input_kamar_id]."', ''), kk.dokter_id = NULLIF('".$val[input_dokter_id]."', ''), kk.kelanjutan = NULLIF('".$val[input_kelanjutan]."',''), kk.tgl_daftar = '".$val[input_tgl_daftar_thn]."-".$val[input_tgl_daftar_bln]."-".$val[input_tgl_daftar_tgl]." ".$val[input_tgl_daftar_jam].":".$val[input_tgl_daftar_mnt].":".$val[input_tgl_daftar_dtk]."', kk.tgl_periksa = '".$val[input_tgl_periksa_thn]."-".$val[input_tgl_periksa_bln]."-".$val[input_tgl_periksa_tgl]." ".$val[input_tgl_periksa_jam].":".$val[input_tgl_periksa_mnt].":".$val[input_tgl_periksa_dtk]."', kk.tgl_keluar = '".$val[input_tgl_keluar_thn]."-".$val[input_tgl_keluar_bln]."-".$val[input_tgl_keluar_tgl]." ".$val[input_tgl_keluar_jam].":".$val[input_tgl_keluar_mnt].":".$val[input_tgl_keluar_dtk]."', kk.diagnosa_utama_id = NULLIF('".$val[input_diagnosa_utama]."', '') WHERE kk.id = '".$val[input_id_kunjungan_kamar]."' "; } else { $sql = " INSERT INTO kunjungan_kamar( kunjungan_id, kamar_id, dokter_id, kelanjutan, tgl_daftar, tgl_periksa, tgl_keluar, diagnosa_utama_id ) VALUES ( '".$val[input_id_kunjungan]."', NULLIF('".$val[input_kamar_id]."', ''), NULLIF('".$val[input_dokter_id]."', ''), NULLIF('".$val[input_kelanjutan]."',''), '".$val[input_tgl_daftar_thn]."-".$val[input_tgl_daftar_bln]."-".$val[input_tgl_daftar_tgl]."', '".$val[input_tgl_periksa_thn]."-".$val[input_tgl_periksa_bln]."-".$val[input_tgl_periksa_tgl]."', '".$val[input_tgl_keluar_thn]."-".$val[input_tgl_keluar_bln]."-".$val[input_tgl_keluar_tgl]."', NULLIF('".$val[input_diagnosa_utama]."', '') ) "; } //} $kon = new Konek; $kon->sql = $sql; $kon->execute(); $afek = $kon->affected_rows; $objResponse = new xajaxResponse(); //$objResponse->addAssign("debug", "innerHTML", $sql); //ins upd del tindakan $is_insert_ic = false; for($i=0;$i<sizeof($val[input_tindakan]);$i++) { if(!$val[input_kunjungan_tindakan_id][$i] && $val[input_tindakan][$i]) { //insert $arr_insert_ic[] = "('".$val[input_id_kunjungan_kamar]."','".$val[input_tindakan][$i]."')"; $is_insert_ic = true; } elseif($val[input_kunjungan_tindakan_id][$i] && $val[input_tindakan][$i]) { //update $kon->sql = "UPDATE kunjungan_kamar_icopim SET icopim_id = '".$val[input_tindakan][$i]."' WHERE id = '".$val[input_kunjungan_tindakan_id][$i]."'"; $kon->execute(); } elseif($val[input_kunjungan_tindakan_id][$i] && !$val[input_tindakan][$i]) { //delete $kon->sql = "DELETE FROM kunjungan_kamar_icopim WHERE id = '".$val[input_kunjungan_tindakan_id][$i]."'"; $kon->execute(); } } //extended insert tindakan if($is_insert_ic == true) { $inserted_ic = implode(", ", $arr_insert_ic); $kon->sql = "INSERT INTO kunjungan_kamar_icopim (kunjungan_kamar_id, icopim_id) VALUES " . $inserted_ic; $kon->execute(); } $is_insert_bhp = false; for($i=0;$i<sizeof($val[input_bhp]);$i++) { if(!$val[input_kunjungan_bhp_id][$i] && $val[input_bhp][$i]) { //insert $arr_insert_bhp[] = "('".$val[input_id_kunjungan_kamar]."','".$val[input_bhp][$i]."')"; $is_insert_bhp = true; } elseif($val[input_kunjungan_bhp_id][$i] && $val[input_bhp][$i]) { //update $kon->sql = "UPDATE kunjungan_kamar_bhp SET bhp_id = '".$val[input_bhp][$i]."' WHERE id = '".$val[input_kunjungan_bhp_id][$i]."'"; $kon->execute(); } elseif($val[input_kunjungan_bhp_id][$i] && !$val[input_bhp][$i]) { //delete $kon->sql = "DELETE FROM kunjungan_kamar_bhp WHERE id = '".$val[input_kunjungan_bhp_id][$i]."'"; $kon->execute(); } } //extended insert bhp if($is_insert_bhp == true) { $inserted_bhp = implode(", ", $arr_insert_bhp); $kon->sql = "INSERT INTO kunjungan_kamar_bhp (kunjungan_kamar_id, bhp_id) VALUES " . $inserted_bhp; $kon->execute(); } $is_insert_im = false; //ins upd del imunisasi for($i=0;$i<sizeof($val[input_imunisasi]);$i++) { if(!$val[input_kunjungan_imunisasi_id][$i] && $val[input_imunisasi][$i]) { //insert $arr_insert_im[] = "('".$val[input_id_kunjungan_kamar]."','".$val[input_imunisasi][$i]."')"; $is_insert_im = true; } elseif($val[input_kunjungan_imunisasi_id][$i] && $val[input_imunisasi][$i]) { //update $kon->sql = "UPDATE kunjungan_kamar_imunisasi SET imunisasi_id = '".$val[input_imunisasi][$i]."' WHERE id = '".$val[input_kunjungan_imunisasi_id][$i]."'"; $kon->execute(); } elseif($val[input_kunjungan_imunisasi_id][$i] && !$val[input_imunisasi][$i]) { //delete $kon->sql = "DELETE FROM kunjungan_kamar_imunisasi WHERE id = '".$val[input_kunjungan_imunisasi_id][$i]."'"; $kon->execute(); } } //extended insert im if($is_insert_im == true) { $inserted_im = implode(", ", $arr_insert_im); $kon->sql = "INSERT INTO kunjungan_kamar_imunisasi (kunjungan_kamar_id, imunisasi_id) VALUES " . $inserted_im; $kon->execute(); } if($afek < 0) { $objResponse->addAlert("Data Kunjungan Tidak Dapat Disimpan\nCek kembali nomor kunjungan"); } else { $objResponse->addScriptCall("list_data", "0"); $objResponse->addScriptCall("xajax_tutup_kunjungan"); $objResponse->addScriptCall("show_status_simpan"); } return $objResponse; }
function simpan_kecamatan_check($value) { $cleaner = new FormCleaner; $cleaner->setValue($value); $cleaner->clean(); $new_value = $cleaner->getValue(); $objResponse = new xajaxResponse(); if(!$new_value[nama]) { $objResponse->addAlert("Silakan Isi Nama Kecamatan."); $objResponse->addScriptCall("fokus", "nama"); } elseif(!$new_value[propinsi_id]) { $objResponse->addAlert("Silakan Pilih Propinsi."); $objResponse->addScriptCall("fokus", "propinsi_id"); } elseif(!$new_value[kabupaten_id]) { $objResponse->addAlert("Silakan Pilih Kabupaten."); $objResponse->addScriptCall("fokus", "kabupaten_id"); } else { $objResponse->addScriptCall("xajax_simpan_kecamatan", $new_value); $objResponse->addScriptCall("fokus", "nama"); } return $objResponse; }
function simpan_kunjungan($value) { $cleaner = new FormCleaner; $cleaner->setValue($value); $cleaner->clean(); $val = $cleaner->getValue(); $kon = new Konek; if($val[beri_resep]==1){ $resep="YA"; }else{ $resep="TIDAK"; } //update beri resep $sql = " UPDATE kunjungan SET resep='".$resep."' WHERE id = '".$val[input_id_kunjungan]."' "; $kon->sql = $sql; $kon->execute(); //update $sql = " UPDATE kunjungan_kamar SET dokter_id = NULLIF('".$val[input_dokter_id]."', ''), diagnosa_utama_id = NULLIF('".$val[input_diagnosa_utama]."', '') WHERE id = '".$val[input_id_kunjungan_kamar]."' "; $kon->sql = $sql; $kon->execute(); //$afek = $kon->affected_rows; $afek = $kon->getJml(); $temp = $sql; $objResponse = new xajaxResponse(); //$objResponse->addAlert($temp); //$objResponse->addAlert(print_r($val)); //$objResponse->addAppend("debug", "innerHTML", $mampu_bayar); //INSERT UPDATE KARCIS for($i=0;$i<sizeof($val[input_karcis]);$i++) { $kunci = key($val[input_karcis]); //get /* BAGI BAYAR => BHP+JASA */ $biaya_bhp = 0; $biaya_jasa = 0; $selisih_biaya = 0; $biaya_bhp = round($val[input_karcis_biaya_bhp][$kunci]); $biaya_jasa = round($val[input_karcis_biaya_jasa][$kunci]); $selisih_biaya = $val[input_karcis_biaya][$kunci]-$biaya_bhp-$biaya_jasa; $biaya_jasa += $selisih_biaya; $bayar_bhp = 0; $bayar_jasa = 0; $selisih_bayar = 0; $bayar_bhp = round($val[input_karcis_biaya_bhp][$kunci]); $bayar_jasa = round($val[input_karcis_biaya_jasa][$kunci]); $selisih_bayar = $val[input_karcis_bayar][$kunci]-$bayar_bhp-$bayar_jasa; $bayar_jasa += $selisih_bayar; if(!$val[input_kunjungan_karcis_id][$kunci]) { //insert $sql = " INSERT INTO kunjungan_bayar ( nama, kunjungan_kamar_id, karcis_id, hak_id, biaya_bhp, biaya_jasa, jumlah, bayar_bhp, bhp_p, bhp_rs, bhp_rs_adm, bhp_rs_op, bayar_jasa, jasa_p, jasa_rs, jasa_rs_op, jasa_rs_kembang, jasa_rs_adm, jasa_rs_sdm, spesialis, spesialis_pendamping, ugp, grabaf, perawat, penunjang, zakat, pajak, tgl ) SELECT '".$val[input_karcis_nama][$i]."', '".$val[input_id_kunjungan_kamar]."', '".$val[input_karcis][$kunci]."', '".$val[input_karcis_hak][$kunci]."', '".$biaya_bhp."', '".$biaya_jasa."', '".$val[input_karcis_jml][$kunci]."', '".$bayar_bhp."', bhp_p, bhp_rs, bhp_rs_adm, bhp_rs_op, '".$bayar_jasa."', jasa_p, jasa_rs, jasa_rs_op, jasa_rs_kembang, jasa_rs_adm, jasa_rs_sdm, spesialis, spesialis_pendamping, ugp, grabaf, perawat, penunjang, zakat, pajak, NOW() FROM karcis WHERE id = '".$val[input_karcis][$kunci]."' "; $kon->sql = $sql; $kon->execute(); } else { //update $sql = " UPDATE kunjungan_bayar SET hak_id = '".$val[input_karcis_hak][$kunci]."', jumlah = '".$val[input_karcis_jml][$kunci]."', biaya_bhp = '".$biaya_bhp ."', biaya_jasa = '".$biaya_jasa."', bayar_bhp = '".$bayar_bhp."', bayar_jasa = '".$bayar_jasa."' WHERE id = '".$val[input_kunjungan_karcis_id][$kunci]."'"; $kon->sql = $sql; $kon->execute(); //$objResponse->addAppend("debug", "innerHTML", $sql); } //$objResponse->addAppend("debug", "innerHTML", $sql); next($val[input_karcis]); } //TINDAKAN for($i=0;$i<sizeof($val[input_icopim]);$i++) { $kunci = key($val[input_icopim]); $parent = $val[input_icopim_parent][$i]; //get if(!$val[input_kunjungan_icopim_id][$kunci] && $val[input_icopim][$kunci]) { //insert $sql = "INSERT INTO kunjungan_kamar_icopim (kunjungan_kamar_id, icopim_id, nama) VALUES ('".$val[input_id_kunjungan_kamar]."', '".$val[input_icopim][$kunci]."', '".$val[input_icopim_nama][$kunci]."')"; $kon->sql = $sql; $kon->execute(); $id_kki = $kon->last_id; //$objResponse->addAppend("debug", "innerHTML", $field . " => " . $val[input_icopim_detil_bayar][$parent][$field] . "<br />"); $sql = "INSERT INTO kunjungan_bayar (nama, kunjungan_kamar_id, kunjungan_kamar_icopim_id, icopim_detil_id, hak_id, biaya_jasa,tgl) VALUES ('".$val[input_icopim_nama][$kunci]."', '".$val[input_id_kunjungan_kamar]."', '".$id_kki."', '".$val[input_icopim_detil][$kunci]."', '".$val[input_icopim_hak][$kunci]."', '".$val[input_icopim_biaya][$kunci]."', NOW())"; $kon->sql = $sql; $kon->execute(); } else { //UPDATE /*diinsert satu satu*/ $sql = "UPDATE kunjungan_bayar SET hak_id = '".$val[input_icopim_hak][$kunci]."', biaya_jasa = '".$val[input_icopim_biaya][$kunci]."' WHERE id = '".$val[input_kunjungan_icopim_id][$kunci]."'"; //$objResponse->addAppend("debug", "innerHTML", $field . " => " . $sql . "<br /><br />"); $kon->sql = $sql; $kon->execute(); } //endfor next($val[input_icopim]); } //BHP for($i=0;$i<sizeof($val[input_bhp]);$i++) { $kunci = key($val[input_bhp]); if(!$val[input_kunjungan_bhp_id][$kunci]) { //insert $sql = " INSERT INTO kunjungan_bayar ( nama, kunjungan_kamar_id, bhp_id, hak_id, biaya_bhp, sifat, jumlah, bayar_bhp, tgl, no_resep ) VALUES ( '".$val[input_bhp_nama][$i]."', '".$val[input_id_kunjungan_kamar]."', '".$val[input_bhp][$kunci]."', '".$val[input_bhp_hak][$kunci]."', '".$val[input_bhp_biaya][$kunci]."', '".$val[input_bhp_sifat][$kunci]."', '".$val[input_bhp_jml][$kunci]."', '".$val[input_bhp_bayar][$kunci]."', NOW(), '".$val[input_no_resep]."') "; $kon->sql = $sql; $kon->execute(); $temp .= $sql; } else { //update $sql = " UPDATE kunjungan_bayar SET hak_id = '".$val[input_bhp_hak][$kunci]."', biaya_bhp = '".$val[input_bhp_biaya][$kunci]."', sifat = '".$val[input_bhp_sifat][$kunci]."', jumlah = '".$val[input_bhp_jml][$kunci]."', bayar_bhp = '".$val[input_bhp_bayar][$kunci]."' WHERE id = '".$val[input_kunjungan_bhp_id][$kunci]."'"; $kon->sql = $sql; //$objResponse->addAssign("debug", "innerHTML", $sql); $kon->execute(); } next($val[input_bhp]); } // $objResponse->addAlert($temp); //simpan di database apotek //pasien id $usercreated = $_SESSION["username"]; $unit_id = 4; $tgl=date("d/m/Y"); $sql="insert into db_apotek.resep_head (no_resep,param_no,pasien_id,created_datetime,created_user,tgl,unit_id,cara_masuk,flags) values('".$val[input_no_resep]."','".$val[input_param_no]."','".$val[input_pasien_id]."',now(),'$usercreated','$tgl','$unit_id','RAWAT INAP',3)"; $kon->sql = $sql; $kon->execute(); //BHP for($i = 0; $i < sizeof($val[input_bhp]); $i++) { $kunci = key($val[input_bhp]); //ambil kode barang $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 from db_apotek.ms_barang where db_apotek.ms_barang.id ='".$val[input_bhp][$i]."'"; $kon->sql = $sql; $kon->execute(); $ref = $kon->getOne(); //ambil data kd_barang $date = date("d/m/Y"); $sql = "INSERT INTO db_apotek.resep (no_resep, pasien_id, kode_obat, tgl, diminta,dosis_id,ket,racikan,flags) VALUES ('".$val[input_no_resep]."','".$val[input_pasien_id]."', '".$ref[kd_barang]. "', '$date','".$val[input_bhp_jml][$i]."','".$val[input_dosis][$i]."','".$val[input_ket][$i]."','-',3)"; $kon->sql = $sql; $kon->execute(); next($val[input_bhp]); } if($afek < 0) { $objResponse->addAlert("Data Kunjungan Tidak Dapat Disimpan\nHubungi Bagian SIM."); } else { $objResponse->addScriptCall("show_status_simpan"); $objResponse->addScriptCall("list_data", "0"); $objResponse->addScriptCall("tutup_kunjungan"); } return $objResponse; }
function simpan_kunjungan($value) { $cleaner = new FormCleaner; $cleaner->setValue($value); $cleaner->clean(); $val = $cleaner->getValue(); //update $sql = " UPDATE kunjungan k JOIN kunjungan_kamar kk ON (kk.kunjungan_id = k.id) SET k.kunjungan_ke = NULLIF('".$val[input_kunjungan_ke]."',''), k.cara_masuk = NULLIF('".$val[input_cara_masuk]."',''), k.perujuk_id = NULLIF('".$val[input_perujuk_id]."', ''), kk.cara_bayar = NULLIF('".$val[input_cara_bayar]."',''), kk.jenis_askes = NULLIF('".$value[input_jenis_askes]."',''), kk.perusahaan_id = NULLIF('".$value[input_perusahaan_id]."',''), kk.nomor = NULLIF('".$value[input_nomor]."',''), kk.pj_nama = '".$val[input_pj_nama]."', kk.pj_alamat = '".$val[input_pj_alamat]."', kk.pj_telp = '".$val[input_pj_telp]."', kk.pj_hubungan_keluarga = NULLIF('".$val[input_pj_hubungan_keluarga]."',''), kk.dokter_id = NULLIF('".$val[input_dokter_id]."', ''), kk.kelanjutan = NULLIF('".$val[input_kelanjutan]."',''), kk.tgl_daftar = '".$val[input_tgl_daftar_thn]."-".$val[input_tgl_daftar_bln]."-".$val[input_tgl_daftar_tgl]." ".$val[input_tgl_daftar_jam].":".$val[input_tgl_daftar_mnt].":00', kk.tgl_periksa = '".$val[input_tgl_periksa_thn]."-".$val[input_tgl_periksa_bln]."-".$val[input_tgl_periksa_tgl]." ".$val[input_tgl_periksa_jam].":".$val[input_tgl_periksa_mnt].":00' WHERE kk.id = '".$val[input_id_kunjungan_kamar]."' "; //} $kon = new Konek; $kon->sql = $sql; $kon->execute(); $afek = $kon->affected_rows; $objResponse = new xajaxResponse(); //$objResponse->addAssign("debug", "innerHTML", nl2br($sql)); if($afek < 0) { $objResponse->addAlert("Data Kunjungan Tidak Dapat Disimpan\nCek kembali nomor kunjungan"); } else { $objResponse->addScriptCall("enable_mainbar"); $objResponse->addScriptCall("list_data", "0"); $objResponse->addScriptCall("xajax_tutup_kunjungan"); $objResponse->addScriptCall("show_status_simpan"); } return $objResponse; }
function simpan_kunjungan($value) { $cleaner = new FormCleaner; $cleaner->setValue($value); $cleaner->clean(); $val = $cleaner->getValue(); $kon = new Konek; $objResponse = new xajaxResponse(); //$objResponse->addAlert(print_r($val)); //$objResponse->addAppend("debug", "innerHTML", $mampu_bayar); //INSERT UPDATE SPECIMEN for($i=0;$i<sizeof($val[input_specimen]);$i++) { $kunci = key($val[input_specimen]); /* BAGI BAYAR => BHP+JASA */ //$bayar_bhp = round($val[input_specimen_biaya_bhp][$kunci]*$val[input_specimen_bayar][$kunci]/($val[input_specimen_biaya_bhp][$kunci]+$val[input_specimen_biaya_jasa][$kunci])); //$bayar_jasa = round($val[input_specimen_biaya_jasa][$kunci]*$val[input_specimen_bayar][$kunci]/($val[input_specimen_biaya_bhp][$kunci]+$val[input_specimen_biaya_jasa][$kunci])); //$selisih = $val[input_specimen_bayar][$kunci]-$bayar_bhp-$bayar_jasa; //$bayar_jasa += $selisih; $bayar_jasa = round($val[input_specimen_bayar][$kunci]); if(!$val[input_kunjungan_specimen_id][$kunci]) { //insert $sql = " INSERT INTO kunjungan_bayar ( nama, kunjungan_kamar_id, lab_kunjungan_id, lab_specimen_id, hak_id, biaya_jasa, tgl ) VALUES ( '".$val[input_specimen_nama][$i]."', NULLIF('".$val[input_id_kunjungan_kamar]."', ''), '".$val[input_id_kunjungan_lab]."', '".$val[input_specimen][$kunci]."', '".$val[input_specimen_hak][$kunci]."', '".$bayar_jasa."',NOW()) "; $kon->sql = $sql; $kon->execute(); } else { //update $sql = " UPDATE kunjungan_bayar SET hak_id = '".$val[input_specimen_hak][$kunci]."', biaya_jasa = '".$bayar_jasa."' WHERE id = '".$val[input_kunjungan_specimen_id][$kunci]."'"; $kon->sql = $sql; $kon->execute(); //$objResponse->addAppend("debug", "innerHTML", $sql); } //$objResponse->addAppend("debug", "innerHTML", $sql); next($val[input_specimen]); } //BHP /*for($i=0;$i<sizeof($val[input_bhp]);$i++) { $kunci = key($val[input_bhp]); if(!$val[input_kunjungan_bhp_id][$kunci]) { //insert $sql = " INSERT INTO kunjungan_bayar ( nama, kunjungan_kamar_id, lab_kunjungan_id, bhp_id, hak_id, biaya_bhp, sifat, jumlah, bayar_bhp, tgl ) VALUES ( '".$val[input_bhp_nama][$i]."', NULLIF('".$val[input_id_kunjungan_kamar]."', ''), '".$val[input_id_kunjungan_lab]."', '".$val[input_bhp][$kunci]."', '".$val[input_bhp_hak][$kunci]."', '".$val[input_bhp_biaya][$kunci]."', '".$val[input_bhp_sifat][$kunci]."', '".$val[input_bhp_jml][$kunci]."', '".$val[input_bhp_bayar][$kunci]."', NOW()) "; $kon->sql = $sql; $kon->execute(); } else { //update $sql = " UPDATE kunjungan_bayar SET hak_id = '".$val[input_bhp_hak][$kunci]."', biaya = '".$val[input_bhp_biaya][$kunci]."', sifat = '".$val[input_bhp_sifat][$kunci]."', jumlah = '".$val[input_bhp_jml][$kunci]."', bayar_bhp = '".$val[input_bhp_bayar][$kunci]."' WHERE id = '".$val[input_kunjungan_bhp_id][$kunci]."'"; $kon->sql = $sql; //$objResponse->addAssign("debug", "innerHTML", $sql); $kon->execute(); } next($val[input_bhp]); }*/ $afek = $kon->affected_rows; if($afek < 0) { $objResponse->addAlert("Data Tidak Dapat Disimpan\nHubungi Bagian SIM."); //$objResponse->addAssign("debug", "innerHTML", $sql); } else { $objResponse->addScriptCall("list_data", "0"); $objResponse->addScriptCall("tutup_kunjungan"); $objResponse->addScriptCall("show_status_simpan"); } return $objResponse; }
function simpan_pasien_check($value) { $objResponse = new xajaxResponse(); $cleaner = new FormCleaner; $cleaner->setValue($value); $cleaner->clean(); $new_value = $cleaner->getValue(); if(!$new_value[nama]) { $objResponse->addAlert("Silakan Isi Nama Pasien."); $objResponse->addScriptCall("fokus", "nama"); } elseif(!checkdate($new_value[tgl_lahir_bln],$new_value[tgl_lahir_tgl],$new_value[tgl_lahir_thn])) { $objResponse->addAlert("Tanggal Lahir Tidak Valid."); $objResponse->addScriptCall("fokus", "tgl_lahir_tgl"); } elseif(!$new_value[sex]) { $objResponse->addAlert("Silakan Isi Jenis Kelamin Pasien."); $objResponse->addScriptCall("fokus", "sex"); } elseif(!$new_value[agama]) { $objResponse->addAlert("Silakan Isi Agama Pasien."); $objResponse->addScriptCall("fokus", "agama"); } elseif(!$new_value[pendidikan_id]) { $objResponse->addAlert("Silakan Isi Pendidikan Pasien."); $objResponse->addScriptCall("fokus", "pendidikan_id"); } elseif(!$new_value[pekerjaan_id]) { $objResponse->addAlert("Silakan Isi Pekerjaan Pasien."); $objResponse->addScriptCall("fokus", "pekerjaan_id"); } elseif(!$new_value[status_nikah]) { $objResponse->addAlert("Silakan Isi Status Nikah Pasien."); $objResponse->addScriptCall("fokus", "status_nikah"); } elseif(!$new_value[alamat]) { $objResponse->addAlert("Silakan Isi Alamat Pasien."); $objResponse->addScriptCall("fokus", "alamat"); } elseif(!$new_value[propinsi_id]) { $objResponse->addAlert("Silakan Isi Propinsi Pasien."); $objResponse->addScriptCall("fokus", "propinsi_id"); } elseif(!$new_value[kabupaten_id]) { $objResponse->addAlert("Silakan Isi Kabupaten Pasien."); $objResponse->addScriptCall("fokus", "kabupaten_id"); } elseif(!$new_value[kecamatan_id]) { $objResponse->addAlert("Silakan Isi Kecamatan Pasien."); $objResponse->addScriptCall("fokus", "kecamatan_id"); } elseif(!$new_value[desa_id]) { $objResponse->addAlert("Silakan Isi Kelurahan Pasien."); $objResponse->addScriptCall("fokus", "desa_id"); } else { $objResponse->addScriptCall("xajax_simpan_pasien", $new_value); } return $objResponse; }
function simpan_kunjungan($value) { $cleaner = new FormCleaner; $cleaner->setValue($value); $cleaner->clean(); $val = $cleaner->getValue(); $kon = new Konek; $objResponse = new xajaxResponse(); //KENDARAAN for($i=0;$i<sizeof($val[input_kendaraan_jenis]);$i++) { $parent = key($val[input_kendaraan_jenis]); //get if(!$val[input_kunjungan_kendaraan_id][$parent] && $val[input_kendaraan_jenis][$parent]) { //insert $sql = "INSERT INTO kunjungan_kendaraan (kunjungan_kamar_id, nama, jarak_tempuh, harga_bbm, tgl) VALUES ('".$val[input_id_kunjungan_kamar]."', '".$val[input_kendaraan_jenis][$parent]."', '".$val[input_jarak_tempuh]."', '".$val[input_harga_bbm]."', NOW())"; $kon->sql = $sql; $kon->execute(); $id_kki = $kon->last_id; if($val[input_kendaraan_jenis][$parent] == "SEWA AMBULANCE") { $jasa_p = '0.75'; $jasa_rs = '0.25'; $jasa_rs_op = '0.2'; $jasa_rs_kembang = '0.025'; $jasa_rs_adm = '0.025'; } else { //SEWA MOBIL JENAZAH $jasa_p = '0.5'; $jasa_rs = '0.5'; $jasa_rs_op = '0.4'; $jasa_rs_kembang = '0.05'; $jasa_rs_adm = '0.05'; } /*diinsert satu satu*/ /* $data[bahan_habis_pakai] = round(0.5 * $biaya); $data[jasa_rumah_sakit] = round(0.25 * $biaya); $data[rumah_tangga] = round(0.0375 * $biaya); $data[sopir] = round(0.10625 * $biaya); $data[perawat] = round(0.10625 * $biaya); */ for($j=0;$j<sizeof($val[input_kendaraan_field][$parent]);$j++) { $field = ""; $field = $val[input_kendaraan_field][$parent][$j]; if($field == "jasa_rumah_sakit") { $sql = "INSERT INTO kunjungan_bayar (nama, kunjungan_kamar_id, kunjungan_kendaraan_id, hak_id, biaya_jasa, bayar_jasa, jasa_p, jasa_rs, jasa_rs_op, jasa_rs_kembang, jasa_rs_adm) VALUES ('".$field."', '".$val[input_id_kunjungan_kamar]."', '".$id_kki."', '".$val[input_kendaraan_hak][$parent][$j]."', '".$val[input_kendaraan_biaya][$parent][$j]."', '".$val[input_kendaraan_bayar][$parent][$j]."', '".$jasa_p."', '".$jasa_rs."', '".$jasa_rs_op."', '".$jasa_rs_kembang."', '".$jasa_rs_adm."')"; } elseif($field == "bahan_habis_pakai") { $sql = "INSERT INTO kunjungan_bayar (nama, kunjungan_kamar_id, kunjungan_kendaraan_id, hak_id, biaya_bhp, bayar_bhp, bhp_rs, bhp_rs_op) VALUES ('".$field."', '".$val[input_id_kunjungan_kamar]."', '".$id_kki."', '".$val[input_kendaraan_hak][$parent][$j]."', '".$val[input_kendaraan_biaya][$parent][$j]."', '".$val[input_kendaraan_bayar][$parent][$j]."', '1', '1')"; } elseif($field == "rumah_tangga") { $sql = "INSERT INTO kunjungan_bayar (nama, kunjungan_kamar_id, kunjungan_kendaraan_id, hak_id, biaya_jasa, bayar_jasa, grabaf, netto) VALUES ('".$field."', '".$val[input_id_kunjungan_kamar]."', '".$id_kki."', '".$val[input_kendaraan_hak][$parent][$j]."', '".$val[input_kendaraan_biaya][$parent][$j]."', '".$val[input_kendaraan_bayar][$parent][$j]."', '1', '1')"; } elseif($field == "sopir") { $sql = "INSERT INTO kunjungan_bayar (nama, kunjungan_kamar_id, kunjungan_kendaraan_id, hak_id, biaya_jasa, bayar_jasa, grabaf, netto) VALUES ('".$field."', '".$val[input_id_kunjungan_kamar]."', '".$id_kki."', '".$val[input_kendaraan_hak][$parent][$j]."', '".$val[input_kendaraan_biaya][$parent][$j]."', '".$val[input_kendaraan_bayar][$parent][$j]."', '1', '1')"; } elseif($field == "perawat") { $sql = "INSERT INTO kunjungan_bayar (nama, kunjungan_kamar_id, kunjungan_kendaraan_id, hak_id, biaya_jasa, bayar_jasa, perawat, netto) VALUES ('".$field."', '".$val[input_id_kunjungan_kamar]."', '".$id_kki."', '".$val[input_kendaraan_hak][$parent][$j]."', '".$val[input_kendaraan_biaya][$parent][$j]."', '".$val[input_kendaraan_bayar][$parent][$j]."', '1', '1')"; } else { //lain-lain } //$objResponse->addAppend("debug", "innerHTML", $sql . "<br /><br />"); $kon->sql = $sql; $kon->execute(); } } else { //UPDATE $sqlup = "UPDATE kunjungan_kendaraan SET jarak_tempuh = '".$val[input_jarak_tempuh]."', harga_bbm = '".$val[input_harga_bbm]."' WHERE id = '".$val[input_kunjungan_kendaraan_id][$parent]."'"; $kon->sql = $sqlup; $kon->execute(); /*diinsert satu satu*/ for($j=0;$j<sizeof($val[input_kendaraan_field][$parent]);$j++) { $field = ""; $field = $val[input_kendaraan_field][$parent][$j]; //$objResponse->addAppend("debug", "innerHTML", $field . " => " . $val[input_icopim_detil_bayar][$parent][$field] . "<br />"); if($field == "jasa_rumah_sakit") { $sql = "UPDATE kunjungan_bayar SET hak_id = '".$val[input_kendaraan_hak][$parent][$j]."', biaya_jasa = '".$val[input_kendaraan_biaya][$parent][$j]."', bayar_jasa = '".$val[input_kendaraan_bayar][$parent][$j]."' WHERE id = '".$val[input_kunjungan_bayar_id][$parent][$j]."'"; } elseif($field == "bahan_habis_pakai") { $sql = "UPDATE kunjungan_bayar SET hak_id = '".$val[input_kendaraan_hak][$parent][$j]."', biaya_bhp = '".$val[input_kendaraan_biaya][$parent][$j]."', bayar_bhp = '".$val[input_kendaraan_bayar][$parent][$j]."' WHERE id = '".$val[input_kunjungan_bayar_id][$parent][$j]."'"; } elseif($field == "rumah_tangga") { $sql = "UPDATE kunjungan_bayar SET hak_id = '".$val[input_kendaraan_hak][$parent][$j]."', biaya_jasa = '".$val[input_kendaraan_biaya][$parent][$j]."', bayar_jasa = '".$val[input_kendaraan_bayar][$parent][$j]."' WHERE id = '".$val[input_kunjungan_bayar_id][$parent][$j]."'"; } elseif($field == "sopir") { $sql = "UPDATE kunjungan_bayar SET hak_id = '".$val[input_kendaraan_hak][$parent][$j]."', biaya_jasa = '".$val[input_kendaraan_biaya][$parent][$j]."', bayar_jasa = '".$val[input_kendaraan_bayar][$parent][$j]."' WHERE id = '".$val[input_kunjungan_bayar_id][$parent][$j]."'"; } elseif($field == "perawat") { $sql = "UPDATE kunjungan_bayar SET hak_id = '".$val[input_kendaraan_hak][$parent][$j]."', biaya_jasa = '".$val[input_kendaraan_biaya][$parent][$j]."', bayar_jasa = '".$val[input_kendaraan_bayar][$parent][$j]."' WHERE id = '".$val[input_kunjungan_bayar_id][$parent][$j]."'"; } else { //lain-lain } //$objResponse->addAppend("debug", "innerHTML", $field . " => " . $sql . "<br /><br />"); $kon->sql = $sql; $kon->execute(); } //endfor } next($val[input_kendaraan_jenis]); } $afek = $kon->affected_rows; if($afek < 0) { $objResponse->addAlert("Data Tidak Dapat Disimpan\nHubungi Bagian SIM."); } else { $objResponse->addScriptCall("list_data", "0"); $objResponse->addScriptCall("tutup_kunjungan"); $objResponse->addScriptCall("show_status_simpan"); } return $objResponse; }