handle adjustments with -0- basis

This commit is contained in:
Paul Trowbridge 2019-04-03 04:45:51 -04:00
parent 111121a801
commit 08a64f4592
3 changed files with 10 additions and 3 deletions

View File

@ -624,12 +624,18 @@ Sub calc_val()
'---------if volume adjustment method is selected, scale the volume up---------------------------------- '---------if volume adjustment method is selected, scale the volume up----------------------------------
If opPlugVol Then If opPlugVol Then
If (pVal + bVal) = 0 Then If (Round(pVal, 2) + Round(bVal, 2)) = 0 Then
pchange = 0 pchange = 0
If co_num(pVal, bVal) = 0 Then
MsgBox ("a new part was added, and then adjusted to -0-")
Else
fVol = fVal / (co_num(bVal, pVal) / co_num(bVol, pVol))
End If
Else Else
pchange = fVal / (pVal + bVal) pchange = fVal / (pVal + bVal)
fVol = (pVol + bVol) * pchange
End If End If
fVol = (pVol + bVol) * pchange
Else Else
fVol = pVol + bVol fVol = pVol + bVol
End If End If
@ -660,6 +666,7 @@ Sub calc_val()
If opPlugVol Then If opPlugVol Then
adjust("type") = "scale_v" adjust("type") = "scale_v"
adjust("amount") = aVal adjust("amount") = aVal
adjust("qty") = aVol
Else Else
adjust("type") = "scale_p" adjust("type") = "scale_p"
adjust("amount") = aVal adjust("amount") = aVal

BIN
fpvt.frx

Binary file not shown.

View File

@ -161,7 +161,7 @@ On Error GoTo errh
Dim i As Integer Dim i As Integer
Call Me.get_sheet Call Me.get_sheet
Dim vp As String Dim vp As String
vp = Sheets("month").Range("R2") vp = Sheets("month").Range("Q2")
For i = 1 To 12 For i = 1 To 12
If sales(i, 5) = "" Then sales(i, 5) = 0 If sales(i, 5) = "" Then sales(i, 5) = 0