<!DOCTYPE html>
<?php
require_once('connection/db.php');
require_once('convert_marathi.php');
// like i said, we must never forget to start the session
session_start();
// is the one accessing this page logged in or not?
if (!isset($_SESSION['logged_in'])|| $_SESSION['logged_in'] !== true)
	{
		// not logged in, move to login page
		header('Location: index.php');
		exit;
	}
$username = $_SESSION['User_Name'];
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Tapal Admin System</title>
<link rel="stylesheet" href="css/style.default.css" type="text/css" />
<link rel="stylesheet" href="css/bootstrap-fileupload.min.css" type="text/css" />
<link rel="stylesheet" href="css/bootstrap-timepicker.min.css" type="text/css" />
<link rel="stylesheet" href="css/responsive-tables.css">
<script type="text/javascript" src="js/jquery-1.9.1.js"></script>
<script type="text/javascript" src="js/jsapi.js"></script>
<script type="text/javascript" src="unicode.js"></script>
<script type="text/javascript" src="js/jquery-1.9.1.min.js"></script>
<script type="text/javascript" src="js/jquery-migrate-1.1.1.min.js"></script>
<script type="text/javascript" src="js/jquery-ui-1.9.2.min.js"></script>
<script type="text/javascript" src="js/bootstrap.min.js"></script>
<script type="text/javascript" src="js/bootstrap-fileupload.min.js"></script>
<script type="text/javascript" src="js/bootstrap-timepicker.min.js"></script>
<script type="text/javascript" src="js/jquery.uniform.min.js"></script>
<script type="text/javascript" src="js/jquery.dataTables.min.js"></script>
<script type="text/javascript" src="js/jquery.validate.min.js"></script>
<script type="text/javascript" src="js/jquery.tagsinput.min.js"></script>
<script type="text/javascript" src="js/jquery.autogrow-textarea.js"></script>
<script type="text/javascript" src="js/charCount.js"></script>
<script type="text/javascript" src="js/colorpicker.js"></script>
<script type="text/javascript" src="js/ui.spinner.min.js"></script>
<script type="text/javascript" src="js/chosen.jquery.min.js"></script>
<script type="text/javascript" src="js/jquery.cookie.js"></script>
<script type="text/javascript" src="js/modernizr.min.js"></script>
<script type="text/javascript" src="js/responsive-tables.js"></script>
<script type="text/javascript" src="js/custom.js"></script>
<script type="text/javascript" src="js/forms.js"></script>
<!-- Script required of tab functioning -->	 
<script type="text/javascript" src="prettify/prettify.js"></script>
<script type="text/javascript" src="js/elements.js"></script>
<script type="text/javascript">
    jQuery(document).ready(function(){
        // dynamic table
        jQuery('#dyntable').dataTable({
            "sPaginationType": "full_numbers",
            "aaSortingFixed": [[0,'asc']],
            "fnDrawCallback": function(oSettings) {
                jQuery.uniform.update();
            }
        });
        
        jQuery('#dyntable2').dataTable( {
            "bScrollInfinite": true,
            "bScrollCollapse": true,
            "sScrollY": "300px"
        });
        
    });
