Untitled

mail@pastecode.io avatar
unknown
plain_text
a month ago
3.8 kB
1
Indexable
Never
    // Peminjaman Warehouse
    function peminjaman_wh(){
        cek_session_akses('peminjaman_wh',$this->session->id_session);
        //	cek_session_karyawan();	
            $this->session->unset_userdata('idp', 'kd');
            //$data['record'] = $this->model_app->view_join_one('rb_pembelian','rb_supplier','id_supplier','id_pembelian','DESC');
            //$data['record'] = $this->model_app->view_ordering('mst_pembelian','id_pembelian','DESC');
            $data['record'] = $this->model_app->view_where_ordering('mst_peminjaman',array('status_pinjam'=>'Submit'),'id_peminjaman','DESC');
            
            $this->template->load('administrator/template','administrator/additional/mod_peminjaman/view_peminjaman_wh',$data);
    }
    function detail_peminjaman(){
        cek_session_akses('peminjaman_wh',$this->session->id_session);
        $id = $this->uri->segment(3);
        $data['rows'] = $this->model_app->view_pj_header($id)->row_array();
        //$data['rows'] = $this->model_app->view_where('mst_pembelian',array('id_pembelian'=>$id))->row_array();
        $data['record'] = $this->model_app->view_join_where('mst_peminjaman_dtl', 'mst_item', 'kode_item', array('id_peminjaman' => $id), 'id_dpeminjaman', 'DESC');
            $this->template->load('administrator/template','administrator/additional/mod_peminjaman/view_peminjaman_detail',$data);
    }

    function verifikasi_peminjaman(){
        cek_session_akses('peminjaman_wh',$this->session->id_session);
        $id = $this->uri->segment(3);
        $data['rows'] = $this->model_app->view_pj_header($id)->row_array();    
        $data['record'] = $this->model_app->view_join_where('mst_peminjaman_dtl', 'mst_item', 'kode_item', array('id_peminjaman' => $id), 'id_dpeminjaman', 'DESC');
            
        $this->template->load('administrator/template','administrator/additional/mod_peminjaman/view_peminjaman_wh_verifikasi',$data);
        }
    
    	function verifikasi_peminjaman_item(){
            cek_session_akses('peminjaman_wh',$this->session->id_session);
            $id = $this->uri->segment(3);
            $status = 	$this->uri->segment(4);
            $idu = 	$this->uri->segment(5);
            $data = array('status_item'=> $status);
            $where = array('id_dpeminjaman' => $id);
            $this->model_app->update('mst_peminjaman_dtl', $data, $where);	
            redirect('administrator/verifikasi_peminjaman/'.$this->uri->segment(5));
            }
        

            function peminjaman_submit()
            {
                cek_session_akses('peminjaman_wh', $this->session->id_session);
                $id = $this->uri->segment(3);
                $status = $this->uri->segment(4);
                $idu = $this->uri->segment(5);
                 // Update 'status_item' dalam 'mst_peminjaman_dtl'
                 $data = array('status_item' => $status);
                 $where = array('id_dpeminjaman' => $id);
                 $this->model_app->update('mst_peminjaman_dtl', $data, $where);
        
                $data1 = array('status_pinjam' => "Approve");
                $where1 = array('id_peminjaman' => $id);
                $this->model_app->update('mst_peminjaman', $data1, $where1);
                redirect('administrator/peminjaman_wh/');
            }
            
    
    
        function delete_peminjaman_detail(){
        //cek_session_akses('pembelian',$this->session->id_session);
        cek_session_akses('peminjaman_wh',$this->session->id_session);
        $id = array('id_dpeminjaman' => $this->uri->segment(4));
        $this->model_app->delete('mst_peminjaman_dtl', $id);
        redirect('administrator/verifikasi_peminjaman/' . $this->uri->segment(3));
    }