<?php defined('BASEPATH') or exit('No direct script access allowed');

class Update_model extends CI_Model
{
    function blokirKaryawan()
    {
        $data = array(
            'status_akun' => 'BLOKIR'
        );
        $this->db->where('id', htmlspecialchars($this->input->post('kode_login')));
        $this->db->update('sistem_login', $data);
    }
    function aktifKaryawan()
    {
        $data = array(
            'status_akun' => 'AKTIF'
        );
        $this->db->where('id', htmlspecialchars($this->input->post('kode_login')));
        $this->db->update('sistem_login', $data);
    }
    function ubahKaryawan()
    {
        $config['upload_path']   = './assets/karyawan';
        $config['allowed_types'] = 'jpg|jpeg|png';
        $config['encrypt_name']  = true;
        $config['overwrite']     = true;
        $config['quality']       = '50%';
        $config['max_size']      = 10024; // 10MB
        $this->load->library('upload', $config);
        if (!$this->upload->do_upload('foto_ktp')) :
            $data_login = array(
                'nm_panggilan' => htmlspecialchars($this->input->post('nm_lengkap')),
                'update_at'    => date("Y-m-d H:i:s")
            );
            $this->db->where('id', htmlspecialchars($this->input->post('kode_login')));
            $this->db->update('sistem_login', $data_login);
            $data_identitas = array(
                'nik'          => htmlspecialchars($this->input->post('nik')),
                'nm_lengkap'   => htmlspecialchars($this->input->post('nm_lengkap')),
                'jk'           => htmlspecialchars($this->input->post('jk')),
                'tempat_lahir' => htmlspecialchars($this->input->post('tempat_lahir')),
                'tgl_lahir'    => htmlspecialchars($this->input->post('tgl_lahir')),
                'alamat'       => htmlspecialchars($this->input->post('alamat'))
            );
            $this->db->where('login_id', htmlspecialchars($this->input->post('kode_login')));
            $this->db->update('sistem_identitas', $data_identitas);
            $this->session->set_flashdata('pesan_berhasil', '<div class="alert alert-success" id="pesan_berhasil" role="alert">Berhasil Ubah Data Karyawan!</div>');
        else :
            $_FILES['file']['name'] = $_FILES['foto_ktp']['name'];
            $_FILES['file']['type'] = $_FILES['foto_ktp']['type'];
            $_FILES['file']['tmp_name'] = $_FILES['foto_ktp']['tmp_name'];
            $_FILES['file']['size'] = $_FILES['foto_ktp']['size'];
            $uploadData = $this->upload->data();
            $data_login = array(
                'nm_panggilan' => htmlspecialchars($this->input->post('nm_lengkap')),
                'update_at'    => date("Y-m-d H:i:s")
            );
            $this->db->where('id', htmlspecialchars($this->input->post('kode_login')));
            $this->db->update('sistem_login', $data_login);
            $data_identitas = array(
                'nik'          => htmlspecialchars($this->input->post('nik')),
                'nm_lengkap'   => htmlspecialchars($this->input->post('nm_lengkap')),
                'jk'           => htmlspecialchars($this->input->post('jk')),
                'tempat_lahir' => htmlspecialchars($this->input->post('tempat_lahir')),
                'tgl_lahir'    => htmlspecialchars($this->input->post('tgl_lahir')),
                'alamat'       => htmlspecialchars($this->input->post('alamat')),
                'foto_ktp'     => $uploadData['file_name']
            );
            $this->db->where('login_id', htmlspecialchars($this->input->post('kode_login')));
            $this->db->update('sistem_identitas', $data_identitas);
            $berkas_lama = './assets/karyawan/' . htmlspecialchars($this->input->post('foto_ktp_lama')) . '';
            unlink($berkas_lama);
            $this->session->set_flashdata('pesan_berhasil', '<div class="alert alert-success" id="pesan_berhasil" role="alert">Berhasil Ubah Data Karyawan!</div>');
        endif;
    }
    // Menambahkan anggota arisan heboh Beranda
    function UpdateDataAnggotaArisanHebohBeranda1($alamat_id, $id_arisan, $anggota_id)
    {
        $cek_data_anggota = $this->db->get_where('tbl_anggota', ['id' => $anggota_id])->row_array();
        $link_foto_lama   = $cek_data_anggota['foto_ktp'];
        $config['upload_path']   = './assets/foto_ktp';
        $config['allowed_types'] = 'jpg|jpeg|png';
        $config['encrypt_name']  = true;
        $config['overwrite']     = true;
        $config['quality']       = '50%';
        $config['max_size']      = 10024; // 10MB
        $this->load->library('upload', $config);
        if (!$this->upload->do_upload('foto_ktp')) :
            $this->session->set_flashdata('pesan_gagal', '<div class="alert alert-danger" id="pesan_gagal" role="alert">Gagal Upload Foto KTP</div>');
            redirect('arisan');
        else :
            $_FILES['file']['name'] = $_FILES['foto_ktp']['name'];
            $_FILES['file']['type'] = $_FILES['foto_ktp']['type'];
            $_FILES['file']['tmp_name'] = $_FILES['foto_ktp']['tmp_name'];
            $_FILES['file']['size'] = $_FILES['foto_ktp']['size'];
            $uploadData = $this->upload->data();
            // Inputan
            $data_anggota_koperasi = array(
                'nm_anggota'        => htmlspecialchars($this->input->post('nm_anggota')),
                'jk'                => htmlspecialchars($this->input->post('jk')),
                'alamat_lengkap'    => htmlspecialchars($this->input->post('alamat_lengkap')),
                'id_alamat'         => $alamat_id,
                'tempat_lahir'      => htmlspecialchars($this->input->post('tempat_lahir')),
                'tgl_lahir'         => htmlspecialchars($this->input->post('tgl_lahir')),
                'pekerjaan'         => htmlspecialchars($this->input->post('pekerjaan')),
                'suami_istri'       => htmlspecialchars($this->input->post('suami_istri')),
                'foto_ktp'          => $uploadData['file_name'],
                'status_anggota'    => 'CALON'
            );
            $this->db->where('id', $anggota_id);
            $this->db->update('tbl_anggota', $data_anggota_koperasi);
            $berkas_lama = './assets/foto_ktp/' . $link_foto_lama . '';
            unlink($berkas_lama);
            $data_tambah_arisan = array(
                'anggota_id'            => $anggota_id,
                'regist_arisan'         => $id_arisan,
                'login_id'              => $this->session->userdata('isloggedin')
            );
            $this->db->insert('tbl_arisan_pengajuan', $data_tambah_arisan);
        endif;
    }
    function UpdateDataAnggotaArisanHebohBeranda2($alamat_id, $id_arisan, $anggota_id)
    {
        $cek_data_anggota = $this->db->get_where('tbl_anggota', ['id' => $anggota_id])->row_array();
        $link_foto_lama   = $cek_data_anggota['foto_ktp'];
        $config['upload_path']   = './assets/foto_ktp';
        $config['allowed_types'] = 'jpg|jpeg|png';
        $config['encrypt_name']  = true;
        $config['overwrite']     = true;
        $config['quality']       = '50%';
        $config['max_size']      = 10024; // 10MB
        $this->load->library('upload', $config);
        if (!$this->upload->do_upload('foto_ktp')) :
            $this->session->set_flashdata('pesan_gagal', '<div class="alert alert-danger" id="pesan_gagal" role="alert">Gagal Upload Foto KTP</div>');
            redirect('arisan');
        else :
            $_FILES['file']['name'] = $_FILES['foto_ktp']['name'];
            $_FILES['file']['type'] = $_FILES['foto_ktp']['type'];
            $_FILES['file']['tmp_name'] = $_FILES['foto_ktp']['tmp_name'];
            $_FILES['file']['size'] = $_FILES['foto_ktp']['size'];
            $uploadData = $this->upload->data();
            // Inputan
            $data_anggota_koperasi = array(
                'nm_anggota'        => htmlspecialchars($this->input->post('nm_anggota')),
                'jk'                => htmlspecialchars($this->input->post('jk')),
                'alamat_lengkap'    => htmlspecialchars($this->input->post('alamat_lengkap')),
                'id_alamat'         => $alamat_id,
                'tempat_lahir'      => htmlspecialchars($this->input->post('tempat_lahir')),
                'tgl_lahir'         => htmlspecialchars($this->input->post('tgl_lahir')),
                'pekerjaan'         => htmlspecialchars($this->input->post('pekerjaan')),
                'suami_istri'       => htmlspecialchars($this->input->post('suami_istri')),
                'foto_ktp'          => $uploadData['file_name'],
                'status_anggota'    => 'CALON'
            );
            $this->db->where('id', $anggota_id);
            $this->db->update('tbl_anggota', $data_anggota_koperasi);
            $berkas_lama = './assets/foto_ktp/' . $link_foto_lama . '';
            unlink($berkas_lama);
            $data_tambah_arisan = array(
                'anggota_id'            => $anggota_id,
                'regist_arisan'         => $id_arisan,
                'login_id'              => $this->session->userdata('isloggedin')
            );
            $this->db->insert('tbl_arisan_pengajuan', $data_tambah_arisan);
        endif;
    }
    // Menambahkan anggota arisan motor Beranda
    function UpdateDataAnggotaArisanMotorBeranda1($alamat_id, $anggota_id, $id_arisan)
    {
        $cek_data_anggota = $this->db->get_where('tbl_anggota', ['id' => $anggota_id])->row_array();
        $link_foto_lama   = $cek_data_anggota['foto_ktp'];
        $config['upload_path']   = './assets/foto_ktp';
        $config['allowed_types'] = 'jpg|jpeg|png';
        $config['encrypt_name']  = true;
        $config['overwrite']     = true;
        $config['quality']       = '50%';
        $config['max_size']      = 10024; // 10MB
        $this->load->library('upload', $config);
        if (!$this->upload->do_upload('foto_ktp')) :
            $this->session->set_flashdata('pesan_gagal', '<div class="alert alert-danger" id="pesan_gagal" role="alert">Gagal Upload Foto KTP</div>');
            redirect('arisan');
        else :
            $_FILES['file']['name'] = $_FILES['foto_ktp']['name'];
            $_FILES['file']['type'] = $_FILES['foto_ktp']['type'];
            $_FILES['file']['tmp_name'] = $_FILES['foto_ktp']['tmp_name'];
            $_FILES['file']['size'] = $_FILES['foto_ktp']['size'];
            $uploadData = $this->upload->data();
            // Inputan
            $data_anggota_koperasi = array(
                'nm_anggota'        => htmlspecialchars($this->input->post('nm_anggota')),
                'jk'                => htmlspecialchars($this->input->post('jk')),
                'alamat_lengkap'    => htmlspecialchars($this->input->post('alamat_lengkap')),
                'id_alamat'         => $alamat_id,
                'tempat_lahir'      => htmlspecialchars($this->input->post('tempat_lahir')),
                'tgl_lahir'         => htmlspecialchars($this->input->post('tgl_lahir')),
                'pekerjaan'         => htmlspecialchars($this->input->post('pekerjaan')),
                'suami_istri'       => htmlspecialchars($this->input->post('suami_istri')),
                'foto_ktp'          => $uploadData['file_name'],
                'status_anggota'    => 'CALON'
            );
            $this->db->where('id', $anggota_id);
            $this->db->update('tbl_anggota', $data_anggota_koperasi);
            $berkas_lama = './assets/foto_ktp/' . $link_foto_lama . '';
            unlink($berkas_lama);
            $data_tambah_arisan = array(
                'anggota_id'            => $anggota_id,
                'regist_arisan'         => $id_arisan,
                'login_id'              => $this->session->userdata('isloggedin')
            );
            $this->db->insert('tbl_arisan_pengajuan', $data_tambah_arisan);
        endif;
    }
    function UpdateDataAnggotaArisanMotorBeranda2($alamat_id, $anggota_id, $id_arisan)
    {
        $cek_data_anggota = $this->db->get_where('tbl_anggota', ['id' => $anggota_id])->row_array();
        $link_foto_lama   = $cek_data_anggota['foto_ktp'];
        $config['upload_path']   = './assets/foto_ktp';
        $config['allowed_types'] = 'jpg|jpeg|png';
        $config['encrypt_name']  = true;
        $config['overwrite']     = true;
        $config['quality']       = '50%';
        $config['max_size']      = 10024; // 10MB
        $this->load->library('upload', $config);
        if (!$this->upload->do_upload('foto_ktp')) :
            $this->session->set_flashdata('pesan_gagal', '<div class="alert alert-danger" id="pesan_gagal" role="alert">Gagal Upload Foto KTP</div>');
            redirect('arisan');
        else :
            $_FILES['file']['name'] = $_FILES['foto_ktp']['name'];
            $_FILES['file']['type'] = $_FILES['foto_ktp']['type'];
            $_FILES['file']['tmp_name'] = $_FILES['foto_ktp']['tmp_name'];
            $_FILES['file']['size'] = $_FILES['foto_ktp']['size'];
            $uploadData = $this->upload->data();
            // Inputan
            $data_anggota_koperasi = array(
                'nm_anggota'        => htmlspecialchars($this->input->post('nm_anggota')),
                'jk'                => htmlspecialchars($this->input->post('jk')),
                'alamat_lengkap'    => htmlspecialchars($this->input->post('alamat_lengkap')),
                'id_alamat'         => $alamat_id,
                'tempat_lahir'      => htmlspecialchars($this->input->post('tempat_lahir')),
                'tgl_lahir'         => htmlspecialchars($this->input->post('tgl_lahir')),
                'pekerjaan'         => htmlspecialchars($this->input->post('pekerjaan')),
                'suami_istri'       => htmlspecialchars($this->input->post('suami_istri')),
                'foto_ktp'          => $uploadData['file_name'],
                'status_anggota'    => 'CALON'
            );
            $this->db->where('id', $anggota_id);
            $this->db->update('tbl_anggota', $data_anggota_koperasi);
            $berkas_lama = './assets/foto_ktp/' . $link_foto_lama . '';
            unlink($berkas_lama);
            $data_tambah_arisan = array(
                'anggota_id'            => $anggota_id,
                'regist_arisan'         => $id_arisan,
                'login_id'              => $this->session->userdata('isloggedin')
            );
            $this->db->insert('tbl_arisan_pengajuan', $data_tambah_arisan);
        endif;
    }
    function updateDataAnggotaKK($data_inputan, $cek_alamat)
    {
        $link_foto_lama   = $data_inputan['foto_kk_old'];
        $config['upload_path']   = './assets/foto_ktp';
        $config['allowed_types'] = 'jpg|jpeg|png';
        $config['encrypt_name']  = true;
        $config['overwrite']     = true;
        $config['quality']       = '50%';
        $config['max_size']      = 10024; // 10MB
        $this->load->library('upload', $config);
        if (!$this->upload->do_upload('foto_kk')) :
            $data_anggota_koperasi = array(
                'nm_anggota'        => htmlspecialchars($this->input->post('nm_anggota')),
                'jk'                => htmlspecialchars($this->input->post('jk')),
                'alamat_lengkap'    => htmlspecialchars($this->input->post('alamat_lengkap')),
                'id_alamat'         => $cek_alamat,
                'tempat_lahir'      => htmlspecialchars($this->input->post('tempat_lahir')),
                'tgl_lahir'         => htmlspecialchars($this->input->post('tgl_lahir')),
                'pekerjaan'         => htmlspecialchars($this->input->post('pekerjaan')),
                'suami_istri'       => htmlspecialchars($this->input->post('suami_istri'))
            );
            $this->db->where('id', $data_inputan['id_anggota']);
            $this->db->update('anggota', $data_anggota_koperasi);
        else :
            $_FILES['file']['name'] = $_FILES['foto_kk']['name'];
            $_FILES['file']['type'] = $_FILES['foto_kk']['type'];
            $_FILES['file']['tmp_name'] = $_FILES['foto_kk']['tmp_name'];
            $_FILES['file']['size'] = $_FILES['foto_kk']['size'];
            $uploadDataKK = $this->upload->data();
            // Inputan
            $data_anggota_koperasi = array(
                'nm_anggota'        => htmlspecialchars($this->input->post('nm_anggota')),
                'jk'                => htmlspecialchars($this->input->post('jk')),
                'alamat_lengkap'    => htmlspecialchars($this->input->post('alamat_lengkap')),
                'id_alamat'         => $cek_alamat,
                'tempat_lahir'      => htmlspecialchars($this->input->post('tempat_lahir')),
                'tgl_lahir'         => htmlspecialchars($this->input->post('tgl_lahir')),
                'pekerjaan'         => htmlspecialchars($this->input->post('pekerjaan')),
                'suami_istri'       => htmlspecialchars($this->input->post('suami_istri')),
                'foto_kk'           => $uploadDataKK['file_name']
            );
            $this->db->where('id', $data_inputan['id_anggota']);
            $this->db->update('anggota', $data_anggota_koperasi);
            $berkas_lama = './assets/foto_ktp/' . $link_foto_lama . '';
            unlink($berkas_lama);
        endif;
    }
    function updateDataAnggota($data_inputan, $cek_alamat)
    {
        $link_foto_lama   = $data_inputan['foto_ktp_old'];
        $config['upload_path']   = './assets/foto_ktp';
        $config['allowed_types'] = 'jpg|jpeg|png';
        $config['encrypt_name']  = true;
        $config['overwrite']     = true;
        $config['quality']       = '50%';
        $config['max_size']      = 10024; // 10MB
        $this->load->library('upload', $config);
        if (!$this->upload->do_upload('foto_ktp')) :
            $data_anggota_koperasi = array(
                'nm_anggota'        => htmlspecialchars($this->input->post('nm_anggota')),
                'jk'                => htmlspecialchars($this->input->post('jk')),
                'alamat_lengkap'    => htmlspecialchars($this->input->post('alamat_lengkap')),
                'id_alamat'         => $cek_alamat,
                'tempat_lahir'      => htmlspecialchars($this->input->post('tempat_lahir')),
                'tgl_lahir'         => htmlspecialchars($this->input->post('tgl_lahir')),
                'pekerjaan'         => htmlspecialchars($this->input->post('pekerjaan')),
                'suami_istri'       => htmlspecialchars($this->input->post('suami_istri'))
            );
            $this->db->where('id', $data_inputan['id_anggota']);
            $this->db->update('anggota', $data_anggota_koperasi);
        else :
            $_FILES['file']['name'] = $_FILES['foto_ktp']['name'];
            $_FILES['file']['type'] = $_FILES['foto_ktp']['type'];
            $_FILES['file']['tmp_name'] = $_FILES['foto_ktp']['tmp_name'];
            $_FILES['file']['size'] = $_FILES['foto_ktp']['size'];
            $uploadData = $this->upload->data();
            // Inputan
            $data_anggota_koperasi = array(
                'nm_anggota'        => htmlspecialchars($this->input->post('nm_anggota')),
                'jk'                => htmlspecialchars($this->input->post('jk')),
                'alamat_lengkap'    => htmlspecialchars($this->input->post('alamat_lengkap')),
                'id_alamat'         => $cek_alamat,
                'tempat_lahir'      => htmlspecialchars($this->input->post('tempat_lahir')),
                'tgl_lahir'         => htmlspecialchars($this->input->post('tgl_lahir')),
                'pekerjaan'         => htmlspecialchars($this->input->post('pekerjaan')),
                'suami_istri'       => htmlspecialchars($this->input->post('suami_istri')),
                'foto_ktp'          => $uploadData['file_name']
            );
            $this->db->where('id', $data_inputan['id_anggota']);
            $this->db->update('anggota', $data_anggota_koperasi);
            $berkas_lama = './assets/foto_ktp/' . $link_foto_lama . '';
            unlink($berkas_lama);
        endif;
    }
    function updateDataKaryawanLama($data_inputan, $alamat_id)
    {
        $link_foto_lama   = $data_inputan['foto_ktp_old'];
        $config['upload_path']   = './assets/ptgs_id';
        $config['allowed_types'] = 'jpg|jpeg|png';
        $config['encrypt_name']  = true;
        $config['overwrite']     = true;
        $config['quality']       = '50%';
        $config['max_size']      = 10024; // 10MB
        $this->load->library('upload', $config);
        if (!$this->upload->do_upload('foto_ktp')) :
            $data_login = array(
                'email'             => $data_inputan['email_baru'],
                'no_hp'             => $data_inputan['no_hp_baru'],
                'nm_panggilan'      => $data_inputan['nm_panggilan']
            );
            $this->db->where('id', $data_inputan['login_id']);
            $this->db->update('sistem_login', $data_login);
            $data_identitas = array(
                'nik'             => $data_inputan['nik'],
                'jk'              => $data_inputan['jk'],
                'tempat_lahir'    => $data_inputan['tempat_lahir'],
                'tgl_lahir'       => $data_inputan['tgl_lahir'],
                'alamat_id'       => $alamat_id,
                'tgl_gabung'      => $data_inputan['tgl_gabung']
            );
            $this->db->where('login_id', $data_inputan['login_id']);
            $this->db->update('sistem_identitas', $data_identitas);
        else :
            $_FILES['file']['name'] = $_FILES['foto_ktp']['name'];
            $_FILES['file']['type'] = $_FILES['foto_ktp']['type'];
            $_FILES['file']['tmp_name'] = $_FILES['foto_ktp']['tmp_name'];
            $_FILES['file']['size'] = $_FILES['foto_ktp']['size'];
            $uploadData = $this->upload->data();
            // Inputan
            $data_login = array(
                'email'             => $data_inputan['email_baru'],
                'no_hp'             => $data_inputan['no_hp_baru'],
                'nm_panggilan'      => $data_inputan['nm_panggilan']
            );
            $this->db->where('id', $data_inputan['login_id']);
            $this->db->update('sistem_login', $data_login);
            $data_identitas = array(
                'nik'             => $data_inputan['nik'],
                'jk'              => $data_inputan['jk'],
                'tempat_lahir'    => $data_inputan['tempat_lahir'],
                'tgl_lahir'       => $data_inputan['tgl_lahir'],
                'alamat_id'       => $alamat_id,
                'foto_ktp'        => $uploadData['file_name'],
                'tgl_gabung'      => $data_inputan['tgl_gabung']
            );
            $this->db->where('login_id', $data_inputan['login_id']);
            $this->db->update('sistem_identitas', $data_identitas);
            $berkas_lama = './assets/ptgs_id/' . $link_foto_lama . '';
            unlink($berkas_lama);
        endif;
    }
    function blokirDataKaryawan($data_inputan)
    {
        $data_login = array(
            'status_akun'             => 'BLOKIR'
        );
        $this->db->where('id', $data_inputan['login_id']);
        $this->db->update('sistem_login', $data_login);
    }
    function aktifDataKaryawan($data_inputan)
    {
        $data_login = array(
            'status_akun'             => 'AKTIF'
        );
        $this->db->where('id', $data_inputan['login_id']);
        $this->db->update('sistem_login', $data_login);
    }
    // merubah data aturan pinjaman koperasi
    function ubahAturanPinjaman()
    {
        $data = array(
            'administrasi' => htmlspecialchars($this->input->post('administrasi')),
            'rk'           => htmlspecialchars($this->input->post('rk')),
            'jasa'         => htmlspecialchars($this->input->post('jasa')),
            'simpanan'     => htmlspecialchars($this->input->post('simpanan')),
            'tempo'        => htmlspecialchars($this->input->post('tempo'))
        );
        $this->db->where('produk_id', htmlspecialchars($this->input->post('produk_id')));
        $this->db->update('p_koperasi_aturan', $data);
    }
    // Merubah data laporan
    function ubahDataLaporan($laporan_id)
    {
        $link_foto_lama   = htmlspecialchars($this->input->post('bukti_jaminan_lama'));
        $config['upload_path']   = './assets/foto_jaminan';
        $config['allowed_types'] = 'jpg|jpeg|png';
        $config['encrypt_name']  = true;
        $config['overwrite']     = true;
        $config['quality']       = '50%';
        $config['max_size']      = 10024; // 10MB
        $this->load->library('upload', $config);
        if (!$this->upload->do_upload('bukti_jaminan')) :
            $this->session->set_flashdata('pesan_gagal', '<div class="alert alert-danger" id="pesan_gagal" role="alert">Gagal Upload Foto Jaminan</div>');
        else :
            $_FILES['file']['name'] = $_FILES['bukti_jaminan']['name'];
            $_FILES['file']['type'] = $_FILES['bukti_jaminan']['type'];
            $_FILES['file']['tmp_name'] = $_FILES['bukti_jaminan']['tmp_name'];
            $_FILES['file']['size'] = $_FILES['bukti_jaminan']['size'];
            $uploadData = $this->upload->data();
            // Inputan
            $ubah_data_laporan = array(
                'jenis_penarikan'        => htmlspecialchars($this->input->post('jenis_penarikan')),
                'jaminan_arisan'         => htmlspecialchars($this->input->post('jaminan_arisan')),
                'foto_jaminan'           => $uploadData['file_name']
            );
            $this->db->where('id', $laporan_id);
            $this->db->update('lap_arisan', $ubah_data_laporan);
            $berkas_lama = './assets/foto_jaminan/' . $link_foto_lama . '';
            unlink($berkas_lama);
            $this->session->set_flashdata('pesan_berhasil', '<div class="alert alert-success" id="pesan_berhasil" role="alert">Berhasil Merubah Data Laporan!</div>');
        endif;
    }
}
