Selasa, 28 Februari 2012

pengeluaran one to one

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

form utama

Private Sub b_Click()
frmBackup.Show

End Sub

Private Sub b_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
b.BackColor = vbBlue
label15.ForeColor = vbWhite

End Sub



Private Sub e_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
e.BackColor = vbBlue
label16.ForeColor = vbWhite
e1.Visible = True
e2.Visible = True
End Sub

Private Sub e1_Click()
Unload Me
frmlogin.Show

End Sub

Private Sub e1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
e1.BackColor = vbInactiveTitleBarText
label17.ForeColor = vbBlack
e2.BackColor = vbHighlight
label18.ForeColor = vbWhite
End Sub

Private Sub e2_Click()
If MsgBox("apakah anda yakin ingin keluar", vbExclamation + vbYesNo, "keluar") = vbYes Then
Unload Me
End If

End Sub

Private Sub e2_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
e2.BackColor = vbInactiveTitleBarText
label18.ForeColor = vbWhite
e1.BackColor = vbHighlight
label17.ForeColor = vbBlack

End Sub

Private Sub Form_Activate()
Text1.Text = Format(Now, "dd-mm-yyyy")
Text2.Text = Time
End Sub

Private Sub Form_Load()
loadskin
Skin1.loadskin skinpath
Skin1.ApplySkin Me.hWnd

m1.Visible = False
m2.Visible = False
m3.Visible = False

t1.Visible = False
t2.Visible = False
t3.Visible = False

l1.Visible = False
l2.Visible = False
l3.Visible = False

e1.Visible = False
e2.Visible = False

u1.Visible = False


End Sub



Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
m1.Visible = False
m2.Visible = False
m3.Visible = False

t1.Visible = False
t2.Visible = False
t3.Visible = False

u1.Visible = False

l1.Visible = False
l2.Visible = False
l3.Visible = False


End Sub









Private Sub l_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
l.BackColor = vbBlue
Label1.ForeColor = vbWhite
l1.Visible = True
l2.Visible = True
l3.Visible = True
End Sub

Private Sub l1_Click()
rptpermintaan.Show

End Sub

Private Sub l1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
l1.BackColor = vbInactiveTitleBarText
label12.ForeColor = vbBlack
l2.BackColor = vbHighlight
label13.ForeColor = vbWhite
l3.BackColor = vbHighlight
label14.ForeColor = vbWhite
End Sub

Private Sub l2_Click()
rptpenerimaan.Show

End Sub

Private Sub l2_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
l2.BackColor = vbInactiveTitleBarText
label13.ForeColor = vbWhite
l1.BackColor = vbHighlight
label12.ForeColor = vbBlack
l3.BackColor = vbHighlight
label14.ForeColor = vbWhite
End Sub

Private Sub l3_Click()
rptpengeluaran.Show

End Sub

Private Sub l3_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
l3.BackColor = vbInactiveTitleBarText
label14.ForeColor = vbWhite
l2.BackColor = vbHighlight
label13.ForeColor = vbWhite
l1.BackColor = vbHighlight
label12.ForeColor = vbBlack

End Sub









Private Sub m_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
m.BackColor = vbBlue
Label1.ForeColor = vbWhite
m1.Visible = True
m2.Visible = True
m3.Visible = True


End Sub

Private Sub m1_Click()
'm1.Visible = False
'm2.Visible = False
'm3.Visible = False
frmbarang.Show



End Sub

Private Sub m1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
m1.BackColor = vbInactiveTitleBarText
Label2.ForeColor = vbBlack
m2.BackColor = vbHighlight
Label3.ForeColor = vbWhite
m3.BackColor = vbHighlight
Label4.ForeColor = vbWhite
End Sub

Private Sub m2_Click()
'm1.Visible = False
'm2.Visible = False
'm3.Visible = False
frmpelanggan.Show
'Me.Enabled = False

End Sub

Private Sub m2_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
m2.BackColor = vbInactiveTitleBarText
Label3.ForeColor = vbBlack
m1.BackColor = vbHighlight
Label1.ForeColor = vbWhite
m3.BackColor = vbHighlight
Label4.ForeColor = vbWhite

End Sub

Private Sub m3_Click()
frmsupplier.Show


End Sub

Private Sub m3_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
m3.BackColor = vbInactiveTitleBarText
Label4.ForeColor = vbBlack
m1.BackColor = vbHighlight
Label1.ForeColor = vbWhite
m2.BackColor = vbHighlight
Label3.ForeColor = vbWhite

End Sub










Private Sub t_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
t.BackColor = vbBlue
label5.ForeColor = vbWhite
t1.Visible = True
t2.Visible = True
t3.Visible = True

End Sub

Private Sub t1_Click()
frmpermintaan.Show

End Sub

Private Sub t1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
t1.BackColor = vbInactiveTitleBarText
label6.ForeColor = vbBlack
t2.BackColor = vbHighlight
label7.ForeColor = vbWhite
t3.BackColor = vbHighlight
label8.ForeColor = vbWhite

End Sub

Private Sub t2_Click()
frmpenerimaan.Show


End Sub

Private Sub t2_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
t2.BackColor = vbHighlight
label7.ForeColor = vbWhite
t1.BackColor = vbInactiveTitleBarText
label6.ForeColor = vbBlack
t3.BackColor = vbHighlight
label8.ForeColor = vbWhite

End Sub

Private Sub t3_Click()
frmpengeluaran.Show

End Sub

Private Sub t3_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)

t3.BackColor = vbHighlight
label8.ForeColor = vbWhite
t2.BackColor = vbHighlight
label7.ForeColor = vbWhite
t1.BackColor = vbInactiveTitleBarText
label6.ForeColor = vbBlack
End Sub



Private Sub u_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
u.BackColor = vbBlue
label9.ForeColor = vbWhite
u1.Visible = True

End Sub

Private Sub u1_Click()
frmabout.Show

End Sub

Private Sub u1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
u1.BackColor = vbHighlight
label10.ForeColor = vbWhite

End Sub

form pengeluaran

Dim baris As Integer

Sub kosong()
Text3.Text = ""
Text4.Text = ""
Text5.Text = ""
Text6.Text = ""
Text7.Text = ""
Text8.Text = ""
Text9.Text = ""
Text10.Text = ""
Text11.Text = ""
Text12.Text = ""
Text13.Text = ""


End Sub

Sub no()
Dim no As String
If rs_keluar.BOF Then
Text1.Text = "TR-1903100"
Exit Sub

Else
rs_keluar.Requery
If Not (rs_keluar.EOF Or rs_keluar.BOF) Then
rs_keluar.MoveLast
End If

no = rs_keluar!KODE_PENGELUARAN
no = Val(Right(no, 3))
no = no + 1
End If

If Val(no) < 10 Then
no = "TR-190310" & no
Text1.Text = no
ElseIf Val(no) < 100 Then
no = "TR-19031" & no
Text1.Text = no
ElseIf Val(no) < 1000 Then
no = "TR-1903" & no
Text1.Text = no
ElseIf Val(no) < 10000 Then
no = "TR-190" & no
Text1.Text = no
Else

End If
End Sub

Sub jual()
'baris = 1
With GridPenjualan
.Col = 0
.Row = 0
.Text = "Kode Barang"
.ColWidth(0) = 2000

.Col = 1
.Row = 0
.Text = "Nama Barang"
.ColWidth(1) = 2000

.Col = 2
.Row = 0
.Text = "Harga Barang"
.ColWidth(2) = 2000

.Col = 3
.Row = 0
.Text = "Jumlah Beli"
.ColWidth(3) = 2000
.Col = 4
.Row = 0
.Text = "Bayar"
.ColWidth(4) = 2000

End With


End Sub



Private Sub Form_Activate()
Call jual
Text2.Text = Date
End Sub




Private Sub Form_Load()
opendb


End Sub



Private Sub OsenVistaButton1_Click()
On Error Resume Next
If Val(Text9.Text) > Val(Text8.Text) Then
MsgBox "Stok Tidak Mencukupi!!!", vbCritical, "Error!"
Else
With GridPenjualan
.Rows = baris + 1
.TextMatrix(baris, 0) = Text5.Text
.TextMatrix(baris, 1) = Text6.Text
.TextMatrix(baris, 2) = Text7.Text
.TextMatrix(baris, 3) = Text9.Text
.TextMatrix(baris, 4) = Text10.Text
End With
Text11.Text = Val(Text10.Text) + Val(Text11.Text)
baris = baris + 1
End If


Text5.Text = ""
Text6.Text = ""
Text7.Text = ""
Text8.Text = ""
Text9.Text = ""
Text10.Text = ""


End Sub



Private Sub Text13_Change()
Text12.Text = Val(Text13.Text) - Val(Text11.Text)

End Sub

