Jumat, 31 Oktober 2008

Pemrograma III Apliksi gaji karyawan

Apliksi gaji karyawan
.
Private Sub Cmbstatus_Click()
'If Me.Cmbstatus.Text = "kawin" Then
'Me.txtjmlanak.Enabled = True'   
Else
'Me.txtjmlanak.Enabled = False'
End If

End Sub
Private Sub cmddelete_Click()
Set Tbnim = mydbase.OpenRecordset("select * from peg where nama = '" & Me.txtnama.Text & "'")

If Tbnim.RecordCount > 0 Then
    response = MsgBox("delete data pegawai ?", 36, "information")
                If response = vbYes Then
                'textnpm = textnpm
                Set Tbnim = mydbase.OpenRecordset("select * from peg where nama = '" & Me.txtnama & "'")
                                If Tbnim.RecordCount > 0 Then
                                Tbnim.Delete
                    Me.txtnama.Text = ""
                    Me.Cmbstatus.Text = ""
                    Me.txtjmlanak.Text = ""
                    Me.Cmbjabatan.Text = ""
                    Me.Cmbgol.Text = ""
                    Me.txtkeluarga.Text = ""
                    Me.txtkeluarga = ""
                    Me.txtanak.Text = ""
                    Me.txtjam.Text = ""
                    Me.txttjlembur.Text = ""
                    Me.txtgapok.Text = ""
                    Me.txtgapok.Text = ""
                    Me.txtpajak.Text = ""
                    Me.txtpenghasilan.Text = ""
                    Me.txtjabatan.Text = ""
                                Tbnim.MoveFirst
                                 Else
                                 MsgBox "data tidak ada, data tidak bisa di delete", vbCritical, "information"
                                 End If
               

                MsgBox "delete sukses !!", vbInformation, "information"
                Set Tbnim = mydbase.OpenRecordset("select * from peg")
                Me.cmdinsert.Enabled = True
                  Me.cmdupdate.Enabled = False
               Me.cmddelete.Enabled = False
            Else
                MsgBox " delete tidak jadi", vbCritical, " informasi"
            End If
        Else
            MsgBox "data tidak ada , tidak bisa di delete !!!", vbCritical, "information"
            Me.cmdinsert.Enabled = True
            Me.cmdupdate.Enabled = False
            Me.cmddelete.Enabled = False
        End If
End Sub
'Private Sub cmddelete_Click()
'Dim nilai As Integer
'Dim pesan As String
'    pesan = "benar record ini akan d hapus???"
'    nilai = MsgBox(pesan, 49, "hapus record")
'    If nilai = 2 Then Exit Sub
'
'            Me.Data1.Recordset.Delete
'            Me.Data1.Recordset.MoveFirst
'End Sub

Private Sub cmdexit_Click()
End
End Sub

Private Sub cmdinsert_Click()
tanya = MsgBox("insert...?", vbOKCancel, " Information")
    If tanya = vbOK Then
    Call INSERT
    MsgBox "insert sukses...", vbCritical, "information"
   
     Me.cmdinsert.Enabled = False
    Me.cmddelete.Enabled = True
    Me.cmdupdate.Enabled = False
    Else
    Exit Sub
End If
End Sub

'Private Sub cmdinsert_Click()
'Me.Data1.Recordset.Update
'MsgBox "Data telah di simpan !!!", vbInformation, "Information"
'Me.Data1.Enabled = True
'End Sub

