<%@page language="java" import="java.text.*,java.util.*,java.sql.*" contentType="text/html"%>

<%
		int i=0;
		 Number sno=Integer.parseInt(request.getParameter("serial"));
          String lettertype="";
		  String serial="";
	 String entrydate="";
String entrytime="";
String subject="";
String sendto="";
String lettername="";
String letterno="";
 String  letterdate="";
String receivedfrom="";
String markedto="";
String action="";
String demiofficial="";


		      
			  
			  SimpleDateFormat sdf=new SimpleDateFormat("dd-MM-yyyy");
		   try {
            Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
            Connection con=DriverManager.getConnection("jdbc:odbc:letter");
           
  PreparedStatement pstmt1 = con.prepareStatement("select * from i_tappals where serial="+sno+"");

 ResultSet rs1= pstmt1.executeQuery();
	 	   while(rs1.next())
            {
serial=rs1.getString(1);
letterno=rs1.getString(2);
 Timestamp tsp2=rs1.getTimestamp(3);
 java.util.Date d2=new java.util.Date(tsp2.getTime());
  letterdate=sdf.format(d2);
 receivedfrom=rs1.getString(4);
 subject=rs1.getString(5);
markedto=rs1.getString(6);
 action=rs1.getString(7);
 demiofficial=rs1.getString(8);
 lettername=rs1.getString(9);
 Timestamp tsp3=rs1.getTimestamp(10);
 java.util.Date d3=new java.util.Date(tsp3.getTime());
 entrydate=sdf.format(d3);
 entrytime=rs1.getString(11);

			 i++;
			 }
	
	 
 
		   
if(i<=0)
			   {
		    request.setAttribute("error","Not Found");
                   RequestDispatcher rd=request.getRequestDispatcher("remainder.jsp");
                rd.forward(request, response);
			
                  }
		   con.close();
		   }

		catch(Exception e)
        { 
	out.println(e);
   }


%>





<html>
    <head>
	<script>
	var sysdate,time;
	  function ftime()
{
  var date=new Date();
  d=date.getDate();
  var m=date.getMonth();
  var y=date.getYear();
  if(m<12)
  m=m+1;
  sysdate=d+"-"+m+"-"+y;
  var h=date.getHours();
  var mi=date.getMinutes();
  var s=date.getSeconds();
  mi=checktime(mi);
  s=checktime(s);
   time=h+":"+mi+":"+s;
f1.t2.value=sysdate;
f1.t3.value=time;
 setTimeout('ftime()',500)
  }
  
function checktime(i)
  {
    if(i<10)
  {
  i='0'+i;
  }
  return i;
}

function pr()
{

document.getElementById("b").style.display="none";
window.print();
}

</script>
       
		<style>
		td
		{
			font-weight:bold;
		}
		</style>
</head>
<body onload="ftime()">
<center>
<form name=f1>
<TABLE  width="100%">
<TR>
	
	<TD colspan=3 align=center><h1>Remainder Letter<font color=red>(<%=lettername%>)</font></h1></TD>
	
</TR>
<tr ><td colspan=3></td></tr>
<tr ><td colspan=3></td></tr>
<tr ><td colspan=3></td></tr>
<tr ><td colspan=3></td></tr>
<tr ><td colspan=3></td></tr>
<tr ><td colspan=3></td></tr>
<tr ><td colspan=3></td></tr>
<tr ><td colspan=3></td></tr>
<tr ><td colspan=3></td></tr>
<tr ><td colspan=3></td></tr>
<tr ><td colspan=3></td></tr>
<tr ><td colspan=3></td></tr>
<tr ><td colspan=3></td></tr>



<TR>
	<TD></TD>
	
	<TD colspan=2 align=right><h2>DME,<br>Mechanical Department,<br>Vijayawada,<br>Date:
	<input type="text" name="t2" style="border:none" size=8>, <br>
 Time: <input type="text" name="t3" style="border:none" size=8>.</h2></TD>

</TR>
<tr ><td colspan=3></td></tr>
<tr ><td colspan=3></td></tr>
<tr ><td colspan=3></td></tr>
<tr ><td colspan=3></td></tr>
<tr ><td colspan=3></td></tr>
<tr ><td colspan=3></td></tr>
<tr ><td colspan=3></td></tr>
<tr ><td colspan=3></td></tr>
<tr ><td colspan=3></td></tr>
<tr ><td colspan=3></td></tr>
<tr ><td colspan=3></td></tr>
<tr ><td colspan=3></td></tr>
<tr ><td colspan=3></td></tr>
<TR>
	
	<TD colspan=2 align=left><h2>To,<br><font color=red><%=markedto%></font>Section,<br>Mechanical Department,<br>Vijayawada.<br></h2></TD>
	<TD></TD>


</TR>
<tr ><td colspan=3></td></tr>
<tr ><td colspan=3></td></tr>
<tr ><td colspan=3></td></tr>
<tr ><td colspan=3></td></tr>
<tr ><td colspan=3></td></tr>
<tr ><td colspan=3></td></tr>
<tr ><td colspan=3></td></tr>
<tr ><td colspan=3></td></tr>
<tr ><td colspan=3></td></tr>
<tr ><td colspan=3></td></tr>
<tr ><td colspan=3></td></tr>
<tr ><td colspan=3></td></tr>
<tr ><td colspan=3></td></tr>


<TR>
	<TD colspan=3><h2>Ref:&nbsp;&nbsp;&nbsp;<font color=red><%=subject%></font></h2></TD>
	
</TR>
<tr ><td colspan=3></td></tr>
<tr ><td colspan=3></td></tr>
<tr ><td colspan=3></td></tr>
<tr ><td colspan=3></td></tr>
<tr ><td colspan=3></td></tr>
<tr ><td colspan=3></td></tr>
<tr ><td colspan=3></td></tr>
<tr ><td colspan=3></td></tr>
<tr ><td colspan=3></td></tr>
<tr ><td colspan=3></td></tr>
<tr ><td colspan=3></td></tr>
<tr ><td colspan=3></td></tr>
<tr ><td colspan=3></td></tr>

<TR>
	<TD colspan=3><h2>&nbsp;&nbsp;&nbsp;You have received a letter from&nbsp;<font color=red><%=receivedfrom%></font> on Date:<font color=red><%=letterdate%> </font>with 
	LetterNo:<font color=red><%=letterno%></font>.<br>You have to give the status of that letter to me in a quick time.</h2></TD>
	
</TR>
</TABLE>

<input type=button id="b" value="    Print   " onclick="pr()">
</form>

</center>
</body>
</html>