Private Sub Text9_Change()
Text10.Text = Val(Text7.Text) * Val(Text9.Text)

End Sub

Private Sub XPButton1_Click()
frmtampilpelanggan.Show

End Sub

Private Sub XPButton2_Click()
frmtampilbarang.Show

End Sub

Private Sub XPButton3_Click()
Call no
baris = 1
XPButton3.Enabled = False
XPButton4.Enabled = True
XPButton5.Enabled = True

End Sub

Private Sub XPButton4_Click()
sqlInsert = ""
sqlInsert = "insert into keluar" _
& " (KODE_PENGELUARAN,TGL_KELUAR,KODE_CUST) " _
& " values('" & Text1.Text & "','" _
& Format(Text2.Text, "yyyy/dd/mm") & "','" _
& Text3.Text & "')"
conn.Execute sqlInsert, , adCmdText
rs_keluar.Requery

For i = 1 To baris - 1
sqlInsert = ""
sqlInsert = "insert into DET_KELUAR " _
& " (KODE_PENGELUARAN,KODE_BARANG," _
& " JUMLAH_KELUAR,BAYAR) " _
& " values('" & Text1.Text & "','" _
& GridPenjualan.TextMatrix(i, 0) & "','" _
& GridPenjualan.TextMatrix(i, 3) & "','" _
& GridPenjualan.TextMatrix(i, 4) & "')"
conn.Execute sqlInsert, , adCmdText

sqlUpdate = ""
sqlUpdate = "update BARANG SET " _
& "STOCK=STOCK- " _
& Val(GridPenjualan.TextMatrix(i, 3)) & "" _
& " where KODE_BARANG='" _
& GridPenjualan.TextMatrix(i, 0) & "'"

conn.Execute sqlUpdate, , adCmdText
Next i

MsgBox "data telah berhasil disimpan!", vbInformation, "informasi"
FmPreviewPenjualan.Show
FmPreviewPenjualan.Text1.Text = Text1.Text

baris = 1
GridPenjualan.Clear
GridPenjualan.Rows = 2
Call jual
Call kosong
XPButton4.Enabled = False
XPButton3.Enabled = True
XPButton5.Enabled = False







End Sub


Private Sub XPButton5_Click()
If MsgBox("yakin nih mau dihapus??", vbExclamation + vbYesNo, "Hapus") = vbYes Then
With GridPenjualan
.RemoveItem (.Row)
End With
End If
Text11.Text = Val(Text11.Text) - Val(Text10.Text)
baris = baris - 1

End Sub

Private Sub XPButton7_Click()
Nom = 1
Sw = 1

FmPreviewPenjualan.Show
Call CetakLayar
End Sub

struk penjualan one to many

Option Explicit
Dim Sw, Nom, Sw2, Nom2 As Integer
Dim sql As String


Private Sub Form_Activate()
Nom = 1
Sw = 1

FmPreviewPenjualan.Show
Call CetakLayar
End Sub

Private Sub Form_Load()
Move (Screen.Width - Width) / 2, _
(Screen.Height - Height) / 3
Call opendb
End Sub

Private Sub CetakLayar()
Dim Grs As String

Set rs_cetakpenjualan = New ADODB.Recordset

sql = "SELECT keluar.KODE_PENGELUARAN, " _
& " keluar.TGL_KELUAR,PELANGGAN.NAMA_CUST, " _
& " DET_KELUAR.KODE_BARANG, " _
& " BARANG.NAMA_BARANG,BARANG.HARGA,DET_KELUAR.JUMLAH_KELUAR, " _
& " DET_KELUAR.BAYAR " _
& " FROM keluar, DET_KELUAR, " _
& " BARANG, PELANGGAN WHERE " _
& " keluar.KODE_PENGELUARAN=DET_KELUAR.KODE_PENGELUARAN " _
& " AND keluar.KODE_CUST=PELANGGAN.KODE_CUST " _
& " AND DET_KELUAR.KODE_BARANG = BARANG.KODE_BARANG " _
& " AND keluar.KODE_PENGELUARAN='" & Text1.Text & "'"

rs_cetakpenjualan.Open sql, conn, _
adOpenDynamic, adLockOptimistic, adCmdText

