<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 src="<?php echo base_url(); ?>assets/autocomplete/jquery.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() {  
            $("#id").autocomplete({  
 
                minLength: 1,  
                source:   
                function(req, add){  
                    $.ajax({  
                        url: "<?php echo base_url(); ?>Systemusers/purchaselookup",  
                        dataType: 'json',  
                        type: 'POST',  
                        data: req,  
                        success:      
                        function(data){  
                            if(data.response =="true"){  
                                add(data.message);  
                                console.log(data);
                            }  
                        },  
                    });  
                },  
                     
            });  
        });
		 $(this).ready( function() {  
            $("#mycode").autocomplete({  
 
                minLength: 1,  
                source:   
                function(req, add){  
                    $.ajax({  
                        url: "<?php echo base_url(); ?>Systemusers/purchaselookup",  
                        dataType: 'json',  
                        type: 'POST',  
                        data: req,  
                        success:      
                        function(data){  
                            if(data.response =="true"){  
                                add(data.message);  
                                console.log(data);
                            }  
                        },  
                    });  
                },  
                     
            });  
        });
		
		
		
		
		
		
        </script>  

<script>
	function printDiv(divName) {
     var printContents = document.getElementById(divName).innerHTML;
     var originalContents = document.body.innerHTML;

    // document.body.innerHTML = printContents.fontsize(16);
     window.print();

	 if( window.print()) {
         window.location.href = "../user/viewsales";
		alert(" printing...........");
    }else {

	
		      return      window.location.href = "../user/viewsales";

		    // document.body.innerHTML = originalContents;

	}
}
	</script>
 
         <script type="text/javascript">
  
		
		 $(document).on("click", "#managebtndelete", function()
        {
          var itemid = $(this).data('id');
		  $("#itemid1").val(itemid); 
		  
		  
		   
        });
		
		
		
		$(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);
                            }  
                        },  
                    });  
                },  
                     
            });  
        });
		
		
		
    </script>  
  <style type="text/css">
  
  	
  .invoice-box table tr.heading td {
        background: #eee;
        border-bottom: 1px solid #ddd;
        font-weight: bold;
		
		
    }
  
  #printable { display: none; }
#print{  	


    background-repeat: no-repeat;
	font-size;20px;
  
    width:100%; height:50px;


}

#sale{  	
background-image:url(images/add.png) ;

    background-repeat: no-repeat;
  
    width:100px; height:50px;


}
    @media print
    {
    	#non-printable { display: none; }
    	#printableArea { display: block; font-size:18; width:100%; }
    }
    </style>
 <div class="row">
  
   	

   	<div class="col-md-12">
	
  
		<div class="panel panel-default" data-collapsed="0">
        	<div class="panel-heading"  id="non-printable">
            	<div class="panel-title" id="non-printable" >
            		<i class="entypo-plus-circled"></i>
						 <span class="pull-right"> Stock history</span>	
                        <a  id="more" class="btn btn-primary" href="<?php echo base_url();?>user/viewproducts">Back to Products </a>
						 <a data-toggle='modal' data-target='#IncomingModal' class="btn btn-default">Search  Incoming stock</a>
						 						 <a data-toggle='modal' data-target='#IncomingCategoryModal' class="btn btn-default">Search By Category</a>

						 						 <a data-toggle='modal' data-target='#productModal' class="btn btn-default">Search Per Product   </a>

                        <a  id="more" class="btn btn-info" href="<?php echo base_url();?>user/viewincomingstock">Refresh </a>
         				 <a href="<?php echo base_url();?>user/viewbulkdispatch" class="btn btn-default"> View bulk dispatch </a>
						 <a data-toggle='modal' data-target='#dispatchedModal' class="btn btn-default">Dispatched/Issued Products to Customers/ Projects</a>
						<a data-toggle='modal' data-target='#issuedtModal' class="btn btn-default">View OLD issued Products (Deactivated)  </a>

			 
 <div class="pull-right" id="non-printable"  >
