Private Sub Reservar_Load(ByVal sender As System.Object, ByVal e As System.E ventArgs) Handles MyBase.Load Me.cbk_opcao.Enabled = False 'Me.btn_finalizar.Enabled = False ' Me.rbt_fechado.Enabled = False If Me.txtcodquarto.Text <> "" Then Me.btn_reservar.Enabled = False Else Me.txt_cod_reserva.Enabled = False Me.txtdatasaida.Enabled = False Me.mtbsaida.Enabled = False Me.btn_reservar.Enabled = True End If
If Me.txt_cpf.Text <> "" Then
Me.btn_verifica_quarto.Enabled = True Else Me.btn_verifica_quarto.Enabled = False End If
Me.Size = New Size(732, 300)
With Gpbacomp .Location = New System.Drawing.Point(19, 290) End With Me.dgvdisponivel.Visible = False Me.txtquarto_acomp.Text = txtnumero.Text If Me.txt_cod_reserva.Text <> "" Then Me.btn_acomp.Enabled = False Me.btn_finalizar.Enabled = True rbt_fechado.Checked = True Me.btn_hospede.Enabled = False Me.btn_verifica_quarto.Enabled = False End If End Sub Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.E ventArgs) FrmQuartos.ShowDialog() End Sub Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.E ventArgs) Handles btn_verifica_quarto.Click Dim strQuery As String = "select tbl_quartos.cod_quarto,tbl_quartos.nume ro_quarto as [NºQuarto],tbl_quartos.tipo_quarto[Andar],valor_quarto[Preço],tbl_categ orias.nome_cat as Categoia from tbl_quartos,tbl_categorias where status ='Dispon ivel' and cod_quarto not in (select cod_quarto from tbl_reservas where status='R eservado' or status='Aguardando') and tbl_quartos.cod_cat=tbl_categorias.cod_cat " Dim t As New clnbd dgvdisponivel.DataSource = t.RetornaDataSet(strQuery.ToString).Tables(0) Me.lbl_dgb.Text = "Hospede" Me.dgvdisponivel.AutoResizeColumns() Me.dgvdisponivel.AutoResizeRows() Me.Size = New Size(732, 600) With Gpbacomp .Location = New System.Drawing.Point(21, 390) End With Me.dgvdisponivel.Visible = True End Sub Private Sub dgvdisponivel_CellContentClick(ByVal sender As System.Object, By Val e As System.Windows.Forms.DataGridViewCellEventArgs) Handles dgvdisponivel.C ellContentClick If Me.cbk_opcao.Checked = False Then If Me.lbl_dgb.Text = "Hospede" Then Me.lbl_dgb.Text = "Hospede" Me.btn_reservar.Enabled = True Me.txtvalor.Text = Replace(Val(Me.dgvdisponivel.CurrentRow.Cells (3).Value), ",", ".") Me.txtnumero.Text = Me.dgvdisponivel.CurrentRow.Cells(1).Value Me.txtcodquarto.Text = Me.dgvdisponivel.CurrentRow.Cells(0).Valu e ' Me.txtcodquarto.Text= Me.dgvdisponivel.Visible = False Me.Size = New Size(732, 300) With Gpbacomp .Location = New System.Drawing.Point(19, 265) End With Me.dgvdisponivel.Visible = False Me.txtquarto_acomp.Text = txtnumero.Text Else Me.txtquarto_acomp.Text = Me.dgvdisponivel.CurrentRow.Cells(0).V alue Me.txt_nome_acomp.Text = Me.dgvdisponivel.CurrentRow.Cells(1).Va lue Me.txt_cpf_acomp.Text = Replace(Val(Me.dgvdisponivel.CurrentRow. Cells(2).Value), ",", ".") ' Me.txtvalor.Text = Replace(Val(Me.dgvdisponivel.CurrentRow.Ce lls(3).Value), ",", ".") Exit Sub Me.btn_reservar.Enabled = True Me.txtvalor.Text = Replace(Val(Me.dgvdisponivel.CurrentRow.Cells (3).Value), ",", ".") Me.txtnumero.Text = Me.dgvdisponivel.CurrentRow.Cells(1).Value Me.txtcodquarto.Text = Me.dgvdisponivel.CurrentRow.Cells(0).Valu e ' Me.txtcodquarto.Text= Me.dgvdisponivel.Visible = False Me.Size = New Size(732, 300) With Gpbacomp .Location = New System.Drawing.Point(19, 265) End With Me.dgvdisponivel.Visible = False Me.txtquarto_acomp.Text = txtnumero.Text End If Else Me.txt_nome_acomp.Text = Me.dgvdisponivel.CurrentRow.Cells(1).Value Me.txt_cpf_acomp.Text = Me.dgvdisponivel.CurrentRow.Cells(2).Value Me.txt_idade_acomp.Text = Me.dgvdisponivel.CurrentRow.Cells(3).Value Me.txt_cod_acomp.Text = Me.dgvdisponivel.CurrentRow.Cells(0).Value End If End Sub Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.E ventArgs) Handles btn_hospede.Click FrmPesquisaHosp.ShowDialog() Me.Close() End Sub
Private Sub btn_reservar_Click(ByVal sender As System.Object, ByVal e As Sys
tem.EventArgs) Handles btn_reservar.Click Me.cbk_opcao.Enabled = True Dim verificacao As String If Me.rbt_agendado.Checked = True Then verificacao = "Agendado" ElseIf Me.rbt_reservado.Checked = True Then verificacao = "Reservado" Else verificacao = "Finalizado" End If
Dim strQuery As String = "insert into tbl_reservas values('" & Me.mtbdat
aentrada.Text & "','" & Me.mtbprivesao.Text & "',''," & Me.txtvalor.Text & ",'" & verificacao & "'," & Me.txtcodhosp.Text & ",3," & Me.txtcodquarto.Text & ")" Dim t As New clnbd t.RetornaDataReader(strQuery) MsgBox("Reservado") End Sub Private Sub btn_finalizar_Click(ByVal sender As System.Object, ByVal e As Sy stem.EventArgs) Handles btn_finalizar.Click Dim verificacao As String If Me.rbt_agendado.Checked = True Then verificacao = "Agendado" ElseIf Me.rbt_reservado.Checked = True Then verificacao = "Reservado" Else verificacao = "Finalizado" End If Dim strQuery As String = "update tbl_reservas set status='" & verificaca o & "' where cod_res>0" Dim t As New clnbd t.RetornaDataReader(strQuery) MsgBox("Alterado") End Sub
Private Sub txtdataentrada_ValueChanged(ByVal sender As System.Object, ByVal
e As System.EventArgs) Handles txtdataentrada.ValueChanged Me.mtbdataentrada.Text = Me.txtdataentrada.Value End Sub Private Sub txtdataprevista_ValueChanged(ByVal sender As System.Object, ByVa l e As System.EventArgs) Handles txtdataprevista.ValueChanged Me.mtbprivesao.Text = Me.txtdataprevista.Value End Sub Private Sub txtdatasaida_ValueChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtdatasaida.ValueChanged Me.mtbsaida.Text = Me.txtdatasaida.Value End Sub Private Sub cbk_opcao_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cbk_opcao.CheckedChanged Me.dgvdisponivel.DataSource = "" If Me.cbk_opcao.Checked = True Then Me.gpb_pesquisa.Visible = True With Me.Gpbacomp .Visible = True .Location = New System.Drawing.Point(19, 450) End With With dgvdisponivel .Visible = True .Location = New System.Drawing.Point(19, 300) End With Me.Size = New Size(732, 600) Else Me.gpb_pesquisa.Visible = False With Me.Gpbacomp .Visible = False .Location = New System.Drawing.Point(19, 450) End With With dgvdisponivel .Visible = False .Location = New System.Drawing.Point(19, 300) End With Me.Size = New Size(732, 300) End If End Sub Private Sub btn_acomp_Click(ByVal sender As System.Object, ByVal e As System .EventArgs) Handles btn_acomp.Click Dim t As New clnbd Dim strQuery As String = "" If Me.cbk_opcao.Checked = True Then Me.lbl_dgb.Text = "Acompanhantes" If Me.rbt_nome_hosp.Checked = True Then strQuery = "select tbl_hospede.cod_hosp as Cod,tbl_hospede.nome_ hosp as Hospede,tbl_hospede.cpf_hosp as CPF,DATEDIFF(YEAR, data_nasc, GETDATE()) as Idade,telefone_hosp as Telefone,tbl_uf.uf as UF from tbl_hospede,tbl_uf wher e tbl_hospede.cod_uf=tbl_uf.cod_uf and nome_hosp like'" & Me.txt_buscar.Text & " %'" Else strQuery = "select tbl_hospede.cod_hosp as Cod,tbl_hospede.nome_ hosp as Hospede,tbl_hospede.cpf_hosp as CPF,DATEDIFF(YEAR, data_nasc, GETDATE()) as Idade,telefone_hosp as Telefone,tbl_uf.uf as UF from tbl_hospede,tbl_uf wher e tbl_hospede.cod_uf=tbl_uf.cod_uf and cpf_hosp='" & Me.txt_buscar.Text & "'" End If End If Me.dgvdisponivel.DataSource = t.RetornaDataSet(strQuery.ToString).Tables (0) Me.dgvdisponivel.AutoResizeColumns() Me.dgvdisponivel.AutoResizeRows() End Sub Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.E ventArgs) Handles btn_registrar.Click Dim t As New clnbd Dim total As Double Dim strQuery As String If Me.lbl_dgb.Text = "Acompanhantes" Then strQuery = "insert into detalhe_quarto values(" & Me.txt_cod_acomp.T ext & "," & Me.txtcodquarto.Text & ",'" & "10/10/2010 22:57:19 ')" 'CDate(Now( )) & " ')" acompanhantes = acompanhantes + 1 Me.lbl_total.Text = "Total de Acompanhantes " & acompanhantes Else If Me.txt_idade_acomp.Text = "" Then MessageBox.Show("Digite a Quantidade") Me.txt_idade_acomp.Focus() Exit Sub Else total = Val(Me.txt_idade_acomp.Text) * Val(Me.txt_cpf_acomp.Text ) strQuery = "insert into detalhe_reserva values(" & Replace(total , ",", ".") & "," & Me.txtquarto_acomp.Text & "," & Me.txt_cod_reserva.Text & ", " & txt_idade_acomp.Text & "," & Me.txtcodquarto.Text & ")" End If End If t.RetornaDataReader(strQuery) Me.txt_idade_acomp.Clear() Me.txt_nome_acomp.Clear() Me.txt_cpf_acomp.Clear() End Sub Private Sub btn_frigobar_Click(ByVal sender As System.Object, ByVal e As Sys tem.EventArgs) Handles btn_frigobar.Click Dim strQuery As String = "select *from tbl_produtos" Dim t As New clnbd dgvdisponivel.DataSource = t.RetornaDataSet(strQuery.ToString).Tables(0) Me.lbl_dgb.Text = "Frigobar" With dgvdisponivel .AutoResizeColumns() .AutoResizeRows() .Visible = True .Location = New System.Drawing.Point(21, 215) End With Me.Size = New Size(732, 600) With Gpbacomp .Location = New System.Drawing.Point(21, 390) End With Me.Gpbacomp.Visible = True Me.Gpbacomp.Text = "Produto Selecionado" Me.lbl_nome_acomp.Text = "Codigo" Me.lbl_cpf_acomp.Text = "Preço" Me.lbl_acomp.Text = "Produto" Me.lbl_idade_acomp.Text = "Quantidade" Me.txt_cod_acomp.Visible = False End Sub Private Sub Button1_Click_1(ByVal sender As System.Object, ByVal e As System .EventArgs) Handles Button1.Click frm_nota.Show() End Sub End Class