Option Strict Off
Option Explicit On
Imports VB = Microsoft.VisualBasic
Imports Microsoft.VisualBasic.PowerPacks
Friend Class frmConsImpOrdServ
	Inherits System.Windows.Forms.Form
	
	Private Sub MontaGridOS()
		With mfgSolServ
			.Redraw = False
			.Rows = 1
			.Cols = 19
			.FixedCols = 2
			Call .Clear()
			
			.set_ColWidth(0, 1000)
			.set_ColWidth(1, 1400)
			.set_ColWidth(2, 400)
			.set_ColWidth(3, 1300)
			.set_ColWidth(4, 1000)
			.set_ColWidth(5, 800)
			.set_ColWidth(6, 1000)
			.set_ColWidth(7, 800)
			.set_ColWidth(8, 3250)
			.set_ColWidth(9, 3250)
			.set_ColWidth(10, 3000)
			.set_ColWidth(11, 3000)
			.set_ColWidth(12, 3000)
			.set_ColWidth(13, 800)
			.set_ColWidth(14, 1150)
			.set_ColWidth(15, 700)
			
			.set_ColWidth(17, 550)
			.set_ColWidth(18, 1000)
			
			.set_TextMatrix(0, 0, "Seq.")
			.set_TextMatrix(0, 1, "Protocolo")
			.set_TextMatrix(0, 2, "Sit.")
			.set_TextMatrix(0, 3, "Identificação")
			.set_TextMatrix(0, 4, "Solicitado")
			.set_TextMatrix(0, 5, "Hora")
			.set_TextMatrix(0, 6, "Concluido")
			.set_TextMatrix(0, 7, "Hora")
			.set_TextMatrix(0, 8, "Descrição do Serviço")
			.set_TextMatrix(0, 9, "Serviço")
			.set_TextMatrix(0, 10, "Solicitante")
			.set_TextMatrix(0, 11, "Consumidor")
			.set_TextMatrix(0, 12, "Ponto Referencia")
			.set_TextMatrix(0, 13, "Prioridade")
			.set_TextMatrix(0, 14, "Feito Por")
			.set_TextMatrix(0, 15, "Região")
			.set_TextMatrix(0, 16, "Executor")
			.set_TextMatrix(0, 17, "Grupo")
			.set_TextMatrix(0, 18, "Valor (R$)")
			.Redraw = True
		End With
		System.Windows.Forms.Application.DoEvents()
	End Sub
	
	'UPGRADE_WARNING: Event chkDataConclusao.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 chkDataConclusao_CheckStateChanged(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles chkDataConclusao.CheckStateChanged
		Call LigDesCampo()
	End Sub
	
	'UPGRADE_WARNING: Event chkDataSolicitacao.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 chkDataSolicitacao_CheckStateChanged(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles chkDataSolicitacao.CheckStateChanged
		Call LigDesCampo()
	End Sub
	
	'UPGRADE_WARNING: Event chkExecutor.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 chkExecutor_CheckStateChanged(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles chkExecutor.CheckStateChanged
		Call LigDesCampo()
	End Sub
	
	'UPGRADE_WARNING: Event chkFeitoPor.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 chkFeitoPor_CheckStateChanged(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles chkFeitoPor.CheckStateChanged
		Call LigDesCampo()
	End Sub
	
	'UPGRADE_WARNING: Event chkPrioridade.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 chkPrioridade_CheckStateChanged(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles chkPrioridade.CheckStateChanged
		Call LigDesCampo()
	End Sub
	
	'UPGRADE_WARNING: Event chkProtocolo.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 chkProtocolo_CheckStateChanged(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles chkProtocolo.CheckStateChanged
		Call LigDesCampo()
	End Sub
	
	'UPGRADE_WARNING: Event chkRegiao.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 chkRegiao_CheckStateChanged(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles chkRegiao.CheckStateChanged
		Call LigDesCampo()
	End Sub
	
	'UPGRADE_WARNING: Event chkSequencia.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 chkSequencia_CheckStateChanged(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles chkSequencia.CheckStateChanged
		Call LigDesCampo()
	End Sub
	
	'UPGRADE_WARNING: Event chkSolicitante.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 chkSolicitante_CheckStateChanged(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles chkSolicitante.CheckStateChanged
		Call LigDesCampo()
	End Sub
	
	'UPGRADE_WARNING: Event chkTipoServico.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 chkTipoServico_CheckStateChanged(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles chkTipoServico.CheckStateChanged
		Call LigDesCampo()
	End Sub
	
	'UPGRADE_WARNING: Event chkZlc.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 chkZlc_CheckStateChanged(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles chkZlc.CheckStateChanged
		Call LigDesCampo()
	End Sub
	
	Private Sub cmdFiltrar_Click(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles cmdFiltrar.Click
		Dim lstrZLC As String
		Dim lstrZona As String
		Dim lstrLivro As String
		Dim lstrConta As String
		Dim lstrNomeUc As String
		Dim llngSequencia As Integer
		Dim lstrProtocolo As String
		Dim ldteSolicitacao As Date
		Dim lstrHoraSolicit As String
		Dim ldteConclusao As Date
		Dim lstrHoraConcl As String
		Dim lstrServico As String
		Dim lstrDescricao As String
		Dim lstrItens As String
		Dim lstrNomeSol As String
		Dim lstrPontoRef As String
		Dim lstrPrioridade As String
		Dim lstrFeitoPor As String
		Dim lstrRegiao As String
		Dim lstrSituacao As String
		Dim llngUnidId As Integer
		Dim lstrGrupo As String
		Dim lstrPadrao As String
		Dim llngExecutor As Integer
		Dim ldblValor As Double
		
		Dim lstrSql As String
		Dim lrstAux As ADODB.Recordset
		lrstAux = New ADODB.Recordset
		
		Call MontaGridOS()
		
		lstrSql = ""
		lstrSql = lstrSql & "   SELECT `solserv`.`zlc`, " & vbCrLf
		lstrSql = lstrSql & "          `solserv`.`cod`, " & vbCrLf
		lstrSql = lstrSql & "          `solserv`.`protocolo`, " & vbCrLf
		lstrSql = lstrSql & "          `solserv`.`data_soli`, " & vbCrLf
		lstrSql = lstrSql & "          `solserv`.`hora_soli`, " & vbCrLf
		lstrSql = lstrSql & "          `solserv`.`datasolu`, " & vbCrLf
		lstrSql = lstrSql & "          `solserv`.`horasolu`, " & vbCrLf
		lstrSql = lstrSql & "          `solserv`.`descr_serv`, " & vbCrLf
		lstrSql = lstrSql & "          `solserv`.`itensserv`, " & vbCrLf
		lstrSql = lstrSql & "          `solserv`.`nomesol`, " & vbCrLf
		lstrSql = lstrSql & "          `solserv`.`ponto_refer`, " & vbCrLf
		lstrSql = lstrSql & "          `solserv`.`prioridade`, " & vbCrLf
		lstrSql = lstrSql & "          `solserv`.`solicit_meio`, " & vbCrLf
		lstrSql = lstrSql & "          `solserv`.`zona_solic`, " & vbCrLf
		lstrSql = lstrSql & "          `solserv`.`sit`, " & vbCrLf
		lstrSql = lstrSql & "          `solserv`.`unid_id`, " & vbCrLf
		lstrSql = lstrSql & "          `solserv`.`unid`, " & vbCrLf
		lstrSql = lstrSql & "          `solserv`.`padrao`, " & vbCrLf
		lstrSql = lstrSql & "          `solserv`.`cod_executor`, " & vbCrLf
		lstrSql = lstrSql & "          `codigos`.`descri`, " & vbCrLf
		lstrSql = lstrSql & "   IFNULL(`unidb`.`nome`,  IFNULL(`unida`.`nome`,  '')) AS `nomeuc`, " & vbCrLf
		lstrSql = lstrSql & "   IFNULL(`unidb`.`zona`,  IFNULL(`unida`.`zona`,  '999')) AS `zonauc`, " & vbCrLf
		lstrSql = lstrSql & "   IFNULL(`unidb`.`livro`, IFNULL(`unida`.`livro`, '99')) AS `livrouc`, " & vbCrLf
		lstrSql = lstrSql & "   IFNULL(`unidb`.`conta`, IFNULL(`unida`.`conta`, '999999')) AS `contauc` " & vbCrLf
		lstrSql = lstrSql & "     FROM `solserv` " & vbCrLf
		lstrSql = lstrSql & "LEFT JOIN `codigos` ON(`codigos`.`num` = LEFT(`solserv`.`itensserv`,10)) " & vbCrLf
		lstrSql = lstrSql & "LEFT JOIN `unidb` ON(`unidb`.`unid_id` = `solserv`.`unid_id` AND `solserv`.`unid` = 'B') " & vbCrLf
		lstrSql = lstrSql & "LEFT JOIN `unida` ON(`unida`.`unid_id` = `solserv`.`unid_id` AND `solserv`.`unid` = 'A') "
		Call Conectar(lstrSql, lrstAux)
		With lrstAux
			If .State > 0 Then
				If .RecordCount > 0 Then
					Me.mfgSolServ.Redraw = False
					While Not .EOF
						'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"'
						lstrZLC = VB6.Format(Trim(IIf(IsDbNull(.Fields("zlc").value), "0", .Fields("zlc").value)), "00000000000")
						lstrZLC = VB.Left(lstrZLC, 3) & "." & Mid(lstrZLC, 4, 2) & "." & VB.Right(lstrZLC, 6)
						
						'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"'
						lstrNomeUc = Trim(IIf(IsDbNull(.Fields("nomeuc").value), "", .Fields("nomeuc").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"'
						lstrZona = VB6.Format(Trim(IIf(IsDbNull(.Fields("zonauc").value), "0", .Fields("zonauc").value)), "000")
						'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"'
						lstrLivro = VB6.Format(Trim(IIf(IsDbNull(.Fields("livrouc").value), "0", .Fields("livrouc").value)), "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"'
						lstrConta = VB6.Format(Trim(IIf(IsDbNull(.Fields("contauc").value), "0", .Fields("contauc").value)), "000000")
						
						lstrZLC = lstrZona & "." & lstrLivro & "." & lstrConta
						
						'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"'
						llngSequencia = CInt(IIf(IsDbNull(.Fields("cod").value), 0, .Fields("cod").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"'
						lstrProtocolo = Trim(IIf(IsDbNull(.Fields("protocolo").value), "", .Fields("protocolo").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"'
						ldteSolicitacao = CDate(IIf(IsDbNull(.Fields("data_soli").value), "1900-01-01", .Fields("data_soli").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"'
						lstrHoraSolicit = VB6.Format(Trim(IIf(IsDbNull(.Fields("hora_soli").value), "1900-01-01 00:00:00", .Fields("hora_soli").value)), "hh:mm:ss")
						'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"'
						ldteConclusao = CDate(IIf(IsDbNull(.Fields("datasolu").value), "1900-01-01", .Fields("datasolu").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"'
						lstrHoraConcl = VB6.Format(Trim(IIf(IsDbNull(.Fields("horasolu").value), "1900-01-01 00:00:00", .Fields("horasolu").value)), "hh:mm:ss")
						'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"'
						lstrServico = Trim(IIf(IsDbNull(.Fields("descr_serv").value), "", .Fields("descr_serv").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"'
						lstrDescricao = Trim(IIf(IsDbNull(.Fields("descri").value), "", .Fields("descri").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"'
						lstrItens = Trim(IIf(IsDbNull(.Fields("itensserv").value), "", .Fields("itensserv").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"'
						lstrNomeSol = Trim(IIf(IsDbNull(.Fields("nomesol").value), "", .Fields("nomesol").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"'
						lstrPontoRef = Trim(IIf(IsDbNull(.Fields("ponto_refer").value), "", .Fields("ponto_refer").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"'
						lstrPrioridade = Trim(IIf(IsDbNull(.Fields("prioridade").value), "N", .Fields("prioridade").value))
						lstrPrioridade = IIf(lstrPrioridade = "N", "Normal", "Urgente")
						'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"'
						lstrFeitoPor = Trim(IIf(IsDbNull(.Fields("solicit_meio").value), "P", .Fields("solicit_meio").value))
						'UPGRADE_WARNING: Couldn't resolve default property of object Switch(). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
						lstrFeitoPor = VB.Switch(lstrFeitoPor = "P", "Pessoalmente", lstrFeitoPor = "F", "Fone", lstrFeitoPor = "E", "E-Mail", lstrFeitoPor = "S", "Site", lstrFeitoPor = "O", "Outro")
						'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"'
						lstrRegiao = Trim(IIf(IsDbNull(.Fields("zona_solic").value), "U", .Fields("zona_solic").value))
						lstrRegiao = IIf(lstrRegiao = "U", "Urbana", "Rural")
						'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"'
						lstrSituacao = Trim(IIf(IsDbNull(.Fields("sit").value), "A", .Fields("sit").value))
						'UPGRADE_WARNING: Couldn't resolve default property of object Switch(). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
						lstrSituacao = VB.Switch(lstrSituacao = "F", "Fin.", lstrSituacao = "A", "Abr.", lstrSituacao = "C", "Can.")
						'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"'
						llngUnidId = CInt(IIf(IsDbNull(.Fields("unid_id").value), 0, .Fields("unid_id").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"'
						lstrGrupo = Trim(IIf(IsDbNull(.Fields("unid").value), "B", .Fields("unid").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"'
						lstrPadrao = Trim(IIf(IsDbNull(.Fields("padrao").value), "Padrão", .Fields("padrao").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"'
						llngExecutor = CInt(IIf(IsDbNull(.Fields("cod_executor").value), 0, .Fields("cod_executor").value))
						ldblValor = CDbl(Mid(lstrItens, InStr(1, lstrItens, "?") + 1, InStr(InStr(1, lstrItens, "?") + 1, lstrItens, ";") - (InStr(1, lstrItens, "?") + 1)))
						
						With Me.mfgSolServ
							.Rows = .Rows + 1
							.set_TextMatrix(.Rows - 1, 0, llngSequencia)
							.set_TextMatrix(.Rows - 1, 1, lstrProtocolo)
							.set_TextMatrix(.Rows - 1, 2, lstrSituacao)
							.set_TextMatrix(.Rows - 1, 3, lstrZLC)
							.set_TextMatrix(.Rows - 1, 4, ldteSolicitacao)
							.set_TextMatrix(.Rows - 1, 5, lstrHoraSolicit)
							.set_TextMatrix(.Rows - 1, 6, ldteConclusao)
							.set_TextMatrix(.Rows - 1, 7, lstrHoraConcl)
							.set_TextMatrix(.Rows - 1, 8, lstrServico)
							.set_TextMatrix(.Rows - 1, 9, lstrDescricao)
							
							.set_TextMatrix(.Rows - 1, 10, lstrNomeSol)
							.set_TextMatrix(.Rows - 1, 11, lstrNomeUc)
							.set_TextMatrix(.Rows - 1, 12, lstrPontoRef)
							.set_TextMatrix(.Rows - 1, 13, lstrPrioridade)
							.set_TextMatrix(.Rows - 1, 14, lstrFeitoPor)
							.set_TextMatrix(.Rows - 1, 15, lstrRegiao)
							.set_TextMatrix(.Rows - 1, 16, llngExecutor)
							.set_TextMatrix(.Rows - 1, 17, lstrGrupo)
							.set_TextMatrix(.Rows - 1, 18, VB6.Format(ldblValor, "Standard"))
						End With
						Call .MoveNext()
						System.Windows.Forms.Application.DoEvents()
					End While
					Me.mfgSolServ.Redraw = True
				End If
				Call .Close()
			End If
		End With
	End Sub
	
	Private Sub frmConsImpOrdServ_Load(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles MyBase.Load
		Me.Icon = FrmAtPrincipal.Icon
		Call MontaGridOS()
		Call EncheTipoServicos()
		Call CarregaTabelaComboBox((Me.cmbExecutor), "`executor`", "`descricao`", "`cod`", "`descricao` ASC", "")
		Me.cmbPrioridade.SelectedIndex = 0
		Me.cmbRegiao.SelectedIndex = 0
		Me.cmbFeitoPor.SelectedIndex = 0
		Call LigDesCampo()
		Me.dtpSolicitacaoIni.value = BuscaDataBD
		'UPGRADE_WARNING: Couldn't resolve default property of object Me.dtpSolicitacaoIni.value. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
		Me.dtpSolicitacaoFim.value = Me.dtpSolicitacaoIni.value
		'UPGRADE_WARNING: Couldn't resolve default property of object Me.dtpSolicitacaoIni.value. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
		Me.dtpConclusaoIni.value = Me.dtpSolicitacaoIni.value
		'UPGRADE_WARNING: Couldn't resolve default property of object Me.dtpConclusaoIni.value. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
		Me.dtpConclusaoFim.value = Me.dtpConclusaoIni.value
	End Sub
	
	Private Sub EncheTipoServicos()
		Dim lstrCodigo As String
		Dim lstrDescri As String
		Dim lstrSql As String
		Dim lrstConsulta As ADODB.Recordset
		lrstConsulta = New ADODB.Recordset
		With Me.lvsServico
			Call .Items.Clear()
			If .Columns.Count <= 1 Then
				Call .Columns.Add("", "Descrição", CInt(VB6.TwipsToPixelsX(3500)))
				Call .Columns.Add("", "Código", CInt(VB6.TwipsToPixelsX(0)))
			End If
			Call .Items.Add("Marcar Todos")
			'UPGRADE_WARNING: Lower bound of collection Me.lvsServico.ListItems has changed from 1 to 0. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="A3B628A0-A810-4AE2-BFA2-9E7A29EB9AD0"'
			Call .Items.Item(.Items.Count).SubItems.Add("0000000000")
		End With
		'UPGRADE_WARNING: Lower bound of collection Me.lvsServico.ListItems has changed from 1 to 0. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="A3B628A0-A810-4AE2-BFA2-9E7A29EB9AD0"'
		Me.lvsServico.Items.Item(1).Checked = True
		lstrSql = lstrSql & "SELECT `codigos`.`num`, "
		lstrSql = lstrSql & "       `codigos`.`descri` "
		lstrSql = lstrSql & "  FROM `codigos` "
		lstrSql = lstrSql & " WHERE LEFT(`codigos`.`num`, 4) IN('9040','9050') "
		lstrSql = lstrSql & "   AND RIGHT(`codigos`.`num`, 1) <> '0' "
		lstrSql = lstrSql & "   AND `situacao` = 'A' AND `flgproc` = 'O' "
		lstrSql = lstrSql & " GROUP BY `descri` "
		lstrSql = lstrSql & "ORDER BY `num` ASC, `descri` ASC "
		Call Conectar(lstrSql, lrstConsulta)
		With lrstConsulta
			If .State > 0 Then
				If .RecordCount > 0 Then
					While Not .EOF
						'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"'
						lstrCodigo = IIf(IsDbNull(.Fields("num").value), "0", .Fields("num").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"'
						lstrDescri = IIf(IsDbNull(.Fields("descri").value), "", .Fields("descri").value)
						With Me.lvsServico
							Call .Items.Add(lstrDescri)
							'UPGRADE_WARNING: Lower bound of collection Me.lvsServico.ListItems has changed from 1 to 0. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="A3B628A0-A810-4AE2-BFA2-9E7A29EB9AD0"'
							Call .Items.Item(.Items.Count).SubItems.Add(lstrCodigo)
							'UPGRADE_WARNING: Lower bound of collection Me.lvsServico.ListItems has changed from 1 to 0. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="A3B628A0-A810-4AE2-BFA2-9E7A29EB9AD0"'
							.Items.Item(.Items.Count).Checked = True
						End With
						Call .MoveNext()
					End While
				End If
				Call .Close()
			End If
		End With
		'UPGRADE_NOTE: Object lrstConsulta 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"'
		lrstConsulta = Nothing
	End Sub
	
	Private Sub LigDesCampo()
		With Me.cmbExecutor
			.Enabled = (Me.chkExecutor.CheckState = 1)
			.BackColor = System.Drawing.ColorTranslator.FromOle(IIf(.Enabled = True, &H80000005, &H8000000F))
		End With
		With Me.txtSolicitante
			.Enabled = (Me.chkSolicitante.CheckState = 1)
			.BackColor = System.Drawing.ColorTranslator.FromOle(IIf(.Enabled = True, &H80000005, &H8000000F))
		End With
		With Me.txtProtocolo
			.Enabled = (Me.chkProtocolo.CheckState = 1)
			.BackColor = System.Drawing.ColorTranslator.FromOle(IIf(.Enabled = True, &H80000005, &H8000000F))
		End With
		With Me.cmbPrioridade
			.Enabled = (Me.chkPrioridade.CheckState = 1)
			.BackColor = System.Drawing.ColorTranslator.FromOle(IIf(.Enabled = True, &H80000005, &H8000000F))
		End With
		With Me.cmbFeitoPor
			.Enabled = (Me.chkFeitoPor.CheckState = 1)
			.BackColor = System.Drawing.ColorTranslator.FromOle(IIf(.Enabled = True, &H80000005, &H8000000F))
		End With
		With Me.cmbRegiao
			.Enabled = (Me.chkRegiao.CheckState = 1)
			.BackColor = System.Drawing.ColorTranslator.FromOle(IIf(.Enabled = True, &H80000005, &H8000000F))
		End With
		Me.dtpSolicitacaoIni.Enabled = (Me.chkDataSolicitacao.CheckState = 1)
		Me.dtpSolicitacaoFim.Enabled = (Me.chkDataSolicitacao.CheckState = 1)
		Me.dtpConclusaoIni.Enabled = (Me.chkDataConclusao.CheckState = 1)
		Me.dtpConclusaoFim.Enabled = (Me.chkDataConclusao.CheckState = 1)
		With Me.txtSequenciaIni
			.Enabled = (Me.chkSequencia.CheckState = 1)
			.BackColor = System.Drawing.ColorTranslator.FromOle(IIf(.Enabled = True, &H80000005, &H8000000F))
		End With
		With Me.txtSequenciaFim
			.Enabled = (Me.chkSequencia.CheckState = 1)
			.BackColor = System.Drawing.ColorTranslator.FromOle(IIf(.Enabled = True, &H80000005, &H8000000F))
		End With
		With Me.txtZona
			.Enabled = (Me.chkZLC.CheckState = 1)
			.BackColor = System.Drawing.ColorTranslator.FromOle(IIf(.Enabled = True, &H80000005, &H8000000F))
		End With
		With Me.txtLivro
			.Enabled = (Me.chkZLC.CheckState = 1)
			.BackColor = System.Drawing.ColorTranslator.FromOle(IIf(.Enabled = True, &H80000005, &H8000000F))
		End With
		With Me.txtConta
			.Enabled = (Me.chkZLC.CheckState = 1)
			.BackColor = System.Drawing.ColorTranslator.FromOle(IIf(.Enabled = True, &H80000005, &H8000000F))
		End With
		Me.cmdBusca.Enabled = (Me.chkZLC.CheckState = 1)
		Me.lvsServico.Enabled = (Me.chkTipoServico.CheckState = 1)
	End Sub
	
	Private Sub lvsServico_ItemCheck(ByVal eventSender As System.Object, ByVal eventArgs As System.Windows.Forms.ItemCheckEventArgs) Handles lvsServico.ItemCheck
		Dim Item As System.Windows.Forms.ListViewItem = lvsServico.Items(eventArgs.Index)
		Dim lintConta As Short
		With Me.lvsServico
			If Item.Text = "Marcar Todos" Then
				'UPGRADE_WARNING: Lower bound of collection Me.lvsServico.ListItems has changed from 1 to 0. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="A3B628A0-A810-4AE2-BFA2-9E7A29EB9AD0"'
				If .Items.Item(1).Checked = True Then
					For lintConta = 1 To .Items.Count
						'UPGRADE_WARNING: Lower bound of collection Me.lvsServico.ListItems has changed from 1 to 0. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="A3B628A0-A810-4AE2-BFA2-9E7A29EB9AD0"'
						.Items.Item(lintConta).Checked = True
					Next lintConta
					'UPGRADE_WARNING: Lower bound of collection Me.lvsServico.ListItems has changed from 1 to 0. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="A3B628A0-A810-4AE2-BFA2-9E7A29EB9AD0"'
				ElseIf .Items.Item(1).Checked = False Then 
					For lintConta = 1 To .Items.Count
						'UPGRADE_WARNING: Lower bound of collection Me.lvsServico.ListItems has changed from 1 to 0. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="A3B628A0-A810-4AE2-BFA2-9E7A29EB9AD0"'
						.Items.Item(lintConta).Checked = False
					Next lintConta
				End If
			Else
				If Item.Checked = False Then
					'UPGRADE_WARNING: Lower bound of collection Me.lvsServico.ListItems has changed from 1 to 0. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="A3B628A0-A810-4AE2-BFA2-9E7A29EB9AD0"'
					.Items.Item(1).Checked = False
				End If
			End If
		End With
	End Sub
End Class