Sub getstokitem As ResumableSub
Dim req As DBRequestManager = CreateRequest
For i = 0 To ClvBO.Size - 1
Dim ABO As databackorder = ClvBO.GetValue(i)
Dim panel As B4XView = ClvBO.GetPanel(i)
If panel.IsInitialized Then ' Ensure panel is initialized
Dim txtkodebo As B4XView = panel.GetView(0)
If txtkodebo.Text.Length > 0 Then
ABO.txtkodebarang = txtkodebo.Text
Dim cmd As DBCommand = CreateCommand("getstokitem", Array(ABO.txtkodebarang))
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)
If res.Rows.Size = 0 Then
MsgboxAsync("Tidak ada data", "Info")
Else
For Each row() As Object In res.Rows
Dim SI As StokItem
SI.txtonhand = row(0)
Dim Pnl06 As B4XView = XUI.CreatePanel(Null)
Pnl06.Color = XUI.Color_Gray
Pnl06.SetLayoutAnimated(0, 0, 0, ClvBO.AsView.Width, 30dip)
PCLV6.AddItem(25dip, XUI.Color_Cyan, SI)
PCLV6.Commit
Next
End If
Else
Log("ERROR: " & j.ErrorMessage)
End If
j.Release ' Make sure to release the job here, inside the loop and if block
End If
End If
Next
End Sub