 <?php ######################################### Desk Wise Sadyasthiti Report ######################################
include_once('dashboard_department.php');
require_once('convert_marathi.php');
$username = $_SESSION['User_Name'];
$qry=mysql_query("SELECT dm.desk_id, dm.desk_nm
FROM desk_master dm, login
WHERE login.desk_id = dm.desk_id
AND login_id = '$username'");
$rwq=mysql_fetch_array($qry);


	
?>
<!DOCTYPE html>
<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>
<script type="text/javascript">     
function PrintDiv() {    
var divToPrint = document.getElementById('divToPrint');
var popupWin = window.open('', '_blank', 'width=600,height=600');
popupWin.document.open();
popupWin.document.write('<html><body onload="window.print()">' + divToPrint.innerHTML + '</html>');
popupWin.document.close();
 }
</script>
<script type="text/javascript" src="js/adduser.js"></script> 
<script src="tableToExcel.js"></script>
<style>
p.small {
    line-height: 0.5;
}
p.big {
    line-height: 2;
}
</style>
</head>
    <div class="rightpanel"> 
        <ul class="breadcrumbs">
            <li><a href="dashboard_desk.php"><i class="iconfa-home"></i></a> <span class="separator"></span></li>
            <li>सुचना </li>
        </ul>
        <div class="pageheader">
            <div class="pageicon"><span class="iconfa-table"></span></div>
            <div class="pagetitle">
                <h5>Tables</h5>
                <h1>सुचना</h1>
            </div>
        </div><!--pageheader-->
        <div class="maincontent">
            <div class="maincontentinner">
			<div class="widget">
					<h4 class="widgettitle">सुचना</h4>
					<div class="widgetcontent">
		
						<br>
						<br>
					<?php				
							$q=mysql_query("SELECT * from login where login_id='$username' ");
							$r=mysql_fetch_array($q);
							$dpt_id=$r['dept_id'];
							$q1=mysql_query("SELECT count(dpt_id)  as cnt from sms_vibhag where dpt_id='$dpt_id'");
							$r1=mysql_fetch_array($q1);
							$cnt=$r1['cnt'];

							$q111=mysql_query("SELECT max(sms_id) as max  from sms_vibhag where dpt_id='$dpt_id'");
							$row222=mysql_fetch_array($q111);
							$max=$row222['max'];
							$q1111=mysql_query("SELECT cnt,suchna  from sms_vibhag where sms_id='$max'");
							$row2222=mysql_fetch_array($q1111);
							$cnt1=$row2222['cnt'];
							$suchna=$row2222['suchna'];
							$suchna = wordwrap($suchna,35, "\n", true);
							if($cnt1=='')
							{
							 echo '
										<h4><center><u><font size="2px" color="blue">सुचना  </font></u></center></h4><br>
										<br>
										
										<h3><center><font size="3px" color="red"><p class="big">'.$suchna.' </p></font></u></center></h4><br>
										<br>
										
										
									';
									
							$q11111=mysql_query("update  sms_vibhag set cnt='1'  where sms_id='$max'");
							}
							else
							{
								?>
								<table id="dyntable" class="table table-bordered">
							<thead>
								<tr>	
									<th><center>दिनांक</center></th>
									<th><center>सुचना</center></th>                          
								
								</tr>
							</thead>
							<tbody>
					<?php
					
						  $qry1=mysql_query("SELECT * FROM sms_vibhag  where dpt_id='$dpt_id' ") or die("".mysql_error());
						
					while($rws=mysql_fetch_array($qry1))
					{	
				        //$dept_nm='';
						$sms_dt=$rws['sms_dt'];
						$sms_dt = date('d-m-Y', strtotime($sms_dt));
						$suchna=$rws['suchna'];
						
						echo "<tr>
						<td class='center'>".$sms_dt."</td>
						<td class='center'>".$suchna."</td>
						</tr>
						";
					}

					?>
							</tbody>
						</table><br>
						<?php
							}
							$cnt1m=$cnt1+1;	
							$q11111=mysql_query("update  sms_vibhag set cnt='$cnt1m'  where sms_id='$max'");
							
					?>
							
						
						 </div><!--widgetcontent-->
               </div><!--widget-->
					<?php include_once('footer.php'); ?>
					</div><!--maincontentinner-->
				</div><!--maincontent-->
			</div><!--rightpanel-->
		</div><!--mainwrapper-->
</body>
</html>