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

📄 frmpaymoney.vb

📁 一个医院管理系统
💻 VB
字号:
Public Class frmPayMoney
    Inherits System.Windows.Forms.Form
    Public strCode As String
    Public bSave As Boolean = False
#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 dgdList As System.Windows.Forms.DataGrid
    Friend WithEvents GroupBox1 As System.Windows.Forms.GroupBox
    Friend WithEvents Label1 As System.Windows.Forms.Label
    Friend WithEvents Label2 As System.Windows.Forms.Label
    Friend WithEvents Label3 As System.Windows.Forms.Label
    Friend WithEvents btnSave As System.Windows.Forms.Button
    Friend WithEvents btnExit As System.Windows.Forms.Button
    Friend WithEvents txbTotal As System.Windows.Forms.TextBox
    Friend WithEvents txbGet As System.Windows.Forms.TextBox
    Friend WithEvents txbReturn As System.Windows.Forms.TextBox
    <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
        Dim resources As System.Resources.ResourceManager = New System.Resources.ResourceManager(GetType(frmPayMoney))
        Me.dgdList = New System.Windows.Forms.DataGrid
        Me.GroupBox1 = New System.Windows.Forms.GroupBox
        Me.btnExit = New System.Windows.Forms.Button
        Me.btnSave = New System.Windows.Forms.Button
        Me.Label3 = New System.Windows.Forms.Label
        Me.txbReturn = New System.Windows.Forms.TextBox
        Me.Label2 = New System.Windows.Forms.Label
        Me.txbGet = New System.Windows.Forms.TextBox
        Me.Label1 = New System.Windows.Forms.Label
        Me.txbTotal = New System.Windows.Forms.TextBox
        CType(Me.dgdList, System.ComponentModel.ISupportInitialize).BeginInit()
        Me.GroupBox1.SuspendLayout()
        Me.SuspendLayout()
        '
        'dgdList
        '
        Me.dgdList.CaptionVisible = False
        Me.dgdList.DataMember = ""
        Me.dgdList.Dock = System.Windows.Forms.DockStyle.Fill
        Me.dgdList.HeaderForeColor = System.Drawing.SystemColors.ControlText
        Me.dgdList.Location = New System.Drawing.Point(0, 0)
        Me.dgdList.Name = "dgdList"
        Me.dgdList.Size = New System.Drawing.Size(488, 273)
        Me.dgdList.TabIndex = 1
        '
        'GroupBox1
        '
        Me.GroupBox1.Controls.Add(Me.btnExit)
        Me.GroupBox1.Controls.Add(Me.btnSave)
        Me.GroupBox1.Controls.Add(Me.Label3)
        Me.GroupBox1.Controls.Add(Me.txbReturn)
        Me.GroupBox1.Controls.Add(Me.Label2)
        Me.GroupBox1.Controls.Add(Me.txbGet)
        Me.GroupBox1.Controls.Add(Me.Label1)
        Me.GroupBox1.Controls.Add(Me.txbTotal)
        Me.GroupBox1.Dock = System.Windows.Forms.DockStyle.Bottom
        Me.GroupBox1.Location = New System.Drawing.Point(0, 193)
        Me.GroupBox1.Name = "GroupBox1"
        Me.GroupBox1.Size = New System.Drawing.Size(488, 80)
        Me.GroupBox1.TabIndex = 2
        Me.GroupBox1.TabStop = False
        '
        'btnExit
        '
        Me.btnExit.Location = New System.Drawing.Point(438, 34)
        Me.btnExit.Name = "btnExit"
        Me.btnExit.Size = New System.Drawing.Size(40, 23)
        Me.btnExit.TabIndex = 7
        Me.btnExit.Text = "取消"
        '
        'btnSave
        '
        Me.btnSave.Location = New System.Drawing.Point(392, 34)
        Me.btnSave.Name = "btnSave"
        Me.btnSave.Size = New System.Drawing.Size(40, 23)
        Me.btnSave.TabIndex = 6
        Me.btnSave.Text = "收款"
        '
        'Label3
        '
        Me.Label3.Location = New System.Drawing.Point(272, 40)
        Me.Label3.Name = "Label3"
        Me.Label3.Size = New System.Drawing.Size(32, 16)
        Me.Label3.TabIndex = 5
        Me.Label3.Text = "找零"
        '
        'txbReturn
        '
        Me.txbReturn.Location = New System.Drawing.Point(304, 35)
        Me.txbReturn.Name = "txbReturn"
        Me.txbReturn.Size = New System.Drawing.Size(72, 21)
        Me.txbReturn.TabIndex = 4
        Me.txbReturn.Text = ""
        '
        'Label2
        '
        Me.Label2.Location = New System.Drawing.Point(152, 40)
        Me.Label2.Name = "Label2"
        Me.Label2.Size = New System.Drawing.Size(32, 16)
        Me.Label2.TabIndex = 3
        Me.Label2.Text = "收款"
        '
        'txbGet
        '
        Me.txbGet.Location = New System.Drawing.Point(184, 35)
        Me.txbGet.Name = "txbGet"
        Me.txbGet.Size = New System.Drawing.Size(72, 21)
        Me.txbGet.TabIndex = 2
        Me.txbGet.Text = ""
        '
        'Label1
        '
        Me.Label1.Location = New System.Drawing.Point(8, 40)
        Me.Label1.Name = "Label1"
        Me.Label1.Size = New System.Drawing.Size(56, 16)
        Me.Label1.TabIndex = 1
        Me.Label1.Text = "合计金额 "
        '
        'txbTotal
        '
        Me.txbTotal.Location = New System.Drawing.Point(65, 35)
        Me.txbTotal.Name = "txbTotal"
        Me.txbTotal.ReadOnly = True
        Me.txbTotal.Size = New System.Drawing.Size(72, 21)
        Me.txbTotal.TabIndex = 0
        Me.txbTotal.Text = ""
        '
        'frmPayMoney
        '
        Me.AutoScaleBaseSize = New System.Drawing.Size(6, 14)
        Me.ClientSize = New System.Drawing.Size(488, 273)
        Me.Controls.Add(Me.GroupBox1)
        Me.Controls.Add(Me.dgdList)
        Me.Icon = CType(resources.GetObject("$this.Icon"), System.Drawing.Icon)
        Me.Name = "frmPayMoney"
        Me.Text = "收费"
        CType(Me.dgdList, System.ComponentModel.ISupportInitialize).EndInit()
        Me.GroupBox1.ResumeLayout(False)
        Me.ResumeLayout(False)

    End Sub

