www.pudn.com > zytgzgl.rar > frmresult.frm, change:2004-06-06,size:16053b


VERSION 5.00 
Object = "{5E9E78A0-531B-11CF-91F6-C2863C385E30}#1.0#0"; "Msflxgrd.ocx" 
Object = "{BDC217C8-ED16-11CD-956C-0000C04E4C0A}#1.1#0"; "Tabctl32.ocx" 
Begin VB.Form frmresult  
   Caption         =   "工资统计结果" 
   ClientHeight    =   9090 
   ClientLeft      =   60 
   ClientTop       =   345 
   ClientWidth     =   11400 
   ControlBox      =   0   'False 
   LinkTopic       =   "Form1" 
   MDIChild        =   -1  'True 
   ScaleHeight     =   9090 
   ScaleWidth      =   11400 
   WindowState     =   2  'Maximized 
   Begin TabDlg.SSTab SSTab1  
      Height          =   6135 
      Left            =   600 
      TabIndex        =   0 
      Top             =   1440 
      Width           =   9645 
      _ExtentX        =   17013 
      _ExtentY        =   10821 
      _Version        =   393216 
      Style           =   1 
      TabHeight       =   520 
      BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}  
         Name            =   "楷体_GB2312" 
         Size            =   12 
         Charset         =   134 
         Weight          =   700 
         Underline       =   0   'False 
         Italic          =   0   'False 
         Strikethrough   =   0   'False 
      EndProperty 
      TabCaption(0)   =   "员工基本工资列表" 
      TabPicture(0)   =   "frmresult.frx":0000 
      Tab(0).ControlEnabled=   -1  'True 
      Tab(0).Control(0)=   "MSFlexGrid2" 
      Tab(0).Control(0).Enabled=   0   'False 
      Tab(0).ControlCount=   1 
      TabCaption(1)   =   "员工其他项目列表" 
      TabPicture(1)   =   "frmresult.frx":001C 
      Tab(1).ControlEnabled=   0   'False 
      Tab(1).Control(0)=   "MSFlexGrid3" 
      Tab(1).ControlCount=   1 
      TabCaption(2)   =   "员工工资统计列表" 
      TabPicture(2)   =   "frmresult.frx":0038 
      Tab(2).ControlEnabled=   0   'False 
      Tab(2).Control(0)=   "MSFlexGrid1" 
      Tab(2).ControlCount=   1 
      Begin MSFlexGridLib.MSFlexGrid MSFlexGrid3  
         Height          =   5055 
         Left            =   -74760 
         TabIndex        =   6 
         Top             =   720 
         Width           =   8175 
         _ExtentX        =   14420 
         _ExtentY        =   8916 
         _Version        =   393216 
         Cols            =   7 
         FixedCols       =   0 
         FillStyle       =   1 
      End 
      Begin MSFlexGridLib.MSFlexGrid MSFlexGrid2  
         Height          =   5055 
         Left            =   360 
         TabIndex        =   7 
         Top             =   720 
         Width           =   8055 
         _ExtentX        =   14208 
         _ExtentY        =   8916 
         _Version        =   393216 
         Cols            =   5 
         FixedCols       =   0 
         FillStyle       =   1 
      End 
      Begin MSFlexGridLib.MSFlexGrid MSFlexGrid1  
         Height          =   5175 
         Left            =   -74640 
         TabIndex        =   5 
         Top             =   600 
         Width           =   8775 
         _ExtentX        =   15478 
         _ExtentY        =   9128 
         _Version        =   393216 
         Cols            =   15 
         FixedCols       =   0 
         FillStyle       =   1 
      End 
   End 
   Begin VB.CommandButton cmdcheckall  
      Caption         =   "查询所有" 
      BeginProperty Font  
         Name            =   "楷体_GB2312" 
         Size            =   12 
         Charset         =   134 
         Weight          =   700 
         Underline       =   0   'False 
         Italic          =   0   'False 
         Strikethrough   =   0   'False 
      EndProperty 
      Height          =   495 
      Left            =   7200 
      TabIndex        =   4 
      Top             =   360 
      Width           =   1335 
   End 
   Begin VB.CommandButton cmdok  
      Caption         =   "查询单人" 
      BeginProperty Font  
         Name            =   "楷体_GB2312" 
         Size            =   12 
         Charset         =   134 
         Weight          =   700 
         Underline       =   0   'False 
         Italic          =   0   'False 
         Strikethrough   =   0   'False 
      EndProperty 
      Height          =   495 
      Left            =   5160 
      TabIndex        =   3 
      Top             =   360 
      Width           =   1335 
   End 
   Begin VB.ComboBox comid  
      BeginProperty Font  
         Name            =   "宋体" 
         Size            =   12 
         Charset         =   134 
         Weight          =   700 
         Underline       =   0   'False 
         Italic          =   0   'False 
         Strikethrough   =   0   'False 
      EndProperty 
      Height          =   360 
      Left            =   2280 
      TabIndex        =   2 
      Top             =   360 
      Width           =   2175 
   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          =   495 
      Left            =   600 
      TabIndex        =   1 
      Top             =   360 
      Width           =   1215 
   End 
