?? frmsalaryman.frm
字號:
Top = 540
Width = 1020
End
Begin VB.Label Label2
AutoSize = -1 'True
Caption = "選擇部門"
BeginProperty Font
Name = "宋體"
Size = 12
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 240
Left = 8520
TabIndex = 4
Top = 540
Width = 1020
End
End
Attribute VB_Name = "FrmSalaryMan"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub CreateSalary()
Dim TmpMonth As String
Dim TmpTax As Single
Dim DayPay As Single '日工資
If CurDep.Dep_Id <= 0 Then
Exit Sub
End If
'生成指定月份
TmpMonth = ComboY.Text + "-" + ComboM.Text
'讀取指定部門的員工編號到數組Arr_EmpId()
MyEmp.Load_by_Dep (CurDep.Dep_Id)
'對每一位員工生成當月的工資數據
i = 0
Do While Arr_EmpId(i) > 0
'如果指定月份當前員工的工資并未發放,則自動生成
With MySal
If .GetPayFlag(TmpMonth, Arr_EmpId(0)) = 0 Then
.PayMonth = TmpMonth
.Emp_Id = Arr_EmpId(i)
'讀取員工基本信息(包含基本工資和獎金基數)
MyEmp.GetInfo (.Emp_Id)
'讀取考勤記錄
Call MyCheck.GetInfo(TmpMonth, Arr_EmpId(i))
'讀取考評記錄
Call MyEva.GetInfo(TmpMonth, Arr_EmpId(i))
DayPay = Round(MyEmp.Base_Wage / 30, 2)
.BaseWage = MyEmp.Base_Wage
'記算加班費
.Ot1Pay = MyCheck.ot1Days * DayPay * 3
.Ot2Pay = MyCheck.ot2Days * DayPay * 2
.Ot3Pay = MyCheck.ot3Days * DayPay * 1.5
'扣款
.Cdkk = MyCheck.cdDays * MyRule.GetAmount(1)
.Sjkk = (MyCheck.sjDays + MyCheck.kgDays) * DayPay
.Bjkk = Round(MyCheck.bjDays * DayPay / 2, 2)
'獎金
' .Prize = Round(MyEmp.Base_Prize * (MyEva.PrizeFactor1 + MyEva.PrizeFactor2) / 100 / 2, 2)
.Prize = Round(MyEmp.Base_Prize * (MyEva.PrizeFactor2) / 100, 2)
'出差補助
.Clbz = MyCheck.cxDays * MyRule.GetAmount(2)
'養老代扣
.Yldk = Round(MyEmp.Base_Wage * MyRule.GetAmount(3) / 100, 2)
'基本醫療代扣
.Mddk = Round(MyEmp.Base_Wage * MyRule.GetAmount(4) / 100, 2)
'失業保險
.Sydk = Round(MyEmp.Base_Wage * MyRule.GetAmount(5) / 100, 2)
'住房公積金代扣
.HouseFunds = Round(MyEmp.Base_Wage * MyRule.GetAmount(6) / 100, 2)
'代扣稅
.Sfgz = .BaseWage + .Prize + .Ot1Pay + .Ot2Pay + .Ot3Pay + .Clbz _
- .Cdkk - .Sjkk - .Bjkk - .Yldk - .Mddk - .Sydk - .HouseFunds - 1000
If .Sfgz < 0 Then
TmpTax = 0
End If
If .Sfgz <= 500 And .Sfgz > 0 Then
TmpTax = 0.5
End If
If .Sfgz <= 2000 And .Sfgz > 500 Then
TmpTax = .Sfgz * 0.1 - 25
End If
If .Sfgz <= 5000 And .Sfgz > 2000 Then
TmpTax = .Sfgz * 0.15 - 125
End If
If .Sfgz <= 20000 And .Sfgz > 5000 Then
TmpTax = .Sfgz * 0.2 - 375
End If
If .Sfgz <= 40000 And .Sfgz > 20000 Then
TmpTax = .Sfgz * 0.25 - 1375
End If
If .Sfgz <= 60000 And .Sfgz > 40000 Then
TmpTax = .Sfgz * 0.3 - 3375
End If
If .Sfgz <= 80000 And .Sfgz > 60000 Then
TmpTax = .Sfgz * 0.35 - 6375
End If
If .Sfgz <= 100000 And .Sfgz > 80000 Then
TmpTax = .Sfgz * 0.4 - 10375
End If
If .Sfgz > 100000 Then
TmpTax = .Sfgz * 0.45 - 13375
End If
.Tax = TmpTax
.Sfgz = .Sfgz + 1000 - .Tax
If MySal.In_DB(TmpMonth, Arr_EmpId(i)) = False Then
'其它扣款
.Qtkk = 0
'醫療費報銷
.Mdbx = 0
'年休假
.YearPrize = 0
.Insert
Else
'讀取其它扣款、醫療報銷和年終獎金
Call .GetInput(TmpMonth, Arr_EmpId(i))
.Sfgz = .Sfgz - .Qtkk + .Mdbx + .YearPrize
'將重新計算的結果寫如表中
Call .UpdateAuto(TmpMonth, Arr_EmpId(i))
End If
LblPay.Enabled = True
LblModify.Enabled = True
Else
'如果工資已經發放,則不能再修改和發放
LblPay.Enabled = False
LblModify.Enabled = False
End If
End With
i = i + 1
Loop
End Sub
Private Sub Refresh_Salary()
Dim TmpSource As String
CreateSalary
TmpSource = "SELECT e.Emp_Id as 員工編號," _
+ "e.Emp_Name as 員工姓名, c.BaseWage as 基本工資," _
+ "c.Prize as 獎金, c.Ot1Pay as 法定節假日加班費," _
+ "c.Ot2Pay as 休息日加班費, c.Ot3Pay as 日常加班費," _
+ "c.Cdkk as 遲到扣款, c.Sjkk as 事假扣款, c.Bjkk as 病假扣款," _
+ "c.Clbz as 差旅補助, c.Yldk as 養老代扣," _
+ "c.Mddk as 基本醫療代扣, c.Sydk as 失業保險代扣," _
+ "c.HouseFunds as 住房公積金代扣, c.Tax as 代扣稅," _
+ "c.Qtkk as 其他扣款, c.Mdbx as 醫藥費報銷, " _
+ "c.YearPrize as 年終獎金, c.Sfgz as 實發工資" _
+ " FROM Employees e, Salary c WHERE c.PayMonth='" _
+ ComboY.Text + "-" + ComboM.Text + "' And e.Emp_Id=c.Emp_Id"
' If CurUser.User_type = 0 Or CurUser.User_type = 2 Then
' If CurDep.Dep_Id <= 0 Then
' DataGrid1.Visible = False
' Exit Sub
' End If
' DataGrid1.Visible = True
Adodc1.RecordSource = TmpSource _
+ " And e.Dep_Id=" + Trim(Str(CurDep.Dep_Id))
' Else
' Adodc1.RecordSource = TmpSource _
' + " And e.Emp_Id=" + Trim(Str(CurUser.Emp_Id))
' End If
Adodc1.Refresh
If Adodc1.Recordset.RecordCount <> 0 Then
LblPay.Enabled = True
LblModify.Enabled = True
LblRules.Enabled = True
End If
End Sub
Private Sub ComboDep_GotFocus()
ComboY.SetFocus
'設置frmdepsel窗體的位置
FrmDepSel.Left = Me.Left + ComboDep.Left + 350 - FrmDepSel.Width
FrmDepSel.Top = Me.Top + ComboDep.Top + ComboDep.Height + 450
FrmDepSel.Show 1
'將選擇的員工姓名顯示到ComboUpper控件中
ComboDep.Text = CurDep.Dep_name
Refresh_Salary
End Sub
Private Sub ComboM_Click()
Refresh_Salary
End Sub
Private Sub ComboY_Click()
Refresh_Salary
End Sub
Private Sub Form_Load()
Adodc1.ConnectionString = "driver={SQL Server};server=" + Trim(Server) + ";uid=" + Trim(User) + ";pwd=" + Trim(Password) + ";database=ERP"
Adodc1.RecordSource = "SELECT * FROM Checkin"
Adodc1.Refresh
Dim yy, mm As Integer
For i = 1999 To 2100
ComboY.AddItem Trim(Str(i))
Next
For i = 1 To 12
ComboM.AddItem Trim(Str(i))
Next
yy = Year(Now)
If yy > 1998 And yy < 2101 Then
ComboY.Text = Trim(Str(yy))
End If
mm = Month(Now)
If mm > 0 And mm < 13 Then
ComboM.Text = Trim(Str(mm))
End If
ComboDep.Text = ""
CurDep.Init
LblPay.Enabled = False
LblModify.Enabled = False
LblRules.Enabled = False
Refresh_Salary
End Sub
Private Sub LblBack_Click()
Unload Me
End Sub
Private Sub LblModify_Click()
With FrmSalaryEdit
.lblMonth = ComboY.Text + "-" + ComboM.Text
.LblName = Adodc1.Recordset.Fields(1)
.OriEmpId = Adodc1.Recordset.Fields(0)
.txtQtkk = Adodc1.Recordset.Fields(16)
.txtMdbx = Adodc1.Recordset.Fields(17)
.txtYearPrize = Adodc1.Recordset.Fields(18)
.TmpSfgz = Adodc1.Recordset.Fields(19)
.Show 1
End With
Refresh_Salary
End Sub
Private Sub LblPay_Click()
If MsgBox("確定要發放當月工資", vbYesNo, "請確認") = vbYes Then
Call MySal.SetPay(ComboY + "-" + ComboM, 1)
LblPay.Enabled = False
LblModify.Enabled = False
End If
End Sub
Private Sub LblRules_Click()
FrmSalaryRule.Show
End Sub
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -