VBA/fpvt.frm
2019-02-28 01:47:56 -05:00

69 lines
2.2 KiB
Plaintext

VERSION 5.00
Begin {C62A69F0-16DC-11CE-9E98-00AA00574A4F} fpvt
Caption = "UserForm1"
ClientHeight = 6780
ClientLeft = 120
ClientTop = 465
ClientWidth = 12735
OleObjectBlob = "fpvt.frx":0000
StartUpPosition = 1 'CenterOwner
End
Attribute VB_Name = "fpvt"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Public mod_adjust As Boolean
Option Explicit
Private Sub tbAdjVal_Change()
If IsNumeric(tbAdjVal.value) Then
tbFcVal = Format(CDbl(tbAdjVal.value) + CDbl(tbBaseVal.value), "#,###")
Else
tbFcVal = Format(CDbl(tbBaseVal.value), "#,###")
End If
End Sub
Private Sub UserForm_Activate()
Dim s_tot As Object
Dim i As Long
Set s_tot = handler.scenario_totals(handler.scenario)
'---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")
Case 2020
Select Case s_tot("x")(i)("iter")
Case "copy"
fpvt.tbBaseVol.Text = Format(s_tot("x")(i)("units"), "#,###")
fpvt.tbBaseVal.Text = Format(s_tot("x")(i)("value_usd"), "#,###")
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"), "#,###")
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, "#,###")
sbEdit.SimpleText = "idle"
End Sub