File: //home/cafsindia/allyindian_com/sbltt/application/controllers/Vehicle_report.php
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
require_once("Persons.php");
class Vehicle_report extends Persons{
public function __construct()
{
parent::__construct('vehicle_report');
$this->load->model('Vehicle_report_model');
}
public function index(){
if(!$this->Appconfig->isAppvalid()){
redirect('config');
}
$data['table_headers'] = $this->xss_clean(get_vehicle_report_table_headers());
$vehicle_no[""] = "---- Select Vehicle ----";
$vehicle_no["All"] = "ALL";
foreach($this->Vehicle_report_model->get_vehicle()->result_array() as $row){
$vehicle_no[$this->xss_clean($row['vehicle_id'])] = $this->xss_clean($row['vehicle_no']);
}
$data['vehicle_no'] = $vehicle_no;
$this->load->view('vehicle_report/manage', $data);
}
/*
Returns Supplier table data rows. This will be called with AJAX.
*/
public function search(){
$search = $this->input->get('search');
$limit = $this->input->get('limit');
$offset = $this->input->get('offset');
$sort = $this->input->get('sort');
$order = $this->input->get('order');
$filters = array('crm' => $this->input->get('crm'),
'crmto' => $this->input->get('crmto'));
$all_leads = $this->Vehicle_report_model->search($search, $filters, $limit, $offset, $sort, $order);
$total_rows = $this->Vehicle_report_model->get_found_rows($search, $filters);
$data_rows = array();
foreach($all_leads->result() as $leads){
$data_rows[] = get_transfer_data_row($leads, $this);
}
echo json_encode(array('total' => $total_rows, 'rows' => $data_rows));
}
/*
This abstrack_report
*/
public function vehicle_report(){
$filters = array('start_date' => $this->input->post('start_date'), 'end_date' => $this->input->post('end_date'));
$search_by = $this->input->post('search_by');
$vehicle_no = $this->input->post('vehicle_no');
$expiry = $this->input->post('expiry');
$result = $this->Vehicle_report_model->vehicle_report($filters,$search_by,$vehicle_no,$expiry);
echo json_encode(array('success' => TRUE, 'result' => $result));
}
}
?>