diff --git a/FL.bas b/FL.bas index e0ee11c..814696b 100644 --- a/FL.bas +++ b/FL.bas @@ -1240,7 +1240,7 @@ Sub extract_price_matrix_r2() tbl = Selection If UBound(tbl, 1) < 2 Then error = "selection is not a valid price matrix" - If UBound(tbl, 2) < 9 Then error = "selection is not a valid price matrix" + If UBound(tbl, 2) <> 8 Then error = "selection is not a valid price matrix" If Not error = "" Then MsgBox (error) @@ -1254,7 +1254,7 @@ Sub extract_price_matrix_r2() Dim k As Long Dim m As Long k = 0 - ReDim unp(9, (UBound(tbl, 1) - 1) * 3) + ReDim unp(8, (UBound(tbl, 1) - 1) * 3) 'iterate through rows For i = 2 To UBound(tbl, 1) '3 iterations per row @@ -1265,24 +1265,24 @@ Sub extract_price_matrix_r2() unp(1, k) = tbl(i, 2) 'color tier unp(2, k) = tbl(i, 3) 'branding unp(3, k) = tbl(i, 4) 'kit - unp(4, k) = tbl(i, 5) 'suffix - unp(5, k) = tbl(i, 6) 'container - unp(6, k) = m + 1 'volume break - unp(7, k) = tbl(i, 7 + m) 'price - unp(8, k) = i 'orig row - unp(9, k) = 7 + m 'orig col + 'unp(4, k) = tbl(i, 5) 'suffix + unp(4, k) = tbl(i, 5) 'container + unp(5, k) = m + 1 'volume break + unp(6, k) = tbl(i, 6 + m) 'price + unp(7, k) = i 'orig row + unp(8, k) = 6 + m 'orig col Next m Next i unp(0, 0) = "stlc" unp(1, 0) = "coltier" unp(2, 0) = "branding" - unp(3, 0) = "kit" - unp(4, 0) = "suffix" - unp(5, 0) = "container" - unp(6, 0) = "volume" - unp(7, 0) = "price" - unp(8, 0) = "orig_row" - unp(9, 0) = "orig_col" + unp(3, 0) = "accs" + 'unp(4, 0) = "suffix" + unp(4, 0) = "container" + unp(5, 0) = "volume" + unp(6, 0) = "price" + unp(7, 0) = "orig_row" + unp(8, 0) = "orig_col" If Not x.TBLp_TestNumeric(unp, 7) Then @@ -1297,11 +1297,11 @@ Sub extract_price_matrix_r2() 'sql = x.SQLp_build_sql_values(unp, False, True, Db2, False) sql = x.json_from_table(unv, "", False) - sql = "SELECT * FROM rlarp.build_pricelist_r1($$" & sql & "$$::jsonb)" + sql = "SELECT * FROM rlarp.build_f20($$" & sql & "$$::jsonb)" Call wapi.ClipBoard_SetData(sql) 'If MsgBox(sql, vbOKCancel, "continue with build?") = vbCancel Then Exit Sub - + 'Exit Sub login.Show If Not login.proceed Then Exit Sub @@ -1363,21 +1363,21 @@ Sub extract_price_matrix_r2() j = 0 For i = 1 To UBound(cms_pl, 1) - Select Case cms_pl(i, 15) + Select Case cms_pl(i, 14) Case "" - orig.Worksheet.Cells(orig.row + cms_pl(i, 13) - 1, orig.column + cms_pl(i, 14) - 1).Interior.ThemeColor = xlThemeColorAccent6 + orig.Worksheet.Cells(orig.row + cms_pl(i, 12) - 1, orig.column + cms_pl(i, 13) - 1).Interior.ThemeColor = xlThemeColorAccent6 Case "no unit conversion" - If orig.Worksheet.Cells(orig.row + cms_pl(i, 13) - 1, orig.column + cms_pl(i, 14) - 1).Interior.ThemeColor <> xlThemeColorAccent6 Then - orig.Worksheet.Cells(orig.row + cms_pl(i, 13) - 1, orig.column + cms_pl(i, 14) - 1).Interior.Color = RGB(255, 255, 161) + If orig.Worksheet.Cells(orig.row + cms_pl(i, 12) - 1, orig.column + cms_pl(i, 13) - 1).Interior.ThemeColor <> xlThemeColorAccent6 Then + orig.Worksheet.Cells(orig.row + cms_pl(i, 12) - 1, orig.column + cms_pl(i, 13) - 1).Interior.Color = RGB(255, 255, 161) End If Case "no part number" - If orig.Worksheet.Cells(orig.row + cms_pl(i, 13) - 1, orig.column + cms_pl(i, 14) - 1).Interior.ThemeColor <> xlThemeColorAccent6 Then - orig.Worksheet.Cells(orig.row + cms_pl(i, 13) - 1, orig.column + cms_pl(i, 14) - 1).Interior.Color = RGB(255, 255, 161) + If orig.Worksheet.Cells(orig.row + cms_pl(i, 12) - 1, orig.column + cms_pl(i, 13) - 1).Interior.ThemeColor <> xlThemeColorAccent6 Then + orig.Worksheet.Cells(orig.row + cms_pl(i, 12) - 1, orig.column + cms_pl(i, 13) - 1).Interior.Color = RGB(255, 255, 161) End If End Select 'if the current row/column is OK, advance to the next row/column j = 0 - Do Until cms_pl(i, 13) <> cms_pl(i + j, 13) Or cms_pl(i, 14) <> cms_pl(i + j, 14) + Do Until cms_pl(i, 12) <> cms_pl(i + j, 12) Or cms_pl(i, 13) <> cms_pl(i + j, 13) j = j + 1 If i + j >= UBound(cms_pl, 1) Then Exit Do Loop @@ -1403,7 +1403,7 @@ Sub extract_price_matrix_r2() Selection.Columns(3).Interior.Pattern = xlNone Selection.Columns(4).Interior.Pattern = xlNone Selection.Columns(5).Interior.Pattern = xlNone - Selection.Columns(6).Interior.Pattern = xlNone + 'Selection.Columns(6).Interior.Pattern = xlNone Selection.Rows(1).Interior.Pattern = xlNone