<?php
	session_start();
	if($_SESSION['subadm'])
	{
		$userid=1111;
		if($_SESSION['subadm']==1111)
		{
			$APBU=$userid;
		}
		else
		{
			$APBU=$_SESSION['subadm'];
		}
		
	}
	else
	{
		header('location:../login.php');
	}
?>
<?php
	include'connection.php';
		
		$query8="select * from wallet where Userid='$userid' order by Id desc";
		$result8=mysqli_query($con,$query8);
		$data8=mysqli_fetch_array($result8);
		$currentbal= $data8['Balance'];
		
    	if(!isset($_POST['submit']))
		{
			echo "<META HTTP-EQUIV ='Refresh' Content ='300' >";
		}
		
	    
		
?>
<html>
    <title>Recharge History</title>
<head>
    <link href="font-awesome/css/font-awesome.min.css" rel="stylesheet" type="text/css">
<style>
body{background:#e6d9c8; background-size:cover; background-repeat:repeat; background-repeat:repeat-x; margin:0; padding:0; width:1580px;}
.head{background:; width:1580px; height:220px; margin:0px;}
#p1{font-size:34px; float:left; Margin:10 0 0 45px; color:#996420;
	font-weight:bold;}
#p2{font-size:20px; float:left; margin:28 0 0 -8px; color:#eaa040;
	font-family:Courier;}
#p3{font-size:15px; font-family:Comic Sans MS; float:left; color:#996420;
	margin-top:48px; margin-left:-153px;}
.h2{background:white; width:400px; height:70px; margin:10 200px;}

#link0{float:right; margin:10 10 0 0px; font-size:20px; text-decoration:none; color:white; background:red; padding:5px; border-radius:4px;}
 #link1{float:right; margin:10 10 0 0px; font-size:20px; text-decoration:none; color:white; background:green; padding:5px; border-radius:4px;}
#link0:hover{ padding:5px; border-radius:4px; color:black;}
.dmorq{margin:0 50px; font-size:19px;}

