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


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); 

	 
 }
}








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

	 $(document).on("click", "#managebtnbarcode", function()
        {
          var code = $(this).data('code');
		  $("#mycode").val(code); 
		    var name = $(this).data('name');
		  $("#myname").val(name); 
		    var shortname = $(this).data('shortname');
		  $("#myshortname").val(shortname); 
		  
		  
		   
        });
			
			
			
	 $(document).on("click", "#managebtndelete", function()
        {
          var itemid = $(this).data('id');
		  $("#itemid1").val(itemid); 
		  
		  
		   
        });
			
			
			
			
			
			
			
			
			
			
		
     $(document).on("click", "#manageorderbtn", function()
        {
          var productid = $(this).data('id');
		  $("#productid2").val(productid); 
		  
		    var name = $(this).data('name');
		   $("#name2").val(name); 
		   
		     var description = $(this).data('description');
		   $("#description2").val(description); 
		 
		     var qty = $(this).data('qty');
		   $("#qty2").val(qty);


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

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


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

		     var reorderevel = $(this).data('reorderevel');
		   $("#reorderevel3").val(reorderevel); 			   
        });
		
	
		
     $(document).on("click", "#managebtn", function()
        {
          var productid = $(this).data('id');
		  $("#productid1").val(productid); 
		  
		    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", "#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 producttype = $(this).data('producttype');
		   $("#producttype").val(producttype); 
		   
		   
		   
   var reorderquantity = $(this).data('reorderquantity');
		   $("#reorderquantity").val(reorderquantity); 
		   
		   
		   
		     var description = $(this).data('description');
		   $("#description").val(description); 
		 
		     var qty = $(this).data('qty');
		   $("#qty").val(qty);

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

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

		     var reorderevel = $(this).data('reorderevel');
		   $("#reorderevel").val(reorderevel); 	
 var category2 = $(this).data('category');
		   $("#category2").val(category2); 		
	
		   
 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 assetaccount = $(this).data('assetaccount');
		   $("#assetaccount").val(assetaccount);
		   
		   
		       var salesaccount = $(this).data('salesaccount');
		   $("#salesaccount").val(salesaccount);
		   
		       var expenseaccount = $(this).data('expenseaccount');
		   $("#expenseaccount").val(expenseaccount);
		   
		   
		   
		   
		     var vattype = $(this).data('vattype');
		   $("#vattype").val(vattype); 
		     var maincode = $(this).data('code');
		   $("#maincode").val(maincode); 	
		        var taxtype = $(this).data('taxtype');
		   $("#taxtype").val(taxtype); 	
		   
        });
		
		
    </script>
 
 <div class="row">
  <?php
  
  
  echo $this->session->flashdata('deletemsg'); 
 
				echo $this->session->flashdata('msg'); 
   $session_data = $this->session->userdata('logged_in');

   	 
	 $data['branchid'] = $session_data['branchid'];
	 $branchid = $data['branchid'];
	 
 	$data['id'] = $session_data['id'];
        
		 $userid = $data['id'];
