⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 frm_bill.vb

📁 application file which contains the notes on Ado.net
💻 VB
📖 第 1 页 / 共 4 页
字号:
        End If
    End Function
    '  Function checkcard(ByVal pCardNumber As String) As Boolean
    '  Dim CharPos As Integer
    '  Dim CheckSum As Integer
    ' Dim tChar As String
    'Dim IsValidCreditCardNumber As Boolean
    '
    '       For CharPos = Len(pCardNumber) To 2 Step -2
    '          CheckSum = CheckSum + CInt(Mid(pCardNumber, CharPos, 1))
    '         tChar = CStr((Mid(pCardNumber, CharPos - 1, 1)) * 2)
    '        CheckSum = CheckSum + CInt(Left(tChar, 1))
    '
    '           If Len(tChar) > 1 Then CheckSum = CheckSum + CInt(Right(tChar, 1))
    '      Next
    '
    '       If Len(pCardNumber) Mod 2 = 1 Then CheckSum = CheckSum + CInt(Left(pCardNumber, 1))
    '
    '       If CheckSum Mod 10 = 0 Then
    '          IsValidCreditCardNumber = True
    '     Else
    '        IsValidCreditCardNumber = False
    '   End If
    'End Function
    Private Sub frm_bill_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        dbset.Clear()
        MyConnection.Open()
        MyCommand = New OleDbCommand("Select * FROM Accounts", MyConnection)
        dataA = New OleDbDataAdapter(MyCommand)
        dataA.Fill(dbset, "Accounts")
        'DataGrid1.ReadOnly = True
        'DataGrid1.DataSource = dbset.Tables("Accounts")
        MyCommand = New OleDbCommand("Select * from Rooms", MyConnection)
        MyReader = MyCommand.ExecuteReader()
        While MyReader.Read
            ComboBox1.Items.Add(MyReader("roomno"))
        End While
        MyReader.Close()
        MyCommand.dispose()
        MyCommand = New OleDbCommand("SELECT * FROM Physicians", MyConnection)
        MyReader = MyCommand.ExecuteReader()
        While MyReader.Read
            ComboBox3.Items.Add(MyReader("phycode"))
        End While
        MyConnection.Close()
        MyReader.Close()
        MyCommand.Dispose()
        dataA.Dispose()
        dbset.Dispose()

        'keeping for safe keeping
        '        MyConnection2.Open()
        '       MyCommand = New OleDbCommand("SELECT * FROM Rooms", MyConnection2)
        '      MyReader = MyCommand.ExecuteReader()
        '     While MyReader.Read
        '    ComboBox1.Items.Add(MyReader("roomno"))
        '   End While
        '  MyConnection2.Close()
        ' MyReader.Close()
        ' MyCommand2.dispose()

    End Sub
    Private Sub Button7_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button7.Click
        ListBox1.Items.Clear()
        ' Dim num As Integer
        'num = num.Parse(TextBox6.Text)
        'TextBox1.Text = num
        MyConnection.Open()
        MyCommand = New OleDbCommand("SELECT * FROM Accounts WHERE slip ='" & TextBox6.Text & "'", MyConnection)
        MyReader = MyCommand.ExecuteReader()
        While MyReader.Read
            ListBox1.Items.Add(MyReader("addfee"))
            TextBox7.Text = MyReader("addfee")
            ListBox1.Items.Add(" ")
            ListBox1.Items.Add(MyReader("roomrate"))
            TextBox8.Text = MyReader("roomrate")
            ListBox1.Items.Add(" ")
            ListBox1.Items.Add(MyReader("examfee"))
            TextBox9.Text = MyReader("examfee")
            ListBox1.Items.Add(" ")
            ListBox1.Items.Add(MyReader("phyfee"))
            TextBox10.Text = MyReader("phyfee")
            ListBox1.Items.Add(" ")
            ListBox1.Items.Add(MyReader("drugcost"))
            TextBox11.Text = MyReader("drugcost")
            'checkcard()
            ComboBox2.Text = MyReader("ctype")
            TextBox21.Text = MyReader("cno")
            TextBox20.Text = MyReader("validdate")
            ComboBox3.Text = MyReader("phycode")
        End While
        MyConnection.Close()
        MyReader.Close()
        MyCommand.Dispose()
        getids()
        getpatname()
        getphyname()
        getroom()
    End Sub
    'function which calculates the  total of the given fees
    Function total() As String
        Dim t As Integer
        t = CInt(TextBox7.Text) + CInt(TextBox8.Text) + CInt(TextBox9.Text) + CInt(TextBox10.Text) + CInt(TextBox11.Text)
        Return t.ToString
    End Function
    Private Sub Button8_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button8.Click
        TextBox5.Text = ""
        TextBox5.Text = total()
    End Sub
    Private Sub Button6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button6.Click
        MyConnection.Open()
        MyCommand = New OleDbCommand("SELECT * FROM Accounts", MyConnection)
        MyReader = MyCommand.ExecuteReader()
        While MyReader.Read
            TextBox12.Text = MyReader("slip")
        End While
        MyConnection.Close()
        MyReader.Close()
        MyCommand.dispose()

        If validslip(TextBox12.Text) = True Then
            TextBox6.Text = getslip(TextBox12.Text)
        Else
            MsgBox("the slip number was not valid ", MsgBoxStyle.Exclamation, "PrisLogix's PIS")
        End If
        Button10.Enabled = True
        Button11.Enabled = True
        enabledfields()
    End Sub
    Private Sub Button9_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button9.Click
        clearfields()
    End Sub
    Private Sub Button10_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button10.Click
        MyConnection.Open()
        MyCommand = New OleDbCommand("INSERT INTO Accounts VALUES ('" & TextBox6.Text & "', '" & TextBox1.Text & "', '" & ComboBox3.Text & "', '" & ComboBox1.Text & "','" & TextBox13.Text & "','" & TextBox14.Text & "', '" & TextBox15.Text & "', '" & TextBox16.Text & "', '" & TextBox17.Text & "','" & TextBox21.Text & "','" & ComboBox2.Text & "','" & TextBox20.Text & "'  )", MyConnection)
        MyCommand.ExecuteNonQuery()
        MyConnection.Close()
        MyCommand.dispose()
        MsgBox("New slip has been added", MsgBoxStyle.Information, "PrisLogix's PIS")
        clearfields()
    End Sub
    Private Sub Button12_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button12.Click
        ref = New frm_reports
        ref.mdiparent = Me.MdiParent
        ref.show()
    End Sub
    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        ref = New frm_srhslip
        ref.show()
    End Sub
    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
    End Sub
    Private Sub CheckBox2_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBox2.CheckedChanged
        TextBox21.Enabled = True
        CheckBox3.CheckState = CheckState.Unchecked
        CheckBox1.CheckState = CheckState.Unchecked
        ComboBox2.Text = ""
    End Sub
    Private Sub CheckBox3_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBox3.CheckedChanged
        TextBox21.Enabled = False
        CheckBox2.CheckState = CheckState.Unchecked
        CheckBox1.CheckState = CheckState.Unchecked
        ComboBox2.Text = "None"
    End Sub
    Private Sub CheckBox1_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBox1.CheckedChanged
        TextBox21.Enabled = False
        CheckBox2.CheckState = CheckState.Unchecked
        CheckBox3.CheckState = CheckState.Unchecked
        ComboBox2.Text = "None"
    End Sub
    Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
        If checkslipbox() = True Then
            MsgBox("Please Enter the Slip Number", MsgBoxStyle.Information, "PrisLogix's PIS")
        End If
        deleteslip()
        clearfields()
        MsgBox("The selected record was deleted", MsgBoxStyle.Information, "PrisLogix's PIS")
    End Sub
    Private Sub Button11_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button11.Click
        disablefields()
        clearfields()
        Button10.Enabled = False
        Button11.Enabled = False
    End Sub
    Private Sub ComboBox3_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBox3.SelectedIndexChanged
        'MyConnection.Open()
        'MyCommand = New OleDbCommand("SELECT * FROM Physicians WHERE phycode = '" & ComboBox3.Text & "' ", MyConnection)
        'MyReader = MyCommand.ExecuteReader()
        'While MyReader.Read
        '  TextBox3.Text = MyReader("Phyname")
        '   TextBox16.Text = MyReader("Fee")
        'End While
        ' MyConnection.Close()
        '  MyReader.Close()
        '   MyCommand.dispose()
    End Sub
    Private Sub ComboBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBox1.SelectedIndexChanged
        '     MyConnection.Open()
        '    MyCommand = New OleDbCommand("SELECT * FROM Rooms WHERE roomno = '" & ComboBox1.Text & "'", MyConnection)
        '   MyReader = MyCommand.ExecuteReader()
        '  While MyReader.Read
        ' TextBox14.Text = MyReader("Roomrate")
        ' End While
        ' MyConnection.Close()
        ' MyReader.Close()
        ' MyCommand.dispose()
    End Sub
    Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
    End Sub
