Compare commits

..

No commits in common. "988f72996a88a45dd4ebc948a2e5a293905d083a" and "3b3785dbd8d4249cd1755890a2e95172000bb97c" have entirely different histories.

6 changed files with 23 additions and 199 deletions

View File

@ -29,7 +29,7 @@ Private Sub cbUndo_Click()
For i = 0 To Me.lbHist.ListCount - 1
If Me.lbHist.Selected(i) Then
Call handler.undo_changes(x(i, 6), fail)
Call handler.undo_changes(x(i, 5), fail)
If fail Then
MsgBox ("undo did not work")
Exit Sub

Binary file not shown.

120
fpvt.frm
View File

@ -72,11 +72,6 @@ Private Sub butAdjust_Click()
Exit Sub
End If
If cbTAG.text = "" Then
MsgBox ("no tag was selected")
Exit Sub
End If
Call handler.request_adjust(JsonConverter.ConvertToJson(adjust), fail)
If fail Then
MsgBox ("adjustment was not made due to error")
@ -84,7 +79,6 @@ Private Sub butAdjust_Click()
End If
Me.tbCOM = ""
Me.cbTAG.text = ""
Me.Hide
@ -121,26 +115,12 @@ End Sub
Private Sub cbGoSheet_Click()
Worksheets("month").tbMCOM.text = ""
Worksheets("month").sbMPV.value = 0
Worksheets("month").sbMPP.value = 0
Me.Hide
Worksheets("month").Visible = xlSheetVisible
Sheets("month").Select
End Sub
Private Sub cbTAG_Change()
If tbAPI.text = "" Then tbAPI.text = "{}"
Set adjust = JsonConverter.ParseJson(tbAPI.text)
adjust("tag") = cbTAG.value
tbAPI.text = JsonConverter.ConvertToJson(adjust)
End Sub
Private Sub Label64_Click()
End Sub
@ -200,13 +180,6 @@ Private Sub opEditPrice_Click()
tbFcVol.Enabled = True
tbFcVol.BackColor = &H80000018
sbpv.Enabled = True
sbpp.Enabled = True
sbpd.Enabled = False
tbpv.Enabled = True
tbpp.Enabled = True
tbpd.Enabled = False
End Sub
Private Sub opEditSales_Click()
@ -223,13 +196,6 @@ Private Sub opEditSales_Click()
tbFcVol.Enabled = False
tbFcVol.BackColor = &H80000005
sbpv.Enabled = False
sbpp.Enabled = False
sbpd.Enabled = True
tbpv.Enabled = False
tbpp.Enabled = False
tbpd.Enabled = True
End Sub
@ -294,24 +260,6 @@ Private Sub opPlugVol_Click()
calc_val
End Sub
Private Sub sbpd_Change()
tbpd.value = sbpd.value
End Sub
Private Sub sbpp_Change()
tbpp.value = sbpp.value
End Sub
Private Sub sbpv_Change()
tbpv.value = sbpv.value
End Sub
Private Sub tbCOM_Change()
If tbAPI.text = "" Then tbAPI.text = "{}"
@ -329,10 +277,8 @@ Private Sub tbFcPrice_Change()
End Sub
Private Sub tbFcVal_Change()
If load_tb Then Exit Sub
If opEditSales Then calc_val
End Sub
Private Sub tbFcVol_Change()
@ -351,63 +297,25 @@ Private Sub opmVol_Click()
End Sub
Private Sub tbmfPrice_Change()
If mline = 0 Then Exit Sub
If clear_lb Or load_tb Then Exit Sub
set_Price = True
If opEditPriceM Then calc_mprice
set_Price = False
End Sub
Private Sub tbMFVal_Change()
If mline = 0 Then Exit Sub
If clear_lb Or load_tb Then Exit Sub
If opEditSalesM Then calc_mval
End Sub
Private Sub tbmfVol_Change()
If mline = 0 Then Exit Sub
If clear_lb Or load_tb Then Exit Sub
If opEditPriceM Then calc_mprice
End Sub
Private Sub tbpd_Change()
If load_tb Then Exit Sub
If Not VBA.IsNumeric(tbpd.value) Then
tbpd = "0"
End If
tbFcVal = (bVal + pVal) * (1 + tbpd.value / 100)
End Sub
Private Sub tbpp_Change()
If load_tb Then Exit Sub
If Not VBA.IsNumeric(tbpd.value) Then
tbpd = "0"
End If
tbFcPrice = (bPrc + pPrc) * (1 + tbpp.value / 100)
Me.load_mbox_ann
End Sub
Private Sub tbpv_Change()
If load_tb Then Exit Sub
If Not VBA.IsNumeric(tbpv.value) Then
tbpd = "0"
End If
tbFcVol = (bVol + pVol) * (1 + tbpv.value / 100)
End Sub
Private Sub UserForm_Activate()
@ -416,7 +324,6 @@ Private Sub UserForm_Activate()
Dim j As Long
Dim k As Long
Dim ok As Boolean
Dim tags() As Variant
Me.Caption = "Forecast Adjust " & Worksheets("config").Cells(8, 2)
Me.mp.Visible = False
@ -565,15 +472,6 @@ Private Sub UserForm_Activate()
basket(i, 3) = sp("package")("basket")(i)("mix")
Next i
If Not IsNull(sp("package")("tags")) Then
ReDim tags(sp("package")("tags").Count - 1, 0)
For i = 1 To sp("package")("tags").Count
tags(i - 1, 0) = sp("package")("tags")(i)
Next i
cbTAG.list = tags
Sheets("month").cbMTAG.list = tags
End If
Call handler.month_tosheet(month, basket)
Application.StatusBar = False
@ -663,19 +561,19 @@ Sub load_mbox()
tbMBaseVol = Format(bVolm, "#,###")
tbMBaseVal = Format(bValm, "#,###")
tbMBasePrice = Format(bPrcm, "0.00000")
tbMBasePrice = Format(bPrcm, "0.000")
tbMPAVol = Format(pVolm, "#,###")
tbmPAVal = Format(pValm, "#,###")
tbMPAPrice = Format(pPrcm, "0.00000")
tbMPAPrice = Format(pPrcm, "0.000")
tbMFVol = Format(fVolm, "#,###")
tbMFVal = Format(fValm, "#,###")
If Not set_Price Then tbMFPrice = Format(fPrcm, "0.#####")
If Not set_Price Then tbMFPrice = Format(fPrcm, "0.###")
tbMAVol = Format(aVolm, "#,###")
tbMAVal = Format(aValm, "#,###")
tbMAPrice = Format(aPrcm, "0.00000")
tbMAPrice = Format(aPrcm, "0.000")
load_tb = False
@ -687,19 +585,19 @@ Sub load_mbox_ann()
tbBaseVol = Format(bVol, "#,##0")
tbBaseVal = Format(bVal, "#,##0")
tbBasePrice = Format(bPrc, "0.00000")
tbBasePrice = Format(bPrc, "0.000")
tbPadjVol = Format(pVol, "#,##0")
tbPadjVal = Format(pVal, "#,##0")
tbPadjPrice = Format(pPrc, "0.00000")
tbPadjPrice = Format(pPrc, "0.000")
tbFcVol = Format(fVol, "#,##0")
tbFcVal = Format(fVal, "#,##0")
If Not set_Price Then tbFcPrice = Format(fPrc, "0.00000")
If Not set_Price Then tbFcPrice = Format(fPrc, "0.000")
tbAdjVol = Format(aVol, "#,##0")
tbAdjVal = Format(aVal, "#,##0")
tbAdjPrice = Format(aPrc, "0.00000")
tbAdjPrice = Format(aPrc, "0.000")
load_tb = False
@ -785,7 +683,6 @@ Sub calc_val()
adjust("user") = Application.UserName
adjust("source") = "adj"
adjust("message") = tbCOM.text
adjust("tag") = cbTAG.text
If opEditSales Then
If opPlugVol Then
adjust("type") = "scale_v"
@ -839,7 +736,6 @@ Sub calc_price()
adjust("user") = Application.UserName
adjust("source") = "adj"
adjust("message") = tbCOM.text
adjust("tag") = cbTAG.text
adjust("version") = handler.plan
If opEditSales Then

