update monthly button controls
This commit is contained in:
parent
699d0fbb2e
commit
6ad0c69c33
86
fpvt.frm
86
fpvt.frm
@ -202,6 +202,29 @@ Private Sub tbFcVol_Change()
|
|||||||
If opEditVol Then calc_vol
|
If opEditVol Then calc_vol
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
|
'--------------------------------monthly buttons--------------------------------------
|
||||||
|
|
||||||
|
Private Sub opmPrice_Click()
|
||||||
|
calc_mval
|
||||||
|
End Sub
|
||||||
|
|
||||||
|
Private Sub opmVol_Click()
|
||||||
|
calc_mval
|
||||||
|
End Sub
|
||||||
|
|
||||||
|
Private Sub tbmfPrice_Change()
|
||||||
|
If opEditPriceM Then calc_mprice
|
||||||
|
End Sub
|
||||||
|
|
||||||
|
Private Sub tbmfVal_Change()
|
||||||
|
If opEditSalesM Then calc_mval
|
||||||
|
tbMFVal.value = Format(CDbl(tbMFVal.value), "#,###")
|
||||||
|
End Sub
|
||||||
|
|
||||||
|
Private Sub tbmfVol_Change()
|
||||||
|
If opEditVolM Then calc_mvol
|
||||||
|
End Sub
|
||||||
|
|
||||||
Private Sub UserForm_Activate()
|
Private Sub UserForm_Activate()
|
||||||
|
|
||||||
Dim sp As Object
|
Dim sp As Object
|
||||||
@ -224,6 +247,8 @@ Private Sub UserForm_Activate()
|
|||||||
|
|
||||||
'---show existing adjustment if there is one----
|
'---show existing adjustment if there is one----
|
||||||
fpvt.mod_adjust = False
|
fpvt.mod_adjust = False
|
||||||
|
fpvt.tbPadjVol.Text = 0
|
||||||
|
fpvt.tbPadjVal.Text = 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")
|
||||||
@ -330,6 +355,7 @@ Sub calc_val()
|
|||||||
tbAdjPrice = 0
|
tbAdjPrice = 0
|
||||||
'tbAdjPrice = Format(CDbl(tbFcVal.value) / CDbl(tbFcVol.value) - ((tbBaseVal + tbPadjVal) / (tbBaseVol + tbPadjVol)), "#.000")
|
'tbAdjPrice = Format(CDbl(tbFcVal.value) / CDbl(tbFcVol.value) - ((tbBaseVal + tbPadjVal) / (tbBaseVol + tbPadjVol)), "#.000")
|
||||||
End If
|
End If
|
||||||
|
tbFcVal = Format(CDbl(tbFcVal), "#,##0")
|
||||||
|
|
||||||
'build json
|
'build json
|
||||||
Set adjust = JsonConverter.ParseJson("{""scneario"":" & scenario & "}")
|
Set adjust = JsonConverter.ParseJson("{""scneario"":" & scenario & "}")
|
||||||
@ -391,40 +417,40 @@ Sub calc_mval()
|
|||||||
|
|
||||||
Dim pchange As Double
|
Dim pchange As Double
|
||||||
|
|
||||||
If IsNumeric(tbFcVal.value) Then
|
If IsNumeric(tbMFVal.value) Then
|
||||||
'calculate percent change
|
'calculate percent change
|
||||||
pchange = CDbl(tbFcVal.value) / (CDbl(tbPadjVal.value) + CDbl(tbBaseVal.value))
|
pchange = CDbl(tbMFVal.value) / (CDbl(tbmPAVal.value) + CDbl(tbMBaseVal.value))
|
||||||
|
|
||||||
'plug the adjustment required
|
'plug the adjustment required
|
||||||
tbAdjVal = Format(CDbl(tbFcVal.value) - CDbl(tbBaseVal.value) - CDbl(tbPadjVal.value), "#,###")
|
tbMAVal = Format(CDbl(tbMFVal.value) - CDbl(tbMBaseVal.value) - CDbl(tbmPAVal.value), "#,###")
|
||||||
|
|
||||||
|
|
||||||
'---------if volume adjustment method is selected, scale the volume up----------------------------------
|
'---------if volume adjustment method is selected, scale the volume up----------------------------------
|
||||||
If opPlugVol Then
|
If opmvol Then
|
||||||
tbFcVol = Format((CDbl(tbPadjVol.value) + CDbl(tbBaseVol.value)) * pchange, "#,###")
|
tbMFVol = Format((CDbl(tbMPAVol.value) + CDbl(tbMBaseVol.value)) * pchange, "#,###")
|
||||||
Else
|
Else
|
||||||
tbFcVol = Format((CDbl(tbPadjVol.value) + CDbl(tbBaseVol.value)), "#,###")
|
tbMFVol = Format((CDbl(tbMPAVol.value) + CDbl(tbMBaseVol.value)), "#,###")
|
||||||
End If
|
End If
|
||||||
tbFcPrice = Format(CDbl(tbFcVal.value) / CDbl(tbFcVol.value), "#.000")
|
tbMFPrice = Format(CDbl(tbMFVal.value) / CDbl(tbMFVol.value), "#.000")
|
||||||
tbAdjVol = Format(tbFcVol - (CDbl(tbBaseVol) + CDbl(tbPadjVol)), "#,###")
|
tbMAVol = Format(tbMFVol - (CDbl(tbMBaseVol) + CDbl(tbMPAVol)), "#,###")
|
||||||
tbAdjPrice = Format(CDbl(tbFcVal.value) / CDbl(tbFcVol.value) - ((CDbl(tbBaseVal.value) + CDbl(tbPadjVal.value)) / (CDbl(tbBaseVol.value) + CDbl(tbPadjVol.value))), "#.000")
|
tbMAPrice = Format(CDbl(tbMFVal.value) / CDbl(tbMFVol.value) - ((CDbl(tbMBaseVal.value) + CDbl(tbmPAVal.value)) / (CDbl(tbMBaseVol.value) + CDbl(tbMPAVol.value))), "#.000")
|
||||||
Else
|
Else
|
||||||
'tbFcVal = Format(CDbl(tbPadjVal.value) + CDbl(tbBaseVal.value), "#,###")
|
'tbMFVal = Format(CDbl(tbMPAVal.value) + CDbl(tbMBaseVal.value), "#,###")
|
||||||
tbAdjVol = Format((CDbl(tbFcVol.value) - CDbl(tbBaseVol.value) - CDbl(tbPadjVol.value)), "#,###")
|
tbMAVol = Format((CDbl(tbMFVol.value) - CDbl(tbMBaseVol.value) - CDbl(tbMPAVol.value)), "#,###")
|
||||||
tbAdjPrice = 0
|
tbMAPrice = 0
|
||||||
'tbAdjPrice = Format(CDbl(tbFcVal.value) / CDbl(tbFcVol.value) - ((tbBaseVal + tbPadjVal) / (tbBaseVol + tbPadjVol)), "#.000")
|
'tbMAPrice = Format(CDbl(tbMFVal.value) / CDbl(tbMFVol.value) - ((tbMBaseVal + tbMPAVal) / (tbMBaseVol + tbMPAVol)), "#.000")
|
||||||
End If
|
End If
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
Sub calc_mprice()
|
Sub calc_mprice()
|
||||||
|
|
||||||
If IsNumeric(tbFcPrice.value) And tbFcPrice.value <> 0 Then
|
If IsNumeric(tbMFPrice.value) And tbMFPrice.value <> 0 Then
|
||||||
tbFcVal = Format(CDbl(tbFcPrice.value) * CDbl(tbFcVol.value), "#,###")
|
tbMFVal = Format(CDbl(tbMFPrice.value) * CDbl(tbMFVol.value), "#,###")
|
||||||
tbAdjVal = Format(CDbl(tbFcVal.value) - CDbl(tbBaseVal.value) - CDbl(tbPadjVal.value), "#,###")
|
tbMAVal = Format(CDbl(tbMFVal.value) - CDbl(tbMBaseVal.value) - CDbl(tbmPAVal.value), "#,###")
|
||||||
tbAdjPrice = Format(CDbl(tbFcVal.value) / CDbl(tbFcVol.value) - ((CDbl(tbBaseVal.value) + CDbl(tbPadjVal.value)) / (CDbl(tbBaseVol.value) + CDbl(tbPadjVol.value))), "#.000")
|
tbMAPrice = Format(CDbl(tbMFVal.value) / CDbl(tbMFVol.value) - ((CDbl(tbMBaseVal.value) + CDbl(tbmPAVal.value)) / (CDbl(tbMBaseVol.value) + CDbl(tbMPAVol.value))), "#.000")
|
||||||
Else
|
Else
|
||||||
tbFcVal = 0
|
tbMFVal = 0
|
||||||
tbAdjVal = Format(CDbl(tbFcVal.value) - CDbl(tbBaseVal.value) - CDbl(tbPadjVal.value), "#,###")
|
tbMAVal = Format(CDbl(tbMFVal.value) - CDbl(tbMBaseVal.value) - CDbl(tbmPAVal.value), "#,###")
|
||||||
End If
|
End If
|
||||||
|
|
||||||
End Sub
|
End Sub
|
||||||
@ -433,23 +459,23 @@ Sub calc_mvol()
|
|||||||
|
|
||||||
Dim pchange As Double
|
Dim pchange As Double
|
||||||
|
|
||||||
If IsNumeric(tbFcVol.value) And tbFcVol <> 0 Then
|
If IsNumeric(tbMFVol.value) And tbMFVol <> 0 Then
|
||||||
'price should already have been re-calculated to base + prior at this point
|
'price should already have been re-calculated to base + prior at this point
|
||||||
tbFcVal = Format(CDbl(tbFcPrice.value) * CDbl(tbFcVol.value))
|
tbMFVal = Format(CDbl(tbMFPrice.value) * CDbl(tbMFVol.value))
|
||||||
|
|
||||||
'calculate percent change
|
'calculate percent change
|
||||||
'pchange = CDbl(tbFcVal.value) / (CDbl(tbPadjVal.value) + CDbl(tbBaseVal.value))
|
'pchange = CDbl(tbMFVal.value) / (CDbl(tbMPAVal.value) + CDbl(tbMBaseVal.value))
|
||||||
|
|
||||||
'plug the adjustment required
|
'plug the adjustment required
|
||||||
tbAdjVal = Format(CDbl(tbFcVal.value) - CDbl(tbBaseVal.value) - CDbl(tbPadjVal.value), "#,###")
|
tbMAVal = Format(CDbl(tbMFVal.value) - CDbl(tbMBaseVal.value) - CDbl(tbmPAVal.value), "#,###")
|
||||||
tbAdjVol = Format(tbFcVol - (CDbl(tbBaseVol) + CDbl(tbPadjVol)), "#,###")
|
tbMAVol = Format(tbMFVol - (CDbl(tbMBaseVol) + CDbl(tbMPAVol)), "#,###")
|
||||||
tbAdjPrice = Format(CDbl(tbFcVal.value) / CDbl(tbFcVol.value) - ((CDbl(tbBaseVal.value) + CDbl(tbPadjVal.value)) / (CDbl(tbBaseVol.value) + CDbl(tbPadjVol.value))), "#.000")
|
tbMAPrice = Format(CDbl(tbMFVal.value) / CDbl(tbMFVol.value) - ((CDbl(tbMBaseVal.value) + CDbl(tbmPAVal.value)) / (CDbl(tbMBaseVol.value) + CDbl(tbMPAVol.value))), "#.000")
|
||||||
Else
|
Else
|
||||||
tbFcVal = 0
|
tbMFVal = 0
|
||||||
tbAdjVal = Format(CDbl(tbFcVal.value) - CDbl(tbBaseVal.value) - CDbl(tbPadjVal.value), "#,###")
|
tbMAVal = Format(CDbl(tbMFVal.value) - CDbl(tbMBaseVal.value) - CDbl(tbmPAVal.value), "#,###")
|
||||||
tbAdjPrice = Format((tbBaseVal + tbPadjVal) / (tbBaseVol + tbPadjVol), "#.000")
|
tbMAPrice = Format((tbMBaseVal + tbmPAVal) / (tbMBaseVol + tbMPAVol), "#.000")
|
||||||
tbAdjVol = Format(-CDbl(tbBaseVol.value) - CDbl(tbPadjVol.value), "#,###")
|
tbMAVol = Format(-CDbl(tbMBaseVol.value) - CDbl(tbMPAVol.value), "#,###")
|
||||||
End If
|
End If
|
||||||
tbFcVal = Format(tbFcVal, "#,###")
|
tbMFVal = Format(tbMFVal, "#,###")
|
||||||
|
|
||||||
End Sub
|
End Sub
|
||||||
|
Loading…
Reference in New Issue
Block a user