Option Strict Off
Option Explicit On
Friend Class frmCadClassificacaoTipos
	Inherits System.Windows.Forms.Form
	Private ifrmQuemChama As System.Windows.Forms.Form
	Private ifrmLocalizar As frmLocalizadorGeral
	Private iblnNovo As Boolean
	
	'UPGRADE_WARNING: Event chkSituacaoCortado.CheckStateChanged 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 chkSituacaoCortado_CheckStateChanged(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles chkSituacaoCortado.CheckStateChanged
		If Me.chkSituacaoDesligado.CheckState = 0 And Me.chkSituacaoLigado.CheckState = 0 And Me.chkSituacaoDesativado.CheckState = 0 And Me.chkSituacaoNaoLigado.CheckState = 0 Then
			Me.chkSituacaoCortado.CheckState = System.Windows.Forms.CheckState.Checked
		End If
	End Sub
	
	'UPGRADE_WARNING: Event chkSituacaoDesativado.CheckStateChanged 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 chkSituacaoDesativado_CheckStateChanged(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles chkSituacaoDesativado.CheckStateChanged
		If Me.chkSituacaoDesligado.CheckState = 0 And Me.chkSituacaoLigado.CheckState = 0 And Me.chkSituacaoCortado.CheckState = 0 And Me.chkSituacaoNaoLigado.CheckState = 0 Then
			Me.chkSituacaoDesativado.CheckState = System.Windows.Forms.CheckState.Checked
		End If
	End Sub
	
	'UPGRADE_WARNING: Event chkSituacaoDesligado.CheckStateChanged 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 chkSituacaoDesligado_CheckStateChanged(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles chkSituacaoDesligado.CheckStateChanged
		If Me.chkSituacaoCortado.CheckState = 0 And Me.chkSituacaoLigado.CheckState = 0 And Me.chkSituacaoDesativado.CheckState = 0 And Me.chkSituacaoNaoLigado.CheckState = 0 Then
			Me.chkSituacaoDesligado.CheckState = System.Windows.Forms.CheckState.Checked
		End If
	End Sub
	
	'UPGRADE_WARNING: Event chkSituacaoLigado.CheckStateChanged 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 chkSituacaoLigado_CheckStateChanged(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles chkSituacaoLigado.CheckStateChanged
		If Me.chkSituacaoCortado.CheckState = 0 And Me.chkSituacaoDesligado.CheckState = 0 And Me.chkSituacaoDesativado.CheckState = 0 And Me.chkSituacaoNaoLigado.CheckState = 0 Then
			Me.chkSituacaoLigado.CheckState = System.Windows.Forms.CheckState.Checked
		End If
	End Sub
	
	'UPGRADE_WARNING: Event chkSituacaoNaoLigado.CheckStateChanged 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 chkSituacaoNaoLigado_CheckStateChanged(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles chkSituacaoNaoLigado.CheckStateChanged
		If Me.chkSituacaoDesligado.CheckState = 0 And Me.chkSituacaoLigado.CheckState = 0 And Me.chkSituacaoCortado.CheckState = 0 And Me.chkSituacaoDesativado.CheckState = 0 Then
			Me.chkSituacaoNaoLigado.CheckState = System.Windows.Forms.CheckState.Checked
		End If
	End Sub
	
	Private Sub cmdExcluir_Click(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles cmdExcluir.Click
		If Trim(Me.txtId.Text) <> "0" Then
			If MsgBox("Deseja realmente excluir este registro!", MsgBoxStyle.YesNo + MsgBoxStyle.DefaultButton2, gstrTituloMensagem) = MsgBoxResult.Yes Then
				If Executar("DELETE FROM `atend_com_cla_det` WHERE `atend_com_cla_det`.`id` = " & CInt(Me.txtId.Text) & " AND `atend_com_cla_det`.`idatend_com_cla_gru` = " & CInt(Me.txtIdAtendComClaGru.Text)) Then
					Call Executar("OPTIMIZE TABLE `atend_com_cla_det`")
					Call LimpaCampos()
					Call MsgBox("Registro eliminado!", MsgBoxStyle.Information, gstrTituloMensagem)
				Else
					If MsgBox("Deseja desativar este registro!", MsgBoxStyle.YesNo + MsgBoxStyle.DefaultButton2, gstrTituloMensagem) = MsgBoxResult.Yes Then
						Call Executar("UPDATE `atend_com_cla_det` SET `situacao` = 'Inativo' WHERE `atend_com_cla_det`.`id` = " & CInt(Me.txtId.Text) & " AND `atend_com_cla_det`.`idatend_com_cla_gru` = " & CInt(Me.txtIdAtendComClaGru.Text))
						Call SetaCodigo("atend_com_cla_det", CInt(Me.txtId.Text), CInt(Me.txtIdAtendComClaGru.Text))
					End If
				End If
			End If
		End If
	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 cmdLocalizar_Click(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles cmdLocalizar.Click
		Call ifrmLocalizar.Show()
		Call ifrmLocalizar.SetParametros("atend_com_cla_det", "Classificação Tipos", Me, "ORDER BY `idatend_com_cla_gru` ASC, `id` ASC ")
	End Sub
	
	Private Sub cmdLocalizarAtendComClaGru_Click(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles cmdLocalizarAtendComClaGru.Click
		Call ifrmLocalizar.Show()
		Call ifrmLocalizar.SetParametros("atend_com_cla_gru", "Classificação Grupos", Me)
	End Sub
	
	Private Sub cmdNovo_Click(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles cmdNovo.Click
		iblnNovo = True
		Call LimpaCampos()
	End Sub
	
	Private Sub cmdSalvar_Click(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles cmdSalvar.Click
		Dim lstrAux As String
		Dim lstrSql As String
		Dim lrstAux As ADODB.Recordset
		lrstAux = New ADODB.Recordset
		
		lstrSql = ""
		If Me.txtId.Text = "0" Or iblnNovo Then
			lstrSql = lstrSql & "INSERT INTO " & vbCrLf
		Else
			lstrSql = lstrSql & "UPDATE " & vbCrLf
		End If
		lstrSql = lstrSql & "       `atend_com_cla_det` SET "
		lstrSql = lstrSql & "       `idatend_com_cla_gru` = " & CInt(Me.txtIdAtendComClaGru.Text) & ", " & vbCrLf
		lstrSql = lstrSql & "       `descricao`  = '" & Replace(Trim(Me.txtDescricao.Text), "'", "\'") & "', " & vbCrLf
		lstrSql = lstrSql & "       `prazo_horas_urbano` = " & Replace(Me.txtPrazoHorasUrbano.Text, ",", ".") & ", " & vbCrLf
		lstrSql = lstrSql & "       `prazo_horas_nao_urbano` = " & Replace(Me.txtPrazoHorasNaoUrbano.Text, ",", ".") & ", " & vbCrLf
		lstrSql = lstrSql & "       `prazo_horas_urgente_urbano` = " & Replace(Me.txtPrazoHorasUrgenteUrbano.Text, ",", ".") & ", " & vbCrLf
		lstrSql = lstrSql & "       `prazo_horas_urgente_nao_urbano` = " & Replace(Me.txtPrazoHorasUrgenteNaoUrbano.Text, ",", ".") & ", " & vbCrLf
		lstrSql = lstrSql & "       `dias_horas_uteis` = " & IIf(Me.chkDiasHorasUteis.CheckState = 0, 0, 1) & ", " & vbCrLf
		lstrSql = lstrSql & "       `nivel_gravidade` = " & VB6.GetItemData(Me.cmbNivelGravidade, Me.cmbNivelGravidade.SelectedIndex) & ", " & vbCrLf
		lstrAux = ""
		lstrAux = lstrAux & IIf(Me.chkSituacaoLigado.CheckState = 0, "L", "")
		lstrAux = lstrAux & IIf(Me.chkSituacaoCortado.CheckState = 0, "C", "")
		lstrAux = lstrAux & IIf(Me.chkSituacaoDesligado.CheckState = 0, "D", "")
		lstrAux = lstrAux & IIf(Me.chkSituacaoDesativado.CheckState = 0, "I", "")
		lstrAux = lstrAux & IIf(Me.chkSituacaoNaoLigado.CheckState = 0, "N", "")
		lstrSql = lstrSql & "       `regra_situacao` = '" & lstrAux & "', " & vbCrLf
		lstrSql = lstrSql & "       `regra_croqui` = " & IIf(Me.chkMedicaoCroqui.CheckState = 0, 0, 1) & ", " & vbCrLf
		lstrSql = lstrSql & "       `regra_medidor` = " & IIf(Me.chkMedicaoMedidor.CheckState = 0, 0, 1) & ", " & vbCrLf
		lstrSql = lstrSql & "       `regra_ramal` = " & IIf(Me.chkMedicaoRamal.CheckState = 0, 0, 1) & ", " & vbCrLf
		lstrSql = lstrSql & "       `regra_verificamedidor` = " & IIf(Me.chkMedicaoVerifica.CheckState = 0, 0, 1) & ", " & vbCrLf
		lstrSql = lstrSql & "       `situacao`   = 'Ativo', " & vbCrLf
		lstrSql = lstrSql & "       `idusuarios` = " & glngUsuario_Id & " "
		If Not iblnNovo And Me.txtId.Text <> "0" Then
			lstrSql = lstrSql & " WHERE `atend_com_cla_det`.`id` = " & CInt(Me.txtId.Text)
			lstrSql = lstrSql & "   AND `atend_com_cla_det`.`idatend_com_cla_gru` = " & CInt(Me.txtIdAtendComClaGru.Text)
		End If
		If Executar(lstrSql) Then
			If Me.txtId.Text = "0" Or iblnNovo Then
				Call Conectar("SELECT LAST_INSERT_ID() ", lrstAux)
				With lrstAux
					If .State = ADODB.ObjectStateEnum.adStateOpen Then
						If .RecordCount > 0 Then
							'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"'
							Me.txtId.Text = CStr(CInt(IIf(IsDbNull(.Fields(0).value), 0, .Fields(0).value)))
						End If
						Call .Close()
					End If
				End With
			End If
			Call SetaCodigo("atend_com_cla_det", CInt(Me.txtId.Text), CInt(Me.txtIdAtendComClaGru.Text))
			Call MsgBox("As informações foram salvas com sucesso.", MsgBoxStyle.Information, gstrTituloMensagem)
		Else
			Call MsgBox("Problema na gravação, favor verificar!", MsgBoxStyle.Exclamation, gstrTituloMensagem)
		End If
		'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
	End Sub
	
	Private Sub frmCadClassificacaoTipos_Load(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles MyBase.Load
		Call CenterForm(Me)
		ifrmLocalizar = New frmLocalizadorGeral
		Call LimpaCampos()
	End Sub
	
	Private Sub frmCadClassificacaoTipos_KeyPress(ByVal eventSender As System.Object, ByVal eventArgs As System.Windows.Forms.KeyPressEventArgs) Handles MyBase.KeyPress
		Dim KeyAscii As Short = Asc(eventArgs.KeyChar)
		If KeyAscii = System.Windows.Forms.Keys.Escape Then
			Call cmdFechar_Click(cmdFechar, New System.EventArgs())
		ElseIf KeyAscii = System.Windows.Forms.Keys.Return Then 
			Call SendKeysA(System.Windows.Forms.Keys.Tab, True)
		End If
		eventArgs.KeyChar = Chr(KeyAscii)
		If KeyAscii = 0 Then
			eventArgs.Handled = True
		End If
	End Sub
	
	Private Sub frmCadClassificacaoTipos_FormClosed(ByVal eventSender As System.Object, ByVal eventArgs As System.Windows.Forms.FormClosedEventArgs) Handles Me.FormClosed
		If ifrmQuemChama Is Nothing Then
			'
		Else
			ifrmQuemChama.Enabled = True
		End If
	End Sub
	
	Public Sub SetaCodigo(ByVal astrTabela As String, ByVal alngId_A As Integer, Optional ByVal alngId_B As Integer = 0, Optional ByVal alngId_C As Integer = 0, Optional ByVal alngId_D As Integer = 0)
		Dim lstrAux As String
		Dim lintAux As Short
		Dim lintNiG As Short
		Dim lstrSql As String
		Dim lrstAux As ADODB.Recordset
		lrstAux = New ADODB.Recordset
		If ValidaView(astrTabela) Then
			astrTabela = Mid(astrTabela, 3)
		End If
		If alngId_A > 0 Then
			lstrAux = ""
			lstrSql = ""
			lstrSql = lstrSql & "SELECT * " & vbCrLf
			lstrSql = lstrSql & "  FROM `" & astrTabela & "` " & vbCrLf
			lstrSql = lstrSql & " WHERE `id` = " & alngId_A & " " & vbCrLf
			If alngId_B > 0 Then
				lstrSql = lstrSql & "   AND `idatend_com_cla_gru` = " & alngId_B
			End If
			Call Conectar(lstrSql, lrstAux)
			With lrstAux
				If .State = ADODB.ObjectStateEnum.adStateOpen Then
					If .RecordCount > 0 Then
						If LCase(Mid(Me.txtIdAtendComClaGru.Name, 6)) = LCase(Replace(astrTabela, "_", "")) Then
							'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"'
							Me.txtIdAtendComClaGru.Text = VB6.Format(CInt(IIf(IsDbNull(.Fields("id").value), 0, .Fields("id").value)), "#,##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"'
							Me.txtDsAtendComClaGru.Text = Trim(IIf(IsDbNull(.Fields("descricao").value), "", .Fields("descricao").value))
						Else
							'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"'
							Me.txtId.Text = VB6.Format(CInt(IIf(IsDbNull(.Fields("id").value), 0, .Fields("id").value)), "#,##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"'
							Me.txtIdAtendComClaGru.Text = VB6.Format(CInt(IIf(IsDbNull(.Fields("idatend_com_cla_gru").value), 0, .Fields("idatend_com_cla_gru").value)), "#,##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"'
							Me.txtDescricao.Text = Trim(IIf(IsDbNull(.Fields("descricao").value), "", .Fields("descricao").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"'
							Me.txtPrazoHorasUrbano.Text = VB6.Format(CInt(IIf(IsDbNull(.Fields("prazo_horas_urbano").value), 0, .Fields("prazo_horas_urbano").value)), "#,##0.00")
							'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"'
							Me.txtPrazoHorasNaoUrbano.Text = VB6.Format(CInt(IIf(IsDbNull(.Fields("prazo_horas_nao_urbano").value), 0, .Fields("prazo_horas_nao_urbano").value)), "#,##0.00")
							'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"'
							Me.txtPrazoHorasUrgenteUrbano.Text = VB6.Format(CInt(IIf(IsDbNull(.Fields("prazo_horas_urgente_urbano").value), 0, .Fields("prazo_horas_urgente_urbano").value)), "#,##0.00")
							'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"'
							Me.txtPrazoHorasUrgenteNaoUrbano.Text = VB6.Format(CInt(IIf(IsDbNull(.Fields("prazo_horas_urgente_nao_urbano").value), 0, .Fields("prazo_horas_urgente_nao_urbano").value)), "#,##0.00")
							'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"'
							Me.chkDiasHorasUteis.CheckState = CShort(IIf(IsDbNull(.Fields("dias_horas_uteis").value), 0, .Fields("dias_horas_uteis").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"'
							lintNiG = CShort(IIf(IsDbNull(.Fields("nivel_gravidade").value), 0, .Fields("nivel_gravidade").value))
							With Me.cmbNivelGravidade
								For lintAux = 0 To .Items.Count - 1
									If CShort(VB6.GetItemData(Me.cmbNivelGravidade, lintAux)) = lintNiG Then
										.SelectedIndex = lintAux
										lintAux = .Items.Count - 1
									End If
								Next lintAux
							End With
							'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"'
							lstrAux = Trim(IIf(IsDbNull(.Fields("regra_situacao").value), "L", .Fields("regra_situacao").value))
							Me.chkSituacaoLigado.CheckState = IIf(InStr(1, lstrAux, "L") > 0, 1, 0)
							Me.chkSituacaoCortado.CheckState = IIf(InStr(1, lstrAux, "C") > 0, 1, 0)
							Me.chkSituacaoDesligado.CheckState = IIf(InStr(1, lstrAux, "D") > 0, 1, 0)
							Me.chkSituacaoDesativado.CheckState = IIf(InStr(1, lstrAux, "I") > 0, 1, 0)
							Me.chkSituacaoNaoLigado.CheckState = IIf(InStr(1, lstrAux, "N") > 0, 1, 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"'
							Me.chkMedicaoCroqui.CheckState = CShort(IIf(IsDbNull(.Fields("regra_croqui").value), 0, .Fields("regra_croqui").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"'
							Me.chkMedicaoMedidor.CheckState = CShort(IIf(IsDbNull(.Fields("regra_medidor").value), 0, .Fields("regra_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"'
							Me.chkMedicaoRamal.CheckState = CShort(IIf(IsDbNull(.Fields("regra_ramal").value), 0, .Fields("regra_ramal").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"'
							Me.chkMedicaoVerifica.CheckState = CShort(IIf(IsDbNull(.Fields("regra_verificamedidor").value), 0, .Fields("regra_verificamedidor").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"'
							Me.lblSituacao.Text = "Situação: " & Trim(IIf(IsDbNull(.Fields("situacao").value), "Ativo", .Fields("situacao").value)) & "  -  último acesso: " & BuscaNomeUsuario(CInt(IIf(IsDbNull(.Fields("idusuarios").value), 0, .Fields("idusuarios").value)))
							iblnNovo = False
							Call txtIdAtendComClaGru_Leave(txtIdAtendComClaGru, New System.EventArgs())
							Call LigDesCamposAutomatico()
							If Me.txtDescricao.Enabled Then
								Call Me.txtDescricao.Focus()
							End If
						End If
					Else
						Call MsgBox("Não foi possível encontrar o registro!", MsgBoxStyle.Exclamation, gstrTituloMensagem)
					End If
					Call .Close()
				End If
			End With
		End If
		'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
	End Sub
	
	Private Sub LimpaCampos()
		Me.txtId.Text = "0"
		Me.txtIdAtendComClaGru.Text = "0"
		Me.txtDsAtendComClaGru.Text = ""
		Me.txtDescricao.Text = ""
		Me.txtPrazoHorasUrbano.Text = "0,00"
		Me.txtPrazoHorasNaoUrbano.Text = "0,00"
		Me.txtPrazoHorasUrgenteUrbano.Text = "0,00"
		Me.txtPrazoHorasUrgenteNaoUrbano.Text = "0,00"
		Me.chkDiasHorasUteis.CheckState = System.Windows.Forms.CheckState.Unchecked
		Me.cmbNivelGravidade.SelectedIndex = 1
		Me.chkSituacaoLigado.CheckState = System.Windows.Forms.CheckState.Checked
		Me.chkSituacaoCortado.CheckState = System.Windows.Forms.CheckState.Checked
		Me.chkSituacaoDesligado.CheckState = System.Windows.Forms.CheckState.Checked
		Me.chkSituacaoDesativado.CheckState = System.Windows.Forms.CheckState.Checked
		Me.chkSituacaoNaoLigado.CheckState = System.Windows.Forms.CheckState.Checked
		Me.chkMedicaoCroqui.CheckState = System.Windows.Forms.CheckState.Unchecked
		Me.chkMedicaoMedidor.CheckState = System.Windows.Forms.CheckState.Unchecked
		Me.chkMedicaoRamal.CheckState = System.Windows.Forms.CheckState.Unchecked
		Me.chkMedicaoVerifica.CheckState = System.Windows.Forms.CheckState.Unchecked
		Me.lblSituacao.Text = ""
	End Sub
	
	Private Sub LigDesCamposAutomatico()
		Me.txtIdAtendComClaGru.Enabled = (CInt(IIf(IsNumeric(Me.txtIdAtendComClaGru.Text), Me.txtIdAtendComClaGru.Text, 0)) >= 1000)
		Me.cmdLocalizarAtendComClaGru.Enabled = (CInt(IIf(IsNumeric(Me.txtIdAtendComClaGru.Text), Me.txtIdAtendComClaGru.Text, 0)) >= 1000)
		Me.txtDescricao.Enabled = (CInt(IIf(IsNumeric(Me.txtIdAtendComClaGru.Text), Me.txtIdAtendComClaGru.Text, 0)) >= 1000)
	End Sub
	Private Sub txtDescricao_Enter(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles txtDescricao.Enter
		With Me.txtDescricao
			.SelectionStart = 0
			.SelectionLength = Len(.Text)
		End With
	End Sub
	
	Public Sub SetaParametros(ByRef afrmQuemChama As System.Windows.Forms.Form)
		ifrmQuemChama = afrmQuemChama
		ifrmQuemChama.Enabled = False
	End Sub
	
	Private Sub txtDescricao_Leave(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles txtDescricao.Leave
		'  With Me.txtDescricao
		'    .Text = Strings.UCase(.Text)
		'  End With
	End Sub
	
	Private Sub txtIdAtendComClaGru_Enter(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles txtIdAtendComClaGru.Enter
		With Me.txtIdAtendComClaGru
			.Text = Replace(.Text, ".", "")
			.SelectionStart = 0
			.SelectionLength = Len(.Text)
		End With
	End Sub
	
	Private Sub txtIdAtendComClaGru_KeyPress(ByVal eventSender As System.Object, ByVal eventArgs As System.Windows.Forms.KeyPressEventArgs) Handles txtIdAtendComClaGru.KeyPress
		Dim KeyAscii As Short = Asc(eventArgs.KeyChar)
		If KeyAscii = System.Windows.Forms.Keys.Return Then
			Call SendKeysA(System.Windows.Forms.Keys.Tab, True)
		ElseIf KeyAscii <> System.Windows.Forms.Keys.Back And (KeyAscii < System.Windows.Forms.Keys.D0 Or KeyAscii > System.Windows.Forms.Keys.D9) Then 
			KeyAscii = 0
		End If
		eventArgs.KeyChar = Chr(KeyAscii)
		If KeyAscii = 0 Then
			eventArgs.Handled = True
		End If
	End Sub
	
	Private Sub txtIdAtendComClaGru_Leave(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles txtIdAtendComClaGru.Leave
		With Me.txtIdAtendComClaGru
			If IsNumeric(.Text) Then
				Call SetaCodigo("atend_com_cla_gru", CInt(.Text))
				'UPGRADE_WARNING: Couldn't resolve default property of object Interaction.IIf(). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				.Text = VB6.Format(IIf(Len(.Text) = 0, 0, .Text), "#,##0")
			Else
				Me.txtDsAtendComClaGru.Text = ""
			End If
		End With
	End Sub
	
	Private Sub txtPrazoHorasUrbano_Enter(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles txtPrazoHorasUrbano.Enter
		With Me.txtPrazoHorasUrbano
			.Text = Replace(.Text, ".", "")
			.SelectionStart = 0
			.SelectionLength = Len(.Text)
		End With
	End Sub
	
	Private Sub txtPrazoHorasUrbano_KeyPress(ByVal eventSender As System.Object, ByVal eventArgs As System.Windows.Forms.KeyPressEventArgs) Handles txtPrazoHorasUrbano.KeyPress
		Dim KeyAscii As Short = Asc(eventArgs.KeyChar)
		If KeyAscii = System.Windows.Forms.Keys.Return Then
			Call SendKeysA(System.Windows.Forms.Keys.Tab, True)
		ElseIf KeyAscii <> System.Windows.Forms.Keys.Back And (KeyAscii < System.Windows.Forms.Keys.D0 Or KeyAscii > System.Windows.Forms.Keys.D9) Then 
			If KeyAscii = System.Windows.Forms.Keys.Delete Then
				KeyAscii = System.Windows.Forms.Keys.Snapshot
			End If
			If KeyAscii <> System.Windows.Forms.Keys.Snapshot Then
				KeyAscii = 0
			Else
				If InStr(1, Me.txtPrazoHorasUrbano.Text, ",") > 0 Then
					KeyAscii = 0
				End If
			End If
		End If
		eventArgs.KeyChar = Chr(KeyAscii)
		If KeyAscii = 0 Then
			eventArgs.Handled = True
		End If
	End Sub
	
	Private Sub txtPrazoHorasUrbano_Leave(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles txtPrazoHorasUrbano.Leave
		With Me.txtPrazoHorasUrbano
			If IsNumeric(.Text) Then
				'UPGRADE_WARNING: Couldn't resolve default property of object Interaction.IIf(). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				.Text = VB6.Format(IIf(Len(.Text) = 0, 0, .Text), "#,##0.00")
			End If
		End With
	End Sub
	
	Private Sub txtPrazoHorasNaoUrbano_Enter(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles txtPrazoHorasNaoUrbano.Enter
		With Me.txtPrazoHorasNaoUrbano
			.Text = Replace(.Text, ".", "")
			.SelectionStart = 0
			.SelectionLength = Len(.Text)
		End With
	End Sub
	
	Private Sub txtPrazoHorasNaoUrbano_KeyPress(ByVal eventSender As System.Object, ByVal eventArgs As System.Windows.Forms.KeyPressEventArgs) Handles txtPrazoHorasNaoUrbano.KeyPress
		Dim KeyAscii As Short = Asc(eventArgs.KeyChar)
		If KeyAscii = System.Windows.Forms.Keys.Return Then
			Call SendKeysA(System.Windows.Forms.Keys.Tab, True)
		ElseIf KeyAscii <> System.Windows.Forms.Keys.Back And (KeyAscii < System.Windows.Forms.Keys.D0 Or KeyAscii > System.Windows.Forms.Keys.D9) Then 
			If KeyAscii = System.Windows.Forms.Keys.Delete Then
				KeyAscii = System.Windows.Forms.Keys.Snapshot
			End If
			If KeyAscii <> System.Windows.Forms.Keys.Snapshot Then
				KeyAscii = 0
			Else
				If InStr(1, Me.txtPrazoHorasNaoUrbano.Text, ",") > 0 Then
					KeyAscii = 0
				End If
			End If
		End If
		eventArgs.KeyChar = Chr(KeyAscii)
		If KeyAscii = 0 Then
			eventArgs.Handled = True
		End If
	End Sub
	
	Private Sub txtPrazoHorasNaoUrbano_Leave(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles txtPrazoHorasNaoUrbano.Leave
		With Me.txtPrazoHorasNaoUrbano
			If IsNumeric(.Text) Then
				'UPGRADE_WARNING: Couldn't resolve default property of object Interaction.IIf(). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				.Text = VB6.Format(IIf(Len(.Text) = 0, 0, .Text), "#,##0.00")
			End If
		End With
	End Sub
	
	Private Sub txtPrazoHorasUrgenteUrbano_Enter(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles txtPrazoHorasUrgenteUrbano.Enter
		With Me.txtPrazoHorasUrgenteUrbano
			.Text = Replace(.Text, ".", "")
			.SelectionStart = 0
			.SelectionLength = Len(.Text)
		End With
	End Sub
	
	Private Sub txtPrazoHorasUrgenteUrbano_KeyPress(ByVal eventSender As System.Object, ByVal eventArgs As System.Windows.Forms.KeyPressEventArgs) Handles txtPrazoHorasUrgenteUrbano.KeyPress
		Dim KeyAscii As Short = Asc(eventArgs.KeyChar)
		If KeyAscii = System.Windows.Forms.Keys.Return Then
			Call SendKeysA(System.Windows.Forms.Keys.Tab, True)
		ElseIf KeyAscii <> System.Windows.Forms.Keys.Back And (KeyAscii < System.Windows.Forms.Keys.D0 Or KeyAscii > System.Windows.Forms.Keys.D9) Then 
			If KeyAscii = System.Windows.Forms.Keys.Delete Then
				KeyAscii = System.Windows.Forms.Keys.Snapshot
			End If
			If KeyAscii <> System.Windows.Forms.Keys.Snapshot Then
				KeyAscii = 0
			Else
				If InStr(1, Me.txtPrazoHorasUrgenteUrbano.Text, ",") > 0 Then
					KeyAscii = 0
				End If
			End If
		End If
		eventArgs.KeyChar = Chr(KeyAscii)
		If KeyAscii = 0 Then
			eventArgs.Handled = True
		End If
	End Sub
	
	Private Sub txtPrazoHorasUrgenteUrbano_Leave(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles txtPrazoHorasUrgenteUrbano.Leave
		With Me.txtPrazoHorasUrgenteUrbano
			If IsNumeric(.Text) Then
				'UPGRADE_WARNING: Couldn't resolve default property of object Interaction.IIf(). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				.Text = VB6.Format(IIf(Len(.Text) = 0, 0, .Text), "#,##0.00")
			End If
		End With
	End Sub
	
	Private Sub txtPrazoHorasUrgenteNaoUrbano_Enter(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles txtPrazoHorasUrgenteNaoUrbano.Enter
		With Me.txtPrazoHorasUrgenteNaoUrbano
			.Text = Replace(.Text, ".", "")
			.SelectionStart = 0
			.SelectionLength = Len(.Text)
		End With
	End Sub
	
	Private Sub txtPrazoHorasUrgenteNaoUrbano_KeyPress(ByVal eventSender As System.Object, ByVal eventArgs As System.Windows.Forms.KeyPressEventArgs) Handles txtPrazoHorasUrgenteNaoUrbano.KeyPress
		Dim KeyAscii As Short = Asc(eventArgs.KeyChar)
		If KeyAscii = System.Windows.Forms.Keys.Return Then
			Call SendKeysA(System.Windows.Forms.Keys.Tab, True)
		ElseIf KeyAscii <> System.Windows.Forms.Keys.Back And (KeyAscii < System.Windows.Forms.Keys.D0 Or KeyAscii > System.Windows.Forms.Keys.D9) Then 
			If KeyAscii = System.Windows.Forms.Keys.Delete Then
				KeyAscii = System.Windows.Forms.Keys.Snapshot
			End If
			If KeyAscii <> System.Windows.Forms.Keys.Snapshot Then
				KeyAscii = 0
			Else
				If InStr(1, Me.txtPrazoHorasUrgenteNaoUrbano.Text, ",") > 0 Then
					KeyAscii = 0
				End If
			End If
		End If
		eventArgs.KeyChar = Chr(KeyAscii)
		If KeyAscii = 0 Then
			eventArgs.Handled = True
		End If
	End Sub
	
	Private Sub txtPrazoHorasUrgenteNaoUrbano_Leave(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles txtPrazoHorasUrgenteNaoUrbano.Leave
		With Me.txtPrazoHorasUrgenteNaoUrbano
			If IsNumeric(.Text) Then
				'UPGRADE_WARNING: Couldn't resolve default property of object Interaction.IIf(). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				.Text = VB6.Format(IIf(Len(.Text) = 0, 0, .Text), "#,##0.00")
			End If
		End With
	End Sub
End Class