<link href="<?php echo base_url(); ?>assets/autocomplete/jquery-ui.css" rel="stylesheet">
    <link href="<?php echo base_url(); ?>assets/autocomplete/ui.theme.css" rel="stylesheet">
    <link href="<?php echo base_url(); ?>assets/autocomplete/autocomplete.css" rel="stylesheet">
	
 <link href="<?php echo base_url(); ?>assets/select/chosen.min.css" rel="stylesheet" media="screen">
	
		   
		   		   <script src="<?php echo base_url(); ?>assets/select/chosen.jquery.min.js"></script>

				   

 
			<script>
    function buttonFunction(b) {
        var field = document.getElementById('qty');
        field.value += b;
    }
	
		  function buttonFunctionClear(b) {
        var field = document.getElementById('qty');
        field.value ="";
    }
</script>	   
<script>


var getQueryString = function ( field, url ) {
    var href = url ? url : window.location.href;
    var reg = new RegExp( '[?&]' + field + '=([^&#]*)', 'i' );
    var string = reg.exec(href);
    return string ? string[1] : null;
};






function selectvat()
{
  var taxindicator = document.getElementById('taxindicator').value;;

  

	 
	 if(taxindicator!=""){
		 
		  
		 
 document.forms[1].submit() ;
		
		

	 }else{
		 alert("There is aproblem reloading the page. Kindly logout then login again");
	 }
  //id.value = myproductcategory;
 
//alert(myproductcategory);

}





function select()
{
  var productid = document.getElementById('productids');
 // var MYID = getQueryString('myproductcategory');
	var myproductcategory = getQueryString('myproductcategory',productid); // "lorem"
//var mysalesid = getParameterByName('mysalesid');
	 
	 var mymessage = document.getElementById('message').value;

	 var myids = document.getElementById('id').value;
	 	 var message = document.getElementById('message').value;
				mymessage.value = message;
//alert(message);


	 
	 if(myids!=""){
		  //alert(myids);
		 	submitForm();

	 }else{
		 //alert("haiko");
	 }
  //id.value = myproductcategory;
 
//alert(myproductcategory);

}

function sync()
{
  var productid = document.getElementById('productids');
 // var MYID = getQueryString('myproductcategory');
	var myproductcategory = getQueryString('myproductcategory',productid); // "lorem"
//var mysalesid = getParameterByName('mysalesid');
	 
	 //var mymessage = document.getElementById('message').value;

	 var myids = document.getElementById('id').value;
	 	 //var message = document.getElementById('message').value;
				//mymessage.value = message;
//alert(message);


	 
	 if(myids!=""){
		  //alert(myids);
		 	submitForm();

	 }else{
		 //alert("haiko");
	 }
  //id.value = myproductcategory;
 
//alert(myproductcategory);

}

</script>

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

        });
	
            $(document).ready(function() { 
		
               $("#due").hide();
               $("#accountno").hide(); 
		  $("#station").hide();
				$("#mydescription1").hide();
			   			$("#mytable").hide();
						 $("#destination").hide();
								$("#myphone").show();
									$("#name").show();
								
						$("#ourcompany").show();
						$("#idno").show();


					});
          
		  
		  
		  
		              $(function () {
        $("#type").change(function () {
            if ($(this).val() == "Cash") {
             $("#due").hide();
		   $("#accountno").hide();
              						$("#idno").hide();

$("#name").hide();

								$("#myphone").hide();
							  $("#station").hide();
								 $("#destination").hide();
								 	$("#ourcompany").hide();
            } else if ($(this).val() == "Mpesa") {
              $("#accountno").show();
				$("#name").hide();
               $("#due").hide();
              $("#name").hide();

								$("#myphone").hide();
							  $("#station").hide();
								 $("#destination").hide();
								 	$("#ourcompany").hide();
$("#mpesa").focus().value = "";
  	 var myfinaltotal = document.getElementById('myfinaltotal').value;

            document.getElementById("mpesa").value = myfinaltotal;
						
			document.getElementById("cash").value = 0;
			document.getElementById("credit").value = 0;
			 document.getElementById("card").value = 0;
			document.getElementById("voucher").value = 0;

			 document.getElementById("cheque").value = 0;
			document.getElementById("points").value = 0;
			document.getElementById("creditnotee").value = 0;



            }else if ($(this).val() == "Bank") {
             $("#accountno").show();
				$("#name").hide();
										$("#idno").hide();

               $("#due").hide();
			   $("#cheque").focus().value = "";

			     	 var myfinaltotal = document.getElementById('myfinaltotal').value;

                 document.getElementById("cheque").value = myfinaltotal;
						
			document.getElementById("cash").value = 0;
			document.getElementById("credit").value = 0;
			 document.getElementById("card").value = 0;
			document.getElementById("voucher").value = 0;

			 document.getElementById("mpesa").value = 0;
			document.getElementById("points").value = 0;
			document.getElementById("creditnotee").value = 0;


            }else if ($(this).val() == "Voucher") {
            $("#accountno").show();
				$("#name").hide();
               $("#due").hide();
			   $("#name").hide();
						$("#idno").hide();

								$("#myphone").hide();
							  $("#station").hide();
								 $("#destination").hide();
								 	$("#ourcompany").hide();
                     $("#voucher").focus().value = "";
  	 var myfinaltotal = document.getElementById('myfinaltotal').value;

            document.getElementById("voucher").value = myfinaltotal;
						
			document.getElementById("cash").value = 0;
			document.getElementById("credit").value = 0;
			 document.getElementById("mpesa").value = 0;
			document.getElementById("card").value = 0;

			 document.getElementById("cheque").value = 0;
			document.getElementById("points").value = 0;
			document.getElementById("creditnotee").value = 0;

            }else if ($(this).val() == "Creditnote") {
             $("#accountno").show();
				$("#name").hide();
               $("#due").hide();
			   $("#name").hide();
						$("#idno").hide();

								$("#myphone").hide();
							  $("#station").hide();
								 $("#destination").hide();
								 	$("#ourcompany").hide();
               $("#creditnotee").focus().value = "";
  	 var myfinaltotal = document.getElementById('myfinaltotal').value;

            document.getElementById("creditnotee").value = myfinaltotal;
						
			document.getElementById("cash").value = 0;
			document.getElementById("credit").value = 0;
			 document.getElementById("mpesa").value = 0;
			document.getElementById("card").value = 0;

			 document.getElementById("cheque").value = 0;
			document.getElementById("points").value = 0;
			document.getElementById("voucher").value = 0;

            }else if ($(this).val() == "Points") {
           $("#accountno").show();
				$("#name").hide();
               $("#due").hide();
						$("#idno").hide();

								$("#myphone").hide();
							  $("#station").hide();
								 $("#destination").hide();
								 	$("#ourcompany").hide();
              
         $("#points").focus().value = "";
  	 var myfinaltotal = document.getElementById('myfinaltotal').value;

            document.getElementById("points").value = myfinaltotal;
						
			document.getElementById("cash").value = 0;
			document.getElementById("credit").value = 0;
			 document.getElementById("mpesa").value = 0;
			document.getElementById("card").value = 0;

			 document.getElementById("cheque").value = 0;
			document.getElementById("creditnotee").value = 0;
			document.getElementById("voucher").value = 0;
            }else if ($(this).val() == "Card") {
           $("#accountno").show();
				$("#name").hide();
               $("#due").hide();
			   	$("#myphone").hide();
										$("#idno").hide();

							  $("#station").hide();
								 $("#destination").hide();
								 	$("#ourcompany").hide();
              $("#card").focus().value = "";
  	 var myfinaltotal = document.getElementById('myfinaltotal').value;

            document.getElementById("card").value = myfinaltotal;
						
			document.getElementById("cash").value = 0;
			document.getElementById("credit").value = 0;
			 document.getElementById("mpesa").value = 0;
			document.getElementById("voucher").value = 0;

			 document.getElementById("cheque").value = 0;
			document.getElementById("points").value = 0;
			document.getElementById("creditnotee").value = 0;

            }else  if ($(this).val() == "Delivery") {
           						$("#idno").hide();

				             $("#accountno").show();
							  $("#name").show();
								$("#myphone").show();
							  $("#station").show();
								 $("#destination").show();
							  	$("#ourcompany").show();
								$("#credit").focus().value = "";
								
  	 var myfinaltotal = document.getElementById('myfinaltotal').value;

            document.getElementById("credit").value = myfinaltotal;
						
						  document.getElementById("cash").value = 0;
			document.getElementById("mpesa").value = 0;
			 document.getElementById("card").value = 0;
			document.getElementById("voucher").value = 0;

			 document.getElementById("cheque").value = 0;
			document.getElementById("points").value = 0;
			document.getElementById("creditnotee").value = 0;

							 
				$("#due").show();
            }else  if ($(this).val() == "Credit") {
           						$("#idno").hide();

				             $("#accountno").hide();
							 	$("#myphone").hide();
							  $("#station").hide();
								 $("#destination").hide();
				$("#ourcompany").hide();

				$("#credit").focus().value = "";
  	 var myfinaltotal = document.getElementById('myfinaltotal').value;

            document.getElementById("credit").value = myfinaltotal;
						
						  document.getElementById("cash").value = 0;
			document.getElementById("mpesa").value = 0;
			 document.getElementById("card").value = 0;
			document.getElementById("voucher").value = 0;

			 document.getElementById("cheque").value = 0;
			document.getElementById("points").value = 0;
			document.getElementById("creditnotee").value = 0;

							 
				$("#due").show();
            }else  if ($(this).val() == "Invoice") {
              $("#accountno").hide();
			 $("#name").show(); 
				           						$("#idno").hide();
     
				$("#due").show();
					$("#myphone").hide();
							  $("#station").hide();
								 $("#destination").hide();
								 				$("#ourcompany").hide();

					$("#credit").focus().value = "";
  	 var myfinaltotal = document.getElementById('myfinaltotal').value;

            document.getElementById("credit").value = myfinaltotal;
						
						  document.getElementById("cash").value = 0;
			document.getElementById("mpesa").value = 0;
			 document.getElementById("card").value = 0;
			document.getElementById("voucher").value = 0;

			 document.getElementById("cheque").value = 0;
			document.getElementById("points").value = 0;
			document.getElementById("creditnotee").value = 0;
            
			
			   }else  if ($(this).val() == "Savedata") {
           						$("#idno").show();

				             $("#accountno").show();
							  $("#name").show();
								$("#myphone").show();
							  $("#station").show();
								 $("#destination").show();
							  	$("#ourcompany").show();
								$("#cash").focus().value = "";
	

							 
				$("#due").show();
            }
			else {
					$("#myphone").show();
								
						$("#ourcompany").show();
						$("#idno").show();

               $("#accountno").show();
				$("#name").hide();
               $("#due").hide();
            }
        });
    });
	    
	   
		              $(function () {
        $("#customer").change(function () {
            if ($(this).val() == "directly") {
            
			$("#name").show();
		 		$("#myphone").show();

              

            } else if ($(this).val() == "cheifmessage") {
            
			$("#mydescription").show();
		 
              

            }else if ($(this).val() == "mytable") {
            
			$("#mytable").show();
		 
              

            }else if ($(this).val() == "selectcheifmessage") {
            
			$("#mydescription1").show();
		 
              

            }else if ($(this).val() == "deliverymessage1") {
            
			$("#mydescription").show();
		 
              

            }

			else {
                // $("#name").hide();
			//$("#mydescription").hide();
			$("#mytable").hide();

            
			
            }
        });
    });
	
	
        </script>
 




