Untitled

mail@pastecode.io avatar
unknown
plain_text
a year ago
12 kB
2
Indexable
Never
<%@ Language=VBScript %>
<!--#include file="db_con.asp"-->
<!--#include file="menu_include.asp"-->
<script language="javascript">
//alert('<%=Request("produkt")%>');
</script>
<script type="text/javascript" src="xlsx.full.min.js"></script>

<style>

* {
  box-sizing: border-box;
}

.row {
  display: flex;
  margin-left:-5px;
  margin-right:-5px;
}

.column {
  flex: 30%;
  padding: 5px;
}

table {
  border-collapse: collapse;
  border-spacing: 0;
  width: 100%;
  border: 1px solid #ddd;
}

th{
background-color:#b7bbbd;
}

th, td {
  text-align: left;
  padding: 5px;
}

tr:nth-child(even) {
  background-color:#ffffff;
}
tr:nth-child(odd) {
  background-color:#e1e4e6;
}

.container {
padding: 1%;
  background-color:#f2f2f2;
  margin: 11%; 
  margin-top: 1%; 
}

.hejsan{
    width: 100%;
    display: flex;
    justify-content: space-between;
}

.containerPart{
    flex-grow: 1;
    flex-basis: 0;
}

h1{
padding: 0%;
margin-left: 10%; 
margin-top: 0%; 
font-family: Verdana; 
 
margin-bottom:0%;
}
h2{
margin-left: 10%;
font-family: Verdana; 
 
margin-top: 0%;
margin-bottom:0%;
}
h3{
font-family: Verdana; 

}
h4{
font-family: Verdana; 
margin:5px;
 
}
#laddaRapport{
  background-color: #73b54e;
  color: white;
  padding: 3px 10px;
  margin-top: 15px;
  border: none;
  border-radius: 1px;
  cursor: pointer;
  transition-duration: 0.4s;
  box-shadow: 0 12px 16px 0 rgba(0,0,0,0.24), 0 17px 50px 0 rgba(0,0,0,0.19);
}

#laddaRapport:hover {
  background-color: #8ac967;
}


#exp{
  background-color: #24749c;
  color: white;
  padding: 3px 10px;
  margin-top: 15px;
  border: none;
  border-radius: 1px;
  cursor: pointer;
  transition-duration: 0.4s;
  box-shadow: 0 12px 16px 0 rgba(0,0,0,0.24), 0 17px 50px 0 rgba(0,0,0,0.19);
}

#exp:hover {
  background-color:#328dba;
}

#uppWeb{
  background-color: #65788c;
  color: white;
  padding: 3px 10px;
  margin-top: 0px;
  border: none;
  border-radius: 1px;
  cursor: pointer;
  transition-duration: 0.4s;
  box-shadow: 0 12px 16px 0 rgba(0,0,0,0.24), 0 17px 50px 0 rgba(0,0,0,0.19);
}

#uppWeb:hover{
  background-color: #99a3ad;
}

select {
display:inherit;
}

</style>

 
<h2>Hämta Rapport</h2>
<div class="container">
<h3>Prep Rapport</h3>
<form type="post" action="PrepStatistics.asp">
<input type="hidden" name="meny" value="<%=Request("meny")%>">
<input type="hidden" name="undermeny" value="<%=Request("undermeny")%>">
<input type="hidden" name="namn" value="<%=Request("namn")%>">
</form>
<br>

<form type="post" action="PrepStatistics.asp">
<div class = "hejsan">
<div class = "containerPart">
<%

produkt = ""
IF Request("produkt") <> "" Then
produkt = Request("Valtprojekt") 
End IF

%>

<h4>Projekt:</h4>

<select id="1" name="Valtprojekt">
<option value="">Välj projekt:</option>
<%
 sqlProdukt=  "Select distinct (Produkt)  FROM [ProduktionPortal].[dbo].[PrepPagesStats] "
