📄 frm_xmsf.frm
字号:
Height = 180
Index = 3
Left = 228
TabIndex = 7
Top = 1404
Width = 996
End
Begin VB.Label Label1
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "项 目 :"
Height = 180
Index = 2
Left = 228
TabIndex = 5
Top = 984
Width = 996
End
Begin VB.Label Label1
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "档次/分类:"
Height = 180
Index = 1
Left = 228
TabIndex = 3
Top = 612
Width = 996
End
Begin VB.Label Label1
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "美容类别 :"
Height = 180
Index = 0
Left = 225
TabIndex = 1
Top = 240
Width = 990
End
End
Attribute VB_Name = "frm_xmsf"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
'Dim db As Database
Dim rec As Recordset
Dim trrec As Recordset
Dim sta As Boolean
Private Sub OKButton_Click()
End Sub
Private Sub Combo1_Click(Index As Integer)
Select Case Index
Case 0
sqlstr = "select distinct 细分类别 from 项目收费表 where 美容类别='" + Combo1(0).Text + "'"
Set trrec = db.OpenRecordset(sqlstr)
Combo1(1).Clear
Do While Not trrec.EOF
If IsNull(trrec.Fields("细分类别")) Or trrec.Fields("细分类别") = "" Then
Else
Combo1(1).AddItem IIf(IsNull(trrec.Fields("细分类别")), "", trrec.Fields("细分类别"))
End If
trrec.MoveNext
Loop
If Combo1(1).ListCount = 0 Then '细分类别为空
sqlstr = "select distinct 项目 from 项目收费表 where 美容类别='" + Combo1(0).Text + "'"
Set trrec = db.OpenRecordset(sqlstr)
Combo1(2).Clear
Do While Not trrec.EOF
Combo1(2).AddItem trrec.Fields("项目")
trrec.MoveNext
Loop
If Combo1(2).ListCount = 0 Then
Else
Combo1(2).ListIndex = 0
End If
Else
Combo1(1).ListIndex = 0
End If
Case 1
sqlstr = "select distinct 项目 from 项目收费表 where 美容类别='" + Combo1(0).Text + "' and 细分类别='" + Combo1(1).Text + "'"
Set trrec = db.OpenRecordset(sqlstr)
Combo1(2).Clear
Do While Not trrec.EOF
Combo1(2).AddItem trrec.Fields("项目")
trrec.MoveNext
Loop
If Combo1(2).ListCount = 0 Then
Else
Combo1(2).ListIndex = 0
End If
Case 2
If Trim(Combo1(1).Text) = "" Then
sqlstr = "select * from 项目收费表 where 美容类别='" + Combo1(0).Text + "' and 项目='" + Combo1(2).Text + "'"
Else
sqlstr = "select * from 项目收费表 where 美容类别='" + Combo1(0).Text + "' and 细分类别='" + Combo1(1).Text + "' and 项目='" + Combo1(2).Text + "'"
End If
Set trrec = db.OpenRecordset(sqlstr)
Combo1(3).Clear
Do While Not trrec.EOF
Combo1(3).AddItem IIf(IsNull(trrec.Fields("功能或名称")), "", trrec.Fields("功能或名称"))
tr
trrec.MoveNext
Loop
If Combo1(3).ListCount = 0 Then
Else
Combo1(3).ListIndex = 0
End If
End Select
End Sub
Private Sub Combo1_GotFocus(Index As Integer)
'Combo1(Index).IMEMode = 1
Combo1(Index).SelStart = 0
Combo1(Index).SelLength = Len(Combo1(Index))
End Sub
Private Sub Command1_Click(Index As Integer)
On Error GoTo jgqerr
Select Case Index
Case 0 '增加
enab
For i = 0 To Combo1.Count - 1
Combo1(i).Text = ""
Next i
MaskEdBox1(0).Text = ""
MaskEdBox1(1).Text = ""
Text1 = ""
Picture1.Visible = False
Picture2.Visible = True
Command1(5).Default = True
Command1(6).Cancel = True
Combo1(0).SetFocus
Set rec = db.OpenRecordset("项目收费表")
rec.AddNew
sta = True
Case 1 '删除
yn = MsgBox("真的想删除当前项目资料吗?", vbYesNo + vbQuestion, "提示")
If yn = vbYes Then
sqlstr = "delete * from 项目收费表 where 美容类别='" + Combo1(0).Text + "' and 项目='" + Combo1(2).Text + "'"
db.Execute sqlstr
ss
Else
End If
Case 2 '修改
enab
Picture1.Visible = False
Picture2.Visible = True
Command1(5).Default = True
Command1(6).Cancel = True
Combo1(0).SetFocus
sqlstr = "select * from 项目收费表 where 美容类别='" + Combo1(0).Text + "' and 项目='" + Combo1(2).Text + "'"
Set rec = db.OpenRecordset(sqlstr)
rec.Edit
sta = False
Case 3 '查询
sqlstr = "select * from 项目收费表 where 美容类别 like '*" + Trim(Combo1(0).Text) + "*' and 细分类别 like '*" + Trim(Combo1(1).Text) + "*' and 项目 like '*" + Trim(Combo1(2).Text) + "*' and 功能或名称 like '*" + Trim(Combo1(3).Text) + "*'"
Set trrec = db.OpenRecordset(sqlstr)
If trrec.EOF And trrec.BOF Then
MsgBox "没有您要查找的项目收费资料", vbOKOnly + vbCritical, "错误"
Exit Sub
Else
Me.Height = 5970
frmcen Me
ListView1.ListItems.Clear
Do While Not trrec.EOF
Set itmx = ListView1.ListItems.Add(, , trrec.Fields(0))
For i = 1 To trrec.Fields.Count - 1
itmx.SubItems(i) = IIf(IsNull(trrec.Fields(i)), "", trrec.Fields(i))
Next i
trrec.MoveNext
Loop
End If
Case 4 '退出
Unload Me
Case 5 '确定
If Trim(Combo1(0)) = "" Then
MsgBox "请在第一栏输入美容类别", vbOKOnly + vbCritical, "错误"
Exit Sub
End If
If Trim(Combo1(2)) = "" Then
MsgBox "请在第三栏输入项目名称", vbOKOnly + vbCritical, "错误"
Exit Sub
End If
If MaskEdBox1(0).Text = "" And MaskEdBox1(1).Text = "" Then
MsgBox "您至少要输入一种收费数据", vbOKOnly + vbCritical, "错误"
Exit Sub
End If
rec.Fields("美容类别") = Trim(Combo1(0))
rec.Fields("细分类别") = Trim(Combo1(1))
rec.Fields("项目") = Trim(Combo1(2))
rec.Fields("功能或名称") = Trim(Combo1(3))
rec.Fields("单次收费") = IIf(MaskEdBox1(0).Text = "", Null, MaskEdBox1(0).Text)
rec.Fields("包月收费") = IIf(MaskEdBox1(1).Text = "", Null, MaskEdBox1(1).Text)
rec.Fields("所需原料") = Trim(Text1)
rec.Update
Picture1.Visible = True
Picture2.Visible = False
disa
If sta = True Then
ss
End If
Command1(0).Default = True
Command1(4).Cancel = True
MsgBox "项目收费资料保存成功", vbOKOnly + vbInformation, "提示"
Case 6 '取消
rec.CancelUpdate
Picture1.Visible = True
Picture2.Visible = False
disa
ss
Command1(0).Default = True
Command1(4).Cancel = True
End Select
Exit Sub
jgqerr:
MsgBox Err.Description, vbOKOnly + vbCritical, "错误"
End Sub
Private Sub Command2_Click()
Me.Height = 3315
frmcen Me
End Sub
Private Sub command3_Click()
If ListView1.ListItems.Count <> 0 Then
dytr_main Me, 1, Me.Caption, "项目收费表"
Else
MsgBox "列表中没有资料供打印", vbOKOnly + vbCritical, "错误"
End If
End Sub
Private Sub Form_Load()
frm_main.xmsf.Enabled = False
Me.Height = 3315
frmcen Me
'Set db = OpenDatabase(AppPath + "datas\mry.mdb")
sqlstr = "select distinct 美容类别 from 项目收费表"
Set rec = db.OpenRecordset(sqlstr)
ss
End Sub
Private Sub tr()
If IsNull(trrec.Fields("单次收费")) Then
MaskEdBox1(0).Text = ""
Else
MaskEdBox1(0).Text = CStr(trrec.Fields("单次收费"))
End If
If IsNull(trrec.Fields("包月收费")) Then
MaskEdBox1(1).Text = ""
Else
MaskEdBox1(1).Text = CStr(trrec.Fields("包月收费"))
End If
Text1 = "" & trrec.Fields("所需原料")
End Sub
Private Sub disa()
For i = 0 To Combo1.Count - 2
Combo1(i).Enabled = True
Next i
'Combo1(3).Enabled = False
MaskEdBox1(0).Enabled = False
MaskEdBox1(1).Enabled = False
Text1.Enabled = False
End Sub
Private Sub enab()
For i = 0 To Combo1.Count - 1
Combo1(i).Enabled = True
Next i
MaskEdBox1(0).Enabled = True
MaskEdBox1(1).Enabled = True
Text1.Enabled = True
End Sub
Private Sub Form_Unload(Cancel As Integer)
frm_main.xmsf.Enabled = True
'db.Close
'Set db = Nothing
End Sub
Private Sub ListView1_ColumnClick(ByVal ColumnHeader As MSComctlLib.ColumnHeader)
ListView1.SortKey = ColumnHeader.Index - 1
yn = MsgBox("将按照『" + ColumnHeader.Text + "』排序" + Chr(13) + "是否按升序排列,按[否]将按降序排列", vbYesNo + vbQuestion, "提示")
If yn = vbNo Then
ListView1.SortOrder = lvwDescending
Else
ListView1.SortOrder = lvwAscending
End If
ListView1.Sorted = True
End Sub
Private Sub MaskEdBox1_GotFocus(Index As Integer)
MaskEdBox1(Index).SelStart = 0
MaskEdBox1(Index).SelLength = Len(MaskEdBox1(Index).Text)
End Sub
Private Sub ss()
sqlstr = "select distinct 美容类别 from 项目收费表"
Set rec = db.OpenRecordset(sqlstr)
Combo1(0).Clear
Do While Not rec.EOF
Combo1(0).AddItem rec.Fields("美容类别")
rec.MoveNext
Loop
If Combo1(0).ListCount = 0 Then
For i = 1 To 3
Command1(i).Enabled = False
Next i
Command1(0).Enabled = True
Command1(4).Enabled = True
Else
For i = 1 To 3
Command1(i).Enabled = True
Next i
Command1(0).Enabled = True
Command1(4).Enabled = True
Combo1(0).ListIndex = 0
End If
'Combo1(3).Enabled = False
MaskEdBox1(0).Enabled = False
MaskEdBox1(1).Enabled = False
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -