<?php session_start();
include("connection.php");
error_reporting(E_ERROR | E_PARSE);
if($_SESSION["user_id"]==true) {
} else {?><script> window.location.href='login/'; </script> <?php } 
$pagename = basename($_SERVER['PHP_SELF']);
if($_REQUEST["id"]!="") {
$id=$_REQUEST["id"];
$bill_no=$_REQUEST["bill_no"];
$st= $_REQUEST["shop_type"];
$tn= $_REQUEST["t_no"]; 
mysqli_query($con,"delete  from onshop where `id`='".$id."'");
 $bill_no=$_REQUEST["bill_no"];
$checks=mysqli_query($con,"select * from onshop where `bill_no`='".$bill_no."'");

$checkn=mysqli_num_rows($checks);
if($checkn=="0") {
   $bill_count=mysqli_query($con,"select * from bill_count"); 
   $bill_count_r=mysqli_fetch_array($bill_count,MYSQLI_ASSOC);
   $last_bill_no=$bill_count_r["no"];
   $last_bill_no=$last_bill_no-1;
   mysqli_query($con,"update bill_count set `no`='".$last_bill_no."' where `id`='1'");
   ?>
<script>
window.location.href="?shop_type=onshop";
</script>
<?php 
    
} else {
    ?>
<script>
window.location.href="?bill_no=<?php echo $bill_no; ?>&type=1&shop_type=<?php echo $st; ?>&t_no=<?php echo $tn; ?>";
</script>
<?php 
    
} 

}
 
 if($_REQUEST["shop_type"]=="") {?> <script>window.location.href="index.php?shop_type=onshop";</script> <?php  } else { } 

 $bill_no=$_REQUEST["bill_no"];


 $bill=mysqli_query($con,"select * from onshop where `bill_no`='".$bill_no."' and `status`='active'  "); $billr=mysqli_fetch_array($bill,MYSQLI_ASSOC);
  $billn=mysqli_num_rows($bill);

?>

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<!-- /Added by HTTrack --><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<!--
<link type="text/css" rel="stylesheet" href="javax.faces.resource/themeab55.css?ln=primefaces-aristo" />
<link type="text/css" rel="stylesheet" href="javax.faces.resource/dist-butterfaces-bootstrap.min4e5d.css?ln=butterfaces-dist-css" />
-->
<link type="text/css" rel="stylesheet" href="javax.faces.resource/css/default.css" />
<link type="text/css" rel="stylesheet" href="javax.faces.resource/css/cssLayout.css" />
<link type="text/css" rel="stylesheet" href="javax.faces.resource/css/bootstrap.css" />
<link type="text/css" rel="stylesheet" href="javax.faces.resource/css/bootstrap.min.css" />
<link type="text/css" rel="stylesheet" href="javax.faces.resource/css/popup.css" />
<link type="text/css" rel="stylesheet" href="javax.faces.resource/css/menu.css" />
<!--
<script type="text/javascript" src="javax.faces.resource/butterfaces-all-with-jquery-and-bootstrap-bundle.min686a.js?ln=butterfaces-dist-bundle-js"></script>
<script type="text/javascript" src="javax.faces.resource/js/jquery-3.4.0.min.js"></script>
<script type="text/javascript" src="javax.faces.resource/js/bootstrap.js"></script>
<script type="text/javascript" src="javax.faces.resource/js/jquery-1.11.2.js"></script>
<script type="text/javascript" src="javax.faces.resource/js/jssor.slider-27.5.0.min.js"></script>
<script type="text/javascript" src="javax.faces.resource/jquery8490.js?ln=js"></script>
<script type="text/javascript" src="javax.faces.resource/menu8490.js?ln=js"></script>
<script type="text/javascript" src="javax.faces.resource/js/canvasjs.min.js"></script>
        
  -->     
        <script type="text/javascript">
            $(function() {
                $('ul.nav li.dropdown').hover(function() {
                    $(this).find('.dropdown-menu').stop(true, true).delay(100).fadeIn(500);
                }, function() {
                    $(this).find('.dropdown-menu').stop(true, true).delay(100).fadeOut(500);
                });
            });
        </script>
        <script type="text/javascript">
            $(function() {
                $("#notice").fadeIn("slow").append('');
                $(".dismis").click(function() {
                    $("#notice").fadeOut("slow");
                });
            });
        </script>
		
<script>
function lfn_SelectSection(p_Class)
    {
        document.getElementById('cusname').disabled=false;
		
  
        $.ajax({
		
                    type: "GET",
                    url: "ajax_location.html?classID=" + p_Class,
                    success: function(state) {
                    document.getElementById('cusname').innerHTML=state;    
					
                    }
        });
		
	 
		
		
    }