Set sqlRs = objConn.Execute(sqlProdukt)
If Not sqlRs.EoF Then
Do While Not sqlRS.EOF 
%>
<option value="<%=sqlRs("produkt")%>" <% If datum=sqlRs("produkt") then Response.Write "Selected" End IF %>><%=sqlRs("produkt")%></option>
<%
sqlRs.MoveNext
Loop
End IF
%>
</select>
<br> 
 
<%
Namn = ""
IF Request("Namn") <> "" Then
Namn = Request("ValdPerson") 
End IF

%>
<h4>Person:</h4>
<select id = 1 name="ValdPerson">
<option value="">Välj person:</option>
<%
sqlNamn=  "Select distinct (Namn)  FROM [ProduktionPortal].[dbo].[PrepPagesStats] order by namn "
Set sqlRs = objConn.Execute(sqlNamn)
If Not sqlRs.EoF Then
Do While Not sqlRS.EOF 
%>
<option value="<%=sqlRs("Namn")%>" <% If namn=sqlRs("Namn") then Response.Write "Selected" End IF %>><%=sqlRs("Namn")%></option>
<%
sqlRs.MoveNext
Loop
End IF
%>
</select>
<br> 
<%
datum = ""
IF Request("datum") <> "" Then
datum = Request("datum") 
End IF

%>
<%
datum2 = ""
IF Request("datum2") <> "" Then
datum2 = Request("datum2") 
End IF

%>
<h4>Startdatum:</h4>
<select id="1" name="datum">
<option value="">Select start date:   </option>
<%
sqlDatum1= "Select distinct (Datum)  FROM [ProduktionPortal].[dbo].[PrepPagesStats] order by datum"
Set sqlRs = objConn.Execute(sqlDatum1)
If Not sqlRs.EoF Then
Do While Not sqlRS.EOF 
%>
<option value="<%=sqlRs("Datum")%>" <% If datum=sqlRs("Datum") then Response.Write "Selected" End IF %>><%=sqlRs("Datum")%></option>
<%
sqlRs.MoveNext
Loop
End IF
%>
</select>
<br> 

<h4>Slutdatum:</h4>
<select id="2" name="datum2">
<option value="">Select end  date:   </option>
<%
sqlDatum2= "Select distinct (Datum)  FROM [ProduktionPortal].[dbo].[PrepPagesStats] order by datum"
Set sqlRs = objConn.Execute(sqlDatum2)
If Not sqlRs.EoF Then
Do While Not sqlRS.EOF 
%>
<option value="<%=sqlRs("Datum")%>" <% If datum2=sqlRs("Datum") then Response.Write "Selected" End IF %>><%=sqlRs("Datum")%></option>
<%
sqlRs.MoveNext
Loop
End IF
%>
</select>

<input type="hidden" name="meny" value="<%=Request("meny")%>">
<input type="hidden" name="undermeny" value="<%=Request("undermeny")%>">
<input type="hidden" name="namn" value="<%=Request("namn")%>">

<br>
<input id="laddaRapport" type="submit" name="Button" value="Ladda rapport">
<br>
<input onclick="ExportExcel('xlsx')" id="exp" type="submit" name="EXP" value="Export to excel">
<br>
<h5>INK - Preparerade sidor = Antal sidor i boxar (53koder) </h5>
<h5>SARA - Preparerade sidor = Antal sidor i boxar (53koder) </h5>
<h5>FOLKE - Preparerade sidor = Antal sidor i utskrivna buntmissiv </h5>
<br>
</div>
<div class= "containerPart" >
<h4>Sök BuntID</h4>
<textarea rows="1" name="SokBuntID" cols="20" style="font-family: Verdana; font-size: 10pt" placeholder="Ex 0004003536" ><%=Request("SokBuntID")%></textarea>
<br>
<h4>Sök Boxnummer (53/44 kod)</h4>
<textarea rows="1" name="SokOrgBatch" cols="20" style="font-family: Verdana; font-size: 10pt" placeholder="Ex 53000000123456" ><%=Request("SokOrgBatch")%></textarea>

