📄 frmtong.frm
字号:
VERSION 5.00
Object = "{86CF1D34-0C5F-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCT2.OCX"
Begin VB.Form frmtong
BorderStyle = 3 'Fixed Dialog
Caption = "统计"
ClientHeight = 3135
ClientLeft = 45
ClientTop = 330
ClientWidth = 6375
Icon = "frmtong.frx":0000
LinkTopic = "Form1"
LockControls = -1 'True
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 3135
ScaleWidth = 6375
ShowInTaskbar = 0 'False
StartUpPosition = 1 '所有者中心
Begin VB.CommandButton Command1
Caption = "确定"
Height = 435
Left = 1800
TabIndex = 12
Top = 2520
Width = 1215
End
Begin VB.CommandButton Command2
Caption = "退出"
Height = 435
Left = 3360
TabIndex = 11
Top = 2520
Width = 1215
End
Begin VB.Frame Frame1
Caption = "指定统计区间"
Height = 2055
Left = 240
TabIndex = 0
Top = 240
Width = 5895
Begin VB.OptionButton Option1
Caption = "出票日期介于"
Height = 255
Index = 0
Left = 480
TabIndex = 4
Top = 600
Value = -1 'True
Width = 1455
End
Begin VB.OptionButton Option1
Caption = "自动编号介于"
Height = 255
Index = 1
Left = 480
TabIndex = 3
Top = 1320
Width = 1455
End
Begin VB.TextBox Text1
Enabled = 0 'False
Height = 270
Index = 0
Left = 1920
TabIndex = 2
Top = 1320
Width = 1335
End
Begin VB.TextBox Text1
Enabled = 0 'False
Height = 270
Index = 1
Left = 3600
TabIndex = 1
Top = 1320
Width = 1335
End
Begin MSComCtl2.DTPicker DTPicker1
Height = 255
Left = 1920
TabIndex = 5
Top = 600
Width = 1335
_ExtentX = 2355
_ExtentY = 450
_Version = 393216
Format = 24576001
CurrentDate = 37331
End
Begin MSComCtl2.DTPicker DTPicker2
Height = 255
Left = 3600
TabIndex = 6
Top = 600
Width = 1335
_ExtentX = 2355
_ExtentY = 450
_Version = 393216
Format = 24576001
CurrentDate = 37331
End
Begin VB.Label Label2
Caption = "和"
Height = 255
Index = 0
Left = 3360
TabIndex = 10
Top = 640
Width = 255
End
Begin VB.Label Label2
Caption = "之间"
Height = 255
Index = 1
Left = 5040
TabIndex = 9
Top = 640
Width = 495
End
Begin VB.Label Label2
Caption = "和"
Height = 255
Index = 2
Left = 3360
TabIndex = 8
Top = 1360
Width = 255
End
Begin VB.Label Label2
Caption = "之间"
Height = 255
Index = 3
Left = 5040
TabIndex = 7
Top = 1360
Width = 495
End
End
End
Attribute VB_Name = "frmtong"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Command1_Click()
Screen.MousePointer = 11
Dim d1, d2 As String
Dim a1, a2 As Integer
a1 = Val(Text1(0).Text)
a2 = Val(Text1(1).Text)
d1 = Format(Me.DTPicker1.Value, "yyyy-m-d")
d2 = Format(Me.DTPicker2.Value, "yyyy-m-d")
Dim heji As Double
Dim jilu As Integer
With ycdck.Adodc1
If Me.Option1(0).Value = True Then
.RecordSource = "select sum(承兑金额) as 到期金额 from 台帐录入 where 出票日期 between#" & d1 & "#and#" & d2 & "#"
.Refresh
On Error Resume Next
heji = ycdck.Adodc1.Recordset.Fields(0)
.RecordSource = "select * from 台帐录入 where 出票日期 between#" & d1 & "#and#" & d2 & "#"
ElseIf Me.Option1(1).Value = True Then
.RecordSource = "select sum(承兑金额) as 到期金额 from 台帐录入 where 自动编号 >=" & a1 & " and 自动编号<=" & a2
.Refresh
heji = ycdck.Adodc1.Recordset.Fields(0)
.RecordSource = "select * from 台帐录入 where 自动编号 >=" & a1 & " and 自动编号<=" & a2
End If
.Refresh
jilu = .Recordset.RecordCount
If jilu = 0 Then
MsgBox "无符合条件数据!", vbOKOnly Or vbInformation, "系统信息"
Screen.MousePointer = 0
Exit Sub
End If
Screen.MousePointer = 0
If Me.Option1(0).Value = True Then
MsgBox "出票日期在" & d1 & "至" & d2 & "之间的记录总数为" & jilu & ",承兑金额合计为" & heji & "。", vbOKOnly Or vbInformation, "统计结果"
ElseIf Me.Option1(1).Value = True Then
MsgBox "自动编号在" & a1 & "至" & a2 & "之间的记录总数为" & jilu & ",承兑金额合计为" & heji & "。", vbOKOnly Or vbInformation, "统计结果"
End If
End With
End Sub
Private Sub Command2_Click()
Unload Me
End Sub
Private Sub Form_Load()
With ycdck.Adodc1
.RecordSource = "select min(出票日期) as min出票日期,max(出票日期) as max出票日期 from 台帐录入"
.Refresh
Me.DTPicker1.Value = .Recordset.Fields(0)
Me.DTPicker2.Value = .Recordset.Fields(1)
End With
End Sub
Private Sub Option1_Click(Index As Integer)
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_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 + -