<%
'*****************************************************************************
'* Step 1: Acquisisco i parametri *
'*****************************************************************************
nnAnni = request("nnAnni")
aaaaStart = request("aaaaUltimaData")
if nnAnni = "" then
response.redirect "/Forno/Impostazioni/mainImpostazione.asp"
else
nnAnni = cint(nnAnni)
nnAnni = nnAnni * 1
end if
aaaaStart = aaaaStart
aaaaEnd = aaaaStart + nnAnni
'*****************************************************************************
'* Step 2: Costruisco la stringa di accodamento *
'*****************************************************************************
strSqlADD_inizio = "INSERT INTO tblRegistro (idGiorno, giornoFestivo) VALUES ("
strSqlADD_fine = ")"
for j = aaaaStart to (aaaaEnd - 1)
for i = 1 to 12
if ((i = 1) or (i = 3) or (i = 5) or (i = 7) or (i = 8)) then
for k = 1 to 9
strData = j & "0" & i & "0" & k
data = clng(strData)
strDataVera = "0" & k &"/0" & i & "/" & j
dataVera = cdate(strdataVera)
ctrl = weekday(dataVera)
if ctrl = 1 then
giornoFestivo = -1
else
giornoFestivo = 0
end if
strSqlADD = strSqlADD_inizio & data & ", " & giornoFestivo & strSqlADD_fine
connDB.Execute(strSqlADD)
'response.write strSqlADD & "
"
Next
for k = 10 to 31
strJ = cstr(j)
strI = cstr(i)
strK = cstr(k)
strData = strJ & "0" & strI & strK
strDataVera = strK &"/0" & strI & "/" & strJ
dataVera = cdate(strdataVera)
ctrl = weekday(dataVera)
if ctrl = 1 then
giornoFestivo = -1
else
giornoFestivo = 0
end if
data = clng(strData)
strSqlADD = strSqlADD_inizio & data & ", " & giornoFestivo & strSqlADD_fine
connDB.Execute(strSqlADD)
'response.write strSqlADD & "
"
Next
else
if ((i = 10) or (i = 12)) then
for k = 1 to 9
strJ = cstr(j)
strI = cstr(i)
strK = cstr(k)
strData = strJ & strI & "0" & strK
strDataVera = "0" & strK &"/" & strI & "/" & strJ
dataVera = cdate(strdataVera)
ctrl = weekday(dataVera)
if ctrl = 1 then
giornoFestivo = -1
else
giornoFestivo = 0
end if
data = clng(strData)
strSqlADD = strSqlADD_inizio & data & ", " & giornoFestivo & strSqlADD_fine
connDB.Execute(strSqlADD)
'response.write strSqlADD & "
"
Next
for k = 10 to 31
strJ = cstr(j)
strI = cstr(i)
strK = cstr(k)
strData = strJ & strI & strK
strDataVera = strK &"/" & strI & "/" & strJ
dataVera = cdate(strdataVera)
ctrl = weekday(dataVera)
if ctrl = 1 then
giornoFestivo = -1
else
giornoFestivo = 0
end if
data = clng(strData)
strSqlADD = strSqlADD_inizio & data & ", " & giornoFestivo & strSqlADD_fine
connDB.Execute(strSqlADD)
'response.write strSqlADD & "
"
Next
else
if ((i = 4) or (i = 6) or (i = 9)) then
for k = 1 to 9
strJ = cstr(j)
strI = cstr(i)
strK = cstr(k)
strData = strJ & "0" & strI & "0" & strK
strDataVera = "0" & strK &"/0" & strI & "/" & strJ
dataVera = cdate(strdataVera)
ctrl = weekday(dataVera)
if ctrl = 1 then
giornoFestivo = -1
else
giornoFestivo = 0
end if
data = clng(strData)
strSqlADD = strSqlADD_inizio & data & ", " & giornoFestivo & strSqlADD_fine
connDB.Execute(strSqlADD)
'response.write strSqlADD & "
"
Next
for k = 10 to 30
strJ = cstr(j)
strI = cstr(i)
strK = cstr(k)
strData = strJ & "0" & strI & strK
strDataVera = strK &"/0" & strI & "/" & strJ
dataVera = cdate(strdataVera)
ctrl = weekday(dataVera)
if ctrl = 1 then
giornoFestivo = -1
else
giornoFestivo = 0
end if
data = clng(strData)
strSqlADD = strSqlADD_inizio & data & ", " & giornoFestivo & strSqlADD_fine
connDB.Execute(strSqlADD)
'response.write strSqlADD & "
"
Next
else
if i = 11 then
for k = 1 to 9
strJ = cstr(j)
strI = cstr(i)
strK = cstr(k)
strData = strJ & strI & "0" & strK
strDataVera = "0" & strK &"/" & strI & "/" & strJ
dataVera = cdate(strdataVera)
ctrl = weekday(dataVera)
if ctrl = 1 then
giornoFestivo = -1
else
giornoFestivo = 0
end if
data = clng(strData)
strSqlADD = strSqlADD_inizio & data & ", " & giornoFestivo & strSqlADD_fine
connDB.Execute(strSqlADD)
'response.write strSqlADD & "
"
Next
for k = 10 to 30
strJ = cstr(j)
strI = cstr(i)
strK = cstr(k)
strData = strJ & strI & strK
strDataVera = strK &"/" & strI & "/" & strJ
dataVera = cdate(strdataVera)
ctrl = weekday(dataVera)
if ctrl = 1 then
giornoFestivo = -1
else
giornoFestivo = 0
end if
data = clng(strData)
strSqlADD = strSqlADD_inizio & data & ", " & giornoFestivo & strSqlADD_fine
connDB.Execute(strSqlADD)
'response.write strSqlADD & "
"
Next
else
if i = 2 then
if j/4 = cint(j/4) then
for k = 1 to 9
strJ = cstr(j)
strI = cstr(i)
strK = cstr(k)
strData = strJ & "0" & strI & "0" & strK
strDataVera = "0" & strK &"/0" & strI & "/" & strJ
dataVera = cdate(strdataVera)
ctrl = weekday(dataVera)
if ctrl = 1 then
giornoFestivo = -1
else
giornoFestivo = 0
end if
data = clng(strData)
strSqlADD = strSqlADD_inizio & data & ", " & giornoFestivo & strSqlADD_fine
connDB.Execute(strSqlADD)
'response.write strSqlADD & "
"
Next
for k = 10 to 29
strJ = cstr(j)
strI = cstr(i)
strK = cstr(k)
strData = strJ & "0" & strI & strK
strDataVera = strK &"/0" & strI & "/" & strJ
dataVera = cdate(strdataVera)
ctrl = weekday(dataVera)
if ctrl = 1 then
giornoFestivo = -1
else
giornoFestivo = 0
end if
data = clng(strData)
strSqlADD = strSqlADD_inizio & data & ", " & giornoFestivo & strSqlADD_fine
connDB.Execute(strSqlADD)
'response.write strSqlADD & "
"
Next
else
for k = 1 to 9
strJ = cstr(j)
strI = cstr(i)
strK = cstr(k)
strData = strJ & "0" & strI & "0" & strK
strDataVera = "0" & strK &"/0" & strI & "/" & strJ
dataVera = cdate(strdataVera)
ctrl = weekday(dataVera)
if ctrl = 1 then
giornoFestivo = -1
else
giornoFestivo = 0
end if
data = clng(strData)
strSqlADD = strSqlADD_inizio & data & ", " & giornoFestivo & strSqlADD_fine
connDB.Execute(strSqlADD)
'response.write strSqlADD & "
"
Next
for k = 10 to 28
strJ = cstr(j)
strI = cstr(i)
strK = cstr(k)
strData = strJ & "0" & strI & strK
strDataVera = strK &"/0" & strI & "/" & strJ
dataVera = cdate(strdataVera)
ctrl = weekday(dataVera)
if ctrl = 1 then
giornoFestivo = -1
else
giornoFestivo = 0
end if
data = clng(strData)
strSqlADD = strSqlADD_inizio & data & ", " & giornoFestivo & strSqlADD_fine
connDB.Execute(strSqlADD)
'response.write strSqlADD & "
"
Next
end if
end if
end if
end if
end if
end if
Next
Next
'*****************************************************************************
'* Step 2: Setto i giorni festivi sicuri *
'*****************************************************************************
for j = aaaaStart to (aaaaEnd - 1)
strSqlUPDATE = "UPDATE tblRegistro SET giornoFestivo = -1 WHERE (((tblRegistro.idGiorno)="& j &"0101)) OR (((tblRegistro.idGiorno)="& j &"0106)) OR (((tblRegistro.idGiorno)="& j &"0425)) OR (((tblRegistro.idGiorno)="& j &"0501)) OR (((tblRegistro.idGiorno)="& j &"0602)) OR (((tblRegistro.idGiorno)="& j &"0815)) OR (((tblRegistro.idGiorno)="& j &"0908)) OR (((tblRegistro.idGiorno)="& j &"1101)) OR (((tblRegistro.idGiorno)="& j &"1208)) OR (((tblRegistro.idGiorno)="& j &"1225)) OR (((tblRegistro.idGiorno)="& j &"1226));"
connDB.Execute(strSqlUPDATE)
Next
response.redirect "/Forno/Impostazioni/mainImpostazione.asp"
%>
<%
connDB.Close
Set connDB = nothing
%>