📄 form6.frm
字号:
VERSION 5.00
Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "mscomctl.ocx"
Object = "{86CF1D34-0C5F-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCT2.OCX"
Object = "{CDE57A40-8B86-11D0-B3C6-00A0C90AEA82}#1.0#0"; "MSDATGRD.OCX"
Object = "{67397AA1-7FB1-11D0-B148-00A0C922E820}#6.0#0"; "MSADODC.OCX"
Begin VB.Form Form6
Caption = "员工业务管理"
ClientHeight = 7425
ClientLeft = 60
ClientTop = 345
ClientWidth = 8160
Icon = "Form6.frx":0000
LinkTopic = "Form6"
MDIChild = -1 'True
ScaleHeight = 7425
ScaleWidth = 8160
WindowState = 2 'Maximized
Begin VB.CommandButton Command2
Caption = "打印报表"
Height = 315
Left = 3840
TabIndex = 4
Top = 120
Width = 1275
End
Begin MSAdodcLib.Adodc Adodc1
Height = 330
Left = 6540
Top = 2400
Visible = 0 'False
Width = 1200
_ExtentX = 2117
_ExtentY = 582
ConnectMode = 0
CursorLocation = 3
IsolationLevel = -1
ConnectionTimeout= 15
CommandTimeout = 30
CursorType = 3
LockType = 3
CommandType = 8
CursorOptions = 0
CacheSize = 50
MaxRecords = 0
BOFAction = 0
EOFAction = 0
ConnectStringType= 1
Appearance = 1
BackColor = -2147483643
ForeColor = -2147483640
Orientation = 0
Enabled = -1
Connect = ""
OLEDBString = ""
OLEDBFile = ""
DataSourceName = ""
OtherAttributes = ""
UserName = ""
Password = ""
RecordSource = ""
Caption = "Adodc1"
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
_Version = 393216
End
Begin MSComctlLib.ProgressBar ProgressBar1
Height = 315
Left = 0
TabIndex = 11
Top = 1080
Visible = 0 'False
Width = 6435
_ExtentX = 11351
_ExtentY = 556
_Version = 393216
Appearance = 1
End
Begin VB.CommandButton Command1
Caption = "开始统计"
Height = 315
Left = 2520
TabIndex = 3
Top = 120
Width = 1275
End
Begin VB.ComboBox Combo1
Height = 300
Left = 1080
Style = 2 'Dropdown List
TabIndex = 0
Top = 120
Width = 1395
End
Begin VB.Frame Frame1
Height = 615
Left = 60
TabIndex = 5
Top = 420
Width = 6375
Begin MSComCtl2.DTPicker DTPicker2
Height = 315
Left = 3600
TabIndex = 2
Top = 180
Width = 1395
_ExtentX = 2461
_ExtentY = 556
_Version = 393216
Format = 23658497
UpDown = -1 'True
CurrentDate = 37394
End
Begin MSComCtl2.DTPicker DTPicker1
Height = 315
Left = 1020
TabIndex = 1
Top = 180
Width = 1395
_ExtentX = 2461
_ExtentY = 556
_Version = 393216
Format = 23658497
UpDown = -1 'True
CurrentDate = 37394
End
Begin VB.Label Label4
AutoSize = -1 'True
Caption = "终止日期"
Height = 180
Left = 2760
TabIndex = 10
Top = 240
Width = 720
End
Begin VB.Label Label3
AutoSize = -1 'True
Caption = "终止日期"
Height = 180
Left = 180
TabIndex = 8
Top = 1260
Width = 720
End
Begin VB.Label Label2
Caption = "起始日期"
Height = 195
Left = 180
TabIndex = 7
Top = 240
Width = 795
End
End
Begin MSDataGridLib.DataGrid DataGrid1
Align = 2 'Align Bottom
Height = 5715
Left = 0
TabIndex = 6
Top = 1710
Width = 8160
_ExtentX = 14393
_ExtentY = 10081
_Version = 393216
AllowUpdate = -1 'True
HeadLines = 1.5
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
MarqueeStyle = 3
BeginProperty Column00
EndProperty
BeginProperty Column01
EndProperty
EndProperty
End
Begin VB.Label Label5
AutoSize = -1 'True
Height = 180
Left = 5220
TabIndex = 12
Top = 180
Width = 90
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "员工姓名"
Height = 180
Left = 240
TabIndex = 9
Top = 180
Width = 720
End
End
Attribute VB_Name = "Form6"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Command1_Click()
Dim cardb, endb As String
Dim str As String
str = "select * from 卡 where 姓名='" & Combo1.Text & "'"
DoSql str, True
Dim i As Integer: Dim card As String
For i = 1 To mAdoRec.RecordCount
cardb = mAdoRec.Fields("起始卡号")
endb = mAdoRec.Fields("终止卡号")
card = card & " or (客户卡号>='" & cardb & "' and 客户卡号<='" & endb & "')"
mAdoRec.MoveNext
Next i
On Error GoTo err:
str = "select * from 订单利润 where 预定时间>=cdate('" & CDate(DTPicker1.Value) & "') and 预定时间<=cdate('" & CDate(DTPicker2.Value) & _
"') and (" & Mid(card, 4, Len(card) - 2) & ")"
Dim s As String '统计求和
s = "select sum(利润) from 订单利润 where 预定时间>=cdate('" & CDate(DTPicker1.Value) & "') and 预定时间<=cdate('" & CDate(DTPicker2.Value) & _
"') and (" & Mid(card, 4, Len(card) - 2) & ")"
DoSql s, True
Label5.Caption = "统计结果:总利润" & mAdoRec.Fields(0) & "元"
Adodc1.ConnectionString = constr
Adodc1.CommandType = adCmdText
Adodc1.RecordSource = str
Set DataGrid1.DataSource = Adodc1
Adodc1.Refresh
For i = 0 To Adodc1.Recordset.RecordCount
ProgressBar1.Visible = True
ProgressBar1.Value = i * 100 / Adodc1.Recordset.RecordCount
Next i
ProgressBar1.Visible = False
DataGrid1.ReBind
Exit Sub
err:
ProgressBar1.Visible = False
MsgBox "没有任何业绩"
End Sub
Private Sub Command2_Click() '打印报表
On Error GoTo err
Dim i, j As Integer
Set xlapp = CreateObject("excel.application")
xlapp.Visible = True
Set xlbook = xlapp.workbooks.Open(App.Path + "\template\业务信息.xls")
With xlbook.worksheets("sheet1")
.Activate
.range("i1").Value = Combo1.Text
For i = 1 To Adodc1.Recordset.RecordCount
.range("A" + Trim(str(i + 2))).Value = DataGrid1.Columns(0).Text
.range("B" + Trim(str(i + 2))).Value = DataGrid1.Columns(1).Text
.range("C" + Trim(str(i + 2))).Value = DataGrid1.Columns(2).Text
.range("d" + Trim(str(i + 2))).Value = DataGrid1.Columns(3).Text
.range("e" + Trim(str(i + 2))).Value = DataGrid1.Columns(4).Text
.range("f" + Trim(str(i + 2))).Value = DataGrid1.Columns(8).Text
.range("g" + Trim(str(i + 2))).Value = DataGrid1.Columns(5).Text
.range("h" + Trim(str(i + 2))).Value = DataGrid1.Columns(6).Text
.range("i" + Trim(str(i + 2))).Value = DataGrid1.Columns(7).Text
DataGrid1.Row = i
Next i
.range("h" + Trim(str(i + 3))).Value = Format(Now, "YYYY年MM月DD日")
xlbook.SaveAs (App.Path & "\报表\" + Format(DTPicker1.Value, "YYYY年MM月DD日") + "-" + Format(DTPicker1.Value, "YYYY年MM月DD日") + "业务查询报表.xls")
End With
Exit Sub
err:
'MsgBox "本文件名包表已经存在,请选择别的文件名!", vbOKOnly + vbInformation, "提示"
End Sub
Private Sub Form_Load()
DTPicker1.Value = Now
DTPicker2.Value = Now
Dim str As String
str = "select 姓名 from 业务员表"
DoSql str, True
Combo1.Clear
While Not mAdoRec.EOF
Combo1.AddItem mAdoRec.Fields(0)
mAdoRec.MoveNext
Wend
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -