load->model('batchcard_model'); $this->isLoggedIn(); $this->load->helper(array('form','url')); date_default_timezone_set('Asia/Kolkata'); } public function index() { $data['emplist'] = $this->batchcard_model->getEmplistforReport(); $this->global['pageTitle'] = 'Siddharth : Hourly Batch Card'; $this->loadViews("hourly_batch_card", $this->global,$data,NULL); } function saveHourlyBatchCard() { //echo "done"; $data = $this->input->post('myData'); // print_r($data); //echo "*********************"; $reportdate = $data['curdate']; $reporttime = $data['usr_time']; $reportdate = date_format(date_create($reportdate),'Y-m-d'); $open_trp_reading = $data['open_trp_reading']; $close_trp_reading = $data['close_trp_reading']; $total_trp_reading = $data['total_trp_reading']; $auto_start = $data['auto_start']; $auto_stop = $data['auto_stop']; $atime = $data['atime']; $feed30sec = $data['feed30sec']; $feed1hr = $data['feed1hr']; $inlet_temp = $data['inlet_temp']; $outlet_temp = $data['outlet_temp']; $output_feed_30 = $data['output_feed_30']; $output_feed_1 = $data['output_feed_1']; $weight_rough = $data['weight_rough']; $weight_fine = $data['weight_fine']; $total = $data['total']; $cyclone = $data['cyclone']; $remarks = $data['remarks']; $cby = $data['cby']; $approvedby = $data['approvedby']; //echo "******************************"; $datatostore = array('report_date'=>$reportdate,'report_time'=>$reporttime,'opening_trp_reading'=>$open_trp_reading,'close_trp_reading'=>$close_trp_reading,'total_trp_reading'=>$total_trp_reading,'auto_start'=>$auto_start,'auto_stop'=>$auto_stop,'time'=>$atime,'feed30sec'=>$feed30sec,'feed1hr'=>$feed1hr,'inlet_temp'=>$inlet_temp,'outlet_temp'=>$outlet_temp,'output_feed_30'=>$output_feed_30,'output_feed_1'=>$output_feed_1,'weight_rough'=>$weight_rough,'weight_fine'=>$weight_fine,'total'=>$total,'cyclone'=>$cyclone,'remarks'=>$remarks,'checkedby'=>$cby,'approvedby'=>$approvedby); //print_r($datatostore);die(); $res = $this->batchcard_model->saveHourlyBatchInfo($datatostore); if($res == 1) { echo ""; } else { echo ""; } } function HourlyListing() { $data['allhourdata'] = $this->batchcard_model->getAllHourlyData(); //print_r($data['allhourdata']);die(); $this->global['pageTitle'] = 'Siddharth : Hourly Batch CardListing'; $this->loadViews("hourlybatchcardlisting", $this->global,$data,NULL); } function checkExistHour() { $bdate = $this->input->post('param1'); $btime = $this->input->post('param2'); //echo $bdate."-".$btime; $bdate = date_format(date_create($bdate),'Y-m-d'); //echo $bdate."-".$btime; $res = $this->batchcard_model->checkExistHourlyData($bdate,$btime); if($res[0]->count == 1) { echo "Duplicate Entry...!Data Exist for Same Time Information"; } } function filterHourlyBatchData() { $hid=''; $from = $this->input->post('fromdate'); $to = $this->input->post('todate'); $from = date_format(date_create($from),'Y-m-d'); $to = date_format(date_create($to),'Y-m-d'); //echo $from.'-'.$to;exit(); $data['allhourdata'] = $this->batchcard_model->getAllHourlyData($hid,$from,$to); $this->global['pageTitle'] = 'Siddharth : Hourly Batch CardListing'; $this->loadViews("hourlybatchcardlisting", $this->global,$data,NULL); } function editHourly() { $hid = $this->uri->segment(3); $data['emplist'] = $this->batchcard_model->getEmplistforReport(); $data['batchdata'] = $this->batchcard_model->getAllHourlyData($hid); $this->global['pageTitle'] = 'Siddharth : Edit Hourly Batch Card'; $this->loadViews("edit_hourly_batch_card", $this->global,$data,NULL); } function updateHourlyBatchCard() { $data = $this->input->post('myData'); // print_r($data); //echo "*********************"; $hid = $data['hid']; $reportdate = $data['curdate']; $reporttime = $data['usr_time']; $reportdate = date_format(date_create($reportdate),'Y-m-d'); $open_trp_reading = $data['open_trp_reading']; $close_trp_reading = $data['close_trp_reading']; $total_trp_reading = $data['total_trp_reading']; $auto_start = $data['auto_start']; $auto_stop = $data['auto_stop']; $atime = $data['atime']; $feed30sec = $data['feed30sec']; $feed1hr = $data['feed1hr']; $inlet_temp = $data['inlet_temp']; $outlet_temp = $data['outlet_temp']; $output_feed_30 = $data['output_feed_30']; $output_feed_1 = $data['output_feed_1']; $weight_rough = $data['weight_rough']; $weight_fine = $data['weight_fine']; $total = $data['total']; $cyclone = $data['cyclone']; $remarks = $data['remarks']; $cby = $data['cby']; $approvedby = $data['approvedby']; $datatostore = array('report_date'=>$reportdate,'report_time'=>$reporttime,'opening_trp_reading'=>$open_trp_reading,'close_trp_reading'=>$close_trp_reading,'total_trp_reading'=>$total_trp_reading,'auto_start'=>$auto_start,'auto_stop'=>$auto_stop,'time'=>$atime,'feed30sec'=>$feed30sec,'feed1hr'=>$feed1hr,'inlet_temp'=>$inlet_temp,'outlet_temp'=>$outlet_temp,'output_feed_30'=>$output_feed_30,'output_feed_1'=>$output_feed_1,'weight_rough'=>$weight_rough,'weight_fine'=>$weight_fine,'total'=>$total,'cyclone'=>$cyclone,'remarks'=>$remarks,'checkedby'=>$cby,'approvedby'=>$approvedby,'updatedby'=>$cby); //print_r($datatostore);die(); $res = $this->batchcard_model->updateHourlyBatchInfo($datatostore,$hid); if($res == 1) { echo ""; } else { echo ""; } } function loadDailyBatchCard() { $data['emplist'] = $this->batchcard_model->getEmplistforReport(); $this->global['pageTitle'] = 'Siddharth : Daily Batch Card'; $this->loadViews("dailybatchcard", $this->global,$data,NULL); } function dailyListing() { $data = array(); if(empty($this->uri->segment(3))) { $year = date("Y"); $month = date("m"); // $current = $current."-01"; $data['month'] = $month.'-'.$year; $data['monthdays'] = cal_days_in_month(CAL_GREGORIAN,$month,$year); $data['hourdata'] = $this->batchcard_model->getDailyBatchCardData($month); $data['datefordisplay'] = date('M-Y'); } else { $fromview = $this->uri->segment(3); $dmy = explode('-',$fromview); $fromview_month = date('m', strtotime($dmy[0])); $fromview_year = $dmy[1]; $data['month'] = $fromview_month.'-'.$fromview_year; $data['monthdays'] = cal_days_in_month(CAL_GREGORIAN,$fromview_month,$fromview_year); $data['hourdata'] = $this->batchcard_model->getDailyBatchCardData($fromview_month); $data['datefordisplay'] = $fromview; } //print_r($data['hourdata']);exit(); $this->global['pageTitle'] = 'Siddharth : Daily Batch Card Listing'; $this->loadViews("dailyBatchCardListing", $this->global,$data,NULL); } function saveDailyBatchCardData()//T_daily_batchcard_data { $ddate = $this->input->post('rdate'); $ddate = date_format(date_create($ddate),'y-m-d'); $description = $this->input->post('description'); $trp_running_hrs = $this->input->post('trp_running_hrs'); $feeding_start = $this->input->post('feeding_start'); $less_maintenance = $this->input->post('less_maintenance'); $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'); $ed_running_hrs = $this->input->post('ed_running_hrs'); $ed_receipt = $this->input->post('ed_receipt'); $ed_issues = $this->input->post('ed_issues'); $rotatry_input = $this->input->post('rotary_input'); $rotatry_output = $this->input->post('rotatry_output'); $roughsand_receipt = $this->input->post('roughsand_receipt'); $roughsand_issues = $this->input->post('roughsand_issues'); $finesand_receipt = $this->input->post('finesand_receipt'); $finesand_issues = $this->input->post('finesand_issues'); $gastrip_receipt = $this->input->post('gastrip_receipt'); $gastrip_consumption = $this->input->post('gastrip_consumption'); $water_receipt = $this->input->post('water_receipt'); $water_consumpiton = $this->input->post('water_consumpiton'); $diesel_receipt = $this->input->post('diesel_receipt'); $diesel_consumption = $this->input->post('diesel_consumption'); $diesel_running_hrs = $this->input->post('diesel_running_hrs'); $diesel_rotary_receipt = $this->input->post('diesel_rotary_receipt'); $diesel_rotary_consumption = $this->input->post('diesel_rotary_consumption'); $diesel_rotary_running_hrs = $this->input->post('diesel_rotary_running_hrs'); $open_reading = $this->input->post('open_reading'); $close_reading = $this->input->post('close_reading'); $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'); $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,'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) { echo ""; } else { echo ""; } //exit(); } function checkExistDaily() { $rdate = $this->input->post('param1'); $rdate = date_format(date_create($rdate),'Y-m-d'); $res = $this->batchcard_model->checkExistDaily($rdate); echo $res[0]->count; } function getPowerConsumptionDetails() { $rdate = $this->input->post('param1'); $rdate = date_format(date_create($rdate),'Y-m-d'); $res = $this->batchcard_model->getPowerConsumptionDetails($rdate); //print_r($res);exit(); $counut = count($res); $data[open] = ''; $data[close] = ''; $data[start] = ''; $data[stop] = ''; for($i=0; $i<=$counut; $i++) { if($i == 0) { $data[open] = $res[$i]->opening_trp_reading; $data[start] = $res[$i]->auto_start; } if($i == ($counut-1)) { $data[close] = $res[$i]->close_trp_reading; $data[stop] = $res[$i]->auto_stop; } } echo json_encode($data); } function saveBatchCardtoExcel() { $abstractjsondata = $this->input->post('param1'); $month = $this->input->post('param2'); $abstractphpdata = json_decode($abstractjsondata,true); //print_r($abstractphpdata); $this->load->library('excel'); $this->excel->setActiveSheetIndex(0); $this->excel->getActiveSheet()->setTitle('Abstract Report for ' . $month); $this->excel->getActiveSheet()->setCellValue('A1', 'Abstrct Report for ' . $month); $this->excel->getActiveSheet()->setCellValue('A3', 'S.No.'); $this->excel->getActiveSheet()->setCellValue('B3', 'Description'); $this->excel->getActiveSheet()->setCellValue('C3', 'Running Hrs'); $this->excel->getActiveSheet()->setCellValue('D3', 'Per Hour'); $this->excel->getActiveSheet()->setCellValue('E3', 'Open Stock'); $this->excel->getActiveSheet()->setCellValue('F3', 'Receipt'); $this->excel->getActiveSheet()->setCellValue('G3', 'Total'); $this->excel->getActiveSheet()->setCellValue('H3', 'Consumption'); $this->excel->getActiveSheet()->setCellValue('I3', 'Closing Stock'); $this->excel->getActiveSheet()->setCellValue('J3', 'Physical Stock'); $this->excel->getActiveSheet()->setCellValue('K3', 'Difference'); $this->excel->getActiveSheet()->mergeCells('A1:K1'); $this->excel->getActiveSheet()->getStyle('A1')->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER); $this->excel->getActiveSheet()->getStyle('A1')->getFont()->setBold(true); $this->excel->getActiveSheet()->getStyle('A1')->getFont()->setSize(16); $this->excel->getActiveSheet()->getStyle('A1')->getFill()->getStartColor()->setARGB('#333'); for($col = ord('A'); $col <= ord('K'); $col++){ $this->excel->getActiveSheet()->getColumnDimension(chr($col))->setAutoSize(true); $this->excel->getActiveSheet()->getStyle(chr($col))->getFont()->setSize(12); $this->excel->getActiveSheet()->getStyle(chr($col))->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER); } $this->excel->getActiveSheet() ->getStyle('A3:K3') ->getFill() ->setFillType(PHPExcel_Style_Fill::FILL_SOLID) ->getStartColor() ->setARGB('FF808080'); $this->excel->getActiveSheet() ->getStyle('A3:K3')-> getFont()->setBold(true); $i = 5; $j = 1; //print_r($abstractphpdata);die(); foreach($abstractphpdata as $row){ $this->excel->getActiveSheet()->setCellValue('A' . (string)($i),$j); $this->excel->getActiveSheet()->setCellValue('B' . (string)($i),$row['Particulars']); $this->excel->getActiveSheet()->setCellValue('C' . (string)($i),$row['Running Hrs']); $this->excel->getActiveSheet()->setCellValue('D' . (string)($i),$row['Per Hour']); $this->excel->getActiveSheet()->getStyle('D'.(string)($i))->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_RIGHT); $this->excel->getActiveSheet()->setCellValue('E' . (string)($i),$row['Open Stock']); $this->excel->getActiveSheet()->getStyle('E'.(string)($i))->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_RIGHT); $this->excel->getActiveSheet()->setCellValue('F' . (string)($i),$row['Receipt']); $this->excel->getActiveSheet()->getStyle('F'.(string)($i))->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_RIGHT); $this->excel->getActiveSheet()->setCellValue('G' . (string)($i),$row['Total']); $this->excel->getActiveSheet()->getStyle('G'.(string)($i))->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_RIGHT); $this->excel->getActiveSheet()->setCellValue('H' . (string)($i),$row['Consumption']); $this->excel->getActiveSheet()->getStyle('H'.(string)($i))->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_RIGHT); $this->excel->getActiveSheet()->setCellValue('I' . (string)($i),$row['Closing Stock']); $this->excel->getActiveSheet()->getStyle('I'.(string)($i))->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_RIGHT); $this->excel->getActiveSheet()->setCellValue('J' . (string)($i),$row['Physical Stock']); $this->excel->getActiveSheet()->getStyle('J'.(string)($i))->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_RIGHT); $this->excel->getActiveSheet()->setCellValue('K' . (string)($i),$row['Difference']); $this->excel->getActiveSheet()->getStyle('K'.(string)($i))->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_RIGHT); //$this->excel->getActiveSheet()->setCellValue('A6','HI'); $i++; $j++; } $this->excel->getActiveSheet()->getProtection()->setSheet(true); $this->excel->getActiveSheet()->getProtection()->setSort(true); $this->excel->getActiveSheet()->getProtection()->setInsertRows(true); $this->excel->getActiveSheet()->getProtection()->setFormatCells(true); $filename='Abstrct Report for'.$month.'.xls'; header('Content-Type: application/vnd.ms-excel'); header('Content-Disposition: attachment;filename="'.$filename.'"'); header('Cache-Control: max-age=0'); $objWriter = PHPExcel_IOFactory::createWriter($this->excel, 'Excel5'); $objWriter->save('php://output'); } function editDailyData() { $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($data['dailydata'][0]->ddate); $data['Maintenances'] = $this->batchcard_model->maintenancesdata($dateval); //$arraydata = $this->batchcard_model->maintenancesdata($date); $this->global['pageTitle'] = 'Siddharth : Daily Batch Card Edit'; $this->loadViews("editDailyData", $this->global,$data,NULL); } function updateDailyBatchCardData() { $did = $this->input->post('did'); $ddate = $this->input->post('rdate'); $ddate = date_format(date_create($ddate),'y-m-d'); $description = $this->input->post('description'); $trp_running_hrs = $this->input->post('trp_running_hrs'); $feeding_start = $this->input->post('feeding_start'); $less_maintenance = $this->input->post('less_maintenance'); $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'); $ed_running_hrs = $this->input->post('ed_running_hrs'); $ed_receipt = $this->input->post('ed_receipt'); $ed_issues = $this->input->post('ed_issues'); $rotatry_input = $this->input->post('rotary_input'); $rotatry_output = $this->input->post('rotatry_output'); $roughsand_receipt = $this->input->post('roughsand_receipt'); $roughsand_issues = $this->input->post('roughsand_issues'); $finesand_receipt = $this->input->post('finesand_receipt'); $finesand_issues = $this->input->post('finesand_issues'); $gastrip_receipt = $this->input->post('gastrip_receipt'); $gastrip_consumption = $this->input->post('gastrip_consumption'); $water_receipt = $this->input->post('water_receipt'); $water_consumpiton = $this->input->post('water_consumpiton'); $diesel_receipt = $this->input->post('diesel_receipt'); $diesel_consumption = $this->input->post('diesel_consumption'); $diesel_running_hrs = $this->input->post('diesel_running_hrs'); $diesel_rotary_receipt = $this->input->post('diesel_rotary_receipt'); $diesel_rotary_consumption = $this->input->post('diesel_rotary_consumption'); $diesel_rotary_running_hrs = $this->input->post('diesel_rotary_running_hrs'); $open_reading = $this->input->post('open_reading'); $close_reading = $this->input->post('close_reading'); $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'); $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,'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) { echo ""; } else { echo ""; } } function saveAbstractReport() { //echo "working"; $overalltotal = 0; $date = $this->input->post('param1'); $cur_day = date('Y-m',strtotime($date)); //echo $date; $jsondata = $this->input->post('param2'); $phpdata = json_decode($jsondata,TRUE); //print_r($phpdata); //die(); //$isExist = $this->batchcard_model->checkAbstractReport($date); $isExist = $this->batchcard_model->checkAbstractReport($cur_day); $c = $isExist[0]->count; if($c == 0){ foreach($phpdata as $d) { $abstract_report_date = $date; $abstract_details = $d['Particulars']; $running_hrs = $d['Running Hrs']; $per_hr = $d['Per Hour']; $open_stock = $d['Open Stock']; $receipt = $d['Receipt']; $total = $d['Total']; $consumption = $d['Consumption']; $close_stock = $d['Closing Stock']; $physical_stock = $d['Physical Stock']; $difference = $d['Difference']; $createdby = $this->session->userdata ( 'userId' ); $datatostore = array('abstract_report_date'=>$abstract_report_date,'abstract_details'=>$abstract_details,'running_hrs'=>$running_hrs,'per_hr'=>$per_hr,'open_stock'=>$open_stock,'receipt'=>$receipt,'total'=>$total,'consumption'=>$consumption,'close_stock'=>$close_stock,'physical_stock'=>$physical_stock,'difference'=>$difference,'createdby'=>$createdby); $res = $this->batchcard_model->saveAbstractReport($datatostore); $overalltotal += $res; } } else { foreach($phpdata as $d) { $abstract_report_date = $date; $abstract_details = $d['Particulars']; $running_hrs = $d['Running Hrs']; $per_hr = $d['Per Hour']; $open_stock = $d['Open Stock']; $receipt = $d['Receipt']; $total = $d['Total']; $consumption = $d['Consumption']; $close_stock = $d['Closing Stock']; $physical_stock = $d['Physical Stock']; $difference = $d['Difference']; $createdby = $this->session->userdata ( 'userId' ); $datatostore = array('abstract_details'=>$abstract_details,'running_hrs'=>$running_hrs,'per_hr'=>$per_hr,'open_stock'=>$open_stock,'receipt'=>$receipt,'total'=>$total,'consumption'=>$consumption,'close_stock'=>$close_stock,'physical_stock'=>$physical_stock,'difference'=>$difference,'updatedby'=>$createdby); //$res = $this->batchcard_model->updateAbstractReport($datatostore,$date,$abstract_details); $res = $this->batchcard_model->updateAbstractReport($datatostore,$cur_day,$abstract_details); $overalltotal += $res; } } echo $overalltotal.' - Details Saved Successfully..!'; } function getPreviousMonthAbstractDetails() { $month = $this->input->post('param1'); $year = $this->input->post('param2'); $currmonthyear = date('Y-m',strtotime($this->input->post('param3'))); $isExist = $this->batchcard_model->checkAbstractReport($currmonthyear); $c = $isExist[0]->count; if($c == 0){//echo " for closestock"; $res = $this->batchcard_model->getPreviousMonthAbstractDetails($month,$year); echo json_encode($res); } else{ //echo " for openstock"; $arr = $this->batchcard_model->getMonthAbstractDetails($currmonthyear); echo json_encode($arr); } } function getMonthAbstractDetails(){ $month = $this->input->post('param1'); $year = $this->input->post('param2'); $arr = $this->batchcard_model->getMonthAbstractDetails($month,$year); echo json_encode($arr); } function getStockDetails() { //echo "hi"; if(!empty($this->input->post('fromdate')) && $this->input->post('stockname')) { $sn = $this->input->post('stockname'); $snforview = $sn; $fd = $this->input->post('fromdate'); $fm = date_format(date_create($fd),'m'); $fy = date_format(date_create($fd),'Y'); $string = $fy.$fm.'01'.'last month'; $py = date_format(date_create($string),'Y-m'); $py = explode('-',$py); // echo 'CURRENT'.$fm.'-'.$fy.'
'; // echo 'PREVOIUS'.$py[0].'-'.$py[1].'
'; // echo $sn; switch($sn) { case 1: $sn = '(sum(ed_receipt) - sum(ed_issues)) as lastmonthclosinged'; $sd1 = 'ed_receipt'; $sd2 = 'ed_issues'; break; case 2: $sn = '(sum(rotary_input) - sum(rotary_output)) as lastmonthclosingrotary'; $sd1 = 'rotary_input as ed_receipt'; $sd2 = 'rotary_output as ed_issues'; break; case 3: $sn = '(sum(diesel_dryer_receipt) - sum(diesel_dryer_consumption)) as lastmonthclosingdryerdiesel'; $sd1 = 'diesel_dryer_receipt as ed_receipt'; $sd2 = 'diesel_dryer_consumption as ed_issues'; break; case 4: $sn = '(sum(diesel_receipt) - sum(diesel_consumption)) as lastmonthclosingbull'; $sd1 = 'diesel_receipt as ed_receipt'; $sd2 = 'diesel_consumption as ed_issues'; break; case 5: $sn = '(sum(trp_roughsand_receipt) - sum(trp_roughsand_issues)) as lastmonthclosingrough'; $sd1 = 'trp_roughsand_receipt as ed_receipt'; $sd2 = 'trp_roughsand_issues as ed_issues'; break; case 6: $sn = '(sum(trp_finesand_receipt) - sum(trp_finesand_issues)) as lastmonthclosingfine'; $sd1 = 'trp_finesand_receipt as ed_receipt'; $sd2 = 'trp_finesand_issues as ed_issues'; break; case 7: $sn = '(sum(gas_for_trip_receipt) - sum(gas_for_trip_consumption)) as lastmonthclosinggas'; $sd1 = 'gas_for_trip_receipt as ed_receipt'; $sd2 = 'gas_for_trip_consumption as ed_issues'; break; case 8: $sn = '(sum(water_receipt) - sum(water_consumption)) as lastmonthclosingewater'; $sd1 = 'water_receipt as ed_receipt'; $sd2 = 'water_consumption as ed_issues'; break; } $data['previousmonthclosingstock'] = $this->batchcard_model->getPreviousMonthClosedStockDetails($py[0],$py[1],$sn); //print_r($data['previousmonthclosingstock']);echo '
';die(); $data['currentmonthstockdetails'] = $this->batchcard_model->currentMonthStockDetails($fm,$fy,$sd1,$sd2); $data['selmonth'] = $fd; $data['selstockvalue'] = $snforview; //print_r($data['currentmonthstockdetails']);echo '
';die(); } else { } $this->global['pageTitle'] = 'Siddharth : Stock Details'; $this->loadViews("batchcard_stockdetails", $this->global,$data,NULL); } function getMaintenancesDetails(){ $date = $this->input->post('id1'); // echo $date; // die(); $arraydata = $this->batchcard_model->maintenancesdata($date); 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(){ $data['emplist'] = $this->batchcard_model->getEmplistforReport(); $data['supplist'] = $this->batchcard_model->getSupplierlist(); $data['MachineList'] = $this->batchcard_model->getmachine_codename(); $this->global['pageTitle'] = 'Siddharth : Add Maintenance/Breakdown'; $this->loadViews("BatchcardMaintAdd", $this->global,$data,NULL); } function editMaint(){ $MntID = base64_decode(urldecode($this->uri->segment(3))); $data['emplist'] = $this->batchcard_model->getEmplistforReport(); $data['MachineList'] = $this->batchcard_model->getmachine_codename(); $data['supplist'] = $this->batchcard_model->getSupplierlist(); $data['MaintEdit'] = $this->batchcard_model->getmaint_dtl_MntID($MntID); $data['MaintFileEdit'] = $this->batchcard_model->getfiledetails($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'); $machinecode = $this->input->post('machine'); if($type == '0'){ $maintenance_subtype = $this->input->post('maintenance_subtype'); if($maintenance_subtype == '1'){ $supplier = $this->input->post('supplier'); } else{ $supplier = NULL; } } else{ $maintenance_subtype = NULL;$supplier = NULL; } //$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_date_time = $this->input->post('maintenance_date_time'); $maintenance_date_time = explode(" - ",$maintenance_date_time); $maintenance_time_from = $maintenance_date_time[0]; $maintenance_time_to = $maintenance_date_time[1]; $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' ); $approvedby = $this->input->post('approvedby'); $workdoneby = $this->input->post('workdoneby'); $addmntbr = array('Type'=>$type,'Machine_Code'=>$machinecode,'Maint_Subtype'=>$maintenance_subtype, 'Maint_Supplier'=>$supplier,'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,'WorkDone_By'=>$workdoneby,'Approved_By'=>$approvedby,'CreatedBy'=>$createdby); //'Maint_Date'=>$maintenance_date,'Maint_Time'=>$maintenance_time, //print_r($addmntbr); //die(); $added = $this->batchcard_model->addmaint_dtl($addmntbr); $maint_id = ''; if(count($added)>0) { foreach ($added as $key ) { $maint_id=$key->Maint_ID; } } $count = $this->input->post('hidecounter'); $constant = $this->input->post('hideconstant'); for($i=1;$i<=$constant;$i++){ $pathname = 'browseFiles'.$i; if(!empty($_FILES[$pathname]['name'])) { $varname = 'filename'.$i; $temp = $this->input->post($varname); $Picture = $this->add($pathname); $arr[] = array($temp,$Picture); } } foreach($arr as $ma){ $index = 0; foreach($ma as $key=>$value){ $index++; if($index == 1){ $file_descrpition = $value; } if($index == 2){ $filename = $value; } } $addfilelist = array( 'Machine_code/Maint_id'=>$maint_id, 'File_name'=>$filename, 'Status'=>"1", 'Status_description'=>($type == '0') ? ('Maintenaces related files') : ('Breakdown related files') ); $this->batchcard_model->addfiledetails($addfilelist); //print_r($addfilelist); //die(); } if(count($added)>0) { echo ""; } //print_r($addmntbr); } function editmntbr(){ $type = $this->input->post('radiobtn'); $mntid = $this->input->post('mntid'); $machinecode = $this->input->post('machine'); if($type == '0'){ $maintenance_subtype = $this->input->post('maintenance_subtype'); if($maintenance_subtype == '1'){ $supplier = $this->input->post('supplier'); } else{ $supplier = NULL; } } else{ $maintenance_subtype = NULL; $supplier = NULL; } // $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_date_time = $this->input->post('maintenance_date_time'); $maintenance_date_time = explode(" - ",$maintenance_date_time); $maintenance_time_from = $maintenance_date_time[0]; $maintenance_time_to = $maintenance_date_time[1]; $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' ); $approvedby = $this->input->post('approvedby'); $workdoneby = $this->input->post('workdoneby'); // $date = new DateTime('now', new DateTimeZone('Asia/Kolkata')); // $updatedon = $date->format('d-m-Y H:i:s'); $editmntbr = array('Type'=>$type,'Machine_Code'=>$machinecode,'Maint_Subtype'=>$maintenance_subtype, 'Maint_Supplier'=>$supplier,'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,'WorkDone_By'=>$workdoneby,'Approved_By'=>$approvedby,'UpdatedBy'=>$updatedby); //'Maint_Date'=>$maintenance_date,'Maint_Time'=>$maintenance_time, //print_r($editmntbr); //die(); // echo $type; // echo $mntid; // die(); $updated = $this->batchcard_model->updatemaint_dtl($editmntbr,$mntid); $count = $this->input->post('hidecounter'); $constant = $this->input->post('hideconstant'); for($i=1;$i<=$constant;$i++){ $pathname = 'browseFiles'.$i; if(!empty($_FILES[$pathname]['name'])) { $varname = 'filename'.$i; $temp = $this->input->post($varname); $Picture = $this->add($pathname); $arr[] = array($temp,$Picture); } } foreach($arr as $ma){ $index = 0; foreach($ma as $key=>$value){ $index++; if($index == 1){ $file_descrpition = $value; } if($index == 2){ $filename = $value; } } $addfilelist = array( 'Machine_code/Maint_id'=>$mntid, 'File_name'=>$filename, 'Status'=>"1", 'Status_description'=>($type == '0') ? ('Maintenaces files') : ('Breakdown files') ); $this->batchcard_model->addfiledetails($addfilelist); //$updatefilelist= array_filter(array_map('array_filter',$updatefilelist )); } if($updated >= 0) { echo ""; } } function getHistListing() { $data['HistListing'] = $this->batchcard_model->getHist_mstr(); $this->global['pageTitle'] = 'Siddharth : Machine Master/History Listing'; $this->loadViews("BatchcardHistListing", $this->global,$data,NULL); } function getPODtls(){ $pono = $this->input->post('id'); $podtls = $this->batchcard_model->getpo_dtls($pono); echo json_encode($podtls); } function addHist(){ $data['HistDeptList'] = $this->batchcard_model->getdept_dtls(); $data['HistPONOList'] = $this->batchcard_model->getpono(); $this->global['pageTitle'] = 'Siddharth : Add Machine Master/History '; $this->loadViews("BatchcardHistAdd", $this->global,$data,NULL); } function autocomplete() { $mc = $this->input->get('query'); $query= $this->batchcard_model->checkMachineCategory($mc); echo json_encode($query); } function add($pathname) { // echo "add files"; // die(); // echo $pathname; $picture = ''; if(!empty($_FILES[$pathname]['name'])) { $config['upload_path'] = 'uploads/images/'; $config['allowed_types'] = '*'; //$config['allowed_types'] = 'jpg|jpeg|png|gif'; $config['file_name'] = $_FILES[$pathname]['name']; //print_r($config); //Load upload library and initialize configuration $this->load->library('upload',$config); $this->upload->initialize($config); if($this->upload->do_upload($pathname)) { $uploadData = $this->upload->data(); $picture = $uploadData['file_name']; } else { $error = array('error' => $this->upload->display_errors()); $picture = ''; } } else { $picture = ''; } return $picture ; } function addHist_mstr(){ $machinename= $this->input->post('mach_name'); $make= $this->input->post('tomake'); $capacity= $this->input->post('machs_capacity'); $category= strtoupper($this->input->post('machs_category')); $categoryarray = $this->batchcard_model->getmachineCategory(); foreach($categoryarray as $mc){ $TempArr[] = $mc->ConfigValue; } if (in_array($category, $TempArr)){} else { $configcode = 'C028'; $config = array('Config_ID'=>$configcode,'ConfigValue'=>$category); $query= $this->batchcard_model->insertvalueintoconfig($config); } $dept= $this->input->post('machs_dept'); $location= $this->input->post('machs_locn'); $PONO= $this->input->post('machs_pono'); $POdate= $this->input->post('machs_podate'); $supplier = $this->input->post('machs_supplier'); $instalizationdate= $this->input->post('install_date'); $machineslifetime = $this->input->post('machs_lifetime'); $commencementdate = $this->input->post('machs_comm_date'); $createdby = $this->session->userdata ('userId'); $add = array( 'Machine_Name' => $machinename, 'Machines_Make' => $make, 'Machines_Capacity' => $capacity, 'Machines_Category' => $category, 'Machines_Dept' => $dept, 'Factory_Loc' => $location, 'Machines_PONO' => $PONO, 'Machines_POdate' => $POdate, 'Machines_Supplier' => $supplier , 'Instalization_Date' => $instalizationdate, 'Machines_Lifetime' => $machineslifetime , 'Commencement_Date' => $commencementdate , 'CreatedBy' => $createdby); $addedmaster = $this->batchcard_model->addhist_mstr($add); $mach_code = ''; if(count($addedmaster)>0) { foreach ($addedmaster as $key ) { $mach_code=$key->Machine_Code; } } $count = $this->input->post('hidecounter'); $constant = $this->input->post('hideconstant'); for($i=1;$i<=$constant;$i++){ $pathname = 'browseFiles'.$i; if(!empty($_FILES[$pathname]['name'])) { $varname = 'filename'.$i; $temp = $this->input->post($varname); $Picture = $this->add($pathname); $arr[] = array($temp,$Picture); } } foreach($arr as $ma){ $index = 0; foreach($ma as $key=>$value){ $index++; if($index == 1){ $file_descrpition = $value; } if($index == 2){ $filename = $value; } } $addfilelist = array( 'Machine_code/Maint_id'=>$mach_code, 'File_name'=>$filename, 'Status'=>"0", 'Status_description'=>"Machine file" ); $this->batchcard_model->addfiledetails($addfilelist); //print_r($addfilelist); //die(); } $range = $this->input->post('machs_range'); $operatingrange = $this->input->post('machs_operating_range'); $leastcount = $this->input->post('machs_least_count'); $calibrationagency = $this->input->post('machs_calibration_agency'); $Calibrationon = $this->input->post('machs_calibration_on'); $Calibrationdue = $this->input->post('machs_calibration_due'); if($category == 'LAB'){ $Acctcriteria = $this->input->post('machs_acceptence_criteria'); } else{ $Acctcriteria = NULL; } $addchild = array( 'Machine_Code' => $mach_code, 'Machine_Name'=> $machinename, 'Range' => $range, 'Operating_Range' => $operatingrange, 'Least_Count' => $leastcount, 'Calibration_Agency' => $calibrationagency, 'Calibration_On' => $Calibrationon, 'Calibration_Due' => $Calibrationdue, 'Acceptence_Criteria'=> $Acctcriteria ); $addedchild = $this->batchcard_model->addhist_dtl($addchild); echo ""; } function editHist(){ //echo 'i am a edit function'; //$MachineCode = $_GET['Machcode']; $MachineCode = base64_decode(urldecode($this->uri->segment(3))); //echo $MachineCode; $data['TableDatas'] = $this->batchcard_model->getHist_tbls($MachineCode); $data['HistMstrEdit'] = $this->batchcard_model->getHist_mstr($MachineCode); $data['HistDtlsEdit'] = $this->batchcard_model->getHist_dtls($MachineCode); $data['HistFileEdit'] = $this->batchcard_model->getfiledetails($MachineCode); $data['HistDeptList'] = $this->batchcard_model->getdept_dtls(); $data['HistPONOList'] = $this->batchcard_model->getpono(); //echo count($data['HistFileEdit']); //echo "
"; //echo sizeof($data['HistFileEdit']); $this->global['pageTitle'] = 'Siddharth : Edit Machine Master/History '; $this->loadViews("BatchcardHistEdit", $this->global,$data,NULL); } function Removefiledetails(){ $id = $this->input->post('id'); $name = $this->input->post('name'); $deletedata = $this->batchcard_model->deletefiledetails($id,$name); echo $deletedata; } function editHist_mstr(){ $code_and_name= $this->input->post('mach_name'); $machcn = explode("-",$code_and_name); //$machinename = $machcn[1]; $machinecode = $machcn[0]; $make= $this->input->post('tomake'); $capacity= $this->input->post('machs_capacity'); $category= strtoupper($this->input->post('machs_category')); $categoryarray = $this->batchcard_model->getmachineCategory(); foreach($categoryarray as $mc){ $TempArr[] = $mc->ConfigValue; } if (in_array($category, $TempArr)){} else { $configcode = 'C028'; $config = array('Config_ID'=>$configcode,'ConfigValue'=>$category); $query= $this->batchcard_model->insertvalueintoconfig($config); } $dept= $this->input->post('machs_dept'); $location= $this->input->post('machs_locn'); $PONO= $this->input->post('machs_pono'); $POdate= $this->input->post('machs_podate'); $supplier = $this->input->post('machs_supplier'); $instalizationdate= $this->input->post('install_date'); $machineslifetime = $this->input->post('machs_lifetime'); $commencementdate = $this->input->post('machs_comm_date'); $updatedby = $this->session->userdata ('userId'); $update = array( //'Machine_Name' => $machinename, 'Machines_Make' => $make, 'Machines_Capacity' => $capacity, 'Machines_Category' => $category, 'Machines_Dept' => $dept, 'Factory_Loc' => $location, 'Machines_PONO' => $PONO, 'Machines_POdate' => $POdate, 'Machines_Supplier' => $supplier , 'Instalization_Date' => $instalizationdate, 'Machines_Lifetime' => $machineslifetime , 'Commencement_Date' => $commencementdate , 'UpdatedBy' => $updatedby); $updatedmaster = $this->batchcard_model->edithist_mstr($update,$machinecode); $range = $this->input->post('machs_range'); $operatingrange = $this->input->post('machs_operating_range'); $leastcount = $this->input->post('machs_least_count'); $calibrationagency = $this->input->post('machs_calibration_agency'); $Calibrationon = $this->input->post('machs_calibration_on'); $Calibrationdue = $this->input->post('machs_calibration_due'); if($category == 'LAB'){ $Acctcriteria = $this->input->post('machs_acceptence_criteria'); } else{ $Acctcriteria = NULL; } $updatechild = array( //'Machine_Code' => $machinecode, //'Machine_Name'=> $machinename, 'Range' => $range, 'Operating_Range' => $operatingrange, 'Least_Count' => $leastcount, 'Calibration_Agency' => $calibrationagency, 'Calibration_On' => $Calibrationon, 'Calibration_Due' => $Calibrationdue, 'Acceptence_Criteria'=> $Acctcriteria ); //print_r($updatechild); //die(); $updatedchild = $this->batchcard_model->edithist_dtl($updatechild,$machinecode); $count = $this->input->post('hidecounter'); $constant = $this->input->post('hideconstant'); for($i=1;$i<=$constant;$i++){ $pathname = 'browseFiles'.$i; if(!empty($_FILES[$pathname]['name'])) { $varname = 'filename'.$i; $temp = $this->input->post($varname); $Picture = $this->add($pathname); $arr[] = array($temp,$Picture); } } foreach($arr as $ma){ $index = 0; foreach($ma as $key=>$value){ $index++; if($index == 1){ $file_descrpition = $value; } if($index == 2){ $filename = $value; } } $addfilelist = array( 'Machine_code/Maint_id'=>$machinecode, 'File_name'=>$filename, 'Status'=>"0", 'Status_description'=>"Machine File" ); $this->batchcard_model->addfiledetails($addfilelist); //$updatefilelist= array_filter(array_map('array_filter',$updatefilelist )); } echo ""; //echo ""; } function FinalProductCalculation() { $data['inv_final_product'] = $this->batchcard_model->getinvoice_products(); $data['consumable_material']= $this->batchcard_model->get_consumablematerials(); $data['Raw_material'] = $this->batchcard_model->get_rawmaterials(); $data['supplier'] = $this->batchcard_model->getSupplierlist(); //print_r($data['allhourdata']);die(); $this->global['pageTitle'] = 'Siddharth : Final Product'; $this->loadViews("FinalProduct", $this->global,$data,NULL); } function MaterailAdjustment() { $data['MaterialCode'] = $this->batchcard_model->getMaterial(); $data['Supplier'] = $this->batchcard_model->getSupplierlist(); $this->global['pageTitle'] = 'Siddharth : Material Adjustment'; $this->loadViews("materialadjustment", $this->global,$data,NULL); } function getQuantity() { $MaterialCode = $this->input->post('materialcode'); $date = $this->input->post('date'); $Supplier = $this->input->post('Supplier'); $netQtyarray = $this->batchcard_model->GetNetQty($MaterialCode,$date,$Supplier); echo json_encode($netQtyarray); //print_r($netQtyarray); // echo $MaterialCode; // echo $date; // echo $Supplier; } function addNewMaterialHistory() { $supplier = $this->input->post('supplier'); $materialcode = $this->input->post('materialcode'); $date = $this->input->post('date'); $ActualQty = $this->input->post('ActualQty'); $Qty = $this->input->post('AdjustableQty'); $reason = $this->input->post('reason'); $Description = $this->input->post('Description'); $status = $this->input->post('transtatus'); $CreatedBy = $this->session->userdata('userId'); $absaluteQty = abs($Qty); // echo $Qty; // echo "abs"; // echo abs($Qty); //die(); $dt = new DateTime('now', new DateTimeZone('Asia/Kolkata')); $createddt = $dt->format('Y-m-d H:i:s'); $adjustmentaarray = array('MaterialCode'=>$materialcode,'ActualQuantity'=>$ActualQty,'Quantity'=>$absaluteQty,'SupplierID'=>$supplier,'Reason'=>$reason,'Description'=>$Description,'CreatedOn'=>$createddt,'CreatedBy'=>$CreatedBy); $materialadjust = $this->batchcard_model->AddmaterialAdjustment($adjustmentaarray); $adjustId =''; if(!empty($materialadjust)) { foreach($materialadjust as $ig) { $adjustId = $ig->AdjustmentId; } } $historytable = array('SupplierID'=>$supplier,'MaterialCode'=>$materialcode,'Transaction_type'=>$status,'Ref_Type'=>'Adjust','Quantity'=>$absaluteQty,'CreatedBy'=>$CreatedBy,'CreatedOn'=>$createddt,'Ref_No'=>$adjustId); $historyadd = $this->batchcard_model->AddMaterialHistory($historytable); if((count($materialadjust)>0) &&(count($historyadd))) { echo "Material Details Added Successfully"; } else { echo "Something Went Wrong,Please Try Again"; } } } ?>