%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<%
Session.LCID = 1033
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")
naction=Request.Form("naction")
if criterio22="" then
xcriterio22=" Todos "
end if
if Date_ini="" or Date_ini=null then
Date_ini=date()-1
Date_end=date()
end if
Date_end2=cdate(Date_end)
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), 2)
strday2 = Right("00" & Day(Date_end2), 2)
strmonth2 = Right("00" & Month(Date_end2), 2)
stryear2 = Right("0000" & Year(Date_end2), 2)
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
'abrir la base, fijate que esta en el directorio que la tienes ...
Set Corr2 = Server.CreateObject("ADODB.Recordset") ' seteas el recordset
if naction="Pend" then
'lq="SELECT * FROM PCSIN where (jobymd between '" & fechainicial & "' and '" & fechafinal2 & "') and left(STAT,1)<>'T' order by serialval,sujuno"
Set Corr2 = dbsql5.Execute("SELECT * FROM PCSIN where left(STAT,1)<>'T' order by serialval,sujuno")
else
'lq="SELECT * FROM PCSIN where (jobymd between '" & fechainicial & "' and '" & fechafinal2 & "') and left(STAT,1)='T' order by jobymd, jobjo,stime,etime"
Set Corr2 = dbsql5.Execute("SELECT * FROM PCSIN where (jobymd between '" & fechainicial & "' and '" & fechafinal2 & "') and left(STAT,1)='T' order by jobymd, jobjo,stime,etime")
end if
'response.write(lq)
if Err.number<>0 then
response.write(" Error "&Err.number)
else
' lo ejecutas
'xq="SELECT * FROM PCSIN where (jobymd between '" & fechainicial & "' and '" & fechafinal2 & "') and left(STAT,1)='T' order by jobymd, jobjo,sujuno"
'response.write(xq)
'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 IIdatepicker demo
<%
header
%>
CORRUGATOR II
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
<%
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)&" - ")
xturnox=Corr2("jobjo")
lfecha1=corr2("jobymd")
if corr2("jobymd")<"220228" then
if xturnox="A" or xturnox="C" or xturnox="" then
xTurno="1"
end if
if xturnox="B" or xturnox="D" then
xTurno="2"
end if
else
if xturnox="A" or xturnox="" or xturnox="1" then
xTurno="1"
end if
if xturnox="B" or xturnox="2" then
xTurno="2"
end if
if xturnox="C" or xturnox="3" then
xTurno="3"
end if
end if
'if lestado=1 then
lm=int(cdbl(Corr2("Jang"))*(cdbl(Corr2("PQTY"))-cdbl(Corr2("PREPQTY"))))/cdbl(Corr2("Pokno"))/1000
lm2=int((cdbl(Corr2("Jang"))*cdbl(Corr2("WPOK")))*(cdbl(Corr2("PQTY"))-cdbl(Corr2("PREPQTY"))))/cdbl(Corr2("Pokno"))/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)
if lstime="" or isnull(lstime) then
lstime=llasttime
end if
%>
<%=Corr2("jobymd")%>
<%=xTurnox%>
<%=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%>
<%
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
llasttime=letime
CORR2.MoveNext
if not Corr2.eof then
if corr2("jobjo")="A" or corr2("jobjo")="C" then
lturno2="1"
end if
if corr2("jobjo")="B" or corr2("jobjo")="D" then
lturno2="2"
end if
if corr2("jobymd")<"220228" then
if xturnox="A" or xturnox="C" or xturnox="" or corr2("jobjo")="A" or corr2("jobjo")="C" then
lturno2="1"
end if
if xturnox="B" or xturnox="D" or corr2("jobjo")="B" or corr2("jobjo")="D" then
lturno2="2"
end if
else
if xturnox="A" or xturnox="" or xturnox="1" or corr2("jobjo")="1" then
lturno2="1"
end if
if xturnox="B" or xturnox="2" or corr2("jobjo")="2" then
lturno2="2"
end if
if xturnox="C" or xturnox="3" or corr2("jobjo")="3" then
lturno2="3"
end if
end if
lfecha2=corr2("jobymd")
end if
if Corr2.eof or lturno1<>lturno2 or lfecha1<>lfecha2 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=xturnox
end if
if lturno1="2" then
lshift=xturnox
end if
if lturno1="3" then
lshift=xturnox
end if
%>
<%=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)%>
<%
lturno1=lturno2
TOTTARGET2=0
TOTPROD2=0
TOTML2=0
TOTM22=0
TOTbad2=0
TOTjtime2=0
TOTdtime2=0
lfecha1=lfecha2
end if
end if
' 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)
%>
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)%>
<% end if
%>
<%
'Corr2.Close
strConexao.Close
Set strConexao=Nothing
End If
Rsfore0.Close
Set Rsfore0 = Nothing
dbsql3.Close
Set dbsql3 = Nothing
'''''''''''''
end if
%>