📄 reports.jsp
字号:
<%@ page contentType="text/html; charset=UTF-8" %>
<%--
* @author Sujatha
* @version 1.0
*
* Development Environment : Oracle9i JDeveloper
* Name of the Application : reports.jsp
* Creation/Modification History :
*
* Sujatha 27-Dec-2001 Created
*
* Overview of Application : This jsp provides the UI for the shop owner
* to generate various reports like sales report, shipping report.
*
--%>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
<%@ page language="java" errorPage="../misc/errorHandler.jsp" %>
<%@ page import="oracle.otnsamples.vsm.Constants"%>
<HTML>
<HEAD>
<TITLE><bean:message key="title.report"/></TITLE>
<!-- To prevent caching -->
<%
response.setHeader("Cache-Control","no-cache"); // HTTP 1.1
response.setHeader("Pragma","no-cache"); // HTTP 1.0
response.setDateHeader ("Expires", -1); // Prevents caching at the proxy server
%>
<SCRIPT type="text/javascript" language="JavaScript" src=
"includes/Cal.js">
</SCRIPT>
<SCRIPT type="text/javascript">
function populateList() {
// Form a drop down list based on the report type
// If report type is shipping, then either Pending or Shipped orders can be queried
// Else the list is empty
var frm = document.Reports;
frm.status.length = 0;
if( frm.reportType.options[frm.reportType.selectedIndex].value=='shipping' ) {
frm.status.options[0]= new Option("Pending","Pending");
frm.status.options[1]= new Option("Shipped","Shipped");
} else {
frm.status.options[0]= new Option("-------","-------");
}
frm.status.options[0].selected = true;
}
function submitForm() {
// Checks if all the form fields have been entered( with proper values) before
// submitting the form
frm = document.Reports;
if ( frm.fromDate.value == "" ) {
alert("<bean:message key="report.javascript.fromdateerror"/>");
return;
}
if( !checkDate(frm.fromDate) ) {
alert("<bean:message key="report.javascript.dateformaterror"/>");
return;
}
if ( frm.toDate.value == "" ) {
alert("<bean:message key="report.javascript.todateerror"/>");
return;
}
if( !checkDate(frm.toDate) ) {
alert("<bean:message key="report.javascript.dateformaterror"/>");
return;
}
if(compareDates(frm.fromDate,frm.toDate)<0){
alert("<bean:message key="report.javascript.datevalueerror"/>");
return;
}
frm.submit();
}
// returns 1 if date2>date1 ,0 if date1=date2 and -1 if date1>date2
function compareDates(date1,date2){
dateArray= new Array();
dateArray["JAN"]=0;
dateArray["FEB"]=1;
dateArray["MAR"]=2;
dateArray["APR"]=3;
dateArray["MAY"]=4;
dateArray["JUN"]=5;
dateArray["JUL"]=6;
dateArray["AUG"]=7;
dateArray["SEP"]=8;
dateArray["OCT"]=9;
dateArray["NOV"]=10;
dateArray["DEC"]=11;
// get years
val1 = parseInt(date1.value.substring(7,11));
val2 = parseInt(date2.value.substring(7,11));
if( val1>val2) {
return -1;
}else if(val1==val2){
// get months
val1 = date1.value.substring(3,6);
val2 = date2.value.substring(3,6);
if( dateArray[val1]>dateArray[val2]) {
return -1;
}else if(val1==val2){
// get dates
v = date1.value.substring(0,2);
if(v=='08') v='8';
if(v=='09') v='9';
val1 = parseInt(v);
v = date2.value.substring(0,2);
if(v=='08') v='8';
if(v=='09') v='9';
val2 = parseInt(v);
//alert(val1+":"+val2);
if( val1>val2) {
return -1;
}else if(val1==val2){
return 0;
} else{
return 1;
}
}else{
return 1;
}
}else{
return 1;
}
}
function checkDate( dateFiled ) {
// Checks if the input parameter is a valid date
if( dateFiled.value.length != 11 ) {
dateFiled.focus();
return false;
}
dateVal = dateFiled.value.substring(0,2);
if( isNaN(dateVal) || parseInt(dateVal) > 31 ) {
return false;
}
monthVal = dateFiled.value.substring(3,6);
if( !isNaN(monthVal) ) {
return false;
}
yearVal = dateFiled.value.substring(7,11);
if( isNaN(yearVal) ) {
return false;
}
return true;
}
</SCRIPT>
</HEAD>
<BODY>
<jsp:include page="../misc/ownerHeader.jsp" flush="true"></jsp:include>
<FORM name="Reports" method="post" action="authownerreport.do">
<TABLE width="100%" border="0" cellspacing="0" cellpadding=
"1" bgcolor="white">
<TR>
<TD width="20%" valign="top">
<jsp:include page="leftNavigation.jsp" flush="true"></jsp:include>
</TD>
<TD width="66%" valign="top">
<TABLE width="100%">
<TR>
<TD width="32%" height="33" class="SubHeading">
<bean:message key="subheading.report"/></TD>
<TD width="68%" height="33">
<HR>
</TD>
</TR>
</TABLE>
<BR>
<TABLE width="100%" border="0" cellspacing="0"
cellpadding="3">
<TR>
<TD width="26%" class="Prompt" align="right"> <bean:message key="prompt.report.from"/></TD>
<TD colspan="2">
<input type="text" name="fromDate"
size="12">
<A href=
"javascript:show_calendar('Reports.fromDate')"
onmouseover=
"window.status='Pop Calendar';return true;"
onmouseout="window.status='';return true;"><IMG
src="images/calendar.gif" width="24" height=
"22" align="absmiddle" border="0"></A> </TD>
</TR>
<TR>
<TD width="26%" class="Prompt" align="right"><bean:message key="prompt.report.to"/></TD>
<TD colspan="2">
<INPUT type="text" name="toDate"
size="12">
<A href=
"javascript:show_calendar('Reports.toDate')"
onmouseover=
"window.status='Pop Calendar';return true;"
onmouseout="window.status='';return true;"><IMG
src="images/calendar.gif" width="24" height=
"22" align="absmiddle" border="0"></A></TD>
</TR>
<TR>
<TD width="26%" height="32" class="Prompt" align=
"right"><bean:message key="prompt.report.type"/></TD>
<TD height="32" colspan="2">
<SELECT name="reportType" onChange="javascript:populateList();">
<OPTION value="shipping"> <bean:message key="prompt.report.ship"/> </OPTION>
<OPTION value="sales"> <bean:message key="prompt.report.sales"/></OPTION>
</SELECT>
</TD>
</TR>
<TR>
<TD width="26%" height="32" class="Prompt" align=
"right"><bean:message key="prompt.orders.status"/></TD>
<TD height="32" colspan="2">
<SELECT name="status">
<OPTION value="<%=Constants.PENDING%>"><bean:message key="prompt.report.pending"/></OPTION>
<OPTION value="<%=Constants.SHIPPED%>"><bean:message key="prompt.report.shipped"/></OPTION>
</SELECT>
</TD>
</TR>
<TR>
<TD width="26%" height="32" class="Prompt" align=
"right"><bean:message key="prompt.report.format"/></TD>
<TD height="32" colspan="2">
<SELECT name="reportFormat">
<OPTION value="html"><bean:message key="prompt.report.html"/></OPTION>
<OPTION value="pdf"><bean:message key="prompt.report.pdf"/></OPTION>
</SELECT>
</TD>
</TR>
</TABLE>
<BR>
<TABLE width="50%" border="0" cellspacing="0" cellpadding="3">
<TR>
<TD width="30%"> </TD>
<TD width="10%" align="right"> <A HREF="javascript:submitForm()">
<html:img srcKey="image.generateReport" border="0"/></A> </TD>
<TD width="10%" align="center">
<A HREF="javascript:document.forms[1].reset();">
<html:img srcKey="image.reset" border="0"/></A> </TD>
<TD width="29%"> </TD>
</TR>
</TABLE>
</TD>
<TD width="14%" valign="top" height="267"><BR>
</TD>
</TR>
</TABLE>
<jsp:include page="../misc/commonFooter.jsp" flush="true"></jsp:include>
</FORM>
</BODY>
</HTML>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -