Sub getSaleList
Try
'
Dim j As HttpJob
j.Initialize("", Me)
Log("code..")
Dim vstartDate, vendDate As String
vstartDate = B4XPages.MainPage.mmenupage.datestart
vendDate = B4XPages.MainPage.mmenupage.dateend
Log(vstartDate & " " & vendDate)
j.Download2(B4XPages.MainPage.gLink, Array As String("action","Sales_List","sdate",vstartDate,"edate",vendDate))
Wait For (j) JobDone(j As HttpJob)
If j.Success Then
Dim strdata As String
strdata = j.GetString
Log(strdata)
Dim jp As JSONParser
jp.Initialize(j.GetString)
saleList = jp.NextArray
If saleList.Size < 1 Then
MsgboxAsync("Records not found! " & Chr(10) & "Date: " & vstartDate & " - " & vendDate,"Admin")
Return
End If
ProgressDialogShow2("Please wait loading...",True)
Dim myList As List
myList.Initialize
myList.clear
For Each mydata As Map In saleList
Dim row(6) As Object
row(0) = mydata.Get("transaction_no")
row(1) = mydata.Get("category")
row(2) = mydata.Get("drso")
row(3) = mydata.Get("description")
row(4) = mydata.Get("issue_date")
row(5) = mydata.Get("total_ammount")
myList.Add(row)
'myList.Add(mydata.Get("branch_no") & "," & mydata.Get("branch_name") & "," & mydata.Get("branch_address") & "," & mydata.Get("branch_contact_no"))
Next
Log(mydata.Size)
B4XTable1.AddColumn("TransNo.", B4XTable1.COLUMN_TYPE_TEXT)
B4XTable1.AddColumn("Category", B4XTable1.COLUMN_TYPE_TEXT)
B4XTable1.AddColumn("DRSO", B4XTable1.COLUMN_TYPE_TEXT)
B4XTable1.AddColumn("Description", B4XTable1.COLUMN_TYPE_TEXT)
B4XTable1.AddColumn("IssueDate", B4XTable1.COLUMN_TYPE_TEXT)
B4XTable1.AddColumn("Total", B4XTable1.COLUMN_TYPE_TEXT)
B4XTable1.SetData(myList)
End If
Catch
'Log("Error")
MsgboxAsync("Error on connection","System admin")
ProgressDialogHide
End Try
ProgressDialogHide
B4XTable1.Refresh
j.Release
End Sub