<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%> <% on error resume next Session.Timeout = 420 Server.ScriptTimeout = 5000 busca=request.QueryString("busca") doc=request.QueryString("doc") origen=request.QueryString("origen") Date_ini=Request.Form("Date_ini") Date_end=Request.Form("Date_end") lvende=Request.Form("cvende") criterio22=Request.Form("criterio22") if criterio22="" then xcriterio22=" Todos " end if if Date_ini="" or Date_ini=null then Date_ini=date()-1 Date_end=date()-1 end if Date_end2=cdate(Date_end)+1 Date_end3=cdate(Date_end)+1 turno1="065000" turno2="152000" turno3="232000" '''''''''''calcula strday = Right("00" & Day(Date_ini), 2) strmonth = Right("00" & Month(Date_ini), 2) stryear = Right("0000" & Year(Date_ini), 4) strday2 = Right("00" & Day(Date_end2), 2) strmonth2 = Right("00" & Month(Date_end2), 2) stryear2 = Right("0000" & Year(Date_end2), 4) fechainicial = CStr(stryear & strmonth & strday) fechafinal2 = CStr(stryear2 & strmonth2 & strday2) response.write(fechainicial&" ") response.write("FF "&fechafinal2) strday2 = Right("00" & Day(Date_end), 2) strmonth2 = Right("00" & Month(Date_end), 2) stryear2 = Right("00" & Year(Date_end), 4) fechafinal = CStr(stryear2 + strmonth2 + strday2) set strConexao = CreateObject("ADODB.Connection") ' seteas la conexion 'strConexao.Open("DRIVER=Firebird/InterBase� driver; UID=SYSDBA;PWD=MOLRA; DBNAME=\\desktop-6psmf8k\firebird_db\CARDBOARD20.fdb") strConexao.Open("DRIVER=Firebird/InterBase(r) driver;UID=SYSDBA;PWD=molra; DBNAME=192.168.0.201:C:\PAUL\data\CARDBOARD20.FDB") 'response.write("Error "&Err.number&" .") 'HandleError Err.number if Err.number<>0 then response.write(" Error "&Err.number) else 'abrir la base, fijate que esta en el directorio que la tienes ... Set Corr2 = Server.CreateObject("ADODB.Recordset") ' seteas el recordset Set Corr2 = strConexao.Execute("SELECT * FROM PCSIN where (LEFT(STIME,8) between '" & fechainicial & "' and '" & fechafinal2 & "') and left(STAT,1)='T' order by STIME,etime") ' lo ejecutas 'Set Corr2 = strConexao.Execute("SELECT * FROM PCSIN where STAT<>'T' order by STIME,etime") ' lo ejecutas 'JOBJO,JOBYMD, JOBSEQ xday = Right("00" & Day(Date), 2) xmonth = Right("00" & Month(Date), 2) xyear = Right("00" & Year(Date), 4) xdate=xyear&xmonth&xday Dim Rsfore0 Dim Sqlfore0 set Rsfore0=dbsql3.execute("SELECT * FROM forecast WHERE id=49") 'Set Rsfore = CurrentDb.OpenRecordset(Sqlfore) xday2 = Right("00" & Rsfore0("month"), 2) xmonth2 = Right("00" & Rsfore0("forecast"), 2) xyear2 = Right("00" & Rsfore0("year"), 4) xdate2=xyear2&xmonth2&xday2 If xdate>xdate2 Then response.write (ErrorNo1) else %> Report Corrugator II datepicker demo
       
Period:   To Excel
         
<% header %>
<% if Not corr2.EOF and Not corr2.BOF then TOTML=0 TOTM2=0 TOTTARGET=0 TOTPROD=0 TOTML=0 '(corr2("JANG")*corr2("PQTY")/1000) TOTM2=0 TOTTARGET2=0 TOTPROD2=0 TOTML2=0 TOTM22=0 TOTbad2=0 TOTjtime2=0 TOTdtime2=0 TOTITEMS=0 'corr2.movefirst 'lturno1=Corr2("JOBJO") lturno1="1" lturno2="1" Do While Not corr2.EOF 'response.write(mid(Corr2("STIME"),1,8)&" - ") if left(Corr2("stat"),1)="T" then 'response.write(" ESTATUS ") end if Echeck=left(Corr2("Extracheck"),1) 'if Corr2("CUST")<>" " THEN lestado=0 'if Echeck="A" THEN shora = mid(Corr2("STIME"),10,2)&mid(Corr2("STIME"),13,2)&mid(Corr2("STIME"),16,2) Ehora = mid(Corr2("ETIME"),10,2)&mid(Corr2("ETIME"),13,2)&mid(Corr2("ETIME"),16,2) fecha1= mid(Corr2("STIME"),1,8) if (mid(Corr2("STIME"),1,8)=fechainicial and (shora<"065000" and Ehora<"065001")) then 'CORR2.MoveNext lestado=0 'response.write(" if 1 ") end if Sec1=0 Sec2=0 if (shora<"065000") and (Ehora>"064959") then shora1=int(mid(Corr2("STIME"),10,2))*3600 shora2=int(mid(Corr2("STIME"),13,2))*60 shora3=int(mid(Corr2("STIME"),16,2)) hstart=shora1+shora2+shora3 ehora1=int(mid(Corr2("ETIME"),10,2))*3600 ehora2=int(mid(Corr2("ETIME"),13,2))*60 ehora3=int(mid(Corr2("ETIME"),16,2)) hend=ehora1+ehora2+ehora3 Shift1=24600 Sec1=int(Shift1-hstart) Sec2=int(hend-Shift1) 'response.write(" if 2 ") end if if (mid(Corr2("STIME"),1,8)=fechainicial) then 'response.write(" if 3 ") if Sec1>Sec2 then 'CORR2.MoveNext lestado=0 'response.write(" if 4 ") else if Sec1"064959" then 'response.write(" if 6 ") lestado=1 Sec12=0 Sec13=0 Sec22=0 Sec23=0 if shora<"152000" and Ehora>"151959" then shora1=int(mid(Corr2("STIME"),10,2))*3600 shora2=int(mid(Corr2("STIME"),13,2))*60 shora3=int(mid(Corr2("STIME"),16,2)) hstart2=shora1+shora2+shora3 ehora1=int(mid(Corr2("ETIME"),10,2))*3600 ehora2=int(mid(Corr2("ETIME"),13,2))*60 ehora3=int(mid(Corr2("ETIME"),16,2)) hend2=ehora1+ehora2+ehora3 Shift2=55200 Sec12=int(Shift2-hstart2) Sec22=int(hend2-Shift2) end if if shora<"232000" and Ehora>"231959" then shora1=int(mid(Corr2("STIME"),10,2))*3600 shora2=int(mid(Corr2("STIME"),13,2))*60 shora3=int(mid(Corr2("STIME"),16,2)) hstart3=shora1+shora2+shora3 ehora1=int(mid(Corr2("ETIME"),10,2))*3600 ehora2=int(mid(Corr2("ETIME"),13,2))*60 ehora3=int(mid(Corr2("ETIME"),16,2)) hend3=ehora1+ehora2+ehora3 Shift3=84000 Sec13=int(Shift3-hstart3) Sec23=int(hend3-Shift3) end if if shora>"064959" and shora<"151959" then xTurno="1" end if if (shora>"151959" and shora<"232000") or Sec22>Sec12 then xTurno="2" end if if Sec22>Sec12 then xTurno="2" end if if shora>"231959" or shora<"064959" or Sec23>Sec13 then xTurno="3" end if end if if (mid(Corr2("STIME"),1,8)=fechafinal2) then if (shora>"064959") then 'CORR2.MoveNext lestado=0 else if Sec1fechainicial and mid(Corr2("STIME"),1,8)"151959" then shora1=int(mid(Corr2("STIME"),10,2))*3600 shora2=int(mid(Corr2("STIME"),13,2))*60 shora3=int(mid(Corr2("STIME"),16,2)) hstart2=shora1+shora2+shora3 ehora1=int(mid(Corr2("ETIME"),10,2))*3600 ehora2=int(mid(Corr2("ETIME"),13,2))*60 ehora3=int(mid(Corr2("ETIME"),16,2)) hend2=ehora1+ehora2+ehora3 Shift2=55200 Sec12=int(Shift2-hstart2) Sec22=int(hend2-Shift2) end if if shora<"232000" and Ehora>"231959" then shora1=int(mid(Corr2("STIME"),10,2))*3600 shora2=int(mid(Corr2("STIME"),13,2))*60 shora3=int(mid(Corr2("STIME"),16,2)) hstart3=shora1+shora2+shora3 ehora1=int(mid(Corr2("ETIME"),10,2))*3600 ehora2=int(mid(Corr2("ETIME"),13,2))*60 ehora3=int(mid(Corr2("ETIME"),16,2)) hend3=ehora1+ehora2+ehora3 Shift3=84000 Sec13=int(Shift3-hstart3) Sec23=int(hend3-Shift3) end if if shora>"064959" and shora<"151959" then xTurno="1" end if if (shora>"151959" and shora<"232000") or Sec22>Sec12 then xTurno="2" end if if Sec22>Sec12 then xTurno="2" end if if shora>"231959" or shora<"064959" or Sec23>Sec13 then xTurno="3" end if end if if lestado=0 then CORR2.MoveNext end if if lestado=1 then lm=int(cdbl(Corr2("Jang"))*(cdbl(Corr2("PQTY"))-cdbl(Corr2("PREPQTY"))))/1000 lm2=int((cdbl(Corr2("Jang"))*cdbl(Corr2("WPOK")))*(cdbl(Corr2("PQTY"))-cdbl(Corr2("PREPQTY"))))/1000000 totalTiempo = cdbl(corr2("dtime")) hores = int((totalTiempo/3600)) aux = int(totalTiempo-(3600*hores)) minuts = int(aux/60) segons = totalTiempo-hores*3600-minuts*60 Downtime = hores&":"&right("00"&minuts,2)&":"&right("00"&segons,2) Tiempo2 = cdbl(corr2("jtime")) hores2 = int((Tiempo2/3600)) aux2 = int(Tiempo2-(3600*hores2)) minuts2 = int(aux2/60) segons2 = Tiempo2-hores2*3600-minuts2*60 Worktime = hores2&":"&right("00"&minuts2,2)&":"&right("00"&segons2,2) lstime=mid(Corr2("stime"),10,8) letime=mid(Corr2("etime"),10,8) %> <% TOTTARGET=TOTTARGET+cdbl(corr2("QTY")) TOTPROD=TOTPROD+cdbl(corr2("PQTY"))-cdbl(Corr2("PREPQTY")) TOTML=TOTML+lm '(corr2("JANG")*corr2("PQTY")/1000) TOTM2=TOTM2+lm2 '(corr2("JANG")*corr2("WPOK")*corr2("PQTY")/1000000) TOTbad=TOTbad+cdbl(corr2("eQTY")) TOTjtime=TOTjtime+cdbl(corr2("jtime")) TOTdtime=TOTdtime+cdbl(corr2("dtime")) TOTTARGET2=TOTTARGET2+cdbl(corr2("QTY")) TOTPROD2=TOTPROD2+cdbl(corr2("PQTY"))-cdbl(Corr2("PREPQTY")) TOTML2=TOTML2+lm '(corr2("JANG")*corr2("PQTY")/1000) TOTM22=TOTM22+lm2 '(corr2("JANG")*corr2("WPOK")*corr2("PQTY")/1000000) TOTbad2=TOTbad2+cdbl(corr2("eQTY")) TOTjtime2=TOTjtime2+cdbl(corr2("jtime")) TOTdtime2=TOTdtime2+cdbl(corr2("dtime")) TOTITEMS=TOTITEMS+1 CORR2.MoveNext if not Corr2.eof then shora2=mid(Corr2("STIME"),10,2)&mid(Corr2("STIME"),13,2)&mid(Corr2("STIME"),16,2) Ehora2=mid(Corr2("ETIME"),10,2)&mid(Corr2("ETIME"),13,2)&mid(Corr2("ETIME"),16,2) if shora2>"064959" and shora2<"152000" then lturno2="1" end if if shora2>"151959" and shora2<"232000" then lturno2="2" 'response.write(" t2 "&) end if if shora2>"231959" or shora2<"065000" then lturno2="3" end if 'response.write(" t "&shora2) if shora2<"065000" and Ehora2>"064959" then shora1x=int(mid(Corr2("STIME"),10,2))*3600 shora2x=int(mid(Corr2("STIME"),13,2))*60 shora3x=int(mid(Corr2("STIME"),16,2)) hstartx=shora1x+shora2x+shora3x ehora1x=int(mid(Corr2("ETIME"),10,2))*3600 ehora2x=int(mid(Corr2("ETIME"),13,2))*60 ehora3x=int(mid(Corr2("ETIME"),16,2)) hendx=ehora1x+ehora2x+ehora3x Shift1=24600 Sec1x=int(Shift1-hstartx) Sec2x=int(hendx-Shift1) if Sec2x>Sec1x then lturno2="1" end if end if if (shora2<"152000" and Ehora2>"151959") or (shora2<"232000" and Ehora2>"231959") then shn1=int(mid(Corr2("STIME"),10,2))*3600 shn2=int(mid(Corr2("STIME"),13,2))*60 shn3=int(mid(Corr2("STIME"),16,2)) hstn=shn1+shn2+shn3 ehn1=int(mid(Corr2("ETIME"),10,2))*3600 ehn2=int(mid(Corr2("ETIME"),13,2))*60 ehn3=int(mid(Corr2("ETIME"),16,2)) hend2n=ehn1+ehn2+ehn3 if (shora2<"152000" and Ehora2>"151959") then Shift2=55200 Sec1n=int(Shift2-hstn) Sec2n=int(hend2n-Shift2) if Sec1n>Sec2n then lturno2="1" else lturno2="2" end if end if if (shora2<"232000" and Ehora2>"231959") then Shift3=84000 Sec1n3=int(Shift3-hstn) Sec2n3=int(hend2n-Shift3) if Sec1n3>Sec2n3 then lturno2="2" else lturno2="3" end if end if end if end if if Corr2.eof or lturno1<>lturno2 then if TOTML2>0 and (TOTjtime2+TOTdtime2)>0 then lspeedtot2=int(TOTML2/((TOTjtime2+TOTdtime2)/60)) else lspeedtot2=0 end if if TOTTARGET2>0 then hores5 = int((TOTjtime2/3600)) aux5 = int(TOTjtime2-(3600*hores5)) minuts5 = int(aux5/60) segons5 = TOTjtime2-hores5*3600-minuts5*60 Worktime5 = hores5&":"&right("00"&minuts5,2)&":"&right("00"&segons5,2) hores6 = int((TOTdtime2/3600)) aux6 = int(TOTdtime2-(3600*hores6)) minuts6 = int(aux6/60) segons6 = TOTdtime2-hores6*3600-minuts6*60 delaytime5 = hores6&":"&right("00"&minuts6,2)&":"&right("00"&segons6,2) if lturno1="1" then lshift="1st" end if if lturno1="2" then lshift="2nd" end if if lturno1="3" then lshift="3rd" end if %> <% lturno1=lturno2 TOTTARGET2=0 TOTPROD2=0 TOTML2=0 TOTM22=0 TOTbad2=0 TOTjtime2=0 TOTdtime2=0 end if end if end if 'ELSE ' CORR2.MoveNext 'END IF LOOP 'END IF corr2.close end if '''''''''''''''''''''''' if totitems>0 then lspeedtot=int(TOTML/((TOTjtime+TOTdtime)/60)) Tiempod = TOTdtime hores3 = int((Tiempod/3600)) aux3 = int(Tiempod-(3600*hores3)) minuts3 = int(aux3/60) segons3 = Tiempod-hores3*3600-minuts3*60 totdt2 = hores3&":"&right("00"&minuts3,2)&":"&right("00"&segons3,2) Tiempow = totjtime hores4 = int((Tiempow/3600)) aux4 = int(Tiempow-(3600*hores4)) minuts4 = int(aux4/60) segons4 = Tiempow-hores4*3600-minuts4*60 totwt2 = hores4&":"&right("00"&minuts4,2)&":"&right("00"&segons4,2) %> <% end if %>
CORRUGATOR II
<%response.write(Err.number)%>
JOB DATE SHIFT TIME ORDER NO CUSTOMER ITEM FLUTE COMBINATION LENGTH WIDTH WO QTY PROD QTY M M2 BAD QTY WORK HOUR STOP HOUR AVG SPEED
<%=mid(Corr2("STIME"),1,8)%> <%=xTurno%> <%=lstime&"-"&lEtime%> <%=Corr2("sujuno")%> <%=Corr2("cust")%> <%=Corr2("Boxname")%> <%=Corr2("GOL")%> <%=Corr2("BEHAP")%> <%=Corr2("Jang")%> <%=Corr2("WPOK")%> <%=Corr2("QTY")%> <%=cdbl(Corr2("PQTY"))-cdbl(Corr2("PREPQTY"))%> <%=formatnumber(lm,0)%> <%=formatnumber(lm2,0)%> <%=Corr2("EQTY")%> <%=worktime%> <%=downtime%>
      <%=lshift%> Shift TOTAL             <%=formatnumber(TOTTARGET2,0)%> <%=formatnumber(TOTPROD2,0)%>
<%=formatnumber(TOTML2,0)%> M
<%=formatnumber(TOTM22,0)%> M2
<%=formatnumber(TOTbad2,0)%>
<%=worktime5%>
<%=delaytime5%>
<%=formatnumber(lspeedtot2,0)%>
      GRAND TOTAL     <%=formatnumber(TOTITEMS,0)%>      
<%=formatnumber(TOTTARGET,0)%>
<%=formatnumber(TOTPROD,0)%>
<%=formatnumber(TOTML,0)%> M
<%=formatnumber(TOTM2,0)%> M2
<%=formatnumber(TOTbad,0)%>
<%=totwt2%>
<%=totdt2%>
<%=formatnumber(lspeedtot,0)%>
<% 'Corr2.Close strConexao.Close Set strConexao=Nothing End If Rsfore0.Close Set Rsfore0 = Nothing dbsql3.Close Set dbsql3 = Nothing ''''''''''''' end if %>