<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 type="text/javascript">

      $(this).ready( function() {  
            $("#searchterm").autocomplete({  
 
                minLength: 1,  
                source:   
                function(req, add){  
                    $.ajax({  
                        url: "<?php echo base_url(); ?>Systemusers/productlistlookup",  
                        dataType: 'json',  
                        type: 'POST',  
                        data: req,  
                        success:      
                        function(data){  
                            if(data.response =="true"){  
                                add(data.message);  
                                console.log(data);
                            }  
                        },  
                    });  
                },  
                     
            });  
        });  
		

				
			
		
     $(document).on("click", "#manageorderbtn", function()
        {
          var productid = $(this).data('id');
		  $("#productid4").val(productid); 
		  
		    var name = $(this).data('name');
		   $("#name4").val(name); 
		   
		     var description = $(this).data('description');
		   $("#description4").val(description); 
		 
		     var qty = $(this).data('qty');
		   $("#qty4").val(qty);


		     var code2 = $(this).data('code');
		   $("#code4").val(code2); 	

		     var reorderevel2 = $(this).data('reorderevel');
		   $("#reorderevel4").val(reorderevel2); 			   
        });
		
		
		
		
		
		
		
	 $(document).on("click", "#managebtndelete", function()
        {
          var itemid = $(this).data('id');
		  $("#itemid1").val(itemid); 
		  
		  
		   
        });
		
		 $(document).on("click", "#managestockbtn", function()
        {
          var productid = $(this).data('id');
		  $("#productid2").val(productid); 
		  
		    var name = $(this).data('name');
		   $("#name2").val(name); 
		   
		     var branch = $(this).data('branch');
		   $("#mybranch").val(branch); 
		 
		     var qty = $(this).data('qty');
		   $("#qty2").val(qty);


		     var code = $(this).data('code');
		   $("#code2").val(code); 	

		     var reorderevel = $(this).data('reorderevel');
		   $("#reorderevel2").val(reorderevel); 			   
        });
		
	
		
     $(document).on("click", "#managebtn", function()
        {
          var productid = $(this).data('id');
		  $("#productid1").val(productid); 
		  
		    var branch = $(this).data('branch');
		   $("#branch").val(branch); 
		     var from = $(this).data('branch');
		   $("#from").val(from); 
		   
		     var name = $(this).data('name');
		   $("#name1").val(name); 
		     var description = $(this).data('description');
		   $("#description1").val(description); 
		 
		     var qty = $(this).data('qty');
		   $("#qty1").val(qty);


		     var code1 = $(this).data('code');
		   $("#code1").val(code1); 	

		     var reorderevel = $(this).data('reorderevel');
		   $("#reorderevel1").val(reorderevel); 			   
        });
		
	
		
     $(document).on("click", "#movebtn", function()
        {
          var productid3 = $(this).data('id');
		  $("#productid3").val(productid3); 
		  
		    var branch3 = $(this).data('branch');
		   $("#branch3").val(branch3); 
		   
		     var name3 = $(this).data('name');
		   $("#name3").val(name3); 
		     var description3 = $(this).data('description');
		   $("#description3").val(description3); 
		 
		     var qty3 = $(this).data('qty');
		   $("#qty3").val(qty3);


		     var code3 = $(this).data('code');
		   $("#code3").val(code3); 	

		     var reordereve3 = $(this).data('reorderevel');
		   $("#reorderevel3").val(reordereve3); 			   
        });
		
			
	   $(document).on("click", "#editbtn", function()
        {
          var productid = $(this).data('id');
		  $("#productid").val(productid); 
		     var expdate = $(this).data('expdate');
		   $("#expdate").val(expdate); 
		    var name = $(this).data('name');
		   $("#name").val(name); 
		   
		     var description = $(this).data('description');
		   $("#description").val(description); 
		 
		     var qty = $(this).data('qty');
		   $("#qty").val(qty);

 var status = $(this).data('status');
		   $("#status").val(status);

		     var code = $(this).data('code');
		   $("#code").val(code); 	
 var uom = $(this).data('uom');
		   $("#uom").val(uom);
		     var reorderevel = $(this).data('reorderevel');
		   $("#reorderevel").val(reorderevel); 	
 var category = $(this).data('category');
		   $("#category").val(category); 		
	
		   
 var 	supplier = $(this).data('supplier');
		   $("#supplier").val(supplier); 		
 var buyingprice = $(this).data('buyingprice');
		   $("#buyingprice").val(buyingprice); 		
 var sellingprice = $(this).data('sellingprice');
		   $("#sellingprice").val(sellingprice); 		
 var promoprice = $(this).data('promoprice');
		   $("#promoprice").val(promoprice); 	

 var wholesaleprice = $(this).data('wholesaleprice');
		   $("#wholesaleprice").val(wholesaleprice);
		   
		   
		    var store = $(this).data('store');
		   $("#store").val(store);
		    var tax_included = $(this).data('tax_included');
		   $("#tax_included").val(tax_included);
		   
		       var orderamount = $(this).data('orderamount');
		   $("#orderamount").val(orderamount);
		   
		   
		          var shortname = $(this).data('shortname');
		   $("#shortname").val(shortname);
		        var vattype = $(this).data('vattype');
		   $("#vattype").val(vattype);
		   
		   
        });
		
		
		
		
		
		
				
    </script>
		
	 
<script type="text/javascript">	
		
		
		
		
		
function getWholesalemargin(){
 //alert(3333);
 
					    	 var mybuyingprice = document.getElementById('mybuyingprice').value;
							 var mywholesalemargin = document.getElementById('mywholesalemargin').value;
							 var mywholesaleprice = document.getElementById('mywholesaleprice').value;

							 
						var mywholesalemargin = parseFloat(mywholesalemargin);
var bprice = parseFloat(mybuyingprice);
 if (bprice !== "") {

var nextretailprice = ((bprice *  (mywholesalemargin   +   100)) / 100 );


		   $("#mywholesaleprice").val(nextretailprice); 
		   
 }else{
	 		   $("#mywholesaleprice").val(0.00); 

	 
 }
}

      