#End Region

    Private Sub frmPayMoney_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Dim strSQL As String = "select a.编号,a.药品编号,b.名称,a.单价,数量,金额 from 门诊划价明细 as a,v收费项目及药品 as b where a.药品编号 = b.编号 and a.划价编号='" + strCode + "'"
        Dim db As DataBase = New DataBase
        Dim dv As DataView = db.RunSelectSQL(strSQL)
        dv.AllowDelete = False
        dv.AllowEdit = False
        dv.AllowNew = False
        Me.dgdList.DataSource = dv
        Dim dTotalMoney As Double = 0
        For Each drv As DataRowView In dv
            dTotalMoney += CType(drv("金额").ToString(), Double)
        Next
        Me.txbTotal.Text = dTotalMoney.ToString
        Me.txbGet.Text = "0"
    End Sub
   
    Private Sub txbGet_TextChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles txbGet.TextChanged
        Dim dGetMoney As Double = CType(Me.txbGet.Text.Trim, Double)
        Dim dTotalMoney As Double = CType(txbTotal.Text.Trim, Double)
        Me.txbReturn.Text = (dGetMoney - dTotalMoney).ToString
    End Sub

    Private Sub txbGet_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles txbGet.KeyPress
        If e.KeyChar.IsDigit(e.KeyChar) = False Then
            e.Handled = True
            Me.txbGet.Text = "0"
        End If
    End Sub

    Private Sub btnExit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnExit.Click
        Me.Close()
    End Sub

    Private Sub btnSave_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSave.Click
        Dim dGetMoney As Double = CType(Me.txbGet.Text.Trim, Double)
        Dim dTotalMoney As Double = CType(txbTotal.Text.Trim, Double)
        If (dGetMoney - dTotalMoney) < 0 Then
            Dim dlgResult As DialogResult = MessageBox.Show("请确保费用已经交齐!""提示", MessageBoxButtons.YesNo)
            If dlgResult = DialogResult.No Then
                Return
            End If
        End If
        Dim db As DataBase = New DataBase
        db.RunDelOrInsSQL("update 门诊划价 set 是否收费='是',收费员='李四',收费时间=getdate() where 编号 ='" + strCode + "'")
        bSave = True
        db.Dispose()
        Me.Close()
    End Sub
End Class

⌨️ 快捷键说明

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