Dim baris As Integer
Sub kosong()
Text5.Text = ""
Text6.Text = ""
Text7.Text = ""
Text8.Text = ""
Text12.Text = ""
Text13.Text = ""
Text10.Text = ""
Text11.Text = ""
End Sub
Private Sub bMasuk_Click()
With GridPenjualan
.Rows = baris + 1
.TextMatrix(baris, 0) = Text5.Text
.TextMatrix(baris, 1) = Text6.Text
.TextMatrix(baris, 2) = Text7.Text
.TextMatrix(baris, 3) = Text12.Text
.TextMatrix(baris, 4) = Text13.Text
End With
tTotal.Text = Val(tTotal.Text) + Val(Text13.Text)
baris = baris + 1
End Sub
Private Sub DataGrid1_DblClick()
Text3.Text = DataGrid1.Columns(0)
Text4.Text = DataGrid1.Columns(1)
End Sub
Private Sub DataGrid2_DblClick()
Text5.Text = DataGrid2.Columns(0)
Text6.Text = DataGrid2.Columns(1)
Text7.Text = DataGrid2.Columns(2)
Text8.Text = DataGrid2.Columns(3)
End Sub
Private Sub Form_Activate()
tTanggal.Text = Date
tJam.Text = Time
baris = 1
With GridPenjualan
.Col = 0
.Row = 0
.Text = "Kode Barang"
.ColWidth(0) = 1200
.AllowUserResizing = flexResizeColumns
.CellAlignment = flexAlignCenterCenter
.Col = 1
.Row = 0
.Text = "Nama Barang"
.ColWidth(1) = 1200
.AllowUserResizing = flexResizeColumns
.CellAlignment = flexAlignCenterCenter
.Col = 2
.Row = 0
.Text = "Harga Barang"
.ColWidth(2) = 1200
.AllowUserResizing = flexResizeColumns
.CellAlignment = flexAlignCenterCenter
.Col = 3
.Row = 0
.Text = "Jumlah Beli"
.ColWidth(3) = 1200
.AllowUserResizing = flexResizeColumns
.CellAlignment = flexAlignCenterCenter
.Col = 4
.Row = 0
.Text = "Bayar"
.ColWidth(4) = 1200
.AllowUserResizing = flexResizeColumns
.CellAlignment = flexAlignCenterCenter
End With
End Sub
Private Sub Form_Load()
Call OpenDB
End Sub
Private Sub OsenVistaButton1_Click()
sqlInsert = ""
sqlInsert = "insert into penjualan" _
& " (no_fakjual,tgl_fakjual, " _
& " kd_pelanggan,kd_pengguna) " _
& " values('" & tFaktur.Text & "','" _
& Format(tTanggal.Text, "yyyy/mm/dd") & "','" _
& Text3.Text & "','" & PenggunaID & "')"
conn.Execute sqlInsert, , adCmdText
rs_penjualan.Requery
For i = 1 To baris - 1
sqlInsert = ""
sqlInsert = "insert into detpenjualan" _
& " (no_fakjual,kd_barang, " _
& " hrg_jual,jumlah_jual,total_jual)" _
& "values ('" & tFaktur.Text & "','" _
& GridPenjualan.TextMatrix(i, 0) & "','" _
& GridPenjualan.TextMatrix(i, 2) & "','" _
& GridPenjualan.TextMatrix(i, 3) & "','" _
& GridPenjualan.TextMatrix(i, 4) & "')"
conn.Execute sqlInsert, , adCmdText
sqlUpdate = ""
sqlUpdate = "update barang set " _
& "stok = stok- " _
& Val(GridPenjualan.TextMatrix(i, 3)) & "" _
& " where kdbarang='" _
& GridPenjualan.TextMatrix(i, 0) & "'"
conn.Execute sqlUpdate, , adCmdText
Next i
MsgBox "data telah tersimpan dalam database !", vbOKOnly + vbInformation, "konfirmasi"
End Sub
Private Sub OsenVistaButton2_Click()
Call kosong
tFaktur.SetFocus
End Sub
Private Sub Text10_Change()
Text11.Text = Val(Text10.Text) - Val(tTotal.Text)
End Sub
Private Sub Text12_Change()
Text13.Text = Val(Text12.Text) * Val(Text7.Text)
End Sub
Tidak ada komentar:
Posting Komentar