
 <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">
   $(document).on("click", "#managebtndelete", function()
        {
          var itemid2 = $(this).data('id');
		  $("#itemid2").val(itemid2); 
		  
		  
		   
        });
	 $(document).on("click", "#managebtncancel", function()
        {
          var itemid3 = $(this).data('id');
		  $("#itemid3").val(itemid3); 
		  
		  
		   
        });
		    $(function() {
<!--             $(".datepicker").datepicker(); -->
<!--             $(".uniform_on").uniform() -->;
            $(".chzn-select").chosen();
   <!--          $('.textarea').wysihtml5(); -->

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

	 
 }
}
	function getWholesalemargin1(){
 //alert(3333);
 
					    	 var mybuyingprice = document.getElementById('mybuyingprice1').value;
							 var mywholesalemargin = document.getElementById('mywholesalemargin1').value;
							 var mywholesaleprice = document.getElementById('mywholesaleprice1').value;

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

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


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

	 
 }
}

      



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

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

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


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

	 
 }
}
		
    </script>   
 
 <div class="row">
  
   	

   	<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>
						 <span class="pull-right"> UOM Price update page</span>	
                        <a  id="more" class="btn btn-info" href="<?php echo base_url();?>Systemusers/viewproducts/<?php   {echo  $page;}  ?>">Back to Products </a>


				                        <a  id="more" class="btn btn-info" href="<?php echo base_url();?>user/viewproductlist">Back to stocklist </a>

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

	  <?php
  echo $this->session->flashdata('deletemsg'); 
   echo $this->session->flashdata('msg'); 

				echo $this->session->flashdata('updatemsg'); 
   $session_data = $this->session->userdata('logged_in');

   
 	$data['id'] = $session_data['id'];
        
		 $userid = $data['id'];
$data['companyid'] = $session_data['companyid'];
	 $companyid = $data['companyid'];
		 $data['usertype'] = $session_data['usertype'];
	 $usertype = $data['usertype'];	
	  $updateaction=$this->usermodel->populatuserpermissionsdataarray('products','update',$userid);

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


  ?>
										
		
							
	<div class="widget-content nopadding table_holder table-responsive1" >				
	
							
									
				<table class="tablesorter table table-bordered  table-hover" id="sortable_table">			

             <thead>
			 
			   <tr>
 <td colspan="8">
<CENTER><H3> UPDATE PRICES IN THIS WINDOW</H3></CENTER> 
 </td>
 </tr>   
				 
         <tr>
			<th>Code</th>						
       <th>Branch</th>
     
	    <th>Name</th>
			
		   <th>Qty</th> 
		   <th>B.price</th> 
		   <th>S.price</th> 
		<th>H.price</th>
				<th>From qty</th>
				
   <th>Price margin</th> 
			      <th>Wh margin</th> 
				  <th>Branch</th>
		<th>Upadate Data </th>

                 </tr>
             </thead>