End 
Attribute VB_Name = "frmresult" 
Attribute VB_GlobalNameSpace = False 
Attribute VB_Creatable = False 
Attribute VB_PredeclaredId = True 
Attribute VB_Exposed = False 
Option Explicit 
Private iclickflag As Integer 
Private sd As String 
Private Sub Form_Load() 
    Dim sql As String 
    Dim rs As New ADODB.Recordset 
    If strusername = "admin" Then 
     sql = "select stuffid from salarysetting" 
     Set rs = getrs(sql, "salary") 
     If rs.EOF = False Then 
     While Not rs.EOF 
         Me.comid.AddItem rs(0) 
         rs.MoveNext 
     Wend 
     rs.Close 
     End If 
     Me.comid.ListIndex = 0 
     Select Case Me.SSTab1.Tab 
         Case 0 
             sql = "select * from salarysetting" 
             Call basictopic 
             Call showbasic(sql) 
         Case 1 
             sql = "select * from salaryother" 
             Call othertopic 
             Call showother(sql) 
         Case 2 
             sql = "select * from salarystatistics order by id desc" 
             Call listtopic 
             Call showdata(sql) 
         End Select 
     Else 
      sql = "select sid from stuffinfo where sname='" & strusername & "'" 
      Set rs = getrs(sql, "salary") 
      While Not rs.EOF 
         Me.comid.AddItem rs(0) 
         rs.MoveNext 
     Wend 
     rs.MoveFirst 
     sd = rs(0) 
     rs.Close 
     Me.comid.ListIndex = 0 
      Select Case Me.SSTab1.Tab 
        Case 0 
             sql = "select * from salarysetting where stuffid='" & sd & "'" 
             Call basictopic 
             Call showbasic(sql) 
         Case 1 
             sql = "select * from salaryother where stuffid='" & sd & "'" 
             Call othertopic 
             Call showother(sql) 
         Case 2 
             sql = "select * from salarystatistics where stuffid='" & sd & "'" 
             Call listtopic 
             Call showdata(sql) 
         End Select 
    End If 
End Sub 
Public Sub basictopic() 
  Dim i As Integer 
  With Me.MSFlexGrid2 
       .TextMatrix(0, 0) = "记录编号" 
       .TextMatrix(0, 1) = "员工编号" 
       .TextMatrix(0, 2) = "员工姓名" 
       .TextMatrix(0, 3) = "员工职务" 
       .TextMatrix(0, 4) = "基本工资" 
       For i = 0 To 4 
          .ColAlignment(i) = 4 
       Next i 
       For i = 0 To 4 
          .ColWidth(i) = 1000 
       Next i 
   End With 
End Sub 
Public Sub showbasic(strquery As String) 
   Dim rs As New ADODB.Recordset 
   Dim rs1 As New ADODB.Recordset 
   Dim sql As String 
   Set rs = getrs(strquery, "salary") 
   If rs.RecordCount = 0 Then 
      MsgBox "没有工资设置", vbOKOnly + vbExclamation, "提示" 
      frmbasicsetting.Show 
      frmbasicsetting.ZOrder 0 
   Else 
      With Me.MSFlexGrid2 
      .Rows = 1 
         While Not rs.EOF 
            .Rows = .Rows + 1 
            .TextMatrix(.Rows - 1, 0) = rs(0) 
            .TextMatrix(.Rows - 1, 1) = rs(1) 
            sql = "select sname from stuffinfo where sid='" & rs(1) & "'" 
            Set rs1 = getrs(sql, "salary") 
            .TextMatrix(.Rows - 1, 2) = rs1(0) 
            rs1.Close 
            .TextMatrix(.Rows - 1, 3) = rs(2) 
            .TextMatrix(.Rows - 1, 4) = rs(3) & "元" 
            rs.MoveNext 
         Wend 
       End With 
       rs.Close 
   End If 
