This commit is contained in:
Paul Trowbridge 2024-09-24 09:29:02 -04:00
parent 40b02b2bc5
commit 5fe9056aac
2 changed files with 20 additions and 18 deletions

23
FL.bas
View File

@ -381,7 +381,8 @@ Sub json_from_table()
Selection.CurrentRegion.Select
tbl = Selection
Call wapi.ClipBoard_SetData(x.json_from_table(tbl, "y", False))
Call wapi.ClipBoard_SetData(x.json_from_table(tbl, ""))
End Sub
@ -1676,7 +1677,7 @@ Sub pricegroup_upload()
'---------------------------postgres------------------------------
sql = x.SQLp_build_sql_values(x.ARRAYp_get_range_string(Selection), True, True, PostgreSQL, False, True, "S", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S", "A", "A", "J", "S")
sql = x.SQLp_build_sql_values(x.ARRAYp_get_range_string(Selection), True, True, PostgreSQL, False, True, "S", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S", "A", "A", "J", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S")
sql = "BEGIN;" & vbCrLf & "DELETE FROM rlarp.price_map;" & vbCrLf & "INSERT INTO rlarp.price_map" & vbCrLf & sql & ";"
sql = sql & vbCrLf & "REFRESH MATERIALIZED VIEW rlarp.molds;"
sql = sql & vbCrLf & "COMMIT;"
@ -1690,11 +1691,17 @@ Sub pricegroup_upload()
Call x.ADOp_CloseCon(0)
'Exit Sub
'---------------------------iSeries------------------------------
Call pricegroup_upload_db2
MsgBox ("Upload Complete")
Exit Sub
'---------------------------sql server------------------------------
sql = x.SQLp_build_sql_values(x.ARRAYp_get_range_string(Selection), True, True, PostgreSQL, False, True, "S", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S", "A", "A", "A", "S")
sql = x.SQLp_build_sql_values(x.ARRAYp_get_range_string(Selection), True, True, PostgreSQL, False, True, "S", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S", "A", "A", "A", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S")
sql = "BEGIN" & vbCrLf & "DELETE FROM rlarp.price_map;" & vbCrLf & "INSERT INTO rlarp.price_map" & vbCrLf & sql & ";" & vbCrLf & "END"
If Not x.ADOp_Exec(1, sql, 1, True, ADOinterface.SqlServer, "usmidsql01", True) Then
@ -1707,12 +1714,6 @@ Sub pricegroup_upload()
Set x = Nothing
'---------------------------iSeries------------------------------
Call pricegroup_upload_db2
MsgBox ("Upload Complete")
End Sub
Sub pricegroup_upload_db2()
@ -1750,7 +1751,7 @@ Sub pricegroup_upload_db2()
inc = 250
Do While i <= UBound(ul, 2)
'sql = x.ADOp_BuildInsertSQL(ul, "rlarp.price_map", True, i, WorksheetFunction.Min(i + inc, UBound(ul, 2)), Array("S", "S", "S", "S", "S", "S", "S", "N", "S", "S"))
sql = x.SQLp_build_sql_values_ranged(ul, False, True, Db2, False, True, i, i + inc, "S", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S", "A", "A", "A", "S")
sql = x.SQLp_build_sql_values_ranged(ul, False, True, Db2, False, True, i, i + inc, "S", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S", "A", "A", "A", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S")
sql = "INSERT INTO rlarp.price_map " & vbCrLf & sql
If Not x.ADOp_Exec(0, sql) Then
MsgBox (x.ADOo_errstring)

View File

@ -43,7 +43,7 @@ Sub test_full20()
login.Show
If Not login.proceed Then Exit Sub
If Not x.ADOp_OpenCon(0, PostgreSQLODBC, "10.56.60.254", False, login.tbU.text, login.tbP.text, "Port=5432;Database=ubm") Then
If Not x.ADOp_OpenCon(0, PostgreSQLODBC, "usmidsap02", False, login.tbU.text, login.tbP.text, "Port=5432;Database=ubm") Then
MsgBox ("not able to connect to CMS" & vbCrLf & x.ADOo_errstring)
Exit Sub
End If
@ -251,7 +251,7 @@ Sub price_load_plcore()
login.Show
If Not login.proceed Then Exit Sub
If Not x.ADOp_Exec(0, sql, 1, True, PostgreSQLODBC, "10.56.60.254", False, login.tbU, login.tbP, "Port=5432;Database=ubm") Then
If Not x.ADOp_Exec(0, sql, 1, True, PostgreSQLODBC, "usmidsap02", False, login.tbU, login.tbP, "Port=5432;Database=ubm") Then
MsgBox (x.ADOo_errstring)
Exit Sub
End If
@ -548,12 +548,13 @@ Sub build_price_level(plev As String)
'---------------------create new workbook-------------------------------------------------------------------
Set nwb = Application.Workbooks.Add
nwb.Activate
nwb.ApplyTheme ("C:\Users\ptrowbridge\AppData\Roaming\Microsoft\Templates\Document Themes\Theme1.thmx")
Set nws = nwb.Sheets(1)
segment_regex = "^G|^N|^F|^P"
'---------------------get price list------------------------------------------------------------------------
If pricelevel.chbNURSERY Then
pln = x.ADOp_SelectS(0, "SELECT * FROM rlarp.plcore_build_pretty('" & plev & "', '^N')", False, 2000, True, PostgreSQLODBC, "usmidsap01", False, login.tbU.text, login.tbP.text, "Port=5432;Database=ubm")
pln = x.ADOp_SelectS(0, "SELECT * FROM rlarp.plcore_build_pretty('" & plev & "', '^N')", False, 2000, True, PostgreSQLODBC, "usmidsap02", False, login.tbU.text, login.tbP.text, "Port=5432;Database=ubm")
If pln(0, 0) <> "Product" Then
MsgBox (pln(0, 0))
Exit Sub
@ -567,7 +568,7 @@ Sub build_price_level(plev As String)
End If
If pricelevel.chbFIBER Then
plf = x.ADOp_SelectS(0, "SELECT * FROM rlarp.plcore_build_pretty('" & plev & "','^F')", False, 2000, True, PostgreSQLODBC, "usmidsap01", False, login.tbU.text, login.tbP.text, "Port=5432;Database=ubm")
plf = x.ADOp_SelectS(0, "SELECT * FROM rlarp.plcore_build_pretty('" & plev & "','^F')", False, 2000, True, PostgreSQLODBC, "usmidsap02", False, login.tbU.text, login.tbP.text, "Port=5432;Database=ubm")
If plf(0, 0) <> "Product" Then
MsgBox (plf(0, 0))
Exit Sub
@ -584,7 +585,7 @@ Sub build_price_level(plev As String)
End If
End If
pl = x.ADOp_SelectS(0, "SELECT * FROM rlarp.plcore_build_pretty('" & plev & "','" & segment_regex & "')", False, 2000, True, PostgreSQLODBC, "usmidsap01", False, login.tbU.text, login.tbP.text, "Port=5432;Database=ubm")
pl = x.ADOp_SelectS(0, "SELECT * FROM rlarp.plcore_build_pretty('" & plev & "','" & segment_regex & "')", False, 2000, True, PostgreSQLODBC, "usmidsap02", False, login.tbU.text, login.tbP.text, "Port=5432;Database=ubm")
If pl(0, 0) <> "Product" Then
MsgBox (pl(0, 0))
Exit Sub
@ -644,7 +645,7 @@ Sub build_price_level(plev As String)
'--------------------get full code list-----------------------------
If pricelevel.chbFULLCODE Then
'---------------------get full code list--------------------------------------------------------------------
fc = x.ADOp_SelectS(0, "SELECT * FROM rlarp.plcore_build_fullcode_cust('" & plev & "', '" & effdate & "'::date)", False, 20000, True, PostgreSQLODBC, "10.56.60.254", False, login.tbU.text, login.tbP.text, "Port=5432;Database=ubm")
fc = x.ADOp_SelectS(0, "SELECT * FROM rlarp.plcore_build_fullcode_cust('" & plev & "', '" & effdate & "'::date)", False, 20000, True, PostgreSQLODBC, "usmidsap02", False, login.tbU.text, login.tbP.text, "Port=5432;Database=ubm")
If fc(0, 0) <> "Currency" Then
MsgBox (fc(0, 0))
Exit Sub