public function save()
 {
     $valid = $this->_submit_validate();
     $access_level = $this->session->userdata('user_indicator');
     $source = 0;
     if ($access_level == "pharmacist") {
         $source = $this->session->userdata('facility');
     }
     $non_arv = 0;
     $tb_drug = 0;
     $drug_in_use = 0;
     $supplied = 0;
     if ($this->input->post('none_arv') == "on") {
         $non_arv = 1;
     }
     if ($this->input->post('tb_drug') == "on") {
         $tb_drug = 1;
     }
     if ($this->input->post('drug_in_use') == "on") {
         $drug_in_use = 1;
     }
     //get drug instructions
     $instructions = $this->input->post('instructions_holder', TRUE);
     if ($instructions == null) {
         $instructions = "";
     }
     $drugcode = new Drugcode();
     $drugcode->Drug = $this->input->post('drugname');
     $drugcode->Unit = $this->input->post('drugunit');
     $drugcode->Pack_Size = $this->input->post('packsize');
     $drugcode->Safety_Quantity = $this->input->post('safety_quantity');
     $drugcode->Generic_Name = $this->input->post('genericname');
     $drugcode->Supported_By = $this->input->post('supplied_by');
     $drugcode->classification = $this->input->post('classification');
     $drugcode->none_arv = $non_arv;
     $drugcode->Tb_Drug = $tb_drug;
     $drugcode->Drug_In_Use = $drug_in_use;
     $drugcode->Comment = $this->input->post('comments');
     $drugcode->Dose = $this->input->post('dose_frequency');
     $drugcode->Duration = $this->input->post('duration');
     $drugcode->Quantity = $this->input->post('quantity');
     $drugcode->Strength = $this->input->post('dose_strength');
     $drugcode->map = $this->input->post('drug_mapping');
     $drugcode->Source = $source;
     $drugcode->instructions = $instructions;
     $drugcode->save();
     //$this -> session -> set_userdata('message_counter', '1');
     $this->session->set_userdata('msg_success', $this->input->post('drugname') . ' was successfully Added!');
     $this->session->set_flashdata('filter_datatable', $this->input->post('drugname'));
     //Filter after saving
     redirect('settings_management');
 }