You are on page 1of 24

Private Sub c_a_Click() FCetakAnggota.

Show 1 End Sub

Private Sub c_p_Click() FCetakPinjaman.Show 1 End Sub

Private Sub c_r_Click() FCetakAngsur.Show 1 End Sub

Private Sub i_a_Click() FAnggota.Show 1 End Sub

Private Sub i_p_Click() FPinjam.Show 1 End Sub

Private Sub i_r_Click() FAngsur.Show 1 End Sub

Private Sub out_Click() End End Sub

Function nomor() With Adodc1.Recordset If .RecordCount <= 0 Then nomor = Right(Year(Date), 2) & "KM001" Else .MoveLast If Right(Year(Date), 2) = Left(.Fields(0), 2) Then NO = Val(Right(.Fields(0), 3)) + 1 Else NO = 1 End If If NO < 10 Then nomor = Right(Year(Date), 2) & "KM00" & NO ElseIf NO < 100 Then nomor = Right(Year(Date), 2) & "KM0" & NO ElseIf NO < 1000 Then nomor = Right(Year(Date), 2) & "KM" & NO End If End If End With End Function Sub bersih() txt_no.Text = "" txt_Nama.Text = "" com_jkel.Text = "" com_status.Text = "" txt_Alamat.Text = ""

txt_notel.Text = "" txt_kerja.Text = "" txt_kota.Text = "" End Sub Sub aktif() txt_no.Enabled = True txt_Nama.Enabled = True com_jkel.Enabled = True com_status.Enabled = True txt_Alamat.Enabled = True txt_notel.Enabled = True txt_kerja.Enabled = True txt_kota.Enabled = True End Sub Sub nonaktif() txt_no.Enabled = False txt_Nama.Enabled = False com_jkel.Enabled = False com_status.Enabled = False txt_Alamat.Enabled = False txt_notel.Enabled = False txt_kerja.Enabled = False txt_kota.Enabled = False End Sub

Private Sub cmdBatal_Click() Call bersih

Call nonaktif cmdSimpan.Enabled = False cmdHapus.Enabled = True cmdCari.Enabled = True End Sub

Private Sub cmdCari_Click() Dim cari As String cari = InputBox("Masukkan Nomor Anggota yang akan Di cari !!", "Cari Anggota") With Adodc1.Recordset .MoveFirst .Find "NoAnggota='" & Trim(cari) & "'" If .EOF = False Then txt_no.Text = .Fields(0) txt_Nama.Text = .Fields(1) txt_Alamat.Text = .Fields(2) com_jkel.Text = .Fields(3) com_status.Text = .Fields(4) txt_notel.Text = .Fields(5) txt_kerja.Text = .Fields(6) txt_kota.Text = .Fields(7) Call aktif cmdSimpan.Caption = "Update" cmdSimpan.Enabled = True cmdCari.Enabled = False cmdHapus.Enabled = False Else

MsgBox ("Anggota yang anda masukkan Belum terdaftar dala database") End If End With End Sub

Private Sub cmdSimpan_Click() On Error Resume Next With Adodc1.Recordset If cmdSimpan.Caption = "Simpan" Then .AddNew .Fields(0) = Trim(txt_no.Text) End If .Fields(1) = Trim(txt_Nama.Text) .Fields(2) = Trim(txt_Alamat.Text) .Fields(3) = Trim(com_jkel.Text) .Fields(4) = Trim(com_status.Text) .Fields(5) = Trim(txt_notel.Text) .Fields(6) = Trim(txt_kerja.Text) .Fields(7) = Trim(txt_kota.Text) .Update End With Call nonaktif Call bersih cmdSimpan.Caption = "Simpan" cmdSimpan.Enabled = False End Sub

Private Sub cmdTambah_Click() Call bersih Call aktif txt_no.Text = nomor txt_Nama.SetFocus cmdSimpan.Enabled = True cmdHapus.Enabled = False cmdCari.Enabled = False End Sub

Private Sub cmdTutup_Click() Unload Me End Sub