<br>

<input id="laddaRapport" type="submit" name="SokBuntIDButton" value="Sök bunt">
<br>
</div>
</div>
<div class="row">
  <div class="column">
    <%if request("Button")<> "" or Request("SokBuntIDButton")<>"" then %>
	<table id = "exportable_table">
      <%
	  firstcol = ""
	  if request("SokBuntIDButton")<> "" then
	  firstcol = "Buntnummer"
	 
	  end if
	   
	  
	  %>
	  

<%

IF request("Button")<> "" then%>
	  <tr>    
        <th>Datum</th>
		<th>Namn</th>	
		<th>Timmar</th>	
		<th>Preparerade Sidor</th>
		<th>Ark</th>					
		<th>KPI (ARK per timme)</th>
		<th>Aktivitet</th>
      </tr>  	

<%

IF request("Button") <> "" and request("ValdPerson") = ""  and request("Valtprojekt") = ""  Then 
	sql1=" SELECT [Datum],[Namn],[Timmar],[PrepareradeSidor],[PrepareradeSidor] / 2 as 'Ark', ROUND( ([PrepareradeSidor] / 2  / CAST([Timmar] AS float)) ,0) as 'KPI',[Produkt]  FROM [ProduktionPortal].[dbo].[PrepPagesStats] "&_
	" where datum >= '"& Request ("datum") &"' and datum <= '"& Request ("datum2") &"' "
Set select_alla_som = ObjConn.Execute(sql1)
'response.write sql1


Else IF request("Button") <> "" and request("ValdPerson") <> ""  and request("Valtprojekt") <> ""  Then 
sql2=" SELECT [Datum],[Namn],[Timmar],[PrepareradeSidor],[PrepareradeSidor] / 2 as 'Ark',  ROUND(([PrepareradeSidor] / 2  / CAST([Timmar] AS float))  ,0) as 'KPI',[Produkt] FROM [ProduktionPortal].[dbo].[PrepPagesStats] "&_
	" where datum >= '"& Request ("datum") &"' and datum <= '"& Request ("datum2") &"'  and  Namn = '" & Request("ValdPerson") &"'  and Produkt =  '" & Request("Valtprojekt") &"' "
Set select_alla_som = ObjConn.Execute(sql2)
'response.write sql2


Else IF request("Button") <> "" and request("ValdPerson") = ""  and request("Valtprojekt") <> ""  Then 
sql3="SELECT [Datum],[Namn],[Timmar],[PrepareradeSidor],[PrepareradeSidor] / 2 as 'Ark',  ROUND(([PrepareradeSidor] / 2  / CAST([Timmar] AS float)) ,0) as 'KPI',[Produkt]  FROM [ProduktionPortal].[dbo].[PrepPagesStats] "&_
	" where datum >= '"& Request ("datum") &"' and datum <= '"& Request ("datum2") &"' and Produkt =  '" & Request("Valtprojekt") &"' "
Set select_alla_som = ObjConn.Execute(sql3)
'response.write sql3


Else IF request("Button") <> "" and request("ValdPerson") <> ""  and request("Valtprojekt") = ""  Then 
sql4=" SELECT [Datum],[Namn],[Timmar],[PrepareradeSidor],[PrepareradeSidor] / 2 as 'Ark', ROUND( ([PrepareradeSidor] / 2  / CAST([Timmar] AS float)) ,0) as 'KPI',[Produkt]  FROM [ProduktionPortal].[dbo].[PrepPagesStats] "&_
	" where datum >= '"& Request ("datum") &"' and datum <= '"& Request ("datum2") &"'  and  Namn = '" & Request("ValdPerson") &"' "
Set select_alla_som = ObjConn.Execute(sql4)
'response.write sql4



