<!DOCTYPE html>
<!--[if IE 8]> <html lang="en" class="ie8 no-js"> <![endif]-->
<!--[if IE 9]> <html lang="en" class="ie9 no-js"> <![endif]-->
<!--[if !IE]><!-->
<html lang="en">
<!--<![endif]-->
    
<!-- BEGIN HEAD -->
<head>
    <!--<meta charset="utf-8" />-->	 
    <title>
					Elitbuzz
			</title>
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta content="width=device-width, initial-scale=1" name="viewport" />
    <meta content="" name="description" />
    <meta content="" name="author" />
	<!-- BEGIN CORE jquery PLUGINS -->
	
    <!--script src="http://www.elitbuzz-me.com/sms/resources/assets/global/plugins/jquery-1.12.3.js" type="text/javascript"></script!-->
	<script src="assets/global/plugins/jquery.min.js" type="text/javascript"></script>
    <!-- END CORE jquery PLUGINS -->	
    <!-- BEGIN GLOBAL MANDATORY STYLES -->
    <link href="http://fonts.googleapis.com/css?family=Open+Sans:400,300,600,700&subset=all" rel="stylesheet" type="text/css" />
    <link href="assets/global/plugins/font-awesome/css/font-awesome.min.css" rel="stylesheet" type="text/css" />
    <link href="assets/global/plugins/simple-line-icons/simple-line-icons.min.css" rel="stylesheet" type="text/css" />
    <link href="assets/global/plugins/bootstrap/css/bootstrap.min.css" rel="stylesheet" type="text/css"/>
    <link href="assets/global/plugins/bootstrap-switch/css/bootstrap-switch.min.css" rel="stylesheet" type="text/css" />
	<link href="assets/global/plugins/datatables/css/dataTables.bootstrap.min.css" rel="stylesheet" type="text/css" />
	<link href="assets/global/plugins/toaster/css/toastr.css" rel="stylesheet" type="text/css" />

	<!-- END GLOBAL MANDATORY STYLES -->
    
    <link href="assets/global/css/components.min.css" rel="stylesheet" id="style_components" type="text/css" />
    <link href="assets/global/css/plugins.min.css" rel="stylesheet" type="text/css" />
	<!-- BEGIN LAYOUT STYLES -->
    <link href="assets/layout/css/layout.min.css" rel="stylesheet" type="text/css" />
    <link href="assets/layout/css/colors.min.css" rel="stylesheet" type="text/css" />
    <link href="assets/layout/css/style.css" rel="stylesheet" type="text/css" />
    <!-- END LAYOUT STYLES -->
    
    <link rel="shortcut icon" href="favicon.ico" /> </head>
<?php
include("config.php");
$sql = "SELECT * FROM `Panel3Report` ORDER BY ID ASC";
$data = mysqli_query($con,$sql);
	while( $info = mysqli_fetch_array($data) ) 
	{ 

	$a="";
	$b="";
	$id = $info['id'];
	$c=$info['chargeforsms'] ;
	$d=$info['totalsms'];
	$dnd = $info['dnd'];
	//$charge=($c * $d);
	$charge= ($d - $dnd)*$c;
	 //echo $charge;
	$chargesdeducted = $info['chargesdeducted'];
	$senderID = $info['senderid'];
	$smsText = $info ['smstext'];
	$clientname = $info['clientname'] ;
	$undelivered = $info['undelivered'] ;
	$country = $info['country'] ;
	$price_state = $info['price_type'];
	
	//$a.= date("F j, Y, g:i a",strtotime($info['senddate']));
	$a.= date("D, dS M Y g:i A",strtotime($info['senddate']));
	$delivered = $info['delivered'];
	$subtooperator = $info['subtooperator'];
	$chargeforsms = $info['chargeforsms'];
	$totalsms = $info['totalsms'];
	$pdf = $info['pdf'];
	
	$in_queue = $d - ($delivered + $subtooperator + $undelivered);
    }
?>
<style>
.modal-dialog { 
  align:center; 
  margin-top: 3%;
  padding-top:1%;
  padding-left:10%;
  padding-right:10%;  
}
</style>

