⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 frmbasicsetting.frm

📁 企业工资管理
💻 FRM
字号:
VERSION 5.00
Begin VB.Form frmBasicSetting 
   Caption         =   "设置基本工资"
   ClientHeight    =   4875
   ClientLeft      =   60
   ClientTop       =   345
   ClientWidth     =   5775
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MinButton       =   0   'False
   ScaleHeight     =   4875
   ScaleWidth      =   5775
   StartUpPosition =   2  '屏幕中心
   Begin VB.OptionButton optionPosition 
      Caption         =   "员工职务"
      BeginProperty Font 
         Name            =   "楷体_GB2312"
         Size            =   12
         Charset         =   134
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   375
      Left            =   840
      TabIndex        =   7
      Top             =   1680
      Width           =   1455
   End
   Begin VB.OptionButton optionID 
      Caption         =   "员工编号"
      BeginProperty Font 
         Name            =   "楷体_GB2312"
         Size            =   12
         Charset         =   134
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   375
      Left            =   840
      TabIndex        =   6
      Top             =   840
      Width           =   1455
   End
   Begin VB.CommandButton cmdCancel 
      Caption         =   "取消"
      Height          =   615
      Left            =   3600
      TabIndex        =   5
      Top             =   3600
      Width           =   1095
   End
   Begin VB.CommandButton cmdOK 
      Caption         =   "确定"
      Height          =   615
      Left            =   1320
      TabIndex        =   4
      Top             =   3600
      Width           =   1095
   End
   Begin VB.TextBox textMoney 
      BeginProperty Font 
         Name            =   "楷体_GB2312"
         Size            =   12
         Charset         =   134
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   375
      Left            =   2520
      TabIndex        =   3
      Top             =   2520
      Width           =   1575
   End
   Begin VB.ComboBox comPosition 
      BeginProperty Font 
         Name            =   "楷体_GB2312"
         Size            =   12
         Charset         =   134
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   360
      Left            =   2520
      TabIndex        =   1
      Top             =   1680
      Width           =   2415
   End
   Begin VB.ComboBox comStuffID 
      BeginProperty Font 
         Name            =   "楷体_GB2312"
         Size            =   12
         Charset         =   134
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   360
      Left            =   2520
      TabIndex        =   0
      Top             =   840
      Width           =   2415
   End
   Begin VB.Label Label2 
      Caption         =   "(元/小时)"
      BeginProperty Font 
         Name            =   "楷体_GB2312"
         Size            =   12
         Charset         =   134
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   375
      Left            =   4200
      TabIndex        =   8
      Top             =   2520
      Width           =   1215
   End
   Begin VB.Label Label1 
      Caption         =   "工资金额"
      BeginProperty Font 
         Name            =   "楷体_GB2312"
         Size            =   12
         Charset         =   134
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   375
      Left            =   1080
      TabIndex        =   2
      Top             =   2640
      Width           =   1095
   End
End
Attribute VB_Name = "frmBasicSetting"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Private ID As String

Private Sub cmdCancel_Click()
    Unload Me
    Exit Sub
End Sub

Private Sub init()
    Me.comPosition.ListIndex = 0
    Me.comStuffID.ListIndex = 0
    Me.textMoney = ""
    Me.optionID.Value = True
End Sub

Private Sub addRecord()                               '添加记录
    Dim sql As String
    Dim rs As New ADODB.Recordset
    sql = "select * from SalarySetting"
    Set rs = getRS(sql, "Salary")
    rs.AddNew
    rs.Fields(1) = Trim(ID)
    rs.Fields(2) = Trim(Me.comPosition.Text)
    rs.Fields(3) = Trim(Me.textMoney)
    rs.Update
    rs.Close
End Sub

