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

📄 frmshoufei.vb

📁 用VB.net做的关于医院收费管理系统的东西
💻 VB
字号:
Public Class frmShouFei
    Inherits System.Windows.Forms.Form
    Private dtList As DataTable
    Private dtDetail As DataTable
    Private iCurrentIndex As Integer = -1
#Region " Windows 窗体设计器生成的代码 "

    Public Sub New()
        MyBase.New()

        '该调用是 Windows 窗体设计器所必需的。
        InitializeComponent()

        '在 InitializeComponent() 调用之后添加任何初始化

    End Sub

    '窗体重写 dispose 以清理组件列表。
    Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
        If disposing Then
            If Not (components Is Nothing) Then
                components.Dispose()
            End If
        End If
        MyBase.Dispose(disposing)
    End Sub

    'Windows 窗体设计器所必需的
    Private components As System.ComponentModel.IContainer

    '注意: 以下过程是 Windows 窗体设计器所必需的
    '可以使用 Windows 窗体设计器修改此过程。
    '不要使用代码编辑器修改它。
    Friend WithEvents ImageList1 As System.Windows.Forms.ImageList
    Friend WithEvents Label3 As System.Windows.Forms.Label
    Friend WithEvents txbThree As System.Windows.Forms.TextBox
    Friend WithEvents txbTwo As System.Windows.Forms.TextBox
    Friend WithEvents Label2 As System.Windows.Forms.Label
    Friend WithEvents Label1 As System.Windows.Forms.Label
    Friend WithEvents txbOne As System.Windows.Forms.TextBox
    Friend WithEvents tbbSearch As System.Windows.Forms.ToolBarButton
    Friend WithEvents tbbSave As System.Windows.Forms.ToolBarButton
    Friend WithEvents tbbExit As System.Windows.Forms.ToolBarButton
    Friend WithEvents ToolBar1 As System.Windows.Forms.ToolBar
    Friend WithEvents GroupBox1 As System.Windows.Forms.GroupBox
    Friend WithEvents GroupBox2 As System.Windows.Forms.GroupBox
    Friend WithEvents dgdList As System.Windows.Forms.DataGrid
    Friend WithEvents dgdDetail As System.Windows.Forms.DataGrid
    Friend WithEvents Label4 As System.Windows.Forms.Label
    Friend WithEvents txbFour As System.Windows.Forms.TextBox
    <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
        Me.components = New System.ComponentModel.Container
        Dim resources As System.Resources.ResourceManager = New System.Resources.ResourceManager(GetType(frmShouFei))
        Me.ImageList1 = New System.Windows.Forms.ImageList(Me.components)
        Me.Label3 = New System.Windows.Forms.Label
        Me.txbThree = New System.Windows.Forms.TextBox
        Me.txbTwo = New System.Windows.Forms.TextBox
        Me.Label2 = New System.Windows.Forms.Label
        Me.Label1 = New System.Windows.Forms.Label
        Me.txbOne = New System.Windows.Forms.TextBox
        Me.tbbSearch = New System.Windows.Forms.ToolBarButton
        Me.tbbSave = New System.Windows.Forms.ToolBarButton
        Me.tbbExit = New System.Windows.Forms.ToolBarButton
        Me.ToolBar1 = New System.Windows.Forms.ToolBar
        Me.GroupBox1 = New System.Windows.Forms.GroupBox
        Me.txbFour = New System.Windows.Forms.TextBox
        Me.Label4 = New System.Windows.Forms.Label
        Me.GroupBox2 = New System.Windows.Forms.GroupBox
        Me.dgdDetail = New System.Windows.Forms.DataGrid
        Me.dgdList = New System.Windows.Forms.DataGrid
        Me.GroupBox1.SuspendLayout()
        Me.GroupBox2.SuspendLayout()
        CType(Me.dgdDetail, System.ComponentModel.ISupportInitialize).BeginInit()
        CType(Me.dgdList, System.ComponentModel.ISupportInitialize).BeginInit()
        Me.SuspendLayout()
        '
        'ImageList1
        '
        Me.ImageList1.ImageSize = New System.Drawing.Size(16, 16)
        Me.ImageList1.ImageStream = CType(resources.GetObject("ImageList1.ImageStream"), System.Windows.Forms.ImageListStreamer)
        Me.ImageList1.TransparentColor = System.Drawing.Color.Transparent
        '
        'Label3
        '
        Me.Label3.Location = New System.Drawing.Point(296, 21)
        Me.Label3.Name = "Label3"
        Me.Label3.Size = New System.Drawing.Size(56, 15)
        Me.Label3.TabIndex = 13
        Me.Label3.Text = "开始时间"
        '
        'txbThree
        '
        Me.txbThree.Location = New System.Drawing.Point(352, 16)
        Me.txbThree.Name = "txbThree"
        Me.txbThree.Size = New System.Drawing.Size(87, 21)
        Me.txbThree.TabIndex = 12
        Me.txbThree.Text = ""
        '
        'txbTwo
        '
        Me.txbTwo.Location = New System.Drawing.Point(200, 16)
        Me.txbTwo.Name = "txbTwo"
        Me.txbTwo.Size = New System.Drawing.Size(87, 21)
        Me.txbTwo.TabIndex = 11
        Me.txbTwo.Text = ""
        '
        'Label2
        '
        Me.Label2.Location = New System.Drawing.Point(168, 21)
        Me.Label2.Name = "Label2"
        Me.Label2.Size = New System.Drawing.Size(32, 15)
        Me.Label2.TabIndex = 9
        Me.Label2.Text = "姓名"
        '
        'Label1
        '
        Me.Label1.Location = New System.Drawing.Point(16, 21)
        Me.Label1.Name = "Label1"
        Me.Label1.Size = New System.Drawing.Size(56, 15)
        Me.Label1.TabIndex = 8
        Me.Label1.Text = "划价编号"
        '
        'txbOne
        '
        Me.txbOne.Location = New System.Drawing.Point(72, 16)
        Me.txbOne.Name = "txbOne"
        Me.txbOne.Size = New System.Drawing.Size(87, 21)
        Me.txbOne.TabIndex = 7
        Me.txbOne.Text = ""
        '
        'tbbSearch
        '
        Me.tbbSearch.ImageIndex = 0
        Me.tbbSearch.Text = "搜索"
        '
        'tbbSave
        '
        Me.tbbSave.ImageIndex = 1
        Me.tbbSave.Text = "收费"
        '
        'tbbExit
        '
        Me.tbbExit.ImageIndex = 2
        Me.tbbExit.Text = "退出"
        '
        'ToolBar1
        '
        Me.ToolBar1.Buttons.AddRange(New System.Windows.Forms.ToolBarButton() {Me.tbbSearch, Me.tbbSave, Me.tbbExit})
        Me.ToolBar1.ButtonSize = New System.Drawing.Size(31, 35)
        Me.ToolBar1.DropDownArrows = True
        Me.ToolBar1.ImageList = Me.ImageList1
        Me.ToolBar1.Location = New System.Drawing.Point(0, 0)
        Me.ToolBar1.Name = "ToolBar1"
        Me.ToolBar1.ShowToolTips = True
        Me.ToolBar1.Size = New System.Drawing.Size(624, 41)
        Me.ToolBar1.TabIndex = 0
        '
        'GroupBox1
        '
        Me.GroupBox1.Controls.Add(Me.txbFour)
        Me.GroupBox1.Controls.Add(Me.Label4)
        Me.GroupBox1.Controls.Add(Me.txbOne)
        Me.GroupBox1.Controls.Add(Me.Label1)
        Me.GroupBox1.Controls.Add(Me.Label2)
        Me.GroupBox1.Controls.Add(Me.txbTwo)
        Me.GroupBox1.Controls.Add(Me.txbThree)
        Me.GroupBox1.Controls.Add(Me.Label3)
        Me.GroupBox1.Dock = System.Windows.Forms.DockStyle.Top
        Me.GroupBox1.Location = New System.Drawing.Point(0, 41)
        Me.GroupBox1.Name = "GroupBox1"
        Me.GroupBox1.Size = New System.Drawing.Size(624, 47)
        Me.GroupBox1.TabIndex = 14
        Me.GroupBox1.TabStop = False
        '
        'txbFour
        '
        Me.txbFour.Location = New System.Drawing.Point(520, 16)
        Me.txbFour.Name = "txbFour"
        Me.txbFour.Size = New System.Drawing.Size(87, 21)
        Me.txbFour.TabIndex = 14
        Me.txbFour.Text = ""
        '
        'Label4
        '
        Me.Label4.Location = New System.Drawing.Point(456, 21)
        Me.Label4.Name = "Label4"
        Me.Label4.Size = New System.Drawing.Size(56, 15)
        Me.Label4.TabIndex = 15
        Me.Label4.Text = "结束时间"
        '
        'GroupBox2
        '
        Me.GroupBox2.Controls.Add(Me.dgdDetail)
        Me.GroupBox2.Controls.Add(Me.dgdList)
        Me.GroupBox2.Dock = System.Windows.Forms.DockStyle.Fill
        Me.GroupBox2.Location = New System.Drawing.Point(0, 88)
        Me.GroupBox2.Name = "GroupBox2"
        Me.GroupBox2.Size = New System.Drawing.Size(624, 205)
        Me.GroupBox2.TabIndex = 15
        Me.GroupBox2.TabStop = False
        '
        'dgdDetail
        '
        Me.dgdDetail.CaptionVisible = False
        Me.dgdDetail.DataMember = ""
        Me.dgdDetail.Dock = System.Windows.Forms.DockStyle.Fill
        Me.dgdDetail.HeaderForeColor = System.Drawing.SystemColors.ControlText
        Me.dgdDetail.Location = New System.Drawing.Point(3, 128)
        Me.dgdDetail.Name = "dgdDetail"
        Me.dgdDetail.Size = New System.Drawing.Size(618, 74)
        Me.dgdDetail.TabIndex = 1
        '
        'dgdList
        '
        Me.dgdList.CaptionVisible = False
        Me.dgdList.DataMember = ""
        Me.dgdList.Dock = System.Windows.Forms.DockStyle.Top
        Me.dgdList.HeaderForeColor = System.Drawing.SystemColors.ControlText
        Me.dgdList.Location = New System.Drawing.Point(3, 17)
        Me.dgdList.Name = "dgdList"
        Me.dgdList.Size = New System.Drawing.Size(618, 111)
        Me.dgdList.TabIndex = 0
        '
        'frmShouFei
        '
        Me.AutoScaleBaseSize = New System.Drawing.Size(6, 14)
        Me.ClientSize = New System.Drawing.Size(624, 293)
        Me.Controls.Add(Me.GroupBox2)
        Me.Controls.Add(Me.GroupBox1)
        Me.Controls.Add(Me.ToolBar1)
        Me.Icon = CType(resources.GetObject("$this.Icon"), System.Drawing.Icon)
        Me.Name = "frmShouFei"
        Me.Text = "门诊收费"
        Me.GroupBox1.ResumeLayout(False)
        Me.GroupBox2.ResumeLayout(False)
        CType(Me.dgdDetail, System.ComponentModel.ISupportInitialize).EndInit()
        CType(Me.dgdList, System.ComponentModel.ISupportInitialize).EndInit()
        Me.ResumeLayout(False)

    End Sub

