📄 统计.frm
字号:
Private Sub Combo1_Click()
Me.Command3.Enabled = False
Me.Command1.Enabled = True
Me.Label5.Caption = ""
Me.Label6.Caption = ""
End Sub
Private Sub Command1_Click()
If Combo1.Text <> "所有经办人" Then
With ycdck.Adodc1
.RecordSource = "select * from 申请经办人 where 申请经办人=" & "'" & Combo1.Text & "'"
.Refresh
d = .Recordset.RecordCount
End With
If d = 0 Then
MsgBox "承兑经办人" & Combo1.Text & "还未设置,无法统计。", vbOKOnly Or vbInformation, "系统信息"
Exit Sub
End If
End If
Dim QQ As String
If 启动历史数据 = True Then
QQ = " 台帐数据 "
ElseIf 启动历史数据 = False Then
QQ = " 台帐录入 "
End If
Screen.MousePointer = 11
Dim d1, d2, d3 As String
Dim a1, a2 As Integer
a1 = Val(Text1(0).Text)
a2 = Val(Text1(1).Text)
d1 = Format(Me.DTPicker1.Value, "yyyy-mm-dd")
d2 = Format(Me.DTPicker2.Value, "yyyy-mm-dd")
d3 = Format(Me.DTPicker3.Value, "yyyy-mm-dd")
Dim heji As Double
Dim jilu As Integer
Dim ye As Double
Dim yl As Integer
On Error Resume Next
If Me.Option1(0).Value = True And Combo1.Text = "所有经办人" Then
With ycdck.Adodc1
.RecordSource = "select * from" & QQ & "where 出票日期 between#" & d1 & "#and#" & d2 & "#"
.Refresh
jilu = .Recordset.RecordCount
If jilu = 0 Then
MsgBox "无符合条件数据!", vbOKOnly Or vbInformation, "系统信息"
Screen.MousePointer = 0
Exit Sub
End If
.RecordSource = "select sum(承兑金额) as 到期金额 from" & QQ & "where 出票日期 between#" & d1 & "#and#" & d2 & "#"
.Refresh
heji = .Recordset.Fields(0).Value
'记算到期
.RecordSource = "select sum(承兑金额) as 到期金额 from" & QQ & "where 出票日期 between#" & d1 & "#and#" & d2 & "# and 到期日期 between#" & d3 & "#and#" & "2050-12-30" & "#"
.Refresh
ye = .Recordset.Fields(0).Value
.RecordSource = "select * from" & QQ & "where 出票日期 between#" & d1 & "#and#" & d2 & "# and 到期日期 between#" & d3 & "#and#" & "2050-12-30" & "#"
.Refresh
yl = .Recordset.RecordCount
.RecordSource = "select * from" & QQ & "where 出票日期 between#" & d1 & "#and#" & d2 & "#"
.Refresh
End With
End If
If Me.Option1(1).Value = True And Combo1.Text = "所有经办人" Then
With ycdck.Adodc1
.RecordSource = "select * from" & QQ & "where 自动编号 >=" & a1 & " and 自动编号<=" & a2
.Refresh
jilu = .Recordset.RecordCount
If jilu = 0 Then
MsgBox "无符合条件数据!", vbOKOnly Or vbInformation, "系统信息"
Screen.MousePointer = 0
Exit Sub
End If
.RecordSource = "select sum(承兑金额) as 到期金额 from" & QQ & "where 自动编号 >=" & a1 & " and 自动编号<=" & a2
.Refresh
heji = .Recordset.Fields(0).Value
.RecordSource = "select * from" & QQ & "where 自动编号 >=" & a1 & " and 自动编号<=" & a2
.Refresh
End With
End If
If Me.Option1(0).Value = True And Combo1.Text <> "所有经办人" Then
With ycdck.Adodc1
.RecordSource = "select * from" & QQ & "where 申请经办人='" & Combo1.Text & "' and 出票日期 between#" & d1 & "#and#" & d2 & "#"
.Refresh
jilu = .Recordset.RecordCount
If jilu = 0 Then
MsgBox "无符合条件数据!", vbOKOnly Or vbInformation, "系统信息"
Screen.MousePointer = 0
Exit Sub
End If
.RecordSource = "select sum(承兑金额) as 到期金额 from" & QQ & "where 申请经办人='" & Combo1.Text & "' and 出票日期 between#" & d1 & "#and#" & d2 & "#"
.Refresh
heji = .Recordset.Fields(0).Value
'记算到期
.RecordSource = "select sum(承兑金额) as 到期金额 from" & QQ & "where 申请经办人='" & Combo1.Text & "' and 出票日期 between#" & d1 & "#and#" & d2 & "# and 到期日期 between#" & d3 & "#and#" & "2050-12-30" & "#"
.Refresh
ye = .Recordset.Fields(0).Value
.RecordSource = "select * from" & QQ & "where 申请经办人='" & Combo1.Text & "' and 出票日期 between#" & d1 & "#and#" & d2 & "# and 到期日期 between#" & d3 & "#and#" & "2050-12-30" & "#"
.Refresh
yl = .Recordset.RecordCount
.RecordSource = "select * from" & QQ & "where 申请经办人='" & Combo1.Text & "' and 出票日期 between#" & d1 & "#and#" & d2 & "#"
.Refresh
End With
End If
If Me.Option1(1).Value = True And Combo1.Text <> "所有经办人" Then
With ycdck.Adodc1
.RecordSource = "select * from" & QQ & "where 申请经办人='" & Combo1.Text & "' and 自动编号 >=" & a1 & " and 自动编号<=" & a2
.Refresh
jilu = .Recordset.RecordCount
If jilu = 0 Then
MsgBox "无符合条件数据!", vbOKOnly Or vbInformation, "系统信息"
Screen.MousePointer = 0
Exit Sub
End If
.RecordSource = "select sum(承兑金额) as 到期金额 from" & QQ & "where 申请经办人='" & Combo1.Text & "' and 自动编号 >=" & a1 & " and 自动编号<=" & a2
.Refresh
heji = .Recordset.Fields(0).Value
.RecordSource = "select * from" & QQ & "where 申请经办人='" & Combo1.Text & "' and 自动编号 >=" & a1 & " and 自动编号<=" & a2
.Refresh
End With
End If
Screen.MousePointer = 0
'输出统计结果
Me.Label8.Caption = yl
ye = CCur(ye * 100) / 100
Me.Label7.Caption = ye
Me.Label5.Caption = jilu
heji = CCur(heji * 100) / 100
Me.Label6.Caption = heji
Me.Command1.Enabled = False
End Sub
Private Sub Command2_Click()
Unload Me
End Sub
Private Sub Command3_Click()
承兑经办人 = Combo1.Text
起日期 = Format(Me.DTPicker1.Value, "yy-m-d")
止日期 = Format(Me.DTPicker2.Value, "yy-m-d")
起编号 = Text1(0).Text
止编号 = Text1(1).Text
If 启动历史数据 = True Then
数据源 = "历史数据"
ElseIf 启动历史数据 = False Then
数据源 = "台帐录入"
End If
记录数量 = Me.Label5.Caption
发生数额 = Me.Label6.Caption
ycdck.Show 1
End Sub
Private Sub DTPicker1_Change()
Me.Command3.Enabled = False
Me.Command1.Enabled = True
Me.Label5.Caption = ""
Me.Label6.Caption = ""
End Sub
Private Sub DTPicker1_Click()
Me.Command3.Enabled = False
Me.Command1.Enabled = True
Me.Label5.Caption = ""
Me.Label6.Caption = ""
End Sub
Private Sub DTPicker1_CloseUp()
Me.Command3.Enabled = False
Me.Command1.Enabled = True
Me.Label5.Caption = ""
Me.Label6.Caption = ""
End Sub
Private Sub DTPicker2_Change()
Me.Command3.Enabled = False
Me.Command1.Enabled = True
Me.Label5.Caption = ""
Me.Label6.Caption = ""
End Sub
Private Sub DTPicker2_Click()
Me.Command3.Enabled = False
Me.Command1.Enabled = True
Me.Label5.Caption = ""
Me.Label6.Caption = ""
End Sub
Private Sub DTPicker3_Change()
Me.Command3.Enabled = False
Me.Command1.Enabled = True
Me.Label5.Caption = ""
Me.Label6.Caption = ""
End Sub
Private Sub DTPicker3_Click()
Me.Command3.Enabled = False
Me.Command1.Enabled = True
Me.Label5.Caption = ""
Me.Label6.Caption = ""
End Sub
Private Sub Form_Activate()
Me.Label5.Caption = ""
Me.Label6.Caption = ""
Me.Command3.Enabled = False
Me.Command1.Enabled = True
End Sub
Private Sub Form_Load()
Me.DTPicker3.Value = Format(Now, "yyyy-mm-dd")
End Sub
Private Sub Label5_Change()
Me.Command3.Enabled = True
If Label5 = "" Then
Label7.Caption = ""
Label8.Caption = ""
End If
End Sub
Private Sub Option1_Click(Index As Integer)
Me.Command3.Enabled = False
Me.Command1.Enabled = True
Me.Label5.Caption = ""
Me.Label6.Caption = ""
Select Case Index
Case 0
For i = 0 To 1
Text1(i).Text = ""
Text1(i).Enabled = False
Next i
Me.DTPicker1.Enabled = True
Me.DTPicker2.Enabled = True
Case 1
Me.DTPicker1.Enabled = False
Me.DTPicker2.Enabled = False
For i = 0 To 1
Text1(i).Enabled = True
Next i
Text1(0).SetFocus
End Select
End Sub
Private Sub Text1_Change(Index As Integer)
Me.Command3.Enabled = False
Me.Command1.Enabled = True
Me.Label5.Caption = ""
Me.Label6.Caption = ""
End Sub
Private Sub Text1_KeyPress(Index As Integer, KeyAscii As Integer)
If KeyAscii = 46 Then
Exit Sub
End If
If KeyAscii = 8 Then
Exit Sub
ElseIf KeyAscii < 48 Or KeyAscii > 57 Then
Beep
KeyAscii = 0
End If
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -