Devo fare apparire il prezzo in base alla settimana. E se il campo settimana è vuoto colorare la cella di un colore.
Ho costruito questo codice ma il prezzo compare uguale in tutte le celle e queste non cambiano colore.
----------------------------------------
<%
rif = Request.Querystring ("rif")
mese=Request.Form("mese")
prezzo=Request.Form("prezzo")
settimana=Request.Form("settimana")
Set Conn= Server.CreateObject("Adodb.connection")
Conn.Open "provider=microsoft.jet.oledb.4.0; data source="& Server.MapPath("/offerte/offerte.mdb")
function getMese(ByVal mese)
if not isNumeric(mese) then exit function
getMese=arrMesi(mese-1)
end function
function giorniMese(mese,anno)
dim giorni
Select Case cint(mese)
Case 1,3,5,7,8,10,12:
giorni = 31
Case 4,6,9,11:
giorni = 30
Case 2:
if ((cint(anno) mod 4 = 0 and _
cint(anno) mod 100 <> 0) _
or ( cint(anno) mod 400 = 0) ) then
giorni = 29
else
giorni = 28
end if
End Select
giorniMese = giorni
end function
arrMesi=Array("Gennaio","Febbraio","Marzo","Aprile ","Maggio","Giugno","Luglio","Agosto","Settembre", "Ottobre","Novembre","Dicembre")
%>
<table width='100%' cellspacing='2' cellpadding='2'class='tblcalendar'>
<%
dim settimana
dim bgcolor
settimana = 0
bgcolor = "#FFD964"
while NOT RS.EOF
if y mod 2 <> 0 then
settimana = "#CCCCCC"
Else
bgcolor = "#FFD964"
End if
%><%
settimana = settimana + 1
Rs.movenext
wend
%>
<%
sql = "SELECT * FROM disponibilita "
set rs = conn.execute(sql)
'y = rs("settimana")
'mese = rs("mese")
prezzo = rs("prezzo")
settimana = rs("settimana")
mese=month(date())
for i=mese to 12
Response.write "<tr>"
Response.write " <td width='15%'>" & getMese(i) & "</td>"
primo=datePart("W","01/" & i & "/" & year(date()))
if primo=7 then
start=1
else
start=1+(7-primo)
end if
nGiorni=giorniMese(i,year(date()))
for y=start to nGiorni
Response.write "<td collspan='2' bgcolor=" & bgcolor & " width='10%'>" & y & ". </td>"
Response.write "<td collspan='2' bgcolor=" & bgcolor & " width='10%'>" & prezzo& "</td>"
y=y+6
next
Response.Write "</tr>"
next
%>
<%
Rs.close
set Rs = nothing%>

Rispondi quotando