function getRetailmargin(){
 //alert(3333);
 
					    	 var mybuyingprice = document.getElementById('mybuyingprice').value;
							 var myretailmargin = document.getElementById('myretailmargin').value;

							 
						var retailmargin = parseFloat(myretailmargin);
var bprice = parseFloat(mybuyingprice);
 if (bprice !== "") {

var nextretailprice = ((bprice *  (retailmargin   +   100)) / 100 );


		   $("#mysellingprice").val(nextretailprice); 
		   
 }else{
	 		   $("#mysellingprice").val(0.00); 

	 
 }
}



		
		
		
		
		
		
		
		
		
    </script>
 
 <div class="row">
  <?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['branchid'] = $session_data['branchid'];
	 $branchid = $data['branchid'];
	 
	 
	 
	 
	 
	 
		 $data['usertype'] = $session_data['usertype'];
	 $usertype = $data['usertype'];	
	      $movestock=$this->usermodel->populatuserpermissionsdataarray('productlist','move',$userid);

     $addproductaction=$this->usermodel->populatuserpermissionsdataarray('productlist','add',$userid);
	      $bulkaction=$this->usermodel->populatuserpermissionsdataarray('productlist','bulk',$userid);
 $viewaction=$this->usermodel->populatuserpermissionsdataarray('productlist','view',$userid);
 $stocktaking=$this->usermodel->populatuserpermissionsdataarray('productlist','stocktaking',$userid);
 $openclosestock=$this->usermodel->populatuserpermissionsdataarray('productlist','openclosestock',$userid);
 $editstocktaken=$this->usermodel->populatuserpermissionsdataarray('productlist','editstocktaken',$userid);
 $editopenclosestock=$this->usermodel->populatuserpermissionsdataarray('productlist','editopenclosestock',$userid);
  $viewbprice=$this->usermodel->populatuserpermissionsdataarray('productlist','viewbprice',$userid);
		  	      $viewallbranches=$this->usermodel->populatuserpermissionsdataarray('reports','viewall',$userid);
  $priceaction=$this->usermodel->populatuserpermissionsdataarray('products','price',$userid);
  $removestockaction=$this->usermodel->populatuserpermissionsdataarray('products','removestock',$userid);


  ?>
   	

   	<div class="col-md-12">
	
  
		<div class="panel panel-default" data-collapsed="0">
        	<div class="panel-heading">
            	<div class="panel-title" id="redcolor" >
            		<i class="entypo-plus-circled"></i>

							<?php
 if( $addproductaction==true){
	 ?>
  <a data-toggle='modal' data-target='#addModal' class="btn btn-default">Add product </a>

	 
	 	<?php	
		}
  ?>
  


							<?php
 if( $addproductaction==true){
	 ?>
	 <a data-toggle='modal' data-target='#addviewModal' class="btn btn-default">View /stock value</a>

	 
	 	<?php	
		}else{ }
  ?>
  
 <a href="<?php echo base_url();?>downloads/products.xlsx" class="btn btn-default">  Bulk productlist template </a>	 



	<?php

	
 if( $bulkaction==true){
	 ?>
												 													                     <a data-toggle='modal' data-target='#uploadModal' class="btn btn-default">Upload products  </a>
												 													                     <a data-toggle='modal' data-target='#uploachilddModal' class="btn btn-default">Upload  child  products  </a>

	  <a data-toggle='modal' data-target='#uploadinventoryModal' class="btn btn-default">Upload Inventory GL  </a>

	 	<?php	

 }else{
	
 }
  ?>
  
									<?php 
				 	 if( $stocktaking==true){
										 ?>
										   <a href="<?php echo base_url();?>user/viewtocktaking" class="btn btn-default"> Stock taking</a>	 
	 
									<?php
									 }
									 ?>
  
									<?php 
				 	 if( $openclosestock==true){
										 ?>
							  <a href="<?php echo base_url();?>user/viewopeningstock" class="btn btn-default"> Opening stock/Closing Stock</a>	 
		 
									<?php
									 }
									 ?>
  
  
    				 <a href="<?php echo base_url();?>user/viewserialnumbers" class="btn btn-default"> Serial No </a>


  
    				 <a href="<?php echo base_url();?>user/viewbulkdispatch" class="btn btn-default"> View Bulk dispatch </a>

  
  
  			<span style="color:red"class="pull-center"> Stocklist/Counter Window</span>


            	</div>
            </div>
			
			<div class="panel-body">
			
	<div class="widget-content nopadding table_holder table-responsive" >				
	<div class="col-md-12">
        <?php 
		
        $attr = array("class" => "form-horizontal", "role" => "form", "id" => "search", "name" => "search");
        echo form_open("user/searchallproductlist", $attr);?>
            <div class="form-group">
			
                <div class="col-md-5">
                    <input class="form-control" autofocus id="searchterm" 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/viewproductlist"; ?>" class="btn btn-default">Refresh</a>
                </div>
				 
            </div>
        <?php echo form_close(); ?>

        </div>
			
						
					<div class="row">
				
				
				
				
						<div class="col-md-12">
							
							<div class="panel-body">
	
									
									
				<table class="tablesorter table table-bordered  table-hover" id="sortable_table">			

             <thead>
         <tr>
     <th>Code</th>
	    <th>Category</th>
     <th>Product Name</th>
		<th>Drawer</th>
	  

	 
		   <th>B.price</th> 
		   <th>S.price</th> 
		<th>Wh.price</th>
				<th>Price Margin</th>

<th>Qty</th>
<th>Branch</th>
<th>Uom</th>
<th>Edit</th>
<th>Transfer</th>
<th>Move</th>

<th>Stock</th>
     <th>Issue</th>         

<th>Delete</th>

			  </tr>
             </thead>
<?php
   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;
					}
 $updateaction=$this->usermodel->populatuserpermissionsdataarray('productlist','update',$userid);
  $addstockaction=$this->usermodel->populatuserpermissionsdataarray('productlist','addstock',$userid);
  $deleteaction=$this->usermodel->populatuserpermissionsdataarray('productlist','delete',$userid);
  $moreaction=$this->usermodel->populatuserpermissionsdataarray('productlist','more',$userid);

  $transferaction=$this->usermodel->populatuserpermissionsdataarray('productlist','transfer',$userid);
	    $dontshowstock=$this->usermodel->populatuserpermissionsdataarray('sales','dontshowstock',$userid);


 if(!is_array($viewproducts)) {
				    echo '<div class="alert alert-danger text-center">There was no products found in the system</div>';

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

 {


   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 ($viewproducts as $c): 
	$retailmargin= formatMoney($c->sellingprice-$c->buyingprice,true)  ;
		$wholesalemargin=formatMoney($c->wholesaleprice-$c->buyingprice,true)  ;


		


             ?>



             <tr>
                
            <?php 
$id=$c->id;
$mycode=$c->code;
$code=$c->code;
  $codedate=$this->usermodel->populateallarray('products','code',$mycode);
	 $shortname=$codedate[0]['shortname'];
 $name=$codedate[0]['name'];
 $description=$codedate[0]['description'];
  $category=$codedate[0]['category'];

?>

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

	
	$mycategory = $this->usermodel->populatecategorybyowner($category);
	


if(is_array($mycategory)) {

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


}} else {
    echo 'No Category .';
}
	$qty1=$c->qty ;
	$reorder=$c->reorderevel; 
	  $userids= $c->supplier ;

$myuser=$this->usermodel->geteuser($userids);
   //echo $myname=$myuser[0]['firstname'];
$c->expdate ;
?>
</td>

    <td><?php echo $name."-".$description ; ?></td>
	 	    <td><?php echo $c->store ; ?></td>


  <td>
  
  	<?php

	
 if( $viewbprice==true){
	 ?>
	 
	 	<?php	

 }else{
	echo $c->buyingprice ; 
 }
  ?>
  
  
  
  </td>
          <td><?php echo $c->sellingprice ; ?></td> 
      <td><?php echo $c->wholesaleprice ; ?></td>  
	      <td>
		  
		    	<?php

	
 if( $viewbprice==true){
	 ?>
	 
	 	<?php	

 }else{

	
			  echo"Rt:". $retailmargin.", Wh:".$wholesalemargin.""; 

 }
  ?>
  
		  
		  
		  
		  
		  
		  
		  </td>


	<td>
			<?php 
			
			 if( $dontshowstock==true){
 
			}else{
	 
	
			if($qty1>$reorder){
			
			?>
			<div class="btn-default">
			<?php  echo $c->qty ; 	?>
			</div>
			<?php
			}else if($qty1<=$reorder){
		?>
			<div class="btn-default">
			<?php  echo $c->qty ; 	?>
			</div>
			<?php
			
			}else if($qty1<=1){
			?>
			<div class="btn-danger">
			<?php  echo $c->qty ; 	?>
			</div>
			<?php
			}
 }
		
			?>
			
		</td>
	 <td>
												 
	<?php 
					// $branch="";
					 $branch=$c->branch;

					 $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->uom ; ?></td>  
		 
												 
												 
												 
												 
											 
              <td>
			  		<div class="form-group">

	
			<?php

	
 if( $updateaction==true){
	 ?>
	 	 	 	 <a  id="more" class="btn btn-default editbtn" href="<?php echo base_url();?>user/viewproductdetails?randomitemidentifier=<?php   {echo  $id;}  ?>&page=<?php   {echo  $page;}  ?>&code=<?php   {echo  $mycode;}  ?>&page=<?php   {echo  $page;}  ?>">Edit  </a>


	 	<?php	

 }else{
	
 }
  ?>


	<?php

	
 if( $priceaction==true){
	 ?>
	 	 <a  id="more" class="btn btn-default" href="<?php echo base_url();?>user/viewprice?randomitemidentifier=<?php   {echo  $code;}  ?>&page=<?php   {echo  $page;}  ?>">Price  </a>

	 	<?php	

 }else{
	
 }
  ?>



    
  </div>
	 </td> 
	 
	 <td>
	 
	 
	 
	 		<?php

	
 if( $transferaction==true){
	 ?>

	 	 <a class="btn btn-default managebtn" id="managebtn" data-branch='<?php echo  $c->branch;?>'	data-code='<?php echo  $c->code;?>' data-qty='<?php echo  $c->qty;?>'	data-description='<?php echo  $c->description;?>' data-name='<?php echo  $c->name;?>'	data-reorderevel='<?php echo  $c->reorderevel;?>'  data-id='<?php echo  $c->id;?>' data-toggle='modal' data-target='#editModal'> Transfer </a>	 

	 	<?php	

 }else{
	
 }
  ?>
      </td> 
	  
	  
	  	 
	 <td>
	 
	 
	 
	 		<?php

	
 if( $movestock==true){
	 ?>
	 	 	 <a  id="more" class="btn btn-default" href="<?php echo base_url();?>user/viewdistribution?randomitemidentifier=<?php   {echo  $id;}  ?>&page=<?php   {echo  $page;}  ?>&code=<?php   {echo  $mycode;}  ?>">Move  </a>



	 	<?php	

 }else{
	
 }
  ?>
      </td> 
	  
	  
	  
	  
	  
	  
	  <td>
	 
	 
	 
	 		<?php

	
 if( $addstockaction==true){
	 ?>

	 	 <a class="btn btn-default managestockbtn" id="managestockbtn" data-branch='<?php echo  $c->branch;?>'	data-code='<?php echo  $c->code;?>' data-qty='<?php echo  $c->qty;?>'	data-description='<?php echo  $c->description;?>' data-name='<?php echo  $c->name;?>'	data-reorderevel='<?php echo  $c->reorderevel;?>'  data-id='<?php echo  $c->id;?>' data-toggle='modal' data-target='#updatetockModal'> stock </a>	 

	 	<?php	

 }else{
	
 }
  ?>
      </td>
	  
	  
	  
	  
	  
	  
	  <td>
	 
	 
	 
	 		<?php

	
 if( $removestockaction==true){
	 ?>

	 	 <a class="btn btn-default manageorderbtn" id="manageorderbtn"	data-code='<?php echo  $c->code;?>' data-qty='<?php echo  $c->qty;?>'	data-description='<?php echo  $c->description;?>' data-name='<?php echo  $c->name;?>'	data-reorderevel='<?php echo  $c->reorderevel;?>'  data-id='<?php echo  $c->id;?>' data-toggle='modal' data-target='#editorderModal'> Issue </a>	 

	 	<?php	

 }else{
	
 }
  ?>
      </td>
	  
	  
	  
		 
		 	 <td> 

 
 
					<div class="btn-group">
                                    <button type="button" class="btn btn-default btn-sm dropdown-toggle" data-toggle="dropdown">
                                        More <span class="caret"></span>
                                    </button>
									
                                    <ul class="dropdown-menu dropdown-default pull-right" role="menu">
                                        
                                        <!-- teacher EDITING LINK -->
                                      
											<li> 
	<?php
										 	 	$salesid = $userid.time();

	
 if( $moreaction==true){
	 ?>

	 	 <a  id="more" class="btn btn-default" href="<?php echo base_url();?>user/viewmoreincomingstock?randomitemidentifier=<?php   {echo  $c->code ;}  ?>&branch=<?php   {echo  $c->branch ;}  ?>">

	 	<?php	

 }else{
	
 }
  ?>


                                                <i class="glyphicon glyphicon-pencil"></i>
															View Dispatched Products
                                                </a>
                                                        </li> 
										
                                        <li class="divider"></li>
                                        
												<li> 
				<a  id="more" target="_blank"class="btn btn-default" href="<?php echo base_url();?>user/viewcurrentserials?branch=<?php   {echo  $c->branch;}  ?>&mycode=<?php   {echo  $c->code;}  ?>"> 


                                                <i class="glyphicon glyphicon-pencil"></i>
															View Serial No
                                                </a>
                                                        </li> 
                                        <li class="divider"></li>

	
														<li> 
				<a  id="more" target="_blank" class="btn btn-default" href="<?php echo base_url();?>user/createserials?branch=<?php   {echo  $c->branch;}  ?>&randomitemidentifier=<?php   {echo  $salesid;}  ?>&mycode=<?php   {echo  $c->code;}  ?>&myqty=<?php   {echo  1;}  ?>&myid=<?php   {echo  "";}  ?>&status=create"> 
					<i class="glyphicon glyphicon-pencil"></i>
															Record	 Serial No
																
                                                </a>
                                                        </li> 	

                                        <li class="divider"></li>








							<li> 								<?php
										 if( $deleteaction==true){
											
											?>
										 <a class="btn btn-danger managebtn" id="managebtndelete"		 data-id='<?php echo  $c->id;?>'    data-toggle='modal' data-target='#myDelete<?php  $c->id; ?>'>	 


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

	<?php endforeach;} ?>

              <?php }?>
  <tfoot>
         <tr>
     <th>Code</th>
     <th>Product Name</th>
		<th>Drawer</th>
	     <th>Category</th>

	 
		   <th>B.price</th> 
		   <th>S.price</th> 
		<th>Wh.price</th>
				<th>Margin</th>

