diff --git a/application/controllers/batchcard.php b/application/controllers/batchcard.php index a17a7818..c0caf7b7 100755 --- a/application/controllers/batchcard.php +++ b/application/controllers/batchcard.php @@ -711,9 +711,25 @@ class batchcard extends BaseController } function getMaintListing(){ - $data['MaintListing'] = $this->batchcard_model->getmaint_dtl(); + + if ($this->input->post('btn_submit')) + { + + $fdate = $this->input->post('from_date'); + + $tdate = $this->input->post('to_date'); + $type = $this->input->post('mySelect'); + + + } + + $data['MaintListing'] = $this->batchcard_model->getmaint_dtl( $fdate,$tdate, $type ); + $this->global['pageTitle'] = 'Siddharth : Maintenance/Breakdown Listing'; $this->loadViews("BatchcardMaintListing", $this->global,$data,NULL); + + + } function addMaint(){ diff --git a/application/models/batchcard_model.php b/application/models/batchcard_model.php index 3042fc3c..2a919672 100755 --- a/application/models/batchcard_model.php +++ b/application/models/batchcard_model.php @@ -233,19 +233,44 @@ class batchcard_model extends CI_Model return $res->result(); } } - function getmaint_dtl() + function getmaint_dtl($fdate,$tdate,$type ) { - // $r->FirstName.' '.$r->LastName - $this->db->select('BMD.*'); + + + $this->db->select('BMD.*'); + // $this->db->select() $this->db->select('CONCAT(ED1.FirstName, " - " , ED1.LastName) AS Approver_Name', FALSE); $this->db->select('CONCAT(ED2.FirstName, " - " , ED2.LastName) AS Worker_Name', FALSE); $this->db->from('T_Batchcard_MaintanceDetails BMD'); + $this->db->like('BMD.CreatedOn', date('Y-m')); $this->db->join('T_Employee_Details ED1', 'ED1.EmpID = BMD.Approved_By', 'left'); $this->db->join('T_Employee_Details ED2', 'ED2.EmpID = BMD.WorkDone_By', 'left'); - $bmd = $this->db->get(); + + + + if ($fdate and $tdate != ''){ + + + $fromdate= date("Y-m-d",strtotime($fdate)); + $todate=date("Y-m-d",strtotime($tdate)); + + $date = "date(BMD.CreatedOn) >= '".$fromdate."' + and date( BMD.CreatedOn) <= '". $todate."'"; + $this->db->where($date); + } + + if($type!=""){ + + $this->db->where("BMD.type" ,$type); + + + } + $bmd = $this->db->get(); return $bmd->result(); } + + function getmaint_dtl_MntID($MntID) { diff --git a/application/views/BatchcardMaintListing.php b/application/views/BatchcardMaintListing.php index 289b57d1..4549f477 100755 --- a/application/views/BatchcardMaintListing.php +++ b/application/views/BatchcardMaintListing.php @@ -1,18 +1,91 @@ + + +
+ + + + + +