</script>
<style> 
        input.largerCheckbox { 
            width: 20px; 
            height: 20px; 
			
        } 
    </style> 
        <title>MAGNOLIA</title></head><body >

        <div id="top" style="background-color:#FF0000">


                    <div class="container-fluid text-center" style="margin-left: 5px"> 
                        <div class="row">
                            <div class="col-sm-1">
							<!-- Logo -->
							
							
                            </div>                           
                                       
                           
                        </div>
                    </div>

                    <!-- Menu start  -->

                    <nav class="navbar navbar-expand-lg header-m" role="navigation">
                        <div class="container-fluid">
                            <div class="navbar-header">
                                <button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1">
                                    <span class="sr-only">Toggle navigation</span>
                                    <span class="icon-bar" style="background-color: #fff;"></span>
                                    <span class="icon-bar" style="background-color: #fff;"></span>
                                    <span class="icon-bar" style="background-color: #fff;"></span>
                                </button>
                                <a class="navbar-brand" href="#"></a>
                            </div>

                            <!-- Collect the nav links, forms, and other content for toggling -->
                            <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
                               
							   <?php include("include/header.php"); ?>
							    
                            </div>

                            <!-- /.navbar-collapse -->
                        </div>
                        <!-- /.container-fluid -->
                    </nav>

        </div>






        <div id="content" class="center_content " >

                    <div class="container-fluid text-center">    
                        <div class="row">
                            <div class="col-sm-2" style="padding-right: 0px;">
							
                               <?php include("include/left.php"); ?>    

                                </div>

                            </div>











                            <div class="col-sm-8" style="padding-right: 2px; padding-left:2px; ">

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

                                        <div class="panel panel-primary" style="background-color: rgb(186,233,254);border: 1px solid #000; margin-bottom: 0px;  ">
                                            <div class="panel-heading" style="font-size: 20px; font-family: serif; background-color: #007de8; color:#CCFF00"> <b>MAGNOLIA</b></div>
                                            <div class="panel-body" style="text-align: justify;padding-bottom: 0px; padding-top: 6px;"><p style="font-family: Cambria;"><strong>
					 
					 <form class="col-sm-12" name="frm" id="frm" method="POST" enctype="multipart/form-data" autocomplete="off">
					 <table  style="width:100%" border="0">
					 <tr>
					 <?php // $l=mysqli_query($con,"select * from bill_count "); 
					 $l=mysqli_query($con,"SELECT MAX(bill_no) as bn FROM onshop");
					 $lr=mysqli_fetch_array($l,MYSQLI_ASSOC);  // echo $lr["id"];?>

					   <td colspan="4" align="right"> Bill No &nbsp; </td>
					   <td> 
					   <!--<a href="index.php"><img src="logo_.png" width="52"></a>&nbsp;&nbsp;&nbsp;&nbsp;<input type="radio" class="largerCheckbox" name="shop" id="onshop" value="onshop" <?php if($_REQUEST["shop_type"]=="onshop" OR  $_REQUEST["shop_type"]==""  ) { ?> checked="checked" <?php } else { } ?> onClick="onshop_();"  <?php if($billr["shop_type"]=="offshop"   ) { ?> disabled="disabled" <?php } else { } ?>    >  
					   <img src="os.png" width="100" height="35"> 
					   <input type="radio" class="largerCheckbox" name="shop" id="offshop" value="offshop" style="visibility:hidden; display:none" <?php if($_REQUEST["shop_type"]=="offshop" ) { ?> checked="checked" <?php } else { } ?>  <?php if($billr["shop_type"]=="onshop"   ) { ?> disabled="disabled" <?php } else { } ?>   onClick="offshop_();" >    <input type="radio" class="largerCheckbox" name="shop" id="parcel" value="parcel" <?php if($_REQUEST["shop_type"]=="parcel" ) { ?> checked="checked" <?php } else { } ?>  <?php if($billr["shop_type"]=="parcel"   ) { ?> disabled="disabled" <?php } else { } ?>   onClick="parcel_();" >  <img src="per.png" width="100" height="35">
					   -->
					   <input type="text" style=" width:100px; height:29px;" value="<?php if($_REQUEST['bill_no']!='') { echo $_REQUEST["bill_no"]; } else { //echo date('Y'); ?><?php echo $lr["bn"]+1; } ?>" name="bill_no" <?php if($billn >="1") { ?> disabled="disabled" <?php } else { }?> id="bill_no" >&nbsp; 
					   <input type="date" style=" width:120px; height:29px;" name="bill_date" id="bill_date"  value="<?php if($_REQUEST['bill_date']!='') { echo $_REQUEST['bill_date']; } else { 
					      if($billn >="1") { echo $billr['bill_date']; } else { echo date('Y-m-d');  } } ?>" >
					 
					   </td>
					 </tr>
					 <script>
					 function onshop_() {
					 var v=document.getElementById("onshop").value;
					  window.location.href="index.php?shop_type="+v;
					 }
					 function parcel_() {
					 var v=document.getElementById("parcel").value;
					  window.location.href="index.php?shop_type="+v;
					 }
					 </script>
					  <script>
					 function offshop_() {
					 var v=document.getElementById("offshop").value;
					  window.location.href="index.php?shop_type="+v;
					 }
					 </script>
					 <tr>
					  <td height="58" style="width:20%; " ><a href="index.php"><img src="logo.png" width="120" height="75"></a>
					 <select name="t_no" id="t_no" tabindex="1" class="form-control" style="width:95%; display: none" <?php if($_REQUEST["shop_type"]=="offshop" OR $_REQUEST["shop_type"]=="parcel" OR $_REQUEST["t_no"]!="" OR $_REQUEST["type"]=="1" ) { ?> disabled="disabled" <?php } else { }?>  onChange="en_product();" >
					  <?php if($_REQUEST["t_no"]=="") { ?>
							<option value="0" style=" background-color:#FFFF66; font:bold; ">Select Chair No</option>
							
							<option value="1" style=" background-color:#FFFF66; font:bold; ">1</option>
							<option value="2" style=" background-color:#FFFF66; font:bold; ">2</option>
							<option value="3" style=" background-color:#FFFF66; font:bold; ">3</option>
							<option value="4" style=" background-color:#FFFF66; font:bold; ">4</option>
							<option value="5" style=" background-color:#FFFF66; font:bold; ">5</option>
							<option value="6" style=" background-color:#FFFF66; font:bold; ">6</option>
							<option value="7" style=" background-color:#FFFF66; font:bold; ">7</option>
							<option value="8" style=" background-color:#FFFF66; font:bold; ">8</option>
							<option value="9" style=" background-color:#FFFF66; font:bold; ">9</option>
							<option value="10" style=" background-color:#FFFF66; font:bold; ">10</option>
							<option value="11" style=" background-color:#FFFF66; font:bold; ">11</option>
							<option value="12" style=" background-color:#FFFF66; font:bold; ">12</option>
							
							 <?php }
							else { ?>
							<option value="<?php echo $_REQUEST["t_no"]; ?>" style=" background-color:#FFFF66; font:bold; "><?php echo $_REQUEST["t_no"]; ?></option>
							<?php } ?>
							
					 </select>
					</td>
					<td style="width:1%;"></td>
					<td style="width:40%;" colspan="2">
					<b>Product Name</b> <?php $p_id=$_REQUEST["p_id"]; $pn=mysqli_query($con,"select `product_name`,`price` from product where `id`='".$p_id."'");
					$pnr=mysqli_fetch_array($pn,MYSQLI_ASSOC); ?>
					 <input type="text" name="p_no" id="product" autofocus   style="width:99%;" class="form-control" list="cus" onChange="refx();" placeholder="Type Product Name " value="<?php echo $pnr['product_name']; ?>" <?php if($_REQUEST["shop_type"]=="onshop" AND $_REQUEST["t_no"]=="" AND $_REQUEST["type"]!="1" ) { ?> <?php } else { }?>   >
					<datalist id="cus">

<?php 

