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

class Dashboard extends CI_Controller 
{
	public function __construct()
	{
	 	parent::__construct();	
		$this->load->model('Crud_model');
		$this->load->library('pagination');
		$this->load->library('form_validation');			
		if(!$this->session->userdata('logged_in')) 
			redirect('Login');
	}
	 
	public function index()
	{
		$url='dashboard';
		$order_field= 	'view';
		$join_array = 	array(0=>array(0=>USER_PERM_TBL,1=>"up_menu_id=menu_id",2=>''));
		$result 	=	$this->Crud_model->select_data(MENU_TBL,'*',array("url"=>$url,"up_emp_id"=>$this->session->userdata('user_id')),'1',$join_array,$order_field,"DESC",'','','');
		$data['no_bill']           = $this->Crud_model->no_of_bill();
		$data['no_of_consignor']    = $this->Crud_model->no_of_consignor();
		$data['no_of_consignee']    = $this->Crud_model->no_of_consignee();




		if(empty($result))
		{
			$data['page_title'] 	=	'Warning';
	        $data['page_name']  	= 	'warning';
	        $data['page_master']	= 	'Dashboard';
	        $data['page_master_url'] = 	'Dashboard';
	        $data['page_function']	=	'';
			$this->load->view('template/default', $data);
		}
		else
		{
	        $data['page_title'] 	=	'Dashboard';
	        $data['page_name']  	=	'dashboard-template';
	        $data['page_master']	= 	'Dashboard';
	        $data['page_master_url']= 	'Dashboard';
	        $data['page_function']	=	'';		
	        $this->load->view('template/dashboard-template', $data);
	    }
	}
}
?>