<link href="<?php echo base_url(); ?>assets/autocomplete/jquery-ui.css" rel="stylesheet">
    <link href="<?php echo base_url(); ?>assets/autocomplete/ui.theme.css" rel="stylesheet">
    <link href="<?php echo base_url(); ?>assets/autocomplete/autocomplete.css" rel="stylesheet">
    <script src="<?php echo base_url(); ?>assets/autocomplete/jquery-ui.min.js"></script>
	

         <script type="text/javascript">
  
		
		
		
			 $(document).ready(function() { 
			   $("#mysupplier").hide();
               $("#myproject").hide();
         

					});
					

				
		         $(function () {
        $("#transferto").change(function () {
            if ($(this).val() == "Customer") {
            
			
               $("#mysupplier").show();
             $("#myproject").hide();
            document.getElementById("myprojects").value = "";

            } else {
               					
             
             $("#myproject").show();
  $("#mysupplier").hide();
                        document.getElementById("mysuppliers").value = "";

			
            }
        });
    });
		
		
		
		
		
		
		$(this).ready( function() {  
            $("#mysuppliers").autocomplete({  
 
                minLength: 1,  
                source:   
                function(req, add){  
                    $.ajax({  
                        url: "<?php echo base_url(); ?>Systemusers/customerSaleslookup",  
                        dataType: 'json',  
                        type: 'POST',  
                        data: req,  
                        success:      
                        function(data){  
                            if(data.response =="true"){  
                                add(data.message);  
                                console.log(data);
                            }  
                        },  
                    });  
                },  
                     
            });  
        });
		
		
		
		
		
		$(this).ready( function() {  
            $("#myprojects").autocomplete({  
 
                minLength: 1,  
                source:   
                function(req, add){  
                    $.ajax({  
                        url: "<?php echo base_url(); ?>Systemusers/Projectlookup",  
                        dataType: 'json',  
                        type: 'POST',  
                        data: req,  
                        success:      
                        function(data){  
                            if(data.response =="true"){  
                                add(data.message);  
                                console.log(data);
                            }  
                        },  
                    });  
                },  
                     
            });  
        });
		
		
		
		
		
		
		
		
		
		
		
		 $(document).on("click", "#managebtndelete", function()
        {
          var itemid = $(this).data('id');
		  $("#itemid1").val(itemid); 
		  
		  
		   
        });
		$(document).on("click", "#editbtn", function()
        {
          var mycategoryid = $(this).data('id');
		  $("#mycategoryid").val(mycategoryid); 
		   
		     var status = $(this).data('status');
		   $("#status").val(status); 
 
		    var name = $(this).data('name');
		   $("#name").val(name); 
		   
		     var description = $(this).data('description');
		   $("#description").val(description); 
		 
		  
		  
		   
        });
		
		
			 $(document).on("click", "#approvebtn", function()
        {
          var aprrovalid = $(this).data('id');
		  $("#aprrovalid").val(aprrovalid); 
		   var aprrovalinvoice = $(this).data('invoice');
		  $("#aprrovalinvoice").val(aprrovalinvoice); 
		  
		  
		   
        });
		
    </script>   
 
 <div class="row">
  
   				
			

   	<div class="col-md-10">
	
  
		<div class="panel panel-default" data-collapsed="0">
        	<div class="panel-heading">
            	<div class="panel-title" id="redcolor" >
            		<i class="entypo-plus-circled"></i>
						 <span class="pull-right"> <br> View bulk dispatch to branch	</span>	
  								<a data-toggle='modal' data-target='#dispatchModal' class="btn btn-default">Branch Bulk dispatch</a>
						<a data-toggle='modal' data-target='#bulkreceivingModal' class="btn btn-success"> Bulk Product Receiving</a>
						<a data-toggle='modal' data-target='#projectdispatchModal' class="btn btn-info">Bulk/Departmental  dispatch</a>


	  	  				 <a href="<?php echo base_url();?>user/viewproducts" class="btn btn-default"> Back to Products</a>

				
            	</div>
            </div>
			<div class="panel-body">

				<div class="widget-content nopadding table_holder table-responsive" >				
	<?PHP

 $session_data = $this->session->userdata('logged_in');

   
 	$data['id'] = $session_data['id'];
        
		 $userid = $data['id'];

 $data['companyid'] = $session_data['companyid'];
	 $companyid = $data['companyid'];
		 $data['usertype'] = $session_data['usertype'];
	 $usertype = $data['usertype'];	
	  echo $this->session->flashdata('deletemsg'); 

				echo $this->session->flashdata('msg'); 
				     echo $this->session->flashdata('productmsg'); 

				   $data['branchid'] = $session_data['branchid'];
	 $branchid = $data['branchid'];
	     $approverequest=$this->usermodel->populatuserpermissionsdataarray('humanresource','approve',$userid);

								?>	
										
					<div class="row">
						<div class="col-md-12">
							
							<div class="panel-body">
		<div class="col-md-12">
        <?php 
		
        $attr = array("class" => "form-horizontal", "role" => "form", "id" => "search", "name" => "search");
        echo form_open("user/searchalldispatch", $attr);?>
            <div class="form-group">
			
                <div class="col-md-5">
                    <input class="form-control" id="searchterm"  autofocus name="searchterm" placeholder="Search for product by name, code,description.." type="text" value="<?php echo set_value('searchterm'); ?>" />
                </div>
                <div class="col-md-4">
                    <input id="btn_search" name="btn_search" type="submit" class="btn btn-default" value="Search" />
                    <a href="<?php echo base_url(). "user/viewbulkdispatch"; ?>" class="btn btn-default">Refresh</a>
                </div>
				 
            </div>
        <?php echo form_close(); ?>

        </div>
									
									
  <table cellpadding="0" cellspacing="0" border="0" class="table  table-striped" id="example" style="border-color:#CCCCCC; width:100%;"  >

             <thead>
         <tr>
		       <th>Dispatch No</th>
		      <th>Dispatch Date</th>

     <th>Invoice</th>
     <th>Approver</th>
	     <th>Description</th>
		 
<th>Type</th>		 
		<th>Started By</th>		 
	<th>From</th>		 
	<th>To</th>		 
<th>Category</th>		 
<th>Status</th>		 

	<th>More</th>	

                 </tr>
             </thead><tbody>
<?php
 if(!is_array($bulkdispatch)) {
				    echo '<div class="alert alert-danger text-center">There was no group/ category found in the system. Please create group/category first</div>';

			 }else{
 if(!is_array($bulkdispatch)) 

 {


   echo "<tr  style='margin-bottom:0px;margin-top:0px;' '>";
      echo "<td colspan='1'>";
    
       echo '<div class="alert alert-warning text-center">There no records found..</div>';
    echo "</td>";
   echo "</tr>";
    }else {
?>
    
             <?php 
  
  	foreach ($bulkdispatch as $c): 

		 

             ?>



             <tr>
                
            <?php 
$id=$c->id;


?>
  <td><?php echo $c->id ; ?>
  
	  <a  id="more" class="btn btn-success" href="<?php echo base_url();?>user/bulkdispatch?invoice=<?php   {echo  $c->invoice ;}  ?>&type=<?php   {echo  $c->type ;}  ?>&frombranch=<?php   {echo  $c->frombranch ;}  ?>&tobranch=<?php   {echo  $c->tobranch ;}  ?>&status=<?php   {echo  $c->status ;}  ?>&category=<?php   {echo  $c->category ;}  ?>&salestype=retail">


                                                <i class="glyphicon glyphicon-pencil"></i>
															View  dispatched
                                                </a>
  </td>          

  <td><?php echo $c->startdate ; ?></td>          

    
  <td><?php echo $c->invoice ; ?></td>          

  <td><?php

 $approver = $this->usermodel->populateallarray('people','id',$c->name);
  if($approver !=false){
	  
	  echo $approver[0]["firstname"];
  }else{
	   echo $c->name ;
	  
  }








  ?></td>
    <td><?php echo $c->description ; ?></td>
	  <td><?php echo $c->type ; ?></td>
	  	  <td><?php 


 $startedby = $this->usermodel->populateallarray('people','id',$c->userid);
  if($startedby !=false){
	  
	  echo $startedby[0]["firstname"];
  }else{
	   echo $c->userid ;
	  
  }







		  ?></td>
  	  <td><?php 
	  if($c->frombranch=="Main"){
		  
		  echo $c->frombranch ;
		  
	  	  }else{
		$myallbranch = $this->usermodel->populateallarray('branch','id',$c->frombranch);

					echo $allbranch=$myallbranch[0]["name"];  
		  
	  }


	
			










	  ?></td>

  	  <td><?php 
	  if($c->category =="Project"){
		  $allbranch = $this->usermodel->populateallarray('projects','id',$c->tobranch);

					echo $allbranch=$allbranch[0]["name"];
		  
	  }else 	  if($c->category =="Customer"){
  $allbranch = $this->usermodel->populateallarray('people','id',$c->tobranch);

					echo $allbranch=$allbranch[0]["company"]. " " .$allbranch[0]["firstname"];

	  }else{
		$allbranch = $this->usermodel->populateallarray('branch','id',$c->tobranch);

					echo $allbranch=$allbranch[0]["name"];  
		  
	  }

  		
 


	  ?></td>
	  	  <td><?php echo $c->category ; ?></td>
  <td><?php echo $c->remarks ; ?></td>          

	 <td> 

 
 
					<div class="btn-group">
                                    <button type="button" class="btn btn-primary btn-sm dropdown-toggle" data-toggle="dropdown">
                                        More <span class="caret"></span>
                                    </button>
									
                                    <ul class="dropdown-menu dropdown-primary pull-right" role="menu">
                                        
                                        <!-- teacher EDITING LINK -->
                                      
									  
									  				<?php
										//
										if($approverequest==TRUE){
											if($c->remarks !="Approved"){
											?>
											
                                     	  <li> 

	 <a class="btn btn-default approvebtn" id="approvebtn" data-invoice='<?php echo  $c->invoice;?>'   data-id='<?php echo  $c->id;?>' data-toggle='modal' data-target='#approveModal'> 	 

                                                <i class="glyphicon glyphicon-pencil"></i>
																Approve / Reject
                                                </a>
                                                        </li>
															<?php
											}
										}
										?>
										      <li class="divider"></li>
                                           
									  
									  
									  
										<?php
										if($usertype=="admin"){
											
											?>
											 <!-- <li> 
										 <a class="btn btn-danger managebtn" id="managebtndelete"		 data-id='<?php echo  $c->id;?>'    data-toggle='modal' data-target='#myModal<?php  $c->id; ?>'>	 

//
                                                <i class="glyphicon glyphicon-pencil"></i>
																Delete
                                                </a>
                                                        </li>
									-->
									
                                        <li class="divider"></li>
                                        
                                     	  <li> 

	 <a class="btn btn-primary editbtn" id="editbtn"   data-name='<?php echo  $c->name;?>' data-status='<?php echo  $c->status;?>' data-description='<?php echo  $c->description;?>'  data-id='<?php echo  $c->id;?>' data-toggle='modal' data-target='#editProductModel'> 	 

                                                <i class="glyphicon glyphicon-pencil"></i>
																Update
                                                </a>
                                                        </li>
                                        	<?php
										}
										?>
										
										    <li class="divider"></li>
                                             
                                     	  <li> 
	 	 <a  id="more" class="btn btn-success" href="<?php echo base_url();?>user/bulkdispatch?invoice=<?php   {echo  $c->invoice ;}  ?>&type=<?php   {echo  $c->type ;}  ?>&frombranch=<?php   {echo  $c->frombranch ;}  ?>&tobranch=<?php   {echo  $c->tobranch ;}  ?>&status=<?php   {echo  $c->status ;}  ?>&category=<?php   {echo  $c->category ;}  ?>&salestype=retail">


                                                <i class="glyphicon glyphicon-pencil"></i>
															View products dispatched
                                                </a>
                                                        </li>
																
									  <li class="divider"></li>
                                        <li> 
	 <a  id="more" class="btn btn-primary" href="<?php echo base_url();?>user/printgrn?invoice=<?php     if(isset($c->invoice)) {echo $c->invoice; } ?>&type=dispatched">  
								 

                                                <i class="glyphicon glyphicon-pencil"></i>
																Print GRN
                                                </a>
																		
										</li>
												
                                    </ul>
										
                                    </ul>
										
                                </div>
</td>
		 
		 
		 
             </tr>

	<?php endforeach;} ?>

              <?php }?>
