} else { } unset($exception); unset($other_request); } } } if ($_REQUEST['sender'] == "entri_pendaftaran_bu") { $cek = b_fetch('select count(*) from pendaftaran where no_pendaftaran=' . quote_smart($_REQUEST['no_pendaftaran'])); if (!$cek) { $nomor = $_REQUEST['no_pendaftaran']; $nmax = (int) substr($_REQUEST['no_pendaftaran'], 1); } else { $nomor = setNomorPendaftaran($_REQUEST['jenis_pendaftaran'], $_REQUEST['objek_pdrd']); $message = $_REQUEST['no_pendaftaran'] . ' sudah terdaftar, ' . "\n" . 'diganti dengan ' . $nomor . "\n"; $nmax = b_fetch('select max(nurut) from pendaftaran where jenis_pendaftaran=' . quote_smart($_REQUEST['jenis_pendaftaran']) . ' and objek_pdrd=' . quote_smart($_REQUEST['objek_pdrd'])); //$nmax = b_fetch('select max(nurut) from pendaftaran where jenis_pendaftaran='.quote_smart($_REQUEST['jenis_pendaftaran']).' '); $nmax++; } $npwp = setNoNPWP($nmax, $_REQUEST['jenis_pendaftaran'], $_REQUEST['objek_pdrd'], $_REQUEST['pemohon']); $nokartu = setNoKartu($nmax, $_REQUEST['jenis_pendaftaran'], $_REQUEST['objek_pdrd'], $_REQUEST['tanggal_kartu']); $arr_field = array('id_pemohon', 'jenis_pendaftaran', 'nurut', 'no_pendaftaran', 'no_kartu', 'npwp', 'objek_pdrd', 'kode_usaha', 'tanggal_kartu', 'tanggal_terima', 'tanggal_kembali', 'tanggal_kirim', 'tanggal_tutup'); $field = implode(',', $arr_field); $qy = 'insert into pendaftaran (' . $field . ') values ('; $qy .= quote_smart($_REQUEST['pemohon']) . ',' . quote_smart($_REQUEST['jenis_pendaftaran']) . ",'{$nmax}'" . ',' . quote_smart($nomor) . ',' . quote_smart($nokartu) . ',' . quote_smart($npwp) . ',' . quote_smart($_REQUEST['objek_pdrd']) . ',' . quote_smart($_REQUEST['kode_usaha']) . ',' . quote_smart($_REQUEST['tanggal_kartu']) . ',' . quote_smart(blkDate($_REQUEST['tanggal_terima'])) . ',' . quote_smart(blkDate($_REQUEST['tanggal_kembali'])) . ',' . quote_smart(blkDate($_REQUEST['tanggal_kirim'])) . ',' . quote_smart(blkDate($_REQUEST['tanggal_tutup'])) . ')'; if (gcms_query($qy)) { echo $message . 'Data telah tersimpan '; } else { echo '!'; } }
function form() { if ($_REQUEST['action'] == 'edit') { $pemohon = $this->IU_Pribadi(); $id = $this->input->post('idmasters'); $arr = array('pemohon' => $pemohon); $this->data_model->fill_data($arr, 'edit'); if ($this->data_model->update_data($id)) { $this->result_msg .= '<li>:: Data telah diupdate ::</li>'; //echo '<li>:: Data telah tersimpan ::</li>'; } else { $this->result_msg .= '<li>:: Gagal update data ::</li>'; } echo $this->result_msg; } else { $pemohon = $this->IU_Pribadi(); //$cek = b_fetch('select count(*) from pendaftaran where no_pendaftaran='.quote_smart($_REQUEST['nomor'])); $cek = $this->data_model->cek_no_pendaftaran($this->input->post('nomor')); if ($cek > 0) { $nomor = setNomorPendaftaran($this->input->post('jenis_daftar'), $this->input->post('objek_pdrd')); $nmax = (int) substr($nomor, 1, strlen($nomor) - 1); $this->result_msg .= '<li>::' . $this->input->post('nomor') . ' sudah terdaftar, diganti dengan ' . $nomor . "::</li>"; //echo '<li>Nomor Baru</li>'; } else { $nomor = $this->input->post('nomor'); $nmax = (int) substr($nomor, 1); //echo '<li>Nomor Form</li>'; } $npwp = setNoNPWP($nmax, $this->input->post('jenis_daftar'), $this->input->post('objek_pdrd'), $pemohon); $nokartu = setNoKartu($nmax, $this->input->post('jenis_daftar'), $this->input->post('objek_pdrd'), $this->input->post('tgl_kartu')); //echo '<li>Set NPWP & No Kartu</li>'; $arr = array('pemohon' => $pemohon, 'nurut' => $nmax, 'no_daftar' => $nomor, 'no_kartu' => $nokartu, 'npwp' => $npwp); $this->data_model->fill_data($arr); if ($this->data_model->insert_data()) { $this->result_msg .= '<li>:: Data telah tersimpan ::</li>'; //echo '<li>:: Data telah tersimpan ::</li>'; } else { $this->result_msg .= '<li>:: Gagal tersimpan data ::</li>'; } echo $this->result_msg; /*$this->form_validation->set_rules('nomor', 'No. Pendaftaran', 'required'); $this->form_validation->set_rules('jenis_daftar', 'Jenis Pendaftaran', 'required'); if ($this->form_validation->run() == FALSE) { $this->index(); } else { $this->index(); } */ //print_r($_POST); //echo json_encode(array('msg'=>'Heloow')); } }