<%    
if islem="sil" then
	firma_sil(fkodu)
	Response.Redirect("giris.asp")
end if
if Request.QueryString("islem")="ekle" then
   if Request.Form("skodu")="" then
   			hata "Yeni Firma Eklenmedi ... Sektör Seçmediniz",16
   elseif Request.Form("adi")="" then
   			hata "Yeni Firma Eklenmedi... Firma Adi Yazmadiniz.",16
   elseif Request.Form("yetkili")="" then
   			hata "Yeni Firma Eklenmedi... Firma Yetkilisini Yazmadiniz.",16
   else
   
   	   sorgum="select * from firma"
	   Rs.Open Sorgum, Baglantim, 1, 3
	   rs.addnew
	   rs("adi")=Request.Form("adi")
	   rs("yetkili")=Request.Form("yetkili")
	   rs("skodu")=Request.Form("skodu")
	   rs("ozel")=false
	   rs("onay")=false
	   
	rs.update
	        Set FSO = CreateObject("Scripting.FileSystemObject")
			veri=FSO.GetFolder(server.MapPath("/firmalar/"))&"\"&rs("fkodu")
			Response.Write veri
			FSO.CreateFolder veri
			veri1=veri&"\logo"
			FSO.CreateFolder veri1
			veri2=veri&"\urun"
			FSO.CreateFolder veri2
			veri3=veri&"\diger"
			FSO.CreateFolder veri3
	rs.close
	hata "Yeni Firma Eklendi",64
	Response.Redirect("giris.asp")	
end if
end if
 %>

  <table width="100%" border="0" cellspacing="3" cellpadding="3">
    <tr>
      <td><form id="form2" name="form2" method="post" action="?sirala=evet">
        <select name="olcu" id="olcu" style="width:140px; font-size:12px;font-weight:normal;color:#000000;text-decoration:none" >
          <option value="fkodu">Firma Koduna G&ouml;re</option>
          <option value="adi">Firma Ad&#305;na G&ouml;re</option>
          <option value="yetkili">Yetkiliye G&ouml;re</option>
        </select>
        &nbsp;&nbsp;
		 <select name="sekil" id="sekil" style="width:100px; font-size:12px;font-weight:normal;color:#000000;text-decoration:none" >
          <option value="DESC">Sondan Basa</option>
          <option value="ASC">Bastan Sonra</option>
        </select>
        &nbsp;&nbsp;
          <select name="ozel" id="ozel" style="width:120px; font-size:12px;font-weight:normal;color:#000000;text-decoration:none" >
            <option value="">Tüm Firmalar</option>
			<option value="ozel=true">&Ouml;zel Firmalar</option>
            <option value="vitrin=1">Vitrin Firmalar</option>
            <option value="ozel=false">Normal Firmalar</option>
          </select>&nbsp;&nbsp;
          <select name="onay" id="onay" style="width:120px; font-size:12px;font-weight:normal;color:#000000;text-decoration:none" >
            <option value="">Tüm Firmalar</option>
            <option value="TRUE">Onayli Firmalar</option>
            <option value="FALSE">Onaysiz Firmalar</option>
        </select>&nbsp;&nbsp;
          <select name="firma" id="firma" style="width:200px; font-size:12px;font-weight:normal;color:#000000;text-decoration:none" >
            <option value="">Tek Firma Se&ccedil;imi</option>
            <% sorgum="Select * from firma order by adi asc"
			   Rs.Open Sorgum, Baglantim, 1, 3  
				if rs.eof then
			   else
				do while not rs.eof
				if rs.eof then exit do
				%><option <%if fkodu=rs("fkodu") then%> selected="selected"<%end if%> value="<%=rs("fkodu")%>"><%=rs("adi")%></option
                ><%rs.movenext
				loop
				end if
				rs.close%>
            
            
            
        </select>&nbsp;&nbsp;
        <select name="ssayi" id="ssayi" style="width:50px; font-size:12px;font-weight:normal;color:#000000;text-decoration:none" >
          <option value="25">25</option>
          <option value="50">50</option>
          <option value="100">100</option>
          <option value="150">150</option>
          <option value="200">200</option>
        </select>
        &nbsp;&nbsp;

          <label>
          <input type="submit" name="listele" id="listele" value="Tekrar Listele" style="width:100px; font-size:12px;font-weight:normal;color:#000000;text-decoration:none" >
          </label>
      </form>      </td>
    </tr>

  </table>
<table width="100%" border="0" cellpadding="0" cellspacing="2">
    <tr>
      <td width="10%"><div align="center"><strong>Firma Kodu </strong></div></td>
      <td width="40%"><strong>Adi</strong></td>
      <td width="20%"><strong>Yetkili</strong></td>
      <td width="5%"><div align="center"><strong>Onay</strong></div></td>
      <td width="5%"><p align="center"><strong>Ozel</strong></p></td>
      <td width="5%"><div align="center"><strong>Vitrin</strong></div></td>
      <td width="15%"><div align="center"><strong>Islemler</strong></div></td>
    </tr>
	
	
<% 
sirala= Request.QueryString("sirala")