Private Sub cmdproses_Click()

    Dim tjlembur As Double
    Dim tjanak As Double
    Dim tjkeluarga As Double
    Dim kel
    Dim tjjabatan As Double
    Dim gajipkk As Double
    Dim pajak As Double
    Dim totpeng As Double
   
         
    'jabatan
    If Cmbjabatan = "Staff" Then
        tjjabatan = " 200000"
        Me.txtlembur.Text = 10000
        Me.txtjabatan.Text = tjjabatan
        Else
         If Cmbjabatan = "Supervisor" Then
          tjjabatan = "500000"
          Me.txtlembur.Text = 25000
          Me.txtjabatan.Text = tjjabatan
           Else
                If Cmbjabatan = "Manager" Then
                 tjjabatan = "1000000"
                 Me.txtlembur.Text = 50000
                 Me.txtjabatan.Text = tjjabatan
                 End If
         End If
    End If
   
    'tj jabatan
   
    tjlembur = Val(Me.txtlembur.Text) * Val(Me.txtjam.Text)
    Me.txttjlembur.Text = tjlembur
   
    'golongan
    If Cmbgol = "1" Then
        gajipkk = " 800000"
        Me.txtgapok.Text = gajipkk
        Else
         If Cmbgol = "2" Then
          gajipkk = "1500000"
          Me.txtgapok.Text = gajipkk
           Else
          If Cmbgol = "3" Then
           gajipkk = "2500000"
           Me.txtgapok.Text = gajipkk
           Else
           If Cmbgol = "4" Then
            gajipkk = "4000000"
            Me.txtgapok.Text = gajipkk
           End If
          End If
         End If
   End If
      
    'tj keluarga
    If Me.Cmbstatus = "Kawin" Then
       tjkeluarga = Val(Me.txtgapok.Text) * 0.1
       Me.txtkeluarga.Text = tjkeluarga
    End If
   
   
    If Cmbstatus = "Kawin" And Me.txtjmlanak.Text = "1" Then
        tjanak = ((gajipkk) * 0.05)
        Me.txtanak.Text = tjanak
        Else
            If Cmbstatus = "Kawin" And Me.txtjmlanak.Text = "2" Then
            tjanak = ((gajipkk) * 0.1)
            Me.txtanak.Text = tjanak
            Else
                If Cmbstatus = "Kawin" And Me.txtjmlanak.Text = "3" Then
                tjanak = ((gajipkk) * 0.16)
                Me.txtanak.Text = tjanak
                Else
                End If
            End If
        End If
   
     'pajak
     pajak = ((10 / 100) * (gajipkk + tjanak + tjkeluarga))
     Me.txtpajak.Text = pajak
    
     'totpenghasilan
    
     totpeng = (Val(Me.txtkeluarga.Text) + Val(Me.txtanak.Text) + Val(Me.txtjabatan.Text) + Val(Me.txttjlembur.Text) + Val(Me.txtgapok.Text)) - Val(Me.txtpajak.Text)
     Me.txtpenghasilan.Text = totpeng
End Sub

Private Sub cmdupdate_Click()
tanya = MsgBox("update...?", vbOKCancel, " Information")
    If tanya = vbOK Then
    Call UPDATE
    MsgBox "update sukses...", vbCritical, "information"
   
    Me.cmdinsert.Enabled = False
    Me.cmddelete.Enabled = True
    Me.cmdupdate.Enabled = True
   
    Else
       
        Exit Sub
       
End If

End Sub

'Private Sub cmdupdate_Click()
'Me.Data1.Recordset.Edit
'Me.Data1.Recordset.MoveFirst
'MsgBox "Data telah di update !!!", vbInformation, "Information"
'End Sub


Private Sub form_load()
Set mydbase = OpenDatabase(App.Path & "\karyawan97.mdb")
    Cmbstatus.AddItem "Kawin"
    Cmbstatus.AddItem "Tidak Kawin"
   
    Cmbgol.AddItem "1"
    Cmbgol.AddItem "2"
    Cmbgol.AddItem "3"
    Cmbgol.AddItem "4"
   
    Cmbjabatan.AddItem "Staff"
    Cmbjabatan.AddItem "Supervisor"
    Cmbjabatan.AddItem "Manager"
                     
End Sub

Private Sub txtnama_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
    If Me.txtnama.Text = "" Then
        MsgBox "Isi Nama Pegawai !!!"
        Me.txtnama.SetFocus
    Else
       
         Set Tbnim = mydbase.OpenRecordset(" select* from peg where nama = '" & Me.txtnama.Text & "'")
                If Tbnim.RecordCount > 0 Then
                    Me.txtnama.Text = Tbnim.Fields("nama").Value
                    Me.Cmbstatus.Text = Tbnim.Fields("status").Value
                    Me.txtjmlanak.Text = Tbnim.Fields("jmlanak").Value
                    Me.Cmbjabatan.Text = Tbnim.Fields("jabatan").Value
                    Me.Cmbgol.Text = Tbnim.Fields("golongan").Value
                    Me.txtjam.Text = Tbnim.Fields("jamlembur").Value
                    Me.txtkeluarga.Text = Tbnim.Fields("tjkeluarga").Value
                    Me.txtanak.Text = Tbnim.Fields("tjanak").Value
                    Me.txttjlembur.Text = Tbnim.Fields("tjlembur").Value
                    Me.txtjabatan.Text = Tbnim.Fields("tjjabatan").Value
                    Me.txtgapok.Text = Tbnim.Fields("gapok").Value
                    Me.txtpajak.Text = Tbnim.Fields("pajak").Value
                    Me.txtpenghasilan.Text = Tbnim.Fields("penghasilan").Value
                                  
                           Else
                           MsgBox "data tdk ada", vbApplicationModal, "information"
            End If
        End If
    End If