END IF
END IF
END IF
END IF
If NOt select_alla_som.EoF Then
Do While Not select_alla_som.EoF
%>	   
      <tr>
        <td><%=select_alla_som("Datum")%></td>
        <td><%=select_alla_som("Namn")%></td>   
		<td><%=select_alla_som("Timmar")%></td> 
		<td><%=select_alla_som("PrepareradeSidor")%></td>  
		<td><%=select_alla_som("Ark")%></td>  		
		<td><%=select_alla_som("KPI")%></td> 		
		<td><%=select_alla_som("Produkt")%></td>  		
      </tr>

<%
select_alla_som.MoveNext
Loop
End If
else if Request("SokBuntIDButton")<> "" then
%>

	  <tr>
        <th><%=firstcol%></th>
		<th>53/44 kod</th>
        <th>Namn</th>
		<th>Datum</th>	
		<th>Prepade sidor</th>
      </tr>  	
 
  <%
  if request("SokBuntID")<>"" and Request("SokOrgBatch") = "" then
  sqlGet = "SELECT bb.Batch as Batch, bb.OrgBatch as OrgBatch, (aa.FirstName+ ' '+ aa.lastname) as [Name], bb.ScannedDate as ScannedDate, bb.PreppedPages as Pages " &_
  " FROM [ProduktionPortal].[dbo].[PrepStatistics] bb, [ProduktionPortal].[dbo].[WebtimeAllaNamn] aa " &_
  " WHERE aa.id= bb.WebtimeAllaNamn_Id and bb.Batch = '"&request("SokBuntID")& "'"
  Set select_alla_som2 = ObjConn.Execute(sqlGet)
  'response.write select_alla_som2.EoF

  Else IF request("SokBuntID")="" and Request("SokOrgBatch") <> "" then
  sqlGet = "  SELECT bb.Batch as Batch, bb.OrgBatch as OrgBatch, (aa.FirstName+ ' '+ aa.lastname) as [Name], bb.ScannedDate as ScannedDate, bb.PreppedPages as Pages "&_ 
  "FROM [ProduktionPortal].[dbo].[PrepStatistics] bb, [ProduktionPortal].[dbo].[WebtimeAllaNamn] aa "&_
  "WHERE aa.id= bb.WebtimeAllaNamn_Id and bb.OrgBatch = '"&Request("SokOrgBatch")&"' "&_
  "ORDER BY Batch"
  Set select_alla_som2 = ObjConn.Execute(sqlGet)
  'response.write select_alla_som2
End IF 
END IF
End IF
END IF
END IF
  If NOt select_alla_som2.EoF Then
  Do While Not select_alla_som2.EoF
  
 %>
 
  
  
  <tr>
        <td><%=select_alla_som2("Batch")%></td>
        <td><%=select_alla_som2("OrgBatch")%></td>   
		<td><%=select_alla_som2("Name")%></td>   	
		<td><%=select_alla_som2("ScannedDate")%></td>  
		<td><%=select_alla_som2("Pages")%></td> 		
   </tr>
   
<%
select_alla_som2.MoveNext
Loop

END IF

sida="TidRapport"
user=Replace(user,"@","")
user=Replace(user,".","")
user=Replace(user," ","")
tid=Replace(now(),":","")
tid=Replace(tid," ","")
tid=Replace(tid,".","")
tid=Replace(tid,"-","")
tid=Replace(tid,"/","")
tid=Replace(tid,"AM","")
tid=Replace(tid,"PM","")
sidnamn=sida&user&tid
%>
</table>
<%


%>




   <script type="text/javascript">
      function ExportExcel(type, fn, dl) {
         var elt = document.getElementById('exportable_table');
         var wb = XLSX.utils.table_to_book(elt, {sheet:"Export1"});
         return dl ?
            XLSX.write(wb, {bookType:type, bookSST:true, type: 'base64'}) :
            XLSX.writeFile(wb, fn || ('<%=sidnamn%>.' + (type || 'xlsx')));
      }
   </script>
   
</div>
</div>
</div>
 

</form>


</form>


<%
ObjConn.Close
Set ObjConn = Nothing
%>