<?php 	
            include_once('../../config.php');    
		  
			if(isset($_POST['Split']))
			{ 
				$EXP = explode(",",$_POST['SplitDigits']); 
				foreach($EXP as $dt)
					mysql_query("insert into  splitCalc (calcId,spliFor,splitAmt,col) values($_REQUEST[id],$_POST[Splitfor],$_POST[SplitAmt],$dt) "); 
				
			 
                mysql_query("insert into splitCalE (cal1) values($_REQUEST[Splitfor]) ");
                
                
				header("Location:  calc.php "); 
                die;     
			}
			
			if(isset($_POST['Update']))
			{    
	    	   //mysql_query("update  calc set market = '$_POST[market]', zero = $_POST[zero] , one = $_POST[one] ,  two = $_POST[two] ,  three = $_POST[three] ,  four = $_POST[four] ,  five = $_POST[five] ,  six = $_POST[six] ,  seven = $_POST[seven] ,  eight = $_POST[eight] ,  nine = $_POST[nine]  where id=$_REQUEST[id]");   
               mysql_query("update     calc set zero = $_POST[zero] , one = $_POST[one] ,  two = $_POST[two] ,  three = $_POST[three] ,  four = $_POST[four] ,  five = $_POST[five] ,  six = $_POST[six] ,  seven = $_POST[seven] ,  eight = $_POST[eight] ,  nine = $_POST[nine]  where id=$_REQUEST[id]"); 
                header("Location:  calc.php "); 
                die;
			} 

			$rst = mysql_query("select * from calc where id=$_REQUEST[id]");
			$value  = mysql_fetch_object($rst);
		 
		 
            $zero =  round($value->zero);  
            $one = round($value->one);
			$two =  round($value->two); 
			$three = round($value->three);
		    $four = round($value->four);       
            $five = round($value->five);      
            $six = round($value->six);    
            $seven = round($value->seven);
			$eight =   round($value->eight);      
			$nine = round($value->nine);       
			        
?>  
<?php  include ABS_PATH.'/admin/header.php';	?>  


 <script>
	$(function() {
		$( "#datepicker" ).datepicker(); 
	}); 
  
	$(document).ready(function()
	{   

	
	$("#product_frm").validate({
		
		errorElement:'div',
		rules:{ 
			city:{
				required:true				 
			} 
			
			
			
		},
		messages:{				
			 
			 city:{
				required:"Enter city name"				 
			} 
		}
	});


	});
 

	function updateresult(id,val)
	{   
		var r = confirm("Do you really want to update  record !");
		if (r == true) {    
		$.ajax({
		type: 'POST',
		url: "../ajax/default.php",
		//async: false,			 
		data: {updateCalc:1,id:id,val:val},	  
		success: function(ajaxresult){	     
			//location.reload();	 	
			window.location.href = "https://www.dubailive.in/admin/live/calc.php";
		},
		error: function(XMLHttpRequest, textStatus, errorThrown) { 
		alert('Error');
		}
		});
		
		}	
	
	}
	
