diff --git a/application/controllers/quality.php b/application/controllers/quality.php index 447a3bba..0fc472ae 100755 --- a/application/controllers/quality.php +++ b/application/controllers/quality.php @@ -218,6 +218,7 @@ class quality extends BaseController function saveTestReportData() { + date_default_timezone_get('Asia/Kolkata'); $testjson = $this->input->post('param1'); $loijson = $this->input->post('param2'); @@ -236,8 +237,17 @@ class quality extends BaseController //print_r($afsphpdata);die(); $createdon = date('Y-m-d H:i:s'); $createby = $this->session->userdata ( 'userId' ); + $document = null; + if(!empty($_FILES['rfile']['name'])) + { + + + $fs = $this->uploadFile(); + $document = $fs; + + } - $masterreportdata = array('invoiceid'=>$invoiceno,'batchdate'=>$batchno,'createdby'=>$createby,'createdon'=>$createdon,'approvedby'=>$approver,'chartdata'=>$chart); + $masterreportdata = array('invoiceid'=>$invoiceno,'batchdate'=>$batchno,'createdby'=>$createby,'createdon'=>$createdon,'approvedby'=>$approver,'chartdata'=>$chart,'document'=>$document); $MASTERID = $this->quality_model->saveMasterTestData($masterreportdata); @@ -319,6 +329,8 @@ class quality extends BaseController function saveInwardTestReportData() { + + date_default_timezone_get('Asia/Kolkata'); $testjson = $this->input->post('param1'); $loijson = $this->input->post('param2'); @@ -339,22 +351,21 @@ class quality extends BaseController //print_r($afsphpdata);die(); $createdon = date('Y-m-d H:i:s'); $createby = $this->session->userdata ( 'userId' ); - - $masterreportdata = array('igrno'=>$igrno,'igrlineitemno'=>$igrlineitemno,'batchdate'=>$report_date,'createdby'=>$createby,'createdon'=>$createdon,'approvedby'=>$approver,'chartdata'=>$chart); + $document = null; + if(!empty($_FILES['rfile']['name'])) + { + + + $fs = $this->uploadFile(); + $document = $fs; + + } + $masterreportdata = array('igrno'=>$igrno,'igrlineitemno'=>$igrlineitemno,'batchdate'=>$report_date,'createdby'=>$createby,'createdon'=>$createdon,'approvedby'=>$approver,'chartdata'=>$chart,'document'=>$document); $MASTERID = $this->quality_model->saveMasterTestData($masterreportdata); - // $descrition = ''; - // $min = ''; - // $max = ''; - // $uom = ''; - // $act1 = ''; - // $act2 = ''; - // $act3 = ''; - // $average = ''; - // $results = ''; - // $remarks1 = ''; + foreach($testphpdata as $data) { //print_r($data);die(); @@ -456,6 +467,34 @@ class quality extends BaseController $this->loadViews("404", $this->global, NULL, NULL); } + + function uploadFile() + { + + $pathinfo = pathinfo($_FILES['rfile']['name']); + $config['upload_path'] = 'uploads/QAD/'; + $config['allowed_types'] = '*'; + $config['file_name'] = $_FILES['rfile']['name']; + $this->load->library('upload',$config); + $this->upload->initialize($config); + + + if($this->upload->do_upload('rfile')) + { + $uploadData = $this->upload->data(); + $uploadfilename = $uploadData['file_name']; + return $uploadfilename; + + } + else + { + $error = array('error' => $this->upload->display_errors()); + $uploadfilename = ''; + print_r($error); + return null; + } + + } } ?> diff --git a/application/models/quality_model.php b/application/models/quality_model.php index c994078e..b04126da 100755 --- a/application/models/quality_model.php +++ b/application/models/quality_model.php @@ -307,7 +307,7 @@ class Quality_model extends CI_Model function getTestMasterforList() { - $this->db->select('T_Test_Report_Master.testreport_id,T_Test_Report_Master.invoiceid,T_Test_Report_Master.batchdate,ip_clients.client_id,ip_clients.client_name,ip_products.product_id,ip_products.product_name,ip_products.product_description'); + $this->db->select('T_Test_Report_Master.testreport_id,T_Test_Report_Master.invoiceid,T_Test_Report_Master.batchdate,T_Test_Report_Master.document,ip_clients.client_id,ip_clients.client_name,ip_products.product_id,ip_products.product_name,ip_products.product_description'); $this->db->from('T_Test_Report_Master'); $this->db->join('ip_invoices','T_Test_Report_Master.invoiceid=ip_invoices.invoice_number'); $this->db->join('ip_clients','ip_invoices.client_id=ip_clients.client_id'); @@ -329,7 +329,7 @@ class Quality_model extends CI_Model // $res = $this->db->get(); // return $res->result(); - $this->db->select('T_Test_Report_Master.batchdate,T_Test_Report_Master.testreport_id,T_IGR_Master.IGRNO,T_IGR_Master.DeliveryChellanOrInvoiceNo,T_IGR_Master.DeliveryChellanDate,T_IGR_Details.IGRItemNo,T_IGR_Details.QuantityAsPerInvoice,T_MaterialMaster.MaterialCode,T_MaterialMaster.Materialname,T_SupplierDetailsN.SupplierID,T_SupplierDetailsN.SupplierName,T_Test_Report_Master.approvedby,T_Employee_Details.EmpID,T_Employee_Details.FirstName,T_Employee_Details.LastName'); + $this->db->select('T_Test_Report_Master.batchdate,T_Test_Report_Master.testreport_id,T_IGR_Master.IGRNO,T_IGR_Master.DeliveryChellanOrInvoiceNo,T_IGR_Master.DeliveryChellanDate,T_IGR_Details.IGRItemNo,T_IGR_Details.QuantityAsPerInvoice,T_MaterialMaster.MaterialCode,T_MaterialMaster.Materialname,T_SupplierDetailsN.SupplierID,T_SupplierDetailsN.SupplierName,T_Test_Report_Master.approvedby,T_Test_Report_Master.document,T_Employee_Details.EmpID,T_Employee_Details.FirstName,T_Employee_Details.LastName'); $this->db->from('T_Test_Report_Master'); $this->db->join('T_IGR_Master','T_Test_Report_Master.igrno=T_IGR_Master.IGRNO'); $this->db->join('T_IGR_Details','T_Test_Report_Master.igrlineitemno=T_IGR_Details.IGRItemNo'); diff --git a/application/views/inward_report_create.php b/application/views/inward_report_create.php index c0fa3ba6..06248b5a 100755 --- a/application/views/inward_report_create.php +++ b/application/views/inward_report_create.php @@ -1,4 +1,4 @@ - +