hide when loading, reset adjust boxes, allow backspace to clear value

This commit is contained in:
Paul Trowbridge 2019-03-21 17:43:15 -04:00
parent 513e6e91b7
commit 7d0ff997c1
2 changed files with 35 additions and 13 deletions

View File

@ -4,7 +4,7 @@ Begin {C62A69F0-16DC-11CE-9E98-00AA00574A4F} fpvt
ClientHeight = 7260 ClientHeight = 7260
ClientLeft = 120 ClientLeft = 120
ClientTop = 465 ClientTop = 465
ClientWidth = 17475 ClientWidth = 7215
OleObjectBlob = "fpvt.frx":0000 OleObjectBlob = "fpvt.frx":0000
StartUpPosition = 1 'CenterOwner StartUpPosition = 1 'CenterOwner
End End
@ -65,7 +65,13 @@ End Sub
Private Sub butAdjust_Click() Private Sub butAdjust_Click()
Call handler.request_adjust(JsonConverter.ConvertToJson(adjust)) Dim fail As Boolean
Call handler.request_adjust(JsonConverter.ConvertToJson(adjust), fail)
If fail Then
MsgBox ("adjustment was not made due to error")
Exit Sub
End If
Me.Hide Me.Hide
@ -291,6 +297,8 @@ Private Sub UserForm_Activate()
Dim j As Long Dim j As Long
Dim k As Long Dim k As Long
Dim ok As Boolean Dim ok As Boolean
Me.mp.Visible = False
Set sp = handler.scenario_package("{""scenario"":" & scenario & "}", ok) Set sp = handler.scenario_package("{""scenario"":" & scenario & "}", ok)
@ -307,6 +315,9 @@ Private Sub UserForm_Activate()
pVal = 0 pVal = 0
bVol = 0 bVol = 0
bVal = 0 bVal = 0
aVol = 0
aVal = 0
aPrc = 0
For i = 1 To sp("package")("totals").Count For i = 1 To sp("package")("totals").Count
Select Case sp("package")("totals")(i)("order_season") Select Case sp("package")("totals")(i)("order_season")
@ -413,6 +424,9 @@ Private Sub UserForm_Activate()
Call handler.month_tosheet(month, basket) Call handler.month_tosheet(month, basket)
Application.StatusBar = False Application.StatusBar = False
Me.mp.Visible = True
End Sub End Sub
Sub crunch_array() Sub crunch_array()
@ -518,20 +532,20 @@ Sub load_mbox_ann()
load_tb = True load_tb = True
tbBaseVol = Format(bVol, "#,###") tbBaseVol = Format(bVol, "#,##0")
tbBaseVal = Format(bVal, "#,###") tbBaseVal = Format(bVal, "#,##0")
tbBasePrice = Format(bPrc, "0.000") tbBasePrice = Format(bPrc, "0.000")
tbPadjVol = Format(pVol, "#,###") tbPadjVol = Format(pVol, "#,##0")
tbPadjVal = Format(pVal, "#,###") tbPadjVal = Format(pVal, "#,##0")
tbPadjPrice = Format(pPrc, "0.000") tbPadjPrice = Format(pPrc, "0.000")
tbFcVol = Format(fVol, "#,###") tbFcVol = Format(fVol, "#,##0")
tbFcVal = Format(fVal, "#,###") tbFcVal = Format(fVal, "#,##0")
If Not set_Price Then tbFcPrice = Format(fPrc, "0.###") If Not set_Price Then tbFcPrice = Format(fPrc, "0.000")
tbAdjVol = Format(aVol, "#,###") tbAdjVol = Format(aVol, "#,##0")
tbAdjVal = Format(aVal, "#,###") tbAdjVal = Format(aVal, "#,##0")
tbAdjPrice = Format(aPrc, "0.000") tbAdjPrice = Format(aPrc, "0.000")
load_tb = False load_tb = False
@ -579,7 +593,11 @@ Sub calc_val()
'---------if volume adjustment method is selected, scale the volume up---------------------------------- '---------if volume adjustment method is selected, scale the volume up----------------------------------
If opPlugVol Then If opPlugVol Then
pchange = fVal / (pVal + bVal) If (pVal + bVal) = 0 Then
pchange = 0
Else
pchange = fVal / (pVal + bVal)
End If
fVol = (pVol + bVol) * pchange fVol = (pVol + bVol) * pchange
Else Else
fVol = pVol + bVol fVol = pVol + bVol
@ -596,7 +614,7 @@ Sub calc_val()
aPrc = 0 aPrc = 0
End If End If
tbFcVal = Format(tbFcVal, "#,###") tbFcVal = Format(co_num(tbFcVal, 0), "#,##0")
Me.load_mbox_ann Me.load_mbox_ann
@ -859,4 +877,8 @@ Function iter_def(ByVal iter As String) As String
End Function End Function
Sub new_part()
End Sub

BIN
fpvt.frx

Binary file not shown.