<?php 	
    include_once('../../config.php');   	
    include_once(ABS_PATH.'/admin/login_check.php');    
    include ABS_PATH.'/admin/header.php';    
     $result =  mysql_query("select *  from biddings where  optionType = 25  order by id DESC") ;      
?>  

<script>
function PaidAmt(val)
{

	var r = confirm("Do you really want to update record !");
	if (r == true) {    
	$.ajax({
	type: 'POST',
	url: "../ajax/default.php",
	//async: false,			 
	data: {PaidAmount:1,val:val},	  
	success: function(ajaxresult){	     
		location.reload();	 	
	},
	error: function(XMLHttpRequest, textStatus, errorThrown) { 
	alert('Error');
	}
	});
	
	}	
	
}

</script>
		 
		<div class="col-md-10">  
  			<div class="content-box-large">
  				<div class="panel-heading">
					<div class="panel-title"><h3>Accounting <?php echo date("d-M-Y");?>  </h3></div>
					
					<!--div align="right">  <input type="button"    class="btn btn-warning" name="btnback" id="btnback" value="Export" onClick="javascript:location.href='#';" />
					 <input type="button"    class="btn btn-warning" name="btnback" id="btnback" value="Add Withdraw" onClick="javascript:location.href='addWithdraw.php';" />
					</div--> 
			 		
				</div>
				
				<h3> Sridevi to Kalyan  </h3>
  				<div class="panel-body">
  					<table cellpadding="0" cellspacing="0" border="0" class="table table-striped table-bordered" id="example">
						<thead>
							<tr>
								<th>Total Single</th>
								<th>Total Jodi</th>
								<th>Total Sp</th>
								<th>Total Dp</th>
								<th>Total Business</th>
								<th>Total Paid </th> 
								<th>Total Profit </th> 
							</tr>
						</thead>
						<tbody>
							<?php   
								  $tdate = date("Y-m-d");//    
								  $Result = mysql_query("select  digit,amount from   cutting where cdate = '$tdate' and    ( (bazarid = 4) || (bazarid = 6) || (bazarid = 7) || (bazarid = 8 ) || (bazarid = 9) || (bazarid = 11) || (bazarid = 59) || (bazarid = 63) ) ");   
								  while($row = mysql_fetch_object($Result))
								  {
									    $string = (string)$row->digit;
									    
									    if(strlen($string)==1)
									       $singleDigitAmt += $row->amount; 
									    if(strlen($string)==2)
									       $jodiAmt += $row->amount;       
									    if(strlen($string)==3)
									    {
									       if( ($string[0]==$string[1]) || ($string[1]==$string[2])  )
									        $DpAmt += $row->amount; 
									       else 
									         $SpAmt += $row->amount; 
									    } 
									       
									    $ToalAmt += $row->amount;   
								  }
								  
								  $Result1 = mysql_query("select  Points from   biddings where adminDate = '$tdate'  and txn = 1  and    ( (bazarId = 4) || (bazarId = 6) || (bazarId = 7) || (bazarId = 8 ) || (bazarId = 9) || (bazarId = 11) || (bazarId = 59) || (bazarId = 63) ) ");  
								  while($row1 = mysql_fetch_object($Result1))
								  {
									$ToalPt +=$row1->Points;   
								  }
							 
							?>
							<tr class="odd gradeX"  >
								<td><?php echo $singleDigitAmt;?> </td>
								<td><?php echo $jodiAmt;?> </td>
								<td><?php echo $SpAmt;?> </td>
								<td><?php echo $DpAmt;?> </td>
								<td><?php echo $ToalAmt;?> </td>
								<td><?php echo $ToalPt; ?> </td> 
								<?php 
								    $Winning =  $ToalAmt-$ToalPt;
								    if($Winning > 0)
								    {
								?>
								<td style="color:green;font-size:15px;"><b><?php echo ($Winning); ?></b> </td> 
								<?php }else { ?>
								    <td style="color:red;font-size:15px;"><b><?php echo ($Winning); ?></b> </td> 
								<?php }  ?>
							</tr>   
						</tbody>
					</table>
  				</div>
  				
  				
  				<h3> Sridevi Night to Main Bazar  </h3>
  				<div class="panel-body">
  					<table cellpadding="0" cellspacing="0" border="0" class="table table-striped table-bordered" id="example">
						<thead>
							<tr>
								<th>Total Single</th>
								<th>Total Jodi</th>
								<th>Total Sp</th>
								<th>Total Dp</th>
								<th>Total Business</th>
								<th>Total Paid </th> 
								<th>Total Profit </th> 
							</tr>
						</thead>
						<tbody>
							<?php   
								  $tdate = date("Y-m-d");//  
								  $Result = mysql_query("select  digit,amount from   cutting where cdate = '$tdate' and    ( (bazarid = 12) || (bazarid = 13) || (bazarid = 14) || (bazarid = 15) || (bazarid = 16) || (bazarid = 22) || (bazarid = 23) ) ");   
								  while($row = mysql_fetch_object($Result))
								  {
									    $string = (string)$row->digit;
									    
									    if(strlen($string)==1)
									       $singleDigitAmt1 += $row->amount; 
									    if(strlen($string)==2)
									       $jodiAmt1 += $row->amount;       
									    if(strlen($string)==3)
									    {
									       if( ($string[0]==$string[1]) || ($string[1]==$string[2])  )
									        $DpAmt1 += $row->amount; 
									       else 
									         $SpAmt1 += $row->amount; 
									    } 
									       
									    $ToalAmt1 += $row->amount;   
								  }
								  
								  $Result1 = mysql_query("select  Points from   biddings where adminDate = '$tdate'  and txn = 1  and    ( (bazarId = 12) || (bazarId = 13) || (bazarId = 14) || (bazarId = 15) || (bazarId = 16) || (bazarId = 22) || (bazarId = 23) ) ");  
								  while($row1 = mysql_fetch_object($Result1))
								  {
									$ToalPt1 +=$row1->Points;   
								  }
							?>
							<tr class="odd gradeX"  >
								<td><?php echo $singleDigitAmt1;?> </td>
								<td><?php echo $jodiAmt1;?> </td>
								<td><?php echo $SpAmt1;?> </td>
								<td><?php echo $DpAmt1;?> </td>
								<td><?php echo $ToalAmt1;?> </td>
								<td><?php echo $ToalPt1; ?> </td> 
								
								<?php 
								    $Winning =  $ToalAmt1-$ToalPt1;
								    if($Winning > 0)
								    {
								?>
								<td style="color:green;font-size:15px;"><b><?php echo ($Winning); ?></b> </td> 
								<?php }else { ?>
								    <td style="color:red;font-size:15px;"><b><?php echo ($Winning); ?></b> </td> 
								<?php }  ?>
							</tr>   
						</tbody>
					</table>
  				</div>
  				
  				
  			</div>



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

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