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

📄 dlgcompose.frm

📁 本系统可用于医院和专业体检中心的健康体检管理
💻 FRM
字号:
VERSION 5.00
Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "mscomctl.ocx"
Object = "{0B81E4A9-BE4E-4AEF-9272-33AB5B51C6FC}#1.0#0"; "XPControls.ocx"
Begin VB.Form dlgCompose 
   BackColor       =   &H00D3DABC&
   BorderStyle     =   3  'Fixed Dialog
   Caption         =   "组单工具"
   ClientHeight    =   8235
   ClientLeft      =   2760
   ClientTop       =   3750
   ClientWidth     =   7635
   Icon            =   "dlgCompose.frx":0000
   LinkTopic       =   "Form1"
   LockControls    =   -1  'True
   MaxButton       =   0   'False
   MinButton       =   0   'False
   ScaleHeight     =   8235
   ScaleWidth      =   7635
   ShowInTaskbar   =   0   'False
   StartUpPosition =   2  '屏幕中心
   Begin VB.TextBox txtRation 
      Height          =   285
      Left            =   6360
      TabIndex        =   11
      Text            =   "1"
      Top             =   5160
      Width           =   825
   End
   Begin XPControls.XPCommandButton cmdExit 
      Cancel          =   -1  'True
      Height          =   405
      Left            =   5820
      TabIndex        =   10
      Top             =   7380
      Width           =   1005
      _ExtentX        =   1773
      _ExtentY        =   714
      Caption         =   "退出"
      BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
         Name            =   "MS Sans Serif"
         Size            =   8.25
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
   End
   Begin VB.Frame Frame3 
      BackColor       =   &H00D3DABC&
      Caption         =   "套餐"
      Height          =   1485
      Left            =   5220
      TabIndex        =   7
      Top             =   450
      Width           =   2295
      Begin VB.ComboBox cmbTCan 
         Height          =   315
         Left            =   90
         Style           =   2  'Dropdown List
         TabIndex        =   8
         Top             =   270
         Width           =   2115
      End
      Begin VB.Label lblTCanInfo 
         BackStyle       =   0  'Transparent
         Height          =   705
         Left            =   90
         TabIndex        =   9
         Top             =   660
         Width           =   2115
      End
   End
   Begin VB.Frame Frame2 
      BackColor       =   &H00D3DABC&
      Caption         =   "选择方式"
      Height          =   2505
      Left            =   5490
      TabIndex        =   3
      Top             =   2460
      Width           =   1695
      Begin XPControls.XPCommandButton cmdSelectAll 
         Height          =   375
         Left            =   420
         TabIndex        =   4
         Top             =   510
         Width           =   855
         _ExtentX        =   1508
         _ExtentY        =   661
         Caption         =   "全选"
         BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
            Name            =   "MS Sans Serif"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
      End
      Begin XPControls.XPCommandButton cmdUnselectAll 
         Height          =   375
         Left            =   420
         TabIndex        =   5
         Top             =   1200
         Width           =   855
         _ExtentX        =   1508
         _ExtentY        =   661
         Caption         =   "全不选"
         BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
            Name            =   "MS Sans Serif"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
      End
      Begin XPControls.XPCommandButton cmdConverseSelect 
         Height          =   375
         Left            =   420
         TabIndex        =   6
         Top             =   1890
         Width           =   855
         _ExtentX        =   1508
         _ExtentY        =   661
         Caption         =   "反选"
         BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
            Name            =   "MS Sans Serif"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
      End
   End
   Begin VB.Frame Frame1 
      BackColor       =   &H00D3DABC&
      Caption         =   "项目列表"
      Height          =   8115
      Left            =   90
      TabIndex        =   0
      Top             =   60
      Width           =   5025
      Begin MSComctlLib.TreeView tvwXMu 
         Height          =   7785
         Left            =   120
         TabIndex        =   1
         Top             =   240
         Width           =   4785
         _ExtentX        =   8440
         _ExtentY        =   13732
         _Version        =   393217
         HideSelection   =   0   'False
         LabelEdit       =   1
         LineStyle       =   1
         Style           =   7
         Checkboxes      =   -1  'True
         Appearance      =   1
      End
   End
   Begin XPControls.XPCommandButton cmdPrintCompose 
      Height          =   405
      Left            =   5820
      TabIndex        =   13
      Top             =   6210
      Width           =   1005
      _ExtentX        =   1773
      _ExtentY        =   714
      Caption         =   "打印组单"
      BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
         Name            =   "MS Sans Serif"
         Size            =   8.25
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
   End
   Begin VB.Label Label1 
      BackStyle       =   0  'Transparent
      Caption         =   "折扣率:"
      Height          =   225
      Left            =   5400
      TabIndex        =   12
      Top             =   5220
      Width           =   855
   End
   Begin VB.Label lblPrice 
      BackStyle       =   0  'Transparent
      Caption         =   "价格:"
      ForeColor       =   &H00FF0000&
      Height          =   255
      Left            =   5400
      TabIndex        =   2
      Top             =   5640
      Width           =   1845
   End