</script>
</head>
<body>
<div class="mainwrapper">
	<div class="header">
		<div class="logo">
			<div style="float:left;"><img src="images\t-soba.png" style="height:95px;width:95px;" alt="" /></div>
			<div style="float:right;margin-top:-50px;margin-right:5px;"><font color="white" size="3px;" style="font-weight:bold">पोलीस अधिक्षक कार्यालय,<br><br> जि.रायगड</font></a></div>
        </div>
        <div class="headerinner">
			<ul class="headmenu">
				<!---------------------------------------------------------------------------------------------
										Notification Code
				----------------------------------------------------------------------------------------------->
				<li class="odd">
                    <a class="dropdown-toggle" data-toggle="dropdown" href="#">
					 <?php 
						$f_dt=date("Y-m-01");
					 
						convert_marathi();
						$qry1=mysql_query("Select * FROM  incoming_letters_transaction i, tapal_to_dpt_transaction t
						WHERE t.nasti_nashta_dt < '$f_dt'
						AND t.nasti_nashta_dt!='0000-00-00'
						AND t.final_nashta_dt IS NULL
						AND t.ltr_id=i.ltr_id
						AND t.dept_id_from=(select dept_id from login where login_id='$username')") OR die("".mysql_error());
						
						
						$cnt=mysql_num_rows($qry1);
						?>
						<span class="count"><?php echo $cnt;?></span>
                        <center><img src="images/silver-bell-md.png" style="height:40px;width:50px;" class="headmenu-label"></center>
                        <span class="headmenu-label">मागील संदर्भ नष्ट  <br>करणे बाकी </span>
                    </a>
                    <ul class="dropdown-menu">
						<table>
                        <?php 
						echo "<li style=width:500px;>
								<tr>
									<td> &nbsp&nbsp&nbsp&nbsp <b> आवक_क्र. </b></td>
									<td>&nbsp&nbsp&nbsp&nbsp <b> संदर्भ_क्र. </b></td>
									<td>&nbsp&nbsp&nbsp&nbsp <b> विषय </b></td>
									<td>&nbsp&nbsp&nbsp&nbsp <b> नस्‍ती नष्‍ट दिनांक</b></td></tr>
									<tr><td colspan=3>&nbsp;</td>
								</tr>
							</li>";
						
						while($row=mysql_fetch_array($qry1))
						{ 
							$nast_dt=date("d-m-Y",strtotime($row['nasti_nashta_dt']));
							echo "<li style=width:400px;><tr><td style=height:18px;>&nbsp&nbsp&nbsp&nbsp".$row['ltr_inword_no']."</td><td>&nbsp&nbsp&nbsp&nbsp".$row['ref_no']."</td><td>&nbsp&nbsp&nbsp&nbsp".$row['subject']."</td>
							<td style=height:18px;>&nbsp&nbsp&nbsp&nbsp".$nast_dt."</td></tr></li>";
						}
						?>
						</table>
                    </ul>
                </li>
				
				
				<li class="odd">
                    <a class="dropdown-toggle" data-toggle="dropdown" href="#">
					<?php 
					$f_dt=date("Y-m-01");
					$l_dt=date("Y-m-t");
					$date123 = date('Y-m-d');
					
					convert_marathi();
					$result = mysql_query("Select * FROM  incoming_letters_transaction i, tapal_to_dpt_transaction t
						WHERE t.nasti_nashta_dt BETWEEN '$f_dt' AND '$l_dt'
						AND t.nasti_nashta_dt!='0000-00-00'
						AND t.final_nashta_dt IS NULL
						AND t.ltr_id=i.ltr_id
						AND t.dept_id_from=(select dept_id from login where login_id='$username')") or die("cccc".mysql_error());
									
								
						$cnt=mysql_num_rows($result);
						
						
						?>
						<span class="count"><?php echo $cnt;?></span>
                        <center><img src="images/silver-bell-md.png" style="height:40px;width:50px;" class="headmenu-label"></center>
                        <span class="headmenu-label"> चालू महिन्यातील संदर्भ  <br>नष्ट करणे बाकी</span>
                    </a>
                    <ul class="dropdown-menu">
						<table>
                        <?php 
						echo "<li style=width:500px;><tr><td> &nbsp&nbsp&nbsp&nbsp <b> आवक_क्र. </b></td>
						<td>&nbsp&nbsp&nbsp&nbsp <b> संदर्भ_क्र. </b></td>
						<td>&nbsp&nbsp&nbsp&nbsp <b> विषय </b></td>
						<td>&nbsp&nbsp&nbsp&nbsp <b> नस्‍ती नष्‍ट दिनांक</b></td></tr>
						<tr><td colspan=3>&nbsp;</td></tr>
						</li>";
						
						while($row=mysql_fetch_array($result))
						{ 
							$nast_dt=date("d-m-Y",strtotime($row['nasti_nashta_dt']));
							echo "<li style=width:500px;><tr style=height:20px;><td style=height:18px;>&nbsp&nbsp&nbsp&nbsp".$row['ltr_inword_no']."</td><td>&nbsp&nbsp&nbsp&nbsp".$row['ref_no']."</td><td style=height:18px;>&nbsp&nbsp&nbsp&nbsp".$row['subject']."</td>
							<td style=height:18px;>&nbsp&nbsp&nbsp&nbsp".$nast_dt."</td>
							</tr></li>";
						}
						
						?>
						</table>
                    </ul>
                </li>
				<li class="odd">
                    <a class="dropdown-toggle" data-toggle="dropdown" href="#">
					<?php 
						convert_marathi();
						$date123 = date('Y-m-d');
					/*	$result5=mysql_query("SELECT * FROM  incoming_letters_transaction WHERE 
						(incoming_letters_transaction.sent_dt < DATE_SUB('$date123',INTERVAL 30 DAY)  AND incoming_letters_transaction.dept_id!='0' AND incoming_letters_transaction.status='pending') AND incoming_letters_transaction.dept_id =(SELECT dept_id from login where login_id = '$username')") or die("".mysql_error()); */
						
							//accepted by dept but nt taken ny action
								$result = mysql_query("SELECT t.action_taken, t.dpt_inword_no, t.dpt_ltr_id, t.dpt_ltr_rec_dt, t.dpt_inword_no, t.desk_id, t.dept_id_from, i.subject, t.update_date, t.dispatched_date, t.status, di.addressed_to, t.ltr_status, i.sender_name, i.ltr_id, i.ltr_inword_no, i.receive_dt, i.ref_dt, i.ref_no, i.dept_id, i.document, t.scan_doc, di.outword_no, di.dispatched_to, t.ltr_category, t.assign_no 
								FROM incoming_letters_transaction i LEFT OUTER JOIN tapal_to_dpt_transaction t ON i.ltr_id = t.ltr_id 
								LEFT OUTER JOIN dispatched_transaction di ON ( di.ltr_id = t.ltr_id AND di.desk_ltr_id='0')
								WHERE (t.dpt_ltr_rec_dt < DATE_SUB('$date123',INTERVAL 14 DAY) ) 
								AND t.ltr_status='' AND t.returned_choice=''
								AND t.dept_id_from = ( SELECT dept_id from login where login_id = '$username' )") or die("cccc".mysql_error());
									
								//not accepted by dept
								$result1 = mysql_query("SELECT t.action_taken, t.dpt_inword_no, t.dpt_ltr_id, t.dpt_ltr_rec_dt, t.dpt_inword_no, t.desk_id, t.dept_id_from, i.subject, t.update_date, t.dispatched_date, t.status, di.addressed_to, t.ltr_status, i.sender_name, i.ltr_id, i.ltr_inword_no, i.receive_dt, i.ref_dt, i.ref_no, i.dept_id, i.document, t.scan_doc, di.outword_no, di.dispatched_to, t.ltr_category, t.assign_no 
								FROM incoming_letters_transaction i LEFT OUTER JOIN tapal_to_dpt_transaction t ON i.ltr_id = t.ltr_id 
								LEFT OUTER JOIN dispatched_transaction di ON ( di.ltr_id = t.ltr_id AND di.desk_ltr_id='0')
								WHERE i.status='pending' AND i.sent_dt < DATE_SUB('$date123',INTERVAL 14 DAY)
								AND i.dept_id = (SELECT dept_id from login where login_id = '$username')") or die("cccc2".mysql_error());
								
						$cnt=mysql_num_rows($result);
						$cnt1=mysql_num_rows($result1);
						$count=$cnt+$cnt1;
						
						?>
						<span class="count"><?php echo $count;?></span>
                        <center><img src="images/silver-bell-md.png" style="height:40px;width:50px;" class="headmenu-label"></center>
                        <span class="headmenu-label">तीन आठवड्यापेक्षा <br>जास्त प्रलंबित संदर्भ  </span>
                    </a>
                    <ul class="dropdown-menu">
						<table>
                        <?php 
						
					echo "<li style=width:500px;><tr><td> &nbsp&nbsp&nbsp&nbsp <b> आवक_क्र. </b></td>
						<td>&nbsp&nbsp&nbsp&nbsp <b> संदर्भ_क्र. </b></td>
						<td>&nbsp&nbsp&nbsp&nbsp <b> विषय </b></td>
						<td>&nbsp&nbsp&nbsp&nbsp <b> पत्राची स्थिती </b></td></tr>
						<tr><td colspan=3>&nbsp;</td></tr>
						</li>";
						
						while($row=mysql_fetch_array($result))
						{ 
							echo "<li style=width:500px;><tr style=height:20px;><td style=height:18px;>&nbsp&nbsp&nbsp&nbsp".$row['ltr_inword_no']."</td><td>&nbsp&nbsp&nbsp&nbsp".$row['ref_no']."</td><td style=height:18px;>&nbsp&nbsp&nbsp&nbsp".$row['subject']."</td>
							<td>&nbsp&nbsp&nbsp&nbsp विभागाने कार्यवाही करणे बाकी </td>
							</tr></li>";
						}
						
						while($row=mysql_fetch_array($result1))
						{ 
							echo "<li style=width:500px;><tr style=height:20px;><td style=height:18px;>&nbsp&nbsp&nbsp&nbsp".$row['ltr_inword_no']."</td><td>&nbsp&nbsp&nbsp&nbsp".$row['ref_no']."</td><td style=height:18px;>&nbsp&nbsp&nbsp&nbsp".$row['subject']."</td>
							<td>&nbsp&nbsp&nbsp&nbsp विभागाने स्वीकारणे बाकी </td>
							</tr></li>";
						}
						?>
						</table>
                    </ul>
                </li>
				<!---------------------------------------------------------------------------------------------
										End OF Notification Code
				----------------------------------------------------------------------------------------------->
                <li class="right">
                    <div class="userloggedinfo">
                        <img src="images/departments.jpg" alt="" />
						<div class="userinfo" style="width:150px;">
                            <ul> 
                                <li><h5><?php echo "Welcome </h5><h4 style=font-weight:bold;>".$_SESSION['User_Name']."</h4>";?></li>
                                <li><a href="logout.php">Sign Out</a></li>
                            </ul>
                        </div>
                    </div>
                </li>
            </ul><!--headmenu-->
        </div>
    </div>
    <div class="leftpanel">
        <div class="leftmenu">        
            <ul class="nav nav-tabs nav-stacked">
            	<li class="nav-header">Navigation</li>
				<li class="active"><a href="rec_sort_jatanprakar.php?flag=n"><span class="iconfa-laptop"></span> होम </a></li>
				<li class="active"><a href="rec_sort_jatanprakar.php?flag=n"><span class="iconfa-envelope"></span>डाटा अपडेट करणे </a></li>
				<li class="active"><a href="rec_sort_barcode.php?flag=n"><span class="iconfa-envelope"></span>बारकोड जोडा </a></li>
                <li class="dropdown active"><a href=""><span class="iconfa-briefcase"></span>रिपोर्ट्स</a>
					<ul>
						<li><a href="rec_sort_report.php?flag=n">जतन प्रकारानुसार  रिपोर्ट्स</a></li>
						<li><a href="rec_sort_reportJatan.php?flag=n">Records By Jatanprakarwise</a></li>
						<li><a href="rec_sort_reportGatthawise.php?flag=n">Gatthawise references </a></li>
					</ul>
                </li>
                <li class="active"><a href=""><span class="iconfa-pencil"></span>रिटर्न to टपाल </a></li>
            </ul>
        </div><!--leftmenu-->
    </div><!-- leftpanel -->
</script>
</body>
</html>