<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/editetimsitems' , 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")) {
										
  ?>
  
  

  <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"  selected >---All counters--</option>
			<option value="Main"  >--Main Store--</option>
					<option value="Mainothers"  >---Main and other counters/branches--</option>

		
		
		
		
		
		
		
		
		
		
		
		
		
								

	
	
	
	
	<?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.';
}
	 }else{
		 
?>
<?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

	 }
		 
?>

</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>
	
	<option value=""   >---Select one -</option>
<?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>
	
	<option value=""   >---Select one -</option>
<?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>
	
	<option value=""   >---Select one -</option>
<?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>
	
	<option value=""   >---Select one -</option>
<?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>
	
	<option value=""   >---Select one -</option>
<?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>
	
	<option value=""   >---Select one -</option>
<?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>
	
	<option value=""   >---Select one -</option>
<?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>
  
  
  
    <?php
		  }
										
  ?>
  
  
  
  
  
<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="inputmaincategory" class="col-sm-2 control-label">	Main category?</label>
    <div class="col-sm-10">
	<select class="form-control" name="maincategory"   required>
	
	<option selected="selected" value="all"  >---All/Any Main Category--</option>

	
	<?php 

					 		$productcategory = $this->usermodel->populatealldatawhere('maincategory','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="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="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="inputvattype" class="col-sm-2 control-label">	VAT Type</label>
    <div class="col-sm-10">

		<select class="form-control" name="vattype"  id="vattype" >
	<option value="all" selected="selected"  >All/Any VAT Type---</option>

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

			<option value="ZERO RATED"  >ZERO RATED</option>
				<option value="EXEMPTED"  >EXEMPTED</option>
				<option value="NON VAT"  >NON VAT</option>
							<!--<option value="VATABLE E"   >VATABLE-E</option>-->

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

    
   

	
	 <div class="form-group">

    <div class="col-sm-offset-2 col-sm-10">
     
	         <button type="submit"  value="etimsupdate" name="btn_etimsupdate" class="btn btn-default"> Update Products	  </button>

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

    

				</div>

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