Sub kosong()
Text1.Text = ""
Text3.Text = ""
Text4.Text = ""
Text5.Text = ""
Text6.Text = ""
Text7.Text = ""
Text8.Text = ""
Text9.Text = ""
Text10.Text = ""
Text11.Text = ""
Text12.Text = ""
End Sub
Private Sub Form_Activate()
Text2.Text = Format(Now, "dd-mm-yyyy")
End Sub
Private Sub Form_Load()
opendb
End Sub
Private Sub OsenVistaButton1_Click()
frmtampilbarang.Show
End Sub
Sub no()
Dim no As String
If rs_pengeluaran.BOF Then
Text1.Text = "KEL-151090"
Exit Sub
Else
rs_pengeluaran.Requery
If Not (rs_pengeluaran.EOF Or rs_pengeluaran.BOF) Then
rs_pengeluaran.MoveLast
End If
no = rs_pengeluaran!KODE_PENGELUARAN
no = Val(Right(no, 3))
no = no + 1
End If
If Val(no) < 10 Then
no = "KEL-15109" & no
Text1.Text = no
ElseIf Val(no) < 100 Then
no = "KEL-1510" & no
Text1.Text = no
ElseIf Val(no) < 1000 Then
no = "KEL-151" & no
Text1.Text = no
ElseIf Val(no) < 10000 Then
no = "KEL-15" & no
Text1.Text = no
End If
End Sub
Private Sub OsenVistaButton2_Click()
Call no
Text3.BackColor = vbWhite
Text4.BackColor = vbWhite
Text5.BackColor = vbWhite
Text6.BackColor = vbWhite
Text7.BackColor = vbWhite
Text8.BackColor = vbWhite
Text9.BackColor = vbWhite
Text9.Locked = False
Text10.BackColor = vbWhite
Text10.Locked = False
Text11.BackColor = vbWhite
Text11.Locked = False
Text12.BackColor = vbWhite
Text12.Locked = False
End Sub
Private Sub OsenVistaButton3_Click()
Adodc1.Recordset.AddNew
With Adodc1
.Recordset!KODE_PENGELUARAN = Text1.Text
.Recordset!TGL_KELUAR = Text2.Text
.Recordset!JUMLAH_KELUAR = Text9.Text
.Recordset!bayar = Text10.Text
.Recordset!KODE_CUST = Text3.Text
.Recordset!KODE_BARANG = Text5.Text
.Recordset.Update
End With
sqlUpdate = ""
sqlUpdate = "UPDATE BARANG SET " _
& " STOCK=STOCK - " _
& Val(Text9.Text) & "" _
& " WHERE KODE_BARANG='" _
& Text5.Text & "'"
conn.Execute sqlUpdate, , adCmdText
OsenVistaButton3.Enabled = False
OsenVistaButton2.Enabled = True
OsenVistaButton4.Enabled = True
Call kosong
Text3.BackColor = &HFFFF80
Text4.BackColor = &HFFFF80
Text5.BackColor = &HFFFF80
Text6.BackColor = &HFFFF80
Text7.BackColor = &HFFFF80
Text8.BackColor = &HFFFF80
Text9.BackColor = &HFFFF80
Text9.Locked = True
Text10.BackColor = &HFFFF80
Text10.Locked = True
Text11.BackColor = &HFFFF80
Text11.Locked = True
Text12.BackColor = &HFFFF80
Text12.Locked = True
End Sub
Private Sub OsenVistaButton4_Click()
If MsgBox("apakah anda yakin ingin keluar", vbExclamation + vbYesNo, "keluar") = vbYes Then
Unload Me
End If
End Sub
Private Sub OsenVistaButton5_Click()
frmtampilpelanggan.Show
End Sub
Private Sub Text11_Change()
Text12.Text = Val(Text11.Text) - Val(Text10.Text)
End Sub
Private Sub Text9_Change()
If Text8.Text < Text9.Text Then
MsgBox "maaf stok tidak mencukupi", vbInformation, "informasi"
Else
Text10.Text = Val(Text7.Text) * Val(Text9.Text)
End If
End Sub
Tidak ada komentar:
Posting Komentar