• 0
Sign in to follow this  
Alberto Mota

Agrupamento de Vendas por Cidades

Question

Prezados colegas, estou usando o Access e o Asp.

Gostaria de criar um relatório onde aparecessem as vendas agrupadas por cidades.

Onde cada cidade teria seu numero de venda logo abaixo, seu nome de cliente, etc. e subtotal.

No final o Total geral em determinado periodo.

Até agora só consegui realizar sem agrupamentos.

Seria assim:

Cidade: Recife

N Venda Cliente Total

1 Luiz Silva 500,00

2 Paulo 300,00

--------------------------------------

SubTotal: 800,00

Cidade: Olinda

N Venda Cliente Total

1 Luiz Silva 200,00

2 Paulo 300,00

--------------------------------------

SubTotal: 500,00

--------------------------------------

--------------------------------------

Total Geral 1300,00

Desde já, obrigado.

Edited by Alberto Mota

Share this post


Link to post
Share on other sites

1 answer to this question

Recommended Posts

  • 0

Estou quase lá. Pesquisei aqui no forum e adaptei um script do Bareta.

Infelizmente esta repetindo as datas.

O cabeçalho do grupo esta correto. apenas os itens.

Vou colocar o script por inteiro para facilitar. Agradeço de antemão qualquer ajuda.

<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">

<head>

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />

<title>Untitled Document</title>

</head>

<body>

<%

connSTR = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.Mappath("dados/februmar.mdb") & ";Persist Security Info=False"

set rsItems = Server.CreateObject("ADODB.Recordset")

rsItems.ActiveConnection = connSTR

rsItems.Source = "SELECT DISTINCT LngNumContrato FROM TblVendaSaidaNovo"

rsItems.Open()

If rsItems.EOF Then

Response.write "Não há dados"

else

Do Until rsItems.EOF

response.write "<table><tr><td>" & rsItems.Fields.Item("lngNumContrato").Value & "</tr></td>"

'rsItems.MoveNext

'loop

parent = rsItems.Fields.Item("LngNumContrato").Value

set rsItems2 = Server.CreateObject("ADODB.Recordset")

rsItems2.ActiveConnection = connSTR

rsItems2.Source = "SELECT * FROM tblvendasaidanovo"' WHERE LngNumContrato=" & LngNumContrato & " "

rsItems2.Open()

Do Until rsItems2.EOF

response.write "<tr><td>" & rsItems2.Fields.Item("dataemissao").Value & "</td></tr>"

rsItems2.MoveNext

Loop

rsItems2.Close

rsItems2=null

response.write "</table><br>"

rsItems.MoveNext

Loop

end if

rsItems.Close

rsItems=null

%>

</body>

</html>

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this