<form name="print" method="post" action="">
 <input type="submit" id="print"  accesskey="p" class="btn btn-primary"  name="print"onclick="printDiv('printableArea')" value="Print Now!" />
                   
 
 </form>

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

				<div class="widget-content nopadding table_holder table-responsive" >				
	  <?php
  echo $this->session->flashdata('deletemsg'); 
 
				echo $this->session->flashdata('msg'); 
   $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'];	
  $mydate = date('Y-m-d 23:59:59');
   $fromdate=date("Y-m-d 00:00:00");

  $deleteincoming=$this->usermodel->populatuserpermissionsdataarray('incomingstock','delete',$userid);
   function formatMoney($number, $fractional=false) {
						if ($fractional) {
							$number = sprintf('%.2f', $number);
						}
						while (true) {
							$replaced = preg_replace('/(-?\d+)(\d\d\d)/', '$1,$2', $number);
							if ($replaced != $number) {
								$number = $replaced;
							} else {
								break;
							}
						}
						return $number;
					}	


  ?>
  
										
					<div class="row">
						<div class="col-md-12">
							
	<div class="widget-content nopadding table_holder table-responsive" >				
	
									
									
				<table class="tablesorter table table-bordered  table-hover" id="printableArea">			

             <thead>
			 <?php if(isset($configuration[0]['businessname'])) {

				 
				 ?>
			   <tr>
								
								<td colspan="16" ><center  >
								
						
									

										<?php

										$bussinessname=$configuration[0]['businessname']; if(isset($bussinessname)) {echo   $bussinessname; }
										
									
			
										
										?>
												<span id="mytitle"></br><b> Stock movement report between   <?PHP echo $finalfromdate ?> and <?PHP echo $finaltodate ?></b>		
								
								<br>Name----------------------Date--------------------Signature----------------</span>

								</center></td>
								
								
							</tr>
							<?php
								 
				 }
							?>
         <tr>
       <th>Invoice /P.O No</th>
	        <th>Code</th>

     <th>Name</th>
	 		   		 	     <th>Before</th>

	       <th>Added</th>

		 	     <th>Current</th>
				 		 	     <th>Weight</th>
								 
								  <th>B.Price</th>
				 		 	     <th>TT 	B.price</th>


		 
	     <th>From</th>
		  <th>To</th>
		   <th>Branch</th>
		 <th>Added Date</th>
		 	 <th>Supplier</th>
<th>Added by</th>
	<th>More</th>

                 </tr>
             </thead>