Private Sub cmdOK_Click()
    Dim sql As String
    Dim rs As New ADODB.Recordset
    If ichangeFlag = 1 Then
        If Me.optionID.Value = True Then
            If Me.comStuffID.Text = "" Then
                MsgBox "请选择员工编号!", vbOKOnly + vbExclamation, "警告!"
            ElseIf IsEmpty(Me.textMoney) = True Then
                MsgBox "请输入基本工资!", vbOKOnly + vbExclamation, "警告!"
                Me.textMoney.SetFocus
            ElseIf IsNumeric(Me.textMoney) = False Then
                MsgBox "请输入金额!", vbOKOnly + vbExclamation, "警告!"
                Me.textMoney = ""
                Me.textMoney.SetFocus
            Else
                sql = "select * from SalarySetting where StuffID='" & Me.comStuffID.Text & "'"
                Set rs = getRS(sql, "Salary")
                If rs.EOF = False Then
                sql = "delete from SalarySetting where StuffID='" & Me.comStuffID.Text & "'"
                Call TransactSQL(sql, "Salary")
                End If
                rs.Close
                ID = Me.comStuffID.Text
                Call addRecord
                MsgBox "已经设置基本工资!", vbOKOnly + vbExclamation, "添加结果!"
                Call init
                sql = "select * from SalarySetting"              '显示添加结果
                Call frmResult.BasicTopic
                Call frmResult.showBasic(sql)
                frmResult.Show
                frmResult.ZOrder 0
                Me.ZOrder 0
            End If
        End If
        If Me.optionPosition.Value = True Then
            If Me.comPosition.Text = "" Then
                MsgBox "请选择职务!", vbOKOnly + vbExclamation, "警告!"
            ElseIf IsEmpty(Me.textMoney) = True Then
                MsgBox "请输入基本工资!", vbOKOnly + vbExclamation, "警告!"
                Me.textMoney.SetFocus
            ElseIf IsNumeric(Me.textMoney) = False Then
                MsgBox "请输入金额!", vbOKOnly + vbExclamation, "警告!"
                Me.textMoney = ""
                Me.textMoney.SetFocus
            Else
                sql = "select * from SalarySetting where SPosition='" & Me.comPosition.Text & "'"
                Set rs = getRS(sql, "Salary")
                If rs.EOF = False Then
                    sql = "delete from SalarySetting where SPosition='" & Me.comPosition.Text & "'"
                    Call TransactSQL(sql, "Salary")
                End If
                rs.Close
                sql = "select * from StuffInfo where SPosition='" & Me.comPosition.Text & "'"
                Set rs = getRS(sql, "Salary")
                While Not rs.EOF
                    ID = rs(0)
                    Call addRecord
                    rs.MoveNext
                Wend
                rs.Close
                MsgBox "已经设置基本工资!", vbOKOnly + vbExclamation, "添加结果!"
                Call init
                sql = "select * from SalarySetting"               '显示添加结果
                Call frmResult.BasicTopic
                Call frmResult.showBasic(sql)
                frmResult.Show
                frmResult.ZOrder 0
                Me.ZOrder 0
            End If
        End If
    Else
        sql = "update SalarySetting set Salary=" & Me.textMoney & " where StuffID='"
        sql = sql & Me.comStuffID & "'"
        Call TransactSQL(sql, "Salary")
        MsgBox "已经修改基本工资设置!", vbOKOnly + vbExclamation, "提示!"
        Unload Me
        sql = "select * from SalarySetting"               '显示添加结果
        Call frmResult.BasicTopic
        Call frmResult.showBasic(sql)
        frmResult.Show
        frmResult.ZOrder 0
        Call frmSumSalary.reSumSalary(Date)
    End If
End Sub

Private Sub Form_Load()                                 '初始化
    Dim sql As String
    Dim rs As New ADODB.Recordset
    If ichangeFlag = 1 Then
    sql = "select SID from StuffInfo order by SID"
    Set rs = getRS(sql, "Salary")
    If rs.EOF = False Then
        While Not rs.EOF
            Me.comStuffID.AddItem rs(0)
            rs.MoveNext
        Wend
        rs.Close
        Me.comStuffID.ListIndex = 0
    End If
    sql = "select distinct SPosition from StuffInfo"
    Set rs = getRS(sql, "Salary")
    If rs.EOF = False Then
        While Not rs.EOF
            Me.comPosition.AddItem rs(0)
            rs.MoveNext
        Wend
        rs.Close
        Me.comPosition.ListIndex = 0
    End If
    Me.optionID.Value = True
    Else
        Me.Caption = "修改基本工资设置"
        Set rs = getRS(strPublicSQL, "Salary")
        Me.comStuffID.Text = rs(1)
        Me.comPosition.Text = rs(2)
        Me.textMoney = rs(3)
        Me.comStuffID.Enabled = False
        Me.comPosition.Enabled = False
        rs.Close
    End If
End Sub

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -