📄 职员操作统计.frm
字号:
UserName = ""
Password = ""
RecordSource = "select 编号,仓库名称 from 仓库"
Caption = "Adodc2"
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
End
Attribute VB_Name = "职员操作统计"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private SQL As String
Private startcol As Integer
Private endcol As Integer
Private col, row As Integer
Private rowheight As Integer
Private colwidth(8) As Long
Private order(8) As Boolean
Option Explicit
Private Sub initdatagrid1()
DataGrid1.Columns(0).width = 500
DataGrid1.Columns(1).width = 1600
DataGrid1.Columns(2).width = 800
DataGrid1.Columns(3).width = 800
DataGrid1.Columns(4).width = 800
DataGrid1.Columns(5).width = 800
DataGrid1.Columns(6).width = 800
DataGrid1.Columns(7).width = 800
DataGrid1.Columns(8).width = 800
DataGrid1.rowheight = 270
End Sub
Private Sub SaveInit()
startcol = DataGrid1.SelStartCol
endcol = DataGrid1.SelEndCol
col = DataGrid1.LeftCol
row = DataGrid1.row
rowheight = DataGrid1.rowheight
Dim i As Integer
For i = 0 To DataGrid1.Columns.count - 1
colwidth(i) = DataGrid1.Columns(i).width
Next
End Sub
Private Sub ResumeInit()
DataGrid1.SelStartCol = startcol
DataGrid1.SelEndCol = endcol
DataGrid1.Scroll col, row
DataGrid1.rowheight = rowheight
Dim i As Integer
For i = 0 To DataGrid1.Columns.count - 1
DataGrid1.Columns(i).width = colwidth(i)
Next
End Sub
Private Sub DataGrid1_HeadClick(ByVal ColIndex As Integer)
If ColIndex > 1 Then Exit Sub
On Error Resume Next
Dim caption As String
caption = DataGrid1.Columns(ColIndex).caption
Adodc1.RecordSource = SQL + " order by " + caption
order(ColIndex) = True - order(ColIndex)
If order(ColIndex) = True Then
Adodc1.RecordSource = Adodc1.RecordSource + " ASC"
Else
Adodc1.RecordSource = Adodc1.RecordSource + " DESC"
End If
SaveInit
Adodc1.Refresh
ResumeInit
End Sub
Private Sub Form_Load()
Adodc1.ConnectionString = DataConnectString
Adodc1.Visible = False
Adodc2.ConnectionString = DataConnectString
Set DataCombo1.RowSource = Adodc2
DataCombo1.ListField = "仓库名称"
Adodc2.Refresh
Adodc2.Visible = False
T出入时间.Text = "无限制"
进行统计_Click
End Sub
Private Sub Form_Unload(Cancel As Integer)
SQL = ""
End Sub
Private Sub 打印_Click()
ShowPrintDlg Adodc1, "职员操作统计"
End Sub
Private Sub 进行统计_Click()
If 限定仓库.Value = 1 And DataCombo1.Text = "" Then MsgBox "请选择仓库名称!": Exit Sub
Dim 仓库编号 As Long
仓库编号 = -1
On Error Resume Next
If 限定仓库.Value = 1 And DataCombo1.Text <> "" Then
'初始化仓库编号
fMainForm.m_checkado.RecordSource = "select * from 仓库 where 仓库名称='" + DataCombo1.Text + "'"
fMainForm.m_checkado.Refresh
仓库编号 = fMainForm.m_checkado.Recordset.Fields("编号").Value
End If
On Error Resume Next
Dim t As String
t = Str(出入时间.Year) + "-" + Str(出入时间.Month) + "-" + Str(出入时间.Day)
Dim s As String
s = "select 编号,姓名,"
'入库单
s = s + "(select count(编号) from 入库单 where 经办人编号=职员信息.编号"
If T出入时间.Text <> "无限制" Then
s = s + " and 入库时间" + T出入时间.Text + "#" + t + "#"
End If
If 仓库编号 <> -1 Then
s = s + " and 仓库编号=" + Str(仓库编号)
End If
s = s + ") as 入库次数,"
'出库单
s = s + "(select count(编号) from 出库单 where 经办人编号=职员信息.编号"
If T出入时间.Text <> "无限制" Then
s = s + " and 出库时间" + T出入时间.Text + "#" + t + "#"
End If
If 仓库编号 <> -1 Then
s = s + " and 仓库编号=" + Str(仓库编号)
End If
s = s + ") as 出库次数,"
'借入单
s = s + "(select count(编号) from 借入单 where 经办人编号=职员信息.编号"
If T出入时间.Text <> "无限制" Then
s = s + " and 借入时间" + T出入时间.Text + "#" + t + "#"
End If
If 仓库编号 <> -1 Then
s = s + " and 仓库编号=" + Str(仓库编号)
End If
s = s + ") as 借入次数,"
'借出单
s = s + "(select count(编号) from 借出单 where 经办人编号=职员信息.编号"
If T出入时间.Text <> "无限制" Then
s = s + " and 借出时间" + T出入时间.Text + "#" + t + "#"
End If
If 仓库编号 <> -1 Then
s = s + " and 仓库编号=" + Str(仓库编号)
End If
s = s + ") as 借出次数,"
'调拔单
s = s + "(select count(编号) from 调拔单 where 经办人编号=职员信息.编号"
If T出入时间.Text <> "无限制" Then
s = s + " and 调拔时间" + T出入时间.Text + "#" + t + "#"
End If
If 仓库编号 <> -1 Then
s = s + " and 原仓库编号=" + Str(仓库编号)
End If
s = s + ") as 调拔次数,"
'报损单
s = s + "(select count(编号) from 报损单 where 经办人编号=职员信息.编号"
If T出入时间.Text <> "无限制" Then
s = s + " and 报损时间" + T出入时间.Text + "#" + t + "#"
End If
If 仓库编号 <> -1 Then
s = s + " and 仓库编号=" + Str(仓库编号)
End If
s = s + ") as 报损次数,"
'总次数
s = s + "(入库次数+出库次数+借入次数+借出次数+调拔次数+报损次数) as 总次数"
s = s + " from 职员信息"
Adodc1.RecordSource = s
SaveInit
Set DataGrid1.DataSource = Adodc1
'第一次刷新调用initdatagrid1初始化眉头
If SQL = "" Then
Adodc1.Refresh
initdatagrid1
Else
Adodc1.Refresh
ResumeInit
End If
SQL = s
If 零次数.Value = 1 Then
Adodc1.Recordset.Filter = "总次数<>0"
Else
Adodc1.Recordset.Filter = 0
End If
End Sub
Private Sub 零次数_Click()
If 零次数.Value = 1 Then
Adodc1.Recordset.Filter = "总次数<>0"
Else
SaveInit
Adodc1.Refresh
ResumeInit
Adodc1.Recordset.Filter = 0
End If
End Sub
Private Sub 限定仓库_Click()
If 限定仓库.Value = 0 Then DataCombo1.Text = ""
End Sub
'此源码由程序太平洋收集整理发布,任何人都可自由转载,但需保留本站信息
'╭⌒╮┅~ ¤ 欢迎光临程序太平洋╭⌒╮
'╭⌒╭⌒╮╭⌒╮~╭⌒╮ ︶ ,︶︶
',︶︶︶︶,''︶~~ ,''~︶︶ ,''
'╔ ╱◥███◣═╬╬╬╬╬╬╬╬╬╗
'╬ ︱田︱田 田 ︱ ╬
'╬ http://www.5ivb.net ╬
'╬ ╭○╮● ╬
'╬ /■\/■\ ╬
'╬ <| || 有希望,就有成功! ╬
'╬ ╬
'╚╬╬╬╬╬╬╬╬╬╬╗ ╔╬╬╬╬╝
'
'说明:
'专业提供VB、.NET、Delphi、ASP、PB源码下载
'包括:程序源码,控件,商业源码,系统方案,开发工具,书籍教程,技术文档
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -