📄 frmsalaryhis.vb
字号:
Public Class frmSalaryHis
Inherits System.Windows.Forms.Form
Private dvResult As DataView
#Region " Windows 窗体设计器生成的代码 "
Public Sub New()
MyBase.New()
'该调用是 Windows 窗体设计器所必需的。
InitializeComponent()
'在 InitializeComponent() 调用之后添加任何初始化
End Sub
'窗体重写 dispose 以清理组件列表。
Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
If disposing Then
If Not (components Is Nothing) Then
components.Dispose()
End If
End If
MyBase.Dispose(disposing)
End Sub
'Windows 窗体设计器所必需的
Private components As System.ComponentModel.IContainer
'注意: 以下过程是 Windows 窗体设计器所必需的
'可以使用 Windows 窗体设计器修改此过程。
'不要使用代码编辑器修改它。
Friend WithEvents grbSalaryHis As System.Windows.Forms.GroupBox
Friend WithEvents lblMonth As System.Windows.Forms.Label
Friend WithEvents txbMonth As System.Windows.Forms.TextBox
Friend WithEvents btnSearch As System.Windows.Forms.Button
Friend WithEvents dgdSarlaryInfo As System.Windows.Forms.DataGrid
Friend WithEvents lblPeopleName As System.Windows.Forms.Label
Friend WithEvents txbPeopleName As System.Windows.Forms.TextBox
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
Me.grbSalaryHis = New System.Windows.Forms.GroupBox
Me.btnSearch = New System.Windows.Forms.Button
Me.txbPeopleName = New System.Windows.Forms.TextBox
Me.txbMonth = New System.Windows.Forms.TextBox
Me.lblPeopleName = New System.Windows.Forms.Label
Me.lblMonth = New System.Windows.Forms.Label
Me.dgdSarlaryInfo = New System.Windows.Forms.DataGrid
Me.grbSalaryHis.SuspendLayout()
CType(Me.dgdSarlaryInfo, System.ComponentModel.ISupportInitialize).BeginInit()
Me.SuspendLayout()
'
'grbSalaryHis
'
Me.grbSalaryHis.Anchor = CType(((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Left) _
Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
Me.grbSalaryHis.Controls.Add(Me.btnSearch)
Me.grbSalaryHis.Controls.Add(Me.txbPeopleName)
Me.grbSalaryHis.Controls.Add(Me.txbMonth)
Me.grbSalaryHis.Controls.Add(Me.lblPeopleName)
Me.grbSalaryHis.Controls.Add(Me.lblMonth)
Me.grbSalaryHis.Location = New System.Drawing.Point(0, -2)
Me.grbSalaryHis.Name = "grbSalaryHis"
Me.grbSalaryHis.Size = New System.Drawing.Size(480, 50)
Me.grbSalaryHis.TabIndex = 0
Me.grbSalaryHis.TabStop = False
'
'btnSearch
'
Me.btnSearch.Location = New System.Drawing.Point(296, 16)
Me.btnSearch.Name = "btnSearch"
Me.btnSearch.Size = New System.Drawing.Size(48, 23)
Me.btnSearch.TabIndex = 12
Me.btnSearch.Text = "查询"
'
'txbPeopleName
'
Me.txbPeopleName.Location = New System.Drawing.Point(200, 16)
Me.txbPeopleName.Name = "txbPeopleName"
Me.txbPeopleName.Size = New System.Drawing.Size(80, 21)
Me.txbPeopleName.TabIndex = 11
Me.txbPeopleName.Text = ""
'
'txbMonth
'
Me.txbMonth.Location = New System.Drawing.Point(48, 16)
Me.txbMonth.Name = "txbMonth"
Me.txbMonth.Size = New System.Drawing.Size(80, 21)
Me.txbMonth.TabIndex = 10
Me.txbMonth.Text = ""
'
'lblPeopleName
'
Me.lblPeopleName.Location = New System.Drawing.Point(136, 21)
Me.lblPeopleName.Name = "lblPeopleName"
Me.lblPeopleName.Size = New System.Drawing.Size(56, 16)
Me.lblPeopleName.TabIndex = 9
Me.lblPeopleName.Text = "职员姓名"
'
'lblMonth
'
Me.lblMonth.Location = New System.Drawing.Point(8, 21)
Me.lblMonth.Name = "lblMonth"
Me.lblMonth.Size = New System.Drawing.Size(32, 16)
Me.lblMonth.TabIndex = 8
Me.lblMonth.Text = "月份"
'
'dgdSarlaryInfo
'
Me.dgdSarlaryInfo.Anchor = CType((((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Bottom) _
Or System.Windows.Forms.AnchorStyles.Left) _
Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
Me.dgdSarlaryInfo.CaptionVisible = False
Me.dgdSarlaryInfo.DataMember = ""
Me.dgdSarlaryInfo.HeaderForeColor = System.Drawing.SystemColors.ControlText
Me.dgdSarlaryInfo.Location = New System.Drawing.Point(8, 48)
Me.dgdSarlaryInfo.Name = "dgdSarlaryInfo"
Me.dgdSarlaryInfo.Size = New System.Drawing.Size(472, 224)
Me.dgdSarlaryInfo.TabIndex = 1
'
'frmSalaryHis
'
Me.AutoScaleBaseSize = New System.Drawing.Size(6, 14)
Me.ClientSize = New System.Drawing.Size(480, 273)
Me.Controls.Add(Me.dgdSarlaryInfo)
Me.Controls.Add(Me.grbSalaryHis)
Me.Name = "frmSalaryHis"
Me.Text = "工资发放历史"
Me.grbSalaryHis.ResumeLayout(False)
CType(Me.dgdSarlaryInfo, System.ComponentModel.ISupportInitialize).EndInit()
Me.ResumeLayout(False)
End Sub
#End Region
Private Sub btnSearch_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSearch.Click
LoadData()
dgdSarlaryInfo.DataSource = dvResult
End Sub
Private Sub LoadData()
Dim db As DataBase = New DataBase
Dim strSQL = "select 姓名,日期,应发金额合计,应扣金额合计,"
strSQL += "工资合计,个人所得税,实发金额,基本工资, 浮动工资,"
strSQL += "合同补, 粮副补, 房补, 临时补, 职务工资, 工龄工资,"
strSQL += "考核工资, 奖金, 房租, 水电费, 请假扣除, 考勤扣除,罚款, "
strSQL += "住房公积金, 医疗保险, 养老保险, 失业保险, 生育保险, 工伤保险,发放否 "
strSQL += "from 职员基本信息表 as a, 工资发放历史表 as b where a.职员编号=b.职员编号"
Dim strCondition As String = ""
If txbMonth.Text.Trim.Length > 0 Then
strCondition += " and 日期 = " + txbMonth.Text.Trim
End If
If Me.txbPeopleName.Text.Trim.Length > 0 And strCondition.Trim.Length > 0 Then
strCondition += " and 姓名 like '%" + txbPeopleName.Text.Trim + "%'"
ElseIf Me.txbPeopleName.Text.Trim.Length > 0 Then
strCondition += " and 姓名 like '%" + txbPeopleName.Text.Trim + "%'"
End If
If strCondition.Trim.Length > 0 Then
strSQL += strCondition
End If
dvResult = db.RunSelectSQL(strSQL)
dvResult.AllowDelete = False
dvResult.AllowNew = False
dvResult.AllowEdit = False
End Sub
Private Sub frmSalaryHis_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load
LoadData()
Dim ts As New DataGridTableStyle
Dim aColumnTextColumn As DataGridTextBoxColumn
Dim numCols As Integer = dvResult.Table.Columns.Count
Dim i As Integer
For i = 0 To numCols - 1
aColumnTextColumn = New DataGridTextBoxColumn
aColumnTextColumn.MappingName = dvResult.Table.Columns(i).ColumnName
aColumnTextColumn.HeaderText = dvResult.Table.Columns(i).ColumnName
aColumnTextColumn.NullText = ""
If i <> 1 Then
aColumnTextColumn.Format = "F"
End If
ts.GridColumnStyles.Add(aColumnTextColumn)
Next
ts.AlternatingBackColor = Color.LightGray
ts.MappingName = dvResult.Table.TableName
dgdSarlaryInfo.TableStyles.Add(ts)
dgdSarlaryInfo.DataSource = dvResult
End Sub
End Class
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -