Ir para conteúdo

POWERED BY:

Arquivado

Este tópico foi arquivado e está fechado para novas respostas.

Andreh

Filtrando resultados

Recommended Posts

Olá,

 

Estou quase terminando meu relatório em asp e msxml, já consegui filtrar alguns dados usando uma sql no asp mas dentro do xml não sei como funciona será que alguem poderia me dar uma ajuda nisto. Gostaria de mostrar somente os registros do

item.attributes.getNamedItem("referencia").text
que fossem iguais a "produtoempromocao"

 

Obrigado, segue o codigo abaixo

 

ASP [/tr][tr]<%

'Abre conexão

Set objCon = Server.CreateObject("ADODB.Connection")

objCon.Open Application("minhaconexao")

'Cria sql

strQ = "SELECT * FROM pedidos Where status=2 ORDER BY data_pagamento DESC"

Set objRS = objCon.Execute(strQ)

'Cria Xml

Dim XMLDoc, XMLItems

Dim produtos

Set XMLDoc = Server.CreateObject("Microsoft.XMLDOM")

%>

<!--#Cria tabela e coloca os valores-->

<html>

<link href="estilos/index.css" rel="stylesheet" type="text/css">

<body><table width="90%" border="0" align="center" cellpadding="10" cellspacing="0" bgcolor="white" class="texto" style="border: 5px solid #DFDFDF">

<tr>

<td><font color="#60707F"><b><font color="#CF0800">PEDIDOS</font><br>

<br>

</b></font> <table width="100%" border="0" cellspacing="0" cellpadding="4" class="texto" align="center">

<!--DWLayoutTable-->

<form name="cesta_produtos" method="post" action="insererelatorio.asp">

<tr>

<td width="328" height="27" valign="top" bgcolor="gainsboro"><strong>Pedido - Descri</strong></td>

<td width="223" align="center" valign="top" bgcolor="gainsboro"><strong>data</strong></td>

<td width="41" align="center" valign="top" bgcolor="gainsboro"><strong>#ID</strong></td>

<td width="41" align="center" valign="top" bgcolor="gainsboro"><strong>Ref.</strong></td>

<td width="41" align="center" valign="top" bgcolor="gainsboro"><strong>Qtd.</strong></td>

<td width="41" align="center" valign="top" nowrap bgcolor="gainsboro"><strong>Valor</strong></td>

<td width="97" align="right" valign="top" nowrap bgcolor="gainsboro"><strong>Total</strong></td>

<td width="117" align="center" valign="top" bgcolor="gainsboro"><strong>Forma de Pagamento </strong></td>

</tr>

<%

n = 0

peso_produtos = 0

total = 0

' Faz o loop nos registros

While NOT objRS.EOF

XMLDoc.loadXML objRS("produtos")

Set XMLItems = XMLDoc.documentElement

For Each item in XMLItems.childNodes

sub_total = ccur(item.attributes.getNamedItem("valor").text) * ccur(item.text)

total = total + sub_total

n = n + 1

 

%>

<tr>

 

<td height="27" valign="top">

<%=Right("000000"&objRS("id"),6)%> -

<%

Response.Write "<a href='produtos_alterar.asp?id=" & item.attributes.getNamedItem("id").text & "' target='_blank'>"

Response.Write item.attributes.getNamedItem("nome").text

Response.Write "</a>"

 

%>

</td>

<td align="center" valign="top"><%=FormataData(objRS("data_pagamento"))%> </td>

<td align="center" valign="top" nowrap><%=item.attributes.getNamedItem("id").text%> </td>

<td align="center" valign="top" nowrap>

<%If Trim(item.attributes.getNamedItem("referencia").text) <> "" Then Response.Write item.attributes.getNamedItem("referencia").text Else Response.Write "-"%> </td>

<td align="center" valign="top" nowrap><%=item.text%></td>

<td align="right" valign="top" nowrap><%=item.attributes.getNamedItem("valor").text%></td>

<td align="right" valign="top" nowrap><%=FormataValor(sub_total)%></td>

<td align="center" valign="top"><%

Select Case objRS("forma_pagamento")

Case 1 : Response.Write "Boleto Bancário"

Case 2 : Response.Write "Depósito Bancário"

Case 3 : Response.Write "Visa"

Case 4 : Response.Write "Master Card"

Case 5 : Response.Write "Diners"

Case 6 : Response.Write "American"

Case Else : Response.Write "-"

End Select

%></td>

</tr>

<%

peso_produtos = peso_produtos + item.attributes.getNamedItem("peso").text * item.text

Next

objRS.MoveNext()

Wend

Set objRS = nothing

Set objRS2 = nothing

%>

<tr>

<td height="27" colspan="7" valign="top" bgcolor="whitesmoke"><div align="right"><strong>Total: R$</strong><strong><%=FormataValor(total)%></strong><br>

</div></td>

<td align="right" valign="top" bgcolor="whitesmoke"><strong> <font face="Arial"><font size="1" face="Verdana, Arial, Helvetica, sans-serif"><font color="#0000FF"><small>

</small></font></font></font> </strong></td>

</tr>

<tr>

<td height="4"></td>

</tr>

</form>

</table>

<strong><font face="Arial"><font size="1" face="Verdana, Arial, Helvetica, sans-serif"><font color="#0000FF"><small>

<%

'mede a velocidade de carregamento

response.write "Processado em " & FormatNumber( Timer - inicio, 2 ) & " segundos"

%>

</small></font></font></font></strong>

</body></html>

[/tr]

Compartilhar este post


Link para o post
Compartilhar em outros sites

×

Informação importante

Ao usar o fórum, você concorda com nossos Termos e condições.