Private Sub LoadProgressUpdate(FY As String)
Dim job As HttpJob
Dim xml As String = File.ReadString(File.DirAssets,"get_progress_update.xml")
xml = xml.Replace("$query$",FY)
job.Initialize("MyJob",Me)
job.PostString(API,xml)
job.GetRequest.SetHeader("SOAPAction", $""http://tempuri.org/IServiceReport/get_progress_update""$)
job.GetRequest.SetHeader("User-Agent", "Apache-HttpClient/4.5.2 (Java/1.8.0_181)")
job.GetRequest.SetContentType("text/xml; charset=utf-8")
ProgressDialogShow2("Retreving Physical Progress data...",False)
Wait For (job) JobDone (j As HttpJob)
ProgressDialogHide
If j.Success Then
Dim response As String = j.GetString
Dim JsonOut As String = Generic.xmlGetTagContent(response,"get_progress_updateResult")
'Log(JsonOut)
JsonOut = JsonOut.Replace("
","")
Dim Json As JSONParser
Json.Initialize(JsonOut)
Dim mylist As List
mylist.Initialize
mylist = Json.NextArray
Dim dt As List
dt.Initialize
Dim totalNew As Int, totalCO As Int, totalCCA As Double, _
totalDetailedSurvey As Int, totalPPRCompleted As Int, _
totalPPROngoing As Int, totalPPRAgreement As Int, _
totalConstructionStarted As Int, _
totalProjectCompleted As Int, totalachievedCCA As Double, Totalprogress As Double, TotalTarget As Int
'For i = 0 To mylist.Size -1
Dim index As Int
For Each m As Map In mylist
index = ShowProgress(progressbar_op)
Sleep(50)
Dim new As Int = m.Get("no_is_new")
Dim co As Int = m.Get("no_carried")
Dim total As Int = new + co
dt.Add(Array(m.Get("districtname"),total,m.Get("no_is_new"),m.Get("no_carried"),Round2(m.Get("tot_cca"),0), _
m.Get("no_detailed_survey"),m.Get("no_ppr_completed"),m.Get("no_ppr_ongoing"), _
m.Get("no_ppr_agreement"),m.Get("no_construction_started"),Round2(m.Get("avg_const_progress"),2), _
m.Get("no_project_completed"),Round2(m.Get("achieved_cca"),0)))
totalNew = totalNew + m.Get("no_is_new")
totalCO = totalCO + m.Get("no_carried")
totalCCA = totalCCA + m.Get("tot_cca")
totalDetailedSurvey = totalDetailedSurvey + m.Get("no_detailed_survey")
totalPPRCompleted= totalPPRCompleted + m.Get("no_ppr_completed")
totalPPROngoing = totalPPROngoing + m.Get("no_ppr_ongoing")
totalPPRAgreement = totalPPRAgreement + m.Get("no_ppr_agreement")
totalConstructionStarted = totalConstructionStarted + m.Get("no_construction_started")
totalProjectCompleted = totalProjectCompleted + m.Get("no_project_completed")
totalachievedCCA = totalachievedCCA + m.Get("achieved_cca")
Totalprogress = Totalprogress + m.Get("avg_const_progress")
TotalTarget = TotalTarget + total
Next
dt.Add(Array("Total",TotalTarget,totalNew,totalCO,Round2(totalCCA,0),totalDetailedSurvey,totalPPRCompleted,totalPPROngoing,totalPPRAgreement,totalConstructionStarted,Round2(Totalprogress/8,2),totalProjectCompleted,Round2(totalachievedCCA,0)))
dgv.SetData(dt)
'cell alignment
SetCellAlignment_OP
'xui.MsgboxAsync(xmlGetTagContent(response,"ReadTableSQLResult"),"B4x")
HideProgress(progressbar_op, index)
Else
ToastMessageShow("No Respone. Please check your Internet Connection",True)
'xui.MsgboxAsync(j.ErrorMessage,"B4x")
End If
j.Release
End Sub