#End Region
    Private Sub ToolBar1_ButtonClick(ByVal sender As System.Object, _
    ByVal e As System.Windows.Forms.ToolBarButtonClickEventArgs) _
    Handles ToolBar1.ButtonClick
        Select Case e.Button.Text
            Case "搜索"
                SetListDataGrid()
            Case "收费"
                Dim dlgChild As frmPayMoney = New frmPayMoney
                dlgChild.strCode = _
                dtList.Rows(dgdList.CurrentCell.RowNumber)("编号")
                dlgChild.ShowDialog()
                SetListDataGrid()
            Case "退出"
                '关闭本窗体
                Me.Close()
        End Select
    End Sub
    Private Sub LoadListData()
        Dim strFilter As String
        If txbOne.Text.Trim.Length <> 0 Then
            strFilter = " and a.划价编号 like '"
            strFilter += txbOne.Text.Trim + "%'"
        End If
        If txbTwo.Text.Trim.Length <> 0 Then
            strFilter += " and 姓名 like '"
            strFilter += txbTwo.Text.Trim + "%'"
        End If
        If txbThree.Text.Trim.Length <> 0 Then
            strFilter += " and a.划价时间>='"
            strFilter += txbThree.Text.Trim + "'"
        End If
        If txbFour.Text.Trim.Length <> 0 Then
            strFilter = " and a.划价时间 <= '"
            strFilter += txbFour.Text.Trim + "'"
        End If
        Dim strSQL As String = "select a.编号,b.姓名,b.性别,a.科室,"
        strSQL += "a.医生,a.划价金额,a.划价时间,a.划价员,a.是否收费,"
        strSQL += "a.收费员,a.收费时间,a.挂号编号 from 门诊划价 as a,"
        strSQL += "门诊挂号 as b  where a.挂号编号=b.编号 and "
        strSQL += "a.是否收费='否'  " + strFilter
        Dim db As DataBase = New DataBase
        Dim dv As DataView = db.RunSelectSQL(strSQL)
        db.Dispose()
        dtList = dv.Table
    End Sub
    Private Sub LoadDataForDetail()
        Dim strSQL As String = "select a.编号,a.药品编号,b.名称,a.单价,"
        strSQL += "数量,金额 from 门诊划价明细 as a,v收费项目及药品 as b "
        strSQL += "where a.药品编号 = b.编号 and a.划价编号='"
        strSQL += dtList.Rows(dgdList.CurrentCell.RowNumber)("编号")
        strSQL += "'"
        Dim db As DataBase = New DataBase
        Dim dv As DataView = db.RunSelectSQL(strSQL)
        dtDetail = dv.Table
        db.Dispose()
    End Sub
    Private Sub SetListDataGrid()
        LoadListData()
        '定义一个DataGrid表样式
        Dim ts As New DataGridTableStyle
        Dim aColumnTextColumn As DataGridTextBoxColumn
        Dim numCols As Integer = dtList.Columns.Count
        Dim i As Integer
        For i = 0 To numCols - 1
            aColumnTextColumn = New DataGridTextBoxColumn
            aColumnTextColumn.MappingName = _
            dtList.Columns(i).ColumnName
            aColumnTextColumn.HeaderText = _
            dtList.Columns(i).ColumnName
            aColumnTextColumn.NullText = ""
            If i <> 0 And i <> numCols - 1 Then
                aColumnTextColumn.Width = 60
            End If
            aColumnTextColumn.ReadOnly = True
            ts.GridColumnStyles.Add(aColumnTextColumn)
        Next
        ts.AlternatingBackColor = Color.LightGray
        ts.AllowSorting = False
        ts.MappingName = dtList.TableName
        dgdList.TableStyles.Clear()
        dgdList.TableStyles.Add(ts)
        Dim dv As DataView = dtList.DefaultView
        dv.AllowNew = False
        dv.AllowDelete = False
        dv.AllowEdit = False
        '设置数据源
        dgdList.DataSource = dtList.DefaultView
        If dtList.Rows.Count <> 0 Then
            SetDetailDataGrid()
        End If
    End Sub
    Private Sub SetDetailDataGrid()
        LoadDataForDetail()
        '定义一个DataGrid表样式
        Dim ts As New DataGridTableStyle
        Dim aColumnTextColumn As DataGridTextBoxColumn
        Dim numCols As Integer = dtDetail.Columns.Count
        Dim i As Integer
        For i = 0 To numCols - 1
            aColumnTextColumn = New DataGridTextBoxColumn
            aColumnTextColumn.MappingName = _
            dtDetail.Columns(i).ColumnName
            aColumnTextColumn.HeaderText = _
            dtDetail.Columns(i).ColumnName
            aColumnTextColumn.NullText = ""
            aColumnTextColumn.ReadOnly = True
            ts.GridColumnStyles.Add(aColumnTextColumn)
        Next
        ts.AlternatingBackColor = Color.LightGray
        ts.AllowSorting = False
        ts.MappingName = dtDetail.TableName
        dgdDetail.TableStyles.Clear()
        dgdDetail.TableStyles.Add(ts)
        Dim dv As DataView = dtDetail.DefaultView
        dv.AllowNew = False
        dv.AllowDelete = False
        'dv.AllowEdit = False
        '设置数据源
        dgdDetail.DataSource = dtDetail.DefaultView
    End Sub
    Private Sub frmShouFei_Load(ByVal sender As Object, _
    ByVal e As System.EventArgs) Handles MyBase.Load
        SetListDataGrid()
    End Sub
    Private Sub dgdList_CurrentCellChanged(ByVal sender As Object, _
    ByVal e As System.EventArgs) Handles dgdList.CurrentCellChanged
        If iCurrentIndex <> -1 Or iCurrentIndex _
        <> dgdList.CurrentCell.RowNumber Then
            iCurrentIndex = dgdList.CurrentCell.RowNumber
            SetDetailDataGrid()
        End If
    End Sub
End Class

⌨️ 快捷键说明

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