%
set maconnexion = server.CreateObject("ADODB.Connection")
maconnexion.Open(Application("bd_ConnectionString"))
idPays = 61
session("idPays") = idPays
'-----------------------------------------
sqlPr = "SELECT Count(Article.idArticle) AS CompteDeidArticles, theVilles.nomEn, theVilles.idVille "
sqlPr = sqlPr&"FROM theVilles INNER JOIN (Quartiers INNER JOIN Article ON Quartiers.idQuartier = Article.idQuartier) ON theVilles.idVille = Quartiers.idVille "
sqlPr = sqlPr&"WHERE theVilles.isprincipaute=1 AND (Article.isTemporaire=0 AND Article.isActif=1 AND (isInFrance = 0 OR (isInFrance=1 AND numMandat Is Not Null AND numMandat<>'' AND EcheanceMandat > '"&date()&"' ))) "
sqlPr = sqlPr&"GROUP BY theVilles.nomEn, theVilles.idVille; "
set rsPr = maconnexion.Execute(sqlPr)
if rsPr.eof then
rsPrIdVille = 0
else
rsPrIdVille = rsPr("idVille")
end if
'------------ RECUP DES REGIONS Où IL Y A DES BIENS (ET AFFICHE LEURS NOMBRE) ------------------
sql = " SELECT theDepartements.idDepartement, theDepartements.nomEn as nom_dep, theDepartements.deno, theDepartements.isPhotoDept, Count(Article.idArticle) AS CompteDeidArticles, pays.nomEn, pays.idPays "
sql = sql&" FROM pays INNER JOIN ((theDepartements INNER JOIN theVilles ON theDepartements.idDepartement = theVilles.idDepartement) INNER JOIN (Quartiers INNER JOIN Article ON Quartiers.idQuartier = Article.idQuartier) ON theVilles.idVille = Quartiers.idVille) ON pays.idpays = theDepartements.idPays "
'sql = sql&" WHERE Article.isActif=1 AND Article.isGoodForMandat=1 AND Article.isTemporaire=0 "
sql = sql&" WHERE (Article.isTemporaire=0 AND Article.isActif=1 AND (isInFrance = 0 OR (isInFrance=1 AND numMandat Is Not Null AND numMandat<>'' AND EcheanceMandat > '"&date()&"' ))) "
sql = sql&" GROUP BY theDepartements.idDepartement, theDepartements.nomEn, theDepartements.deno, theDepartements.isPhotoDept, pays.nomEn, pays.idPays "
sql = sql&" HAVING (((pays.idPays) = "&idpays&" )) "
sql = sql&" ORDER BY theDepartements.nomEn ASC; "
set rs = maconnexion.Execute(sql)
'response.write sql
'-------------------------- FIN ------------------------------------------------------------------
sel = "SELECT * FROM theDepartements WHERE idPays="&idPays&" and (code=38 OR code<=10 OR (code >=80 and code<=90) OR code=20)ORDER By nomEn ASC "
set theRes = maconnexion.Execute(sel)
'--------------- Affichage liste avec nb de biens pour chaque département ---------------
nbDep = 20 '20 est le nb de département plus monaco
ReDim tab(nbDep,5)
if not rs.eof then
indice = 1
rs.movefirst
do while not rs.eof
'response.write " "&rs("idDepartement")&"-->"&rs("nom_dep")&"-->"&rs("CompteDeidArticles")&"-->"&rs("deno")
'response.write "- "& indice
tab(indice,1) = rs("idDepartement")
tab(indice,2) = rs("nom_dep")
tab(indice,3) = formatnumber(rs("CompteDeidArticles"),0)+0
tab(indice,4) = rs("deno")
tab(indice,5) = rs("isPhotoDept")
'response.write "-->"& rs("nom_dep") &"-->"& tab(indice,2)
indice = indice+1
rs.movenext
loop
nbElement = indice - 1
rs.movefirst
end if
'-------- Je rajoute les programmes neufs
nbDep = 1000
ReDim tabn(nbDep,4) 'nb de villes ds le département
sqlF = " SELECT Count(Articles_neufs.idArticle) AS CompteDeidArticle, theVilles.nomEn as nom_ville, theDepartements.idPays as DepidPays, articles_neufs.isTemporaire as articleisTemp, theDepartements.idDepartement, theDepartements.nomEn AS nom_dep, theVilles.idVille "
sqlF = sqlF&" FROM (theDepartements INNER JOIN theVilles ON theDepartements.idDepartement = theVilles.idDepartement) INNER JOIN Articles_neufs ON theVilles.idVille = Articles_neufs.idVille "
sqlF = sqlF&" GROUP BY theVilles.nomEn, theDepartements.idPays, theDepartements.nomEn, theVilles.idVille, theDepartements.idDepartement, articles_neufs.isTemporaire "
sqlF = sqlF&" HAVING DepidPays="&idPays&" and articleisTemp=0 "
sqlF = sqlF&" ORDER BY theDepartements.nomEn ASC; "
'response.write "-->"& ind &"--"& nbDep
'response.end
set rsF = maconnexion.Execute(sqlF)
if not rsF.eof then
ind = 1
rsF.movefirst
do while not rsF.eof
tabn(ind,1) = rsF("idDepartement")
tabn(ind,2) = rsF("nom_dep")
tabn(ind,3) = formatnumber(rsF("CompteDeidArticle"),0)+0
'response.write " "& ind &" : "& tabn(ind,1) &" "& tabn(ind,2) &" "& tabn(ind,3) &" "& tabn(ind,4)
ind = ind + 1
rsF.movenext
loop
nbElementn = ind - 1
rsF.close
set rsF = nothing
end if
'--------
function see(theName,nbElement)
res = 0
res_a = 0
res_b = 0
for i=1 to nbElement
if (theName = tab(i,2)) then
res_a = tab(i,3)
end if
next
for i=1 to nbElementn
if (theName = tabn(i,2)) then
res_b = res_b + tabn(i,3)
end if
next
res = formatnumber(res_a+res_b,0)+0
see = res
end function
'------------------------------------------------------
function testPresence(value)
For inc = 1 To nbElement 'Effectue une itération sur le tableau
'response.write tab(inc,2) &"-"& tab(inc,3) &"-"& tab(inc,4) &" "
if Instr(tab(inc,2),value) then
if (tab(inc,5) = 1) then
alinkd = "acheter_villes_france.asp"
else
alinkd = "liste_biens_departement.asp"
end if
aret = "href="""& alinkd &"?idPays="&idPays&"&idDepartement="&tab(inc,1)&""" onMouseOver=""javascript:on_('"&tab(inc,4)&"');"" onMouseOut=""javascript:off_();"""
Exit For
else
aret = "#"
end if
next
testPresence = aret
end function
nbDep = 22
%>
<%
if not theRes.eof then
dim k
dim borneSup
' borneSup est le nb d'enreg par colonne
if int(nbDep/2) = (nbDep/2) then
borneSup = int(nbDep/2)+1
else
borneSup = int(nbDep/2)+1
end if
theRes.movefirst
do while not theRes.eof
k=k+1
if (k<=borneSup) then
theNom = theRes("nomEn")
theNb = see(theNom,nbElement)
if left(theNom,1) = "S" then
response.write ""& rsPr("nomEn") &" ("& rsPr("CompteDeidArticles") &")
"
if (theRes("deno")<>"") then
aanomc = "onMouseOver=""javascript:on_('"&theres("deno")&"');"" onMouseOut=""javascript:off_();"""
else
aanomc = ""
end if
if theRes("isPhotoDept")=1 then
response.write ""& theNom &" ("& theNb &")
"
end if
end if
theRes.movenext
loop
theRes.movefirst
end if%>
<%
'response.write "aa"
'response.end
%>
<%
if not theRes.eof then
k=0
theRes.movefirst
do while not theRes.eof
k=k+1
if (k>borneSup) then
theNom = theRes("nomEn")
theNb = see(theNom,nbElement)
if left(theNom,1) = "S" then
response.write ""& rsPr("nomEn") &" ("& rsPr("CompteDeidArticles") &")
" & vbCrLf
if (theRes("deno")<>"") then
aanomc = "onMouseOver=""javascript:on_('"&theres("deno")&"');"" onMouseOut=""javascript:off_();"""
else
aanomc = ""
end if
if theRes("isPhotoDept")=1 then
response.write ""& theNom &" ("& theNb &")