#End Region
#Region "GLOW CODE"

    Private Sub MouseEnterEvent(ByVal sender As Object, ByVal e As System.EventArgs) _
        Handles Button1.MouseEnter, Button10.MouseEnter, Button11.MouseEnter, Button4.MouseEnter, Button5.MouseEnter, Button6.MouseEnter, Button7.MouseEnter, Button8.MouseEnter, Button9.MouseEnter, Button12.MouseEnter

        ' A simple event handler that fires when the user's mouse arrow rolls 
        ' over any of the buttons.  It passes the button's identity to the Glow sub.

        Dim ctrl As Control = CType(sender, Control)
        Glow(ctrl, True)

    End Sub

    Private Sub MouseLeaveEvent(ByVal sender As Object, ByVal e As System.EventArgs) _
    Handles Button1.MouseLeave, Button10.MouseLeave, Button11.MouseLeave, Button4.MouseLeave, Button5.MouseLeave, Button6.MouseLeave, Button7.MouseLeave, Button8.MouseLeave, Button9.MouseLeave, Button12.MouseLeave

        ' A simple event handler that fires when the user's mouse arrow leaves the
        ' area of any of the buttons.  It passes the button's identity to the Glow sub.

        Dim ctrl As Control = CType(sender, Control)
        Glow(ctrl, False)

    End Sub

    Private Sub Glow(ByVal ctrl As Control, ByVal Hovering As Boolean)

        Dim Sb_R, Sb_G, Sb_B As Int16 '           <--- RGB values for the starting backcolor
        Dim Sf_R, Sf_G, Sf_B As Int16 '           <--- RGB values for the starting forecolor
        Dim Eb_R, Eb_G, Eb_B As Int16 '           <--- RGB values for the ending backcolor
        Dim Ef_R, Ef_G, Ef_B As Int16 '           <--- RGB values for the ending forecolor

        Select Case Hovering  ' True for MouseEnter, False for MouseLeave
            Case True
                Sb_R = SystemColors.Control.R           ' Assign the variables the 
                Sb_G = SystemColors.Control.G           ' appropriate values based
                Sb_B = SystemColors.Control.B           ' on system-defined colors
                '                                         for control and control
                Sf_R = SystemColors.ControlText.R       ' text.
                Sf_G = SystemColors.ControlText.G
                Sf_B = SystemColors.ControlText.B

                Eb_R = SystemColors.ActiveCaption.R     ' Assign the variables the
                Eb_G = SystemColors.ActiveCaption.G     ' appropriate values based
                Eb_B = SystemColors.ActiveCaption.B     ' on system-defined colors
                '                                         for the title bar and the
                Ef_R = SystemColors.ActiveCaptionText.R ' title bar's text.
                Ef_G = SystemColors.ActiveCaptionText.G
                Ef_B = SystemColors.ActiveCaptionText.B
            Case False
                Sb_R = SystemColors.ActiveCaption.R     ' Assign the variables the
                Sb_G = SystemColors.ActiveCaption.G     ' appropriate values based
                Sb_B = SystemColors.ActiveCaption.B     ' on system-defined colors
                '                                         for the title bar and the
                Sf_R = SystemColors.ActiveCaptionText.R ' title bar's text.
                Sf_G = SystemColors.ActiveCaptionText.G
                Sf_B = SystemColors.ActiveCaptionText.B

                Eb_R = SystemColors.Control.R           ' Assign the variables the 
                Eb_G = SystemColors.Control.G           ' appropriate values based
                Eb_B = SystemColors.Control.B           ' on system-defined colors
                '                                         for control and control
                Ef_R = SystemColors.ControlText.R       ' text.
                Ef_G = SystemColors.ControlText.G
                Ef_B = SystemColors.ControlText.B
        End Select

        Dim b_RIncrement As Int16 = Round(((Eb_R - Sb_R) / 16), 0)      ' Find the increments that
        Dim b_GIncrement As Int16 = Round(((Eb_G - Sb_G) / 16), 0)      ' the RGB values will take;
        Dim b_BIncrement As Int16 = Round(((Eb_B - Sb_B) / 16), 0)      ' 1/16th of the difference
        '                                                                 between the start and end
        Dim f_RIncrement As Int16 = Round(((Ef_R - Sf_R) / 16), 0)      ' values, rounded to the 
        Dim f_GIncrement As Int16 = Round(((Ef_G - Sf_G) / 16), 0)      ' nearest integer.
        Dim f_BIncrement As Int16 = Round(((Ef_B - Sf_B) / 16), 0)

        Dim bR As Int16 = Sb_R ' \
        Dim bG As Int16 = Sb_G '  }--  the RGB values for the backcolor as it changes.
        Dim bB As Int16 = Sb_B ' /

        Dim fR As Int16 = Sf_R ' \
        Dim fG As Int16 = Sf_G '  }--  the RGB values for the forecolor as it changes.
        Dim fB As Int16 = Sf_B ' /

        Dim count As Int16
        For count = 0 To 14
            bR += b_RIncrement          ' Add the appropriate increments to the 
            bG += b_GIncrement          ' RGB values.  The result is a nifty
            bB += b_BIncrement          ' "cross-fade" effect.
            fR += f_RIncrement
            fG += f_GIncrement
            fB += f_BIncrement

            ctrl.BackColor = Color.FromArgb(bR, bG, bB)   ' Repaint the button using the
            ctrl.ForeColor = Color.FromArgb(fR, fG, fB)   ' current RGB values, and refresh
            ctrl.Refresh()                                ' the button.

            Threading.Thread.Sleep(30 - (count * 2))      ' Wait a certain number of milliseconds,
            '                                               which is a factor of the current count.
            '                                               I tweaked these numbers to get a decent
            '                                               effect; feel free to adjust these 
            '                                               numbers to achieve an effect you like.
        Next
        Select Case Hovering
            Case True
                ctrl.BackColor = SystemColors.InactiveCaption        ' Finish the effect by painting 
                ctrl.ForeColor = SystemColors.InactiveCaptionText      ' the control with it's final
            Case False                                              ' look, depending on whether
                ctrl.BackColor = SystemColors.Control               ' we're fading in or out.
                ctrl.ForeColor = SystemColors.ControlText
        End Select
    End Sub




#End Region
End Class

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -