dateplanreport.jsp 9.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291
  1. <%@ page contentType="text/html; charset=utf-8" session="false" %>
  2. <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
  3. <%@page import="java.util.List"%>
  4. <%@page import="java.util.Map"%>
  5. <%@page import="java.util.ArrayList"%>
  6. <%@page import="java.text.DecimalFormat"%>
  7. <html xmlns="http://www.w3.org/1999/xhtml">
  8. <style>
  9. @media print { .ipt {display:none} }
  10. </style>
  11. <head>
  12. <title>我的工作台</title>
  13. <%@ include file="../common/header.jsp" %>
  14. <style type="text/css">
  15. .ptabsty{
  16. margin:1px auto;
  17. border-collapse:collapse;
  18. }
  19. .ptabsty,.ptabsty tr td,.ptabsty tr th{ border:#ADADAD solid 1px;color:#000000;}
  20. .ptabsty tr th{ background-color:#E0E0E0; font-size:14px; font-weight:bold; text-align:center;}
  21. .ptabsty tr td{ background-color:white; }
  22. </style>
  23. <script type="text/javascript">
  24. function datePlanReport(){
  25. var bc1=$("#bc1").val();
  26. var bc2=$("#bc2").val();
  27. var bc3=$("#bc3").val();
  28. var beginDate = $("#beginDate").val();
  29. var selectId = $("#selectId").val();
  30. var btnType = $("#btnType").val();
  31. document.location.href="${contextPath}/admin/recipeplan/dateplanreportexcel.html?beginDate="+beginDate+"&selectId="+selectId+"&bc1="+bc1+"&bc2="+bc2+"&bc3="+bc3+"&btnType="+btnType;
  32. }
  33. function PrinterJob(){
  34. if (window.print) {
  35. var p_title = document.all.p_1.innerHTML;
  36. var css = '<style type="text/css">' +
  37. 'p { line-height: 120%}' +
  38. '.ftitle { line-height: 120%; font-size: 18px; color: #000000}' +
  39. 'td { font-size: 10px; color: #000000}' +
  40. '</style>' ;
  41. var body ='<table width="100%" border="0" cellspacing="0" cellpadding="5">' +
  42. ' <tr> ' +
  43. ' <td class="ftitle"> ' +
  44. ' <div align="center" class=ftitle>' + p_title + '</div>' +
  45. ' </td>' +
  46. ' </tr>' +
  47. '</table>';
  48. document.body.innerHTML = '<center>' + css + body + '</center>';
  49. window.print();
  50. }
  51. }
  52. </script>
  53. </head>
  54. <body>
  55. <div>
  56. <input type="hidden" id="bc1" value="${bc1 }" />
  57. <input type="hidden" id="bc2" value="${bc2 }" />
  58. <input type="hidden" id="bc3" value="${bc3 }" />
  59. <input type="hidden" id="beginDate" value="${beginDate }" />
  60. <input type="hidden" id="btnType" value="${btnType }" />
  61. <input type="hidden" id="selectId" value="${selectId }" />
  62. <div id=p_1>
  63. <table cellspacing="1" cellpadding="0" border="0" style="width:99%;">
  64. <tr>
  65. <td align="center">
  66. <c:if test="${btnType eq 0}">
  67. <h1><c:out value="${beginDate}" />日计划打印表(按每次投料量)</h1>
  68. </c:if>
  69. <c:if test="${btnType eq 1}">
  70. <h1><c:out value="${beginDate}" />日计划打印表(按投料累加量)</h1>
  71. </c:if>
  72. <c:if test="${btnType eq 2}">
  73. <h1><c:out value="${beginDate}" />日计划打印表(按发料量)</h1>
  74. </c:if>
  75. <c:if test="${btnType eq 3}">
  76. <h1>牧场日粮配合表(<c:out value="${beginDate}" />)</h1>
  77. </c:if>
  78. <c:if test="${btnType eq 5}">
  79. <h1>牧场日粮累加配合表(<c:out value="${beginDate}" />)</h1>
  80. </c:if>
  81. <c:if test="${btnType eq 4}">
  82. <h1><c:out value="${beginDate}" />日计划打印表(包装量)</h1>
  83. </c:if>
  84. <c:if test="${btnType eq 6}">
  85. <h1>牧场日粮实发表(<c:out value="${beginDate}" />(单位:公斤))</h1>
  86. </c:if>
  87. </td>
  88. </tr>
  89. </table>
  90. <table cellspacing="0" cellpadding="0" border="0" style="width:99%;" class="ptabsty">
  91. <tbody>
  92. <tr align="center" style="height: 25px;">
  93. <c:forEach var="col" items="${colList}">
  94. <c:if test="${col.name != 'TMR'}">
  95. <th><c:out value="${col.name}" /></th>
  96. </c:if>
  97. <c:if test="${col.name == 'TMR'}">
  98. <c:if test="${tmrFlag == true}">
  99. <th><c:out value="${col.name}" /></th>
  100. </c:if>
  101. </c:if>
  102. </c:forEach>
  103. </tr>
  104. <%
  105. Boolean tmrFlag = (Boolean) request.getAttribute("tmrFlag");
  106. String btnType = (String) request.getAttribute("btnType");
  107. List colList = (List) request.getAttribute("colList");
  108. List rsList = (List) request.getAttribute("rsList");
  109. Integer scount = (Integer) request.getAttribute("scount");
  110. Float lsVale = 0F;
  111. String str = "";
  112. if(scount==0){
  113. str = "##0";
  114. }else if(scount==1){
  115. str = "##0.0";
  116. }else if(scount==2){
  117. str = "##0.00";
  118. }else if(scount==3){
  119. str = "##0.000";
  120. }
  121. DecimalFormat fnum = new DecimalFormat(str);
  122. if("1".equals(btnType)){
  123. for (int i = 0; i < rsList.size(); i++){
  124. lsVale = 0F;
  125. Map rsMap = (Map) rsList.get(i);
  126. %>
  127. <tr align="center" style="height: 25px;">
  128. <%
  129. for (int j = 0; j < colList.size(); j++){
  130. Map colMap = (Map) colList.get(j);
  131. if(colMap==null){
  132. continue;
  133. }
  134. String colName = (String)colMap.get("name");
  135. if("没有数据!".equals(colName)){
  136. %>
  137. <td>没有数据!</td>
  138. <%
  139. }else{
  140. if(i%2==1){
  141. if("车次".equals(colName)||"时间".equals(colName)||"配方模板".equals(colName)||"日系数比例".equals(colName)||"驾驶员".equals(colName)||"班组".equals(colName)){
  142. String colValueOld = (String)rsMap.get(colName);
  143. %>
  144. <td style="background-color:#E0E0E0;"><c:out value="<%=colValueOld %>"/></td>
  145. <%
  146. }else if("TMR".equals(colName)){
  147. if(tmrFlag){
  148. String colValueOld = (String)rsMap.get(colName);
  149. %>
  150. <td style="background-color:#E0E0E0;"><c:out value="<%=colValueOld %>"/></td>
  151. <%
  152. }
  153. }else{
  154. String colValueOld = (String)rsMap.get(colName);
  155. if(colValueOld!=null&&!colValueOld.isEmpty()){
  156. Float colValue = Float.valueOf(colValueOld);
  157. if(lsVale == 0){
  158. lsVale = colValue;
  159. }else{
  160. lsVale += colValue;
  161. }
  162. String colValueNew = fnum.format(lsVale);
  163. %>
  164. <td style="background-color:#E0E0E0;"><c:out value="<%=colValueNew %>"/></td>
  165. <%
  166. }else{
  167. %>
  168. <td style="background-color:#E0E0E0;"><c:out value=""/></td>
  169. <%
  170. }
  171. }
  172. }else{
  173. if("车次".equals(colName)||"时间".equals(colName)||"配方模板".equals(colName)||"日系数比例".equals(colName)||"驾驶员".equals(colName)||"班组".equals(colName)){
  174. String colValueOld = (String)rsMap.get(colName);
  175. %>
  176. <td><c:out value="<%=colValueOld %>"/></td>
  177. <%
  178. }else if("TMR".equals(colName)){
  179. if(tmrFlag){
  180. String colValueOld = (String)rsMap.get(colName);
  181. %>
  182. <td><c:out value="<%=colValueOld %>"/></td>
  183. <%
  184. }
  185. }else{
  186. String colValueOld = (String)rsMap.get(colName);
  187. if(colValueOld!=null&&!colValueOld.isEmpty()){
  188. Float colValue = Float.valueOf(colValueOld);
  189. if(lsVale == 0){
  190. lsVale = colValue;
  191. }else{
  192. lsVale += colValue;
  193. }
  194. String colValueNew = fnum.format(lsVale);
  195. %>
  196. <td><c:out value="<%=colValueNew %>"/></td>
  197. <%
  198. }else{
  199. %>
  200. <td><c:out value=""/></td>
  201. <%
  202. }
  203. }
  204. }
  205. }
  206. }
  207. %>
  208. </tr>
  209. <%
  210. }
  211. }else{
  212. for (int i = 0; i < rsList.size(); i++){
  213. Map rsMap = (Map) rsList.get(i);
  214. %>
  215. <tr align="center" style="height: 25px;">
  216. <%
  217. for (int j = 0; j < colList.size(); j++){
  218. Map colMap = (Map) colList.get(j);
  219. String colName = (String)colMap.get("name");
  220. if("没有数据!".equals(colName)){
  221. %>
  222. <td>没有数据!</td>
  223. <%
  224. }else{
  225. Object colValueOld = (Object)rsMap.get(colName);
  226. String colValueNew = "";
  227. if(!"TMR".equals(colName)){
  228. if("发料合计".equals(colName)){
  229. if(colValueOld != null){
  230. String sss = colValueOld.toString();
  231. Float fff = Float.valueOf(sss);
  232. colValueNew = fnum.format(fff);
  233. }
  234. if(i%2==1){
  235. %>
  236. <td style="background-color:#E0E0E0;"><c:out value="<%=colValueNew %>"/></td>
  237. <%
  238. }else{
  239. %>
  240. <td><c:out value="<%=colValueNew %>"/></td>
  241. <%
  242. }
  243. }else{
  244. if(i%2==1){
  245. %>
  246. <td style="background-color:#E0E0E0;"><c:out value="<%=colValueOld %>"/></td>
  247. <%
  248. }else{
  249. %>
  250. <td><c:out value="<%=colValueOld %>"/></td>
  251. <%
  252. }
  253. }
  254. }else{
  255. if(tmrFlag){
  256. if(i%2==1){
  257. %>
  258. <td style="background-color:#E0E0E0;"><c:out value="<%=colValueOld %>"/></td>
  259. <%
  260. }else{
  261. %>
  262. <td><c:out value="<%=colValueOld %>"/></td>
  263. <%
  264. }
  265. }
  266. }
  267. }
  268. }
  269. %>
  270. </tr>
  271. <%
  272. }
  273. }
  274. %>
  275. </tbody>
  276. </table>
  277. </div>
  278. <table cellspacing="1" cellpadding="0" border="0" style="width:99%;">
  279. <tr><td align="right"><input type="button" value="打印" class="sysub" onclick="PrinterJob()"/><input type="button" value="导出Excel" class="sysub" onclick="datePlanReport()"/></tr>
  280. </table>
  281. </div>
  282. </body>
  283. </html>