Private Sub Form_Load() Call bersih Call nonaktif cmdSimpan.Enabled = False End Sub Sub nonaktif() txt_Nomor.Enabled = False txt_kdAnggota.Enabled = False txt_Nama.Enabled = False txt_Alamat.Enabled = False txt_Pekerjaan.Enabled = False txt_notel.Enabled = False txt_Pinjaman.Enabled = False

txt_Lama.Enabled = False txt_Bunga.Enabled = False txt_TotalBunga.Enabled = False txt_Admin.Enabled = False txt_TotalAdmin.Enabled = False DTmulai.Enabled = False dtawal.Enabled = False txt_Jumlah.Enabled = False txt_Total.Enabled = False txt_Angsuran.Enabled = False End Sub Sub aktif() txt_Nomor.Enabled = True txt_kdAnggota.Enabled = True txt_Nama.Enabled = True txt_Alamat.Enabled = True txt_Pekerjaan.Enabled = True txt_notel.Enabled = True txt_Pinjaman.Enabled = True txt_Lama.Enabled = True txt_Bunga.Enabled = True txt_TotalBunga.Enabled = True txt_Admin.Enabled = True txt_TotalAdmin.Enabled = True DTmulai.Enabled = True dtawal.Enabled = True txt_Jumlah.Enabled = True

txt_Total.Enabled = True txt_Angsuran.Enabled = True End Sub Sub bersih() txt_Nomor.Text = "" txt_kdAnggota.Text = "" txt_Nama.Text = "" txt_Alamat.Text = "" txt_Pekerjaan.Text = "" txt_notel.Text = "" txt_Pinjaman.Text = "" txt_Lama.Text = "" txt_Bunga.Text = "" txt_TotalBunga.Text = "" txt_Admin.Text = "" txt_TotalAdmin.Text = "" dtawal.Text = "" txt_Jumlah.Text = "" txt_Total.Text = "" txt_Angsuran.Text = "" End Sub Function nomor() With Adodc1.Recordset If .RecordCount <= 0 Then nomor = Right(Year(Date), 2) & "TRS001" Else .MoveLast

If Right(Year(Date), 2) = Left(.Fields(0), 2) Then NO = Val(Right(.Fields(0), 3)) + 1 Else NO = 1 End If If NO < 10 Then nomor = Right(Year(Date), 2) & "TRS00" & NO ElseIf NO < 100 Then nomor = Right(Year(Date), 2) & "TRS0" & NO ElseIf NO < 1000 Then nomor = Right(Year(Date), 2) & "TRS" & NO End If End If End With End Function

Private Sub cari_Click() Dim anggota As String anggota = InputBox("Masukkan Nomor Anggota yang akan Di cari !!", "Cari Anggota") With Adodc2.Recordset .MoveFirst .Find "NoAnggota='" & Trim(anggota) & "'" If .EOF = False Then txt_kdAnggota.Text = .Fields(0) txt_Nama.Text = .Fields(1) txt_Alamat.Text = .Fields(2) txt_notel.Text = .Fields(5)

txt_Pekerjaan.Text = .Fields(6) cek.Visible = True Else MsgBox ("Anggota yang anda masukkan Belum terdaftar dalam database") End If End With End Sub

Private Sub cek_Click() Adodc4.RecordSource = "select*from tblangsuran where kdanggota='" & Trim(txt_kdAnggota.Text) & "'" Adodc4.Refresh With Adodc4.Recordset If .RecordCount > 0 Then .MoveLast If Val(.Fields(4)) >= 1 Then MsgBox "Maaf Data Angsuran Belum Lunas" Call cmdBatal_Click End If End If End With cek.Visible = False End Sub

Private Sub cmdBatal_Click() Call bersih Call nonaktif cmdSimpan.Enabled = False

cmdSimpan.Caption = "&Simpan" cmdCari.Enabled = True cmdHapus.Enabled = True Adodc1.RecordSource = "select * from tblPinjaman" Adodc1.Refresh End Sub

