update monthly controls
This commit is contained in:
parent
ba99264fb6
commit
93a5086160
118
monthly.bas
Normal file
118
monthly.bas
Normal file
@ -0,0 +1,118 @@
|
|||||||
|
Sub calc_mval()
|
||||||
|
|
||||||
|
Dim pchange As Double
|
||||||
|
|
||||||
|
If IsNumeric(tbMFVal.value) Then
|
||||||
|
'calculate percent change
|
||||||
|
pchange = CDbl(tbMFVal.value) / (CDbl(tbMPAVal.value) + CDbl(tbMBaseVal.value))
|
||||||
|
|
||||||
|
'plug the adjustment required
|
||||||
|
tbMAVal = Format(CDbl(tbMFVal.value) - CDbl(tbMBaseVal.value) - CDbl(tbMPAVal.value), "#,###")
|
||||||
|
|
||||||
|
|
||||||
|
'---------if volume adjustment method is selected, scale the volume up----------------------------------
|
||||||
|
If opmVol Then
|
||||||
|
tbMFVol = Format((CDbl(tbMPAVol.value) + CDbl(tbMBaseVol.value)) * pchange, "#,###")
|
||||||
|
Else
|
||||||
|
tbMFVol = Format((CDbl(tbMPAVol.value) + CDbl(tbMBaseVol.value)), "#,###")
|
||||||
|
End If
|
||||||
|
tbMFPrice = Format(CDbl(tbMFVal.value) / CDbl(tbMFVol.value), "#.000")
|
||||||
|
tbMAVol = Format(tbMFVol - (CDbl(tbMBaseVol) + CDbl(tbMPAVol)), "#,###")
|
||||||
|
tbMAPrice = Format(CDbl(tbMFVal.value) / CDbl(tbMFVol.value) - ((CDbl(tbMBaseVal.value) + CDbl(tbMPAVal.value)) / (CDbl(tbMBaseVol.value) + CDbl(tbMPAVol.value))), "#.000")
|
||||||
|
Else
|
||||||
|
'tbMFVal = Format(CDbl(tbMPAVal.value) + CDbl(tbMBaseVal.value), "#,###")
|
||||||
|
tbMAVol = Format((CDbl(tbMFVol.value) - CDbl(tbMBaseVol.value) - CDbl(tbMPAVol.value)), "#,###")
|
||||||
|
tbMAPrice = 0
|
||||||
|
'tbMAPrice = Format(CDbl(tbMFVal.value) / CDbl(tbMFVol.value) - ((tbMBaseVal + tbMPAVal) / (tbMBaseVol + tbMPAVol)), "#.000")
|
||||||
|
End If
|
||||||
|
End Sub
|
||||||
|
|
||||||
|
Sub calc_mprice()
|
||||||
|
|
||||||
|
If IsNumeric(tbMFPrice.value) And tbMFPrice.value <> 0 Then
|
||||||
|
tbMFVal = Format(CDbl(tbMFPrice.value) * CDbl(tbMFVol.value), "#,###")
|
||||||
|
tbMAVal = Format(CDbl(tbMFVal.value) - CDbl(tbMBaseVal.value) - CDbl(tbMPAVal.value), "#,###")
|
||||||
|
tbMAPrice = Format(CDbl(tbMFVal.value) / CDbl(tbMFVol.value) - ((CDbl(tbMBaseVal.value) + CDbl(tbMPAVal.value)) / (CDbl(tbMBaseVol.value) + CDbl(tbMPAVol.value))), "#.000")
|
||||||
|
Else
|
||||||
|
tbMFVal = 0
|
||||||
|
tbMAVal = Format(CDbl(tbMFVal.value) - CDbl(tbMBaseVal.value) - CDbl(tbMPAVal.value), "#,###")
|
||||||
|
End If
|
||||||
|
|
||||||
|
End Sub
|
||||||
|
|
||||||
|
Sub calc_mvol()
|
||||||
|
|
||||||
|
Dim pchange As Double
|
||||||
|
|
||||||
|
If IsNumeric(tbMFVol.value) And tbMFVol <> 0 Then
|
||||||
|
'price should already have been re-calculated to base + prior at this point
|
||||||
|
tbMFVal = Format(CDbl(tbMFPrice.value) * CDbl(tbMFVol.value))
|
||||||
|
|
||||||
|
'calculate percent change
|
||||||
|
'pchange = CDbl(tbMFVal.value) / (CDbl(tbMPAVal.value) + CDbl(tbMBaseVal.value))
|
||||||
|
|
||||||
|
'plug the adjustment required
|
||||||
|
tbMAVal = Format(CDbl(tbMFVal.value) - CDbl(tbMBaseVal.value) - CDbl(tbMPAVal.value), "#,###")
|
||||||
|
tbMAVol = Format(tbMFVol - (CDbl(tbMBaseVol) + CDbl(tbMPAVol)), "#,###")
|
||||||
|
tbMAPrice = Format(CDbl(tbMFVal.value) / CDbl(tbMFVol.value) - ((CDbl(tbMBaseVal.value) + CDbl(tbMPAVal.value)) / (CDbl(tbMBaseVol.value) + CDbl(tbMPAVol.value))), "#.000")
|
||||||
|
Else
|
||||||
|
tbMFVal = 0
|
||||||
|
tbMAVal = Format(CDbl(tbMFVal.value) - CDbl(tbMBaseVal.value) - CDbl(tbMPAVal.value), "#,###")
|
||||||
|
tbMAPrice = Format((tbMBaseVal + tbMPAVal) / (tbMBaseVol + tbMPAVol), "#.000")
|
||||||
|
tbMAVol = Format(-CDbl(tbMBaseVol.value) - CDbl(tbMPAVol.value), "#,###")
|
||||||
|
End If
|
||||||
|
tbMFVal = Format(tbMFVal, "#,###")
|
||||||
|
|
||||||
|
End Sub
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Private Sub opEditPriceM_Click()
|
||||||
|
opmVol.Enabled = False
|
||||||
|
opmPrice.Enabled = False
|
||||||
|
opmVol.Visible = False
|
||||||
|
opmPrice.Visible = False
|
||||||
|
opmPrice.value = True
|
||||||
|
opmVol.value = False
|
||||||
|
|
||||||
|
tbmfPrice.Enabled = True
|
||||||
|
tbmfPrice.BackColor = &H80000018
|
||||||
|
tbmfVal.Enabled = False
|
||||||
|
tbmfVal.BackColor = &H80000005
|
||||||
|
tbmfVol.Enabled = False
|
||||||
|
tbmfVol.BackColor = &H80000005
|
||||||
|
|
||||||
|
End Sub
|
||||||
|
|
||||||
|
Private Sub opEditSalesM_Click()
|
||||||
|
opmVol.Enabled = True
|
||||||
|
opmPrice.Enabled = True
|
||||||
|
opmVol.Visible = True
|
||||||
|
opmPrice.Visible = True
|
||||||
|
|
||||||
|
tbmfPrice.Enabled = False
|
||||||
|
tbmfPrice.BackColor = &H80000005
|
||||||
|
tbmfVal.Enabled = True
|
||||||
|
tbmfVal.BackColor = &H80000018
|
||||||
|
tbmfVol.Enabled = False
|
||||||
|
tbmfVol.BackColor = &H80000005
|
||||||
|
|
||||||
|
End Sub
|
||||||
|
|
||||||
|
Private Sub opEditVolM_Click()
|
||||||
|
opmVol.Enabled = False
|
||||||
|
opmPrice.Enabled = False
|
||||||
|
opmPrice.value = False
|
||||||
|
opmVol.value = True
|
||||||
|
opmVol.Enabled = False
|
||||||
|
opmPrice.Enabled = False
|
||||||
|
opmVol.Visible = False
|
||||||
|
opmPrice.Visible = False
|
||||||
|
|
||||||
|
tbmfPrice.Enabled = False
|
||||||
|
tbmfPrice.BackColor = &H80000005
|
||||||
|
tbmfVal.Enabled = False
|
||||||
|
tbmfVal.BackColor = &H80000005
|
||||||
|
tbmfVol.Enabled = True
|
||||||
|
tbmfVol.BackColor = &H80000018
|
||||||
|
End Sub
|
Loading…
Reference in New Issue
Block a user