function submit() { $arr['ID'] = isset($_REQUEST['action']) && $_REQUEST['action'] == 'edit' ? '' : $this->data_model->setID(); $arr['nomor'] = isset($_REQUEST['action']) && $_REQUEST['action'] == 'edit' ? '' : $this->data_model->get_next_no(); //$arr['total'] = str_replace(',','',$this->input->post('dasar_pengenaan'))*str_replace(',','',$this->input->post('persen_tarif'))/100; $arr['total'] = 0; $this->data_model->fill_data($arr); foreach ($_REQUEST['idrows'] as $idx => $value) { $arr[$idx]['pparkir_id'] = $value; $arr[$idx]['ID'] = $arr['ID']; //$arr[$idx]['id_rekening'] = $_REQUEST['kode_rekening'][$idx]; $arr[$idx]['id_rekening'] = getIdRekening($_REQUEST['kode_rekening'][$idx]); $arr[$idx]['dasar_pengenaan'] = $_REQUEST['dasar_pengenaan'][$idx]; $arr[$idx]['dasar_tarif'] = $_REQUEST['dasar_tarif'][$idx]; $arr[$idx]['jumlah'] = $_REQUEST['jumlah'][$idx]; $arr[$idx]['persen_tarif'] = $_REQUEST['persen_tarif'][$idx]; $arr[$idx]['nominal'] = $_REQUEST['pajak'][$idx]; $total += $arr[$idx]['nominal']; } $arr['total'] = $total; $this->db->trans_start(); if ($_REQUEST['action'] == 'edit') { $id = $this->input->post('idmasters'); if ($this->data_model->update_data($id)) { $this->data_model->delete_rincian_data($id); foreach ($_REQUEST['idrows'] as $idx => $value) { $this->data_model->fill_rincian_data($arr[$idx]); //if($this->data_model->update_rincian_data($arr[$idx]['pparkir_id'])) if ($this->data_model->insert_rincian_data()) { $this->result_msg = '<li>:: Data telah diupdate ::</li>'; $this->db->trans_complete(); } else { $this->result_msg = '<li>:: Error Update data ::</li>'; } } $this->db->query('update pendataan_spt set nominal=' . $this->db->escape($arr['total']) . ' where pendataan_id=' . $this->db->escape($id)); } else { $this->result_msg .= '<li>:: Gagal Update data ::</li>'; } echo $this->result_msg; } else { if ($this->data_model->insert_data()) { foreach ($_REQUEST['idrows'] as $idx => $value) { $this->data_model->fill_rincian_data($arr[$idx]); if ($this->data_model->insert_rincian_data()) { $this->result_msg = '<li>:: Data telah tersimpan ::</li>'; } else { $this->result_msg = '<li>:: Error tersimpan data ::</li>'; } } } else { $this->result_msg = '<li>:: Gagal tersimpan data ::</li>'; } $this->db->query('update pendataan_spt set nominal=' . $this->db->escape($arr['total']) . ' where pendataan_id=' . $this->db->escape($arr['ID'])); echo $this->result_msg; } $this->db->trans_complete(); }
} else { echo 'error'; } unset($exception); unset($other_request); } } else { //tambah if (isset($_REQUEST['detail'])) { //data detail if ($_REQUEST['rekening'] == '') { //catch if empty //do nothing } else { $ID_PARKIR = $fbird->setGenerator('GEN_PENDATAAN_PPARKIR'); $id_rekening = getIdRekening($_REQUEST['rekening']); $exception = array('pparkir_alamat', 'pparkir_id_desa'); $other_request = array('pparkir_id' => $ID_PARKIR, 'pendataan_id' => $_REQUEST['FK'], 'dasar_pengenaan' => $_REQUEST['pengenaan'], 'persen_tarif' => $_REQUEST['persen'], 'id_rekening' => $id_rekening, 'nominal' => $_REQUEST['pajak']); ibase_trans(); $b = $fbird->FBInsert('pendataan_pparkir', $other_request, $exception); unset($exception); unset($other_request); } } else { //data umum $ID = $fbird->setGenerator('GEN_PENDATAAN_SPT'); $exception = array('spt_id', 'memo', 'nama_kegiatan'); $other_request = array('pendataan_no' => $_REQUEST['nomor'], 'pendataan_id' => $ID); ibase_trans(); $a = $fbird->FBInsert('pendataan_spt', $other_request, $exception); if ($a) {
$crudColumns = array('id' => 'id', 'kode_rekening' => 'kode_rekening', 'nama_rekening' => 'nama_rekening', 'tarif_dasar' => 'tarif_dasar', 'persen_tarif' => 'persen_tarif'); $crudTableName = 'REKENING_KODE'; $Filter = 'objek'; $NilaiFilter = '02'; include $expath . 'jqGridCrudALL.php'; } if ($_REQUEST['sender'] == 'penetapan_PajakHiburan') { $crudColumns = array('id' => 'phiburan_id', 'TglEntri' => 'tgl_entry', 'NpwpdNpwrd' => 'npwp', 'Nama' => 'nama', 'Alamat' => 'alamat', 'pemungutan' => 'jenis_pungutan', 'periodeAwal' => 'periode_awal', 'periodeAkhir' => 'periode_akhir', 'Pajak' => 'nominal'); $crudTableName = 'PENDATAAN_SPT'; $ID = "PENDATAAN_"; $Filter = 'pendataan_spt.jenis_pendataan'; $NilaiFilter = 'HIBURAN'; include $expath . 'jqGridCrudPendataanHiburan.php'; } if ($_REQUEST['sender'] == 'set_form') { $id = getIdRekening($_REQUEST['id']); $qry = 'select id,persen_tarif, tarif_dasar from rekening_kode where id=' . quote_smart($id); $result = gcms_query($qry); $rs = gcms_fetch_object($result); $arr = array('persen' => $rs->persen_tarif, 'tarif' => $rs->tarif_dasar, 'id_rekening' => $rs->id); echo json_encode($arr); } if ($_REQUEST['sender'] == "DataHiburan") { switch ($_REQUEST['action']) { case 'read': echo '{ "page":"0", "total":0, "records":0, "rows":[ {"id":0,"cell":[0,"","","",""]},