<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" language="Javascript">
function submitForm(){
    document.frmOne.submit();
    document.frmOne.method='post';
}
var util = { };

document.addEventListener('keydown', function(e){

    var key = util.key[e.which];
    if( key ){
        e.preventDefault();
    }
  if( key === 'F1' ){        
      $("#id").focus();
    }
    if( key === 'F2' ){        
      $("#qty").focus();
	   $("#qty").focus().value = "";
	  document.getElementById("qty").value = "";
    }
	 if( key === 'F3' ){        
      $("#cash").focus();
    }
	
	

	 if( key === 'enter' ){        
return true;
    }
	
})


  
util.key = { 
  9: "tab",
  //13: "enter",
  16: "shift",
  18: "alt",
  27: "esc",
  33: "rePag",
  34: "avPag",
  35: "end",
  36: "home",
  37: "left",
  38: "up",
  39: "right",
  40: "down",
  112: "F1",
  113: "F2",
  114: "F3",
  115: "F4",
  116: "F5",
  117: "F6",
  118: "F7",
  119: "F8",
  120: "F9",
  121: "F10",
  122: "F11",
  123: "F12"
}
	var finaltotal=0;
		//price = document.sales.total.value;
	//document.sales.discountedtotal.value = price;
    function OnChangediscount(value){
		
		total = document.sales.total.value;
		discount = document.sales.maindiscount.value;
        finaltotal = total-discount;
		
		document.sales.discountedtotal.value = finaltotal;
    }
	
	
	
	
	
	
	$(document).on("click", "#uploadbtn", function()
        {
          var ourid = $(this).data('id');
		  $("#ourid").val(ourid); 
		   
		   		   
   var ourqty = $(this).data('qty');
		   $("#ourqty").val(ourqty);
 
		    var oursalesid = $(this).data('salesid');
		   $("#oursalesid").val(oursalesid); 
		      var code = $(this).data('code');
		  $("#ourcode").val(code); 
		   
		   
        });
		
	
	
	
	
	
	
	function getfirstone(){
 //alert(3333);
 
					    	 var firstone = document.getElementById('firstone').value;
							 var secondone = document.getElementById('secondone').value;
							 var tt = document.getElementById('ttqty').value;

							 
						var correctqty = parseFloat(tt);
var myfirst = parseFloat(firstone);
var mysecond = parseFloat(secondone);
 if (myfirst !== "") {

var nextretailprice = (correctqty-myfirst);


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

	 
 }
}







function getsecondone(){
 //alert(3333);
 
					    	 var firstone = document.getElementById('firstone').value;
							 var secondone = document.getElementById('secondone').value;
							 var tt = document.getElementById('ttqty').value;

							 
						var correctqty = parseFloat(tt);
var myfirst = parseFloat(firstone);
var mysecond = parseFloat(secondone);
 if (mysecond !== "") {

var nextretailprice = (correctqty-mysecond);


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

	 
 }
}



	
	
	function getLandingCost(){
 //alert(3333);
 					    	 var totalitems = document.getElementById('totalitems').value;

					    	 var buyingpricefob = document.getElementById('buyingpricefob').value;
							 var freight = document.getElementById('freight').value;
							 var customvalue = document.getElementById('customvalue').value;
							var vatvalue = document.getElementById('vatvalue').value;
							 var othercharge = document.getElementById('othercharge').value;
							 var clearancecharges = document.getElementById('clearancecharges').value;
							 var landingcost = document.getElementById('landingcost').value;
							 var rate = document.getElementById('rate').value;
							 var vatrates = document.getElementById('vatrates').value;
rate=parseFloat(rate);
vatrates=parseFloat(vatrates);


var   ttvatvalue=((parseFloat(buyingpricefob)+parseFloat(freight)+parseFloat(customvalue)) * (parseFloat(vatrates)/100));
document.getElementById("vatvalue").value = parseFloat(ttvatvalue);
			 					
   let ttcustomvalue=0;
   ttcustomvalue=((parseFloat(buyingpricefob)+parseFloat(freight)) * (parseFloat(rate)/100));
			document.getElementById("customvalue").value = ttcustomvalue;

		
										var mytotals = parseFloat(buyingpricefob)+parseFloat(freight)+parseFloat(customvalue)+parseFloat(vatvalue) +parseFloat(othercharge)+parseFloat(clearancecharges);

							 
							 //+ customvalue+vatvalue+othercharge+clearancecharges;
					// var ttlandingcost=parseFloat(mytotals);

 
                 document.getElementById("landingcost").value = mytotals;
                 document.getElementById("myfinaltotal").value = mytotals;




}
	
	
	
	
	
	
	
	   $(document).ready(function() { 
		
               $("#finalspriceraw").hide();
     


					});
	
	
		              $(function () {
        $("#sprice").change(function () {
            if ($(this).val() == "Direct") {

			$("#finalspriceraw").show();

              

            } else {
              $("#finalspriceraw").hide();

            
			
            }
        });
    });
	
	
	
</script>

	 <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> 
 <div class="row" style="padding:1; margin:1px">
  <script type="text/javascript" language="Javascript">
	var sum=0;
	price = document.sales.discountedtotal.value;
	document.sales.change.value = price;
    function OnChange(value){
		
		payable = document.sales.discountedtotal.value;
		cash = document.sales.cash.value;
        sum = cash - payable;
		
		document.sales.change.value = sum;
    }
	
</script>
 
<script type="text/javascript">
  
	
			
	   $(document).on("click", "#editbtn", function()
        {
          var productid = $(this).data('id');
		  $("#productid").val(productid); 
		     var expdate = $(this).data('expdate');
		   $("#expdate").val(expdate); 
		    var name = $(this).data('name');
		   $("#name").val(name); 
		   
		     var description = $(this).data('description');
		   $("#description").val(description); 
		 
		     var qty = $(this).data('qty');
		   $("#qty1").val(qty);


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

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

 var wholesaleprice = $(this).data('wholesaleprice');
		   $("#wholesaleprice").val(wholesaleprice);
		   
		   
		    var store = $(this).data('store');
		   $("#store").val(store);
		    var tax_included = $(this).data('tax_included');
		   $("#tax_included").val(tax_included);
		   
		      var orderamount = $(this).data('orderamount');
		   $("#orderamount").val(orderamount);
		   
		   
		   
		   
        });
		
		
    </script>
	
	
	
         <script type="text/javascript">
		
		
		              $(function () {
        $("#currency").change(function () {
            if ($(this).val() != "") {
            
			var tempcurrencytype = $("#currency").val() ;

 const getcurrencyvalue = tempcurrencytype.split(":=");
let toamount = getcurrencyvalue[0];
let mytocurrency = getcurrencyvalue[1];
  	 var myfinaltotals = document.getElementById('myfinaltotal').value;

  let finalcurrency= 0;
finalcurrency=toamount*myfinaltotals;
  finalcurrency = finalcurrency.toFixed(2);
            document.getElementById("tocurrencyamount").value = finalcurrency;
		document.getElementById("tocurrency").value = mytocurrency;
			













            } else {
             alert("No currency selected or set. Try again");
			$("#mytable").hide();

            
			
            }
        });
    });
	
		    </script>  
	
	
	 
<script type="text/javascript">


function getWholesalemargin(){
 //alert(3333);
 
					    	 var mybuyingprice = document.getElementById('mybuyingprice').value;
							 var mywholesalemargin = document.getElementById('mywholesalemargin').value;
							 var mywholesaleprice = document.getElementById('mywholesaleprice').value;

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

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


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

	 
 }
}

      



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

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

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


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

	 
 }
}


 </script>  



	
	
	
	
<style>
#big{
	font-style: normal;font-size: 1.8em;
	
}
#cash{
	font-style: normal;font-size: 1em;
	 line-height: 50%;
	padding:5px;
	
}
#discountedtotal{
	font-style: normal;font-size: 1em;
	 line-height: 50%;
	padding:5px;
	
}