$p_id=$_REQUEST["p_id"];  $p=mysqli_query($con,"select * from product where `status`='active' and `category` !='Kitchen' order by product_name"); while($pr=mysqli_fetch_array($p,MYSQLI_ASSOC)) { ?>
  <option <?php if($pr["id"]==$p_id) { ?> selected="selected" <?php } else { }?> style="background-color:#FFCCFF" value="<?php echo $pr['product_name']; ?>"><b><?php //echo $pr["product_name"]; ?> [ Mrp : <?php echo $pr['mrp2']; ?> / Pur. <?php echo $pr['mrp']; ?> / Sell. <?php echo $pr['price']; ?> ]</b></option> 
<?php } ?>
</datalist>    
					
					
					
					
					<!--  <select name="p_no" id="product" autofocus required   class="form-control" style="width:99%;" onChange="ref();" <?php if($_REQUEST["shop_type"]=="onshop" AND $_REQUEST["t_no"]==""AND $_REQUEST["type"]!="1" ) { ?> <?php } else { }?>  >
				  <option value="0" ><b>Product Name</b></option>
				  <?php $p_id=$_REQUEST["p_id"];  $p=mysqli_query($con,"select * from product where `status`='active' and `category` !='Kitchen' order by product_name"); while($pr=mysqli_fetch_array($p,MYSQLI_ASSOC)) { ?>
				  <option <?php if($pr["id"]==$p_id) { ?> selected="selected" <?php } else { }?> style="background-color:#FFCCFF" value="<?php echo $pr['id']; ?>"><b><?php echo $pr["product_name"]; ?></b></option>
				  <?php } ?>
				</select>	 -->
					</td>
<script>
function en_product() {
//document.getElementById("product").disabled= false
//window.open("table2.php", "_blank", "toolbar=no,scrollbars=yes,resizable=yes,top=20,left=385,width=635,height=650");
 var bn=document.getElementById("t_no").value;
window.location.href="index.php?t_no="+bn+"&shop_type=<?php echo $_REQUEST['shop_type']; ?>"
}
function ref() {
var bn=document.getElementById("bill_no").value;
var bd=document.getElementById("bill_date").value;
var tn=document.getElementById("t_no").value;
var v=document.getElementById("product").value;
var st="<?php echo $_REQUEST['shop_type']; ?>";
window.location.href="index.php?bill_no="+bn+"&bill_date="+bd+"&t_no="+tn+"&p_id="+v+"&shop_type="+st;
//document.getElementById('company').disabled=false;
}
</script>				
<?php 				
if($p_id!="") {  $pp=mysqli_query($con,"select * from product where `status`='active' and `id`='".$p_id."'"); $ppr=mysqli_fetch_array($pp,MYSQLI_ASSOC); } else {  }	
?>			
					
				<td style="width:38%;">
				<!--
					  <select name="company" id="company" class="form-control" style="width:95%;"  <?php if($p_id!=""  ) { ?>  <?php } else { ?>  disabled="disabled" <?php }?>   >
				  <option style=" background-color:#FFFF66; font:bold; font-size:18px;" value="<?php echo $ppr["company"]; ?>"><b><?php echo $ppr["company"]; ?></b></option>
				 
				</select>	 -->
			<!--	<b><br>&nbsp;Photo of the Product : </b>--><br>
				 <input type="number" name="card" id=""   class="form-control" style="width:100px; background-color:#FFCC99" placeholder="Card No." value="<?php echo $billr['card_no']; ?>" >  </td>
			 
				<input type="text" name="unit" value="<?php echo $ppr["unit"]; ?>" style="visibility:hidden; display:none"> 
					</td>	
					 </tr>
					 				 
					 
			<tr>		
			<td height="55" >
			<b>Price :</b>
			  <input type="hidden"   class="form-control" style="width:95%;" value="<?php if($_REQUEST["shop_type"]=="parcel") { echo $ppr['parcel_price']; } else { echo $ppr['price']; } ?>" <?php if($p_id !=""  ) { ?>  <?php } else { ?> disabled="disabled"  <?php }?> >
			<input type="text" name="price" onKeyUp="calval3();"   class="form-control" style="width:95%;" id="d_p" value="<?php if($_REQUEST["shop_type"]=="parcel") { echo $ppr['parcel_price']; } else { echo $ppr['price']; } ?>" <?php if($p_id !=""  ) { ?>  <?php } else { ?>   <?php }?> >	
		<input type="text" name="mrp_p" value="<?php echo $ppr['mrp']; ?>" style="width:95%; display:none" >
		<input type="text" name="pro_type" value="<?php echo $ppr['category']; ?>" style="width:95%; display:none" >
			</td>
			<td >
			
			</td>
			<td style="width:10%; " > 
			 <b>Qnty :</b>
			  <input type="number" name="qnty" id="qnty" value="1"  onKeyUp="calval3();" class="form-control" style="width:90%;" <?php if($pr["id"]==$p_id) { ?> <?php } else { ?>   <?php }?> required >  </td>
			  <td > <?php if($ppr["peg"]=="yes" and ($_REQUEST["shop_type"]=="onshop" or $_REQUEST["shop_type"]=="parcel" )) { ?><?php } else { } ?><font color="#0000FF">Amount :  </font><font color="#990000"  ></font><input type="text" value="<?php echo $ppr['price']; ?>" name="t_val" id="t_val"  style="width:65px; background-color:#FFFF99; "   <?php if($ppr["peg"]=="yes") { ?>  <?php } else { ?> class="form-control" <?php } ?> >
			  
			
	<script>		  
	 
	  function calval2() {
	    var q=document.getElementById("qnty").value;
	   var bn2=document.getElementById("bottle").value;
	   
	   document.getElementById("d_p").value=bn2;
	   
	   var t= bn2*q;
	   document.getElementById("t_val").value=t;
	 // document.getElementById("t_amount").value=t;
	  }	
	   function calval3() {
	    var q=document.getElementById("qnty").value;
	   var bn2=document.getElementById("d_p").value;
	   var t= bn2*q;
	   document.getElementById("t_val").value=t;
	
	 }
	  function customers() {
	  /*  var q=document.getElementById("abc").value;
		var n = q.length;
		var nn=n-10;
	  var res = q.substring(nn, n);
	 
	   document.getElementById("phone").value=res; */
	   
	   var name=document.getElementById("abc").value;

var arrName = name.split("/");
var firstName = arrName.slice(0, 1).join(' ');
var lastName = arrName.slice(1, arrName.length).join(' ');
/*
  document.getElementById("d_p").value=firstName;
  document.getElementById("peg_vol").value=lastName;
  
  
  
   var q=document.getElementById("qnty").value;
	   var bn2=document.getElementById("d_p").value;
	   var t= bn2*q; */
	   document.getElementById("phone").value=lastName;
	    document.getElementById("c_name").value=firstName;
	   
	   
	   
	   
	   
	
	 
	  }		 	 	  
	</script>		 
			</td>
			
		<!-- Do <img src="not.png" style="width:30%; "> -->	
	<td rowspan="3"> <?php if($ppr["quantity"] <=0 ) { ?> <img src="<?php if($ppr['photo']!="") { echo $ppr['photo']; } else { ?> logo.png  <?php } ?>" style="width:70%; "> <?php   } else {?>
			<img src="<?php if($ppr['photo']!="") { echo $ppr['photo']; } else { ?> not.png  <?php } ?>" style="width:30%; ">
			
			 <font color="#6633FF"> &nbsp;<!-- <a href="update_product.php?id=<?php echo $_REQUEST['p_id']; ?>"><img src="edit.png" width="6%"></a> --> 
			 <?php if($ppr['category']=="Food") { ?>Stock not avail for Food Item <?php  } else { ?>
			 Stock : <?php echo $ppr["quantity"]; ?></font><br> <font color="#FF0000" style="text-decoration:blink"><!-- Running Low --></font> 
		 <?php } ?>
			
				
			<?php } ?>
			</td> 	
			
			
			
					
			</tr>


		
			
