Vous êtes sur la page 1sur 3

<%@ page contentType="text/html;charset=windows-1252"%>

<html>
<head>
<title>Connection test Page</title>
<%@page import="java.sql.*"%>
<%@page import="oracle.jdbc.*"%>
<%@page import="javax.servlet.http.*;"%>

<%
String url = "jdbc:oracle:thin:@amrndhp0003b.pfizer.com:7021:EBS1DEV";
String UserID = "apps";
String Passwd = "m4kn3sium";
String Query = "";
String Country = "";
Statement Data = null;
Connection DB = null;
ResultSet rs = null;
ResultSet cn = null;
try
{
DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());

DB = DriverManager.getConnection(url,UserID,Passwd);
}
catch (SQLException er)
{
System.out.println("Error :" + er.getMessage());
}
try
{
Data = DB.createStatement();
Query = " SELECT a.territory_code, a.territory_short_name, "+
" (select DECODE (gl.closing_status, 'C', 'CLOSED', 'O', 'OPEN', 'NOT YET
OPENED') "+
" from fnd_application_tl fl,gl_period_statuses gl "+
" where fl.application_id = '101' "+
" AND gl.application_id = fl.application_id "+
" AND b.set_of_books_id = gl.set_of_books_id "+
" AND TRUNC(SYSDATE) BETWEEN GL.START_DATE AND GL.END_DATE ) GL, "+
" (select DECODE (gl.closing_status, 'C', 'CLOSED', 'O', 'OPEN', 'NOT YET
OPENED' ) "+
" from fnd_application_tl fl,gl_period_statuses gl "+
" where fl.application_id = '200' "+
" AND gl.application_id = fl.application_id "+
" AND b.set_of_books_id = gl.set_of_books_id "+
" AND TRUNC(SYSDATE) BETWEEN GL.START_DATE AND GL.END_DATE) payables, "+
" (select DECODE (gl.closing_status, 'C', 'CLOSED', 'O', 'OPEN', 'NOT YET
OPENED' ) "+
" from fnd_application_tl fl, "+
" gl_period_statuses gl "+
" where fl.application_id = '201' "+
" AND gl.application_id = fl.application_id "+
" AND b.set_of_books_id = gl.set_of_books_id "+
" AND TRUNC(SYSDATE) BETWEEN GL.START_DATE AND GL.END_DATE) receivables "+
" FROM fnd_territories_tl a,hr_operating_units b "+
" WHERE a.territory_code = TRIM (SUBSTR (b.NAME, 3, 4))"+
" AND ( NAME NOT LIKE '%USD%' AND NAME NOT LIKE '%JJ%%' AND NAME NOT LIKE
'%US%' ) "+
" ORDER BY territory_short_name ";

Country = " select distinct a.territory_code,territory_short_name"+


" from fnd_territories_tl a, hr_operating_units b"+
" where a.territory_code = trim(substr(b.name,3,4)) "+
" and ( name not like '%USD%' and name not like '%JJ%%'and name not like
'%US%') ";
}
catch (SQLException e)
{
System.out.println("Error :"+ e.getMessage());
}
%>
</head>
<body>
<%@ page language="java" %>
<%
try {
cn = Data.executeQuery(Country);
%>

<table cellspacing="2" cellpadding="1" border="1" width="100%">


Country
<select name="Country">
<% while(cn.next()) { %>
<option
value=<%cn.getString("territory_code");%>><%out.println(cn.getString("territory_sh
ort_name"));%> </option>
<% } %>
</select>
Accounting Period <select name="Period">
<option value="AP01 - 08">AP01 - 08</option>
<option value="AP02 - 08">AP02 - 08</option>
<option value="AP03 - 08">AP03 - 08</option>
<option value="AP04 - 08">AP04 - 08</option>
<option value="AP05 - 08">AP05 - 08</option>
<option value="AP06 - 08">AP06 - 08</option>
<option value="AP07 - 08">AP07 - 08</option>
<option value="AP08 - 08">AP08 - 08</option>
<option value="AP09 - 08">AP09 - 08</option>
<option value="AP10 - 08">AP10 - 08</option>
<option value="AP11 - 08">AP11 - 08</option>
<option value="AP12 - 08">AP12 - 08</option>
</select>

<% try {
rs = Data.executeQuery(Query);
}
catch (SQLException e)
{
System.out.println("Error :"+ e.getMessage());
} %>
<tr>
<td>Territory Code</td>
<td>Territory Short Name</td>
<%-- <td>Period</td> --%>
<td>GL</td>
<td>PAYABLES</td>
<td>RECEIVABLES</td>
<%-- <td>Name</td> --%>
</tr>
<% while(rs.next()) { %>
<tr>
<td> <% out.println(rs.getString("TERRITORY_CODE")); %> </td>
<td> <% out.println(rs.getString("TERRITORY_SHORT_NAME")); %> </td>
<%-- <td> <% out.println(rs.getString("PERIOD_NAME")); %> </td> --%>
<td> <% out.println(rs.getString("GL")); %> </td>
<td> <% out.println(rs.getString("PAYABLES")); %> </td>
<td> <% out.println(rs.getString("RECEIVABLES")); %> </td>
<%-- <td> <% out.println(rs.getString("Name")); %> </td> --%>
</tr>
<%}
}
catch (SQLException e)
{
System.out.println("Error :"+ e.getMessage());
}%>
</table>
</body>
</html>

Vous aimerez peut-être aussi