With rs_cetakpenjualan
.MoveFirst
Do While Not .EOF
If Sw = 1 Then
FmPreviewPenjualan.FontBold = True
FmPreviewPenjualan.FontSize = 14
FmPreviewPenjualan.Print
FmPreviewPenjualan.Print "Data Penjualan Barang"
Grs = String$(92, "+")
FmPreviewPenjualan.FontBold = False
FmPreviewPenjualan.FontSize = 10
FmPreviewPenjualan.Print
FmPreviewPenjualan.Print Tab(0); Grs;
FmPreviewPenjualan.Print Tab(2); "No";
FmPreviewPenjualan.Print Tab(8); "Kode";
FmPreviewPenjualan.Print Tab(23); "Nama";
FmPreviewPenjualan.Print Tab(38); "Harga";
FmPreviewPenjualan.Print Tab(48); "Jumlah";
FmPreviewPenjualan.Print Tab(58); "Bayar";
FmPreviewPenjualan.Print Tab(8); "Barang";
FmPreviewPenjualan.Print Tab(23); "Barang";
FmPreviewPenjualan.Print Tab(38); "Barang";
FmPreviewPenjualan.Print Tab(48); "Barang";
' FmPreviewPenjualan.Print Tab(58); "Barang";
FmPreviewPenjualan.FontBold = False
FmPreviewPenjualan.Print Tab(0); Grs;
Sw = 0
End If
FmPreviewPenjualan.Print Tab(3); Format(Nom, "###");
FmPreviewPenjualan.Print Tab(8); ![KODE_BARANG];
FmPreviewPenjualan.Print Tab(23); ![NAMA_BARANG];
FmPreviewPenjualan.Print Tab(38); _
Format(![HARGA], "Rp #,#");
FmPreviewPenjualan.Print Tab(48); ![JUMLAH_KELUAR];
FmPreviewPenjualan.Print Tab(58); _
Format(![bayar], "Rp #,#");
Text2.Text = Val(![bayar]) + Val(Text2.Text)
FmPreviewPenjualan.Print
.MoveNext
Nom = Nom + 1
Loop
FmPreviewPenjualan.Print Tab(0); Grs;
FmPreviewPenjualan.Print Tab(48); "Total = "; Text2.Text;
End With
End Sub

Private Sub Cetak()
Dim Grs As String

Set rs_cetakpenjualan = New ADODB.Recordset
sql = "SELECT Penjualan.No_FakJual, " _
& " Penjualan.Tgl_FakJual,Pelanggan.Nm_Pelanggan, " _
& " Pengguna.Nama_User,DetPenjualan.Kd_Barang, " _
& " Barang.Nm_Barang,DetPenjualan.Harga_Jual, " _
& " DetPenjualan.Jumlah_Jual, DetPenjualan.Total_Jual" _
& " FROM Penjualan, DetPenjualan, " _
& " Barang, Pengguna, Pelanggan WHERE " _
& " Penjualan.No_FakJual=DetPenjualan.No_FakJual " _
& " AND Penjualan.Kd_Pelanggan=Pelanggan.Kd_Pelanggan " _
& " AND Penjualan.Kd_Pengguna=Pengguna.Kd_Pengguna " _
& " AND DetPenjualan.Kd_Barang = Barang.Kd_Barang " _
& " AND Penjualan.No_FakJual='" & TxtNoFaktur.Text & "'"


rs_cetakpenjualan.Open sql, conn, _
adOpenDynamic, adLockOptimistic, adCmdText

With rs_cetakpenjualan
.MoveFirst
Printer.CurrentX = 0
Printer.CurrentY = 0
Do While Not .EOF
If Sw2 = 1 Then
Printer.FontBold = True
Printer.FontSize = 14
Printer.Print
Printer.Print "Data Penjualan Barang"
Grs = String$(92, "+")
Printer.FontBold = False
Printer.FontSize = 10
Printer.Print
Printer.Print Tab(0); Grs;
Printer.Print Tab(2); "No";
Printer.Print Tab(8); "Kode";
Printer.Print Tab(18); "Nama";
Printer.Print Tab(38); "Harga";
Printer.Print Tab(48); "Jumlah";
Printer.Print Tab(58); "Total";
Printer.Print Tab(8); "Barang";
Printer.Print Tab(18); "Barang";
Printer.Print Tab(38); "Barang";
Printer.Print Tab(48); "Barang";
Printer.Print Tab(58); "Barang";
Printer.FontBold = False
Printer.Print Tab(0); Grs;
Sw2 = 0
End If
Printer.Print Tab(3); Format(Nom, "###");
Printer.Print Tab(8); ![Kd_Barang];
Printer.Print Tab(18); ![Nm_Barang];
Printer.Print Tab(38); _
Format(![Harga_Jual], "Rp #,#");
Printer.Print Tab(48); ![Jumlah_Jual];
Printer.Print Tab(58); _
Format(![Total_Jual], "Rp #,#");
.MoveNext
Nom2 = Nom2 + 1
Loop
Printer.Print Tab(0); Grs;
End With
Printer.NewPage
End Sub

