<?php
session_start();
error_reporting(0);
if(($_SESSION['uniqe_id']=='A') or  ($_SESSION['uniqe_id']=='S') or ($_SESSION['uniqe_id']=='D')){
		include("class.php");
	}

	
	if($_SESSION['uniqe_id']=='U' or $_SESSION['uniqe_id']==NULL)	{
		echo "<script type='text/javascript'>";
		echo "window.location='index.php'";
		echo "</script>";
	}

include_once("database_connection.php");
date_default_timezone_set('Asia/Calcutta');

?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Dashboard:Bankingproductivity</title>
<script language="javascript" type="text/javascript" src="datetimepicker.js"></script>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<!--<meta http-equiv="refresh" content="120" url="ge_dashboard.php" />-->


<link href="css/ge_dashboard.css" rel="stylesheet" type="text/css">
 <link type="text/css" href="menu/menu_admin.css" rel="stylesheet" />
  
    <script type="text/javascript" src="menu/menu.js"></script>
	<style>
	.borderHeader{
	border:1px;
	border-style:solid;
	height:75px;
	background-color:white;
	text-align:center;
	width:100%;
}
.centerimage{
	margin-top:20px;
}
.pagename
{
	text-align:center;
	margin-top:-60px;
	color:#8B0000;
	height:100px;
	
	
}

.airtellogo
{
   margin-top:-42px;

}
#searchbutton  {
	background-color:#228B22;
	color:#FFF;
	padding:5px;
	border-radius:8px;
	font-weight:bold;
}
#searchbutton:hover  {
	background-color:#228B22;
	color:#FFF;
	padding:5px;
	border-radius:8px;
}
#salutation{
	margin-top:-10px;
	text-align:CENTER;

}
/*Footer Container Start*/
#footer-container { width:100%; height:25px; background:#343434; color:#FFFFFF; font-size:15px; text-align:center; padding-top:8px;}
/*Footer Container End*/
  </style>
  
</head>
<body>

<div class="borderHeader">
	<div align=left><img src="images/kmspl.PNG" /></div><div class="pagename"><h2>PRODUCTIVITY DASHBOARD</h2></div>
</div>

   <div class="background"> 
   <?php
	
	if(($_SESSION['uniqe_id']=='S'))
	{
	include("menu/menu_superadmin.php");
	}
	if(($_SESSION['uniqe_id']=='A') or ($_SESSION['uniqe_id']=='T'))
	{
	include("menu/menu_admin.php");
	}
	if(($_SESSION['uniqe_id']=='D'))
	{
	include("menu/menu_deo.php");
	}
	else
	{
	}	
	?>
<form action="" method="post">