<script>
function pegval() {
 

 var name=document.getElementById("pv").value;

var arrName = name.split(" ");
var firstName = arrName.slice(0, 1).join(' ');
var lastName = arrName.slice(1, arrName.length).join(' ');

  document.getElementById("d_p").value=firstName;
  document.getElementById("peg_vol").value=lastName;
  
  
  
   var q=document.getElementById("qnty").value;
	   var bn2=document.getElementById("d_p").value;
	   var t= bn2*q;
	   document.getElementById("t_val").value=t;
 
}
</script>			
						
<!--									
			<tr >		
			<td height="63"  colspan="3">
			<b>Customer Name :</b>
			  <input type="text" name="cus_name" id="abc" class="form-control" style="width:95%;" list="cus" autocomplete="off" onChange="customers();" value="<?php echo $billr['cus_name']; ?>" required  >
				<datalist id="cus">
<?php $cl=mysqli_query($con,"select cus_name,phone from onshop GROUP BY `cus_name` ORDER BY `id` ASC "); while($clr=mysqli_fetch_array($cl,MYSQLI_ASSOC)) { ?>
  <option value="<?php echo $clr['name']; ?>"> (Ph. No. <?php echo $clr['phone']; ?>)</option>
<?php } ?>
</datalist>  
			</td>
			
			
			<td>
			<b>Phone No. :</b>
			  <input type="text" name="phone" id="phone" class="form-control" style="width:95%;" value="<?php echo $billr['phone']; ?>" >  
			</td>		
			<!--	<td> <?php if($ppr["peg"]=="yes") { ?> Peg Value = <?php echo $ppr["peg_value"]; ?> <?php } else { }?>  </td> 
				
			</tr> -->
			
		
			
			

	<tr>		
			<td height="52"  >
	
			<b>Customer Name :</b>
			  <input type="text" name="cus_name" id="abc" class="form-control" style="width:95%; height:30px" list="cust" autocomplete="off" onChange="customers();" value="<?php echo $billr['cus_name']; ?>"   >
				<datalist id="cust">
<?php $cl=mysqli_query($con,"select cus_name,phone from onshop GROUP BY `cus_name` "); while($clr=mysqli_fetch_array($cl,MYSQLI_ASSOC)) { ?>
  <option value="<?php echo $clr['cus_name']; ?> / <?php echo $clr['phone']; ?>"> </option>
<?php } ?>
</datalist>  
<input type="text" name="c_name" id="c_name" style="display:none" >
			</td>
			
			
			<td>	
			
			</td>
			<td colspan="2">
			<b>Phone No. :</b>
			  <input type="text" name="phone" id="phone" class="form-control" style="width:55%; height:30px" value="<?php echo $billr['phone']; ?>" >
		 
			</td>
				
		
			
			</tr>		


	















	
	
		
						
	<tr>		
			<td height="52"  >
<?php if($billr['paid_status']=="paid") {?>  <input type="submit" class="form-control" style="width:95%; background-color:#FF9900; color:#000000" disabled="disabled" > <?php } else {?>
			  <input type="submit" name="ok" value="Add" class="form-control" style="width:95%; background-color:#FF9900; color:#000000" >
	<?php }?>			
			</td>
			
			
			<td>
			
			</td>
			<td colspan=""> 
			<?php if($_REQUEST["t_no"]=="") { ?>
			<input type="submit" name="find_detail" class="form-control" style="width:95%; background-color:#6633FF; color:#FFFFFF " value="Find Now" > 
			<?php } else {?>  <input type="submit" name="find_detail" class="form-control" style="width:95%; background-color:#6633FF; color:#FFFFFF; " disabled="disabled" value="Find Now" >  <?php } ?>
			
			<script>
			function f_reset() {
			window.location.href="index.php";
			}
			</script>
			</td>
			<td></td>		
			<td> </td>	
			
			</tr>					
			
			
			
				 
					 </table>
					 
