📄 frm_xfxm.frm
字号:
VERSION 5.00
Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "mscomctl.ocx"
Begin VB.Form frm_xfxm
BorderStyle = 3 'Fixed Dialog
Caption = "消费项目设置"
ClientHeight = 6375
ClientLeft = 30
ClientTop = 435
ClientWidth = 9180
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 6375
ScaleWidth = 9180
ShowInTaskbar = 0 'False
StartUpPosition = 3 'Windows Default
Begin VB.TextBox txt_jiage
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 372
Left = 1080
MaxLength = 10
TabIndex = 14
Top = 1200
Width = 1452
End
Begin VB.TextBox txt_zhekou
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 372
Left = 1080
MaxLength = 10
TabIndex = 13
Top = 1680
Width = 1452
End
Begin VB.TextBox txt_Name
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 372
Left = 1080
MaxLength = 10
TabIndex = 7
Top = 720
Width = 2772
End
Begin VB.TextBox txt_NO
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 372
Left = 1080
MaxLength = 8
TabIndex = 6
Top = 240
Width = 1452
End
Begin VB.CommandButton cmd_Co
Caption = "退出(&Q)"
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 492
Index = 5
Left = 7560
TabIndex = 5
Top = 840
Width = 1284
End
Begin VB.CommandButton cmd_Co
Caption = "取消(&C)"
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 492
Index = 4
Left = 6240
TabIndex = 4
Top = 840
Width = 1284
End
Begin VB.CommandButton cmd_Co
Caption = "确定(&O)"
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 492
Index = 3
Left = 4920
TabIndex = 3
Top = 840
Width = 1284
End
Begin VB.CommandButton cmd_Co
Caption = "删除(&D)"
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 492
Index = 2
Left = 7560
TabIndex = 2
Top = 240
Width = 1284
End
Begin VB.CommandButton cmd_Co
Caption = "修改(E)"
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 492
Index = 1
Left = 6240
TabIndex = 1
Top = 240
Width = 1284
End
Begin VB.CommandButton cmd_Co
Caption = "新增(&A)"
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 492
Index = 0
Left = 4920
TabIndex = 0
Top = 240
Width = 1284
End
Begin MSComctlLib.ListView ListView_Duty
Height = 3852
Left = 240
TabIndex = 8
Top = 2280
Width = 8652
_ExtentX = 15266
_ExtentY = 6800
LabelWrap = -1 'True
HideSelection = -1 'True
FullRowSelect = -1 'True
GridLines = -1 'True
_Version = 393217
ForeColor = -2147483640
BackColor = -2147483643
BorderStyle = 1
Appearance = 1
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
NumItems = 0
End
Begin VB.Label Label4
Caption = "折扣:"
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 252
Left = 240
TabIndex = 12
Top = 1680
Width = 852
End
Begin VB.Label Label1
Caption = "价格:"
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 252
Left = 240
TabIndex = 11
Top = 1200
Width = 732
End
Begin VB.Label Label3
Caption = "名称:"
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 252
Left = 240
TabIndex = 10
Top = 720
Width = 852
End
Begin VB.Label Label2
Caption = "编号:"
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 252
Left = 240
TabIndex = 9
Top = 240
Width = 852
End
End
Attribute VB_Name = "frm_xfxm"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim active As Integer
Dim listview_index As Integer
Dim str_DutyNo, str_DutyName As String
Dim rs As New ADODB.Recordset
Private Sub cmd_Co_Click(Index As Integer)
Select Case Index
Case 0
active = 0
Cmd_F
txt_NO.Enabled = True
txt_NO.SetFocus
txt_NO.Text = ""
txt_Name.Text = ""
txt_jiage.Text = ""
txt_zhekou.Text = ""
Case 1
active = 1
str_Set
txt_NO.Enabled = False
Case 2
str_Set
If active <> 3 Then
If MsgBox("确实要删除该记录吗?", vbCritical + vbYesNo, "中芯德立提示信息") = vbYes Then
maSys_db.Execute "delete from 消费项目明细表 where 消费项目编号='" & str_DutyNo & "'"
Rs_Record_Set
End If
End If
Cmd_T
Case 3
Call txt_zhekou_LostFocus
If active = 1 Then
If txt_NO <> "" And txt_Name <> "" And txt_jiage <> "" And txt_zhekou <> "" Then
maSys_db.Execute "update 消费项目明细表 set 消费项目名称='" & Trim(txt_Name) & "',价格=" & Val(txt_jiage) & ",折扣=" & Val(txt_zhekou) & " where 消费项目编号='" & Trim(str_DutyNo) & "'"
Rs_Record_Set
Else
Exit Sub
End If
Else
If txt_NO <> "" And txt_Name <> "" And txt_jiage <> "" And txt_zhekou <> "" Then
Set rs = GetRecordset(maSys_db, "select * from 消费项目明细表 where 消费项目编号='" & Trim(txt_NO.Text) & "'")
If Not rs.EOF Then '该员工编号在数据库中已经存在!
MsgBox "该编号在数据库中已经存在,请核对!", vbInformation + vbOKOnly, "中芯德立提示信息"
Exit Sub
End If
maSys_db.Execute "insert into 消费项目明细表(消费项目编号,消费项目名称,价格,折扣) values('" & Trim(txt_NO.Text) & "','" & Trim(txt_Name.Text) & "'," & Val(txt_jiage.Text) & "," & Val(txt_zhekou.Text) & ")"
Rs_Record_Set
Else
MsgBox "输入不能为空!", vbInformation + vbOKOnly, "中芯德立提示信息"
Exit Sub
End If
End If
Cmd_T
Case 4
Cmd_T
Case 5
Unload Me
End Select
End Sub
Private Sub str_Set()
If ListView_Duty.ListItems.Count <> 0 Then
listview_index = ListView_Duty.SelectedItem
' str_DutyNo = ListView_Duty.ListItems(listview_index).SubItems(1)
' str_DutyName = ListView_Duty.ListItems(listview_index).SubItems(2)
txt_NO = ListView_Duty.ListItems(listview_index).SubItems(1)
txt_Name = ListView_Duty.ListItems(listview_index).SubItems(2)
txt_jiage = ListView_Duty.ListItems(listview_index).SubItems(3)
txt_zhekou = ListView_Duty.ListItems(listview_index).SubItems(4)
str_DutyNo = txt_NO
str_DutyName = txt_Name
Cmd_F
Else
str_Msg = MsgBox("没有可供操作的记录!", vbInformation + vbOKOnly, "中芯德立提示信息")
active = 3
Exit Sub
End If
End Sub
Private Sub Form_Load()
Me.Top = (Screen.Height - Me.Height) / 2
Me.Left = (Screen.Width - Me.Width) / 2
txt_NO.Text = ""
txt_Name.Text = ""
txt_jiage.Text = ""
txt_zhekou.Text = ""
Rs_Record_Set
Cmd_T
' maSys_db.Execute "delete from Full_UserDict "
' maSys_db.Execute "delete from linkdatabuffer "
End Sub
Private Sub Rs_Record_Set() '显示记录到listview
Dim L As ListItem
Dim i As Integer
Set rs = GetRecordset(maSys_db, "select * from 消费项目明细表")
ListView_Duty.ColumnHeaders.Clear
ListView_Duty.ListItems.Clear
ListView_Duty.View = lvwReport
ListView_Duty.ColumnHeaders.Add , , "ID", 800
ListView_Duty.ColumnHeaders.Add , , "项目编号", 1500
ListView_Duty.ColumnHeaders.Add , , "项目名称", 4000
ListView_Duty.ColumnHeaders.Add , , "价格", 1000
ListView_Duty.ColumnHeaders.Add , , "折扣", 1000
i = 1
If rs.EOF Then
Exit Sub
Else
rs.MoveFirst
Do While Not rs.EOF
Set L = ListView_Duty.ListItems.Add(, , i)
L.SubItems(1) = CStr(rs!消费项目编号)
L.SubItems(2) = CStr(rs!消费项目名称)
L.SubItems(3) = Trim(str(rs!价格))
L.SubItems(4) = Trim(str(rs!折扣))
i = i + 1
rs.MoveNext
Loop
End If
End Sub
Private Sub Cmd_T()
cmd_Co(0).Enabled = True
cmd_Co(1).Enabled = True
cmd_Co(2).Enabled = True
cmd_Co(3).Enabled = False
cmd_Co(4).Enabled = False
cmd_Co(5).Enabled = True
End Sub
Private Sub Cmd_F()
cmd_Co(0).Enabled = False
cmd_Co(1).Enabled = False
cmd_Co(2).Enabled = False
cmd_Co(3).Enabled = True
cmd_Co(4).Enabled = True
cmd_Co(5).Enabled = False
End Sub
Private Sub txt_jiage_KeyPress(KeyAscii As Integer)
If KeyAscii > 57 Or KeyAscii < 48 And KeyAscii <> 8 And KeyAscii <> 46 Then
KeyAscii = 0
End If
End Sub
Private Sub txt_no_KeyPress(KeyAscii As Integer)
If KeyAscii > 57 Or KeyAscii < 48 And KeyAscii <> 8 Then
KeyAscii = 0
End If
End Sub
Private Sub txt_no_LostFocus()
txt_NO = Format(txt_NO, "00000000")
End Sub
Private Sub txt_zhekou_LostFocus()
If Val(txt_zhekou.Text) < 0 Or Val(txt_zhekou.Text) > 100 Then
MsgBox "折扣输入错误!", vbInformation + vbOKOnly, "中芯德立提示信息"
txt_zhekou = ""
End If
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -