2019-02-27 19:49:25 -05:00
|
|
|
Option Explicit
|
|
|
|
|
|
|
|
Public sql As String
|
|
|
|
Public jsql As String
|
|
|
|
Public scenario As String
|
|
|
|
Public sc() As Variant
|
|
|
|
Public x As New TheBigOne
|
|
|
|
Public wapi As New Windows_API
|
|
|
|
|
|
|
|
|
|
|
|
Sub load_fpvt()
|
|
|
|
|
|
|
|
Call wapi.ClipBoard_SetData(sql)
|
|
|
|
|
|
|
|
fpvt.Show
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
End Sub
|
|
|
|
|
|
|
|
|
|
|
|
Sub pull_months(doc As String)
|
|
|
|
|
|
|
|
Dim req As New WinHttp.WinHttpRequest
|
|
|
|
Dim wapi As New Windows_API
|
|
|
|
Dim wr As String
|
|
|
|
Dim json As Object
|
|
|
|
Dim i As Long
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
With req
|
|
|
|
'.Open "GET", "http://10.56.1.108:3000/monthly_orders", True
|
|
|
|
.Open "GET", "http://192.168.1.69:3000/monthly_orders", True
|
|
|
|
.SetRequestHeader "Content-Type", "application/json"
|
|
|
|
.Send doc
|
|
|
|
.WaitForResponse
|
|
|
|
wr = .ResponseText
|
|
|
|
End With
|
|
|
|
|
|
|
|
Call wapi.ClipBoard_SetData(wr)
|
|
|
|
|
|
|
|
'MsgBox (wr)
|
|
|
|
|
|
|
|
On Error GoTo jerr
|
|
|
|
|
|
|
|
Set json = JsonConverter.ParseJson(wr)
|
|
|
|
|
|
|
|
jerr:
|
|
|
|
If Err.Number <> 0 Then
|
|
|
|
MsgBox ("function call error:" & vbCrLf & wr)
|
|
|
|
Exit Sub
|
|
|
|
End If
|
|
|
|
|
|
|
|
On Error GoTo errh
|
|
|
|
|
|
|
|
Sheets("test").range("A2:D1000").ClearContents
|
|
|
|
Sheets("test").range("N3:Q14").ClearContents
|
|
|
|
|
|
|
|
For i = 1 To json("jsonb_agg").Count
|
|
|
|
Sheets("test").Cells(i + 1, 1) = json("jsonb_agg")(i)("oseas")
|
|
|
|
Sheets("test").Cells(i + 1, 2) = json("jsonb_agg")(i)("monthn")
|
|
|
|
Sheets("test").Cells(i + 1, 3) = json("jsonb_agg")(i)("qty")
|
|
|
|
Sheets("test").Cells(i + 1, 4) = json("jsonb_agg")(i)("sales")
|
|
|
|
Next i
|
|
|
|
|
|
|
|
Sheets("test").Select
|
|
|
|
|
|
|
|
errh:
|
|
|
|
If Err.Number <> 0 Then
|
|
|
|
MsgBox (Err.Description)
|
|
|
|
End If
|
|
|
|
|
|
|
|
End Sub
|
|
|
|
|
|
|
|
Sub pg_main_workset()
|
|
|
|
|
|
|
|
Dim req As New WinHttp.WinHttpRequest
|
|
|
|
Dim wapi As New Windows_API
|
|
|
|
Dim wr As String
|
|
|
|
Dim json As Object
|
|
|
|
Dim i As Long
|
2019-02-27 20:34:59 -05:00
|
|
|
Dim j As Long
|
2019-02-27 19:49:25 -05:00
|
|
|
Dim doc As String
|
2019-02-27 20:34:59 -05:00
|
|
|
Dim res() As Variant
|
2019-02-27 22:13:38 -05:00
|
|
|
Dim str() As String
|
2019-02-27 19:49:25 -05:00
|
|
|
|
2019-02-27 20:34:59 -05:00
|
|
|
doc = "{""quota_rep"":""13025 - JAMES REGER""}"
|
2019-02-27 19:49:25 -05:00
|
|
|
|
|
|
|
With req
|
|
|
|
'.Open "GET", "http://10.56.1.15:3000/get_pool", True
|
|
|
|
.Open "GET", "http://192.168.1.69:3000/get_pool", True
|
|
|
|
.SetRequestHeader "Content-Type", "application/json"
|
|
|
|
.Send doc
|
|
|
|
.WaitForResponse
|
|
|
|
wr = .ResponseText
|
|
|
|
End With
|
|
|
|
|
|
|
|
Set json = JsonConverter.ParseJson(wr)
|
2019-02-27 20:34:59 -05:00
|
|
|
ReDim res(json("x").Count, 32)
|
2019-02-27 19:49:25 -05:00
|
|
|
|
2019-02-27 22:13:38 -05:00
|
|
|
For i = 0 To UBound(res, 1) - 1
|
2019-02-27 20:34:59 -05:00
|
|
|
res(i, 0) = json("x")(i + 1)("bill_cust_descr")
|
|
|
|
res(i, 1) = json("x")(i + 1)("billto_group")
|
|
|
|
res(i, 2) = json("x")(i + 1)("ship_cust_descr")
|
|
|
|
res(i, 3) = json("x")(i + 1)("shipto_group")
|
|
|
|
res(i, 4) = json("x")(i + 1)("quota_rep_descr")
|
|
|
|
res(i, 5) = json("x")(i + 1)("director_descr")
|
|
|
|
res(i, 6) = json("x")(i + 1)("segm")
|
|
|
|
res(i, 7) = json("x")(i + 1)("mod_chan")
|
|
|
|
res(i, 8) = json("x")(i + 1)("mod_chansub")
|
|
|
|
res(i, 9) = json("x")(i + 1)("majg_descr")
|
|
|
|
res(i, 10) = json("x")(i + 1)("ming_descr")
|
|
|
|
res(i, 11) = json("x")(i + 1)("majs_descr")
|
|
|
|
res(i, 12) = json("x")(i + 1)("mins_descr")
|
|
|
|
res(i, 13) = json("x")(i + 1)("brand")
|
|
|
|
res(i, 14) = json("x")(i + 1)("part_family")
|
|
|
|
res(i, 15) = json("x")(i + 1)("part_group")
|
|
|
|
res(i, 16) = json("x")(i + 1)("branding")
|
|
|
|
res(i, 17) = json("x")(i + 1)("color")
|
|
|
|
res(i, 18) = json("x")(i + 1)("part_descr")
|
|
|
|
res(i, 19) = json("x")(i + 1)("order_season")
|
|
|
|
res(i, 20) = json("x")(i + 1)("order_month")
|
|
|
|
res(i, 21) = json("x")(i + 1)("ship_season")
|
|
|
|
res(i, 22) = json("x")(i + 1)("ship_month")
|
|
|
|
res(i, 23) = json("x")(i + 1)("request_season")
|
|
|
|
res(i, 24) = json("x")(i + 1)("request_month")
|
|
|
|
res(i, 25) = json("x")(i + 1)("promo")
|
|
|
|
res(i, 26) = json("x")(i + 1)("version")
|
|
|
|
res(i, 27) = json("x")(i + 1)("iter")
|
|
|
|
res(i, 28) = json("x")(i + 1)("value_loc")
|
|
|
|
res(i, 29) = json("x")(i + 1)("value_usd")
|
|
|
|
res(i, 30) = json("x")(i + 1)("cost_loc")
|
|
|
|
res(i, 31) = json("x")(i + 1)("cust_usd")
|
|
|
|
res(i, 32) = json("x")(i + 1)("units")
|
|
|
|
Next i
|
|
|
|
|
|
|
|
Set json = Nothing
|
2019-02-27 19:49:25 -05:00
|
|
|
|
2019-02-27 22:13:38 -05:00
|
|
|
ReDim str(UBound(res, 1), UBound(res, 2))
|
2019-02-27 20:34:59 -05:00
|
|
|
|
2019-02-27 22:13:38 -05:00
|
|
|
For i = 0 To UBound(res, 1)
|
|
|
|
For j = 0 To UBound(res, 2)
|
|
|
|
If IsNull(res(i, j)) Then
|
|
|
|
str(i, j) = ""
|
|
|
|
Else
|
|
|
|
str(i, j) = res(i, j)
|
|
|
|
End If
|
|
|
|
Next j
|
|
|
|
Next i
|
|
|
|
|
|
|
|
Call x.SHTp_Dump(str, "Sheet1", 1, 1, True, False)
|
2019-02-27 19:49:25 -05:00
|
|
|
|
2019-02-27 22:13:38 -05:00
|
|
|
End Sub
|