</form>
<?php   if(isset($_POST["find_detail"])) {
 $bill_no=$_REQUEST["bill_no"];
$f=mysqli_query($con,"select * from onshop where `bill_no`='".$bill_no."' and `status`='active'"); $fr=mysqli_fetch_array($f,MYSQLI_ASSOC); $frn=mysqli_num_rows($f);
$st= $fr["shop_type"];
$tn= $fr["table_no"]; ?>
<script>
window.location.href="?bill_no=<?php echo $bill_no; ?>&status=1&shop_type=<?php echo $st; ?>&t_no=<?php echo $tn; ?>";
</script><?php 
}
   if(isset($_POST["ok"]))
        {
		  $bill_no=$_REQUEST["bill_no"];
		  $bill_date=$_REQUEST["bill_date"];
		  $t_no=$_REQUEST["t_no"];
		  $product_id=$_POST["p_no"];
		  $product_name=$ppr["product_name"];
		  $company=$_POST["company"];
		  $price=$_POST["price"];
		  $mrp_p=$pplr["mrp"];
		   $qnty=$_POST["qnty"];
		  $type=$_POST["ch_radio"];
		  //$type=$_POST["qnty"];
		 /* $cus_name=$_POST["cus_name"];
		  $a=strlen($cus_name);
		  $a=$a-12;
		  $cus_name=substr($cus_name,0,$a);*/
		  $cus_name=$_POST["c_name"];
		   $phone=$_POST["phone"];
		    $unit=$_POST["unit"];
		    $card_no=$_POST["card"];
		  $total=$qnty*$price;
		  $peg_bottle=$_REQUEST["shop_type"];
		 $peg_vol=$_POST["peg_vol"];
		  $waiter=$_POST["waiter"];
		   $advance=$_POST["advance"];
		   //$due=$_POST["due_amount"];
		   $pro_type=$_POST["pro_type"];
		   $token=rand(11111,99999);
		  
		   if( ($t_no=="0" or $product_id=="" or $qnty=="" or ($peg_vol=="" and $shop_type=="onshop")) and $_REQUEST["shop_type"]=="onshop" and $_POST["peg_yes_no"]=="yes" ) { ?>
<script>alert("Something went wrong");
window.location.href="index.php";</script><?php } else { 
		   
		 $f=mysqli_query($con,"select `id` from onshop where `bill_no`='".$bill_no."' and `status`='active'"); $fr=mysqli_fetch_array($f,MYSQLI_ASSOC); $frn=mysqli_num_rows($f);
		  mysqli_query($con,"insert into onshop (`bill_no`,`bill_date`,`table_no`,`product_id`,`product_name`,`company`,`price`,`qnty`,`total`,`cus_name`,`phone`,`created_by`,`paid_status`,`bill_status`,`status`,`peg_bottle`,`unit`,`shop_type`,`peg_volume`,`waiter`,`advance`,`mrp`,`product_type`,`card_no`) values('".$bill_no."','".$bill_date."','".$t_no."','".$product_id."','".$product_id."','".$company."','".$price."','".$qnty."','".$total."','".$cus_name."','".$phone."','','unpaid','pending','active','".$type."','".$unit."','".$peg_bottle."','".$peg_vol."','".$waiter."','".$advance."','".$mrp_p."','".$pro_type."','".$card_no."')"); 

if($frn=="0") {
$q=mysqli_query($con,"select * from bill_count"); $qr=mysqli_fetch_array($q,MYSQLI_ASSOC);
		  $b_n=$qr["no"];
		  $b_n=$b_n+1;
   mysqli_query($con,"update bill_count set `no`='".$b_n."' where `id`='1'");	
} else {}	
		  
?>
<script>
//alert("Added Successfully");
window.location.href="index.php?bill_no=<?php echo $bill_no; ?>&type=1&shop_type=<?php echo $peg_bottle; ?>&t_no=<?php echo $_REQUEST['t_no']; ?>";</script><?php 		 
		
 } 		  
		  
		} ?>