Private Sub TbPreview_Click()
Nom = 1
Sw = 1

FmPreviewPenjualan.Show
Call CetakLayar
End Sub

Private Sub TbCetak_Click()
Nom2 = 1
Sw2 = 1

Call Cetak
Printer.EndDoc
End Sub

Private Sub TbKeluar_Click()
FormUtama.Enabled = False
frmpenjualan.Enabled = True
Unload Me
End Sub

Rabu, 01 Februari 2012

modul

Option Explicit
Public conn As ADODB.Connection
Public rs_barang As ADODB.Recordset
Public rs_jenis As ADODB.Recordset
Public rs_pemasok As ADODB.Recordset
Public rs_pegawai As ADODB.Recordset
Public rs_pelanggan As ADODB.Recordset
Public rs_pengguna As ADODB.Recordset
Public rs_penjualan As ADODB.Recordset
Public rs_detjual As ADODB.Recordset
Public rs_pembelian As ADODB.Recordset
Public rs_detbeli As ADODB.Recordset
Public sqlInsert As String
Public sqlUpdate As String
Public cmd As ADODB.Command
Public dbServer As String


Public Sub OpenDB()
Dim dbuser As String, dbpass As String, dbname As String
dbuser = "nasihatun"
dbpass = "nasihatun"
dbname = "nasihatun"
dbServer = "192.168.200.254"
Set conn = New ADODB.Connection
conn.Open "Provider=SQLOLEDB.1;User ID=" & dbuser & ";Password=" & dbpass & ";Initial Catalog=" & dbname & ";Data Source=" & dbServer

Set rs_pelanggan = New ADODB.Recordset
rs_pelanggan.Open "select * from pelanggan", _
conn, adOpenDynamic, adLockBatchOptimistic

Set rs_penjualan = New ADODB.Recordset
rs_penjualan.Open "select * from penjualan", _
conn, adOpenDynamic, adLockBatchOptimistic

Set rs_barang = New ADODB.Recordset
rs_barang.Open "select barang.*,jenis.nmjenis" _
& " from barang,jenis" _
& " where jenis.kdjenis=barang.kdjenis" _
, conn, adOpenDynamic, adLockBatchOptimistic

End Sub


Public Sub ExeQuery(sqlStr As String)
Set cmd = New ADODB.Command
cmd.ActiveConnection = conn
cmd.CommandType = adCmdText
cmd.CommandText = sqlStr

End Sub

membuat form penjualan one to many

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

Kamis, 23 September 2010

Sinopsis The Last Airbender

Avatar : The Last Airbender, versi layar lebar dari film animasi Avatar : The Legend of Aang nih. The Last Airbender (Avatar) kabarnya akan segera tayang di Indonesia pada tanggal 21 Juli 2010 nanti. ^^ Liat dulu sinopsis serta trailer film Avatar : The Last Airbender yang diproduksi oleh Paramount Pictures ini..

Sebelum Bloggerceria lanjut ke sinopsis serta review The Last Airbender movie ini, ada info yang cukup menarik. Sebenarnya film ini sebelumnya diberi judul Avatar : The Last Airbender, hanya saja agar tidak rancu dengan film Avatar (2009) yang memenangkan perhargaanOscar beberapa waktu lalu, maka judulnya diubah menjadi The Last Airbender saja. :D Film ini rencananya juga akan dibikin trilogy..

Avatar The last Airbender Movie Poster
Sutradara : M. Night Shyamalan
Cast : Noah Ringer (Aang), Jackson Rathbone (Sokka), Dev Patel (Zuko), Cliff Curtis (Firelord Ozai), Seychelle Gabriel (Princess Yue), dll..

Berikut ini sinopsis/resensi film Avatar : The Last Airbender diterjemahkan BCC dari IMDB :
Di masa lampau, ada empat bangsa yang mendiami dunia. Keempat bangsa tersebut yaitu Air, Bumi, Api & Udara (Air Nomads) hidup damai berkat penjagaan dari sang Avatar. Ia satu-satunya yang mampu menyatukan empat elemen tersebut.