<tbody>
        </table>
  <div class="col-md-12 text-center">    <?php echo $links; ?>
					   		<span style="color:red; font-size:20px"><?php  echo $total_rows. "   Product in the system. " ;?>    </span>

        
        </div>
					
									
									
									
					</div>	

					
					
					
					
							
							
					<div id="approveModal" class="modal fade" role="dialog">
  <div class="modal-dialog">

    <!-- Modal content-->
    <div class="modal-content">
      <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal">&times;</button>
        <h4 class="modal-title">Approval</h4>
      </div>
      <div class="modal-body">
        <h3>Are you sure you want to process this application? </h3>
      </div>
      <div class="modal-footer">
	  	

     
		<?PHP
				$session_data = $this->session->userdata('logged_in');
 echo $this->session->flashdata('deletemsg'); 

		
                 echo form_open('user/approvedispatch' , array('class' => 'form-horizontal ', 'enctype' => 'multipart/form-data'));
				 if(validation_errors()):?>
<div class='alert alert-danger text-center'><?php echo validation_errors(); ?></div>
<?php endif;?>
 <input type="hidden" id="table"name="table" class="table" placeholder="view" value="bulkdispatch">

 <input type="hidden" id="view"name="view" class="view" placeholder="view" value="user/viewbulkdispatch">

 
 
 
   
   	<div class="form-group">
    <label for="inputstatus" class="col-sm-2 control-label">Status	 </label>
    <div class="col-sm-10">
	
	<select class="form-control" name="status" required >
	
	<option value=""  selected="selected">---Select Status---</option>
	<option value="Approved"  >Final Approved</option>
		<option value="TemporaryApproved"  >Temporary Approved</option>
		<option value="Rejected"  >Rejected</option>
				<option value="Progress"  >Progress</option>
								<option value="Active"  >Active</option>

								<option value="Returned"  >Returned</option>

	</select>		 
				
		<span class="text-danger"> <?php echo form_error('status'); ?>
		
		</span>
	</div>
  </div>
  
  
	<div class="form-group">
    <label for="inputdescription" class="col-sm-2 control-label">	Comments</label>
    <div class="col-sm-10">

				<textarea name="description" value="<?php echo set_value('description'); ?>"  class="form-control"  placeholder="Enter any comments"></textarea>
			
		<span class="text-danger"> <?php echo form_error('description'); ?>
		
		</span>
	</div>
  </div>
		
 
 
 
 <div class="form-group">
    <label for="inputapproval" class="col-sm-2 control-label">Approval	SMS  to?</label>
    <div class="col-sm-10">
	<select class="form-control" name="approval" style ="width: 100%"  >
	
	<option value=""  >---Select task owner---</option>
			
				<option value="No"  >Don't send sms alert</option>

			
	
	
	
	<?php 
				
							$allusers  = $this->usermodel->populatealldatanoarrayorderby('people','firstname',"asc",'status', 1,'category', 'user');

	
	 						//$allusers = $this->usermodel->populatealldatanoarraythree('people', 'companyid',$companyid,'status',1,'category','user');

	
