add rounding, increment year, dont hardcode plan

This commit is contained in:
Paul Trowbridge 2020-02-13 02:23:13 -05:00
parent 44ef2f5dc5
commit 3c646b3a8d
3 changed files with 10 additions and 7 deletions

View File

@ -345,7 +345,7 @@ Private Sub UserForm_Activate()
For i = 1 To sp("package")("totals").Count For i = 1 To sp("package")("totals").Count
Select Case sp("package")("totals")(i)("order_season") Select Case sp("package")("totals")(i)("order_season")
Case 2020 Case 2021
Select Case Me.iter_def(sp("package")("totals")(i)("iter")) Select Case Me.iter_def(sp("package")("totals")(i)("iter"))
Case "baseline" Case "baseline"
bVol = bVol + sp("package")("totals")(i)("units") bVol = bVol + sp("package")("totals")(i)("units")
@ -657,7 +657,7 @@ Sub calc_val()
'build json 'build json
Set adjust = JsonConverter.ParseJson("{""scenario"":" & scenario & "}") Set adjust = JsonConverter.ParseJson("{""scenario"":" & scenario & "}")
adjust("scenario")("version") = "b20" adjust("scenario")("version") = handler.plan
adjust("scenario")("iter") = handler.basis 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
@ -709,12 +709,12 @@ Sub calc_price()
'build json 'build json
Set adjust = JsonConverter.ParseJson("{""scenario"":" & scenario & "}") Set adjust = JsonConverter.ParseJson("{""scenario"":" & scenario & "}")
adjust("scenario")("version") = "b20" adjust("scenario")("version") = handler.plan
adjust("scenario")("iter") = handler.basis 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" adjust("version") = handler.plan
If opEditSales Then If opEditSales Then
If opPlugVol Then If opPlugVol Then
@ -779,7 +779,7 @@ Sub calc_mval()
'build json 'build json
Set j = JsonConverter.ParseJson("{""scenario"":" & scenario & "}") Set j = JsonConverter.ParseJson("{""scenario"":" & scenario & "}")
j("scenario")("version") = "b20" j("scenario")("version") = handler.plan
j("scenario")("iter") = handler.basis j("scenario")("iter") = handler.basis
j("stamp") = Format(Date + time, "yyyy-mm-dd hh:mm:ss") j("stamp") = Format(Date + time, "yyyy-mm-dd hh:mm:ss")
j("user") = Application.UserName j("user") = Application.UserName
@ -848,7 +848,7 @@ Sub calc_mprice()
'build json 'build json
Set j = JsonConverter.ParseJson("{""scenario"":" & scenario & "}") Set j = JsonConverter.ParseJson("{""scenario"":" & scenario & "}")
j("scenario")("version") = "b20" j("scenario")("version") = handler.plan
j("scenario")("iter") = handler.basis j("scenario")("iter") = handler.basis
j("stamp") = Format(Date + time, "yyyy-mm-dd hh:mm:ss") j("stamp") = Format(Date + time, "yyyy-mm-dd hh:mm:ss")
j("user") = Application.UserName j("user") = Application.UserName

BIN
fpvt.frx

Binary file not shown.

View File

@ -11,6 +11,7 @@ Public data() As String
Public agg() As String Public agg() As String
Public showprice As Boolean Public showprice As Boolean
Public server As String Public server As String
Public plan As String
Public basis() As Variant Public basis() As Variant
Public baseline() As Variant Public baseline() As Variant
Public adjust() As Variant Public adjust() As Variant
@ -346,6 +347,8 @@ Sub load_config()
i = i + 1 i = i + 1
Loop Loop
ReDim Preserve handler.adjust(j - 1) ReDim Preserve handler.adjust(j - 1)
'---plan version--------------------------------------------------------------
handler.plan = Sheets("config").Cells(9, 2)
End Sub End Sub
@ -406,7 +409,7 @@ Sub month_tosheet(ByRef pkg() As Variant, ByRef basket() As Variant)
If (pkg(i, 3) + pkg(i, 2)) = 0 Or pkg(i, 2) = 0 Then If (pkg(i, 3) + pkg(i, 2)) = 0 Or pkg(i, 2) = 0 Then
sh.Cells(i + 1, 8) = 0 sh.Cells(i + 1, 8) = 0
Else Else
sh.Cells(i + 1, 8) = (pkg(i, 7) + pkg(i, 6)) / (pkg(i, 3) + pkg(i, 2)) - (pkg(i, 6) / pkg(i, 2)) sh.Cells(i + 1, 8) = (Round(pkg(i, 7), 10) + Round(pkg(i, 6), 10)) / (Round(pkg(i, 3), 10) + Round(pkg(i, 2), 10)) - (Round(pkg(i, 6), 10) / Round(pkg(i, 2), 10))
End If End If
'--current adjust-- '--current adjust--