<?php
include("database_connection.php");
?>
<table  border="1"  width="90%">
<tr>
<td align="center" bgcolor="#F4A460"><b><font color="#191970">PRODUCTIVITY DASHBOARD TVR</font></b></td>
</tr>
</table>
<table  border="1"  width="90%">
<tr bgcolor="#F4A460">
<td align="center" height="20"><b><font color="#191970">TVR CALLER NAME</font></b></td>
<td align="center" height="20"><b><font color="#191970" font-family="Trebuchet MS">08-09AM</font></b></td>
<td align="center" height="20"><b><font color="#191970" font-family="Trebuchet MS">09-10AM</font></b></td>
<td align="center" height="20"><b><font color="#191970" font-family="Trebuchet MS">10-11AM</font></b></td>
<td align="center" height="20"><b><font color="#191970" font-family="Trebuchet MS">11-12PM</font></b></td>
<td align="center" height="20"><b><font color="#191970" font-family="Trebuchet MS">12-01PM</font></b></td>
<td align="center" height="20"><b><font color="#191970" font-family="Trebuchet MS">01-02PM</font></b></td>
<td align="center" height="20"><b><font color="#191970" font-family="Trebuchet MS">02-03PM</font></b></td>
<td align="center" height="20"><b><font color="#191970" font-family="Trebuchet MS">03-04PM</font></b></td>
<td align="center" height="20"><b><font color="#191970" font-family="Trebuchet MS">04-05PM</font></b></td>
<td align="center" height="20"><b><font color="#191970" font-family="Trebuchet MS">05-06PM</font></b></td>
<td align="center" height="20"><b><font color="#191970" font-family="Trebuchet MS">06-07PM</font></b></td>
<td align="center" height="20"><b><font color="#191970" font-family="Trebuchet MS">07-08PM</font></b></td>
<td align="center" height="20"><b><font color="#191970" font-family="Trebuchet MS">08-09PM</font></b></td>
<td align="center" height="20"><b><font color="#191970" font-family="Trebuchet MS">09-10PM</font></b></td>
<td align="center" height="20"><b><font color="#191970" font-family="Trebuchet MS">TOTAL</font></b></td>
</tr>
<?php
$scan_date=date('m-d-Y');
/*
SELECT `caller_name` FROM tvr_tbl where tvr_tbl.calling_date='03-20-2025' UNION SELECT `caller_name` FROM sbicalliing_tbl where sbicalliing_tbl.calling_date='20-03-2025' UNION SELECT `caller_name` FROM lic_callertbl where lic_callertbl.dump_date='03-20-2025'

*/
$sqltvr="SELECT DISTINCT (caller_name) FROM tvr_tbl WHERE calling_date =  '$scan_date' order BY caller_name asc" ;
$resulttvr=mysql_query($sqltvr);
while($datatvr=mysql_fetch_array($resulttvr)) {	
	$caller_name=$datatvr['caller_name'];
	$sqlt="select first_name,last_name from user_tbl where user_name='$caller_name' ";
	$resultt=mysql_query($sqlt);
	$datat=mysql_fetch_array($resultt);		
	$sqltc="select count(id) as num from tvr_tbl where caller_name='$caller_name' and calling_date='$scan_date' " ;
	$resulttc=mysql_query($sqltc);
	$datatc=mysql_fetch_array($resulttc);
	$tvr=$datatc[0];
   
    $totaltvr=$tvr;
    $totaltvrt +=$totaltvr;
	
	$time1="08:00 AM";
	$time2="08:59 AM";
	$time3="09:00 AM";
	$time4="09:59 AM";
	$time5="10:00 AM";
	$time6="10:59 AM";
	$time7="11:00 AM";
	$time8="11:59 AM";
	$time9="12:00 PM";
	$time10="12:59 PM";
	$time11="01:00 PM";
	$time12="01:59 PM";
	$time13="02:00 PM";
	$time14="02:59 PM";
	$time15="03:00 PM";
	$time16="03:59 PM";
	$time17="04:00 PM";
	$time18="04:59 PM";
	$time19="05:00 PM";
	$time20="05:59 PM";
	$time21="06:00 PM";
	$time22="06:59 PM";
	$time23="07:00 PM";
	$time24="07:59 PM";
	$time25="08:00 PM";
	$time26="08:59 PM";
	$time27="09:00 PM";
	$time28="10:00 PM";
	
   
    $sqltv1="select count(id) as num from tvr_tbl where caller_name='$caller_name' and calling_date='$scan_date' and calling_time between '$time1' and '$time2' " ;
	$resulttv1=mysql_query($sqltv1);
	$datatv1=mysql_fetch_array($resulttv1);
    $tv1=$datatv1[0];    
    $time8tvam=$tv1;
    $sqltv2="select count(id) as num from tvr_tbl where caller_name='$caller_name' and calling_date='$scan_date' and calling_time between '$time3' and '$time4' " ;
	$resulttv2=mysql_query($sqltv2);
	$datatv2=mysql_fetch_array($resulttv2);
    $tv2=$datatv2[0];    
    $time9tvam=$tv2;
    
    $sqlc3="select count(id) as num from tvr_tbl where caller_name='$caller_name' and calling_date='$scan_date' and calling_time between '$time5' and '$time6' " ;
	$resultc3=mysql_query($sqlc3);
	$datac3=mysql_fetch_array($resultc3);
    $c3=$datac3[0];    
    $time10tvam=$c3;
    
    $sqlc4="select count(id) as num from tvr_tbl where caller_name='$caller_name' and calling_date='$scan_date' and calling_time between '$time7' and '$time8' " ;
	$resultc4=mysql_query($sqlc4);
	$datac4=mysql_fetch_array($resultc4);
    $c4=$datac4[0];    
    $time11tvam=$c4;
    
    $sqlc5="select count(id) as num from tvr_tbl where caller_name='$caller_name' and calling_date='$scan_date' and calling_time between '$time9' and '$time10' " ;
	$resultc5=mysql_query($sqlc5);
	$datac5=mysql_fetch_array($resultc5);
    $c5=$datac5[0];    
    $time12tvam=$c5;
    
    $sqlc6="select count(id) as num from tvr_tbl where caller_name='$caller_name' and calling_date='$scan_date' and calling_time between '$time11' and '$time12' " ;
	$resultc6=mysql_query($sqlc6);
	$datac6=mysql_fetch_array($resultc6);
    $c6=$datac6[0];    
    $time1tvpm=$c6;
    
    $sqlc7="select count(id) as num from tvr_tbl where caller_name='$caller_name' and calling_date='$scan_date' and calling_time between '$time13' and '$time14' " ;
	$resultc7=mysql_query($sqlc7);
	$datac7=mysql_fetch_array($resultc7);
    $c7=$datac7[0];    
    $time2tvpm=$c7;
    
    $sqlc8="select count(id) as num from tvr_tbl where caller_name='$caller_name' and calling_date='$scan_date' and calling_time between '$time15' and '$time16' " ;
	$resultc8=mysql_query($sqlc8);
	$datac8=mysql_fetch_array($resultc8);
    $c8=$datac8[0];    
    $time3tvpm=$c8;
    
    $sqlc9="select count(id) as num from tvr_tbl where caller_name='$caller_name' and calling_date='$scan_date' and calling_time between '$time17' and '$time18' " ;
	$resultc9=mysql_query($sqlc9);
	$datac9=mysql_fetch_array($resultc9);
    $c9=$datac9[0];    
    $time4tvpm=$c9;
    
    $sqlc10="select count(id) as num from tvr_tbl where caller_name='$caller_name' and calling_date='$scan_date' and calling_time between '$time19' and '$time20' " ;
	$resultc10=mysql_query($sqlc10);
	$datac10=mysql_fetch_array($resultc10);
    $c10=$datac10[0];    
    $time5tvpm=$c10;
    
    $sqlc11="select count(id) as num from tvr_tbl where caller_name='$caller_name' and calling_date='$scan_date' and calling_time between '$time21' and '$time22' " ;
	$resultc11=mysql_query($sqlc11);
	$datac11=mysql_fetch_array($resultc11);
    $c11=$datac11[0];    
    $time6tvpm=$c11;
    
    $sqlc12="select count(id) as num from tvr_tbl where caller_name='$caller_name' and calling_date='$scan_date' and calling_time between '$time23' and '$time24' " ;
	$resultc12=mysql_query($sqlc12);
	$datac12=mysql_fetch_array($resultc12);
    $c12=$datac12[0];    
    $time7tvpm=$c12;
    $sqlc13="select count(id) as num from tvr_tbl where caller_name='$caller_name' and calling_date='$scan_date' and calling_time between '$time25' and '$time26' " ;
	$resultc13=mysql_query($sqlc13);
	$datac13=mysql_fetch_array($resultc13);
    $c13=$datac13[0];    
    $time8tvpm=$c13;
    
    $sqlc14="select count(id) as num from tvr_tbl where caller_name='$caller_name' and calling_date='$scan_date' and calling_time between '$time27' and '$time28' " ;
	$resultc14=mysql_query($sqlc14);
	$datac14=mysql_fetch_array($resultc14);
    $c14=$datac14[0];    
    $time9tvpm=$c;    
    
    $time8tvamt +=$time8tvam;
    $time9tvamt +=$time9tvam;
    $time10tvamt +=$time10tvam;
    $time11tvamt +=$time11tvam;
    $time12tvamt +=$time12tvam;
    $time1tvpmt +=$time1tvpm;
    $time2tvpmt +=$time2tvpm;
    $time3tvpmt +=$time3tvpm;
    $time4tvpmt +=$time4tvpm;
    $time5tvpmt +=$time5tvpm;
    $time6tvpmt +=$time6tvpm;
    $time7tvpmt +=$time7tvpm;
    $time8tvpmt +=$time8tvpm;
    $time9tvpmt +=$time9tvpm;
    
    $curtime=date('h:i A');
    $tt=strtotime($curtime);
    $t8=strtotime($time1);
    $t9=strtotime($time3);
    $t10=strtotime($time5);
    $t11=strtotime($time7);
    $t12=strtotime($time9);
    $t1=strtotime($time11);
    $t2=strtotime($time13);
    $t3=strtotime($time15);
    $t4=strtotime($time17);
    $t5=strtotime($time19);
    $t6=strtotime($time21);
    $t7=strtotime($time23);
    $t8p=strtotime($time25);
    $t9p=strtotime($time27);
    
    
    if($time8tvam<15 and $tt>$t8 )
    {
    $bgtv8="red";
    $ftv8="white";
    }
    else
    {
    $bgtv8="white";
    $ftv8="#191970";
    }
    if($time9tvam<15 and $tt>$t9)
    {
    $bgtv9="red";
    $ftv9="white";
    }
    else
    {
    $bgtv9="white";
    $ftv9="#191970";
    }
    if($time10tvam<15 and $tt>$t10)
    {
    $bgtv10="red";
    $ftv10="white";
    }
    else
    {
    $bgtv10="white";
    $ftv10="#191970";
    }
    
    if($time11tvam<15 and $tt>$t11)
    {
    $bgtv11="red";
    $ftv11="white";
    }
    else
    {
    $bgtv11="white";
    $ftv11="#191970";
    }
    if($time12tvam<15 and $tt>$t12)
    {
    $bgtv12="red";
    $ftv12="white";
    }
    else
    {
    $bg12="white";
    $f12="#191970";
    }
    if($time1tvpm<15 and $tt>$t1)
    {
    $bgtv1="red";
    $ftv1="white";
    }
    else
    {
    $bgtv1="white";
    $ftv1="#191970";
    }
    if($time2tvpm<15 and $tt>$t2)
    {
    $bgtv2="red";
    $ftv2="white";
    }
    else
    {
    $bgtv2="white";
    $ftv2="#191970";
    }
    if($time3tvpm<15  and $tt>$t3)
    {
    $bgtv3="red";
    $ftv3="white";
    }
    else
    {
    $bgtv3="white";
    $ftv3="#191970";
    }
    if($time4tvpm<15  and $tt>$t4)
    {
    $bgtv4="red";
    $ftv4="white";
    }
    else
    {
    $bgtv4="white";
    $ftv4="#191970";
    }
    if($time5tvpm<15  and $tt>$t5)
    {
    $bgtv5="red";
    $ftv5="white";
    }
    else
    {
    $bgtv5="white";
    $ftv5="#191970";
    }
    if($time6tvpm<15  and $tt>$t6)
    {
    $bgtv6="red";
    $ftv6="white";
    }
    else
    {
    $bgtv6="white";
    $ftv6="#191970";
    }
    if($time7tvpm<15  and $tt>$t7)
    {
    $bgtv7="red";
    $ftv7="white";
    }
    else
    {
    $bgtv7="white";
    $ftv7="#191970";
    }
    if($time8tvpm<15  and $tt>$t8p)
    {
    $bgtv8p="red";
    $ftv8p="white";
    }
    else
    {
    $bgtv8p="white";
    $f8p="#191970";
    }
    if($time9tvpm<15  and $tt>$t9p)
    {
    $bg9p="red";
    $ftv9p="white";
    }
    else
    {
    $bgtv9p="white";
    $ftv9p="#191970";
    }
    if($totaltvr>0)
    {
    ?>
    <tr>
<td align="center" height="20"><font color="#191970" font-family="Trebuchet MS"><b><?php echo $caller_name;?></b></font></td>
<td align="center" height="20" bgcolor="<?php echo $bgtv8 ; ?>"><font color="<?php echo $ftv8 ; ?>" font-family="Trebuchet MS"><b><?php echo $time8tvam;?></b></font></td>
<td align="center" height="20" bgcolor="<?php echo $bgtv9 ; ?>"><font color="<?php echo $ftv9 ; ?>" font-family="Trebuchet MS"><b><?php echo $time9tvam;?></b></font></td>
<td align="center" height="20" bgcolor="<?php echo $bgtv10 ; ?>"><font color="<?php echo $ftv10 ; ?>" font-family="Trebuchet MS"><b><?php echo $time10tvam;?></b></font></td>
<td align="center" height="20" bgcolor="<?php echo $bgtv11 ; ?>"><font color="<?php echo $ftv11 ; ?>" font-family="Trebuchet MS"><b><?php echo $time11tvam;?></b></font></td>
<td align="center" height="20" bgcolor="<?php echo $bgtv12 ; ?>"><font color="<?php echo $ftv12 ; ?>" font-family="Trebuchet MS"><b><?php echo $time12tvam;?></b></font></td>
<td align="center" height="20" bgcolor="<?php echo $bgtv1 ; ?>"><font color="<?php echo $ftv1 ; ?>" font-family="Trebuchet MS"><b><?php echo $time1tvpm;?></b></font></td>
<td align="center" height="20" bgcolor="<?php echo $bgtv2 ; ?>"><font color="<?php echo $ftv2 ; ?>" font-family="Trebuchet MS"><b><?php echo $time2tvpm;?></b></font></td>
<td align="center" height="20" bgcolor="<?php echo $bgtv3 ; ?>"><font color="<?php echo $ftv3 ; ?>" font-family="Trebuchet MS"><b><?php echo $time3tvpm;?></b></font></td>
<td align="center" height="20" bgcolor="<?php echo $bgtv4 ; ?>"><font color="<?php echo $ftv4 ; ?>" font-family="Trebuchet MS"><b><?php echo $time4tvpm;?></b></font></td>
<td align="center" height="20" bgcolor="<?php echo $bgtv5 ; ?>"><font color="<?php echo $ftv5 ; ?>" font-family="Trebuchet MS"><b><?php echo $time5tvpm;?></b></font></td>
<td align="center" height="20" bgcolor="<?php echo $bgtv6 ; ?>"><font color="<?php echo $ftv6 ; ?>" font-family="Trebuchet MS"><b><?php echo $time6tvpm;?></b></font></td>
<td align="center" height="20" bgcolor="<?php echo $bgtv7 ; ?>"><font color="<?php echo $ftv7 ; ?>" font-family="Trebuchet MS"><b><?php echo $time7tvpm;?></b></font></td>
<td align="center" height="20" bgcolor="<?php echo $bgtv8p ; ?>"><font color="<?php echo $ftv8p ; ?>" font-family="Trebuchet MS"><b><?php echo $time8tvpm;?></b></font></td>
<td align="center" height="20" bgcolor="<?php echo $bgtv9p ; ?>"><font color="<?php echo $ftv9p ; ?>" font-family="Trebuchet MS"><b><?php echo $time9tvpm;?></b></font></td>
<td align="center" height="20"><font color="#191970" font-family="Trebuchet MS"><b><?php echo $totaltvr;?></b></font></td>
</tr>
<?php  }
} 