$data['companyid'] = $session_data['companyid'];
	 $companyid = $data['companyid'];
		 $data['usertype'] = $session_data['usertype'];
	 $usertype = $data['usertype'];	
     $addproductaction=$this->usermodel->populatuserpermissionsdataarray('products','add',$userid);
	      $bulkaction=$this->usermodel->populatuserpermissionsdataarray('products','bulk',$userid);
  $removestockaction=$this->usermodel->populatuserpermissionsdataarray('products','removestock',$userid);
  $removeallstockaction=$this->usermodel->populatuserpermissionsdataarray('products','removeallstock',$userid);
  $priceaction=$this->usermodel->populatuserpermissionsdataarray('products','price',$userid);
		  	      $viewallbranches=$this->usermodel->populatuserpermissionsdataarray('reports','viewall',$userid);
	    $dontshowstock=$this->usermodel->populatuserpermissionsdataarray('sales','dontshowstock',$userid);

			 $finalsalesid = $userid.time();
			 
			 
			    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('products','update',$userid);
  $addstockaction=$this->usermodel->populatuserpermissionsdataarray('products','addstock',$userid);
  $deleteaction=$this->usermodel->populatuserpermissionsdataarray('products','delete',$userid);
  $moreaction=$this->usermodel->populatuserpermissionsdataarray('products','more',$userid);
  $dispatchaction=$this->usermodel->populatuserpermissionsdataarray('products','dispatch',$userid);
  $viewbprice=$this->usermodel->populatuserpermissionsdataarray('products','viewbprice',$userid);
  $bulkpriceupdate=$this->usermodel->populatuserpermissionsdataarray('products','bulkpriceupdate',$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='#viewModal' class="btn btn-default">View stocks</a>

  <a data-toggle='modal' data-target='#addModal' class="btn btn-default">Add product </a>

																	 

	 
	 	<?php	
		}else{ }
  ?>
  
  
	<?php

	
 if( $bulkaction==true){
	 ?>

	 
	 	<?php	

 }else{
	
 }
  ?>
												 													                     <a data-toggle='modal' data-target='#uploadModal' class="btn btn-default">Product Bulk upload  </a>


 <a href="<?php echo base_url();?>downloads/products.xlsx" class="btn btn-default">download    template </a>	 


 
	 		<?php

	
 if( $removestockaction==true){
	 ?>

				 <a href="<?php echo base_url();?>user/viewmyorder" class="btn btn-default"> My order </a>

	 	<?php	

 }else{
	
 }
  ?>

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

				 <a href="<?php echo base_url();?>user/viewallorder" class="btn btn-default"> All order </a>

	 	<?php	

 }else{
	
 }
  ?>
  				 <a href="<?php echo base_url();?>user/viewserialnumbers" class="btn btn-default"> Serials No </a>

  						  <a data-toggle='modal' data-target='#addsupplierModal' class="btn btn-default">Add Company </a>
						  										                     <a data-toggle='modal' data-target='#addcategoryModal' class="btn btn-default">Add Sub Category/group </a>


  								<a data-toggle='modal' data-target='#subcategoryModal' class="btn btn-default">Search 	by Category</a>

								<a data-toggle='modal' data-target='#userModal' class="btn btn-default">search Per Supplier</a>
  								<a data-toggle='modal' data-target='#dispatchModal' class="btn btn-default">Dispatch</a>
  				 <a href="<?php echo base_url();?>user/viewbulkdispatch" class="btn btn-default"> View Bulk dispatch </a>

  				 <a href="<?php echo base_url();?>user/viewassets" class="btn btn-default"> Assets </a>
  				 <a href="<?php echo base_url();?>user/viewtocktaking" class="btn btn-default"> Stock taking </a>

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

						 <a data-toggle='modal' data-target='#addbulkPriceModal' class="btn btn-primary">Bulk Price </a>

	 	<?php	

 }
  ?>


			<span style="color:red"class="pull-center"> Products in main store </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/searchallproduct", $attr);?>
            <div class="form-group">
			
                <div class="col-md-5">
                    <input class="form-control" id="searchterm"  autofocus name="searchterm" placeholder="Search for product by name, code,description.." type="text" value="<?php echo set_value('searchterm'); ?>" />
                </div>
                <div class="col-md-4">
                    <input id="btn_search" name="btn_search" type="submit" class="btn btn-default" value="Search" />
                    <a href="<?php echo base_url(). "user/viewproducts"; ?>" 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>Weight</th>
	

	 
		   <th>Unit (B.) price</th> 
		    <th>Thickness</th> 
		<th>Height</th>
			

<th>Qty</th>
<th>Uom</th>

<th>Edit</th>
<th>Price</th>
<th>Dispatch</th>
<th>Stock</th>
<!--

<th>Issue</th>
-->

              

<th>More</th>

			  </tr>

             </thead>
<?php

  
  $smsconfig = $this->usermodel->populateallarray('smsconfig','id',$companyid);
		 	  $view=$smsconfig[0]['view'];	
		  		 	  $display1=$smsconfig[0]['display1'];


 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;
$code=$c->code;


?>

              
  <td><?php echo $c->code ; ?></td>
  
      <td><?php 
	$category=$c->category;
	
	$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 $c->name."-".$c->description ; ?></td>
	    <td><?php echo $c->sellingprice ; ?></td>



  <td>
  
  	 
	 		<?php

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

 }else{
	echo $c->buyingprice ; 
 }
  ?>
  
  
  </td>
          <td><?php echo $c->description ?>
		  
		 
		  </td> 
      <td><?php echo $c->store ; ?></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-warning">
			<?php  echo $c->qty ; 	?>
			</div>
			<?php
			
			}else if($qty1<=1){
			?>
			<div class="btn-danger">
			<?php  echo $c->qty ; 	?>
			</div>
			<?php
			}
			
			}
			?>
			
		</td>
      <td><?php echo $c->uom ; ?></td>  

              <td>
			
			<?php

	
 if( $updateaction==true){
	 ?>
		 <a class="btn btn-default editbtn" id="editbtn"     data-reorderquantity='<?php echo  $c->reorderquantity;?>'  data-taxtype='<?php echo  $c->taxtype;?>'   data-vattype='<?php echo  $c->vattype;?>' data-assetaccount='<?php echo  $c->assetaccount;?>' data-salesaccount='<?php echo  $c->salesaccount;?>' data-expenseaccount='<?php echo  $c->expenseaccount;?>'  data-tax_included='<?php echo  $c->tax_included;?>' data-uom='<?php echo  $c->uom;?>'  data-producttype='<?php echo  $c->producttype;?>'   data-shortname='<?php echo  $c->shortname;?>'  data-status='<?php echo  $c->status;?>'  data-orderamount='<?php echo  $c->orderamount;?>'    data-expdate='<?php echo  $c->expdate;?>'data-store='<?php echo  $c->store;?>' 	data-supplier='<?php echo  $c->supplier;?>'  data-category='<?php echo  $c->category;?>'  data-buyingprice='<?php echo  $c->buyingprice;?>' data-sellingprice='<?php echo  $c->sellingprice;?>'data-promoprice='<?php echo  $c->promoprice;?>'  data-wholesaleprice='<?php echo  $c->wholesaleprice;?>' 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='#editProductModel'> Edit </a>	 

	 	<?php	

 }else{
	
 }
  ?>			  
	 </td>

          <td>
			  
			<?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{
	
 }
  ?>			  
	 </td>

	 <td>
	 
	 
	 
	 		<?php

	
 if( $dispatchaction==true){
	 ?>

	 	 <a class="btn btn-default managebtn" id="managebtn"	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'> Dispatch </a>	 

	 	<?php	

 }else{
	
 }
  ?>
      </td>

