Option Strict Off
Option Explicit On
Imports VB = Microsoft.VisualBasic
Friend Class frmVisSituacaoUnidadesConsumidoras
	Inherits System.Windows.Forms.Form
	
	Private Sub MontaGradeSituacaoUnidadesConsumidoras()
		With Me.mfgLigadasSemMedidor
			.Rows = 1
			Call .Clear()
			.set_ColWidth(0, 650)
			.set_ColWidth(1, 650)
			.set_ColWidth(2, 500)
			.set_ColWidth(3, 800)
			.set_ColWidth(4, 4000)
			.set_ColWidth(5, 1000)
			.set_ColWidth(6, 700)
			.set_ColWidth(7, 600)
			.set_ColWidth(8, 1000)
			.set_ColWidth(9, 600)
			.set_ColWidth(10, 0)
			.set_ColWidth(11, 0)
			.set_ColAlignment(0, MSFlexGridLib.AlignmentSettings.flexAlignRightCenter)
			.set_ColAlignment(1, MSFlexGridLib.AlignmentSettings.flexAlignCenterCenter)
			.set_ColAlignment(2, MSFlexGridLib.AlignmentSettings.flexAlignCenterCenter)
			.set_ColAlignment(3, MSFlexGridLib.AlignmentSettings.flexAlignCenterCenter)
			.set_ColAlignment(4, MSFlexGridLib.AlignmentSettings.flexAlignLeftCenter)
			.set_ColAlignment(5, MSFlexGridLib.AlignmentSettings.flexAlignCenterCenter)
			.set_ColAlignment(6, MSFlexGridLib.AlignmentSettings.flexAlignCenterCenter)
			.set_ColAlignment(7, MSFlexGridLib.AlignmentSettings.flexAlignCenterCenter)
			.set_ColAlignment(8, MSFlexGridLib.AlignmentSettings.flexAlignCenterCenter)
			.set_ColAlignment(9, MSFlexGridLib.AlignmentSettings.flexAlignRightCenter)
			.set_ColAlignment(10, MSFlexGridLib.AlignmentSettings.flexAlignRightCenter)
			.set_TextMatrix(0, 0, "Seq.")
			.set_TextMatrix(0, 1, "Zona")
			.set_TextMatrix(0, 2, "Livro")
			.set_TextMatrix(0, 3, "Conta")
			.set_TextMatrix(0, 4, "Nome")
			.set_TextMatrix(0, 5, "Situação")
			.set_TextMatrix(0, 6, "Medidor")
			.set_TextMatrix(0, 7, "Ramal")
			.set_TextMatrix(0, 8, "Situação")
			.set_TextMatrix(0, 9, "Dias")
			.set_TextMatrix(0, 10, "Regra")
			.set_TextMatrix(0, 11, "Ordenação")
		End With
	End Sub
	
	Private Sub PopulaGradeSituacaoUnidadesConsumidoras()
		Dim llngReg As Integer
		Dim ldteLig As Date
		Dim ldteDes As Date
		Dim ldteEnt As Date
		Dim ldteSus As Date
		Dim llngDia As Integer
		Dim lstrDte As String
		Dim lstrZon As String
		Dim lstrLiv As String
		Dim lstrCon As String
		Dim lstrNom As String
		Dim lstrSit As String
		Dim llngMed As Integer
		Dim lstrMed As String
		Dim lstrRam As String
		Dim lstrSql As String
		Dim lrstAux As ADODB.Recordset
		lrstAux = New ADODB.Recordset
		Me.Cursor = System.Windows.Forms.Cursors.WaitCursor
		Call MontaGradeSituacaoUnidadesConsumidoras()
		lstrSql = ""
		lstrSql = lstrSql & "SELECT `id`, `grupo`, `cons_id`, `unid_id`, `zona`, `livro`, `conta`, `nome`, `situacao`, `idmedidor`, `medidor`, `ramal`, "
		lstrSql = lstrSql & "       `dt_corte`,`dt_desligamento`,`dt_entrada`,`dt_ligacao`,`dt_religacao`,`dt_ramal`"
		lstrSql = lstrSql & "  FROM `unidade_consumidora` "
		lstrSql = lstrSql & " WHERE "
		If Me.chkMedidor.CheckState = System.Windows.Forms.CheckState.Checked Then
			lstrSql = lstrSql & " `idmedidor` > 0 "
			lstrSql = lstrSql & " AND ((`situacao` = 'C' AND IFNULL(`dt_corte`,sysdate()) <= '" & VB6.Format(Me.txtDtBase.Text, "yyyy-MM-dd") & "') OR "
			lstrSql = lstrSql & "      (`situacao` IN('D','I') AND IFNULL(`dt_desligamento`,sysdate()) <= '" & VB6.Format(Me.txtDtBase.Text, "yyyy-MM-dd") & "'))"
		Else
			lstrSql = lstrSql & "        ((`situacao` = 'L' AND (`idmedidor` = 0 OR `medidor` = '') AND (`dt_ligacao` <= '" & VB6.Format(Me.txtDtBase.Text, "yyyy-MM-dd") & "' AND `dt_entrada` <= '" & VB6.Format(Me.txtDtBase.Text, "yyyy-MM-dd") & "'))) OR "
			'lstrSql = lstrSql & "        (`situacao` = 'L' AND (`idmedidor` = 0 OR `medidor` = '') AND (`dt_entrada` <= '" & Strings.Format(Me.txtDtBase.Text, "yyyy-MM-dd") & "')) OR "
			lstrSql = lstrSql & "        (`situacao` = 'C' AND (`idmedidor` = 0 OR `medidor` = '') AND (`dt_corte` <= '" & VB6.Format(Me.txtDtBase.Text, "yyyy-MM-dd") & "'))  OR "
			lstrSql = lstrSql & "        (`situacao` IN('D','I') AND (`idmedidor` > 0 OR (`medidor` <> '' AND `medidor` <> '0')) AND (`dt_desligamento` <= '" & VB6.Format(Me.txtDtBase.Text, "yyyy-MM-dd") & "')) OR "
			lstrSql = lstrSql & "        (`situacao` IN('D','I') AND `ramal` = 'S' AND (`dt_desligamento` <= '" & VB6.Format(Me.txtDtBase.Text, "yyyy-MM-dd") & "'))) "
		End If
		Call Conectar(lstrSql, lrstAux)
		With lrstAux
			If .State = ADODB.ObjectStateEnum.adStateOpen Then
				If .RecordCount > 0 Then
					Me.mfgLigadasSemMedidor.Redraw = False
					While Not .EOF
						llngReg = 0
						'UPGRADE_WARNING: Use of Null/IsNull() detected. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="2EED02CB-5C0E-4DC1-AE94-4FAA3A30F51A"'
						ldteLig = IIf(IsDbNull(.Fields("dt_ligacao").value), "1900-01-01", .Fields("dt_ligacao").value)
						'UPGRADE_WARNING: Use of Null/IsNull() detected. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="2EED02CB-5C0E-4DC1-AE94-4FAA3A30F51A"'
						ldteDes = IIf(IsDbNull(.Fields("dt_desligamento").value), "1900-01-01", .Fields("dt_desligamento").value)
						'UPGRADE_WARNING: Use of Null/IsNull() detected. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="2EED02CB-5C0E-4DC1-AE94-4FAA3A30F51A"'
						ldteEnt = IIf(IsDbNull(.Fields("dt_entrada").value), "1900-01-01", .Fields("dt_entrada").value)
						'UPGRADE_WARNING: Use of Null/IsNull() detected. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="2EED02CB-5C0E-4DC1-AE94-4FAA3A30F51A"'
						ldteSus = IIf(IsDbNull(.Fields("dt_corte").value), "1900-01-01", .Fields("dt_corte").value)
						'UPGRADE_WARNING: Use of Null/IsNull() detected. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="2EED02CB-5C0E-4DC1-AE94-4FAA3A30F51A"'
						lstrZon = IIf(IsDbNull(.Fields("zona").value), "", .Fields("zona").value)
						'UPGRADE_WARNING: Use of Null/IsNull() detected. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="2EED02CB-5C0E-4DC1-AE94-4FAA3A30F51A"'
						lstrLiv = IIf(IsDbNull(.Fields("livro").value), "", .Fields("livro").value)
						'UPGRADE_WARNING: Use of Null/IsNull() detected. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="2EED02CB-5C0E-4DC1-AE94-4FAA3A30F51A"'
						lstrCon = IIf(IsDbNull(.Fields("conta").value), "", .Fields("conta").value)
						'UPGRADE_WARNING: Use of Null/IsNull() detected. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="2EED02CB-5C0E-4DC1-AE94-4FAA3A30F51A"'
						lstrNom = IIf(IsDbNull(.Fields("nome").value), "", .Fields("nome").value)
						'UPGRADE_WARNING: Use of Null/IsNull() detected. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="2EED02CB-5C0E-4DC1-AE94-4FAA3A30F51A"'
						lstrSit = IIf(IsDbNull(.Fields("situacao").value), "N", .Fields("situacao").value)
						'UPGRADE_WARNING: Use of Null/IsNull() detected. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="2EED02CB-5C0E-4DC1-AE94-4FAA3A30F51A"'
						llngMed = CInt(IIf(IsDbNull(.Fields("idmedidor").value), 0, .Fields("idmedidor").value))
						'UPGRADE_WARNING: Use of Null/IsNull() detected. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="2EED02CB-5C0E-4DC1-AE94-4FAA3A30F51A"'
						lstrMed = IIf(IsDbNull(.Fields("medidor").value), "", .Fields("medidor").value)
						'UPGRADE_WARNING: Use of Null/IsNull() detected. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="2EED02CB-5C0E-4DC1-AE94-4FAA3A30F51A"'
						lstrRam = IIf(IsDbNull(.Fields("ramal").value), "N", .Fields("ramal").value)
						lstrRam = IIf(lstrRam = "S", "Sim", "Não")
						If llngMed <> 0 Then
							lstrMed = "Sim"
						ElseIf lstrMed <> "0" And lstrMed <> "" Then 
							lstrMed = "Sim"
						Else
							lstrMed = "Não"
						End If
						If lstrSit = "L" Or lstrSit = "C" Then
							If lstrMed = "Não" Then
								llngReg = 1
							End If
						End If
						If lstrSit = "D" Or lstrSit = "I" Or lstrSit = "C" Then
							If lstrMed = "Sim" Then
								llngReg = 2
							ElseIf lstrRam = "Sim" Then 
								llngReg = 3
							End If
						Else
							llngReg = 0
						End If
						Select Case lstrSit
							Case Is = "L"
								lstrSit = "Ligado"
								If ldteLig >= ldteEnt Then
									If ldteLig = CDate("01/01/1900") Then
										lstrDte = ""
										llngDia = 0
									Else
										lstrDte = VB6.Format(ldteLig, "dd/mm/yyyy")
										'UPGRADE_WARNING: DateDiff behavior may be different. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6B38EC3F-686D-4B2E-B5A5-9E8E7A762E32"'
										llngDia = DateDiff(Microsoft.VisualBasic.DateInterval.Day, ldteLig, CDate(Me.txtDtBase.Text))
									End If
								Else
									If ldteEnt = CDate("01/01/1900") Then
										lstrDte = ""
										llngDia = 0
									Else
										lstrDte = VB6.Format(ldteEnt, "dd/mm/yyyy")
										'UPGRADE_WARNING: DateDiff behavior may be different. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6B38EC3F-686D-4B2E-B5A5-9E8E7A762E32"'
										llngDia = DateDiff(Microsoft.VisualBasic.DateInterval.Day, ldteEnt, CDate(Me.txtDtBase.Text))
									End If
								End If
							Case Is = "C"
								lstrSit = "Suspendido"
								If ldteSus = CDate("01/01/1900") Then
									lstrDte = ""
									llngDia = 0
								Else
									lstrDte = VB6.Format(ldteSus, "dd/mm/yyyy")
									'UPGRADE_WARNING: DateDiff behavior may be different. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6B38EC3F-686D-4B2E-B5A5-9E8E7A762E32"'
									llngDia = DateDiff(Microsoft.VisualBasic.DateInterval.Day, ldteSus, CDate(Me.txtDtBase.Text))
								End If
							Case Is = "D"
								lstrSit = "Desligado"
								If ldteDes = CDate("01/01/1900") Then
									lstrDte = ""
									llngDia = 0
								Else
									lstrDte = VB6.Format(ldteDes, "dd/mm/yyyy")
									'UPGRADE_WARNING: DateDiff behavior may be different. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6B38EC3F-686D-4B2E-B5A5-9E8E7A762E32"'
									llngDia = DateDiff(Microsoft.VisualBasic.DateInterval.Day, ldteDes, CDate(Me.txtDtBase.Text))
								End If
							Case Is = "I"
								lstrSit = "Desativado"
								If ldteDes = CDate("01/01/1900") Then
									lstrDte = ""
									llngDia = 0
								Else
									lstrDte = VB6.Format(ldteDes, "dd/mm/yyyy")
									'UPGRADE_WARNING: DateDiff behavior may be different. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6B38EC3F-686D-4B2E-B5A5-9E8E7A762E32"'
									llngDia = DateDiff(Microsoft.VisualBasic.DateInterval.Day, ldteDes, CDate(Me.txtDtBase.Text))
								End If
							Case Else
								lstrSit = "Não Ligado"
								lstrDte = ""
								llngDia = 0
						End Select
						If llngReg > 0 Then
							With Me.mfgLigadasSemMedidor
								.Rows = .Rows + 1
								.set_TextMatrix(.Rows - 1, 0, .Rows - 1)
								.set_TextMatrix(.Rows - 1, 1, lstrZon)
								.set_TextMatrix(.Rows - 1, 2, lstrLiv)
								.set_TextMatrix(.Rows - 1, 3, lstrCon)
								.set_TextMatrix(.Rows - 1, 4, lstrNom)
								.set_TextMatrix(.Rows - 1, 5, lstrSit)
								.set_TextMatrix(.Rows - 1, 6, lstrMed)
								.set_TextMatrix(.Rows - 1, 7, "")
								.set_TextMatrix(.Rows - 1, 8, lstrDte)
								.set_TextMatrix(.Rows - 1, 9, llngDia)
								.set_TextMatrix(.Rows - 1, 10, llngReg)
								.set_TextMatrix(.Rows - 1, 11, llngReg & llngDia)
							End With
						End If
						Call .MoveNext()
					End While
					With Me.mfgLigadasSemMedidor
						.Col = 11
						.Sort = MSFlexGridLib.SortSettings.flexSortGenericAscending
						For llngReg = 1 To .Rows - 1
							.set_TextMatrix(llngReg, 0, llngReg)
						Next llngReg
						.Redraw = True
					End With
				End If
				Call .Close()
			End If
		End With
		'UPGRADE_NOTE: Object lrstAux may not be destroyed until it is garbage collected. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6E35BFF6-CD74-4B09-9689-3E1A43DF8969"'
		lrstAux = Nothing
		Me.Cursor = System.Windows.Forms.Cursors.Default
	End Sub
	
	'UPGRADE_WARNING: Event cmbMeses.TextChanged may fire when form is initialized. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="88B12AE1-6DE0-48A0-86F1-60C0686C026A"'
	'UPGRADE_WARNING: ComboBox event cmbMeses.Change was upgraded to cmbMeses.TextChanged which has a new behavior. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="DFCDE711-9694-47D7-9C50-45A99CD8E91E"'
	Private Sub cmbMeses_TextChanged(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles cmbMeses.TextChanged
		Call cmbMeses_SelectedIndexChanged(cmbMeses, New System.EventArgs())
	End Sub
	
	'UPGRADE_WARNING: Event cmbMeses.SelectedIndexChanged may fire when form is initialized. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="88B12AE1-6DE0-48A0-86F1-60C0686C026A"'
	Private Sub cmbMeses_SelectedIndexChanged(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles cmbMeses.SelectedIndexChanged
		Dim lintAux As Short
		Dim ldteBase As Date
		Dim ldteAux As Date
		Dim lintDia As Short
		ldteBase = BuscaDataBD
		ldteAux = CDate("01/" & VB6.Format(ldteBase, "mm/yyyy"))
		For lintAux = 1 To VB6.GetItemData(Me.cmbMeses, Me.cmbMeses.SelectedIndex)
			ldteAux = System.Date.FromOADate(ldteAux.ToOADate - 1)
			ldteAux = CDate("01/" & VB6.Format(ldteAux, "mm/yyyy"))
		Next lintAux
		lintDia = UltimoDiaMes(Month(ldteAux), Year(ldteAux))
		If VB.Day(ldteBase) > lintDia Then
			ldteAux = CDate(lintDia & "/" & VB6.Format(ldteAux, "mm/yyyy"))
		Else
			ldteAux = CDate(VB.Day(ldteBase) & "/" & VB6.Format(ldteAux, "mm/yyyy"))
		End If
		Me.txtDtBase.Text = VB6.Format(ldteAux, "dd/mm/yyyy")
	End Sub
	
	Private Sub cmdFechar_Click(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles cmdFechar.Click
		Call Me.Close()
	End Sub
	
	Private Sub cmdImprimir_Click(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles cmdImprimir.Click
		Dim lstrSql As String
		Dim llngRow As Integer
		Call Executar("DELETE FROM temp_vissituacaounidadesconsumidoras WHERE nomemaquina = '" & gstrNmEstacao & gstrUsuario_Login & "'")
		With Me.mfgLigadasSemMedidor
			If .Rows > 1 Then
				lstrSql = ""
				lstrSql = lstrSql & "INSERT INTO temp_vissituacaounidadesconsumidoras "
				lstrSql = lstrSql & " (`nomemaquina`, `zona`, `livro`, `conta`, `nome`, `situacao`, `medidor`, `ramal`, `dtsituacao`, `dias`) VALUES "
				For llngRow = 1 To .Rows - 1
					lstrSql = lstrSql & "("
					lstrSql = lstrSql & "'" & gstrNmEstacao & gstrUsuario_Login & "', "
					lstrSql = lstrSql & "'" & Replace(.get_TextMatrix(llngRow, 1), "'", "\'") & "', "
					lstrSql = lstrSql & "'" & Replace(.get_TextMatrix(llngRow, 2), "'", "\'") & "', "
					lstrSql = lstrSql & "'" & Replace(.get_TextMatrix(llngRow, 3), "'", "\'") & "', "
					lstrSql = lstrSql & "'" & Replace(.get_TextMatrix(llngRow, 4), "'", "\'") & "', "
					lstrSql = lstrSql & "'" & Replace(.get_TextMatrix(llngRow, 5), "'", "\'") & "', "
					lstrSql = lstrSql & "'" & Replace(.get_TextMatrix(llngRow, 6), "'", "\'") & "', "
					lstrSql = lstrSql & "'" & Replace(.get_TextMatrix(llngRow, 7), "'", "\'") & "', "
					lstrSql = lstrSql & "'" & VB6.Format(.get_TextMatrix(llngRow, 8), "yyyy-MM-dd") & "', "
					lstrSql = lstrSql & Replace(.get_TextMatrix(llngRow, 9), "'", "\'") & "),"
				Next llngRow
				If Executar(VB.Left(lstrSql, CInt(Len(lstrSql)) - 1)) Then
					
					With Me.crpVisSitUC
						.ReportFileName = My.Application.Info.DirectoryPath & "\" & LeConfig("DIR_RPT") & "RelVisSituacaoUC.rpt"
						.DiscardSavedData = True
						.WindowState = Crystal.WindowStateConstants.crptMaximized
						.WindowControlBox = True
						.WindowControls = True
						.WindowShowPrintSetupBtn = True
						.WindowShowCloseBtn = True
						.WindowShowSearchBtn = True
						.SelectionFormula = "{temp_vissituacaounidadesconsumidoras.nomemaquina} = """ & gstrNmEstacao & gstrUsuario_Login & """"
						.WindowTitle = "Relatório de Situação das Unidades Consumidoras"
						.Destination = Crystal.DestinationConstants.crptToWindow
						.set_Formulas(1, "F_Titulo = """ & "Listagem da situação das unidades consumidoras em: " & VB6.Format(BuscaDataBD, "dd/mm/yyyy") & """ ")
						.Action = 0
					End With
				End If
			End If
		End With
	End Sub
	
	Private Sub cmdLocalizar_Click(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles cmdLocalizar.Click
		Call PopulaGradeSituacaoUnidadesConsumidoras()
	End Sub
	
	Private Sub frmVisSituacaoUnidadesConsumidoras_Load(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles MyBase.Load
		Dim lintAux As Short
		Dim lstrSql As String
		Call CenterForm(Me)
		Call MontaGradeSituacaoUnidadesConsumidoras()
		With Me.cmbMeses
			Call .Items.Clear()
			For lintAux = 1 To 12
				Call .Items.Add(VB6.Format(lintAux, "00"))
				'UPGRADE_ISSUE: ComboBox property cmbMeses.NewIndex was not upgraded. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="F649E068-7137-45E5-AC20-4D80A3CC70AC"'
				VB6.SetItemData(Me.cmbMeses, Me.cmbMeses.NewIndex, lintAux)
			Next lintAux
			.SelectedIndex = 2
		End With
		Call cmbMeses_SelectedIndexChanged(cmbMeses, New System.EventArgs())
		lstrSql = ""
		lstrSql = lstrSql & "CREATE TABLE IF NOT EXISTS `temp_vissituacaounidadesconsumidoras` " & vbCrLf
		lstrSql = lstrSql & "(" & vbCrLf
		lstrSql = lstrSql & "   `nomemaquina` varchar(255) default '000',    " & vbCrLf
		lstrSql = lstrSql & "   `zona`        varchar(3)   default '000',    " & vbCrLf
		lstrSql = lstrSql & "   `livro`       varchar(2)   default '00',     " & vbCrLf
		lstrSql = lstrSql & "   `conta`       varchar(6)   default '000000', " & vbCrLf
		lstrSql = lstrSql & "   `nome`        varchar(85)  default '',       " & vbCrLf
		lstrSql = lstrSql & "   `situacao`    varchar(10)  default '',       " & vbCrLf
		lstrSql = lstrSql & "   `medidor`     char(3)  default '',           " & vbCrLf
		lstrSql = lstrSql & "   `ramal`       char(3)  default '',           " & vbCrLf
		lstrSql = lstrSql & "   `dtsituacao`  date default '0000-00-00',     " & vbCrLf
		lstrSql = lstrSql & "   `dias`        int(11) DEFAULT '0'            " & vbCrLf
		lstrSql = lstrSql & ")"
		Call Executar(lstrSql)
		
	End Sub
	
	Private Sub frmVisSituacaoUnidadesConsumidoras_FormClosed(ByVal eventSender As System.Object, ByVal eventArgs As System.Windows.Forms.FormClosedEventArgs) Handles Me.FormClosed
		Call Executar("DELETE FROM temp_vissituacaounidadesconsumidoras WHERE `nomemaquina` = '" & gstrNmEstacao & gstrUsuario_Login & "' ")
	End Sub
End Class