End
Attribute VB_Name = "dlgCompose"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False

Option Explicit
Dim m_blnCompute As Boolean

Private Sub cmbTCan_Click()
On Error GoTo ErrMsg
    Dim Status
    Dim strSQL As String
    Dim rstemp As ADODB.Recordset
    Dim i As Integer, j As Integer
    Dim strDXID As String
    Dim blnHave As Boolean
    Dim curTotal As Currency
    Dim sngRation As Single
    
    m_blnCompute = False '选择套餐时禁止计算
    Me.MousePointer = vbHourglass
    If cmbTCan.Text = "" Then
        '清除所有选择
        For i = 1 To tvwXMu.Nodes.Count
            tvwXMu.Nodes(i).Checked = False
        Next
        '去掉套餐描述
        lblTCanInfo.Caption = ""
        lblPrice.Caption = "价格:0 元"
        GoTo ExitLab
    End If
    
    '显示该套餐描述
    strSQL = "select TCMC from SET_TC" _
            & " where TCID='" _
            & LongToString(cmbTCan.ItemData(cmbTCan.ListIndex), 5) & "'"
    Set rstemp = New ADODB.Recordset
    rstemp.Open strSQL, GCon, adOpenForwardOnly, adLockReadOnly
    lblTCanInfo.Caption = rstemp("TCMC") & ""
    rstemp.Close
    
    '获取该套餐包含的大项
    strSQL = "select DXID from SET_TCDX" _
            & " where TCID='" _
            & LongToString(cmbTCan.ItemData(cmbTCan.ListIndex), 5) & "'"
    Set rstemp = New ADODB.Recordset
    rstemp.Open strSQL, GCon, adOpenKeyset, adLockOptimistic
    If rstemp.RecordCount > 0 Then
        '循环每个大项,如果该大项包含在当前套餐中,则选中,否则不选中
        For i = 1 To tvwXMu.Nodes.Count
            '只处理大项
            If Len(tvwXMu.Nodes(i).Key) = 5 Then
                strDXID = Mid(tvwXMu.Nodes(i).Key, 2)
                
                blnHave = False
                rstemp.MoveFirst
                For j = 1 To rstemp.RecordCount
                    If rstemp("DXID") = strDXID Then
                        blnHave = True
                        Exit For
                    End If
                    rstemp.MoveNext
                Next j
                
                '检查是否包含
                If blnHave = True Then
                    tvwXMu.Nodes(i).Checked = True
                    blnHave = False
                Else
                    tvwXMu.Nodes(i).Checked = False
                End If
            End If
        Next i
        
        rstemp.Close
    End If
    Set rstemp = Nothing
    
    '如果某个大项选中,则选中其父节点
    For i = 1 To tvwXMu.Nodes.Count
        If tvwXMu.Nodes(i).Checked = True And Len(tvwXMu.Nodes(i).Key) > 3 Then
            tvwXMu.Nodes(i).Parent.Checked = True
        End If
    Next i
    
    sngRation = CSng(Val(txtRation.Text))
    curTotal = ComputeMoneyFromCurrentSelect(tvwXMu, cmbTCan, sngRation)
    lblPrice.Caption = "价格:" & CStr(curTotal) & " 元"
    GoTo ExitLab
ErrMsg:
    Status = SetError(Err.Number, Err.Description, Err.Source)
    ErrMsg Status
ExitLab:
    '启动计算
    m_blnCompute = True
    Me.MousePointer = vbDefault
End Sub

Private Sub cmdConverseSelect_Click()
    Dim i As Integer
    Dim curTotal As Currency
    Dim sngRation As Single
    
    With tvwXMu
        For i = 1 To tvwXMu.Nodes.Count
            .Nodes(i).Checked = Not .Nodes(i).Checked
        Next
    End With
    
    sngRation = CSng(Val(txtRation.Text))
    curTotal = ComputeMoneyFromCurrentSelect(tvwXMu, cmbTCan, sngRation)
    lblPrice.Caption = "价格:" & CStr(curTotal) & " 元"
End Sub

Private Sub cmdPrintCompose_Click()
    Dim curTotal As Currency
    
    curTotal = CCur(Val(Mid(lblPrice.Caption, InStr(1, lblPrice.Caption, ":") + 1)))
    Call PrintPersonGuider_PuYa(0, True, tvwXMu, curTotal)
