Frmjf2.frm
上传用户:bubble
上传日期:2007-03-02
资源大小:403k
文件大小:17k
- VERSION 5.00
- Begin VB.Form Frmjf1
- BorderStyle = 1 'Fixed Single
- Caption = "交费"
- ClientHeight = 5355
- ClientLeft = 3105
- ClientTop = 1485
- ClientWidth = 6480
- LinkTopic = "Form2"
- MaxButton = 0 'False
- MDIChild = -1 'True
- MinButton = 0 'False
- ScaleHeight = 5355
- ScaleWidth = 6480
- Begin VB.CommandButton Command1
- Caption = "确定"
- Height = 255
- Left = 1200
- TabIndex = 11
- Top = 5070
- Width = 1095
- End
- Begin VB.CommandButton Command2
- Caption = "取消"
- Height = 255
- Left = 4080
- TabIndex = 10
- Top = 5070
- Width = 1095
- End
- Begin VB.Frame Frame1
- Height = 5055
- Left = 120
- TabIndex = 0
- Top = 0
- Width = 6255
- Begin VB.ListBox List1
- Appearance = 0 'Flat
- Height = 930
- Left = 1320
- TabIndex = 29
- Top = 1970
- Visible = 0 'False
- Width = 1335
- End
- Begin VB.TextBox Text2
- Appearance = 0 'Flat
- BackColor = &H80000018&
- ForeColor = &H000000FF&
- Height = 270
- Left = 4320
- Locked = -1 'True
- TabIndex = 24
- Top = 1680
- Width = 1335
- End
- Begin VB.ComboBox Combo1
- BackColor = &H80000018&
- Height = 300
- Left = 1320
- TabIndex = 23
- Top = 960
- Width = 2655
- End
- Begin VB.ComboBox Combo4
- BackColor = &H80000018&
- Height = 300
- Left = 1320
- TabIndex = 22
- Top = 1680
- Width = 1335
- End
- Begin VB.ComboBox Combo2
- BackColor = &H80000018&
- Height = 300
- Left = 1320
- TabIndex = 21
- Top = 1320
- Width = 1335
- End
- Begin VB.Frame Frame4
- Caption = "以上欠费"
- Height = 855
- Left = 240
- TabIndex = 4
- Top = 3960
- Width = 5895
- Begin VB.TextBox Text1
- Alignment = 1 'Right Justify
- Appearance = 0 'Flat
- BackColor = &H80000018&
- ForeColor = &H000000FF&
- Height = 270
- Index = 4
- Left = 4320
- Locked = -1 'True
- TabIndex = 17
- TabStop = 0 'False
- Top = 360
- Width = 855
- End
- Begin VB.TextBox Text1
- Alignment = 1 'Right Justify
- Appearance = 0 'Flat
- BackColor = &H80000018&
- ForeColor = &H000000FF&
- Height = 270
- Index = 3
- Left = 1560
- Locked = -1 'True
- TabIndex = 16
- TabStop = 0 'False
- Top = 360
- Width = 855
- End
- Begin VB.Label Label9
- Caption = "累计欠费:"
- Height = 255
- Left = 3360
- TabIndex = 8
- Top = 360
- Width = 1095
- End
- Begin VB.Label Label10
- Caption = "元"
- Height = 255
- Left = 5280
- TabIndex = 7
- Top = 360
- Width = 255
- End
- Begin VB.Label Label11
- Caption = "以上欠费:"
- Height = 255
- Left = 240
- TabIndex = 6
- Top = 360
- Width = 975
- End
- Begin VB.Label Label12
- Caption = "元"
- Height = 255
- Left = 2520
- TabIndex = 5
- Top = 360
- Width = 615
- End
- End
- Begin VB.Frame Frame3
- Caption = "交费情况"
- Height = 1455
- Left = 240
- TabIndex = 1
- Top = 2280
- Width = 5895
- Begin VB.TextBox Text1
- Alignment = 1 'Right Justify
- Appearance = 0 'Flat
- BackColor = &H80000018&
- ForeColor = &H000000FF&
- Height = 270
- Index = 2
- Left = 4320
- Locked = -1 'True
- TabIndex = 15
- TabStop = 0 'False
- Top = 960
- Width = 855
- End
- Begin VB.TextBox Text1
- Alignment = 1 'Right Justify
- Appearance = 0 'Flat
- BackColor = &H80000018&
- Height = 270
- Index = 1
- Left = 1560
- TabIndex = 14
- Top = 960
- Width = 855
- End
- Begin VB.TextBox Text1
- Alignment = 1 'Right Justify
- Appearance = 0 'Flat
- BackColor = &H80000018&
- ForeColor = &H000000FF&
- Height = 270
- Index = 0
- Left = 1560
- Locked = -1 'True
- TabIndex = 13
- TabStop = 0 'False
- Top = 480
- Width = 855
- End
- Begin VB.Label Label14
- Caption = "元"
- Height = 255
- Left = 2520
- TabIndex = 20
- Top = 480
- Width = 255
- End
- Begin VB.Label Label13
- Caption = "元"
- Height = 255
- Left = 5280
- TabIndex = 19
- Top = 960
- Width = 255
- End
- Begin VB.Label Label8
- Caption = "元"
- Height = 255
- Left = 2520
- TabIndex = 18
- Top = 960
- Width = 255
- End
- Begin VB.Label Label6
- Caption = "本次欠费:"
- Height = 255
- Left = 3360
- TabIndex = 9
- Top = 960
- Width = 975
- End
- Begin VB.Label Label5
- Caption = "本学期应交费:"
- Height = 255
- Left = 240
- TabIndex = 3
- Top = 480
- Width = 1335
- End
- Begin VB.Label Label1
- Caption = "实际交费:"
- Height = 255
- Left = 240
- TabIndex = 2
- Top = 960
- Width = 975
- End
- End
- Begin VB.Label Label7
- Caption = "姓名:"
- Height = 255
- Left = 3360
- TabIndex = 28
- Top = 1725
- Width = 615
- End
- Begin VB.Label Label2
- Caption = "学号:"
- Height = 255
- Left = 720
- TabIndex = 27
- Top = 1710
- Width = 615
- End
- Begin VB.Label Label3
- Caption = "班级:"
- Height = 255
- Left = 720
- TabIndex = 26
- Top = 1365
- Width = 615
- End
- Begin VB.Label Label4
- Caption = "学期:"
- Height = 255
- Left = 720
- TabIndex = 25
- Top = 1005
- Width = 615
- End
- Begin VB.Label Label15
- Caption = "交费管理"
- BeginProperty Font
- Name = "楷体_GB2312"
- Size = 18
- Charset = 134
- Weight = 400
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- Height = 495
- Left = 2040
- TabIndex = 12
- Top = 360
- Width = 1815
- End
- End
- End
- Attribute VB_Name = "Frmjf1"
- Attribute VB_GlobalNameSpace = False
- Attribute VB_Creatable = False
- Attribute VB_PredeclaredId = True
- Attribute VB_Exposed = False
- Public bbb As Boolean
- Private Sub Combo1_Click()
- If Combo2.Text = "" Or Combo1.Text = "" Then
- Exit Sub
- End If
- txtsql = "select 学费 from xuefei where 学期='" & Trim(Combo1.Text) & "' and 专业=(select 专业 from class where 班级='" & Trim(Combo2.Text) & "') and 年制=(select 年制 from class where 班级='" & Trim(Combo2.Text) & "') and 年级=(select 年级 from class where 班级='" & Trim(Combo2.Text) & "')"
- Set mrc = ExecuteSQL(txtsql)
- If mrc.EOF = True Then
- sss = MsgBox("请先设置该班级的学费!", vbExclamation + vbOKOnly, "警告")
- Command1.Enabled = False
- Text1(0).Text = ""
- Exit Sub
- Else
- Command1.Enabled = True
- End If
- Text1(0).Text = mrc.Fields(0)
- End Sub
- Private Sub Combo2_Click()
- Dim mrc As ADODB.Recordset
- txtsql = "select DISTINCT 学号 from xj where 班级='" & Trim(Combo2.Text) & "' order by 学号"
- Set mrc = ExecuteSQL(txtsql)
- If mrc.EOF = True Then
- Combo4.Clear
- Text2.Text = ""
- Else
- mrc.MoveFirst
- Combo4.Clear
- Do While Not mrc.EOF
- Combo4.AddItem mrc.Fields(0)
-
- mrc.MoveNext
- Loop
- Combo4.ListIndex = 0
- Set mrc = Nothing
- End If
- If Combo2.Text = "" Or Combo1.Text = "" Then
- Exit Sub
- End If
- txtsql = "select 学费 from xuefei where 学期='" & Trim(Combo1.Text) & "' and 专业=(select 专业 from class where 班级='" & Trim(Combo2.Text) & "') and 年制=(select 年制 from class where 班级='" & Trim(Combo2.Text) & "') and 年级=(select 年级 from class where 班级='" & Trim(Combo2.Text) & "')"
- Set mrc = ExecuteSQL(txtsql)
- If mrc.EOF = True Then
- sss = MsgBox("请先设置该班级的学费!", vbExclamation + vbOKOnly, "警告")
- Command1.Enabled = False
- Text1(0).Text = ""
- Text1(1).Text = ""
- Text1(2).Text = ""
- Text1(3).Text = ""
- Text1(4).Text = ""
- Exit Sub
- Else
- Command1.Enabled = True
- End If
- Text1(0).Text = mrc.Fields(0)
- Set mrc = Nothing
- End Sub
- Private Sub Combo4_Change()
- If Trim(Combo4.Text) = "" Then
- List1.Clear
- List1.Visible = False
- Exit Sub
- End If
- If bbb = True Then
- List1.Clear
- List1.Visible = False
- Dim mrc As ADODB.Recordset
- txtsql = "select DISTINCT 姓名 from xj where 学号 ='" & Trim(Combo4.Text) & "'"
- Set mrc = ExecuteSQL(txtsql)
- If mrc.EOF = True Then
- sss = MsgBox("没有此学号!", vbExclamation + vbOKOnly, "警告")
- Text2.Text = ""
- Exit Sub
- End If
- Text2.Text = mrc.Fields(0)
- Set mrc = Nothing
- Exit Sub
- End If
- Dim rst As ADODB.Recordset
- Dim str As String
- str = "select 学号 from xj where 学号 like'" & Trim(Combo4.Text) & "%' and 班级='" & Trim(Combo2.Text) & "' order by 学号"
- Set rst = ExecuteSQL(str)
- If rst.EOF = True Then
- List1.Clear
- List1.Visible = False
- Set rst = Nothing
- Exit Sub
- End If
- List1.Clear
- Do Until rst.EOF
- List1.AddItem rst.Fields(0)
- rst.MoveNext
- Loop
- Set rst = Nothing
- List1.Visible = True
- End Sub
- Private Sub Combo4_Click()
- Dim mrc As ADODB.Recordset
- txtsql = "select DISTINCT 姓名 from xj where 学号 ='" & Trim(Combo4.Text) & "'"
- Set mrc = ExecuteSQL(txtsql)
- Text2.Text = mrc.Fields(0)
- Text1(1).SetFocus
- txtsql = "select 学号,sum(欠费) from jf group by 学号 having 学号='" & Trim(Combo4.Text) & "'"
- Set mrc = ExecuteSQL(txtsql)
- If mrc.EOF = True Then
- Text1(3).Text = "0"
- Text1(4).Text = "0"
- Exit Sub
- End If
- Text1(1).SetFocus
- Text1(3).Text = mrc.Fields(1)
- Text1(4).Text = mrc.Fields(1)
- Set mrc = Nothing
- End Sub
- Private Sub Combo4_KeyPress(KeyAscii As Integer)
- 'List1.Visible = True
- If KeyAscii = 13 Then
- Dim mrc As ADODB.Recordset
- txtsql = "select DISTINCT 姓名 from xj where 学号 ='" & Trim(Combo4.Text) & "'"
- Set mrc = ExecuteSQL(txtsql)
- If mrc.EOF = True Then
- sss = MsgBox("没有此学号!", vbExclamation + vbOKOnly, "警告")
- Text2.Text = ""
- Text1(1).Text = ""
- Text1(2).Text = ""
- Text1(3).Text = ""
- Text1(4).Text = ""
- Exit Sub
- End If
- Text2.Text = mrc.Fields(0)
- Text1(1).SetFocus
- Set mrc = Nothing
- Else
- bbb = False
- End If
- End Sub
- Private Sub Command1_Click()
- If Trim(Combo4.Text) = "" Then
- ss = MsgBox("学号不能为空!", vbExclamation + vbOKOnly, "警告")
- Combo4.SetFocus
- Exit Sub
- End If
- If Trim(Text1(1).Text) = "" Then
- ss = MsgBox("交费不能为空!", vbExclamation + vbOKOnly, "警告")
- Text1(1).SetFocus
- Exit Sub
- End If
- Dim mrc As ADODB.Recordset
- txtsql = "select * from xj where 学号='" & Trim(Combo4.Text) & "'"
- Set mrc = ExecuteSQL(txtsql)
- If mrc.EOF = True Then
- sss = MsgBox("该班级不存在该学生记录!", vbExclamation + vbOKOnly, "警告")
- Combo4.SetFocus
- Combo4.SelStart = 0
- Combo4.SelLength = Len(Combo4.Text)
- Exit Sub
- End If
- txtsql = "select * from jf where 学号='" & Trim(Combo4.Text) & "' and 学期='" & Trim(Combo1.Text) & "'"
- Set mrc = ExecuteSQL(txtsql)
- If mrc.EOF = False Then
- sss = MsgBox("已经存在该学生本学期的交费记录!", vbExclamation + vbOKOnly, "警告")
- Exit Sub
- End If
- txtsql = "select * from jf"
- Set mrc = ExecuteSQL(txtsql)
- mrc.AddNew
- mrc.Fields(0) = Trim(Combo4.Text)
- mrc.Fields(1) = Trim(Combo1.Text)
- mrc.Fields(2) = Trim(Text1(1).Text)
- mrc.Fields(3) = Trim(Text1(2).Text)
- mrc.Fields(4) = Date
- mrc.Fields(5) = username
- mrc.Update
- Combo4.Text = ""
- For i = 1 To 3
- Text1(i).Text = ""
- Next i
- End Sub
- Private Sub Command1_GotFocus()
- Text1(2).Text = Val(Text1(0).Text) - Val(Text1(1).Text)
- Text1(4).Text = Val(Text1(3).Text) + Val(Text1(2).Text)
- End Sub
- Private Sub Command2_Click()
- Unload Me
- End Sub
- Private Sub Form_Activate()
- List1.Visible = False
- Dim mrc As ADODB.Recordset
- txtsql = "select DISTINCT 班级 from class order by 班级"
- Set mrc = ExecuteSQL(txtsql)
- mrc.MoveFirst
- Combo2.Clear
- Do While Not mrc.EOF
- Combo2.AddItem mrc.Fields(0)
-
- mrc.MoveNext
- Loop
- Combo2.ListIndex = 0
-
- Combo1.AddItem Val(Format(Date, "yyyy")) - 1 & "---" & Val(Format(Date, "yyyy")) & "年度第一学期"
- Combo1.AddItem Val(Format(Date, "yyyy")) - 1 & "---" & Val(Format(Date, "yyyy")) & "年度第二学期"
- Combo1.AddItem Format(Date, "yyyy") & "---" & Val(Format(Date, "yyyy")) + 1 & "年度第一学期"
- Combo1.AddItem Format(Date, "yyyy") & "---" & Val(Format(Date, "yyyy")) + 1 & "年度第二学期"
- Combo1.AddItem Val(Format(Date, "yyyy")) + 1 & "---" & Val(Format(Date, "yyyy")) + 2 & "年度第一学期"
- Combo1.AddItem Val(Format(Date, "yyyy")) + 1 & "---" & Val(Format(Date, "yyyy")) + 2 & "年度第二学期"
- If Val(Format(Date, "mm")) > 8 Then
- Combo1.ListIndex = 2
- Else
- Combo1.ListIndex = 1
- End If
- Set mrc = Nothing
- End Sub
- Private Sub List1_Click()
- bbb = True
- Combo4.Text = List1.List(List1.ListIndex)
- End Sub
- Private Sub Text1_GotFocus(Index As Integer)
- List1.Visible = False
- If Index = 1 Then
- Text1(1).Text = Text1(0).Text
- Text1(1).SelStart = 0
- Text1(1).SelLength = Len(Text1(1).Text)
- Else
- Command1.SetFocus
- End If
- End Sub
- Private Sub Text1_KeyPress(Index As Integer, KeyAscii As Integer)
- Dim shao As Integer
- Dim zs As String
- If KeyAscii <> 8 And KeyAscii <> 13 Then
- shao = InStr(Trim(Text1(Index).Text), ".")
- If shao <> 0 Then
- zs = Right(Trim(Text1(Index).Text), Len(Trim(Text1(Index).Text)) - shao)
- If Len(zs) > 1 Then KeyAscii = 0
- End If
- End If
- If KeyAscii = 13 Or KeyAscii = 46 Or KeyAscii > 47 And KeyAscii < 58 Or KeyAscii = 8 Then
- Else
- KeyAscii = 0
- Exit Sub
- End If
- If KeyAscii = 13 Then
- Text1(2).Text = Val(Text1(0).Text) - Val(Text1(1).Text)
- Text1(4).Text = Val(Text1(3).Text) + Val(Text1(2).Text)
- Command1.SetFocus
- End If
- End Sub
- Private Sub Text1_LostFocus(Index As Integer)
- If Command1.Enabled = True Then
- Command1.SetFocus
- End If
- End Sub