<?php

 if(!is_array($product)) 

 {


   echo "<tr  style='margin-bottom:0px;margin-top:0px;' '>";
      echo "<td colspan='6'>";
    
       echo '<div class="alert alert-warning text-center">There no records found..</div>';
    echo "</td>";
   echo "</tr>";
    }else {
?>
    
             <?php 
  $myqty=0;
  	foreach ($product as $row): 

		 

             ?>



             <tr>
			 				<?php
					
		
                 echo form_open('user/editprices' , 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;?>								
  
    <td>

		 		 											<input type="text" name="code" id="code" value="<?php echo set_value('code',$row->code); ?>" class="form-control" required placeholder="code" >

		 										
												 
			  </td>
		 <td>
		 		 		 											<input type="hidden" name="page" id="page" value="<?php echo set_value('page',$page); ?>" class="form-control" required placeholder="page" >


		 											<input type="hidden" name="myid" id="myid" value="<?php echo set_value('myid',$row->id); ?>" class="form-control" required placeholder="myid" >
		 											<input type="text" name="branch" id="branch" readonly value="Main Store" class="form-control" required placeholder="branch" >

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


if(is_array($mycategory)) {

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


}} else {
    echo 'No Product .';
}
	
?>
</td>

	 <td>
	 
	 		<?php

	
 if( $updateaction==true){
	 ?>
		 		 											<input type="text" readonly name="qty" id="qty" value="<?php echo set_value('qty',$row->qty); ?>" class="form-control" required placeholder="qty" >

	 	<?php	

 }else{?>
			 		 											<input type="hidden" name="qty" id="qty" value="<?php echo set_value('qty',$row->qty); ?>" class="form-control" required placeholder="qty" >

<?php }
  ?>


		 										
												 
			  </td>		 
			 
 <td>
		 								<input type="text" name="buyingprice"   id="mybuyingprice" value="<?php echo set_value('buyingprice',$row->buyingprice); ?>" class="form-control" required placeholder="buying price" >

	
	</td>
				    <td>
					
					<input type="text" name="sellingprice" id="mysellingprice"  value="<?php echo set_value('sellingprice',$row->sellingprice); ?>" class="form-control" required placeholder="selling price" >
					
					</td>
						 
			
	    <td>
		
							<input type="text" name="wholesaleprice"  id="mywholesaleprice" value="<?php echo set_value('wholesaleprice',$row->wholesaleprice); ?>" class="form-control" required placeholder="whole  price" >

		</td>
				
	    <td>
		
							<input type="text" name="promoprice" id="promoprice" value="<?php echo set_value('promoprice',$row->promoprice); ?>" class="form-control"  placeholder="From qty" >

		</td>
<td>
				<input type="text" name="retailmargin"  id="myretailmargin" maxlength="2"  onblur="getRetailmargin()"  value="<?php echo set_value('retailmargin'); ?>"  class="form-control"  placeholder="Enter  margin in % form">

</td>


<td>
				<input type="text" name="mywholesalemargin"  id="mywholesalemargin" maxlength="2"  onblur="getWholesalemargin()"  value="<?php echo set_value('mywholesalemargin'); ?>"  class="form-control"  placeholder="Enter  margin in % form">

</td>
<td>
   <select class="form-control"name="updatetype" style="width:50px" >
	
	<option value=""  >-Barnch to update?</option>
   <option value="Specific"  >Main</option>

   <option value="all"  selected="selected"  >All</option>


   

</select>		
</td><td>	
	<button type="submit"  value="editprice" name="btn_editprice" class="btn btn-success"> Update All    </button>
</td>
 <?php echo form_close();?>	
  			

            </tr>
			
<?php endforeach;}





 if(!is_array($viewprice)) 

 {


   echo "<tr  style='margin-bottom:0px;margin-top:0px;' '>";
      echo "<td colspan='7'>";
    
       echo '<div class="alert alert-warning text-center">There no records found..</div>';
    echo "</td>";
   echo "</tr>";
    }else {
?>
    
             <?php 
  $myqty=0;
  	foreach ($viewprice as $c): 

		 

             ?>



             <tr>
                
            <?php 
$id=$c->id;


?>
  
  
  				 
										<?php
					
		
                 echo form_open('user/editprices' , 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;?>								
    <td>
		 		 											<input type="text" name="code" id="code" value="<?php    if(isset($c->code)) {  echo $c->code; }  ?>" class="form-control" required placeholder="code" >

		 										
												 
			  </td>
  
		 <td>
		 		 		 											<input type="hidden" name="page" id="page" value="<?php echo set_value('page',$page); ?>" class="form-control" required placeholder="page" >


		 											<input type="hidden" name="myid" id="myid" value="<?php echo set_value('myid',$c->id); ?>" class="form-control" required placeholder="myid" >
		 											<input type="hidden" name="branch" id="branch" value="<?php echo set_value('branch',$c->branch); ?>" class="form-control" required placeholder="branch" >

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

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



if(is_array($branchtype)) {

   foreach($branchtype as $branchtyperow){

   echo $branchtyperow->name;
 
 
}} else {
    echo $branch;
}
	
?>
												 
	 </td>		
                 <td><?php 
	$itemid=$c->code;
	
	$mycategory = $this->usermodel->populateall('products','code', $itemid);
	


if(is_array($mycategory)) {

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


}} else {
    echo 'No Product .';
}
	
?>
</td>

 <td>

				<?php

	
 if( $updateaction==true){
	 ?>
		 <input type="text" name="qty" readonly id="qty" value="<?php echo set_value('qty',$c->qty); ?>" class="form-control" required placeholder="qty" >

	 	<?php	

 }else{?>
		 <input type="hidden" name="qty" id="qty" value="<?php echo set_value('qty',$c->qty); ?>" class="form-control" required placeholder="qty" >

<?php }
  ?>
 



		 										
												 
			  </td>	
    <td>
	
		 								<input type="text" name="buyingprice" id="mybuyingprice1" value="<?php echo set_value('buyingprice',$c->buyingprice); ?>" class="form-control" required placeholder="buying price" >

	
	</td>
				    <td>
					
					<input type="text" name="sellingprice" id="mysellingprice1" value="<?php echo set_value('sellingprice',$c->sellingprice); ?>" class="form-control" required placeholder="selling price" >
					
					</td>
						 
			
	    <td>
							<input type="text" name="wholesaleprice" id="mywholesaleprice1" value="<?php echo set_value('wholesaleprice',$c->wholesaleprice); ?>" class="form-control" required placeholder="whole  price" >

		</td>
		  <td>
							<input type="text" name="promoprice" id="promoprice" value="<?php echo set_value('promoprice',$c->promoprice); ?>" class="form-control"  placeholder="From QTY" >

		</td>
<td>
				<input type="text" name="retailmargin"  id="myretailmargin1" maxlength="2"  onblur="getRetailmargin1()"  value="<?php echo set_value('retailmargin'); ?>"  class="form-control"  placeholder="Enter  margin in % form">

</td>


  <td>
				<input type="text" name="mywholesalemargin"  id="mywholesalemargin1" maxlength="2"  onblur="getWholesalemargin1()"  value="<?php echo set_value('mywholesalemargin'); ?>"  class="form-control"  placeholder="Enter  margin in % form">

</td>

<td COLSPAN="3">
	<button type="submit"  value="editprice" name="btn_editprice" class="btn btn-primary"> Update this Price    </button>
</td>
 <?php echo form_close();?>	
  					
	
		 
             </tr>

	<?php endforeach;} ?>

             
 	
	
        </table>

					
				









				<table class="tablesorter table table-bordered  table-hover" id="sortable_table">			

 <thead>
 <tr>
 <td colspan="9">
