Source Code Perhitungan Gaji Karyawan Dengan Visual Basic
Buat tampilan seperti dibawah ini
Kemudian masukan script dibawah ini
Private Sub CmdBatal_Click()
TxtNama.SetFocus
TxtNama = ""
TxtNik = ""
TxtGolongan = ""
TxtKodeStatus = ""
TxtStatus = ""
TxtTahun = ""
TxtJabatan = ""
TxtBagian = ""
TxtGajiPokok = ""
TxtTunjangan = ""
TxtTotalGaji = ""
End Sub
Private Sub CmdKeluar_Click()
Unload Me
End Sub
Private Sub CmdLagi_Click()
TxtNama.SetFocus
TxtNama = ""
TxtNik = ""
TxtGolongan = ""
TxtKodeStatus = ""
TxtStatus = ""
TxtTahun = ""
TxtJabatan = ""
TxtBagian = ""
TxtGajiPokok = ""
TxtTunjangan = ""
TxtTotalGaji = ""
End Sub
Private Sub CmdProses_Click()
Dim Golongan, KodeBagian, KodeStatus, Status, Tahun, Jabatan, Bagian, GajiPokok, Tunjangan As Variant
Golongan = Mid(TxtNik.Text, 5, 1)
TxtGolongan = Golongan
KodeStatus = Mid(TxtNik.Text, 7, 1)
TxtKodeStatus = KodeStatus
If KodeStatus = "S" Then
Status = "Single"
ElseIf KodeStatus = "M" Then
Status = "Menikah"
ElseIf KodeStatus = "J" Then
Status = "Janda"
ElseIf KodeStatus = "D" Then
Status = "Duda"
End If
TxtStatus = Status
Tahun = Left(TxtNik.Text, 4)
TxtTahun = Tahun
Select Case Golongan
Case "A"
Jabatan = "Manager"
GajiPokok = 4000000
Tunjangan = 1025000
Case "B"
Jabatan = "Ka. Seksi"
GajiPokok = 3500000
Tunjangan = 975000
Case "C"
Jabatan = "Staff"
GajiPokok = 3000000
Tunjangan = 925000
End Select
TxtJabatan = Jabatan
TxtGajiPokok = GajiPokok
TxtTunjangan = Tunjangan
KodeBagian = Right(TxtNik.Text, 3)
Select Case KodeBagian
Case "KEU"
Bagian = "Accounting"
Case "ADM"
Bagian = "Administrasi"
Case "SDM"
Bagian = "General Affair"
Case "EDP"
Bagian = "IT Unit"
Case "SPM"
Bagian = "Security"
End Select
TxtBagian = Bagian
TxtTotalGaji = GajiPokok + Tunjangan
End Sub
Private Sub Form_Activate()
TxtNama.SetFocus
End Sub
Private Sub TxtNama_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
TxtNik.SetFocus
End If
End Sub
Kemudian masukan script dibawah ini
Private Sub CmdBatal_Click()
TxtNama.SetFocus
TxtNama = ""
TxtNik = ""
TxtGolongan = ""
TxtKodeStatus = ""
TxtStatus = ""
TxtTahun = ""
TxtJabatan = ""
TxtBagian = ""
TxtGajiPokok = ""
TxtTunjangan = ""
TxtTotalGaji = ""
End Sub
Private Sub CmdKeluar_Click()
Unload Me
End Sub
Private Sub CmdLagi_Click()
TxtNama.SetFocus
TxtNama = ""
TxtNik = ""
TxtGolongan = ""
TxtKodeStatus = ""
TxtStatus = ""
TxtTahun = ""
TxtJabatan = ""
TxtBagian = ""
TxtGajiPokok = ""
TxtTunjangan = ""
TxtTotalGaji = ""
End Sub
Private Sub CmdProses_Click()
Dim Golongan, KodeBagian, KodeStatus, Status, Tahun, Jabatan, Bagian, GajiPokok, Tunjangan As Variant
Golongan = Mid(TxtNik.Text, 5, 1)
TxtGolongan = Golongan
KodeStatus = Mid(TxtNik.Text, 7, 1)
TxtKodeStatus = KodeStatus
If KodeStatus = "S" Then
Status = "Single"
ElseIf KodeStatus = "M" Then
Status = "Menikah"
ElseIf KodeStatus = "J" Then
Status = "Janda"
ElseIf KodeStatus = "D" Then
Status = "Duda"
End If
TxtStatus = Status
Tahun = Left(TxtNik.Text, 4)
TxtTahun = Tahun
Select Case Golongan
Case "A"
Jabatan = "Manager"
GajiPokok = 4000000
Tunjangan = 1025000
Case "B"
Jabatan = "Ka. Seksi"
GajiPokok = 3500000
Tunjangan = 975000
Case "C"
Jabatan = "Staff"
GajiPokok = 3000000
Tunjangan = 925000
End Select
TxtJabatan = Jabatan
TxtGajiPokok = GajiPokok
TxtTunjangan = Tunjangan
KodeBagian = Right(TxtNik.Text, 3)
Select Case KodeBagian
Case "KEU"
Bagian = "Accounting"
Case "ADM"
Bagian = "Administrasi"
Case "SDM"
Bagian = "General Affair"
Case "EDP"
Bagian = "IT Unit"
Case "SPM"
Bagian = "Security"
End Select
TxtBagian = Bagian
TxtTotalGaji = GajiPokok + Tunjangan
End Sub
Private Sub Form_Activate()
TxtNama.SetFocus
End Sub
Private Sub TxtNama_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
TxtNik.SetFocus
End If
End Sub
Belum ada Komentar untuk "Source Code Perhitungan Gaji Karyawan Dengan Visual Basic"
Posting Komentar