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

📄 frmygztj.frm

📁 企业工资管理系统的具体实现
💻 FRM
📖 第 1 页 / 共 2 页
字号:
         Width           =   615
      End
      Begin VB.TextBox Text1 
         Height          =   345
         Left            =   450
         TabIndex        =   17
         Top             =   315
         Width           =   855
      End
      Begin VB.CommandButton cmdexit 
         Caption         =   "退  出"
         Height          =   390
         Left            =   10500
         TabIndex        =   11
         Top             =   960
         Width           =   855
      End
      Begin VB.CommandButton cmdok 
         Caption         =   "统  计"
         Height          =   390
         Left            =   9360
         TabIndex        =   10
         Top             =   960
         Width           =   855
      End
      Begin VB.Frame Frame2 
         Height          =   1245
         Left            =   3375
         TabIndex        =   5
         Top             =   120
         Width           =   2700
         Begin VB.TextBox Text6 
            Enabled         =   0   'False
            Height          =   375
            Left            =   870
            TabIndex        =   14
            Top             =   750
            Width           =   1050
         End
         Begin VB.TextBox Text5 
            Height          =   375
            Left            =   870
            TabIndex        =   12
            Top             =   210
            Width           =   1050
         End
         Begin VB.OptionButton Option2 
            Caption         =   "工时"
            Height          =   285
            Left            =   135
            TabIndex        =   7
            Top             =   795
            Width           =   675
         End
         Begin VB.OptionButton Option1 
            Caption         =   "产品"
            Height          =   300
            Left            =   135
            TabIndex        =   6
            Top             =   285
            Value           =   -1  'True
            Width           =   660
         End
         Begin VB.Label Label7 
            AutoSize        =   -1  'True
            Caption         =   "元/时"
            Height          =   180
            Left            =   2100
            TabIndex        =   15
            Top             =   855
            Width           =   450
         End
         Begin VB.Label Label6 
            AutoSize        =   -1  'True
            Caption         =   "元/件"
            Height          =   180
            Left            =   2100
            TabIndex        =   13
            Top             =   330
            Width           =   450
         End
      End
      Begin VB.ComboBox Combo1 
         Height          =   300
         Left            =   1320
         TabIndex        =   4
         Top             =   945
         Width           =   1800
      End
      Begin VB.Label Label8 
         AutoSize        =   -1  'True
         Caption         =   "津贴费:"
         Height          =   180
         Left            =   9015
         TabIndex        =   16
         Top             =   405
         Width           =   720
      End
      Begin VB.Label Label5 
         AutoSize        =   -1  'True
         Caption         =   "元/时"
         Height          =   180
         Left            =   8355
         TabIndex        =   9
         Top             =   405
         Width           =   450
      End
      Begin VB.Label Label4 
         AutoSize        =   -1  'True
         Caption         =   "迟到扣"
         Height          =   180
         Left            =   6435
         TabIndex        =   8
         Top             =   390
         Width           =   540
      End
      Begin VB.Label Label3 
         AutoSize        =   -1  'True
         Caption         =   "车间代号:"
         Height          =   180
         Left            =   435
         TabIndex        =   3
         Top             =   1065
         Width           =   900
      End
      Begin VB.Label Label2 
         AutoSize        =   -1  'True
         Caption         =   "月"
         Height          =   180
         Left            =   2535
         TabIndex        =   2
         Top             =   420
         Width           =   180
      End
      Begin VB.Label Label1 
         AutoSize        =   -1  'True
         Caption         =   "年"
         Height          =   180
         Left            =   1440
         TabIndex        =   1
         Top             =   405
         Width           =   180
      End
   End
End
Attribute VB_Name = "frmygztj"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub cmdexit_Click()
Unload Me
End Sub

Private Sub cmdok_Click()
Dim cnn As New ADODB.Recordset
Dim cnn1 As New ADODB.Recordset
Dim gs As String, yf As String, err1 As Integer
Dim kc As Integer
If Text2.Text <> "" Then
    If MsgBox("请确定你要统计的是否是" & Text1.Text & "年" & Text2.Text & "月,确定请按“是”,否则按“否”。", vbYesNo + vbInformation, "提示") = vbYes Then
    Call textchange(frmygztj, err1)
    If err1 = 1 Then Exit Sub
        yf = Trim(Text1.Text) & "年" & Trim(Text2.Text) & "月"
        With cnn
            .ActiveConnection = constr
            .CursorLocation = adUseClient
            .CursorType = adOpenDynamic
            .LockType = adLockBatchOptimistic
            .Open "select * from sbqkb" & Trim(Text2.Text) & " where cjdh='" & Trim(Combo1.Text) & "'"
            If Not (.EOF And .BOF) Then
                .MoveFirst
            Else
                MsgBox "输入车间代号有误,或者没有进行车间设置,不能进行工资统计。", vbInformation, "提示"
                Combo1.SetFocus
                Exit Sub
            End If
            Do While Not .EOF
                With cnn1
                    .ActiveConnection = constr
                    .CursorLocation = adUseClient
                    .CursorType = adOpenDynamic
                    .LockType = adLockBatchOptimistic               '根据工人代号和月份找出工人的加班时间
                    .Open "select jbsj from gzkcb where grdh='" & cnn.Fields("grdh").Value & "' and yf='" & yf & "'"
                    If Not .EOF And Not .BOF Then               '出席加上加班时间算出工时
                        gs = cnn.Fields("cx").Value * 8 + .Fields("jbsj").Value
                    Else
                        gs = cnn.Fields("cx").Value * 8
                    End If
                    .Close
                End With
                Set cnn1 = Nothing
                With adoygzqkb
                    .ConnectionString = constr
                    .RecordSource = "select * from ygzqkb where grdh='" & cnn.Fields("grdh") & "' and yf='" & yf & "'"
                    .Refresh
                    If .Recordset.EOF And .Recordset.BOF Then              '如果月工作情况表中已有所查工人的月份,车间代号等信息,则不再加入
                        .Recordset.AddNew
                        .Recordset.Fields("yf").Value = yf
                        .Recordset.Fields("cjdh").Value = Trim(Combo1.Text)
                        .Recordset.Fields("grdh").Value = cnn.Fields("grdh").Value
                        .Recordset.Fields("xm").Value = cnn.Fields("xm").Value
                     End If
                    .Recordset.Fields("gs").Value = gs
                    .Recordset.Fields("cpjs").Value = cnn.Fields("cpjs").Value
                    .Recordset.Update
                   
                End With
                .MoveNext
            Loop
            .Close
        End With
        Set cnn = Nothing
        MsgBox "初始化第一步!"
        With adoygzqkb
            .ConnectionString = constr
            .RecordSource = "select * from ygzqkb where cjdh='" & Trim(Combo1.Text) & "' and yf='" & yf & "'"
            .Refresh
            If Not (.Recordset.EOF And .Recordset.BOF) Then
                .Recordset.MoveFirst
            End If
            Do While Not .Recordset.EOF
                With cnn1
                    .ActiveConnection = constr
                    .CursorLocation = adUseClient
                    .CursorType = adOpenDynamic
                    .LockType = adLockBatchOptimistic
                    .Open "select * from gzkcb where grdh='" & adoygzqkb.Recordset.Fields("grdh").Value & "' and yf='" & yf & "'"
                    If Not (.EOF And .BOF) Then                '在月工作情况表中加入迟到扣除,次品扣除等信息
                        If Not IsNull(.Fields("cdsj").Value) Then adoygzqkb.Recordset.Fields("cdkc").Value = .Fields("cdsj").Value * Val(Trim(Text3.Text))
                        If Not IsNull(.Fields("cpkc").Value) Then adoygzqkb.Recordset.Fields("cpkc").Value = .Fields("cpkc").Value
                        If Not IsNull(.Fields("qtkc").Value) Then adoygzqkb.Recordset.Fields("qtkc").Value = .Fields("qtkc").Value
                        
                    End If
                    If Text4.Text <> "" Then adoygzqkb.Recordset.Fields("jtf").Value = Val(Trim(Text4.Text))
                    .Close
                End With
                Set cnn1 = Nothing
                .Recordset.MoveNext
            Loop
        End With
        MsgBox "初始化第二步!"
        With adoygzqkb
            .ConnectionString = constr
            .RecordSource = "select * from ygzqkb where cjdh='" & Trim(Combo1.Text) & "' and yf='" & yf & "'"
            .Refresh
            If Not (.Recordset.EOF And .Recordset.BOF) Then
                .Recordset.MoveFirst
            End If
            Do While Not .Recordset.EOF
                If Option1.Value = True Then          '工资总计
                    kc = .Recordset.Fields("cdkc").Value + .Recordset.Fields("cpkc").Value + .Recordset.Fields("qtkc").Value
                    .Recordset.Fields("gzhj").Value = .Recordset.Fields("cpjs").Value * Val(Trim(Text5.Text)) - kc + .Recordset.Fields("jtf").Value
                Else
                    kc = .Recordset.Fields("cdkc").Value + .Recordset.Fields("qtkc").Value
                    .Recordset.Fields("gzhj").Value = .Recordset.Fields("gs").Value * Val(Trim(Text6.Text)) - kc + .Recordset.Fields("jtf").Value
                End If
                .Recordset.MoveNext
            Loop
        End With
        MsgBox "统计完成!"
    Else
        Text2.SetFocus
        Exit Sub
    End If
Else
    MsgBox "请输入月份!", vbInformation, "提示"
    Text2.SetFocus
    Exit Sub
End If
End Sub

Private Sub Combo1_Click()
With adoygzqkb
    .ConnectionString = constr
    .RecordSource = "select * from ygzqkb where cjdh='" & Trim(Combo1.Text) & "' and yf='" & Trim(Text1.Text) & "年" & Trim(Text2.Text) & "月" & "'"
    .Refresh
End With
End Sub

Private Sub Form_Load()
Dim year1 As String, yf As String

year1 = Now
v = Split(year1, "-")
Text1.Text = v(0)
If Len(v(1)) = 1 Then v(1) = "0" & v(1)
Text2.Text = v(1)
yf = Trim(Text1.Text) & "年" & Trim(Text2.Text) & "月"
Call frmwork(frmygztj)
With adoygzqkb
    .ConnectionString = constr
    .RecordSource = "select * from ygzqkb where cjdh='" & Trim(Combo1.Text) & "' and yf='" & yf & "'"
    .Refresh
End With
Set DataGrid1.DataSource = adoygzqkb
End Sub

Private Sub Option1_Click()
If Option1.Value = True Then
    Text5.Enabled = True
    Text6.Text = ""
    Text6.Enabled = False
End If
End Sub

Private Sub Option2_Click()
If Option2.Value = True Then
    Text6.Enabled = True
    Text5.Text = ""
    Text5.Enabled = False
End If
End Sub
Private Sub Text1_LostFocus()
If IsNumeric(Text1.Text) = False Then
    MsgBox "输入年份不是数字,请重输。", vbInformation, "提示"
    Text1.Text = ""
    Text1.SetFocus
    Exit Sub
ElseIf Val(Trim(Text1.Text)) < 2000 Or Len(Trim(Text1.Text)) <> 4 Then
    MsgBox "输入的年份格式不对或不是2000年以后,请重输。", vbInformation, "提示"
    Text1.Text = ""
    Text1.SetFocus
    Exit Sub
End If
End Sub

Private Sub Text2_LostFocus()
If IsNumeric(Text2.Text) = False Then
    MsgBox "输入的月份不是数字,请重输。", vbInformation, "提示"
    Text2.Text = ""
    Text2.SetFocus
    Exit Sub
ElseIf Val(Trim(Text2.Text)) < 1 Or Val(Trim(Text2.Text)) > 12 Or Len(Trim(Text2.Text)) <> 2 Then
    MsgBox "输入的月份格式不对(格式:“06”形式)或不在1-12之间,请重输。", vbInformation, "提示"
    Text2.Text = ""
    Text2.SetFocus
    Exit Sub
End If
End Sub

⌨️ 快捷键说明

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