
<%@page import="org.jpedal.*,org.jpedal.fonts.*"%>
<%@page import="org.jpedal.exception.PdfException"%>
<%@page
	import="java.awt.Image, javax.imageio.ImageIO,java.awt.image.*,java.util.*,java.text.SimpleDateFormat,ibase.webitm.utility.GenericUtility"%>
<%@page
	import="java.io.*,java.sql.*,ibase.system.config.ConnDriver,ibase.utility.CommonConstants"%>
<%!

String siteCode= "",empCode="",empFname="",empLname="";
String location="",confirmed="",empMname="",flightCode="",flightDescr="";
String tranID="";
java.sql.Date tranDate=null;
GenericUtility genericUtility = GenericUtility.getInstance();
SimpleDateFormat sdf;

%>
<%
response.setHeader("Cache-Control","no-cache"); //HTTP 1.1
response.setHeader("Pragma","no-cache"); //HTTP 1.0
response.setDateHeader ("Expires", 0); //prevents caching at the proxy server
%>
<%
	System.out.println("Calling empFlightInfo.jsp");
	String sql="";
	PreparedStatement pstmt = null;
	ResultSet rs = null;
	Connection conn=null;
	ConnDriver ConnDriver = new ConnDriver();
	StringBuffer xmlBuff=new StringBuffer();
	tranID =  request.getParameter("tran_id") == null ?"0001": request.getParameter("tran_id");
	System.out.println("tranID--receiped from jsp 7/APR/14--["+tranID+"]");
	int cnt = 0;	
	boolean flag = false;
	try
		{
			sdf = new SimpleDateFormat(genericUtility.getApplDateFormat());
			sql= " SELECT TRAN_DATE,SITE_CODE,EMP_CODE,EMP_FNAME,EMP_MNAME,EMP_LNAME,flight_code FROM EMP_TRAVEL_INFO WHERE TRAN_ID = ? ";
				conn = ConnDriver.getConnectDB("DriverITM");
				pstmt = conn.prepareStatement( sql );
				pstmt.setString(1,tranID);
				System.out.println( "@@@@@ sqlgetdata :: [[" + sql+"]]" );
				rs = pstmt.executeQuery(  );
				if(rs.next())
				{
					tranDate= rs.getDate("TRAN_DATE");
					siteCode= checkNull(rs.getString("SITE_CODE"));
					empCode= checkNull(rs.getString("EMP_CODE"));					
					empFname= checkNull(rs.getString("EMP_FNAME"));
					empMname= checkNull(rs.getString("EMP_MNAME"));
					empLname= checkNull(rs.getString("EMP_LNAME"));
					flightCode= checkNull(rs.getString("flight_code")); 
					/* flightCode= rs.getString("flight_code"); */
					System.out.println( "@@@@@ flightCode :: ["+flightCode+"]" );
					
				}			
				rs.close();
				rs = null;
				pstmt.close();
				pstmt = null;
				
				if(flightCode !=null && flightCode.trim().length() != 0)
				{	
				sql = " select descr from gencodes where fld_name='FLIGHT_CODE' AND MOD_NAME='W_EMP_TRAVEL_INFO'  and fld_value=? ";
				pstmt = conn.prepareStatement( sql );
				pstmt.setString(1,flightCode);
				System.out.println( "@@@@@ sqlgetdata :: [[" + sql+"]]" );
				rs = pstmt.executeQuery(  );
				if(rs.next())
				{
					flightDescr = rs.getString("descr")==null?"":rs.getString("descr").trim();
					
				}
				System.out.println( "@@@@@ flightDescr occured:: "+flightDescr );
				rs.close();
				rs = null;
				pstmt.close();
				pstmt = null;
				}
				else
				{
					flightDescr="";	
				}
				
			}catch( Exception ex )
			{
				ex.printStackTrace();
				System.out.println( "@@@@@ Exception occured:: " );
				
			}finally{
				try{
					if( rs != null )
						rs.close();
					rs = null;					
					if( pstmt != null )
						pstmt.close();
					pstmt = null;
					if( conn != null )
						conn.close();
					conn = null; 
				}catch( Exception ex ){}
				
			}
	
%>
<%! private String checkNull(String inp)
{
	if(inp == null)
		inp = " ";
	return inp.trim();
}
%>

<center>
	<div style="height: 100%; overflow: auto;">
		<!-- <fieldset STYLE="width:800PX;border-color:#99FF33"> -->
		<head>
<title>Employee Flight information:</title>
</br>
		</head>
		<body>
			<script type="text/javascript" src="/ibase/webitm/js/EmpFligtBook.js"></script>
			<form method="post" action="" name="flightform" id="form">
				<div
					STYLE='font-family: arial; color: black; background-color: #48D1CC; POSITION: relative; TOP: 1;'>
					<h5>Employee Flight information:</h5>
				</div>

				<table style='font-family: arial; color: black; font-size: 15px;'>
					<tr STYLE='background-color: #D3D3D3;'>
						<td align="right" style="width: 300px">Tran Id :</td>
						<td><input type="text" id="tran_id" name='Tran Id :'
							size="10" value="<%=request.getParameter("tran_id") %>" readonly></td>
					</tr>
					<tr STYLE='background-color: #D3D3D3;'>
						<td align="right" style="width: 300px">Emp Code:</td>
						<td><input type="text" id="emp_code" name='Emp Code :'
							size="10" value="<%=empCode%>" readonly></td>
					</tr>
					<tr STYLE='background-color: #D3D3D3;' r>
						<td align="right" style="width: 300px">Emp Name:</td>
						<td><input type="text" id="emp_fname" name='Emp First Name :'
							size="10" value="<%=empFname%>" readonly> <input
							type="text" id="emp_lname" name='Emp Last Name :' size="10"
							value="<%=empLname%>" readonly> <input type="text"
							id="emp_mname" name='Emp Middle Name :' size="10"
							value="<%=empMname%>" readonly></td>
					</tr>
					<tr STYLE='background-color: #D3D3D3;'>
						<td align="right" style="width: 300px">Flight Code :</td>
						<td><input type="text" id="flight_code" size="20"
							value="<%=flightCode%>" onblur="return upperCase(this.id)">
							<img src="/ibase/webitm/images/e12_pophelp_16.jpg"
							id="flight_code.popupImage"
							onclick="return openPophelp(this.id);" />
					</tr>
					<tr STYLE='background-color: #D3D3D3;'>
						<td align="right" style="width: 300px">Flight Description :</td>
						<td><input type="text" id="flight_code_descr" size="40"
							value="<%=flightDescr%>" readonly></td>
					</tr>
					<tr> <td align="right" style = "width:300px"><input type="button" id="submit" value="save" onclick="return setActionVal1(this.id);"></td></tr> 
					<!-- <tr>
						<td align="right" style="width: 300px"><input type="submit"
							id="submit" value="save"></td>
					</tr>-->
				</table>
				<!-- </fieldset> -->
	</div>
	</form>
	</body>
</center>




