initial rework of value calc

This commit is contained in:
Trowbridge 2019-03-06 04:44:08 -05:00
parent bbf3d84e60
commit 3447f9d48c
2 changed files with 22 additions and 14 deletions

View File

@ -231,11 +231,11 @@ End Sub
'--------------------------------monthly buttons-------------------------------------- '--------------------------------monthly buttons--------------------------------------
Private Sub opmPrice_Click() Private Sub opmPrice_Click()
'calc_mval calc_mval
End Sub End Sub
Private Sub opmVol_Click() Private Sub opmVol_Click()
'calc_mval calc_mval
End Sub End Sub
Private Sub tbmfPrice_Change() Private Sub tbmfPrice_Change()
@ -248,6 +248,12 @@ End Sub
Private Sub tbMFVal_Change()
If mline = 0 Then Exit Sub
If clear_lb Or load_tb Then Exit Sub
If opEditSalesM Then calc_mval
End Sub
Private Sub tbmfVol_Change() Private Sub tbmfVol_Change()
If mline = 0 Then Exit Sub If mline = 0 Then Exit Sub
If clear_lb Or load_tb Then Exit Sub If clear_lb Or load_tb Then Exit Sub
@ -560,31 +566,33 @@ Sub calc_mval()
Dim pchange As Double Dim pchange As Double
If IsNumeric(tbMFVal.value) Then If IsNumeric(tbMFVal.value) Then
fValm = tbMFVal.value
'calculate percent change 'calculate percent change
If (CDbl(tbmPAVal.value) + CDbl(tbMBaseVal.value)) = 0 Then Exit Sub 'If (pValm + bValm) = 0 Then Exit Sub
pchange = CDbl(tbMFVal.value) / (CDbl(tbmPAVal.value) + CDbl(tbMBaseVal.value)) pchange = fValm / (pValm + bValm)
'plug the adjustment required 'plug the adjustment required
tbMAVal = Format(CDbl(tbMFVal.value) - CDbl(tbMBaseVal.value) - CDbl(tbmPAVal.value), "#,###") aValm = fValm - bValm - pValm
'---------if volume adjustment method is selected, scale the volume up---------------------------------- '---------if volume adjustment method is selected, scale the volume up----------------------------------
If opmvol Then If opmvol Then
tbMFVol = Format((CDbl(tbMPAVol.value) + CDbl(tbMBaseVol.value)) * pchange, "#,###") fVolm = (pVolm + bVolm) * pchange
Else Else
tbMFVol = Format((CDbl(tbMPAVol.value) + CDbl(tbMBaseVol.value)), "#,###") fVolm = pVolm + bVolm
End If End If
tbMFPrice = Format(CDbl(tbMFVal.value) / CDbl(tbMFVol.value), "#.000") fPrcm = fValm / fVolm
tbMAVol = Format(tbMFVol - (CDbl(tbMBaseVol) + CDbl(tbMPAVol)), "#,###") aVolm = fVolm - (bVolm + pVolm)
tbMAPrice = Format(CDbl(tbMFVal.value) / CDbl(tbMFVol.value) - ((CDbl(tbMBaseVal.value) + CDbl(tbmPAVal.value)) / (CDbl(tbMBaseVol.value) + CDbl(tbMPAVol.value))), "#.000") aPrcm = fValm / fVolm - (bValm + pValm) / (bVolm + pVolm)
Else Else
'tbMFVal = Format(CDbl(tbMPAVal.value) + CDbl(tbMBaseVal.value), "#,###") aVolm = fVolm - bVolm - pVolm
tbMAVol = Format((CDbl(tbMFVol.value) - CDbl(tbMBaseVol.value) - CDbl(tbMPAVol.value)), "#,###") aPrcm = 0
tbMAPrice = 0
'tbMAPrice = Format(CDbl(tbMFVal.value) / CDbl(tbMFVol.value) - ((tbMBaseVal + tbMPAVal) / (tbMBaseVol + tbMPAVol)), "#.000")
End If End If
tbMFVal = Format(tbMFVal, "#,###") tbMFVal = Format(tbMFVal, "#,###")
Me.load_mbox
Me.load_array
End Sub End Sub
Sub calc_mprice() Sub calc_mprice()

BIN
fpvt.frx

Binary file not shown.