if(is_array($allusers)) {

   foreach($allusers as $userrow){

   //echo $courserow->coursename;
    ?>
					<option value="<?=  $userrow->id;   ?>"><?=  $userrow->firstname ."- ".$userrow->surname ."(". $userrow->phone.")"; ?></option>



	<?php

}} else {
    echo 'No user available.';
}
	
?>
</select>
		
						<span class="text-danger"><?php echo form_error('taskowner'); ?>

	</div>
  </div>
  
 
 
 
 
 <input type="hidden" id="aprrovalid"name="aprrovalid" class="aprrovalid" placeholder="aprrovalid" value=""><br>
  <input type="hidden" id="aprrovalinvoice"name="aprrovalinvoice" class="aprrovalinvoice" placeholder="aprrovalinvoice" value=""><br>

 <button type="button" class="btn btn-warning" data-dismiss="modal">No</button>
 		  	         <button type="submit" name="btn_updateapproval" value="dispatch" class="btn btn-info"> Submit  </button>

	<?php echo form_close();?>
      </div>
    </div>

  </div>

  </div>

  			
							
							
<div id="dispatchModal" class="modal fade" role="dialog">
  <div class="modal-dialog">

    <!-- Modal content-->
    <div class="modal-content">
      <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal">&times;</button>
        <h4 class="modal-title">Start a new batch stock transfer/movement</h4>
         				 <a href="<?php echo base_url();?>user/viewbulkdispatch" class="btn btn-default"> View previous bulk  dispatch </a>


	 </div>
      <div class="modal-body">
      
	  	

				<?PHP
//$session_data = $this->session->userdata('logged_in');

				echo $this->session->flashdata('deletemsg'); 
	 $finalsalesid = $userid.time();

				echo $this->session->flashdata('msg'); 
		
                 echo form_open('user/startdispatch' , array('class' => 'form-horizontal form-groups-bordered validate', 'enctype' => 'multipart/form-data'));
				 if(validation_errors()):?>
<div class='alert alert-danger text-center'><?php echo validation_errors(); ?></div>
<?php endif;?>
<input type="hidden" name="view" value="user/viewbulkdispatch"id="view" class="form-control" required placeholder="Enter status">
		 		  		<input readonly type="hidden" name="invoice" required value="<?php echo set_value('invoice',$finalsalesid); ?>" class="form-control"  placeholder="Enter invoice or Receip tnumber">
		 		  		<input readonly type="hidden" name="category" required value="branch" class="form-control"  placeholder="Enter invoice or Receipt number">



  <div class="form-group">
    <label for="inputtype" class="col-sm-2 control-label">Type?</label>
    <div class="col-sm-10">
	<select class="form-control" name="type"  required>
		<option value=""  >---Select type of transaction---</option>


		 	<option value="Transfer" selected  >Bulk stock transfer</option>
					 	<option value="Movement"  >Bulk stock movement</option>


</select>
		

	</div>
  </div>
  

		  <div class="form-group">
    <label for="inputstatus" class="col-sm-2 control-label">Category?</label>
    <div class="col-sm-10">
	<select class="form-control" name="status"  required>
		<option value=""  >---Select  Category ---</option>


		 	<option value="product" selected  >Product based</option>
					 	<option value="serial"  >Serial based</option>


</select>
		

	</div>
  </div>	  	

			  		
	<div class="form-group">
    <label for="inputstartdate" class="col-sm-2 control-label">	Transfer Date </label>
    <div class="col-sm-10">
	
		  		<input type="date" name="startdate" value="<?php echo set_value('startdate'); ?>" class="form-control" required placeholder="Enter start date">
		 
				
		<span class="text-danger"> <?php echo form_error('startdate'); ?>
		
		</span>
	</div>
  </div>


  
	<div class="form-group">
    <label for="inputname" class="col-sm-2 control-label">Approver?</label>
    <div class="col-sm-10">
	<select class="form-control" name="name" >
	
	<option value=""  >---Head of your Department---</option>

	
	
	
	
	<?php 
				
					$allusers = $this->usermodel->populatealldatanoarraythree('supervisor', 'companyid',$companyid,'status',"active",'id >',0);

	

	
if(is_array($allusers)) {

   foreach($allusers as $userrow){
	   
	   $biodata= $this->usermodel->populateallarray('people','id',$userrow->employeeno);
		
$name=$biodata[0]['firstname'] ."  "  .$biodata[0]['surname'];

$email=$biodata[0]['email'] ;

    ?>
						<option value="<?=  $userrow->employeeno;   ?>"><?=  $name ."(". $email.")"; ?></option>




	<?php

}} else {
    echo 'No user available.';
}
	
?>
</select>
		
						<span class="text-danger"><?php echo form_error('controller'); ?>

	</div>
  </div>
  


  <div class="form-group">
    <label for="inputfrombranch" class="col-sm-2 control-label">From?</label>
    <div class="col-sm-10">
	<select class="form-control" name="frombranch"  required>
		<option value=""  >---Select where to dispatch from---</option>


		 	<option value="Main" selected="selected" >Main Store</option>

	
	<?php 
					 

								 $mybranch= $this->usermodel->populateall('branch','id',$branchid);
		 


if(is_array($mybranch)) {

   foreach($mybranch as $branchrow){

   //echo $courserow->coursename;
    ?>
					<option value="<?=  $branchrow->id;   ?>"><?=  $branchrow->name; ?></option>



	<?php

}} else {
    echo 'No branch available.';
}
	
