%
'#########################################################################################
'#----------------------------------------------------------------------------------------
'#########################################################################################
'#
'# CÓDIGO: VirtuaStore Versão OPEN - Copyright 2001-2004 VirtuaStore
'# URL: http://comunidade.virtuastore.com.br
'# E-MAIL: comunidade@virtuastore.com.br
'# AUTORES: Otávio Dias(Desenvolvedor)
'#
'# Este programa é um software livre; você pode redistribuí-lo e/ou
'# modificá-lo sob os termos do GNU General Public License como
'# publicado pela Free Software Foundation.
'# É importante lembrar que qualquer alteração feita no programa
'# deve ser informada e enviada para os criadores, através de e-mail
'# ou da página de onde foi baixado o código.
'#
'# //-------------------------------------------------------------------------------------
'# // LEIA COM ATENÇÃO: O software VirtuaStore OPEN deve conter as frases
'# // "Powered by VirtuaStore OPEN" ou "Software derivado de VirtuaStore 1.2" e
'# // o link para o site http://comunidade.virtuastore.com.br no créditos da
'# // sua loja virtual para ser utilizado gratuitamente. Se o link e/ou uma das
'# // frases não estiver presentes ou visiveis este software deixará de ser
'# // considerado Open-source(gratuito) e o uso sem autorização terá
'# // penalidades judiciais de acordo com as leis de pirataria de software.
'# //--------------------------------------------------------------------------------------
'#
'# Este programa é distribuído com a esperança de que lhe seja útil,
'# porém SEM NENHUMA GARANTIA. Veja a GNU General Public License
'# abaixo (GNU Licença Pública Geral) para mais detalhes.
'#
'# Você deve receber a cópia da Licença GNU com este programa,
'# caso contrário escreva para
'# Free Software Foundation, Inc., 59 Temple Place, Suite 330,
'# Boston, MA 02111-1307 USA
'#
'# Para enviar suas dúvidas, sugestões e/ou contratar a VirtuaWorks
'# Internet Design entre em contato através do e-mail
'# contato@virtuaworks.com.br ou pelo endereço abaixo:
'# Rua Venâncio Aires, 1001 - Niterói - Canoas - RS - Brasil. Cep 92110-000.
'#
'# Para ajuda e suporte acesse um dos sites abaixo:
'# http://comunidade.virtuastore.com.br
'# http://br.groups.yahoo.com/group/virtuastore
'#
'# BOM PROVEITO!
'# Equipe VirtuaStore
'# []'s
'#
'#########################################################################################
'#----------------------------------------------------------------------------------------
'#########################################################################################
'INÍCIO DO CÓDIGO
'Este código está otimizado e roda tanto em Windows 2000/NT/XP/ME/98 quanto em servidores UNIX-LINUX com chilli!ASP
'Declaração das variaveis comuns
Dim razaoloja
Dim bancopag
Dim contapag
Dim pagpara
Dim varimg
Dim pesquisa
Dim strTextoHtml
Dim conexao
Dim dados
Dim nomeloja
Dim slogan
Dim emailloja
Dim urlloja
Dim tituloloja
Dim endereco11
Dim bairro11
Dim cidade11
Dim estado11
Dim pais11
Dim fone11
Dim razao
Dim Mes
Dim meszz
Dim diazz
Dim dataz
Dim i
Dim dia
Dim mez
Dim strLink
Dim strAcao
Dim contacompra
Dim contacli
Dim estadoz
Dim rs
Dim r2
Dim finalera
Dim pag
Dim pesss
Dim pagdxx
Dim pesqsa
Dim catege
Dim fDia
Dim mezito
Dim anito
Dim data
Dim Ano
Dim j
Dim ndiasmes
Dim anozinho
Dim palavra
Dim inicial
Dim final
Dim restinho
Dim totalreg
Dim pagina2
Dim pagina3
Dim rs2
Dim nSem
Dim aDiasMes
Dim strString
Dim UploadRequest
Dim objFSO
Dim ObjFile
Dim ObjStream
Dim arquivodat
Dim separador
Dim senhaok
Dim VersaoDb
Dim StringdeConexao
Const wexPassword = ""
Const wexRoot = "\"
Const appName = "Explorer VirtuaStore"
Const appVersion = "OPEN"
Const wexCharSet = "ISO-8859-1"
Const showHiddenItems = true
Const calculateTotalSize = false
Const calculateFolderSize = false
Const editableExtensions = "*htm*|*html*|*asp*|*asa*|*txt*|*inc*|*css*|*aspx*|*js*|*vbs*|*shtm*|*shtml*|*xml*|*xsl*|*log*"
Const viewableExtensions = "*gif*|*jpg*|*jpeg*|*png*|*bmp*|*jpe*"
Const iconFolderOpenBig = ""
Const iconFolderUp = " Diretório acima"
Const iconFolder = ""
Const iconFile = ""
Const iconFileEditable = ""
Const iconFileViewable = ""
Const iconRefresh = ""
Const iconCreateFile = ""
Const iconCreateFolder = ""
Const iconUpload = ""
Const iconLogout = ""
Const iconDelete = ""
Server.ScriptTimeout = 60
Call Iniciar
%>
<%
'-----------------------------------------------------------------------------------
'Inicia a sub pricipal
Sub Iniciar()
on error resume next
Session.LCID = 1046
Response.Buffer = True
'inicia conexao com o banco de dados
%>
<%
set conexao = Server.CreateObject("ADODB.Connection")
conexao.Open(StringdeConexao)
'Chama variaveis de Aplicação
nomeloja = Application("nomeloja")
razaoloja = Application("razaoloja")
emailloja = Application("emailloja")
slogan = Application("slogan")
urlloja = Application("urlloja")
endereco11 = Application("endereco11")
bairro11 = Application("bairro11")
cidade11 = Application("cidade11")
estado11 = Application("estado11")
pais11 = Application("pais11")
fone11 = Application("fone11")
bancopag = Application("bancopag")
contapag = Application("contapag")
pagpara = Application("pagpara")
If Session("admin") = "" Then
%><%
Response.Write strTextoHtml
Response.End
End If
'---------------------------------------------------------------------------
strTextoHtml = "" & vbNewLine & vbNewLine & "" & vbNewLine
strTextoHtml = strTextoHtml & ""
strTextoHtml = strTextoHtml & "
"
Mes = CStr(Trim(Month(Date)))
If Mes = "1" Or Mes = "01" Then
Mes = "janeiro"
End If
If Mes = "2" Or Mes = "02" Then
Mes = "fevereiro"
End If
If Mes = "3" Or Mes = "03" Then
Mes = "março"
End If
If Mes = "4" Or Mes = "04" Then
Mes = "abril"
End If
If Mes = "5" Or Mes = "05" Then
Mes = "maio"
End If
If Mes = "6" Or Mes = "06" Then
Mes = "junho"
End If
If Mes = "7" Or Mes = "07" Then
Mes = "julho"
End If
If Mes = "8" Or Mes = "08" Then
Mes = "agosto"
End If
If Mes = "9" Or Mes = "09" Then
Mes = "setembro"
End If
If Mes = "10" Then
Mes = "outubro"
End If
If Mes = "11" Then
Mes = "novembro"
End If
If Mes = "12" Then
Mes = "dezembro"
End If
strTextoHtml = strTextoHtml & "
"
strTextoHtml = strTextoHtml & ""
strTextoHtml = strTextoHtml & ""
If Len(Day(Date)) = 1 Then
dia = "0" & Day(Date)
Else
dia = Day(Date)
End If
If Len(Month(Date)) = 1 Then
mez = "0" & Month(Date)
Else
mez = Month(Date)
End If
strTextoHtml = strTextoHtml & "
"
strLink = Request("link")
strAcao = Request("acao")
Select Case strLink
Case "produtos"
%><%
Case "clientes"
%><%
Case "news"
%><%
Case "util"
%><%
Case "suporte"
%><%
Case "dep"
%><%
Case "sdep"
%><%
Case "compras"
%><%
Case "adm"
%><%
Case "logout"
Session.contents.remove("admin")
Session.contents.remove("ACESSO")
Session.contents.remove("ULTACESSO")
Session.Abandon()
Response.Redirect "administrador.asp"
Case Else
%><%
End Select
strTextoHtml = strTextoHtml & "
"
strTextoHtml = strTextoHtml & ""
conexao.Close
Set conexao = Nothing
Response.Write strTextoHtml
End Sub
'-----------------------------------------------------------------------------------
Function MesExtenso(Mes)
Select Case Mes
Case 1
MesExtenso = "Janeiro"
Case 2
MesExtenso = "Fevereiro"
Case 3
MesExtenso = "Março"
Case 4
MesExtenso = "Abril"
Case 5
MesExtenso = "Maio"
Case 6
MesExtenso = "Junho"
Case 7
MesExtenso = "Julho"
Case 8
MesExtenso = "Agosto"
Case 9
MesExtenso = "Setembro"
Case 10
MesExtenso = "Outubro"
Case 11
MesExtenso = "Novembro"
Case 12
MesExtenso = "Dezembro"
End Select
End Function
'-----------------------------------------------------------------------------------
Function DiaSemana(iDia)
Select Case iDia
Case 0
DiaSemana = "Dom"
Case 1
DiaSemana = "Seg"
Case 2
DiaSemana = "Ter"
Case 3
DiaSemana = "Qua"
Case 4
DiaSemana = "Qui"
Case 5
DiaSemana = "Sex"
Case 6
DiaSemana = "Sab"
End Select
End Function
'-----------------------------------------------------------------------------------
Function nSemanas(Mes, Ano)
DtInicial = DateSerial(Ano, Mes, fDia)
If Weekday(DtInicial) = 1 Then
nSem = 0
Else
nSem = 1
End If
ndiasmes = aDiasMes(Mes)
For i = 1 To ndiasmes
If Weekday(DtInicial) = 1 Then
nSem = nSem + 1
End If
DtInicial = DateAdd("d", 1, DtInicial)
Next
nSemanas = nSem
End Function
'-----------------------------------------------------------------------------------
Sub SetBissexto()
mezito = Request("mes")
anito = Request("ano")
If mezito = "" Then
mezito = Month(Now)
End If
If anito = "" Then
anito = Year(Now)
End If
data = "1/" & mezito & "/" & anito
If Trim(data) = "" Then
data = Date
Else
data = CDate(data)
End If
Ano = Year(data)
If (Ano Mod 4 = 0) Or (Ano Mod 100 = 0) And (Ano Mod 400 = 0) Then
aDiasMes(2) = 29
Else
aDiasMes(2) = 28
End If
End Sub
'-----------------------------------------------------------------------------------
Sub CalendarioASP()
strTextoHtml = strTextoHtml & "Selecione pela data as compras que você deseja visualizar:"
strTextoHtml = strTextoHtml & "
"
fDia = 1
ReDim aDiasMes(12)
aDiasMes(1) = 31
aDiasMes(2) = 28
aDiasMes(3) = 31
aDiasMes(4) = 30
aDiasMes(5) = 31
aDiasMes(6) = 30
aDiasMes(7) = 31
aDiasMes(8) = 31
aDiasMes(9) = 30
aDiasMes(10) = 31
aDiasMes(11) = 30
aDiasMes(12) = 31
Call SetBissexto
Call MontaCalendario
End Sub
'-----------------------------------------------------------------------------------
Sub MontaCalendario()
mezito = Request("mes")
anito = Request("ano")
If mezito = "" Then
mezito = Month(Now)
End If
If anito = "" Then
anito = Year(Now)
End If
data = "1/" & mezito & "/" & anito
If Trim(data) = "" Then
data = Date
Else
data = CDate(data)
End If
Ano = Year(data)
Mes = Month(data)
DiaInicial = Weekday(DateSerial(Ano, Mes, fDia))
DtInicial = DateSerial(Ano, Mes, fDia)
strTextoHtml = strTextoHtml & "
" & vbCrLf
strTextoHtml = strTextoHtml & "
"
For j = 0 To 6
If j = 0 Then
strTextoHtml = strTextoHtml & "
" & DiaSemana(j) & "
" & vbCrLf
Else
strTextoHtml = strTextoHtml & "
" & DiaSemana(j) & "
" & vbCrLf
End If
Next
strTextoHtml = strTextoHtml & "
"
For i = 0 To (nSemanas(Month(DtInicial), Year(DtInicial)) - 1)
strTextoHtml = strTextoHtml & "
" & vbCrLf
For j = 0 To 6
If (DiaInicial - 1) > j And i = 0 Then
If j = 0 And i = 0 Then
strTextoHtml = strTextoHtml & "
" & vbCrLf
Else
strTextoHtml = strTextoHtml & "
" & vbCrLf
End If
Else
If Month(DtInicial) > Mes Or Year(DtInicial) > Ano Then
strTextoHtml = strTextoHtml & "
" & vbCrLf
Else
If Weekday(DtInicial) = 1 Then
If CStr(Len(Day(DtInicial))) = CStr("1") Then
diazz = "0" & Day(DtInicial)
Else
diazz = Day(DtInicial)
End If
If CStr(Len(Month(DtInicial))) = CStr("1") Then
meszz = "0" & Month(DtInicial)
Else
meszz = Month(DtInicial)
End If
dataz = diazz & "/" & meszz & "/" & Year(DtInicial)
set rs = conexao.execute("select * from compras where datacompra='" & dataz & "' AND status <> 'Compra em Aberto';")
if rs.eof then
varvialvelcompra = "#000000"
else
varvialvelcompra = "red"
end if
rs.close
set rs = nothing
strTextoHtml = strTextoHtml & "
"
If CStr(Request("dia")) = CStr(Day(DtInicial)) Then
strTextoHtml = strTextoHtml & "" & Day(DtInicial) & ""
Else
strTextoHtml = strTextoHtml & Day(DtInicial)
End If
strTextoHtml = strTextoHtml & "
"
Else
If DtInicial = Date Then
If CStr(Len(Day(DtInicial))) = CStr("1") Then
diazz = "0" & Day(DtInicial)
Else
diazz = Day(DtInicial)
End If
If CStr(Len(Month(DtInicial))) = CStr("1") Then
meszz = "0" & Month(DtInicial)
Else
meszz = Month(DtInicial)
End If
dataz = diazz & "/" & meszz & "/" & Year(DtInicial)
set rs = conexao.execute("select * from compras where datacompra='" & dataz & "' AND status <> 'Compra em Aberto';")
if rs.eof then
varvialvelcompra = "#000000"
else
varvialvelcompra = "red"
end if
rs.close
set rs = nothing
strTextoHtml = strTextoHtml & "
"
If CStr(Request("dia")) = CStr(Day(DtInicial)) Then
strTextoHtml = strTextoHtml & "" & Day(DtInicial) & ""
Else
strTextoHtml = strTextoHtml & Day(DtInicial)
End If
strTextoHtml = strTextoHtml & "
"
Else
If CStr(Len(Day(DtInicial))) = CStr("1") Then
diazz = "0" & Day(DtInicial)
Else
diazz = Day(DtInicial)
End If
If CStr(Len(Month(DtInicial))) = CStr("1") Then
meszz = "0" & Month(DtInicial)
Else
meszz = Month(DtInicial)
End If
dataz = diazz & "/" & meszz & "/" & Year(DtInicial)
set rs = conexao.execute("select * from compras where datacompra='" & dataz & "' AND status <> 'Compra em Aberto';")
if rs.eof then
varvialvelcompra = "#000000"
else
varvialvelcompra = "red"
end if
rs.close
set rs = nothing
strTextoHtml = strTextoHtml & "
"
If CStr(Request("dia")) = CStr(Day(DtInicial)) Then
strTextoHtml = strTextoHtml & "" & Day(DtInicial) & ""
Else
strTextoHtml = strTextoHtml & Day(DtInicial)
End If
strTextoHtml = strTextoHtml & "
"
End If
End If
End If
DtInicial = DateAdd("d", DtInicial, 1)
End If
Next
strTextoHtml = strTextoHtml & "
" & vbCrLf
End Sub
'-----------------------------------------------------------------------------------
Sub DisplaySelectDate()
strTextoHtml = strTextoHtml & ""
Case "editar"
Set rs = conexao.Execute("SELECT * FROM sessoes ORDER by nome")
If rs.EOF Or rs.bof Then
strTextoHtml = strTextoHtml & " Editar departamentos na loja"
strTextoHtml = strTextoHtml & "
"
rs.Close
Set rs = Nothing
End If
Case "excluir"
Set rs = conexao.Execute("SELECT * FROM sessoes ORDER by nome")
If rs.EOF Or rs.bof Then
strTextoHtml = strTextoHtml & " Excluir departamentos na loja"
strTextoHtml = strTextoHtml & "
"
If Request("status") = "sucesso" Then
strTextoHtml = strTextoHtml & "
DEPARTAMENTO EXCLIUDO COM SUCESSO!
"
Else
End If
While Not rs.EOF
iz = iz + 1
If rs("ver") = "s" Then
varestoq = "Sim"
Else
varestoq = "Não"
End If
strTextoHtml = strTextoHtml & "" & vbNewLine
strTextoHtml = strTextoHtml & "
"
rs.Close
Set rs = Nothing
End If
Case "exclui"
notz = Request.QueryString("dep")
set rs_delete = abredb.execute("SELECT idcategoria from categoria where idsessao=" & notz & ";")
if not rs_delete.eof then
delete_idcategoria=rs_delete("idcategoria")
end if
rs_delete.close
set rs_delete = nothing
conexao.Execute("delete from sessoes where id=" & notz & ";")
conexao.Execute("delete from produtos where idsessao='" & delete_idcategoria & "';")
Response.Redirect "?link=dep&acao=excluir&status=sucesso"
Case "ver"
Set setdep = conexao.Execute("SELECT * FROM sessoes WHERE id = " & Request("dep") & ";")
nome = setdep("nome")
data = setdep("data")
descri = setdep("descr")
ver = setdep("ver")
If Request("status") = "sucesso" Then
strTextoHtml = strTextoHtml & " Departamento editado com sucesso"
strTextoHtml = strTextoHtml & ""
strTextoHtml = strTextoHtml & "
"
Case "edita"
Set depz = conexao.Execute("SELECT * FROM sessoes WHERE id = " & Request("dep") & ";")
strTextoHtml = strTextoHtml & " Editar departamento na loja"
strTextoHtml = strTextoHtml & "
"
Case "gravavelho"
nome = Trim(Request("nomedep"))
descri = Trim(Request("descri"))
ver = Trim(Request("ver"))
If nome = "" Then
If nome = "" Then erro1 = "sim" Else erro1 = nome
erro3 = descri
If ver = "" Then erro2 = "sim" Else erro2 = ver
Response.Redirect "?link=dep&acao=edita2&erro1=" & erro1 & "&erro2=" & erro2 & "&erro3=" & erro3 & "&dep=" & Request("dep")
End If
If descri = "" Then
descri = "-"
End If
textosql = "UPDATE sessoes SET nome = '" & nome & "', descr = '" & descri & "', ver = '" & ver & "' WHERE id = " & Request("dep") & ";"
Set gravadep = conexao.Execute(textosql)
Response.Redirect "?link=dep&acao=ver&status=sucesso&dep=" & Request("dep")
Case "edita2"
strTextoHtml = strTextoHtml & " Editar departamento na loja"
strTextoHtml = strTextoHtml & "
"sim" Then
strTextoHtml = strTextoHtml & Request.QueryString("erro1")
End If
strTextoHtml = strTextoHtml & """ size=50 style=font-size:11px;font-family:tahoma>"
If Request.QueryString("erro1") = "sim" Then
strTextoHtml = strTextoHtml & varimg
End If
strTextoHtml = strTextoHtml & "