$user_id = $this->session->userdata('user_id'); 

        $condition[] = array('where','tracking_number',$tracking_number);
        $selected_array=array(
                              'table_name'=>TABLE_TRACKING_NUMBERS,
                               'table_fields'=>'is_status,tracking_number',
                                'condition'=>$condition,
                                'limit'=>'',
                                'offset'=>''
                            );
		$check_track['check_track'] = $this->master_model->select_data($selected_array);
		//dump($this->db->last_query());
		
		if(!empty($check_track['check_track'] )&& is_array($check_track['check_track']))
		{

			$this->session->set_flashdata('message','Dispenser already Returned');
			redirect('gc/dispenser_sale_data/search_return_dispenser');
				
		}else{
			    $return_data =array(
								//'tracking_number' =>$tracking_number,
								//'product_id' =>$product_id,
								'possessed_by' =>$company_branch_id,
								'is_status'=>'Company'
								
								
					    );
			    $return_details =array(
								'refill_date' =>'0000-00-00',
								'next_refill_date' =>'0000-00-00',
								'is_returned'=>'yes',
								'comments'=>$comments,
								'modified_by'=>$user_id
																
					    );
 				$condition_track=array('tracking_numbers_id'=>$tracking_numbers_id);
			     $this->master_model->update_record(TABLE_TRACKING_NUMBERS,$return_data,$condition_track);				
				$condition=array('tracking_numbers_id'=>$tracking_numbers_id);
				$this->master_model->update_record(TABLE_TRACKING_DETAILS, $return_details,$condition);
				$this->session->set_flashdata('message','Dispenser returned successfully');
				redirect('gc/dispenser_sale_data/search_return_dispenser');
		}