?>
<!--<tr bgcolor="#F4A460">
<td align="center" height="20"><b><font color="#191970" font-family="Trebuchet MS">TOTAL</b></font></td>
<td align="center" height="20"><b><font color="#191970" font-family="Trebuchet MS"><?php echo $time8tvamt;?></font></b></td>
<td align="center" height="20"><b><font color="#191970" font-family="Trebuchet MS"><?php echo $time9tvamt;?></font></b></td>
<td align="center" height="20"><b><font color="#191970" font-family="Trebuchet MS"><?php echo $time10tvamt;?></font></b></td>
<td align="center" height="20"><b><font color="#191970" font-family="Trebuchet MS"><?php echo $time11tvamt;?></font></b></td>
<td align="center" height="20"><b><font color="#191970" font-family="Trebuchet MS"><?php echo $time12tvamt;?></font></b></td>
<td align="center" height="20"><b><font color="#191970" font-family="Trebuchet MS"><?php echo $time1tvpmt;?></font></b></td>
<td align="center" height="20"><b><font color="#191970" font-family="Trebuchet MS"><?php echo $time2tvpmt;?></font></b></td>
<td align="center" height="20"><b><font color="#191970" font-family="Trebuchet MS"><?php echo $time3tvpmt;?></font></b></td>
<td align="center" height="20"><b><font color="#191970" font-family="Trebuchet MS"><?php echo $time4tvpmt;?></font></b></td>
<td align="center" height="20"><b><font color="#191970" font-family="Trebuchet MS"><?php echo $time5tvpmt;?></font></b></td>
<td align="center" height="20"><b><font color="#191970" font-family="Trebuchet MS"><?php echo $time6tvpmt;?></font></b></td>
<td align="center" height="20"><b><font color="#191970" font-family="Trebuchet MS"><?php echo $time7tvpmt;?></font></b></td>
<td align="center" height="20"><b><font color="#191970" font-family="Trebuchet MS"><?php echo $time8tvpmt;?></font></b></td>
<td align="center" height="20"><b><font color="#191970" font-family="Trebuchet MS"><?php echo $time9tvpmt;?></font></b></td>
<td align="center" height="20"><b><font color="#191970" font-family="Trebuchet MS"><?php echo $totaltvrt;?></font></b></td>
</tr>-->
<?php
$calling_date=date('d-M-Y');
$sqltvr="SELECT DISTINCT (caller_name) FROM sbitvr_tbl WHERE calling_date1 =  '$calling_date' order BY caller_name asc" ;
$resulttvr=mysql_query($sqltvr);
while($datatvr=mysql_fetch_array($resulttvr)) {	
	$caller_name=$datatvr['caller_name'];
	$sqlt="select first_name,last_name from user_tbl where user_name='$caller_name' ";
	$resultt=mysql_query($sqlt);
	$datat=mysql_fetch_array($resultt);		
	$sqltc="select count(id) as num from sbitvr_tbl where caller_name='$caller_name' and calling_date1='$calling_date' " ;
	$resulttc=mysql_query($sqltc);
	$datatc=mysql_fetch_array($resulttc);
	$tvr=$datatc[0];
   
    $totaltvr=$tvr;
    $totaltvrt +=$totaltvr;
	
	$time1="08:00 AM";
	$time2="08:59 AM";
	$time3="09:00 AM";
	$time4="09:59 AM";
	$time5="10:00 AM";
	$time6="10:59 AM";
	$time7="11:00 AM";
	$time8="11:59 AM";
	$time9="12:00 PM";
	$time10="12:59 PM";
	$time11="01:00 PM";
	$time12="01:59 PM";
	$time13="02:00 PM";
	$time14="02:59 PM";
	$time15="03:00 PM";
	$time16="03:59 PM";
	$time17="04:00 PM";
	$time18="04:59 PM";
	$time19="05:00 PM";
	$time20="05:59 PM";
	$time21="06:00 PM";
	$time22="06:59 PM";
	$time23="07:00 PM";
	$time24="07:59 PM";
	$time25="08:00 PM";
	$time26="08:59 PM";
	$time27="09:00 PM";
	$time28="10:00 PM";
	
   
    $sqltv1="select count(id) as num from sbitvr_tbl where caller_name='$caller_name' and calling_date1='$calling_date' and calling_time1 between '$time1' and '$time2' " ;
	$resulttv1=mysql_query($sqltv1);
	$datatv1=mysql_fetch_array($resulttv1);
    $tv1=$datatv1[0];    
    $time8tvam=$tv1;
    $sqltv2="select count(id) as num from sbitvr_tbl where caller_name='$caller_name' and calling_date1='$calling_date' and calling_time1 between '$time3' and '$time4' " ;
	$resulttv2=mysql_query($sqltv2);
	$datatv2=mysql_fetch_array($resulttv2);
    $tv2=$datatv2[0];    
    $time9tvam=$tv2;
    
    $sqlc3="select count(id) as num from sbitvr_tbl where caller_name='$caller_name' and calling_date1='$calling_date' and calling_time1 between '$time5' and '$time6' " ;
	$resultc3=mysql_query($sqlc3);
	$datac3=mysql_fetch_array($resultc3);
    $c3=$datac3[0];    
    $time10tvam=$c3;
    
    $sqlc4="select count(id) as num from sbitvr_tbl where caller_name='$caller_name' and calling_date1='$calling_date' and calling_time1 between '$time7' and '$time8' " ;
	$resultc4=mysql_query($sqlc4);
	$datac4=mysql_fetch_array($resultc4);
    $c4=$datac4[0];    
    $time11tvam=$c4;
    
    $sqlc5="select count(id) as num from sbitvr_tbl where caller_name='$caller_name' and calling_date1='$calling_date' and calling_time1 between '$time9' and '$time10' " ;
	$resultc5=mysql_query($sqlc5);
	$datac5=mysql_fetch_array($resultc5);
    $c5=$datac5[0];    
    $time12tvam=$c5;
    
    $sqlc6="select count(id) as num from sbitvr_tbl where caller_name='$caller_name' and calling_date1='$calling_date' and calling_time1 between '$time11' and '$time12' " ;
	$resultc6=mysql_query($sqlc6);
	$datac6=mysql_fetch_array($resultc6);
    $c6=$datac6[0];    
    $time1tvpm=$c6;
    
    $sqlc7="select count(id) as num from sbitvr_tbl where caller_name='$caller_name' and calling_date1='$calling_date' and calling_time1 between '$time13' and '$time14' " ;
	$resultc7=mysql_query($sqlc7);
	$datac7=mysql_fetch_array($resultc7);
    $c7=$datac7[0];    
    $time2tvpm=$c7;
    
    $sqlc8="select count(id) as num from sbitvr_tbl where caller_name='$caller_name' and calling_date1='$calling_date' and calling_time1 between '$time15' and '$time16' " ;
	$resultc8=mysql_query($sqlc8);
	$datac8=mysql_fetch_array($resultc8);
    $c8=$datac8[0];    
    $time3tvpm=$c8;
    
    $sqlc9="select count(id) as num from sbitvr_tbl where caller_name='$caller_name' and calling_date1='$calling_date' and calling_time1 between '$time17' and '$time18' " ;
	$resultc9=mysql_query($sqlc9);
	$datac9=mysql_fetch_array($resultc9);
    $c9=$datac9[0];    
    $time4tvpm=$c9;
    
    $sqlc10="select count(id) as num from sbitvr_tbl where caller_name='$caller_name' and calling_date1='$calling_date' and calling_time1 between '$time19' and '$time20' " ;
	$resultc10=mysql_query($sqlc10);
	$datac10=mysql_fetch_array($resultc10);
    $c10=$datac10[0];    
    $time5tvpm=$c10;
    
    $sqlc11="select count(id) as num from sbitvr_tbl where caller_name='$caller_name' and calling_date1='$calling_date' and calling_time1 between '$time21' and '$time22' " ;
	$resultc11=mysql_query($sqlc11);
	$datac11=mysql_fetch_array($resultc11);
    $c11=$datac11[0];    
    $time6tvpm=$c11;
    
    $sqlc12="select count(id) as num from sbitvr_tbl where caller_name='$caller_name' and calling_date1='$calling_date' and calling_time1 between '$time23' and '$time24' " ;
	$resultc12=mysql_query($sqlc12);
	$datac12=mysql_fetch_array($resultc12);
    $c12=$datac12[0];    
    $time7tvpm=$c12;
    $sqlc13="select count(id) as num from sbitvr_tbl where caller_name='$caller_name' and calling_date1='$calling_date' and calling_time1 between '$time25' and '$time26' " ;
	$resultc13=mysql_query($sqlc13);
	$datac13=mysql_fetch_array($resultc13);
    $c13=$datac13[0];    
    $time8tvpm=$c13;
    
    $sqlc14="select count(id) as num from sbitvr_tbl where caller_name='$caller_name' and calling_date1='$calling_date' and calling_time1 between '$time27' and '$time28' " ;
	$resultc14=mysql_query($sqlc14);
	$datac14=mysql_fetch_array($resultc14);
    $c14=$datac14[0];    
    $time9tvpm=$c;    
    
    $time8tvamt +=$time8tvam;
    $time9tvamt +=$time9tvam;
    $time10tvamt +=$time10tvam;
    $time11tvamt +=$time11tvam;
    $time12tvamt +=$time12tvam;
    $time1tvpmt +=$time1tvpm;
    $time2tvpmt +=$time2tvpm;
    $time3tvpmt +=$time3tvpm;
    $time4tvpmt +=$time4tvpm;
    $time5tvpmt +=$time5tvpm;
    $time6tvpmt +=$time6tvpm;
    $time7tvpmt +=$time7tvpm;
    $time8tvpmt +=$time8tvpm;
    $time9tvpmt +=$time9tvpm;
    
    $curtime=date('h:i A');
    $tt=strtotime($curtime);
    $t8=strtotime($time1);
    $t9=strtotime($time3);
    $t10=strtotime($time5);
    $t11=strtotime($time7);
    $t12=strtotime($time9);
    $t1=strtotime($time11);
    $t2=strtotime($time13);
    $t3=strtotime($time15);
    $t4=strtotime($time17);
    $t5=strtotime($time19);
    $t6=strtotime($time21);
    $t7=strtotime($time23);
    $t8p=strtotime($time25);
    $t9p=strtotime($time27);
    
    
    if($time8tvam<15 and $tt>$t8 )
    {
    $bgtv8="red";
    $ftv8="white";
    }
    else
    {
    $bgtv8="white";
    $ftv8="#191970";
    }
    if($time9tvam<15 and $tt>$t9)
    {
    $bgtv9="red";
    $ftv9="white";
    }
    else
    {
    $bgtv9="white";
    $ftv9="#191970";
    }
    if($time10tvam<15 and $tt>$t10)
    {
    $bgtv10="red";
    $ftv10="white";
    }
    else
    {
    $bgtv10="white";
    $ftv10="#191970";
    }
    
    if($time11tvam<15 and $tt>$t11)
    {
    $bgtv11="red";
    $ftv11="white";
    }
    else
    {
    $bgtv11="white";
    $ftv11="#191970";
    }
    if($time12tvam<15 and $tt>$t12)
    {
    $bgtv12="red";
    $ftv12="white";
    }
    else
    {
    $bg12="white";
    $f12="#191970";
    }
    if($time1tvpm<15 and $tt>$t1)
    {
    $bgtv1="red";
    $ftv1="white";
    }
    else
    {
    $bgtv1="white";
    $ftv1="#191970";
    }
    if($time2tvpm<15 and $tt>$t2)
    {
    $bgtv2="red";
    $ftv2="white";
    }
    else
    {
    $bgtv2="white";
    $ftv2="#191970";
    }
    if($time3tvpm<15  and $tt>$t3)
    {
    $bgtv3="red";
    $ftv3="white";
    }
    else
    {
    $bgtv3="white";
    $ftv3="#191970";
    }
    if($time4tvpm<15  and $tt>$t4)
    {
    $bgtv4="red";
    $ftv4="white";
    }
    else
    {
    $bgtv4="white";
    $ftv4="#191970";
    }
    if($time5tvpm<15  and $tt>$t5)
    {
    $bgtv5="red";
    $ftv5="white";
    }
    else
    {
    $bgtv5="white";
    $ftv5="#191970";
    }
    if($time6tvpm<15  and $tt>$t6)
    {
    $bgtv6="red";
    $ftv6="white";
    }
    else
    {
    $bgtv6="white";
    $ftv6="#191970";
    }
    if($time7tvpm<15  and $tt>$t7)
    {
    $bgtv7="red";
    $ftv7="white";
    }
    else
    {
    $bgtv7="white";
    $ftv7="#191970";
    }
    if($time8tvpm<15  and $tt>$t8p)
    {
    $bgtv8p="red";
    $ftv8p="white";
    }
    else
    {
    $bgtv8p="white";
    $f8p="#191970";
    }
    if($time9tvpm<15  and $tt>$t9p)
    {
    $bg9p="red";
    $ftv9p="white";
    }
    else
    {
    $bgtv9p="white";
    $ftv9p="#191970";
    }
	?>
	<tr>
<td align="center" height="20"><font color="#191970" font-family="Trebuchet MS"><b><?php echo $caller_name;?></b></font></td>
<td align="center" height="20" bgcolor="<?php echo $bgtv8 ; ?>"><font color="<?php echo $ftv8 ; ?>" font-family="Trebuchet MS"><b><?php echo $time8tvam;?></b></font></td>
<td align="center" height="20" bgcolor="<?php echo $bgtv9 ; ?>"><font color="<?php echo $ftv9 ; ?>" font-family="Trebuchet MS"><b><?php echo $time9tvam;?></b></font></td>
<td align="center" height="20" bgcolor="<?php echo $bgtv10 ; ?>"><font color="<?php echo $ftv10 ; ?>" font-family="Trebuchet MS"><b><?php echo $time10tvam;?></b></font></td>
<td align="center" height="20" bgcolor="<?php echo $bgtv11 ; ?>"><font color="<?php echo $ftv11 ; ?>" font-family="Trebuchet MS"><b><?php echo $time11tvam;?></b></font></td>
<td align="center" height="20" bgcolor="<?php echo $bgtv12 ; ?>"><font color="<?php echo $ftv12 ; ?>" font-family="Trebuchet MS"><b><?php echo $time12tvam;?></b></font></td>
<td align="center" height="20" bgcolor="<?php echo $bgtv1 ; ?>"><font color="<?php echo $ftv1 ; ?>" font-family="Trebuchet MS"><b><?php echo $time1tvpm;?></b></font></td>
<td align="center" height="20" bgcolor="<?php echo $bgtv2 ; ?>"><font color="<?php echo $ftv2 ; ?>" font-family="Trebuchet MS"><b><?php echo $time2tvpm;?></b></font></td>
<td align="center" height="20" bgcolor="<?php echo $bgtv3 ; ?>"><font color="<?php echo $ftv3 ; ?>" font-family="Trebuchet MS"><b><?php echo $time3tvpm;?></b></font></td>
<td align="center" height="20" bgcolor="<?php echo $bgtv4 ; ?>"><font color="<?php echo $ftv4 ; ?>" font-family="Trebuchet MS"><b><?php echo $time4tvpm;?></b></font></td>
<td align="center" height="20" bgcolor="<?php echo $bgtv5 ; ?>"><font color="<?php echo $ftv5 ; ?>" font-family="Trebuchet MS"><b><?php echo $time5tvpm;?></b></font></td>
<td align="center" height="20" bgcolor="<?php echo $bgtv6 ; ?>"><font color="<?php echo $ftv6 ; ?>" font-family="Trebuchet MS"><b><?php echo $time6tvpm;?></b></font></td>
<td align="center" height="20" bgcolor="<?php echo $bgtv7 ; ?>"><font color="<?php echo $ftv7 ; ?>" font-family="Trebuchet MS"><b><?php echo $time7tvpm;?></b></font></td>
<td align="center" height="20" bgcolor="<?php echo $bgtv8p ; ?>"><font color="<?php echo $ftv8p ; ?>" font-family="Trebuchet MS"><b><?php echo $time8tvpm;?></b></font></td>
<td align="center" height="20" bgcolor="<?php echo $bgtv9p ; ?>"><font color="<?php echo $ftv9p ; ?>" font-family="Trebuchet MS"><b><?php echo $time9tvpm;?></b></font></td>
<td align="center" height="20"><font color="#191970" font-family="Trebuchet MS"><b><?php echo $totaltvr;?></b></font></td>
</tr>
<?php  }
 