<?php if($billn>0) { ?>		
		<p>&nbsp;<?php echo $_REQUEST["shop_type"]; ?> Product List </p> 	
		<form method="post">		 	
<table style="width:100%; background-color:#FFFFCC" border="1"	>
<tr style="height:35px; background-color:#CC99FF">
<td align="center">Sl No.</td><td align="center">Bill No.</td>
<td align="center">Product Name</td>
<!--<td align="center">Company name</td>--><td align="center">Qunty</td><!--<td align="center">Unit</td>-->
<td align="center">Price</td><td align="center">Total</td><td align="center">Action</td>
</tr>
<?php $tx=0; $b=mysqli_query($con,"select * from onshop where  `bill_no`='".$bill_no."'  "); $i=1; while($br=mysqli_fetch_array($b,MYSQLI_ASSOC)) { ?>
<tr style="height:20px;">
<td align="center" style="height:25px;"><?php echo $i; ?></td>
<td align="center"><?php echo $br["bill_no"]; ?></td>
<td >&nbsp;<?php echo $br["product_name"];  ?></td>
<!--<td ><?php echo $br["company"]; ?></td>-->
<td >&nbsp;<?php echo $br["qnty"]; ?> <?php //echo $br["peg_volume"]; ?> <?php //echo $br["unit"]; ?></td>
<!--<td ><?php if($br["peg_bottle"]=="peg") { echo "peg"; } else { echo $br["unit"]; } ?></td>-->
<td align="center"><?php echo $br["price"]; ?></td>
<td align="center"><?php echo $x=$br["total"]; $tx=$tx+$x; $pb=$br["payable"]; ?></td>
<td align="center">
<?php $ps=$br["paid_status"]; if($ps!="paid") { ?>
<a href="?id=<?php echo $br['id']; ?>&bill_no=<?php echo $_REQUEST['bill_no']; ?>&shop_type=<?php echo $br['shop_type']; ?>&t_no=<?php echo $br['table_no']; ?>" onClick="return confirm('Are you sure you want to delete this item?');"><img src="del.png" width="20"></a>
<?php } else {} ?>
</td>
</tr>
<?php $i++; $ps=$br["paid_status"]; $ad=$br['advance']; $gross_amount=$br['discount']; $payb=$br["payable"]; $c_charge=$br["cabin_charge"]; } ?>

<tr><td height="33" colspan="6" align="right"><?php if($_REQUEST["shop_type"]=="parcel") { ?> Parcel Cost <?php  } else { ?> <input type="radio" name="a_r" value="Cabin / AC Charge" checked="checked"> Extra Cost  <?php } ?> : &nbsp;&nbsp;</td>
<td colspan="1">&nbsp; <input type="text" name="cabin_ac" id="cabin_ac" onChange="cabin_ac_charge()" <?php if($_REQUEST["status"]=="1") { ?> value="<?php echo $c_charge; ?>" <?php } else { ?> value="0" <?php } ?> style="width:50px; height:25px;" ></td>
</tr>
<script>
    function cabin_ac_charge() {
       var a=document.getElementById("cabin_ac").value; 
       var b=document.getElementById("price_bd").value; 
       var c=+a + +b;
         document.getElementById("ac_cab").innerHTML=c;
       //  var advance=document.getElementById("disc").value;
        var discount=document.getElementById("dis").value;
        var d=c-discount;
         document.getElementById("price_total").innerHTML=d;
        document.getElementById("price_bd").value=c;
        document.getElementById("price_total2").value=c;
    }
</script>


<tr><td height="33" colspan="6" align="right">Total : &nbsp;&nbsp;</td>
<td colspan="1">&nbsp;<font color="#FF0000" id="ac_cab" ><?php echo $final=$tx; ?> /-</font> <input type="hidden" name="" value="<?php echo $tx; ?>" id="price_bd" > &nbsp;<font size="+1">&#8377;</font></td>

</tr>
<tr><td height="33" colspan="6" align="right">Discount (%) : &nbsp;&nbsp;</td>
<td colspan="2">&nbsp;<input type="text" name=""  style="width:50px; height:25px;" id="dis" onKeyUp="discount();" <?php if($_REQUEST["status"]=="1"){?> value="<?php echo $final-$payb+$c_charge; ?>" disabled="disabled" <?php } else {} ?> > % &nbsp;<input type="hidden" value="1"  id="per" onClick="percen();"  ></td>
</tr>
<tr><td height="33" colspan="6" align="right">Discount : &nbsp;&nbsp;</td>
<td colspan="2">&nbsp;<input type="text" name=""  style="width:50px; height:25px;" id="dis2" onKeyUp="discount2();" <?php if($_REQUEST["status"]=="1"){?> value="<?php echo $final-$payb+$c_charge; ?>" disabled="disabled" <?php } else {} ?> > Rs. &nbsp;<input type="hidden" value="1"  id="per2" onClick="percen2();"  ></td>
</tr>
<tr><td height="33" colspan="6" align="right">Payable : &nbsp;&nbsp;</td>
<td colspan="2" >&nbsp;<font color="blue" id="price_total"><?php if($_REQUEST["status"]=="1") { echo $payb; } else { echo $pb=$tx-$ad; } ?> </font> /- <input type="hidden" id="price_total2" name="pt" value="<?php echo $tx; ?>"  > &nbsp;&nbsp; <input type="checkbox" name="due_amount" id="due_amount" onClick="due_();" > Due Rs. : <input type="text" name="due_amount" id="due" style="width: 55px; display:none;"> &nbsp;<!-- <input type="checkbox" <?php if($_REQUEST["shop_type"]=="offshop") { ?> checked="checked" <?php } else {}?>  ><b> Pay </b> --></td>
</tr>
<tr ><td height="33" colspan="6" align="center"><input type="radio" name="pay_type" value="cash" checked> Cash <input type="radio" name="pay_type" value="online"> Online</td>
<td colspan="3">&nbsp;
<?php if($ps=="paid") { ?> <input type="submit" name="bill_print"  value="Bill Print"  style="width:85px; height:27px; background-color:green; color:#FFFFFF"> 
   <?php } else { ?> 
<input type="submit" name="save" value="Pay Now" style="width:75px; height:27px; background-color:green; color:#FFFFFF"> 
<!--<input type="submit" name="bill_print2"  value="Quitee Print"  style="width:95px; height:27px; background-color:purple; color:#FFFFFF">-->
<?php } ?>
</td>
</tr>
</table>
</form>	

<script>

function discount() {
   var p=document.getElementById("price_bd").value;
   var d=document.getElementById("dis").value;
 // var dis=document.getElementById("disc").value;


  //var tx= p-d;
  var tx=(p - (p*d)/100);
   document.getElementById("price_total").innerHTML=tx;
   document.getElementById("price_total2").value=tx; 
}
function discount2() {
   var p=document.getElementById("price_bd").value;
   var d=document.getElementById("dis2").value;
 // var dis=document.getElementById("disc").value;


  //var tx= p-d;
  var tx=(p - d);
   document.getElementById("price_total").innerHTML=tx;
   document.getElementById("price_total2").value=tx; 
}

function due_() {
	
   
   var v=document.getElementById("due_amount");
	//document.getElementById("due").style.display = "block";
	//alert (""+v);
	if (v.checked == true){
    document.getElementById("due").style.display= "table-cell";
  } else {
    document.getElementById("due").style.display= "none";
  }
	  }



function percen() {
  // var d=document.getElementById("per").value;
  var p=document.getElementById("price_bd").value;
   var d=document.getElementById("dis").value;
   var dis=document.getElementById("disc").value;
   var pp=p-dis;
   var t= (pp*d)/100;
   var tt=pp-t;
   var ttt=Math.round(tt);
    document.getElementById("price_total").innerHTML=ttt;
	  document.getElementById("price_total2").value=ttt;
	  
}
</script>
<!-- <tr><td colspan="7" align="right">Discount : &nbsp;&nbsp;</td><td colspan="2">&nbsp;<input type="text" name="" value="" style="width:70px; height:25px;">  <input type="checkbox" class="largerCheckbox" > </td>
</tr> -->

<?php } else {} ?>				

