diff --git a/application/config/database.php b/application/config/database.php
index 5f92ff5c..3ed04101 100644
--- a/application/config/database.php
+++ b/application/config/database.php
@@ -64,5 +64,27 @@ $db['default']['swap_pre'] = '';
$db['default']['autoinit'] = TRUE;
$db['default']['stricton'] = FALSE;
+// DB_USERNAME=resicoin_invoice
+// DB_PASSWORD=resicoin_invoice
+// DB_DATABASE=resicoin_invoices
+// DB_DATABASE=resicoin_invoicetest #kasiram9_InvoiceTest
+
+$db['invoicedb']['hostname'] = 'resicoindustries.com';
+$db['invoicedb']['username'] = 'resicoin_invoice';
+$db['invoicedb']['password'] = 'resicoin_invoice';
+//$db['invoicedb']['database'] = 'resicoin_invoicetest';
+$db['invoicedb']['database'] = 'resicoin_invoices';
+$db['invoicedb']['dbdriver'] = 'mysqli';
+$db['invoicedb']['dbprefix'] = '';
+$db['invoicedb']['pconnect'] = TRUE;
+$db['invoicedb']['db_debug'] = FALSE;
+$db['invoicedb']['cache_on'] = FALSE;
+$db['invoicedb']['cachedir'] = '';
+$db['invoicedb']['char_set'] = 'utf8';
+$db['invoicedb']['dbcollat'] = 'utf8_general_ci';
+$db['invoicedb']['swap_pre'] = '';
+$db['invoicedb']['autoinit'] = TRUE;
+$db['invoicedb']['stricton'] = FALSE;
+
/* End of file database.php */
/* Location: ./application/config/database.php */
\ No newline at end of file
diff --git a/application/controllers/batchcard.php b/application/controllers/batchcard.php
index 1d601d37..1555ad54 100755
--- a/application/controllers/batchcard.php
+++ b/application/controllers/batchcard.php
@@ -24,1255 +24,6 @@ class batchcard extends BaseController
$this->CompanyName = $this->global['CompanyName'];
}
- public function index()
- {
- //$data['emplist'] = $this->batchcard_model->getEmplistforReport();
- //$this->global['pageTitle'] = $this->CompanyName.' : 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'] = $this->CompanyName.' : 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'] = $this->CompanyName.' : 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'] = $this->CompanyName.' : 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'] = $this->CompanyName.' : 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'] = $this->CompanyName.' : 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'] = $this->CompanyName.' : 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'] = $this->CompanyName.' : 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(){
-
-// 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'] = $this->CompanyName.' : 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'] = $this->CompanyName.' : 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'] = $this->CompanyName.' : 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'] = $this->CompanyName.' : 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'] = $this->CompanyName.' : 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'] = $this->CompanyName.' : 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()
{
@@ -1335,7 +86,6 @@ class batchcard extends BaseController
{
$data['MaterialCode'] = $this->batchcard_model->getMaterial();
$data['Supplier'] = $this->batchcard_model->getSupplierlist();
-
$this->global['pageTitle'] = $this->CompanyName.' : Material Adjustment';
$this->loadViews("materialadjustment", $this->global,$data,NULL);
}
@@ -1858,9 +608,10 @@ class batchcard extends BaseController
$frm = $this->input->post('from_date');
$t = $this->input->post('to_date');
$data['material']=$this->batchcard_model->getMaterial_history($prod,$frm,$t);
- }
- $data['material_name']=$this->batchcard_model->material_name();
-
+ }
+ $data['material_name']=$this->batchcard_model->material_name();
+ //$data['firstinvoice'] = $this->batchcard_model->selectquery();
+
$this->loadviews("MaterialHistory",$this->global,$data,NULL);
diff --git a/application/controllers/purchaseorder.php b/application/controllers/purchaseorder.php
index 24a50bb4..eb93bafa 100644
--- a/application/controllers/purchaseorder.php
+++ b/application/controllers/purchaseorder.php
@@ -1067,18 +1067,19 @@ class purchaseorder extends BaseController
$DeliveryAddr = $this->input->post('txtDeliveryAddress');
$dt = $this->input->post('Deliverydt');
$DeliveryOption = $this->input->post('DateRange');
- if($DeliveryOption==1){
- $Deliverydt = '';
- $DeliverySchedule = $this->input->post('Scheduleby');
- }
- else{
- $Deliverydt = $this->getDateformat($dt);
- $DeliverySchedule = '';
- }
- $b4supplier=$this->input->post('b4supplier');
- $b4date=$this->input->post('b4podate');
- $b4podate = $this->getDateformat($b4date);
+ if($DeliveryOption==1){
+ $Deliverydt = '';
+ $DeliverySchedule = $this->input->post('Scheduleby');
+ }
+ else{
+ $Deliverydt = $this->getDateformat($dt);
+ $DeliverySchedule = '';
+ }
+
+ $b4supplier=$this->input->post('b4supplier');
+ $b4date=$this->input->post('b4podate');
+ $b4podate = $this->getDateformat($b4date);
$Modeofshipment=$this->input->post('editmodeofshipment');
$supplierreference=$this->input->post('editsupplierreference');
@@ -1087,10 +1088,11 @@ class purchaseorder extends BaseController
$fincap=$this->input->post('editfincap');
$revenuetype=$this->input->post('PoTypeOptions');
$insurancestatus=$this->input->post('insurancestatus');
+
if($insurancestatus == 1){
- $insuranceno=$this->input->post('insuranceno');
+ $insuranceno=$this->input->post('insuranceno');
}else{
- $insuranceno="";
+ $insuranceno="";
}
$POType = $this->input->post('POType');
@@ -1111,7 +1113,7 @@ class purchaseorder extends BaseController
$updateddt = $dt->format('Y-m-d H:i:s');
$PaymentTerms=$this->input->post('PaymentTerms');
- $OtherPayment=$this->input->post('Otherpayment');
+ $OtherPayment=$this->input->post('Otherpayment');
$Local_Interstate=$this->input->post('Range');
$Qualitycheck=1;
@@ -1121,27 +1123,28 @@ class purchaseorder extends BaseController
$POMaster = $this->purchaseorder_model->updatePOMaster($PONO,$POList);
- $LineItemStatus = REQITEM_NEW;
+ $LineItemStatus = REQITEM_NEW;
+
if($PODate != $b4podate )
- {
+ {
$logpo =array('PONO'=>$PONO,'LineItemNo'=>'-','UpdateBy'=>$updatedBy,'OldValue'=>$b4podate,'NewValue'=>$PODate,'Entity'=>'PO DateChanged');
- $this->purchaseorder_model->insertlogpo($logpo);
- }
-
- if(!empty($newSupId[0] ))
- {
- if($newSupId[0] != $b4supplier)
- {
-
- $logpo =array('PONO'=>$PONO,'LineItemNo'=>'-','UpdateBy'=>$updatedBy,'OldValue'=>$b4supplier,'NewValue'=>$newsup,'Entity'=>'Supplier Changed');
$this->purchaseorder_model->insertlogpo($logpo);
- }
- }
+ }
+
+ if(!empty($newSupId[0] ))
+ {
+ if($newSupId[0] != $b4supplier)
+ {
+
+ $logpo =array('PONO'=>$PONO,'LineItemNo'=>'-','UpdateBy'=>$updatedBy,'OldValue'=>$b4supplier,'NewValue'=>$newsup,'Entity'=>'Supplier Changed');
+ $this->purchaseorder_model->insertlogpo($logpo);
+ }
+ }
- for ($i = 1; $i <= $RowCount; $i++)
- {
+ for($i = 1; $i <= $RowCount; $i++)
+ {
$MaterialCode = $this->input->post('materialCode'.$i);
$Quantity = $this->input->post('quantity'.$i);
@@ -1178,41 +1181,37 @@ class purchaseorder extends BaseController
if($Quantity != $b4qty)
{
- $logpo =array('PONO'=>$PONO,'LineItemNo'=>$POLineItemNo,'UpdateBy'=>$updatedBy,'OldValue'=>$b4qty,'NewValue'=>$Quantity,'Entity'=>'Quantity Changed');
-
- $this->purchaseorder_model->insertlogpo($logpo);
+ $logpo =array('PONO'=>$PONO,'LineItemNo'=>$POLineItemNo,'UpdateBy'=>$updatedBy,'OldValue'=>$b4qty,'NewValue'=>$Quantity,'Entity'=>'Quantity Changed');
+ $this->purchaseorder_model->insertlogpo($logpo);
}
- if($itemRate != $b4rate)
+ if($itemRate != $b4rate)
{
- $logpo =array('PONO'=>$PONO,'LineItemNo'=>$POLineItemNo,'UpdateBy'=>$updatedBy,'OldValue'=>$b4rate,'NewValue'=>$itemRate,'Entity'=>'Rate Changed');
-
-
- $this->purchaseorder_model->insertlogpo($logpo);
- }
+ $logpo =array('PONO'=>$PONO,'LineItemNo'=>$POLineItemNo,'UpdateBy'=>$updatedBy,'OldValue'=>$b4rate,'NewValue'=>$itemRate,'Entity'=>'Rate Changed');
+ $this->purchaseorder_model->insertlogpo($logpo);
+ }
- $SkipInsert = "False";
- if( count($comma_separated) > 0)
- {
+ $SkipInsert = "False";
+
+ if( count($comma_separated) > 0)
+ {
for($j = 1; $j < count($comma_separated); $j++)
{
$deletedRow = $comma_separated[$j] ;
-
- if($deletedRow == $i )
- {
- $SkipInsert = "True";
- break;
- }
+ if($deletedRow == $i )
+ {
+ $SkipInsert = "True";
+ break;
+ }
- }
- }
+ }
+ }
- $ReqDetails = array('Quantity'=>$Quantity,'UpdatedBy'=>$updatedBy,'UpdatedOn'=>$updateddt);
-
+ $ReqDetails = array('Quantity'=>$Quantity,'UpdatedBy'=>$updatedBy,'UpdatedOn'=>$updateddt);
$this->purchaseorder_model->updateReqDetails($Reqnumber,$MaterialCode,$ReqDetails);
$recqty=0;
@@ -1223,7 +1222,7 @@ class purchaseorder extends BaseController
$recqty= $Quantity;
$IGRD= $this->purchaseorder_model->getIGRDetails($PONO);
- $j = $i-1;
+ $j = $i-1;
$IGRDs = array('QuantityAsPerInvoice'=>$Quantity,'UpdateBY'=>$updatedBy,'UpdatedOn'=>$updateddt);
@@ -1253,9 +1252,7 @@ class purchaseorder extends BaseController
}
$isExists = $this->purchaseorder_model->LineItemExistsinRevenueTax($LineItemNo);
if(count($isExists) == 0)
- {
-
- }
+ {}
else
{
diff --git a/application/controllers/rawmaterialdetails.php b/application/controllers/rawmaterialdetails.php
index 187a4541..b6372369 100644
--- a/application/controllers/rawmaterialdetails.php
+++ b/application/controllers/rawmaterialdetails.php
@@ -168,6 +168,19 @@ else
$ConversionFactor = $this->input->post('conversionfactor');
$cfuom = $this->input->post('conversionfactorUOM');//print_r( $ConversionFactorUOM);
$HSN = $this->input->post('HSNcode');//print_r($HSNcode);
+ $stock = $this->input->post('openstock');
+ $reorder = $this->input->post('reorder');
+ $stockdate = $this->input->post('Date');
+ if (empty($stockdate))
+ {
+ $stockdate = NULL;
+ }
+ else
+ {
+ $stockdate = strtotime( $stockdate);
+ $stockdate = date("Y-m-d ", $stockdate);
+ }
+
$CreatedBy = $this->session->userdata('userId');
$chked = $this->input->post('isactive');
@@ -214,7 +227,7 @@ else
$IsActive = '0';
}
- $RawMaterial = array('MaterialName'=>$MaterialName, 'MaterialType'=>$MaterialType, 'UOM'=>$UOM,'Category'=>$MaterialCategory, 'CreatedBy'=>$CreatedBy,'IsActive' => $IsActive,'assetcode'=>$AssetCode,'CostCenterCode'=>$CostCenterCode,'ConversionFactorUnit'=>$ConversionFactor,'ConversionFactorUOM'=>$ConversionFactorUOM,'Remarks'=>$Remarks,'HSNCODE'=>$HSNcode);
+ $RawMaterial = array('MaterialName'=>$MaterialName, 'MaterialType'=>$MaterialType, 'UOM'=>$UOM,'Category'=>$MaterialCategory, 'CreatedBy'=>$CreatedBy,'IsActive' => $IsActive,'assetcode'=>$AssetCode,'CostCenterCode'=>$CostCenterCode,'ConversionFactorUnit'=>$ConversionFactor,'ConversionFactorUOM'=>$ConversionFactorUOM,'Remarks'=>$Remarks,'HSNCODE'=>$HSNcode ,'stock'=>$stock,'stockdate'=>$stockdate,'reorder'=>$reorder);
$result = $this->rawmaterialdetails_model->addNewRawMaterial($RawMaterial);
if($result > 0)
@@ -245,6 +258,7 @@ else
$RawMaterialID = $_GET['RID'];
$MaterialType = $_GET['MType'];
$UOM = $_GET['UOM'];
+ $currentdate=$_GET['date1'];
}
else
{
@@ -252,6 +266,7 @@ else
}
$data['materialDetails'] = $this->rawmaterialdetails_model->getMaterialDetails($RawMaterialID);
+ $data['currentstock'] = $this->rawmaterialdetails_model->getMaterialstock($RawMaterialID, $currentdate);
$data['materialType'] = $this->rawmaterialdetails_model->getmaterialType($MaterialType );
$data['materialCategory'] = $this->rawmaterialdetails_model->getmaterialCategory($MaterialCategory);
$data['UOMList'] = $this->rawmaterialdetails_model->getUOM($UOM);
@@ -319,6 +334,18 @@ else
$ConversionFactor = $this->input->post('conversionfactor');
$cfuom = $this->input->post('conversionfactorUOM');
$HSN = $this->input->post('HSNcode');
+ $stock = $this->input->post('openstock');
+ $reorder = $this->input->post('reorder');
+ $stockdate = $this->input->post('Date');
+ if (empty($stockdate))
+ {
+ $stockdate = NULL;
+ }
+ else
+ {
+ $stockdate = strtotime( $stockdate);
+ $stockdate = date("Y-m-d ", $stockdate);
+ }
$UpdatedBy = $this->session->userdata ('userId');
$chked = $this->input->post('isactive');
if($asset == '0')
@@ -365,6 +392,7 @@ else
$RawMaterial = array();
$RawMaterial = array('MaterialName'=>$MaterialName,'MaterialType'=>$MaterialType,'UpdatedBy'=>$UpdatedBy, 'UOM'=>$UOM,'IsActive' => $IsActive,'Category'=>$MaterialCategory,'ConversionFactorUnit'=>$ConversionFactor,'ConversionFactorUOM'=>$ConversionFactorUOM,'Remarks'=>$Remarks,'assetcode'=>$AssetCode,'CostCenterCode'=>$CostCenterCode,'HSNCODE'=>$HSNcode);
+ $RawMaterial = array('MaterialName'=>$MaterialName,'MaterialType'=>$MaterialType,'UpdatedBy'=>$UpdatedBy, 'UOM'=>$UOM,'IsActive' => $IsActive,'Category'=>$MaterialCategory,'ConversionFactorUnit'=>$ConversionFactor,'ConversionFactorUOM'=>$ConversionFactorUOM,'Remarks'=>$Remarks,'assetcode'=>$AssetCode,'CostCenterCode'=>$CostCenterCode,'HSNCODE'=>$HSNcode,'stock'=>$stock,'stockdate'=>$stockdate,'reorder'=>$reorder);//,'RMCode'=>$rmcode);
$result = $this->rawmaterialdetails_model->editRawmaterial($RawMaterial, $MaterialCode);
if($result == true)
diff --git a/application/models/batchcard_model.php b/application/models/batchcard_model.php
index 3e1bb695..0b5cba65 100755
--- a/application/models/batchcard_model.php
+++ b/application/models/batchcard_model.php
@@ -2,1201 +2,650 @@
class batchcard_model extends CI_Model
{
-
- function getEmplistforReport()
- {
- $this->db->select('T_Employee_Details.EmpID,T_Employee_Details.FirstName,T_Employee_Details.LastName,T_Employee_Details.Departmentcode,T_DepartmentDetails.shortName');
- $this->db->from('T_Employee_Details');
- $this->db->join('T_DepartmentDetails','T_Employee_Details.Departmentcode=T_DepartmentDetails.DEPCode');
- //$this->db->join('ip_invoice_items','ip_invoices.invoice_number=ip_invoice_items.invoice_number');
- //$this->db->join('ip_products','ip_invoice_items.item_product_id=ip_products.product_id');
- //$this->db->join('ip_invoice_custom','ip_invoices.invoice_number=ip_invoice_custom.invoice_number and invoice_custom_fieldid=62');
- $this->db->order_by('T_Employee_Details.EmpID');
- $res = $this->db->get();
- return $res->result();
-
- }
-
- function getSupplierlist(){
-
- $this->db->select('SupplierName,SupplierID');
- $this->db->from('T_SupplierDetailsN');
- $supp = $this->db->get();
- return $supp->result();
-
+ function __construct(){
+ parent::__construct();
+ //load our second db and put in $db2
+ $this->db2 = $this->load->database('invoicedb', TRUE);
}
- function saveHourlyBatchInfo($datatostore)
- {
- $this->db->insert('T_hourly_batch_info',$datatostore);
- $res = $this->db->affected_rows();
-
- return $res;
- }
-
- function saveDailyBatchCardData($datatostore)
- {
- $this->db->insert('T_daily_batchcard_data',$datatostore);
- $res = $this->db->affected_rows();
- return $res;
- }
-
- function updateHourlyBatchInfo($datatostore,$hid)
- {
- $this->db->where('hourlyid',$hid);
- $this->db->update('T_hourly_batch_info',$datatostore);
- $res = $this->db->affected_rows();
-
- return $res;
- }
-
- function getAllHourlyData($hid='',$from='',$to='')
- {
- //echo "Model".$from.'-'.$to;
-
- $this->db->select('T_hourly_batch_info.*,T_Employee_Details.FirstName as F,T_Employee_Details.LastName as L');
- $this->db->from('T_hourly_batch_info');
- $this->db->join('tbl_users','T_hourly_batch_info.checkedby=tbl_users.userId');
- $this->db->join('T_Employee_Details','tbl_users.EmpID=T_Employee_Details.EmpID');
- if(!empty($hid))
- {
- $this->db->where('hourlyid',$hid);
- }
- if(!empty($from) && !empty($to))
- {
- $this->db->where('T_hourly_batch_info.report_date <=',$to);
- $this->db->where('T_hourly_batch_info.report_date >=',$from);
- }
- $this->db->order_by('hourlyid','desc');
- $res = $this->db->get();
- //print_r($res->result());die();
- return $res->result();
- }
-
-
- function checkExistHourlyData($bdate,$btime)
- {
- //echo 'Model'.$bdate.'-'.$btime;
- $this->db->select('count(*) as count');
- $this->db->from('T_hourly_batch_info');
- $this->db->where('report_date',$bdate);
- $this->db->where('report_time',$btime);
- $res = $this->db->get();
- return $res->result();
- }
-
-
- function getPowerConsumptionDetails($rdate)
- {
-
- $this->db->select('hourlyid,report_time,opening_trp_reading,close_trp_reading,auto_start,auto_stop');
- $this->db->from('T_hourly_batch_info');
- $this->db->where('report_date',$rdate);
- $res = $this->db->get();
- return $res->result();
- }
-
- function getDailyBatchCardData($month)
- {
- // $this->db->select('*');
- // $this->db->from('T_daily_batchcard_data');
- // $this->db->where('month(ddate)',$month);
- $sql = 'select T_daily_batchcard_data.*,T_Employee_Details.FirstName,T_Employee_Details.LastName from T_daily_batchcard_data
- join tbl_users on T_daily_batchcard_data.createdby = tbl_users.userId
- join T_Employee_Details on T_Employee_Details.EmpID = tbl_users.EmpID
- where month(ddate) = ?';
- $res = $this->db->query($sql,array($month));
- return $res->result();
- }
-
- function getIndividualDailyData($did)
- {
-
- $this->db->select('*');
- $this->db->from('T_daily_batchcard_data');
- $this->db->where('dailyid',$did);
- $res = $this->db->get();
- return $res->result();
-
- }
-
- function checkExistDaily($rdate)
- {
- $this->db->select('count(*) as count');
- $this->db->from('T_daily_batchcard_data');
- $this->db->where('ddate',$rdate);
- $res = $this->db->get();
- return $res->result();
- }
-
- function updateDailyBatchCardData($datatostore,$did)
- {
- $this->db->where('dailyid',$did);
- $this->db->update('T_daily_batchcard_data',$datatostore);
- $res = $this->db->affected_rows();
-
- return $res;
- }
-
- function checkAbstractReport($date)
- {
- $this->db->select('count(*) as count');
- $this->db->from('T_abstract_report');
- //$this->db->where('abstract_report_date',$date);
- $this->db->where("date_format(abstract_report_date,'%Y-%m')",$date);
- $res = $this->db->get();
- return $res->result();
- }
-
- function saveAbstractReport($datatostore)
- {
- $this->db->insert('T_abstract_report',$datatostore);
- $res = $this->db->affected_rows();
- return $res;
- }
-
- function updateAbstractReport($datatostore,$date,$abstract_details)
- {
- //$this->db->where('abstract_report_date',$date);
- $this->db->where("date_format(abstract_report_date,'%Y-%m')",$date);
- $this->db->where('abstract_details',$abstract_details);
- $this->db->update('T_abstract_report',$datatostore);
- $res = $this->db->affected_rows();
-
- return $res;
-
- }
-
- function getPreviousMonthAbstractDetails($month,$year)
- {
- //$sql = "select abstract_details,close_stock from T_abstract_report where month(abstract_report_date) =? and year(abstract_report_date) =? ";
- $sql = "select abstract_details,close_stock as Available from T_abstract_report where month(abstract_report_date) =? and year(abstract_report_date) =? ";
- $res = $this->db->query($sql,array($month,$year));
- return $res->result();
-
- }
-
- function getMonthAbstractDetails($month_year)
- {
- $sql = "select abstract_details,close_stock,open_stock as Available,physical_stock from T_abstract_report where date_format(abstract_report_date,'%Y-%m') = ? ";
- $res = $this->db->query($sql,array($month_year));
-
- return $res->result();
- }
-
- function getPreviousMonthClosedStockDetails($y,$m,$sn)
- {
- $month = 'month(ddate)';
- $year = 'year(ddate)';
- //$this->db->select($sn);
- $this->db->select($sn,'ddate');
- $this->db->from('T_daily_batchcard_data');
- $this->db->where($month,$m);
- $this->db->where($year,$y);
- $this->db->order_by('ddate','desc');
- $this->db->limit(1);
- $res = $this->db->get();
- //print_r($res->result());
- return $res->result();
- }
-
- function currentMonthStockDetails($m,$y,$sd1,$sd2)
- {
- $month = 'month(ddate)';
- $year = 'year(ddate)';
- $list = array('ddate',$sd1,$sd2);
- $this->db->select($list);
- $this->db->from('T_daily_batchcard_data');
- $this->db->where($month,$m);
- $this->db->where($year,$y);
- $this->db->order_by('ddate','asc');
- $res = $this->db->get();
- //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;
-
- $this->db->insert('T_Batchcard_MaintanceDetails',$array);
- $bmd = $this->db->affected_rows();
-
-
- if($bmd>0)
- {
- $this->db->select('max(Maint_ID) as Maint_ID');
- $this->db->from('T_Batchcard_MaintanceDetails');
- $res = $this->db->get();
- return $res->result();
- }
- }
- function getmaint_dtl($fdate,$tdate,$type )
- {
-
-
- $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->join('T_Employee_Details ED1', 'ED1.EmpID = BMD.Approved_By', 'left');
- $this->db->join('T_Employee_Details ED2', 'ED2.EmpID = BMD.WorkDone_By', 'left');
-
-
-
- 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)
- {
-
- $this->db->select('*');
- $this->db->from('T_Batchcard_MaintanceDetails');
- $this->db->where('Maint_ID',$MntID);
- $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){
-
- $this->db->select("bm.*,mm.Machine_Name");
- $this->db->select("DATE_FORMAT(bm.CreatedOn,'%d-%m-%Y') AS date", FALSE);
- $this->db->select("DATE_FORMAT(bm.CreatedOn,'%l:%i %p') AS time", FALSE);
- $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 bm");
- $this->db->join("T_Machine_Master mm", "bm.Machine_Code = mm.Machine_Code", "left");
- $this->db->join("T_Employee_Details ED1", "bm.Approved_By = ED1.EmpID", "left");
- $this->db->join("T_Employee_Details ED2", "bm.WorkDone_By = ED2.EmpID", "left");
- $this->db->where("mm.Machines_Category = 'TRP'");
- //AND DATE_FORMAT(bm.CreatedOn,'%Y-%m-%d') = '19-04-2018'
- $this->db->where("DATE_FORMAT(bm.CreatedOn,'%d-%m-%Y')",$date);
- $bmd = $this->db->get();
- return $bmd->result();
-
- //print_r($this->db->last_query());
- //die();
-
- }
-
- function getmachine_codename(){
- $this->db->select('Machine_Code,Machine_Name');
- $this->db->from('T_Machine_Master');
- $res = $this->db->get();
- return $res->result();
- }
-
- /** Machines History/Master */
- function getdept_dtls()
- {
- $this->db->select('T_DepartmentDetails.DEPCode,T_DepartmentDetails.shortName');
- $this->db->from('T_DepartmentDetails');
- $this->db->where('IsActive',1);
- $res = $this->db->get();
- return $res->result();
- }
-
- function getpono(){
-
- $this->db->select('PONO');
- $this->db->from('T_PurchaseOrder_Master');
- $this->db->where('Status','ST026');
- $res = $this->db->get();
- return $res->result();
- }
-
- function getpo_dtls($pono){
-
- // $this->db->select('T_PurchaseOrder_Master.PONO,T_PurchaseOrder_Master.SupplierID,T_SupplierDetailsN.SupplierName,DATE_FORMAT(T_PurchaseOrder_Master.PODate,"%d-%m-%Y") as PO_Date');
- // $this->db->from('T_PurchaseOrder_Master');
- // $this->db->join('T_SupplierDetailsN','T_PurchaseOrder_Master.SupplierID=T_SupplierDetailsN.SupplierID');
- // $this->db->where('PONO',$pono);
- // $res = $this->db->get();
- // return $res->result();
- $sql = "select T_PurchaseOrder_Master.PONO,T_PurchaseOrder_Master.SupplierID,T_SupplierDetailsN.SupplierName,DATE_FORMAT(T_PurchaseOrder_Master.PODate,'%d-%m-%Y') as PO_Date
- from T_PurchaseOrder_Master
- join T_SupplierDetailsN on T_PurchaseOrder_Master.SupplierID=T_SupplierDetailsN.SupplierID
- where PONO = ? ";
- $res = $this->db->query($sql,array($pono));
- return $res->result();
-
- }
-
- function addhist_mstr($array)
- {
- $this->db->insert('T_Machine_Master',$array);
- $mstr = $this->db->affected_rows();
- //print_r($this->db->last_query());
- //print_r($mstr);
- if($mstr>0)
- {
-
- $this->db->select('max(Machine_Code) as Machine_Code');
- $this->db->from('T_Machine_Master');
- $res = $this->db->get();
- //print_r($res->result());
- return $res->result();
-
-
-
-
-
- }
-
- }
- function addhist_dtl($array){
-
- $this->db->insert('T_Machine_Details',$array);
- $child = $this->db->affected_rows();
- return $child;
-
- }
- //This function for multi file upload option (both machine and maint/br screen)
- function addfiledetails($array){
-
- $this->db->insert('T_Machines_file', $array);
- $r = $this->db->affected_rows();
- return $r;
- //return TRUE;
-
- }
- function insertvalueintoconfig($config){
-
- $this->db->insert('T_ConfigDetails', $config);
- return TRUE;
- }
-
- //This function used to get the material category using configdetails table
- function getmachineCategory($MaterialCategory = '')
- {
- $Config_ID = 'C028';
- $this->db->select('Config_ID,ConfigValue');
- $this->db->from('T_ConfigDetails');
- $this->db->where('Config_id',$Config_ID );
- if($MaterialCategory != '')
- {
- $this->db->where('ConfigValue !=',$MaterialCategory );
- }
- $query = $this->db->get();
-
- return $query->result();
- }
-
-
- function getHist_dtls($MachineCode = '')
- {
-
- $this->db->select('*');
- $this->db->from('T_Machine_Details');
- if($MachineCode != '')
- {
- $this->db->where('Machine_Code',$MachineCode );
- }
- $bmd = $this->db->get();
- return $bmd->result();
- }
-
- //This function for multi file upload option (both machine and maint/br screen)
- function getfiledetails($data = '')
- {
-
- $this->db->select('*');
- $this->db->from('T_Machines_file');
- if($data != '')
- {
- $this->db->where('Machine_code/Maint_id',$data );
- }
- $bmd = $this->db->get();
- return $bmd->result();
- }
-
- function getHist_mstr($MachineCode = '')
- {
-
- $this->db->select('*');
- $this->db->from('T_Machine_Master');
- if($MachineCode != '')
- {
- $this->db->where('Machine_Code',$MachineCode );
- }
- $bmd = $this->db->get();
- return $bmd->result();
- }
-
- // function getHist_dtlsID($MntID)
- // {
-
- // $this->db->select('*');
- // $this->db->from('T_Batchcard_MaintanceDetails');
- // $this->db->where('Maint_ID',$MntID);
- // $bmd = $this->db->get();
- // return $bmd->result();
+ // function selectquery(){
+ // $query = $this->db2->get('ip_invoices');
+ // return $query->result();
// }
-
- // function getHist_dtlsDate($dateval)
- // {
-
- // $this->db->select('*');
- // $this->db->from('T_Batchcard_MaintanceDetails');
- // $this->db->where('Maint_Date',$dateval);
- // $bmd = $this->db->get();
- // return $bmd->result();
- // }
-
-
- function edithist_mstr($array,$machinecode){
-
- $this->db->where('Machine_Code',$machinecode );
- $this->db->update('T_Machine_Master',$array);
- $mstr = $this->db->affected_rows();
- if($mstr>0)
- {
-
- $this->db->select('max(Machine_Code) as Machine_Code');
- $this->db->from('T_Machine_Master');
- $res = $this->db->get();
- return $res->result();
- }
-
- }
-
- function edithist_dtl($array,$machinecode){
- $this->db->where('Machine_Code',$machinecode );
- $this->db->update('T_Machine_Details',$array);
- $mdtl = $this->db->affected_rows();
- return $mdtl;
- }
-
- function updatefilelist($array,$fileid){
-
- $this->db->where('File_No',$fileid);
- $this->db->update('T_Machines_file', $array);
- $ar = $this->db->affected_rows();
- return $ar;
-
- }
-
- function checkMachineCategory($mc){
-
- // $this->db->select('ConfigValue');
- // $this->db->from('T_ConfigDetails');
- // $this->db->where(Config_ID,'C023');
- // $this->db->like('ConfigValue',$mc);
- // $query = $this->db->get();
- // //print_r($query->result());
- // return $query->result();
-
- // //return $this->db->get('T_MaterialMaster');
- // }
- $temp[] = '' ;
-
- $this->db->distinct();
- $this->db->select('ConfigValue');
- $this->db->from('T_ConfigDetails');
- $this->db->where('Config_ID','C028');
- $this->db->like('ConfigValue',$mc);
- $query = $this->db->get();
- //print_r($query->result());die;
- $temparr[] = '' ;
- foreach($query->result() as $arr){
- $temparr[] = $arr->ConfigValue ;
- }
- $temp['suggestions'] = $temparr;
- //print_r($temp);
-
- return $temp;
- }
-
- //This function for multi file upload option (both machine and maint/br screen)
- function deletefiledetails($id,$name){
- $sql = "DELETE FROM T_Machines_file WHERE File_No =".$id;
- unlink("uploads/images/".$name);//this deletes the file on particular folder too
- $query = $this->db->query($sql);
- $ar = $this->db->affected_rows();
- return $ar;
- }
-
-
- function getHist_tbls($MachineCode){
-
- $this->db->select('T_Machine_Master.*,T_Batchcard_MaintanceDetails.*,T_DepartmentDetails.DepartmentName');
- $this->db->select("DATE_FORMAT(T_Batchcard_MaintanceDetails.CreatedOn,'%d-%m-%Y') AS date", FALSE);
- $this->db->select("DATE_FORMAT(T_Batchcard_MaintanceDetails.CreatedOn,'%l:%i %p') AS time", FALSE);
- $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_Machine_Master');
- $this->db->join('T_Batchcard_MaintanceDetails','T_Batchcard_MaintanceDetails.Machine_Code=T_Machine_Master.Machine_Code');
- $this->db->join('T_DepartmentDetails','T_DepartmentDetails.DEPCode=T_Machine_Master.Machines_Dept');
- $this->db->join('T_Employee_Details ED1', 'ED1.EmpID = T_Batchcard_MaintanceDetails.Approved_By', 'left');
- $this->db->join('T_Employee_Details ED2', 'ED2.EmpID = T_Batchcard_MaintanceDetails.WorkDone_By', 'left');
- $this->db->where('T_Machine_Master.Machine_Code',$MachineCode);
- $res = $this->db->get();
- return $res->result();
+
+ //presented
+ function getSupplierlist(){
+
+ $this->db->select('SupplierName,SupplierID');
+ $this->db->from('T_SupplierDetailsN');
+ $supp = $this->db->get();
+ return $supp->result();
- // $sql = "SELECT T_Machine_Master.*,T_Batchcard_MaintanceDetails.*,
- // T_DepartmentDetails.DepartmentName,
- // DATE_FORMAT(T_Batchcard_MaintanceDetails.CreatedOn, '%d-%m-%Y') as date,
- // DATE_FORMAT(T_Batchcard_MaintanceDetails.CreatedOn, '%l:%i %p') as time,
- // FROM T_Machine_Master
- // LEFT JOIN T_Batchcard_MaintanceDetails ON T_Batchcard_MaintanceDetails.Machine_Code=T_Machine_Master.Machine_Code
- // LEFT JOIN T_DepartmentDetails ON T_DepartmentDetails.DEPCode=T_Machine_Master.Machines_Dept
- // WHERE T_Machine_Master.Machine_Code = '".$MachineCode."'" ;
- // $res = $this->db->query($sql);
- // return $res->result();
-
}
-
-
-
-
-
- function getinvoice_products()
- {
-
- $this->db->select('product_id,product_name');
- $this->db->from('ip_products');
- $supp = $this->db->get();
- return $supp->result();
-
- }
-
- function get_consumablematerials()
- {
-
- $this->db->select('MaterialCode,MaterialName,');
- $this->db->from('T_MaterialMaster');
- $this->db->where('T_MaterialMaster.Category',Consumables);
- $supp = $this->db->get();
- return $supp->result();
-
- }
-
-
- function get_rawmaterials()
- {
- $this->db->select('MaterialCode,MaterialName,');
- $this->db->from('T_MaterialMaster');
- $this->db->where('T_MaterialMaster.Category',RawMaterial);
- $supp = $this->db->get();
- return $supp->result();
- }
-
-
- function get_packmaterials()
- {
- $this->db->select('MaterialCode,MaterialName,');
- $this->db->from('T_MaterialMaster');
- $this->db->where('T_MaterialMaster.Category',Packingmaterial);
- $supp = $this->db->get();
- return $supp->result();
- }
-
-
- function getMaterial()
- {
- $this->db->select('MaterialCode,MaterialName,');
- $this->db->from('T_MaterialMaster');
- //$this->db->where('T_MaterialMaster.Category',Consumables);
- $supp = $this->db->get();
- return $supp->result();
- }
-
-
-
- function GettotalQty($MaterialCode,$date)
- {
- echo $model;
- $dt = date('d',strtotime($date));
- $year = date('Y', strtotime($date));
- $month = date('m', strtotime($date));
- if($month<04)
- {
- //echo "b4finance";
- $newyr = $year - 1;
- $startdate = $newyr.'-'.'04'.'-'.'01';
-
- //echo $startdate;
- }
- else
- {
- //echo "after Finance";
- $startdate = $year.'-'.'04'.'-'.'01';
- // echo $startdate;
- }
-
- $nedt= $dt;
-
- $newdate=$year.'-'.$month.'-'.$nedt;
-
- $subQuery='select T_MaterialMaster.MaterialName,T_Material_stock_history.MaterialCode,ifnull((select ifnull(sum(Quantity),0) as AddQty from T_Material_stock_history
-where Transaction_type = "Add" and MaterialCode=?),0) as Addqty,
-ifnull((select ifnull(sum(Quantity),0) as ReduceQty from T_Material_stock_history where Transaction_type = "Reduce"
-and MaterialCode=?),0) as ReduceQty from T_Material_stock_history join T_MaterialMaster on T_Material_stock_history.MaterialCode=T_MaterialMaster.MaterialCode where T_Material_stock_history.MaterialCode=?
-and CreatedOn >= ? and CreatedOn<=? group by Addqty';
-
- $query = $this->db->query($subQuery,array($MaterialCode,$MaterialCode,$MaterialCode,$startdate,$newdate));
- //print_r($this->db->last_query());
- return $query->result_array();
-
-
- }
-
-
- function GetNetQty($MaterialCode,$date,$Supplier)
- {
- //echo $date;
- $dt = date('d',strtotime($date));
- $year = date('Y', strtotime($date));
- $month = date('m', strtotime($date));
-
- if($month<04)
- {
- //echo "b4finance";
- $newyr = $year - 1;
- $startdate = $newyr.'-'.'04'.'-'.'01';
-
- //echo $startdate;
- }
-
- else
- {
- //echo "after Finance";
- $startdate = $year.'-'.'04'.'-'.'01';
- // echo $startdate;
- }
-
- $nedt= $dt+1;
-
- $newdate=$year.'-'.$month.'-'.$nedt;
-
-
-// $subQuery='select (select sum(Quantity) as AddQty from T_Material_stock_history where Transaction_type = "Add" and MaterialCode=?
-// ) as Addqty,(select sum(Quantity) as ReduceQty from T_Material_stock_history where Transaction_type = "Reduce" and MaterialCode=?
-// ) as ReduceQty from T_Material_stock_history where MaterialCode=? and CreatedOn >= ? and CreatedOn<=? and SupplierID=? group by Addqty';
-
-
- $subQuery='select ifnull((select ifnull(sum(Quantity),0) as AddQty from T_Material_stock_history
-where Transaction_type = "Add" and MaterialCode=? and SupplierID=? ),0) as Addqty,
-ifnull((select ifnull(sum(Quantity),0) as ReduceQty from T_Material_stock_history where Transaction_type = "Reduce"
-and MaterialCode=? and SupplierID=? ),0) as ReduceQty from T_Material_stock_history where MaterialCode=?
-and CreatedOn >= ? and CreatedOn<=? and SupplierID=? group by Addqty';
-
- $query = $this->db->query($subQuery,array($MaterialCode,$Supplier,$MaterialCode,$Supplier,$MaterialCode,$startdate,$newdate,$Supplier));
- //print_r($this->db->last_query());
- return $query->result_array();
-
-
- }
-
-
- function GetMaterialHistory($AdjustmentId)
- {
- $this->db->select('T_Material_Adjustment.*,SupplierName,MaterialName');
- $this->db->from('T_Material_Adjustment');
- $this->db->join('T_SupplierDetailsN',"T_SupplierDetailsN.SupplierID=T_Material_Adjustment.SupplierID");
- $this->db->join('T_MaterialMaster',"T_MaterialMaster.MaterialCode=T_Material_Adjustment.MaterialCode");
- $this->db->where('T_Material_Adjustment.AdjustmentId',$AdjustmentId);
- $supp = $this->db->get();
- return $supp->result();
-
- join("T_Machine_Master mm", "bm.Machine_Code = mm.Machine_Code", "left");
- }
-
-
-
-
- function AddmaterialAdjustment($adjustmentaarray)
- {
- $this->db->trans_start();
- $this->db->insert('T_Material_Adjustment',$adjustmentaarray);
- $insert_id = $this->db->affected_rows();
- $this->db->trans_complete();
+
+ //presented
+ function getinvoice_products()
+ {
+
+ $this->db2->select('product_id,product_name');
+ $this->db2->from('ip_products');
+ $supp = $this->db2->get();
+ return $supp->result();
+
+ }
+
+ //presented
+ function get_consumablematerials()
+ {
+
+ $this->db->select('MaterialCode,MaterialName,');
+ $this->db->from('T_MaterialMaster');
+ $this->db->where('T_MaterialMaster.Category',Consumables);
+ $supp = $this->db->get();
+ return $supp->result();
+
+ }
+
+ //presented
+ function get_rawmaterials()
+ {
+ $this->db->select('MaterialCode,MaterialName,');
+ $this->db->from('T_MaterialMaster');
+ $this->db->where('T_MaterialMaster.Category',RawMaterial);
+ $supp = $this->db->get();
+ return $supp->result();
+ }
+
+ //presented
+ function get_packmaterials()
+ {
+ $this->db->select('MaterialCode,MaterialName,');
+ $this->db->from('T_MaterialMaster');
+ $this->db->where('T_MaterialMaster.Category',Packingmaterial);
+ $supp = $this->db->get();
+ return $supp->result();
+ }
+
+ //presented
+ function getMaterial()
+ {
+ $this->db->select('MaterialCode,MaterialName,');
+ $this->db->from('T_MaterialMaster');
+ //$this->db->where('T_MaterialMaster.Category',Consumables);
+ $supp = $this->db->get();
+ return $supp->result();
+ }
+
+
+
+ function GettotalQty($MaterialCode,$date)
+ {
+ echo $model;
+ $dt = date('d',strtotime($date));
+ $year = date('Y', strtotime($date));
+ $month = date('m', strtotime($date));
+ if($month<04)
+ {
+ //echo "b4finance";
+ $newyr = $year - 1;
+ $startdate = $newyr.'-'.'04'.'-'.'01';
+
+ //echo $startdate;
+ }
+ else
+ {
+ //echo "after Finance";
+ $startdate = $year.'-'.'04'.'-'.'01';
+ // echo $startdate;
+ }
+
+ $nedt= $dt;
+
+ $newdate=$year.'-'.$month.'-'.$nedt;
+
+ $subQuery='select T_MaterialMaster.MaterialName,T_Material_stock_history.MaterialCode,ifnull((select ifnull(sum(Quantity),0) as AddQty from T_Material_stock_history
+ where Transaction_type = "Add" and MaterialCode=?),0) as Addqty,
+ ifnull((select ifnull(sum(Quantity),0) as ReduceQty from T_Material_stock_history where Transaction_type = "Reduce"
+ and MaterialCode=?),0) as ReduceQty from T_Material_stock_history join T_MaterialMaster on T_Material_stock_history.MaterialCode=T_MaterialMaster.MaterialCode where T_Material_stock_history.MaterialCode=?
+ and CreatedOn >= ? and CreatedOn<=? group by Addqty';
+
+ $query = $this->db->query($subQuery,array($MaterialCode,$MaterialCode,$MaterialCode,$startdate,$newdate));
+ //print_r($this->db->last_query());
+ return $query->result_array();
+
+
+ }
+
+ //presented
+ function GetNetQty($MaterialCode,$date,$Supplier)
+ {
+ //echo $date;
+ $dt = date('d',strtotime($date));
+ $year = date('Y', strtotime($date));
+ $month = date('m', strtotime($date));
+
+ if($month<04)
+ {
+ //echo "b4finance";
+ $newyr = $year - 1;
+ $startdate = $newyr.'-'.'04'.'-'.'01';
+
+ //echo $startdate;
+ }
+
+ else
+ {
+ //echo "after Finance";
+ $startdate = $year.'-'.'04'.'-'.'01';
+ // echo $startdate;
+ }
+
+ $nedt= $dt+1;
+
+ $newdate=$year.'-'.$month.'-'.$nedt;
+
+
+ // $subQuery='select (select sum(Quantity) as AddQty from T_Material_stock_history where Transaction_type = "Add" and MaterialCode=?
+ // ) as Addqty,(select sum(Quantity) as ReduceQty from T_Material_stock_history where Transaction_type = "Reduce" and MaterialCode=?
+ // ) as ReduceQty from T_Material_stock_history where MaterialCode=? and CreatedOn >= ? and CreatedOn<=? and SupplierID=? group by Addqty';
+
+
+ $subQuery='select ifnull((select ifnull(sum(Quantity),0) as AddQty from T_Material_stock_history
+ where Transaction_type = "Add" and MaterialCode=? and SupplierID=? ),0) as Addqty,
+ ifnull((select ifnull(sum(Quantity),0) as ReduceQty from T_Material_stock_history where Transaction_type = "Reduce"
+ and MaterialCode=? and SupplierID=? ),0) as ReduceQty from T_Material_stock_history where MaterialCode=?
+ and CreatedOn >= ? and CreatedOn<=? and SupplierID=? group by Addqty';
+
+ $query = $this->db->query($subQuery,array($MaterialCode,$Supplier,$MaterialCode,$Supplier,$MaterialCode,$startdate,$newdate,$Supplier));
+ //print_r($this->db->last_query());
+ return $query->result_array();
+
+
+ }
+
+ //presented
+ function GetMaterialHistory($AdjustmentId)
+ {
+ $this->db->select('T_Material_Adjustment.*,SupplierName,MaterialName');
+ $this->db->from('T_Material_Adjustment');
+ $this->db->join('T_SupplierDetailsN',"T_SupplierDetailsN.SupplierID=T_Material_Adjustment.SupplierID");
+ $this->db->join('T_MaterialMaster',"T_MaterialMaster.MaterialCode=T_Material_Adjustment.MaterialCode");
+ $this->db->where('T_Material_Adjustment.AdjustmentId',$AdjustmentId);
+ $supp = $this->db->get();
+ return $supp->result();
+
+ join("T_Machine_Master mm", "bm.Machine_Code = mm.Machine_Code", "left");
+ }
+
+
+
+ //presented
+ function AddmaterialAdjustment($adjustmentaarray)
+ {
+ $this->db->trans_start();
+ $this->db->insert('T_Material_Adjustment',$adjustmentaarray);
+ $insert_id = $this->db->affected_rows();
+ $this->db->trans_complete();
+ // print_r($this->db->last_query());
+ //print_r($insert_id);
+ if($insert_id>0)
+ {
+ $subQuery = 'select max(AdjustmentId) as AdjustmentId from T_Material_Adjustment';
+ $query = $this->db->query($subQuery);
+
+ return $query->result();
+ }
+ }
+
+ //presented
+ function AddMaterialHistory($historytable)
+ {
+ $this->db->trans_start();
+ $this->db->insert('T_Material_stock_history',$historytable);
+ $insert_id = $this->db->affected_rows();
+ $this->db->trans_complete();
+ return $insert_id;
+
+ }
+
+ //presented
+ function insert_final_product($final_master)
+ {
+ $this->db->trans_start();
+ $this->db->insert('T_FinalProduct_Master',$final_master);
+ $insert_id = $this->db->affected_rows();
+ $this->db->trans_complete();
// print_r($this->db->last_query());
- //print_r($insert_id);
- if($insert_id>0)
- {
- $subQuery = 'select max(AdjustmentId) as AdjustmentId from T_Material_Adjustment';
- $query = $this->db->query($subQuery);
-
- return $query->result();
- }
- }
-
-
- function AddMaterialHistory($historytable)
- {
- $this->db->trans_start();
- $this->db->insert('T_Material_stock_history',$historytable);
- $insert_id = $this->db->affected_rows();
- $this->db->trans_complete();
- return $insert_id;
-
- }
-
-
- function insert_final_product($final_master)
- {
- $this->db->trans_start();
- $this->db->insert('T_FinalProduct_Master',$final_master);
- $insert_id = $this->db->affected_rows();
- $this->db->trans_complete();
- // print_r($this->db->last_query());
- //print_r($insert_id);
- if($insert_id>0)
- {
- $subQuery = 'select max(FPId) as PId from T_FinalProduct_Master';
- $query = $this->db->query($subQuery);
-
- return $query->result();
- }
- }
-
-
- function save_finalraw($rawarray)
- {
- $this->db->trans_start();
- $this->db->insert('T_FinalProduct_RawMaterials',$rawarray);
- $insert_id = $this->db->affected_rows();
- $this->db->trans_complete();
- return true;
-
- }
-
-
- function save_finalcon($conarray)
- {
- $this->db->trans_start();
- $this->db->insert('T_FinalProduct_ConsumableMaterials',$conarray);
- $insert_id = $this->db->affected_rows();
- $this->db->trans_complete();
- return true;
- }
-
- function save_finalpacking($packarray)
- {
- $this->db->trans_start();
- $this->db->insert('T_FinalProduct_PackingMaterials',$packarray);
- $insert_id = $this->db->affected_rows();
- $this->db->trans_complete();
- return true;
- }
-
-
- function save_finalcoproduct($coparray)
- {
-
- //print_r($coparray);
- $this->db->trans_start();
- $this->db->insert('T_FinalProduct_CoProduct_Materials',$coparray);
- $insert_id = $this->db->affected_rows();
- $this->db->trans_complete();
- return true;
- }
-
-
- function getAllMaterialAdjustments()
- {
- $this->db->select('T_Material_Adjustment.*,SupplierName,MaterialName');
- $this->db->from('T_Material_Adjustment');
- $this->db->join('T_SupplierDetailsN', 'T_Material_Adjustment.SupplierID = T_SupplierDetailsN.SupplierID');
- $this->db->join('T_MaterialMaster', 'T_MaterialMaster.MaterialCode = T_Material_Adjustment.MaterialCode');
- $res = $this->db->get();
- return $res->result();
- }
-
-
-
-
- function save_rawmaterialto_materialHistory($materialhistory)
- {
- $this->db->trans_start();
- $this->db->insert('T_Material_stock_history',$materialhistory);
- $insert_id = $this->db->affected_rows();
- $this->db->trans_complete();
- return true;
- }
-
-
- function getFinalProductDetaisl()
- {
- $this->db->select('T_FinalProduct_Master.*,product_name,product_description');
- $this->db->from('T_FinalProduct_Master');
- $this->db->join('ip_products','ip_products.product_id=T_FinalProduct_Master.MaterialCode');
- $res = $this->db->get();
- return $res->result();
+ //print_r($insert_id);
+ if($insert_id>0)
+ {
+ $subQuery = 'select max(FPId) as PId from T_FinalProduct_Master';
+ $query = $this->db->query($subQuery);
- }
-
-
- function getmasterProductDetails($FPId)
- {
- $this->db->select('T_FinalProduct_Master.*,product_name,product_description');
- $this->db->from('T_FinalProduct_Master');
- $this->db->join('ip_products','ip_products.product_id=T_FinalProduct_Master.MaterialCode');
- $this->db->where('T_FinalProduct_Master.FPId',$FPId);
- $res = $this->db->get();
- return $res->result();
- }
-
-
- function getrawmaterialDetails($FPId)
- {
- $this->db->select('T_FinalProduct_RawMaterials.*,SupplierName,MaterialName');
- $this->db->from('T_FinalProduct_RawMaterials');
- $this->db->join('T_MaterialMaster','T_MaterialMaster.MaterialCode=T_FinalProduct_RawMaterials.MaterialCode');
- $this->db->join('T_SupplierDetailsN','T_SupplierDetailsN.SupplierID=T_FinalProduct_RawMaterials.SupplierID');
- $this->db->where('T_FinalProduct_RawMaterials.FPId',$FPId);
- $res = $this->db->get();
- return $res->result();
- }
-
-
- function getconsumaterialDetails($FPId)
- {
- $this->db->select('T_FinalProduct_ConsumableMaterials.*,SupplierName,MaterialName');
- $this->db->from('T_FinalProduct_ConsumableMaterials');
- $this->db->join('T_MaterialMaster','T_MaterialMaster.MaterialCode=T_FinalProduct_ConsumableMaterials.MaterialCode');
- $this->db->join('T_SupplierDetailsN','T_SupplierDetailsN.SupplierID=T_FinalProduct_ConsumableMaterials.SupplierID');
- $this->db->where('T_FinalProduct_ConsumableMaterials.FPId',$FPId);
- $res = $this->db->get();
- return $res->result();
- }
-
-
- function getpackagematerialDetails($FPId)
- {
- $this->db->select('T_FinalProduct_PackingMaterials.*,SupplierName,MaterialName');
- $this->db->from('T_FinalProduct_PackingMaterials');
- $this->db->join('T_MaterialMaster','T_MaterialMaster.MaterialCode=T_FinalProduct_PackingMaterials.MaterialCode');
- $this->db->join('T_SupplierDetailsN','T_SupplierDetailsN.SupplierID=T_FinalProduct_PackingMaterials.SupplierID');
- $this->db->where('T_FinalProduct_PackingMaterials.FPId',$FPId);
- $res = $this->db->get();
- return $res->result();
- }
-
-
- function getcoproductmaterial($FPId)
- {
- $subQuery ='select T_FinalProduct_CoProduct_Materials.*,product_name
- from T_FinalProduct_CoProduct_Materials
- join ip_products on ip_products.product_id = T_FinalProduct_CoProduct_Materials.MaterialCode
- where T_FinalProduct_CoProduct_Materials.FPId=?';
-
- $query = $this->db->query($subQuery,array($FPId));
-
- return $query->result_array();
-
- }
-
-
- function update_final_product($final_master,$FPId)
- {
- //print_r($final_master);
- $this->db->where('FPId', $FPId);
- $this->db->update('T_FinalProduct_Master', $final_master);
- $insert_id = $this->db->affected_rows();
- //return TRUE;
- if($insert_id>0)
- {
- $subQuery = 'select max(FPId) as FPId from T_FinalProduct_Master';
-
- $query = $this->db->query($subQuery,array());
-
- return $query->result_array();
- }
- }
-
-
-
- function GetRawid($rawilneno)
- {
- $this->db->select('*');
- $this->db->from('T_FinalProduct_RawMaterials');
- $this->db->where('RawId',$rawilneno);
- $query = $this->db->get();
- //print_r($this->db->last_query());
- return $query->result();
- }
-
-
-
- function Getconsuid($consuline)
- {
- $this->db->select('*');
- $this->db->from('T_FinalProduct_ConsumableMaterials');
- $this->db->where('ConId',$consuline);
- $query = $this->db->get();
- //print_r($this->db->last_query());
- return $query->result();
- }
-
-
- function Getpackid($packlineId)
- {
-
- $this->db->select('*');
- $this->db->from('T_FinalProduct_PackingMaterials');
- $this->db->where('PackId',$packlineId);
- $query = $this->db->get();
- //print_r($this->db->last_query());
- return $query->result();
- }
-
-
- function Getcopid($coplineId)
- {
- $this->db->select('*');
- $this->db->from('T_FinalProduct_CoProduct_Materials');
- $this->db->where('CoId',$coplineId);
- $query = $this->db->get();
- //print_r($this->db->last_query());
- return $query->result();
-
- }
-
-
- function update_finalraw($rawarray,$rawilneno)
- {
- $this->db->where('RawId', $rawilneno);
- $this->db->update('T_FinalProduct_RawMaterials', $rawarray);
- return TRUE;
- }
-
-
- function GetRawCheck($rawmaterial,$final_product_id)
- {
- $this->db->select('*');
- $this->db->from('T_Material_stock_history');
- $this->db->where('MaterialCode',$rawmaterial);
- $this->db->where('Ref_No',$final_product_id);
- $this->db->where('Ref_Type',FinalProduct);
- $query = $this->db->get();
- //print_r($this->db->last_query());
- return $query->result();
- }
-
-
- function update_rawmaterialto_materialHistory($rawmaterialhistory,$rawmaterial,$FPID)
- {
- $this->db->where('Ref_No', $FPID);
- $this->db->where('MaterialCode', $rawmaterial);
- $this->db->update('T_Material_stock_history', $rawmaterialhistory);
- return TRUE;
- }
-
-
- function update_finalconsu($conarray,$consuline)
- {
- $this->db->where('ConId', $consuline);
- $this->db->update('T_FinalProduct_ConsumableMaterials', $conarray);
- return TRUE;
- }
-
-
- function update_finalpacking($conarray,$packlineId)
- {
- $this->db->where('PackId', $packlineId);
- $this->db->update('T_FinalProduct_PackingMaterials', $conarray);
- return TRUE;
- }
-
-
- function update_finalcoproduct($coparray,$coplineId)
- {
- $this->db->where('CoId', $coplineId);
- $this->db->update('T_FinalProduct_CoProduct_Materials', $coparray);
- return TRUE;
- }
- function getEditMaterialAdjustments($AdjustmentId)
- {
-
- $this->db->select('T_Material_Adjustment.*,SupplierName,MaterialName,Description,AdjustmentId,ActualQuantity,T_Material_stock_history.Quantity,Ref_Type,Transaction_type');
- $this->db->from('T_Material_Adjustment');
- $this->db->join('T_Material_stock_history', 'T_Material_Adjustment.AdjustmentId = T_Material_stock_history.Ref_No and T_Material_stock_history.Ref_Type="Adjust"');
- $this->db->join('T_SupplierDetailsN', 'T_Material_Adjustment.SupplierID = T_SupplierDetailsN.SupplierID');
- $this->db->join('T_MaterialMaster', 'T_MaterialMaster.MaterialCode = T_Material_Adjustment.MaterialCode');
- $this->db->where('T_Material_Adjustment.AdjustmentId',$AdjustmentId);
- $res = $this->db->get();
- return $res->result();
- }
- function material_name(){
- $sql="SELECT distinct MaterialName FROM T_MaterialMaster;";
- $query = $this->db->query($sql);
- return $query->result();
- }
- function getMaterial_history($prod,$frm,$t)
- {
- $sql="SELECT msh.StockId,sd.SupplierName,mm.MaterialName,msh.Transaction_type,msh.Ref_Type,msh.Ref_No,msh.Quantity,msh.ItemValue,date_format(msh.UpdatedOn,'%d-%m-%Y') as updatedOn FROM T_Material_stock_history as msh
- left join T_SupplierDetailsN as sd on sd.SupplierID=msh.SupplierID
- left join T_MaterialMaster as mm on mm.MaterialCode=msh.MaterialCode
- where msh.StockId != 'null' ";
- if ($prod!= ''){
-
- $sql.=" and mm.MaterialName = '".$prod."' ";
-
- }
- if ($frm and $t != ''){
- $fromd= date("Y-m-d",strtotime($frm));
- $tod=date("Y-m-d",strtotime($t));
-
-
- $sql.="and date(msh.UpdatedOn) >= '".$fromd."'
- and date(msh.UpdatedOn) <= '".$tod."'";
-
- }
-
-
- $query =$this->db->query($sql);
- return $query->result();
-
-
- }
- //created by TamilBala
- //for update quantity stockhistory
- function updateQuantityStockHistory($updatequantity,$id)
- {
-
- $this->db->where('Ref_No',$id);
- $this->db->where('Ref_Type',Adjust);
- $this->db->update('T_Material_stock_history',$updatequantity);
- $r = $this->db->affected_rows();
- //return $r->result();
- //echo "HIS";
-
- }
-
- //created by TamilBala
- //for update quantity T_Material_Adjustment
-
- function updateQuantityAdjusment($updatequantitydes,$id)
- {
- $this->db->where('AdjustmentId',$id);
- $this->db->update('T_Material_Adjustment',$updatequantitydes);
- $r = $this->db->affected_rows();
- return $r;
-
- }
- //created by TamilBala
- //for update isactive T_Material_Adjustment
- function updateisactiveadjusment($Updateactive,$AdjustmentId)
- {
- $this->db->where('AdjustmentId',$AdjustmentId);
- $this->db->update('T_Material_Adjustment',$Updateactive);
- $r = $this->db->affected_rows();
- return $r;
-
- }
-
- //created by TamilBala
- //for update isactive stockhistory
- function updateisactiveastockhistory($Updateactive,$AdjustmentId)
- {
- $this->db->where('Ref_No',$AdjustmentId);
- $this->db->where('Ref_Type',Adjust);
- $this->db->update('T_Material_stock_history',$Updateactive);
- $r = $this->db->affected_rows();
- return $r;
- }
-
-
-
-// function GetFinishedProductList($starting_date,$end_date,$product_id)
-// {
-
-
-// $subQuery ='select ip_products.product_id,ip_products.product_name,ip_invoices.invoice_id,ip_invoice_items.item_quantity,ip_invoice_items.item_price,ip_invoices.invoice_number as IDnumber,ip_invoices.receivedstatus as Type from ip_products join ip_invoice_items on ip_products.product_id = ip_invoice_items.item_product_id join ip_invoices on ip_invoice_items.invoice_id = ip_invoices.invoice_id
-// join T_FinalProduct_Master on ip_products.product_id = T_FinalProduct_Master.MaterialCode where (ip_invoices.invoice_date_modified>=? and ip_invoices.invoice_date_modified<=? and ip_invoice_items.item_product_id=?) union
-
-// select ip_products.product_id,ip_products.product_name,T_FinalProduct_Master.FPId,T_FinalProduct_Master.Quantity,T_FinalProduct_Master.Price,T_FinalProduct_Master.FPId as IDnumber,T_FinalProduct_Master.ProductType as Type from ip_products join ip_invoice_items on ip_products.product_id = ip_invoice_items.item_product_id
-// join T_FinalProduct_Master on ip_products.product_id = T_FinalProduct_Master.MaterialCode where
-// (T_FinalProduct_Master.ProductDate<=? and T_FinalProduct_Master.ProductDate>=? and T_FinalProduct_Master.MaterialCode=?) group by FPId';
-
-// $query = $this->db->query($subQuery,array($starting_date,$end_date,$product_id,$end_date,$starting_date,$product_id));
-
-// //print_r($this->db->last_query());
-
-
-// return $query->result_array();
-
-
-// }
-
-
-function GetFinishedProductList($starting_date,$end_date,$product_id)
-{
-
-
- // $subQuery = 'select * from T_FinalProduct_History,ip_products.product_name
- // join ip_products on T_FinalProduct_History.ProductCode = ip_products.product_id
-
- // where ProductCode=?
- // and Transactiondate >= ? and Transactiondate <= ?';
-
- $subQuery='select RefID,ProductCode,Quantity,Price,Transactiondate,TransactionType,product_name
-from T_FinalProduct_History
-join ip_products on ip_products.product_id= T_FinalProduct_History.ProductCode
-where ProductCode=? and Transactiondate >= ? and Transactiondate <= ?';
-
- $query = $this->db->query($subQuery,array($product_id,$starting_date,$end_date));
- return $query->result_array();
-
-}
-
-
- function SaveFinalHistory($final_history)
- {
- $this->db->trans_start();
- $this->db->insert('T_FinalProduct_History',$final_history);
- $insert_id = $this->db->affected_rows();
- $this->db->trans_complete();
- return true;
- }
-
-
- function UpdateFinalHistory($final_history,$FPID,$rawmaterial)
- {
- //print_r($final_history);
- $this->db->where('RefID', $FPID);
- $this->db->where('ProductCode',$rawmaterial);
- $this->db->update('T_FinalProduct_History',$final_history);
- //print_r($this->db->last_query());
- return TRUE;
- }
-
+ return $query->result();
+ }
+ }
-}
-
-?>
\ No newline at end of file
+ //presented
+ function save_finalraw($rawarray)
+ {
+ $this->db->trans_start();
+ $this->db->insert('T_FinalProduct_RawMaterials',$rawarray);
+ $insert_id = $this->db->affected_rows();
+ $this->db->trans_complete();
+ return true;
+
+ }
+
+
+ //presented
+ function save_finalcon($conarray)
+ {
+ $this->db->trans_start();
+ $this->db->insert('T_FinalProduct_ConsumableMaterials',$conarray);
+ $insert_id = $this->db->affected_rows();
+ $this->db->trans_complete();
+ return true;
+ }
+ //presented
+ function save_finalpacking($packarray)
+ {
+ $this->db->trans_start();
+ $this->db->insert('T_FinalProduct_PackingMaterials',$packarray);
+ $insert_id = $this->db->affected_rows();
+ $this->db->trans_complete();
+ return true;
+ }
+
+ //presented
+ function save_finalcoproduct($coparray)
+ {
+
+ //print_r($coparray);
+ $this->db->trans_start();
+ $this->db->insert('T_FinalProduct_CoProduct_Materials',$coparray);
+ $insert_id = $this->db->affected_rows();
+ $this->db->trans_complete();
+ return true;
+ }
+
+ //presented
+ function getAllMaterialAdjustments()
+ {
+ $this->db->select('T_Material_Adjustment.*,SupplierName,MaterialName');
+ $this->db->from('T_Material_Adjustment');
+ $this->db->join('T_SupplierDetailsN', 'T_Material_Adjustment.SupplierID = T_SupplierDetailsN.SupplierID');
+ $this->db->join('T_MaterialMaster', 'T_MaterialMaster.MaterialCode = T_Material_Adjustment.MaterialCode');
+ $res = $this->db->get();
+ return $res->result();
+ }
+
+
+
+ //presented
+ function save_rawmaterialto_materialHistory($materialhistory)
+ {
+ $this->db->trans_start();
+ $this->db->insert('T_Material_stock_history',$materialhistory);
+ $insert_id = $this->db->affected_rows();
+ $this->db->trans_complete();
+ return true;
+ }
+
+ //presented
+ function getFinalProductDetaisl()
+ {
+ $this->db->select('T_FinalProduct_Master.*,product_name,product_description');
+ $this->db->from('T_FinalProduct_Master');
+ $this->db->join('ip_products','ip_products.product_id=T_FinalProduct_Master.MaterialCode');
+ $res = $this->db->get();
+ return $res->result();
+
+ }
+
+ //presented
+ function getmasterProductDetails($FPId)
+ {
+ $this->db->select('T_FinalProduct_Master.*,product_name,product_description');
+ $this->db->from('T_FinalProduct_Master');
+ $this->db->join('ip_products','ip_products.product_id=T_FinalProduct_Master.MaterialCode');
+ $this->db->where('T_FinalProduct_Master.FPId',$FPId);
+ $res = $this->db->get();
+ return $res->result();
+ }
+
+ //presented
+ function getrawmaterialDetails($FPId)
+ {
+ $this->db->select('T_FinalProduct_RawMaterials.*,SupplierName,MaterialName');
+ $this->db->from('T_FinalProduct_RawMaterials');
+ $this->db->join('T_MaterialMaster','T_MaterialMaster.MaterialCode=T_FinalProduct_RawMaterials.MaterialCode');
+ $this->db->join('T_SupplierDetailsN','T_SupplierDetailsN.SupplierID=T_FinalProduct_RawMaterials.SupplierID');
+ $this->db->where('T_FinalProduct_RawMaterials.FPId',$FPId);
+ $res = $this->db->get();
+ return $res->result();
+ }
+
+ //presented
+ function getconsumaterialDetails($FPId)
+ {
+ $this->db->select('T_FinalProduct_ConsumableMaterials.*,SupplierName,MaterialName');
+ $this->db->from('T_FinalProduct_ConsumableMaterials');
+ $this->db->join('T_MaterialMaster','T_MaterialMaster.MaterialCode=T_FinalProduct_ConsumableMaterials.MaterialCode');
+ $this->db->join('T_SupplierDetailsN','T_SupplierDetailsN.SupplierID=T_FinalProduct_ConsumableMaterials.SupplierID');
+ $this->db->where('T_FinalProduct_ConsumableMaterials.FPId',$FPId);
+ $res = $this->db->get();
+ return $res->result();
+ }
+
+ //presented
+ function getpackagematerialDetails($FPId)
+ {
+ $this->db->select('T_FinalProduct_PackingMaterials.*,SupplierName,MaterialName');
+ $this->db->from('T_FinalProduct_PackingMaterials');
+ $this->db->join('T_MaterialMaster','T_MaterialMaster.MaterialCode=T_FinalProduct_PackingMaterials.MaterialCode');
+ $this->db->join('T_SupplierDetailsN','T_SupplierDetailsN.SupplierID=T_FinalProduct_PackingMaterials.SupplierID');
+ $this->db->where('T_FinalProduct_PackingMaterials.FPId',$FPId);
+ $res = $this->db->get();
+ return $res->result();
+ }
+
+ //presented
+ function getcoproductmaterial($FPId)
+ {
+ $subQuery ='select T_FinalProduct_CoProduct_Materials.*,product_name
+ from T_FinalProduct_CoProduct_Materials
+ join ip_products on ip_products.product_id = T_FinalProduct_CoProduct_Materials.MaterialCode
+ where T_FinalProduct_CoProduct_Materials.FPId=?';
+
+ $query = $this->db->query($subQuery,array($FPId));
+
+ return $query->result_array();
+
+ }
+
+ //presented
+ function update_final_product($final_master,$FPId)
+ {
+ //print_r($final_master);
+ $this->db->where('FPId', $FPId);
+ $this->db->update('T_FinalProduct_Master', $final_master);
+ $insert_id = $this->db->affected_rows();
+ //return TRUE;
+ if($insert_id>0)
+ {
+ $subQuery = 'select max(FPId) as FPId from T_FinalProduct_Master';
+
+ $query = $this->db->query($subQuery,array());
+
+ return $query->result_array();
+ }
+ }
+
+
+ //presented
+ function GetRawid($rawilneno)
+ {
+ $this->db->select('*');
+ $this->db->from('T_FinalProduct_RawMaterials');
+ $this->db->where('RawId',$rawilneno);
+ $query = $this->db->get();
+ //print_r($this->db->last_query());
+ return $query->result();
+ }
+
+
+ //presented
+ function Getconsuid($consuline)
+ {
+ $this->db->select('*');
+ $this->db->from('T_FinalProduct_ConsumableMaterials');
+ $this->db->where('ConId',$consuline);
+ $query = $this->db->get();
+ //print_r($this->db->last_query());
+ return $query->result();
+ }
+
+
+ function Getpackid($packlineId)
+ {
+
+ $this->db->select('*');
+ $this->db->from('T_FinalProduct_PackingMaterials');
+ $this->db->where('PackId',$packlineId);
+ $query = $this->db->get();
+ //print_r($this->db->last_query());
+ return $query->result();
+ }
+
+ //presented
+ function Getcopid($coplineId)
+ {
+ $this->db->select('*');
+ $this->db->from('T_FinalProduct_CoProduct_Materials');
+ $this->db->where('CoId',$coplineId);
+ $query = $this->db->get();
+ //print_r($this->db->last_query());
+ return $query->result();
+
+ }
+
+ //presented
+ function update_finalraw($rawarray,$rawilneno)
+ {
+ $this->db->where('RawId', $rawilneno);
+ $this->db->update('T_FinalProduct_RawMaterials', $rawarray);
+ return TRUE;
+ }
+
+ //presented
+ function GetRawCheck($rawmaterial,$final_product_id)
+ {
+ $this->db->select('*');
+ $this->db->from('T_Material_stock_history');
+ $this->db->where('MaterialCode',$rawmaterial);
+ $this->db->where('Ref_No',$final_product_id);
+ $this->db->where('Ref_Type',FinalProduct);
+ $query = $this->db->get();
+ //print_r($this->db->last_query());
+ return $query->result();
+ }
+ //presented
+
+ function update_rawmaterialto_materialHistory($rawmaterialhistory,$rawmaterial,$FPID)
+ {
+ $this->db->where('Ref_No', $FPID);
+ $this->db->where('MaterialCode', $rawmaterial);
+ $this->db->update('T_Material_stock_history', $rawmaterialhistory);
+ return TRUE;
+ }
+
+ //presented
+ function update_finalconsu($conarray,$consuline)
+ {
+ $this->db->where('ConId', $consuline);
+ $this->db->update('T_FinalProduct_ConsumableMaterials', $conarray);
+ return TRUE;
+ }
+
+ //presented
+ function update_finalpacking($conarray,$packlineId)
+ {
+ $this->db->where('PackId', $packlineId);
+ $this->db->update('T_FinalProduct_PackingMaterials', $conarray);
+ return TRUE;
+ }
+
+ //presented
+ function update_finalcoproduct($coparray,$coplineId)
+ {
+ $this->db->where('CoId', $coplineId);
+ $this->db->update('T_FinalProduct_CoProduct_Materials', $coparray);
+ return TRUE;
+ }
+ //presented
+ function getEditMaterialAdjustments($AdjustmentId)
+ {
+
+ $this->db->select('T_Material_Adjustment.*,SupplierName,MaterialName,Description,AdjustmentId,ActualQuantity,T_Material_stock_history.Quantity,Ref_Type,Transaction_type');
+ $this->db->from('T_Material_Adjustment');
+ $this->db->join('T_Material_stock_history', 'T_Material_Adjustment.AdjustmentId = T_Material_stock_history.Ref_No and T_Material_stock_history.Ref_Type="Adjust"');
+ $this->db->join('T_SupplierDetailsN', 'T_Material_Adjustment.SupplierID = T_SupplierDetailsN.SupplierID');
+ $this->db->join('T_MaterialMaster', 'T_MaterialMaster.MaterialCode = T_Material_Adjustment.MaterialCode');
+ $this->db->where('T_Material_Adjustment.AdjustmentId',$AdjustmentId);
+ $res = $this->db->get();
+ return $res->result();
+ }
+ //presented
+ function material_name(){
+ $sql="SELECT distinct MaterialName FROM T_MaterialMaster;";
+ $query = $this->db->query($sql);
+ return $query->result();
+ }
+ //presented
+ function getMaterial_history($prod,$frm,$t)
+ {
+ $sql="SELECT msh.StockId,sd.SupplierName,mm.MaterialName,msh.Transaction_type,msh.Ref_Type,msh.Ref_No,msh.Quantity,msh.ItemValue,date_format(msh.UpdatedOn,'%d-%m-%Y') as updatedOn FROM T_Material_stock_history as msh
+ left join T_SupplierDetailsN as sd on sd.SupplierID=msh.SupplierID
+ left join T_MaterialMaster as mm on mm.MaterialCode=msh.MaterialCode
+ where msh.StockId != 'null' ";
+ if ($prod!= ''){
+
+ $sql.=" and mm.MaterialName = '".$prod."' ";
+
+ }
+ if ($frm and $t != ''){
+ $fromd= date("Y-m-d",strtotime($frm));
+ $tod=date("Y-m-d",strtotime($t));
+
+
+ $sql.="and date(msh.UpdatedOn) >= '".$fromd."'
+ and date(msh.UpdatedOn) <= '".$tod."'";
+
+ }
+
+
+ $query =$this->db->query($sql);
+ return $query->result();
+
+
+ }
+ //created by TamilBala
+ //for update quantity stockhistory
+ //presented
+ function updateQuantityStockHistory($updatequantity,$id)
+ {
+
+ $this->db->where('Ref_No',$id);
+ $this->db->where('Ref_Type',Adjust);
+ $this->db->update('T_Material_stock_history',$updatequantity);
+ $r = $this->db->affected_rows();
+ //return $r->result();
+ //echo "HIS";
+
+ }
+
+ //created by TamilBala
+ //for update quantity T_Material_Adjustment
+ //presented
+ function updateQuantityAdjusment($updatequantitydes,$id)
+ {
+ $this->db->where('AdjustmentId',$id);
+ $this->db->update('T_Material_Adjustment',$updatequantitydes);
+ $r = $this->db->affected_rows();
+ return $r;
+
+ }
+ //created by TamilBala
+ //for update isactive T_Material_Adjustment
+ //presented
+ function updateisactiveadjusment($Updateactive,$AdjustmentId)
+ {
+ $this->db->where('AdjustmentId',$AdjustmentId);
+ $this->db->update('T_Material_Adjustment',$Updateactive);
+ $r = $this->db->affected_rows();
+ return $r;
+
+ }
+
+ //created by TamilBala
+ //for update isactive stockhistory
+ //
+ function updateisactiveastockhistory($Updateactive,$AdjustmentId)
+ {
+ $this->db->where('Ref_No',$AdjustmentId);
+ $this->db->where('Ref_Type',Adjust);
+ $this->db->update('T_Material_stock_history',$Updateactive);
+ $r = $this->db->affected_rows();
+ return $r;
+ }
+
+
+
+ // function GetFinishedProductList($starting_date,$end_date,$product_id)
+ // {
+
+
+ // $subQuery ='select ip_products.product_id,ip_products.product_name,ip_invoices.invoice_id,ip_invoice_items.item_quantity,ip_invoice_items.item_price,ip_invoices.invoice_number as IDnumber,ip_invoices.receivedstatus as Type from ip_products join ip_invoice_items on ip_products.product_id = ip_invoice_items.item_product_id join ip_invoices on ip_invoice_items.invoice_id = ip_invoices.invoice_id
+ // join T_FinalProduct_Master on ip_products.product_id = T_FinalProduct_Master.MaterialCode where (ip_invoices.invoice_date_modified>=? and ip_invoices.invoice_date_modified<=? and ip_invoice_items.item_product_id=?) union
+
+ // select ip_products.product_id,ip_products.product_name,T_FinalProduct_Master.FPId,T_FinalProduct_Master.Quantity,T_FinalProduct_Master.Price,T_FinalProduct_Master.FPId as IDnumber,T_FinalProduct_Master.ProductType as Type from ip_products join ip_invoice_items on ip_products.product_id = ip_invoice_items.item_product_id
+ // join T_FinalProduct_Master on ip_products.product_id = T_FinalProduct_Master.MaterialCode where
+ // (T_FinalProduct_Master.ProductDate<=? and T_FinalProduct_Master.ProductDate>=? and T_FinalProduct_Master.MaterialCode=?) group by FPId';
+
+ // $query = $this->db->query($subQuery,array($starting_date,$end_date,$product_id,$end_date,$starting_date,$product_id));
+
+ // //print_r($this->db->last_query());
+
+
+ // return $query->result_array();
+
+
+ // }
+
+ //presented
+ function GetFinishedProductList($starting_date,$end_date,$product_id)
+ {
+
+
+ // $subQuery = 'select * from T_FinalProduct_History,ip_products.product_name
+ // join ip_products on T_FinalProduct_History.ProductCode = ip_products.product_id
+
+ // where ProductCode=?
+ // and Transactiondate >= ? and Transactiondate <= ?';
+
+ $subQuery='select RefID,ProductCode,Quantity,Price,Transactiondate,TransactionType,product_name
+ from T_FinalProduct_History
+ join ip_products on ip_products.product_id= T_FinalProduct_History.ProductCode
+ where ProductCode=? and Transactiondate >= ? and Transactiondate <= ?';
+
+ $query = $this->db->query($subQuery,array($product_id,$starting_date,$end_date));
+ return $query->result_array();
+
+ }
+
+ //presented
+ function SaveFinalHistory($final_history)
+ {
+ $this->db->trans_start();
+ $this->db->insert('T_FinalProduct_History',$final_history);
+ $insert_id = $this->db->affected_rows();
+ $this->db->trans_complete();
+ return true;
+ }
+
+ //presented
+ function UpdateFinalHistory($final_history,$FPID,$rawmaterial)
+ {
+ //print_r($final_history);
+ $this->db->where('RefID', $FPID);
+ $this->db->where('ProductCode',$rawmaterial);
+ $this->db->update('T_FinalProduct_History',$final_history);
+ //print_r($this->db->last_query());
+ return TRUE;
+ }
+
+
+ }
+
+ ?>
\ No newline at end of file
diff --git a/application/models/purchaseorder_model.php b/application/models/purchaseorder_model.php
index 4ce9fd9c..8957858d 100755
--- a/application/models/purchaseorder_model.php
+++ b/application/models/purchaseorder_model.php
@@ -23,6 +23,7 @@ class purchaseorder_model extends CI_Model
$query = $this->db->get();
return $query->result();
}
+
function getfies($pono)
{
@@ -38,16 +39,16 @@ class purchaseorder_model extends CI_Model
}
-function updateReqDetails($Reqnumber,$MaterialCode,$ReqDetail){
-$this->db->where('ReqNo',$Reqnumber);
-$this->db->where('MaterialCode',$MaterialCode);
-$this->db->update('T_Requestion_Details',$ReqDetail);
-$r = $this->db->affected_rows();
-return $r;
-}
+ function updateReqDetails($Reqnumber,$MaterialCode,$ReqDetail){
+ $this->db->where('ReqNo',$Reqnumber);
+ $this->db->where('MaterialCode',$MaterialCode);
+ $this->db->update('T_Requestion_Details',$ReqDetail);
+ $r = $this->db->affected_rows();
+ return $r;
+ }
-//function IGRDetailsupdate($PONO)
+//function IGRDetailsupdate($PONO)old file name
function getIGRDetails($PONO)
{
diff --git a/application/models/rawmaterialdetails_model.php b/application/models/rawmaterialdetails_model.php
index 1be4146b..6d3c8796 100644
--- a/application/models/rawmaterialdetails_model.php
+++ b/application/models/rawmaterialdetails_model.php
@@ -113,6 +113,39 @@ class rawmaterialdetails_model extends CI_Model
return $query->result();
}
+ function getMaterialstock($MaterialCode, $currentdate)
+ {
+
+ $dt = date('d',strtotime($currentdate));
+ $year = date('Y', strtotime($currentdate));
+ $month = date('m', strtotime($currentdate));
+
+ if($month<04)
+ {
+
+ $newyr = $year - 1;
+ $startdate = $newyr.'-'.'04'.'-'.'01';
+ }
+ else
+ {
+
+ $startdate = $year.'-'.'04'.'-'.'01';
+ }
+
+ $nedt= $dt+1;
+
+ $newdate=$year.'-'.$month.'-'.$nedt;
+
+ $subquery="SELECT SUM(IF(Transaction_type='Add',Quantity,0)) - SUM(IF(Transaction_type='Reduce',Quantity,0))as remainingqty
+ FROM T_Material_stock_history
+ WHERE MaterialCode=? AND CreatedOn >=? AND CreatedOn <=? ";
+ $query = $this->db->query($subquery,array($MaterialCode,$startdate,$newdate));
+
+ return $query->result_array();
+
+
+ }
+
function getAssetcode()
{
$this->db->select('AssetCode,AssetName');
diff --git a/application/views/MaterialHistory.php b/application/views/MaterialHistory.php
index c4d926a8..360fe8d3 100644
--- a/application/views/MaterialHistory.php
+++ b/application/views/MaterialHistory.php
@@ -52,9 +52,10 @@ table.dataTable thead > tr > td.sorting {
Siddharth Industries - Material History
+
- Material History
input->post('item_name')){
$it=$this->input->post('item_name');
echo $it;
diff --git a/application/views/addRawMaterial.php b/application/views/addRawMaterial.php
index 954cb4f4..fd284a19 100644
--- a/application/views/addRawMaterial.php
+++ b/application/views/addRawMaterial.php
@@ -6,6 +6,15 @@
outline: 1px solid slategrey;
}
+