Data Base TO Listview
'## FROM LOAD
penDB() ' Connect db
ListView1.View = View.Details
ListView1.GridLines = True
ListView1.AutoSize = True
ListView1.FullRowSelect = True '' เลือกทั้งแถว ของ Listview
'' HEADER
ListView1.Columns.Add("PO", 100)
ListView1.Columns.Add("PRINT", 200)
ListView1.Columns.Add("CATON", 100)
ListView1.Columns.Add("QTY", 100)
ListView1.Columns.Add("P/L", 200)
ListView1.Columns.Add("LOC", 200)
ListView1.Columns.Add("CATON", 200)
ListView1.Columns.Add("QTY", 170)
'ListView1.SelectedIndex = 0
ListView1.Items.Clear()
Dim sql2 As String
Dim rss2 As OleDbDataReader
sql2 = " select b.pono,b.cuspartno,sum(decode(c.stkqty,0,0,1)) ctn,b.orderqty,c.palletkey,c.shelve,b.orderqty / l.outerqty ordctn,sum(c.stkqty) stkqty" & _
" from tbd_orderent e inner join tbd_orderbody b on e.orderkey = b.orderkey " & _
" inner join tbd_stkdetails s on s.cuspartno = b.cuspartno " & _
" Left join tbd_ctndetails c on c.cuspartno = s.cuspartno and c.ctnsplno = s.ctnsplno and (c.stkqty > 0 or c.stkqty is not null) " & _
" inner join tbd_partlg l on l.cuspartno = b.cuspartno " & _
" where e.orderkey = 'DATTAP1509-006' " & _
" group by b.pono,b.cuspartno,b.orderqty,c.palletkey,c.shelve,b.orderqty / l.outerqty ,l.datpartno,s.recdte " & _
" order by b.pono,b.cuspartno,s.recdte,c.palletkey "
rss2 = ExcuteReader(sql2)
Do While rss2.Read
AddListView(0) = rss2.Item("pono")
AddListView(1) = rss2.Item("cuspartno")
AddListView(2) = rss2.Item("ctn")
AddListView(3) = rss2.Item("orderqty")
AddListView(4) = rss2.Item("palletkey")
AddListView(5) = rss2.Item("shelve")
AddListView(6) = rss2.Item("ordctn")
AddListView(7) = rss2.Item("stkqty")
item = New ListViewItem(AddListView)
ListView1.Items.Add(item)
Loop
penDB() ' Connect db
ListView1.View = View.Details
ListView1.GridLines = True
ListView1.AutoSize = True
ListView1.FullRowSelect = True '' เลือกทั้งแถว ของ Listview
'' HEADER
ListView1.Columns.Add("PO", 100)
ListView1.Columns.Add("PRINT", 200)
ListView1.Columns.Add("CATON", 100)
ListView1.Columns.Add("QTY", 100)
ListView1.Columns.Add("P/L", 200)
ListView1.Columns.Add("LOC", 200)
ListView1.Columns.Add("CATON", 200)
ListView1.Columns.Add("QTY", 170)
'ListView1.SelectedIndex = 0
ListView1.Items.Clear()
Dim sql2 As String
Dim rss2 As OleDbDataReader
sql2 = " select b.pono,b.cuspartno,sum(decode(c.stkqty,0,0,1)) ctn,b.orderqty,c.palletkey,c.shelve,b.orderqty / l.outerqty ordctn,sum(c.stkqty) stkqty" & _
" from tbd_orderent e inner join tbd_orderbody b on e.orderkey = b.orderkey " & _
" inner join tbd_stkdetails s on s.cuspartno = b.cuspartno " & _
" Left join tbd_ctndetails c on c.cuspartno = s.cuspartno and c.ctnsplno = s.ctnsplno and (c.stkqty > 0 or c.stkqty is not null) " & _
" inner join tbd_partlg l on l.cuspartno = b.cuspartno " & _
" where e.orderkey = 'DATTAP1509-006' " & _
" group by b.pono,b.cuspartno,b.orderqty,c.palletkey,c.shelve,b.orderqty / l.outerqty ,l.datpartno,s.recdte " & _
" order by b.pono,b.cuspartno,s.recdte,c.palletkey "
rss2 = ExcuteReader(sql2)
Do While rss2.Read
AddListView(0) = rss2.Item("pono")
AddListView(1) = rss2.Item("cuspartno")
AddListView(2) = rss2.Item("ctn")
AddListView(3) = rss2.Item("orderqty")
AddListView(4) = rss2.Item("palletkey")
AddListView(5) = rss2.Item("shelve")
AddListView(6) = rss2.Item("ordctn")
AddListView(7) = rss2.Item("stkqty")
item = New ListViewItem(AddListView)
ListView1.Items.Add(item)
Loop
ไม่มีความคิดเห็น