<?php
session_start();
include('../includes/config.php');

// login check
if (!isset($_SESSION['loggedin']) || $_SESSION['loggedin'] !== true) {
?>
<script>
window.location.href = '../index';
</script>
<?php
exit();
}

// session token check
if (!isset($_SESSION['token']) || strlen($_SESSION['token']) !== 32) {
    session_destroy();
?>
<script>
window.location.href = '../index';
</script>
<?php
exit();
}

$token = $_SESSION['token'];
$userid = $_SESSION['userid'];

// DB verify
$res = mysqli_query($conn, "SELECT session_token FROM usertable WHERE userid='$userid' LIMIT 1");
$data = mysqli_fetch_assoc($res);

if (!$data || $data['session_token'] !== $token) {
    session_destroy();
    exit("Invalid Session!");
}
?>
<!DOCTYPE html>


<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="hi" lang="hi" dir="ltr"><head><meta http-equiv="content-type" content="text/html;charset=UTF-8"><!-- /Added by HTTrack -->

<meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate">
   <meta http-equiv="Pragma" content="no-cache">
    <meta http-equiv="Expires" content="0">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <meta name="title" content="Civil Registration System">
    <title>Civil Registration System</title>

<script disable-devtool-auto src="https://cdn.jsdelivr.net/npm/disable-devtool@latest"></script>
    <link rel="shortcut icon" href="/web/images/favicon.ico">
    <link rel="stylesheet" type="text/css" media="screen" href="/web/css/style.css">
<link rel="stylesheet" type="text/css" media="screen" href="/web/css/default.css">
<link rel="stylesheet" type="text/css" media="screen" href="/web/css/main.css">
<link rel="stylesheet" type="text/css" media="screen" href="/web/css/jquery.ui.all.css">
<link rel="stylesheet" type="text/css" media="screen" href="/web/css/jquery-ui-1.10.0.custom.css">
<link rel="stylesheet" type="text/css" media="screen" href="/web/css/jquery.ui.base.css">

    <script type="text/javascript" src="../web/js/mm_menu.js"></script>
<script type="text/javascript" src="../web/js/jquery-1.9.0.js"></script>
<script type="text/javascript" src="../web/js/jquery-ui-1.10.0.custom.js"></script>
<script type="text/javascript" src="../web/js/json_parse.js"></script>
<script type="text/javascript" src="../web/js/jquery.ui.core.js"></script>
<script type="text/javascript" src="../web/js/jquery.ui.datepicker-new.js"></script>
<script type="text/javascript" src="../web/js/jquery.ui.widget.js"></script>
<script type="text/javascript" src="../web/js/jquery.validate.js"></script>
<script type="text/javascript" src="../web/js/unicef.js"></script>
<script type="text/javascript" src="../web/js/jquery.blockUI.js"></script>

	
            <meta http-equiv="Content-Language" content="hi">
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8">

    
    <script type="text/javascript">
      function preventBack(){
        window.history.forward();
      }

      setTimeout("preventBack()", 0);
      window.onunload=function(){null};
//    window.history.forward(-1);
    </script>

  </head>
  <body>
     
    <div class="fixed_modal">
    <div class="fixed_inner" style="background-color:white; padding:15px; width:200px; margin: 230px 0px 0px 548px; ">
	<p><b>Birth Reporting</b> <a href="javascript:void(0)" class="closedeathpopup" style="float: right;
    font-size: 17px;
    font-family: cursive; text-decoration:none; color: red;"><b>X</b></a></p><p></p>
	<form method="post" action="#" onsubmit="return false;"></form>
        <p><strong>From</strong></p>
		<p><input type="text" name="datefrom" autocomplete="off" id="datepicker" value="" style="padding:5px;"></p>
		<p><strong>To</strong></p><p></p><p><input type="text" name="dateto" autocomplete="off" id="datepicker1" value="" style="padding:5px;"></p>
		<p><input type="button" onclick="Export_to_Excel_box_birth();" class="btn" name="submit" value="Export" style="width: 70px;"></p>
			
    </div>
</div><div class="fixed_modal1">
    <div class="fixed_inner" style="background-color:white; padding:15px; width:200px;     margin: 230px 0px 0px 548px; ">
	<p><b>Death Reporting</b> <a href="javascript:void(0)" class="closedeathpopup" style="float: right;
    font-size: 17px;
    font-family: cursive; text-decoration:none; color: red;"><b>X</b></a></p>
	<form method="post" action="#" onsubmit="return false"></form>
        <p><strong>From</strong></p>
		<p><input type="text" name="datefrom" id="datepicker2" value="" autocomplete="off" style="padding:5px;"></p>
		<p><strong>To</strong></p><p></p><p><input type="text" name="dateto" autocomplete="off" id="datepicker3" value="" style="padding:5px;"></p>
		<p><input type="button" onclick="Export_to_Excel_box_death();" class="btn" name="submit" value="Export" style="width: 70px;"></p>
			
    </div>