<script type="text/javascript" language="Javascript">
function submitForm(){
    document.saveform.submit();
    document.saveform.method='post';
}
function submitEditForm(){
			    //return      window.location.href = "../user/mysales";

    document.editform.submit();
    document.editform.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();
	   $("#cash").focus().value = "";
	  document.getElementById("cash").value = "";
    }
	 if( key === 'F4' ){        
      $("#mpesa").focus();
    }
	 if( key === 'F5' ){        
      $("#card").focus();
    }
	 if( key === 'F6' ){        
      $("#credit").focus();
    }
	 if( key === 'F7' ){        
      $("#voucher").focus();
    }
	 if( key === 'F8' ){        
      $("#cheque").focus();
    }
	 if( key === 'F9' ){        
      $("#points").focus();
    }
	if( key === 'F10' ){        
      	  	  document.getElementById("phone").value = "";
$("#phone").focus();

	  	  document.getElementById("phone").value = "254";

    }
		 if( key === 'right' ){        
      $("#btn_dontprint").focus();
    }
		 if( key === 'left' ){        
      $("#btn_savesales").focus();
    }
	
	if( key === 'alt' ){        
      $("#cardnumber").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){
		
	var	total = document.sales.total.value;
	var	discount = document.sales.maindiscount.value;
        finaltotal = total-discount;
		
		document.sales.discountedtotal.value = finaltotal;
    }
</script>

 

  <script type="text/javascript" language="Javascript">
		var sum=0;

	var price = document.sales.discountedtotal.value;
	document.sales.change.value = price;
    function OnChange(value){
				var mpesa = document.sales.mpesa.value;
				var creditnotee = document.sales.creditnotee.value;
				var saving = document.sales.saving.value;

				var credit = document.sales.credit.value;
				var voucher = document.sales.voucher.value;
				var cheque = document.sales.cheque.value;
				var points = document.sales.points.value;
				var card = document.sales.card.value;
				//var total=mpesa+credit+voucher+cheque+points+card;

		var payable = document.sales.discountedtotal.value - mpesa-credit-voucher-cheque-points-card-creditnotee;
		var cash = document.sales.cash.value;
        sum = cash - payable-saving;
		
		document.sales.change.value = sum;
    }
	
</script>
 
<script type="text/javascript">
  
	
			
	   $(document).on("click", "#editbtn", function()
        {
          var productid = $(this).data('id');
		  $("#productid1").val(productid); 
		     var expdate = $(this).data('expdate');
		   $("#expdate1").val(expdate); 
		    var name = $(this).data('name');
		   $("#name1").val(name); 
		   
		   
		     var shortname = $(this).data('shortname');
		   $("#shortname1").val(shortname); 
		   
		     var description = $(this).data('description');
		   $("#description1").val(description); 
		 
		     var qty = $(this).data('qty');
		   $("#qty1").val(qty);


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

		     var reorderevel = $(this).data('reorderevel');
		   $("#reorderevel1").val(reorderevel); 	
 var category = $(this).data('category');
		   $("#category1").val(category); 		
	
		   
			 var 	supplier = $(this).data('supplier');
					   $("#supplier1").val(supplier); 		
			 var buyingprice = $(this).data('buyingprice');
					   $("#buyingprice1").val(buyingprice); 		
			 var sellingprice = $(this).data('sellingprice');
					   $("#sellingprice1").val(sellingprice); 		
			 var promoprice = $(this).data('promoprice');
					   $("#promoprice1").val(promoprice); 	

			 var wholesaleprice = $(this).data('wholesaleprice');
					   $("#wholesaleprice1").val(wholesaleprice);
		   
		   
		    var store = $(this).data('store');
		   $("#store1").val(store);
		    var tax_included = $(this).data('tax_included');
		   $("#tax_included1").val(tax_included);
		   
		      var orderamount = $(this).data('orderamount');
		   $("#orderamount1").val(orderamount);
		   
	  	
		      var mybranch = $(this).data('branch');
		   $("#branch1").val(mybranch);
		         var status = $(this).data('status');
		   $("#status1").val(status);
		   
      var producttype = $(this).data('producttype');
		   $("#producttype1").val(producttype);
		   
		   
        });
		
		
    </script>
<style>
#big{
font-style: bold;font-size: 0.9em;
	padding:0px;
	font-type:bold;
	
	
}
#cash{
	font-style: normal;font-size: 2em;
	
	padding:1px;
	
}
#mpesa{
	font-style: normal;font-size: 2em;
	
	padding:1px;
	
}
#credit{
	font-style: normal;font-size: 2em;
	
	padding:1px;
	
}
#voucher{
	font-style: normal;font-size: 2em;
	
	padding:1px;
	
}
#cheque{
	font-style: normal;font-size: 2em;
	
	padding:1px;
	
}
#accountno{
	font-style: normal;font-size: 1em;
	
	padding:1px;
	
}
#card{
	font-style: normal;font-size: 2em;
	
	padding:1px;
	
}
#mytotal{
	font-style: normal;font-size: 1.5em;
	
	padding:0px;
	
}

#points{
	font-style: normal;font-size: 2em;
	
	padding:1px;
	
}
#creditnotee{
	font-style: normal;font-size: 2em;
	
	padding:1px;
	
}
#change{
	font-style: normal;font-size: 2em;
	
	padding:1px;
	
}
#discountedtotal{
	font-style: normal;font-size: 2em;
	
	padding:1px;
	
}

#maindiscount{
	font-style: normal;font-size: 2em;
	
	padding:1px;
	
	
}


#scroll{

height: auto; overflow-y: auto;
}

#scrollmain {
overflow: auto;
overflow-y: scroll;
max-height: 100vh;
}