?>
</select>
		
						<span class="text-danger"><?php echo form_error('frombranch'); ?>

	</div>
  </div>
  
  
  <div class="form-group">
    <label for="inputtobranch" class="col-sm-2 control-label">To?</label>
    <div class="col-sm-10">
	<select class="form-control" name="tobranch"  required>
		<option value=""  >---Select where to dispatch to---</option>


		 	<option value="Main"  >Main Store</option>

	
	<?php 
					 

								 $mybranch= $this->usermodel->populateall('branch','companyid',$companyid);
		 


if(is_array($mybranch)) {

   foreach($mybranch as $branchrow){

   //echo $courserow->coursename;
    ?>
					<option selected="selected" value="<?=  $branchrow->id;   ?>"><?=  $branchrow->name; ?></option>



	<?php

}} else {
    echo 'No branch available.';
}
	
?>
</select>
		
						<span class="text-danger"><?php echo form_error('tobranch'); ?>

	</div>
  </div>
  
  
	<div class="form-group">
    <label for="inputdescription" class="col-sm-2 control-label">	Remarks</label>
    <div class="col-sm-10">
		  		<input type="text" name="description" value="<?php echo set_value('description'); ?>" class="form-control"  placeholder="Enter any remarks">

			
		<span class="text-danger"> <?php echo form_error('description'); ?>
		
		</span>
	</div>
  </div>
			
 <div class="form-group">
    <label for="inputenddate" class="col-sm-2 control-label">Receive Products?</label>
    <div class="col-sm-10">
	<select class="form-control" name="enddate"  required>
		<option value=""  >--Do you want the items to be Approved and Received? ---</option>


		 	<option value="Yes"   >Yes</option>
					 	<option selected value="No"  >No</option>


</select>
		

	</div>
  </div>
	
 <div class="form-group">
    <label for="inputsalestype" class="col-sm-2 control-label">Retail?</label>
    <div class="col-sm-10">
	<select class="form-control" name="salestype"  required>
		<option value=""  >---Select  type ---</option>


		 	<option value="retail" selected  >Retail</option>
					 	<option value="wholesale"  >Wholesale</option>


</select>
		

	</div>
  </div>	  	


	 <div class="form-group">

    <div class="col-sm-offset-2 col-sm-10">
     
	         <button type="submit"  value="start" name="btn_addstartdispatch" class="btn btn-default"> Start Bulk Dispatch   </button>

    </div>
  </div>
  					<?php echo form_close();?>
			</div>							   
				
									
							
								
			<div class="modal-footer">

    

				</div>

		</div>
	    </div>
    </div>

							
							
							
											
							
<div id="bulkreceivingModal" class="modal fade" role="dialog">
  <div class="modal-dialog">

    <!-- Modal content-->
    <div class="modal-content">
      <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal">&times;</button>
        <h4 class="modal-title">Bulk stock Receiving Window</h4>
         				 <a href="<?php echo base_url();?>user/viewbulkdispatch" class="btn btn-default"> View previous bulk  dispatch </a>


	 </div>
      <div class="modal-body">
      
	  	

				<?PHP
//$session_data = $this->session->userdata('logged_in');

				echo $this->session->flashdata('deletemsg'); 
	 $finalsalesid = $userid.time();

				echo $this->session->flashdata('msg'); 
		
                 echo form_open('user/startprojectdispatch' , array('class' => 'form-horizontal form-groups-bordered validate', 'enctype' => 'multipart/form-data'));
				 if(validation_errors()):?>
<div class='alert alert-danger text-center'><?php echo validation_errors(); ?></div>
<?php endif;?>
<input type="hidden" name="view" value="user/viewproducts"id="view" class="form-control" required placeholder="Enter status">
		 		  		<input readonly type="hidden" name="invoice" required value="<?php echo set_value('invoice',$finalsalesid); ?>" class="form-control"  placeholder="Enter invoice or Receip tnumber">
		 		  		<input readonly type="hidden" name="type" required value="Transfer" class="form-control"  placeholder="Enter invoice or Receip tnumber">
		 		  		<input readonly type="hidden" name="category" required value="BulkReceiving" class="form-control"  placeholder="Enter invoice or Receip tnumber">


	 	  	


  

		  <div class="form-group">
    <label for="inputstatus" class="col-sm-2 control-label">Category?</label>
    <div class="col-sm-10">
	<select class="form-control" name="status"  required>
		<option value=""  >---Select  Category ---</option>


		 	<option value="product" selected="selected"  >Product based</option>
					 	<option value="serial"  >Serial based</option>


</select>
		

	</div>
  </div>	  	
  
  
  
  
  
  
  
  
  
  
  
  

			  		
	<div class="form-group">
    <label for="inputstartdate" class="col-sm-2 control-label">	Receiving Date </label>
    <div class="col-sm-10">
	
		  		<input type="date" name="startdate" value="<?php echo set_value('startdate'); ?>" class="form-control" required placeholder="Enter start date">
		 
				
		<span class="text-danger"> <?php echo form_error('startdate'); ?>
		
		</span>
	</div>
  </div>

				  		
	<div class="form-group">
    <label for="inputname" class="col-sm-2 control-label">	Approved by?</label>
    <div class="col-sm-10">
	
		  		<input type="text" name="name" value="<?php echo set_value('name'); ?>" class="form-control" required placeholder="Enter name">
		 
				
		<span class="text-danger"> <?php echo form_error('name'); ?>
		
		</span>
	</div>
  </div>


  <div class="form-group">
    <label for="inputfrombranch" class="col-sm-2 control-label">Branch name?</label>
    <div class="col-sm-10">
	<select class="form-control" name="frombranch"  required>
		<option value=""  >---Select where to dispatch to---</option>


		 	<option value="Main"  >Main Store</option>

	
	<?php 
					 

								 $mybranch= $this->usermodel->populateall('branch','id',$branchid);
		 


