Advertisement
Guest User

Untitled

a guest
Dec 15th, 2019
138
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.83 KB | None | 0 0
  1. <?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
  2.  
  3. class Invoices extends CI_Controller {
  4.     public function __construct(){
  5.         parent::__construct();
  6.        
  7.         if($this->session->userdata('group') != '1'){
  8.             $this->session->set_flashdata('error','Sorry, you are not logged in!');
  9.             redirect('login');
  10.         }
  11.        
  12.         //load model -> model_products
  13.         $this->load->model('model_orders');
  14.     }
  15.    
  16.     public function index()
  17.     {
  18.         $data['invoices'] = $this->model_orders->all();
  19.         $this->load->view('backend/view_all_invoices', $data);
  20.     }
  21.  
  22.     public function detail($invoice_id)
  23.     {
  24.         $data['invoice'] = $this->model_orders->get_invoice_by_id($invoice_id);
  25.         $data['orders']  = $this->model_orders->get_orders_by_invoice($invoice_id);
  26.         $this->load->view('backend/view_invoice_detail', $data);
  27.     }
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement