Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
jinli gu
JSH ERP
Commits
bf9beea1
Commit
bf9beea1
authored
Sep 02, 2017
by
季圣华
Browse files
增加4张报表的打印功能
parent
b70adf22
Changes
6
Hide whitespace changes
Inline
Side-by-side
src/main/webapp/js/print/print.html
0 → 100644
View file @
bf9beea1
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html
xmlns=
"http://www.w3.org/1999/xhtml"
>
<head>
<title>
数据打印
</title>
<style
type=
"text/css"
>
body
{
background
:
white
;
margin
:
0px
;
padding
:
0px
;
font-size
:
13px
;
text-align
:
left
;}
.div-title
{
font-size
:
16pt
;}
.div-time
{
font-size
:
11pt
;}
.pb
{
font-size
:
13px
;
border-collapse
:
collapse
;}
.pb
th
{
font-weight
:
bold
;
text-align
:
center
;
border
:
1px
solid
#333333
;
padding
:
2px
;}
.pb
td
{
border
:
1px
solid
#333333
;
padding
:
2px
;}
</style>
</head>
<body>
<script
type=
"text/javascript"
>
var
tableString
=
localStorage
.
getItem
(
"
tableString
"
);
document
.
write
(
tableString
);
window
.
print
();
</script>
</body>
</html>
\ No newline at end of file
src/main/webapp/js/print/print.js
0 → 100644
View file @
bf9beea1
// strPrintName 打印任务名
// printDatagrid 要打印的datagrid
function
CreateFormPage
(
strPrintName
,
printDatagrid
)
{
var
beginDate
=
$
(
"
#searchBeginTime
"
).
val
();
var
endDate
=
$
(
"
#searchEndTime
"
).
val
();
var
tableString
=
'
<div class="div-title">上海某某某某有限责任公司
\n
</div>
'
+
'
\n
<div class="div-time">日期:
'
+
beginDate
+
'
至
'
+
endDate
+
'
\n
</div>
'
+
'
\n
<table cellspacing="0" class="pb">
'
;
var
frozenColumns
=
printDatagrid
.
datagrid
(
"
options
"
).
frozenColumns
;
// 得到frozenColumns对象
var
columns
=
printDatagrid
.
datagrid
(
"
options
"
).
columns
;
// 得到columns对象
var
nameList
=
''
;
// 载入title
if
(
typeof
columns
!=
'
undefined
'
&&
columns
!=
''
)
{
$
(
columns
).
each
(
function
(
index
)
{
tableString
+=
'
\n
<tr>
'
;
if
(
typeof
frozenColumns
!=
'
undefined
'
&&
typeof
frozenColumns
[
index
]
!=
'
undefined
'
)
{
for
(
var
i
=
0
;
i
<
frozenColumns
[
index
].
length
;
++
i
)
{
if
(
!
frozenColumns
[
index
][
i
].
hidden
)
{
tableString
+=
'
\n
<th width="
'
+
frozenColumns
[
index
][
i
].
width
+
'
"
'
;
if
(
typeof
frozenColumns
[
index
][
i
].
rowspan
!=
'
undefined
'
&&
frozenColumns
[
index
][
i
].
rowspan
>
1
)
{
tableString
+=
'
rowspan="
'
+
frozenColumns
[
index
][
i
].
rowspan
+
'
"
'
;
}
if
(
typeof
frozenColumns
[
index
][
i
].
colspan
!=
'
undefined
'
&&
frozenColumns
[
index
][
i
].
colspan
>
1
)
{
tableString
+=
'
colspan="
'
+
frozenColumns
[
index
][
i
].
colspan
+
'
"
'
;
}
if
(
typeof
frozenColumns
[
index
][
i
].
field
!=
'
undefined
'
&&
frozenColumns
[
index
][
i
].
field
!=
''
)
{
nameList
+=
'
,{"f":"
'
+
frozenColumns
[
index
][
i
].
field
+
'
", "a":"
'
+
frozenColumns
[
index
][
i
].
align
+
'
"}
'
;
}
tableString
+=
'
>
'
+
frozenColumns
[
0
][
i
].
title
+
'
</th>
'
;
}
}
}
for
(
var
i
=
0
;
i
<
columns
[
index
].
length
;
++
i
)
{
if
(
!
columns
[
index
][
i
].
hidden
)
{
tableString
+=
'
\n
<th width="
'
+
columns
[
index
][
i
].
width
+
'
"
'
;
if
(
typeof
columns
[
index
][
i
].
rowspan
!=
'
undefined
'
&&
columns
[
index
][
i
].
rowspan
>
1
)
{
tableString
+=
'
rowspan="
'
+
columns
[
index
][
i
].
rowspan
+
'
"
'
;
}
if
(
typeof
columns
[
index
][
i
].
colspan
!=
'
undefined
'
&&
columns
[
index
][
i
].
colspan
>
1
)
{
tableString
+=
'
colspan="
'
+
columns
[
index
][
i
].
colspan
+
'
"
'
;
}
if
(
typeof
columns
[
index
][
i
].
field
!=
'
undefined
'
&&
columns
[
index
][
i
].
field
!=
''
)
{
nameList
+=
'
,{"f":"
'
+
columns
[
index
][
i
].
field
+
'
", "a":"
'
+
columns
[
index
][
i
].
align
+
'
"}
'
;
}
tableString
+=
'
>
'
+
columns
[
index
][
i
].
title
+
'
</th>
'
;
}
}
tableString
+=
'
\n
</tr>
'
;
});
}
// 载入内容
var
rows
=
printDatagrid
.
datagrid
(
"
getRows
"
);
// 这段代码是获取当前页的所有行
var
nl
=
eval
(
'
([
'
+
nameList
.
substring
(
1
)
+
'
])
'
);
for
(
var
i
=
0
;
i
<
rows
.
length
;
++
i
)
{
tableString
+=
'
\n
<tr>
'
;
$
(
nl
).
each
(
function
(
j
)
{
var
e
=
nl
[
j
].
f
.
lastIndexOf
(
'
_0
'
);
tableString
+=
'
\n
<td
'
;
if
(
nl
[
j
].
a
!=
'
undefined
'
&&
nl
[
j
].
a
!=
''
)
{
tableString
+=
'
style="text-align:
'
+
nl
[
j
].
a
+
'
;"
'
;
}
tableString
+=
'
>
'
;
if
(
e
+
2
==
nl
[
j
].
f
.
length
)
{
tableString
+=
rows
[
i
][
nl
[
j
].
f
.
substring
(
0
,
e
)];
}
else
tableString
+=
rows
[
i
][
nl
[
j
].
f
];
tableString
+=
'
</td>
'
;
});
tableString
+=
'
\n
</tr>
'
;
}
tableString
+=
'
\n
</table>
'
;
localStorage
.
setItem
(
"
tableString
"
,
tableString
);
window
.
open
(
"
../../js/print/print.html
"
,
"
location:No;status:No;help:No;dialogWidth:800px;dialogHeight:600px;scroll:auto;
"
);
}
\ No newline at end of file
src/main/webapp/pages/reports/in_detail.jsp
View file @
bf9beea1
...
...
@@ -13,6 +13,7 @@
<meta
http-equiv=
"X-UA-Compatible"
content=
"IE=EmulateIE8"
/>
<link
rel=
"shortcut icon"
href=
"
<%=
path
%>
/images/favicon.ico"
type=
"image/x-icon"
/>
<script
type=
"text/javascript"
src=
"
<%=
path
%>
/js/jquery-1.8.0.min.js"
></script>
<script
type=
"text/javascript"
src=
"
<%=
path
%>
/js/print/print.js"
></script>
<link
rel=
"stylesheet"
type=
"text/css"
href=
"
<%=
path
%>
/js/easyui-1.3.5/themes/default/easyui.css"
/>
<link
rel=
"stylesheet"
type=
"text/css"
href=
"
<%=
path
%>
/js/easyui-1.3.5/themes/icon.css"
/>
<link
type=
"text/css"
rel=
"stylesheet"
href=
"
<%=
path
%>
/css/common.css"
/>
...
...
@@ -45,7 +46,8 @@
<td>
</td>
<td>
<a
href=
"javascript:void(0)"
class=
"easyui-linkbutton"
iconCls=
"icon-search"
id=
"searchBtn"
>
查询
</a>
<span
class=
"total-count"
></span>
<a
href=
"javascript:void(0)"
class=
"easyui-linkbutton"
iconCls=
"icon-print"
id=
"printBtn"
>
打印
</a>
</td>
</tr>
</table>
...
...
@@ -76,6 +78,7 @@
initTableData
();
ininPager
();
search
();
print
();
});
...
...
@@ -304,7 +307,13 @@
return
;
}
});
}
}
//报表打印
function
print
()
{
$
(
"
#printBtn
"
).
off
(
"
click
"
).
on
(
"
click
"
,
function
(){
CreateFormPage
(
'
打印报表
'
,
$
(
'
#tableData
'
));
});
}
</script>
</body>
</html>
\ No newline at end of file
src/main/webapp/pages/reports/in_material_count.jsp
View file @
bf9beea1
...
...
@@ -13,6 +13,7 @@
<meta
http-equiv=
"X-UA-Compatible"
content=
"IE=EmulateIE8"
/>
<link
rel=
"shortcut icon"
href=
"
<%=
path
%>
/images/favicon.ico"
type=
"image/x-icon"
/>
<script
type=
"text/javascript"
src=
"
<%=
path
%>
/js/jquery-1.8.0.min.js"
></script>
<script
type=
"text/javascript"
src=
"
<%=
path
%>
/js/print/print.js"
></script>
<link
rel=
"stylesheet"
type=
"text/css"
href=
"
<%=
path
%>
/js/easyui-1.3.5/themes/default/easyui.css"
/>
<link
rel=
"stylesheet"
type=
"text/css"
href=
"
<%=
path
%>
/js/easyui-1.3.5/themes/icon.css"
/>
<link
type=
"text/css"
rel=
"stylesheet"
href=
"
<%=
path
%>
/css/common.css"
/>
...
...
@@ -45,7 +46,8 @@
<td>
</td>
<td>
<a
href=
"javascript:void(0)"
class=
"easyui-linkbutton"
iconCls=
"icon-search"
id=
"searchBtn"
>
查询
</a>
<span
class=
"total-count"
></span>
<a
href=
"javascript:void(0)"
class=
"easyui-linkbutton"
iconCls=
"icon-print"
id=
"printBtn"
>
打印
</a>
</td>
</tr>
</table>
...
...
@@ -76,8 +78,8 @@
initTableData
();
ininPager
();
search
();
print
();
});
//初始化系统基础信息
...
...
@@ -299,7 +301,13 @@
return
;
}
});
}
}
//报表打印
function
print
()
{
$
(
"
#printBtn
"
).
off
(
"
click
"
).
on
(
"
click
"
,
function
(){
CreateFormPage
(
'
打印报表
'
,
$
(
'
#tableData
'
));
});
}
</script>
</body>
</html>
\ No newline at end of file
src/main/webapp/pages/reports/out_detail.jsp
View file @
bf9beea1
...
...
@@ -13,6 +13,7 @@
<meta
http-equiv=
"X-UA-Compatible"
content=
"IE=EmulateIE8"
/>
<link
rel=
"shortcut icon"
href=
"
<%=
path
%>
/images/favicon.ico"
type=
"image/x-icon"
/>
<script
type=
"text/javascript"
src=
"
<%=
path
%>
/js/jquery-1.8.0.min.js"
></script>
<script
type=
"text/javascript"
src=
"
<%=
path
%>
/js/print/print.js"
></script>
<link
rel=
"stylesheet"
type=
"text/css"
href=
"
<%=
path
%>
/js/easyui-1.3.5/themes/default/easyui.css"
/>
<link
rel=
"stylesheet"
type=
"text/css"
href=
"
<%=
path
%>
/js/easyui-1.3.5/themes/icon.css"
/>
<link
type=
"text/css"
rel=
"stylesheet"
href=
"
<%=
path
%>
/css/common.css"
/>
...
...
@@ -45,7 +46,8 @@
<td>
</td>
<td>
<a
href=
"javascript:void(0)"
class=
"easyui-linkbutton"
iconCls=
"icon-search"
id=
"searchBtn"
>
查询
</a>
<span
class=
"total-count"
></span>
<a
href=
"javascript:void(0)"
class=
"easyui-linkbutton"
iconCls=
"icon-print"
id=
"printBtn"
>
打印
</a>
</td>
</tr>
</table>
...
...
@@ -76,10 +78,10 @@
initTableData
();
ininPager
();
search
();
print
();
});
//初始化系统基础信息
function
initSystemData_UB
(){
$
.
ajax
({
...
...
@@ -305,6 +307,12 @@
}
});
}
//报表打印
function
print
()
{
$
(
"
#printBtn
"
).
off
(
"
click
"
).
on
(
"
click
"
,
function
(){
CreateFormPage
(
'
打印报表
'
,
$
(
'
#tableData
'
));
});
}
</script>
</body>
</html>
\ No newline at end of file
src/main/webapp/pages/reports/out_material_count.jsp
View file @
bf9beea1
...
...
@@ -13,6 +13,7 @@
<meta
http-equiv=
"X-UA-Compatible"
content=
"IE=EmulateIE8"
/>
<link
rel=
"shortcut icon"
href=
"
<%=
path
%>
/images/favicon.ico"
type=
"image/x-icon"
/>
<script
type=
"text/javascript"
src=
"
<%=
path
%>
/js/jquery-1.8.0.min.js"
></script>
<script
type=
"text/javascript"
src=
"
<%=
path
%>
/js/print/print.js"
></script>
<link
rel=
"stylesheet"
type=
"text/css"
href=
"
<%=
path
%>
/js/easyui-1.3.5/themes/default/easyui.css"
/>
<link
rel=
"stylesheet"
type=
"text/css"
href=
"
<%=
path
%>
/js/easyui-1.3.5/themes/icon.css"
/>
<link
type=
"text/css"
rel=
"stylesheet"
href=
"
<%=
path
%>
/css/common.css"
/>
...
...
@@ -45,7 +46,8 @@
<td>
</td>
<td>
<a
href=
"javascript:void(0)"
class=
"easyui-linkbutton"
iconCls=
"icon-search"
id=
"searchBtn"
>
查询
</a>
<span
class=
"total-count"
></span>
<a
href=
"javascript:void(0)"
class=
"easyui-linkbutton"
iconCls=
"icon-print"
id=
"printBtn"
>
打印
</a>
</td>
</tr>
</table>
...
...
@@ -76,8 +78,8 @@
initTableData
();
ininPager
();
search
();
print
();
});
//初始化系统基础信息
...
...
@@ -299,7 +301,13 @@
return
;
}
});
}
}
//报表打印
function
print
()
{
$
(
"
#printBtn
"
).
off
(
"
click
"
).
on
(
"
click
"
,
function
(){
CreateFormPage
(
'
打印报表
'
,
$
(
'
#tableData
'
));
});
}
</script>
</body>
</html>
\ No newline at end of file
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment