<!DOCTYPE html>
<?php
 ob_start();
 include("config.php");
require_once('tcpdf.php');

?>
<?php
  $query = "select * from email_report order by id desc limit 1";
  $results=mysqli_query($con,$query);
   $email_report = mysqli_fetch_object($results);
  
    
?> 
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge" charset=utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>imail-frame</title>
<link href="favicon.ico" rel="shortcut icon" type="image/x-icon">
<link rel="stylesheet" href="bootstrap-3.2.0-dist/css/bootstrap.min.css">
<link rel="stylesheet" href="bootstrap-3.2.0-dist/css/bootstrap-theme.min.css">
<script src="libs/jquery-1.11.1.min.js"></script>
<script src="bootstrap-3.2.0-dist/js/bootstrap.min.js"></script>
<link rel="stylesheet" href="style.css">
<link rel="stylesheet" href="printStyle.css" media="print"><!-- Modified by Sana on [31.12.17][To print report]-->
<link rel="stylesheet" href="rwd-table.min.css">

<script type="text/javascript" src="canvasjs/canvasjs.min.js"></script>
<script type="text/javascript" src="canvasjs/jquery.canvasjs.min.js"></script>
<script type="text/javascript" src="canvasjs/html2canvas.js"></script>
</head>
<script>
function myFunction()
{
window.print();
}
</script>
<body>
<!-------------------------Header Section----------------------------------------->
<div id="screen">
<header>
	<div class="container">
		<div class="row">
			<div class="col-sm-12">
				<div class="col-sm-3">
					<a href="#"><img src="images/logo.png" alt="" /></a>
				</div>
				<div class="col-sm-9 text-right login">
					<ul>
						<li><img src="images/user-icon.png" alt=""/></li>
						<li><a href="#"><span>Imail Frame</span></a></li>
						<li><a href="index.php?lg=1">Sign Out</a></li>						
					</ul>
				</div>
			</div>
		</div>
	</div>
</header>


<div class="menu">
	<div class="container">
		<div class="row">
			<div class="col-sm-10">
				<ul>
					<li><a href="form.php">Dashboard</a></li>
					<li><a href="">Subscribers</a></li>
					<li><a href="">Create / Send</a></li>
					<li><a href="">Forms</a></li>
					<li class="act"><a class="actv" href="">Reports</a>
						<ul class="submenu active">
							<li><a href="">Blast</a></li>
							<li><a href="">Social Share</a></li>
							<li><a href="">Custom Reports</a></li>
						</ul>	
					</li>
				</ul>
				
			</div>
			<div class="col-sm-2">
				<ul>
					<li><a href="">Private Label Manager</a></li>
				</ul>
			</div>
		</div>
	</div>