<CENTER><H3> BREAKING UNITS MODULE(ASSIGNING CHILD TO PARENTS /PRODUCTION)</H3></CENTER> 
 </td>
 </tr>
  <tr>
				  <?php   echo form_open('user/adduomprice' , 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" id="status" value="child" class="form-control" required placeholder="status" >

	<input type="hidden" name="page" id="page" value="<?php echo set_value('page',$page); ?>" class="form-control" required placeholder="page" >
	<input type="hidden" name="code" id="code" value="<?php echo set_value('code',$itemid); ?>" class="form-control" required placeholder="code" >

<td>
<select class="form-control" name="branch"  required>
	
	<option value="" selected="selected" >---Select Branch/Counter Name-</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 Branch/Counter.';
}
	
?>
</select>
		
</td>
<td>
	<select class="chzn-select" name="uom" style="width:50%"  required>
	
	<option value="" selected="selected"  >---Select child product-</option>

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


							


if(is_array($uom)) {

   foreach($uom as $uomrow){

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



	<?php

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

      <td>
		 								<input type="text" name="qty" id="qty" value="<?php echo set_value('qty'); ?>" class="form-control" required placeholder="qty ">
					<input type="hidden" name="price" id="price" value="<?php echo set_value('price'); ?>" class="form-control" required placeholder="selling price" >

	
	</td>
				  
					
					
					
						 
			
	   

<td colspan="5">
	<button type="submit"  value="adduomprice" name="btn_adduomprice" class="btn btn-primary"> Add Child product   </button>
</td>
 <?php echo form_close();?>	
  			


                 </tr>
				 
  <tr>
									
	    <th>code</th>
     <th>Name</th>
	      <th>Main B.price</th>
		  	      <th>Unit Price</th>
<!--
	      <th>S.price</th>

	    -->      <th>Branch</th>

		   <th>Qty</th> 
		   		   <th>UOM</th> 

		<th>Update </th>

                 </tr>
             </thead>
<?php 
 if(!is_array($child)) 

 {


   echo "<tr  style='margin-bottom:0px;margin-top:0px;' '>";
      echo "<td colspan='6'>";
    
       echo '<div class="alert alert-warning text-center">There no uom found..</div>';
    echo "</td>";
   echo "</tr>";
    }else {

  $ttmyprice=0;
  $myqty=0;
    $ttbprice=0;
	  $ttsprice=0;
  	foreach ($child as $childc): 

		 

             ?>



             <tr>
                
            <?php 
$id=$childc->id;
	

?>
  
  
  				 
										<?php
					
		
                 echo form_open('user/edituom' , 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" id="status" value="<?php echo set_value('status',$childc->status); ?>" class="form-control" required placeholder="status" >

		
		 		 		 											<input type="hidden" name="page" id="page" value="<?php echo set_value('page',$page); ?>" class="form-control" required placeholder="page" >

		 		 											<input type="hidden" name="code" id="code" value="<?php echo set_value('code',$childc->code); ?>" class="form-control" required placeholder="code" >

		 											<input type="hidden" name="myid" id="myid" value="<?php echo set_value('myid',$childc->id); ?>" class="form-control" required placeholder="myid" >
		 											<input type="hidden" name="branch" id="branch" value="<?php echo set_value('branch',$childc->branch); ?>" class="form-control" required placeholder="branch" >

				
		<td>
<?php  echo $childc->uom; ?> 
		</td>	 
                 <td><?php 
	$itemids=$childc->uom;
	
	$mycategory = $this->usermodel->populateall('products','code', $itemids);
	
$UOM="";
$bprice=0;
$sprice=0;

if(is_array($mycategory)) {

   foreach($mycategory as $mycategoryrow){
	   
		echo $mycategoryrow->name." (" .$mycategoryrow->description." Qty:".$mycategoryrow->qty.")";
		
		$bprice=$mycategoryrow->buyingprice;
$sprice=$mycategoryrow->sellingprice;
 
$UOM=$mycategoryrow->uom;
}} else {
    echo 'No Product .';
}
	  $myprice=($bprice*$childc->qty);
//$ttmyprice=$ttmyprice+$myprice;

	   $ttmyprice=$ttmyprice+$childc->brice;

	   	 
?>
</td>


  	<td>
	<?php 
 echo  formatMoney($bprice, true);
 ?> 


		</td>
			<td>
			
						 								<input type="text" name="brice" id="brice" value="<?php echo set_value('price',$childc->brice); ?>" class="form-control2" required placeholder="buying price" >
 
		</td>
		<!--
	<td>
<?php  echo $sprice;
 ?> 
		</td>		

-->

 <td>								 
	<?php 
	
	
	$ttbprice= $ttbprice+ ($bprice*$childc->qty);
	  $ttsprice=  $ttsprice+($sprice*$childc->qty);
					// $branch="";
					 $branch=$childc->branch;

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



if(is_array($branchtype)) {

   foreach($branchtype as $branchtyperow){

   echo $branchtyperow->name;
 
 
}} else {
    echo $branch;
}
	
?>
												 
	 </td>







	 
 <td>
 <?PHP
 echo $childc->qty;
 
 ?>
							<input type="text" name="qty" style="width:100px" id="qty" value="<?php echo set_value('qty',$childc->qty); ?>" class="form-control2" required placeholder="Enter qty" >

		</td>
  	<td>
<?php  echo $UOM; ?> 
		</td>	

	
	
						 
			
	    

<td>
	<button type="submit"  value="edituom" name="btn_edituom" class="btn btn-primary"> Update 	Child    </button>
		
										 <a class="btn btn-danger managebtn" id="managebtncancel"		 data-id='<?php echo  $childc->id;?>'    data-toggle='modal' data-target='#CANCELModal<?php  $childc->id; ?>'>	 


                                               
																Cancel
                                                </a>
	
												


                                                        
	
	
	
	
</td>
 <?php echo form_close();?>	
  					
	
		 
             </tr>

	<?php endforeach;
	?>
	<tr>
	<td colspan="2"> <b>Total </b></td>
	<td>
	<b>
	<?php 
	
	
	  echo$ttbprice;
	  ?>
	  </b>
	</td>
	<td>
	<b>
	<?php 
	
	 echo formatMoney($ttmyprice, true);
	
	  ?>
	  </b>
	</td>
	<td>
	<b>
	
	  </b>
	</td>
		<td colspan="6">
		</td>

	</tr>
	
	
	<?php
	} ?>


	
</table>				
									
								
					</div>	

	
					

					
					
					
					
					
					
					
					
					
					<table class="tablesorter table table-bordered  table-hover" id="sortable_table">			

 <thead>
 <tr>
 <td colspan="7">
<CENTER><H3> UNITS OF MEASUREMENTS(UOM)</H3></CENTER> 
 </td>
 </tr>
  <tr>
				  <?php   echo form_open('user/adduomprice' , 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" id="status" value="active" class="form-control" required placeholder="active" >

	<input type="hidden" name="page" id="page" value="<?php echo set_value('page',$page); ?>" class="form-control" required placeholder="page" >
	<input type="hidden" name="code" id="code" value="<?php echo set_value('code',$itemid); ?>" class="form-control" required placeholder="code" >

<td>
<select class="form-control" name="branch"  required>
	
	<option value="" selected="selected" >---Select Branch/Counter Name-</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 Branch/Counter.';
}
	
?>
</select>
		
</td>
<td>
	<select class="form-control" name="uom"  required>
	
	<option value="" selected="selected"  >---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>
</td>

      <td>
		 								<input type="text" name="qty" id="qty" value="<?php echo set_value('qty'); ?>" class="form-control" required placeholder="qty ">

	
	</td>
				    <td>
					
					<input type="text" name="brice" id="brice" value="<?php echo set_value('brice'); ?>" class="form-control" required placeholder="Buying price" >
					
					</td>
						 
			  <td>
					
					<input type="text" name="price" id="price" value="<?php echo set_value('price'); ?>" class="form-control" required placeholder="selling price" >
					
					</td>
	   

<td colspan="4">
	<button type="submit"  value="adduomprice" name="btn_adduomprice" class="btn btn-primary"> Add new UOM    </button>
</td>
 <?php echo form_close();?>	
  			


                 </tr>
				 
  <tr>
									
	    <th>code</th>
     <th>Name</th>
	          <th>Branch</th>
		   <th>UOM</th> 

		   <th>Qty</th> 
		      <th>B.price</th> 
		   <th>S.price</th> 
		<th>Update </th>

                 </tr>
             </thead>
<?php 
 if(!is_array($uomprice)) 

 {


   echo "<tr  style='margin-bottom:0px;margin-top:0px;' '>";
      echo "<td colspan='7'>";
    
       echo '<div class="alert alert-warning text-center">There no uom found..</div>';
    echo "</td>";
   echo "</tr>";
    }else {

  $myqty=0;
  	foreach ($uomprice as $uomc): 

		 

             ?>



             <tr>
                
            <?php 
$id=$uomc->id;


?>
  
  
  				 
										<?php
					
		
                 echo form_open('user/edituom' , 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" id="status" value="<?php echo set_value('status',$uomc->status); ?>" class="form-control" required placeholder="status" >

		
		 		 		 											<input type="hidden" name="page" id="page" value="<?php echo set_value('page',$page); ?>" class="form-control" required placeholder="page" >

		 		 											<input type="hidden" name="code" id="code" value="<?php echo set_value('code',$uomc->code); ?>" class="form-control" required placeholder="code" >

		 											<input type="hidden" name="myid" id="myid" value="<?php echo set_value('myid',$uomc->id); ?>" class="form-control" required placeholder="myid" >
		 											<input type="hidden" name="branch" id="branch" value="<?php echo set_value('branch',$uomc->branch); ?>" class="form-control" required placeholder="branch" >

				
		<td>
<?php  echo $uomc->code; ?> 
		</td>	 
                 <td><?php 
	$itemids=$uomc->code;
	
	$mycategory = $this->usermodel->populateall('products','code', $itemids);
	


if(is_array($mycategory)) {

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


}} else {
    echo 'No Product .';
}
	
?>
</td>
 <td>								 
	<?php 
					// $branch="";
					 $branch=$uomc->branch;

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



if(is_array($branchtype)) {

   foreach($branchtype as $branchtyperow){

   echo $branchtyperow->name;
 
 
}} else {
    echo $branch;
}
	
?>
												 
	 </td>



 <td>								 
	<?php 
					// $branch="";
					 $uomname=$uomc->uom;

					 $uom= $this->usermodel->populateall('uom','code',$uomname);



if(is_array($uom)) {

   foreach($uom as $uomrow){

   echo $uomrow->name."(".$uomrow->code.")";
 
 
}} else {
    echo $uomname;
}
	
?>

												 
	 </td>





	 
 <td>
							<input type="text" name="qty" id="qty" value="<?php echo set_value('qty',$uomc->qty); ?>" class="form-control" required placeholder="Enter qty" >

		</td>
		
		
		 <td>
					
					<input type="text" name="brice" id="brice" value="<?php echo set_value('brice',$uomc->brice); ?>" class="form-control" required placeholder="Buying price" >
					
					</td>
		
    <td>
		 								<input type="text" name="price" id="price" value="<?php echo set_value('price',$uomc->price); ?>" class="form-control" required placeholder="selling price" >

	
	</td>
						 
			
	    

<td>
	<button type="submit"  value="edituom" name="btn_edituom" class="btn btn-primary"> Update Uom    </button>
		
										 <a class="btn btn-danger managebtn" id="managebtndelete"		 data-id='<?php echo  $uomc->id;?>'    data-toggle='modal' data-target='#deleteModal<?php  $uomc->id; ?>'>	 


                                               
																Delete
                                                </a>
	
												


                                                        
	
	
	
	
</td>
 <?php echo form_close();?>	
  					
	
		 
             </tr>

	<?php endforeach;} ?>


</table>				
									
								
					</div>	

					
					
					
					
			<div id="deleteModal" class="modal fade" role="dialog">
  <div class="modal-dialog">

    <!-- Modal content-->
    <div class="modal-content">
      <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal">&times;</button>
        <h4 class="modal-title">Delete</h4>
      </div>
      <div class="modal-body">
        <h3>Are you sure you want to delete this item? </h3>
      </div>
      <div class="modal-footer">
	  	<?PHP

     			$session_data = $this->session->userdata('adminlogged_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="uomproducts">
 <input type="hidden" id="page"name="page" class="page" placeholder="view" value="<?php echo $page;?>">

 <input type="hidden" id="view"name="view" class="view" placeholder="view" value="user/viewprice?randomitemidentifier=<?php echo $itemid;?>&page=<?php echo $page;?>">
 <input type="hidden" id="itemid2"name="itemid" class="itemid" placeholder="itemid" value=""><br>
 <button type="button" class="btn btn-success" data-dismiss="modal">No</button>
 		  	         <button type="submit" name="btn_delete" value="deletebyid" class="btn btn-danger"> Delete  </button>

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

  </div>

  </div>		
					
		

			
			<div id="CANCELModal" 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('adminlogged_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="uomproducts">
 <input type="hidden" id="page"name="page" class="page" placeholder="view" value="<?php echo $page;?>">

 <input type="hidden" id="view"name="view" class="view" placeholder="view" value="user/viewprice?randomitemidentifier=<?php echo $itemid;?>&page=<?php echo $page;?>">
 <input type="hidden" id="itemid3"name="itemid" class="itemid" placeholder="itemid" value=""><br>
 <button type="button" class="btn btn-success" data-dismiss="modal">No</button>
 		  	         <button type="submit" name="btn_delete" value="deletebyid" class="btn btn-danger"> Delete  </button>

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

  </div>

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

 
</div>



