End Sub

Private Sub INSERT()
Set Tbnim = mydbase.OpenRecordset("select * from peg")
Tbnim.AddNew
Tbnim.Fields("nama").Value = Me.txtnama.Text
                   Tbnim.Fields("status").Value = Me.Cmbstatus.Text
                    Tbnim.Fields("jmlanak").Value = Me.txtjmlanak.Text
                     Tbnim.Fields("jabatan").Value = Me.Cmbjabatan.Text
                    Tbnim.Fields("golongan").Value = Me.Cmbgol.Text
                    Tbnim.Fields("jamlembur").Value = Me.txtjam.Text
                    Tbnim.Fields("tjkeluarga").Value = Me.txtkeluarga
                   Tbnim.Fields("tjanak").Value = Me.txtanak.Text
                    Tbnim.Fields("tjjabatan").Value = Me.txtjabatan.Text
                   Tbnim.Fields("tjlembur").Value = Me.txttjlembur.Text
                     Tbnim.Fields("gapok").Value = Me.txtgapok.Text
                    Tbnim.Fields("pajak").Value = Me.txtpajak.Text
                    Tbnim.Fields("penghasilan").Value = Me.txtpenghasilan.Text
Tbnim.UPDATE
End Sub

Private Sub UPDATE()
 Set Tbnim = mydbase.OpenRecordset("select * from peg")
Tbnim.Edit
Tbnim.Fields("nama").Value = Me.txtnama.Text
                   Tbnim.Fields("status").Value = Me.Cmbstatus.Text
                    Tbnim.Fields("jmlanak").Value = Me.txtjmlanak.Text
                     Tbnim.Fields("jabatan").Value = Me.Cmbjabatan.Text
                    Tbnim.Fields("golongan").Value = Me.Cmbgol.Text
                    Tbnim.Fields("jamlembur").Value = Me.txtjam.Text
                    Tbnim.Fields("tjkeluarga").Value = Me.txtkeluarga
                   Tbnim.Fields("tjanak").Value = Me.txtanak.Text
                    Tbnim.Fields("tjjabatan").Value = Me.txtjabatan.Text
                   Tbnim.Fields("tjlembur").Value = Me.txttjlembur.Text
                     Tbnim.Fields("gapok").Value = Me.txtgapok.Text
                    Tbnim.Fields("pajak").Value = Me.txtpajak.Text
                    Tbnim.Fields("penghasilan").Value = Me.txtpenghasilan.Text
Tbnim.UPDATE
 End Sub

4).  3 ganjil 3 genap
Private Sub Command1_Click()
Dim i, n As Integer
    Dim jumganjil, jumgenap, nomor As Integer
    i = 1
    n = 100
    nomor = 1
    Do While (i <= n)
        If (i Mod 2 <> 0) Then
            List1.AddItem nomor & Space(30) & i
            jumganjil = jumganjil + i
            nomor = nomor + 1
        End If
        i = i + 1
        txtjumganjil.Text = jumganjil
    Loop
    i = 1
    Do While (i <= n)
            If (i Mod 2 = 0) Then
                List1.AddItem nomor & Space(30) & i
                jumgenap = jumgenap + i
                nomor = nomor + 1
            End If
       
        i = i + 1
        txtjumgenap.Text = jumgenap
    Loop
End Sub

Private Sub Command2_Click()
List1.Clear
     txtjumganjil.Text = " "
     txtjumgenap.Text = " "
End Sub

Private Sub Command3_Click()
End
End Sub


0 komentar:

Posting Komentar

Related Posts Plugin for WordPress, Blogger...