<?php 
 if(isset($_POST["bill_print"]))
        {
		?><script>window.location.href="bill_print.php?bill_no=<?php echo $bill_no; ?>&page=index";</script>
		
	<?php	}
 if(isset($_POST["bill_print2"]))
  { 
      ?><script>window.location.href="quitee_print.php?bill_no=<?php echo $bill_no; ?>&page=index";</script><?php 
  }

 if(isset($_POST["save"]))
  { 
		 $pt=$_POST["pt"];
		 $point=($pt*5/100);
		 $credit_point=round($point);
		 $point_amount=$point/2;
		 $credit_amount=round($point_amount);
		 $card_no=0;
		 $cabin_ac=$_POST["cabin_ac"];
		 $bill_no=$_REQUEST["bill_no"];
         $b=mysqli_query($con,"select * from onshop where `bill_status`='pending' and `bill_no`='".$bill_no."'  "); $i=1; 
		 while($br=mysqli_fetch_array($b,MYSQLI_ASSOC)) 
		 {	
              $p_id=$br["product_id"];
              $b_date=$br["bill_date"];
              $card_no=$br["card_no"];
              $p=mysqli_query($con,"select * from product where `id`='".$p_id."'" ); $pr=mysqli_fetch_array($p,MYSQLI_ASSOC);
		      $qnty=$br["qnty"]; // selling quantity
		 	  $quantity=$pr["quantity"]; // product quantity
              $pr_type=$pr["category"];
		      $mrp=$pr["mrp"];
		      $price=$pr["price"];
		      $pay_type=$_POST["pay_type"];
		          if($pr["auto_decrese"]=="yes" ) 
				  {  
				       $quantity=$quantity - $qnty;
					   mysqli_query($con,"update product set `quantity`='".$quantity."' where `id`='".$p_id."' "); //right
				   } else {  }
		   		
 		$due=$_POST["due_amount"];
 		$a_r=$_POST["a_r"];
 		$date=date('Y-m-d');
 		$p=mysqli_query($con,"select phone,cus_name from onshop where `bill_no`='".$bill_no."' ");
 		$pr=mysqli_fetch_array($p,MYSQLI_ASSOC);
 		$mob=$pr["phone"]; $cus_name=$pr["cus_name"];
        mysqli_query($con,"update onshop set  `bill_status`='complete',`due`='".$due."',`payable`='".$pt."',`paid_status`='paid',`cabin_charge`='".$cabin_ac."',`charge_type`='".$a_r."',`pay_type`='".$pay_type."' where `bill_no`='".$bill_no."' "); //`payable`='".$pt."'	
      //  mysqli_query($con,"insert into card_history (`card_no`,`credit_point`,`credit_amount`,`bill_no`,`date`) values ('".$card_no."','".$credit_point."','".$credit_amount."','".$bill_no."','".$date."')");

/*
$ch = curl_init();
$parampro['uname'] = "scriptlovers";
$parampro['password'] = "123456";
$parampro['sender'] = "STRSLN";
$parampro['receiver'] =$mob;
$parampro['route'] = "TA";
$parampro['msgtype'] = "1";
  $parampro['tempid'] = "1207168004906627935";

$parampro['sms'] = "Hi ".$cus_name.", Great to see you @The Star Salon. View your E bill  thestarsalon.com?b=".$bill_no." .Thank You"  ;

$sendsmspro = http_build_query($parampro);

$urlpro="http://sendsms.designhost.in/index.php/smsapi/httpapi/?".$sendsmspro;

curl_setopt($ch, CURLOPT_URL, $urlpro);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
 $resultpro = curl_exec($ch); 
curl_close($ch);    */


$cre=mysqli_query($con,"select * from card_detail where `card_no`='".$card_no."'");
        $cer=mysqli_fetch_array($cre,MYSQLI_ASSOC);
        $point=$cer["point"];
         mysqli_query($con,"insert into card_history (`card_no`,`credit_point`,`credit_amount`,`bill_no`,`date`) values ('".$card_no."','".$credit_point."','".$credit_amount."','".$bill_no."','".$date."')");
$point=$point+$credit_point;

mysqli_query($con,"update card_detail set `point`='".$point."' where `card_no`='".$card_no."'");


?><script>window.location.href="bill_print.php?bill_no=<?php echo $bill_no; ?>&page=index";</script><?php 	
        }
        	}
		

		?>				 
<p>&nbsp;</p>					 
					
					 
					 
					 
<!--				 					
											 <select name="class" id="class" class="form-control" onChange="lfn_SelectSection(this.value);">
                                            <option value="">--- Please Select Class ----</option>
                                             <option value="A">A</option>
											 <option value="B">B</option>
											 <option value="C">C</option>
                                             </select>
											Section
											 <select type="text" name="secname" id="secname" class="form-control" >
                                        	<option value="0">------select Section_o------</option>

                                        </select> -->	
										
                                                    </strong></p></div>
                                                    
                                                    <?php $date=date('Y-m-d'); 
                                                    $d2= date('Y-m-d', strtotime('-1 day', strtotime($date)));
                                                    $d3= date('Y-m-d', strtotime('-2 day', strtotime($date)));
                                                    $d4= date('Y-m-d', strtotime('-3 day', strtotime($date)));
                                                    $d5= date('Y-m-d', strtotime('-4 day', strtotime($date)));
                                                    $d6= date('Y-m-d', strtotime('-5 day', strtotime($date)));
                                                    $d7= date('Y-m-d', strtotime('-6 day', strtotime($date)));
   $c=mysqli_query($con,"select payable  from onshop where  `bill_date` ='".$d7."' and `shop_type`='onshop' and `bill_status`='complete' GROUP BY `bill_no` "); 
      $cr=mysqli_fetch_array($c,MYSQLI_ASSOC);
        $amt7=$cr["payable"]; 
       $c=mysqli_query($con,"select payable  from onshop where  `bill_date` ='".$d6."' and `shop_type`='onshop' and `bill_status`='complete' GROUP BY `bill_no` "); 
      $cr=mysqli_fetch_array($c,MYSQLI_ASSOC);
        $amt6=$cr["payable"]; 
       $c=mysqli_query($con,"select payable  from onshop where  `bill_date` ='".$d5."' and `shop_type`='onshop' and `bill_status`='complete' GROUP BY `bill_no` "); 
      $cr=mysqli_fetch_array($c,MYSQLI_ASSOC);
        $amt5=$cr["payable"]; 
       $c=mysqli_query($con,"select payable  from onshop where  `bill_date` ='".$d4."' and `shop_type`='onshop' and `bill_status`='complete' GROUP BY `bill_no` "); 
      $cr=mysqli_fetch_array($c,MYSQLI_ASSOC);
        $amt4=$cr["payable"]; 
       $c=mysqli_query($con,"select payable  from onshop where  `bill_date` ='".$d3."' and `shop_type`='onshop' and `bill_status`='complete' GROUP BY `bill_no` "); 
      $cr=mysqli_fetch_array($c,MYSQLI_ASSOC);
        $amt3=$cr["payable"]; 
       $c=mysqli_query($con,"select payable  from onshop where  `bill_date` ='".$d2."' and `shop_type`='onshop' and `bill_status`='complete' GROUP BY `bill_no` "); 
      $cr=mysqli_fetch_array($c,MYSQLI_ASSOC);
        $amt2=$cr["payable"]; 
       $c=mysqli_query($con,"select payable from onshop where  `bill_date` ='".$date."' and `shop_type`='onshop' and `bill_status`='complete' GROUP BY `bill_no` "); 
      $cr=mysqli_fetch_array($c,MYSQLI_ASSOC);
        $amt1=$cr["payable"]; 
                                                    $dataPoints = array( 
	array("y" => $amt7 , "label" => $d7 ),
	array("y" => $amt6, "label" => $d6 ),
	array("y" => $amt5, "label" => $d5 ),
	array("y" => $amt4, "label" => $d4 ),
	array("y" => $amt3, "label" => $d3 ),
	array("y" => $amt2, "label" => $d2 ),
	array("y" => $amt1, "label" => $date ),
	
);

 ?>
  <script>
         window.onload = function() {
 
var chart = new CanvasJS.Chart("chartContainer<?php echo '1' ?>", {
	animationEnabled: true,
	theme: "light2",
	title:{
		text: "LAST 7 DAYS SELLING REPORT"
	},
	axisY: {
		title: "Marks"
	},
	data: [{
		type: "column",
		yValueFormatString: "#,##0.## Rs",
		dataPoints: <?php echo json_encode($dataPoints, JSON_NUMERIC_CHECK); ?>
	}]
});
chart.render();
 
}
     </script>   
  <script src="https://cdn.canvasjs.com/canvasjs.min.js"></script>
     <?php if($_REQUEST["bill_no"] !=""){ } else { ?>  <div id="chartContainer1" style="height: 120px; width: 100%;"></div> <?php }?>                                                  
                                                    
        <p>&nbsp;</p>                                            
                                        </div>



                                    </div>
                                </div>
                                <!--
