<% '######################################################################################### '#---------------------------------------------------------------------------------------- '######################################################################################### '# '# 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://www.bondhost.com.br '# '# 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 %> <% '##### Sub-departamentoS 'Sub Sub-departamentosASP() If Request("acaba") = "sim" Then Session("adm_descprod") = "" Session("adm_email") = "" End If Select Case strAcao Case "inserir" strTextoHtml = strTextoHtml & " Incluir novo Sub-departamento na loja
" strTextoHtml = strTextoHtml & "
" strTextoHtml = strTextoHtml & "" varimg = " " strTextoHtml = strTextoHtml & "" '-------------------------------------------------------------------------------------------- '##### DEPARTAMENTOS (LISTAGEM) '-------------------------------------------------------------------------------------------- strTextoHtml = strTextoHtml & ""&VBcrlf End if strTextoHtml = strTextoHtml & "" strTextoHtml = strTextoHtml & "" strTextoHtml = strTextoHtml & "" strTextoHtml = strTextoHtml & "" strTextoHtml = strTextoHtml & "
Data:" & dia & "/" & mez & "/" & Year(Date) & "
Departamento:" SQL = "SELECT * FROM sessoes ORDER BY nome ASC" Set Rs = conexao.Execute(SQL) If not Rs.eof then strTextoHtml = strTextoHtml & "
Sub-Departamento: "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 & "
Dica: Para criar apenas um Departamento e inserir Produtos nele (sem ter Sub-Departamentos), crie um Sub-Departamento chamado ""Todos"" e cadastre os produtos neste Sub-Departamento
Descrição (opcional):
Visível:
    


Voltar para página inicial

" Case "gravanovo" nome = Trim(Request("nomedep")) descri = Trim(Request("descri")) ver = Trim(Request("ver")) sessao = Request("sessao") If nome = "" Then If nome = "" Then erro1 = "sim" Else erro1 = nome erro3 = descri If ver = "" Then erro2 = "sim" Else erro2 = ver Response.Redirect "?link=sdep&acao=inserir&erro1=" & erro1 & "&erro2=" & erro2 & "&erro3=" & erro3 End If If descri = "" Then descri = "-" End If If CStr(Len(Day(Now))) = CStr("1") Then diazz = "0" & Day(Now) Else diazz = Day(Now) End If If CStr(Len(Month(Now))) = CStr("1") Then meszz = "0" & Month(Now) Else meszz = Month(Now) End If dataz = diazz & "/" & meszz & "/" & Year(Now) textosql = "INSERT INTO categoria (data, nome, descr,ver,idsessao) VALUES ('" & dataz & "', '" & nome & "', '" & descri & "','" & ver & "',"&sessao&");" Set gravadep = conexao.Execute(textosql) strTextoHtml = strTextoHtml & " Novo Sub-departamento incluído na loja com sucesso
" strTextoHtml = strTextoHtml & "
" strTextoHtml = strTextoHtml & "
Inserir um novo Sub-departamento na loja
" strTextoHtml = strTextoHtml & "
" strTextoHtml = strTextoHtml & "

" strTextoHtml = strTextoHtml & "" varimg = " " strTextoHtml = strTextoHtml & "" strTextoHtml = strTextoHtml & "" strTextoHtml = strTextoHtml & "
Data:" & dataz & "
Sub-departamento:" & nome & "
Descrição (opcional):" If descri = "" Then strTextoHtml = strTextoHtml & "-" Else strTextoHtml = strTextoHtml & descri End If strTextoHtml = strTextoHtml & "
Visível:" If CStr(ver) = "s" Then strTextoHtml = strTextoHtml & "Sim" Else strTextoHtml = strTextoHtml & "Não" End If strTextoHtml = strTextoHtml & "

Voltar para página inicial

" Case "editar" Set rs = conexao.Execute("SELECT * FROM SESSOES ORDER BY NOME") If rs.EOF Or rs.bof Then strTextoHtml = strTextoHtml & " Editar Sub-departamentos na loja
" strTextoHtml = strTextoHtml & "
" strTextoHtml = strTextoHtml & "Sub-departamentos(s) encontrado(s): 0
" strTextoHtml = strTextoHtml & "

" strTextoHtml = strTextoHtml & "


Nenhum Sub-departamento foi encontrado na base de dados da loja.



" strTextoHtml = strTextoHtml & "
" strTextoHtml = strTextoHtml & "" strTextoHtml = strTextoHtml & "

