Sub ViewPembelian()
Dim lSingleItem As ListViewItem
objCommand = MyConnection.open.CreateCommand
objCommand.CommandText = "SELECT Pembelian.Invoice, Pembelian.Tgl_Invoice, " & _
" Pembelian.Kode_Brg, Barang.Deskripsi, Barang.Hrg_Beli, Pembelian.Qty, " & _
" Barang.Path, Pembelian.Jlh_Diskon, Pembelian.Hrg_Diskon, Pembelian.Harga, " & _
" Total_Pembelian.Total_DiskonPersen, Total_Pembelian.Total_DiskonRp," & _
" Total_Pembelian.Total_Harga, Karyawan.FirstName, Supplier.NamaSupplier," & _
" Supplier.Alamat, Supplier.ContactPerson, Total_PO.PO_No " & _
" FROM Supplier INNER JOIN ((((Pembelian INNER JOIN Total_Pembelian " & _
" ON Pembelian.Invoice = Total_Pembelian.Invoice) INNER JOIN Barang ON " & _
" Pembelian.Kode_Brg = Barang.Kode_Brg) INNER JOIN Karyawan ON " & _
" Total_Pembelian.NIK = Karyawan.NIK) INNER JOIN Total_PO ON " & _
" (Karyawan.NIK = Total_PO.NIK) AND (Total_Pembelian.PO_No = Total_PO.PO_No)) " & _
" ON Supplier.SupplierID = Total_PO.SupplierID Where Pembelian.Invoice ='" & Trim(CbSearch.SelectedItem) & "';"
objdatareader = objCommand.ExecuteReader
While objdatareader.Read()
txtNama.Text = objdatareader.Item("FirstName")
dtTgl_Invoice.Text = objdatareader.Item("Tgl_Invoice")
txtInvoice.Text = objdatareader.Item("Invoice").ToString
lSingleItem = LstTransaksi.Items.Add(objdatareader.Item("Kode_Brg").ToString)
lSingleItem.SubItems.Add(objdatareader.Item("Deskripsi").ToString)
lSingleItem.SubItems.Add(objdatareader.Item("Qty").ToString)
lSingleItem.SubItems.Add(FormatCurrency(objdatareader.Item("Hrg_Beli").ToString))
lSingleItem.SubItems.Add(objdatareader.Item("Jlh_Diskon").ToString)
lSingleItem.SubItems.Add(FormatCurrency(objdatareader.Item("Hrg_Diskon").ToString))
lSingleItem.SubItems.Add(FormatCurrency(objdatareader.Item("Harga").ToString))
txtTotDisPersen.Text = objdatareader.Item("Total_DiskonPersen").ToString
txtTotDisRp.Text = FormatCurrency(objdatareader.Item("Total_DiskonRp").ToString)
txtTotalHarga.Text = FormatCurrency(objdatareader.Item("Total_Harga").ToString)
txtNamaSupplier.Text = objdatareader.Item("NamaSupplier").ToString
txtContactPerson.Text = objdatareader.Item("ContactPerson").ToString
txtAlamat.Text = objdatareader.Item("Alamat").ToString
lblPO.Text = "PO No. " & objdatareader.Item("PO_No").ToString
End While
MyConnection.close()
End Sub