File: /home/cafsindia/ntc_cafsinfotech_in_bk/application/controllers/Maintenance_tyre_change_report.php
<?php if ( ! defined('BASEPATH')) exit('No direct script is allowed');
require_once("Action_controller.php");
class Maintenance_tyre_change_report extends Action_controller{
public function __construct(){
parent::__construct('maintenance_tyre_change_report');
$this->collect_base_info();
}
// LOAD PAGE QUICK LINK,FILTERS AND TABLE HEADERS
public function index(){
$this->load->view("$this->control_name/manage");
}
//LOAD TABEL WITH FILTERS
public function check_log_details(){
$start_date = str_replace("/","-",$this->input->post('start_date'));
$end_date = str_replace("/","-",$this->input->post('end_date'));
$from_date = date('Y-m-d',strtotime($start_date));
$to_date = date('Y-m-d',strtotime($end_date));
$this->db->from('cw_tyre_scrap');
$this->db->join('cw_vehicle_trip_info', 'cw_vehicle_trip_info.prime_vehicle_info_id = cw_tyre_scrap.prime_tyre_scrap_id','inner');
$this->db->join('cw_vehicle_master', ' cw_vehicle_master.prime_vehicle_master_id = cw_tyre_scrap.prime_tyre_scrap_id','inner');
$this->db->join('cw_inventory_brand', ' cw_inventory_brand.prime_inventory_brand_id = cw_tyre_scrap.prime_tyre_scrap_id','inner');
$this->db->join('cw_zct_19','cw_zct_19.cw_zct_19_id = cw_tyre_scrap.prime_tyre_scrap_id','inner');
$this->db->join('cw_tyre_size','cw_tyre_size.prime_tyre_size_id = cw_tyre_scrap.prime_tyre_scrap_id','inner');
$this->db->where('cw_tyre_scrap.date between "'.$from_date.'" and "'.$to_date.'"');
$get_data_rslt = $this->db->get()->result();
$tr_line = "";
foreach ($get_data_rslt as $key => $value){
$horse_reg=$value->reg_no.'/'.$value->register_no;
$tr_line .="<tr>
<td>".$date = date('d-m-Y',strtotime($value->date))."</td>
<td>".$vehicle_no = $value->vehicle_no."</td>
<td>".$horse_reg = $horse_reg."</td>
<td>".$brand_name = $value->brand_name."</td>
<td>".$cw_zct_19_value = $value->cw_zct_19_value."</td>
<td>".$tyre_size = $value->tyre_size."</td>
</tr>";
}
if($get_data_rslt){
$table_content = "<div style='margin:20px;'>
<table class='table table-striped table-bordered' id='trip_report'>
<thead>
<tr>
<td>DATE</td>
<td>FLEET NUMBER</td>
<td>HORSE/TRAILER REG</td>
<td>BRAND</td>
<td>TYRE POSITION CHANGE</td>
<td>TYRE SIZE</td>
</tr>
</thead>
<tbody>
$tr_line
</tbody>
</table>
</div>";
echo json_encode(array('success'=>true,'table_content'=>$table_content));
}else{
echo json_encode(array('success'=>false,'message'=>'NO DATA AVAILABLE','table_content'=>$table_content));
}
}
}
?>