BIN
fpvt.frx

Binary file not shown.

View File

@ -137,8 +137,8 @@ Sub pg_main_workset(rep As String)
res(i, 28) = json("x")(i)("version")
res(i, 29) = json("x")(i)("iter")
res(i, 30) = json("x")(i)("logid")
res(i, 31) = json("x")(i)("tag")
res(i, 32) = json("x")(i)("comment")
res(i, 31) = json("x")(i)("comment")
res(i, 32) = json("x")(i)("module")
Next i
res(0, 0) = "bill_cust_descr"
@ -172,8 +172,8 @@ Sub pg_main_workset(rep As String)
res(0, 28) = "version"
res(0, 29) = "iter"
res(0, 30) = "logid"
res(0, 31) = "tag"
res(0, 32) = "comment"
res(0, 31) = "comment"
res(0, 32) = "module"
Set json = Nothing
@ -283,8 +283,8 @@ Function request_adjust(doc As String, ByRef fail As Boolean) As Object
res(i - 1, 28) = json("x")(i)("version")
res(i - 1, 29) = json("x")(i)("iter")
res(i - 1, 30) = json("x")(i)("logid")
res(i - 1, 31) = json("x")(i)("tag")
res(i - 1, 32) = json("x")(i)("comment")
res(i - 1, 31) = json("x")(i)("comment")
res(i - 1, 32) = json("x")(i)("module")
Next i
Set json = Nothing
@ -505,17 +505,16 @@ Function list_changes(doc As String, ByRef fail As Boolean) As Variant()
Exit Function
End If
ReDim res(json("x").Count - 1, 7)
ReDim res(json("x").Count - 1, 6)
For i = 0 To UBound(res, 1)
res(i, 0) = json("x")(i + 1)("user")
res(i, 1) = json("x")(i + 1)("quota_rep_descr")
res(i, 2) = json("x")(i + 1)("stamp")
res(i, 3) = json("x")(i + 1)("tag")
res(i, 4) = json("x")(i + 1)("comment")
res(i, 5) = json("x")(i + 1)("sales")
res(i, 6) = json("x")(i + 1)("id")
res(i, 7) = json("x")(i + 1)("def")
res(i, 3) = json("x")(i + 1)("comment")
res(i, 4) = json("x")(i + 1)("sales")
res(i, 5) = json("x")(i + 1)("id")
res(i, 6) = json("x")(i + 1)("def")
Next i
list_changes = res

