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
|
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
|
co_num = two
|
||||||
Else
|
Else
|
||||||
co_num = one
|
co_num = one
|
||||||
@ -678,36 +678,37 @@ End Sub
|
|||||||
Sub calc_price()
|
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 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
|
'capture currently changed item
|
||||||
fVol = tbFcVol.value
|
|
||||||
fPrc = tbFcPrice.value
|
fVol = co_num(tbFcVol.value, 0)
|
||||||
|
fPrc = co_num(tbFcPrice.value, 0)
|
||||||
'calc
|
'calc
|
||||||
fVal = fPrc * fVol
|
fVal = fPrc * fVol
|
||||||
aVal = fVal - bVal - pVal
|
aVal = fVal - bVal - pVal
|
||||||
aVol = fVol - (bVol + pVol)
|
aVol = fVol - (bVol + pVol)
|
||||||
If nomonth Then
|
|
||||||
aPrc = fVal / fVol - bPrc
|
|
||||||
Else
|
|
||||||
If (bVol + pVol) = 0 Then
|
If (bVol + pVol) = 0 Then
|
||||||
aPrc = 0
|
aPrc = 0
|
||||||
Else
|
Else
|
||||||
aPrc = fVal / fVol - ((bVal + pVal) / (bVol + pVol))
|
'aPrc = fVal / fVol - ((bVal + pVal) / (bVol + pVol))
|
||||||
End If
|
aPrc = fPrc - (bPrc + pPrc)
|
||||||
End If
|
|
||||||
Else
|
|
||||||
fVol = co_num(tbFcVol.value, 0)
|
|
||||||
fVal = 0
|
|
||||||
aVal = fVal - bVal - pVal
|
|
||||||
End If
|
End If
|
||||||
|
'End If
|
||||||
|
|
||||||
Me.load_mbox_ann
|
Me.load_mbox_ann
|
||||||
|
|
||||||
'build json
|
'build json
|
||||||
Set adjust = JsonConverter.ParseJson("{""scenario"":" & scenario & "}")
|
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("stamp") = Format(Date + time, "yyyy-mm-dd hh:mm:ss")
|
||||||
adjust("user") = Application.UserName
|
adjust("user") = Application.UserName
|
||||||
adjust("source") = "adj"
|
adjust("source") = "adj"
|
||||||
|
adjust("version") = "b20"
|
||||||
|
|
||||||
If opEditSales Then
|
If opEditSales Then
|
||||||
If opPlugVol Then
|
If opPlugVol Then
|
||||||
adjust("type") = "scale_v"
|
adjust("type") = "scale_v"
|
||||||
|
Loading…
Reference in New Issue
Block a user