Public Sub Initialize (labelTemp As Label)
labelLocal=labelTemp
End Sub
Public Sub downloadInfo '< I call this one on Activity Create
Log("class:downloadinfo")
ProgressDialogShow("Obteniendo Suma..")
remoteQuery("SELECT SUM(monto) AS TotalesF FROM gastoscash", "sumcash")
End Sub
Private Sub remoteQuery(query As String, nombreJob As String)
Log("class:remoteQuery")
Dim job As HttpJob
job.Initialize(nombreJob,Me )
job.PostString("http://localhost:8080/gastosxampp/operaciones.php", query)
End Sub
Sub JobDone(Job As HttpJob)
Log("class:JobDone("&Job.GetString&")")
ProgressDialogHide
If Job.Success Then
Dim res As String
res=Job.GetString
Log("Server response: " & res)
Dim parser As JSONParser
parser.Initialize(res)
Select Job.JobName
Case "sumarcash"
Dim l As List
l= parser.NextArray
If l.Size = 0 Then
lblTotaC.Text="SIN DATOS"
Else
Dim m As Map
m= l.Get(0)
lblTotaC.Text= m.Get("TotalesC")
End If
End Select
Else
ToastMessageShow("Error: " & Job.ErrorMessage,True)
End If
Job.Release
End Sub