End Sub 
Private Sub cmdcheckall_Click() 
   Dim sql As String 
   If Trim(strusername) <> "admin" Then 
     MsgBox "您没有这个权限!", vbOKOnly + vbExclamation, "警告" 
     Exit Sub 
   Else 
   Select Case Me.SSTab1.Tab 
    Case 0 
       sql = "select * from salarysetting" 
       Call basictopic 
       Call showbasic(sql) 
    Case 1 
       sql = "select * from salaryother" 
       Call othertopic 
       Call showother(sql) 
    Case 2 
       sql = "select * from salarystatistics order by id desc" 
       Call listtopic 
       Call showdata(sql) 
    End Select 
    End If 
  iclickflag = 2 
End Sub 
Private Sub cmdok_Click() 
   Dim sql As String 
   If Trim(strusername) <> "admin" Then 
     MsgBox "您没有这个权限!", vbOKOnly + vbExclamation, "警告" 
   Exit Sub 
   Else 
   Select Case Me.SSTab1.Tab 
   Case 0 
      sql = "select * from salarysetting where stuffid='" & Me.comid.Text & "'" 
      Call basictopic 
      Call showbasic(sql) 
   Case 1 
      sql = "select * from salaryother where stuffid='" & Me.comid.Text & "'" 
      Call othertopic 
      Call showother(sql) 
   Case 2 
      sql = "select * from salarystatistics where stuffid='" & Me.comid.Text & "'" 
      Call listtopic 
      Call showdata(sql) 
      End Select 
    End If 
   iclickflag = 1 
End Sub 
Public Sub listtopic() 
    Dim i As Integer 
    With Me.MSFlexGrid1                            '设置表头 
        .TextMatrix(0, 0) = "记录编号" 
        .TextMatrix(0, 1) = "员工编号" 
        .TextMatrix(0, 2) = "员工姓名" 
        .TextMatrix(0, 3) = "统计日期" 
        .TextMatrix(0, 4) = "基本工资" 
        .TextMatrix(0, 5) = "奖    金" 
        .TextMatrix(0, 6) = "福    利" 
        .TextMatrix(0, 7) = "津    贴" 
        .TextMatrix(0, 8) = "扣    发" 
        .TextMatrix(0, 9) = "迟到早退" 
        .TextMatrix(0, 10) = "旷工扣发" 
        .TextMatrix(0, 11) = "加班费" 
        .TextMatrix(0, 12) = "出差费" 
        .TextMatrix(0, 13) = "其   他" 
        .TextMatrix(0, 14) = "总   额" 
        For i = 0 To 14                             '设置所有表格对齐方式 
            .ColAlignment(i) = 4 
        Next i 
        For i = 0 To 14                             '设置每列宽度 
            .ColWidth(i) = 1000 
        Next i 
    End With 
End Sub 
Public Sub showdata(strquery As String) 
    Dim rs As New ADODB.Recordset 
    Set rs = getrs(strquery, "salary") 
    If rs.EOF = False Then 
    With Me.MSFlexGrid1 
        .Rows = 1 
        While Not rs.EOF 
            .Rows = .Rows + 1 
            .TextMatrix(.Rows - 1, 0) = rs(0) 
            .TextMatrix(.Rows - 1, 1) = rs(1) 
            .TextMatrix(.Rows - 1, 2) = rs(2) 
            .TextMatrix(.Rows - 1, 3) = rs(3) 
            .TextMatrix(.Rows - 1, 4) = rs(4) & "元" 
            .TextMatrix(.Rows - 1, 5) = rs(5) & "元" 
            .TextMatrix(.Rows - 1, 6) = rs(6) & "元" 
            .TextMatrix(.Rows - 1, 7) = rs(7) & "元" 
            .TextMatrix(.Rows - 1, 8) = rs(8) & "元" 
            .TextMatrix(.Rows - 1, 9) = rs(9) & "元" 
            .TextMatrix(.Rows - 1, 10) = rs(10) & "元" 
            .TextMatrix(.Rows - 1, 11) = rs(11) & "元" 
            .TextMatrix(.Rows - 1, 12) = rs(12) & "元" 
            .TextMatrix(.Rows - 1, 13) = rs(13) & "元" 
            .TextMatrix(.Rows - 1, 14) = rs(14) & "元" 
            rs.MoveNext 
        Wend 
    End With 
    rs.Close 
    End If 
