RELATÓRIO VS 2013

PCLSILVA 19/08/2014 10:44:45
#440584
Estou tentando migra para vb 2013, mas estou com dificuldades no relatório, não consigo mudar de pagina quando ao fim da página.Segue o Código, alguem pode ajudar?

Private Sub printIt_PrintPage(ByVal sender As System.Object, ByVal e As System.Drawing.Printing.PrintPageEventArgs)
If Not conn.State = ConnectionState.Open Then
conect()
End If

Dim myAdapter As New MySqlDataAdapter([Ô]SELECT Data, NroOS , Tecnico, Nome, Valor, Endereco,Bairro,Tels [Ô] & _
[Ô] FROM OS where CodCli = [ô][Ô] & [Ô]0[Ô] & Mid(Me.cboColaborador.Text, 1, 5) & [Ô][ô] ORDER BY Tecnico[Ô], conn)

Dim myData As New DataTable
myAdapter.Fill(myData)





If myData.Rows.Count > 0 Then

Dim TotalProd As Integer
Dim TotalGeral As String
Dim totpercent As String
Dim contalinha As Integer
Dim linha As Integer
Dim x As Integer

contalinha = 0
totpercent = 0
TotalProd = 0
TotalGeral = 0

For i = 0 To myData.Rows.Count - 1
If myData.Rows.Count > 0 Then
totpercent = Val(totpercent) + Val(myData.Rows(i).Item([Ô]Valor[Ô]))
End If
Next



x = 0
linha = 0

linha = 10

e.Graphics.DrawString([Ô]Relatório das Entregas aos Coordenadores: [Ô], New Font([Ô]Verdana[Ô], 12, FontStyle.Bold), Brushes.Black, 10, linha)
linha += 15

e.Graphics.DrawString([Ô]---------------------------------------------------------------------------------------------------------------------------------------------------------------[Ô], New Font([Ô]Verdana[Ô], 7, FontStyle.Bold), Brushes.Black, 10, linha + (x * 20))
linha += 20
e.Graphics.DrawString([Ô]Coordenador: [Ô] & myData.Rows(0).Item([Ô]Nome[Ô]), New Font([Ô]Verdana[Ô], 12, FontStyle.Regular), Brushes.Black, 10, linha)
linha += 20
e.Graphics.DrawString([Ô]Endereço: [Ô] & myData.Rows(0).Item([Ô]Endereco[Ô]) & [Ô] - [Ô] & myData.Rows(0).Item([Ô]Bairro[Ô]), New Font([Ô]Verdana[Ô], 12, FontStyle.Regular), Brushes.Black, 10, linha)
linha += 20
e.Graphics.DrawString([Ô]Tel.: [Ô] & myData.Rows(0).Item([Ô]Tels[Ô]), New Font([Ô]Verdana[Ô], 12, FontStyle.Regular), Brushes.Black, 10, linha)
linha += 20
e.Graphics.DrawString(Date.Now, New Font([Ô]Verdana[Ô], 12, FontStyle.Regular), Brushes.Black, 10, linha)
linha += 25
e.Graphics.DrawString([Ô]---------------------------------------------------------------------------------------------------------------------------------------------------------------[Ô], New Font([Ô]Verdana[Ô], 7, FontStyle.Bold), Brushes.Black, 10, linha + (x * 20))
linha += 10
Dim CodBpro As String

CodBpro = myData.Rows.Count

If myData.Rows.Count > 0 Then
CodBpro = Mid(myData.Rows(0).Item([Ô]Tecnico[Ô]), 1, 3)
Me.cboTecnico.Text = CodBpro
End If

e.Graphics.DrawString([Ô]PRODUTO Quantidade[Ô], New Font([Ô]Verdana[Ô], 12, FontStyle.Bold), Brushes.Black, 10, linha)
x = x + 1
e.Graphics.DrawString([Ô]---------------------------------------------------------------------------------------------------------------------------------------------------------------[Ô], New Font([Ô]Verdana[Ô], 7, FontStyle.Bold), Brushes.Black, 10, linha + (x * 20))

