%@ Language=VBScript %>
<%
'RECUPERO VALORI
Dim key, contaRec, contaFound, objRS
Set objRS = Server.CreateObject("ADODB.Recordset")
'**************************************************************
'RICERCA ALFABETICA
'**************************************************************
%>	
	
	
      
		
			| 
				 
				 
				
					
						| 
							<%if key<>"" then%>
								  
								RISULTATO DELLA RICERCA ALFABETICA 
							<%else%>
								
								 
								
								RICERCA ALFABETICA 
							<%end if%>
						 | 
					 
				 
				 
			 | 
		 
		
		
			
				
				
					
						
							| 
								<%if key<>"" then%>
									 
									ALPHABETICAL SEARCH RESULT 
								
								<%else%>
									
									
									ALPHABETICAL SUPPLIER SEARCH 
								<%end if%>
							 | 
						 
					 
				
				 
				
				
				<%
				key=Request.QueryString("key")
				IF key<>"" THEN
					'PARAMETRI DI PAGINAZIONE
					Dim iPageSize
					Dim iPageCount
					Dim iPageCurrent
					Dim strOrderBy
					Dim strSQL
					Dim iRecordsShown
					Dim I
					iPageSize = 5 'NUMERO RECORD PER PAGINA
					If Request.QueryString("page") = "" Then
						iPageCurrent = 1
					Else
						iPageCurrent = CInt(Request.QueryString("page"))
					End If
					If Request.QueryString("order") = "" Then
						strOrderBy = "priorita, ragsoc"
					Else
						strOrderBy = Request.QueryString("order")
					End If
					contaFound=0
											
					strSQL="SELECT * FROM tImb WHERE ucase(left(ragsoc,1))='"& key &"' ORDER BY priorita, ragsoc"
					objRS.PageSize = iPageSize
					objRS.CacheSize = iPageSize
					objRS.Open strSQL, objConn, adOpenStatic, adLockReadOnly, adCmdText
					reccount = objRS.recordcount
					iPageCount = objRS.PageCount
					If iPageCurrent > iPageCount Then iPageCurrent = iPageCount
					If iPageCurrent < 1 Then iPageCurrent = 1
					If iPageCount = 0 Then
						Response.Write "Non è stato trovato nessun record. No record found. |  "
					Else
						objRS.AbsolutePage = iPageCurrent
						iRecordsShown = 0
												
						Do While iRecordsShown < iPageSize And Not objRS.EOF
							if contaFound=0 then%>
								
								 
									| 
										Ricerca per la lettera: <%=key%>  -  Search for letter: <%=key%>		
									 | 
								 
								
								<%contaFound=contaFound+1
							end if%>
							
							<%
							iRecordsShown = iRecordsShown + 1
							objRS.movenext
						Loop
					End If
					objRS.Close
					set objRS = nothing
					%> <%
											
					If ipagecount = 1 Then
					%>
						
						
						 
					<%
					else
					%>
						
						
							
								
									| Pagina | 
									<%=iPageCurrent%> | 
									di | 
									<%=iPageCount%> | 
								 
								
									| Page | 
									of | 
								 
							 
						
						 
						<%
					end if
										
				ELSE%>
					
					
						
						 
							
								
								 Seleziona 
								una lettera dell'alfabeto 
									<%for i=65 to 90%>
										<%=chr(i)%>
									<%next%>
								 
								 Select a word from alphabet to search supplier
								
								 | 
							 
						 
					
					 
				
				<%END IF
					objConn.Close
					set objConn = nothing
				%>
				
				 
				   
				  
				  
				   | 
		 
	
	 
	 
	
 | 
 
	<%if key<>"" then%>
	 
		 
		 
		 
		
		 
	<%end if%>	
 |