<td>
	 
	 
	 
	 		<?php

	
 if( $addstockaction==true){
	 ?>

	 	 <a class="btn btn-default managestockbtn" id="managestockbtn"	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>
									<?php
										 	 	$salesid = $userid.time();

										 if( $deleteaction==true){
											
											?>
                                    <ul class="dropdown-menu dropdown-default pull-right" role="menu">
                                        
                                        <!-- teacher EDITING LINK -->
                                      
													  <li> 
	<?php

	
 if( $moreaction==true){
	 ?>

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

	 	<?php	

 }else{
	
 }
  ?>

                                                <i class="glyphicon glyphicon-pencil"></i>
																View stock history
                                                </a>
                                                        </li>
														
														   <li class="divider"></li>

																<li> 
										 <a class="btn btn-info managebtn" id="managebtnbarcode"		data-shortname='<?php echo  $c->shortname;?>'  data-name='<?php echo  $c->name;?>' data-code='<?php echo  $c->code;?>'  data-id='<?php echo  $c->id;?>'    data-toggle='modal' data-target='#myBarcode<?php  $c->id; ?>'>	 


                                                <i class="glyphicon glyphicon-pencil"></i>
																Generate Barcode
                                                </a>
                                                        </li>
														
														
													                                        <li class="divider"></li>
	
														
															<li> 
				<a  id="more" target="_blank" class="btn btn-default" href="<?php echo base_url();?>user/viewcurrentserials?branch=Main&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=Main&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> 
				<a  id="more" target="_blank" class="btn btn-default" href="<?php echo base_url();?>user/viewphoto?randomitemidentifier=<?php   {echo  $id;}  ?>&page=<?php if(isset($page)) {echo "Systemusers/viewproducts/".$page;}else { echo"Systemusers/viewproducts/";}?>"> 
					<i class="glyphicon glyphicon-pencil"></i>
															View Image
																
                                                </a>
                                                        </li> 	
																

                                     


													
																									                                        <li class="divider"></li>
		
											  <li> 
										 <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>
									
									
                                        <li class="divider"></li>
                                        
                                        <!-- teacher DELETION LINK -->
                                        
                                    </ul>
											<?php
										}
										?>
                                </div>
</td>
             </tr>

	<?php endforeach;} ?>

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

	 
		   <th>Unit (B.) price</th> 
		   <th>Thickness</th> 
		<th>Height</th>
				

<th>Qty</th>
<th>Uom</th>

<th>Edit</th>
<th>Price</th>
<th>Dispatch</th>
<th>Stock</th>
<!--
<th>Issue</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="dispatchModal" class="modal fade" role="dialog">
  <div class="modal-dialog">

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


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

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

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


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



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


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


</select>
		

	</div>
  </div>
  

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


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


</select>
		

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

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


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


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

	
	<?php 
					 

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


if(is_array($mybranch)) {

   foreach($mybranch as $branchrow){

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



	<?php

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

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


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

	
	<?php 
					 

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


if(is_array($mybranch)) {

   foreach($mybranch as $branchrow){

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



	<?php

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

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

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

	

	
	 <div class="form-group">

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

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

    

				</div>

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

							
							
							
							
							
							
							
							
							
							
							
				
 
							
							
							
							
							
					
			<div id="subcategoryModal" 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">Products  per sub category</h4>
      </div>
      <div class="modal-body">
      
	  	

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



				echo $this->session->flashdata('msg'); 
		
                 echo form_open('user/viewallproductbycategory' , 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="inputcategory" class="col-sm-2 control-label">	Sub category?</label>
    <div class="col-sm-10">
	<select class="form-control" name="category"  id="category" required>
	
	<option selected="selected" value="all"  >---All/Any Category--</option>

	
	<?php 

					 		$productcategory = $this->usermodel->populatealldatawhere('productcategory','name','ASC','companyid',$companyid);

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


							


if(is_array($productcategory)) {

   foreach($productcategory as $productcategoryrow){

   //echo $courserow->coursename;
    ?>
					<option value="<?=  $productcategoryrow->id;   ?>"><?=  $productcategoryrow->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="inputbranchid" class="col-sm-2 control-label">Counter/branch</label>
    <div class="col-sm-10">
	<select class="form-control" name="branchid"  id="branchid" required>
	
	
	<option value=""  >---Select Branch/Counter to Open--</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 selected="selected" value="<?=  $maincategoryrow->id;   ?>"><?=  $maincategoryrow->name; ?></option>



	<?php

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

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

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

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

    

				</div>

		</div>
	    </div>
    </div>
	
	
			
							
							
							
							
							
							
							
							
							
							
							
							
						
			<div id="userModal" 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">Low products  per supplier</h4>
      </div>
      <div class="modal-body">
      
	  	

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



				echo $this->session->flashdata('msg'); 
		
                 echo form_open('user/viewallproductbysupplier' , 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="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"  >---Select 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="supplier" name="btn_addproductsupplier" class="btn btn-default"> View products  </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="products">
	<input type="hidden" name="page" value="<?php echo $page ?>"id="page" class="form-control" required placeholder="Enter bookid">

<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">
				<input type="hidden" name="view" value="<?php if(isset($searchterm)) {echo "Systemusers/searchallproduct/".$page;}else { echo"Systemusers/viewproducts/".$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 id="myBarcode" 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">Barcode</h4>
      </div>
      <div class="modal-body">
        <h3>Are you sure you want generate barcode?</h3>
      </div>
      <div class="modal-footer">
	  	

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

		
                 echo form_open('user/generatebarcode' , 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;?>


		<div class="form-group">
    <label for="inputmyqty" class="col-sm-2 control-label">	How many Pieces? </label>
    <div class="col-sm-10">
	
		  		<input type="number"  name="myqty" required value="20" class="form-control"  placeholder="Enter how many codes to generate">
		 
				
		<span class="text-danger"> <?php echo form_error('myqty'); ?>
		
		</span>
	</div>
  </div>	
						
				<div class="form-group">
    <label for="inputcolumns" class="col-sm-2 control-label">	How many columns? </label>
    <div class="col-sm-10">
	
		  		<input type="number" name="columns" required value="1" class="form-control"  placeholder="Enter how many columns to generate">
		 
				
		<span class="text-danger"> <?php echo form_error('columns'); ?>
		
		</span>
	</div>
  </div>	
				





				<input type="hidden" name="view" value="user/viewproducts" id="view" class="form-control" required placeholder="Enter view">
 <input type="hidden" id="myname"name="myname" class="name" placeholder="name" value=""><br>
 <input type="hidden" id="myshortname"name="myshortname" class="shortname" placeholder="shortname" value=""><br>

 <input type="hidden" id="mycode"name="mycode" class="code" placeholder="code" value=""><br>
 <button type="button" class="btn btn-default" data-dismiss="modal">No</button>
 		  	         <button type="submit" name="btn_barcode" value="barcode" class="btn btn-info"> YES  </button>

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

  </div>

  </div>	




	<div id="addsupplierModal" 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  Campany/Customer</h4>
      </div>
      <div class="modal-body">
      
	  	

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



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

<input type="hidden" name="view" value="user/viewproducts"id="view" class="form-control" required placeholder="Enter status">


	
		  		<input type="hidden" name="category" readonly     value="<?php echo set_value('category','supplier'); ?>" class="form-control"  placeholder="Enter ocategory">
		 
				
				
						
						
					<div class="form-group">
    <label for="inputcompany" class="col-sm-2 control-label">	Company Name </label>
    <div class="col-sm-10">
	
		  		<input type="text" name="company" required value="<?php echo set_value('company'); ?>" class="form-control"  placeholder="Enter company name if any">
		 
				
		<span class="text-danger"> <?php echo form_error('company'); ?>
		
		</span>
	</div>
  </div>	
						
						
						
						
						
						
						
	<div class="form-group">
    <label for="inputfirstname" class="col-sm-2 control-label"> Contact	Names<span style="color:red;">*</span></label>
    <div class="col-sm-10">
	
		  		<input type="text" name="firstname" value="<?php echo set_value('firstname'); ?>" class="form-control" required placeholder="Enter first and last name">
		 
				
		<span class="text-danger"> <?php echo form_error('firstname'); ?>
		
		</span>
	</div>
  </div>

  
  	<div class="form-group">
    <label for="inputphone" class="col-sm-2 control-label">	Phone <span style="color:red;">*</span></label>
    <div class="col-sm-10">
	
		  		<input type="text" name="phone" value="<?php echo set_value('phone'); ?>" class="form-control" required placeholder="Enter phone e.g 254712345678">
		 
				
		<span class="text-danger"> e.g 254712345678 <?php echo form_error('phone'); ?>
		
		</span>
	</div>
  </div>
  
   	<div class="form-group">
    <label for="inputphoneaddress_1" class="col-sm-2 control-label">Phone 2	 </label>
    <div class="col-sm-10">
	
		  		<input type="text" name="address_1" value="<?php echo set_value('address_1'); ?>" class="form-control"  placeholder="Enter other line e.g 254712345678">
		 
				
		<span class="text-danger">Other Number e.g 254712345678 <?php echo form_error('address_1'); ?>
		
		</span>
	</div>
  </div>
  
   	<div class="form-group">
    <label for="inputphonegender" class="col-sm-2 control-label">Contact	Gender	 </label>
    <div class="col-sm-10">
	
	<select class="form-control" name="gender" >
	
	<option value=""  >---Select Gender---</option>
	<option value="female"  >female</option>
		<option value="male"  >male</option>
	</select>		 
				
		<span class="text-danger"> <?php echo form_error('gender'); ?>
		
		</span>
	</div>
  </div>
   <div class="form-group">
    <label for="inputcountry" class="col-sm-2 control-label">Country?</label>
    <div class="col-sm-10">
	<select class="form-control" name="country" >
	


	
	<?php 
					 
			$mycountry = $this->nationmodel->populatenation();
	


if(is_array($mycountry)) {

   foreach($mycountry as $mycountryrow){

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



	<?php

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

	</div>
  </div>
  
  
  
  
    	<div class="form-group">
    <label for="inputemail" class="col-sm-2 control-label">	Email </label>
    <div class="col-sm-10">
	
		  		<input type="email" name="email" value="<?php echo set_value('email'); ?>" class="form-control"  placeholder="Enter Your email">
		 
				
		<span class="text-danger"> <?php echo form_error('email'); ?>
		
		</span>
	</div>
  </div>
  
  	
  	<div class="form-group">
    <label for="inputidno" class="col-sm-2 control-label">	ID Number	 </label>
    <div class="col-sm-10">
	
		  		<input type="text" name="idno" value="<?php echo set_value('idno'); ?>" class="form-control"  placeholder="Enter idno if any ">
		 
				
		<span class="text-danger"> <?php echo form_error('idno'); ?>
		
		</span>
	</div>
  </div>
  
  
  
     
   	<div class="form-group">
    <label for="inputidnumber" class="col-sm-2 control-label">	PIN  </label>
    <div class="col-sm-10">
	
		  		<input type="text" name="idnumber" value="<?php echo set_value('idnumber'); ?>" class="form-control"  placeholder="Enter Campany Pin">
		 
				
		<span class="text-danger"> <?php echo form_error('idnumber'); ?>
		
		</span>
	</div>
  </div>
  
  
  
     
  
  
  
  
    
  	<div class="form-group">
    <label for="inputcity" class="col-sm-2 control-label">	City 	 </label>
    <div class="col-sm-10">
	
		  		<input type="text" name="city" value="<?php echo set_value('city'); ?>" class="form-control"  placeholder="Enter City or town">
		 
				
		<span class="text-danger"> <?php echo form_error('city'); ?>
		
		</span>
	</div>
  </div>
  
  
  
  	<div class="form-group">
    <label for="inputzip" class="col-sm-2 control-label">	Zip Code 	 </label>
    <div class="col-sm-10">
	
		  		<input type="text" name="zip" value="<?php echo set_value('zip'); ?>" class="form-control"  placeholder="Enter Zip Code">
		 
				
		<span class="text-danger"> <?php echo form_error('zip'); ?>
		
		</span>
	</div>
  </div>
  
  
  
 
  
  	
 
  
    	<div class="form-group">
    <label for="inputwebsite" class="col-sm-2 control-label">		Website/Link 	 </label>
    <div class="col-sm-10">
	
		  		<input type="text" name="website" value="<?php echo set_value('website'); ?>" class="form-control"  placeholder="Enter website if any">
		 
				
		<span class="text-danger"> <?php echo form_error('website'); ?>
		
		</span>
	</div>
  </div>
  
  	<div class="form-group">
    <label for="inputentrydate" class="col-sm-2 control-label">	Entry date  	 </label>
    <div class="col-sm-10">
	
		  		<input type="text" name="entrydate" value="<?php echo set_value('entrydate'); ?>" class="form-control"  placeholder="Enter Entry date">
		 
				
		<span class="text-danger"> <?php echo form_error('entrydate'); ?>
		
		</span>
	</div>
  </div>
  
  
  
  
	<div class="form-group">
    <label for="inputcomments" class="col-sm-2 control-label">	Description</label>
    <div class="col-sm-10">

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

	

	
	 <div class="form-group">

    <div class="col-sm-offset-2 col-sm-10">
     
	         <button type="submit"  value="member" name="btn_addmember" class="btn btn-default"> Add Campany   </button>

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

    

				</div>

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











	
<div id="addbulkPriceModal" 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">Change Price in Bulk</h4>
      </div>
      <div class="modal-body">
      
	  	

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

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


				echo $this->session->flashdata('msg'); 
		
                 echo form_open('user/bulkpriceupdate' , 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="inputmethod" class="col-sm-2 control-label">Method?</label>
    <div class="col-sm-10">
	<select class="form-control" name="method" required>
	
		<option value=""  >---Select bulk method to use---</option>
		<option value="Percentage" selected="selected"  >By Percentage(%)</option>
		<option value="Amount"  >By Specific Amount</option>

	

</select>
		

	</div>
  </div>



  <div class="form-group">
    <label for="inputcategory" class="col-sm-2 control-label">	Sub category?</label>
    <div class="col-sm-10">
	<select class="form-control" name="category"  id="category" required>
	
	<option selected="selected" value="all"  >---All/Any Category--</option>
		<option value="Equal"  >With equal Amount</option>

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


							


if(is_array($productcategory)) {

   foreach($productcategory as $productcategoryrow){

   //echo $courserow->coursename;
    ?>
					<option value="<?=  $productcategoryrow->id;   ?>"><?=  $productcategoryrow->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="inputbranch" class="col-sm-2 control-label">Branch?</label>
    <div class="col-sm-10">
	<select class="form-control" name="branch"  required>
		<option value="" selected="selected" >---Select Branch to Update</option>

		 <!--	<option value="all"  >Everything(Branches and Main Store)</option>
-->
		 	<option value="Main"  >Main Store</option>

	
	<?php 
					 

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


if(is_array($mybranch)) {

   foreach($mybranch as $branchrow){

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



	<?php

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

	</div>
  </div>
    <div class="form-group">
    <label for="inputprice" class="col-sm-2 control-label">Price?</label>
    <div class="col-sm-10">
	<select class="form-control" name="price" required>
	
		<option value=""  >---Select which price to change in---</option>
		<option value="Selling" selected="selected"  >Selling Price</option>
		<option value="Wholesale"  >Wholesale Price</option>
		<option value="Both"  >Both Prices</option>

	

</select>
		

	</div>
  </div>

				
	<div class="form-group">
    <label for="inputamount" class="col-sm-2 control-label">Figure </label>
    <div class="col-sm-10">
	
		  		<input type="text" name="amount" value="<?php echo set_value('amount'); ?>" class="form-control" required placeholder="Enter Amount/Percentage to update">
		 
				
		<span class="text-danger">Enter Amount/Percentage <?php echo form_error('amount'); ?>
		
		</span>
	</div>
  </div>

  	<div class="form-group">
    <label for="inputequalto" class="col-sm-2 control-label">Amount Equal to? </label>
    <div class="col-sm-10">
	
		  		<input type="text" name="equalto" value="<?php echo set_value('equalto'); ?>" class="form-control"  placeholder="Enter Equivalent to update">
		 
				
		<span class="text-danger">Enter Equivalent to replace <?php echo form_error('equalto'); ?>
		
		</span>
	</div>
  </div>

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

				<textarea name="description" value="<?php echo set_value('description'); ?>"  class="form-control"  placeholder="Enter Thickness"></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="bulk" name="btn_addbbulkpriceupdate" class="btn btn-primary"> Change Price in Bulk   </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/viewproducts"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">
    <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"> (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; display:none">
    <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',0); ?>"  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">	Weight</label>
    <div class="col-sm-10">

				<input type="text" name="sellingprice" id="mysellingprice" required value="<?php echo set_value('sellingprice',0); ?>"  class="form-control"  placeholder="Enter Weight">
			
		<span class="text-danger"> <?php echo form_error('sellingprice'); ?>
		
		</span>
	</div>
  </div>
  
  	
	<div class="form-group">
    <label for="inputdescription" class="col-sm-2 control-label">	Thickness</label>
    <div class="col-sm-10">

				<textarea name="description" value="<?php echo set_value('description'); ?>"  class="form-control"  placeholder="Enter Thickness"></textarea>
			
		<span class="text-danger"> <?php echo form_error('description'); ?>
		
		</span>
	</div>
  </div>
	
		<div class="form-group">
    <label for="inputstore" class="col-sm-2 control-label">	Height</label>
    <div class="col-sm-10">

				<input type="text" name="store" value="<?php echo set_value('store'); ?>"  class="form-control"   placeholder="Enter Height">
			
		<span class="text-danger"> <?php echo form_error('store'); ?>
		
		</span>
	</div>
  </div>
  	
  
  
  
  
	
		<div class="form-group" style="display:none">
    <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',0); ?>"  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">
    <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">
    <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">
    <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" 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">
    <label for="inputreorderquantity" class="col-sm-2 control-label">	Qty To Reorder </label>
    <div class="col-sm-10">

				<input type="text"     name="reorderquantity" value="<?php echo set_value('reorderquantity'); ?>"  class="form-control"  placeholder="Enter Quantity to Reorder always e.g 10">
			
		<span class="text-danger"> <?php echo form_error('reorderquantity'); ?>
		
		</span>
	</div>
  </div>
	
	
	
	<div class="form-group" style="margin:0px">
    <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">
    <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">
    <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">
    <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">
    <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">
    <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">
    <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="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 = $userid.time();


				echo $this->session->flashdata('msg'); 
		
                 echo form_open('user/updateproduct' , 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="<?php if(isset($searchterm)) {echo "Systemusers/searchallproduct";}else { echo"Systemusers/viewproducts";}?>"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">

	<input type="hidden" name="imgid" value="<?php echo $imgid ?>"id="imgid" 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="hidden" name="maincode" id="maincode" value="<?php echo set_value('code'); ?>" class="form-control" required placeholder="Enter Product Code">

		  		<input type="text" name="code" 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"   id="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') ;?>"  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"  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" id="productstatus"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="inputproducttype" class="col-sm-2 control-label">Inventory Type?</label>
    <div class="col-sm-10">
	<select class="form-control" name="producttype"  id="producttype" required>
	
		<option value="" selected="selected"  ></option>
		<option value="Inventory"  >Inventory</option>
		<option value="None Inventory"  >None Inventory </option>
		<option value="Service"  >Service</option>

	

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

	</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="inputcategory" class="col-sm-2 control-label">Category?</label>
    <div class="col-sm-10">
	<select class="form-control" name="category" id="category2"required>
	
	<option value="" selected></option>
		<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" id="supplier" required>
	
	<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="inputbuyingprice" class="col-sm-2 control-label">	Unit (B.) Price</label>
    <div class="col-sm-10">

				<input type="text"  id="buyingprice"  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">Weight</label>
    <div class="col-sm-10">

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

				<textarea name="description"  id="description"  value="<?php echo set_value('description'); ?>"  class="form-control"  placeholder="Enter Thickness"></textarea>
			
		<span class="text-danger"> <?php echo form_error('description'); ?>
		
		</span>
	</div>
  </div>
		<div class="form-group">
    <label for="inputstore" class="col-sm-2 control-label">	Height</label>
    <div class="col-sm-10">

				<input type="text"  id="store" name="store" value="<?php echo set_value('store'); ?>"  class="form-control"   placeholder="Enter Height ">
			
		<span class="text-danger"> <?php echo form_error('store'); ?>
		
		</span>
	</div>
  </div>
	
	
	
		<div class="form-group" style="display:none">
    <label for="inputwholesaleprice" class="col-sm-2 control-label">	Wh. Price</label>
    <div class="col-sm-10">

				<input type="text" readonly  name="wholesaleprice" 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" value="<?php echo set_value('promoprice'); ?>"  class="form-control"  placeholder="Enter From how many 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">
    <label for="inputuom" class="col-sm-2 control-label">Default UOM</label>
    <div class="col-sm-10">
	<select class="form-control" name="uom"  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" name="qty" readonly 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="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="inputreorderquantity" class="col-sm-2 control-label">	Qty To Reorder </label>
    <div class="col-sm-10">

				<input type="text" required  id="reorderquantity"  name="reorderquantity" value="<?php echo set_value('reorderevel'); ?>"  class="form-control"  placeholder="Enter Quantity to Reorder always e.g 10">
			
		<span class="text-danger"> <?php echo form_error('reorderquantity'); ?>
		
		</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-control2" 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>


Tax Type:
	<select class="form-control2" name="taxtype" id="taxtype" >
					<option value="" selected="selected"  ></option>

			
						<option value="na"   >na</option>
 
							<option value="Inclusive"   >Vat Inclusive </option>
					  				<option value="Exclusive"   >Vat Exclusive</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="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="inputassetaccount" class="col-sm-2 control-label">Asset / Purchase Acount?</label>
    <div class="col-sm-10">
	<select class="form-control"  name="assetaccount" id="assetaccount">
	
			<option value=""   selected="selected"></option>

	
			<option value=""  >---Select asset Account---</option>

<?php 

$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=""  >---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">
    <label for="inputsalesaccount" class="col-sm-2 control-label">Income Account?</label>
    <div class="col-sm-10">
	<select class="form-control" name="salesaccount" id="salesaccount">
	
<?php 

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

								$glaccounts = $this->usermodel->populateall('glaccounts','number',$salesaccount);
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">
    <label for="inputexpenseaccount" class="col-sm-2 control-label">Expense Acount?</label>
    <div class="col-sm-10">
	<select class="form-control" name="expenseaccount" id="expenseaccount" >
	
		<option value="Asset" selected="Purchases"  >Purchases</option>
			
<?php 
					 
$expenseaccount=$configuration[0]['expenseaccount'];

								$glaccounts = $this->usermodel->populateall('glaccounts','number',$expenseaccount);
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">
    <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_updateproduct" 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="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">Order 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/viewproducts"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">

		
		
		
		<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="total2" 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">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="store to kitchen" selected > from store to kitchen</option>


</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="code2" 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="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">	 Thickness</label>
    <div class="col-sm-10">

<textarea name="description" readonly id="description2"class="form-control"><?php echo set_value('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="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="viewModal" 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>

			<option value="all"  >---All counters--</option>
			<option value="Main"  >--Main Store--</option>
					<option value="Mainothers"  >---Main and other counters/branches--</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="inputcategory" class="col-sm-2 control-label">	Sub category?</label>
    <div class="col-sm-10">
	<select class="form-control" name="category"  id="category" required>
	
	<option selected="selected" value="all"  >---All/Any Category--</option>

	
	<?php 

					 		$productcategory = $this->usermodel->populatealldatawhere('productcategory','name','ASC','companyid',$companyid);

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


							


if(is_array($productcategory)) {

   foreach($productcategory as $productcategoryrow){

   //echo $courserow->coursename;
    ?>
					<option value="<?=  $productcategoryrow->id;   ?>"><?=  $productcategoryrow->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>
	<option value="all" selected="selected"  >All/Any 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="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="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="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="viewModal222" 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/viewmainstockreport' , 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>

			<option value="Main"  selected="selected">---Main/Hq Only--</option>

					<option value="all"  >---Main and other counters/branches--</option>

	


</select>

		
	</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="download">I want to download stocks</option>

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

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

    <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="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 Products 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/uploadproducts' , 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">	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_uploaduploadproducts" 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 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/updatestock' , 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">
		<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="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="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="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="code3" 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="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">
    <label for="inputdescription" class="col-sm-2 control-label">	 Thickness</label>
    <div class="col-sm-10">

<textarea name="description"  class="form-control"><?php echo set_value('description'); ?></textarea>		
		<span class="text-danger"> Enter Thickness<?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="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">Dispatch stock (<?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/addstock' , 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">
		<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">
		 		  		<input readonly type="hidden" name="invoice" required value="<?php echo set_value('invoice',$finalsalesid); ?>" class="form-control"  placeholder="Enter invoice or Receip tnumber">


<div class ="form-inline">
<?php	

					 

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



if(is_array($branchlevel)) {

   foreach($branchlevel as $branchlevelrow){
    ?>

<p>

     <div class="form-group">
	     <label for="inputfrom" class="col-sm-1 control-label">	TO?</label>

    <div class="col-sm-6">
	<select class="form-control" name="from[]" required>
	
	<option value=""  >---Moving products to which branch?---</option>

	
	<?php 
					 

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



if(is_array($branch)) {

   foreach($branch as $branchrow){

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



	<?php

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


	</div>
		 <div class="col-sm-3">		<input type="text" autofocus  name="total[]" value="0"  id="total1" class="form-control" required placeholder="Enter total"></div>


  </div>


		 
</p>
  	<?php

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

	  </div>
	

  
  <div class="form-group">
    <label for="inputdeduction" class="col-sm-2 control-label">Deduct?</label>
    <div class="col-sm-10">
	<select class="form-control" name="deduction" required>
	
		<option value=""  >---Do you want to deduct stock from main store to adjust stocklist?--</option>
		<option value="Yes" selected="selected"  >Yes</option>
		<option value="No"  >No -Just add stock to stocklist directly</option>

	

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

	</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('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="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">	 Thickness</label>
    <div class="col-sm-10">

<textarea name="description"  class="form-control"><?php echo set_value('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="stock" name="btn_uaddstock" class="btn btn-default"> Update Stock   </button>

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

    

				</div>

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

 
</div>


</div>


</div>


</div>


</div>


</div>
</div>


</div>
</div>


</div>
</div>


</div>
</div>


</div>
</div>


</div>
</div>


</div>
</div>


</div>
</div>


</div>


</div>