</style>



 
            
        <script type="text/javascript">  
        $(this).ready( function() {  
            $("#id").autocomplete({  
 
                minLength: 1,  
                source:   
                function(req, add){  
                    $.ajax({  
                        url: "<?php echo base_url(); ?>Systemusers/branchlookup",  
                        dataType: 'json',  
                        type: 'POST',  
                        data: req,  
                        success:      
                        function(data){  
                            if(data.response =="true"){  
                                add(data.message);  
                                console.log(data);
                            }  
                        },  
                    });  
                },  
                     
            });  
        });  
		
		
		
 $(this).ready( function() {  
            $("#phone").autocomplete({  
 
                minLength: 1,  
                source:   
                function(req, add){  
                    $.ajax({  
                        url: "<?php echo base_url(); ?>Systemusers/branchlookupmpesa",  
                        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 productcategory = $(this).data('productcategory');
		  $("#productcategory").val(productcategory); 
   var salesids = $(this).data('salesid');
		  $("#salesids").val(salesids); 
		    var myproductid = $(this).data('myproductid');
		  $("#myproductid").val(myproductid);  
		   
        });
		
        </script>  
		 <script>
	function wcqib_refresh_quantity_increments() {
    jQuery("div.quantity:not(.buttons_added), td.quantity:not(.buttons_added)").each(function(a, b) {
        var c = jQuery(b);
        c.addClass("buttons_added"), c.children().first().before('<input type="button" value="-" class="minus" />'), c.children().last().after('<input type="button" value="+" class="plus" />')
    })
}
String.prototype.getDecimals || (String.prototype.getDecimals = function() {
    var a = this,
        b = ("" + a).match(/(?:\.(\d+))?(?:[eE]([+-]?\d+))?$/);
    return b ? Math.max(0, (b[1] ? b[1].length : 0) - (b[2] ? +b[2] : 0)) : 0
}), jQuery(document).ready(function() {
    wcqib_refresh_quantity_increments()
}), jQuery(document).on("updated_wc_div", function() {
    wcqib_refresh_quantity_increments()
}), jQuery(document).on("click", ".plus, .minus", function() {
    var a = jQuery(this).closest(".quantity").find(".qty"),
        b = parseFloat(a.val()),
        c = parseFloat(a.attr("max")),
        d = parseFloat(a.attr("min")),
        e = a.attr("step");
    b && "" !== b && "NaN" !== b || (b = 0), "" !== c && "NaN" !== c || (c = ""), "" !== d && "NaN" !== d || (d = 0), "any" !== e && "" !== e && void 0 !== e && "NaN" !== parseFloat(e) || (e = 1), jQuery(this).is(".plus") ? c && b >= c ? a.val(c) : a.val((b + parseFloat(e)).toFixed(e.getDecimals())) : d && b <= d ? a.val(d) : b > 0 && a.val((b - parseFloat(e)).toFixed(e.getDecimals())), a.trigger("change")
});
	</script>
	<style>
	
	/* -- quantity box -- */

.quantity {
 display: inline-block; }

.quantity .input-text.qty {
 width: 50px;
 height: 39px;
 padding: 0 5px;
 text-align: center;
 background-color: transparent;
 border: 1px solid #efefef;
}

.quantity.buttons_added {
 text-align: left;
 position: relative;
 white-space: nowrap;
 vertical-align: top; }

.quantity.buttons_added input {
 display: inline-block;
 margin: 0;
 vertical-align: top;
 box-shadow: none;
}

.quantity.buttons_added .minus,
.quantity.buttons_added .plus {
 padding: 7px 10px 8px;
 height: 41px;
 background-color: #ffffff;
 border: 1px solid #efefef;
 cursor:pointer;}

.quantity.buttons_added .minus {
 border-right: 0; }

.quantity.buttons_added .plus {
 border-left: 0; }

.quantity.buttons_added .minus:hover,
.quantity.buttons_added .plus:hover {
 background: #eeeeee; }

.quantity input::-webkit-outer-spin-button,
.quantity input::-webkit-inner-spin-button {
 -webkit-appearance: none;
 -moz-appearance: none;
 margin: 0; }
 
 .quantity.buttons_added .minus:focus,
.quantity.buttons_added .plus:focus {
 outline: none; }


	</style>
 <div class="row">
   <?php
 
 
 
   $session_data = $this->session->userdata('logged_in');

   
 	$data['id'] = $session_data['id'];
        
		 $userid = $data['id'];
$data['companyid'] = $session_data['companyid'];
	 $companyid = $data['companyid'];
		 $data['usertype'] = $session_data['usertype'];
	 $usertype = $data['usertype'];	
     $mpesaaction=$this->usermodel->populatuserpermissionsdataarray('sales','mpesa',$userid);
	      $chequeaction=$this->usermodel->populatuserpermissionsdataarray('sales','cheque',$userid);
 $voucheraction=$this->usermodel->populatuserpermissionsdataarray('sales','voucher',$userid);
	      $creditaction=$this->usermodel->populatuserpermissionsdataarray('sales','credit',$userid);
		   $pointsaction=$this->usermodel->populatuserpermissionsdataarray('sales','points',$userid);
	      $cardaction=$this->usermodel->populatuserpermissionsdataarray('sales','card',$userid);
	      $orderaction=$this->usermodel->populatuserpermissionsdataarray('sales','order',$userid);
		  	 $cashaction=$this->usermodel->populatuserpermissionsdataarray('sales','cash',$userid);
    
				$sendsms=$this->usermodel->populatuserpermissionsdataarray('sales','sendsms',$userid);
		  	      $printdelivery=$this->usermodel->populatuserpermissionsdataarray('sales','printdelivery',$userid);

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

		  

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

		  

		  	      $creditnoteeaction=$this->usermodel->populatuserpermissionsdataarray('sales','creditnote',$userid);
			    $myreturn=$this->usermodel->populatuserpermissionsdataarray('viewreturnsales','return',$userid);

		  	      $dontprintaction=$this->usermodel->populatuserpermissionsdataarray('sales','dontprint',$userid);
			  	      $printreceipt=$this->usermodel->populatuserpermissionsdataarray('sales','printreceipt',$userid);

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

		  
		  $productdiscountaction=$this->usermodel->populatuserpermissionsdataarray('sales','productdiscount',$userid);
	      $editsellingpriceaction=$this->usermodel->populatuserpermissionsdataarray('sales','editsellingprice',$userid);
	      $changeuomonsales=$this->usermodel->populatuserpermissionsdataarray('sales','changeuomonsales',$userid);
	      $selecttable=$this->usermodel->populatuserpermissionsdataarray('sales','selecttable',$userid);

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

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

		  
		  	      $updateproduct=$this->usermodel->populatuserpermissionsdataarray('products','update',$userid);

		      $daddpeople=$this->usermodel->populatuserpermissionsdataarray('members','add',$userid);
		  		  	      $salesperson=$this->usermodel->populatuserpermissionsdataarray('sales','salesperson',$userid);

		  		  	      $selectmessage=$this->usermodel->populatuserpermissionsdataarray('sales','selectmessage',$userid);
		  		  	      $selectroom=$this->usermodel->populatuserpermissionsdataarray('sales','selectroom',$userid);
			    $cashiersales=$this->usermodel->populatuserpermissionsdataarray('cashiersales','all',$userid);
		  		  	      $updateqtysales=$this->usermodel->populatuserpermissionsdataarray('sales','updateqtysales',$userid);

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

		  		  	      $backdatesales=$this->usermodel->populatuserpermissionsdataarray('sales','backdatesales',$userid);
		  		  	      $suspendsales=$this->usermodel->populatuserpermissionsdataarray('sales','suspend',$userid);
		  		  	      $selectcurrency=$this->usermodel->populatuserpermissionsdataarray('sales','selectcurrency',$userid);
     $addproducts=$this->usermodel->populatuserpermissionsdataarray('products','add',$userid);
     $addmyproducts=$this->usermodel->populatuserpermissionsdataarray('productlist','add',$userid);
     $usekeyboard=$this->usermodel->populatuserpermissionsdataarray('sales','usekeyboard',$userid);
	$entermpesacode=$this->usermodel->populatuserpermissionsdataarray('sales','entermpesacode',$userid);


  ?>

     	<div class="col-md-12">
		
			<?php
if($usekeyboard==true){
			 ?>
		 <div class="col-md-12" style="margin:0px">
								
								 <table  width="100%" >
                                        <tr>
										<td>
										          
                                                    <button type="button" style="width: 40px;height: 40px;" class="btn-info" value="1" id="myBtn1"  onclick="buttonFunction(1)">1</button>
                                                
                                                
                                                    <button type="button" style="width: 40px;height: 40px;" class="btn-info" value="2" id="myBtn1"  onclick="buttonFunction(2)">2</button>
                                                
                                                
                                                    <button type="button" style="width: 40px;height: 40px;" class="btn-info" value="3" id="myBtn1"  onclick="buttonFunction(3)">3</button>
                                                
                                            
                                        
                                        
                                            
                                                
                                                    <button type="button" style="width: 40px;height: 40px;" class="btn-info" value="4" id="myBtn1"  onclick="buttonFunction(4)">4</button>
                                                
                                                
                                                    <button type="button" style="width: 40px;height: 40px;" class="btn-info" value="5" id="myBtn1"  onclick="buttonFunction(5)">5</button>
                                                
                                                
                                                    <button type="button" style="width: 40px;height: 40px;" class="btn-info" value="6" id="myBtn1"  onclick="buttonFunction(6)">6</button>
                                                
                                            
                                        
                                        
                                            
                                                
                                                    <button type="button" style="width: 40px;height: 40px;" class="btn-info" value="7" id="myBtn1"  onclick="buttonFunction(7)">7</button>
                                                
                                                
                                                    <button type="button" style="width: 40px;height: 40px;" class="btn-info" value="8" id="myBtn1"  onclick="buttonFunction(8)">8</button>
                                                
                                                
                                                    <button type="button" style="width: 40px;height: 40px;" class="btn-info" value="9" id="myBtn1"  onclick="buttonFunction(9)">9</button>
                                                
                                            
                                        
                                        
                                            
                                                
                                                    <button type="button" style="width: 40px;height: 40px;" class="btn-info" value="0" id="myBtn1"  onclick="buttonFunction(0)">0</button>
                                                
                                                
                                                                                                       <button type="button" style="width: 40px;height: 40px;" class="btn-info" value="9" id="myBtn1"  onclick="buttonFunction('.')">.</button>

                                        
                                        
                                            
                                                
											 <button type="reset"  style="width: 40px;height: 40px;" onclick="buttonFunctionClear(0)"class="btn-danger">Clear</button></td>

                                                
                                               


												
                                                
										</td>
										<tr>
								</table>
								</div>
		<?php
		}
			 ?>
		
	<span> 
	<b style="color:red; ">Whole Sales : </b>

	<?php
if($cashiersales==true){
			 ?>
<a id="non-printable"  href="<?php echo base_url(); ?>user/mysales" >  <span class="btn btn-default" style="padding:5px;  margin:2px;"> Cashier Sales</span>
</a>
<?php
 }							
?>

<a id="non-printable"  href="<?php echo base_url(); ?>user/mypendingsales" >  <span class="btn btn-default" style="padding:5px; margin:1px;"> Pending</span>
	</a>
															
															
															
															
</span>


  <?php
  
  if(($view=="Restaurant") || ($view=="CompleteTouch")){
  ?>
    <div  id="scrollmain" class="col-md-4" >



  <?php	
}else{
 ?>
 
   <div  id="scrollmain" class="col-md-4"  style="display:none">

 
  <?php		
}
  ?>
  


  	<ul id="permission_list" class="list-unstyled">

 
	<?php
$finalproductname="";
$mymainid="";
	
 if(!is_array($viewmaincategory)) 

 {
     
	 
  
    }else {
?>
    
             <?php 
  	foreach ($viewmaincategory as $c): 
             ?>
	  <div class="pull-left radius-5px" style="width:auto; padding: 1px; border: 1px solid #ddd;">


	   <li>

            
                
            <?php 
$myid=$c->id;
$mymainid=$c->id;


?>

     
   
                                <a  style="padding:10px" id="more" class="btn btn-warning" href="<?php echo base_url();?>user/viewsubcategory?maincategory=<?php   {echo  $mymainid;}  ?>&salesid=<?php   {echo  $salesid;}  ?>&type=wholesale"><?php echo $c->name ; ?></a>


		</li>
		 </div>
		<?php endforeach;} ?>
				                              <a  style="padding:10px" id="more" class="btn btn-primary" href="<?php echo base_url();?>user/viewsubcategory?maincategory=<?php  if(isset($maincategory)) {echo $maincategory; } ?>&salesid=<?php   {echo  $salesid;}  ?>&type=wholesale">back</a>

		
	<br/><div style="clear:both;"/>
			<?php

	
 if(!is_array($viewsubcategory)) 

 {
  
    }else {
?>
    
             <?php 
  
  	foreach ($viewsubcategory as $sub): 
             ?>

 <div class="pull-left radius-5px" style="width:auto;padding: 1px; border: 1px solid #ddd;">


	   <li>          
            <?php 
$myidsub=$sub->id;


?>
   <a   style="padding:10px"  id="more" class="btn btn-success" href="<?php echo base_url();?>user/viewprodubyctcategory?productcategory=<?php   {echo  $myidsub;}  ?>&salesid=<?php   {echo  $salesid;}  ?>&type=wholesale&maincategory=<?php   if(isset($maincategory)) {echo $maincategory; } ?>"><?php echo $sub->name ; ?></a>


		 </li>  
		 </div>
		<?php endforeach;} ?>
	
<br/><div style="clear:both;"/>
		
		<?php

	
 if(!is_array($viewproductcategory)) 

 {
  
    }else {
?>
    
             <?php 
  
  	foreach ($viewproductcategory as $cat): 
             ?>




            
                
            <?php 
			$myimgid=$cat->imgid;

$mycode=$cat->code;
$shortname=$cat->shortname;
$productcategory=$cat->category;
$productname=$cat->name;
	  if ($shortname!=""){
	$finalproductname=$shortname;
    
	  }else{
		 	$finalproductname=$productname;
 
	  }


//echo('<form><input type="text" name="guess"></form>');
$url="";
if($myimgid !=""){
$usr_result= $this->usermodel->populatepostimages($myimgid);
	if($usr_result==FALSE){
		$url="";
	}else{
		
		
$img=$usr_result[0]->name;
$img1='photoimghod/';
$url = base_url().$img1.$img;
	}
}
				







?>

 <div >
<a  class="pull-left radius-5" style="margin:0px;width:80px;height:80px;background-color:#337ab7;;text-decoration: none;padding: 6px 12px; display: inline-block; border: 1px solid #ddd;"   id="productids"    href="#" onclick="window.location = ' <?php echo base_url();?>user/viewwholesales?productcategory=<?php   {echo  $productcategory;}  ?>&myproductcategory=<?php   {echo  $mycode;}  ?>&type=wholesale&maincategory=<?php  if(isset($maincategory)) {echo $maincategory; }  ?>&mysalesid=<?php   {echo  $salesid;}  ?>&type=wholesale&currentqty=' + document.getElementById('qty').value + '' "><?php   if($url !=""){ ?> <img src="<?php echo $url ?>" style="height:50px" > </br> <?php  } ?>   <span style="color:white;font-weight: bold;"> <?php echo $finalproductname ; ?> </span></a>


		
		   </div>
		<?php endforeach;} ?>
	
		
		
		
			</ul>
	</div>
	  <?php
  
if(($view=="Restaurant") || ($view=="CompleteTouch")){
  ?>
   	<div class="col-md-6"id="scrollmain">

  
  <?php	
}else{
 ?>
 
   	<div class="col-md-9" id="scrollmain">

 
  <?php		
}
  ?>
  
		<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 	echo $this->session->flashdata('msg'); 

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

?>

				
            	</div>
            </div>

				<div class="widget-content nopadding table_holder table-responsive"  >		
	
		
	
					
					
				
					<div class="table-responsive" >
						<table id="register"  width="100%" frame="box"   cellspacing="0" class="table" style="padding:0px;margin:0px">
						<thead>
						
								<tr>
								 <th colspan="2">
										<?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');
										 
										 
  //$dateposted = date('Y-m-d');
            $dateposted = date('Y-m-d H:i:s');

 	$data['id'] = $session_data['id'];
        
		 $userid = $data['id'];
$data['companyid'] = $session_data['companyid'];
	 $companyid = $data['companyid'];
		 $data['usertype'] = $session_data['usertype'];
	 $usertype = $data['usertype'];	
	 $myproductcategory="";
	 	 $return="";
 if (isset($_GET['return'])){
	
    
      $return= $_GET['return'];
	  }
	  if (isset($_GET['myproductcategory'])){
	
    
      $myproductcategory= $_GET['myproductcategory'];
	  }
	  $productcategory="";
	  if (isset($_GET['productcategory'])){
	
    
      $productcategory= $_GET['productcategory'];
	  }
	 

	 
	$updateaction=$this->usermodel->populatuserpermissionsdataarray('products','update',$userid);
                 echo form_open('user/addsale' , array('class' => 'form-horizontal form-groups-bordered validate', 'name'=>'saveform','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="return" value="<?php echo set_value('return',$salesid); ?>" class="form-control" required placeholder="Enter invoice">

								<input type="hidden" name="productcategory" value="<?php echo set_value('productcategory',$productcategory); ?>" class="form-control" required placeholder="Enter invoice">
								<input type="hidden" name="invoice" value="<?php echo set_value('invoice',$salesid); ?>" class="form-control" required placeholder="Enter invoice">
												<input type="hidden" name="view" id="view" value="user/viewwholesales?productcategory=<?php if(isset($productcategory)) {echo $productcategory; }?>&salesid=<?php if(isset($salesid)) {echo $salesid; }?>&maincategory=<?php if(isset($maincategory)) {echo $maincategory; }?>" class="form-control"  placeholder="view" >
								<input type="hidden" name="maincategory" value="<?php if(isset($maincategory)) {echo $maincategory; } ?>" class="form-control"  placeholder="Enter invoice">

			  		<input type="hidden" name="type" value="<?php echo set_value('type','Cash'); ?>" class="form-control" required placeholder="Enter type">
			  		<input type="hidden" name="salestype" value="wholesale" class="form-control" required placeholder="Enter sales type">


								  		<input type="hidden" name="dateposted" value="<?php echo set_value('type',$dateposted); ?>" class="form-control" required placeholder="Enter Sales date e.g 2019-07-10 10:00:00">

			
		 	
		
								 <?php
				 if( $selectmessage==true){
					 ?>
		  		<input type="text" name="code" id="id" autofocus value="<?php echo set_value('code',$myproductcategory); ?>" class="form-control" required placeholder="Search with  barcode,code or Item name">

							<?php	
						}else{
							?>
									  		<input type="text"     name="code" id="id"  onfocus="sync()" autofocus value="<?php echo set_value('code',$myproductcategory); ?>" class="form-control" required placeholder="Search with  barcode,code or Item name">

						<?php
						}
				  ?>


		 
		 
		 
		 
		 
		 
								</th>
								<th>
							  													
	
								
  <?php
  
  if(($view=="Restaurant") || ($view=="CompleteTouch")){
  ?>

		 
		 <div class="quantity buttons_added" >

	<input type="button" value="-" class="minus"><input style="width:100px; margin:0px" type="text"  id="qty" step="1" min="" max="" name="qty" value="<?php if(isset($currentqty)) {echo $currentqty; }else { echo 1;}?>" title="Qty" class="input-text qty text2"  size="10"  ><input type="button" value="+" class="plus">
</div>		
								
								
  <?php }else{?>
  					  		<input style="width:100px; margin:0px" type="text" name="qty" id="qty"value="<?php if(isset($currentqty)) {echo $currentqty; }else { echo 1;}?>" class="form-control2" required placeholder="Qty" >

  
  <?php }?>
				
								
			</th>						
					<th colspan="5" >		

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

					 		 <select class="form-control2"  style="width:50px"  name="taxindicator"  >

					




<?php 

if($display1=="yes"){
	?>
			<option selected="selected" value="<?php echo $display1; ?>"  ><?php echo $display1;?></option>
		<option value="no"  >no</option>

	
	<?php 
}else{
	?>	
		<option selected="selected" value="<?php echo $display1; ?>"  ><?php echo $display1;?></option>
		<option  value="yes"   >yes</option>
<?php 	
}
?>

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

					 		 <select class="form-control2"  style="width:50px; display:none"  name="taxindicator"  >

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

		<option  value="yes"   >yes</option>
		<option value="no"  >no</option>

		
</select>
					 
							
						<?php
						}
				  ?>







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

													  		<input type="text"  style="width:100px" name="discount" value="<?php echo set_value('discount','0'); ?>" class="form-control2" required placeholder="Enter Discount">
				
							
	 
		 	<?php	
		}else{


		}
  ?>
  
  
								 <?php
 if( $productdiscountaction==true){
	 
	 //
	 ?>

		<select name="mode" id="mode" class="form-control2">

<option selected="selected" value="AMT" >AMT</option>
<option value="PC">PC%</option>
<option value="DIRECT">DRCT</option>
<option value="Money">Money</option>
<option  value="COMBINED" >Combined</option>
<option  value="TWOSTEPS" >Two Steps</option>



</select>										
				
							
	 
		 	<?php	
		}else{


		}
  ?>
	
												 <?php
				 if( $selectmessage==true){
					 ?>
							
<select name="message" id="message" onchange="select()"  class="form-control2"  style="width:30%" >

  <?php

 		//$mymessage= $this->usermodel->populateall('message','companyid',$companyid);
			$mymessage= $this->usermodel->populatealldatawhere('message','id','ASC','companyid', $companyid);



if(is_array($mymessage)) {

   foreach($mymessage as $mymessage){

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

   
    <?php

}} else {
	?>
		<!--<option value=""  >---No message-</option>-->

	<?php
	
}
 ?>
		<option value=""  >N/A</option>

</select>	
					
							<?php	
						}else{
							?>
									  		<input type="hidden" style="width:30%"  name="message" id="mymessage"  id="message"  autofocus value="" class="form-control" required placeholder="Enter message">

						<?php
						}
				  ?>
						

															<button type="submit"  value="sale" name="btn_addsale" class="btn btn-primary">Sell  </button>

								</th>
							
										
								

								
								
								

 
  					<?php echo form_close();?>
								
							
							
								
							</tr>
								<tr>
							
								<th width="30%">Item Name</th>
								
															 <?php
				 if( $changeuomonsales==true){
					 echo "<th>";
					 echo "Uom";
					 	 echo "</th>";
				 }
					 ?>
															
											<th>Qty</th>
							
											 <?php
				 if( $changetaxstatus==true){
					 echo "<th>";
					 echo "Vat";
					 	 echo "</th>";
				 }
					 ?>
								
									 <?php
					 if( $productdiscountaction==true){
			 ?>
					<th>Disc </th>
					 
					 
					  <?php
				 }
					 ?>
							
								<th>S Price</th>
								<th >Total</th>
								<th colspan="5"></th>
									
							</tr>
						</thead>
						<?php
					
 if(!is_array($viewsales)) {
	 

			 }else{
 if(!is_array($viewsales)) 

 {


   echo "<tr  style='margin-bottom:0px;margin-top:0px;' '>";
      echo "<td colspan='5'>";
    
    echo "</td>";
   echo "</tr>";
    }else {
 $totalcost=0;
  $totalqty=0;
 $totaldiscount=0;
   $totalvat=0;
  	foreach ($viewsales as $c): 

		 $totalqty=$totalqty+$c->qty;
 $totaldiscount= $totaldiscount+$c->discount;

             ?>
				                    <tbody  >
									
										 
										<?php
					
		                 echo form_open('user/editsale' , array('class' => 'form-horizontal form-groups-bordered validate', 'name'=>'editform','enctype' => 'multipart/form-data'));

				 if(validation_errors()):?>
<div class='alert alert-danger text-center'><?php echo validation_errors(); ?></div>
<?php endif;?>								
<div  id="scroll">
											<tr>
											
  								
													    <td  width="30%">
														
														
											
														
														
														
														
														<?php ; 
						 $receiptdescription=$configuration[0]['receiptdescription'];
									
   $customer=$c->code;
   $mybranch=$c->branch;
   if($customer!=""){
	  
      $productname = $this->usermodel->geteproductbyid($customer);
  
     echo "<b>";
	 $myserial="";
	 if($c->serial==""){
		 	 $myserial="";

	 }else{
			 $myserial=" ,S/N: ".$c->serial;; 
	 } 
     $name=$productname[0]['name'].$myserial ;
	 
	 
	 if($receiptdescription=="yes"){ echo"-".$description=$productname[0]['description'].$myserial ;}
	 

	  echo "</b>";


   }else{
	    echo "No Product";  
   }


								//	$PRODUCTLIST  = $this->usermodel->populatealldatanoarray('productlist','code', $customer,'branch', $mybranch);
		 					 		$PRODUCTLIST = $this->usermodel->populateall('products','code',$customer);



if(is_array($PRODUCTLIST)) {

   foreach($PRODUCTLIST as $p){

   //echo $courserow->coursename;

 if( $updateproduct==true){
	 ?>
<a id="editbtn"  data-producttype='<?php echo  $p->producttype;?>' data-status='<?php echo  $p->status;?>' data-branch='<?php echo  $mybranch;?>' data-branch='<?php echo  $mybranch?>'  data-branch='<?php echo  $mybranch;?>' data-name='<?php echo  $p->name;?>' 
data-salesaccount='<?php echo  $p->salesaccount;?>' data-expenseaccount='<?php echo  $p->expenseaccount;?>'  
data-tax_included='<?php echo  $p->tax_included;?>' data-uom='<?php echo  $p->uom;?>' 
 data-producttype='<?php echo  $p->producttype;?>'   data-shortname='<?php echo  $p->shortname;?>'
 data-status='<?php echo  $p->status;?>'  data-orderamount='<?php echo  $p->orderamount;?>'    data-expdate='<?php echo  $p->expdate;?>'data-store='<?php echo  $p->store;?>' 	data-supplier='<?php echo  $p->supplier;?>'  data-category='<?php echo  $p->category;?>'  data-buyingprice='<?php echo  $p->buyingprice;?>' data-sellingprice='<?php echo  $p->sellingprice;?>'data-promoprice='<?php echo  $p->promoprice;?>'  data-wholesaleprice='<?php echo  $p->wholesaleprice;?>' data-code='<?php echo  $p->code;?>' data-qty='<?php echo  $p->qty;?>'data-description='<?php echo  $p->description;?>' data-name='<?php echo  $p->name;?>'	data-reorderevel='<?php echo  $p->reorderevel;?>'  data-id='<?php echo  $p->id;?>' data-toggle='modal' data-target='#editProductModel'><!--<span style="color:black"> <?php    $name;   ?> </span>	--> </a>	 
				
							
	 
		 	<?php	
			
			 echo$name;   
   echo  " ".$serial=$c->serial;
		}else{
   echo$name;   
   echo  " ".$serial=$c->serial;
		}
 


	
}} else {
    echo 'No Customer available.';
}
	
?>
  								 <?php
				 if( $selectmessage==true){
					 ?>
						
											  
   					<input type="text" name="message"  value="<?php echo set_value('message',$c->address); ?>" class="form-control"  placeholder="message"  style=" border-top-style: hidden; border-right-style: hidden; border-left-style: hidden;  border-bottom-style: hidden;background-color: #white;">
					<!--
					<textarea type="hidden" rows="1" cols="20" name="message3" value="<?php echo set_value("message" ); ?>"  class="form-control"  style="margin-bottom:0: "   placeholder="Enter Details"><?php echo set_value('message',$c->address); ?></textarea>
--->
	
	
				
				 <?php
				 }else{
					 
					 
					 ?>
						
  											<input type="hidden" name="message"  value="<?php echo set_value('message',$c->address); ?>" class="form-control"  placeholder="message"  style=" border-top-style: hidden; border-right-style: hidden; border-left-style: hidden;  border-bottom-style: hidden;background-color: #white;">

  
				<?php
				 }
				 
					 ?>
  
  
  

   </td>


   
								 <?php
				 if( $changeuomonsales==true){
					 ?>
					    <td>
<select class="form-control1"  name="uom" style="style:width:50%; border-top-style: hidden; border-right-style: hidden; border-left-style: hidden;  border-bottom-style: hidden;background-color: #white;"  >
	
		<option selected="selected" value="<?php echo $c->uom; ?>"  ><?php echo $c->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."price:".$uomrow->price.")"; ?></option>



	<?php

}} else {
    echo 'No uom.';
}
	
?>
</select>
  
  			
					
					<?php	
						}else{
							?>
<select class="form-control1"  name="uom" style="display:none" style="width:50%; border-top-style: hidden; border-right-style: hidden; border-left-style: hidden;  border-bottom-style: hidden;background-color: #white;"  >
	
		<option selected="selected" value="<?php echo $c->uom; ?>"  ><?php echo $c->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."price:".$uomrow->price.")"; ?></option>



	<?php

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


  
  

												
													<td>
												
												<input type="hidden" name="myinvoice" id="myinvoice" value="<?php echo set_value('myinvoice',$salesid); ?>" class="form-control" required placeholder="myid" >
												<input type="hidden" name="type" id="retail" value="wholesale" class="form-control" required placeholder="type" >
<input type="hidden" name="view" id="view" value="user/viewwholesales?productcategory=<?php if(isset($productcategory)) {echo $productcategory; }?>" class="form-control" required placeholder="view" >

											<input type="hidden" name="myid" id="myid" value="<?php echo set_value('myid',$c->id); ?>" class="form-control" required placeholder="myid" >
					 <?php
							 
		 if( $updateqtysales==true){
			 
					 ?>
																					<input type="text"  name="myqty" id="myqty" value="<?php echo set_value('myqty',$c->qty); ?>" class="form-control2"  required placeholder="Qty" style="width:100px; border-top-style: hidden; border-right-style: hidden; border-left-style: hidden;  border-bottom-style: hidden;background-color: #white;" >
 
					 	<?php 
}else{
	?>	
																		<input type="text"  name="myqty" id="myqty" readonly value="<?php echo set_value('myqty',$c->qty); ?>" class="form-control2"  required placeholder="Qty" style="width:100px; border-top-style: hidden; border-right-style: hidden; border-left-style: hidden;  border-bottom-style: hidden;background-color: #white;" >

<?php 	
}
?>
					 
															  	

							 
							 </td>
						
							 <?php
							 
		 if( $changetaxstatus==true){
			 
					 ?>
				 	 <td>
				 
				  <select class="form-control1"  style="width:100px; border-top-style: hidden; border-right-style: hidden; border-left-style: hidden;  border-bottom-style: hidden;background-color: #white;" onchange="selectvat()" id="taxindicator" name="taxindicator"  >


<?php 

if($c->taxindicator=="yes"){
	?>
			<option selected="selected" value="<?php echo $c->taxindicator; ?>"  ><?php echo $c->taxindicator;?></option>
		<option value="no"  >no</option>

	
	<?php 
}else{
	?>	
			<option selected="selected" value="<?php echo $c->taxindicator; ?>"  ><?php echo $c->taxindicator;?></option>
		<option  value="yes"   >yes</option>
<?php 	
}
?>







		
</select>
</td>
				 <?php
				 }
					 ?>


	
					 <?php
					 if( $productdiscountaction==true){
			 ?>
				 	<td><?php echo $c->discount ;?></td>
					 
					 
					  <?php
				 }
					 ?>

					 
					 
	
													
										 	 <td>

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

									<input type="text" style="width:70%;  border-top-style: hidden; border-right-style: hidden; border-left-style: hidden;  border-bottom-style: hidden;background-color: #white;" name="sprice" id="sprice" value="<?php echo set_value('sprice',$c->sprice); ?>" class="form-control2" required placeholder="sprice" >
				
							
	 
		 	<?php	
		}else{
			
			
			?>
			
												<input type="hidden" style="width:70%;  border-top-style: hidden; border-right-style: hidden; border-left-style: hidden;  border-bottom-style: hidden;background-color: #white;" name="sprice" id="sprice" value="<?php echo set_value('sprice',$c->sprice); ?>" class="form-control2" required placeholder="sprice" >
<?php	

echo $c->sprice;
		}
  ?>
									
									
									
									
									
									
									
									
									
									
									
									
											 </td>
											 	 <td colspan="2"><?php echo $c->amount ; 
												$totalcost=(round($totalcost+$c->amount)) ;
												 	// $totalcost=($totalcost+$c->amount) ;
												//$totalcost= formatMoney($totalcost, true);
												    $totalvat=  ($totalvat+ $c->tax);

												 ?>
												</td>
												
												
												
											
 <td>
 
 
 <?php
	$myid=  $c->id ;
		$mystatus=  $c->ordersales ;
				 if($mystatus=="new") {

	 ?>

		
								 <?php
				 if( $suspendsales==true){
					 ?>
			 <a  id="more"  class=" btn-danger" href="<?php echo base_url();?>user/deletesoldeproducts?randomitemidentifier=<?php   {echo  $salesid;}  ?>&transactionid=<?php   {echo  $myid;}  ?>&type=wholesale&view=user/viewwholesales?productcategory=<?php if(isset($productcategory)) {echo $productcategory; }?> "> <span class="glyphicon glyphicon-trash"></span> </a>

							<?php	
						}else{
							?>

				 <a class=" btn-danger managebtn" id="managebtndelete" data-productcategory='<?php echo  $productcategory?>'  data-myproductid='<?php echo  $myid?>'     data-salesid='<?php echo  $salesid?>'       data-toggle='modal' data-target='#mydeleteModal<?php  $myid; ?>'>	 
<span class="glyphicon glyphicon-trash"></span> </a>
						<?php
						}
				  ?>

				
  				 	<?php	

 }else{
	 
	  //if($myreturn==true) {
		  
		  ?>
<!--
			 <a  id="more"  class=" btn-danger" href="<?php echo base_url();?>user/deletesoldeproducts?randomitemidentifier=<?php   {echo  $salesid;}  ?>&transactionid=<?php   {echo  $myid;}  ?>&type=wholesale&view=user/viewwholesales?productcategory=<?php if(isset($productcategory)) {echo $productcategory; }?> "> <span class="glyphicon glyphicon-trash"></span> </a>
			-->
  				 	<?php	 
	  //}
	 
	 
	 
 }
  ?>
										
</td>
			
												
												
												
												<td>
												
		<?php
		 if($mystatus=="new") {
			  ?>

<button type="submit"  value="sale" name="btn_editsales" class="btn-primary"> <span class="glyphicon glyphicon-pencil"></span> 				                             
			
  				 	<?php
		 }else{
		
		if($myreturn==true) {
	 ?>

	 
	
		<!--				  
							
<button type="submit"  value="sale" name="btn_editsales" class="btn-primary"> <span class="glyphicon glyphicon-pencil"></span> 				                             
  </button>
-->
 
  				 	<?php	

 }
		 }
  ?>
			

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

              <?php }?>	
			 
								<tr>
								<th>
	
     
   
							
								 <?php
				 if( $suspendsales==true){
					 ?>
					
						 <a class="btn btn-warning" href="<?php echo base_url(); ?>user/suspendsales?randomitemidentifier=<?php   {echo  $salesid;}  ?>&view=user/viewwholesales">Suspend  </a>

							<?php	
						}else{
							?>

			
 <a class="btn btn-warning managebtn" id="managebtndelete"      data-salesid='<?php echo  $salesid?>'       data-toggle='modal' data-target='#mysuspendModal<?php  $salesid; ?>'>	 
<span class="glyphicon glyphicon-trash">Suspend</span> </a>
						<?php
						}
				  ?>

	<?php						
							
 if( $addproducts==true){
	 ?>
  <a data-toggle='modal' data-target='#addModal' class="btn btn-default">Creat product </a>

	 
	 	<?php	
		}
  ?>







								
								</th>
								
								
		
							
								
								
								
								
<th>

 
										<?php

					
										if(isset($totalqty)) { 
										 //
										 echo "Qty:". formatMoney($totalqty, true);
										 
										 }

?>

</th>
								
								
										 <th colspan="4" >
										 
										 
							
								
								
								
								<h2 class="pull-right" style="margin:0px; padding0px; color:red">
							

										 
										<?php



										if(isset($totaldiscount)) { 
										 //
										 if($totaldiscount !="" ){
										 echo " Dsc:". formatMoney($totaldiscount, true);
										 }
										 }

					
										if(isset($totalcost)) { 
										 //
										 echo " Total Amount:". formatMoney($totalcost, true);
										 
										 }
										 
				
										 
										 if($display1=="yes"){
											 if(isset($totalvat)) { 
											
						// echo ";       VAT:". formatMoney($totalvat, true);

										 }
 
										 }
										 
										 
										 ?>
									
																			 										 <hr style="height:2px;border-width:0;color:gray;background-color:gray">
 
								</h2>
				
								</th>
								
							
							</tr>
							
							<tr>
								<th  colspan="8">
														<div class="col-md-12 text-center">   <?php if(isset($links)) {echo $links; }?>

        
        </div>
								</th>
							
							</tr>
							
				
									</tbody>
									
									
					</table>
				</div>	
			</div>
					
					
					
					
					
					
	
  

			
			
		
		
  

 

	
	
 </div>


	</div>
	
		
		  <?php
  
 if(($view=="Restaurant") || ($view=="CompleteTouch")){
  ?>
	 	<div class="col-md-2">

  
  <?php	
}else{
 ?>
 
	 	<div class="col-md-3">

 
  <?php		
}
  ?>
		
	<div class="panel panel-default" data-collapsed="0">
        	<div class="panel-heading">
            	<div class="panel-title"  >
            		<i class="entypo-plus-circled"></i>
					
					
						<?php
 if( $mpesaaction==true){
	 

	 ?>
																		 <a target="_blank"  href="<?php echo base_url();?>user/viewprndingmoneyreceived"  class="btn-success" >Mpesa </a>
	
			
			
	 	<?php	
		
		}
  ?>

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

<a data-toggle='modal' data-target='#addsupplierModal' class=" btn-info">  Customer</a>

							
	 
		 	<?php	
		}else{


		}
  ?>
					 <?php
 if( $giveloyalityponts==true){
	 ?>
	 			 <a class="btn-warning"  target="_blank" id="more" href="<?php echo base_url();?>user/viewloyality">L.Points  </a>
	<?php	
		}
  ?>  					


					 <?php
 if( $leaseitems==true){
	 ?>
	 			 <a class="btn-info"  target="_blank" id="more" href="<?php echo base_url();?>user/viewlease">Lease </a>
	<?php	
		}
  ?>  					

				</div>
            </div>
			<div class="table2" >

			



<table width="100%">

<tr><td colspan="2">
<form name ="mpesa" id="sales"action="getpayment" method="post">

					  		<input type="hidden" name="invoice" value="<?php echo set_value('type',$salesid); ?>" class="form-control" required placeholder="Enter invoice">
							
													<?php
 if( $mpesaaction==true){
	 

	 ?>
<input type="text" name="phone" id="phone" placeholder="Enter Phone No to verify" style="margin-bottom:0: "value="254" class="form-control" />
	
			
			
	 	<?php	
		
		}
  ?>

<input type="hidden" name="myview" value="user/viewwholesales" class="form-control" required placeholder="Enter view">





	</form>
</td>
</tr>
  <tr>
  
  <td colspan="2">
  					<form name = "sales" id="sales"action="savesales" method="post">

<?php 
                 //echo form_open('user/addsale' , array('id'=>'sales','name'=>'','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/viewwholesales" class="form-control" required placeholder="Enter view">

				  		<input type="hidden" name="invoice" value="<?php echo set_value('type',$salesid); ?>" class="form-control" required placeholder="Enter invoice">
			  		<input type="hidden" name="salestype" value="wholesale" class="form-control" required placeholder="Enter sales type">
							  		<input type="hidden" name="soldqty" value="<?php if(isset($totalqty)) { echo $totalqty;  }?>" class="form-control" required placeholder="Enter total qty">

			
					 
					 				 <?php
				 if( $selectcurrency==true){
					 ?>
					 
						
				
	<div class="form-group">
				 <select class="chzn-select" name="currency" id="currency" style="width:100%" style="margin:0px; padding:0px;" >
	
	<option value=""  >---Select Currency---</option>
								   
									   
		<?php 

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


if(is_array($currency)) {

   foreach($currency as $currencyrow){

  


  
   ?>
	    <option selected="selected" value="<?php echo $currencyrow->name; ?> "><?=$currencyrow->name;?></option>

   
    <?php   


   
   
  

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

?>
</select>	
	</div>				
			<?php	
						}else{
							?>
									  		<input type="hidden" name="currency" id="currency"   value="" class="form-control" required placeholder="Enter currency name">

						<?php
						}
					?>
					
					
					
					
					
					
					
					
					
					
								 <?php
				 if( $selectroom==true){
					 ?>
					 
						
				
	<div class="form-group">
				 <select class="chzn-select" name="rooms" id="rooms" style="width:100%" style="margin:0px; padding:0px;" >
	
	<option value=""  >---Select Rooms---</option>

				

	<?php 
					 
			$myroom= $this->usermodel->populatealldatanoarray('house','companyid',$companyid,'status', "occupied");
	     // $mycustomer=$this->usermodel->populatealldatawhere('products','bulk',$userid);


if(is_array($myroom)) {

   foreach($myroom as $myroomrow){

   //echo $courserow->coursename;
   ?>
					<option value="<?=  $myroomrow->houseno."-".$myroomrow->plotno;   ?>"><?=  $myroomrow->houseno."-".$myroomrow->plotno; ?></option>




	<?php

}} else {
    echo 'No Room available.';
}
	
?>
</select>	
	</div>				
			<?php	
						}else{
							?>
									  		<input type="hidden" name="rooms" id="rooms"   value="" class="form-control" required placeholder="Enter room name">

						<?php
						}
				  ?>
							
	<div class="form-group">		
 <select class="chzn-select" name="customer" id="customer" style="width:100%" >
	
	<option value=""  >---Select Customer/User---</option>
<!--
		<option value="directly"  >---Enter Name Directly---</option>
		
		-->
				<option value="cheifmessage"  >---Post Chief's Message---</option>

								<option value="selectcheifmessage"  >--Select Chief's Message--</option>



	<?php 
											//$mycustomer = $this->usermodel->populatealldatanoarraythree('people', 'companyid',$companyid,'status',1,'category <>','supplier');
 											$mycustomer = $this->usermodel->populatealldatanoarraythree('people', 'companyid',$companyid,'status',1,'category','member');


if(is_array($mycustomer)) {

   foreach($mycustomer as $mycustomerrow){

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




	<?php

}} else {
    echo 'No Customer available.';
}
	
?>
</select>
  </div>
  </td>
  
  </tr>
	<tr><td colspan="2">
	
	
	
		
	<select name="type" required id="type" class="form-control1" style="width:60%">

<?php if(isset($_GET['transactioncode'])) {
	?>
	<option value="Mpesa" selected="selected">Mpesa</option>

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

	
	<?php	
	}
	?>









<?php
 if( $mpesaaction==true){
	 ?>
<option value="Mpesa"  >Mpesa</option>
		<?php	
		}
  ?>


<?php
 if( $cardaction==true){
	 ?>
<option value="Card">Card</option>
		<?php	
		}
  ?>
  
  
  
<?php
 if( $creditaction==true){
	 ?>
<option value="Invoice">Invoice / Credit</option>
		<?php	
		}
  ?>
  
  

  
<?php
 if( $chequeaction==true){
	 ?>
<option value="Bank">Bank</option>
		<?php	
		}
  ?>
  
  
  <?php
 if( $voucheraction==true){
	 ?>
<option value="Voucher">Voucher/Complimentary</option>
		<?php	
		}
  ?>
  
  
<?php
 if( $pointsaction==true){
	 ?>
<option value="Points">Bonga Points</option>
		<?php	
		}
  ?>
  
  
  
<?php
 if( $creditnoteeaction==true){
	 ?>
<option value="Creditnote">Credit Note</option>
		<?php	
		}
  ?>
  
<option value="Delivery">Cash On Delivery</option>


<option value="Savedata">Save Customer</option>

</select>										




		
	<select name="redeem" id="redeem" class="form-control1" style="width:30%">

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


<option value="">-Redeem?-</option>

</select>										

</td>
	
								
								
								
								
								
								
								
<tr>
							<td colspan="2">
								
		
		
		<?php
if($entermpesacode==true){
			 ?>
			<input type="text" name="accountno"  id="accountno" value="<?php if(isset($_GET['transactioncode'])) {echo $_GET['transactioncode']; }?>" placeholder="Enter reference code" class="form-control" />

				<?php
}else{
	 ?>	
			<input type="hidden" name="accountno"  id="accountno" value="<?php if(isset($_GET['transactioncode'])) {echo $_GET['transactioncode']; }?>" placeholder="Enter reference code" class="form-control" />

<?php	

}
 ?>
																			  	
																				<input type="hidden"    readonly name="discountedtotal" value="<?php if(isset($totalcost)) {echo $totalcost; }?>" id="discountedtotal"class="form-control" required placeholder="total">

  </td> 
  </tr>


  
  
  
  

    <tr>
   <td colspan="2">
   
  
<h3  style="margin:0px;"> <?php 
		
		if(isset($_GET['transactioncode'])) {echo $_GET['transactioncode']; }
		
				if(isset($_GET['memberid'])) {
					$memberids=$_GET['memberid'];
						      $customers=$this->usermodel->populateallarray('people','id',$memberids);

				
					
						 echo$customers[0]['firstname'];
				   
				   
				   ?>
				   	<input type="hidden" name="memberid"  id="memberid" value="<?php echo $memberids ;?>" placeholder="Enter code" class="form-control" /><br>

				   <?php
						 
					}else{
							
						
					}
				
				
				
				
				?>

		
		
		
		
		
		
		
		
		
		
		</h3>
  </td>
  </tr>
  
  
  <tr>

			<td colspan="2">
															<input type="text" name="due" id="due" style="margin:0px; padding:0px;" placeholder="Due Date(Credit only)"  value="<?php echo$dateposted ;?>" class="tcal" />

<?php
 if( $selecttable==true){
	 ?>
						<div class="form-group" id="mytable2" style="margin-bottom:10px; padding:0;">

				<select class="chzn-select" name="mytable" id="mytable" id="mytable" style="width:100%" style="margin:0px; padding:0px;" >
	
	<option value=""  >---Slect table--</option>

	<?php 
					 
			$mytable= $this->usermodel->populatealldatanoarrayorderbydata('tables','branchid',$branchid,'status', "active","id","ASC");


if(is_array($mytable)) {

   foreach($mytable as $mytablerow){

	  	$correctable= $this->usermodel->pendingorder('sales','branch',$branchid,'mytable',$mytablerow->name);

if(is_array($correctable)) {

} else {
    ?>
					<option class="btn btn-warning" style="margin:5px; padding:10px;" value="<?=  $mytablerow->name;   ?>"><?=  $mytablerow->name; ?></option>



	<?php
}
}} else {
    echo 'No table.';
}
	
?>
</select>	
	</div>	

		<?php
 }else{
	 ?>
	<input type="hidden" name="mytable"  id="mytable2" placeholder="Table Number" style="margin-bottom:0:" value="" class="form-control" /><br>

		<?php 
 }
	 ?>	
	 
	 
	 <?php
 if( $salesperson==true){
	 ?>
	  <select class="chzn-select" name="salesperson" id="salesperson" style="width:100%" >
	
	<option value=""  >---Select Sales Person---</option>
<!--
		<option value="directly"  >---Enter Name Directly---</option>
		
		-->
			



	<?php 
											$mycustomer = $this->usermodel->populatealldatanoarraythree('people', 'companyid',$companyid,'status',1,'category <>','supplier');
 

if(is_array($mycustomer)) {

   foreach($mycustomer as $mycustomerrow){

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




	<?php

}} else {
    echo 'No Customer available.';
}
	
?>
</select>
	 
	
		<?php
 }else{
	 ?>
	<input type="hidden" name="salesperson"  id="salesperson" placeholder="salesperson" style="margin-bottom:0:" value="" class="form-control" /><br>

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

										<?php 
										//
						$maindiscount=$configuration[0]['maindiscount']; 
						if(($maindiscount=="yes")&&($maindiscount!="")){
						
						?>
							
							<tr>
								<td id="big"> Discount</td>
								<td id="big">

								
								<input type="text"  class="form-control" name="maindiscount" value="" id="maindiscount"  placeholder="discount" onkeyup='OnChangediscount(this.value)' onkeypress="return isNumberKey(event)" autocomplete="off"  ="required"/>
																
							
								
								
								</td>
							</tr>
							
							
											<?php 
						
						}else{
							?>

							
	<input type="hidden"  class="form-control" name="maindiscount" value="<?php if(isset($totaldiscount)) {echo $totaldiscount; }?>" id="maindiscount"  placeholder="discount" onkeyup='OnChangediscount(this.value)' onkeypress="return isNumberKey(event)" autocomplete="off"  ="required"/>
	<?php 
						
						}
						?>
							
							
							
								<tr>
								<td id="big" width="130px"> CASH-F3</td>
								<td id="big">
								<input type="hidden" name="total"  id="myfinaltotal"   placeholder="Cash" value="<?php if(isset($totalcost)) {echo $totalcost; }?>" />

								<input type="text"  class="form-control" name="cash" value="<?php if(isset($_GET['mpesaamount'])) {echo "0"; }else{ if(isset($totalcost)) {echo $totalcost; }} ?>" id="cash"  placeholder="cash" onkeyup='OnChange(this.value)' onkeypress="return isNumberKey(event)" autocomplete="off"  required="required"/>
																
							
								
								
								</td>
							</tr>
		<?php
 if( $mpesaaction==true){
	 

	 ?>
		<tr>
								<td id="big"> MPESA-F4</td>
								<td id="big">

								<input type="text"  class="form-control" name="mpesa" value="<?php if(isset($_GET['mpesaamount'])) {echo $_GET['mpesaamount']; }else{echo "0";}?>" id="mpesa"  placeholder="mpesa" onkeyup='OnChange(this.value)' onkeypress="return isNumberKey(event)" autocomplete="off"  required="required"/>
																
							
								
								
								</td>
							</tr>
							
	 
	 	<?php	
		}else{
?>
								<input type="hidden"  class="form-control" name="mpesa" value="0" id="mpesa"  placeholder="mpesa" onkeyup='OnChange(this.value)' onkeypress="return isNumberKey(event)" autocomplete="off"  required="required"/>

<?php

		}
  ?>
								<?php
 if( $cardaction==true){
	 ?>

								<tr>
								<td id="big"> CARD-F5</td>
								<td id="big">

								<input type="text"  class="form-control" name="card" value="0" id="card"  placeholder="card" onkeyup='OnChange(this.value)' onkeypress="return isNumberKey(event)" autocomplete="off"  required="required"/>
																
							
								
								
								</td>
							</tr>
	 
		 	<?php	
		}else{
?>
								<input type="hidden"  class="form-control" name="card" value="0" id="card"  placeholder="card" onkeyup='OnChange(this.value)' onkeypress="return isNumberKey(event)" autocomplete="off"  required="required"/>

<?php

		}
  ?>
	<?php
 if( $creditaction==true){
	 ?>

	 <tr>
								<td id="big"> CREDIT-F6</td>
								<td id="big">

								<input type="text"  class="form-control" name="credit" value="0" id="credit"  placeholder="credit" onkeyup='OnChange(this.value)' onkeypress="return isNumberKey(event)" autocomplete="off"  required="required"/>
																
							
								
								
								</td>
							</tr>
		 	<?php	
		}else{
?>
								<input type="hidden"  class="form-control" name="credit" value="0" id="credit"  placeholder="credit" onkeyup='OnChange(this.value)' onkeypress="return isNumberKey(event)" autocomplete="off"  required="required"/>

<?php

		}
  ?>
  
<?php
 if( $voucheraction==true){
	 ?>
	<tr>
								<td id="big"> VOUCHER-F7</td>
								<td id="big">

								<input type="text"  class="form-control" name="voucher" value="0" id="voucher"  placeholder="voucher" onkeyup='OnChange(this.value)' onkeypress="return isNumberKey(event)" autocomplete="off"  required="required"/>
																
							
								
								
								</td>
							</tr>
	 
		 	<?php	
		}else{
?>
								<input type="hidden"  class="form-control" name="voucher" value="0" id="voucher"  placeholder="voucher" onkeyup='OnChange(this.value)' onkeypress="return isNumberKey(event)" autocomplete="off"  required="required"/>

<?php

		}
  ?>
				<?php
 if( $chequeaction==true){
	 ?>
<tr>
								<td id="big"> BANK-F8</td>
								<td id="big">

								<input type="text"  class="form-control" name="cheque" value="0" id="cheque"  placeholder="cheque" onkeyup='OnChange(this.value)' onkeypress="return isNumberKey(event)" autocomplete="off"  required="required"/>
																
							
								
								
								</td>
							</tr>
	 
		 	<?php	
		}else{
?>
								<input type="hidden"  class="form-control" name="cheque" value="0" id="cheque"  placeholder="cheque" onkeyup='OnChange(this.value)' onkeypress="return isNumberKey(event)" autocomplete="off"  required="required"/>

<?php

		}
  ?>
			
		<?php
 if( $pointsaction==true){
	 ?>

	 <tr>
								<td id="big"> L POINTS-F9</td>
								<td id="big">

								<input type="text"  class="form-control" name="points" value="0" id="points"  placeholder="points" onkeyup='OnChange(this.value)' onkeypress="return isNumberKey(event)" autocomplete="off"  required="required"/>
																
							
								
								
								</td>
							</tr>
							
		 	<?php	
		}else{
?>								<input type="hidden"  class="form-control" name="points" value="0" id="points"  placeholder="points" onkeyup='OnChange(this.value)' onkeypress="return isNumberKey(event)" autocomplete="off"  required="required"/>


<?php

		}
  ?>				
							
							
								
							
						<?php
 if( $creditnoteeaction==true){
	 ?>

	 <tr>
								<td id="big"> CREDIT NOT-F10</td>
								<td id="big">

								<input type="text"  class="form-control" name="creditnote" value="0" id="creditnotee"  placeholder="creditnote" onkeyup='OnChange(this.value)' onkeypress="return isNumberKey(event)" autocomplete="off"  required="required"/>
																
							
								
								
								</td>
							</tr>
		 	<?php	
		}else{
?>
								<input type="hidden"  class="form-control" name="creditnote" value="0" id="creditnotee"  placeholder="creditnote" onkeyup='OnChange(this.value)' onkeypress="return isNumberKey(event)" autocomplete="off"  required="required"/>

<?php

		}
  ?>	
								
							
								<tr>
								<td id="big">CHANGE</td>
								<td id="big">
		  		<input type="text" readonly    name="change" value="0" id="change" class="form-control" required placeholder="Change">
								
								</td>
							</tr>
							
							<tr>
								
								<td colspan="2">	
								
										 <?php
			  if( $printreceipt==true){
	 ?>

	         <button type="submit" style="margin:0; padding:0;" value="sales" name="btn_savesales" id="btn_savesales"  class="btn btn-primary"><h4> Print   </h4>  </button>
			
	 
		 	<?php	
		}else{

		}
  ?>
	
								
			 <?php
			  if( $dontprintaction==true){
	 ?>

	         <button type="submit" style="margin:0; padding:0;" value="noreceipt" name="btn_savesales" id="btn_dontprint"  class="btn btn-warning"><h4> Don't Print  </h4>  </button>
			
	 
		 	<?php	
		}else{

		}
  ?>
	
	

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


					 <button type="submit"  value="order" style="margin:0; padding:0;"name="btn_savesales" id="btn_order"  class="btn btn-info"><h4> Order </h4>  </button>
				 	 		 <input type="checkbox" style="margin:5px; padding:30px;"value="1" name="next"/>NEXT

						
		 	<?php	
		}else{
			

		}
  ?>  
  
  
  
  
  	  	 <?php
 if( $printdelivery==true){
	 ?>
	 <input type="checkbox" style="margin:5px; padding:30px;"value="1" name="delivery"/>Delv
	 	<?php	
		}else{
		?>
			 <input type="hidden" style="margin:5px; padding:30px;"value="0" name="delivery"/>

<?php		

		}
  ?> 
 
	
  
  
  
  
  
  	 <?php
 if( $sendsms==true){
	 ?>
	 <input type="checkbox" style="margin:5px; padding:30px;"value="1" name="sendsms"/>SMS
	 	<?php	
		}else{
		?>
			 <input type="hidden" style="margin:5px; padding:30px;"value="0" name="sendsms"/>

<?php		

		}
  ?> 
 
 
 	<div class="form-group">
   
			 <?php
 if( $giveloyalityponts==true){
	 ?>
	  <div class="col-sm-6" style="margin:0px; padding:0px;" >
  <input type="text" name="cardnumber"  style="margin:0px; padding:0px;" id="cardnumber" value="<?php if(isset($_GET['cardnumber'])) {echo $_GET['cardnumber']; }?>" placeholder="Enter Card Number  (Alt Key)" class="form-control" />

				</div>	 	<?php	
		}else{
			?>
			  <input type="hidden" name="cardnumber"  style="margin:0px; padding:0px;" id="cardnumber" value="<?php if(isset($_GET['cardnumber'])) {echo $_GET['cardnumber']; }?>" placeholder="Enter Card Number  (Alt Key)" class="form-control" />

 	<?php	
		}
  ?>  					

		


					 <?php
 if( $recordcoins==true){
	 ?>
	 
	  <div class="col-sm-3"  style="margin:0px; padding:0px;">

	<input type="text"  class="form-control" name="saving" value="0" id="saving"  placeholder="Enter savings" onkeyup='OnChange(this.value)' onkeypress="return isNumberKey(event)" autocomplete="off"  required="required"/>

			  </div>	
	 <div class="col-sm-3"  style="margin:0px; padding:0px;">

		 <input type="checkbox"    style="margin:0px; padding:0px;"  value="1" name="coins"/>Save

			  </div>			
		 	<?php	
		}else{
			?>
					 <input type="hidden"    style="margin:0px; padding:0px;"  value="0" name="coins"/>

	<?php	
		}
		?>
	

  </div>
  
  
 
				<input type="text" name="name"  id="name2"value="<?php echo set_value('name'); ?>"  class="form-control" style="margin-bottom:0: " placeholder="Enter Driver Name">

			<input type="text" name="phone"    minlength="12"	maxlength="14"   id="myphone2" value="<?php echo set_value('phone'); ?>"  class="form-control" style="margin-bottom:0: " placeholder="Enter Phone Number e.g 2547xxxxxxxx">
			<input type="text" name="station"  id="station"value="<?php echo set_value('station'); ?>"  class="form-control" style="margin-bottom:0: " placeholder="Enter Department">
			<input type="text" name="destination"  id="destination"value="<?php echo set_value('destination'); ?>"  class="form-control" style="margin-bottom:0: " placeholder="Enter destination">
  							
 
 	<input type="text" name="ourcompany" id="ourcompany2" value="<?php echo set_value('ourcompany'); ?>"  class="form-control" style="margin-bottom:0: " placeholder="Enter Department">
					<input type="text" name="idno"   id="idno2" value="<?php echo set_value('idno'); ?>"  class="form-control" style="margin-bottom:0: " placeholder="Enter Number plate">

				<textarea name="description" id="mydescription" value="<?php echo set_value('description'); ?>"  class="form-control"  style="margin-bottom:0: "   placeholder="Enter Make"></textarea>

 
 
 
 
 
 

 	 <?php
 if( $receiptno==true){
	 $myreceiptno="";
		$lastnumber = $this->usermodel->last_recordsalesreceipt($companyid);
	
		 if($lastnumber==FALSE){
			 		$myreceiptno="";

		 }else{
 		$myreceiptno=$lastnumber[0]["receiptno"]+1;	 

		 }
	//echo $myreceiptno;
	 ?>
	<input type="text" name="receiptno"   id="receiptno" value="<?php echo set_value('receiptno'); ?>"  class="form-control"  placeholder="Enter alternative Receipt No if any">

	 	<?php	
		}else{
		?>
			 <input type="hidden" value="" name="receiptno"/>

<?php		

		}
  ?> 
									
		<select class="form-control"name="mydescription1" id="mydescription1" >
			<option value=""  selected>--select correct message--</option>



   <?php

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



if(is_array($mymessage)) {

   foreach($mymessage as $mymessage){

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

   
    <?php

}} else {
	?>
		<option value=""  >---No message available--</option>

	<?php
	
}
 ?>

</select>		
		 <?php
				 if( $backdatesales==true){
					 ?>
					 
					 
					 
      <label for="inputfromdate" class="col-sm-2 control-label"> Date  </label>

  
  <div class="col-sm-5">
					<div class="form-group">

                     		  		<input type="date" name="dateposted" value="<?php echo set_value('dateposted',date("Y-m-d", strtotime($dateposted))); ?>" class="form-control2" required placeholder="Enter start date">

					</div>
				</div>
				<div class="col-sm-5">
					<div class="form-group">
					

							  		<input type="time"  name="frotime" value="<?php echo set_value('frotime',date("H:i:s")); ?>" class="form-control2" required placeholder="Enter start time">

					</div>
				</div>
					 
					 
					 
					 
					 
					 
					 
					 

					
					<?php	
				 }else{?>

                     		  		<input type="hidden" name="dateposted" value="<?php echo set_value('dateposted',date("Y-m-d", strtotime($dateposted))); ?>" class="form-control" required placeholder="Enter start date">

 							  		<input type="hidden"  name="frotime" value="<?php echo set_value('frotime',date("H:i:s")); ?>" class="form-control" required placeholder="Enter start time">

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

			<td colspan="2">
					<?php
						
						

						?>

		
			
				
	
		
				
	 <?php


 if( $displaycustomers==true){
	 
	 
	 	 							  $viewmembers = $this->usermodel->populatealldatanoarray('people','companyid', $companyid,'category','user');

	 ?>

				
							

						
	<ul id="permission_list" class="list-unstyled">

 
	<?php
$finalproductname="";

	
 if(!is_array($viewmembers)) 

 {
     
	 
  
    }else {
?>
    
             <?php 
  
  	foreach ($viewmembers as $myc): 
             ?>
	  <div class="pull-left radius-5px" style="width:auto; padding: 5px; border: 1px solid #ddd;">


	   <li>

            
                
            <?php 
$memberid=$myc->id;


?>



  
                              <a  style="padding:10px" id="more" class="btn btn-warning" id="mycustomerid"  href="<?php echo base_url();?>user/viewwholesales?memberid=<?php   {echo  $memberid;}  ?>"><?php echo $myc->firstname ; ?></a>

		</li>
		 </div>
		<?php endforeach;
		
		 ?>
		
		
	
	
	<?php
	}
?>
	 
		 	<?php	
		}else{


		}
  ?>

	
								
  </td>
			
			
</tr>	


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




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

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

				<?PHP
				
				 $mylastrecord=0;
		
			$lastrecord = $this->usermodel->last_productcode($companyid);
			if($lastrecord !=false){
				 $mylastrecord=$lastrecord[0]["code"]+1;
			}else{
				
				 $mylastrecord=$mylastrecord+1;
			}
				
				
				
				
				
				
				
				
				
				
//$session_data = $this->session->userdata('logged_in');
$imgid = rand(100, 990000).time();
 $session_data = $this->session->userdata('logged_in');


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

				 }
					
   
 	$data['id'] = $session_data['id'];
        
		 $userid = $data['id'];
$data['companyid'] = $session_data['companyid'];
	 $companyid = $data['companyid'];
		 $data['usertype'] = $session_data['usertype'];
	 $usertype = $data['usertype'];	

				echo $this->session->flashdata('msg'); 
		
                 echo form_open('user/addproduct' , array('class' => 'form-horizontal form-groups-bordered validate', 'name' => 'products', 'enctype' => 'multipart/form-data'));
				 if(validation_errors()):?>
<div class='alert alert-danger text-center'><?php echo validation_errors(); ?></div>
<?php endif;?>
				  		<input type="hidden" name="type" value="product"id="type" class="form-control" required placeholder="Enter type">
	<input type="hidden" name="view" value="user/viewwholesales" 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"  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="2"  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="2"  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" name="qty" value="0"  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="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="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="addsupplierModal" class="modal fade" role="dialog">
  <div class="modal-dialog">

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

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



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

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


	
		 
				
		 
				
					<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" >
	<option value=""  >---Select category---</option>
	<option value="member" selected="selected"  >Customer</option>
		<option value="supplier"  >Supplier</option>
				<option value="user"  >Employee</option>
				
								<option value="accomodation" >Accomodation</option>

				<option value="reseller"  >Reseller/Agents</option>

	</select>		 
				
		<span class="text-danger"> <?php echo form_error('category'); ?>
		
		</span>
	</div>
  </div>
				
						
						
						
						
						
						
	<div class="form-group">
    <label for="inputfirstname" class="col-sm-2 control-label"> Customer	Names<span style="color:red;">*</span></label>
    <div class="col-sm-10">
	
		  		<input type="text" name="firstname" value="<?php echo set_value('firstname'); ?>" class="form-control" required placeholder="Enter first and last name">
		 
				
		<span class="text-danger"> <?php echo form_error('firstname'); ?>
		
		</span>
	</div>
  </div>
			<div class="form-group">
    <label for="inputcompany" class="col-sm-2 control-label">	Business Name </label>
    <div class="col-sm-10">
	
		  		<input type="text" name="company"  value="<?php echo set_value('company'); ?>" class="form-control"  placeholder="Enter company name if any">
		 
				
		<span class="text-danger"> <?php echo form_error('company'); ?>
		
		</span>
	</div>
  </div>	
	
  
  	<div class="form-group">
    <label for="inputphone" class="col-sm-2 control-label">	Phone <span style="color:red;">*</span></label>
    <div class="col-sm-10">
	
		  		<input type="text" name="phone"   minlength="12"	maxlength="14"   value="<?php echo set_value('phone'); ?>" class="form-control" required placeholder="Enter phone e.g 254712345678">
		 
				
		<span class="text-danger"> e.g 254712345678 <?php echo form_error('phone'); ?>
		
		</span>
	</div>
  </div>
  
   	<div class="form-group">
    <label for="inputphoneaddress_1" class="col-sm-2 control-label">Card Number/ Phone 2	 </label>
    <div class="col-sm-10">
	
		  		<input type="text" name="address_1" value="<?php echo set_value('address_1'); ?>" class="form-control"  placeholder="Enter Card Number/ Phone 2">
		 
				
		<span class="text-danger"><?php echo form_error('address_1'); ?>
		
		</span>
	</div>
  </div>
  
  			
							
						
			
  	<div class="form-group">
    <label for="inputidno" class="col-sm-2 control-label">	ID Number				 </label>
    <div class="col-sm-10">
	
		  		<input type="text" name="idno" value="<?php echo set_value('idno'); ?>"  class="form-control"  placeholder="Enter idno if any ">
		 
				
		<span class="text-danger"> <?php echo form_error('idno'); ?>
		
		</span>
	</div>
  </div>
  
    	<div class="form-group">
    <label for="inputidnumber" class="col-sm-2 control-label">	PIN  Number 	 	 </label>
    <div class="col-sm-10">
	
		  		<input type="text" name="idnumber" value="<?php echo set_value('idnumber'); ?>"   minlength="11"	maxlength="14"  class="form-control"  placeholder="Enter Campany Pin">
		 
				
		<span class="text-danger"> <?php echo form_error('idnumber'); ?>
		
		</span>
	</div>
  </div>
  
  
   	<div class="form-group">
    <label for="inputphonegender" class="col-sm-2 control-label">Contact	Gender	 </label>
    <div class="col-sm-10">
	
	<select class="form-control" name="gender" >
	
	<option value=""  >---Select Gender---</option>
	<option value="female"  >female</option>
		<option value="male"  >male</option>
	</select>		 
				
		<span class="text-danger"> <?php echo form_error('gender'); ?>
		
		</span>
	</div>
  </div>
   <div class="form-group">
    <label for="inputcountry" class="col-sm-2 control-label">Country?</label>
    <div class="col-sm-10">
	<select class="form-control" name="country" >
	


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


if(is_array($mycountry)) {

   foreach($mycountry as $mycountryrow){

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



	<?php

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

	</div>
  </div>
  
  
  
  
    	<div class="form-group">
    <label for="inputemail" class="col-sm-2 control-label">	Email </label>
    <div class="col-sm-10">
	
		  		<input type="email" name="email" value="<?php echo set_value('email'); ?>" class="form-control"  placeholder="Enter Your email">
		 
				
		<span class="text-danger"> <?php echo form_error('email'); ?>
		
		</span>
	</div>
  </div>
  
  	
  
  
     
  
  
  
  
    
  	<div class="form-group">
    <label for="inputcity" class="col-sm-2 control-label">	City 	 </label>
    <div class="col-sm-10">
	
		  		<input type="text" name="city" value="<?php echo set_value('city'); ?>" class="form-control"  placeholder="Enter City or town">
		 
				
		<span class="text-danger"> <?php echo form_error('city'); ?>
		
		</span>
	</div>
  </div>
  
  
  
 
  
 
  
  	<div class="form-group">
    <label for="inputentrydate" class="col-sm-2 control-label">	Entry date  	 </label>
    <div class="col-sm-10">
	
		  		<input type="text" name="entrydate" value="<?php echo set_value('entrydate'); ?>" class="form-control"  placeholder="Enter Entry date">
		 
				
		<span class="text-danger"> <?php echo form_error('entrydate'); ?>
		
		</span>
	</div>
  </div>
  
  
   	<div class="form-group">
    <label for="inputzip" class="col-sm-2 control-label">	Due Date </label>
    <div class="col-sm-10">
	
		  		<input type="text" name="zip" value="<?php echo set_value('zip'); ?>" class="form-control"  placeholder="Enter Due Date">
		 
				
		<span class="text-danger"> <?php echo form_error('zip'); ?>
		
		</span>
	</div>
  </div>
  
  
  
   	<div class="form-group">
    <label for="inputwebsite" class="col-sm-2 control-label">Renewal	Comments /Website	 </label>
    <div class="col-sm-10">
	
		  		<input type="text" name="website" value="<?php echo set_value('website'); ?>" class="form-control"  placeholder="Enter Comments if any">
		 
				
		<span class="text-danger"> <?php echo form_error('website'); ?>
		
		</span>
	</div>
  </div>
  
    
	
	  	<div class="form-group">
    <label for="inputsalesperson" class="col-sm-2 control-label">	Sales Person 	 </label>
    <div class="col-sm-10">
	
		  		<input type="text" name="salesperson" value="<?php echo set_value('city'); ?>" class="form-control"  placeholder="Enter sales person">
		 
				
		<span class="text-danger"> <?php echo form_error('salesperson'); ?>
		
		</span>
	</div>
  </div>
	
  
  
  
  
  
  
  
  
  
	<div class="form-group">
    <label for="inputcomments" class="col-sm-2 control-label">	Description</label>
    <div class="col-sm-10">

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

	

	
	 <div class="form-group">

    <div class="col-sm-offset-2 col-sm-10">
     
	         <button type="submit"  value="member" name="btn_addmember" class="btn btn-primary"> Add Campany   </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">View 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'));

                 echo form_open('' , array('class' => 'form-horizontal form-groups-bordered validate', 'enctype' => 'multipart/form-data'));
				 if(validation_errors()):?>
<div class='alert alert-danger text-center'><?php echo validation_errors(); ?></div>
<?php endif;?>
<input type="hidden" name="view" value="user/viewwholesales" class="form-control" required placeholder="Enter view">
<input type="hidden" name="branch" value=""id="branch1" class="form-control" required placeholder="Enter branch1">

<input type="hidden" name="productid" value=""id="productid1" class="form-control" required placeholder="Enter productid">
		<!--<input type="hidden" name="page" value="<?php echo $page ?>"id="page" class="form-control" required placeholder="Enter bookid">
-->
	<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="code1" readonly 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="name1" 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') ;?>"  id="shortname1" 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" id="status1"required>
	
	<option value="" selected></option>
		<option value=""  >---Select Status---</option>
		<option value="active"  >Active</option>
		<option value="inactive"  >Inactive</option>
		<option value="global"  >Global</option>

	

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

	</div>
  </div>
 

   <div class="form-group">
    <label for="inputproducttype" class="col-sm-2 control-label">Inventory Type?</label>
    <div class="col-sm-10">
	<select class="form-control" name="producttype"  id="producttype1" required>
	
		<option value="" selected="selected"  ></option>
		<option value="Inventory"  >Inventory</option>
		<option value="None Inventory"  >None Inventory </option>
		<option value="Service"  >Service</option>

	

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

	</div>
  </div>
  
  
  
  
  
  
  
  

     <div class="form-group">
    <label for="inputcategory" class="col-sm-2 control-label">Category?</label>
    <div class="col-sm-10">
	<select class="form-control" name="category" id="category1"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="supplier1" 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="buyingprice1" 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="sellingprice1" 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="wholesaleprice1" 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="promoprice1" 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="description1"  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="reorderevel1"  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="orderamount1" 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_included1" 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="store1" 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="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">

    <div class="col-sm-offset-2 col-sm-10">
     <!--
	         <button type="submit"  value="myproduct" name="btn_updateproductsales" class="btn btn-primary"> Update Product   </button>
-->
    </div>
  </div>
  					<?php echo form_close();?>
			</div>							   
				
									
							
								
			<div class="modal-footer">

    

				</div>

		</div>
	    </div>
    </div>
			
			
			<div id="mydeleteModal" 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">Cancel</h4>
      </div>
      <div class="modal-body">
        <h3>Are you sure you want to Cancel 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/cancelsoldeproducts' , 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="mycancelview" name="view" class="view" placeholder="view" value="user/viewwholesales?productcategory=<?php if(isset($productcategory)) {echo $productcategory; }?>"><br>
 <input type="hidden" id="mycancelview" name="type" class="type" placeholder="type" value="wholesale"><br>

 <input type="hidden" id="myproductid" name="transactionid" class="myproductid" placeholder="myproductid" value=""><br>
 <input type="hidden" id="salesids"name="randomitemidentifier" class="salesids" placeholder="salesids" value=""><br>
 <input type="hidden" id="productcategory"name="productcategory" class="productcategory" placeholder="productcategory" value=""><br>
  
    <div class="form-group">
    <label for="inputregno" class="col-sm-2 control-label">Enter Password</label>
    <div class="col-sm-10">
			  		<input type="password" name="password"  value="<?php echo set_value('password'); ?>"id="password" class="form-control" required placeholder="password">


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

	</div>
  </div>
 <button type="button" class="btn btn-success" data-dismiss="modal">Don't Cancel</button>
 		  	         <button type="submit" name="btn_deletesales" value="solditems" class="btn btn-danger"> Cancel Transaction  </button>

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

  </div>

  </div>


	<div id="mysuspendModal" 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">Suspend all current transactions</h4>
      </div>
      <div class="modal-body">
        <h3>Are you sure you want to Suspend all current transactions ? </h3>
      </div>
      <div class="modal-footer">
	  	

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

		
                 echo form_open('user/suspendsalesmade' , 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"  name="view" class="view" placeholder="view" value="user/viewwholesales?productcategory=<?php if(isset($productcategory)) {echo $productcategory; }?>"><br>
 <input type="hidden"  name="type" class="type" placeholder="type" value="wholesale"><br>

 <input type="hidden"  name="randomitemidentifier" class="salesids" placeholder="salesids" value="<?php   {echo  $salesid;}  ?>"><br>
  
    <div class="form-group">
    <label for="inputregno" class="col-sm-2 control-label">Enter Password</label>
    <div class="col-sm-10">
			  		<input type="password" name="password"  value="<?php echo set_value('password'); ?>"id="password" class="form-control" required placeholder="password">


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

	</div>
  </div>
 <button type="button" class="btn btn-success" data-dismiss="modal">Don't Cancel</button>
 		  	         <button type="submit" name="btn_suspendallsales" value="allsolditems" class="btn btn-danger"> Suspend all Transactions  </button>

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

  </div>




















