add version and iter to price_calc json build; deal with non-numeric input
This commit is contained in:
parent
c38e262733
commit
111121a801
43
fpvt.frm
43
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
|
||||||
'capture currently changed item
|
|
||||||
fVol = tbFcVol.value
|
'If IsNumeric(tbFcPrice.value) And IsNumeric(tbFcVol.value) Then
|
||||||
fPrc = tbFcPrice.value
|
'capture currently changed item
|
||||||
'calc
|
|
||||||
fVal = fPrc * fVol
|
fVol = co_num(tbFcVol.value, 0)
|
||||||
aVal = fVal - bVal - pVal
|
fPrc = co_num(tbFcPrice.value, 0)
|
||||||
aVol = fVol - (bVol + pVol)
|
'calc
|
||||||
If nomonth Then
|
fVal = fPrc * fVol
|
||||||
aPrc = fVal / fVol - bPrc
|
aVal = fVal - bVal - pVal
|
||||||
Else
|
aVol = fVol - (bVol + pVol)
|
||||||
If (bVol + pVol) = 0 Then
|
|
||||||
aPrc = 0
|
If (bVol + pVol) = 0 Then
|
||||||
Else
|
aPrc = 0
|
||||||
aPrc = fVal / fVol - ((bVal + pVal) / (bVol + pVol))
|
|
||||||
End If
|
|
||||||
End If
|
|
||||||
Else
|
Else
|
||||||
fVol = co_num(tbFcVol.value, 0)
|
'aPrc = fVal / fVol - ((bVal + pVal) / (bVol + pVol))
|
||||||
fVal = 0
|
aPrc = fPrc - (bPrc + pPrc)
|
||||||
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