123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291 |
- <%@ page contentType="text/html; charset=utf-8" session="false" %>
- <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
- <%@page import="java.util.List"%>
- <%@page import="java.util.Map"%>
- <%@page import="java.util.ArrayList"%>
- <%@page import="java.text.DecimalFormat"%>
- <html xmlns="http://www.w3.org/1999/xhtml">
- <style>
- @media print { .ipt {display:none} }
- </style>
- <head>
- <title>我的工作台</title>
- <%@ include file="../common/header.jsp" %>
- <style type="text/css">
- .ptabsty{
- margin:1px auto;
- border-collapse:collapse;
- }
- .ptabsty,.ptabsty tr td,.ptabsty tr th{ border:#ADADAD solid 1px;color:#000000;}
- .ptabsty tr th{ background-color:#E0E0E0; font-size:14px; font-weight:bold; text-align:center;}
- .ptabsty tr td{ background-color:white; }
- </style>
- <script type="text/javascript">
- function datePlanReport(){
- var bc1=$("#bc1").val();
- var bc2=$("#bc2").val();
- var bc3=$("#bc3").val();
- var beginDate = $("#beginDate").val();
- var selectId = $("#selectId").val();
- var btnType = $("#btnType").val();
- document.location.href="${contextPath}/admin/recipeplan/dateplanreportexcel.html?beginDate="+beginDate+"&selectId="+selectId+"&bc1="+bc1+"&bc2="+bc2+"&bc3="+bc3+"&btnType="+btnType;
- }
-
- function PrinterJob(){
- if (window.print) {
- var p_title = document.all.p_1.innerHTML;
-
- var css = '<style type="text/css">' +
- 'p { line-height: 120%}' +
- '.ftitle { line-height: 120%; font-size: 18px; color: #000000}' +
- 'td { font-size: 10px; color: #000000}' +
- '</style>' ;
- var body ='<table width="100%" border="0" cellspacing="0" cellpadding="5">' +
- ' <tr> ' +
- ' <td class="ftitle"> ' +
- ' <div align="center" class=ftitle>' + p_title + '</div>' +
- ' </td>' +
- ' </tr>' +
- '</table>';
- document.body.innerHTML = '<center>' + css + body + '</center>';
- window.print();
- }
- }
- </script>
- </head>
- <body>
- <div>
- <input type="hidden" id="bc1" value="${bc1 }" />
- <input type="hidden" id="bc2" value="${bc2 }" />
- <input type="hidden" id="bc3" value="${bc3 }" />
- <input type="hidden" id="beginDate" value="${beginDate }" />
- <input type="hidden" id="btnType" value="${btnType }" />
- <input type="hidden" id="selectId" value="${selectId }" />
- <div id=p_1>
- <table cellspacing="1" cellpadding="0" border="0" style="width:99%;">
- <tr>
- <td align="center">
- <c:if test="${btnType eq 0}">
- <h1><c:out value="${beginDate}" />日计划打印表(按每次投料量)</h1>
- </c:if>
- <c:if test="${btnType eq 1}">
- <h1><c:out value="${beginDate}" />日计划打印表(按投料累加量)</h1>
- </c:if>
- <c:if test="${btnType eq 2}">
- <h1><c:out value="${beginDate}" />日计划打印表(按发料量)</h1>
- </c:if>
- <c:if test="${btnType eq 3}">
- <h1>牧场日粮配合表(<c:out value="${beginDate}" />)</h1>
- </c:if>
- <c:if test="${btnType eq 5}">
- <h1>牧场日粮累加配合表(<c:out value="${beginDate}" />)</h1>
- </c:if>
- <c:if test="${btnType eq 4}">
- <h1><c:out value="${beginDate}" />日计划打印表(包装量)</h1>
- </c:if>
- <c:if test="${btnType eq 6}">
- <h1>牧场日粮实发表(<c:out value="${beginDate}" />(单位:公斤))</h1>
- </c:if>
- </td>
- </tr>
- </table>
- <table cellspacing="0" cellpadding="0" border="0" style="width:99%;" class="ptabsty">
- <tbody>
- <tr align="center" style="height: 25px;">
- <c:forEach var="col" items="${colList}">
- <c:if test="${col.name != 'TMR'}">
- <th><c:out value="${col.name}" /></th>
- </c:if>
- <c:if test="${col.name == 'TMR'}">
- <c:if test="${tmrFlag == true}">
- <th><c:out value="${col.name}" /></th>
- </c:if>
- </c:if>
- </c:forEach>
- </tr>
- <%
- Boolean tmrFlag = (Boolean) request.getAttribute("tmrFlag");
- String btnType = (String) request.getAttribute("btnType");
- List colList = (List) request.getAttribute("colList");
- List rsList = (List) request.getAttribute("rsList");
- Integer scount = (Integer) request.getAttribute("scount");
- Float lsVale = 0F;
-
- String str = "";
- if(scount==0){
- str = "##0";
- }else if(scount==1){
- str = "##0.0";
- }else if(scount==2){
- str = "##0.00";
- }else if(scount==3){
- str = "##0.000";
- }
- DecimalFormat fnum = new DecimalFormat(str);
-
- if("1".equals(btnType)){
- for (int i = 0; i < rsList.size(); i++){
- lsVale = 0F;
- Map rsMap = (Map) rsList.get(i);
- %>
- <tr align="center" style="height: 25px;">
- <%
- for (int j = 0; j < colList.size(); j++){
- Map colMap = (Map) colList.get(j);
- if(colMap==null){
- continue;
- }
- String colName = (String)colMap.get("name");
-
- if("没有数据!".equals(colName)){
- %>
- <td>没有数据!</td>
- <%
- }else{
- if(i%2==1){
- if("车次".equals(colName)||"时间".equals(colName)||"配方模板".equals(colName)||"日系数比例".equals(colName)||"驾驶员".equals(colName)||"班组".equals(colName)){
- String colValueOld = (String)rsMap.get(colName);
- %>
- <td style="background-color:#E0E0E0;"><c:out value="<%=colValueOld %>"/></td>
- <%
- }else if("TMR".equals(colName)){
- if(tmrFlag){
- String colValueOld = (String)rsMap.get(colName);
- %>
- <td style="background-color:#E0E0E0;"><c:out value="<%=colValueOld %>"/></td>
- <%
- }
- }else{
- String colValueOld = (String)rsMap.get(colName);
- if(colValueOld!=null&&!colValueOld.isEmpty()){
- Float colValue = Float.valueOf(colValueOld);
- if(lsVale == 0){
- lsVale = colValue;
- }else{
- lsVale += colValue;
- }
- String colValueNew = fnum.format(lsVale);
- %>
- <td style="background-color:#E0E0E0;"><c:out value="<%=colValueNew %>"/></td>
- <%
- }else{
- %>
- <td style="background-color:#E0E0E0;"><c:out value=""/></td>
- <%
- }
- }
- }else{
- if("车次".equals(colName)||"时间".equals(colName)||"配方模板".equals(colName)||"日系数比例".equals(colName)||"驾驶员".equals(colName)||"班组".equals(colName)){
- String colValueOld = (String)rsMap.get(colName);
- %>
- <td><c:out value="<%=colValueOld %>"/></td>
- <%
- }else if("TMR".equals(colName)){
- if(tmrFlag){
- String colValueOld = (String)rsMap.get(colName);
- %>
- <td><c:out value="<%=colValueOld %>"/></td>
- <%
- }
- }else{
- String colValueOld = (String)rsMap.get(colName);
- if(colValueOld!=null&&!colValueOld.isEmpty()){
- Float colValue = Float.valueOf(colValueOld);
- if(lsVale == 0){
- lsVale = colValue;
- }else{
- lsVale += colValue;
- }
- String colValueNew = fnum.format(lsVale);
- %>
- <td><c:out value="<%=colValueNew %>"/></td>
- <%
- }else{
- %>
- <td><c:out value=""/></td>
- <%
- }
- }
- }
- }
- }
- %>
- </tr>
- <%
- }
- }else{
- for (int i = 0; i < rsList.size(); i++){
- Map rsMap = (Map) rsList.get(i);
- %>
- <tr align="center" style="height: 25px;">
- <%
- for (int j = 0; j < colList.size(); j++){
- Map colMap = (Map) colList.get(j);
- String colName = (String)colMap.get("name");
-
- if("没有数据!".equals(colName)){
- %>
- <td>没有数据!</td>
- <%
- }else{
- Object colValueOld = (Object)rsMap.get(colName);
- String colValueNew = "";
- if(!"TMR".equals(colName)){
- if("发料合计".equals(colName)){
- if(colValueOld != null){
- String sss = colValueOld.toString();
- Float fff = Float.valueOf(sss);
- colValueNew = fnum.format(fff);
- }
- if(i%2==1){
- %>
- <td style="background-color:#E0E0E0;"><c:out value="<%=colValueNew %>"/></td>
- <%
- }else{
- %>
- <td><c:out value="<%=colValueNew %>"/></td>
- <%
- }
- }else{
- if(i%2==1){
- %>
- <td style="background-color:#E0E0E0;"><c:out value="<%=colValueOld %>"/></td>
- <%
- }else{
- %>
- <td><c:out value="<%=colValueOld %>"/></td>
- <%
- }
- }
- }else{
- if(tmrFlag){
- if(i%2==1){
- %>
- <td style="background-color:#E0E0E0;"><c:out value="<%=colValueOld %>"/></td>
- <%
- }else{
- %>
- <td><c:out value="<%=colValueOld %>"/></td>
- <%
- }
- }
- }
- }
- }
- %>
- </tr>
- <%
- }
- }
- %>
- </tbody>
- </table>
- </div>
- <table cellspacing="1" cellpadding="0" border="0" style="width:99%;">
- <tr><td align="right"><input type="button" value="打印" class="sysub" onclick="PrinterJob()"/><input type="button" value="导出Excel" class="sysub" onclick="datePlanReport()"/></tr>
- </table>
- </div>
- </body>
- </html>
|