%
'-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#
' Loja Exemplo Locaweb
' Versão: 6.4
' Data: 12/09/06
' Arquivo: ADM_relatorio_resp.asp
' Versão do arquivo: 0.0
' Data da ultima atualização: 30/05/07
'
'-----------------------------------------------------------------------------
' Licença Código Livre: http://comercio.Locaweb.com.br/gpl/gpl.txt
'-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#
' Esta página só pode ser acessada se o visitante já se autenticou
checa_senha()
'Verifica se o perfil de usuário permite acesso a esta página
Call checa_perfil_admin(""&ADMRelat&"")
%>
<%
Call abre_conexao(conexao)
'abre o banco de dados
codigo_pedido = Request("codigo_pedido")
'monta a query inicial da consulta
query_consulta = "SELECT codigo_pedido, data_pedido_inicio, data_pedido, user_ID, sessionID, ip_cliente, razaosocial_cobranca, cnpj_cobranca, nome_cobranca, cpf_cobranca, rg_cobranca, data_nascimento_cobranca, logradouro_cobranca, numero_cobranca, complemento_cobranca, bairro_cobranca, cidade_cobranca, estado_cobranca, cep_cobranca, pais_cobranca, ddd_cobranca, telefone_cobranca, razaosocial_entrega, cnpj_entrega, nome_entrega, cpf_entrega, rg_entrega, data_nascimento_entrega, logradouro_entrega, numero_entrega, complemento_entrega, bairro_entrega, cidade_entrega, estado_entrega, cep_entrega, pais_entrega, ddd_entrega, telefone_entrega, email_entrega, subtotal, taxa_envio, total, tipo_frete, codigo_frete, peso_total, forma_pagamento, cartao_encrypt, tipo_cartao, instrucoes, atendido, pago, falha, cancelado, devolvido, fraude, num_remessa, boleto_emitido, boleto_tipo, sigla_idioma, sigla_moeda, valor_moeda FROM Pedidos WHERE "
'monta a query inicial da soma do valor total da consulta
query_somaconsulta = "SELECT SUM(Pedidos.total) AS VLRTOTAL FROM Pedidos WHERE "
If request("cbData") <> "" Then
If Application("TipoBanco") = "access" Then
query_resposta = query_resposta & " format(" & request("cbData") & ",'yyyymmdd') BETWEEN format('" & request("edtIni") & "','yyyymmdd') AND format('" & request("edtFim") & "','yyyymmdd') AND "
Else
query_resposta = query_resposta & request("cbData") & " BETWEEN '" & PreparaDataBD(request("edtIni")) & " 00:00:00:000' AND '" & PreparaDataBD(request("edtFim")) & " 23:59:59:999' AND "
End If
End if
If request("cbNome") <> "" Then
query_resposta = query_resposta & request("cbNome") & " Like '%" & request("edtNome") & "%' AND "
End If
If request("cbNrPedido") <> "" Then
query_resposta = query_resposta & request("cbNrPedido") & " = " & request("edtNrPedido") & " AND "
End If
If request("cbTotal") <> "" Then
query_resposta = query_resposta & request("cbTotal") & " " & request("comboTotal") & " " & request("edtTotal") & " AND "
End If
If request("cbCidade") <> "" Then
query_resposta = query_resposta & request("cbCidade") & " = '" & request("comboCidades") & " ' AND "
End If
If request("cbEstado") <> "" Then
query_resposta = query_resposta & request("cbEstado") & " = '" & request("comboEstados") & "' AND "
End If
If request("cbAtendido") <> "" Then
If Application("DBAccess") = "1" Then
query_resposta = query_resposta & request("cbAtendido") & " = " & request("comboAtendido") & " AND "
Else
query_resposta = query_resposta & request("cbAtendido") & " = " & Replace(Replace(request("comboAtendido"),"true","1"),"false","0") & " AND "
End If
End If
If request("cbPago") <> "" Then
If Application("DBAccess") = "1" Then
query_resposta = query_resposta & request("cbPago") & " = " & request("comboPago") & " AND "
Else
query_resposta = query_resposta & request("cbPago") & " = " & Replace(Replace(request("comboPago"),"true","1"),"false","0") & " AND "
End If
End If
'monta a query final da consulta
query_consulta = query_consulta & query_resposta
If right(query_resposta,4) = "AND " Then
query_consulta = query_consulta & " Pedidos.data_pedido Is not Null ORDER BY Pedidos.codigo_pedido desc "
Else
query_consulta = query_consulta & " AND Pedidos.data_pedido Is not Null ORDER BY Pedidos.codigo_pedido desc "
End If
'monta a query final da soma do valor total da consulta
query_somaconsulta = query_somaconsulta & query_resposta
If right(query_resposta,4) = "AND " Then
query_somaconsulta = query_somaconsulta & " Pedidos.data_pedido Is not Null "
Else
query_somaconsulta = query_somaconsulta & " AND Pedidos.data_pedido Is not Null "
End If
'Verifica o valor total da consulta
Set RS_Pedidos_total = Server.CreateObject("ADODB.Recordset")
RS_Pedidos_total.CursorLocation = 3
RS_Pedidos_total.CursorType = 0
RS_Pedidos_total.LockType = 1
RS_Pedidos_Total.CursorLocation = 3
RS_Pedidos_Total.Open query_somaconsulta, Conexao
IF NOT RS_Pedidos_total.Eof THEN
VLRTOTAL = RS_PEDIDOS_TOTAL("VLRTOTAL")
If VLRTOTAL > 0 Then
VLRTOTAL = RS_PEDIDOS_TOTAL("VLRTOTAL")
Else
VLRTOTAL = "0"
End if
END IF
RS_Pedidos_Total.Close
Set RS_Pedidos_Total = Nothing
'Monta uma string adicional para paginação relatório de vendas.
If Request("cbData") <> "" Then
StrAdicional = StrAdicional & "&cbData=" & Request("cbData")
End If
If Request("edtIni") <> "" Then
StrAdicional = StrAdicional & "&edtIni=" & Request("edtIni")
End If
If Request("edtFim") <> "" Then
StrAdicional = StrAdicional & "&edtFim=" & Request("edtFim")
End If
If Request("cbNome") <> "" Then
StrAdicional = StrAdicional & "&cbNome=" & Request("cbNome")
End If
If Request("edtNome") <> "" Then
StrAdicional = StrAdicional & "&edtNome=" & Request("edtNome")
End If
If Request("cbNrPedido") <> "" Then
StrAdicional = StrAdicional & "&cbNrPedido=" & Request("cbNrPedido")
End If
If Request("edtNrPedido") <> "" Then
StrAdicional = StrAdicional & "&edtNrPedido=" & Request("edtNrPedido")
End If
If Request("cbTotal") <> "" Then
StrAdicional = StrAdicional & "&cbTotal=" & Request("cbTotal")
End If
If Request("comboTotal") <> "" Then
StrAdicional = StrAdicional & "&comboTotal=" & Server.URLEncode(Request("comboTotal"))
End If
If Request("edtTotal") <> "" Then
StrAdicional = StrAdicional & "&edtTotal=" & Request("edtTotal")
End If
If Request("cbCidade") <> "" Then
StrAdicional = StrAdicional & "&cbCidade=" & Request("cbCidade")
End If
If Request("comboCidades") <> "" Then
StrAdicional = StrAdicional & "&comboCidades=" & Server.URLEncode(Request("comboCidades"))
End If
If Request("cbEstado") <> "" Then
StrAdicional = StrAdicional & "&cbEstado=" & Request("cbEstado")
End If
If Request("comboEstados") <> "" Then
StrAdicional = StrAdicional & "&comboEstados=" & Request("comboEstados")
End If
If Request("cbAtendido") <> "" Then
StrAdicional = StrAdicional & "&cbAtendido=" & Request("cbAtendido")
End If
If Request("comboAtendido") <> "" Then
StrAdicional = StrAdicional & "&comboAtendido=" & Request("comboAtendido")
End If
If Request("cbPago") <> "" Then
StrAdicional = StrAdicional & "&cbPago=" & Request("cbPago")
End If
If Request("comboPago") <> "" Then
StrAdicional = StrAdicional & "&comboPago=" & Request("comboPago")
End If
If Request.queryString("PN") = "" then
PaginaAtual = 1
Else
PaginaAtual = Request.queryString("PN")
End if
If Request.queryString("intervalo") = "" then
Intervalo = 20 'Valor Padrão
Else
Intervalo = Request.queryString("intervalo")
End if
%>
<%=Application("NomeLoja")%>
 |
