forecast_api/Master Template.xlsm_EXPORTS/changes.frm
PhilRunninger 2454393a1d DRY up the WinHttpRequest calls. One sub now does it all.
Instead of having multiple locations with the same code, the web
interface code now lives in its own module, and is called from multiple
locations.
2024-03-20 17:21:08 -04:00

76 lines
1.9 KiB
Plaintext

VERSION 5.00
Begin {C62A69F0-16DC-11CE-9E98-00AA00574A4F} changes
Caption = "History"
ClientHeight = 7815
ClientLeft = 120
ClientTop = 465
ClientWidth = 16710
OleObjectBlob = "changes.frx":0000
StartUpPosition = 1 'CenterOwner
End
Attribute VB_Name = "changes"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private X As Variant
Private Sub UserForm_Activate()
tbPrint.Value = ""
Dim errorMsg As String
X = handler.list_changes("{""scenario"":{""quota_rep_descr"":""" & shData.Cells(2, 5) & """}}", errorMsg)
If errorMsg <> "" Then
Unload Me
MsgBox "No adjustments have been made.", vbOKOnly + vbExclamation, errorMsg
End
End If
Me.lbHist.list = X
Call Utils.frmListBoxHeader(Me.lbHEAD, Me.lbHist, "Modifier", "Owner", "When", "Tag", "Comment", "Sales", "id")
End Sub
Private Sub cbCancel_Click()
Me.Hide
End Sub
Private Sub cbUndo_Click()
Call Me.delete_selected
End Sub
Private Sub lbHist_Change()
Dim i As Integer
For i = 0 To Me.lbHist.ListCount - 1
If Me.lbHist.Selected(i) Then
Me.tbPrint.Value = X(i, 7)
Exit Sub
End If
Next i
End Sub
Sub delete_selected()
Dim logid As Integer
Dim i As Integer
Dim errorMsg As String
Dim proceed As Boolean
If MsgBox("Permanently delete these changes?", vbYesNo) = vbNo Then
Exit Sub
End If
For i = 0 To Me.lbHist.ListCount - 1
If Me.lbHist.Selected(i) Then
handler.undo_changes X(i, 6), errorMsg
If errorMsg <> "" Then
MsgBox errorMsg, vbOKOnly + vbCritical, "Undo did not work."
Exit Sub
End If
End If
Next i
shOrders.PivotTables("ptOrders").PivotCache.Refresh
Me.lbHist.clear
Me.Hide
End Sub