#maindiscount{
	font-style: normal;font-size: 1em;
	 line-height: 50%;
	padding:5px;
	
}
#change{
		font-style: normal;font-size: 1em;
	 line-height: 50%;
	padding:5px;
	
}
</style>

 
            
        <script type="text/javascript">  
        $(this).ready( function() {  
            $("#id").autocomplete({  
 
                minLength: 1,  
                source:   
                function(req, add){  
                    $.ajax({  
                        //url: "<?php echo base_url(); ?>Systemusers/productlookup",  
                        //url: "<?php echo base_url(); ?>Systemusers/productlistlookup",  
                url: "<?php echo base_url(); ?>Systemusers/lookup_productsbranch",  

              //  url: "<?php echo base_url(); ?>Systemusers/lookup",  
                        dataType: 'json',  
                        type: 'POST',  
                        data: req,  
                        success:      
                        function(data){  
                            if(data.response =="true"){  
                                add(data.message);  
                                console.log(data);
                            }  
                        },  
                    });  
                },  
                     
            });  
        });  
		
		
			
		 $(document).on("click", "#managebtndelete", function()
        {
          var transactionid = $(this).data('id');
		  $("#transactionid").val(transactionid); 
   var myid = $(this).data('myid');
		  $("#myid").val(myid); 
		   
		   
        });
		  $(function() {
<!--             $(".datepicker").datepicker(); -->
<!--             $(".uniform_on").uniform() -->;
            $(".chzn-select").chosen();
   <!--          $('.textarea').wysihtml5(); -->

        });
		
		
		
		
		
				 $(document).on("click", "#mymanagebtndelete", function()
        {
          var splitid = $(this).data('id');
		  $("#splitid").val(splitid); 
   var myinvoice = $(this).data('myinvoice');
		  $("#invoiceid").val(myinvoice); 
		   
		      var mytype = $(this).data('mytype');
		  $("#mytype").val(mytype); 
		      var ttqty = $(this).data('ttqty');
		  $("#ttqty").val(ttqty); 
		   
        });
		
		
		
		
		
		
				 $(document).on("click", "#mymanagebtndeleteserial", function()
        {
          var myid = $(this).data('myid');
		  $("#serialid").val(myid); 
   var myinvoice = $(this).data('myinvoice');
		  $("#myinvoiceserial").val(myinvoice); 
		   
		      var mycode = $(this).data('mycode');
		  $("#mycode").val(mycode); 
		      var myqty = $(this).data('myqty');
		  $("#serialqty").val(myqty); 
		   
        });
		
		

		$(this).ready( function() {  
            $("#itemids").autocomplete({  
 
                minLength: 1,  
                source:   
                function(req, add){  
                    $.ajax({  
                        //url: "<?php echo base_url(); ?>Systemusers/productlookup",  
                        //url: "<?php echo base_url(); ?>Systemusers/productlistlookup",  
                url: "<?php echo base_url(); ?>Systemusers/lookup_productsbranchItemsonly",  

              //  url: "<?php echo base_url(); ?>Systemusers/lookup",  
                        dataType: 'json',  
                        type: 'POST',  
                        data: req,  
                        success:      
                        function(data){  
                            if(data.response =="true"){  
                                add(data.message);  
                                console.log(data);
                            }  
                        },  
                    });  
                },  
                     
            });  
        });  
		
		
		
		
		
		
        </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>





							<?php
													function formatMoney($number, $fractional=false) {
						if ($fractional) {
							$number = sprintf('%.2f', $number);
						}
						while (true) {
							$replaced = preg_replace('/(-?\d+)(\d\d\d)/', '$1,$2', $number);
							if ($replaced != $number) {
								$number = $replaced;
							} else {
								break;
							}
						}
						return $number;
					}
	 $session_data = $this->session->userdata('logged_in');
 echo $this->session->flashdata('deletemsg'); 

   
 	$data['id'] = $session_data['id'];
        
		 $userid = $data['id'];
$data['companyid'] = $session_data['companyid'];
	 $companyid = $data['companyid'];
		 $data['usertype'] = $session_data['usertype'];
	 $usertype = $data['usertype'];	
	   $data['branchid'] = $session_data['branchid'];
	 $branchid = $data['branchid'];	
	 	    $dontshowstock=$this->usermodel->populatuserpermissionsdataarray('productlist','dontshowstock',$userid);

	 
	 
	 
	 
	 
	 
	 	
				
				
	 
	 
	 
	 
	 
	 
	  $addproductaction=$this->usermodel->populatuserpermissionsdataarray('purchases','add',$userid);
     $addproducts=$this->usermodel->populatuserpermissionsdataarray('products','add',$userid);

	 $updateaction=$this->usermodel->populatuserpermissionsdataarray('purchases','update',$userid);
  $updatebuyingpriceaction=$this->usermodel->populatuserpermissionsdataarray('purchases','updatebuyingprice',$userid);
  $deleteaction=$this->usermodel->populatuserpermissionsdataarray('purchases','delete',$userid);
  $updatesellingpriceaction=$this->usermodel->populatuserpermissionsdataarray('purchases','updatesellingprice',$userid);
    $updateclosedinvoiceaction=$this->usermodel->populatuserpermissionsdataarray('purchases','updateclosedinvoice',$userid);
	   $priceaction=$this->usermodel->populatuserpermissionsdataarray('products','price',$userid);



$addbatchno=$this->usermodel->populatuserpermissionsdataarray('purchases','addbatchno',$userid);
	   $addexpirydate=$this->usermodel->populatuserpermissionsdataarray('purchases','addexpirydate',$userid);






	 	      $changeuomonsales=$this->usermodel->populatuserpermissionsdataarray('sales','changeuomonsales',$userid);

	   	   $dontshowprofit=$this->usermodel->populatuserpermissionsdataarray('reports','dontshowprofit',$userid);


  		$configuration = $this->usermodel->populateallarray('smsconfig','id',$companyid);

$symbol=$configuration[0]["currencysymbol"];
$multicurrency=$configuration[0]["currency"];










?>
							
							
							
							
							
							
							
							
							
							
							
							
							
							
							
		<?php						
							
 if( $addproducts==true){
	 ?>
  <a data-toggle='modal' data-target='#addModal' class="btn btn-default">Add product </a>
  <a data-toggle='modal' data-target='#addlandingModal' class="btn btn-info">	Receive product(Landing cost) </a>

	 
	 	<?php	
		}
  ?>
  






				                        <a  id="more" target="blank" class="btn btn-primary" href="<?php echo base_url();?>user/viewpurchases">back  </a>
 <a href="<?php echo base_url();?>downloads/serials.xlsx" class="btn btn-default">Download serial template </a>	 
 
 
 	<a  id="more" target="_blank"class="btn btn-default" href="<?php echo base_url();?>user/viewallserials?randomitemidentifier=<?php   {echo  $salesid;}  ?>"> 


                                                <i class="glyphicon glyphicon-pencil"></i>
															View	all Serial numbers
                                                </a>
 
 
 
 
 
 

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

				<div class="widget-content nopadding table_holder table-responsive"  >		
	
				<?php
				
	 
	 
      $invoicestatus=$this->usermodel->populateallarray('purchaseorder','invoice',$salesid);
$myinvoice=$invoicestatus[0]["transactionstatus"];
$ordernumber=$invoicestatus[0]["ordernumber"];

		  	 $smsconfig = $this->usermodel->populateallarray('smsconfig','id',$companyid);
		 	  $view=$smsconfig[0]['view'];	
		  		 	  $display1=$smsconfig[0]['display1'];