if sirala="evet" then
	fkodu=Request.Form("firma")
	olcu=Request.Form("olcu")
	sekil=Request.Form("sekil")
	ozel=Request.Form("ozel")
	onay=Request.Form("onay")
	ssayi=cint(Request.Form("ssayi"))
	if fkodu<>"" and ozel<>"" and onay<>"" then
	 sorgum="Select * from firma where onay="&onay&" and "&ozel&" and fkodu="&fkodu&" order by "&olcu&" "&sekil&""
	elseif fkodu<>"" and ozel<>"" and onay="" then
	 sorgum="Select * from firma where "&ozel&" and fkodu="&fkodu&" order by "&olcu&" "&sekil&""
	elseif fkodu<>"" and ozel="" and onay<>"" then 
	  sorgum="Select * from firma where onay="&onay&" and fkodu="&fkodu&" order by "&olcu&" "&sekil&""
	elseif fkodu<>"" and ozel="" and onay="" then 
	  sorgum="Select * from firma where fkodu="&fkodu&" order by "&olcu&" "&sekil&""	
  	elseif fkodu="" and ozel<>"" and onay<>"" then
	 sorgum="Select * from firma where "&ozel&" and onay="&onay&" order by "&olcu&" "&sekil&""
	elseif fkodu="" and ozel<>"" and onay="" then 
	  sorgum="Select * from firma where "&ozel&" order by "&olcu&" "&sekil&""
	elseif fkodu="" and ozel="" and onay<>"" then 
	  sorgum="Select * from firma where onay="&onay&" order by "&olcu&" "&sekil&""
	elseif fkodu="" and ozel="" and onay="" then 
	  sorgum="Select * from firma order by "&olcu&" "&sekil&""	    
	end if 
 else
   sorgum="Select * from firma order by fkodu desc"
end if

Rs.Open Sorgum, Baglantim, 1, 3  
if rs.eof then
else
%>

<% shf = Request.QueryString("shf")
   if shf="" then shf=1 end if
   if ssayi<>"" then
    rs.pagesize = ssayi
   else
    rs.pagesize=20
   end if 
   rs.absolutepage = shf
   sayfa = rs.pagecount	
   for i=1 to rs.pagesize
	  if rs.eof then exit for End If  %>
<form name="form1" method="post" action="uye_giris.asp?islem=login&amp;yetki=admin" target="_blank">
	<tr onmouseover="this.style.backgroundColor='#EEEEEE';" 
    onMouseOut="this.style.backgroundColor='#FFFFFF';" >
      <td><div align="center"><%= rs("fkodu") %></div></td>
      <td><%= rs("adi") %></td>
      <td><%= rs("yetkili") %></td>
      <td><div align="center">
          <% if rs("onay")=true then %>
	  						  <img src="images/true.gif" border="0"/>
					      <% else %>
							  <img src="images/false.gif" border="0"/>
<% end if %>	  
				        </div></td>
      <td><div align="center">
          <% if rs("ozel")=true then %>
	  						  <img src="images/true.gif" border="0"/>
					      <% else %>
							  <img src="images/false.gif" border="0"/>
<% end if %>	  
				        </div></td>
      <td><div align="center">
        <% if rs("vitrin")=1 then %>
          <img src="images/true.gif" border="0"/>
          <% else %>
          <img src="images/false.gif" border="0"/>
          <% end if %>
      </div></td>
      <td><div align="center"><a href="uye_giris.asp?fkodu=<%= rs("fkodu") %>&mail=<%= rs("mail") %>&skodu=<%= rs("skodu") %>" target="_blank"><img src="images/detay.jpg" border="0" /></a> <a href="?islem=sil&amp;fkodu=<%= rs("fkodu") %>" onclick="return confirm('Dikkat! Firmaya Ait Tüm Bilgiler Silinecektir.')"><img src="images/sil.jpg" border="0" /></a></div></td>
	</tr>
</form>	
<% rs.movenext
next %>
  
  

   <tr>
      <td colspan="7" class="mc"> 
	    <div align="center">
	      <% for y=1 to sayfa %>
	      
          <% if cint(shf)=cint(y) then %>
	      <strong><a href="?shf=<%= y %>"><%= y %></a></strong>
          <% else %>
	      <a href="?shf=<%= y %>"><%= y %></a>	
          <% end if %>
          <% next %>     
      </div></td>
   </tr>

<% end if %>
<form name="form1" method="post" action="?islem=ekle">
   <tr>
     <td colspan="7" height="25">Firma Ad&#305; 
	
	 	<input name="adi" type="text" class="footersmin" id="adi" size="20">
        Yetkili Ad&#305; Soyad&#305;
        <input name="yetkili" type="text" class="footersmin" id="yetkili" size="18">
        <% sektor_sec %>    
     <input name="Submit22" type="submit" class="mb" value="Yeni Firma Ekle">
     &nbsp;&nbsp;&nbsp;Toplam :
     <strong><%response.Write(rs.recordcount)%></strong>
Firma Kayitlidir. </td>
   </tr>
</form>
</table>

