change so price and volume edited together
This commit is contained in:
parent
6ad0c69c33
commit
856c885c44
80
fpvt.frm
80
fpvt.frm
@ -41,12 +41,35 @@ End Sub
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Private Sub butMAdjust_Click()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
End Sub
|
||||||
|
|
||||||
|
Private Sub butMCancel_Click()
|
||||||
|
|
||||||
|
Me.Hide
|
||||||
|
|
||||||
|
End Sub
|
||||||
|
|
||||||
Private Sub lbMonth_Change()
|
Private Sub lbMonth_Change()
|
||||||
|
|
||||||
Dim i As Long
|
Dim i As Long
|
||||||
For i = 0 To 12
|
For i = 0 To 12
|
||||||
If lbMonth.Selected(i) Then
|
If lbMonth.Selected(i) Then
|
||||||
If i <> 0 Then
|
If i <> 0 Then
|
||||||
|
If co_num(month(i, 6), 0) = 0 And co_num(month(i, 2), 0) = 0 Then
|
||||||
|
tbMBaseVal.value = 0
|
||||||
|
tbMBaseVol.value = 0
|
||||||
|
tbmPAVal.value = 0
|
||||||
|
tbMPAVol.value = 0
|
||||||
|
tbMFVal.value = 0
|
||||||
|
tbMFVol.value = 0
|
||||||
|
tbMBasePrice = 0
|
||||||
|
tbMFPrice = 0
|
||||||
|
End If
|
||||||
'------------base-------------------------------------
|
'------------base-------------------------------------
|
||||||
tbMBaseVal.value = co_num(month(i, 6), 0)
|
tbMBaseVal.value = co_num(month(i, 6), 0)
|
||||||
tbMBaseVol.value = co_num(month(i, 2), 0)
|
tbMBaseVol.value = co_num(month(i, 2), 0)
|
||||||
@ -83,6 +106,7 @@ Private Sub lbMonth_Change()
|
|||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
Private Sub opEditPrice_Click()
|
Private Sub opEditPrice_Click()
|
||||||
|
|
||||||
opPlugVol.Enabled = False
|
opPlugVol.Enabled = False
|
||||||
opPlugPrice.Enabled = False
|
opPlugPrice.Enabled = False
|
||||||
opPlugVol.Visible = False
|
opPlugVol.Visible = False
|
||||||
@ -94,12 +118,13 @@ Private Sub opEditPrice_Click()
|
|||||||
tbFcPrice.BackColor = &H80000018
|
tbFcPrice.BackColor = &H80000018
|
||||||
tbFcVal.Enabled = False
|
tbFcVal.Enabled = False
|
||||||
tbFcVal.BackColor = &H80000005
|
tbFcVal.BackColor = &H80000005
|
||||||
tbFcVol.Enabled = False
|
tbFcVol.Enabled = True
|
||||||
tbFcVol.BackColor = &H80000005
|
tbFcVol.BackColor = &H80000018
|
||||||
|
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
Private Sub opEditSales_Click()
|
Private Sub opEditSales_Click()
|
||||||
|
|
||||||
opPlugVol.Enabled = True
|
opPlugVol.Enabled = True
|
||||||
opPlugPrice.Enabled = True
|
opPlugPrice.Enabled = True
|
||||||
opPlugVol.Visible = True
|
opPlugVol.Visible = True
|
||||||
@ -114,42 +139,27 @@ Private Sub opEditSales_Click()
|
|||||||
|
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
Private Sub opEditVol_Click()
|
|
||||||
opPlugVol.Enabled = False
|
|
||||||
opPlugPrice.Enabled = False
|
|
||||||
opPlugPrice.value = False
|
|
||||||
opPlugVol.value = True
|
|
||||||
opPlugVol.Enabled = False
|
|
||||||
opPlugPrice.Enabled = False
|
|
||||||
opPlugVol.Visible = False
|
|
||||||
opPlugPrice.Visible = False
|
|
||||||
|
|
||||||
tbFcPrice.Enabled = False
|
|
||||||
tbFcPrice.BackColor = &H80000005
|
|
||||||
tbFcVal.Enabled = False
|
|
||||||
tbFcVal.BackColor = &H80000005
|
|
||||||
tbFcVol.Enabled = True
|
|
||||||
tbFcVol.BackColor = &H80000018
|
|
||||||
End Sub
|
|
||||||
|
|
||||||
Private Sub opEditPriceM_Click()
|
Private Sub opEditPriceM_Click()
|
||||||
|
|
||||||
opmvol.Enabled = False
|
opmvol.Enabled = False
|
||||||
opmprice.Enabled = False
|
opmprice.Enabled = False
|
||||||
opmvol.Visible = False
|
opmvol.Visible = False
|
||||||
opmprice.Visible = False
|
opmprice.Visible = False
|
||||||
opmprice.value = True
|
opmprice.value = True
|
||||||
opmvol.value = False
|
opmvol.value = True
|
||||||
|
|
||||||
tbMFPrice.Enabled = True
|
tbMFPrice.Enabled = True
|
||||||
tbMFPrice.BackColor = &H80000018
|
tbMFPrice.BackColor = &H80000018
|
||||||
tbMFVal.Enabled = False
|
tbMFVal.Enabled = False
|
||||||
tbMFVal.BackColor = &H80000005
|
tbMFVal.BackColor = &H80000005
|
||||||
tbMFVol.Enabled = False
|
tbMFVol.Enabled = True
|
||||||
tbMFVol.BackColor = &H80000005
|
tbMFVol.BackColor = &H80000018
|
||||||
|
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
Private Sub opEditSalesM_Click()
|
Private Sub opEditSalesM_Click()
|
||||||
|
|
||||||
opmvol.Enabled = True
|
opmvol.Enabled = True
|
||||||
opmprice.Enabled = True
|
opmprice.Enabled = True
|
||||||
opmvol.Visible = True
|
opmvol.Visible = True
|
||||||
@ -165,6 +175,7 @@ Private Sub opEditSalesM_Click()
|
|||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
Private Sub opEditVolM_Click()
|
Private Sub opEditVolM_Click()
|
||||||
|
|
||||||
opmvol.Enabled = False
|
opmvol.Enabled = False
|
||||||
opmprice.Enabled = False
|
opmprice.Enabled = False
|
||||||
opmprice.value = False
|
opmprice.value = False
|
||||||
@ -199,7 +210,7 @@ Private Sub tbFcVal_Change()
|
|||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
Private Sub tbFcVol_Change()
|
Private Sub tbFcVol_Change()
|
||||||
If opEditVol Then calc_vol
|
If opEditPrice Then calc_price
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
'--------------------------------monthly buttons--------------------------------------
|
'--------------------------------monthly buttons--------------------------------------
|
||||||
@ -218,11 +229,10 @@ End Sub
|
|||||||
|
|
||||||
Private Sub tbmfVal_Change()
|
Private Sub tbmfVal_Change()
|
||||||
If opEditSalesM Then calc_mval
|
If opEditSalesM Then calc_mval
|
||||||
tbMFVal.value = Format(CDbl(tbMFVal.value), "#,###")
|
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
Private Sub tbmfVol_Change()
|
Private Sub tbmfVol_Change()
|
||||||
If opEditVolM Then calc_mvol
|
If opEditPriceM Then calc_mprice
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
Private Sub UserForm_Activate()
|
Private Sub UserForm_Activate()
|
||||||
@ -233,8 +243,8 @@ Private Sub UserForm_Activate()
|
|||||||
Dim k As Long
|
Dim k As Long
|
||||||
Dim ok As Boolean
|
Dim ok As Boolean
|
||||||
|
|
||||||
handler.server = "http://10.56.1.20:3000"
|
'handler.server = "http://10.56.1.20:3000"
|
||||||
'handler.server = "http://192.168.1.69:3000"
|
handler.server = "http://192.168.1.69:3000"
|
||||||
|
|
||||||
Set sp = handler.scenario_package(handler.scenario, ok)
|
Set sp = handler.scenario_package(handler.scenario, ok)
|
||||||
|
|
||||||
@ -270,6 +280,7 @@ Private Sub UserForm_Activate()
|
|||||||
fpvt.tbFcVol.value = Format(CDbl(fpvt.tbBaseVol.value) + CDbl(fpvt.tbPadjVol.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.tbFcVal.value = Format(CDbl(fpvt.tbBaseVal.value) + CDbl(fpvt.tbPadjVal.value), "#")
|
||||||
fpvt.tbFcPrice.value = Format(CDbl(fpvt.tbFcVal.value) / CDbl(fpvt.tbFcVol.value), "#.000")
|
fpvt.tbFcPrice.value = Format(CDbl(fpvt.tbFcVal.value) / CDbl(fpvt.tbFcVol.value), "#.000")
|
||||||
|
fpvt.tbPadjPrice.value = Format((CDbl(fpvt.tbPadjVal.value) + CDbl(tbBaseVal.value)) / (CDbl(fpvt.tbBaseVol.value) + CDbl(tbPadjVol.value)) - CDbl(tbBaseVal) / CDbl(tbBaseVol), "#.000")
|
||||||
|
|
||||||
'---------------------------------------populate monthly-------------------------------------------------------
|
'---------------------------------------populate monthly-------------------------------------------------------
|
||||||
|
|
||||||
@ -401,9 +412,10 @@ End Sub
|
|||||||
|
|
||||||
Sub calc_price()
|
Sub calc_price()
|
||||||
|
|
||||||
If IsNumeric(tbFcPrice.value) And tbFcPrice.value <> 0 Then
|
If IsNumeric(tbFcPrice.value) And tbFcPrice.value <> 0 And IsNumeric(tbFcVol.value) And tbFcVol.value <> 0 Then
|
||||||
tbFcVal = Format(CDbl(tbFcPrice.value) * CDbl(tbFcVol.value), "#,###")
|
tbFcVal = Format(CDbl(tbFcPrice.value) * CDbl(tbFcVol.value), "#,##0")
|
||||||
tbAdjVal = Format(CDbl(tbFcVal.value) - CDbl(tbBaseVal.value) - CDbl(tbPadjVal.value), "#,###")
|
tbAdjVal = Format(CDbl(tbFcVal.value) - CDbl(tbBaseVal.value) - CDbl(tbPadjVal.value), "#,###")
|
||||||
|
tbAdjVol = Format(tbFcVol - (CDbl(tbBaseVol) + CDbl(tbPadjVol)), "#,###")
|
||||||
tbAdjPrice = Format(CDbl(tbFcVal.value) / CDbl(tbFcVol.value) - ((CDbl(tbBaseVal.value) + CDbl(tbPadjVal.value)) / (CDbl(tbBaseVol.value) + CDbl(tbPadjVol.value))), "#.000")
|
tbAdjPrice = Format(CDbl(tbFcVal.value) / CDbl(tbFcVol.value) - ((CDbl(tbBaseVal.value) + CDbl(tbPadjVal.value)) / (CDbl(tbBaseVol.value) + CDbl(tbPadjVol.value))), "#.000")
|
||||||
Else
|
Else
|
||||||
tbFcVal = 0
|
tbFcVal = 0
|
||||||
@ -419,6 +431,7 @@ Sub calc_mval()
|
|||||||
|
|
||||||
If IsNumeric(tbMFVal.value) Then
|
If IsNumeric(tbMFVal.value) Then
|
||||||
'calculate percent change
|
'calculate percent change
|
||||||
|
If (CDbl(tbmPAVal.value) + CDbl(tbMBaseVal.value)) = 0 Then Exit Sub
|
||||||
pchange = CDbl(tbMFVal.value) / (CDbl(tbmPAVal.value) + CDbl(tbMBaseVal.value))
|
pchange = CDbl(tbMFVal.value) / (CDbl(tbmPAVal.value) + CDbl(tbMBaseVal.value))
|
||||||
|
|
||||||
'plug the adjustment required
|
'plug the adjustment required
|
||||||
@ -440,13 +453,16 @@ Sub calc_mval()
|
|||||||
tbMAPrice = 0
|
tbMAPrice = 0
|
||||||
'tbMAPrice = Format(CDbl(tbMFVal.value) / CDbl(tbMFVol.value) - ((tbMBaseVal + tbMPAVal) / (tbMBaseVol + tbMPAVol)), "#.000")
|
'tbMAPrice = Format(CDbl(tbMFVal.value) / CDbl(tbMFVol.value) - ((tbMBaseVal + tbMPAVal) / (tbMBaseVol + tbMPAVol)), "#.000")
|
||||||
End If
|
End If
|
||||||
|
tbMFVal = Format(tbMFVal, "#,###")
|
||||||
|
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
Sub calc_mprice()
|
Sub calc_mprice()
|
||||||
|
|
||||||
If IsNumeric(tbMFPrice.value) And tbMFPrice.value <> 0 Then
|
If IsNumeric(tbMFPrice.value) And tbMFPrice.value <> 0 And IsNumeric(tbMFVol.value) And tbMFVol.value <> 0 Then
|
||||||
tbMFVal = Format(CDbl(tbMFPrice.value) * CDbl(tbMFVol.value), "#,###")
|
tbMFVal = Format(CDbl(tbMFPrice.value) * CDbl(tbMFVol.value), "#,##0")
|
||||||
tbMAVal = Format(CDbl(tbMFVal.value) - CDbl(tbMBaseVal.value) - CDbl(tbmPAVal.value), "#,###")
|
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")
|
tbMAPrice = Format(CDbl(tbMFVal.value) / CDbl(tbMFVol.value) - ((CDbl(tbMBaseVal.value) + CDbl(tbmPAVal.value)) / (CDbl(tbMBaseVol.value) + CDbl(tbMPAVol.value))), "#.000")
|
||||||
Else
|
Else
|
||||||
tbMFVal = 0
|
tbMFVal = 0
|
||||||
@ -476,6 +492,6 @@ Sub calc_mvol()
|
|||||||
tbMAPrice = Format((tbMBaseVal + tbmPAVal) / (tbMBaseVol + tbMPAVol), "#.000")
|
tbMAPrice = Format((tbMBaseVal + tbmPAVal) / (tbMBaseVol + tbMPAVol), "#.000")
|
||||||
tbMAVol = Format(-CDbl(tbMBaseVol.value) - CDbl(tbMPAVol.value), "#,###")
|
tbMAVol = Format(-CDbl(tbMBaseVol.value) - CDbl(tbMPAVol.value), "#,###")
|
||||||
End If
|
End If
|
||||||
tbMFVal = Format(tbMFVal, "#,###")
|
tbMFVol = Format(CDbl(tbMFVol), "#,###")
|
||||||
|
|
||||||
End Sub
|
End Sub
|
||||||
|
Loading…
Reference in New Issue
Block a user