update changes
This commit is contained in:
parent
5a2dfcdf27
commit
878e691a55
114
fpvt.frm
114
fpvt.frm
@ -1,10 +1,10 @@
|
||||
VERSION 5.00
|
||||
Begin {C62A69F0-16DC-11CE-9E98-00AA00574A4F} fpvt
|
||||
Caption = "UserForm1"
|
||||
ClientHeight = 6780
|
||||
Caption = "Forecast Adjustment"
|
||||
ClientHeight = 7275
|
||||
ClientLeft = 120
|
||||
ClientTop = 465
|
||||
ClientWidth = 12735
|
||||
ClientWidth = 13695
|
||||
OleObjectBlob = "fpvt.frx":0000
|
||||
StartUpPosition = 1 'CenterOwner
|
||||
End
|
||||
@ -18,12 +18,84 @@ Option Explicit
|
||||
|
||||
|
||||
|
||||
Private Sub cbCancel_Click()
|
||||
|
||||
tbAdjVol.value = 0
|
||||
tbAdjVal.value = 0
|
||||
tbAdjPrice.value = 0
|
||||
fpvt.Hide
|
||||
|
||||
End Sub
|
||||
|
||||
|
||||
|
||||
Private Sub cbOK_Click()
|
||||
|
||||
'MsgBox (handler.scenario)
|
||||
|
||||
|
||||
End Sub
|
||||
|
||||
Private Sub chbPlug_Change()
|
||||
|
||||
opvolume.Enabled = Not chbPlug.value
|
||||
opprice.Enabled = Not chbPlug.value
|
||||
|
||||
End Sub
|
||||
|
||||
|
||||
Private Sub opprice_Click()
|
||||
|
||||
tbFcVal = Format(CDbl(tbPadjVal.value) + CDbl(tbBaseVal.value) + CDbl(tbAdjVal.value), "#,###")
|
||||
tbFcVol = Format((CDbl(tbPadjVol.value) + CDbl(tbBaseVol.value)), "#,###")
|
||||
tbFcPrice = Format(CDbl(tbFcVal.value) / CDbl(tbFcVol.value), "#.000")
|
||||
|
||||
End Sub
|
||||
|
||||
Private Sub opvolume_Click()
|
||||
|
||||
Dim pchange As Double
|
||||
|
||||
'---------calculate percent change----------------------------------------------------------------------
|
||||
pchange = 1 + CDbl(tbAdjVal.value) / (CDbl(tbPadjVal.value) + CDbl(tbBaseVal.value))
|
||||
'---------add the adjustments together to get the new forecast------------------------------------------
|
||||
tbFcVal = Format(CDbl(tbPadjVal.value) + CDbl(tbBaseVal.value) + CDbl(tbAdjVal.value), "#,###")
|
||||
tbFcVol = Format((CDbl(tbPadjVol.value) + CDbl(tbBaseVol.value)) * pchange, "#,###")
|
||||
tbFcPrice = Format(CDbl(tbFcVal.value) / CDbl(tbFcVol.value), "#.000")
|
||||
|
||||
End Sub
|
||||
|
||||
Private Sub tbAdjVal_Change()
|
||||
|
||||
Dim pchange As Double
|
||||
|
||||
If IsNumeric(tbAdjVal.value) Then
|
||||
tbFcVal = Format(CDbl(tbAdjVal.value) + CDbl(tbBaseVal.value), "#,###")
|
||||
'---------calculate percent change----------------------------------------------------------------------
|
||||
pchange = 1 + CDbl(tbAdjVal.value) / (CDbl(tbPadjVal.value) + CDbl(tbBaseVal.value))
|
||||
'---------add the adjustments together to get the new forecast------------------------------------------
|
||||
tbFcVal = Format(CDbl(tbPadjVal.value) + CDbl(tbBaseVal.value) + CDbl(tbAdjVal.value), "#,###")
|
||||
'---------if volume adjustment method is selected, scale the volume up----------------------------------
|
||||
If opvolume Then
|
||||
tbFcVol = Format((CDbl(tbPadjVol.value) + CDbl(tbBaseVol.value)) * pchange, "#,###")
|
||||
Else
|
||||
tbFcVol = Format((CDbl(tbPadjVol.value) + CDbl(tbBaseVol.value)), "#,###")
|
||||
End If
|
||||
tbFcPrice = Format(CDbl(tbFcVal.value) / CDbl(tbFcVol.value), "#.000")
|
||||
Else
|
||||
tbFcVal = Format(CDbl(tbBaseVal.value), "#,###")
|
||||
tbFcVal = Format(CDbl(tbPadjVal.value) + CDbl(tbBaseVal.value), "#,###")
|
||||
tbFcVol = Format((CDbl(tbPadjVol.value) + CDbl(tbBaseVol.value)), "#,###")
|
||||
tbFcPrice = Format(CDbl(tbFcVal.value) / CDbl(tbFcVol.value), "#.000")
|
||||
End If
|
||||
|
||||
End Sub
|
||||
|
||||
|
||||
Private Sub tbAdjVol_Change()
|
||||
|
||||
If IsNumeric(tbAdjVol.value) Then
|
||||
tbFcVol = Format(CDbl(tbAdjVol.value) + CDbl(tbBaseVol.value), "#,###")
|
||||
Else
|
||||
tbFcVol = Format(CDbl(tbBaseVol.value), "#,###")
|
||||
End If
|
||||
|
||||
End Sub
|
||||
@ -32,13 +104,19 @@ Private Sub UserForm_Activate()
|
||||
|
||||
Dim s_tot As Object
|
||||
Dim i As Long
|
||||
Dim ok As Boolean
|
||||
|
||||
Set s_tot = handler.scenario_totals(handler.scenario)
|
||||
Set s_tot = handler.scenario_totals(handler.scenario, ok)
|
||||
|
||||
If Not ok Then
|
||||
fpvt.Hide
|
||||
Application.StatusBar = False
|
||||
Exit Sub
|
||||
End If
|
||||
|
||||
|
||||
'---show existing adjustment if there is one----
|
||||
fpvt.mod_adjust = False
|
||||
fpvt.lOrigAdj.Visible = False
|
||||
fpvt.tbOrigAdj.Visible = False
|
||||
|
||||
For i = 1 To s_tot("x").Count
|
||||
Select Case s_tot("x")(i)("order_season")
|
||||
@ -47,22 +125,20 @@ Private Sub UserForm_Activate()
|
||||
Case "copy"
|
||||
fpvt.tbBaseVol.Text = Format(s_tot("x")(i)("units"), "#,###")
|
||||
fpvt.tbBaseVal.Text = Format(s_tot("x")(i)("value_usd"), "#,###")
|
||||
If s_tot("x")(i)("units") <> 0 Then fpvt.tbBasePrice.Text = Format(s_tot("x")(i)("value_usd") / s_tot("x")(i)("units"), "#.000")
|
||||
|
||||
Case "adjustment"
|
||||
fpvt.tbAdjVol.Text = Format(s_tot("x")(i)("units"), "#,###")
|
||||
fpvt.tbAdjVal.Text = Format(s_tot("x")(i)("value_usd"), "#,###")
|
||||
|
||||
'---show existing adjustment if there is one----
|
||||
fpvt.mod_adjust = True
|
||||
fpvt.lOrigAdj.Visible = True
|
||||
fpvt.tbOrigAdj.Visible = True
|
||||
fpvt.tbOrigAdj.value = Format(s_tot("x")(i)("value_usd"), "#,###")
|
||||
fpvt.tbPadjVol.Text = Format(s_tot("x")(i)("units"), "#,###")
|
||||
fpvt.tbPadjVal.Text = Format(s_tot("x")(i)("value_usd"), "#,###")
|
||||
|
||||
End Select
|
||||
End Select
|
||||
Next i
|
||||
|
||||
fpvt.tbFcVol.Text = Format(fpvt.tbBaseVol.value + fpvt.tbAdjVol.value, "#,###")
|
||||
fpvt.tbFcVal.Text = Format(fpvt.tbBaseVal.value + fpvt.tbAdjVal.value, "#,###")
|
||||
fpvt.tbFcVol.value = Format(CDbl(fpvt.tbBaseVol.value) + CDbl(fpvt.tbPadjVol.value), "#,###")
|
||||
fpvt.tbFcVal.value = Format(CDbl(fpvt.tbBaseVal.value) + CDbl(fpvt.tbPadjVal.value), "#,###")
|
||||
fpvt.tbFcPrice.value = Format(CDbl(fpvt.tbFcVal.value) / CDbl(fpvt.tbFcVol.value), "#.000")
|
||||
|
||||
Application.StatusBar = False
|
||||
|
||||
sbEdit.SimpleText = "idle"
|
||||
End Sub
|
||||
|
Loading…
Reference in New Issue
Block a user