?>
<tr bgcolor="#F4A460">
<td align="center" height="20"><b><font color="#191970" font-family="Trebuchet MS">TOTAL</b></font></td>
<td align="center" height="20"><b><font color="#191970" font-family="Trebuchet MS"><?php echo $time8tvamt;?></font></b></td>
<td align="center" height="20"><b><font color="#191970" font-family="Trebuchet MS"><?php echo $time9tvamt;?></font></b></td>
<td align="center" height="20"><b><font color="#191970" font-family="Trebuchet MS"><?php echo $time10tvamt;?></font></b></td>
<td align="center" height="20"><b><font color="#191970" font-family="Trebuchet MS"><?php echo $time11tvamt;?></font></b></td>
<td align="center" height="20"><b><font color="#191970" font-family="Trebuchet MS"><?php echo $time12tvamt;?></font></b></td>
<td align="center" height="20"><b><font color="#191970" font-family="Trebuchet MS"><?php echo $time1tvpmt;?></font></b></td>
<td align="center" height="20"><b><font color="#191970" font-family="Trebuchet MS"><?php echo $time2tvpmt;?></font></b></td>
<td align="center" height="20"><b><font color="#191970" font-family="Trebuchet MS"><?php echo $time3tvpmt;?></font></b></td>
<td align="center" height="20"><b><font color="#191970" font-family="Trebuchet MS"><?php echo $time4tvpmt;?></font></b></td>
<td align="center" height="20"><b><font color="#191970" font-family="Trebuchet MS"><?php echo $time5tvpmt;?></font></b></td>
<td align="center" height="20"><b><font color="#191970" font-family="Trebuchet MS"><?php echo $time6tvpmt;?></font></b></td>
<td align="center" height="20"><b><font color="#191970" font-family="Trebuchet MS"><?php echo $time7tvpmt;?></font></b></td>
<td align="center" height="20"><b><font color="#191970" font-family="Trebuchet MS"><?php echo $time8tvpmt;?></font></b></td>
<td align="center" height="20"><b><font color="#191970" font-family="Trebuchet MS"><?php echo $time9tvpmt;?></font></b></td>
<td align="center" height="20"><b><font color="#191970" font-family="Trebuchet MS"><?php echo $totaltvrt;?></font></b></td>
</tr>
</table>

</table>
</div>
<div style="clear:both; float:none;" class="clear">
</div>
<table>
<tr height="50">
<td height="50">&nbsp;</td>
</tr>
</table>

</div>

	</div>	
	<div id="x"></div>	
</body>
</html>
