Option Strict Off
Option Explicit On
Imports fatd_faturamento.BLL.Repositorio
Imports fatd_faturamento.ENTIDADE
Imports CrystalDecisions.CrystalReports.Engine
Friend Class frmRelMercado
	Inherits System.Windows.Forms.Form
	Dim sql As String
	'Dim fr As New FrmRelatorio

	Dim kwhf(10, 100) As Integer
	Dim valor(10, 100) As Double
	Dim qtd(10, 100) As Integer
	Dim tt(10) As Double
	Dim SubTit As String

	Dim objAtualizaBancoDados As New entidadeAtualizaBancoDados
	Dim repositorioAtualizaBancoDados As New repositorioAtualizaBancoDados

	Dim objExecAtualizaBancoDados As New entidadeAtualizaBancoDados
	Dim repositorioExecAtualizaBancoDados As New repositorioAtualizaBancoDados
	Dim dt, dt1, dt2 As DataTable


	Private Sub Command1_Click(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles Command1.Click
		Me.Cursor = System.Windows.Forms.Cursors.WaitCursor
		
		Command1.Enabled = False
		Command2.Enabled = False

		If cTipo.SelectedIndex = 0 Then
			Call Municipio()
		Else
			Call carregaDados()
			Call Zona()
		End If

		Command1.Enabled = True
		Command2.Enabled = True
		
		Me.Cursor = System.Windows.Forms.Cursors.Default
	End Sub
	
	Private Sub Command2_Click(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles Command2.Click
		Me.Close()
	End Sub
	
	Private Sub frmRelMercado_Load(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles MyBase.Load
		tMesAno.Text = Format(Month(Date.Now), "00") & "/" & Format(Year(Date.Now), "0000")
		cTipo.SelectedIndex = 0
	End Sub
	
	Private Sub Municipio()
		
	End Sub
	
	Private Sub Zona()

		'fr.quem_chama = Me
		'SubTit = "Numero de Consumidores"

		'fr.VS.Font = VB6.FontChangeName(fr.VS.Font, "Arial")
		'fr.VS.Font = VB6.FontChangeSize(fr.VS.Font, 5)

		'fr.VS.TableBorder = VSVIEW6.TableBorderSettings.tbNone

		'fr.VS.PageBorder = VSVIEW6.TableBorderSettings.tbNone
		''fr.VS.ShowGuides = gdShow

		'fr.VS.Orientation = VSVIEW6.OrientationSettings.orPortrait
		'fr.VS.PhysicalPage = True
		'fr.VS.PaperSize = VSVIEW6.PaperSizeSettings.pprA4
		'fr.VS.MarginTop = "7mm"
		'fr.VS.MarginRight = "7mm"
		'fr.VS.MarginLeft = "7mm"
		'fr.VS.MarginBottom = "5mm"
		''    fr.VS.MarginFooter = "0mm"
		''    fr.VS.MarginHeader = "0mm"

		'fr.VS.TextColor = System.Drawing.Color.Black
		'fr.VS.BrushStyle = VSVIEW6.BrushStyleSettings.bsSolid
		'fr.VS.Font = VB6.FontChangeBold(fr.VS.Font, False)
		'fr.VS.StartDoc()

		'Dim tot As Integer
		'Dim I As Integer

		''----- QTDADE ---------

		'fr.VS.Table = "<20mm|>17mm|>15mm|>15mm|>15mm|>15mm|>15mm|>15mm|>15mm|>15mm|>15mm;" & "ZONA|RESIDENCIAL|INDUSTRIAL|COMERCIAL|RURAL|P. PUBLICO|IL. PUBLICA|SERV. PUBL.| PROPRIO|TOTAL"

		'info.Text = "Imprimindo Qtdade.."
		'pgb.Minimum = 0
		'pgb.Maximum = 100
		'pgb.Value = 0
		'For I = 1 To 100
		'	tot = qtd(1, I) + qtd(3, I) + qtd(4, I) + qtd(5, I) + qtd(6, I) + qtd(7, I) + qtd(8, I) + qtd(9, I)
		'	If tot > 0 Then
		'		fr.VS.Table = "<20mm|>15mm|>15mm|>15mm|>15mm|>15mm|>15mm|>15mm|>15mm|>15mm|>15mm;" & VB6.Format(I, "000") & "|" & qtd(9, I) & "|" & qtd(1, I) & "|" & qtd(4, I) & "|" & qtd(5, I) & "|" & qtd(6, I) & "|" & qtd(3, I) & "|" & qtd(7, I) & "|" & qtd(8, I) & "|" & tot

		'		tt(1) = tt(1) + qtd(1, I)
		'		tt(3) = tt(3) + qtd(3, I)
		'		tt(4) = tt(4) + qtd(4, I)
		'		tt(5) = tt(5) + qtd(5, I)
		'		tt(6) = tt(6) + qtd(6, I)
		'		tt(7) = tt(7) + qtd(7, I)
		'		tt(8) = tt(8) + qtd(8, I)
		'		tt(9) = tt(9) + qtd(9, I)
		'		tt(10) = tt(10) + tot
		'	End If
		'	pgb.Value = pgb.Value + 1
		'	System.Windows.Forms.Application.DoEvents()
		'Next 

		'fr.LineFeed((1))
		'fr.VS.Table = "^20mm|>15mm|>15mm|>15mm|>15mm|>15mm|>15mm|>15mm|>15mm|>15mm|>15mm;" & "TOTAL GERAL|" & VB6.Format(tt(9), "Standard") & "|" & VB6.Format(tt(1), "Standard") & "|" & VB6.Format(tt(4), "Standard") & "|" & VB6.Format(tt(5), "Standard") & "|" & VB6.Format(tt(6), "Standard") & "|" & VB6.Format(tt(3), "Standard") & "|" & VB6.Format(tt(7), "Standard") & "|" & VB6.Format(tt(8), "Standard") & "|" & VB6.Format(tt(10), "Standard")

		'tt(1) = 0
		'tt(3) = 0
		'tt(4) = 0
		'tt(5) = 0
		'tt(6) = 0
		'tt(7) = 0
		'tt(8) = 0
		'tt(9) = 0
		'tt(10) = 0

		''----- CONSUMO ---------
		'info.Text = "Imprimindo Consumo.."
		'SubTit = "kWh Faturados"
		'fr.VS.NewPage()
		'fr.VS.Table = "<20mm|>17mm|>15mm|>15mm|>15mm|>15mm|>15mm|>15mm|>15mm|>15mm|>15mm;" & "ZONA|RESIDENCIAL|INDUSTRIAL|COMERCIAL|RURAL|P. PUBLICO|IL. PUBLICA|SERV. PUBL.| PROPRIO|TOTAL"
		'pgb.Minimum = 0
		'pgb.Maximum = 100
		'pgb.Value = 0
		'For I = 1 To 100
		'	tot = kwhf(1, I) + kwhf(3, I) + kwhf(4, I) + kwhf(5, I) + kwhf(6, I) + kwhf(7, I) + kwhf(8, I) + kwhf(9, I)
		'	If tot > 0 Then
		'		fr.VS.Table = "<20mm|>15mm|>15mm|>15mm|>15mm|>15mm|>15mm|>15mm|>15mm|>15mm|>15mm;" & VB6.Format(I, "000") & "|" & kwhf(9, I) & "|" & kwhf(1, I) & "|" & kwhf(4, I) & "|" & kwhf(5, I) & "|" & kwhf(6, I) & "|" & kwhf(3, I) & "|" & kwhf(7, I) & "|" & kwhf(8, I) & "|" & tot

		'		tt(1) = tt(1) + kwhf(1, I)
		'		tt(3) = tt(3) + kwhf(3, I)
		'		tt(4) = tt(4) + kwhf(4, I)
		'		tt(5) = tt(5) + kwhf(5, I)
		'		tt(6) = tt(6) + kwhf(6, I)
		'		tt(7) = tt(7) + kwhf(7, I)
		'		tt(8) = tt(8) + kwhf(8, I)
		'		tt(9) = tt(9) + kwhf(9, I)
		'		tt(10) = tt(10) + tot

		'	End If
		'	pgb.Value = pgb.Value + 1
		'	System.Windows.Forms.Application.DoEvents()
		'Next 

		'fr.LineFeed((1))
		'fr.VS.Table = "^20mm|>15mm|>15mm|>15mm|>15mm|>15mm|>15mm|>15mm|>15mm|>15mm|>15mm;" & "TOTAL GERAL|" & VB6.Format(tt(9), "Standard") & "|" & VB6.Format(tt(1), "Standard") & "|" & VB6.Format(tt(4), "Standard") & "|" & VB6.Format(tt(5), "Standard") & "|" & VB6.Format(tt(6), "Standard") & "|" & VB6.Format(tt(3), "Standard") & "|" & VB6.Format(tt(7), "Standard") & "|" & VB6.Format(tt(8), "Standard") & "|" & VB6.Format(tt(10), "Standard")
		'tt(1) = 0
		'tt(3) = 0
		'tt(4) = 0
		'tt(5) = 0
		'tt(6) = 0
		'tt(7) = 0
		'tt(8) = 0
		'tt(9) = 0
		'tt(10) = 0

		''----- VALOR ---------
		'info.Text = "Imprimindo Valores.."
		'SubTit = "Receita (Consumo+Demanda+FP)"
		'fr.VS.NewPage()
		'fr.VS.Table = "<18mm|>17mm|>15mm|>15mm|>15mm|>15mm|>15mm|>15mm|>15mm|>15mm|>15mm;" & "ZONA|RESIDENCIAL|INDUSTRIAL|COMERCIAL|RURAL|P. PUBLICO|IL. PUBLICA|SERV. PUBL.| PROPRIO|TOTAL"
		'pgb.Minimum = 0
		'pgb.Maximum = 100
		'pgb.Value = 0
		'For I = 1 To 100
		'	tot = valor(1, I) + valor(3, I) + valor(4, I) + valor(5, I) + valor(6, I) + valor(7, I) + valor(8, I) + valor(9, I)
		'	If tot > 0 Then
		'		fr.VS.Table = "<20mm|>15mm|>15mm|>15mm|>15mm|>15mm|>15mm|>15mm|>15mm|>15mm|>15mm;" & VB6.Format(I, "000") & "|" & VB6.Format(valor(9, I), "Standard") & "|" & VB6.Format(valor(1, I), "Standard") & "|" & VB6.Format(valor(4, I), "Standard") & "|" & VB6.Format(valor(5, I), "Standard") & "|" & VB6.Format(valor(6, I), "Standard") & "|" & VB6.Format(valor(3, I), "Standard") & "|" & VB6.Format(valor(7, I), "Standard") & "|" & VB6.Format(valor(8, I), "Standard") & "|" & VB6.Format(tot, "Standard")

		'		tt(1) = tt(1) + valor(1, I)
		'		tt(3) = tt(3) + valor(3, I)
		'		tt(4) = tt(4) + valor(4, I)
		'		tt(5) = tt(5) + valor(5, I)
		'		tt(6) = tt(6) + valor(6, I)
		'		tt(7) = tt(7) + valor(7, I)
		'		tt(8) = tt(8) + valor(8, I)
		'		tt(9) = tt(9) + valor(9, I)
		'		tt(10) = tt(10) + tot
		'	End If
		'	pgb.Value = pgb.Value + 1
		'	System.Windows.Forms.Application.DoEvents()
		'Next 
		'fr.LineFeed((1))
		'fr.VS.Table = "^20mm|>15mm|>15mm|>15mm|>15mm|>15mm|>15mm|>15mm|>15mm|>15mm|>15mm;" & "TOTAL GERAL|" & VB6.Format(tt(9), "Standard") & "|" & VB6.Format(tt(1), "Standard") & "|" & VB6.Format(tt(4), "Standard") & "|" & VB6.Format(tt(5), "Standard") & "|" & VB6.Format(tt(6), "Standard") & "|" & VB6.Format(tt(3), "Standard") & "|" & VB6.Format(tt(7), "Standard") & "|" & VB6.Format(tt(8), "Standard") & "|" & VB6.Format(tt(10), "Standard")


		'tt(1) = 0
		'tt(3) = 0
		'tt(4) = 0
		'tt(5) = 0
		'tt(6) = 0
		'tt(7) = 0
		'tt(8) = 0
		'tt(9) = 0
		'tt(10) = 0

		'fr.VS.EndDoc()
		'fr.Show()

	End Sub
	
	
	Private Sub carregaDados()
		'Dim lrstAux As ADODB.Recordset
		'lrstAux = New ADODB.Recordset
		info.Text = "Carregando dados..."
		info.Refresh()
		sql = "select * from nf where mesano='" & Trim(tMesAno.Text) & "'"
		objAtualizaBancoDados.QUERY_NAME = sql
		dt = repositorioAtualizaBancoDados.Consultar(objAtualizaBancoDados)
		'''Call Conectar(sql, lrstAux)

		'If lrstAux.BOF = False And lrstAux.EOF = False Then
		'	lrstAux.MoveLast()
		'	lrstAux.MoveFirst()
		'	pgb.Minimum = 0
		'	'   pgb.Max = lrstAux.RecordCount
		'	pgb.Value = 0
		'Else
		'	MsgBox("Não existe faturas no mês selecionado!!", MsgBoxStyle.Information, "Atenção")
		'	lrstAux.Close()
		'	Exit Sub
		'End If

		Dim I As Integer

		If dt.Rows.Count > 0 Then
			For Each row As DataRow In dt.Rows
				I = I + 1
				info.Text = "Processando: " & I
				info.Refresh()
				Select Case Mid(row.Item("codclas"), 1, 1)
					Case CStr(1), CStr(2), CStr(3)
						kwhf(1, row.Item("Zona")) = kwhf(1, row.Item("Zona")) + CDbl(ChecaItensServ("0302010009", row.Item("itensserv")))
						valor(1, row.Item("Zona")) = valor(1, row.Item("Zona")) + CDbl(ChecaItensServ("0302020009", row.Item("itensserv"))) + CDbl(ChecaItensServ("0302020015", row.Item("itensserv"))) + CDbl(ChecaItensServ("0302020012", row.Item("itensserv")))
						qtd(1, row.Item("Zona")) = qtd(1, row.Item("Zona")) + 1
					Case CStr(4)
						kwhf(4, row.Item("Zona")) = kwhf(4, row.Item("Zona")) + CDbl(ChecaItensServ("0302010009", row.Item("itensserv")))
						valor(4, row.Item("Zona")) = valor(4, row.Item("Zona")) + CDbl(ChecaItensServ("0302020009", row.Item("itensserv"))) + CDbl(ChecaItensServ("0302020015", row.Item("itensserv"))) + CDbl(ChecaItensServ("0302020012", row.Item("itensserv")))
						qtd(4, row.Item("Zona")) = qtd(4, row.Item("Zona")) + 1
					Case CStr(5)
						kwhf(5, row.Item("Zona")) = kwhf(5, row.Item("Zona")) + CDbl(ChecaItensServ("0302010009", row.Item("itensserv")))
						valor(5, row.Item("Zona")) = valor(5, row.Item("Zona")) + CDbl(ChecaItensServ("0302020009", row.Item("itensserv"))) + CDbl(ChecaItensServ("0302020015", row.Item("itensserv"))) + CDbl(ChecaItensServ("0302020012", row.Item("itensserv")))
						qtd(5, row.Item("Zona")) = qtd(5, row.Item("Zona")) + 1
					Case CStr(6)
						If CDbl(Mid(row.Item("codclas"), 1, 2)) = 64 Then
							kwhf(3, row.Item("Zona")) = kwhf(3, row.Item("Zona")) + CDbl(ChecaItensServ("0302010009", row.Item("itensserv")))
							valor(3, row.Item("Zona")) = valor(3, row.Item("Zona")) + CDbl(ChecaItensServ("0302020009", row.Item("itensserv"))) + CDbl(ChecaItensServ("0302020015", row.Item("itensserv"))) + CDbl(ChecaItensServ("0302020012", row.Item("itensserv")))
							qtd(3, row.Item("Zona")) = qtd(3, row.Item("Zona")) + 1
						Else
							kwhf(6, row.Item("Zona")) = kwhf(6, row.Item("Zona")) + CDbl(ChecaItensServ("0302010009", row.Item("itensserv")))
							valor(6, row.Item("Zona")) = valor(6, row.Item("Zona")) + CDbl(ChecaItensServ("0302020009", row.Item("itensserv"))) + CDbl(ChecaItensServ("0302020015", row.Item("itensserv"))) + CDbl(ChecaItensServ("0302020012", row.Item("itensserv")))
							qtd(6, row.Item("Zona")) = qtd(6, row.Item("Zona")) + 1
						End If
					Case CStr(7)
						kwhf(7, row.Item("Zona")) = kwhf(7, row.Item("Zona")) + CDbl(ChecaItensServ("0302010009", row.Item("itensserv")))
						valor(7, row.Item("Zona")) = valor(7, row.Item("Zona")) + CDbl(ChecaItensServ("0302020009", row.Item("itensserv"))) + CDbl(ChecaItensServ("0302020015", row.Item("itensserv"))) + CDbl(ChecaItensServ("0302020012", row.Item("itensserv")))
						qtd(7, row.Item("Zona")) = qtd(7, row.Item("Zona")) + 1
					Case CStr(8)
						kwhf(8, row.Item("Zona")) = kwhf(8, row.Item("Zona")) + CDbl(ChecaItensServ("0302010009", row.Item("itensserv")))
						valor(8, row.Item("Zona")) = valor(8, row.Item("Zona")) + CDbl(ChecaItensServ("0302020009", row.Item("itensserv"))) + CDbl(ChecaItensServ("0302020015", row.Item("itensserv"))) + CDbl(ChecaItensServ("0302020012", row.Item("itensserv")))
						qtd(8, row.Item("Zona")) = qtd(8, row.Item("Zona")) + 1
					Case CStr(9)
						kwhf(9, row.Item("Zona")) = kwhf(9, row.Item("Zona")) + CDbl(ChecaItensServ("0302010009", row.Item("itensserv")))
						valor(9, row.Item("Zona")) = valor(9, row.Item("Zona")) + CDbl(ChecaItensServ("0302020009", row.Item("itensserv"))) + CDbl(ChecaItensServ("0302020015", row.Item("itensserv"))) + CDbl(ChecaItensServ("0302020012", row.Item("itensserv")))
						qtd(9, row.Item("Zona")) = qtd(9, row.Item("Zona")) + 1
				End Select

				'lrstAux.MoveNext()
				'pgb.Value = pgb.Value + 1
				System.Windows.Forms.Application.DoEvents()
			Next
		End If
		'lrstAux.Close()

	End Sub

	'Public Function CabecaRel() As Object
	'	Call Cabecalho_Relatorio((fr.VS), "RESUMO DE MERCADO - " & Trim(tMesAno.Text), SubTit, "2", False, "")
	'	Call LineFeed((fr.VS), 1)
	'End Function

	Private Sub lPrint(ByVal vNomeRPT As String)

		Dim dt As DataTable
		Dim dt_1 As DataTable
		Dim dt_2 As DataTable
		Dim dt_3 As DataTable
		Dim dc As DataColumn
		Dim ds As DataSet
		Dim lstrsql As String

		Dim bytBLOBData() As Byte

		Dim objEmpresa As New entidadeEmpresa
		Dim repositorioEmpresa As New repositorioEmpresa

		Dim vlist


		'Dim vlist

		'Dim objEmpresa As New entidadeEmpresa
		'Dim repositorioEmpresa As New repositorioEmpresa


		'vlist = repositorioEmpresa.Select(objEmpresa)

		'If vlist.Count <> 0 Then

		'	For Each objEmpresaFor As entidadeEmpresa In vlist

		'		bytBLOBData = objEmpresaFor.LOGOTIPO

		'	Next

		'End If

		Try
			Dim rpt As New ReportDocument()

			'rptConsumidorAVencer
			If vNomeRPT = "rptConsumidorAVencer" Then


				dt_2 = New DataTable()
				dt_2.Columns.Add("TIPO", GetType(String))
				dt_2.Columns.Add("DATAAUX", GetType(String))
				dt_2.Columns.Add("DIASAUX", GetType(String))
				dt_2.Columns.Add("CLASSE", GetType(String))
				dt_2.Columns.Add("TA", GetType(String))
				dt_2.Columns.Add("BANCO", GetType(String))
				dt_2.Columns.Add("NMBANCO", GetType(String))
				dt_2.Columns.Add("ZONA", GetType(String))
				dt_2.Columns.Add("NMCIDADE", GetType(String))
				dt_2.Columns.Add("KWH_FAT", GetType(String))
				dt_2.Columns.Add("CONSUMO", GetType(String))
				dt_2.Columns.Add("BANDEIRA", GetType(String))
				dt_2.Columns.Add("ICMS", GetType(String))
				dt_2.Columns.Add("REATIVO", GetType(String))
				dt_2.Columns.Add("TIP", GetType(String))
				dt_2.Columns.Add("DIF_ELTRBR", GetType(String))
				dt_2.Columns.Add("ECE", GetType(String))
				dt_2.Columns.Add("ICMS_ECE", GetType(String))
				dt_2.Columns.Add("MULTA_ECE", GetType(String))
				dt_2.Columns.Add("PIS", GetType(String))
				dt_2.Columns.Add("COFINS", GetType(String))
				dt_2.Columns.Add("ICMSPISCOF", GetType(String))
				dt_2.Columns.Add("TAXADOS", GetType(String))
				dt_2.Columns.Add("DIVERSOS", GetType(String))
				dt_2.Columns.Add("CONVENIOS", GetType(String))
				dt_2.Columns.Add("RETENCAO", GetType(String))
				dt_2.Columns.Add("VKWH_DEV_P", GetType(String))
				dt_2.Columns.Add("VKWH_DEV_FP", GetType(String))
				dt_2.Columns.Add("VKWH_UTR_P", GetType(String))
				dt_2.Columns.Add("VKWH_UTR_FP", GetType(String))
				dt_2.Columns.Add("ICMS_ST", GetType(String))
				dt_2.Columns.Add("PIS_ST", GetType(String))
				dt_2.Columns.Add("COFINS_ST", GetType(String))
				dt_2.Columns.Add("REVERSO", GetType(String))
				dt_2.Columns.Add("TOTAL", GetType(String))
				dt_2.Columns.Add("NCONS", GetType(String))
				dt_2.Columns.Add("IMAGEM", GetType(Byte()))


				ds = New DataSet

				lstrsql = ""
				lstrsql = "SELECT * FROM AUX_VENC " 'WHERE nm_usuario = '" & My.Computer.Name & "'"
				objAtualizaBancoDados.QUERY_NAME = lstrsql
				dt = repositorioAtualizaBancoDados.Consultar(objAtualizaBancoDados)

				If dt.Rows.Count > 0 Then
					For Each dr_1 As DataRow In dt.Rows

						dt_2.Rows.Add(dr_1("TIPO"),
										  dr_1("DATAAUX"),
										  dr_1("DIASAUX"),
										  dr_1("CLASSE"),
										  dr_1("TA"),
										  dr_1("BANCO"),
										  dr_1("NMBANCO"),
										  dr_1("ZONA"),
										  dr_1("NMCIDADE"),
										  dr_1("KWH_FAT"),
										  dr_1("CONSUMO"),
										  dr_1("BANDEIRA"),
										  dr_1("ICMS"),
										  dr_1("REATIVO"),
										  dr_1("TIP"),
										  dr_1("DIF_ELTRBR"),
										  dr_1("ECE"),
										  dr_1("ICMS_ECE"),
										  dr_1("MULTA_ECE"),
										  dr_1("PIS"),
										  dr_1("COFINS"),
										  dr_1("ICMSPISCOF"),
										  dr_1("TAXADOS"),
										  dr_1("DIVERSOS"),
										  dr_1("CONVENIOS"),
										  dr_1("RETENCAO"),
										  dr_1("VKWH_DEV_P"),
										  dr_1("VKWH_DEV_FP"),
										  dr_1("VKWH_UTR_P"),
										  dr_1("VKWH_UTR_FP"),
										  dr_1("ICMS_ST"),
										  dr_1("PIS_ST"),
										  dr_1("COFINS_ST"),
										  dr_1("REVERSO"),
										  dr_1("TOTAL"),
										  dr_1("NCONS"),
										  bytBLOBData)
					Next dr_1
				End If


				ds.Tables.Add(dt)
				ds.Tables(0).TableName = "REL_VENC"

				If ds.Tables(0).Rows.Count = 0 Then
					MessageBox.Show("Não há registros para o relatório escolhido! ", "Informação", MessageBoxButtons.OK, MessageBoxIcon.Information)
					Exit Sub
				Else

					rpt = New rptConsumidorAVencerc_MuniC

					rpt.SetDataSource(ds)
					'rpt.SetParameterValue("nomeempresa", sNomeEmpresa)
					'rpt.SetParameterValue("enderecoempresa", sEnderecoEmpresa)
					'rpt.SetParameterValue("cepempresa", sCepEmpresa)
					'rpt.SetParameterValue("ufempresa", sUFempresa)
					'rpt.SetParameterValue("cidadeempresa", sCidadeEmpresa)
					'rpt.SetParameterValue("bairroempresa", sBairroEmpresa)
					'rpt.SetParameterValue("foneempresa", sFoneEmpresa)
					'rpt.SetParameterValue("websiteempresa", sWebEmpresa)
					'rpt.SetParameterValue("Tipo", IIf(cmbOpcao.Text = "Geral", "Geral", "Munícipio"))
					'rpt.SetParameterValue("MesAnoRef", Month(dtpMesAno.Value) & "/" & Year(dtpMesAno.Value))
					' rpt.SetParameterValue("NomeRel", "Grupo A - Período de: " & dtpIni.Value & " Até: " & dtpFim.Value)

					frmViewRelatorios.rpt = rpt

					frmViewRelatorios.CRViewer.Zoom((100))
					frmViewRelatorios.Text = "Relatório Consumidor a Vencer"
					frmViewRelatorios.ShowDialog()

				End If

			End If

			Me.Cursor = System.Windows.Forms.Cursors.Default

		Catch ex As Exception
			MessageBox.Show("Ocorreu o Erro: " & Err.Description & " - Rotina: lPrint" & "", "Aviso de Erro", MessageBoxButtons.OK, MessageBoxIcon.Error)
			Exit Sub
		End Try

	End Sub
	Private Sub sCriaTabelaAuxiliar()

		Try
			Dim lstrsql As String


			objExecAtualizaBancoDados.QUERY_NAME = "drop table if exists AUX_VENC_ITENS"
			repositorioExecAtualizaBancoDados.Execute(objExecAtualizaBancoDados)

			lstrsql = ""
			lstrsql = "create table AUX_VENC_ITENS ("
			lstrsql = lstrsql & "tipo VARCHAR(50),"
			lstrsql = lstrsql & "detalhamento VARCHAR(50),"
			lstrsql = lstrsql & "dataaux VARCHAR(10),"
			lstrsql = lstrsql & "diasaux VARCHAR(10),"
			lstrsql = lstrsql & "banco  VARCHAR(50),"
			lstrsql = lstrsql & "zona VARCHAR(10),"
			lstrsql = lstrsql & "nmcidade VARCHAR(50),"
			lstrsql = lstrsql & "codigo VARCHAR(20),"
			lstrsql = lstrsql & "valor  VARCHAR(20),"
			lstrsql = lstrsql & "descricao  VARCHAR(50))"
			objExecAtualizaBancoDados.QUERY_NAME = lstrsql
			repositorioExecAtualizaBancoDados.Execute(objExecAtualizaBancoDados)

		Catch ex As Exception
			MessageBox.Show("Ocorreu o Erro: " & Err.Description & " - Rotina: sCriaTabelaAuxiliar" & "", "Aviso de Erro", MessageBoxButtons.OK, MessageBoxIcon.Error)
			Exit Sub
		End Try

	End Sub
End Class