<%@ page contentType="text/html; charset=UTF-8"%>
<%@ page import="com.csc.library.system.*,com.csc.library.utilities.*,com.csc.library.cscexport.*,java.util.*,com.csc.library.entry.*,com.csc.library.database.*,com.csc.library.session.*"%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<HTML>
<HEAD>
<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
<META name="GENERATOR" content="IBM WebSphere Studio">
<META http-equiv="Content-Style-Type" content="text/css">
<LINK href="theme/Master.css" rel="stylesheet" type="text/css">
<TITLE>VIEW TPYTRAN1</TITLE>
</HEAD>
<BODY>
<%
		//OT 2000510,2000512,2000515,2000517,2000530,2000532,2000580,2000582,A0140,A0142,A0144
			String employeeid	=	"";
			try{
				employeeid = request.getParameter("__employeeid");
				System.out.println(employeeid);
			}catch(Exception e){
				e.printStackTrace();
			}
			if(employeeid != null){
				UProfile UP = new UProfile(); 
				UP = new UProfile();
				UP.setDbName("SQL_THAIMETAL2");  
				UP.setSchemaName("PR");
				UP.setUserName("myhradmin");
				UP.set("companyid", "10");
				UP.set("lang", "eng");	
				UP.set("appname","Payroll");

				String	tablename	=	"tpytran1";    
				boolean flag			=	false;
				try{
					out.println("============Start sum=========="+"<br>");
					//1. ทำการวนหาค่าใน tpytran0
					DbInquiry inqTPY = new InitialInquiry(UP).getDbInquiry();
					inqTPY.initMyTable(tablename,"employeeid='"+employeeid+"'   ","employeeid");   
					inqTPY.setColumn("*");
					inqTPY.refresh();
					double	value	= 0.0;
					double	tmp		=	0.0;
					int			count	=	0;
					while(inqTPY.next()){
						DbRecord recTPY		= 	inqTPY.getCurrentDbRecord().cloneRecord(true);	 
						 tmp	 =	 recTPY.getDouble("CUR_AMOUNT"); 
						//out.println("id "+recTPY.getString("employeeid")+"value :"+tmp+"sum:"+value+"<br>"); 
						out.println(recTPY.getString("formulaid")+"    "+tmp+"<br>");    
						count++;
					}
				}catch(Exception e){
					e.printStackTrace();
				}
			}
%>
<FORM METHOD="post" ACTION="EMPLOYEE.jsp"> 
	<TABLE width="100">
		<!--<TR>
			<TD>DBNAME</TD>
			<TD><INPUT TYPE="TEXT" NAME="__dbname" value="" ></TD>
		</TR>-->
		<TR>
			<TD>EMPLOYEEID</TD>
			<TD><INPUT TYPE="TEXT" NAME="__employeeid" value="" ></TD>
		</TR>
		<TR COLSPAN="2">
			<TD><INPUT TYPE="SUBMIT" NAME="OK" value="OK" ></TD>
		</TR>
	</TABLE>
</FORM>
</BODY>
</HTML>