if(is_array($mybranch)) {

   foreach($mybranch as $branchrow){

   //echo $courserow->coursename;
    ?>
					<option selected="selected" value="<?=  $branchrow->id;   ?>"><?=  $branchrow->name; ?></option>



	<?php

}} else {
    echo 'No branch available.';
}
	
?>
</select>
		
						<span class="text-danger"><?php echo form_error('frombranch'); ?>

	</div>
  </div>
  
  
  
  
  
  
  
		  		<input type="hidden" name="supplier"  autofocus value="<?php echo set_value('supplier',""); ?>" class="form-control"  placeholder="Enter Customer or supplier name ">
		 			  		<input type="hidden" name="project"  autofocus value="<?php echo set_value('project',""); ?>" class="form-control"  placeholder="Enter project name ">

	
 
  		
 <div class="form-group">
    <label for="inputsalestype" class="col-sm-2 control-label">Retail?</label>
    <div class="col-sm-10">
	<select class="form-control" name="salestype"  required>
		<option value=""  >---Select  type ---</option>


		 	<option value="retail" selected  >Retail</option>
					 	<option value="wholesale"  >Wholesale</option>


</select>
		

	</div>
  </div>	  	
  
  
  
  
  <div class="form-group">
    <label for="inputdescription" class="col-sm-2 control-label">	Remarks</label>
    <div class="col-sm-10">
		  		<input type="text" name="description" value="<?php echo set_value('description'); ?>" class="form-control"  placeholder="Enter any remarks">

			
		<span class="text-danger"> <?php echo form_error('description'); ?>
		
		</span>
	</div>
  </div>
		

  
  
  
  
  
  
  
	

	
	 <div class="form-group">

    <div class="col-sm-offset-2 col-sm-10">
     
	         <button type="submit"  value="startproject" name="btn_addprojectdispatch" class="btn btn-default"> Start Bulk Receiving   </button>

    </div>
  </div>
  					<?php echo form_close();?>
			</div>							   
				
									
							
								
			<div class="modal-footer">

    

				</div>

		</div>
	    </div>
    </div>

									
							
							
							
<div id="projectdispatchModal" class="modal fade" role="dialog">
  <div class="modal-dialog">

    <!-- Modal content-->
    <div class="modal-content">
      <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal">&times;</button>
        <h4 class="modal-title">Bulk Departmental Dispatch Report</h4>
         				 <a href="<?php echo base_url();?>user/viewbulkdispatch" class="btn btn-default"> View previous bulk  dispatch </a>


	 </div>
      <div class="modal-body">
      
	  	

				<?PHP
//$session_data = $this->session->userdata('logged_in');

				echo $this->session->flashdata('deletemsg'); 
	 $finalsalesid = $userid.time();

				echo $this->session->flashdata('msg'); 
		
                 echo form_open('user/startprojectdispatch' , array('class' => 'form-horizontal form-groups-bordered validate', 'enctype' => 'multipart/form-data'));
				 if(validation_errors()):?>
<div class='alert alert-danger text-center'><?php echo validation_errors(); ?></div>
<?php endif;?>
<input type="hidden" name="view" value="user/viewproducts"id="view" class="form-control" required placeholder="Enter status">
		 		  		<input readonly type="hidden" name="invoice" required value="<?php echo set_value('invoice',$finalsalesid); ?>" class="form-control"  placeholder="Enter invoice or Receip tnumber">
		 		  		<input readonly type="hidden" name="type" required value="Transfer" class="form-control"  placeholder="Enter invoice or Receip tnumber">


	  <div class="form-group">
    <label for="inputtransferto" class="col-sm-2 control-label">Transfer Type?</label>
    <div class="col-sm-10">
	<select class="form-control" name="category" id="transferto" required>
		<option value=""  selected >---Select  Type ---</option>
							 						 	<option value="Project"  >Bulk  Department Transfer </option>

				 	<option value="Customer"   >Bulk Issue      </option>


						
						<option value="BulkReceiving"  >Bulk Receiving of Products </option>



</select>
		

	</div>
  </div>	  	


  

		  <div class="form-group">
    <label for="inputstatus" class="col-sm-2 control-label">Category?</label>
    <div class="col-sm-10">
	<select class="form-control" name="status"  required>
		<option value=""  >---Select  Category ---</option>


		 	<option value="product" selected  >Product based</option>
					 	<option value="serial"  >Serial based</option>