Private Sub cmdCari_Click() Call aktif Dim kata As String kata = InputBox$("Masukkan Kode Peminjaman Yang Akan Dicari", "CAri Data") Adodc3.RecordSource = "select * from tblAngsuran where nopinjam='" & Trim(kata) & "'" Adodc3.Refresh If Adodc3.Recordset.RecordCount >= 2 Then MsgBox "Maaf Untuk Proses Ini tidak Bisa Di Update karena Sudah Di angsur" Exit Sub End If Adodc1.RecordSource = "select * from tblPinjaman where nopinjam='" & Trim(kata) & "'" Adodc1.Refresh With Adodc1.Recordset If .RecordCount > 0 Then txt_Nomor.Text = Trim(.Fields(0)) DTmulai.Value = .Fields(1) txt_kdAnggota.Text = Trim(.Fields(2)) txt_Pinjaman.Text = Val(.Fields(3)) txt_Lama.Text = Val(.Fields(4)) txt_Bunga.Text = Val(.Fields(5))

txt_Admin.Text = Val(.Fields(6)) dtawal.Text = Trim(.Fields(7)) txt_Jumlah.Text = Format(.Fields(8), "#,##0") txt_Total.Text = Format(.Fields(9), "#,##0") txt_Angsuran.Text = Format(.Fields(10), "#,##0") Adodc2.Recordset.MoveFirst Adodc2.Recordset.Find "NoAnggota='" & Trim(txt_kdAnggota.Text) & "'" If Adodc2.Recordset.EOF = False Then txt_kdAnggota.Text = Adodc2.Recordset.Fields(0) txt_Nama.Text = Adodc2.Recordset.Fields(1) txt_Alamat.Text = Adodc2.Recordset.Fields(2) txt_notel.Text = Adodc2.Recordset.Fields(5) txt_Pekerjaan.Text = Adodc2.Recordset.Fields(6) End If cmdSimpan.Enabled = True cmdSimpan.Caption = "&Update" cmdCari.Enabled = False cmdHapusEnabled = False End If End With End Sub

Private Sub cmdHapus_Click() Dim kata As String kata = InputBox$("Masukkan Kode Peminjaman Yang Akan Dicari", "CAri Data") Adodc1.RecordSource = "select * from tblPinjaman where nopinjam='" & Trim(kata) & "'" Adodc1.Refresh

With Adodc1.Recordset If .RecordCount > 0 Then .MoveFirst .Delete .Update End If End With cmdSimpan.Enabled = True cmdSimpan.Caption = "&Update" cmdCari.Enabled = False cmdHapusEnabled = False End Sub

Private Sub cmdSimpan_Click() With Adodc1.Recordset If cmdSimpan.Caption = "&Simpan" Then .AddNew .Fields(0) = Trim(txt_Nomor) End If .Fields(1) = DTmulai.Value .Fields(2) = Trim(txt_kdAnggota.Text) .Fields(3) = Val(txt_Pinjaman.Text) .Fields(4) = Val(txt_Lama.Text) .Fields(5) = txt_Bunga.Text .Fields(6) = txt_Admin.Text .Fields(7) = Trim(dtawal.Text) .Fields(8) = Int(txt_Jumlah.Text)

.Fields(9) = Int(txt_Total.Text) .Fields(10) = Int(txt_Angsuran.Text) .Fields(11) = "Mulai Pinjam" .Update End With Adodc3.Refresh With Adodc3.Recordset If cmdSimpan.Caption = "&Simpan" Then .AddNew .Fields(0) = Trim(txt_Nomor) End If .Fields(1) = Int(txt_Total.Text) .Fields(2) = Val(txt_Pinjaman.Text) .Fields(3) = Int(txt_Total.Text) .Fields(4) = Val(txt_Lama.Text) .Fields(5) = Trim(dtawal.Text) .Fields(6) = Int(txt_Angsuran.Text) .Fields(7) = DTmulai.Value .Fields(8) = 0 .Fields(9) = 0 .Fields(10) = 0 .Fields(11) = txt_kdAnggota.Text .Update End With Call cmdBatal_Click End Sub

Private Sub cmdTambah_Click() Call bersih Call aktif cmdSimpan.Enabled = True cmdCari.Enabled = False cmdHapus.Enabled = False txt_Nomor.Text = nomor cari.Visible = True End Sub

Private Sub cmdTutup_Click() Unload Me End Sub