View File

@ -29,66 +29,6 @@ Private showbasket As Boolean
Private np As Object 'json dedicated to new part scenario
Private b() As Variant 'holds basket
Private Sub cbMTAG_Change()
End Sub
Private Sub sbMPP_Change()
Dim m As Worksheet
Dim i As Long
Application.ScreenUpdating = False
dumping = True
Set m = Sheets("month")
m.Cells(19, 11) = sbMPP.value / 100
For i = 6 To 17
m.Cells(i, 11) = (m.Cells(i, 9)) * m.Cells(19, 11)
Next i
Me.mvp_adj
dumping = False
Application.ScreenUpdating = True
End Sub
Private Sub sbMPV_Change()
Dim m As Worksheet
Dim i As Long
Application.ScreenUpdating = False
dumping = True
Set m = Sheets("month")
m.Cells(19, 5) = sbMPV.value / 100
For i = 6 To 17
If m.Cells(i, 5) <> "" Then
m.Cells(i, 5) = (m.Cells(i, 3)) * m.Cells(19, 5)
End If
Next i
dumping = False
Call Me.mvp_adj
Application.ScreenUpdating = True
End Sub
Private Sub tbMCOM_Change()
End Sub
Private Sub Worksheet_Change(ByVal target As Range)
If Not dumping Then
@ -573,8 +513,7 @@ Sub build_json()
adjust(pos)("type") = "addmonth_vp"
Else
'if the target price is the same as average and a month is being added
'--ignore above comment and always use add month_vp
adjust(pos)("type") = "addmonth_vp"
adjust(pos)("type") = "addmonth_v"
End If
adjust(pos)("month") = Worksheets("month").Cells(5 + pos, 1)
adjust(pos)("qty") = units(pos, 4)
@ -847,24 +786,14 @@ Sub post_adjust()
Dim i As Long
Dim fail As Boolean
Dim adjust As Object
Dim jdoc As String
If Me.newpart Then
Set adjust = JsonConverter.ParseJson(Sheets("_month").Cells(2, 16))
adjust("message") = Me.tbMCOM.text
adjust("tag") = Me.cbMTAG.text
jdoc = JsonConverter.ConvertToJson(adjust)
Call handler.request_adjust(jdoc, fail)
Call handler.request_adjust(Sheets("_month").Cells(2, 16), fail)
If fail Then Exit Sub
Else
For i = 2 To 13
If Sheets("_month").Cells(i, 16) <> "" Then
Set adjust = JsonConverter.ParseJson(Sheets("_month").Cells(i, 16))
adjust("message") = Me.tbMCOM.text
adjust("tag") = Me.cbMTAG.text
jdoc = JsonConverter.ConvertToJson(adjust)
Call handler.request_adjust(jdoc, fail)
Call handler.request_adjust(Sheets("_month").Cells(i, 16), fail)
If fail Then Exit Sub
End If
Next i