Voltar para Página Inicial
" Else Set rs2 = conexao.Execute("select count(nome) as total from categoria") totalreg = rs2("total") rs2.Close Set rs2 = Nothing numiz = Request("pagina") & "0" numiz = CInt(numiz) iz = iz + numiz strTextoHtml = strTextoHtml & " Editar Sub-departamentos na loja
" strTextoHtml = strTextoHtml & "
" strTextoHtml = strTextoHtml & "Sub-departamentos(s) encontrado(s): " & totalreg & "
" strTextoHtml = strTextoHtml & "
" While Not rs.EOF iz = iz + 1 If rs("ver") = "s" Then varestoq = "Sim" Else varestoq = "Não" End If strTextoHtml = strTextoHtml & "" rs.movenext Wend strTextoHtml = strTextoHtml & "" strTextoHtml = strTextoHtml & "
"&_ "" & iz & ") "& UCase(rs("nome"))& "
      Data: " & rs("data") & "    Visível: " & varestoq & ""&_ "" Set Rs3 = conexao.Execute("SELECT A.idcategoria, B.nome, A.data, A.nome as Nm, A.descr, A.ver FROM CATEGORIA AS A, sessoes as B WHERE B.id = A.idsessao AND B.id="& Rs("id") &" ORDER by A.nome") IF NOT RS3.EOF THEN izz = 1 While Not rs3.EOF If rs3("ver") = "s" Then varestoq = "Sim" Else varestoq = "Não" End If strTextoHtml = strTextoHtml & ""&_ ""&_ ""&_ ""&_ "" rs3.movenext izz = izz + 1 Wend END IF strTextoHtml = strTextoHtml & "
"&_ ""& iz&"."&izz & ") "& UCase(rs3("nm")) &"Data: " & rs3("data") & "    Visível: " & varestoq & ""&_ ""&_ "Ação: Ver | Editar "&_ "
 


Voltar para Página Inicial
" 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 Sub-departamentos na loja
" strTextoHtml = strTextoHtml & "
" strTextoHtml = strTextoHtml & "Sub-departamentos(s) encontrado(s): 0
" strTextoHtml = strTextoHtml & "

" strTextoHtml = strTextoHtml & "


Nenhum Sub-departamento foi encontrado na base de dados da loja.



" strTextoHtml = strTextoHtml & "
" strTextoHtml = strTextoHtml & "" strTextoHtml = strTextoHtml & "

Voltar para Página Inicial
" Else strTextoHtml = strTextoHtml & "" & vbNewLine Set rs2 = conexao.Execute("SELECT count(nome) AS total FROM categoria;") totalreg = rs2("total") rs2.Close Set rs2 = Nothing numiz = Request("pagina") & "0" numiz = CInt(numiz) iz = iz + numiz strTextoHtml = strTextoHtml & " Excluir Sub-departamentos na loja
" strTextoHtml = strTextoHtml & "
" strTextoHtml = strTextoHtml & "Sub-departamentos(s) encontrado(s): " & totalreg & "
" strTextoHtml = strTextoHtml & "
" If Request("status") = "sucesso" Then strTextoHtml = strTextoHtml & "
DEPARTAMENTO EXCLUIDO 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 & "
" rs.movenext Wend strTextoHtml = strTextoHtml & "" strTextoHtml = strTextoHtml & "
"&_ "" & iz & ") "& UCase(rs("nome"))& "
      Data: " & rs("data") & "    Visível: " & varestoq & ""&_ "" Set Rs3 = conexao.Execute("SELECT A.idcategoria, B.nome, A.data, A.nome as Nm, A.descr, A.ver FROM CATEGORIA AS A, sessoes as B WHERE B.id = A.idsessao AND B.id="& Rs("id") &" ORDER by A.nome") IF NOT RS3.EOF THEN izz = 1 While Not rs3.EOF If rs("ver") = "s" Then varestoq = "Sim" Else varestoq = "Não" End If strTextoHtml = strTextoHtml & ""&_ ""&_ ""&_ ""&_ ""&_ rs3.movenext izz = izz + 1 Wend END IF strTextoHtml = strTextoHtml & "
"&_ ""& iz&"."&izz & ") "& UCase(rs3("nm")) &"Data: " & rs3("data") & "    Visível: " & varestoq & ""&_ ""&_ "Ação: Ver | Excluir"&_ "


