<?php
session_start();
error_reporting(1);
include('includes/config.php');
if (strlen($_SESSION['signAdminlogin']) == 0) {
	header('location:index.php');
} else {
?>
	<!doctype html>
	<html lang="en" class="no-js">

	<head>
		<meta charset="UTF-8">
		<meta http-equiv="X-UA-Compatible" content="IE=edge">
		<meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1, maximum-scale=1">
		<meta name="description" content="">
		<meta name="author" content="">
		<meta name="theme-color" content="#3e454c">

		<title>SignAdmin Dashboard</title>

		<!-- Font awesome -->
		<link rel="stylesheet" href="css/font-awesome.min.css">
		<!-- Sandstone Bootstrap CSS -->
		<link rel="stylesheet" href="css/bootstrap.min.css">
		<!-- Admin Stye -->
		<link rel="stylesheet" href="css/style.css">
	</head>

	<body>
		<?php include('includes/header.php'); ?>

		<div class="ts-main-content">
			<?php include('includes/leftbar.php'); ?>
			<div class="content-wrapper">
				<div class="container-fluid">

					<div class="row">
						<div class="col-md-12">

							<h2 class="page-title">Sign Dashboard</h2>

							<div class="row">
								<div class="col-md-12">
									<div class="row">
										<div class="col-md-3">
											<div class="panel panel-default">
												<div class="panel-body bk-primary text-light">
													<div class="stat-panel text-center">
														<?php
														//$today = date('Y-m-d');
														
														date_default_timezone_set('Asia/Dhaka');
														$today = date('Ymd');
														
                                                        $sql = "SELECT id FROM signcopy_sub WHERE date_flt = :today";
														$query = $dbh->prepare($sql);
														$query->bindParam(':today', $today, PDO::PARAM_STR);
														$query->execute();
														$results = $query->fetchAll(PDO::FETCH_OBJ);
														$bg = $query->rowCount();
														?>
														<div class="stat-panel-number h1 "><?php echo htmlentities($bg); ?></div>
														<div class="stat-panel-title text-uppercase">Submition Today</div>
													</div>
												</div>
												<!--<a href="userlist.php" class="block-anchor panel-footer">Full Detail <i class="fa fa-arrow-right"></i></a>-->
											</div>
										</div>
										<div class="col-md-3">
											<div class="panel panel-default">
												<div class="panel-body bk-success text-light">
													<div class="stat-panel text-center">

														<?php
														//$today = date('Y-m-d');
														
														date_default_timezone_set('Asia/Dhaka');
														$today = date('Ymd');
														
														$sql1 = "SELECT id from signcopy_sub where delivery_flt = :today and status = 2";
														$query1 = $dbh->prepare($sql1);;
														$query1->bindParam(':today', $today, PDO::PARAM_STR);
														$query1->execute();
														$results1 = $query1->fetchAll(PDO::FETCH_OBJ);
														$regbd = $query1->rowCount();
														?>
														<div class="stat-panel-number h1 "><?php echo htmlentities($regbd); ?></div>
														<div class="stat-panel-title text-uppercase">Completed Today</div>
													</div>
												</div>
												<!--<a href="recharge.php" class="block-anchor panel-footer text-center">Full Detail &nbsp; <i class="fa fa-arrow-right"></i></a>-->
											</div>
										</div>

										<div class="col-md-3">
											<div class="panel panel-default">
												<div class="panel-body bk-danger text-light">
													<div class="stat-panel text-center">

														<?php
														$today = date('Y-m-d');
														$sql12 = "SELECT id from signcopy_sub where DATE(sub_at) = :today and status = 1";
														$query12 = $dbh->prepare($sql12);;
														$query12->bindParam(':today', $today, PDO::PARAM_STR);
														$query12->execute();
														$results12 = $query12->fetchAll(PDO::FETCH_OBJ);
														$regbd2 = $query12->rowCount();
														?>
														<div class="stat-panel-number h1 "><?php echo htmlentities($regbd2); ?></div>
														<div class="stat-panel-title text-uppercase">Pending Today</div>
													</div>
												</div>
												<a href="Pending.php" class="block-anchor panel-footer text-center">Full Detail &nbsp; <i class="fa fa-arrow-right"></i></a>
											</div>
										</div>
										<div class="col-md-3">
											<div class="panel panel-default">
												<div class="panel-body bk-info text-light">
													<div class="stat-panel text-center">
														<?php
														$sql6 = "SELECT id from signcopy_sub";
														$query6 = $dbh->prepare($sql6);;
														$query6->execute();
														$results6 = $query6->fetchAll(PDO::FETCH_OBJ);
														$query = $query6->rowCount();
														?>
														<div class="stat-panel-number h1 "><?php echo htmlentities($query) ?></div>
														<div class="stat-panel-title text-uppercase">Lifetime Submission</div>
													</div>
												</div>
												<!--<a href="signDash.php" class="block-anchor panel-footer text-center">Full Detail &nbsp; <i class="fa fa-arrow-right"></i></a>-->
											</div>
										</div>

									</div>
								</div>
							</div>
							
							<h2 class="page-title">Server Dashboard</h2>

							<div class="row">
								<div class="col-md-12">
									<div class="row">
										<div class="col-md-3">
											<div class="panel panel-default">
												<div class="panel-body bk-primary text-light">
													<div class="stat-panel text-center">
														<?php
														$today = date('Y-m-d');
                                                        $sql = "SELECT id FROM servercopy_sub WHERE DATE(sub_at) = :today";
														$query = $dbh->prepare($sql);
														$query->bindParam(':today', $today, PDO::PARAM_STR);
														$query->execute();
														$results = $query->fetchAll(PDO::FETCH_OBJ);
														$bg = $query->rowCount();
														?>
														<div class="stat-panel-number h1 "><?php echo htmlentities($bg); ?></div>
														<div class="stat-panel-title text-uppercase">Submition Today</div>
													</div>
												</div>
												<!--<a href="userlist.php" class="block-anchor panel-footer">Full Detail <i class="fa fa-arrow-right"></i></a>-->
											</div>
										</div>
										<div class="col-md-3">
											<div class="panel panel-default">
												<div class="panel-body bk-success text-light">
													<div class="stat-panel text-center">

														<?php
														$today = date('Y-m-d');
														$sql1 = "SELECT id from servercopy_sub where DATE(sub_at) = :today and status = 2";
														$query1 = $dbh->prepare($sql1);;
														$query1->bindParam(':today', $today, PDO::PARAM_STR);
														$query1->execute();
														$results1 = $query1->fetchAll(PDO::FETCH_OBJ);
														$regbd = $query1->rowCount();
														?>
														<div class="stat-panel-number h1 "><?php echo htmlentities($regbd); ?></div>
														<div class="stat-panel-title text-uppercase">Completed Today</div>
													</div>
												</div>
												<!--<a href="recharge.php" class="block-anchor panel-footer text-center">Full Detail &nbsp; <i class="fa fa-arrow-right"></i></a>-->
											</div>
										</div>

										<div class="col-md-3">
											<div class="panel panel-default">
												<div class="panel-body bk-danger text-light">
													<div class="stat-panel text-center">

														<?php
														$today = date('Y-m-d');
														$sql12 = "SELECT id from servercopy_sub where DATE(sub_at) = :today and status = 1";
														$query12 = $dbh->prepare($sql12);;
														$query12->bindParam(':today', $today, PDO::PARAM_STR);
														$query12->execute();
														$results12 = $query12->fetchAll(PDO::FETCH_OBJ);
														$regbd2 = $query12->rowCount();
														?>
														<div class="stat-panel-number h1 "><?php echo htmlentities($regbd2); ?></div>
														<div class="stat-panel-title text-uppercase">Pending Today</div>
													</div>
												</div>
												<a href="server-pending.php" class="block-anchor panel-footer text-center">Full Detail &nbsp; <i class="fa fa-arrow-right"></i></a>
											</div>
										</div>
										<div class="col-md-3">
											<div class="panel panel-default">
												<div class="panel-body bk-info text-light">
													<div class="stat-panel text-center">
														<?php
														$sql6 = "SELECT id from servercopy_sub";
														$query6 = $dbh->prepare($sql6);;
														$query6->execute();
														$results6 = $query6->fetchAll(PDO::FETCH_OBJ);
														$query = $query6->rowCount();
														?>
														<div class="stat-panel-number h1 "><?php echo htmlentities($query) ?></div>
														<div class="stat-panel-title text-uppercase">Lifetime Submission</div>
													</div>
												</div>
												<!--<a href="signDash.php" class="block-anchor panel-footer text-center">Full Detail &nbsp; <i class="fa fa-arrow-right"></i></a>-->
											</div>
										</div>

									</div>
								</div>
							</div>
							
							<h2 class="page-title">Card Dashboard</h2>

							<div class="row">
								<div class="col-md-12">
									<div class="row">
										<div class="col-md-3">
											<div class="panel panel-default">
												<div class="panel-body bk-primary text-light">
													<div class="stat-panel text-center">
														<?php
														$today = date('Y-m-d');
                                                        $sql = "SELECT id FROM cardcopy_sub WHERE DATE(sub_at) = :today";
														$query = $dbh->prepare($sql);
														$query->bindParam(':today', $today, PDO::PARAM_STR);
														$query->execute();
														$results = $query->fetchAll(PDO::FETCH_OBJ);
														$bg = $query->rowCount();
														?>
														<div class="stat-panel-number h1 "><?php echo htmlentities($bg); ?></div>
														<div class="stat-panel-title text-uppercase">Submition Today</div>
													</div>
												</div>
												<!--<a href="userlist.php" class="block-anchor panel-footer">Full Detail <i class="fa fa-arrow-right"></i></a>-->
											</div>
										</div>
										<div class="col-md-3">
											<div class="panel panel-default">
												<div class="panel-body bk-success text-light">
													<div class="stat-panel text-center">

														<?php
														$today = date('Y-m-d');
														$sql1 = "SELECT id from cardcopy_sub where DATE(sub_at) = :today and status = 2";
														$query1 = $dbh->prepare($sql1);;
														$query1->bindParam(':today', $today, PDO::PARAM_STR);
														$query1->execute();
														$results1 = $query1->fetchAll(PDO::FETCH_OBJ);
														$regbd = $query1->rowCount();
														?>
														<div class="stat-panel-number h1 "><?php echo htmlentities($regbd); ?></div>
														<div class="stat-panel-title text-uppercase">Completed Today</div>
													</div>
												</div>
												<!--<a href="recharge.php" class="block-anchor panel-footer text-center">Full Detail &nbsp; <i class="fa fa-arrow-right"></i></a>-->
											</div>
										</div>

										<div class="col-md-3">
											<div class="panel panel-default">
												<div class="panel-body bk-danger text-light">
													<div class="stat-panel text-center">

														<?php
														$today = date('Y-m-d');
														$sql12 = "SELECT id from cardcopy_sub where DATE(sub_at) = :today and status = 1";
														$query12 = $dbh->prepare($sql12);;
														$query12->bindParam(':today', $today, PDO::PARAM_STR);
														$query12->execute();
														$results12 = $query12->fetchAll(PDO::FETCH_OBJ);
														$regbd2 = $query12->rowCount();
														?>
														<div class="stat-panel-number h1 "><?php echo htmlentities($regbd2); ?></div>
														<div class="stat-panel-title text-uppercase">Pending Today</div>
													</div>
												</div>
												<a href="card-pending.php" class="block-anchor panel-footer text-center">Full Detail &nbsp; <i class="fa fa-arrow-right"></i></a>
											</div>
										</div>
										<div class="col-md-3">
											<div class="panel panel-default">
												<div class="panel-body bk-info text-light">
													<div class="stat-panel text-center">
														<?php
														$sql6 = "SELECT id from cardcopy_sub";
														$query6 = $dbh->prepare($sql6);;
														$query6->execute();
														$results6 = $query6->fetchAll(PDO::FETCH_OBJ);
														$query = $query6->rowCount();
														?>
														<div class="stat-panel-number h1 "><?php echo htmlentities($query) ?></div>
														<div class="stat-panel-title text-uppercase">Lifetime Submission</div>
													</div>
												</div>
												<!--<a href="signDash.php" class="block-anchor panel-footer text-center">Full Detail &nbsp; <i class="fa fa-arrow-right"></i></a>-->
											</div>
										</div>

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

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

		<!-- Loading Scripts -->
		<script src="js/jquery.min.js"></script>
		<script src="js/bootstrap.min.js"></script>
		<script src="js/main.js"></script>

		<script>
			window.onload = function() {

				// Line chart from swirlData for dashReport
				var ctx = document.getElementById("dashReport").getContext("2d");
				window.myLine = new Chart(ctx).Line(swirlData, {
					responsive: true,
					scaleShowVerticalLines: false,
					scaleBeginAtZero: true,
					multiTooltipTemplate: "<%if (label){%><%=label%>: <%}%><%= value %>",
				});

				// Pie Chart from doughutData
				var doctx = document.getElementById("chart-area3").getContext("2d");
				window.myDoughnut = new Chart(doctx).Pie(doughnutData, {
					responsive: true
				});

				// Dougnut Chart from doughnutData
				var doctx = document.getElementById("chart-area4").getContext("2d");
				window.myDoughnut = new Chart(doctx).Doughnut(doughnutData, {
					responsive: true
				});

			}
		</script>
	</body>

	</html>
<?php } ?>