 <?php ######################################### Desk Wise Sadyasthiti Report ######################################
require_once('convert_marathi.php');
$id111=$_REQUEST['id'];
if($id111=='old')
{
	include_once('dashboard_department.php');
}
else if($id111=='new') 
{
	include_once('new_dashboard_department.php');
}
require_once('connection/db.php');
$username = $_SESSION['User_Name'];
convert_marathi();
$qry=mysql_query("select dept_id,dept_nm from department_master where dept_id =(select dept_id from login where 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>
</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">
			<h4 class="widgettitle"><?php echo $rwq['dept_nm']; ?>ची कार्यविवरण नोंदवही / वर्कशिट</h4>	
			<!-- Code For Start Date End Date Input -->
				<form name="direct_javak_report" action="direct_javak_report_dpt.php?id=<?php echo $id111;?>" method="post">
					<div align="center"><br><table align="center" cellpadding="2" cellspacing="0" class='myClass'>
						<table>
							<tr>
								<td align="center"><label style="width:110px;">Start date</label></td>
								<td align="center"><input type="text" name="start_date" class="input-small"/></td>
								<td align="center"><label style="width:110px;">End Date</label></td>
								<td align="center"><input type="text" name="end_date" class="input-small"/></td>
							</tr>
							<tr>
								<td colspan="4">
								<div align="center">
									<input type="submit" onClick="return sadyasthitiDate()" name="ok" value="GO"/>
									<input type="reset" value="CLEAR" name="clear"/>
								</div>
								</td>
							</tr>
						</table>
					</div>
				</form>
			           
						<p align="center"><font size="4" color='#0866c6' style="font-family:verdana;"><br>
						<?php
						$date123	= $_POST['start_date'];
						$date1	= date('Y-m-d',strtotime($date123));
						$date223	= $_POST['end_date'];
						$date2	= date('Y-m-d',strtotime($date223));
						//$date22	= date('d-m-Y',strtotime($date2));
						echo 'दिनांक <font color="#59c600">'.$date123.'</font>'.' पासून दिनांक '.'<font color="#59c600">'.$date223.'</font>';$id = $date1;
						$id1= $date2;
						?></font>
						</p>
						<br>			
					<table id="dyntable" class="table table-bordered">
							<thead>
								<tr>	
									<th><center>जावक_क्र.<br>जावक_दिनांक</center></th>
									<th><center>विभाग</center></th>                          
									<th><center>संक्लन क्रंमाक<br>नाव</center></th>                      
									<th><center>विषय  </center></th>
									<th><center>view </center></th>
								</tr>
							</thead>
							<tbody>
					<?php
					$desk_id=$rwq['dept_id'];
						if($date1=='1970-01-01' && $date2=='1970-01-01')
						{
						  $qry1=mysql_query("SELECT * FROM direct_javak  where dept_id='$desk_id' ORDER BY javak_dt DESC") or die("".mysql_error());
						}	
						else
						{	
						  $qry1=mysql_query("SELECT * FROM direct_javak where  dept_id='$desk_id' and javak_dt BETWEEN '$date1' AND '$date2' ORDER BY javak_dt DESC") or die("".mysql_error());
						}
					while($rws=mysql_fetch_array($qry1))
					{	
				        //$dept_nm='';
						$javak_id=$rws['javak_id'];
						$javak_no=$rws['javak_no'];
						$javak_dt=$rws['javak_dt'];
						$javak_dt = date('d-m-Y', strtotime($javak_dt));
						$actoin=$rws['actoin'];
						$sakalan=$rws['sakalan'];
						$subject=$rws['subject'];
						if($actoin=='dpt')
						{
						  $dpt_id=$rws['dpt_id'];
						  $q=mysql_query("SELECT dept_nm from department_master  where dept_id='$dpt_id'");
						  $r=mysql_fetch_array($q);
						   $dept_nm=$r['dept_nm'];
						}
						else if($actoin=='other')
						{
						   $dept_nm=$rws['other_nm'];
						}
						echo "<tr>
						<td class='center'>".$javak_no."<br>".$javak_dt."</td>
						<td class='center'>".$dept_nm."</td>
						<td class='center'>".$sakalan."</td>
						<td class='center'>".$subject."</td>
						<td class='center'><a href='view_direct_javak_dpt.php?id=".$javak_id."&dpt=".$id111."'> View </a></td>
						</tr>
						";
					}
					
					?>
							</tbody>
						</table><br>
						
						
						<p>	
							<center><input type="submit" value=" Print Page " onclick="PrintDiv();" class="btn btn-primary"/>
							<input type="button" class="btn" onclick="tableToExcel('export', 'W3C Example Table')" value="Export to Excel"></center>
						</p>
					  <br /><br />
					<?php include_once('footer.php'); ?>
					</div><!--maincontentinner-->
				</div><!--maincontent-->
			</div><!--rightpanel-->
		</div><!--mainwrapper-->
</body>
</html>