</select>
		

	</div>
  </div>	  	
  
  
  
  
  
  
  
  
  
  
  
  

			  		
	<div class="form-group">
    <label for="inputstartdate" class="col-sm-2 control-label">	Transfer Date </label>
    <div class="col-sm-10">
	
		  		<input type="date" name="startdate" value="<?php echo set_value('startdate'); ?>" class="form-control" required placeholder="Enter start date">
		 
				
		<span class="text-danger"> <?php echo form_error('startdate'); ?>
		
		</span>
	</div>
  </div>

				  		


  <div class="form-group">
    <label for="inputfrombranch" class="col-sm-2 control-label">From?</label>
    <div class="col-sm-10">
	<select class="form-control" name="frombranch"  required>
		<option value=""  >---Select where to dispatch from---</option>


		 	<option value="Main" selected="selected" >Main Store</option>

	
	<?php 
					 

								 $mybranch= $this->usermodel->populateall('branch','id',$branchid);
		 


if(is_array($mybranch)) {

   foreach($mybranch as $branchrow){

   //echo $courserow->coursename;
    ?>
					<option value="<?=  $branchrow->id;   ?>"><?=  $branchrow->name; ?></option>



	<?php

}} else {
    echo 'No branch available.';
}
	
?>
</select>
		
						<span class="text-danger"><?php echo form_error('frombranch'); ?>

	</div>
  </div>
  
  
  
  
  
  
  
  		  <div class="form-group" id="mysupplier">
    <label for="inputsupplier" class="col-sm-2 control-label"> Department / User</label>
    <div class="col-sm-10">
	
		  		<input type="text" name="supplier" id="mysuppliers" autofocus value="<?php echo set_value('supplier'); ?>" class="form-control"  placeholder="Enter Department Name/ User Name ">
		 
				
		<span class="text-danger"> Enter "all" or user name<?php echo form_error('supplier'); ?>
		
		</span>
	</div>
	</div>
	
	
	<div class="form-group">
    <label for="inputname" class="col-sm-2 control-label">Approver?</label>
    <div class="col-sm-10">
	<select class="form-control" name="name" >
	
	<option value=""  >---Head of your Department---</option>

	
	
	
	
	<?php 
				
					$allusers = $this->usermodel->populatealldatanoarraythree('supervisor', 'companyid',$companyid,'status',"active",'id >',0);

	

	
if(is_array($allusers)) {

   foreach($allusers as $userrow){
	   
	   $biodata= $this->usermodel->populateallarray('people','id',$userrow->employeeno);
		
$name=$biodata[0]['firstname'] ."  "  .$biodata[0]['surname'];

$email=$biodata[0]['email'] ;

    ?>
						<option value="<?=  $userrow->employeeno;   ?>"><?=  $name ."(". $email.")"; ?></option>




	<?php

}} else {
    echo 'No user available.';
}
	
?>
</select>
		
						<span class="text-danger"><?php echo form_error('controller'); ?>

	</div>
  </div>
  
	
  	<div class="form-group" id="myproject">
    <label for="inputsupplier" class="col-sm-2 control-label">	Department / User</label>
    <div class="col-sm-10">
			  		<input type="text" name="project" id="myprojects" autofocus value="<?php echo set_value('project'); ?>" class="form-control"  placeholder="Enter project name ">

		 
				
		<span class="text-danger"> <?php echo form_error('PAYMENTDATE'); ?>
		
		</span>
	</div>
  </div>
  
  
  
  
  
  
  <div class="form-group">
    <label for="inputdescription" class="col-sm-2 control-label">	Remarks</label>
    <div class="col-sm-10">
		  		<input type="text" name="description" value="<?php echo set_value('description'); ?>" class="form-control"  placeholder="Enter any remarks">

			
		<span class="text-danger"> <?php echo form_error('description'); ?>
		
		</span>
	</div>
  </div>
		

  
  
  
  
  
  
  
	

	
	 <div class="form-group">

    <div class="col-sm-offset-2 col-sm-10">
     
	         <button type="submit"  value="startproject" name="btn_addprojectdispatch" class="btn btn-default"> Start Bulk Dispatch   </button>

    </div>
  </div>
  					<?php echo form_close();?>
			</div>							   
				
									
							
								
			<div class="modal-footer">

    

				</div>

		</div>
	    </div>
    </div>

									
			
<div id="editProductModel" class="modal fade" role="dialog">
  <div class="modal-dialog">

    <!-- Modal content-->
    <div class="modal-content">
      <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal">&times;</button>
        <h4 class="modal-title">Update main Category/group</h4>
      </div>
      <div class="modal-body">
      
	  	

				<?PHP
//$session_data = $this->session->userdata('logged_in');



				echo $this->session->flashdata('msg'); 
		
                 echo form_open('user/updatemainproductcategory' , array('class' => 'form-horizontal form-groups-bordered validate', 'enctype' => 'multipart/form-data'));
				 if(validation_errors()):?>
<div class='alert alert-danger text-center'><?php echo validation_errors(); ?></div>
<?php endif;?>
	<input type="hidden" name="mycategoryid" value=""id="mycategoryid" class="form-control" required placeholder="Enter mycategoryid">
			  		
	<div class="form-group">
    <label for="inputname" class="col-sm-2 control-label">	Name </label>
    <div class="col-sm-10">
	
		  		<input type="text" name="name" value="<?php echo set_value('name'); ?>" id="name" class="form-control" required placeholder="Enter name">
		 
				
		<span class="text-danger"> <?php echo form_error('name'); ?>
		
		</span>
	</div>
  </div>
 
 
  	
	<div class="form-group">
    <label for="inputdescription" class="col-sm-2 control-label">	Description</label>
    <div class="col-sm-10">

				<textarea name="description" value="<?php echo set_value('description'); ?>"  id="description" class="form-control"  placeholder="Enter description"></textarea>
			
		<span class="text-danger"> <?php echo form_error('description'); ?>
		
		</span>
	</div>
  </div>
		 <div class="form-group">
    <label for="inputstatus" class="col-sm-2 control-label">Status?</label>
    <div class="col-sm-10">
	<select class="form-control" name="status" id="status" required>
	
		<option value="active" selected="selected"  >Active</option>
		<option value="inactive"  >Inactive</option>

	

