“Everybody in this country should learn to program a computer, because it teaches you how to think.”

Masukkan Kata Kunci Pencarian Anda Disini

Friday 6 May 2011

Program Sederhana Menghitung Gaji dengan VB 6.0

Selamat berjumpa kembali dengan Blog saya, kali ini saya akan membahas tentang sebuah program sederhana, yaitu menghitung gaji dengan VB 6.0

Soal:
A.Karyawan Honorer PT ABC di gaji berdasarkan jumlah jam kerjanya selama satu minggu.
Upah per jam adalah Rp 2.000.00,- Bila Jam kerja lebih dari 48 jam, selebihnya di hitung sebagai lembur. Input program adalah Total jam kerja karyawan.
B.Karaywan tetap di kelompokkan berdasarkan golonganya, Upah perjam berdasarkan golonganya, jika
Gol A = 4.000.00,-
Gol B = 5.000.00,-
Gol C = 6.000.00,-
Gol D = 7.500.00,-

Ok, mari kita mulai saja y....

1. Bukalah program VB 6.0

2. Maka akan muncul seperti ini...

3. Tambahkan Label, Text Box, Command Button, Frame, Option sesuai kebutuhan,
susun seperti gambar di bawah ini... dan atur propertiesnya...

4. Kemudian masukkan kode program di bawah ini

'Memilih Status Karyawan
Private Sub Combo1_Click()
If Combo1.ListIndex = 1 Then
Frame1.Visible = True
Else
Frame1.Visible = False
End If
End Sub
'Kode program penghitungan gaji
Private Sub Command1_Click()
Dim Jamkrj, Lembur, Upahjam As Double
Dim Upah, Upahlembur As Currency
Jamkrj = Txt1.Text
Txt1.Text = "" & Format(Txt1.Text, "")
Select Case Jamkrj

Case Is = ""
MsgBox "Apanya Yang Mau di Hitung Boss....????", vbInformation, "Yuwono-TI"
MsgBox "Anda Belum Memasukkan Total Jam Kerja", vbInformation, "Yuwono-TI"
Txt1.SetFocus
Exit Sub

Case Is <= 48 If Combo1.ListIndex = -1 Then Txt7.Text = 0 MsgBox " Anda Belum Menentukan STATUS Karyawan", vbInformation, "Yuwono-TI" End If If Combo1.ListIndex = 0 Then Txt7.Text = 2000 End If Txt2.Text = Jamkrj Lembur = 0 Txt3.Text = Lembur Upah = Jamkrj * Txt7.Text Txt4.Text = Upah Upah = "" & Format(Txt4.Text, "Currency") Upahlembur = Lembur * 3000 Txt5.Text = Upahlembur Upahlembur = "" & Format(Txt5.Text, "Currency") Txt6.Text = Val(Txt4.Text) + Val(Txt5.Text) Txt6.Text = "" & Format(Txt6.Text, "Currency") Case Else If Combo1.ListIndex = -1 Then Txt7.Text = 0 Txt8.Text = 0 MsgBox " Anda Belum Menentukan STATUS Karyawan", vbInformation, "Yuwono-TI" If Option2 Or Option3 Or Option4 Or Option5 = False Then MsgBox " Anda Belum Menentukan GOLONGAN Karyawan", vbInformation, "Yuwono-TI" End If End If If Combo1.ListIndex = 0 Then Txt7.Text = 2000 Txt8.Text = 3000 End If Txt3.Text = Lembur Lembur = Jamkrj - 48 Txt2.Text = Jamkrj - Lembur If Txt7.Text = "" Then Txt7.Text = 2000 End If Upah = Txt2.Text * Txt7.Text Txt4.Text = Upah Upah = "" & Format(Txt4.Text, "Currency") Txt3.Text = Lembur Lembur = Jamkrj - 48 Upahlembur = Lembur * Txt8.Text Txt5.Text = Upahlembur Upahlembur = "" & Format(Txt5.Text, "Currency") Txt6.Text = Val(Txt4.Text) + Val(Txt5.Text) Txt6.Text = "" & Format(Txt6.Text, "Currency") End Select End Sub 'kode program reset Private Sub Command2_Click() Txt1.Text = "" Txt2.Text = "" Txt3.Text = "" Txt4.Text = "" Txt5.Text = "" Txt6.Text = "" Txt1.SetFocus Option2.Value = False Option3.Value = False Option4.Value = False Option5.Value = False Combo1.ListIndex = -1 End Sub 'Kode keluar dari program Private Sub Command3_Click() Unload Me End Sub 'Menonaktifkan fungsi2 text Private Sub Form_Load() Txt2.Enabled = False Txt3.Enabled = False Txt4.Enabled = False Txt5.Enabled = False Txt6.Enabled = False End Sub Private Sub Option2_Click() Txt7.Text = 4000 Txt8.Text = 3000 End Sub Private Sub Option3_Click() Txt7.Text = 5000 Txt8.Text = 3000 End Sub Private Sub Option4_Click() Txt7.Text = 6000 Txt8.Text = 3000 End Sub Private Sub Option5_Click() Txt7.Text = 7500 Txt8.Text = 3000 End Sub Private Sub Option6_Click() Frame1.Enabled = True End Sub 5. Hasil Program setelah di run adalah seperti ini





6.Selamat mencoba y.....
bagi yang gak mau repot silahkan download disini

1 comment:

Gunakan bahasa yang baik dan sopan. Komentar yang berbau SARA akan di HAPUS / DELETE.
Komentar akan muncul setelah mendapat persetujuan dari Admin Anak Rantau.