From 9974c6257007585fbd988c720ad9be0494a52e0d Mon Sep 17 00:00:00 2001 From: "venbatechnologies@gmail.com" Date: Tue, 6 Mar 2018 11:04:28 +0530 Subject: [PATCH] raw material auto complete box changes --- .../controllers/rawmaterialdetails.php | 69 +- .../models/rawmaterialdetails_model.php | 27 + application/views/addRawMaterial.php | 232 ++--- application/views/addRawMaterial0.php | 373 ++++++++ application/views/editRawmaterial.php | 263 +++--- assets/Autocomplete/countries.js | 1 + assets/Autocomplete/jquery.autocomplete.js | 833 ++++++++++++++++++ 7 files changed, 1563 insertions(+), 235 deletions(-) create mode 100755 application/views/addRawMaterial0.php create mode 100644 assets/Autocomplete/countries.js create mode 100644 assets/Autocomplete/jquery.autocomplete.js diff --git a/application/controllers/rawmaterialdetails.php b/application/controllers/rawmaterialdetails.php index f7640021..624c8865 100644 --- a/application/controllers/rawmaterialdetails.php +++ b/application/controllers/rawmaterialdetails.php @@ -123,10 +123,10 @@ class rawmaterialdetails extends BaseController */ function addNewRawMaterial() { - + $TempArr = []; $this->form_validation->set_rules('MaterialName','Material Name','trim|required|'); $this->form_validation->set_rules('MaterialType','MaterialType','trim|callback_MaterialType_validate'); - $this->form_validation->set_rules('MaterialCategory','MaterialCategory','trim|callback_materialcategory_validate'); + // $this->form_validation->set_rules('MaterialCategory','MaterialCategory','trim|callback_materialcategory_validate'); $this->form_validation->set_rules('UOM','UOM','trim|callback_UOM_validate'); if($this->form_validation->run() == FALSE) @@ -138,7 +138,26 @@ class rawmaterialdetails extends BaseController $MaterialName = $this->input->post('MaterialName');//print_r($MaterialName); $MaterialType = $this->input->post('MaterialType'); $UOM = $this->input->post('UOM'); - $MaterialCategory = $this->input->post('MaterialCategory'); + //$MaterialCategory = $this->input->post('MaterialCategory'); + $MaterialCategory = $this->input->post('MatCate'); + $materialcategoryarray = $this->rawmaterialdetails_model->getmaterialCategory(); + + foreach($materialcategoryarray as $mc){ + $TempArr[] = $mc->ConfigValue; + + } + //print_r($TempArr); + if (in_array($MaterialCategory, $TempArr)) + { + //echo "Match found"; + } +else + { + //echo "Match not found"; + $configcode = 'C023'; + $config = array('Config_ID'=>$configcode,'ConfigValue'=>$MaterialCategory); + $query= $this->rawmaterialdetails_model->insertvalueintoconfig($config); + } $Remarks = $this->input->post('remarks'); $asset = $this->input->post('Assetcode');//print_r($AssetCode); $costcentercode = $this->input->post('Costcenter');//print_r($CostCenterCode); @@ -267,7 +286,26 @@ class rawmaterialdetails extends BaseController $MaterialCode = $this->input->post('MaterialCode'); $MaterialName = $this->input->post('MaterialName'); $MaterialType = $this->input->post('MaterialType'); + //$MaterialCategory =$this->input->post('MaterialCategory'); $MaterialCategory =$this->input->post('MaterialCategory'); + $materialcategoryarray = $this->rawmaterialdetails_model->getmaterialCategory(); + + foreach($materialcategoryarray as $mc){ + $TempArr[] = $mc->ConfigValue; + + } + //print_r($TempArr); + if (in_array($MaterialCategory, $TempArr)) + { + //echo "Match found"; + } +else + { + //echo "Match not found"; + $configcode = 'C023'; + $config = array('Config_ID'=>$configcode,'ConfigValue'=>$MaterialCategory); + $query= $this->rawmaterialdetails_model->insertvalueintoconfig($config); + } $UOM = $this->input->post('UOM'); $rmcode = $this->input->post('RMcode'); $Remarks = $this->input->post('remarks'); @@ -338,6 +376,31 @@ class rawmaterialdetails extends BaseController } } + function autocomplete() +{ + + $this->load->model('model','rawmaterialdetails_model'); + + $mc = $this->input->get('query'); + + $query= $this->rawmaterialdetails_model->checkMaterialCategory($mc); + + echo json_encode($query); + +} + +function insertvalueintoconfig(){ + $this->load->model('model','rawmaterialdetails_model'); + $mc = $this->input->post('id'); + $configcode = 'C023'; + $config = array('Config_ID'=>$configcode,'ConfigValue'=>$mc); + + $query= $this->rawmaterialdetails_model->insertvalueintoconfig($config); + + + +} + /** * To Check and display the already existing material list */ diff --git a/application/models/rawmaterialdetails_model.php b/application/models/rawmaterialdetails_model.php index 6cdf331e..6ee7bdc7 100644 --- a/application/models/rawmaterialdetails_model.php +++ b/application/models/rawmaterialdetails_model.php @@ -185,5 +185,32 @@ class rawmaterialdetails_model extends CI_Model // $this->db->update('T_PurchaseOrderDetails', $POInfo); // return $this->db->affected_rows(); // } + + function insertvalueintoconfig($config){ + + $this->db->insert('T_ConfigDetails', $config); + return TRUE; + } + + function checkMaterialCategory($mc){ + + $temp[] = '' ; + $temparr[] = '' ; + + $this->db->distinct(); + $this->db->select('ConfigValue'); + $this->db->from('T_ConfigDetails'); + $this->db->where('Config_ID','C023'); + $this->db->like('ConfigValue',$mc); + + $query = $this->db->get(); + + foreach($query->result() as $arr){ + $temparr[] = $arr->ConfigValue ; + } + + $temp['suggestions'] = $temparr; + return $temp; + } } ?> \ No newline at end of file diff --git a/application/views/addRawMaterial.php b/application/views/addRawMaterial.php index 28849065..bde8c77b 100644 --- a/application/views/addRawMaterial.php +++ b/application/views/addRawMaterial.php @@ -1,55 +1,12 @@ - + +
@@ -79,7 +36,7 @@ function BlockSpecial(evt) {
* - +
@@ -104,7 +61,16 @@ function BlockSpecial(evt) {
-
+
+
+ * + + + +
+
+ +
@@ -243,41 +209,103 @@ function BlockSpecial(evt) {
-
- load->helper('form'); - $error = $this->session->flashdata('error'); - if($error) - { - ?> -
- - session->flashdata('error'); ?> -
- - session->flashdata('success'); - if($success) - { - ?> -
- - session->flashdata('success'); ?> -
- - -
-
- ', '
'); ?> -
-
-
\ No newline at end of file diff --git a/application/views/addRawMaterial0.php b/application/views/addRawMaterial0.php new file mode 100755 index 00000000..ce720616 --- /dev/null +++ b/application/views/addRawMaterial0.php @@ -0,0 +1,373 @@ + + +
+ +
+

+ +
Siddharth Industries - Add New Material
+ +

+ +
+ +
+
+ Back +
+
+
+ +
+ +
+ + + +
+ + +
+
+
+
+ * + +
+
+ +
+
+ * + +
+
+ + + +
+
+ * + + + +
+
+ +
+
+ * + +
+
+
+ +
+ +
+
+ + +
+
+ +
+
+ + +
+
+
+
+ + +
+
+
+
+ + +
+
+
+
+
+
+ + +
+
+
+
+ + +
+
+
+
+
+ +
+
+
+ +
+ + +
+
+
+
+ load->helper('form'); + $error = $this->session->flashdata('error'); + if($error) + { + ?> +
+ + session->flashdata('error'); ?> +
+ + session->flashdata('success'); + if($success) + { + ?> +
+ + session->flashdata('success'); ?> +
+ + +
+
+ ', '
'); ?> +
+
+
+
+ + + + + \ No newline at end of file diff --git a/application/views/editRawmaterial.php b/application/views/editRawmaterial.php index ae0679e4..20bd2af0 100644 --- a/application/views/editRawmaterial.php +++ b/application/views/editRawmaterial.php @@ -46,99 +46,15 @@ if(!empty($materialDetails)) ?> - - - + +
@@ -208,11 +124,17 @@ function changeTextBox() {
-
+
+
+ * + +
+
+ +
- + -->
@@ -354,41 +276,132 @@ function changeTextBox() {
-
- load->helper('form'); - $error = $this->session->flashdata('error'); - if($error) - { - ?> -
- - session->flashdata('error'); ?> -
- - session->flashdata('success'); - if($success) - { - ?> -
- - session->flashdata('success'); ?> -
- - -
-
- ', '
'); ?> -
-
- +
+