📄 main_ysbb.frm
字号:
VERSION 5.00
Object = "{86CF1D34-0C5F-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCT2.OCX"
Object = "{CDE57A40-8B86-11D0-B3C6-00A0C90AEA82}#1.0#0"; "MSDATGRD.OCX"
Begin VB.Form main_ysbb
BorderStyle = 3 'Fixed Dialog
Caption = "登记预收报表"
ClientHeight = 3990
ClientLeft = 45
ClientTop = 555
ClientWidth = 11100
Icon = "main_ysbb.frx":0000
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 3990
ScaleWidth = 11100
ShowInTaskbar = 0 'False
StartUpPosition = 1 '所有者中心
Begin MSDataGridLib.DataGrid DataGrid1
Height = 2775
Left = 240
TabIndex = 16
Top = 720
Width = 9975
_ExtentX = 17595
_ExtentY = 4895
_Version = 393216
HeadLines = 1
RowHeight = 15
BeginProperty HeadFont {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ColumnCount = 2
BeginProperty Column00
DataField = ""
Caption = ""
BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED}
Type = 0
Format = ""
HaveTrueFalseNull= 0
FirstDayOfWeek = 0
FirstWeekOfYear = 0
LCID = 2052
SubFormatType = 0
EndProperty
EndProperty
BeginProperty Column01
DataField = ""
Caption = ""
BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED}
Type = 0
Format = ""
HaveTrueFalseNull= 0
FirstDayOfWeek = 0
FirstWeekOfYear = 0
LCID = 2052
SubFormatType = 0
EndProperty
EndProperty
SplitCount = 1
BeginProperty Split0
BeginProperty Column00
EndProperty
BeginProperty Column01
EndProperty
EndProperty
End
Begin VB.Frame Frame2
Caption = "Frame2"
Height = 1290
Left = -3900
TabIndex = 7
Top = 900
Visible = 0 'False
Width = 5010
Begin VB.TextBox G1
Height = 270
Left = 195
TabIndex = 9
Top = 600
Width = 1635
End
Begin VB.TextBox G2
Height = 270
Left = 195
TabIndex = 8
Top = 270
Width = 1620
End
End
Begin VB.Frame Frame1
Height = 675
Left = 60
TabIndex = 0
Top = 0
Width = 10995
Begin VB.CommandButton Command1
BackColor = &H00C0C0C0&
Caption = "确定"
Height = 345
Left = 8520
Style = 1 'Graphical
TabIndex = 12
Top = 210
Width = 1200
End
Begin VB.TextBox czy
BackColor = &H80000000&
BorderStyle = 0 'None
Height = 240
Left = 795
TabIndex = 10
Top = 255
Width = 1035
End
Begin MSComCtl2.DTPicker DTM1
Height = 315
Left = 4005
TabIndex = 5
Top = 210
Width = 1350
_ExtentX = 2381
_ExtentY = 556
_Version = 393216
Format = 160038914
CurrentDate = .354166666666667
End
Begin MSComCtl2.DTPicker DTP1
Height = 315
Left = 2625
TabIndex = 3
Top = 210
Width = 1335
_ExtentX = 2355
_ExtentY = 556
_Version = 393216
Format = 160038913
CurrentDate = 37143
End
Begin VB.CommandButton Command2
BackColor = &H00C0C0C0&
Caption = "退出"
Height = 345
Left = 9720
Style = 1 'Graphical
TabIndex = 2
Top = 210
Width = 1200
End
Begin MSComCtl2.DTPicker DTP2
Height = 315
Left = 5760
TabIndex = 4
Top = 210
Width = 1380
_ExtentX = 2434
_ExtentY = 556
_Version = 393216
Format = 160038913
CurrentDate = 37143
End
Begin MSComCtl2.DTPicker DTM2
Height = 315
Left = 7080
TabIndex = 6
Top = 210
Width = 1350
_ExtentX = 2381
_ExtentY = 556
_Version = 393216
Format = 160038914
CurrentDate = .354166666666667
End
Begin VB.Label Label2
Caption = "操作员:"
Height = 255
Left = 75
TabIndex = 11
Top = 255
Width = 765
End
Begin VB.Label Label1
Caption = "日期从: 到"
Height = 285
Left = 1905
TabIndex = 1
Top = 255
Width = 6795
End
End
Begin VB.Label Labyj
BackStyle = 0 'Transparent
Height = 240
Left = 5265
TabIndex = 15
Top = 3660
Width = 2430
End
Begin VB.Label Labys
BackStyle = 0 'Transparent
Height = 240
Left = 1425
TabIndex = 14
Top = 3660
Width = 2430
End
Begin VB.Label Label3
BackStyle = 0 'Transparent
Caption = "合计应收宿费: 合计预收宿费:"
Height = 270
Left = 120
TabIndex = 13
Top = 3660
Width = 7560
End
End
Attribute VB_Name = "main_ysbb"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim DBcnn As New ADODB.Connection
Dim DBrs1 As New ADODB.Recordset
Dim DBrs2 As New ADODB.Recordset
Dim sqlstr As String
Private Sub DBGrid1_Click()
End Sub
Private Sub Form_Load()
If DBcnn.State = 0 Then
Dim connectstr As String
connectstr = "Provider=Microsoft.jet.OLEDB.4.0;Data Source=" & _
App.Path & "\KFGL.mdb;Persist Security Info=False"
DBcnn.CursorLocation = adUseClient
DBcnn.Open connectstr
End If
'自动识别数据库路径
' Data1.DatabaseName = App.Path & "\KFGL.MDB"
' Data2.DatabaseName = App.Path & "\KFGL.MDB"
End Sub
Private Sub Form_Activate()
czy.Text = main.StatusBar1.Panels(4).Text
DTP1.Value = Date - 1
DTP2.Value = Date
G1.Text = Left(DTP1, 4) & Right(Left(DTP1, 7), 2) & Right(DTP1, 2) & Left(DTM1, 2) & Left(Right(DTM1, 5), 2)
G2.Text = Left(DTP2, 4) & Right(Left(DTP2, 7), 2) & Right(DTP2, 2) & Left(DTM2, 2) & Left(Right(DTM2, 5), 2)
If DBrs1.State = 1 Then
DBrs1.Close
End If
'DBrs1.Open sqlstr, DBcnn, adOpenDynamic, adLockBatchOptimistic
If DBrs2.State = 1 Then
DBrs2.Close
End If
'sqlstr = "select * from djys where val(BZ) >" & Val(G1.Text) & _
" AND val(BZ)<" & Val(G2.Text) & " order by 凭证号码"
' DBrs1.Open sqlstr, DBcnn, adOpenStatic, adLockBatchOptimistic
'Set DataGrid1.DataSource = DBrs1
' Data1.RecordSource = "select * from djys where djys.BZ >" & Val(G1.Text) & "AND djys.BZ<" & Val(G2.Text) & " order by 凭证号码"
'Data1.Refresh
'sqlstr = "select count(*) as ddd,sum(应收宿费)as 应收宿费1 ," & _
"sum(预收金额)as 预收汇总 from djys where val(BZ)>" & _
Val(G1.Text) & "AND djys.BZ<" & Val(G2.Text) & _
" and 标志 like '*'"
' DBrs2.Open sqlstr, DBcnn, adOpenStatic, adLockBatchOptimistic
'Data2.RecordSource = "select count(*) as ddd,sum(应收宿费)as 应收宿费1 ,sum(预收金额)as 预收汇总 from djys where djys.BZ >" & Val(G1.Text) & "AND djys.BZ<" & Val(G2.Text) & " and djys.标志 like " + Chr(34) + "*" + Chr(34) + ""
'Data2.Refresh
' If DBrs2.Fields(1) <> "" Then Labys.Caption = Format(DBrs2.Fields(1)) Else Labys.Caption = "0"
' If DBrs2.Fields(2) <> "" Then Labyj.Caption = Format(DBrs2.Fields(2)) Else Labyj.Caption = "0"
End Sub
Private Sub Form_Unload(Cancel As Integer)
main.Enabled = True
End Sub
Private Sub Command1_Click()
Dim datestr1 As String
Dim timestr1 As String
Dim datestr2 As String
Dim timestr2 As String
'统计应收宿费、预收宿费
If DTP1.Value <= DTP2.Value Then
datestr1 = Format(DTP1, "yyyy-MM-dd")
datestr2 = Format(DTP2, "yyyy-MM-dd")
timestr1 = Hour(DTM1) & Minute(DTM1)
timestr2 = Hour(DTM2) & Minute(DTM2)
G1.Text = Left(DTP1, 4) & Right(Left(DTP1, 7), 2) & Right(DTP1, 2) & Left(DTM1, 2) & Left(Right(DTM1, 5), 2)
G2.Text = Left(DTP2, 4) & Right(Left(DTP2, 7), 2) & Right(DTP2, 2) & Left(DTM2, 2) & Left(Right(DTM2, 5), 2)
If DBrs1.State = 1 Then
DBrs1.Close
End If
'DBrs1.Open sqlstr, DBcnn, adOpenDynamic, adLockBatchOptimistic
If DBrs2.State = 1 Then
DBrs2.Close
End If
'sqlstr = "select * from djys where val(left(BZ,4)) >=" & Val(Left(datestr1, 4)) & _
' " and val(right(left(BZ,8),4)) >=" & Val(Right(datestr1, 4)) & _
' " and val(right(BZ,4))>=" & Val(timestr1) & _
' " and val(left(BZ,4)) >=" & Val(Left(datestr1, 4)) & _
' " and val(right(left(BZ,8),4)) <=" & Val(Right(datestr1, 4)) & _
' " and val(right(BZ,4)) <=" & Val(timestr1) & _
' " order by 凭证号码"
'sqlstr = "select * from djys where val(left(BZ,4))>=" & Val(Left(datestr1, 4))
sqlstr = "select * from djys where 住宿日期>=" & DTP1.Value
MsgBox Left(datestr1, 4)
DBrs1.Open sqlstr, DBcnn, adOpenStatic, adLockBatchOptimistic
MsgBox DBrs1.Fields("BZ").Value
Set DataGrid1.DataSource = DBrs1
'Data1.RecordSource = "select * from djys where djys.BZ >" & Val(G1.Text) & "AND djys.bz< " & Val(G2.Text) & " order by 凭证号码"
'Data1.Refresh
'sqlstr = "select count(*) as ddd,sum(应收宿费)as 应收宿费1 ," & _
"sum(预收金额)as 预收汇总 from djys where BZ >" & _
G1.Text & " AND bz<" & G2.Text
'DBrs2.Open sqlstr, DBcnn, adOpenStatic, adLockBatchOptimistic
'Data2.RecordSource = "select count(*) as ddd,sum(应收宿费)as 应收宿费1 ,sum(预收金额)as 预收汇总 from djys where djys.BZ >" & Val(G1.Text) & "AND djys.bz<" & Val(G2.Text)
'Data2.Refresh
'If DBrs2.Fields(1) <> "" Then Labys.Caption = Format(DBrs2.Fields(1), "0.00") Else Labys.Caption = "0"
' If DBrs2.Fields(2) <> "" Then Labyj.Caption = Format(DBrs2.Fields(2), "0.00") Else Labyj.Caption = "0"
'Else
' MsgBox ("日期不能颠倒")
DTP2.Value = Date
End If
End Sub
Private Sub Command2_Click()
main.Enabled = True
Unload Me
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -