function getXMLHttpRequest() { var xmlhttp; /*@cc_on @*/ /*@if (@_jscript_version >= 5) try { xmlhttp=new ActiveXObject("Msxml2.XMLHTTP") } catch (e) { try { xmlhttp=new ActiveXObject("Microsoft.XMLHTTP") } catch (E) { xmlhttp=false } } @else xmlhttp=false @end @*/ if (!xmlhttp && typeof XMLHttpRequest!='undefined') { try { xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");//new XMLHttpRequest(); } catch (e) { xmlhttp=false } } return xmlhttp; } function ajaxMethod(url,param){ myHttp = getXMLHttpRequest(); myHttp.open('post',url,false); if(param == null || param == ""){ param ="5000"; } myHttp.setRequestHeader("Content-Length",param.length); myHttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded'); myHttp.send(); if(myHttp.readyState == 4 && myHttp.status==200){ var text = myHttp.responseText; return text.replace(/(^\s*)|(\s*$)/g, "");//去除前后空格 }else{ return ""; } } function ajaxMethodPost(url,param){ myHttp = getXMLHttpRequest(); myHttp.open('post',url,false); if(param == null || param == ""){ param ="5000"; } myHttp.setRequestHeader("Content-Length",param.length); myHttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded'); myHttp.send(param); //myHttp.readyState == 4 && myHttp.status==200 if(myHttp.readyState == 4 && myHttp.status==200){ var text = myHttp.responseText; return text.replace(/(^\s*)|(\s*$)/g, "");//去除前后空格 }else{ return ""; } } /* * ajax 异步 */ var deptN ;//ajax 开关 function dataSel2(deptName,search,fromDate,toDate,enterStatus,curstate,jumpPage){ deptN = deptName; var divObj = document.getElementById(deptName); if(divObj.style.display == 'inline' && (jumpPage==null || jumpPage =="")){//加入了 ajax jumpPage的操作 divObj.style.display = 'none'; }else{ //jumpPage 为ajax页面提过分页功能,并且传给分页的页数 document.forms[0].dept1.value = deptName; document.forms[0].search1.value = search; document.forms[0].fromDate1.value = fromDate; document.forms[0].toDate1.value = toDate; document.forms[0].enterStatus1.value = enterStatus; document.forms[0].curstate1.value = curstate; var url = 'deptZccxAjax.jsp'; var param = ''; if(deptName.split("_").length >1){ deptName = ""; } var sql = this.getSql(deptName,search,fromDate,toDate,enterStatus,curstate); //alert(sql); sql = encodeURIComponent(encodeURIComponent(sql)); param = 'sql=' + sql; //jumpPage 为ajax页面提过分页功能,并且传给分页的页数 if(jumpPage != null && jumpPage !=""){ param += '&jumpPage=' + jumpPage; } myHttp = getXMLHttpRequest(); myHttp.open('post',url,true);//true 同步,false 异步 if(param == null || param == ""){ param ="5000"; } myHttp.setRequestHeader("Content-Length",param.length); myHttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded'); myHttp.onreadystatechange = ajaxRet; //异步必须用 回调 onreadystatechange ,后面的方法不能有括号 //同步,不必用回调函数,在send()方法后面直接用 if(myHttp.readyState == 4 && myHttp.status==200){}方法 myHttp.send(param); } } function ajaxRet(){ if(myHttp.readyState == 4 && myHttp.status==200){ var reVal = myHttp.responseText; if(reVal != ""){ var divObj = document.getElementById(deptN);//deptName var divObjs = document.getElementsByTagName('DIV'); for(var i = 0 ; i < divObjs.length ; i++){ var obj = divObjs[i]; if(obj.className == 'ajaxDiv' && obj.id != deptN){//deptName obj.style.display = 'none'; } } divObj.innerHTML=reVal; divObj.style.display = 'inline'; //alert(divObj.top); //debugger; window.document.body.scrollTop = this.FirstTopTr(deptN) - 130; } } } function FirstTopTr(id) { var m=document.all(id); var w=0 while(m.offsetParent) { w+=m.offsetTop; m=m.offsetParent; } return w; } /** * ajax 同步 */ function dataSel(deptName,search,fromDate,toDate){ var divObj = document.getElementById(deptName); if(divObj.style.display == 'inline'){ divObj.style.display = 'none'; }else{ var url = 'deptZccxAjax.jsp'; var param = ''; if(deptName.split("_").length >1){ deptName = ""; } var sql = this.getSql(deptName,search,fromDate,toDate); //alert(sql); sql = encodeURIComponent(encodeURIComponent(sql)); param = 'sql=' + sql; var reVal = ajaxMethodPost(url,param); //if(myHttp.readyState == 4 && myHttp.status==200){ //var reVal = myHttp.responseText; if(reVal != ""){ var divObjs = document.getElementsByTagName('DIV'); for(var i = 0 ; i < divObjs.length ; i++){ var obj = divObjs[i]; if(obj.className == 'ajaxDiv' && obj.id != deptName){ obj.style.display = 'none'; } } divObj.innerHTML=reVal; divObj.style.display = 'inline'; } //} } }
deptZccx.jsp
<%@ page language="java" import="java.util.*" pageEncoding="GBK" contentType="text/html; charset=GBK"%>
<%@page import="com.sysoft.baseform.process.util.ParseProperties"%>
<%@page import="com.syoa.struts.form.deptzccx.DeptZccxForm"%>
<%@page import="com.sysoft.baselib.PublicMethod"%>
<%@page import="com.sysoft.baselib.Common"%>
<%@page import="com.sysoft.baseform.process.util.StringUtil"%>
<%@ taglib uri="http://struts.apache.org/tags-bean" prefix="bean" %>
<%@ taglib uri="http://struts.apache.org/tags-html" prefix="html" %>
<%@ taglib uri="http://struts.apache.org/tags-logic" prefix="logic" %>
<%@ taglib uri="http://struts.apache.org/tags-tiles" prefix="tiles" %>
<%
String contextPath = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+contextPath+"/";
DeptZccxForm deptZccxForm = (DeptZccxForm)request.getAttribute("deptZccxForm");
String search = deptZccxForm.getSearch();
String fromDate = deptZccxForm.getFromDate();
String toDate = deptZccxForm.getToDate();
//String selVal = deptZccxForm.getSelVal();
String enterStatus = deptZccxForm.getEnterStatus();//入账状态
String curstate = deptZccxForm.getCurstate();//当前状态(在用、在库、下线)
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html:html>
<head>
<html:base target="_self"/>
<title>部门资产查询----------------------------------deptZccx.jsp</title>
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<!--
<link rel="stylesheet" type="text/css" href="styles.css">
-->
<script type="text/javascript" src="<%=request.getContextPath() %>/js/newCalendar/popcalendar.js"></script>
<%@include file="/stockExchange/include/cssAndJs.inc" %>
<script type="text/javascript">
function showDetail(id,objclass , tabUrl){
//debugger;
//'http://210.1.5.40/wbsjy/inbox/chkviewinfo.aspx?obj=GDZCZXX&info_id=90009892&isview=1&isreg=1'
var dlgProp900 = "dialogWidth:1024px;"
+ "dialogHeight:1024px;" //+ (window.document.body.clientHeight)
+ "px;dialogLeft:((screen.width-800)/2)px;dialogTop:" + (window.screenTop) + "px;"
+ "center:yes;help:no;resizable:no;status:no;";
var url = "";
if(tabUrl != ""){
url = tabUrl;
}else{
url = '<%=ParseProperties.getSysinfo("net.url",application.getRealPath("/"))%>/wbsjy/inbox/chkviewinfo.aspx?obj='+objclass+'&info_id='+id+'&isview=1&isreg=1';
}
url += '&reload=no';
var openProp = 'scrollbars=0,top=0,left=0,height=' + (screen.availHeight - 30) + ',width=' + (screen.availWidth - 10) + ',resizable=1,scrollbars=1';
var returnVal = window.open(url,'wWindow',openProp);//showModalDialog
}
function showBaoBiao(){
var dlgProp900 = "dialogWidth:1024px;"
+ "dialogHeight:1024px;" //+ (window.document.body.clientHeight)
+ "px;dialogLeft:((screen.width-800)/2)px;dialogTop:" + (window.screenTop) + "px;"
+ "center:yes;help:no;resizable:no;status:no;";
// var url = '<%=ParseProperties.getSysinfo("net.moss.url",application.getRealPath("/"))%>/_layouts/erpnew/temp/capital.htm';
var url = '<%=ParseProperties.getSysinfo("ERP_MACHINE",application.getRealPath("/"))%>/zjs/capital.htm';
var openProp ="width:1024px;"
+ "height:1024px;" //+ (window.document.body.clientHeight)
+ "px;left:((screen.width-800)/2)px;top:" + (window.screenTop) + "px;"
+ "center:yes;help:no;resizable:no;status:no;";
var openprop1 = "top=0,left=0,width=" + (screen.availWidth - 10) + ",height=" + (screen.availHeight - 30)+ ",resizable=1,scrollbars=1";
var returnVal = window.open(url,'wWindow',openprop1);//showModalDialog
}
//跳转个人资产页面
function showGr(){
window.location.href = "grczcx.jsp";
}
function sub(){
if(this.check_All()){
cDefaultSubmit();
document.forms[0].submit();
}
}
function check_All(){
var fromDate = document.forms[0].fromDate.value;
var toDate = document.forms[0].toDate.value ;
if(fromDate != "" && toDate != "" && fromDate > toDate){
alert("起始日期大于结束日期!");
return false;
}
return true;
}
</script>
</head>
<%--
select
t1.*, t2.OBJCLASS, t2.NGRQ, t2.BT, t2.WH
from ERP_AMS_MINFO t1, G_INFOS t2
where
t1.INFO_ID = t2.ID
select
sum(t1.CAPSVALUE) as CAPSVALUE ,sum(t1.CNETWORTH) as CNETWORTH
from ERP_AMS_MINFO t1, G_INFOS t2
where
t1.INFO_ID = t2.ID
and t1.DEPT = '办公室'
select distinct t1.DEPT,
(select sum(t3.CAPSVALUE) as CAPSVALUE
from ERP_AMS_MINFO t3, G_INFOS t4
where t3.INFO_ID = t4.ID
and t3.DEPT = t1.DEPT
--and t3.INFO_ID =90037373
) as ALLCAPSVALUE,
(select sum(t5.CNETWORTH) as CNETWORTH
from ERP_AMS_MINFO t5, G_INFOS t6
where t5.INFO_ID = t6.ID
and t5.DEPT = t1.DEPT
-- and t5.INFO_ID =90037373
) as ALLCNETWORTH
from ERP_AMS_MINFO t1, G_INFOS t2
where t1.INFO_ID = t2.ID
--and t1.INFO_ID = 90037373
--%>
<body style="background-color: white;">
<html:form action="/stockExchange/userSelfHelp/deptZccx" method="post">
<html:hidden property="action"/>
<!-- 以下是ajax 分页用 -->
<input type='hidden' name='ajaxJumpPage' value='<%=StringUtil.cleanString(request.getParameter("ajaxJumpPage")) %>' />
<input type='hidden' name='dept1' value='<%=StringUtil.cleanString(request.getParameter("dept1")) %>' />
<input type='hidden' name='search1' value='<%=StringUtil.cleanString(request.getParameter("search1")) %>' />
<input type='hidden' name='fromDate1' value='<%=StringUtil.cleanString(request.getParameter("fromDate1")) %>' />
<input type='hidden' name='toDate1' value='<%=StringUtil.cleanString(request.getParameter("toDate1")) %>' />
<input type='hidden' name='enterStatus1' value='<%=StringUtil.cleanString(request.getParameter("enterStatus1")) %>' />
<input type='hidden' name='curstate1' value='<%=StringUtil.cleanString(request.getParameter("curstate1")) %>' />
<%--
<input type='text' name="a" value="<%=request.getParameter("a") %>" />
--%>
<div style="width: 100%;height: 1000px;">
<table style="width: 100%;" align="center"><!-- 850px -->
<tr>
<td align="left">
<div align="left" class="from_title" >
资产名称<!-- 3.23文档 部门资产查询 标题字段为:资产名称 -->
</div>
</td>
</tr>
</table>
<br/>
<table style="width: 100%" align="center" border="0">
<tr>
<td nowrap="nowrap" colspan="2">
<B>关键字:</B>
<html:text property="search" style='width: 380px;'
οnfοcus="clearDefault(this);" οnblur="resetDefault(this);"></html:text>
</td>
<td nowrap="nowrap">
<html:select property="enterStatus" name="deptZccxForm" >
<html:optionsCollection property="enterStatusList" name="deptZccxForm"/>
</html:select>
</td>
<td nowrap="nowrap">
<html:select property="curstate" name="deptZccxForm" >
<html:optionsCollection property="curstateList" name="deptZccxForm"/>
</html:select>
</td>
</tr>
<tr>
<td nowrap="nowrap">
<html:select property="selVal" name="deptZccxForm" >
<html:optionsCollection property="selList" name="deptZccxForm"/>
</html:select>
</td>
<td nowrap="nowrap">
领用日期从
<html:text property="fromDate" style="width:80px;" readonly="true"></html:text>
<img name="cwrqImg" src="../../Images/time.gif"
style='cursor:hand' border='0'
οnclick="popUpCalendar(this, document.forms[0].fromDate, 'yyyy-mm-dd');"></img>
到
<html:text property="toDate" style="width:80px;" readonly="true"></html:text>
<img name="cwrqImg1" src="../../Images/time.gif"
style='cursor:hand' border='0'
οnclick="popUpCalendar(this, document.forms[0].toDate, 'yyyy-mm-dd');"></img>
</td>
<td nowrap="nowrap" colspan="2">
<input type="button" value="检索" class="XPButton_1" οnclick="sub();"/>
<input type="button" value="资产报表" οnclick="showBaoBiao();" class="XPButton_1">
<input type="button" value="个人资产" class="XPButton_1" οnclick="showGr();"/>
</td>
</tr>
</table>
<br/>
<TABLE align="center" border="0" cellpadding="0" cellspacing="1" bgcolor="#EDEDED" class="table_boxfrom" style="width: 100%">
<logic:iterate id="iter" property="list" name="deptZccxForm">
<%
Map<String,String> map = (Map)pageContext.getAttribute("iter");
String dept = map.get("DEPT");
String allCapsvalue=map.get("ALLCAPSVALUE");
String allCnetworth = map.get("ALLCNETWORTH");
String allDatas = map.get("ALLDATAS");
allCapsvalue = (allCapsvalue == null || "".equals(allCapsvalue))? "0" : allCapsvalue;
allCnetworth = (allCnetworth == null || "".equals(allCnetworth))? "0" : allCnetworth;
String showCapsvalue = " 资产原值合计:" + PublicMethod.doubleFormat(Double.parseDouble(allCapsvalue)) ;
String showCnetworth = " 资产净值合计:" + PublicMethod.doubleFormat(Double.parseDouble(allCnetworth));
String showAlldata = " 总共有 " + allDatas + " 条记录";
String outP = dept+" " + showCapsvalue + showCnetworth + showAlldata;
if(dept == null || dept.equals("")){
dept = "dept_" + Common.getGuid();
}
%>
<tr align="right" bgcolor="#FFFFFF">
<td align="left" height="28px;">
<div>
<%--
dataSel('<%=dept %>','<%=search %>','<%=fromDate %>','<%=toDate %>');
--%>
<a href="javascript:dataSel2('<%=dept %>','<%=search %>','<%=fromDate %>','<%=toDate %>','<%=enterStatus %>','<%=curstate %>');">
<%=outP %>
</a>
<a href="javascript:excelExport('<%=dept %>','<%=search %>','<%=fromDate %>','<%=toDate %>','<%=enterStatus %>','<%=curstate %>')">生成Excel</a>
</div>
<div id='<%=dept %>' class='ajaxDiv' style="display: none;"></div>
</td>
</tr>
</logic:iterate>
</table>
<br><br><br>
</div>
</html:form>
<script type="text/javascript">
//var myHttp;
function getXMLHttpRequest() {
var xmlhttp;
/*@cc_on @*/
/*@if (@_jscript_version >= 5)
try {
xmlhttp=new ActiveXObject("Msxml2.XMLHTTP")
} catch (e) {
try {
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP")
} catch (E) {
xmlhttp=false
}
}
@else
xmlhttp=false
@end @*/
if (!xmlhttp && typeof XMLHttpRequest!='undefined') {
try {
xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");//new XMLHttpRequest();
} catch (e) {
xmlhttp=false
}
}
return xmlhttp;
}
function ajaxMethod(url,param){
myHttp = getXMLHttpRequest();
myHttp.open('post',url,false);
if(param == null || param == ""){
param ="5000";
}
myHttp.setRequestHeader("Content-Length",param.length);
myHttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
myHttp.send();
if(myHttp.readyState == 4 && myHttp.status==200){
var text = myHttp.responseText;
return text.replace(/(^\s*)|(\s*$)/g, "");//去除前后空格
}else{
return "";
}
}
function ajaxMethodPost(url,param){
myHttp = getXMLHttpRequest();
myHttp.open('post',url,false);
if(param == null || param == ""){
param ="5000";
}
myHttp.setRequestHeader("Content-Length",param.length);
myHttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
myHttp.send(param);
//myHttp.readyState == 4 && myHttp.status==200
if(myHttp.readyState == 4 && myHttp.status==200){
var text = myHttp.responseText;
return text.replace(/(^\s*)|(\s*$)/g, "");//去除前后空格
}else{
return "";
}
}
/*
function ajaxM(deptName,search,fromDate,toDate){
myHttp = getXMLHttpRequest();
var text = "";
var url = 'deptZccxAjax.jsp';
var param = this.getSql(deptName,search,fromDate,toDate);
myHttp.open('post',url,true);
if(param == null || param == ""){
param ="5000";
}
myHttp.setRequestHeader("Content-Length",param.length);
myHttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
myHttp.onreadystatechange = dataSel(deptName,search,fromDate,toDate);
myHttp.send(param);
}
*/
function excelExport(deptName,search,fromDate,toDate,enterStatus,curstate,jumpPage){
var sql = this.getSql(deptName,search,fromDate,toDate,enterStatus,curstate);
sql = encodeURIComponent(encodeURIComponent(sql));
var url = 'deptZccxExcel.jsp';
//alert(deptName);
//alert(encodeURIComponent(encodeURIComponent(deptName)));
url += "?dept=" + encodeURIComponent(encodeURIComponent(deptName));
url += "&sql=" + sql;
//alert(url);
var openProp2 = 'scrollbars=0,top=0,left=0,height=200,width=600,resizable=1,scrollbars=1';
var returnVal = window.open(url,'_blank',openProp2);
}
/*
* ajax 异步
*/
var deptN ;//ajax 开关
function dataSel2(deptName,search,fromDate,toDate,enterStatus,curstate,jumpPage){
deptN = deptName;
var divObj = document.getElementById(deptName);
if(divObj.style.display == 'inline' && (jumpPage==null || jumpPage =="")){//加入了 ajax jumpPage的操作
divObj.style.display = 'none';
}else{
//jumpPage 为ajax页面提过分页功能,并且传给分页的页数
document.forms[0].dept1.value = deptName;
document.forms[0].search1.value = search;
document.forms[0].fromDate1.value = fromDate;
document.forms[0].toDate1.value = toDate;
document.forms[0].enterStatus1.value = enterStatus;
document.forms[0].curstate1.value = curstate;
var url = 'deptZccxAjax.jsp';
var param = '';
if(deptName.split("_").length >1){
deptName = "";
}
var sql = this.getSql(deptName,search,fromDate,toDate,enterStatus,curstate);
//alert(sql);
sql = encodeURIComponent(encodeURIComponent(sql));
param = 'sql=' + sql;
//jumpPage 为ajax页面提过分页功能,并且传给分页的页数
if(jumpPage != null && jumpPage !=""){
param += '&jumpPage=' + jumpPage;
}
myHttp = getXMLHttpRequest();
myHttp.open('post',url,true);//true 同步,false 异步
if(param == null || param == ""){
param ="5000";
}
myHttp.setRequestHeader("Content-Length",param.length);
myHttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
myHttp.onreadystatechange = ajaxRet;
//异步必须用 回调 onreadystatechange ,后面的方法不能有括号
//同步,不必用回调函数,在send()方法后面直接用 if(myHttp.readyState == 4 && myHttp.status==200){}方法
myHttp.send(param);
}
}
function ajaxRet(){
if(myHttp.readyState == 4 && myHttp.status==200){
var reVal = myHttp.responseText;
if(reVal != ""){
var divObj = document.getElementById(deptN);//deptName
var divObjs = document.getElementsByTagName('DIV');
for(var i = 0 ; i < divObjs.length ; i++){
var obj = divObjs[i];
if(obj.className == 'ajaxDiv' && obj.id != deptN){//deptName
obj.style.display = 'none';
}
}
divObj.innerHTML=reVal;
divObj.style.display = 'inline';
//alert(divObj.top);
//debugger;
window.document.body.scrollTop = this.FirstTopTr(deptN) - 130;
}
}
}
function FirstTopTr(id)
{
var m=document.all(id);
var w=0
while(m.offsetParent)
{
w+=m.offsetTop;
m=m.offsetParent;
}
return w;
}
/**
* ajax 同步
*/
function dataSel(deptName,search,fromDate,toDate){
var divObj = document.getElementById(deptName);
if(divObj.style.display == 'inline'){
divObj.style.display = 'none';
}else{
var url = 'deptZccxAjax.jsp';
var param = '';
if(deptName.split("_").length >1){
deptName = "";
}
var sql = this.getSql(deptName,search,fromDate,toDate);
//alert(sql);
sql = encodeURIComponent(encodeURIComponent(sql));
param = 'sql=' + sql;
var reVal = ajaxMethodPost(url,param);
//if(myHttp.readyState == 4 && myHttp.status==200){
//var reVal = myHttp.responseText;
if(reVal != ""){
var divObjs = document.getElementsByTagName('DIV');
for(var i = 0 ; i < divObjs.length ; i++){
var obj = divObjs[i];
if(obj.className == 'ajaxDiv' && obj.id != deptName){
obj.style.display = 'none';
}
}
divObj.innerHTML=reVal;
divObj.style.display = 'inline';
}
//}
}
}
function getSql(deptName,search,fromDate,toDate,enterStatus,curstate){
//把t.* 改成具体的t.INFO_ID,t.CTYPE,t.RUSER,t.RUSEDATE,T.DEPT,T.STOREPLACE,T.CAPSVALUE,T.CNETWORTH,T.CURSTATE
var sql =" select t.INFO_ID,t.CTYPE,t.RUSER,t.RUSEDATE,T.DEPT,T.STOREPLACE,T.CAPSVALUE,T.CNETWORTH,T.CURSTATE,g.* ,t.status as ENTERSTATUS " +
" from ERP_AMS_MINFO t, G_INFOS g " +
" where t.INFO_ID = g.ID and g.DELETED > -1 " +
" and t.DEPT = '"+deptName+"' ";
if(enterStatus != ""){
sql += " and t.status = "+enterStatus+" ";
}
if(curstate != ""){
sql += " and t.CURSTATE = '"+curstate+"' ";
}
if(search != ""){
sql += " and (g.WH like '%" + search + "%'" +
" or g.BT like '%" + search + "%' " +
" or t.RUSER like '%" + search + "%' " +
" or t.STOREPLACE like '%"+ search +"%' " +
" or t.CTYPE like '%"+ search +"%' " +
" or t.DEPT like '%"+ search +"%') ";
}
if(fromDate != "" && toDate != "" ){
sql += " and t.RUSEDATE between convert(datetime, '" + fromDate + "') " +
" and convert(datetime, '" + toDate + " 23:59:59')";
}else if(fromDate != "" && toDate == "" ){
sql += " and t.RUSEDATE >= convert(datetime, '"+fromDate+"') ";
}else if(fromDate = "" && toDate != "" ){
sql += " and t.RUSEDATE <= convert(datetime, '"+toDate+"') ";
}
return sql;
}
var defaultKeywords = "资产编号、资产名称、领用人、类别、领用部门、存放地点";
var textName = "search";
function clearDefault(el) {//清空
//if (el.defaultValue==el.value) el.value = "";
if(el.value == defaultKeywords ) {
el.value = "";
el.style.color = '';
}
}
function resetDefault(el){// 重设
//if (el.value == '') el.value=el.defaultValue;
if(el.value =='') {
el.value = defaultKeywords;
el.style.color = '#9D9D9D';
}
}
function cDefaultSubmit(){
var val = document.getElementById(textName).value;
if(val == defaultKeywords){
document.getElementById(textName).value='';
}
}
window.document.body.onload = (function(){
var val = document.getElementById(textName).value;
if(val == defaultKeywords){
document.getElementById(textName).style.color = '#9D9D9D';
}else if(val == ''){//加载页面时,值为空是 指定默认值
document.getElementById(textName).value = defaultKeywords;
document.getElementById(textName).style.color = '#9D9D9D';
}
});
//ajax分页
function Jumping(el){
try{cDefaultSubmit();}catch(e){}//关键字中除去默认值
document.all['ajaxJumpPage'].value = el.value;//document.all['jumpPage'].value;
// alert(document.all['ajaxJumpPage'].value);
//document.forms[0].submit();
//debugger;
this.ajaxJP();
//return;
}
function gotoPage(pagenum){
document.all['ajaxJumpPage'].value = pagenum;
try{cDefaultSubmit();}catch(e){}
//document.forms[0].submit();
this.ajaxJP();
//return;
}
function ajaxJP(){
//用于 ajax 页面分页
var ajaxJumpPage = document.all['ajaxJumpPage'].value;
//debugger;
if(ajaxJumpPage !=null && ajaxJumpPage != ""){
deptN = '';
var deptName = document.forms[0].dept1.value ;
var search = document.forms[0].search1.value;
var fromDate = document.forms[0].fromDate1.value;
var toDate = document.forms[0].toDate1.value;
var enterStatus = document.forms[0].enterStatus1.value;
var curstate = document.forms[0].curstate1.value;
this.dataSel2(deptName,search,fromDate,toDate,enterStatus,curstate,ajaxJumpPage);
//ajaxJumpPage = '';
}
}
</script>
</body>
</html:html>
deptZccxAjax.jsp
<%@ page language="java" import="java.util.*" pageEncoding="GBK" contentType="text/html; charset=GBK"%><%@
page import="java.net.URLDecoder"%><%@
page import="com.sysoft.baseform.process.util.DataSet"%><%@
page import="com.sysoft.baselib.PublicMethod"%><%@
page import="com.sysoft.baselib.Common"%><%
//String contextPath = request.getContextPath();
//String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+contextPath+"/";
%><%
String sql = request.getParameter("sql");
//System.out.println("ajax sql : " + sql);
if(sql != null && !"".equals(sql)){
sql = URLDecoder.decode(sql,"UTF-8");
//System.out.println("ajax sql : " + sql);
%>
<TABLE border="0" cellpadding="0" cellspacing="1" bgcolor="#EDEDED"
class="table_boxfrom" style="width: 90%"><!-- 850px -->
<tr align="center" valign="bottom" class="tdpage_01">
<TD nowrap="nowrap" align="center">资产编号</TD>
<TD nowrap="nowrap" align="center">资产名称</TD>
<TD nowrap="nowrap" align="center">类别</TD>
<TD nowrap="nowrap" align="center">存放地点</TD>
<TD nowrap="nowrap" align="center">领用人</TD>
<TD nowrap="nowrap" align="center">领用部门</TD>
<TD nowrap="nowrap" align="center">领用日期</TD>
<TD nowrap="nowrap" align="center">资产原值</TD>
<TD nowrap="nowrap" align="center">资产净值</TD>
<TD nowrap="nowrap" align="center">入账状态</TD>
<td nowrap="nowrap" align="center">当前状态</td>
</TR>
<%
DataSet ds = new DataSet();
System.out.println("\n deptAjax :\n " + sql + "\n");
//ds.queryNNVL(sql);
String jumpPage = request.getParameter("jumpPage");
ds.rowsPerPage = 15;
ds.queryByPageNNVL(sql, jumpPage);
for(int i = 0; ds != null && i < ds.size(); i++){
String info_id = ds.getFieldString(i, "INFO_ID");
String objClass = ds.getFieldString(i, "OBJCLASS");
String zcbh = ds.getFieldString(i, "WH"); //资产编号
String zcmc = ds.getFieldString(i, "BT"); //资产名称
String zclx = ds.getFieldString(i, "CTYPE"); //资产类型
String djr = ds.getFieldString(i, "RUSER"); //领用人
String djrq = ds.getFieldString(i, "RUSEDATE");//领用日期
String dept = ds.getFieldString(i, "DEPT"); //所在部门
String cfdd = ds.getFieldString(i, "STOREPLACE");//存放地点
String zcyz = ds.getFieldString(i, "CAPSVALUE"); //资产原值
String zcjz = ds.getFieldString(i, "CNETWORTH"); //资产净值
String curstate = ds.getFieldString(i,"CURSTATE");//当前状态
String enterStatus = ds.getFieldString(i,"ENTERSTATUS");//入账状态
if(enterStatus.equals("0")){
enterStatus = "未入帐";
}else if(enterStatus.equals("1")){
enterStatus = "入帐中";
}else if(enterStatus.equals("2")){
enterStatus = "已入帐";
}
//全局资产管理 全局资产查看 部门资产查看
//boolean roots = Common.isRole(request,"全局资产管理") ;
int ii = 1;
if(Common.isRole(request,"全局资产管理")){
ii=0;
}
String tabUrl = PublicMethod.getNetFormUrl(info_id,objClass,ii+"",application);//"0"
%>
<tr height="25px" bgcolor="#FFFFFF" >
<TD>
<div align="center" style="margin-left:10px;" style="cursor: hand"
οnclick="showDetail('<%=info_id %>', '<%=objClass %>' , '<%=tabUrl %>');">
<%=zcbh %>
</div>
</TD>
<TD><div align="center" style="margin-left:10px;"><%=zcmc %> </div></TD>
<TD><div align="center" style="margin-left:10px;"><%=zclx %> </div></TD>
<TD><div align="center" style="margin-left:10px;"><%=cfdd %> </div></TD>
<TD><div align="center" style="margin-left:10px;"><%=djr %> </div></TD>
<TD><div align="center" style="margin-left:10px;"><%=dept %> </div></TD>
<TD><div align="center" style="margin-left:10px;"><%=djrq %> </div></TD>
<TD><div align="center" style="margin-left:10px;"><%=zcyz %> </div></TD>
<TD><div align="center" style="margin-left:10px;"><%=zcjz %> </div></TD>
<TD><div align="center" style="margin-left:10px;"><%=enterStatus %> </div></TD>
<TD><div align="center" style="margin-left:10px;"><%=curstate %> </div></TD>
</TR>
<%
}
%>
</TABLE>
<table align="center" border="0" cellpadding="0" cellspacing="1" style="width: 850px">
<tr><td colspan="7" align="right">
<%if(ds != null && ds.maxPage!=1 && ds.size()!=0){ %>
每页 <span class='font_e'><%=ds.rowsPerPage%></span> 行
共 <span class='font_e'><%=ds.maxRowCount%></span> 行
当前是 <span class='font_e'><%=ds.curPage%>/
<%=ds.maxPage%></span> 页
<%if(ds.curPage==1){ out.print(" [首页][上一页]"); }else{ %>
[<A HREF="javascript:gotoPage(1)"><span class="font_d" >首页</span></A>]
[<A HREF="javascript:gotoPage(<%=ds.curPage-1%>)"><span class="font_d" >上一页</span></A>]
<%}%>
<%if(ds.curPage==ds.maxPage){ out.print("[下一页] [尾页]"); }else{ %>
[<A HREF="javascript:gotoPage(<%=ds.curPage+1%>)"><span class="font_d" >下一页</span></A>]
[<A HREF="javascript:gotoPage(<%=ds.maxPage%>)"><span class="font_d" >尾页</span></A>]
<%}%>
转到第<SELECT name="jumpPage" οnchange="Jumping(this)">
<% for(int i=1;i<=ds.maxPage;i++) {
if (i== ds.curPage){
%>
<OPTION selected="selected" value='<%=i%>'><%=i%></OPTION>
<%}else{%>
<OPTION value='<%=i%>'><%=i%></OPTION>
<%}}%>
</SELECT>页
<%}%>
</td></tr>
</table>
<br/>
<!--
<script type="text/javascript">
function Jumping(){
try{cDefaultSubmit();}catch(e){}//关键字中除去默认值
document.forms[0].submit();
return;
}
function gotoPage(pagenum){
document.all['jumpPage'].value = pagenum;
try{cDefaultSubmit();}catch(e){}
document.forms[0].submit();
return;
}
</script>
-->
<%
}
%>
deptZccxExcel.jsp
<%@ page contentType="application/msexcel; charset=GBK" %><%@
page import="java.net.URLDecoder"%><%@
page import="com.sysoft.baseform.process.util.DataSet"%><%@
page import="com.sysoft.baselib.PublicMethod"%><%@
page import="com.sysoft.baselib.Common"%>
<%@page import="com.sysoft.baseform.process.util.StringUtil"%>
<%@page import="org.apache.log4j.Logger"%><%
//String contextPath = request.getContextPath();
//String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+contextPath+"/";
%><%
//Logger log = Logger.getLogger("部门资产EXCEL");
String deptName = StringUtil.cleanString(request
.getParameter("dept"));
System.out.println("\n deptAjax :\n " + deptName + "\n");
//log.debug(deptName);
if (!deptName.equals("")) {
deptName = URLDecoder.decode(deptName, "UTF-8");
//log.debug(deptName);
} else {
deptName = "部门资产";
}
String filename = new String((deptName).getBytes("GBK"),"ISO-8859-1");
response.addHeader("Content-disposition", "inline; filename="
+ filename + ".xls");
String sql = request.getParameter("sql");
//System.out.println("ajax sql : " + sql);
if (sql != null && !"".equals(sql)) {
sql = URLDecoder.decode(sql, "UTF-8");
//System.out.println("ajax sql : " + sql);
%>
<TABLE border="1" cellpadding="0" cellspacing="1" bgcolor="#EDEDED" class="table_boxfrom" style="width: 850px">
<tr align="center" valign="bottom" class="tdpage_01">
<TD align="center">资产编号</TD>
<TD align="center">资产名称</TD>
<TD align="center">类别</TD>
<TD align="center">存放地点</TD>
<TD align="center">领用人</TD>
<TD align="center">领用部门</TD>
<TD align="center">领用日期</TD>
<TD align="center">资产原值</TD>
<TD align="center">资产净值</TD>
<TD align="center">入账状态</TD>
<td align="center">当前状态</td>
</TR>
<%
DataSet ds = new DataSet();
//System.out.println("\n deptAjax :\n " + sql + "\n");
//ds.queryNNVL(sql);
//String jumpPage = request.getParameter("jumpPage");
//ds.rowsPerPage = 15;
ds.queryNNVL(sql);
for (int i = 0; ds != null && i < ds.size(); i++) {
String info_id = ds.getFieldString(i, "INFO_ID");
String objClass = ds.getFieldString(i, "OBJCLASS");
String zcbh = ds.getFieldString(i, "WH"); //资产编号
String zcmc = ds.getFieldString(i, "BT"); //资产名称
String zclx = ds.getFieldString(i, "CTYPE"); //资产类型
String djr = ds.getFieldString(i, "RUSER"); //领用人
String djrq = ds.getFieldString(i, "RUSEDATE");//领用日期
String dept = ds.getFieldString(i, "DEPT"); //所在部门
String cfdd = ds.getFieldString(i, "STOREPLACE");//存放地点
String zcyz = ds.getFieldString(i, "CAPSVALUE"); //资产原值
String zcjz = ds.getFieldString(i, "CNETWORTH"); //资产净值
String curstate = ds.getFieldString(i, "CURSTATE");//当前状态
String enterStatus = ds.getFieldString(i, "ENTERSTATUS");//入账状态
if (enterStatus.equals("0")) {
enterStatus = "未入帐";
} else if (enterStatus.equals("1")) {
enterStatus = "入帐中";
} else if (enterStatus.equals("2")) {
enterStatus = "已入帐";
}
//全局资产管理 全局资产查看 部门资产查看
//boolean roots = Common.isRole(request,"全局资产管理") ;
int ii = 1;
if (Common.isRole(request, "全局资产管理")) {
ii = 0;
}
String tabUrl = PublicMethod.getNetFormUrl(info_id,
objClass, ii + "", application);//"0"
%>
<tr style="cursor: hand" height="25px" bgcolor="#FFFFFF" οnclick="showDetail('<%=info_id%>', '<%=objClass%>' , '<%=tabUrl%>');">
<TD><div align="center" style="margin-left:10px;"><%=zcbh%> </div></TD>
<TD><div align="center" style="margin-left:10px;"><%=zcmc%> </div></TD>
<TD><div align="center" style="margin-left:10px;"><%=zclx%> </div></TD>
<TD><div align="center" style="margin-left:10px;"><%=cfdd%> </div></TD>
<TD><div align="center" style="margin-left:10px;"><%=djr%> </div></TD>
<TD><div align="center" style="margin-left:10px;"><%=dept%> </div></TD>
<TD><div align="center" style="margin-left:10px;"><%=djrq%> </div></TD>
<TD><div align="center" style="margin-left:10px;"><%=zcyz%> </div></TD>
<TD><div align="center" style="margin-left:10px;"><%=zcjz%> </div></TD>
<TD><div align="center" style="margin-left:10px;"><%=enterStatus%> </div></TD>
<TD><div align="center" style="margin-left:10px;"><%=curstate%> </div></TD>
</TR>
<%
}
%>
</TABLE>
<%
}
%>