db->select('product_id,product_name,product_description'); $this->db->from('ip_products'); $result = $this->db->get(); return $result->result(); } function getAllcustomers() { $this->db->select('client_id,client_name'); $this->db->from('ip_clients'); $result = $this->db->get(); return $result->result(); } function getAllTestReports() { $this->db->select('masterreport_id,productid,ip_products.product_name,customerid,ip_clients.client_name,batchno,batchdate,document'); $this->db->join('ip_products','T_Inprocess_Testreport_Master.productid=ip_products.product_id'); $this->db->join('ip_clients','T_Inprocess_Testreport_Master.customerid=ip_clients.client_id'); $this->db->from('T_Inprocess_Testreport_Master'); $result = $this->db->get(); return $result->result(); } function getSpecifications($productid,$customerid) { //echo 'from model'.$productid.'-'.$customerid; // $this->db->where('product_id',$productid); // $this->db->where('customer_id',$customerid); // $res = $this->db->get('T_Prodcut_Specification_Master'); $sql = "Select * from T_Prodcut_Specification_Master where product_id = ? and customer_id = ?"; $res = $this->db->query($sql,array($productid,$customerid)); // print_r($this->db->last_query()); return $res->result(); //print_r($res->result()); } 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 saveMasterTestData($masterreportdata) { $this->db->insert('T_Inprocess_Testreport_Master',$masterreportdata); $id = $this->db->insert_id(); return $id; } function saveTestReportData($testreportdata) { foreach($testreportdata as $data) { $this->db->insert('T_Inprocess_Testreport',$data); //$row = $this->db->affected_rows(); //return $row; //print_r($data); } } function saveTestReportAFSData($afstabledata) { $this->db->insert('T_Inprocess_AFSTestreport',$afstabledata); $row = $this->db->affected_rows(); //return $row; } function saveTestReportLOIData($loitabledata) { $this->db->insert('T_Inprocess_LOITestreport',$loitabledata); $row = $this->db->affected_rows(); //return $row; } function getIndividualInprocessReportData($reportid) { $this->db->select('T_Inprocess_Testreport_Master.*,ip_clients.client_name,ip_products.product_name,ip_products.product_description,T_Employee_Details.FirstName,T_Employee_Details.LastName'); $this->db->from('T_Inprocess_Testreport_Master'); $this->db->join('ip_clients','T_Inprocess_Testreport_Master.customerid=ip_clients.client_id'); $this->db->join('ip_products','T_Inprocess_Testreport_Master.productid=ip_products.product_id'); $this->db->join('tbl_users','T_Inprocess_Testreport_Master.createdby=tbl_users.userid'); $this->db->join('T_Employee_Details','tbl_users.EmpID=T_Employee_Details.EmpID'); $this->db->where('T_Inprocess_Testreport_Master.masterreport_id',$reportid); $res = $this->db->get(); $reportdata['master'] = $res->result(); $this->db->select('T_Inprocess_Testreport.*,T_Prodcut_Specification_Master.testtype,T_Prodcut_Specification_Master.min,T_Prodcut_Specification_Master.max,T_Prodcut_Specification_Master.uom'); $this->db->from('T_Inprocess_Testreport'); $this->db->join('T_Prodcut_Specification_Master','T_Inprocess_Testreport.specid=T_Prodcut_Specification_Master.productspecmaster_id'); $this->db->where('masterreport_id',$reportid); $res1 = $this->db->get(); $reportdata['masterreport'] = $res1->result(); $this->db->select('T_Inprocess_LOITestreport.*'); $this->db->from('T_Inprocess_LOITestreport'); $this->db->where('masterreport_id',$reportid); $res1 = $this->db->get(); $reportdata['masterreportloi'] = $res1->result(); $this->db->select('T_Inprocess_AFSTestreport.*'); $this->db->from('T_Inprocess_AFSTestreport'); $this->db->where('masterreport_id',$reportid); $res1 = $this->db->get(); $reportdata['masterreportafs'] = $res1->result(); $this->db->select('T_Company_Details.CompanyName,T_Company_Details.Address,T_Company_Details.ProfilePic'); $this->db->from('T_Company_Details'); //$this->db->where('testreport_id',$reportid); $res1 = $this->db->get(); $reportdata['company'] = $res1->result(); return $reportdata; } function getTestMasterforList() { $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'); $this->db->join('ip_invoice_items','ip_invoices.invoice_id=ip_invoice_items.invoice_id'); $this->db->join('ip_products','ip_products.product_id=ip_invoice_items.item_product_id'); //$this->db->where('T_Test_Report_Master.invoiceid','!=0'); $res = $this->db->get(); return $res->result(); } function updateMasterTestData($masterreportdata,$masterid) { $this->db->where('masterreport_id',$masterid); $this->db->update('T_Inprocess_Testreport_Master',$masterreportdata); } function updateTestReportData($testreportdata,$masterid,$specid) { foreach($testreportdata as $data) { $this->db->where('masterreport_id',$masterid); $this->db->where('specid',$specid); $this->db->where('iteration',$data['iteration']); $this->db->where('subtype',$data['subtype']); $this->db->update('T_Inprocess_Testreport',$data); //echo $this->db->last_query(); } } function updateTestReportAFSData($afstabledata,$masterid,$ssize,$factor) { $this->db->where('masterreport_id',$masterid); $this->db->where('sieve_size',$ssize); $this->db->where('factor',$factor); $this->db->update('T_Inprocess_AFSTestreport',$afstabledata); // echo $this->db->last_query(); } function updateTestReportLOIData($loitabledata,$masterid,$loidetails) { $this->db->where('masterreport_id',$masterid); $this->db->where('loidetails',$loidetails); $this->db->update('T_Inprocess_LOITestreport',$loitabledata); //echo $this->db->last_query(); } //FOR NISSAN INPROCESS function updateNissanMasterTestData($masterreportdata,$masterid) { //echo "from model"; //print_r($masterreportdata);die(); $this->db->where('masterreport_id',$masterid); $this->db->update('T_Inprocess_Testreport_Master',$masterreportdata); } function updateNissanTestReportData($testreportdata,$masterid,$specid) { foreach($testreportdata as $data) { $this->db->where('masterreport_id',$masterid); $this->db->where('specid',$specid); $this->db->where('iteration',$data['iteration']); $this->db->where('subtype',$data['subtype']); $this->db->update('T_Inprocess_Testreport',$data); //echo $this->db->last_query(); } } function updateNissanTestReportAFSData($afstabledata,$masterid,$ssize,$factor) { $this->db->where('masterreport_id',$masterid); $this->db->where('sieve_size',$ssize); $this->db->where('factor',$factor); $this->db->update('T_Inprocess_AFSTestreport',$afstabledata); // echo $this->db->last_query(); } function updateNissanTestReportLOIData($loitabledata,$masterid,$loidetails) { $this->db->where('masterreport_id',$masterid); $this->db->where('loidetails',$loidetails); $this->db->update('T_Inprocess_LOITestreport',$loitabledata); //echo $this->db->last_query(); } } ?>