Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.
Ahmad Mustaqim | 12100408 1                                                                                Rental_mobil   ...
Ahmad Mustaqim | 12100408 2                                                                                    Rental_mobi...
Ahmad Mustaqim | 12100408 3                                                                                      Rental_mo...
Ahmad Mustaqim | 12100408 4                                                                                     Rental_mob...
Upcoming SlideShare
Loading in …5
×

Rental

1,025 views

Published on

Published in: Education, Technology
  • Be the first to comment

  • Be the first to like this

Rental

  1. 1. Ahmad Mustaqim | 12100408 1 Rental_mobil txtharga_sewa.Text = "" txtlama.Text = "" txttotal.Text = "0" End Sub Sub nonaktif() txtsewa.Enabled = False txtkdpeminjam.Enabled = False txtnama_peminjam.Enabled = False cmbtipe.Enabled = False txtharga_sewa.Enabled = FalseMODUL txtlama.Enabled = FalsePublic dbado As New ADODB.Connection txttotal.Enabled = FalsePublic rssewa As New ADODB.Recordset binputlain.Enabled = FalsePublic rspeminjam As New ADODB.Recordset bsave.Enabled = FalsePublic rsdetail As New ADODB.Recordset bcancel.Enabled = FalsePublic Sub koneksi() End SubIf dbado.State = adStateOpen Then Sub aktif()dbado.Close txtsewa.Enabled = TrueEnd If txtkdpeminjam.Enabled = Truedbado.ConnectionString = txtnama_peminjam.Enabled = True"provider=msdasql.1;persist security cmbtipe.Enabled = Trueinfo=false;data source=rental_mobil" txtharga_sewa.Enabled = Truedbado.Open txtlama.Enabled = TrueEnd Sub txttotal.Enabled = TrueLISTING binputlain.Enabled = TrueSub bersih() bsave.Enabled = Truetxtsewa.Text = "" bcancel.Enabled = Truetxtkdpeminjam.Text = "" End Subtxtnama_peminjam.Text = "" Sub tabel()cmbtipe.Text = "" Grid1.ColWidth(0) = 126
  2. 2. Ahmad Mustaqim | 12100408 2 Rental_mobilGrid1.ColWidth(1) = 900 sqldel = "delete from detail_sewa where no_sewa=" &txtsewa.Text& ""Grid1.ColWidth(2) = 900 Set rsdetail = dbado.Execute(sqldel, , adCmdText)Grid1.ColWidth(3) = 900 tabelGrid1.ColWidth(4) = 900 nonaktifsqltabel = "select*from detail_sewa" bersihSet rsdetail = dbado.Execute(sqltabel, ,adCmdText) End SubSet Grid1.DataSource = rsdetailEnd Sub Private Sub bclose_Click()Sub no() X = MsgBox("yakinmaukeluar form?", vbYesNo, "konfirmasi")Dim sqlno, a, b As String If X = vbYes Thensqlno = "select * from sewa" EndSet rssewa = dbado.Execute(sqlno, , adCmdText) End IfIf rssewa.BOFAndrssewa.EOF Then End Subtxtsewa.Text = "W" &Format(Date, "yymm") &"001" Private Sub binputlain_Click()Else sqlsv = "insert into detail_sewa()values(" &txtsewa.Text& "," &cmbtipe.Text& ","a=0 &txtlama.Text& "," &txtharga_sewa.Text& ")"rssewa.MoveFirst Set rsdetail = dbado.Execute(sqlsv, , adCmdText)Do Until rssewa.EOF cmbtipe.Text = ""a=a+1 txtharga_sewa.Text = ""rssewa.MoveNext txtlama.Text = ""Loop cmbtipe.SetFocusa=a+1 tabelb = Len(Str(a)) End Subtxtsewa.Text = "W" &Format(Date, "yymm") &Mid$("000", 1, 4 - b) & a Private Sub bnew_Click()End If aktifEnd Sub bersih noPrivate Sub bcancel_Click()
  3. 3. Ahmad Mustaqim | 12100408 3 Rental_mobiltxtkdpeminjam.SetFocus If cmbtipe.ListIndex = 1 ThenEnd Sub ck = "select no_sewa from detail_sewa where no_sewa=" &txtsewa.Text& " and tipe_mobil=" &cmbtipe.Text& ""Private Sub bsave_Click() Set rsdetail = dbado.Execute(ck, , adCmdText)sqlsave = "insert into sewa()values(" If rsdetail.BOFAndrsdetail.EOF Then&txtsewa.Text& "," &lbltanggal.Caption& ","&txttotal.Text& "," &txtkdpeminjam.Text& ")" txtharga_sewa.Text = "300000"Set rssewa = dbado.Execute(sqlsave, , txtlama.SetFocusadCmdText) Elsesqlsv = "insert into detail_sewa()values("&txtsewa.Text& "," &cmbtipe.Text& "," MsgBox " TIPE " &cmbtipe.Text& " SUDAH&txtlama.Text& "," &txtharga_sewa.Text& ")" DIPESAN!"Set rsdetail = dbado.Execute(sqlsv, , adCmdText) txtharga_sewa.Text = ""tabel cmbtipe.SetFocusnonaktif End Ifbersih ElseEnd Sub If cmbtipe.ListIndex = 2 ThenPrivate Sub cmbtipe_Click() ck = "select no_sewa from detail_sewa where no_sewa=" &txtsewa.Text& " and tipe_mobil="If cmbtipe.ListIndex = 0 Then &cmbtipe.Text& ""ck = "select no_sewa from detail_sewa where Set rsdetail = dbado.Execute(ck, , adCmdText)no_sewa=" &txtsewa.Text& " and tipe_mobil="&cmbtipe.Text& "" If rsdetail.BOFAndrsdetail.EOF ThenSet rsdetail = dbado.Execute(ck, , adCmdText) txtharga_sewa.Text = "500000" If rsdetail.BOFAndrsdetail.EOF Then txtlama.SetFocustxtharga_sewa.Text = "400000" Elsetxtlama.SetFocus MsgBox " TIPE " &cmbtipe.Text& " SUDAH DIPESAN!" Else txtharga_sewa.Text = ""MsgBox " TIPE " &cmbtipe.Text& " SUDAHDIPESAN!" cmbtipe.SetFocustxtharga_sewa.Text = "" End Ifcmbtipe.SetFocus End If End If End IfElse End If
  4. 4. Ahmad Mustaqim | 12100408 4 Rental_mobilEnd Sub Private Sub txtlama_Change() txttotal.Text = (Val(txtharga_sewa.Text) * Val(txtlama.Text)) + Val(txttotal.Text)Private Sub Form_Activate() End Subnonaktiflbltanggal.Caption = Format(Date, "yyyy-mm-dd")tabelcmbtipe.AddItem ("inova")cmbtipe.AddItem ("avanza")cmbtipe.AddItem ("city")End SubPrivate Sub Form_Load()koneksiEnd SubPrivate Sub txtkdpeminjam_OnEnter()sqlkd = "select*from peminjam wherekd_peminjam=" &txtkdpeminjam.Text& ""Set rspeminjam = dbado.Execute(sqlkd, ,adCmdText)If rspeminjam.BOFAndrspeminjam.EOF ThenMsgBox "KODE " &txtkdpeminjam.Text& "BelumTerdaftar"txtkdpeminjam.Text = ""txtkdpeminjam.SetFocusElsetxtnama_peminjam.Text = rspeminjam!namacmbtipe.SetFocusEnd IfEnd Sub

×