|
 |
|
• Relatório Solicitado
| CÓDIGO |
NOME DO CLIENTE |
VALOR |
ATENDIDO |
PAGO |
<%
Set RS_Resposta = Server.CreateObject("ADODB.Recordset")
RS_Resposta.CursorLocation = 3
RS_Resposta.Open query_consulta, Conexao
RS_Resposta.PageSize = CInt(intervalo)
TotalPaginas= RS_Resposta.PageCount
TotalRegistros = RS_Resposta.recordcount
totalreg = "0"
IF NOT RS_Resposta.Eof THEN
RS_Resposta.AbsolutePage = CInt(PaginaAtual)
Else
%>
Nenhum resultado para consulta |
<%
END IF
DO UNTIL RS_Resposta.AbsolutePage <> CInt(PaginaAtual) OR RS_Resposta.EOF
If RS_Resposta.AbsolutePosition Mod 2 = 0 Then
strColor = "class='Linha2Tabela'"
Else
strColor = "class='Linha1Tabela'"
End If
%>
onMouseOver="this.style.backgroundColor='#FFECEC'; this.style.cursor='hand';" onMouseOut="this.style.backgroundColor='';" onclick="javascript: window.location='ADM_mostra_pedido.asp?codigo_pedido=<%=RS_Resposta("codigo_pedido")%>&status=compraram&orderby=<%=orderby%>';">
| <%= RS_Resposta("codigo_pedido") %> |
<%= RS_Resposta("nome_cobranca") %> |
<%= FormatCurrency(RS_Resposta("total")) %> |
<%
If RS_Resposta("atendido") = "0" Then
response.write "Não"
Else
response.write "Sim"
End if
%>
|
<%
If RS_Resposta("pago") = "0" Then
response.write "Não"
Else
response.write "Sim"
End If
%>
|
<%
total = total + Cdbl(RS_Resposta("total"))
RS_Resposta.MoveNext
LOOP
RS_Resposta.Close
Set RS_Resposta = Nothing
If FormatCurrency(total) > 0 Then
%>
|
|
<%= FormatCurrency(total) %> |
|
|
<%
End if
%>
|
<% 'Chama a páginação
Call paginacao(StrAdicional,TotalPaginas,Intervalo)
%>
|
| RESUMO DESTA CONSULTA |
| Total de Registros: |
<%=TotalRegistros%> |
| Total de Páginas: |
<%=TotalPaginas%> |
| Valor Total (desta página) |
<%= FormatCurrency(total) %> |
| Valor Total (toda a consulta): |
R$ <%=FormatNumber(VLRTOTAL)%> |
|
 |
|
|
 |