.menu{background:#996420; height:40px; width:1450px; margin-left:10px; padding:0; line-height:40px;}
.menu ul{padding:0; margin:0; position:relative; display:inline-block;}
.menu ul li{list-style:none; float:left; width:170px; line-height:40px; text-align:center; font-size:17px; margin:0; padding:0; color:white;}
.menu ul li ul {display:none;}
.menu ul li:hover{background:#d1994a; cursor:pointer;}
.menu ul li:hover ul {display:block; z-index:2;}
.menu ul li:hover ul li{background:#d1994a; border-top:solid white 0.1px;}
.menu ul li ul li:hover{background:#996420; color:white;}
.menu ul li ul li:hover a{ color:white;}
.menu ul li a{ text-decoration:none; color:white;}
 #a1{border:none; color:white;}
 .menu{letter-spacing:1px;}
#AFLI{background:white; width:200px;}
#AFLI:hover{background:#f5f5f5;}
 #inp{margin-left:10px; height:35px; padding:3 10px; font-size:20px;}
 #inpNum{margin-left:10px; height:35px; width:100px; padding:3 10px; font-size:20px;}
 #srchby{margin-left:20px; font-family:calibri; font-size:22px;}
 .date{background:; margin:10 0 0 20px;}
 .rechreport{width:1560px; height:40px; background:#996420; color:white; line-height:40px; margin:0 0 0 20px;}
 .rechreport p{margin-left:20px;}
.notifi{background:#995702; width:950px; height:70px; margin:5 5 5 50px; border-radius:8px; float:left;}
.imgdiv{background:; width:60px; height:60px; float:left; margin:0 20px;}
#notifidiv{background:red; width:40px; height:40px; margin:0 0 0 30px; border-radius:50%; text-align:center; line-height:40px;
color:white; font-size:20px; z-index:4; float:left; position:absolute;}
img{width:60px; height:60px; float:left; margin:7px;}
#myInput{width:100px; height:30px; font-size:15px; margin:0px; border-radius:4px;}

.adminOnline{background:white; width:auto; float:left; line-height:100%; margin:5px 0px 0px 50px; border-radius:3px; padding:0;}
#divOnline{background:; width:auto; height:; float:left; margin:0px 5px; text-align:center; line-height:100%; font-size:17px;}
#iconDesktop{font-size:25px; margin:0px 5px; color:green; padding:0;}
#iconMobile{font-size:30px; margin:0px 5px; color:green; padding:0;}

#t1{ width:1560px; text-align:center; border-collapse:collapse; border-color:black; margin-left:20px;   word-wrap: break-word;}
#t1 th{font-family:calibri; background:#94928f; color:white; font-size:17px;}
#t1 td{font-family:calibri; font-size:17px;}
#t1 tr:nth-child(odd){background:#f6f0e8;}
#t1 tr:nth-child(even){background:white; }
#t1 tr:hover{background:#fce3f0;}
#tda a{text-decoration:none; font-size:18px; font-family:sans-serif; color:#0b52e2;}
#rechId{text-decoration:none; background:; color:blue; font-size:18px; padding:2 5px; border-radius:4px; font-weight:bold;}
#green{background:green; color:white; font-size:18px; padding:2 5px; border-radius:4px; font-weight:bold;}
#red{background:red; color:white; font-size:18px; padding:2 5px; border-radius:4px; font-weight:bold;}
#blue{background:blue; color:white; font-size:18px; padding:2 5px; border-radius:4px; font-weight:bold;}
#balColorRed{color:RED; font-weight:bold;}
#balColorBlack{font-weight:bold;}
#usr{display:none;}

    @media (max-width:768px)
	{
	    
	}
 .foot{float:left; margin:10 0 0 100px; width:1350px;}
 </style>
</head>
<body>
	<div class="head">
		<p id="p1">LLP</p>
		<p id="p2">Recharge</p>
		<p id="p3">The Complete Solution</p>
		<a id="link0" href="logout.php">Log Out</a>
		<p id="link1"><?php echo "Welcome $userid Admin";  ?></p>
		
	<div class="notifi">
	   <?php  include'notification.php'; ?>
	</div>
	<div class="adminOnline">
	    <input type="text" id="usr" value="<?php echo $Adminid; ?>">
	    <script>
	        var Adminid = document.getElementById("usr").value;
            var screenWidth = screen.width;
            if(screenWidth<760)
            {
                var device = "Mobile";
            }
            else
            {
                var device = "Desktop";
            }
        
            var xmlhttp2 = new XMLHttpRequest();
            xmlhttp2.open("GET", "ajax_Admin_Online_Device.php?Adminid="+Adminid+"&device="+device, false);
            xmlhttp2.send(null);
            var result = xmlhttp2.responseText;
        </script>

	    <table>
	    <?php
	        $AdOndate = date("Y-m-d H:i:s");
            $AdOntime = strtotime($AdOndate);
            $AdOntime = $AdOntime - (2 * 60);
            $AdOndateAdOntime = date("Y-m-d H:i:s", $AdOntime);
            
            $quUpdateOnline="update admin set online='$AdOndate' where Userid='$Adminid'";
		    mysqli_query($con,$quUpdateOnline);
		    
	        $quAdminOnlin="select * from admin";
	        $reAdminOnlin=mysqli_query($con,$quAdminOnlin);
	        while($dataAdminOnlin=mysqli_fetch_array($reAdminOnlin))
	        {
	            $deviceName=$dataAdminOnlin['Device'];
	            $SelfAdminId=$dataAdminOnlin['Userid'];
	            $OnlineTime=$dataAdminOnlin['online'];
	            if($SelfAdminId!==$Adminid)
	            {
	                if($OnlineTime>=$AdOndateAdOntime)
	                {
        	            if($deviceName=="Mobile")
	                    {
	                        echo "<tr><td><div id='divOnline'><p>".$dataAdminOnlin['Name']." - </p></div></td><td><div id='online'><i class='fa fa-mobile' aria-hidden='true' id='iconMobile'></i></div></td></tr>";
	                    }
	                    else
    	                {
	                         echo "<tr><td><div id='divOnline'><p>".$dataAdminOnlin['Name']." - </p></div></td><td><div id='online'><i class='fa fa-desktop' aria-hidden='true' id='iconDesktop'></i></div></td></tr>";
	                    }
	                }
	                else
	                {
	                    echo "<tr><td><div id='divOnline'><p>".$dataAdminOnlin['Name']." - </p></div></td><td><div id='online'>.$OnlineTime.</div></td></tr>";
	                }
	            }
	        }
	    ?>
	    </table>
	</div>
	   <div class="dmorq">
		<marquee scrollamount="6" onmouseover="stop()" onmouseout="start()">
		<?php
		    $dateformat = Date("d/M/Y");
			
			$AcOp="select * from operator where Active='1'";
			$reAcOp=mysqli_query($con,$AcOp);
			$CountRowsAcOp=mysqli_num_rows($reAcOp);
			while($dataAcOp=mysqli_fetch_array($reAcOp))
			{
			    echo $dataAcOp['Operator']." Down, ";
			}
			if($CountRowsAcOp==0)
			{
			    echo "ALL OPERATORS ARE WORKING FINE, ";
			}
			
		    $querymsg="select * from messege order by Id desc";
			$resultmsg=mysqli_query($con,$querymsg);
			while($datamsg=mysqli_fetch_array($resultmsg))
			{
			    echo $datamsg['Messege']." ";
			}
		?>
		</marquee>
	</div>
	<?php include 'menu.php'; ?>
	<div class="date">
	    <?php
	        if(isset($_POST['submit']))
			{
			    $fValueDate=$_POST['fdate'];
			    $lValueDate=$_POST['ldate'];
			}
			else
			{
			    $fValueDate=$date;
			    $lValueDate=$date;
			}
	    ?>
	    <form method="post">
		    <input type="date" name="fdate" value="<?php echo $fValueDate; ?>" id="inp">
		    <input type="date" name="ldate" value="<?php echo $lValueDate; ?>" id="inp">
		    <select name="oprtr" id="inp">
		        <option>ALL</option>
		        <?php
		            $quGetOp="select * from operator";
		            $reGetOp=mysqli_query($con,$quGetOp);
		            while($dataGetOp=mysqli_fetch_array($reGetOp))
		            {
		                echo "<option>".$dataGetOp['Operator']."</option>";
		            }
		        ?>
		    </select>
		    <select name="stat" id="inp">
		            <option>ALL</option>
		            <option>SUCCESS</option>
		            <option>FAILED</option>
		            <option>PENDING</option>
		    </select>
		<input type="number" name="DiffAmt" id="inpNum" placeholder="&#8377 1000">
		    <select name="diff" id="inp">
		            <option>PLUS</option>
		            <option>MINUS</option>
		            <option>ALL</option>
		    </select>
		    <select name="seller" id="inp">
		        <option>ALL</option>
		        <?php
		            $quGetSeller="SELECT * FROM Seller WHERE Status='Active' ORDER BY Name ASC";
		            $reGetSeller=mysqli_query($con,$quGetSeller);
		            while($dataGetSeller=mysqli_fetch_array($reGetSeller))
		            {
		                echo "<option>".$dataGetSeller['Name']."</option>";
		            }
		        ?>
		    </select>
		<input type="submit" name="submit" id="inp">
		</form>
	</div>
	<div class="rechreport">
		<p>Recharge History</p>
	</div>
<div id="Rech">	
        <?php // include'javaScriptForRechHistory.php'; ?>
	<table border="1" cellpadding="5" id="t1">
		<tr>
			<th>sl.</th>
			<th>Date | Time</th>
			<th>Agent Name</th>
			<th>Balance</th>
			<th>RC</th>
			<th>DC</th>
			<th>MC</th>
			<th>Operator</th>
			<th>Mobile No.</th>
			<th>Amt</th>
			<th>R.O.</th>
			<th>API</th>
			<th>No</th>
			<th>Lapu Owner</th>
			<th>Lapu No.</th>
			<th>API Bal.</th>
			<th>A. D.</th>
			<th>Operator Id</th>
			<th>#</th>
			<th>Rech Id</th>
			<th>Status</th>
			<th>CB</th>
			<th>RS</th>
			<th>Diff</th>
			<th>#</th>
		</tr>
		
		<?php
			include'connection.php';
			$ToatlRechAmount=0;
			if(isset($_POST['submit']))
			{
			    $fdate=$_POST['fdate'];
			    $ldate=$_POST['ldate'];
			    $oprtr=$_POST['oprtr'];
			    $stat=$_POST['stat'];
			    $diff=$_POST['diff'];
			    $DiffAmt=$_POST['DiffAmt'];
			    $seller=$_POST['seller'];
			    
			    if($oprtr=="ALL")
			    {
			        if($stat=="ALL")
			        {
			            if($diff=="ALL")
			            {
			                $quByDate="select * from recharge where Rechargedate>='$fdate' and Rechargedate<='$ldate'";
			            }
			            elseif($diff=="PLUS")
			            {
			                if(empty($DiffAmt))
			                {
			                    $quByDate="select * from recharge where Diff>=100 and Rechargedate>='$fdate' and Rechargedate<='$ldate'";
			                }
			                else
			                {
			                    $quByDate="select * from recharge where Diff>=$DiffAmt and Rechargedate>='$fdate' and Rechargedate<='$ldate'";
			                }
			            }
			            else
			            {
			                $quByDate="select * from recharge where Diff<0 and Rechargedate>='$fdate' and Rechargedate<='$ldate'";
			            }
			        }
			        else
			        {
			            $quByDate="select * from recharge where Rechargedate>='$fdate' and Rechargedate<='$ldate' and Status='$stat'";
			        }
			    }
			    else
			    {
			        if($stat=="ALL")
			        {
			            if($diff=="ALL")
			            {
			                $quByDate="select * from recharge where Rechargedate>='$fdate' and Rechargedate<='$ldate' and Companyname='$oprtr'";
			            }
			            elseif($diff=="PLUS")
			            {
			                if(empty($DiffAmt))
			                {
			                    $quByDate="select * from recharge where Diff>=100 and Rechargedate>='$fdate' and Rechargedate<='$ldate' and Companyname='$oprtr'";
			                }
			                else
			                {
			                    $quByDate="select * from recharge where Diff>=$DiffAmt and Rechargedate>='$fdate' and Rechargedate<='$ldate' and Companyname='$oprtr'";
			                }
			            }
			            else
			            {
			                $quByDate="select * from recharge where Diff<0 and Rechargedate>='$fdate' and Rechargedate<='$ldate' and Companyname='$oprtr'";
			            }
			            //$quByDate="select * from recharge where Rechargedate>='$fdate' and Rechargedate<='$ldate' and Companyname='$oprtr'";
			        }
			        else
			        {
			            $quByDate="select * from recharge where Rechargedate>='$fdate' and Rechargedate<='$ldate' and Companyname='$oprtr' and Status='$stat'";
			        }
			    }
			    $reByDate=mysqli_query($con,$quByDate);
			    $TotalRechAmount=0;
			    $TotalDebitAmount=0;
			    $TotalR_Offer=0;
			    $TotalDiffAmount=0;
			    $TotalDiffAmount1=0;
			    $TotalDiffAmount2=0;
			    $sl1=0;
			    $sl2=0;
			    $sl3=0;
			    $sl4=0;
			    while($dataByDate=mysqli_fetch_array($reByDate))
			    {
			        $TotalDebitAmount=$TotalDebitAmount+$dataByDate['Debitamount'];
			        $TotalRechAmount=$TotalRechAmount+$dataByDate['Amount'];
			        $TotalR_Offer=$TotalR_Offer+$dataByDate['R_Offer'];
			        $quGetName1="select * from retailer where Userid='".$dataByDate['Userid']."'";
			        $reGetName1=mysqli_query($con,$quGetName1);
			        $dataGetName1=mysqli_fetch_array($reGetName1);
			        
			        $LapuNo=$dataByDate['LapuNo'];
			        $quGetLapuOwner="select * from myapi where LapuNumber='$LapuNo'";
			        $reGetLapuOwner=mysqli_query($con,$quGetLapuOwner);
			        $dataGetLapuOwner=mysqli_fetch_array($reGetLapuOwner);
			        $LapuOwner=$dataGetLapuOwner['Seller'];
			        
    			    if($dataByDate['Status']=="SUCCESS")
    			    {
    			        $color="green";
    			    }
    			    elseif($dataByDate['Status']=="FAILED")
    			    {
    			        $color="red";
    			    }
    			    else
    			    {
    			        $color="blue";
    			    }
    			    
    			    if($seller=="ALL")
    			    {
    			        $sl1=$sl1+1;
    			            if($dataByDate['ApiBal']<1000 && $dataByDate['Status']=="SUCCESS")
    			            {
    			                $balColor="balColorRed";
    			            }
    			            else
    			            {
    			                $balColor="balColorBlack";
    			            }
						echo "<tr>";
							echo "<td>".$sl1."</td>";
							echo "<td>".$dataByDate['Rechargedate']."<br>".$dataByDate['Time']."</td>";
							echo "<td id='tda'><a href='User_profile.php?id=".$dataGetName1['Userid']."' target='_blank'>".$dataGetName1['Name']."</a></td>";
							echo "<td>".$dataByDate['Balance']."</td>";
							echo "<td>".$dataByDate['RetComm']."</td>";
							echo "<td>".$dataByDate['DisComm']."</td>";
							echo "<td>".$dataByDate['MdComm']."</td>";
							echo "<td>".$dataByDate['Companyname']."</td>";
							echo "<td>".$dataByDate['Mobile']."</td>";
							echo "<td>".$dataByDate['Amount']."</td>";
							echo "<td>".floor($dataByDate['R_Offer'])."</td>";
							echo "<td>".$dataByDate['API']."</td>";
							echo "<td>".$dataByDate['API_NO']."</td>";
							echo "<td>".$LapuOwner."</td>";
							echo "<td><a href='RechargeHistoryByLapu.php?lapuId=".$dataByDate['LapuNo']."&rechId=".$dataByDate['Id']."' target='_blank'>".$dataByDate['LapuNo']."</td>";
							echo "<td><p id='$balColor'>".$dataByDate['ApiBal']."</p></td>";
							echo "<td>".$dataByDate['Diff']."</td>";
							echo "<td>".$dataByDate['Operatorid']."</td>";
							echo "<td></td>";
							echo "<td><a id='rechId' href='check_status.php?id=".$dataByDate['Id']."' target='_blank'>".$dataByDate['Id']."</a></td>";
							echo "<td><p id='$color'>".$dataByDate['Status']."</p></td>";
							echo "<td>";
								if($dataByDate['CallBack']==0)
								{
									echo "<span style='font-size:18px;'>&#10008;</span>";
								}
								else
								{
									echo "<span style='font-size:18px;'>&#10004;</span>";
								}
							echo"</td>";
							echo "<td>".$dataByDate['Roaming']."</td>";
							echo "<td><a href='AccountReportsByUser.php?uid=".$dataByDate['Userid']."' target='_blank'>".floor($dataByDate['AdminDiffValue'])."</a></td>";
							if($dataByDate['ReHit']=="1" && $dataByDate['Status']=="PENDING")
							{   
								echo "<td><a href='re_hit.php?id=".$dataByDate['Id']."' target='_blank'>Re-Hit</a></td>";
							}
							else
							{
								echo "<td></td>";
							}
						echo "</tr>";
    			    }
    			    else
    			    {
    			       
    			        if($LapuOwner==$seller)
    			        {
    			            $TotalDiffAmount=$TotalDiffAmount+$dataByDate['Diff'];
    			            
    			            $roundDiffValue1=floor($dataByDate['Diff']/1000);
    			            $roundDiffAmount1=$roundDiffValue1*1000;
    			            $TotalDiffAmount1=$TotalDiffAmount1+$roundDiffAmount1;
    			            
    			            $roundDiffValue2=floor($dataByDate['Diff']/500);
    			            $roundDiffAmount2=$roundDiffValue2*500;
    			            $TotalDiffAmount2=$TotalDiffAmount2+$roundDiffAmount2;
    			            
    			            $sl2=$sl2+1;
    			            if($dataByDate['ApiBal']<1000 && $dataByDate['Status']=="SUCCESS")
    			            {
    			                $balColor="balColorRed";
    			            }
    			            else
    			            {
    			                $balColor="balColorBlack";
    			            }
    			            echo "<tr>";
								echo "<td>".$sl2."</td>";
								echo "<td>".$dataByDate['Rechargedate']."<br>".$dataByDate['Time']."</td>";
								echo "<td id='tda'><a href='User_profile.php?id=".$dataGetName1['Userid']."' target='_blank'>".$dataGetName1['Name']."</a></td>";
								echo "<td>".$dataByDate['Balance']."</td>";
								echo "<td>".$dataByDate['RetComm']."</td>";
								echo "<td>".$dataByDate['DisComm']."</td>";
								echo "<td>".$dataByDate['MdComm']."</td>";
								echo "<td>".$dataByDate['Companyname']."</td>";
								echo "<td>".$dataByDate['Mobile']."</td>";
								echo "<td>".$dataByDate['Amount']."</td>";
								echo "<td>".floor($dataByDate['R_Offer'])."</td>";
								echo "<td>".$dataByDate['API']."</td>";
								echo "<td>".$dataByDate['API_NO']."</td>";
								echo "<td>".$LapuOwner."</td>";
								echo "<td><a href='RechargeHistoryByLapu.php?lapuId=".$dataByDate['LapuNo']."&rechId=".$dataByDate['Id']."' target='_blank'>".$dataByDate['LapuNo']."</td>";
								echo "<td><p id='$balColor'>".$dataByDate['ApiBal']."</p></td>";
								echo "<td>".$dataByDate['Diff']."</td>";
								echo "<td>".$dataByDate['Operatorid']."</td>";
								echo "<td></td>";
								echo "<td><a id='rechId' href='check_status.php?id=".$dataByDate['Id']."' target='_blank'>".$dataByDate['Id']."</a></td>";
								echo "<td><p id='$color'>".$dataByDate['Status']."</p></td>";
								echo "<td>";
									if($dataByDate['CallBack']==0)
									{
										echo "<span style='font-size:18px;'>&#10008;</span>";
									}
									else
									{
										echo "<span style='font-size:18px;'>&#10004;</span>";
									}
								echo"</td>";
							    echo "<td>".$dataByDate['Roaming']."</td>";
								echo "<td><a href='AccountReportsByUser.php?uid=".$dataByDate['Userid']."' target='_blank'>".floor($dataByDate['AdminDiffValue'])."</a></td>";
								if($dataByDate['ReHit']=="1" && $dataByDate['Status']=="PENDING")
								{   
									echo "<td><a href='re_hit.php?id=".$dataByDate['Id']."' target='_blank'>Re-Hit</a></td>";
								}
								else
								{
									echo "<td></td>";
								}
							echo "</tr>";
    			        }
    			    }
			    }
			   echo "<tr>";
    					echo "<th></th>";
    					echo "<th>ALL</th>";
    					echo "<th></th>";
    					echo "<th></th>";
    					echo "<th>".$oprtr."</th>";
    					echo "<th></th>";
    					echo "<th>".$TotalRechAmount."</th>";
    					echo "<th>".$TotalR_Offer."</th>";
    					echo "<th></th>";
    					echo "<th></th>";
    					echo "<th></th>";
    					echo "<th></th>";
    					echo "<th></th>";
    					echo "<th></th>";
    					echo "<th>".$TotalDiffAmount2."</th>";
    					echo "<th>".$TotalDiffAmount."</th>";
    					echo "<th>".$TotalDiffAmount1."</th>";
    					echo "<th id='$color'>".$stat."</th>";
    					echo "<th></th>";
    					echo "<th></th>";
    					echo "<th></th>";
    					echo "<th></th>";
    					echo "<th></th>";
				echo "</tr>";
			}
			else
			{
			    date_default_timezone_set("asia/Kolkata");
			    $datetime= Date("Y-m-d - h:i:s A");
			    $time= Date("h:i:s A");
			    $fdate= Date("Y-m-d");
			    $ldate= Date("Y-m-d");
			   
			    $sl=0;
			    
    			$query="select * from recharge order by Id desc limit 30";
    			$result=mysqli_query($con,$query);
    			while($row=mysqli_fetch_array($result))
    			{
    			    $LapuNo=$row['LapuNo'];
    			    if(!empty($LapuNo))
    			    {
			            $quGetLapuOwner="select * from myapi where LapuNumber='$LapuNo'";
			            $reGetLapuOwner=mysqli_query($con,$quGetLapuOwner);
			            $dataGetLapuOwner=mysqli_fetch_array($reGetLapuOwner);
			            $LapuOwner=$dataGetLapuOwner['Seller'];
    			    }
    			    else
    			    {
    			        $LapuOwner="";
    			    }
			        
    			    $quGetName="select * from retailer where Userid='".$row['Userid']."'";
    			    $reGetName=mysqli_query($con,$quGetName);
    			    $dataGetName=mysqli_fetch_array($reGetName);
    			    if($row['Status']=="SUCCESS")
    			    {
    			        $color="green";
    			    }
    			    elseif($row['Status']=="FAILED")
    			    {
    			        $color="red";
    			    }
    			    else
    			    {
    			        $color="blue";
    			    }
    			    $sl3=$sl3+1;
    			    if($row['ApiBal']<1000 && $row['Status']=="SUCCESS")
    			    {
    			        $balColor="balColorRed";
    			    }
    			    else
    			    {
    			        $balColor="balColorBlack";
    			    }
    				echo "<tr>";
    					echo "<td>".$sl3."</td>";
    					echo "<td>".$row['Rechargedate']."<br>".$row['Time']."</td>";
    					echo "<td id='tda'><a href='RechargeHistoryByUser.php?userId=".$row['Userid']."' target='_blank'>".$dataGetName['Name']."</a></td>";
    					echo "<td>".floor($row['Balance'])."</td>";
    					echo "<td>".$row['RetComm']."</td>";
    					echo "<td>".$row['DisComm']."</td>";
    					echo "<td>".$row['MdComm']."</td>";
    					echo "<td><a href='RechageHistoryByOp.php?Op=".$row['Companyname']."' target='_blank'>".$row['Companyname']."</a></td>";
    					echo "<td>".$row['Mobile']."</td>";
    					echo "<td>".$row['Amount']."</td>";
    					echo "<td>".floor($row['R_Offer'])."</td>";
    					echo "<td>".$row['API']."</td>";
    					echo "<td>".$row['API_NO']."</td>";
    					echo "<td>".$LapuOwner."</td>";
    					echo "<td><a href='RechargeHistoryByLapu.php?lapuId=".$row['LapuNo']."&rechId=".$row['Id']."' target='_blank'>".$row['LapuNo']."</td>";
    					echo "<td><p id='$balColor'>".floor($row['ApiBal'])."</p></td>";
    					echo "<td>".floor($row['Diff'])."</td>";
    					echo "<td>".$row['Operatorid']."</td>";
    					echo "<td>".$row['AdminOpId']."</td>";
    					echo "<td><a id='rechId' href='check_status.php?id=".$row['Id']."' target='_blank'>".$row['Id']."</a></td>";
    					echo "<td><p id='$color'>".$row['Status']."</p></td>";
    					echo "<td>";
    					    if($row['CallBack']==0)
    					    {
    					        echo "<span style='font-size:18px;'>&#10008;</span>";
    					    }
    					    else
    					    {
    					        echo "<span style='font-size:18px;'>&#10004;</span>";
    					    }
    					echo"</td>";
						echo "<td>".$row['Roaming']."</td>";
    					echo "<td><a href='AccountReportsByUser.php?uid=".$row['Userid']."' target='_blank'>".floor($row['AdminDiffValue'])."</a></td>";
    					if($row['ReHit']=="1" && $row['Status']=="PENDING")
    					{   
    					    echo "<td><a href='re_hit.php?id=".$row['Id']."' target='_blank'>Re-Hit</a></td>";
    					}
    					else
    					{
    					    echo "<td></td>";
    					}
    				echo "</tr>";
    			}
				echo "<META HTTP-EQUIV ='Refresh' Content ='60' >";
			}
		?>
	</table>
</body>
</html>