<h4 style="text-align:left"><b>Total Selling Entry</b></h4>
                               <div class="well" style="padding: 5px;background-color: rgb(186,233,254); border: 1px solid #000; margin-bottom: 1px;">
                                    
<form method="post"  >  <br>                                      
  <b>Bill No</b> <input type="text" style=" width:50px; height:26px " value="<?php if($_REQUEST['bill_no']!='') { echo $_REQUEST["bill_no"]; } else { //echo date('Y'); ?><?php echo $lr["bn"]+1; } ?>" name="bill_no" <?php if($billn >="1") { ?> disabled="disabled" <?php } else { }?> id="bill_no" >                                      
 <input type="date" style=" width:135px; height:26px" name="bill_date" id="bill_date"   
					   
					   
					   value="<?php if($_REQUEST['bill_date']!='') { echo $_REQUEST['bill_date']; } else { 
					      if($billn >="1") { echo $billr['bill_date']; } else { echo date('Y-m-d');  } } ?>" >                                      
                                    <b> Type</b> <select name="shop_type" style=" height:26px">
									 <option value="onshop">ONSHOP</option>
								
									 <option value="parcel">PARCEL</option>
									 </select>   
                                         
                                      
					  <select name="p_no2" id="p_no2" style="width:150px; display:none"   >
				  <option value="" ><b>Product Name</b></option>
				  <?php $p_id=$_REQUEST["p_id"];  $p=mysqli_query($con,"select * from product where `status`='active' and `category` !='Kitchen' order by product_name"); while($pr=mysqli_fetch_array($p,MYSQLI_ASSOC)) { ?>
				  <option <?php if($pr["id"]==$p_id) { ?> selected="selected" <?php } else { }?> style="background-color:#FFCCFF" value="<?php echo $pr['id']; ?>"><b><?php echo $pr["product_name"]; ?></b></option>
				  <?php } ?>
				</select>
			<!--	<b>Total </b>--><input type="hidden" style="width:65px; height:26px"  name="total_peg2" id="total_peg2" onKeyUp="cal_now()" value="1" > <!-- Unit -->
			<!--	<input type="hidden" name="tb" id="tb">  <input type="hidden" name="tv" id="tv">
				<input type="text" name="amount" style="width:50px; height:26px" placeholder="Rs." required > 
				<input type="submit" name="submit22" value="Submit" style="width:90px; background-color:#FFFF99; height:26px">
				</form>		
					<br>
									<font id="cal2" color="#FF0000">  </font> 
									 
                                </div>
				-->
		<?php		if(isset($_POST["submit22"]))
  { 
   $shop_type=$_POST["shop_type"];
   $p_no2=$_POST["p_no2"];
   $total_peg2=$_POST["total_peg2"];
  $ppl=mysqli_query($con,"select * from product where `status`='active' and `id`='".$p_no2."'"); $pplr=mysqli_fetch_array($ppl,MYSQLI_ASSOC);
  $product_name=$pplr["product_name"];
  $company=$pplr["company"];
  $quantity=$pplr["quantity"];
  $pro_type=$pplr["category"];
  $mrp_p=$pplr["mrp"];
   //$mrp_p=$pplr["mrp"];
  $curent_peg=750-$pplr["curent_peg"];
  $all_peg=$curent_peg+$total_peg2;
  $bottle=intval($all_peg/750); //
  $peg=$all_peg-(750*$bottle);
  $db_peg=750-$peg; //
  $db_quantity=$quantity-$bottle;
  mysqli_query($con,"update product set `quantity`='".$db_quantity."', `curent_peg`='".$db_peg."' where `id`='".$p_no2."'");
  $bill_no=$_POST["bill_no"];
  $bill_date=$_POST["bill_date"];
   $pay_type=$_POST["pay_type"];
  $product_id=$p_no2;
   $t_price=$_POST["amount"];
  mysqli_query($con,"insert into onshop (`bill_no`,`bill_date`,`table_no`,`product_id`,`product_name`,`company`,`price`,`qnty`,`total`,`cus_name`,`phone`,`created_by`,`paid_status`,`bill_status`,`status`,`peg_bottle`,`unit`,`shop_type`,`peg_volume`,`waiter`,`advance`,`mrp`,`product_type`,`payable`,`pay_type`) values('".$bill_no."','".$bill_date."','','".$product_id."','".$product_name."','".$company."','".$t_price."','1','".$t_price."','','','','paid','complete','active','peg','ml','".$shop_type."','".$total_peg2."','','','".$mrp_p."','".$pro_type."','".$t_price."','".$pay_type."')"); 
 ?><script>
 alert("Successfully Submitted");
 window.location.href="index.php";
 </script><?php 
  }							
?>									
<script>
 function cal_now() {
  var p_no22=document.getElementById("p_no2").value;
  var pg2=document.getElementById("total_peg2").value;
 /* if(p_no22=="") {
  alert("Select Product");
  } */
  //document.getElementById("cal2").innerHTML=pg2; 
  var a=pg2/750;
  var a=Math.floor(a);
  var b=pg2-(a*750);
  var pg2=document.getElementById("tb").value=a;
   var pg2=document.getElementById("tv").value=b;
  document.getElementById("cal2").innerHTML="<b>"+a+" Bottle and "+b+" ml </b>";
 
}
</script>	
								
								
                                <div class="row">
                                 
                                </div>
                            
                               

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

<?php include("include/right.php"); ?>

                               
                            </div>                     
                        </div>

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


       <?php include("include/footer.php"); ?>
		

		
		
		</body>



</html>