Sub refreshlistnota_Click
Clv2.Clear
If chkproses.Checked = True Then
If chkfaktur.Checked = True Then
getlistsalesorder
getlistnota
Else
getlistsalesorder
End If
Else
If chkfaktur.Checked = True Then
getlistnota
Else
MsgboxAsync(" Anda belum menentukan pilihan pengecekan data", " Info")
End If
End If
End Sub
Sub getlistnota
Dim req As DBRequestManager=CreateRequest
Dim cmd As DBCommand=CreateCommand("getlistnota", Array(kodetoko))
Wait for (req.ExecuteQuery(cmd,0,Null)) JobDone(j As HttpJob)
If j.Success Then
req.HandleJobAsync(j,"req")
wait for (req) req_result(res As DBResult)
req.PrintTable(res)
'Log(res.Columns)
For Each row() As Object In res.Rows
Dim AD As ambildata
DateTime.DateFormat= "dd-MM-yyyy"
AD.Initialize
AD.txtnobon ="No Faktur : " & row(2)
AD.txtnobonsaja=row(2)
AD.txtjumlah = NumberFormat(row(6),1,3)
Dim Pnl02 As B4XView = XUI.CreatePanel(Null)
Pnl02.Color = XUI.Color_Gray
Pnl02.SetLayoutAnimated(0, 0, 0, Clv2.AsView.Width, 35dip)
Clv2.Add(Pnl02,AD)
Next
Else
Log("ERROR: " &j.ErrorMessage)
End If
j.Release
End Sub
Sub getlistsalesorder
Dim req As DBRequestManager=CreateRequest
Dim cmd As DBCommand=CreateCommand("getlistsalesorder", Array(kodetoko))
Wait for (req.ExecuteQuery(cmd,0,Null)) JobDone(j As HttpJob)
If j.Success Then
req.HandleJobAsync(j,"req")
wait for (req) req_result(res As DBResult)
'req.PrintTable(res)
'Log(res.Columns)
For Each row() As Object In res.Rows
Dim AD As ambildata
AD.nosalesorder ="No Order : " & row(0)
AD.nosalesordersaja = row(0)
AD.txtrupiah = "0"
Dim Pnl04 As B4XView = XUI.CreatePanel(Null)
Pnl04.Color = XUI.Color_Gray
Pnl04.SetLayoutAnimated(0, 0, 0, Clv2.AsView.Width, 35dip)
Clv2.Add(Pnl04,AD)
Next
Else
Log("ERROR: " &j.ErrorMessage)
End If
j.Release
End Sub
Sub clv2_VisibleRangeChanged (FirstIndex As Int, LastIndex As Int)
Dim ExtraSize As Int = 10 'Add 25 items at a time, this can be changed to suite your requirements
For i = Max(0, FirstIndex - ExtraSize) To Min(LastIndex + ExtraSize, Clv2.Size - 1) 'Loop for adding/removing your items layout to or from the list
Dim Pnl As B4XView = Clv2.GetPanel(i) 'Declare a new B4XView
If i > FirstIndex - ExtraSize And i < LastIndex + ExtraSize Then 'Add a new item to the list
If Pnl.NumberOfViews = 0 Then 'Add items to the list
Dim AD As ambildata = Clv2.GetValue(i) 'Get your custom Type
Pnl.LoadLayout("gabungan")
noorder.text = AD.nosalesorder
rupiahorder.Text = AD.txtrupiah
txtnobon.Text = AD.txtnobon
txtjumlah.Text = AD.txtjumlah
End If
Else 'Remove items from the list
If Pnl.NumberOfViews > 0 Then
Pnl.RemoveAllViews 'Remove none visible item from the main xCLV layout
End If
End If
Next
End Sub