Private Sub Command1_Click() Dim bl As Integer bl = Format(Val(Month(DTmulai.Value))) If bl < 12 Then dtawal.Text = Format(Val(Month(DTmulai.Value)) + 1, "00") & "/" & Year(Date) ElseIf bl = 12 Then dtawal.Text = Format("01") & "/" & Year(Date) + 1 End If End Sub

Private Sub Form_Load() Call bersih Call nonaktif

cmdSimpan.Enabled = False txt_Pinjaman.Text = Format(txt_Total.Text, "#,#") End Sub

Private Sub txt_Admin_Change() On Error Resume Next txt_TotalAdmin.Text = Format(Val(Int(txt_Pinjaman.Text)) * Val(Int(txt_Admin.Text)) / 100, "#,##0") txt_Jumlah.Text = Format(Val(Int(txt_TotalBunga.Text)) + Val(Int(txt_TotalAdmin.Text)), "#,##0") txt_Total.Text = Format(Val(Int(txt_Pinjaman.Text)) + Val(Int(txt_Jumlah.Text)), "#,##0") txt_Angsuran.Text = Format(Val(Int(txt_Total.Text)) / Val(txt_Lama.Text), "#,##0") DTmulai.Enabled = True DTmulai.Value = Format(Now, "dd/mm/yyyy") End Sub

Private Sub txt_Bunga_Change() On Error Resume Next txt_TotalBunga.Text = Format(Val(Int(txt_Pinjaman.Text)) * Val(Int(txt_Bunga.Text)) / 100, "#,##0") End Sub

Private Sub txt_Pinjaman_LostFocus() On Error Resume Next If txt_Pinjaman.Text <= 300000 Then MsgBox "Akses Ditolak" Call cmdBatal_Click Else Lp(6).Caption = "Rp. " & Format(txt_Total.Text, "#,##0")

End If End Sub

Private Sub txt_Total_Change() Lp(6).Caption = "Rp. " & Format(txt_Total.Text, "#,##0") End Sub

Sub nonaktif() txtNoAnggota.Enabled = False txt_Pinjaman.Enabled = False txt_Angsuran.Enabled = False txt_Lama.Enabled = False txt_sisa.Enabled = False txt_Total.Enabled = False txtbulan.Enabled = False Txtdenda.Enabled = False txtjumlah.Enabled = False Txtket.Enabled = False End Sub Sub bersih() txtnomor.Text = "" txtNoAnggota.Text = "" txt_Pinjaman.Text = "" txt_Angsuran.Text = "" txt_Lama.Text = "" txt_sisa.Text = "" txt_Total.Text = ""

txtbulan.Text = "" Txtdenda.Text = "" txtjumlah.Text = "" Txtket.Text = "" End Sub

Private Sub cmdAngsur_Click() Dim NO, TH As String With Adodc1.Recordset .AddNew .Fields(0) = Trim(txtnomor.Text) .Fields(1) = txt_Total.Text .Fields(2) = txt_Pinjaman.Text .Fields(3) = Val(txt_sisa.Text) .Fields(4) = Val(txt_Lama.Text) If Left(Trim(txtbulan.Text), 2) > 12 Then NO = "01" TH = Val(Right(Trim(txtbulan.Text), 4)) + 1 Else NO = Format(Val(Left(Trim(txtbulan.Text), 2)) + 1, "00") TH = Right(Trim(txtbulan.Text), 4) End If .Fields(5) = NO & "/" & TH .Fields(6) = txt_Angsuran.Text .Fields(7) = DTmulai.Value .Fields(8) = Txtket.Text .Fields(9) = Val(Txtdenda.Text)

.Fields(10) = Val(txtjumlah.Text) .Fields(11) = Trim(txtNoAnggota.Text) .Update End With Adodc1.Refresh CrystalReport1.ReportFileName = App.Path & "\Report4.rpt" CrystalReport1.Connect = conn CrystalReport1.SelectionFormula = "{tblAngsuran.NoPinjam}='" & txtnomor.Text & "' And {tblAngsuran.Bulan}='" & Trim(NO & "/" & TH) & "'" CrystalReport1.RetrieveDataFiles CrystalReport1.WindowState = crptMaximized CrystalReport1.Action = 1 Call bersih End Sub