End Sub 
Public Sub othertopic() 
    Dim i As Integer 
    With Me.MSFlexGrid3                            '设置表头 
        .TextMatrix(0, 0) = "记录编号" 
        .TextMatrix(0, 1) = "员工编号" 
        .TextMatrix(0, 2) = "员工姓名" 
        .TextMatrix(0, 3) = "添加日期" 
        .TextMatrix(0, 4) = "名    称" 
        .TextMatrix(0, 5) = "金    额" 
        .TextMatrix(0, 6) = "备    注" 
        For i = 0 To 6                             '设置所有表格对齐方式 
            .ColAlignment(i) = 4 
        Next i 
        For i = 0 To 6                             '设置每列宽度 
            .ColWidth(i) = 1000 
        Next i 
    End With 
End Sub 
Public Sub showother(strquery As String) 
    Dim rs As New ADODB.Recordset 
    Dim rs1 As New ADODB.Recordset 
    Dim sql As String 
    Set rs = getrs(strquery, "salary") 
    If rs.EOF = False Then 
        With Me.MSFlexGrid3 
        .Rows = 1 
            While Not rs.EOF 
                .Rows = .Rows + 1 
                .TextMatrix(.Rows - 1, 0) = rs(0) 
                .TextMatrix(.Rows - 1, 1) = rs(1) 
                sql = "select sname from stuffinfo where sid='" & rs(1) & "'" 
                Set rs1 = getrs(sql, "salary") 
                .TextMatrix(.Rows - 1, 2) = rs1(0) 
                rs1.Close 
                .TextMatrix(.Rows - 1, 3) = rs(2) 
                .TextMatrix(.Rows - 1, 4) = rs(4) 
                .TextMatrix(.Rows - 1, 5) = rs(5) & "元" 
                .TextMatrix(.Rows - 1, 6) = rs(6) 
                rs.MoveNext 
            Wend 
        End With 
    rs.Close 
    End If 
End Sub 
Private Sub MSFlexGrid2_MouseUp(Button As Integer, Shift As Integer, x As Single, y As Single) 
    If Shift = 0 And Button = 2 Then 
        PopupMenu frmpopmenu.Popmenu 
    End If 
End Sub 
Private Sub MSFlexGrid3_MouseUp(Button As Integer, Shift As Integer, x As Single, y As Single) 
      If Shift = 0 And Button = 2 Then 
        PopupMenu frmpopmenu.Popmenu2 
    End If 
End Sub 
Private Sub SSTab1_Click(PreviousTab As Integer) 
    Dim sql As String 
    Dim rs As New ADODB.Recordset 
    If strusername = "admin" Then 
    If iclickflag = 1 Then 
        Select Case Me.SSTab1.Tab 
        Case 0 
            sql = "select * from salarysetting where stuffid='" & Me.comid.Text & "'" 
            Call basictopic 
            Call showbasic(sql) 
        Case 1 
            sql = "select * from salaryother where stuffid='" & Me.comid.Text & "'" 
            Call othertopic 
            Call showother(sql) 
        Case 2 
            sql = "select * from salarystatistics where stuffid='" & Me.comid.Text & "'" 
            Call listtopic 
            Call showdata(sql) 
        End Select 
    Else 
    Select Case Me.SSTab1.Tab 
        Case 0 
            sql = "select * from salarysetting" 
            Call basictopic 
            Call showbasic(sql) 
        Case 1 
            sql = "select * from salaryother" 
            Call othertopic 
            Call showother(sql) 
        Case 2 
            sql = "select * from salarystatistics order by id desc" 
            Call listtopic 
            Call showdata(sql) 
        End Select 
     End If 
     Else 
      sql = "select sid from stuffinfo where sname='" & strusername & "'" 
      Set rs = getrs(sql, "salary") 
      While Not rs.EOF 
         Me.comid.AddItem rs(0) 
         rs.MoveNext 
     Wend 
     rs.MoveFirst 
     sd = rs(0) 
     rs.Close 
     Me.comid.ListIndex = 0 
      Select Case Me.SSTab1.Tab 
        Case 0 
             sql = "select * from salarysetting where stuffid='" & sd & "' " 
             Call basictopic 
             Call showbasic(sql) 
         Case 1 
             sql = "select * from salaryother where stuffid='" & sd & "'" 
             Call othertopic 
             Call showother(sql) 
         Case 2 
             sql = "select * from salarystatistics where stuffid='" & sd & "'" 
             Call listtopic 
             Call showdata(sql) 
         End Select 
      End If 
End Sub