<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">
	
 <link href="<?php echo base_url(); ?>assets/select/chosen.min.css" rel="stylesheet" media="screen">
	
		   
		   		   <script src="<?php echo base_url(); ?>assets/select/chosen.jquery.min.js"></script>
<script type="text/javascript">

	    $(function() {
<!--             $(".datepicker").datepicker(); -->
<!--             $(".uniform_on").uniform() -->;
            $(".chzn-select").chosen();
   <!--          $('.textarea').wysihtml5(); -->

        });
	




 </script>  


 <div class="row">
   	<div class="col-md-12">

  <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 Etims products</h4>
			  	                    <a href="<?php echo base_url(). "user/viewproducts"; ?>" class="btn btn-primary">Back</a>

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


<?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'];	
	 
	 		  	      $viewallbranches=$this->usermodel->populatuserpermissionsdataarray('reports','viewall',$userid);

	 
	 
	 
	 
	 
	 
	 
	 
	 
$smsconfig = $this->usermodel->populateallarray('smsconfig','id',$companyid);
		$etims=$smsconfig[0]["hscode"];
   echo form_open('user/editetimsitemsproducts' , 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;	

  
							   if (($etims =="EnableEtims")|| ($etims =="yes")) {
										
  ?>
  
      		  		<input type="hidden" name="page" readonly value="<?php echo set_value('code',$page); ?>" class="form-control"  placeholder="Enter hscode">

  		  		<input type="hidden" name="code" readonly value="<?php echo set_value('code',$products[0]['code']); ?>" class="form-control"  placeholder="Enter hscode">

    <div class="form-group">
    <label for="inputhscode" class="col-sm-2 control-label">KRA Code	 </label>
    <div class="col-sm-10">
	
		  		<input type="text" name="hscode" readonly value="<?php echo set_value('hscode',$products[0]['hscode']); ?>" class="form-control"  placeholder="Enter hscode">
		 
				
		<span class="text-danger"> <?php echo form_error('hscode'); ?>
		
		</span>
	</div>
  </div>
  


  <div class="form-group">
    <label for="inputbranchname" class="col-sm-2 control-label">Baranch / Counter</label>
    <div class="col-sm-10">
	<select class="form-control" required name="branchname" required id="branchname" >
	
	<option value=""  >---Select Branch/Counter Name--</option>
	<option value="all" selected  >All counters</option>



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


if(is_array($mybranch)) {

   foreach($mybranch as $branchrow){

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




	<?php

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


</select>

		
	</div>
  </div>

  	<div class="form-group">
    <label for="inputItemClassification" class="col-sm-2 control-label">Item Classification</label>
    <div class="col-sm-10">
		
	<select class="chzn-select" name="ItemClassification" style="width:100%" required>
	
	
	
	  <?php

$main = $this->usermodel->populateall('itemclassification','itm_class_code', $products[0]['itemclassification']);

if(is_array($main)) {

   foreach($main as $row){
 ?>
	<option  value="<?=  $row->itm_class_code;   ?>"><?= $row->name." ".$row->itm_class_code;  ?></option>
<?php

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

<?php 
}?>

	
	
	
	
	
	
	
<?php 
			

$main = $this->usermodel->populateall('itemclassification','id > ',0);

if(is_array($main)) {

   foreach($main as $row){

  
    ?>
	<option  value="<?=  $row->itm_class_code;   ?>"><?= $row->name." ".$row->itm_class_code;  ?></option>
<?php

}
}

?>
</select>
		
		

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

  
  
  <?php
							   }
  
							   if ($etims =="EnableEtims"){
										
  ?>
  
  
 
    	<div class="form-group">
    <label for="inputcountryoforigin" class="col-sm-2 control-label">Country of origin</label>
    <div class="col-sm-10">
		
		<select class="chzn-select" name="countryoforigin" style="width:100%" required>
	
  <?php

$main = $this->usermodel->populateall('nation','code', $products[0]['country']);

if(is_array($main)) {

   foreach($main as $row){
 ?>
	<option  value="<?=  $row->code;   ?>"><?= $row->name." - ".$row->code;  ?></option>
<?php

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

<?php 
}?>


<?php 
			

$main = $this->usermodel->populateall('nation','id > ',0);

if(is_array($main)) {

   foreach($main as $row){

  
    ?>
	<option  value="<?=  $row->code;   ?>"><?= $row->name." - ".$row->code;  ?></option>
<?php

}
}

?>
</select>

		<span class="text-danger"> <?php echo form_error('countryoforigin'); ?>
		
		</span>
	</div>
  </div>
  
      	<div class="form-group">
    <label for="inputitemtype" class="col-sm-2 control-label">Item Type</label>
    <div class="col-sm-10">
		
		<select class="chzn-select" name="itemtype" style="width:100%" required>
	
  <?php

$main = $this->usermodel->populateall('itemtypecodes','code', $products[0]['itemtype']);

if(is_array($main)) {

   foreach($main as $row){
 ?>
	<option  value="<?=  $row->code;   ?>"><?= $row->name." - ".$row->code;  ?></option>
<?php

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

<?php 
}?>
<?php 
			

$main = $this->usermodel->populateall('itemtypecodes','id > ',0);

if(is_array($main)) {

   foreach($main as $row){

  
    ?>
	<option  value="<?=  $row->code;   ?>"><?= $row->name." - ".$row->code;  ?></option>
<?php

}
}

?>
</select>
		<span class="text-danger"> <?php echo form_error('itemtype'); ?>
		
		</span>
	</div>
  </div>
  
  
  
     	<div class="form-group">
    <label for="inputpackagingunit" class="col-sm-2 control-label">Packaging  Unit</label>
    <div class="col-sm-10">
		<select class="chzn-select" name="packagingunit" style="width:100%" required>
	
	
	
  <?php

$main = $this->usermodel->populateall('packagingcodes','code', $products[0]['packagingunit']);

if(is_array($main)) {

   foreach($main as $row){
 ?>
	<option  value="<?=  $row->code;   ?>"><?= $row->name." - ".$row->code;  ?></option>
<?php

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

<?php 
}?>
	
	
	
	
	
	
<?php 
			

$main = $this->usermodel->populateall('packagingcodes','id > ',0);

if(is_array($main)) {

   foreach($main as $row){

  
    ?>
	<option  value="<?=  $row->code;   ?>"><?= $row->name." - ".$row->code;  ?></option>
<?php

}
}

?>
</select>

		<span class="text-danger"> <?php echo form_error('packagingunit'); ?>
		
		</span>
	</div>
  </div>
  
       	<div class="form-group">
    <label for="inputsalesunit" class="col-sm-2 control-label">Sales  Unit</label>
    <div class="col-sm-10">
			<select class="chzn-select" name="salesunit" style="width:100%" required>
	

	
  <?php

$main = $this->usermodel->populateall('quantitycodes','code', $products[0]['salesunit']);

if(is_array($main)) {

   foreach($main as $row){
 ?>
	<option  value="<?=  $row->code;   ?>"><?= $row->name." - ".$row->code;  ?></option>
<?php

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

<?php 
}?>
	<?php 
			

$main = $this->usermodel->populateall('quantitycodes','id > ',0);

if(is_array($main)) {

   foreach($main as $row){

  
    ?>
	<option  value="<?=  $row->code;   ?>"><?= $row->name." - ".$row->code;  ?></option>
<?php

}
}

?>
</select>

		<span class="text-danger"> <?php echo form_error('salesunit'); ?>
		
		</span>
	</div>
  </div>
  
  
     	<div class="form-group">
    <label for="inputitemstatus" class="col-sm-2 control-label">Item Status</label>
    <div class="col-sm-10">
				<select class="chzn-select" name="itemstatus" style="width:100%" required>
	

  <?php

$main = $this->usermodel->populateall('itemstatuscodes','code', $products[0]['itemstatus']);

if(is_array($main)) {

   foreach($main as $row){
 ?>
	<option  value="<?=  $row->code;   ?>"><?= $row->name." - ".$row->code;  ?></option>
<?php

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

<?php 
}
?>



<?php 
			

$main = $this->usermodel->populateall('itemstatuscodes','id > ',0);

if(is_array($main)) {

   foreach($main as $row){

  
    ?>
	<option  selected value="<?=  $row->code;   ?>"><?= $row->name." - ".$row->code;  ?></option>
<?php

}
}

?>
</select>

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

  
    	<div class="form-group">
    <label for="inputitemtax" class="col-sm-2 control-label">Item Tax</label>
    <div class="col-sm-10">
				<select class="chzn-select" name="itemtax" style="width:100%" required>
	
  <?php

$main = $this->usermodel->populateall('taxcodes','tax_code', $products[0]['itemtax']);

if(is_array($main)) {

   foreach($main as $row){
 ?>
	<option   value="<?=  $row->tax_code;   ?>"><?= $row->name." - ".$row->tax_code;  ?></option>
<?php

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

<?php 
}
?>
<?php 
			

$main = $this->usermodel->populateall('taxcodes','id > ',0);

if(is_array($main)) {

   foreach($main as $row){

  
    ?>
	<option   value="<?=  $row->tax_code;   ?>"><?= $row->name." - ".$row->tax_code;  ?></option>
<?php

}
}

?>
</select>


		<span class="text-danger"> <?php echo form_error('itemtax'); ?>
		
		</span>
	</div>
  </div>
  
  
    	<div class="form-group">
    <label for="inputupdatetype" class="col-sm-2 control-label">Update type</label>
    <div class="col-sm-10">
				<select class="chzn-select" name="updatetype" style="width:100%" required>

	<option   value="internal">Update Internal products Only</option>
	<option  selected value="both">Update Both Internal and Etims products </option>

</select>

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

    <div class="col-sm-offset-2 col-sm-10">
     
	         <button type="submit"  value="etimsupdates" name="btn_etimsupdates" class="btn btn-info"> Update Products	  </button>

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

	
									
							
			<div class="modal-footer">

    

				</div>

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