diff --git a/fpvt.frm b/fpvt.frm index 2db68b6..4e56959 100644 --- a/fpvt.frm +++ b/fpvt.frm @@ -604,7 +604,7 @@ End Sub Function co_num(ByRef one As Variant, ByRef two As Variant) As Variant - If one = "" Or IsNull(one) Then + If Not IsNumeric(one) Or IsNull(one) Then co_num = two Else co_num = one @@ -678,36 +678,37 @@ End Sub Sub calc_price() 'If IsNumeric(tbFcPrice.value) And tbFcPrice.value <> 0 And IsNumeric(tbFcVol.value) And tbFcVol.value <> 0 Then - If IsNumeric(tbFcPrice.value) And IsNumeric(tbFcVol.value) And tbFcVol.value <> 0 Then - 'capture currently changed item - fVol = tbFcVol.value - fPrc = tbFcPrice.value - 'calc - fVal = fPrc * fVol - aVal = fVal - bVal - pVal - aVol = fVol - (bVol + pVol) - If nomonth Then - aPrc = fVal / fVol - bPrc - Else - If (bVol + pVol) = 0 Then - aPrc = 0 - Else - aPrc = fVal / fVol - ((bVal + pVal) / (bVol + pVol)) - End If - End If + 'If IsNumeric(tbFcPrice.value) And IsNumeric(tbFcVol.value) And tbFcVol.value <> 0 Then + + 'If IsNumeric(tbFcPrice.value) And IsNumeric(tbFcVol.value) Then + 'capture currently changed item + + fVol = co_num(tbFcVol.value, 0) + fPrc = co_num(tbFcPrice.value, 0) + 'calc + fVal = fPrc * fVol + aVal = fVal - bVal - pVal + aVol = fVol - (bVol + pVol) + + If (bVol + pVol) = 0 Then + aPrc = 0 Else - fVol = co_num(tbFcVol.value, 0) - fVal = 0 - aVal = fVal - bVal - pVal + 'aPrc = fVal / fVol - ((bVal + pVal) / (bVol + pVol)) + aPrc = fPrc - (bPrc + pPrc) End If + 'End If Me.load_mbox_ann 'build json Set adjust = JsonConverter.ParseJson("{""scenario"":" & scenario & "}") + adjust("scenario")("version") = "b20" + adjust("scenario")("iter") = handler.basis adjust("stamp") = Format(Date + time, "yyyy-mm-dd hh:mm:ss") adjust("user") = Application.UserName adjust("source") = "adj" + adjust("version") = "b20" + If opEditSales Then If opPlugVol Then adjust("type") = "scale_v" diff --git a/fpvt.frx b/fpvt.frx index a038d1d..2336bd4 100644 Binary files a/fpvt.frx and b/fpvt.frx differ