End Sub

Private Sub cmdSelectAll_Click()
    Dim i As Integer
    Dim curTotal As Currency
    Dim sngRation As Single
    
    With tvwXMu
        For i = 1 To tvwXMu.Nodes.Count
            .Nodes(i).Checked = True
        Next
    End With
    
    sngRation = CSng(Val(txtRation.Text))
    curTotal = ComputeMoneyFromCurrentSelect(tvwXMu, cmbTCan, sngRation)
    lblPrice.Caption = "价格:" & CStr(curTotal) & " 元"
End Sub

Private Sub cmdExit_Click()
    Unload Me
End Sub

Private Sub cmdUnselectAll_Click()
    Dim i As Integer
    Dim sngRation As Single
    Dim curTotal As Currency
    
    With tvwXMu
        For i = 1 To tvwXMu.Nodes.Count
            .Nodes(i).Checked = False
        Next
    End With
    
    sngRation = CSng(Val(txtRation.Text))
    curTotal = ComputeMoneyFromCurrentSelect(tvwXMu, cmbTCan, sngRation)
    lblPrice.Caption = "价格:" & CStr(curTotal) & " 元"
End Sub

Private Sub Form_Load()
On Error GoTo ErrMsg
    Dim Status
    Dim strSQL As String
    Dim rstemp As ADODB.Recordset
    
    Screen.MousePointer = vbHourglass
    
    '加载所有组合
    Call LoadKShiAndXMu(tvwXMu, True)
    
    '获取套餐
    strSQL = "select TCID,TCMC from SET_TC order by TCID"
    Set rstemp = New ADODB.Recordset
    rstemp.Open strSQL, GCon, adOpenStatic, adLockOptimistic
    If rstemp.RecordCount >= 1 Then
        '首先添加一个空行
        cmbTCan.AddItem ""
        '添加用户设置的套餐
        rstemp.MoveFirst
        Do
            cmbTCan.AddItem rstemp("TCMC")
            cmbTCan.ItemData(cmbTCan.NewIndex) = rstemp("TCID")
            
            rstemp.MoveNext
        Loop Until rstemp.EOF
        rstemp.Close
    End If
    
    m_blnCompute = True '可以计算
    GoTo ExitLab
ErrMsg:
    Status = SetError(Err.Number, Err.Description, Err.Source)
    ErrMsg Status
ExitLab:
    Screen.MousePointer = vbDefault
End Sub

Private Sub tvwXMu_NodeCheck(ByVal Node As MSComctlLib.Node)
On Error Resume Next '防止非法操作
    Dim i As Integer
    Dim curTotal As Currency
    Dim sngRation As Single
    
    Me.MousePointer = vbHourglass
    
    With tvwXMu
        If Len(Node.Key) = 3 Then '科室节点
            For i = 1 To .Nodes.Count
                If Left(.Nodes(i).Key, 3) = Node.Key _
                        And Len(.Nodes(i).Key) > 3 Then       '该大项节点属于该科室
                    .Nodes(i).Checked = Node.Checked
                End If
            Next i
        ElseIf Len(Node.Key) > 3 Then  '大项节点
            If Node.Checked = True Then
                For i = 1 To .Nodes.Count
                    If .Nodes(i).Key = Left(Node.Key, 3) Then  '该科室节点包括该大项
                        .Nodes(i).Checked = True
                        Exit For
                    End If
                Next i
                .Nodes(HEADER).Checked = True
            End If
        Else '选择了根节点
            If Node.Checked Then
                cmdSelectAll_Click
            Else
                cmdUnselectAll_Click
            End If
            GoTo ExitLab '上面两函数均实现了计算,所以可以直接退出
        End If
    End With
    
    sngRation = CSng(Val(txtRation.Text))
    
    If m_blnCompute Then
        curTotal = ComputeMoneyFromCurrentSelect(tvwXMu, cmbTCan, sngRation)
        lblPrice.Caption = "价格:" & CStr(curTotal) & " 元"
    End If
    
    GoTo ExitLab
ExitLab:
    Me.MousePointer = vbDefault
End Sub

Private Sub txtRation_KeyPress(KeyAscii As Integer)
    Dim curTotal As Currency
    Dim sngRation As Single
    
    If KeyAscii = vbKeyReturn Then
        sngRation = CSng(Val(txtRation.Text))
        curTotal = ComputeMoneyFromCurrentSelect(tvwXMu, cmbTCan, sngRation)
        lblPrice.Caption = "价格:" & CStr(curTotal) & " 元"
    End If
End Sub

⌨️ 快捷键说明

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