public function update_delivery_status()
 {
     $delivery = $this->uri->segment(3);
     $data['order'] = $delivery;
     $data['order_ord'] = Kemsa_Order_Details::get_order($delivery);
     $data['batch_no'] = Kemsa_Order::get_batch_no($delivery);
     $data['title'] = "Update Delivery Status";
     $data['content_view'] = "update_delivery_status_v";
     $data['banner_text'] = "Update Status";
     $data['link'] = "order_management";
     $data['quick_link'] = "all_deliveries";
     $this->load->view("template", $data);
 }
 function update_stock_level()
 {
     $order_dispatched = $_POST['order_dispatched'];
     $kemsa_order_no = $_POST['kemsa_order_no'];
     $r_name = $_POST['r_name'];
     $r_pin = $_POST['r_pin'];
     $r_phone = $_POST['r_phone'];
     $order_deliver = $_POST['deliver_date'];
     $drugs_stock = Kemsa_Order_Details::get_stock_to_update($kemsa_order_no);
     $count = $drugs_stock->Count();
     $data_array = $drugs_stock->toArray();
     for ($i = 0; $i < $count; $i++) {
         $mydata = array_merge($data_array[$i], array('facility_code' => 17948));
         Facility_Stock::update_facility_stock($mydata);
     }
     /*$count=1;
     		$data_array=NULL;
     		foreach($drugs_stock as $drug){
     			if($count==1){ 
     			 $data=array('facility_code'=>17948,
     			 'kemsa_code'=>$drug->kemsa_code,
     			 'batch_no'=>$drug->batch_no,
     			 'manufacture'=>$drug->manufacture,
     			 'expiry_date'=>$drug->expiry_date,
     			 'quantity'=>$drug->quantity);
     			
     			 $data_array=array(); 
     			 
     			 $data_array=array_merge($data,$data_array);
     			  
     			 $count++;
     			}
     			else{
     				
     			$data=array('facility_code'=>17948,
     			 'kemsa_code'=>$drug->kemsa_code,
     			 'batch_no'=>$drug->batch_no,
     			 'manufacture'=>$drug->manufacture,
     			 'expiry_date'=>$drug->expiry_date,
     			 'quantity'=>$drug->quantity);
     			 $data_array=array_merge($data,$data_array);
                 }
             
     		}
     		print_r($data_array);
     		exit;
     		    $status=*/
     if ($status == TRUE) {
         redirect('stock_management/stock_level');
     }
 }