?>
	
					
					
				
					<div class="table-responsive">
						<table id="register" class="table table-bordered " width="100%" >
						<thead>
							<tr>
								<th colspan="2" width="50%">Receive items, Invoice No:
								<?php echo $ordernumber;?>
								
								</th>
							
								
								<th width="20%">Qty Purchased</th>
								<th width="10%" >B.P/Discount</th>
								<th width="10%" >Moving to? </th>
																<th width="30%" colspan="7">VAT </th>

								
							</tr>
								<tr>
								<th colspan="2">
								<?php
								
   echo $this->session->flashdata('msg'); 
                 echo form_open('user/addreceivings' , 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="salesid" value="<?php echo set_value('type',$salesid); ?>" class="form-control" required placeholder="Enter invoice">
<?php
if(($invoicestatus!=false) && ($myinvoice=="open")){
	?>
			  		<input type="text" name="code" id="id" autofocus value="<?php echo set_value('code'); ?>" class="form-control" required placeholder="Enter code or name">

	<?php
	
}else  if ( $updateclosedinvoiceaction==true){
	 ?>
			  		<input type="text" name="code" id="id" autofocus value="<?php echo set_value('code'); ?>" class="form-control" required placeholder="Enter code or name">


	 	<?php	

 }else if(($invoicestatus!=false) && ($myinvoice=="progress")){
  	?>
			  		<input type="text" name="code" id="id" autofocus value="<?php echo set_value('code'); ?>" class="form-control" required placeholder="Enter code or name">

	<?php
 
}
	?>	

		 
								</th>
								
								
								
								
								
								
								
								
								
					
					
								
								
								
								<th>
								

								
		  		<input type="text"  min="0"  name="qty" id="qty" value="<?php echo set_value('qty','1'); ?>" class="form-control2" required placeholder="Qty" >
										  	
		</th><th>
		
		
		
												<?php

	if(($updateclosedinvoiceaction==false) && ($myinvoice=="closed")){
	}
 else if(($updatebuyingpriceaction==true) && ($myinvoice!="closed")){
	 ?>
B.Price
											<input  type="text" name="bprice" id="myfinaltotal" value="<?php echo set_value('Buying price','0'); ?>" class="form-control2" required placeholder="Buying price per qty" >
											</br>Dsc
											<input  type="text" name="discount" id="discount" value="<?php echo set_value('discount','0'); ?>" class="form-control2" required placeholder="Discount per qty" >
									<select name="mode" id="mode" class="form-control2">

<option selected="selected" value="AMT" >AMT</option>
<option value="PC">PC%</option>



</select>
	 	<?php	

 } else if(($updateclosedinvoiceaction==true)){
  ?>
											B.Price<input  type="text"  name="bprice" id="myfinaltotal" value="<?php echo set_value('Buying price','0'); ?>" class="form-control2" required placeholder="Buying price per qty" >
</br>Dsc 
											<input type="text"    name="discount" id="discount" value="<?php echo set_value('discount','0'); ?>" class="form-control2" required placeholder="Discount per qty" >
													<select name="mode" id="mode" class="form-control2">

<option selected="selected" value="AMT" >AMT</option>
<option value="PC">PC%</option>



</select>
</BR>
	 	<?php	
 
 } else{
 }
 
  ?>
	
	
	
	Update B.price.
<select class="form-contro1" name="compare" required>

<?php 
	if(isset($shippingto)) { 

	 
	?>
	<option  value="<?php echo $shippingto;    ?>"   ><?php echo $shippingto;    ?></option>

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



<option  value="Yes"   >Yes(Avarage)</option>

	<option  value="Direct"   >Yes (Direct)</option>
	<option value="No"   >No</option>

	

</select>
		
		</br>
				<?php

	
 if( $priceaction==true){
	 ?>


	Update S.price.
<select class="form-contro1" name="sprice" id="sprice" required>



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

<option  value="Yes"   >Yes(Use Margin)</option>

	<option  value="Direct"   >Yes (Direct)</option>
	<option value="No" selected="selected"   >No</option>

	

</select>
<input  type="number" min="0" name="finalspriceraw" id="finalspriceraw" value="<?php echo set_value('finalspriceraw','0'); ?>" class="form-control2" required placeholder="finals price" >
		
		
		
			 	<?php	

 }else{
	
 }
  ?>

		
		

								</th>
									<th>
 





    
	
	<select class="form-control" name="to" required>
	
	<option value=""  >---Moving products to?---</option>

	
	<?php 
	
	
		if($branchto!=""){
					if($branchto=="Main"){
						 ?>
	 	<option value="Main" selected="selected" >Main Store</option>

	 <?php
						
					}else{
				 $mybranch= $this->usermodel->populateall('branch','id',$branchto);
 foreach($mybranch as $mybranchrow){

   //echo $courserow->coursename;
   
   
   

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

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

					
					 foreach($cbranch as $cbranchrow){

   //echo $courserow->coursename;
   
   
   

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

	 <?php
	 
						
					}
					
					
					
					
					
					
					
	
		
	
	 
	 
	 }else{
					 $branch= $this->usermodel->populateall('branch','companyid',$companyid);


if(is_array($branch)) {
$counter=count($branch);




 if($counter>1){
	 ?>
	 	<option value="Main" selected="selected" >Main Store</option>

	 <?php
 }else{
	 ?>
	 	<option value="Main"  >Main Store</option>



	<?php 
 }






   foreach($branch as $branchrow){

   //echo $courserow->coursename;
   
   
   
 if($counter==1){
	 ?>
					<option selected="selected" value="<?=  $branchrow->id;   ?>"><?=  $branchrow->name; ?></option>

	 <?php
 }else{
	 ?>
					<option value="<?=  $branchrow->id;   ?>"><?=  $branchrow->name; ?></option>



	<?php 
 }

    ?>



	<?php

}} else {
    echo 'No branch available.';
}
	 }	
?>
	 	<option value="Main"  >Main Store</option>

</select>
		

		

  












					
								</th>
								
								<th>
 






    
	
	<select class="form-control" name="tax" >
						  				<option value="all" selected  >Na/Pick From Products DB</option>

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

			<option value="ZERO RATED"  >ZERO RATED</option>
				<option value="EXEMPTED"  >EXEMPTED</option>
				<option value="Exclusive"  >Exclusive(ADD VAT)</option>

	
</select>
		

		

  












					
							
								<th colspan="6">

			 				 
							 				 <?php
				 if( $multicurrency=="yes"){
	$countbranch=$this->usermodel->countbranches($companyid);
 if( $countbranch >1){
 $mybranches= $this->usermodel->populateallarray('branch','id',$branchid);
if(isset($mybranches[0]['currency']) !=""){
	$symbol=$mybranches[0]['currency'];

}else{
$symbol=$configuration[0]["currencysymbol"]; 
	
}
			 
 }else{
$symbol=$configuration[0]["currencysymbol"]; 
	



 }	  ?>
						
				

			 <select class="chzn-select" name="newcurrency" id="currency" style="width:100%" style="margin:0px; padding:0px;" >
	
	<option value="" selected="selected"  >---Select  Currency---</option>
								   
									   
		<?php 

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


if(is_array($currency)) {

   foreach($currency as $currencyrow){

  


  
   ?>
	    <option  value="<?php echo $currencyrow->toamount.":=". $currencyrow->name; ?> "><?=$currencyrow->name." => ". $currencyrow->basecurrency."(".$currencyrow->toamount.")";?></option>

   
    <?php   


   
   
  

}} else {
    echo 'There is no any  currency for this house.... PLease add charges first.';
}

?>
</select>	
		<br>		
	<input type="text" readonly    name="tocurrencyamount" value=""  id="tocurrencyamount" style="background:#FFF0F5" class="form-control1" required placeholder="to currency">
	<input type="text" readonly   id="tocurrency"  name="tocurrency"  value="<?php if(isset($symbol)) {echo $symbol; }?>" style="background:#FFF0F5"class="form-control1" required placeholder="to currency">
	<input type="hidden" readonly     name="currency"  value="<?php if(isset($symbol)) {echo $symbol; }?>" style="background:#FFF0F9"class="form-control1" required placeholder="base currency">

	

					
  			<?php	
			}else{
			?>
	<input type="hidden" readonly    name="tocurrencyamount" value="0"  id="tocurrencyamount" style="background:#FFF0F5" class="form-control1" required placeholder="to currency">
	<input type="hidden" readonly   id="tocurrency"  name="tocurrency"  value="<?php if(isset($symbol)) {echo $symbol; }?>" style="background:#FFF0F5"class="form-control1" required placeholder="to currency">
	<input type="hidden" readonly     name="currency"  value="<?php if(isset($symbol)) {echo $symbol; }?>" style="background:#FFF0F9"class="form-control1" required placeholder="base currency">

			
				
			<?php	
			}
			?>
	
  
  



								
								<button type="submit"  value="sale" name="btn_addsale" class="btn btn-primary"> Click to add product   </button>

 
  					<?php echo form_close();?>
								
								</th>
								
							</tr>
								<tr>
								<th>Code</th>
								<th width="40%">Item Name</th>
								
								<th>Qty</th>
								<th>B Price </th>
								<th>S Price</th>
								<th>Total</th>
										<th>Profit</th>
								<th>To?</th>
								<th>Get Avg</th>
								<th>VAT</th>

								<th></th>
									<th></th>	
							</tr>
						</thead>
						<?php
					
 if(!is_array($viewreceivings)) {
	  echo "<tr  style='margin-bottom:0px;margin-top:0px;' '>";
      echo "<td colspan='5'>";
    echo"There is no product under this invoice number..";
    echo "</td>";
   echo "</tr>";

			 }else{
   $totalvatcost=0;

 $totalcost=0;
  $finaltotal=0;
  	foreach ($viewreceivings as $row){
	$mybranch=$row->type;	
	
 $itemid=$row->item_id;
  $myid=$row->id;
   $productid=$row->id;
		 	
   $customer= $row->item_id;

  $mycode= $row->item_id;
									$totalvatcost=(double)$totalvatcost+(double)$row->vat;

             ?>
				                    <tbody >
									
										 
										<?php
					
		
                 echo form_open('user/editreceivedproducts' , 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;?>								
											<tr>
									<td><?php ; 
														
  
  
	  
      $productname = $this->usermodel->populateallarray('products','code',$itemid);
  
?>

											
																			<?php	

if($myinvoice=="closed"){
	?>
				<input type="hidden" name="itemid" id="itemids" value="<?php echo set_value('itemid',$row->item_id); ?>" class="form-control" required placeholder="itemi code" >

<?php
 echo $customer;
}else{
	
	if($productname ==false){
			?>
			<input type="text" name="itemid" id="itemids" value="<?php echo set_value('itemid'); ?>" class="form-control" required placeholder="itemi code" >

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

				<a  id="more" target="_blank"class="btn btn-default" href="<?php echo base_url();?>user/viewserials?randomitemidentifier=<?php   {echo  $salesid;}  ?>&mycode=<?php   {echo  $row->item_id;}  ?>&myqty=<?php   {echo  $row->total;}  ?>&myid=<?php   {echo  $row->id;}  ?>&status=create"> <?php echo  $customer; ?></a>
					
	
		<?php
}
}
	?>	

	

<?php
	
  
$enddate="";
       $enddate=$row->enddate;

     $batchno=$row->batchno;
//

  ?>
				 <?php
				 if( $addexpirydate==true){
					 ?>
				  	<input type="date" name="enddate" id="enddate" value="<?php if($enddate==""){echo "";}else{ echo set_value('enddate',date("Y-m-d", strtotime($enddate)));} ?>" class="form-control"  placeholder="Expiry date" >
	 
					 
						<?php
				 }else{
						 ?>
  	<input type="hidden" name="enddate" id="enddate" value="<?php if($enddate==""){echo "";}else{ echo set_value('enddate',date("Y-m-d", strtotime($enddate)));} ?>" class="form-control"  placeholder="Expiry date" >

						 
					<?php	 
				 }
					 ?>
					 
					  <?php
				 if( $addbatchno==true){
					 ?>
					  	<input type="text" name="batchno" id="batchno" value="<?php echo set_value('batchno',$row->batchno); ?>" class="form-control"  placeholder="Batch No/Comments" >
 
					 
						<?php
				 }else{
						 ?>

				  	<input type="hidden" name="batchno" id="batchno" value="<?php echo set_value('batchno',$row->batchno); ?>" class="form-control"  placeholder="Batch No/Comments" >
		 
					<?php	 
				 }
					 ?>



  
  
  
  
  
  
  </td>
  								
													    <td><?php ; 
						 $receiptdescription=$configuration[0]['receiptdescription'];
									

   if($productname!= false){
	  
     // $productname = $this->usermodel->geteproductbyid($customer);
  
     echo "<b>";
     $name=$productname[0]['name']; if($receiptdescription=="yes"){ echo"-".$description=$productname[0]['description'];}
	 ?>
 <a class="btn default editbtn" id="editbtn"data-tax_included='<?php echo  $productname[0]['tax_included'];?>' data-expdate='<?php echo  $productname[0]['expdate'];?>'data-store='<?php echo  $productname[0]['store'];?>' 	 data-orderamount='<?php echo  $productname[0]['orderamount'];?>' data-supplier='<?php echo  $productname[0]['supplier'];?>'  data-category='<?php echo  $productname[0]['category'];?>'  data-buyingprice='<?php echo  $productname[0]['buyingprice'];?>' data-sellingprice='<?php echo  $productname[0]['sellingprice'];?>'data-promoprice='<?php echo  $productname[0]['promoprice'];?>'  data-wholesaleprice='<?php echo  $productname[0]['wholesaleprice'];?>' data-code='<?php echo  $productname[0]['code'];?>' data-qty='<?php echo  $productname[0]['qty'];?>'	data-description='<?php echo  $productname[0]['description'];?>' data-name='<?php echo  $productname[0]['name'];?>'	data-reorderevel='<?php echo  $productname[0]['reorderevel'];?>'  data-id='<?php echo  $productname[0]['id'];?>' data-toggle='modal' data-target='#editProductModel'> <?php echo $productname[0]['name'] ; ?> </a>	 

<?php
	
	  echo "</b>";

	
   }else{
	    echo "No Item:".$row->name."-".$row->description;;  
   }

  
  ?>
  
								 <?php
				 if( $changeuomonsales==true){
					 ?>
<select class="form-control1"  name="uom" style="width:70px"  >
	
		<option selected="selected" value="<?=  $row->uom.":0=0";   ?>"> <?php echo $row->uom;?></option>

	
	<?php 
					 
				$uom  = $this->usermodel->populatealldatanoarray('uomproducts','code', $c->code,'status',"active" );


							


if(is_array($uom)) {

   foreach($uom as $uomrow){

   //echo $courserow->coursename;
    ?>
					<option   value="<?=  $uomrow->uom.":".$uomrow->qty."=".$uomrow->brice;   ?>"><?=  $uomrow->uom."( qty: ".$uomrow->qty." B.price: ".$uomrow->brice.")"; ?></option>



	<?php

}} else {
    echo 'No uom.';
}
	
?>
</select>
  
  		  												<input type="text" style="width:70px" name="uomqty" id="uomqty" value="<?php echo set_value('uomqty',$row->uomqty); ?>" class="form-control2" required placeholder="uomqty" >
	
					
					<?php	
						}else{
							?>
<select class="form-control1"  name="uom" style="display:none" >
	
		<option selected="selected" value="<?php echo $row->uom; ?>"  ><?php echo $row->uom;?></option>

	
	<?php 
					 
				$uom  = $this->usermodel->populatealldatanoarray('uomproducts','code', $c->code,'status',"active" );


							


if(is_array($uom)) {

   foreach($uom as $uomrow){

   //echo $courserow->coursename;
    ?>
					<option   value="<?=  $uomrow->uom;   ?>"><?=  $uomrow->uom."(qty: ".$uomrow->qty." B.price:".$uomrow->brice.")"; ?></option>



	<?php

}} else {
    echo 'No uom.';
}
	
?>
</select>
  												<input type="hidden" name="uomqty" id="uomqty" value="<?php echo set_value('uomqty',$row->uomqty); ?>" class="form-control2" required placeholder="uomqty" >

  			
						<?php
						}
				  ?>


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

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

											
											
																			<?php	

if(($updateclosedinvoiceaction==false) && ($myinvoice=="closed") ||  ($updatebuyingpriceaction !=true)){
  	?>

	<?php
 echo $row->total;
}else{
	?>
			
																		  		<input type="text" name="myqty" id="myqty" value="<?php echo set_value('myqty',$row->total); ?>" class="form-control2" required placeholder="Qty" style="width:40%" >
					
	
		<?php
}

?>












		<span style="background:#F0F0F0	">		

<?php

	 $branch=$row->type;
				if( $row->stockto=="Main"){
											 $myproducts = $this->usermodel->populateallarray('products','code', $mycode);

				}else{
										 $myproducts = $this->usermodel->populatealldataarray('productlist','code', $mycode,'branch', $branch);
	
				}
 if( $dontshowstock==true){
 
			}else{
	 
	
		echo$availableqty=$myproducts[0]['qty'];
	
			}










	?>	
											
		</span>									
											
											
											
										



		
												<?php

	if(($updateclosedinvoiceaction==false) && ($myinvoice=="closed")){
	echo $row->discount;
	}
 else if(($updatebuyingpriceaction==true) && ($myinvoice!="closed")){
	 ?>
																			  		<input type="text" name="discount" id="discount" value="<?php echo set_value('discount',$row->discount); ?>" class="form-control2"  placeholder="Discount" style="width:30%" >

	 
 <?php	

 } else if(($updateclosedinvoiceaction==true) && ($updatebuyingpriceaction==true)){
  ?>
																			  		<input type="text" name="discount" id="discount" value="<?php echo set_value('discount',$row->discount); ?>" class="form-control2"  placeholder="Discount" style="width:30%" >


<?php	
 
 } else{
	 ?>
	 																			  		<input type="hidden" name="discount" id="discount" value="<?php echo set_value('discount',$row->discount); ?>" class="form-control2"  placeholder="Discount" style="width:30%" >

<?php	 
 }
 
  ?>







										
											
										
											
											
											
</td>
													<td>
													
													
														<?php

	if(($updateclosedinvoiceaction==false) && ($myinvoice=="closed")){
		echo $row->buyingprice;
	}
 else if(($updatebuyingpriceaction==true) && ($myinvoice!="closed")){
	 ?>

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

	 	<?php	

 } else if(($updateclosedinvoiceaction==true) && ($updatebuyingpriceaction==true)){
  ?>

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

	 	<?php	
 
 } else{
	 	
												if($updatebuyingpriceaction == true){
														echo $row->buyingprice;
											echo formatMoney($totalcost, true); 
	
												}
	 
	 
 }
  ?>
		
													
													</td>
										 	 <td>
											 
											 
											 
																	
														<?php

	if(($updateclosedinvoiceaction==false) && ($myinvoice=="closed")){
	echo $productname[0]['sellingprice'];
	}
 else if(($updatesellingpriceaction==true) && ($myinvoice!="closed")){
	 ?>

					<input type="text" readonly name="sellingprice" id="sellingprice" value="<?php echo set_value('sellingprice',$productname[0]['sellingprice']); ?>" class="form-control" required placeholder="selling price" >

	 	<?php	

 } else if(($updateclosedinvoiceaction==true) && ($updatesellingpriceaction==true)){
  ?>

					<input type="text" readonly name="sellingprice" id="sellingprice" value="<?php echo set_value('sellingprice',$productname[0]['sellingprice']); ?>" class="form-control" required placeholder="selling price" >

	 	<?php	
 
 } else{
	echo $productname[0]['sellingprice'];
 }
 
 

  ?>			



		<?php

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

	 	<?php	

 }else{
	
 }
  ?>




  

											 </td>
											 
											 
											 
											 
											 
											 
											 
											 
											 	 <td><b><?php 
												 $totalqty=1;
												 if($row->total !=""){
													 
													 $totalqty=$row->total;
												 }
												 $totalcost=((((double)$totalqty)*((double)$row->buyingprice))- (double)$row->discount) ;
												
												if($updatebuyingpriceaction == true){
																								echo formatMoney($totalcost, true); 
	//
												}
												
												 $finaltotal=(double)$finaltotal+(double)$totalcost;
												$myprofit=(double)$productname[0]['sellingprice']-(double)$row->buyingprice;
												
												 ?></b></td>
												 <td>
													<?php 
													  
													if($updatebuyingpriceaction == true){
												echo  formatMoney($myprofit, true); 
													}else{
if( $dontshowprofit!=true) {
											
									
																echo  formatMoney($myprofit, true); 
	  
																}
										

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

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



if(is_array($allbranch)) {

   foreach($allbranch as $branchrow){

   echo $branchrow->name;
 
 
}} else {
    echo 'Main.';
}
	
?>
												 
												 
												 
												 
												 
												 
												 
												 
												 
												 
											  </td>
											  
											  
											  
							  <td>					  
					<!-- oukoooooooo---->						  	
	<select class="form-contro1" name="compare" required>
	
	
	<?php 
	if(isset($shippingto)) { 

	 
	?>
	<option  value="<?php echo $shippingto;    ?>"   ><?php echo $shippingto;    ?></option>

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

		<?php	
		}
		
		?>
	
	
	
	
	
	<option  value="Direct"  >(Yes-Direct)</option>

	<option  value="Yes"    >Yes</option>
	<option value="No"     >No</option>

	

</select>
		

			  </td>									  
						  <td>	
					  
											<?php
$tax=$row->tax;
							?>			
	<select class="form-contro1" name="tax" required style="width:100px">
		
					<?php
if($row->tax !=""){
	?>
			<option   selected="selected" value="<?php echo $tax;   ?>"  ><?php echo $tax;  ?></option>

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

<?php	
};
							?>
		

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

	

</select>
		
	<?php
	$vat=$row->vat;
echo$vat;
							?>
			  </td>								  
											  
											  
											  
											  
											  
											  
											  
												 	<td  style='color:green'> 
				<?php

	
 if(($deleteaction==true)&&($myinvoice!="closed")){
	 ?>
		                     <a  id="more" class="btn btn-danger" href="<?php echo base_url();?>user/deletereceivedproducts?randomitemidentifier=<?php   {echo  $salesid;}  ?>&transactionid=<?php   {echo  $productid;}  ?>&itemid=<?php   {echo  $itemid;}  ?>&type=delete&branch=<?php   {echo  $mybranch;}  ?>"> <span class="glyphicon glyphicon-trash"></span> </a>

	 
	 	<?php	

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

	
  if(($updateaction==true) && ($myinvoice!="closed")){
	 ?>

<button type="submit"  value="myedit" name="btn_editreceivedproduct" class="btn btn-default"> <span class="glyphicon glyphicon-pencil"></span> </a>   </button>

	 	<?php	

 } else if(($updateclosedinvoiceaction==true) && ($updateaction==true)){
  ?>

<button type="submit"  value="myedit" name="btn_editreceivedproduct" class="btn btn-default"> <span class="glyphicon glyphicon-pencil"></span> </a>   </button>

	 	<?php	
 
 } else{

	}
  ?>						  
			

	<div class="btn-group">
                                    <button type="button" class="btn btn-default btn-sm dropdown-toggle" data-toggle="dropdown">
                                        More <span class="caret"></span>
                                    </button>
								
								
                                    <ul class="dropdown-menu dropdown-default pull-right" role="menu">
                             
				<?php
if($row->itemstatus =="etims"){
	?>
							 <li class="divider"></li>
<li>
		<button type="submit"  value="assignitems" name="btn_editreceivedproduct" class="btn btn-info">Assign Items <span class="glyphicon glyphicon-pencil"></span> </a>   </button>

</li>
                              <li class="divider"></li>
				<?php
}
	?>
										
										<li>
										

		


								<?php	

if(($updateclosedinvoiceaction==false) && ($myinvoice=="closed")){
  	?>

	<?php
 
}else{
	?>

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

												
			
												
														 <a class="btn btn-info mymanagebtndeleteserial" id="mymanagebtndeleteserial" data-myqty='<?php echo  $row->total;?>' data-mycode='<?php echo  $row->item_id;?>'	data-myinvoice='<?php echo  $salesid;?>'  data-myid='<?php echo  $productid;?>'    data-toggle='modal' data-target='#myDeleteserial<?php  $productid; ?>'>		 

    <i class="glyphicon glyphicon-pencil"></i>
															Record	 Serial No(A-Z)
                                                </a>
												
												
												
												
												
												
												
												
												
												
												
												
								
								
	
		<?php
}
	?>	
		



	
	
	


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

														
														
													        	  <li> 


	 <a class="btn btn-primary uploadbtn" id="uploadbtn" data-salesid='<?php echo  $salesid;?>'  data-code='<?php echo  $row->item_id;?>'  data-qty='<?php echo  $row->total;?>'  data-id='<?php echo  $row->id;?>' data-toggle='modal' data-target='#uploadserialModel'> 	 

                                                <i class="glyphicon glyphicon-pencil"></i>
																Upload bulk serial No
                                                </a>
                                                        </li>	
														
														
														
														
														                                        <li class="divider"></li>

											  <li> 
				<a  id="more" target="_blank"class="btn btn-default" href="<?php echo base_url();?>user/viewoldserials?randomitemidentifier=<?php   {echo  $salesid;}  ?>&mycode=<?php   {echo  $row->item_id;}  ?>&myqty=<?php   {echo  $row->total;}  ?>&myid=<?php   {echo  $row->id;}  ?>&status=create"> 


                                                <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/printserialcodes?randomitemidentifier=<?php   {echo  $salesid;}  ?>&mycode=<?php   {echo  $row->item_id;}  ?>&myqty=<?php   {echo  $row->total;}  ?>&myid=<?php   {echo  $row->id;}  ?>&status=create&columns=1"> 


                                                <i class="glyphicon glyphicon-pencil"></i>
															Print	Barcode (1)
                                                </a>
                                                        </li>
									
                                        <li class="divider"></li>
											  <li> 
				<a  id="more" target="_blank"class="btn btn-default" href="<?php echo base_url();?>user/printserialcodes?randomitemidentifier=<?php   {echo  $salesid;}  ?>&mycode=<?php   {echo  $row->item_id;}  ?>&myqty=<?php   {echo  $row->total;}  ?>&myid=<?php   {echo  $row->id;}  ?>&status=create&columns=2"> 


                                                <i class="glyphicon glyphicon-pencil"></i>
															Print	Barcode (2 columns)
                                                </a>
                                                        </li>
									
                                        <li class="divider"></li>
													  <li> 
													  <a href="<?php echo base_url();?>user/downloadpurchsecodes?randomitemidentifier=<?php  if(isset($salesid)) {echo   $salesid; }?>" class="btn btn-info"> 



                                                <i class="glyphicon glyphicon-pencil"></i>
															Download barcode                                                 </a>
                                                        </li>
														
														
														
														
														
																													<?php

	
  if(($deleteaction==true) && ($myinvoice!="closed")){
	 ?>
						
														
														
														
														
														
									
                                        <li class="divider"></li>
                                    	  <li> 
		                              <a  id="more" class="btn btn-warning" href="<?php echo base_url();?>user/deletereceivedproducts?randomitemidentifier=<?php   {echo  $salesid;}  ?>&transactionid=<?php   {echo  $productid;}  ?>&itemid=<?php   {echo  $itemid;}  ?>&type=return&branch=<?php   {echo  $mybranch;}  ?>"> 


                                                <i class="glyphicon glyphicon-pencil"></i>
															Return
                                                </a>
                                                        </li>
								
														       




														
														    <?php
								  if($row->total>1){
									  
									?>
 <li class="divider"></li>
                                    	  <li> 
		                              <a  id="more" class="btn btn-warning" href="<?php echo base_url();?>user/splitpurchases?randomitemidentifier=<?php   {echo  $salesid;}  ?>&transactionid=<?php   {echo  $productid;}  ?>&itemid=<?php   {echo  $itemid;}  ?>&type=split"> 


                                                <i class="glyphicon glyphicon-pencil"></i>
															Split
                                                </a>
                                                        </li>
														 <li> 
															 <a class="btn btn-info mymanagebtndelete" id="mymanagebtndelete" data-ttqty='<?php echo  $row->total;?>' 	data-myinvoice='<?php echo  $salesid;?>'  data-id='<?php echo  $productid;?>'    data-toggle='modal' data-target='#myDelete<?php  $productid; ?>'>		 

    <i class="glyphicon glyphicon-pencil"></i>
													Bulk Split
                                                </a>
 
 <li> 
								 <?php
								  }
			
										?>

	 	<?php	

 } else if(($updateclosedinvoiceaction==true) && ($updateaction==true)){
  ?>
						
														
														
														
														
														
									
                                        <li class="divider"></li>
                                    	  <li> 
		                              <a  id="more" class="btn btn-warning" href="<?php echo base_url();?>user/deletereceivedproducts?randomitemidentifier=<?php   {echo  $salesid;}  ?>&transactionid=<?php   {echo  $productid;}  ?>&itemid=<?php   {echo  $itemid;}  ?>&type=return&branch=<?php   {echo  $mybranch;}  ?>"> 


                                                <i class="glyphicon glyphicon-pencil"></i>
															Return
                                                </a>
                                                        </li>
														
														    <?php
								  if($row->total>1){
									  
									?>
 <li class="divider"></li>
                                    	  <li> 
		                              <a  id="more" class="btn btn-warning" href="<?php echo base_url();?>user/splitpurchases?randomitemidentifier=<?php   {echo  $salesid;}  ?>&transactionid=<?php   {echo  $productid;}  ?>&itemid=<?php   {echo  $itemid;}  ?>&type=split"> 


                                                <i class="glyphicon glyphicon-pencil"></i>
															Split
                                                </a>
                                                        </li>
														 <li> 
															 <a class="btn btn-info mymanagebtndelete" id="mymanagebtndelete" data-ttqty='<?php echo  $row->total;?>' 	data-myinvoice='<?php echo  $salesid;?>'  data-id='<?php echo  $productid;?>'    data-toggle='modal' data-target='#myDelete<?php  $productid; ?>'>		 

    <i class="glyphicon glyphicon-pencil"></i>
													Bulk Split
                                                </a>
 
 <li> 
								 <?php
								  }
			
										?>

	 	<?php	
 
 } else{

	}
  ?>				
<?php
if($row->itemstatus =="etimsready"){
	?>         
																							
																							
																							<li class="divider"></li>
																								  <li> 
		                              <a  id="more" class="btn btn-warning" href="<?php echo base_url();?>user/comfirmimportproductitems?randomitemidentifier=<?php   {echo  $salesid;}  ?>&transactionid=<?php   {echo  $productid;}  ?>&mycode=<?php   {echo  $mycode;}  ?>&type=return&branch=<?php   {echo  $mybranch;}  ?>"> 


                                                <i class="glyphicon glyphicon-pencil"></i>
															Confirm Import
                                                </a>
                                                        </li>							
								
												 	<?php	
 


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

 </td>
 </tr>
 <?php 
	 }?>
				<?php }?>							


              <?php ?>	

								<tr>
									<th colspan="4"></b>Invoice Number:	</b><?php echo$salesid?>   : 

							
								<?php	

if(($updateclosedinvoiceaction==false) && ($myinvoice=="closed")){
  	?>

	<?php
 
}else{
	?>
		<a  id="more" class="btn btn-primary" href="<?php echo base_url();?>user/printsuppliercreditnotediscount?invoice=<?php   if(isset($salesid)) {echo $salesid; } ?>&type=receiving">  Discount Credit Note   </a>

	<a  id="more" class="btn btn-primary" href="<?php echo base_url();?>user/printreturnedserialnos?invoice=<?php   if(isset($salesid)) {echo $salesid; } ?>&type=receiving">   Returned Serials   </a>


<?php if($deleteaction==true){
	 	?>
	
				<a  id="more"  class="btn btn-warning" href="<?php echo base_url();?>user/updatereceivedeals?randomitemidentifier=<?php   {echo  $salesid;}  ?>&status=suspended"> Suspend</a>

<?php
}
	 	?>
								
			 								<a  id="more"  class="btn btn-info" href="<?php echo base_url();?>user/updatereceivedeals?randomitemidentifier=<?php   {echo  $salesid;}  ?>&status=progress"> Work in progress</a>
																						 								<a  id="more"  class="btn btn-info" href="<?php echo base_url();?>user/confirmetimspurchase?randomitemidentifier=<?php   {echo  $salesid;}  ?>&status=closed"> Confirm Etims Purchase</a>


											 								<a  id="more"  class="btn btn-success" href="<?php echo base_url();?>user/updatereceivedeals?randomitemidentifier=<?php   {echo  $salesid;}  ?>&status=closed"> Complete/Close</a>

	
		<?php
}
	?>	
												
		<?php						
if($myinvoice=="closed"){
	?>
		<a  id="more" class="btn btn-primary" href="<?php echo base_url();?>user/printgrn?invoice=<?php   if(isset($salesid)) {echo $salesid; } ?>&type=receiving">  Print GRN   </a>

				<a  id="more" class="btn btn-primary" href="<?php echo base_url();?>user/printsuppliercreditnote?invoice=<?php   if(isset($salesid)) {echo $salesid; } ?>&type=receiving">  Print Goods Return Note   </a>
					
		<?php						
}
	?>		

								
								</th>
								<th colspan="5"><h3>Total:<?php 
								if($updatebuyingpriceaction == true){
								
								if(isset($finaltotal)) {echo formatMoney($finaltotal, true); }
								
								
								}
								?></h3>
							</th>
							
							
								
								<th>	VAT	:					
							<?php 
							if(isset($totalvatcost)) {echo formatMoney($totalvatcost, true);  }
							?>
								</th>
							
							
							
							
							
							
							</tr>
				
									</tbody>
									
									
					</table>
				</div>	
			</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">BULK SPLIT2</h4>
      </div>
      <div class="modal-body">
        <h3>Are you sure you want to Split  this item Into two? 
		
		NOTE: TOTAL QTY SHOULD BE EQUAL TO ORIGAN QTY e.g 5=(3 firt one + 2 second one);
		</h3>
      </div>
      <div class="modal-footer">
	  	

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

		
                 echo form_open('user/splitpurchasebulk' , 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="type" value="product"id="mytype" class="form-control" required placeholder="Enter type">
	<input type="text" readonly name="ttqty" value=""id="ttqty" class="form-control" required placeholder="Enter type">


<input type="hidden" name="view" value="user/searchinvoice?code=<?php echo $salesid ;?>" id="view" class="form-control" required placeholder="Enter view">
 <input type="hidden" id="invoiceid"  name="invoice" class="itemid" placeholder="invoice" value=""><br>
<div class="form-group">
    <label for="inputfirstone" class="col-sm-2 control-label">	 First QTY</label>
    <div class="col-sm-10">
		
				<input type="text" name="firstone"   onblur="getfirstone()"  id="firstone" value="<?php echo set_value('firstone') ;?>"  class="form-control" required placeholder="Enter  First qty e.g 3 out of 5">

		<span class="text-danger"> <?php echo form_error('firstone'); ?>
		
		</span>
	</div>
  </div>
  <div class="form-group">
    <label for="inputsecondone" class="col-sm-2 control-label">	 Second QTY</label>
    <div class="col-sm-10">
		
				<input type="text" name="secondone"  onblur="getsecondone()"  id="secondone" value="<?php echo set_value('secondone') ;?>"  class="form-control" required placeholder="Enter  Second qty e.g 2 out of 5">

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

  </div>
 <input type="hidden" id="splitid"  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"> Yes  </button>

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

  </div>

  </div>
			
			
			
			
			
			
	
	
	
	
			<div id="myDeleteserial" 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">SERIALS</h4>
      </div>
      <div class="modal-body">
        <h3>Are you sure you want generate serials in Ascending order? 
		
		</h3>
      </div>
      <div class="modal-footer">
	  	

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

		
                 echo form_open('user/generateviewserials' , 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="view" value="user/searchinvoice?code=<?php echo $salesid ;?>" id="view" class="form-control" required placeholder="Enter view">
 <input type="hidden" id="myinvoiceserial"  name="invoice" class="itemid" placeholder="invoice" value=""><br>
 
  <input type="hidden" id="serialid"  name="myid" class="myid" placeholder="myid" value=""><br>


 <input type="hidden" id="mycode"  name="mycode" class="mycode" placeholder="mycode" value=""><br>

<div class="form-group">
    <label for="inputqty" class="col-sm-2 control-label">	 Enter QTY</label>
    <div class="col-sm-10">
		
				<input type="text" name="myqty"   id="serialqty" value="<?php echo set_value('qty') ;?>"  class="form-control" required placeholder="Enter   qty e.g 10">

		<span class="text-danger"> <?php echo form_error('qty'); ?>
		
		</span>
	</div>
  </div>
  <div class="form-group">
    <label for="inputstartnumber" class="col-sm-2 control-label">	 Enter the First Number</label>
    <div class="col-sm-10">
		
				<input type="number" name="startnumber"  id="startnumber" value="<?php echo set_value('startnumber') ;?>"  class="form-control" required placeholder="Enter  the fisrt serial Number">

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

  </div>
 <input type="hidden" id="splitid"  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_GenerateSerial" value="generate" class="btn btn-danger"> Generate Now  </button>

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

  </div>

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

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



				echo $this->session->flashdata('msg'); 
		
                 echo form_open('user/uploadserialnumbers' , 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/viewreceivedproducts?randomitemidentifier=<?php  echo $salesid; ?>"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"  placeholder="Enter Surname"  >

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


	 <div class="form-group" style="display:none">
    <label for="inputfromdate" class="col-sm-2 control-label">qty </label>
    <div class="col-sm-10">
	
		  		<input type="text" name="qty" id="ourqty" value="" class="form-control"  placeholder="Enter qty">
		 
				
		
		</span>
	</div>
  </div>
  
  
  <div class="form-group" style="display:none">
    <label for="inputid" class="col-sm-2 control-label">MY id</label>
    <div class="col-sm-10">
		  		<input type="text" name="id"  value="" id="ourid" class="form-control"  placeholder="Enter qty">

			
		
		</span>
	</div>
  </div><div class="form-group" style="display:none">
    <label for="inputsalesid" class="col-sm-2 control-label">salesid</label>
    <div class="col-sm-10">
		  		<input type="text" name="salesid" value="" id="oursalesid" class="form-control"  placeholder="Enter salesid">

			
		
		</span>
	</div>
  </div>
  
  
  
	 <div class="form-group" style="display:none">
    <label for="inputcode" class="col-sm-2 control-label">code </label>
    <div class="col-sm-10">
	
		  		<input type="text" name="code" value=""   id="ourcode" class="form-control"  placeholder="Enter code">
		 
				
		
		</span>
	</div>
  </div>
  
  
  
  
	 <div class="form-group">

    <div class="col-sm-offset-2 col-sm-10">
     
	         <button type="submit"  value="serial" name="btn_uploadserials" class="btn btn-default">Upload Serial Numbers  </button>

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

    

				</div>

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

    <!-- Modal content-->
    <div class="modal-content">
      <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal">&times;</button>
        <h4 class="modal-title">Update Product</h4>
      </div>
      <div class="modal-body">
      
	  	

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


				echo $this->session->flashdata('msg'); 
		
                 echo form_open('user/updatesaleproduct' , 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="myview" value="user/viewsales" class="form-control" required placeholder="Enter view">

<input type="hidden" name="productid" value=""id="productid" class="form-control" required placeholder="Enter productid">
		<!--<input type="hidden" name="page" value="<?php echo $page ?>"id="page" class="form-control" required placeholder="Enter bookid">
-->
	<div class="form-group">
    <label for="inputcode" class="col-sm-2 control-label">	 Code</label>
    <div class="col-sm-10">
	
		  		<input type="text" name="code" 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">
    <label for="inputcategory" class="col-sm-2 control-label">Category?</label>
    <div class="col-sm-10">
	<select class="form-control" name="category" id="category"required>
	
	<option value="" selected></option>
		<option value=""  >---Select Category---</option>

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


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


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

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

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

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

				<input type="text" id="promoprice" name="promoprice" value="<?php echo set_value('promoprice'); ?>"  class="form-control"  placeholder="Enter Promotion  price">
			
		<span class="text-danger"> <?php echo form_error('promoprice'); ?>
		
		</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" id="qty1" value="<?php echo set_value('qty'); ?>"  class="form-control" required  placeholder="Enter quantity in stock">
			
		<span class="text-danger"> <?php echo form_error('qty'); ?>
		
		</span>
	</div>
  </div>
  	
	
		
	<div class="form-group">
    <label for="inputdescription" class="col-sm-2 control-label">	Description</label>
    <div class="col-sm-10">

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

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

				<input type="text" 
				name="orderamount" value="<?php echo set_value('orderamount'); ?>"  id="orderamount" class="form-control"  placeholder="Enter  quantity to Reorder">
			
		<span class="text-danger"> <?php echo form_error('orderamount'); ?>
		
		</span>
	</div>
  </div>
	

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

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

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

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

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

    

				</div>

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

<div id="addlandingModal" 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">Calculate Landing Cost</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/addbranch' , array('id' => 'sales', '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="inputtotalitems" class="col-sm-4 control-label">	TT Items Purchased</label>
    <div class="col-sm-8">
	
		  		<input type="text" onblur="getLandingCost()" id="totalitems"name="totalitems"  value="<?php echo set_value('totalitems',1); ?>" class="form-control" required placeholder="Enter total items purchased">

				
		<span class="text-danger"> <?php echo form_error('totalitems'); ?>
		
		</span>
	</div>
  </div>
	  		
	<div class="form-group">
    <label for="inputbuyingpricefob" class="col-sm-4 control-label">	Buying price (F.O.B) </label>
    <div class="col-sm-8">
	
		  		<input type="text" onblur="getLandingCost()" id="buyingpricefob"name="buyingpricefob"  value="<?php echo set_value('buyingpricefob',0); ?>" class="form-control" required placeholder="Enter Buying price (F.O.B)">

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

  
  
	<div class="form-group">
    <label for="inputfreight" class="col-sm-4 control-label">	Freight & Insurance	</label>
    <div class="col-sm-8">
	
		  		<input type="text" onblur="getLandingCost()" id="freight" name="freight" value="<?php echo set_value('freight',0); ?>" class="form-control" required placeholder="Enter Freight & Insurance">
		 
				
		<span class="text-danger"> <?php echo form_error('freight'); ?>
		
		</span>
	</div>
  </div>


		<div class="form-group">
    <label for="inputcustomvalue" class="col-sm-4 control-label">	Custom value	</label>
    <div class="col-sm-8">
	
		  		<input type="text" readonly onblur="getLandingCost()"  style="width:50%; background:gray"  id="customvalue" name="customvalue" value="<?php echo set_value('customvalue',0); ?>" class="form-control2" required placeholder="Enter Custom value">
		 		 		 <input type="text" onblur="getLandingCost()" style="width:30%"  id="rate" name="rate"  value="<?php echo set_value('rate',10); ?>" class="form-control1" required placeholder="Enter  custom rate of 10% or 25% ">%

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

	<div class="form-group">
    <label for="inputvatvalue" class="col-sm-4 control-label">	Vat Values	</label>
    <div class="col-sm-8">
	
		  		<input type="text" onblur="getLandingCost()" readonly id="vatvalue" name="vatvalue" value="<?php echo set_value('vatvalue',0); ?>" class="form-control" required placeholder="Enter Vat Value">
		 
				
		<span class="text-danger"> <?php echo form_error('vatvalue'); ?>
		
		</span>
	</div>
  </div>
	<div class="form-group">
    <label for="inputclearancecharges" class="col-sm-4 control-label">	Clearance charges	</label>
    <div class="col-sm-8">
	
		  		<input type="text" onblur="getLandingCost()" id="clearancecharges" name="clearancecharges" value="<?php echo set_value('freight',0); ?>" class="form-control" required placeholder="Enter Clearance charges">
		 
				
		<span class="text-danger"> <?php echo form_error('clearancecharges'); ?>
		
		</span>
	</div>
  </div>

	<div class="form-group">
    <label for="inputothercharge" class="col-sm-4 control-label">Other charge	</label>
    <div class="col-sm-8">
	
		  		<input type="text" onblur="getLandingCost()" id="othercharge"name="othercharge" value="<?php echo set_value('othercharge',0); ?>" class="form-control" required placeholder="Enter Other charge">
		 
				
		<span class="text-danger"> <?php echo form_error('othercharge'); ?>
		
		</span>
	</div>
  </div>


<div class="form-group">
    <label for="inputvatrates" class="col-sm-4 control-label">Vat Rate</label>
    <div class="col-sm-8">
	
		  		<input type="text" id="vatrates" name="vatrates" value="<?php echo set_value('vatrates',16); ?>" class="form-control" required placeholder="Enter vat rate">
		 
				
		<span class="text-danger"> <?php echo form_error('vatrates'); ?>
		
		</span>
	</div>
  </div>






<div class="form-group">
    <label for="inputlandingcost" class="col-sm-4 control-label">Landing Cost</label>
    <div class="col-sm-8">
	
		  		<input type="text" onblur="getLandingCost()" id="landingcost" name="landingcost" value="<?php echo set_value('landingcost'); ?>" class="form-control" required placeholder="Enter landing cost">
		 
				
		<span class="text-danger"> <?php echo form_error('landingcost'); ?>
		
		</span>
	</div>
  </div>


	

	
	 <div class="form-group">

    <div class="col-sm-offset-2 col-sm-10">
     <!--
	         <button type="submit"  value="finallandingcost" name="btn_addlandingcost" class="btn btn-primary"> Post Landing Cost    </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=(double)$lastrecord[0]["code"]+1;
			}else{
				
				 $mylastrecord=(double)$mylastrecord+1;
			}
				
				
				
			
				
				
				
//$session_data = $this->session->userdata('logged_in');
$imgid = rand(100, 990000).time();


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

				 }
					
   
 	
				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/viewreceivedproducts?randomitemidentifier=<?php echo $salesid ;?>" 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">
    <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">
    <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" >
	
		<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">
    <label for="inputproducttype" class="col-sm-2 control-label">Inventory Type?</label>
    <div class="col-sm-10">
	<select class="form-control" name="producttype" required>
	
		<option value=""  >---Select Product Type---</option>
		<option value="Inventory" selected="selected"  >Inventory</option>
		<option value="None Inventory"  >None Inventory </option>
		<option value="Service"  >Service</option>


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

	</div>
  </div>
  	
  

  
  
  
  

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

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



if(is_array($mycategory)) {

   foreach($mycategory as $mycategoryrow){

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



	<?php

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

	</div>
  </div>
  	


  

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

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

	
if(is_array($allsuppliers)) {

   foreach($allsuppliers as $suppliersrow){

   //echo $courserow->coursename;
    ?>
					<option value="<?=  $suppliersrow->id;   ?>"><?=  $suppliersrow->company ."(". $suppliersrow->firstname ."- ".$suppliersrow->phone.")"; ?></option>



	<?php

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

	</div>
  </div>
  
  
  
  
  
  
  
  
  
  
	<div class="form-group" style="margin-bottom:0px; ">
    <label for="inputbuyingprice" class="col-sm-2 control-label">Unit (B.)Price</label>
    <div class="col-sm-10">

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

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

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

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

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

				<input type="text" readonly name="qty" value="0"  class="form-control" required  placeholder="Enter quantity in stock">
			
		<span class="text-danger"> You cant edit qty <?php echo form_error('qty'); ?>
		
		</span>
	</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">
    <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">
    <label for="inputdescription" class="col-sm-2 control-label">	Description</label>
    <div class="col-sm-10">

				<textarea name="description" value="<?php echo set_value('description'); ?>"  class="form-control"  placeholder="Enter description"></textarea>
			
		<span class="text-danger"> <?php echo form_error('description'); ?>
		
		</span>
	</div>
  </div>
	
	
	
	
	<div class="form-group" style="margin:0px">
    <label for="inputreorderevel" class="col-sm-2 control-label">	Reorder Level</label>
    <div class="col-sm-10">

				<input type="text" required name="reorderevel" value="0"  class="form-control"  placeholder="Enter Reorder Level e.g 10">
			
		<span class="text-danger"> <?php echo form_error('reorderevel'); ?>
		
		</span>
	</div>
  </div>
	
	
	
	<div class="form-group" style="margin:0px">
    <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="inputstore" class="col-sm-2 control-label">	Rack /Store Name</label>
    <div class="col-sm-10">

				<input type="text" name="store" value="<?php echo set_value('store'); ?>"  class="form-control"   placeholder="Enter store / rack name">
			
		<span class="text-danger">Enter the name where the product is stored <?php echo form_error('store'); ?>
		
		</span>
	</div>
  </div>
  	
	
	
	<div class="form-group">
    <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="myModal" 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 transaction ? </h3>
      </div>
      <div class="modal-footer">
	  	

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

		
                 echo form_open('user/deletesoldeproducts' , 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="text" id="transactionid"name="transactionid" class="transactionid" placeholder="transactionid" value=""><br>
				<input type="hidden" name="mysalesid" value="<?php echo set_value('mysalesid',$salesid); ?>" id="mysalesid" class="form-control" required placeholder="Enter salesid">
 <input type="text" id="myid"name="myid" class="myid" placeholder="myid" value=""><br>

 <button type="button" class="btn btn-success" data-dismiss="modal">Don't Delete</button>
 		  	         <button type="submit" name="btn_delete" value="delete" class="btn btn-danger"> Delete  </button>

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

  </div>

  </div>







  </div>

