<?php

 if(!is_array($viewincomingstock)) 

 {


   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 
  $myqty=0;
    $ttweight=0;

    $totalamount=0;
  	foreach ($viewincomingstock as $c): 

		    $totalamount= $totalamount+($c->buyingprice*$c->total ) ;

             ?>



             <tr>
                
            <?php 
$id=$c->id;
$myqty=$myqty+$c->total;

?>
    <td><?php if($c->invoice_number !=""){
		
		echo$c->invoice_number;
	}else{
			echo"Internal";
		
	}
	; ?></td>
	
	    <td><?php echo $c->item_id ; ?></td>

                 <td><?php 
	$itemid=$c->item_id;
	
	$mycategory = $this->usermodel->populateall('products','code', $itemid);
	


if(is_array($mycategory)) {

   foreach($mycategory as $mycategoryrow){
		echo $mycategoryrow->name." (" .$mycategoryrow->description.")";


}} else {
    echo 'No Product .';
}
	
?>
</td>
		    <td><?php echo $c->item_id1 ; ?></td>

 
    <td><?php echo $c->total ; ?></td>
	
	
		    <td><?php echo $c->balance ; ?></td>

			    <td><?php echo $c->sellingprice ;

    $ttweight=$ttweight+$c->sellingprice

				?></td>
				

 <td><?php echo $c->buyingprice ; ?></td>
				
							    <td><?php echo $c->buyingprice*$c->total  ; ?></td>

<td>
												 
	<?php 
					// $branch="";
					 $stockfrom=$c->stockfrom;

					 $branchfrom= $this->usermodel->populateall('branch','id',$stockfrom);



if(is_array($branchfrom)) {

   foreach($branchfrom as $branchfromrow){

   echo $branchfromrow->name;
 
 
}} else {
    echo $stockfrom;
}
	
?>
												 
	 </td>											 
		 <td>
												 
	<?php 
					// $branch="";
					 $type=$c->stockto;

					 $branchtype= $this->usermodel->populateall('branch','id',$type);



if(is_array($branchtype)) {

   foreach($branchtype as $branchtyperow){

   echo $branchtyperow->name;
 
 
}} else {
    echo $type;
}
	
?>
												 
	 </td>											 
			
	
	
	
	
	
			
	
 <td>
												 
	<?php 
					// $branch="";
					 $branch=$c->branchid;

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



if(is_array($branch)) {

   foreach($branch as $branchrow){

   echo $branchrow->name;
 
 
}} else {
    echo 'General.';
}
	
?>
												 
	 </td>	
	
	
	
	
	
	
	 <td><?php echo $c->date ; ?></td>
	 
		 
		 
		 
		  <td><?php 
		  
		  
		  
		  
		  
		  $allstocks = $this->usermodel->getstockbyinvoice($c->invoice_number);
						 $mysupplier=$allstocks[0]['supplier'];
if($mysupplier !=""){
$supliers=$this->usermodel->geteuser($mysupplier);

if($supliers[0]['company']!=""){
	   echo $supliers[0]['company'];
}else{
   echo $supliers[0]['firstname'];	
}

   
   
   
   
   
}else{
	
 echo "Internal ";	




}
		  
		  
		  

?>
</td> 
		 
		 
		 
		 
		 
		 
		 
		 
		 
		 
		 
	 <td><?php  $userids= $c->userid ;

$myuser=$this->usermodel->geteuser($userids);
   echo $myname=$myuser[0]['firstname'];

  ?></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>
									<?php
										if($deleteincoming==true){
											
											?>
                                    <ul class="dropdown-menu dropdown-primary pull-right" role="menu">
                                        
                                        <!-- teacher EDITING LINK -->
                                      
										
											  <li> 
										 <a class="btn btn-danger managebtn" id="managebtndelete"		 data-id='<?php echo  $c->id;?>'    data-toggle='modal' data-target='#deleteModal<?php  $c->id; ?>'>	 


                                                <i class="glyphicon glyphicon-pencil"></i>
																Delete
                                                </a>
                                                        </li>
									
									
                                        <li class="divider"></li>
                                        
                                        <!-- teacher DELETION LINK -->
                                        
                                    </ul>
											<?php
										}
										?>
                                </div>
</td>
		 
             </tr>

	<?php endforeach;} ?>

            
 								<tr colspan="3" border="1" background="green">
									<td colspan="4"><b>Total Quantity</b></td>

									<td colspan="2" ><b><?php if(isset($myqty)) {echo $myqty;   }?></b> </td>
																	

									
																		<td ><b><?php if(isset($ttweight)) {echo $ttweight;   }?></b> </td>
	<td></td>
																		<td><b><?php if(isset($totalamount)) { echo formatMoney($totalamount , true);  }?></b> </td>


	<td colspan="3"></td>								
