add version and iter to price_calc json build; deal with non-numeric input
This commit is contained in:
parent
c38e262733
commit
111121a801
29
fpvt.frm
29
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
|
||||
'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 = tbFcVol.value
|
||||
fPrc = tbFcPrice.value
|
||||
|
||||
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 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
|
||||
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"
|
||||
|
Loading…
Reference in New Issue
Block a user