<div id="detailsreports" tabindex="-1" data-backdrop="static" data-keyboard="false">
            <div >
                <div >
                    <div class="modal-header">
                        <!--<button type="button" class="close" data-dismiss="modal" aria-hidden="true"></button>-->
                        <h4 class="modal-title">Report Details<?php echo" : ". $clientname?></h4>
                    </div>
                    <div class="modal-body">
					 <div class="row">
					  <div class="col-md-2">
					  </div>
                                        <div class="col-md-8">
                                            <h4 class="font-yellow-gold">Progress</h4>
                                            <hr>
                                            <div class="progress" id="progtotalsms">
                                                                                                
                                            </div>
                                            <div class="progress" id="progsentsms">
                                                                                                
                                            </div>
                                            <div class="progress" id="progqueuesms">
                                                                                        
                                            </div>
                                        </div>
                                       
                                    </div>
                                    <div class="row">
                                        <div class="col-md-12 margin-bottom-10">
                                            <h4 class="font-yellow-gold">SMS Sent</h4>
                                            <hr>
                                        </div>
                                    </div>
                      <div class="row">
                        <div class="col-md-12 col-sm-12">
                            <div class="portlet light ">
									
                                    <div id="tbldatatabledivdetails" class="portlet-body flip-scroll">
                                        <table id="tbldatatabledetails" style="width:100%" class="table table-bordered table-striped table-condensed flip-content">
                                            <thead class="flip-content">
											
                                        <tr align = 'left'>
                                                    <th> Sent Time </th>
                                                    <th> Sender ID </th>
													<th> SMS Text </th>
													<th> Submitted</th>
													<th> Delivered </th>
													<th> Undelivered </th>
													<th> DND </th>
													<th> Submitted to Operator </th> 
													<?php
													if($charge != 0 || $chargesdeducted != 0)
													{
														?>
														<th>
														<?php
													echo "Credits Deducted";
													?>
													</th>
													<?php
													}
													?>
                                                </tr>
												<tr align = 'left'>
												<td><?php echo $a ?></td>
												<td><?php echo $senderID ?> </td>
												<td><?php echo $smsText ?> </td>
												<td><?php echo $d ?> </td>
												<td><?php echo $delivered ?> </td>
												<td><?php echo $undelivered ?> </td>
												<td><?php echo $dnd ?> </td>
												<td><?php echo $subtooperator ?> </td>
												<?php
													if($charge != 0)
													{
														?>
														<td>
														<?php
														echo "AED ".$charge;
														?>
														</td>
														<?php
													}
													else if($chargesdeducted != 0)
													{
														?>
														<td>
														<?php
														echo "AED ".$chargesdeducted;
														?>
														</td>
														<?php
													}
												?>
												
												</tr>
                                            </thead>
                                            <tbody>
                                           
                                            </tbody>
                                        </table>
                                    </div>
                               
                                </div>
                            </div>
                        </div>
                     
                    </div>
                    </div>
                   
                </div>
            </div>
        </div>
<script type = "text/javascript"></script>
<script>
(function() {	
		 (function() {
			 $('#progtotalsms').html(
			'<div class="progress-bar progress-bar-info progress-bar-striped" role="progressbar" aria-valuenow="100" aria-valuemin="0" aria-valuemax="100" style="width: 100%;">'+
			 '<div align="left" style="color:#fff ! important">Total SMS '+<?php echo $d ?>+' </div>'+
			'</div>');
			
			var totalQueue = Math.abs(<?php echo $d ?> - <?php echo $d ?>); 
			
			 var totalSentPercent = 0;
			 var totalQueuePercent = 0;
			 if(<?php echo $d ?> > 0){
				totalSentPercent = (<?php echo $d ?>*100)/<?php echo $d ?>;
				totalQueuePercent =  100-totalSentPercent;
			 }
			 
			$('#progsentsms').html(
			'<div class="progress-bar progress-bar-success progress-bar-striped" role="progressbar" aria-valuenow="100" aria-valuemin="0" aria-valuemax="100" style="width: 100%; -webkit-print-color-adjust: exact;">'+
			 '<div align="left" style="color:#fff ! important">Total Sent '+<?php echo $d ?>+' ('+totalSentPercent+' %)</div>'+
			'</div>');
			
			/*$('#progqueuesms').html(
			'<div class="progress-bar progress-bar-warning progress-bar-striped" role="progressbar" aria-valuenow="100" aria-valuemin="0" aria-valuemax="100" style="width: 100%; background-color: #f5f5f5 ! important; -webkit-print-color-adjust: exact;">'+
			 '<div align="left">In Queue '+totalQueue+' ('+totalQueuePercent+' %) </div>'+
			'</div>');*/
			
			$('#progqueuesms').html(
			'<div class="progress-bar progress-bar-warning progress-bar-striped" role="progressbar" aria-valuenow="100" aria-valuemin="0" aria-valuemax="100" style="width: 100%; background-color: #f5f5f5 ! important; -webkit-print-color-adjust: exact;">'+
			 '<div align="left" style="color:#fff ! important">In</div>'+
			'</div>');
		})();
		
})();
</script>
<style>
@media print
{
.no_print
{
display:none ! important;
}
}
</style>
<form action = "Panel3Form.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>
<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>
</html>