</div>
<div class="submenu-data">
</div>


 
<div class="middle">
	<div class="container">
		<div class="row">
			<div class="col-sm-12">
				<h1>Blast Report</h1>
			</div>
		</div>
		<div class="row">
			<div class="col-sm-12">
				<div class="col-sm-12 remove-padding table-data">
					<div class="col-sm-12 table-value">
						<div class="col-sm-9">
							<h2>
								<img src="images/order-icon.png" alt="" />
								
								<!--Modified by Sana on [18.01.17][To display arabic text in rtl direction][Start]-->
								
								<?php
								if((mb_detect_encoding($email_report->subject)== "UTF-8") && (preg_match('/[a-zA-Z]/' , $email_report->subject)))
								{ ?>
								<h3h dir ltr><?php echo htmlentities($email_report->subject, ENT_COMPAT, 'UTF-8')?> </h3h>
								<?php
								}
								else if(mb_detect_encoding($email_report->subject)== "UTF-8")
								{								
								?>
								<h3h dir = rtl> <?php echo ($email_report->subject); ?> </h3h>
								<?php
								}
								else
								{
								 echo ($email_report->subject) ; 
								}
								 ?> <span>( <?php echo $email_report->subscriber; ?> People )</span>
								<!--Modified by Sana on [18.01.17][To display arabic text in rtl direction][End]-->
							</h2>
						</div>
						<div class="col-sm-3 text-right">
							<h3>
								<img src="images/date-icon.png" alt="" /><?php echo date('F d, Y : g:i A' , strtotime($email_report->datetime)); ?>
							</h3>
						</div>
					</div>
					<div class="col-sm-12 remove-padding">
						<div class="table-responsive remove-padding table-entry col-sm-8" data-pattern="priority-columns"> 
						
							<table cellspacing="0" id="tech-companies-1" class="table table-small-font  table-striped">
								<tbody>
									<tr>
										<td style="border-top:none;"><span>Blast Id:</span></td>
										<td style="border-top:none; font-size: 12px;"><?php echo $email_report->id; ?></td>
										<td style="border-top:none;"></td>
									</tr>
									<tr>
										<td><span>From:</span></td>
										<td style="font-size: 12px;"><?php echo $email_report->from; ?></td>
										<td></td>
									</tr>
									<tr>
										<td><span>Reply To:</span></td>
										<td style="font-size: 12px;"><?php echo $email_report->reply; ?></td>
										<td></td>
									</tr>
									<tr>
										<td><span>To:</span></td>
										<td><a href="#"><img src="images/sub.png" alt=""/>  Subscribers</a></td>
										<td><span style="text-align:right; font-size: 13px;"><?php echo $email_report->subscriber; ?> people</span></td>
									</tr>
									<tr>
										<td><span>Status:</span></td>
										<td style="font-size: 12px;"><img src="images/right.png" alt=""/>Sent</td>
										<td></td>
									</tr>
									<tr>
										<td><span>Completed at:</span></td>
										<td style="font-size: 12px;"><?php echo date('F d, Y : g:i A' , strtotime($email_report->completed_date)) ;?></td>
										<td></td>
									</tr>
								</tbody>
							</table>
				
						</div>
						<div class="col-sm-4 email">
							<div class="email-data">
								<h2>View the sent Email</h2>
								<div class="col-sm-12">
									<div class="col-sm-6">
										<a href="#">
										<img src="images/html.png" alt="" /><span>HTML</span> version</a>
									</div>
									<div class="col-sm-6">
										<a href="#">
										<img src="images/text.png" alt="" /><span>Text</span> version</a>
									</div>
								</div>
								<div class="clearfix"></div>
							</div>
						</div>
					</div>
				</div>
			</div>
		</div>
		<div class="row">
			<div class="col-sm-12 tab">
				<div class="tab-inner" role="tabpanel">
			<!---------- Nav tabs ------------------->
					  <ul class="nav nav-tabs" role="tablist">
						<li role="presentation" class="active"><a href="#step-1" aria-controls="Summary" role="tab" data-toggle="tab">Summary</a></li>
						<li role="presentation"><a>Delivery Report</a></li>
						<li role="presentation"><a>Views</a></li>
						<li role="presentation"><a>Social Views</a></li>
						<li role="presentation"><a>Clicks</a></li>
						<li role="presentation"><a>Unsubscribes</a></li>
						<li role="presentation"><a>Forwards</a></li>
						<li role="presentation"><a>Widgets</a></li>
					  </ul>
			<!---------- Tab panes ----------------------->
				<div class="col-sm-8 remove-padding">
					<div class="tab-content">
						<div role="tabpanel" class="tab-pane active" id="step-1">
							<h1>Summary</h1>
							<div class="col-sm-12 text-center cricle-data">
								<!--img src="images/cricle.png" alt="" /-->
								<div id="chartContainer" style="height: 300px; width: 100%;"></div>	
								
								<script type="text/javascript">
									window.onload = function () {										
										   CanvasJS.addColorSet("greenShades",
											[//colorSet Array
											"#50B332",
											"#038EC5",
											"#FFAE19"               
											]);
										var chart = new CanvasJS.Chart("chartContainer",
										{
											colorSet: "greenShades",
											
													animationEnabled: true,
											legend:{
												verticalAlign: "center",
												horizontalAlign: "left",
												fontSize: 15,
												fontFamily: "Helvetica"        
											},
											theme: "theme2",
											data: [
											{        
												type: "pie",       
												indexLabelFontFamily: "Garamond",       
												indexLabelFontSize: 15,
												indexLabel: "{label} ({x}), {y}%",
												startAngle:-20,      
												showInLegend: false,
												toolTipContent:"{legendText} {y}%",
												dataPoints: [
												{  y: <?php	echo number_format($email_report->delivered,2);?>, legendText:"Delivered", label: "Delivered", x: <?php echo $email_report->delivereds;?>},
												{  y: <?php echo number_format($email_report->undelivered,2);?>, legendText:"Undelivered", label: "Undelivered", x: <?php echo $email_report->undelivereds;?> }, 		
												{  y: <?php echo number_format($email_report->bounced,2);?>, legendText:"Bounced", label: "Bounced", x: <?php echo $email_report->bounceds;?>, legendText: "Bounced", label: "Bounced"}
											]
											}
											]
										});
										chart.render();
									}
									</script>
							</div>
						</div>
						
						<div role="tabpanel" class="tab-pane" id="step-2">...</div>
						<div role="tabpanel" class="tab-pane" id="step-3">...</div>
						<div role="tabpanel" class="tab-pane" id="step-4">...</div>
						<div role="tabpanel" class="tab-pane" id="step-5">...</div>
						<div role="tabpanel" class="tab-pane" id="step-6">...</div>
						<div role="tabpanel" class="tab-pane" id="step-7">...</div>
						<div role="tabpanel" class="tab-pane" id="step-8">...</div>
					</div>
				</div>
				</div>
				
				<div class="col-sm-4 remove-padding">
					<div class="table-data">
						<div class="col-sm-12 table-value">
							<div class="col-sm-6 remove-padding">
								<h2><a href="#">Unique Viewers</a></h2>
							</div>
							<div class="col-sm-6 count remove-padding">
								<?php echo number_format($email_report->unique_views) ;?><br />
							<?php 	
							
							?>
								<span><?php echo number_format($email_report->unique_view,2); ?>% of Delivered</span>
							</div>
						</div>
						<div class="col-sm-12 table-value tab-in">
							<div class="col-sm-6 remove-padding">
								<h2><a href="#">Total Viewers</a></h2>
							</div>
							<div class="col-sm-6 count remove-padding">
								<p><?php echo $email_report->tot_views ;?></p>
							</div>
						</div>
						<div class="clearfix"></div>
					</div>
					<div class="table-data">
						<div class="col-sm-12 table-value">
							<div class="col-sm-6 remove-padding">
								<h2><a href="#">Social Viewers</a></h2>
							</div>
							<div class="col-sm-6 count remove-padding">
								<?php echo $email_report->social_views ;?>
							</div>
						</div>
						<div class="col-sm-12 table-value tab-in tab-in-data">
							<div class="col-sm-6 remove-padding">
								<h2>Facebook</h2>
							</div>
							<div class="col-sm-6 count remove-padding">
								<p><?php echo $email_report->facebook ;?></p>
							</div>
							<div class="col-sm-6 remove-padding">
								<h2>Twitter</h2>
							</div>
							<div class="col-sm-6 count remove-padding">
								<p><?php echo $email_report->twitter ;?></p>
							</div>
							<div class="col-sm-6 remove-padding">
								<h2>Linkedin</h2>
							</div>
							<div class="col-sm-6 count remove-padding">
								<p><?php echo $email_report->linked ;?></p>
							</div>
							<div class="col-sm-6 remove-padding">
								<h2>Other</h2>
							</div>
							<div class="col-sm-6 count remove-padding">
								<p><?php echo $email_report->other ;?></p>
							</div>
						</div>
						
						<div class="clearfix"></div>
					</div>
					<div class="table-data">
						<div class="col-sm-12 table-value tab-total">
							<div class="col-sm-6 remove-padding">
								<h2><a href="#">Unique Clickers</a></h2>
								<span><?php echo number_format($email_report->unique_clicker,2) ;?>% of Delivered</span>
							</div>
							<div class="col-sm-6 count remove-padding">
								<?php echo number_format($email_report->unique_clickers) ;?>
							</div>
						</div>
						<div class="col-sm-12 table-value tab-in">
							<div class="col-sm-6 remove-padding">
								<h2><a href="#">Total Clicks</a></h2>
							</div>
							<div class="col-sm-6 count remove-padding">
								<p><?php echo $email_report->total_clicks ;?></p>
							</div>
						</div>
						<div class="clearfix"></div>
					</div>
				</div>
			</div>
		</div>
	</div>
</div>
</div>
<!-- Modified by Sana on [31.12.17][To print report][Start]-->
<form action = "email_report.php" method="post">
<div style="float: left; padding-left: 500px;border-radius:50px;" class="no_print"><input type = "submit" style = "border-radius:100px;background-color: #d3d3d3" name="Create New Report" value = "Create New Report" id="newreport"></input></div>
</form>
<div style="float: right; padding-right: 600px;" class="no_print"><input type = "submit" style= "border-radius:100px;background-color: #d3d3d3;" name="save" value = "Save Report" id="save" onclick="window.print();"></input></div>

</body>
<!-- Modified by Sana on [31.12.17][To print report][End]-->
</html>





