From 3b3785dbd8d4249cd1755890a2e95172000bb97c Mon Sep 17 00:00:00 2001 From: Trowbridge Date: Fri, 14 Feb 2020 17:24:02 -0500 Subject: [PATCH] add undo and comments --- build.frx | Bin 3096 -> 3096 bytes changes.frm | 23 ++++++ changes.frx | Bin 3096 -> 3096 bytes fpvt.frm | 9 ++- fpvt.frx | Bin 20504 -> 20504 bytes handler.bas | 225 +++++++++++++++++++++++++++++++++------------------- openf.frx | Bin 3096 -> 3096 bytes part.frx | Bin 2584 -> 2584 bytes 8 files changed, 173 insertions(+), 84 deletions(-) diff --git a/build.frx b/build.frx index 2207528d743f87970b50c0ee4415cd9613c7cbb2..2a443311cb38c6d7458b26dfa6d244a7915bcfd0 100644 GIT binary patch delta 25 gcmbOsF+*ZQ3kz$5kpy4s=1vwCHpcwTeOz6P0B0%(ivR!s delta 25 gcmbOsF+*ZQ3kxg5)k-Fg&7CYPY>W(>`?$Io0c7q67XSbN diff --git a/changes.frm b/changes.frm index 685584c..7ff6d61 100644 --- a/changes.frm +++ b/changes.frm @@ -21,6 +21,29 @@ Private Sub cbCancel_Click() End Sub +Private Sub cbUndo_Click() + + Dim logid As Integer + Dim i As Integer + Dim fail As Boolean + + For i = 0 To Me.lbHist.ListCount - 1 + If Me.lbHist.Selected(i) Then + Call handler.undo_changes(x(i, 5), fail) + If fail Then + MsgBox ("undo did not work") + Exit Sub + End If + End If + Next i + + Sheets("Orders").PivotTables("PivotTable1").PivotCache.Refresh + + Me.Hide + + +End Sub + Private Sub lbHist_Change() Dim i As Integer diff --git a/changes.frx b/changes.frx index beb8312bfa16b58aef2057d95a9976f4d89c0957..47976450b69cc50f66b75a482df6ed5404a46f67 100644 GIT binary patch delta 32 mcmbOsF+*ZQ3k&OktSrIS&7CYSnHd>27jw8V0;ye`aZCWZa0)>H delta 32 ocmbOsF+*ZQ3k$0O-&Yon&7CYSnHdu|7jw8VGP-Qu#Tmy00IW_4`v3p{ diff --git a/fpvt.frm b/fpvt.frm index 3e5ac49..448c0b0 100644 --- a/fpvt.frm +++ b/fpvt.frm @@ -67,9 +67,10 @@ Private Sub butAdjust_Click() Dim fail As Boolean - Dim com As String - - com = InputBox("Enter any comments to describe the change") + If adjust("source") = "" Then + MsgBox ("No adjustments provided") + Exit Sub + End If Call handler.request_adjust(JsonConverter.ConvertToJson(adjust), fail) If fail Then @@ -77,6 +78,8 @@ Private Sub butAdjust_Click() Exit Sub End If + Me.tbCOM = "" + Me.Hide Set adjust = Nothing diff --git a/fpvt.frx b/fpvt.frx index e157912a7e9a013b5062b0922f1035841f3238da..603b40f2047a56b7838d78347e66754eeac09e89 100644 GIT binary patch delta 1250 zcmZ8gUrbw77(eIS0=uQOl(3e6gZ46;wm>Zf=@m+8i*~G|6q03EXwneweb_oGc{VuWBo=%55Md{+U%!_S*S zC*SV~UV%r#ZdehSi8S)_{gb#C^I*eJscji{)0)~Bwv8*dzM&LeqkdeaCe zHbgXO$FBk!OxcP^{FZSA1=A^NhqdPJe~BAE+%&FeqIp4h974gmP*ZYp_L7BISB7YX zx-$amjVGyyqOA!Z+19PRM$*ZbiLVB}M9kZrQn;mx%TDHVi<#`P77IU*tGVgf+>B#5 zqvU4P1)_ay|D2UwSZFG{5Mpx~q7|C&|NjcbPq`Qrc9jJ|Y%N2yLhIX9EWOcZgj|Ei zk)rK5=GbR(5(5!P6&Y7%)Ie_#Upao$J9pI?rb$#wtrZF(UlaT#H=>xZVp6)KyU(Ti zsEj@BA*>l}SZxpR?p%=yu^w7Gpf{A_ruAAG^kS^eoBNBNNs@ z+{$TSxoe$1qCdCwuLR0a<;M`jmhWe9Ojb=eGWI169RGQnqIHUej+_24dcdGEt3`89g7JQ4<_MHP1!Q! rUul(GT6FrwrG-V#u$_`@O7>CLu#!uw*?(N9jF@*ck1ThJE<*kW7FL}h delta 1262 zcmZWpZA@Eb6n@|L7S=)wbZhw-$ohe#Em*k)TVSOvWhoz{fSJK1#>7%?C|W4kVfK+N zRimc8o=hp74bGu+TaVs)1o`xk}Q{=$hsId0fxo)7xAWCrtcnqb}oA;so>|~MhrMRxD~59D;AtST7Bb; zi4LY(8X9$iLV_-j=29*XPXaENlx7T@?KQaWS}qxjB}WtKIYn;4N%ycw&!Ml?gHL^B zYPH9%(?$myd!LpPnKVX%cC2~dAcDb1f2Xz(ZkgnoEDy~<5!PGINmLCR?s_cB6@oH8 zl)EL?!?4mB!eVa&jz-Gy;^4zrj_eYxew>$`+>g(Eeo3L=dG|g9TMgyUPbNpm6kDTh zG?TUxZbw&N9dYQf(3&B7L)$wvxwep1U28kcrLlMnD`6j%+A4TO-a~BT#MTRYz(vW` zSO_Hf6#fl3gyMz0eUvBF!|lhnayR69P3%>fbdyNZUMQ91E!Zj*<{5Z>t#_qc2!Ctu zfwEMF&s@Q{tV2G4n4cKufSjw4N)V0WoOFb95 z$+vfcZ{h>lh2J7KrMCC2I2E_x*Y0j9rP%ODw29g^4_Po3jcPl-N&v%8(QgYWMZrO0Y8M#dNTVA}df6 zf08FK8z0b=uEigh-lKnsdFbUG>=Vb`k|Ep}st}0`ZVg2Xv(+*@rp;!B(@%e->yALB Vp9bE-IA=K;JyzS7Yc@18_8+%7i#Y%Q diff --git a/handler.bas b/handler.bas index 82437d8..e3be28c 100644 --- a/handler.bas +++ b/handler.bas @@ -98,6 +98,10 @@ Sub pg_main_workset(rep As String) wr = .ResponseText End With + If Mid(wr, 1, 1) <> "{" Then + MsgBox (wr) + Exit Sub + End If Set json = JsonConverter.ParseJson(wr) ReDim res(json("x").Count, 32) @@ -107,34 +111,34 @@ Sub pg_main_workset(rep As String) res(i, 2) = json("x")(i)("ship_cust_descr") res(i, 3) = json("x")(i)("shipto_group") res(i, 4) = json("x")(i)("quota_rep_descr") - res(i, 5) = json("x")(i)("director_descr") + res(i, 5) = json("x")(i)("director") res(i, 6) = json("x")(i)("segm") - res(i, 7) = json("x")(i)("mod_chan") - res(i, 8) = json("x")(i)("mod_chansub") - res(i, 9) = json("x")(i)("majg_descr") - res(i, 10) = json("x")(i)("ming_descr") - res(i, 11) = json("x")(i)("majs_descr") - res(i, 12) = json("x")(i)("mins_descr") - res(i, 13) = json("x")(i)("brand") - res(i, 14) = json("x")(i)("part_family") - res(i, 15) = json("x")(i)("part_group") - res(i, 16) = json("x")(i)("branding") - res(i, 17) = json("x")(i)("color") - res(i, 18) = json("x")(i)("part_descr") - res(i, 19) = json("x")(i)("order_season") - res(i, 20) = json("x")(i)("order_month") - res(i, 21) = json("x")(i)("ship_season") - res(i, 22) = json("x")(i)("ship_month") - res(i, 23) = json("x")(i)("request_season") - res(i, 24) = json("x")(i)("request_month") - res(i, 25) = json("x")(i)("promo") - res(i, 26) = json("x")(i)("version") - res(i, 27) = json("x")(i)("iter") - res(i, 28) = json("x")(i)("value_loc") - res(i, 29) = json("x")(i)("value_usd") - res(i, 30) = json("x")(i)("cost_loc") - res(i, 31) = json("x")(i)("cost_usd") - res(i, 32) = json("x")(i)("units") + res(i, 7) = json("x")(i)("chan") + res(i, 8) = json("x")(i)("chansub") + res(i, 9) = json("x")(i)("part_descr") + res(i, 10) = json("x")(i)("part_group") + res(i, 11) = json("x")(i)("branding") + res(i, 12) = json("x")(i)("majg_descr") + res(i, 13) = json("x")(i)("ming_descr") + res(i, 14) = json("x")(i)("majs_descr") + res(i, 15) = json("x")(i)("mins_descr") + res(i, 16) = json("x")(i)("order_season") + res(i, 17) = json("x")(i)("order_month") + res(i, 18) = json("x")(i)("ship_season") + res(i, 19) = json("x")(i)("ship_month") + res(i, 20) = json("x")(i)("request_season") + res(i, 21) = json("x")(i)("request_month") + res(i, 22) = json("x")(i)("promo") + res(i, 23) = json("x")(i)("value_loc") + res(i, 24) = json("x")(i)("value_usd") + res(i, 25) = json("x")(i)("cost_loc") + res(i, 26) = json("x")(i)("cost_usd") + res(i, 27) = json("x")(i)("units") + res(i, 28) = json("x")(i)("version") + res(i, 29) = json("x")(i)("iter") + res(i, 30) = json("x")(i)("logid") + res(i, 31) = json("x")(i)("comment") + res(i, 32) = json("x")(i)("module") Next i res(0, 0) = "bill_cust_descr" @@ -142,34 +146,34 @@ Sub pg_main_workset(rep As String) res(0, 2) = "ship_cust_descr" res(0, 3) = "shipto_group" res(0, 4) = "quota_rep_descr" - res(0, 5) = "director_descr" + res(0, 5) = "director" res(0, 6) = "segm" - res(0, 7) = "mod_chan" - res(0, 8) = "mod_chansub" - res(0, 9) = "majg_descr" - res(0, 10) = "ming_descr" - res(0, 11) = "majs_descr" - res(0, 12) = "mins_descr" - res(0, 13) = "brand" - res(0, 14) = "part_family" - res(0, 15) = "part_group" - res(0, 16) = "branding" - res(0, 17) = "color" - res(0, 18) = "part_descr" - res(0, 19) = "order_season" - res(0, 20) = "order_month" - res(0, 21) = "ship_season" - res(0, 22) = "ship_month" - res(0, 23) = "request_season" - res(0, 24) = "request_month" - res(0, 25) = "promo" - res(0, 26) = "version" - res(0, 27) = "iter" - res(0, 28) = "value_loc" - res(0, 29) = "value_usd" - res(0, 30) = "cost_loc" - res(0, 31) = "cost_usd" - res(0, 32) = "units" + res(0, 7) = "chan" + res(0, 8) = "chansub" + res(0, 9) = "part_descr" + res(0, 10) = "part_group" + res(0, 11) = "branding" + res(0, 12) = "majg_descr" + res(0, 13) = "ming_descr" + res(0, 14) = "majs_descr" + res(0, 15) = "mins_descr" + res(0, 16) = "order_season" + res(0, 17) = "order_month" + res(0, 18) = "ship_season" + res(0, 19) = "ship_month" + res(0, 20) = "request_season" + res(0, 21) = "request_month" + res(0, 22) = "promo" + res(0, 23) = "value_loc" + res(0, 24) = "value_usd" + res(0, 25) = "cost_loc" + res(0, 26) = "cost_usd" + res(0, 27) = "units" + res(0, 28) = "version" + res(0, 29) = "iter" + res(0, 30) = "logid" + res(0, 31) = "comment" + res(0, 32) = "module" Set json = Nothing @@ -253,34 +257,34 @@ Function request_adjust(doc As String, ByRef fail As Boolean) As Object res(i - 1, 2) = json("x")(i)("ship_cust_descr") res(i - 1, 3) = json("x")(i)("shipto_group") res(i - 1, 4) = json("x")(i)("quota_rep_descr") - res(i - 1, 5) = json("x")(i)("director_descr") + res(i - 1, 5) = json("x")(i)("director") res(i - 1, 6) = json("x")(i)("segm") - res(i - 1, 7) = json("x")(i)("mod_chan") - res(i - 1, 8) = json("x")(i)("mod_chansub") - res(i - 1, 9) = json("x")(i)("majg_descr") - res(i - 1, 10) = json("x")(i)("ming_descr") - res(i - 1, 11) = json("x")(i)("majs_descr") - res(i - 1, 12) = json("x")(i)("mins_descr") - res(i - 1, 13) = json("x")(i)("brand") - res(i - 1, 14) = json("x")(i)("part_family") - res(i - 1, 15) = json("x")(i)("part_group") - res(i - 1, 16) = json("x")(i)("branding") - res(i - 1, 17) = json("x")(i)("color") - res(i - 1, 18) = json("x")(i)("part_descr") - res(i - 1, 19) = json("x")(i)("order_season") - res(i - 1, 20) = json("x")(i)("order_month") - res(i - 1, 21) = json("x")(i)("ship_season") - res(i - 1, 22) = json("x")(i)("ship_month") - res(i - 1, 23) = json("x")(i)("request_season") - res(i - 1, 24) = json("x")(i)("request_month") - res(i - 1, 25) = json("x")(i)("promo") - res(i - 1, 26) = json("x")(i)("version") - res(i - 1, 27) = json("x")(i)("iter") - res(i - 1, 28) = json("x")(i)("value_loc") - res(i - 1, 29) = json("x")(i)("value_usd") - res(i - 1, 30) = json("x")(i)("cost_loc") - res(i - 1, 31) = json("x")(i)("cost_usd") - res(i - 1, 32) = json("x")(i)("units") + res(i - 1, 7) = json("x")(i)("chan") + res(i - 1, 8) = json("x")(i)("chansub") + res(i - 1, 9) = json("x")(i)("part_descr") + res(i - 1, 10) = json("x")(i)("part_group") + res(i - 1, 11) = json("x")(i)("branding") + res(i - 1, 12) = json("x")(i)("majg_descr") + res(i - 1, 13) = json("x")(i)("ming_descr") + res(i - 1, 14) = json("x")(i)("majs_descr") + res(i - 1, 15) = json("x")(i)("mins_descr") + res(i - 1, 16) = json("x")(i)("order_season") + res(i - 1, 17) = json("x")(i)("order_month") + res(i - 1, 18) = json("x")(i)("ship_season") + res(i - 1, 19) = json("x")(i)("ship_month") + res(i - 1, 20) = json("x")(i)("request_season") + res(i - 1, 21) = json("x")(i)("request_month") + res(i - 1, 22) = json("x")(i)("promo") + res(i - 1, 23) = json("x")(i)("value_loc") + res(i - 1, 24) = json("x")(i)("value_usd") + res(i - 1, 25) = json("x")(i)("cost_loc") + res(i - 1, 26) = json("x")(i)("cost_usd") + res(i - 1, 27) = json("x")(i)("units") + res(i - 1, 28) = json("x")(i)("version") + res(i - 1, 29) = json("x")(i)("iter") + res(i - 1, 30) = json("x")(i)("logid") + res(i - 1, 31) = json("x")(i)("comment") + res(i - 1, 32) = json("x")(i)("module") Next i Set json = Nothing @@ -517,6 +521,65 @@ Function list_changes(doc As String, ByRef fail As Boolean) As Variant() End Function +Function undo_changes(ByVal logid As Integer, ByRef fail As Boolean) As Variant() + + Dim req As New WinHttp.WinHttpRequest + Dim json As Object + Dim wr As String + Dim i As Integer + Dim j As Integer + Dim res() As Variant + Dim doc As String + Dim ds As Worksheet + + doc = "{""logid"":" & logid & "}" + + server = handler.server + + With req + .Option(WinHttpRequestOption_SslErrorIgnoreFlags) = SslErrorFlag_Ignore_All + .Open "GET", server & "/undo_change", True + .SetRequestHeader "Content-Type", "application/json" + .Send doc + .WaitForResponse + wr = .ResponseText + End With + + Set json = JsonConverter.ParseJson(wr) + logid = json("x")(1)("id") + + '---------loop through and get a list of each row that needs deleted?----- + + Set ds = Sheets("data") + + j = 0 + For i = 1 To 100 + If ds.Cells(1, i) = "logid" Then + j = i + Exit For + End If + Next i + + If j = 0 Then + MsgBox ("current data set is not tracking changes, cannot isolate change locally") + fail = True + Exit Function + End If + + i = 2 + While ds.Cells(i, 1) <> "" + If ds.Cells(i, j) = logid Then + ds.Rows(i).Delete + Else + i = i + 1 + End If + Wend + + + +End Function + + Sub history() changes.Show diff --git a/openf.frx b/openf.frx index 36b3bdf4630528fcf5cc6619d6befa832052b2e6..047e2646ccb06bdf972fd80b27c0cdf23b403e42 100644 GIT binary patch delta 31 ncmbOsF+*ZQ3k&OpEMbw>&7CYSnHiHO7jyJ8GHhn%6lDegtH%jx delta 31 ncmbOsF+*ZQ3kz$2+e}`L&7CYSnHd=-7jyJ8x@>0V6lDego-PQ; diff --git a/part.frx b/part.frx index 4b333eb3d04f925e316d6cd181c0b19d6f4a4230..87a61818e5d19f3236da98848161fea72a86cb19 100644 GIT binary patch delta 31 ncmbOsGDBoT3k$13-*K_l&7CYSnHj?-7jr~2GHgE2;mHU9vbqX) delta 31 ncmbOsGDBoT3k&N6zvn_6n>$%vGBY|&F6M}4blH5K!;=vJuZs$1