Voltar para Página Inicial
" rs.Close Set rs = Nothing End If Case "exclui" notz = Request.QueryString("dep") response.buffer= true '############################################### '## CORRIGE BUG DE EXCLUIR '############################################### IF request.querystring("Status") = "Redir" THEN Response.write "" END IF '############################################### '## CORRIGE BUG DE EXCLUIR '## EXCLUI DADOS DA TABELA ESTOQUE TB '############################################### conexao.Execute("delete from categoria where idcategoria=" & notz & ";") strTextoHtml = strTextoHtml & "APAGANDO SUB-CATEGORIA E SEUS DEVIDOS PRODUTOS....
por favor aguarde!
" conexao.Execute("delete from produtos where idsessao='" & notz & "';") '############################################### Response.write "" '############################################### conexao.Execute("delete from categoria where idcategoria=" & notz & ";") conexao.Execute("delete from produtos where idsessao='" & notz & "';") '############################################### '## CORRIGE BUG DE EXCLUIR '## EXCLUI DADOS DA TABELA ESTOQUE TB '############################################### response.flush response.clear Case "ver" Set setdep = conexao.Execute("SELECT A.*, B.NOME AS SESSAO FROM CATEGORIA AS A, SESSOES AS B WHERE A.IDSESSAO = B.ID AND idcategoria="&Request("dep") & ";") nome = setdep("nome") data = setdep("data") descri = setdep("descr") ver = setdep("ver") If Request("status") = "sucesso" Then strTextoHtml = strTextoHtml & " Sub-departamento editado com sucesso
" strTextoHtml = strTextoHtml & "
" strTextoHtml = strTextoHtml & "
Editar novamente este Sub-departamento | Ver novamente todos os Sub-departamentos
" Else strTextoHtml = strTextoHtml & " Ver Sub-departamento cadastrado na loja
" strTextoHtml = strTextoHtml & "
" If Request("modo") = "exclui" Then strTextoHtml = strTextoHtml & "" & vbNewLine strTextoHtml = strTextoHtml & "
Excluir este Sub-departamento | Ver todos os Sub-departamentos
" Else strTextoHtml = strTextoHtml & "
Editar este Sub-departamento | Ver todos os Sub-departamentos
" End If End If strTextoHtml = strTextoHtml & "
" strTextoHtml = strTextoHtml & "

" strTextoHtml = strTextoHtml & "" strTextoHtml = strTextoHtml & "" strTextoHtml = strTextoHtml & "" strTextoHtml = strTextoHtml & "" strTextoHtml = strTextoHtml & "" strTextoHtml = strTextoHtml & "
Data:" & dataz & "
Sub-departamento:" & nome & "
Descrição (opcional):" If setdep("descr") = "" Then strTextoHtml = strTextoHtml & "-" Else strTextoHtml = strTextoHtml & descri End If strTextoHtml = strTextoHtml & "
Visível:" If CStr(ver) = "s" Then strTextoHtml = strTextoHtml & "Sim" Else strTextoHtml = strTextoHtml & "Não" End If strTextoHtml = strTextoHtml & "

Voltar para página inicial

" Case "edita" Set depz = conexao.Execute("SELECT * FROM categoria WHERE idcategoria = " & Request("dep") & ";") strTextoHtml = strTextoHtml & " Editar Sub-departamento na loja
" strTextoHtml = strTextoHtml & "
" strTextoHtml = strTextoHtml & "" strTextoHtml = strTextoHtml & "" varimg = " " strTextoHtml = strTextoHtml & "" '-------------------------------------------------------------------------------------------- '##### DEPARTAMENTOS (LISTAGEM) '-------------------------------------------------------------------------------------------- strTextoHtml = strTextoHtml & ""&VBcrlf End if strTextoHtml = strTextoHtml & "" strTextoHtml = strTextoHtml & "" strTextoHtml = strTextoHtml & "" strTextoHtml = strTextoHtml & "" strTextoHtml = strTextoHtml & "
Data:" & depz("data") & "
Departamento:" SQL = "SELECT * FROM sessoes ORDER BY nome ASC" Set Rs = conexao.Execute(SQL) If not Rs.eof then strTextoHtml = strTextoHtml & "
Sub-departamento:" If Request.QueryString("erro1") = "sim" Then strTextoHtml = strTextoHtml & varimg End If strTextoHtml = strTextoHtml & "
Descrição (opcional):
Visível:
    


Voltar para página inicial

" Case "gravavelho" nome = Trim(Request("nomedep")) descri = Trim(Request("descri")) ver = Trim(Request("ver")) sessao = Request("sessao") If nome = "" Then If nome = "" Then erro1 = "sim" Else erro1 = nome erro3 = descri If ver = "" Then erro2 = "sim" Else erro2 = ver Response.Redirect "?link=sdep&acao=edita2&erro1=" & erro1 & "&erro2=" & erro2 & "&erro3=" & erro3 & "&dep=" & Request("dep") End If If descri = "" Then descri = "-" End If textosql = "UPDATE categoria SET nome = '" & nome & "', descr = '" & descri & "', ver = '" & ver & "', idsessao="&sessao&" WHERE idcategoria = " & Request("dep") & ";" Set gravadep = conexao.Execute(textosql) Response.Redirect "?link=sdep&acao=ver&status=sucesso&dep=" & Request("dep") Case "edita2" strTextoHtml = strTextoHtml & " Editar Sub-departamento na loja
" strTextoHtml = strTextoHtml & "
" strTextoHtml = strTextoHtml & "" strTextoHtml = strTextoHtml & "" varimg = " " strTextoHtml = strTextoHtml & "" strTextoHtml = strTextoHtml & "" strTextoHtml = strTextoHtml & "" strTextoHtml = strTextoHtml & "" strTextoHtml = strTextoHtml & "
Data:" & dia & "/" & mez & "/" & Year(Date) & "
Sub-departamento: "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 & "
Descrição (opcional):
Visível:
    


Voltar para página inicial

" End Select 'End Sub %>