monthly comments and tags

This commit is contained in:
pt 2020-02-18 02:07:38 -05:00
parent 3b3785dbd8
commit 501fa5f4e6
5 changed files with 152 additions and 11 deletions

View File

@ -39,8 +39,6 @@ Private Sub cbUndo_Click()
Sheets("Orders").PivotTables("PivotTable1").PivotCache.Refresh
Me.Hide
End Sub

Binary file not shown.

111
fpvt.frm
View File

@ -115,12 +115,26 @@ 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
@ -180,6 +194,13 @@ 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()
@ -196,6 +217,13 @@ 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
@ -260,6 +288,24 @@ 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 = "{}"
@ -277,8 +323,10 @@ 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()
@ -297,25 +345,63 @@ 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()
@ -324,6 +410,7 @@ 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
@ -472,6 +559,14 @@ 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
End If
Call handler.month_tosheet(month, basket)
Application.StatusBar = False
@ -561,19 +656,19 @@ Sub load_mbox()
tbMBaseVol = Format(bVolm, "#,###")
tbMBaseVal = Format(bValm, "#,###")
tbMBasePrice = Format(bPrcm, "0.000")
tbMBasePrice = Format(bPrcm, "0.00000")
tbMPAVol = Format(pVolm, "#,###")
tbmPAVal = Format(pValm, "#,###")
tbMPAPrice = Format(pPrcm, "0.000")
tbMPAPrice = Format(pPrcm, "0.00000")
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.000")
tbMAPrice = Format(aPrcm, "0.00000")
load_tb = False
@ -585,19 +680,19 @@ Sub load_mbox_ann()
tbBaseVol = Format(bVol, "#,##0")
tbBaseVal = Format(bVal, "#,##0")
tbBasePrice = Format(bPrc, "0.000")
tbBasePrice = Format(bPrc, "0.00000")
tbPadjVol = Format(pVol, "#,##0")
tbPadjVal = Format(pVal, "#,##0")
tbPadjPrice = Format(pPrc, "0.000")
tbPadjPrice = Format(pPrc, "0.00000")
tbFcVol = Format(fVol, "#,##0")
tbFcVal = Format(fVal, "#,##0")
If Not set_Price Then tbFcPrice = Format(fPrc, "0.000")
If Not set_Price Then tbFcPrice = Format(fPrc, "0.00000")
tbAdjVol = Format(aVol, "#,##0")
tbAdjVal = Format(aVal, "#,##0")
tbAdjPrice = Format(aPrc, "0.000")
tbAdjPrice = Format(aPrc, "0.00000")
load_tb = False

BIN
fpvt.frx

Binary file not shown.

View File

@ -29,6 +29,53 @@ Private showbasket As Boolean
Private np As Object 'json dedicated to new part scenario
Private b() As Variant 'holds basket
Private Sub SpinButton1_Change()
End Sub
Private Sub ComboBox1_Change()
End Sub
Private Sub sbMPP_Change()
Dim m As Worksheet
Dim i As Long
Application.ScreenUpdating = False
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
Application.ScreenUpdating = True
End Sub
Private Sub sbMPV_Change()
Dim m As Worksheet
Dim i As Long
Application.ScreenUpdating = False
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
Application.ScreenUpdating = True
End Sub
Private Sub tbMCOM_Change()
End Sub
Private Sub Worksheet_Change(ByVal target As Range)
If Not dumping Then
@ -513,7 +560,8 @@ Sub build_json()
adjust(pos)("type") = "addmonth_vp"
Else
'if the target price is the same as average and a month is being added
adjust(pos)("type") = "addmonth_v"
'--ignore above comment and always use add month_vp
adjust(pos)("type") = "addmonth_vp"
End If
adjust(pos)("month") = Worksheets("month").Cells(5 + pos, 1)
adjust(pos)("qty") = units(pos, 4)