+
diff --git a/application/controllers/batchcard.php b/application/controllers/batchcard.php index d45702ab..23d9dd00 100755 --- a/application/controllers/batchcard.php +++ b/application/controllers/batchcard.php @@ -225,9 +225,9 @@ class batchcard extends BaseController $less_break_down_hrs = $this->input->post('less_break_down_hrs'); $total_burner_running_time = $this->input->post('total_burner_running_time'); $total_feeding_hrs = $this->input->post('total_feeding_hrs'); - $gas_consumption_per_hour = $this->input->post('gas_consumption_per_hour'); - $gas_consumption_per_ton = $this->input->post('gas_consumption_per_ton'); - $total_gas_consumption = $this->input->post('total_gas_consumption'); + // $gas_consumption_per_hour = $this->input->post('gas_consumption_per_hour'); + // $gas_consumption_per_ton = $this->input->post('gas_consumption_per_ton'); + // $total_gas_consumption = $this->input->post('total_gas_consumption'); $ed_running_hrs = $this->input->post('ed_running_hrs'); $ed_receipt = $this->input->post('ed_receipt'); $ed_issues = $this->input->post('ed_issues'); @@ -252,21 +252,24 @@ class batchcard extends BaseController $engineers = $this->input->post('engineers'); $operators = $this->input->post('operators'); $helpers = $this->input->post('helpers'); - $breakdown = $this->input->post('breakdown'); - $location = $this->input->post('location'); - $maintenance_description = $this->input->post('maintenance_description'); - $maintenance_reason = $this->input->post('maintenance_reason'); - $maintenance_time_from = $this->input->post('maintenance_time_from'); - $maintenance_time_to = $this->input->post('maintenance_time_to'); - $maintenance_total_hrs = $this->input->post('maintenance_total_hrs'); - $cost_material = $this->input->post('cost_material'); - $cost_labour = $this->input->post('cost_labour'); + // $breakdown = $this->input->post('breakdown'); + // $location = $this->input->post('location'); + // $maintenance_description = $this->input->post('maintenance_description'); + // $maintenance_reason = $this->input->post('maintenance_reason'); + // $maintenance_time_from = $this->input->post('maintenance_time_from'); + // $maintenance_time_to = $this->input->post('maintenance_time_to'); + // $maintenance_total_hrs = $this->input->post('maintenance_total_hrs'); + // $cost_material = $this->input->post('cost_material'); + // $cost_labour = $this->input->post('cost_labour'); $remarks = $this->input->post('remarks'); $createdby = $this->session->userdata ( 'userId' ); $createdtime = date('y-m-d'); $approvedby = $this->input->post('approvedby'); - $datatostore = array('ddate'=>$ddate,'description'=>$description,'total_trp_running_hrs'=>$trp_running_hrs,'less_feeding_start'=>$feeding_start,'less_maintenance'=>$less_maintenance,'less_break_down_hrs'=>$less_break_down_hrs,'total_burner_running_time'=>$total_burner_running_time,'total_feeding_hrs'=>$total_feeding_hrs,'gas_consumption_hr'=>$gas_consumption_per_hour,'gas_consumption_ton'=>$gas_consumption_per_ton,'total_gas_consumption'=>$total_gas_consumption,'ed_running_hrs'=>$ed_running_hrs,'ed_receipt'=>$ed_receipt,'ed_issues'=>$ed_issues,'rotary_input'=>$rotatry_input,'rotary_output'=>$rotatry_output,'trp_roughsand_receipt'=>$roughsand_receipt,'trp_roughsand_issues'=>$roughsand_issues,'trp_finesand_receipt'=>$finesand_receipt,'trp_finesand_issues'=>$finesand_issues,'gas_for_trip_receipt'=>$gastrip_receipt,'gas_for_trip_consumption'=>$gastrip_consumption,'water_receipt'=>$water_receipt,'water_consumption'=>$water_consumpiton,'diesel_receipt'=>$diesel_receipt,'diesel_consumption'=>$diesel_consumption,'diesel_runninig_hrs'=>$diesel_running_hrs,'diesel_dryer_receipt'=>$diesel_rotary_receipt,'diesel_dryer_consumption'=>$diesel_rotary_consumption,'diesel_dryer_runninig_hrs'=>$diesel_rotary_running_hrs,'power_open_reading'=>$open_reading,'power_close_reading'=>$close_reading,'engineers'=>$engineers,'operators'=>$operators,'helpers'=>$helpers,'maintenance_breakdown'=>$breakdown,'maintenance_location'=>$location,'maintenance_description'=>$maintenance_description,'maintenance_reason'=>$maintenance_reason,'maintenance_from_hrs'=>$maintenance_time_from,'maintenance_to_hrs'=>$maintenance_time_to,'maintenance_total_hrs'=>$maintenance_total_hrs,'cost_material'=>$cost_material,'cost_labour'=>$cost_labour,'remarks'=>$remarks,'createdby'=>$createdby,'createdon'=>$createdtime,'approvedby'=>$approvedby); + $datatostore = array('ddate'=>$ddate,'description'=>$description,'total_trp_running_hrs'=>$trp_running_hrs,'less_feeding_start'=>$feeding_start,'less_maintenance'=>$less_maintenance,'less_break_down_hrs'=>$less_break_down_hrs,'total_burner_running_time'=>$total_burner_running_time,'total_feeding_hrs'=>$total_feeding_hrs,'ed_running_hrs'=>$ed_running_hrs,'ed_receipt'=>$ed_receipt,'ed_issues'=>$ed_issues,'rotary_input'=>$rotatry_input,'rotary_output'=>$rotatry_output,'trp_roughsand_receipt'=>$roughsand_receipt,'trp_roughsand_issues'=>$roughsand_issues,'trp_finesand_receipt'=>$finesand_receipt,'trp_finesand_issues'=>$finesand_issues,'water_receipt'=>$water_receipt,'water_consumption'=>$water_consumpiton,'diesel_receipt'=>$diesel_receipt,'diesel_consumption'=>$diesel_consumption,'diesel_runninig_hrs'=>$diesel_running_hrs,'diesel_dryer_receipt'=>$diesel_rotary_receipt,'diesel_dryer_consumption'=>$diesel_rotary_consumption,'diesel_dryer_runninig_hrs'=>$diesel_rotary_running_hrs,'power_open_reading'=>$open_reading,'power_close_reading'=>$close_reading,'engineers'=>$engineers,'operators'=>$operators,'helpers'=>$helpers,'gas_for_trip_receipt'=>$gastrip_receipt,'gas_for_trip_consumption'=>$gastrip_consumption,'remarks'=>$remarks,'createdby'=>$createdby,'createdon'=>$createdtime,'approvedby'=>$approvedby); + //'total_gas_consumption'=>$total_gas_consumption,'gas_consumption_hr'=>$gas_consumption_per_hour,'gas_consumption_ton'=>$gas_consumption_per_ton,'maintenance_breakdown'=>$breakdown,'maintenance_location'=>$location,'maintenance_description'=>$maintenance_description,'maintenance_reason'=>$maintenance_reason,'maintenance_from_hrs'=>$maintenance_time_from,'maintenance_to_hrs'=>$maintenance_time_to,'maintenance_total_hrs'=>$maintenance_total_hrs,'cost_material'=>$cost_material,'cost_labour'=>$cost_labour + + //$datatostore = array('ddate'=>$ddate,'description'=>$description,'total_trp_running_hrs'=>$trp_running_hrs,'less_feeding_start'=>$feeding_start,'less_maintenance'=>$less_maintenance,'less_break_down_hrs'=>$less_break_down_hrs,'total_burner_running_time'=>$total_burner_running_time,'total_feeding_hrs'=>$total_feeding_hrs,'gas_consumption_hr'=>$gas_consumption_per_hour,'gas_consumption_ton'=>$gas_consumption_per_ton,'total_gas_consumption'=>$total_gas_consumption,'ed_running_hrs'=>$ed_running_hrs,'ed_receipt'=>$ed_receipt,'ed_issues'=>$ed_issues,'rotary_input'=>$rotatry_input,'rotary_output'=>$rotatry_output,'trp_roughsand_receipt'=>$roughsand_receipt,'trp_roughsand_issues'=>$roughsand_issues,'trp_finesand_receipt'=>$finesand_receipt,'trp_finesand_issues'=>$finesand_issues,'gas_for_trip_receipt'=>$gastrip_receipt,'gas_for_trip_consumption'=>$gastrip_consumption,'water_receipt'=>$water_receipt,'water_consumption'=>$water_consumpiton,'diesel_receipt'=>$diesel_receipt,'diesel_consumption'=>$diesel_consumption,'diesel_runninig_hrs'=>$diesel_running_hrs,'diesel_dryer_receipt'=>$diesel_rotary_receipt,'diesel_dryer_consumption'=>$diesel_rotary_consumption,'diesel_dryer_runninig_hrs'=>$diesel_rotary_running_hrs,'power_open_reading'=>$open_reading,'power_close_reading'=>$close_reading,'engineers'=>$engineers,'operators'=>$operators,'helpers'=>$helpers,'maintenance_breakdown'=>$breakdown,'maintenance_location'=>$location,'maintenance_description'=>$maintenance_description,'maintenance_reason'=>$maintenance_reason,'maintenance_from_hrs'=>$maintenance_time_from,'maintenance_to_hrs'=>$maintenance_time_to,'maintenance_total_hrs'=>$maintenance_total_hrs,'cost_material'=>$cost_material,'cost_labour'=>$cost_labour,'remarks'=>$remarks,'createdby'=>$createdby,'createdon'=>$createdtime,'approvedby'=>$approvedby); //print_r($datatostore); $res = $this->batchcard_model->saveDailyBatchCardData($datatostore); if($res == 1) @@ -436,6 +439,10 @@ class batchcard extends BaseController $did = $this->uri->segment(3); $data['emplist'] = $this->batchcard_model->getEmplistforReport(); $data['dailydata'] = $this->batchcard_model->getIndividualDailyData($did); + $ddate = explode("-",$data['dailydata'][0]->ddate); + $dateval =$ddate[2].'-'.$ddate[1].'-'.$ddate[0]; + $data['Maintenances'] = $this->batchcard_model->getmaint_dtl_MntDate($dateval); + //echo $dateval;print_r($data['Maintenances']); $this->global['pageTitle'] = 'Siddharth : Daily Batch Card Edit'; $this->loadViews("editDailyData", $this->global,$data,NULL); @@ -454,9 +461,9 @@ class batchcard extends BaseController $less_break_down_hrs = $this->input->post('less_break_down_hrs'); $total_burner_running_time = $this->input->post('total_burner_running_time'); $total_feeding_hrs = $this->input->post('total_feeding_hrs'); - $gas_consumption_per_hour = $this->input->post('gas_consumption_per_hour'); - $gas_consumption_per_ton = $this->input->post('gas_consumption_per_ton'); - $total_gas_consumption = $this->input->post('total_gas_consumption'); + // $gas_consumption_per_hour = $this->input->post('gas_consumption_per_hour'); + // $gas_consumption_per_ton = $this->input->post('gas_consumption_per_ton'); + // $total_gas_consumption = $this->input->post('total_gas_consumption'); $ed_running_hrs = $this->input->post('ed_running_hrs'); $ed_receipt = $this->input->post('ed_receipt'); $ed_issues = $this->input->post('ed_issues'); @@ -481,21 +488,22 @@ class batchcard extends BaseController $engineers = $this->input->post('engineers'); $operators = $this->input->post('operators'); $helpers = $this->input->post('helpers'); - $breakdown = $this->input->post('breakdown'); - $location = $this->input->post('location'); - $maintenance_description = $this->input->post('maintenance_description'); - $maintenance_reason = $this->input->post('maintenance_reason'); - $maintenance_time_from = $this->input->post('maintenance_time_from'); - $maintenance_time_to = $this->input->post('maintenance_time_to'); - $maintenance_total_hrs = $this->input->post('maintenance_total_hrs'); - $cost_material = $this->input->post('cost_material'); - $cost_labour = $this->input->post('cost_labour'); + // $breakdown = $this->input->post('breakdown'); + // $location = $this->input->post('location'); + // $maintenance_description = $this->input->post('maintenance_description'); + // $maintenance_reason = $this->input->post('maintenance_reason'); + // $maintenance_time_from = $this->input->post('maintenance_time_from'); + // $maintenance_time_to = $this->input->post('maintenance_time_to'); + // $maintenance_total_hrs = $this->input->post('maintenance_total_hrs'); + // $cost_material = $this->input->post('cost_material'); + // $cost_labour = $this->input->post('cost_labour'); $remarks = $this->input->post('remarks'); $createdby = $this->session->userdata ( 'userId' ); $createdtime = date('y-m-d'); $approvedby = $this->input->post('approvedby'); - $datatostore = array('ddate'=>$ddate,'description'=>$description,'total_trp_running_hrs'=>$trp_running_hrs,'less_feeding_start'=>$feeding_start,'less_maintenance'=>$less_maintenance,'less_break_down_hrs'=>$less_break_down_hrs,'total_burner_running_time'=>$total_burner_running_time,'total_feeding_hrs'=>$total_feeding_hrs,'gas_consumption_hr'=>$gas_consumption_per_hour,'gas_consumption_ton'=>$gas_consumption_per_ton,'total_gas_consumption'=>$total_gas_consumption,'ed_running_hrs'=>$ed_running_hrs,'ed_receipt'=>$ed_receipt,'ed_issues'=>$ed_issues,'rotary_input'=>$rotatry_input,'rotary_output'=>$rotatry_output,'trp_roughsand_receipt'=>$roughsand_receipt,'trp_roughsand_issues'=>$roughsand_issues,'trp_finesand_receipt'=>$finesand_receipt,'trp_finesand_issues'=>$finesand_issues,'gas_for_trip_receipt'=>$gastrip_receipt,'gas_for_trip_consumption'=>$gastrip_consumption,'water_receipt'=>$water_receipt,'water_consumption'=>$water_consumpiton,'diesel_receipt'=>$diesel_receipt,'diesel_consumption'=>$diesel_consumption,'diesel_runninig_hrs'=>$diesel_running_hrs,'diesel_dryer_receipt'=>$diesel_rotary_receipt,'diesel_dryer_consumption'=>$diesel_rotary_consumption,'diesel_dryer_runninig_hrs'=>$diesel_rotary_running_hrs,'power_open_reading'=>$open_reading,'power_close_reading'=>$close_reading,'engineers'=>$engineers,'operators'=>$operators,'helpers'=>$helpers,'maintenance_breakdown'=>$breakdown,'maintenance_location'=>$location,'maintenance_description'=>$maintenance_description,'maintenance_reason'=>$maintenance_reason,'maintenance_from_hrs'=>$maintenance_time_from,'maintenance_to_hrs'=>$maintenance_time_to,'maintenance_total_hrs'=>$maintenance_total_hrs,'cost_material'=>$cost_material,'cost_labour'=>$cost_labour,'remarks'=>$remarks,'updatedby'=>$createdby,'approvedby'=>$approvedby); + $datatostore = array('ddate'=>$ddate,'description'=>$description,'total_trp_running_hrs'=>$trp_running_hrs,'less_feeding_start'=>$feeding_start,'less_maintenance'=>$less_maintenance,'less_break_down_hrs'=>$less_break_down_hrs,'total_burner_running_time'=>$total_burner_running_time,'total_feeding_hrs'=>$total_feeding_hrs,'ed_running_hrs'=>$ed_running_hrs,'ed_receipt'=>$ed_receipt,'ed_issues'=>$ed_issues,'rotary_input'=>$rotatry_input,'rotary_output'=>$rotatry_output,'trp_roughsand_receipt'=>$roughsand_receipt,'trp_roughsand_issues'=>$roughsand_issues,'trp_finesand_receipt'=>$finesand_receipt,'trp_finesand_issues'=>$finesand_issues,'gas_for_trip_receipt'=>$gastrip_receipt,'gas_for_trip_consumption'=>$gastrip_consumption,'water_receipt'=>$water_receipt,'water_consumption'=>$water_consumpiton,'diesel_receipt'=>$diesel_receipt,'diesel_consumption'=>$diesel_consumption,'diesel_runninig_hrs'=>$diesel_running_hrs,'diesel_dryer_receipt'=>$diesel_rotary_receipt,'diesel_dryer_consumption'=>$diesel_rotary_consumption,'diesel_dryer_runninig_hrs'=>$diesel_rotary_running_hrs,'power_open_reading'=>$open_reading,'power_close_reading'=>$close_reading,'engineers'=>$engineers,'operators'=>$operators,'helpers'=>$helpers,'remarks'=>$remarks,'updatedby'=>$createdby,'approvedby'=>$approvedby); + //'gas_consumption_hr'=>$gas_consumption_per_hour,'gas_consumption_ton'=>$gas_consumption_per_ton,'total_gas_consumption'=>$total_gas_consumption,'maintenance_breakdown'=>$breakdown,'maintenance_location'=>$location,'maintenance_description'=>$maintenance_description,'maintenance_reason'=>$maintenance_reason,'maintenance_from_hrs'=>$maintenance_time_from,'maintenance_to_hrs'=>$maintenance_time_to,'maintenance_total_hrs'=>$maintenance_total_hrs,'cost_material'=>$cost_material,'cost_labour'=>$cost_labour, //print_r($datatostore); $res = $this->batchcard_model->updateDailyBatchCardData($datatostore,$did); if($res == 1) @@ -670,6 +678,94 @@ class batchcard extends BaseController $this->global['pageTitle'] = 'Siddharth : Stock Details'; $this->loadViews("batchcard_stockdetails", $this->global,$data,NULL); } + + function getMaintenancesDetails(){ + + $date = $this->input->post('id1'); + $arraydata = $this->batchcard_model->maintenancesdata($date,$Autostartstoptime); + if(count($arraydata) != 0){ + echo json_encode($arraydata);} + } + + function getMaintListing(){ + $data['MaintListing'] = $this->batchcard_model->getmaint_dtl(); + $this->global['pageTitle'] = 'Siddharth : Maintenance/Breakdown Listing'; + $this->loadViews("BatchcardMaintListing", $this->global,$data,NULL); + } + + function addMaint(){ + $this->global['pageTitle'] = 'Siddharth : Add Maintenance/Breakdown'; + $this->loadViews("BatchcardMaintAdd", $this->global,NULL,NULL); + } + function editMaint(){ + + $MntID = $_GET['MntID']; + + //echo $MntID; + $data['MaintEdit'] = $this->batchcard_model->getmaint_dtl_MntID($MntID); + //print_r($data); + + $this->global['pageTitle'] = 'Siddharth : Edit Maintenance/Breakdown'; + $this->loadViews("BatchcardMaintEdit", $this->global,$data,NULL); + } + function addmntbr(){ + + $type = $this->input->post('radiobtn'); + $maintenance_date = $this->input->post('maintenance_date'); + $maintenance_time= $this->input->post('maintenance_time'); + $location = $this->input->post('location'); + $maintenance_description = $this->input->post('maintenance_description'); + $maintenance_reason = $this->input->post('maintenance_reason'); + $maintenance_time_from = $this->input->post('maintenance_time_from'); + $maintenance_time_to = $this->input->post('maintenance_time_to'); + $maintenance_total_hrs = $this->input->post('maintenance_total_hrs'); + $cost_material = $this->input->post('cost_material'); + $cost_labour = $this->input->post('cost_labour'); + $createdby = $this->session->userdata ( 'userId' ); + + $addmntbr = array('Type'=>$type,'Maint_Date'=>$maintenance_date,'Maint_Time'=>$maintenance_time, 'Maint_Location'=>$location, 'Maint_Description'=>$maintenance_description, 'Maint_Reason'=>$maintenance_reason, 'Maint_Time_from'=>$maintenance_time_from, 'Maint_Time_to'=>$maintenance_time_to, 'Maint_Total_hrs'=>$maintenance_total_hrs, 'Cost_Material'=>$cost_material, 'Cost_Labour'=>$cost_labour, 'CreatedBy'=>$createdby); + $added = $this->batchcard_model->addmaint_dtl($addmntbr); + + if($added == 1) + { + echo ""; + } + + //print_r($addmntbr); + + } + function editmntbr(){ + + $type = $this->input->post('radiobtn'); + $mntid = $this->input->post('mntid'); + $maintenance_date = $this->input->post('maintenance_date'); + $maintenance_time= $this->input->post('maintenance_time'); + $location = $this->input->post('location'); + $maintenance_description = $this->input->post('maintenance_description'); + $maintenance_reason = $this->input->post('maintenance_reason'); + $maintenance_time_from = $this->input->post('maintenance_time_from'); + $maintenance_time_to = $this->input->post('maintenance_time_to'); + $maintenance_total_hrs = $this->input->post('maintenance_total_hrs'); + $cost_material = $this->input->post('cost_material'); + $cost_labour = $this->input->post('cost_labour'); + $updatedby = $this->session->userdata ( 'userId' ); + // $date = new DateTime('now', new DateTimeZone('Asia/Kolkata')); + // $updatedon = $date->format('d-m-Y H:i:s'); + + $editmntbr = array('Type'=>$type,'Maint_Date'=>$maintenance_date,'Maint_Time'=>$maintenance_time, 'Maint_Location'=>$location, 'Maint_Description'=>$maintenance_description, 'Maint_Reason'=>$maintenance_reason, 'Maint_Time_from'=>$maintenance_time_from, 'Maint_Time_to'=>$maintenance_time_to, 'Maint_Total_hrs'=>$maintenance_total_hrs, 'Cost_Material'=>$cost_material, 'Cost_Labour'=>$cost_labour, 'UpdatedBy'=>$updatedby); + //print_r($editmntbr); + //die(); + // echo $type; + // echo $mntid; + // die(); + $updated = $this->batchcard_model->updatemaint_dtl($editmntbr,$mntid); + + if($updated == 1) + { + echo ""; + } + + } } ?> \ No newline at end of file diff --git a/application/models/batchcard_model.php b/application/models/batchcard_model.php index 3d8c49c8..69c6e1e5 100755 --- a/application/models/batchcard_model.php +++ b/application/models/batchcard_model.php @@ -193,6 +193,58 @@ class batchcard_model extends CI_Model //print_r($res->result()); return $res->result(); } + + + function addmaint_dtl($array) + { + $this->db->insert('T_Batchcard_MaintanceDetails',$array); + $bmd = $this->db->affected_rows(); + return $bmd; + } + function getmaint_dtl() + { + + $this->db->select('*'); + $this->db->from('T_Batchcard_MaintanceDetails'); + $bmd = $this->db->get(); + return $bmd->result(); + } + + function getmaint_dtl_MntID($MntID) + { + + $this->db->select('*'); + $this->db->from('T_Batchcard_MaintanceDetails'); + $this->db->where('Maint_ID',$MntID); + $bmd = $this->db->get(); + return $bmd->result(); + } + + function getmaint_dtl_MntDate($dateval) + { + + $this->db->select('*'); + $this->db->from('T_Batchcard_MaintanceDetails'); + $this->db->where('Maint_Date',$dateval); + $bmd = $this->db->get(); + return $bmd->result(); + } + + function updatemaint_dtl($array,$MntID) + { + $this->db->where('Maint_ID',$MntID); + $this->db->update('T_Batchcard_MaintanceDetails',$array); + $bmd = $this->db->affected_rows(); + + return $bmd; + } + + function maintenancesdata($date,$Autostartstoptime){ + $sql = "SELECT * FROM T_Batchcard_MaintanceDetails + where Maint_Date = '".$date."'"; + $res = $this->db->query($sql); + return $res->result(); + } } ?> \ No newline at end of file diff --git a/application/views/BatchcardMaintAdd.php b/application/views/BatchcardMaintAdd.php new file mode 100644 index 00000000..1cc5a509 --- /dev/null +++ b/application/views/BatchcardMaintAdd.php @@ -0,0 +1,250 @@ + + +
| S.No | +Date | +Time | +Type | +Location | +Description | +Reason | +Time Taken From | +Time Taken To | +Total hours | +Material | +Labour | +
|---|---|---|---|---|---|---|---|---|---|---|---|
| S.No | +Date | +Time | +Type | +Location | +Description | +Reason | +Time Taken From | +Time Taken To | +Total hours | +Material | +Labour | +
|---|---|---|---|---|---|---|---|---|---|---|---|