handle no month situation for sales plug

This commit is contained in:
Trowbridge 2019-03-06 05:02:35 -05:00
parent 3447f9d48c
commit 6794d8ff9a
2 changed files with 13 additions and 11 deletions

View File

@ -92,8 +92,8 @@ Private Sub lbMonth_Change()
Dim i As Long Dim i As Long
For i = 0 To 13 For i = 0 To 13
If lbMonth.Selected(i) Then If lbMonth.Selected(i) Then
If i <> 0 And i <> 13 Then
mline = i mline = i
If i <> 0 And i <> 13 Then
Me.load_var Me.load_var
Me.load_mbox Me.load_mbox
Else Else
@ -566,24 +566,26 @@ Sub calc_mval()
Dim pchange As Double Dim pchange As Double
If IsNumeric(tbMFVal.value) Then If IsNumeric(tbMFVal.value) Then
'get textbox value
fValm = tbMFVal.value fValm = tbMFVal.value
'calculate percent change 'do calculations
'If (pValm + bValm) = 0 Then Exit Sub
pchange = fValm / (pValm + bValm)
'plug the adjustment required
aValm = fValm - bValm - pValm 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 nomonth Then
fVolm = fValm / bPrcm
fPrcm = bPrcm
Else
If opmvol Then If opmvol Then
pchange = fValm / (pValm + bValm)
fVolm = (pVolm + bVolm) * pchange fVolm = (pVolm + bVolm) * pchange
Else Else
fVolm = pVolm + bVolm fVolm = pVolm + bVolm
End If End If
End If
fPrcm = fValm / fVolm fPrcm = fValm / fVolm
aVolm = fVolm - (bVolm + pVolm) aVolm = fVolm - (bVolm + pVolm)
aPrcm = fValm / fVolm - (bValm + pValm) / (bVolm + pVolm) aPrcm = fPrcm - (bPrcm + pPrcm)
Else Else
aVolm = fVolm - bVolm - pVolm aVolm = fVolm - bVolm - pVolm
aPrcm = 0 aPrcm = 0

BIN
fpvt.frx

Binary file not shown.