Private Sub cmdBatal_Click() Call bersih Adodc1.Refresh Adodc1.RecordSource = "select * from tblAngsuran" End Sub

Private Sub cmdCari_Click() Dim NO As Integer Adodc1.RecordSource = "select * from tblAngsuran where nopinjam='" & Trim(txtnomor.Text) & "'" Adodc1.Refresh With Adodc1.Recordset If .RecordCount > 0 Then .MoveLast

If Val(.Fields(4)) <= 0 Then MsgBox "Maaf Data Angsuran Sudah Lunas" Exit Sub End If txtnomor = Trim(.Fields(0)) txtNoAnggota.Text = Trim(.Fields(11)) txt_Pinjaman.Text = .Fields(2) txt_Total.Text = .Fields(1) txt_Lama.Text = .Fields(4) - 1 txt_sisa.Text = Val(.Fields(3)) - Val(.Fields(6)) txt_Angsuran.Text = .Fields(6) txtbulan.Text = .Fields(5) DTmulai.Value = Format(Date, "d") & "/" & txtbulan.Text txtjumlah.Text = Val(.Fields(10)) + Val(.Fields(6)) End If End With End Sub

Private Sub cmdTutup_Click() Unload Me End Sub

Private Sub Command1_Click()

If Val(Month(DTmulai.Value)) > Val(Left(txtbulan.Text, 2)) Then If Val(Year(DTmulai.Value)) >= Val(Mid(txtbulan.Text, 4, 4)) Then Txtket = "Denda"

Txtdenda.Text = "5000" Else Txtket = "" Txtdenda.Text = "" End If Else Txtket = "" Txtdenda.Text = "" End If End Sub

Private Sub Form_Load() Call nonaktif Call bersih On Error Resume Next Call nonaktif Call bersih Dim i, j, k As Integer Dim data As String Dim save As Boolean With Adodc3.Recordset .MoveFirst For i = 0 To .RecordCount save = True data = .Fields(0) For j = 0 To txtnomor.ListCount - 1 If .Fields(0) = Trim(txtnomor.List(j)) Then

save = False End If Next j If save = True Then txtnomor.AddItem .Fields(0) End If .MoveNext Next i End With End Sub Private Sub c_a_Click() FCetakAnggota.Show 1 End Sub

Private Sub c_p_Click() FCetakPinjaman.Show 1 End Sub

Private Sub c_r_Click() FCetakAngsur.Show 1 End Sub

Private Sub i_a_Click() FAnggota.Show 1 End Sub

Private Sub i_p_Click()

FPinjam.Show 1 End Sub

Private Sub i_r_Click() FAngsur.Show 1 End Sub

Private Sub out_Click() End End Sub

Private Sub Comexit_Click() Unload Me End Sub

Private Sub Command1_Click() CrystalReport1.ReportFileName = App.Path & "\Report1.rpt" CrystalReport1.Connect = conn CrystalReport1.WindowState = crptMaximized CrystalReport1.Action = 1 End Sub

Private Sub Comexit_Click() Unload Me End Sub

Private Sub Command1_Click()

CrystalReport1.ReportFileName = App.Path & "\Report2.rpt" CrystalReport1.Connect = conn CrystalReport1.WindowState = crptMaximized CrystalReport1.Action = 1 End Sub

Private Sub Command2_Click() CrystalReport1.ReportFileName = App.Path & "\pinjaman.rpt" CrystalReport1.SelectionFormula = "{tblPinjaman.NoPinjam}='" & Trim(Text1.Text) & "'" CrystalReport1.RetrieveDataFiles CrystalReport1.WindowState = crptMaximized CrystalReport1.Action = 1 Text1.Text = "" End Sub

Private Sub Comexit_Click() Unload Me End Sub

Private Sub Command1_Click() CrystalReport1.ReportFileName = App.Path & "\Report3.rpt" CrystalReport1.Connect = conn CrystalReport1.WindowState = crptMaximized CrystalReport1.Action = 1 End Sub

You might also like