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

class BIIreports extends Admin_Controller {
    
    function __construct() {
        parent::__construct();
    }

    public function termreport() {
        $this->session->set_userdata('top_menu', 'Reports');
        $this->session->set_userdata('sub_menu', 'bireports/termreport');
        $data['title'] = 'Term Reports';
        
        if ($this->input->server('REQUEST_METHOD') == "POST") {
            $search = $this->input->post('search');
            
            if ($search == "search_filter") {
                $date_from = date('Y-m-d', $this->customlib->datetostrtotime($this->input->post('date_from')));
                $date_to = date('Y-m-d', $this->customlib->datetostrtotime($this->input->post('date_to')));
                
                $data['exp_title'] = 'Term Report From ' . $this->input->post('date_from') . " To " . $this->input->post('date_to');
                $data['date_from2'] = $date_from;
                $data['date_to2'] = $date_to;
                $data['report_type'] = $this->input->post('report_type');
            }
        }
        
        $this->load->view('layout/header', $data);
        $this->load->view('admin/bireports/termreport', $data);
        $this->load->view('layout/footer', $data);
    }

    public function printTermReport() {
        $setting_result = $this->setting_model->get();
        $data['settinglist'] = $setting_result;
        
        $data['title'] = 'Term Report';
        $data['exp_title'] = 'Term Report From ' . $this->input->post('date_from') . " To " . $this->input->post('date_to');
        $date_from = date('Y-m-d', $this->customlib->datetostrtotime($this->input->post('date_from')));
        $date_to = date('Y-m-d', $this->customlib->datetostrtotime($this->input->post('date_to')));
        
        $data['date_from2'] = $date_from;
        $data['date_to2'] = $date_to;
        $data['report_type'] = $this->input->post('report_type');

        $this->load->view('print/printTermReport', $data);
    }
}
?>