<?php
if (!defined('BASEPATH')) exit('No direct script access allowed');
class Activetickets extends MY_Controller {
    function __construct() {
        parent::__construct();
    }
    public function index() {
          $data['template'] = 'sales/activetickets_view';
          $this->load->view('template',$data);
    }
    
    public function deletetickets($id) {
        $where = array('ID' => $id);  
        $this->common->delete('SHAREDTICKETS',$where);
        $this->session->set_flashdata('success_msg', 'The record has been deleted successfuly.');
        redirect('sales/activetickets');
    }
    // ACTIVE TICKETS LIST
    public function getactivetickets() {
        $this->load->model('sales/activetickets_model');
//        $data['data'] = $this->common->getAll('SHAREDTICKETS');
        //echo "<pre>";print_r($data);exit;
        $data['data'] = $this->activetickets_model->getactiveticketlist();
        echo json_encode($data);
    }
     public function editactivetickets($id) {
        $where = array('ID' => $id,);
        $data = $this->common->getWhere('SHAREDTICKETS',$where);
        echo json_encode($data);
    }
    // ACTIVE TICKETS DETAILS
    public function getactiveticketlines() {
        if (!$this->uri->segment(3) || $this->uri->segment(3) == "")
            redirect(site_url() . 'sales');
        $this->load->model('sales/activetickets_model');
        $data['activetickets'] = $this->activetickets_model->getactiveticketlinesbyparam($this->uri->segment(3));
        $this->load->view('settings/header');
        $this->load->view('sales/activeticket_details_view', $data);
        $this->load->view('settings/footer');
    }
}