<th>Qty</th>
<th>Branch</th>
<th>Uom</th>
<th>Edit</th>
<th>Transfer</th>
<th>Move</th>

<th>Stock</th>
<th>More</th>
              


			  </tr>
             </tfoot>
        </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="editorderModal" 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">Issue  products (<?PHP

 $postedtime = date('Y-m-d');
		$currenttime = date('h:i sa');
 		echo$dateposted =  ($postedtime)." ".$currenttime ;?>)</h4>
      </div>
      <div class="modal-body">
      
	  	

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



				echo $this->session->flashdata('msg'); 
		
                 echo form_open('user/removestock' , 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="mytype" value="store"id="mytype" class="form-control" required placeholder="Enter type">

<input type="hidden" name="type" value="store"id="type" class="form-control" required placeholder="Enter type">
				<input type="hidden" name="view" value="user/viewproductlist"id="view" class="form-control" required placeholder="Enter view">
		<input type="hidden" name="productid" value=""id="productid4" class="form-control" required placeholder="Enter productid">
		<input type="hidden" name="page" value="<?php echo $page ?>"id="page" class="form-control" required placeholder="Enter bookid">

		
		
		
		<div class="form-group">
    <label for="inputtotal" class="col-sm-2 control-label">	Total items to Remove </label>
    <div class="col-sm-10">
	
		  		<input type="text"   name="total" value="<?php echo set_value('total'); ?>"id="total4" class="form-control" required placeholder="Enter total">
		 
				
		<span class="text-danger"> 	How many items do you want to remove?<?php echo form_error('total'); ?>
		
		</span>
	</div>
  </div>
  
  
  
	
  
  

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

<textarea name="comments"  id="comments"class="form-control" placeholder="Enter description/comments if any "><?php echo set_value('comments'); ?></textarea>		
		<span class="text-danger"> Enter description/comments if any<?php echo form_error('comments'); ?>
		
		</span>
	</div>
  </div>
		
  
  
  
<div class="form-group">
    <label for="inputfrom" class="col-sm-2 control-label">Branch(From)</label>
    <div class="col-sm-10">
	<select class="form-control" name="from"  required readonly id="from" >

	
	<option value="" selected></option>
	
	<option value=""  >---Where do you want to transfer product to?---</option>

	
	<?php 
					 

					 $branch= $this->usermodel->populateall('branch','companyid',$companyid);
					//$branch  = $this->usermodel->populatealldatanoarray('branch','id', $branchid,'companyid',$companyid );



if(is_array($branch)) {

   foreach($branch as $branchrow){

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



	<?php

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

	</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" readonly name="code" value="<?php echo set_value('code'); ?>"id="code4" class="form-control" required placeholder="Enter  code">
		 
				
		<span class="text-danger"> <?php echo form_error('name'); ?>
		
		</span>
	</div>
  </div>	

		<div class="form-group">
    <label for="inputname" class="col-sm-2 control-label">	Product Name</label>
    <div class="col-sm-10">
	
		  		<input type="text" name="name" value="<?php echo set_value('name'); ?>"id="name4" class="form-control" readonly required placeholder="Enter  Product name">
		 
				
		<span class="text-danger"> <?php echo form_error('name'); ?>
		
		</span>
	</div>
  </div>
	
		<div class="form-group">
    <label for="inputqty" class="col-sm-2 control-label">	Total Remaining items </label>
    <div class="col-sm-10">
	
		  		<input type="text"  readonly name="qty" value="<?php echo set_value('qty'); ?>"id="qty4" class="form-control" required placeholder="Enter qty">
		 
				
		<span class="text-danger"> <?php echo form_error('qty'); ?>
		
		</span>
	</div>
  </div>
	
	
	
	
	
		<div class="form-group">
    <label for="inputreorderevel" class="col-sm-2 control-label">	Reorder level</label>
    <div class="col-sm-10">
	
		  		<input type="text"  readonly  name="reorderevel" value="<?php echo set_value('reorderevel'); ?>"id="reorderevel4" class="form-control" required placeholder="Enter reorder level">
		 
				
		<span class="text-danger"> <?php echo form_error('reorderevel'); ?>
		
		</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" readonly id="description4"class="form-control"><?php echo set_value('description'); ?></textarea>		
		<span class="text-danger"> Enter description if any<?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="stock" name="btn_uaddstock" class="btn btn-default">Move Stock   </button>

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

    

				</div>

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




			<div id="myDelete" 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="productlist">

<input type="hidden" name="type" value="product"id="type" class="form-control" required placeholder="Enter type">
				<input type="hidden" name="view" value="user/viewproductlist" id="view" class="form-control" required placeholder="Enter view">
								<input type="hidden" name="view" value="<?php if(isset($searchterm)) {echo "Systemusers/searchallproductlist/".floor($page);}else { echo"Systemusers/viewproductlist/".floor($page);}?>"id="view" class="form-control" required placeholder="Enter view">

 <input type="hidden" id="itemid1"name="itemid" class="itemid" placeholder="itemid" value=""><br>
 <button type="button" class="btn btn-default" 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>
				</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 Product</h4>
      </div>
      <div class="modal-body">
      
	  	

				<?PHP
//$session_data = $this->session->userdata('logged_in');
$imgid = rand(100, 990000).time();


				echo $this->session->flashdata('msg'); 
		
                 echo form_open('user/updateproductlist' , 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="type" value="product"id="type" class="form-control" required placeholder="Enter type">
				<input type="hidden" name="view" value="user/viewproductlist"id="view" class="form-control" required placeholder="Enter view">
<input type="hidden" name="productid" value=""id="productid" class="form-control" required placeholder="Enter productid">
		<!--<input type="hidden" name="page" value="<?php echo $page ?>"id="page" class="form-control" required placeholder="Enter bookid">
-->
	<div class="form-group">
    <label for="inputcode" class="col-sm-2 control-label">	 Code</label>
    <div class="col-sm-10">
	
		  		<input type="text" name="code" readonly id="code" value="<?php echo set_value('code'); ?>" class="form-control" required placeholder="Enter Product Code">
		 
				
		<span class="text-danger"> <?php echo form_error('code'); ?>
		
		</span>
	</div>
  </div>












	<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"  readonly id="name" value="<?php echo set_value('name') ;?>"  class="form-control"  placeholder="Enter  product name">

		<span class="text-danger"> <?php echo form_error('name'); ?>
		
		</span>
	</div>
  </div>
  
  
  
  
  
  
  
  
  
  	<div class="form-group">
    <label for="inputshortname" class="col-sm-2 control-label">	Short Name</label>
    <div class="col-sm-10">
		
				<input type="text" name="shortname" readonly value="<?php echo set_value('shortname') ;?>"  id="shortname" class="form-control"  placeholder="Enter  Short  name">

		<span class="text-danger"> <?php echo form_error('shortname'); ?>
		
		</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"  readonly id="category">
	
	<option value="" selected></option>
		<option value=""  >---Select Category---</option>

	<?php 
						$mycategory = $this->usermodel->populateproductcategorybyid($companyid);
		 
	


if(is_array($mycategory)) {

   foreach($mycategory as $mycategoryrow){

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



	<?php

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

	</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" readonly id="supplier" >
	
	<option value=""  >---Select supplier---</option>

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



if(is_array($suppliers)) {

   foreach($suppliers as $suppliersrow){

   //echo $courserow->coursename;
    ?>
					<option value="<?=  $suppliersrow->id;   ?>"><?=  $suppliersrow->company ."(". $suppliersrow->firstname ." ".$suppliersrow->lastname.")"; ?></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="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="" selected></option>
		<option value=""  >---Select Status---</option>
		<option value="active"  >Active</option>
		<option value="inactive"  >Inactive</option>
		<option value="global"  >Global</option>

	

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

	</div>
  </div>
  	
  
  
  
  
  
   <div class="form-group">
    <label for="inputorderamount" class="col-sm-2 control-label">Product Type</label>
    <div class="col-sm-10">
	<select class="form-control" name="orderamount" id="orderamount" required>
	
		<option value="" selected="selected" ></option>
			<option value=""  >---Select Product Type---</option>
		<option value="mainitem"   >Main-item</option>
		<option value="production"  >Production-item</option>
		<option value="subitem"  >Sub-item</option>
						<option value="Sub-Single-item"  >Sub-Single-item</option>

			<option value="accompaniment"  >Accompaniment</option>


	

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

	</div>
  </div>
  
  
  
	<div class="form-group">
    <label for="inputbuyingprice" class="col-sm-2 control-label">	B Price</label>
    <div class="col-sm-10">

				<input type="text" id="buyingprice" readonly required name="buyingprice" value="<?php echo set_value('buyingprice'); ?>"  class="form-control"  placeholder="Enter buying price">
			
		<span class="text-danger"> <?php echo form_error('buyingprice'); ?>
		
		</span>
	</div>
  </div>
  	
	<div class="form-group">
    <label for="inputsellingprice" class="col-sm-2 control-label">	S Price</label>
    <div class="col-sm-10">

				<input type="text" id="sellingprice" readonly name="sellingprice" required value="<?php echo set_value('sellingprice'); ?>"  class="form-control"  placeholder="Enter selling price">
			
		<span class="text-danger"> <?php echo form_error('sellingprice'); ?>
		
		</span>
	</div>
  </div>
	
		<div class="form-group">
    <label for="inputwholesaleprice" class="col-sm-2 control-label">	Wh Price</label>
    <div class="col-sm-10">

				<input type="text"  name="wholesaleprice" readonly value="<?php echo set_value('wholesaleprice'); ?>"  id="wholesaleprice" class="form-control"  placeholder="Enter whole sale price">
			
		<span class="text-danger"> <?php echo form_error('wholesaleprice'); ?>
		
		</span>
	</div>
  </div>
	
	
			<div class="form-group">
    <label for="inputpromoprice" class="col-sm-2 control-label">From QTY</label>
    <div class="col-sm-10">

				<input type="text" id="promoprice" name="promoprice" readonly value="<?php echo set_value('promoprice'); ?>"  class="form-control"  placeholder="Enter qty needed to sale in whole sale  price">
			
		<span class="text-danger"> How many Qty worth whole sale price<?php echo form_error('promoprice'); ?>
		
		</span>
	</div>
  </div>
	
	
  <div class="form-group">
    <label for="inputuom" class="col-sm-2 control-label">Default UOM</label>
    <div class="col-sm-10">
	<select class="form-control" name="uom" readonly id="uom" required>
	
	<option value=""  >---Select UOM-</option>

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


							


if(is_array($uom)) {

   foreach($uom as $uomrow){

   //echo $courserow->coursename;
    ?>
					<option  value="<?=  $uomrow->code;   ?>"><?=  $uomrow->name; ?></option>



	<?php

}} else {
    echo 'No uom.';
}
	
?>
</select>
		

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

				<input type="text" readonly name="qty" id="qty" value="<?php echo set_value('qty'); ?>"  class="form-control" required  placeholder="Enter quantity in stock">
			
		<span class="text-danger"> <?php echo form_error('qty'); ?>
		
		</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"  id="description" readonly 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">
    <label for="inputreorderevel" class="col-sm-2 control-label">	Reorder Level</label>
    <div class="col-sm-10">

				<input type="text" required  id="reorderevel"  name="reorderevel" value="<?php echo set_value('reorderevel'); ?>"  class="form-control"  placeholder="Enter Reorder Level e.g 10">
			
		<span class="text-danger"> <?php echo form_error('reorderevel'); ?>
		
		</span>
	</div>
  </div>
  
  
  <div class="form-group">
    <label for="inputvattype" class="col-sm-2 control-label">	VAT Type</label>
    <div class="col-sm-10">

		<select class="form-control" name="vattype"  id="vattype" >
				<option value="" selected="selected"  ></option>

			<option value="VATABLE"   >VATABLE</option>

			<option value="ZERO RATED"  >ZERO RATED</option>
				<option value="EXEMPTED"  >EXEMPTED</option>

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

	<div class="form-group">
    <label for="inputtax_included" class="col-sm-2 control-label">	Tax included (%)</label>
    <div class="col-sm-10">

				<input type="text"   id="tax_included" name="tax_included" value="<?php echo set_value('tax_included'); ?>"  class="form-control"   placeholder="Enter tax if any">
			
		<span class="text-danger"> Enter tax to be included if any<?php echo form_error('tax_included'); ?>
		
		</span>
	</div>
  </div>
  	
		<div class="form-group">
    <label for="inputstore" class="col-sm-2 control-label">	Rack /Store Name</label>
    <div class="col-sm-10">

				<input type="text"  id="store" name="store" value="<?php echo set_value('store'); ?>"  class="form-control"   placeholder="Enter store / rack name">
			
		<span class="text-danger"> Enter the name where the product is stored<?php echo form_error('store'); ?>
		
		</span>
	</div>
  </div>
	
	<div class="form-group">
    <label for="inputexpdate" class="col-sm-2 control-label">	Expiry date(YYYY-MM-DD)</label>
    <div class="col-sm-10">

				<input type="text"   id="expdate" name="expdate" value="<?php echo set_value('expdate'); ?>"  class="form-control"   placeholder="Enter expiry date">
			
		<span class="text-danger"> Enter expiry date  if any<?php echo form_error('expdate'); ?>
		
		</span>
	</div>
  </div>
	<div class="form-group">
    <label for="inputphoto" class="col-sm-2 control-label">	Upload Image</label>
    <div class="col-sm-10">

	

	<input type="file" name="photo" value="<?php echo set_value('photo'); ?>"id="photo" class="form-control"  placeholder="Please upload image if any">
			<span class="text-danger"> <?php echo form_error('photo'); ?>
		
		</span>
	</div>
	
	 <div class="form-group">

    <div class="col-sm-offset-2 col-sm-10">
     
	         <button type="submit"  value="product" name="btn_updateproductlist" class="btn btn-default"> Update Product   </button>

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

    

				</div>

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







	
	
	
	
	
	
	
	
	













			<div id="uploachilddModal" 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">Please Upload Product  child data(CSV)</h4>
		
      </div>
      <div class="modal-body">
      
	  	

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



				echo $this->session->flashdata('msg'); 
		
                 echo form_open('user/uploadproductlistchild' , 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="type" value="child"id="type" class="form-control" required placeholder="Enter type">
				<input type="hidden" name="view" value="user/viewproductlist"id="view" class="form-control" required placeholder="Enter view">
	
	
	<div class="form-group">
    <label for="inputsurname" class="col-sm-2 control-label">	CSV LIST</label>
    <div class="col-sm-10">
		
			<input type="file" name="file" width="400"  value="<?php echo set_value('file') ;?>" placeholder="Select EXCELL" class="form-control" required placeholder="Enter Surname"  >

		  		
				
		<span class="text-danger"> Upload correct format of CSV File  here..<?php echo form_error('file'); ?>
		
		</span>
	</div>
  </div>	
  
	

	
	 <div class="form-group">

    <div class="col-sm-offset-2 col-sm-10">
     
	         <button type="submit"  value="products" name="btn_uploadproductlist" class="btn btn-default">Upload products  </button>

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

    

				</div>

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

















						<div id="uploadModal" 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">Please Upload Correct stocklist data(CSV)</h4>
		
      </div>
      <div class="modal-body">
      
	  	

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



				echo $this->session->flashdata('msg'); 
		
                 echo form_open('user/uploadproductlist' , 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="type" value="product"id="type" class="form-control" required placeholder="Enter type">
				<input type="hidden" name="view" value="user/viewproductlist"id="view" class="form-control" required placeholder="Enter view">
	
	
	<div class="form-group">
    <label for="inputsurname" class="col-sm-2 control-label">	CSV LIST</label>
    <div class="col-sm-10">
		
			<input type="file" name="file" width="400"  value="<?php echo set_value('file') ;?>" placeholder="Select EXCELL" class="form-control" required placeholder="Enter Surname"  >

		  		
				
		<span class="text-danger"> Upload correct format of CSV File  here..<?php echo form_error('file'); ?>
		
		</span>
	</div>
  </div>	
  
	

	
	 <div class="form-group">

    <div class="col-sm-offset-2 col-sm-10">
     
	         <button type="submit"  value="products" name="btn_uploadproductlist" class="btn btn-default">Upload products  </button>

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

    

				</div>

		</div>
	    </div>
    </div>
	
	
	<div id="updatetockModal" 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 stock (<?PHP

 $postedtime = date('Y-m-d');
		$currenttime = date('H:i:s');
 		echo$dateposted =  ($postedtime)." ".$currenttime ;?>)</h4>
      </div>
      <div class="modal-body">
      
	  	

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



				echo $this->session->flashdata('msg'); 
		
                 echo form_open('user/updatestocklist' , 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="type" value="product"id="type" class="form-control" required placeholder="Enter type">
				<input type="hidden" name="view" value="user/viewproductlist"id="view" class="form-control" required placeholder="Enter view">
		<input type="hidden" name="productid" value=""id="productid2" class="form-control" required placeholder="Enter productid">
		<input type="hidden" name="page" value="<?php echo $page ?>"id="page" class="form-control" required placeholder="Enter bookid">
<input type="hidden" name="branch" value=""id="mybranch" class="form-control" required placeholder="Enter branch">

    

	
		<div class="form-group">
    <label for="inputtotal" class="col-sm-2 control-label">	Total items to Add </label>
    <div class="col-sm-10">
	
		  		<input type="text" autofocus   name="total" value="<?php echo set_value('total'); ?>"id="total2" class="form-control" required placeholder="Enter total">
		 
				
		<span class="text-danger"> 	How many items do you want to add?<?php echo form_error('total'); ?>
		
		</span>
	</div>
  </div>
  <div class="form-group">
    <label for="inputfrom" class="col-sm-2 control-label">From?</label>
    <div class="col-sm-10">
	<select class="form-control" name="from" required>
	
	<option value="" >--Where are you adding product from?---</option>


	
	<option value="internal"  selected="selected"> from within</option>

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

	</div>
  </div>
  
  










   <div class="form-group">
    <label for="inputmethod" class="col-sm-2 control-label">Method</label>
    <div class="col-sm-10">
	<select class="form-control" name="method" required>
	
	<option value="" >--Select Method of stocking---</option>


	
	<option value="Direct"  selected="selected"> Direct</option>
	<option value="Production"  > Production(Deduct from other items)</option>

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

	</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" readonly name="code" value="<?php echo set_value('code'); ?>"id="code2" class="form-control" required placeholder="Enter  code">
		 
				
		<span class="text-danger"> <?php echo form_error('code'); ?>
		
		</span>
	</div>
  </div>	

		<div class="form-group">
    <label for="inputname" class="col-sm-2 control-label">	Product Name</label>
    <div class="col-sm-10">
	
		  		<input type="text" name="name" value="<?php echo set_value('name'); ?>"id="name2" class="form-control" readonly required placeholder="Enter  Product name">
		 
				
		<span class="text-danger"> <?php echo form_error('name'); ?>
		
		</span>
	</div>
  </div>
	
		<div class="form-group">
    <label for="inputqty" class="col-sm-2 control-label">	Total Remaining items </label>
    <div class="col-sm-10">
	
		  		<input type="text"  readonly name="qty" value="<?php echo set_value('qty'); ?>"id="qty2" class="form-control" required placeholder="Enter qty">
		 
				
		<span class="text-danger"> <?php echo form_error('qty'); ?>
		
		</span>
	</div>
  </div>
	
	
	
	
	
		<div class="form-group">
    <label for="inputreorderevel" class="col-sm-2 control-label">	Reorder level</label>
    <div class="col-sm-10">
	
		  		<input type="text"  readonly  name="reorderevel" value="<?php echo set_value('reorderevel'); ?>"id="reorderevel2" class="form-control" required placeholder="Enter reorder level">
		 
				
		<span class="text-danger"> <?php echo form_error('reorderevel'); ?>
		
		</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"  class="form-control"><?php echo set_value('description'); ?></textarea>		
		<span class="text-danger"> Enter description if any<?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="stock" name="btn_addstock" class="btn btn-default"> Update 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 Product</h4>
      </div>
      <div class="modal-body">
      
	  	

				<?PHP
				
				 $mylastrecord=0;
		
			$lastrecord = $this->usermodel->last_productcode($companyid);
			if($lastrecord !=false){
				 $mylastrecord=$lastrecord[0]["code"]+1;
			}else{
				
				 $mylastrecord=$mylastrecord+1;
			}
				
				
				
				
				
				
				
				
				
				
//$session_data = $this->session->userdata('logged_in');
$imgid = rand(100, 990000).time();
 $session_data = $this->session->userdata('logged_in');


	$smsconfig = $this->usermodel->populateallarray('smsconfig','id',$companyid);
		  		 	  $display1=$smsconfig[0]['display1'];
					  $mytax=0;
				 if( $display1=="yes"){
					  $mytax=$smsconfig[0]['tax1rate'];
				 }else{
					  $mytax=0;

				 }
					
   
 	$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('msg'); 
		
                 echo form_open('user/addproduct' , array('class' => 'form-horizontal form-groups-bordered validate', 'name' => 'products', '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="type" value="product"id="type" class="form-control" required placeholder="Enter type">
				<input type="hidden" name="view" value="user/viewproductlist"id="view" class="form-control" required placeholder="Enter view">
	

	<div class="form-group">
    <label for="inputcode" class="col-sm-2 control-label">	 Code</label>
    <div class="col-sm-10">
	
		  		<input type="text" name="code" value="<?php echo set_value('code',$mylastrecord); ?>" class="form-control" required placeholder="Enter Product Code">
		 
				
		<span class="text-danger"> <?php echo form_error('code'); ?>
		
		</span>
	</div>
  </div>

	<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  product name">

		<span class="text-danger"> <?php echo form_error('name'); ?>
		
		</span>
	</div>
  </div>
  
  
  
  	<div class="form-group" style="display:none">
    <label for="inputshortname" class="col-sm-2 control-label">	Short Name</label>
    <div class="col-sm-10">
		
				<input type="text" name="shortname" value="<?php echo set_value('shortname') ;?>"  class="form-control"  placeholder="Enter  Short  name">

		<span class="text-danger"> <?php echo form_error('shortname'); ?>
		
		</span>
	</div>
  </div>
  
  <div class="form-group" style="display:none">
    <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=""  >---Select Status---</option>
		<option value="active" selected="selected"  >Active</option>
		<option value="inactive"  >Inactive</option>
		<option value="global"  >Global</option>

	

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

	</div>
  </div>
  
  
	  <div class="form-group" style="display:none">
    <label for="inputorderamount" class="col-sm-2 control-label" >Product Type</label>
    <div class="col-sm-10">
	<select class="form-control" name="orderamount"  required>
	
		<option value=""  >---Select Product Type---</option>
		<option value="mainitem" selected="selected"  >Main-item</option>
		<option value="production"  >Production-item</option>
		<option value="subitem"  >Sub-item</option>
				<option value="Sub-Single-item"  >Sub-Single-item</option>

		<option value="accompaniment"  >Accompaniment</option>


	

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

	</div>
  </div>
	
	
  	
 <div class="form-group" style="display:none">
    <label for="inputproducttype" class="col-sm-2 control-label">Inventory Type?</label>
    <div class="col-sm-10">
	<select class="form-control" name="producttype" required>
	
		<option value=""  >---Select Product Type---</option>
		<option value="Inventory" selected="selected"  >Inventory</option>
		<option value="None Inventory"  >None Inventory </option>
		<option value="Service"  >Service</option>


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

	</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>

	
	<?php 
					 
			//$mycategory = $this->usermodel->populateproductcategorybyid($companyid);
						 		$mycategory = $this->usermodel->populatealldatawhere('productcategory','name','ASC','companyid',$companyid);



if(is_array($mycategory)) {

   foreach($mycategory as $mycategoryrow){

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



	<?php

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

	</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>

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

	
if(is_array($allsuppliers)) {

   foreach($allsuppliers 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" style="margin-bottom:0px; ">
    <label for="inputbuyingprice" class="col-sm-2 control-label">Unit (B.)Price</label>
    <div class="col-sm-10">

				<input type="text" required name="buyingprice"  id="mybuyingprice"  value="<?php echo set_value('buyingprice'); ?>"  class="form-control"  placeholder="Enter buying price">
			
		<span class="text-danger"> <?php echo form_error('buyingprice'); ?>
		
		</span>
	</div>
  </div>
  	
	
		<div class="form-group" style="margin:0px;margin-top:0px;">
    <label for="inputretailmargin" class="col-sm-3 control-label">	Regular Profit Margin(%)</label>
    <div class="col-sm-3">

				<input type="text" name="retailmargin"  id="myretailmargin" maxlength="2"  onblur="getRetailmargin()"  value="<?php echo set_value('retailmargin'); ?>"  class="form-control"  placeholder="Enter  margin in % form">
			
		
	</div>
	
	    <label for="inputmywholesalemargin" class="col-sm-3 control-label">	Wholesale Profit Margin(%)</label>
    <div class="col-sm-3">

				<input type="text" name="mywholesalemargin"  id="mywholesalemargin" maxlength="2"  onblur="getWholesalemargin()"  value="<?php echo set_value('mywholesalemargin',0); ?>"  class="form-control"  placeholder="Enter  margin in % form">
			
		
	</div>
  </div>
	<div class="form-group">
    <label for="inputsellingprice" class="col-sm-2 control-label">	Regular (S.)  Price</label>
    <div class="col-sm-10">

				<input type="text" name="sellingprice" id="mysellingprice" required value="<?php echo set_value('sellingprice'); ?>"  class="form-control"  placeholder="Enter selling price">
			
		<span class="text-danger"> <?php echo form_error('sellingprice'); ?>
		
		</span>
	</div>
  </div>
	
		<div class="form-group">
    <label for="inputwholesaleprice" class="col-sm-2 control-label">	Wh. Price</label>
    <div class="col-sm-10">

				<input type="text" name="wholesaleprice"  id="mywholesaleprice" value="<?php echo set_value('wholesaleprice'); ?>"  class="form-control"  placeholder="Enter whole sale price">
			
		<span class="text-danger"> <?php echo form_error('wholesaleprice'); ?>
		
		</span>
	</div>
  </div>
		<div class="form-group">
    <label for="inputqty" class="col-sm-2 control-label">	Quantity</label>
    <div class="col-sm-10">

				<input type="text" name="qty" value=""  class="form-control" required  placeholder="Enter quantity in stock">
			
		<span class="text-danger"> <?php echo form_error('qty'); ?>
		
		</span>
	</div>
  </div>
  	
	
			<div class="form-group" style="display:none">
    <label for="inputpromoprice" class="col-sm-2 control-label" >	From QTY</label>
    <div class="col-sm-10">

				<input type="text" name="promoprice" value="<?php echo set_value('promoprice',0); ?>"  class="form-control"  placeholder="Enter From qty to sale in whole sale  price">
			
		<span class="text-danger"> How many Qty worth whole sale price<?php echo form_error('promoprice'); ?>
		
		</span>
	</div>
  </div>
	
	
  <div class="form-group" style="display:none">
    <label for="inputuom" class="col-sm-2 control-label" >Default UOM</label>
    <div class="col-sm-10">
	<select class="form-control" name="uom"  required>
	
	<option value=""  >---Select UOM-</option>

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


							


if(is_array($uom)) {

   foreach($uom as $uomrow){

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



	<?php

}} else {
    echo 'No uom.';
}
	
?>
</select>
		

		
	</div>
  </div>
  
  
  	
	
	


  <div class="form-group" style="display:none">
    <label for="inputbranch" class="col-sm-2 control-label" >Branch</label>
    <div class="col-sm-10">
	<select class="form-control" name="branch"  required>
	
	<option value=""  >---Select Branch/Counter Name to dispatch--</option>
	<option value="no"  >Dont Dispatch to Stocklist directly</option>
	<option value="all"  selected="selected" > Dispatch to all Stocklist directly</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 Branch/Counter.';
}
	
?>
</select>
		

		
	</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" style="margin:0px">
    <label for="inputreorderevel" class="col-sm-2 control-label">	Reorder Level</label>
    <div class="col-sm-10">

				<input type="text" required name="reorderevel" value="0"  class="form-control"  placeholder="Enter Reorder Level e.g 10">
			
		<span class="text-danger"> <?php echo form_error('reorderevel'); ?>
		
		</span>
	</div>
  </div>
	
	
	
	<div class="form-group" style="margin:0px;display:none" >
    <label for="inputvattype" class="col-sm-2 control-label">	VAT type</label>
    <div class="col-sm-10">

		<select class="form-control2" name="vattype" >
	
			 <?php
				 if( $display1=="yes"){
					 ?>
						<option value="VATABLE" selected  >VATABLE</option>
 
					 <?php
				 }else{
					  ?>
					  				<option value="EXEMPTED"  selected >EXEMPTED</option>


					 <?php
				 }
					 ?>
							<option value="VATABLE"   >VATABLE</option>

			<option value="ZERO RATED"  >ZERO RATED</option>
				<option value="EXEMPTED"  >EXEMPTED</option>

	
</select>


Tax Type:
	<select class="form-control2" name="taxtype" >
	
			 <?php
				 if( $display1 !="yes"){
					 ?>
						<option value="na" selected  >na</option>
 
					 <?php
				 }else{
					  ?>
					  				<option value="Inclusive"  selected >Vat Inclusive </option>
					  				<option value="Exclusive"   >Vat Exclusive</option>


					 <?php
				 }
					 ?>
							

	
</select>











	</div>
  </div>
	

	
	
		<div class="form-group" style="display:none">
    <label for="inputtax_included" class="col-sm-2 control-label">	Tax included (%)</label>
    <div class="col-sm-10">

				<input type="text" name="tax_included" value="<?php  echo$mytax ; ?>"  class="form-control"   placeholder="Enter tax if any">
			
		<span class="text-danger">Enter tax to be included if any <?php echo form_error('tax_included'); ?>
		
		</span>
	</div>
  </div>
  	
		<div class="form-group" style="display:none">
    <label for="inputstore" class="col-sm-2 control-label">	Rack /Store Name</label>
    <div class="col-sm-10">

				<input type="text" name="store" value="<?php echo set_value('store'); ?>"  class="form-control"   placeholder="Enter store / rack name">
			
		<span class="text-danger">Enter the name where the product is stored <?php echo form_error('store'); ?>
		
		</span>
	</div>
  </div>
  	
	
	
	<div class="form-group" style="display:none">
    <label for="inputexpdate" class="col-sm-2 control-label">	Expiry date(YYYY-MM-DD)</label>
    <div class="col-sm-10">

				<input type="text"   id="expdate1" name="expdate" value="<?php echo set_value('expdate'); ?>"  class="form-control"   placeholder="Enter expiry date">
			
		<span class="text-danger"> Enter expiry date  if any<?php echo form_error('expdate'); ?>
		
		</span>
	</div>
  </div>
	
	
	
	
	
	
	<div class="form-group" style="display:none">
    <label for="inputassetaccount" class="col-sm-2 control-label">Asset / Purchase Acount?</label>
    <div class="col-sm-10">
	<select class="form-control"  name="assetaccount" >
	
		
<?php 
						           		$configuration = $this->usermodel->populateallarray('smsconfig','id',$companyid);
			 
$assetaccount=$configuration[0]['assetaccount'];

								$glaccounts = $this->usermodel->populateall('glaccounts','number',$assetaccount);
if(is_array($glaccounts)) {

   foreach($glaccounts as $glaccounts){

    ?>
					<option  selected="selected"  value="<?=  $glaccounts->number;   ?>"><?=  $glaccounts->accountname; ?></option>



	<?php

}} else {
	?>
			<option value=""   selected="selected">---Select asset Account---</option>

	<?php
  //  echo 'No GL Account.';
}
	

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


if(is_array($glaccounts)) {

   foreach($glaccounts as $glaccounts){

    ?>
					<option  value="<?=  $glaccounts->number;   ?>"><?=  $glaccounts->accountname; ?></option>



	<?php

}} else {
    echo 'No GL Account.';
}
	
?>


</select>
		
	

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

	</div>
  </div>
	
	<div class="form-group" style="display:none">
    <label for="inputsalesaccount" class="col-sm-2 control-label">Income Account?</label>
    <div class="col-sm-10">
	<select class="form-control" name="salesaccount" >
	
<?php 

$assetaccount=$configuration[0]['salesaccount'];

								$glaccounts = $this->usermodel->populateall('glaccounts','number',$assetaccount);
if(is_array($glaccounts)) {

   foreach($glaccounts as $glaccounts){

    ?>
					<option  selected="selected"  value="<?=  $glaccounts->number;   ?>"><?=  $glaccounts->accountname; ?></option>



	<?php

}} else {
	?>
			<option value=""   selected="selected">---Select Income Account---</option>

	<?php
  //  echo 'No GL Account.';
}
	

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


if(is_array($glaccounts)) {

   foreach($glaccounts as $glaccounts){

    ?>
					<option  value="<?=  $glaccounts->number;   ?>"><?=  $glaccounts->accountname; ?></option>



	<?php

}} else {
    echo 'No GL Account.';
}
	
?>
		

	

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

	</div>
  </div>
	
	<div class="form-group" style="display:none">
    <label for="inputexpenseaccount" class="col-sm-2 control-label">Expense Acount?</label>
    <div class="col-sm-10">
	<select class="form-control" name="expenseaccount" >
	
			
<?php 
					 
$assetaccount=$configuration[0]['expenseaccount'];

								$glaccounts = $this->usermodel->populateall('glaccounts','number',$assetaccount);
if(is_array($glaccounts)) {

   foreach($glaccounts as $glaccounts){

    ?>
					<option  selected="selected"  value="<?=  $glaccounts->number;   ?>"><?=  $glaccounts->accountname; ?></option>



	<?php

}} else {
	?>
			<option value=""   selected="selected">---Select Expense Account---</option>

	<?php
  //  echo 'No GL Account.';
}
	

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


if(is_array($glaccounts)) {

   foreach($glaccounts as $glaccounts){

    ?>
					<option  value="<?=  $glaccounts->number;   ?>"><?=  $glaccounts->accountname; ?></option>



	<?php

}} else {
    echo 'No GL Account.';
}
	
?>
		


	

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

	</div>
  </div>
	
	
	
	
	<div class="form-group" style="display:none">
    <label for="inputphoto" class="col-sm-2 control-label">	Upload Image</label>
    <div class="col-sm-10">
	<input type="hidden" name="imgid"   value="<?php if(isset($imgid)) {echo $imgid; }?>"  class="form-control">


	<input type="file" name="photo" value="<?php echo set_value('photo'); ?>"id="photo" class="form-control"  placeholder="Please upload image if any">
			<span class="text-danger"> <?php echo form_error('photo'); ?>
		
		</span>
	</div>
	</div>
	
	 <div class="form-group">

    <div class="col-sm-offset-2 col-sm-10">
     
	         <button type="submit"  value="product" name="btn_addproduct" class="btn btn-default"> Add Product   </button>

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

    

				</div>

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

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

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

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



				echo $this->session->flashdata('msg'); 
		
                 echo form_open('user/viewstockreport' , 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">Counter</label>
    <div class="col-sm-10">
	<select class="form-control" name="branchname"  id="branchname" required>
	
	<option value=""  >---Select Branch/Counter Name--</option>

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


if(is_array($mybranch)) {

   foreach($mybranch as $branchrow){

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




	<?php

}} else {
    echo 'No Branch available.';
}
	
?>
	
	
	
	
	
	
	<?php 
	
	
 if( $viewallbranches==true){
	?>
								<option value="all"  >All branches/Counters</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="inputorderamount" class="col-sm-2 control-label">Product Type</label>
    <div class="col-sm-10">
	<select class="form-control" name="orderamount" id="orderamount" required >
	
			<option value="all" selected="selected" >---Select all Products---</option>
		<option value="mainitem"   >Main-item</option>
		<option value="production"  >Production-item</option>
		<option value="subitem"  >Sub-item</option>
						<option value="Sub-Single-item"  >Sub-Single-item</option>

			<option value="accompaniment"  >Accompaniment</option>


	

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

	</div>
  </div>
    
  

  
  
  
  
    
     <div class="form-group">
    <label for="inputtype" class="col-sm-2 control-label">Action type</label>
    <div class="col-sm-10">
	<select class="form-control" name="type" required>
	<option  value=""  >---Select option--</option>
	<option value="view" selected="selected" >I want to view stocks</option>
		<option value="viewall" selected="selected" >I want to view all counters</option>

<option value="download">I want to download stocks</option>

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

	</div>
  </div>
   

	
	 <div class="form-group">

    <div class="col-sm-offset-2 col-sm-10">
     
	         <button type="submit"  value="stock" name="btn_stock" class="btn btn-default"> View /Download Stock  </button>

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

    

				</div>

		</div>
	    </div>
    </div>	
	
	
	
	
	
	<div id="uploadinventoryModal" 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">Please Upload  inventory GL</h4>
		
      </div>
      <div class="modal-body">
       <a href="<?php echo base_url();?>downloads/inventorybalance.xlsx" class="btn btn-info">Download    template </a>	 

	  	

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



				echo $this->session->flashdata('msg'); 
		
                 echo form_open('user/uploadinventory' , 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="type" value="product"id="type" class="form-control" required placeholder="Enter type">
				<input type="hidden" name="view" value="user/viewproducts"id="view" class="form-control" required placeholder="Enter view">
	
	
	<div class="form-group">
    <label for="inputsurname" class="col-sm-2 control-label">	 LIST</label>
    <div class="col-sm-10">
		
			<input type="file" name="file" width="400"  value="<?php echo set_value('file') ;?>" placeholder="Select EXCELL" class="form-control" required placeholder="Enter Surname"  >

		  		
				
		<span class="text-danger"> Upload correct format of the File  here..<?php echo form_error('file'); ?>
		
		</span>
	</div>
  </div>	
  
	  
  <div class="form-group">
    <label for="inputstatus" class="col-sm-2 control-label">Inventory Status?</label>
    <div class="col-sm-10">
	<select class="form-control" name="status" id="status"required>
	
		<option value="" selected  >---Select Inventory Status---</option>
		<option value="old"  >Existing asset(Balance B/F)</option>

	

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

	</div>
  </div>

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

    <div class="col-sm-offset-2 col-sm-10">
     
	         <button type="submit"  value="assets" name="btn_uploadinventory" class="btn btn-default">Upload Inventory B/F  </button>

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

    

				</div>

		</div>
	    </div>
    </div>
	
	
		
<div id="editModal" 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">Transfer stock (<?PHP

 $postedtime = date('Y-m-d');
		$currenttime = date('H:i:s');
 		echo$dateposted =  ($postedtime)." ".$currenttime ;?>)</h4>
      </div>
      <div class="modal-body">
      
	  	

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



				echo $this->session->flashdata('msg'); 
		
                 echo form_open('user/transferstock' , 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="type" value="product"id="type" class="form-control" required placeholder="Enter type">
				<input type="hidden" name="view" value="user/viewproductlist"id="view" class="form-control" required placeholder="Enter view">
		<input type="hidden" name="productid" value=""id="productid1" class="form-control" required placeholder="Enter productid">
		<input type="hidden" name="page" value="<?php echo $page ?>"id="page" class="form-control" required placeholder="Enter bookid">
<input type="hidden" name="mytype" value="shop"id="mytype" class="form-control" required placeholder="Enter type">





<div class="form-group">
    <label for="inputfrom" class="col-sm-2 control-label">Branch(From)</label>
    <div class="col-sm-10">
	<select class="form-control" name="from"  required readonly id="from" >

	
	<option value="" selected></option>
	
	<option value=""  >---Where do you want to transfer product to?---</option>

	
	<?php 
					 

					 $branch= $this->usermodel->populateall('branch','companyid',$companyid);
					//$branch  = $this->usermodel->populatealldatanoarray('branch','id', $branchid,'companyid',$companyid );



if(is_array($branch)) {

   foreach($branch as $branchrow){

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



	<?php

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

	</div>
  </div>
  	








	
     <div class="form-group">
    <label for="inputbranch" class="col-sm-2 control-label">To?</label>
    <div class="col-sm-10">
	<select class="form-control" name="branch" required>
	
	<option value=""  >---Where do you want to transfer product to?---</option>

	
	<?php 
					 

					 $branch= $this->usermodel->populateall('branch','companyid',$companyid);
					//$branch  = $this->usermodel->populatealldatanoarray('branch','id<>', $branchid,'companyid',$companyid );



if(is_array($branch)) {

   foreach($branch as $branchrow){

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



	<?php

}} else {
    echo 'No branch available.';
}
	
?>

	<option value="Main"  >Move Back to Main Store?</option>

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

	</div>
  </div>
  	

  
	
	
		<div class="form-group">
    <label for="inputtotal" class="col-sm-2 control-label">	Total items to Add </label>
    <div class="col-sm-10">
	
		  		<input type="text"   name="total" value="<?php echo set_value('total'); ?>"id="total1" class="form-control" required placeholder="Enter total">
		 
				
		<span class="text-danger"> 	How many items do you want to add?<?php echo form_error('total'); ?>
		
		</span>
	</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" readonly name="code" value="<?php echo set_value('code'); ?>"id="code1" class="form-control" required placeholder="Enter  code">
		 
				
		<span class="text-danger"> <?php echo form_error('name'); ?>
		
		</span>
	</div>
  </div>	

		<div class="form-group">
    <label for="inputname" class="col-sm-2 control-label">	Product Name</label>
    <div class="col-sm-10">
	
		  		<input type="text" name="name" value="<?php echo set_value('name'); ?>"id="name1" class="form-control" readonly required placeholder="Enter  Product name">
		 
				
		<span class="text-danger"> <?php echo form_error('name'); ?>
		
		</span>
	</div>
  </div>
	
		<div class="form-group">
    <label for="inputqty" class="col-sm-2 control-label">	Total Remaining items </label>
    <div class="col-sm-10">
	
		  		<input type="text"  readonly name="qty" value="<?php echo set_value('qty'); ?>"id="qty1" class="form-control" required placeholder="Enter qty">
		 
				
		<span class="text-danger"> <?php echo form_error('qty'); ?>
		
		</span>
	</div>
  </div>
	
	
	
	
	
		<div class="form-group">
    <label for="inputreorderevel" class="col-sm-2 control-label">	Reorder level</label>
    <div class="col-sm-10">
	
		  		<input type="text"  readonly  name="reorderevel" value="<?php echo set_value('reorderevel'); ?>"id="reorderevel1" class="form-control" required placeholder="Enter reorder level">
		 
				
		<span class="text-danger"> <?php echo form_error('reorderevel'); ?>
		
		</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" class="form-control"><?php echo set_value('description'); ?></textarea>		
		<span class="text-danger"> Enter description if any<?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="transfer" name="btn_uaddstock" class="btn btn-default"> Transfer Stock   </button>

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

    

				</div>

		</div>
	    </div>
    </div>	
	
	
	
	
	
<div id="moveModal" 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">Transfer stock (<?PHP

 $postedtime = date('Y-m-d');
		$currenttime = date('H:i:s');
 		echo$dateposted =  ($postedtime)." ".$currenttime ;?>)</h4>
      </div>
      <div class="modal-body">
      
	  	

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



				echo $this->session->flashdata('msg'); 
		
                 echo form_open('user/movetock' , 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="type" value="product"id="type" class="form-control" required placeholder="Enter type">
				<input type="hidden" name="view" value="user/viewproductlist"id="view" class="form-control" required placeholder="Enter view">
		<input type="hidden" name="productid" value=""id="productid3" class="form-control" required placeholder="Enter productid">
		<input type="hidden" name="page" value="<?php echo $page ?>"id="page" class="form-control" required placeholder="Enter bookid">
<input type="hidden" name="mytype" value="shop"id="mytype" class="form-control" required placeholder="Enter type">

<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=""  >---Where do you want to transfer product to?---</option>

	
	<?php 
					 

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



if(is_array($branch)) {

   foreach($branch as $branchrow){

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



	<?php

}} else {
    echo 'No branch available.';
}
	
?>

	<option value="Main Store"  >Move Back to Main Store?</option>

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

	</div>
  </div>
  	

  

  	<div class="form-group">
    <label for="inputnewproduct" class="col-sm-2 control-label">Next Product Code</label>
    <div class="col-sm-10">
	
		  		<input type="text"   name="newproduct" value="<?php echo set_value('newproduct'); ?>"id="newproduct" class="form-control" required placeholder="Enter the code">
		 
				
		<span class="text-danger"> 	How many items do you want to add?<?php echo form_error('newproduct'); ?>
		
		</span>
	</div>
  </div>
	

  	<div class="form-group">
    <label for="inputtotal" class="col-sm-2 control-label">	Total items to Add </label>
    <div class="col-sm-10">
	
		  		<input type="text"   name="total" value="<?php echo set_value('total'); ?>"id="total3" class="form-control" required placeholder="Enter total">
		 
				
		<span class="text-danger"> 	How many items do you want to add?<?php echo form_error('total'); ?>
		
		</span>
	</div>
  </div>
	
	
		<div class="form-group">
    <label for="inputtotal" class="col-sm-2 control-label">	Total items to deduct </label>
    <div class="col-sm-10">
	
		  		<input type="text"   name="description" value="<?php echo set_value('description'); ?>"id="description" class="form-control" required placeholder="Enter total to deduct">
		 
				
		<span class="text-danger"> 	How many items do you want to add?<?php echo form_error('description'); ?>
		
		</span>
	</div>
  </div>
       
  


<div class="form-group">
    <label for="inputbranch" class="col-sm-2 control-label">Branch(From)</label>
    <div class="col-sm-10">
	<select class="form-control" name="branch"  readonly id="branch3" >

	
	<option value="" selected></option>
	
	<option value=""  >---Where do you want to transfer product to?---</option>

	
	<?php 
					 

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



if(is_array($branch)) {

   foreach($branch 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('from'); ?>

	</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" readonly name="code" value="<?php echo set_value('code'); ?>"id="code3" class="form-control" required placeholder="Enter  code">
		 
				
		<span class="text-danger"> <?php echo form_error('name'); ?>
		
		</span>
	</div>
  </div>	

		<div class="form-group">
    <label for="inputname" class="col-sm-2 control-label">	Product Name</label>
    <div class="col-sm-10">
	
		  		<input type="text" name="name" value="<?php echo set_value('name'); ?>"id="name3" class="form-control" readonly required placeholder="Enter  Product name">
		 
				
		<span class="text-danger"> <?php echo form_error('name'); ?>
		
		</span>
	</div>
  </div>
	
		<div class="form-group">
    <label for="inputqty" class="col-sm-2 control-label">	Total Remaining items </label>
    <div class="col-sm-10">
	
		  		<input type="text"  readonly name="qty" value="<?php echo set_value('qty'); ?>"id="qty3" class="form-control" required placeholder="Enter qty">
		 
				
		<span class="text-danger"> <?php echo form_error('qty'); ?>
		
		</span>
	</div>
  </div>
	
	
	
	
	
		<div class="form-group">
    <label for="inputreorderevel" class="col-sm-2 control-label">	Reorder level</label>
    <div class="col-sm-10">
	
		  		<input type="text"  readonly  name="reorderevel" value="<?php echo set_value('reorderevel'); ?>"id="reorderevel3" class="form-control" required placeholder="Enter reorder level">
		 
				
		<span class="text-danger"> <?php echo form_error('reorderevel'); ?>
		
		</span>
	</div>
  </div>
	
	
	
	
	

		
		
		
	
  
  
  
  
  
  
  
  
  
  

  
  
	 <div class="form-group">

    <div class="col-sm-offset-2 col-sm-10">
     
	         <button type="submit"  value="move" name="btn_movestock" class="btn btn-default"> Move Stock   </button>

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

    

				</div>

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

 
</div>


</div>


</div>












