From 111121a801db005787861cd65dbd1595174f4abd Mon Sep 17 00:00:00 2001 From: Paul Trowbridge Date: Mon, 25 Mar 2019 16:41:56 -0400 Subject: [PATCH] add version and iter to price_calc json build; deal with non-numeric input --- fpvt.frm | 43 ++++++++++++++++++++++--------------------- fpvt.frx | Bin 19992 -> 19992 bytes 2 files changed, 22 insertions(+), 21 deletions(-) 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 a038d1d903d1f79006c6040f127f0c7a2ad00db2..2336bd42e0901cf62a4b7d3fa49febae8d18c89c 100644 GIT binary patch delta 895 zcmZ8eTSyd97(QoaH5b#!G_UEXn0vu-c6BfA>h2ica(7+3pg~}*7h2oPY;7wo6xM?e z`%({|hK7MXL@yG-KwuHwULqnYf-dwDK^Q>@y;$_nnavV>m^1%;{NLq#GrvgZ7wK)0 z`WG9C$=OlYlyxmS&*InA!?>bpHtYivW<`n0VRGW98IsNOQj#VEyPU479#YO zTM#u<`C~KGMuI(?3H~Db>Me+xseVkU0>3cAE{SEKfrjx~Smzv3Jg@c80P^dqDS@f( zAx;{tsH!*Nk}((l`f2#Y0=%m)qD1{xAJl1#c7us_;e^3VQ-Hz16DB$BD92j^SfLT4 zLr2K79K<<+lcIQPbWuAjx)Qa_)S{yy_(jbsA~tGKX2k=1Y(m7Uc!(znYgT8t`2o`j zdfd3`l-W~-xUB_xuM?l726!yZ`Ju2f6pE%MLQFyMRpW|9(tcvXXTo<^Bg(A`bI4e) z@qvLATyHN{J6g_C#B62=l1QBhwjE=dg67igU}v-UAj<7y`0dqW#$LgiTCxvQMP0Xh zDB_YADW}YbMkgS7hS>TJTMedIw0N5gu{*-GN~m-l&5e?&L^Or9(kjRn0nVNhcH0-O z49hZTuSMFO&!!poDV``q{psFIS*JqBSBg;gaZGyeusQ{Kh$kt6v}|U(H)NC6(JR@+ zKF&GrvM8f!*}gdrv9`{vd)yYmLib_BTu1aI5F9)`IW|GmfgU5(i0R&}O0PzL+53S( z>T+Kl#enA?I=v0Zwd_L3(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