</script>
		 
		 <div class="col-md-10">

	  			<div class="row">
	  				<div class="col-md-12">
	  					<div class="content-box-large">
							<div class="panel-heading">
								<div class="panel-title"> <h3> <?php //echo $val;?> </h3></div>    
								
								<div class="panel-options"> 

								   <input type="button"  class="btn btn-warning" name="btnback" id="btnback" value=" Back " onClick="javascript:location.href='calc.php';" />
								  
								</div>
							</div>
							
			  				<div class="panel-body">
								
								 
			  					<form class="form-horizontal" role="form" method="post" enctype="multipart/form-data" id="product_frm" autocomplete="off">
							 
							  
							  
							    
								<div class="form-group">
								    <label for="inputEmail3" class="col-sm-2 control-label">Market</label>
								    <div class="col-sm-3">
								        <select name="market" class="form-control"> 
								        <option selected> select market</option>
										<option>Karnataka Day</option>  
										<option>Sridevi</option> 
										<option>Time Bazar</option>  
										<option>Madhur Day</option> 
										<option>Milan Day</option> 
										<option>Rajdhani  Day</option> 
										<option>Kalyan </option> 
										<option>Karnatak night</option> 
										<option>Suprem  Day</option>   
										<option>Sridevi Night </option>
										<option>Madhur   Night </option> 
										<option>Milan    Night </option>   
										<option>Suprem  Night</option>  
										<option>Kalyan   Night </option>     
										<option>Main Bazar  </option>
										
									  </select>
									  
						   		    </div>
								 </div>
								 <hr>  		
								 
								 

								<div class="form-group">
								    <label for="inputEmail3" class="col-sm-2 control-label">0</label>
								    <div class="col-sm-3">
								      <input name="zero" class="form-control"   placeholder="Value" value="<?php echo $zero;?>"  >
									  <br><a   style="font-size:18px;float:left" href="javascript:void(0);" onclick="updateresult(<?php echo $_REQUEST['id']; ?>,0)">Win 0</a>
								    </div>
								 </div>
								 <hr>  		
								 
								 
								<div class="form-group">
								    <label for="inputEmail3" class="col-sm-2 control-label">1</label>
								    <div class="col-sm-3">
								      <input name="one" class="form-control"   placeholder="Value" value="<?php echo $one;?>"  >
									  <br><a   style="font-size:18px;float:left" href="javascript:void(0);" onclick="updateresult(<?php echo $_REQUEST['id']; ?>,1)">Win 1</a>
								    </div>
								 </div>
								 <hr>   
								   
								   
								  
								   
								<div class="form-group">
								    <label for="inputEmail3" class="col-sm-2 control-label">2</label>
								    <div class="col-sm-3">
								      <input name="two" class="form-control"   placeholder="Value" value="<?php echo $two;?>"  >
									  <br><a   style="font-size:18px;float:left" href="javascript:void(0);" onclick="updateresult(<?php echo $_REQUEST['id']; ?>,2)">Win 2</a>
								    </div>
								 </div>
								 <hr>   
								 
								    
								<div class="form-group">
								    <label for="inputEmail3" class="col-sm-2 control-label">3</label>
								    <div class="col-sm-3">
								      <input name="three" class="form-control"   placeholder="Value" value="<?php echo $three;?>"  >
									  <br><a   style="font-size:18px;float:left" href="javascript:void(0);" onclick="updateresult(<?php echo $_REQUEST['id']; ?>,3)">Win 3</a>
								    </div>
								 </div>
								 <hr>   
								   
								   
								      
								<div class="form-group">
								    <label for="inputEmail3" class="col-sm-2 control-label">4</label>
								    <div class="col-sm-3">
								      <input name="four" class="form-control"   placeholder="Value" value="<?php echo $four;?>"  >
									  <br><a   style="font-size:18px;float:left" href="javascript:void(0);" onclick="updateresult(<?php echo $_REQUEST['id']; ?>,4)">Win 4</a>
								    </div>
								 </div>
								 <hr>   
								   
								   
								      
								<div class="form-group">
								    <label for="inputEmail3" class="col-sm-2 control-label">5</label>
								    <div class="col-sm-3">
								      <input name="five" class="form-control"   placeholder="Value" value="<?php echo $five;?>"  >
									  <br><a   style="font-size:18px;float:left" href="javascript:void(0);" onclick="updateresult(<?php echo $_REQUEST['id']; ?>,5)">Win 5</a>
								    </div>
								 </div>
								 <hr>   
								   
								   
								      
								<div class="form-group">
								    <label for="inputEmail3" class="col-sm-2 control-label">6</label>
								    <div class="col-sm-3">
								      <input name="six" class="form-control"   placeholder="Value" value="<?php echo $six;?>"  >
									  <br><a   style="font-size:18px;float:left" href="javascript:void(0);" onclick="updateresult(<?php echo $_REQUEST['id']; ?>,6)">Win 6</a>
								    </div>
								 </div>
								 <hr>   
								   
								   
								      
								<div class="form-group">
								    <label for="inputEmail3" class="col-sm-2 control-label">7</label>
								    <div class="col-sm-3">
								      <input name="seven" class="form-control"   placeholder="Value" value="<?php echo $seven;?>"  >
									  <br><a   style="font-size:18px;float:left" href="javascript:void(0);" onclick="updateresult(<?php echo $_REQUEST['id']; ?>,7)">Win 7</a>
								    </div>
								 </div>
								 <hr>   
								   
								   
								      
								<div class="form-group">
								    <label for="inputEmail3" class="col-sm-2 control-label">8</label>
								    <div class="col-sm-3">
								      <input name="eight" class="form-control"   placeholder="Value" value="<?php echo $eight;?>"  >
									  <br><a   style="font-size:18px;float:left" href="javascript:void(0);" onclick="updateresult(<?php echo $_REQUEST['id']; ?>,8)">Win 8</a>
								    </div>
								 </div>
								 <hr>    
								 
								 <div class="form-group">
								    <label for="inputEmail3" class="col-sm-2 control-label">9</label>
								    <div class="col-sm-3">
								      <input name="nine" class="form-control"   placeholder="Value" value="<?php echo $nine;?>"  >  
									  <br><a   style="font-size:18px;float:left" href="javascript:void(0);" onclick="updateresult(<?php echo $_REQUEST['id']; ?>,9)">Win 9 </a>    
								    </div>
								 </div>
								 <hr>  

								 <!--div class="form-group">
										<label for="inputEmail3" class="col-sm-2 control-label">Split</label>
										<div class="col-sm-3"> 
										<input name="Splitfor" id="SplitDigit"    class="form-control"   placeholder="Split For" />	 <Br>
										<input name="SplitDigits" id="SplitDigit"    class="form-control"   placeholder="Split  Digits seperted by ," />	<Br>
										<input name="SplitAmt" id="SplitDigit"    class="form-control"   placeholder="Split Amount" /> <Br> 
										</div>
								  </div-->
								  
								
								 
									 
								  
								  <div class="form-group">
										<label for="inputEmail3" class="col-sm-2 control-label">Update</label>
										<div class="col-sm-10"> 
										  <input type="submit"    class="btn btn-primary"  name="Update" value="Update">&nbsp;
										  <!--input type="submit"    class="btn btn-primary"  name="Split" value="SPLIT"-->&nbsp; 
										</div>
								  </div>  
								  
								</form>
								
								
							
			  				</div>
			  			</div>
	  				</div>
	  				 
	  			</div>

	  			 


	  		<!--  Page content -->
		  </div>
		</div>
    </div>

<?php  include ABS_PATH.'/admin/footer.php';	?>    