</tr>
	
        </table>

        </div>
					
									
									
									
									
					</div>	
					
					
					
					
					
					
					
					
					
											
				<div id="productModal" 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">Stock movement per product Report</h4>
      </div>
      <div class="modal-body">
      
	  	




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



				echo $this->session->flashdata('msg'); 
		
                 echo form_open('user/viewproductmovement' , 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="inputbranchname" class="col-sm-2 control-label">From</label>
    <div class="col-sm-10">
	<select class="form-control" name="branchname"  id="branchname" required>
	
	
	<option value=""  >---Select Branch/Counter Name(From?)--</option>
						<option value="" selected="selected" >-Selet From -</option>
							<option value="Main"  >Main Store</option>
						<option value="supplier"  >Supplier</option>
						<option value="Internal"  >Internal</option>
						<option value="all"  selected="selected" >--All/Any--</option>


	
	<?php 
					 
					 		$maincategory = $this->usermodel->populateall('branch','companyid',$companyid);


							


if(is_array($maincategory)) {

   foreach($maincategory as $maincategoryrow){

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



	<?php

}} else {
    echo 'No main counter available.';
}
	
?>
</select>
		

		
	</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"  id="tobranch" required>
	
	
	<option value=""  >---Select Branch/Counter Name(To?)--</option>
						<option value=""  >-Selet to -</option>
						<option value="Main"  >Main Store</option>
					
						<option value="all"  selected="selected" >--All/Any--</option>

	
	<?php 
					 
					 		$maincategory = $this->usermodel->populateall('branch','companyid',$companyid);


							


if(is_array($maincategory)) {

   foreach($maincategory as $maincategoryrow){

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



	<?php

}} else {
    echo 'No main counter available.';
}
	
?>
</select>
		

		
	</div>
  </div>
	
	











	  <div class="form-group">
    <label for="inputcode" class="col-sm-2 control-label">Product code</label>
    <div class="col-sm-10">
	
		  		<input type="text" name="code" id="id" autofocus value="<?php echo set_value('code'); ?>" class="form-control" required placeholder="Enter code or name">
		 
				
		<span class="text-danger"> <?php echo form_error('code'); ?>
		
		</span>
	</div>
  </div>
  
	
	
	
	
	
	
	
  <div class="form-group">
    <label for="inputfromdate" class="col-sm-2 control-label">From Date </label>
    <div class="col-sm-10">

		  		<input type="text" name="fromdate" value="<?php echo set_value('fromdate',$fromdate); ?>" class="form-control" required placeholder="Enter start date">
		 
				
		<span class="text-danger"> <?php echo form_error('fromdate'); ?>
		
		</span>
	</div>
  </div>
  
  	<div class="form-group">
    <label for="inputtodate" class="col-sm-2 control-label">	To Date </label>
    <div class="col-sm-10">
	
		  		<input type="text" name="todate" value="<?php echo set_value('todate',$mydate); ?>" class="form-control" required placeholder="Enter End date">
		 
				
		<span class="text-danger"> <?php echo form_error('todate'); ?>
		
		</span>
	</div>
  </div>
  
    
       	 		  		<input type="hidden" name="type" value="all" class="form-control" required placeholder="Enter all">


	
   <div class="form-group">
    <label for="inputuser" class="col-sm-2 control-label">User?</label>
    <div class="col-sm-10">
	<select class="form-control" name="user" required>
	
	<option value=""  >---Select user---</option>
	<option value="all" selected="selected" >-All users-</option>
	
	<?php 
							$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->email.")"; ?></option>



	<?php

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

	</div>
  </div>
  
	
	 <div class="form-group">

    <div class="col-sm-offset-2 col-sm-10">
     
	         <button type="submit"  value="event" name="btn_addevent" class="btn btn-primary"> View Sales  </button>

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

    

				</div>

		</div>
	    </div>
    </div>
	
						
				<div id="issuedtModal" 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">View issuied items</h4>
      </div>
      <div class="modal-body">
      
	  	




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



				echo $this->session->flashdata('msg'); 
		
                 echo form_open('user/viewissuedproducts' , 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="inputbranch" class="col-sm-2 control-label">Branch</label>
    <div class="col-sm-10">
	<select class="form-control" name="branch"  id="branch" required>
	
	
	<option value=""  >---Select Branch/Counter-</option>
						<option value="Main"  >Main Store</option>
					
						<option value="all"  selected="selected" >--All/Any--</option>

	
	<?php 
					 
					 		$maincategory = $this->usermodel->populateall('branch','companyid',$companyid);


							


if(is_array($maincategory)) {

   foreach($maincategory as $maincategoryrow){

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



	<?php

}} else {
    echo 'No main counter available.';
}
	
?>
</select>
		

		
	</div>
  </div>
	
	











	  <div class="form-group">
    <label for="inputcode" class="col-sm-2 control-label">Product code</label>
    <div class="col-sm-10">
	
		  		<input type="text" name="code" id="mycode" autofocus value="<?php echo set_value('code'); ?>" class="form-control" required placeholder="Enter code or name">
		 
				
		<span class="text-danger"> <?php echo form_error('code'); ?>
		
		</span>
	</div>
  </div>
  
	
	
	
	
	
	
	
  <div class="form-group">
    <label for="inputfromdate" class="col-sm-2 control-label">From Date </label>
    <div class="col-sm-10">

		  		<input type="text" name="fromdate" value="<?php echo set_value('fromdate',$fromdate); ?>" class="form-control" required placeholder="Enter start date">
		 
				
		<span class="text-danger"> <?php echo form_error('fromdate'); ?>
		
		</span>
	</div>
  </div>
  
  	<div class="form-group">
    <label for="inputtodate" class="col-sm-2 control-label">	To Date </label>
    <div class="col-sm-10">
	
		  		<input type="text" name="todate" value="<?php echo set_value('todate',$mydate); ?>" class="form-control" required placeholder="Enter End date">
		 
				
		<span class="text-danger"> <?php echo form_error('todate'); ?>
		
		</span>
	</div>
  </div>
  
    
       	 		  		<input type="hidden" name="type" value="all" class="form-control" required placeholder="Enter all">


	

	
	 <div class="form-group">

    <div class="col-sm-offset-2 col-sm-10">
     
	         <button type="submit"  value="event" name="btn_addevent" class="btn btn-primary"> View   </button>

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

    

				</div>

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

								<div id="deleteModal" 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="newstock">

 <input type="hidden" id="view"name="view" class="view" placeholder="view" value="user/viewincomingstock">
 <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="IncomingModal" 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">Dispatched stock Report</h4>
      </div>
      <div class="modal-body">
      
	  	

				<?PHP
//$session_data = $this->session->userdata('logged_in');
 //$mydate=date("Y-m-d");
 					//  $mydate=date("Y-m-d H:i:s");


				echo $this->session->flashdata('msg'); 
		
                 echo form_open('user/viewincomingreport' , 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="inputbranchname" class="col-sm-2 control-label">From</label>
    <div class="col-sm-10">
	<select class="form-control" name="branchname"  id="branchname" required>
	
	
	<option value=""  >---Select Branch/Counter Name(From?)--</option>
						<option value="all" selected="selected" >All branches/Counters</option>
						<option value="Main"  >Main Store</option>


	
	<?php 
					 
					 		$maincategory = $this->usermodel->populateall('branch','companyid',$companyid);


							


if(is_array($maincategory)) {

   foreach($maincategory as $maincategoryrow){

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



	<?php

}} else {
    echo 'No main counter available.';
}
	
?>
</select>
		

		
	</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"  id="tobranch" required>
	
	
	<option value=""  >---Select Branch/Counter Name(To?)--</option>
						<option value="all" selected="selected" >All branches/Counters</option>
						<option value="Main"  >Main Store</option>


	
	<?php 
					 
					 		$maincategory = $this->usermodel->populateall('branch','companyid',$companyid);


							


if(is_array($maincategory)) {

   foreach($maincategory as $maincategoryrow){

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



	<?php

}} else {
    echo 'No main counter available.';
}
	
?>
</select>
		

		
	</div>
  </div>
	
	
  <div class="form-group">
    <label for="inputfromdate" class="col-sm-2 control-label">From Date </label>
    <div class="col-sm-10">
	
		  		<input type="text" name="fromdate" value="<?php echo set_value('fromdate',$fromdate); ?>" class="form-control" required placeholder="Enter start date">
		 
				
		<span class="text-danger"> <?php echo form_error('fromdate'); ?>
		
		</span>
	</div>
  </div>
  
  	<div class="form-group">
    <label for="inputtodate" class="col-sm-2 control-label">	To Date </label>
    <div class="col-sm-10">
	
		  		<input type="text" name="todate" value="<?php echo set_value('todate',$mydate); ?>" class="form-control" required placeholder="Enter End date">
		 
				
		<span class="text-danger"> <?php echo form_error('todate'); ?>
		
		</span>
	</div>
  </div>
  
  
    <div class="form-group">
    <label for="inputsupplier" class="col-sm-2 control-label">supplier?</label>
    <div class="col-sm-10">
	<select class="form-control" name="supplier" required>
	
	<option value=""  >---Select supplier---</option>
						<option value="all" selected="selected" >--I want view all/any supplier---</option>

	<?php 
					 
			$mysuppliers =  $this->usermodel->populatemysupplier($companyid);
	

	
if(is_array($mysuppliers)) {

   foreach($mysuppliers as $suppliersrow){

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



	<?php

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

	</div>
  </div>
  

	
     <div class="form-group">
    <label for="inputuser" class="col-sm-2 control-label">User?</label>
    <div class="col-sm-10">
	<select class="form-control" name="user" required>
	
	<option value=""  >---Select user---</option>
	<option value="all" selected="selected" >-All users-</option>
	
	<?php 
							$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->email.")"; ?></option>



	<?php

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

	</div>
  </div>
  
  


	
	 <div class="form-group">

    <div class="col-sm-offset-2 col-sm-10">
     
	         <button type="submit"  value="event" name="btn_addevent" class="btn btn-primary"> View Incoming stock  </button>

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

    

				</div>

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





			<div id="IncomingCategoryModal" 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">Dispatched stock Report By Category</h4>
      </div>
      <div class="modal-body">
      
	  	

				<?PHP
//$session_data = $this->session->userdata('logged_in');
 //$mydate=date("Y-m-d");
 					//  $mydate=date("Y-m-d H:i:s");


				echo $this->session->flashdata('msg'); 
		
                 echo form_open('user/viewincomingreportcategory' , 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="inputbranchname" class="col-sm-2 control-label">From</label>
    <div class="col-sm-10">
	<select class="form-control" name="branchname"  id="branchname" required>
	
	
	<option value=""  >---Select Branch/Counter Name(From?)--</option>
						<option value="all" selected="selected" >All branches/Counters</option>
						<option value="Main"  >Main Store</option>


	
	<?php 
					 
					 		$maincategory = $this->usermodel->populateall('branch','companyid',$companyid);


							


if(is_array($maincategory)) {

   foreach($maincategory as $maincategoryrow){

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



	<?php

}} else {
    echo 'No main counter available.';
}
	
?>
</select>
		

		
	</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"  id="tobranch" required>
	
	
	<option value=""  >---Select Branch/Counter Name(To?)--</option>
						<option value="all" selected="selected" >All branches/Counters</option>
						<option value="Main"  >Main Store</option>


	
	<?php 
					 
					 		$maincategory = $this->usermodel->populateall('branch','companyid',$companyid);


							


if(is_array($maincategory)) {

   foreach($maincategory as $maincategoryrow){

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



	<?php

}} else {
    echo 'No main counter available.';
}
	
?>
</select>
		

		
	</div>
  </div>
	
	
  <div class="form-group">
    <label for="inputfromdate" class="col-sm-2 control-label">From Date </label>
    <div class="col-sm-10">
	
		  		<input type="text" name="fromdate" value="<?php echo set_value('fromdate',$fromdate); ?>" class="form-control" required placeholder="Enter start date">
		 
				
		<span class="text-danger"> <?php echo form_error('fromdate'); ?>
		
		</span>
	</div>
  </div>
  
  	<div class="form-group">
    <label for="inputtodate" class="col-sm-2 control-label">	To Date </label>
    <div class="col-sm-10">
	
		  		<input type="text" name="todate" value="<?php echo set_value('todate',$mydate); ?>" class="form-control" required placeholder="Enter End date">
		 
				
		<span class="text-danger"> <?php echo form_error('todate'); ?>
		
		</span>
	</div>
  </div>
  
  
    <div class="form-group">
    <label for="inputcategory" class="col-sm-2 control-label">Category?</label>
    <div class="col-sm-10">
	<select class="form-control" name="category" required>
	
	<option value=""  >---Select Category---</option>
						<option value="all" selected="selected" >--I want view all/any Category---</option>

	<?php 
					 
			$category = $this->usermodel->populateall('productcategory','companyid',$companyid);


	
if(is_array($category)) {

   foreach($category as $categoryrow){

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



	<?php

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

	</div>
  </div>
  

	

	
	 <div class="form-group">

    <div class="col-sm-offset-2 col-sm-10">
     
	         <button type="submit"  value="event" name="btn_addevent" class="btn btn-primary"> View Incoming stock  </button>

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

    

				</div>

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



















			<div id="dispatchedModal" 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">Dispatched/Issued products Report</h4>
      </div>
      <div class="modal-body">
      
	  	

				<?PHP
//$session_data = $this->session->userdata('logged_in');
 //$mydate=date("Y-m-d");
 					//  $mydate=date("Y-m-d H:i:s");


				echo $this->session->flashdata('msg'); 
		
                 echo form_open('user/viewincomingreportperproject' , 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="inputbranchname" class="col-sm-2 control-label">From</label>
    <div class="col-sm-10">
	<select class="form-control" name="branchname"  id="branchname" required>
	
	
	<option value=""  >---Select Branch/Counter Name(From?)--</option>
						<option value="all" selected="selected" >All branches/Counters</option>
						<option value="Main"  >Main Store</option>


	
	<?php 
					 
					 		$maincategory = $this->usermodel->populateall('branch','companyid',$companyid);


							


if(is_array($maincategory)) {

   foreach($maincategory as $maincategoryrow){

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



	<?php

}} else {
    echo 'No main counter available.';
}
	
?>
</select>
		

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

		 	<option value="Customer"   >Issued to Customer  / Supplier?   </option>
					 	<option value="Project"  >To Project ? </option>


</select>
		

	</div>
  </div>	  	

	
  		  <div class="form-group" id="mysupplier">
    <label for="inputsupplier" class="col-sm-2 control-label">Customer/Employee/ Supplier name</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 Customer or supplier name ">
		 
				
		<span class="text-danger"> Enter "all" or user name<?php echo form_error('supplier'); ?>
		
		</span>
	</div>
	</div>
  	<div class="form-group" id="myproject">
    <label for="inputsupplier" class="col-sm-2 control-label">	Project Name</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('project'); ?>
		
		</span>
	</div>
  </div>
  
  
  
  <div class="form-group">
    <label for="inputfromdate" class="col-sm-2 control-label">From Date </label>
    <div class="col-sm-10">
	
		  		<input type="text" name="fromdate" value="<?php echo set_value('fromdate',$fromdate); ?>" class="form-control" required placeholder="Enter start date">
		 
				
		<span class="text-danger"> <?php echo form_error('fromdate'); ?>
		
		</span>
	</div>
  </div>
  
  	<div class="form-group">
    <label for="inputtodate" class="col-sm-2 control-label">	To Date </label>
    <div class="col-sm-10">
	
		  		<input type="text" name="todate" value="<?php echo set_value('todate',$mydate); ?>" class="form-control" required placeholder="Enter End date">
		 
				
		<span class="text-danger"> <?php echo form_error('todate'); ?>
		
		</span>
	</div>
  </div>
  
  
    <div class="form-group">
    <label for="inputsupplier" class="col-sm-2 control-label">supplier?</label>
    <div class="col-sm-10">
	<select class="form-control" name="supplier" required>
	
	<option value=""  >---Select supplier---</option>
						<option value="all" selected="selected" >--I want view all/any supplier---</option>

	<?php 
					 
			$mysuppliers =  $this->usermodel->populatemysupplier($companyid);
	

	
if(is_array($mysuppliers)) {

   foreach($mysuppliers as $suppliersrow){

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



	<?php

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

	</div>
  </div>
  

	

	
	 <div class="form-group">

    <div class="col-sm-offset-2 col-sm-10">
     
	         <button type="submit"  value="event" name="btn_addevent" class="btn btn-primary"> View Incoming stock  </button>

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

    

				</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 Category</h4>
      </div>
      <div class="modal-body">
      
	  	

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



				echo $this->session->flashdata('msg'); 
		
                 echo form_open('user/addcategory' , 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_addcategory" class="btn btn-primary"> Add Category   </button>

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

    

				</div>

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





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

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

 
</div>


