linha += 5
For i = 0 To myData.Rows.Count - 1

If myData.Rows.Count > 0 Then
If Mid(myData.Rows(i).Item([Ô]Tecnico[Ô]), 1, 3) = CodBpro Then
TotalProd = Val(TotalProd) + Val(myData.Rows(i).Item([Ô]Valor[Ô]))
TotalGeral = Val(TotalGeral) + Val(myData.Rows(i).Item([Ô]Valor[Ô]))

Else

numeroPagina = numeroPagina + 1



prodestoque()

linha += 10
e.Graphics.DrawString(myData.Rows(i - 1).Item([Ô]Tecnico[Ô]), New Font([Ô]Verdana[Ô], 12, FontStyle.Regular), Brushes.Black, 10, linha + (x * 20))
e.Graphics.DrawString(TotalProd, New Font([Ô]Verdana[Ô], 12, FontStyle.Regular), Brushes.Black, 500, linha + (x * 20))
e.Graphics.DrawString(Math.Round((Val(TotalProd) / Val(Me.totalsaiu.Text)) * 100, 2) & [Ô]%[Ô], New Font([Ô]Verdana[Ô], 12, FontStyle.Regular), Brushes.Black, 600, linha + (x * 20))
CodBpro = Mid(myData.Rows(i).Item([Ô]Tecnico[Ô]), 1, 3)
Me.cboTecnico.Text = CodBpro
TotalProd = 0
TotalProd = Val(TotalProd) + Val(myData.Rows(i).Item([Ô]Valor[Ô]))
TotalGeral = Val(TotalGeral) + Val(myData.Rows(i).Item([Ô]Valor[Ô]))
x = x + 1


e.Graphics.DrawString([Ô]---------------------------------------------------------------------------------------------------------------------------------------------------------------[Ô], New Font([Ô]Verdana[Ô], 7, FontStyle.Bold), Brushes.Black, 10, linha + (x * 20))




End If

End If

Next

x = x + 1
linha -= 10

e.Graphics.DrawString(myData.Rows(0).Item([Ô]Tecnico[Ô]), New Font([Ô]Verdana[Ô], 12, FontStyle.Regular), Brushes.Black, 10, linha + (x * 20))
e.Graphics.DrawString(TotalProd, New Font([Ô]Verdana[Ô], 12, FontStyle.Regular), Brushes.Black, 500, linha + (x * 20))
e.Graphics.DrawString(Math.Round((Val(TotalProd) / Val(Me.totalsaiu.Text)) * 100, 2) & [Ô]%[Ô], New Font([Ô]Verdana[Ô], 12, FontStyle.Regular), Brushes.Black, 600, linha + (x * 20))
x = x + 1
e.Graphics.DrawString([Ô]---------------------------------------------------------------------------------------------------------------------------------------------------------------[Ô], New Font([Ô]Verdana[Ô], 7, FontStyle.Bold), Brushes.Black, 10, linha + (x * 20))
x = x + 1
e.Graphics.DrawString([Ô]Total Geral: [Ô], New Font([Ô]Verdana[Ô], 12, FontStyle.Bold), Brushes.Black, 300, linha + (x * 20))
e.Graphics.DrawString(TotalGeral, New Font([Ô]Verdana[Ô], 12, FontStyle.Bold), Brushes.Black, 500, linha + (x * 20))

linha = 600
linha = linha + (x * 10)
x = 0


e.Graphics.PageUnit = GraphicsUnit.Millimeter
Else
MsgBox([Ô]Não foi Entregue Material para esse Coordenador ![Ô])
End If

If numeroPagina >= 20 Then
e.HasMorePages = True
Else
e.HasMorePages = False
End If

conn.Close()
conn.Dispose()

End Sub
Faça seu login para responder