</select>
		
						<span class="text-danger"><?php echo form_error('status'); ?>

	</div>
  </div>

	

	
	 <div class="form-group">

    <div class="col-sm-offset-2 col-sm-10">
     
	         <button type="submit"  value="category" name="btn_updatemaincategory" class="btn btn-primary"> Update Category   </button>

    </div>
  </div>
  					<?php echo form_close();?>
			</div>							   
				
									
							
								
			<div class="modal-footer">

    

				</div>

		</div>
	    </div>
    </div>
					
					
					
					
					
					
					
					
					
					
					
					
						<div id="myModal" class="modal fade" role="dialog">
  <div class="modal-dialog">

    <!-- Modal content-->
    <div class="modal-content">
      <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal">&times;</button>
        <h4 class="modal-title">Delete</h4>
      </div>
      <div class="modal-body">
        <h3>Are you sure you want to delete this item? </h3>
      </div>
      <div class="modal-footer">
	  	

     
		<?PHP
				$session_data = $this->session->userdata('logged_in');
 echo $this->session->flashdata('deletemsg'); 

		
                 echo form_open('user/deletebyid' , array('class' => 'form-horizontal ', 'enctype' => 'multipart/form-data'));
				 if(validation_errors()):?>
<div class='alert alert-danger text-center'><?php echo validation_errors(); ?></div>
<?php endif;?>
 <input type="hidden" id="table"name="table" class="table" placeholder="view" value="n">

 <input type="hidden" id="view"name="view" class="view" placeholder="view" value="user/viewbulkdispatch">
 <input type="hidden" id="itemid1"name="itemid" class="itemid" placeholder="itemid" value=""><br>
 <button type="button" class="btn btn-success" data-dismiss="modal">No</button>
 		  	         <button type="submit" name="btn_delete" value="deletebyid" class="btn btn-danger"> Delete  </button>

	<?php echo form_close();?>
      </div>
    </div>

  </div>

  </div>					
<div id="addModal" class="modal fade" role="dialog">
  <div class="modal-dialog">

    <!-- Modal content-->
    <div class="modal-content">
      <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal">&times;</button>
        <h4 class="modal-title">Add new main/parent product category</h4>
      </div>
      <div class="modal-body">
      
	  	

				<?PHP
//$session_data = $this->session->userdata('logged_in');

				echo $this->session->flashdata('deletemsg'); 


				echo $this->session->flashdata('msg'); 
		
                 echo form_open('user/addmainproductcategory' , array('class' => 'form-horizontal form-groups-bordered validate', 'enctype' => 'multipart/form-data'));
				 if(validation_errors()):?>
<div class='alert alert-danger text-center'><?php echo validation_errors(); ?></div>
<?php endif;?>
				  		
	<div class="form-group">
    <label for="inputname" class="col-sm-2 control-label">	Name </label>
    <div class="col-sm-10">
	
		  		<input type="text" name="name" value="<?php echo set_value('name'); ?>" class="form-control" required placeholder="Enter name">
		 
				
		<span class="text-danger"> <?php echo form_error('name'); ?>
		
		</span>
	</div>
  </div>

	<div class="form-group">
    <label for="inputdescription" class="col-sm-2 control-label">	Description</label>
    <div class="col-sm-10">

				<textarea name="description" value="<?php echo set_value('description'); ?>"  class="form-control"  placeholder="Enter description"></textarea>
			
		<span class="text-danger"> <?php echo form_error('description'); ?>
		
		</span>
	</div>
  </div>
		

	

	
	 <div class="form-group">

    <div class="col-sm-offset-2 col-sm-10">
     
	         <button type="submit"  value="category" name="btn_addmainproductcategory" class="btn btn-primary"> Add  Main Category   </button>

    </div>
  </div>
  					<?php echo form_close();?>
			</div>							   
				
									
							
								
			<div class="modal-footer">

    

				</div>

		</div>
	    </div>
    </div>





					
									
									
							</div>		
									
							</div>
						</div>
				

			
			</div>
		</div>
  
  </div>
			
		<div class="col-md-2">
			  <div class="panel panel-default" data-collapsed="0">
        	<div class="panel-heading">
            	<div class="panel-title" id="redcolor" >
            		<i class="entypo-plus-circled"></i>
				<p>Help/More Explanation </p>

				
            	</div>
            </div>
      
			<p>Create various  main groups/ category first which you would want to add products to, depending on the nature of your business e.g. a category/ group called Hardware, Food, Fruits, Oils, vages, Lunch, plastics, Drinks etc.“       Just by clicking on “ Add category Button.</p>
			
			
		</div>			
	</div>			
		
		
  

 
</div>


