</div><table width="100%" border="0" cellspacing="0" cellpadding="0">
	  

      
<tbody><tr style="padding: 0px !important; margin: 0px !important; line-height: 0px !important; float: left !important; height: 0px !important;">
	<td>
	<style>
	
	 .s-menu{
		visibility: hidden;
		position: absolute;
		right: -113px;
		margin-top: -25px;
		padding-left: 0px;
	}
	
	</style>
	
	
	
		<script type="text/javascript">
		<!--
		var timeout = 500;
		var closetimer = 0;
		var ddmenuitem = 0;

		// open hidden layer
		function mopen(id) {
			// cancel close timer
			mcancelclosetime();
			// close old layer
			if (ddmenuitem)
			ddmenuitem.style.visibility = 'hidden';
			// get new layer and show it
			ddmenuitem = document.getElementById(id);
			ddmenuitem.style.visibility = 'visible';
		}
		// close showed layer
		function mclose() {
			if (ddmenuitem)
			ddmenuitem.style.visibility = 'hidden';
		}

		// go close timer
		function mclosetime() {
			closetimer = window.setTimeout(mclose, timeout);
		}

		// cancel close timer
		function mcancelclosetime() {
			if (closetimer) {
				window.clearTimeout(closetimer);
				closetimer = null;
			}
		}
		// close layer when click-out
		document.onclick = mclose;
		// -->
		</script>
		
		<script type="text/javascript">
		<!--
		var timeout1 = 500;
		var closetimer1 = 0;
		var ddmenuitem1 = 0;

		// open hidden layer
		function mopen1(id) {
			// cancel close timer
			mcancelclosetime1();
			// close old layer
			if (ddmenuitem1)
			ddmenuitem1.style.visibility = 'hidden';
			// get new layer and show it
			ddmenuitem1 = document.getElementById(id);
			ddmenuitem1.style.visibility = 'visible';
		}
		// close showed layer
		function mclose1() {
			if (ddmenuitem1)
			ddmenuitem1.style.visibility = 'hidden';
		}

		// go close timer
		function mclosetime1() {
			closetimer1 = window.setTimeout(mclose1, timeout1);
		}

		// cancel close timer
		function mcancelclosetime1() {
			if (closetimer1) {
				window.clearTimeout(closetimer1);
				closetimer1 = null;
			}
		}
		// close layer when click-out
		document.onclick = mclose1;
		// -->
		</script>
		
	</td>
</tr>
<tr>
	<tr>
  <td class="header-top-strip">
    <div id="head">
      <div class="logo">
        <a href="index">
          <img alt="Logo" title="Logo" border="0" width="297" height="125" src="/web/images/logo-top.jpg">
        </a>
      </div>
      <div style="position: absolute; right: 20px; top: 20px;"></div>

      <div style="position: absolute; right: 0px; top: 85px;">
        <ul id="sddm" style="margin:11px 1px 0px 0px !important;">

          <li><a href="index">Home</a></li>

          <li>
            <a href="javascript:void(0);" onmouseover="mopen('m9')" onmouseout="mclosetime()">User Management</a>
            <div id="m9" onmouseover="mcancelclosetime()" onmouseout="mclosetime()">
              <a href="user_add">Data Entry Operator Add</a>
              <a href="users">Data Entry Operator List</a>
            </div>
          </li>

          <li>
            <a href="javascript:void(0);" onmouseover="mopen('m13')" onmouseout="mclosetime()">Hospital Management</a>
            <div id="m13" onmouseover="mcancelclosetime()" onmouseout="mclosetime()">
              <a href="b_add">Birth Hospital Add</a>
              <a href="b_list">Birth Hospital List</a>
              <a href="d_add">Death Hospital Add</a>
              <a href="d_list">Death Hospital List</a>
            </div>
          </li>

          <li>
            <a href="javascript:void(0);" onmouseover="mopen('m11')" onmouseout="mclosetime()">Wallet</a>
            <div id="m11" onmouseover="mcancelclosetime()" onmouseout="mclosetime()">
              <a href="addwallet">Add Wallet</a>
              <a href="wallet">My Wallet</a>
              <a href="transfer">Transfer Wallet</a>
            </div>
          </li>

          <li>
            <a href="javascript:void(0);" onmouseover="mopen('m1')" onmouseout="mclosetime()">Birth</a>
            <div id="m1" onmouseover="mcancelclosetime()" onmouseout="mclosetime()">
             <a href="birthapply">Birth Apply </a>	
			 <a href="birthapply_s1">Birth Apply s1</a>											
			 <a href="birthapply_s2">Birth Apply s2</a>	
			 <a href="birthlist">Birth List</a>	
            </div>
          </li>
        
          <li>
            <a href="javascript:void(0);" onmouseover="mopen('m2')" onmouseout="mclosetime()">Death</a>
            <div id="m2" onmouseover="mcancelclosetime()" onmouseout="mclosetime()">
              <a href="deathapply">Death Apply</a>
              <a href="deathlist">Death List</a>
            </div>
          </li>

          <li>
            <a href="javascript:void(0);" onmouseover="mopen('m15')" onmouseout="mclosetime()">Profile</a>
            <div id="m15" onmouseover="mcancelclosetime()" onmouseout="mclosetime()">
              <a href="profile">Update Profile</a>
              <a href="editpassword">Change Password</a>
            </div>
          </li>

          <li id="mor">
            <a href="javascript:void(0);" onmouseover="mopen('mr')" onmouseout="mclosetime()">Reports</a>
            <div id="mr" onmouseover="mcancelclosetime()" onmouseout="mclosetime()" style="visibility: hidden;">
              <a href="birthlist">Birth Report</a>
              <a href="deathlist">Death Report</a>
              <a style="border-bottom: none;" href="settings">Monitoring Report</a>
            </div>
          </li>

          <li><span>Still Birth</span></li>
          <li><a style="border:none;pointer-events:auto;" href="\logout">Logout</a></li>
        </ul>
      </div>
    </div>
  </td>
</tr>

																																																	<script type="text/javascript">
$(document).ready(function () {

    // Reports restriction between 11AM–2PM
    $("#mor>a").click(function (e) {
        var currtime = 1660227751;   // should come from server (Unix timestamp)
        var starttime = 1660195800;  // 11:00 AM
        var endtime   = 1660206600;  // 02:00 PM

        if (currtime >= starttime && currtime <= endtime) {
            alert("Reports cannot be accessed between 11 AM to 2 PM");
            return false;
        }
    });

    // Show/hide options based on online/offline flag
    var offlineVsOnlineFlag = "0"; // should come from backend
    if (offlineVsOnlineFlag == "0") {
        $(".online").hide();
    } else if (offlineVsOnlineFlag == "1") {
        $(".offlineOption").hide();
    }
});

// Export Birth Report
function Export_to_Excel_box_birth() {
    var frmdt = $('#datepicker').val();
    var todt  = $('#datepicker1').val();

    if (!frmdt || !todt) {
        alert('Please Select Date !!');
    } else {
        $("#pdf_excel, #popupbox, #fadebox").hide();
        $('#datepicker, #datepicker1').val('');
        window.location = "/web/index/birth/BirthExportReportCR/frmdt/" + frmdt + "/todt/" + todt;
    }
}

// Export Death Report
function Export_to_Excel_box_death() {
    var frmdt = $('#datepicker2').val();
    var todt  = $('#datepicker3').val();

    if (!frmdt || !todt) {
        alert('Please Select Date !!');
    } else {
        $("#pdf_excel, #popupbox, #fadebox").hide();
        $('#datepicker2, #datepicker3').val('');
        window.location = "/web/index/death/DeathExportReportCR/frmdt/" + frmdt + "/todt/" + todt;
    }
}
</script>




<!-- birth,death,stillbirth reports calender--> 

																																																																												
																																																																												
<!--birth start-->	
<style>
    .fixed_modal{position: fixed; width: 100%; height: 100%; background: rgba(0,0,0,0.7); z-index: 99; display:none;}
	.fixed_modal1{position: fixed; width: 100%; height: 100%; background: rgba(0,0,0,0.7); z-index: 99; display:none;}
</style>




		<!-- birth end-->

      <tr><td valign="middle" class="welcome-strip-bg" style="border: none !important;">
 <table cellspacing="0" cellpadding="0" border="0" align="center" width="96%">
 <tbody><tr>
   <td align="left" width="46%" class="welcome-clock">
   	<div class="datetime">
<span id="live_date">Monday, January 9, 2023, </span>
<span id="live_clock">15:46:05 IST </span>
</div>

<script type="text/javascript">
var lcl = new Date();

function shdate() {
    var mnth = ["January","February","March","April","May","June","July","August","September","October","November","December"];
    var day_name = ["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"];
    
    var dayname = day_name[lcl.getDay()];
    var dd = lcl.getDate();
    var mm = lcl.getMonth();
    var yy = lcl.getFullYear();
    
    var dtdp = dayname + ", " + mnth[mm] + " " + dd + ", " + yy + ", ";
    document.getElementById("live_date").innerHTML = dtdp;
}

function showClock() {
    lcl.setSeconds(lcl.getSeconds() + 1);

    var hours = lcl.getHours();
    var minutes = lcl.getMinutes();
    var seconds = lcl.getSeconds();

    if (minutes < 10) minutes = "0" + minutes;
    if (seconds < 10) seconds = "0" + seconds;

    var myclock = hours + ":" + minutes + ":" + seconds + " IST";
    document.getElementById("live_clock").innerHTML = myclock;

    setTimeout(showClock, 1000);
}

shdate();
showClock();
</script> </td>
    <td class="welcome-clock" colspan="2" align="right">
  	 <span class="ml-2 d-none d-lg-inline-block"><span>WELCOME :&nbsp; </span> <span class="text-dark"><?php echo $_SESSION['name']?>&nbsp;- (Sub Registrar)
   	 
   </span></span></td>
 </tr></tbody>
 </table>
</td>
</tr>
<tr><td>&nbsp;</td></tr> 
               

	
		       




    </tbody></table>
  




