Compare commits
123 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| c4d8bf8f4d | |||
| 465c1386c1 | |||
| cb47ddd837 | |||
| fa3dd9096a | |||
| 62374b7b20 | |||
| eeb2fd8eba | |||
| ee5418c860 | |||
| 722fa429fb | |||
| 14c43eec3c | |||
| 3be3aab2b1 | |||
| c58ce9ea0d | |||
| 5385deaae8 | |||
| d9513aa891 | |||
| 84d09c4b83 | |||
| 7bad7774eb | |||
| dcbc55b037 | |||
| 189bc6a782 | |||
| b3e06fec14 | |||
| 2cf2e6efc4 | |||
| 1ace825974 | |||
| e1b19482db | |||
| 044e605dd4 | |||
| 76a0f49450 | |||
| 2815e25802 | |||
| 787bf1c3d5 | |||
| 39ed186bca | |||
| e859162b16 | |||
| 1a2659d86a | |||
| 57cce232c5 | |||
| d365e71f12 | |||
| 2a98de83d1 | |||
| 45020fb23f | |||
| 2414841cd5 | |||
| 685f75ffe8 | |||
| e54b42bc83 | |||
| ce2fe219f4 | |||
| fb749ffde5 | |||
| 2ffb052722 | |||
| 1db8e4c8eb | |||
| 66af258d7b | |||
| 1990d69196 | |||
| da287484cd | |||
| e87caff7f6 | |||
| efba5e2a6d | |||
| f0c8fe4de9 | |||
| db3dc8bc73 | |||
| 77e1fc1f55 | |||
| 6c41a4e928 | |||
| 7c5c0b1134 | |||
| 2d24c9e0e5 | |||
| c46402c1cb | |||
| aa8367e6e7 | |||
| a5546ecea7 | |||
| 89223b09dd | |||
| 92f14f5726 | |||
| 4af21a1d65 | |||
| d2f5f6bc51 | |||
| f54081f69d | |||
| eaba629002 | |||
| 4f675a62a3 | |||
| c265917a56 | |||
| aa50440ec5 | |||
| 57adefbd4b | |||
| 4edd2aee40 | |||
| 1434021bfe | |||
| dde2e8d581 | |||
| f2f4dcedae | |||
| 6b76d9d935 | |||
| 2941e0f3a4 | |||
| 2a6419b386 | |||
| b7309bb3f3 | |||
| 8fc5d0e689 | |||
| d9e78e285f | |||
|
|
025b3b8c12 | ||
|
|
5033b753ff | ||
|
|
44dd489377 | ||
|
|
5b1333b8c1 | ||
|
|
2df666a44f | ||
|
|
2c46764be2 | ||
|
|
1505221961 | ||
|
|
1cf13e4f57 | ||
|
|
ae6b21b197 | ||
|
|
9933e66c77 | ||
|
|
22c2375f44 | ||
|
|
2454393a1d | ||
|
|
c7789f868c | ||
|
|
aa13911c02 | ||
|
|
4c1584af3d | ||
|
|
241994cb56 | ||
|
|
b73403aef7 | ||
|
|
b10a3ac655 | ||
|
|
a821f15c32 | ||
|
|
f70a733624 | ||
|
|
aabbf8210b | ||
|
|
337f5425e2 | ||
|
|
f8f1433546 | ||
|
|
cc7726758b | ||
|
|
e87c0ecc62 | ||
|
|
3fa2cb07f5 | ||
|
|
7bd8cc2674 | ||
|
|
395da4671b | ||
|
|
f5a79f16b6 | ||
|
|
80c8b5b159 | ||
|
|
8ab2e26937 | ||
|
|
1d5234a8b7 | ||
|
|
123da3ea11 | ||
|
|
f0ec96fe2a | ||
|
|
5e83df9e5c | ||
|
|
42e5e939e9 | ||
|
|
853196bd65 | ||
|
|
b171b4d7ac | ||
|
|
d5738cc7af | ||
|
|
e726349c98 | ||
|
|
0d83f19e33 | ||
|
|
47d1baffc5 | ||
|
|
7e82b37fb1 | ||
|
|
eb03d61600 | ||
| f47571c1e2 | |||
|
|
cecd647ee7 | ||
|
|
9e1299e49c | ||
|
|
5fe17549ab | ||
|
|
da28aa485f | ||
|
|
4504cbaa2a |
Binary file not shown.
83
Master Template.xlsm_EXPORTS/HttpHandler.bas
Normal file
83
Master Template.xlsm_EXPORTS/HttpHandler.bas
Normal file
@ -0,0 +1,83 @@
|
||||
Attribute VB_Name = "HttpHandler"
|
||||
Option Explicit
|
||||
|
||||
Function makeHttpRequest(method As String, route As String, doc As String, ByRef errorMsg As String) As Object
|
||||
Dim req As New WinHttp.WinHttpRequest
|
||||
Dim json As Object
|
||||
Dim wr As String
|
||||
Dim res() As Variant
|
||||
|
||||
On Error GoTo errHandler
|
||||
|
||||
Set makeHttpRequest = Nothing
|
||||
|
||||
If doc = "" Then
|
||||
errorMsg = "No message to send to the server."
|
||||
Exit Function
|
||||
End If
|
||||
|
||||
' Inject the user's name and the current version of this file into the request body.
|
||||
Set json = JsonConverter.ParseJson(doc)
|
||||
json("version") = shConfig.Range("version").value
|
||||
json("username") = Application.UserName
|
||||
doc = JsonConverter.ConvertToJson(json)
|
||||
|
||||
Dim server As String
|
||||
server = shConfig.Range("server").value
|
||||
|
||||
With req
|
||||
.Option(WinHttpRequestOption_SslErrorIgnoreFlags) = SslErrorFlag_Ignore_All
|
||||
.Open method, server & "/" & route, True
|
||||
.SetRequestHeader "Content-Type", "application/json"
|
||||
.Send doc
|
||||
Debug.Print method & " /" & route & " (";
|
||||
Dim t As Single
|
||||
t = Timer
|
||||
.WaitForResponse
|
||||
wr = .ResponseText
|
||||
Debug.Print Timer - t; "sec): "; Left(wr, 200)
|
||||
End With
|
||||
|
||||
' This is a poor man's self-upgrade mechanism for this application.
|
||||
If Mid(wr, 1, 24) = "Obsolete client workbook" Then
|
||||
If MsgBox("Your workbook is an older version and needs to be upgraded. Download now? This workbook will be closed so your download can overwrite it. To ease the transition, save the downloaded file in the same location as this one: " & vbCrLf & vbCrLf & ActiveWorkbook.FullName, vbYesNo + vbQuestion) = vbYes Then
|
||||
ActiveWorkbook.FollowHyperlink server & "/template"
|
||||
ActiveWorkbook.Close False
|
||||
Else
|
||||
errorMsg = "You won't be able to use this workbook until you upgrade it. Please download the new one the next time you're prompted."
|
||||
Exit Function
|
||||
End If
|
||||
End If
|
||||
|
||||
If Mid(wr, 1, 1) <> "{" Or _
|
||||
Mid(wr, 2, 5) = "error" Or _
|
||||
Mid(wr, 1, 6) = "<body>" Or _
|
||||
Mid(wr, 1, 6) = "<!DOCT" _
|
||||
Then
|
||||
errorMsg = "Unexpected Result from Server: " & wr
|
||||
Exit Function
|
||||
End If
|
||||
|
||||
If Mid(wr, 1, 6) = "null" Then
|
||||
errorMsg = "API route not implemented."
|
||||
Exit Function
|
||||
End If
|
||||
|
||||
Set json = JsonConverter.ParseJson(wr)
|
||||
|
||||
If IsNull(json("x")) Then
|
||||
errorMsg = "Empty response from the server."
|
||||
Exit Function
|
||||
End If
|
||||
|
||||
Set makeHttpRequest = json
|
||||
|
||||
exitFunction:
|
||||
' Any final clean-up goes here. This will get hit even after errHandler does its thing.
|
||||
Exit Function
|
||||
|
||||
errHandler:
|
||||
MsgBox Err.Description
|
||||
Resume exitFunction
|
||||
End Function
|
||||
|
||||
1125
Master Template.xlsm_EXPORTS/JsonConverter.bas
Normal file
1125
Master Template.xlsm_EXPORTS/JsonConverter.bas
Normal file
File diff suppressed because it is too large
Load Diff
43
Master Template.xlsm_EXPORTS/JsonDebugPrint.bas
Normal file
43
Master Template.xlsm_EXPORTS/JsonDebugPrint.bas
Normal file
@ -0,0 +1,43 @@
|
||||
Attribute VB_Name = "JsonDebugPrint"
|
||||
Option Explicit
|
||||
|
||||
|
||||
Public Sub TestPrintJSON()
|
||||
PrintJSON ParseJson("[1,2,3]")
|
||||
PrintJSON ParseJson("[{""a"":123,""b"":[56,7,78]}]")
|
||||
End Sub
|
||||
|
||||
' This is definitely NOT a pretty printer. It was written merely as a debugging
|
||||
' tool to make sense of the objects that come out of JsonConverter.ParseJSON.
|
||||
' It doesn't format in the best way possible, but it does provide a semi-readable
|
||||
' view of the data in the JSON object.
|
||||
' Phil Runninger 3/1/2023
|
||||
'
|
||||
Public Sub PrintJSON(obj As Variant, Optional level As Integer = 0)
|
||||
Dim itm As Variant
|
||||
Dim first As Boolean
|
||||
Select Case TypeName(obj)
|
||||
Case "Dictionary"
|
||||
Debug.Print String(level * 2, " "); "{"
|
||||
first = True
|
||||
For Each itm In obj
|
||||
If Not first Then Debug.Print String((level + 1) * 2, " "); ","
|
||||
first = False
|
||||
Debug.Print String((level + 1) * 2, " "); itm; ":";
|
||||
PrintJSON obj(itm), level + 1
|
||||
Next
|
||||
Debug.Print String(level * 2, " "); "}"
|
||||
Case "Collection"
|
||||
Debug.Print String(level * 2, " "); "["
|
||||
first = True
|
||||
For Each itm In obj
|
||||
If Not first Then Debug.Print String(level * 2, " "); ","
|
||||
first = False
|
||||
PrintJSON itm, level + 1
|
||||
Next
|
||||
Debug.Print String(level * 2, " "); "]"
|
||||
Case Else
|
||||
Debug.Print String(level * 2, " "); obj;
|
||||
End Select
|
||||
End Sub
|
||||
|
||||
19
Master Template.xlsm_EXPORTS/ThisWorkbook.cls
Normal file
19
Master Template.xlsm_EXPORTS/ThisWorkbook.cls
Normal file
@ -0,0 +1,19 @@
|
||||
VERSION 1.0 CLASS
|
||||
BEGIN
|
||||
MultiUse = -1 'True
|
||||
END
|
||||
Attribute VB_Name = "ThisWorkbook"
|
||||
Attribute VB_GlobalNameSpace = False
|
||||
Attribute VB_Creatable = False
|
||||
Attribute VB_PredeclaredId = True
|
||||
Attribute VB_Exposed = True
|
||||
Private Sub Workbook_Open()
|
||||
Dim adjuster As Variant
|
||||
For Each adjuster In shConfig.ListObjects("ShipDateAdjusters").DataBodyRange
|
||||
If adjuster = Environ("USERNAME") Then
|
||||
shShipments.Visible = xlSheetVisible
|
||||
Exit Sub
|
||||
End If
|
||||
Next
|
||||
shShipments.Visible = xlSheetVeryHidden
|
||||
End Sub
|
||||
665
Master Template.xlsm_EXPORTS/Utils.bas
Normal file
665
Master Template.xlsm_EXPORTS/Utils.bas
Normal file
@ -0,0 +1,665 @@
|
||||
Attribute VB_Name = "Utils"
|
||||
Option Explicit
|
||||
|
||||
Public ADOo_errstring As String
|
||||
|
||||
Public Function TBLp_Aggregate(ByRef tbl() As String, ByRef needsort As Boolean, ByRef headers As Boolean, ByRef del_unused As Boolean, ParamArray groupnum_type_sumnum()) As Boolean
|
||||
|
||||
Dim i As Long
|
||||
Dim j As Long
|
||||
Dim nt() As String
|
||||
Dim keep() As Integer
|
||||
|
||||
If needsort Then
|
||||
If Not TBLp_BubbleSortAsc(tbl, PAp_2DGetIntegerArray(0, groupnum_type_sumnum), PAp_2DGetStringArray(1, groupnum_type_sumnum), headers) Then
|
||||
TBLp_Aggregate = False
|
||||
Exit Function
|
||||
End If
|
||||
End If
|
||||
|
||||
If Not TBLp_Roll(tbl, PAp_2DGetIntegerArray(0, groupnum_type_sumnum), PAp_2DGetIntegerArray(2, groupnum_type_sumnum), headers) Then
|
||||
TBLp_Aggregate = False
|
||||
Exit Function
|
||||
End If
|
||||
|
||||
|
||||
If del_unused Then
|
||||
keep = PAp_2DGetMultIntegerArray(ARRAYp_MakeInteger(0, 2), groupnum_type_sumnum)
|
||||
ReDim nt(UBound(keep()), UBound(tbl, 2))
|
||||
For i = 0 To UBound(keep())
|
||||
For j = 0 To UBound(tbl, 2)
|
||||
nt(i, j) = tbl(keep(i), j)
|
||||
Next j
|
||||
Next i
|
||||
tbl = nt
|
||||
End If
|
||||
|
||||
TBLp_Aggregate = True
|
||||
|
||||
End Function
|
||||
|
||||
Function TBLp_BubbleSortAsc(ByRef tbl() As String, ByRef sortflds() As Integer, ByRef typeflds() As String, ByRef headers As Boolean) As Boolean
|
||||
|
||||
On Error GoTo errh
|
||||
'get fort field numbers
|
||||
'loop through each row and generate the row key
|
||||
'eveluate the row key against other row keys
|
||||
'perform swaps
|
||||
|
||||
Dim i As Long
|
||||
Dim j As Long
|
||||
Dim k As Long
|
||||
|
||||
k = 0
|
||||
If headers Then k = 1
|
||||
|
||||
For i = k To UBound(tbl, 2) - 1
|
||||
For j = i + 1 To UBound(tbl, 2)
|
||||
If ROWe_AscSwapFlag(tbl, i, j, sortflds, typeflds) Then
|
||||
Call ROWp_Swap(tbl, i, j)
|
||||
Else
|
||||
If ADOo_errstring <> "" Then
|
||||
TBLp_BubbleSortAsc = False
|
||||
Exit Function
|
||||
End If
|
||||
End If
|
||||
Next j
|
||||
Next i
|
||||
|
||||
errh:
|
||||
If Err.Number <> 0 Then
|
||||
MsgBox "Error at TBLP_BubbleSortAsc." & vbCrLf & Err.Description
|
||||
ADOo_errstring = Err.Description
|
||||
End If
|
||||
|
||||
TBLp_BubbleSortAsc = True
|
||||
|
||||
End Function
|
||||
|
||||
Public Function TBLp_Roll(ByRef tbl() As String, ByRef gflds() As Integer, ByRef sflds() As Integer, ByRef headers As Boolean) As Boolean
|
||||
|
||||
On Error GoTo errh
|
||||
Dim i As Long 'indexes primary row
|
||||
Dim j As Long 'indexes secondary chaecker row
|
||||
Dim k As Integer 'used to start at 0 or 1
|
||||
Dim m As Long 'used to aggregate on sequencing lines (i and j aggregate to m line) then shorten array to m length - 1
|
||||
|
||||
k = 0
|
||||
If headers Then k = 1
|
||||
m = k
|
||||
For i = k To UBound(tbl, 2)
|
||||
If i = UBound(tbl, 2) Then
|
||||
i = i
|
||||
End If
|
||||
j = i + 1
|
||||
Do
|
||||
If j > UBound(tbl, 2) Then Exit Do
|
||||
If ROWe_MatchesFlag(tbl, i, j, gflds) Then
|
||||
Call ROWp_Aggregate2Rows(tbl, i, j, sflds)
|
||||
Else
|
||||
Exit Do
|
||||
End If
|
||||
j = j + 1
|
||||
If j > UBound(tbl, 2) Then
|
||||
Exit Do
|
||||
End If
|
||||
Loop
|
||||
Call ROWp_Copy(tbl, i, m)
|
||||
m = m + 1
|
||||
i = j - 1
|
||||
Next i
|
||||
|
||||
ReDim Preserve tbl(UBound(tbl, 1), m - 1)
|
||||
|
||||
errh:
|
||||
If Err.Number <> 0 Then
|
||||
ADOo_errstring = Err.Description
|
||||
TBLp_Roll = False
|
||||
Exit Function
|
||||
End If
|
||||
|
||||
TBLp_Roll = True
|
||||
|
||||
End Function
|
||||
|
||||
Sub ROWp_Swap(ByRef tbl() As String, ByRef p1 As Long, ByRef p2 As Long)
|
||||
|
||||
Dim temprow() As String
|
||||
ReDim temprow(UBound(tbl, 1))
|
||||
Dim i As Integer
|
||||
|
||||
For i = 0 To UBound(tbl, 1)
|
||||
temprow(i) = tbl(i, p2)
|
||||
Next i
|
||||
|
||||
For i = 0 To UBound(tbl, 1)
|
||||
tbl(i, p2) = tbl(i, p1)
|
||||
Next i
|
||||
|
||||
For i = 0 To UBound(tbl, 1)
|
||||
tbl(i, p1) = temprow(i)
|
||||
Next i
|
||||
|
||||
End Sub
|
||||
|
||||
Sub ROWp_Copy(ByRef tbl() As String, ByRef r_from As Long, ByRef r_to As Long)
|
||||
|
||||
Dim i As Integer
|
||||
|
||||
For i = 0 To UBound(tbl, 1)
|
||||
tbl(i, r_to) = tbl(i, r_from)
|
||||
Next i
|
||||
|
||||
End Sub
|
||||
|
||||
Sub ROWp_Aggregate2Rows(ByRef tbl() As String, ByRef p1 As Long, ByRef p2 As Long, ByRef sflds() As Integer)
|
||||
|
||||
Dim i As Integer
|
||||
On Error GoTo exitsub
|
||||
For i = 0 To UBound(sflds, 1)
|
||||
tbl(sflds(i), p1) = CDbl(tbl(sflds(i), p1)) + CDbl(tbl(sflds(i), p2))
|
||||
Next i
|
||||
|
||||
exitsub:
|
||||
|
||||
End Sub
|
||||
|
||||
Function ROWe_AscSwapFlag(ByRef tbl() As String, ByRef row1 As Long, ByRef row2 As Long, ByRef KeyFld() As Integer, ByRef TypeFld() As String) As Boolean
|
||||
'only returns true if greater than
|
||||
|
||||
On Error GoTo errh
|
||||
Dim i As Integer
|
||||
Dim compare As Integer
|
||||
|
||||
For i = 0 To UBound(KeyFld)
|
||||
Select Case TypeFld(i)
|
||||
Case "S"
|
||||
compare = MISCe_CompareString(CStr(tbl(KeyFld(i), row1)), CStr(tbl(KeyFld(i), row2)))
|
||||
Case "N"
|
||||
compare = MISCe_CompareDouble(CDbl(tbl(KeyFld(i), row1)), CDbl(tbl(KeyFld(i), row2)))
|
||||
Case "D"
|
||||
compare = MISCe_CompareDate(CDate(tbl(KeyFld(i), row1)), CDate(tbl(KeyFld(i), row2)))
|
||||
End Select
|
||||
Select Case compare
|
||||
Case -1
|
||||
ROWe_AscSwapFlag = True
|
||||
Exit Function
|
||||
Case 1
|
||||
ROWe_AscSwapFlag = False
|
||||
Exit Function
|
||||
End Select
|
||||
Next i
|
||||
|
||||
errh:
|
||||
If Err.Number <> 0 Then
|
||||
MsgBox "Error at ROWe_AscSwapFlag." & vbCrLf & Err.Description
|
||||
ADOo_errstring = Err.Description
|
||||
Exit Function
|
||||
End If
|
||||
|
||||
End Function
|
||||
|
||||
Function ROWe_MatchesFlag(ByRef tbl() As String, ByRef row1 As Long, ByRef row2 As Long, ByRef KeyFld() As Integer) As Boolean
|
||||
'only returns true if greater than
|
||||
|
||||
Dim i As Integer
|
||||
Dim k1 As String
|
||||
Dim k2 As String
|
||||
|
||||
For i = 0 To UBound(KeyFld())
|
||||
k1 = k1 & tbl(KeyFld(i), row1)
|
||||
Next i
|
||||
|
||||
For i = 0 To UBound(KeyFld())
|
||||
k2 = k2 & tbl(KeyFld(i), row2)
|
||||
Next i
|
||||
|
||||
|
||||
If k2 = k1 Then
|
||||
ROWe_MatchesFlag = True
|
||||
Else
|
||||
ROWe_MatchesFlag = False
|
||||
End If
|
||||
|
||||
End Function
|
||||
|
||||
Sub SHTp_DumpVar(ByRef tbl() As Variant, ByRef sheet As String, ByRef row As Long, ByRef col As Long, ByRef clear As Boolean, ByRef transpose As Boolean, ByRef zerobase As Boolean)
|
||||
|
||||
Dim sh As Worksheet
|
||||
Dim address As String
|
||||
Set sh = Sheets(sheet)
|
||||
|
||||
'If clear Then sh.Cells.clear
|
||||
'If transpose Then Call ARRAYp_Transpose(tbl)
|
||||
If zerobase Then
|
||||
address = sh.Cells(row, col).address & ":" & sh.Cells(row + UBound(tbl, 1), col + UBound(tbl, 2)).address
|
||||
Else
|
||||
address = sh.Cells(row, col).address & ":" & sh.Cells(row + UBound(tbl, 1) - 1, col + UBound(tbl, 2) - 1).address
|
||||
End If
|
||||
sh.Range(address).FormulaR1C1 = tbl
|
||||
|
||||
On Error GoTo errhndl
|
||||
|
||||
|
||||
errhndl:
|
||||
If Err.Number <> 0 Then MsgBox "Error in dumping to sheet" & vbCrLf & Err.Description
|
||||
|
||||
|
||||
End Sub
|
||||
|
||||
Function ARRAYp_TransposeVar(ByRef a() As Variant) As Variant()
|
||||
|
||||
Dim s() As Variant
|
||||
ReDim s(UBound(a, 2), UBound(a, 1))
|
||||
|
||||
Dim i As Long
|
||||
Dim j As Long
|
||||
|
||||
For i = 0 To UBound(s, 1)
|
||||
For j = 0 To UBound(s, 2)
|
||||
s(i, j) = a(j, i)
|
||||
Next j
|
||||
Next i
|
||||
|
||||
ARRAYp_TransposeVar = s
|
||||
|
||||
End Function
|
||||
|
||||
Function ARRAYp_zerobased_addheader(ByRef z() As Variant, ParamArray cols()) As Variant()
|
||||
|
||||
Dim i As Long
|
||||
Dim j As Long
|
||||
|
||||
Dim r() As Variant
|
||||
ReDim r(UBound(z, 1), UBound(z, 2) + 1)
|
||||
|
||||
For i = 0 To UBound(r, 1)
|
||||
For j = 1 To UBound(r, 2)
|
||||
r(i, j) = z(i, j - 1)
|
||||
Next j
|
||||
r(i, 0) = cols(i)
|
||||
Next i
|
||||
|
||||
ARRAYp_zerobased_addheader = r
|
||||
|
||||
End Function
|
||||
|
||||
Public Function SHTp_Get(ByRef sheet As String, ByRef row As Long, ByRef col As Long, ByRef headers As Boolean) As String()
|
||||
|
||||
Dim i As Long
|
||||
Dim j As Long
|
||||
Dim table() As String
|
||||
Dim sh As Worksheet
|
||||
Set sh = Sheets(sheet)
|
||||
|
||||
On Error GoTo errhdnl
|
||||
|
||||
i = 1
|
||||
While sh.Cells(row, col + i - 1) <> ""
|
||||
i = i + 1
|
||||
Wend
|
||||
|
||||
j = 1
|
||||
While sh.Cells(row + j - 1, col) <> ""
|
||||
j = j + 1
|
||||
Wend
|
||||
|
||||
ReDim table(i - 2, j - 2)
|
||||
i = 1
|
||||
While i <= UBound(table, 1) + 1
|
||||
j = 0
|
||||
While j <= UBound(table, 2)
|
||||
table(i - 1, j) = sh.Cells(row + j, col + i - 1)
|
||||
j = j + 1
|
||||
Wend
|
||||
i = i + 1
|
||||
Wend
|
||||
|
||||
errhdnl:
|
||||
If Err.Number <> 0 Then
|
||||
MsgBox Err.Description
|
||||
End If
|
||||
|
||||
SHTp_Get = table
|
||||
|
||||
End Function
|
||||
|
||||
Function PAp_2DGetStringArray(ByRef index As Integer, ParamArray pa()) As String()
|
||||
|
||||
Dim str() As String
|
||||
Dim i As Long
|
||||
ReDim str(UBound(pa(0)(index)))
|
||||
|
||||
For i = 0 To UBound(pa(0)(index))
|
||||
str(i) = pa(0)(index)(i)
|
||||
Next i
|
||||
PAp_2DGetStringArray = str
|
||||
|
||||
End Function
|
||||
|
||||
Function PAp_2DGetIntegerArray(ByRef index As Integer, ParamArray pa()) As Integer()
|
||||
|
||||
Dim str() As Integer
|
||||
Dim i As Long
|
||||
If UBound(pa(0)(index)) <> -1 Then
|
||||
ReDim str(UBound(pa(0)(index)))
|
||||
|
||||
For i = 0 To UBound(pa(0)(index))
|
||||
str(i) = pa(0)(index)(i)
|
||||
Next i
|
||||
End If
|
||||
PAp_2DGetIntegerArray = str
|
||||
|
||||
End Function
|
||||
|
||||
Function PAp_2DGetMultIntegerArray(ByRef ArraysGet() As Integer, ParamArray pa()) As Integer()
|
||||
|
||||
Dim str() As Integer
|
||||
Dim i As Long
|
||||
Dim j As Long
|
||||
Dim cnt As Long
|
||||
Dim index As Long
|
||||
|
||||
|
||||
'get length of selected arrays
|
||||
For i = 0 To UBound(ArraysGet, 1)
|
||||
cnt = cnt + UBound(pa(0)(ArraysGet(i)))
|
||||
Next i
|
||||
|
||||
ReDim str(cnt + 1)
|
||||
cnt = 0
|
||||
|
||||
For i = 0 To UBound(ArraysGet, 1)
|
||||
For j = 0 To UBound(pa(0)(ArraysGet(i)))
|
||||
str(cnt) = pa(0)(ArraysGet(i))(j)
|
||||
cnt = cnt + 1
|
||||
Next j
|
||||
Next i
|
||||
|
||||
PAp_2DGetMultIntegerArray = str
|
||||
|
||||
End Function
|
||||
|
||||
Public Function ARRAYp_MakeInteger(ParamArray items()) As Integer()
|
||||
|
||||
Dim X() As Integer
|
||||
Dim i As Integer
|
||||
ReDim X(UBound(items))
|
||||
|
||||
For i = 0 To UBound(items())
|
||||
X(i) = items(i)
|
||||
Next i
|
||||
|
||||
ARRAYp_MakeInteger = X
|
||||
|
||||
End Function
|
||||
|
||||
Public Function MISCe_CompareString(ByRef base As String, ByRef compare As String) As Integer
|
||||
|
||||
If compare < base Then
|
||||
MISCe_CompareString = -1
|
||||
Exit Function
|
||||
End If
|
||||
|
||||
If compare = base Then
|
||||
MISCe_CompareString = 0
|
||||
Exit Function
|
||||
End If
|
||||
|
||||
If compare > base Then
|
||||
MISCe_CompareString = 1
|
||||
Exit Function
|
||||
End If
|
||||
|
||||
End Function
|
||||
|
||||
Public Function MISCe_CompareDouble(ByRef base As Double, ByRef compare As Double) As Integer
|
||||
|
||||
If compare < base Then
|
||||
MISCe_CompareDouble = -1
|
||||
Exit Function
|
||||
End If
|
||||
|
||||
If compare = base Then
|
||||
MISCe_CompareDouble = 0
|
||||
Exit Function
|
||||
End If
|
||||
|
||||
If compare > base Then
|
||||
MISCe_CompareDouble = 1
|
||||
Exit Function
|
||||
End If
|
||||
|
||||
End Function
|
||||
|
||||
Public Function MISCe_CompareDate(ByRef base As Date, ByRef compare As Date) As Integer
|
||||
|
||||
|
||||
If compare < base Then
|
||||
MISCe_CompareDate = -1
|
||||
Exit Function
|
||||
End If
|
||||
|
||||
If compare = base Then
|
||||
MISCe_CompareDate = 0
|
||||
Exit Function
|
||||
End If
|
||||
|
||||
If compare > base Then
|
||||
MISCe_CompareDate = 1
|
||||
Exit Function
|
||||
End If
|
||||
|
||||
End Function
|
||||
|
||||
Public Function json_from_table(ByRef tbl() As Variant, ByRef array_label As String, Optional strip_braces As Boolean) As String
|
||||
|
||||
|
||||
Dim ajson As String
|
||||
Dim json As String
|
||||
Dim r As Integer
|
||||
Dim c As Integer
|
||||
Dim needs_comma As Boolean
|
||||
Dim needs_braces As Integer
|
||||
|
||||
needs_comma = False
|
||||
needs_braces = 0
|
||||
ajson = ""
|
||||
|
||||
For r = 2 To UBound(tbl, 1)
|
||||
For c = 1 To UBound(tbl, 2)
|
||||
If tbl(r, c) <> "" Then
|
||||
needs_braces = needs_braces + 1
|
||||
If needs_comma Then json = json & ","
|
||||
needs_comma = True
|
||||
If IsNumeric(tbl(r, c)) And Mid(tbl(r, c), 1, 1) <> 0 Then
|
||||
json = json & Chr(34) & tbl(1, c) & Chr(34) & ":" & tbl(r, c)
|
||||
Else
|
||||
'test if item is a json object
|
||||
If Mid(tbl(r, c), 1, 1) = "{" Or Mid(tbl(r, c), 1, 1) = "[" Then
|
||||
json = json & """" & tbl(1, c) & """" & ":" & tbl(r, c)
|
||||
Else
|
||||
json = json & Chr(34) & tbl(1, c) & Chr(34) & ":" & Chr(34) & tbl(r, c) & Chr(34)
|
||||
End If
|
||||
End If
|
||||
End If
|
||||
Next c
|
||||
If needs_braces > 0 Then json = "{" & json & "}"
|
||||
needs_comma = False
|
||||
needs_braces = 0
|
||||
If r > 2 Then
|
||||
ajson = ajson & "," & json
|
||||
Else
|
||||
ajson = json
|
||||
End If
|
||||
json = ""
|
||||
Next r
|
||||
|
||||
'if theres more the one record, include brackets for array
|
||||
'if an array_label is given give the array a key and the array become the value
|
||||
'then if the array is labeled with a key it should have braces unless specified otherwise
|
||||
If r > 3 Then
|
||||
ajson = "[" & ajson & "]"
|
||||
If array_label <> "" Then
|
||||
ajson = """" & array_label & """:" & ajson
|
||||
If Not strip_braces Then
|
||||
ajson = "{" & ajson & "}"
|
||||
End If
|
||||
End If
|
||||
Else
|
||||
If strip_braces Then
|
||||
ajson = Mid(ajson, 2, Len(ajson) - 2)
|
||||
End If
|
||||
End If
|
||||
|
||||
json_from_table = ajson
|
||||
|
||||
End Function
|
||||
|
||||
Public Function json_from_table_zb(ByRef tbl() As Variant, ByRef array_label As String, ByVal force_array As Boolean, Optional strip_braces As Boolean) As String
|
||||
|
||||
Dim ajson As String
|
||||
Dim json As String
|
||||
Dim r As Integer
|
||||
Dim c As Integer
|
||||
Dim needs_comma As Boolean
|
||||
Dim needs_braces As Integer
|
||||
|
||||
needs_comma = False
|
||||
needs_braces = 0
|
||||
ajson = ""
|
||||
|
||||
For r = 1 To UBound(tbl, 1)
|
||||
For c = 0 To UBound(tbl, 2)
|
||||
If tbl(r, c) <> "" Then
|
||||
needs_braces = needs_braces + 1
|
||||
If needs_comma Then json = json & ","
|
||||
needs_comma = True
|
||||
If IsNumeric(tbl(r, c)) And Mid(tbl(r, c), 1, 1) <> 0 Then
|
||||
json = json & Chr(34) & tbl(0, c) & Chr(34) & ":" & tbl(r, c)
|
||||
Else
|
||||
'test if item is a json object
|
||||
If Mid(tbl(r, c), 1, 1) = "{" Or Mid(tbl(r, c), 1, 1) = "[" Then
|
||||
json = json & """" & tbl(0, c) & """" & ":" & tbl(r, c)
|
||||
Else
|
||||
json = json & Chr(34) & tbl(0, c) & Chr(34) & ":" & Chr(34) & tbl(r, c) & Chr(34)
|
||||
End If
|
||||
End If
|
||||
End If
|
||||
Next c
|
||||
If needs_braces > 0 Then json = "{" & json & "}"
|
||||
needs_comma = False
|
||||
needs_braces = 0
|
||||
If r > 1 Then
|
||||
ajson = ajson & "," & json
|
||||
Else
|
||||
ajson = json
|
||||
End If
|
||||
json = ""
|
||||
Next r
|
||||
|
||||
'if theres more the one record, include brackets for array
|
||||
'if an array_label is given give the array a key and the array become the value
|
||||
'then if the array is labeled with a key it should have braces unless specified otherwise
|
||||
If r > 2 Or force_array Then
|
||||
ajson = "[" & ajson & "]"
|
||||
If array_label <> "" Then
|
||||
ajson = """" & array_label & """:" & ajson
|
||||
If Not strip_braces Then
|
||||
ajson = "{" & ajson & "}"
|
||||
End If
|
||||
End If
|
||||
Else
|
||||
If strip_braces Then
|
||||
ajson = Mid(ajson, 2, Len(ajson) - 2)
|
||||
End If
|
||||
End If
|
||||
|
||||
json_from_table_zb = ajson
|
||||
|
||||
End Function
|
||||
|
||||
Public Function SHTp_get_block(point As Range) As Variant()
|
||||
|
||||
SHTp_get_block = point.CurrentRegion
|
||||
|
||||
End Function
|
||||
|
||||
Sub frmListBoxHeader(ByRef hdr As MSForms.listbox, ByRef det As MSForms.listbox, ParamArray cols())
|
||||
|
||||
Dim i As Long
|
||||
|
||||
hdr.ColumnCount = det.ColumnCount
|
||||
hdr.ColumnWidths = det.ColumnWidths
|
||||
|
||||
' add header elements
|
||||
hdr.clear
|
||||
hdr.AddItem
|
||||
For i = 0 To UBound(cols, 1)
|
||||
hdr.list(0, i) = cols(i)
|
||||
Next i
|
||||
|
||||
' make it pretty
|
||||
'body.ZOrder (1)
|
||||
'lbHEAD.ZOrder (0)
|
||||
hdr.SpecialEffect = fmSpecialEffectFlat
|
||||
'hdr.BackColor = RGB(200, 200, 200)
|
||||
'hdr.Height = 15
|
||||
|
||||
' align header to body (should be done last!)
|
||||
hdr.width = det.width
|
||||
hdr.Left = det.Left
|
||||
hdr.Top = det.Top - (hdr.Height + 3)
|
||||
|
||||
End Sub
|
||||
|
||||
Public Function IntersectsWith(Range1 As Range, Range2 As Range) As Boolean
|
||||
IntersectsWith = Not Application.Intersect(Range1, Range2) Is Nothing
|
||||
End Function
|
||||
|
||||
' Credit: https://stackoverflow.com/a/64563408/510067
|
||||
Public Function RangeToArray(inputRange As Range) As Variant()
|
||||
Dim size As Integer
|
||||
Dim inputValue As Variant, outputArray() As Variant
|
||||
|
||||
' inputValue will either be an variant array for ranges with more than 1 cell
|
||||
' or a single variant value for range will only 1 cell
|
||||
inputValue = inputRange
|
||||
|
||||
On Error Resume Next
|
||||
size = UBound(inputValue)
|
||||
|
||||
If Err.Number = 0 Then
|
||||
RangeToArray = inputValue
|
||||
Else
|
||||
On Error GoTo 0
|
||||
ReDim outputArray(1 To 1, 1 To 1)
|
||||
outputArray(1, 1) = inputValue
|
||||
RangeToArray = outputArray
|
||||
End If
|
||||
|
||||
On Error GoTo 0
|
||||
|
||||
End Function
|
||||
|
||||
Public Function escape_json(ByVal text As String) As String
|
||||
|
||||
text = Replace(text, "'", "''")
|
||||
text = Replace(text, """", "\""")
|
||||
If text = "(blank)" Then text = ""
|
||||
escape_json = text
|
||||
|
||||
End Function
|
||||
|
||||
Public Function escape_sql(ByVal text As String) As String
|
||||
|
||||
text = Replace(text, "'", "''")
|
||||
text = Replace(text, """", """""")
|
||||
If text = "(blank)" Then text = ""
|
||||
escape_sql = text
|
||||
|
||||
End Function
|
||||
|
||||
|
||||
|
||||
|
||||
39
Master Template.xlsm_EXPORTS/build.frm
Normal file
39
Master Template.xlsm_EXPORTS/build.frm
Normal file
@ -0,0 +1,39 @@
|
||||
VERSION 5.00
|
||||
Begin {C62A69F0-16DC-11CE-9E98-00AA00574A4F} build
|
||||
Caption = "Change the Mix"
|
||||
ClientHeight = 1590
|
||||
ClientLeft = 120
|
||||
ClientTop = 465
|
||||
ClientWidth = 10725
|
||||
OleObjectBlob = "build.frx":0000
|
||||
StartUpPosition = 1 'CenterOwner
|
||||
End
|
||||
Attribute VB_Name = "build"
|
||||
Attribute VB_GlobalNameSpace = False
|
||||
Attribute VB_Creatable = False
|
||||
Attribute VB_PredeclaredId = True
|
||||
Attribute VB_Exposed = False
|
||||
Option Explicit
|
||||
|
||||
Public useval As Boolean
|
||||
|
||||
Private Sub cmdCancel_Click()
|
||||
useval = False
|
||||
Me.Hide
|
||||
End Sub
|
||||
|
||||
Private Sub cmdOK_Click()
|
||||
useval = True
|
||||
Me.Hide
|
||||
End Sub
|
||||
|
||||
Public Sub Initialize(part As String, billTo As String, shipTo As String)
|
||||
cbPart.list = RangeToArray(shSupportingData.ListObjects("ITEM").DataBodyRange)
|
||||
cbPart.value = part
|
||||
cbBill.list = RangeToArray(shSupportingData.ListObjects("CUSTOMER").DataBodyRange)
|
||||
cbBill.value = billTo
|
||||
cbShip.list = RangeToArray(shSupportingData.ListObjects("CUSTOMER").DataBodyRange)
|
||||
cbShip.value = shipTo
|
||||
|
||||
useval = False
|
||||
End Sub
|
||||
BIN
Master Template.xlsm_EXPORTS/build.frx
Normal file
BIN
Master Template.xlsm_EXPORTS/build.frx
Normal file
Binary file not shown.
75
Master Template.xlsm_EXPORTS/changes.frm
Normal file
75
Master Template.xlsm_EXPORTS/changes.frm
Normal file
@ -0,0 +1,75 @@
|
||||
VERSION 5.00
|
||||
Begin {C62A69F0-16DC-11CE-9E98-00AA00574A4F} changes
|
||||
Caption = "History"
|
||||
ClientHeight = 7815
|
||||
ClientLeft = 120
|
||||
ClientTop = 465
|
||||
ClientWidth = 16710
|
||||
OleObjectBlob = "changes.frx":0000
|
||||
StartUpPosition = 1 'CenterOwner
|
||||
End
|
||||
Attribute VB_Name = "changes"
|
||||
Attribute VB_GlobalNameSpace = False
|
||||
Attribute VB_Creatable = False
|
||||
Attribute VB_PredeclaredId = True
|
||||
Attribute VB_Exposed = False
|
||||
Private X As Variant
|
||||
|
||||
Private Sub UserForm_Activate()
|
||||
tbPrint.value = ""
|
||||
|
||||
Dim errorMsg As String
|
||||
X = handler.list_changes(errorMsg)
|
||||
If errorMsg <> "" Then
|
||||
Unload Me
|
||||
MsgBox errorMsg, vbOKOnly + vbExclamation, "No data found."
|
||||
End
|
||||
End If
|
||||
Me.lbHist.list = X
|
||||
Call Utils.frmListBoxHeader(Me.lbHEAD, Me.lbHist, "Modifier", "Owner", "When", "Tag", "Comment", "Sales", "id")
|
||||
End Sub
|
||||
|
||||
Private Sub cbCancel_Click()
|
||||
Me.Hide
|
||||
End Sub
|
||||
|
||||
Private Sub cbUndo_Click()
|
||||
Call Me.delete_selected
|
||||
End Sub
|
||||
|
||||
Private Sub lbHist_Change()
|
||||
Dim i As Integer
|
||||
|
||||
For i = 0 To Me.lbHist.ListCount - 1
|
||||
If Me.lbHist.Selected(i) Then
|
||||
Me.tbPrint.value = X(i, 7)
|
||||
Exit Sub
|
||||
End If
|
||||
Next i
|
||||
End Sub
|
||||
|
||||
Sub delete_selected()
|
||||
Dim logid As Integer
|
||||
Dim i As Integer
|
||||
Dim errorMsg As String
|
||||
Dim proceed As Boolean
|
||||
|
||||
If MsgBox("Permanently delete these changes?", vbYesNo) = vbNo Then
|
||||
Exit Sub
|
||||
End If
|
||||
|
||||
For i = 0 To Me.lbHist.ListCount - 1
|
||||
If Me.lbHist.Selected(i) Then
|
||||
handler.undo_changes X(i, 6), errorMsg
|
||||
If errorMsg <> "" Then
|
||||
MsgBox errorMsg, vbOKOnly + vbCritical, "Undo did not work."
|
||||
Exit Sub
|
||||
End If
|
||||
End If
|
||||
Next i
|
||||
|
||||
shOrders.PivotTables("ptOrders").PivotCache.Refresh
|
||||
|
||||
Me.lbHist.clear
|
||||
Me.Hide
|
||||
End Sub
|
||||
BIN
Master Template.xlsm_EXPORTS/changes.frx
Normal file
BIN
Master Template.xlsm_EXPORTS/changes.frx
Normal file
Binary file not shown.
567
Master Template.xlsm_EXPORTS/fpvt.frm
Normal file
567
Master Template.xlsm_EXPORTS/fpvt.frm
Normal file
@ -0,0 +1,567 @@
|
||||
VERSION 5.00
|
||||
Begin {C62A69F0-16DC-11CE-9E98-00AA00574A4F} fpvt
|
||||
Caption = "Forecast Adjustment"
|
||||
ClientHeight = 8490.001
|
||||
ClientLeft = 120
|
||||
ClientTop = 465
|
||||
ClientWidth = 8670.001
|
||||
OleObjectBlob = "fpvt.frx":0000
|
||||
StartUpPosition = 1 'CenterOwner
|
||||
End
|
||||
Attribute VB_Name = "fpvt"
|
||||
Attribute VB_GlobalNameSpace = False
|
||||
Attribute VB_Creatable = False
|
||||
Attribute VB_PredeclaredId = True
|
||||
Attribute VB_Exposed = False
|
||||
Option Explicit
|
||||
|
||||
Private month() As Variant
|
||||
Private adjust As Object
|
||||
Private load_tb As Boolean
|
||||
Private set_Price As Boolean
|
||||
Private sp As Object
|
||||
|
||||
Private bVol As Double
|
||||
Private bVal As Double
|
||||
Private bPrc As Double
|
||||
Private pVol As Double
|
||||
Private pVal As Double
|
||||
Private pPrc As Double
|
||||
Private aVol As Double
|
||||
Private aVal As Double
|
||||
Private aPrc As Double
|
||||
Private fVol As Double
|
||||
Private fVal As Double
|
||||
Private fPrc As Double
|
||||
|
||||
'=====================================================================================================
|
||||
' Developers' backdoor to enter or exit debug mode: Ctrl-RightClick on the "Selected Scenario"
|
||||
' label at the top of the form. Debug Mode shows the Pending Changes tab in the form, as well
|
||||
' as all hidden sheets.
|
||||
Private Sub Label62_MouseUp(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)
|
||||
If Button = 2 And Shift = 2 Then
|
||||
shConfig.Range("debug_mode") = Not shConfig.Range("debug_mode")
|
||||
mp.Pages("pAPIDOC").Visible = shConfig.Range("debug_mode")
|
||||
End If
|
||||
End Sub
|
||||
'=====================================================================================================
|
||||
|
||||
Private Sub butAdjust_Click()
|
||||
Dim errorMsg As String
|
||||
If tbAPI.text = "" Then errorMsg = "No adjustments provided."
|
||||
If cbTAG.text = "" Then errorMsg = "No tag was selected."
|
||||
If tbAPI.text = "" Then errorMsg = "No adjustements are ready."
|
||||
|
||||
If errorMsg <> "" Then
|
||||
MsgBox errorMsg, vbOKOnly Or vbExclamation
|
||||
Exit Sub
|
||||
End If
|
||||
|
||||
handler.request_adjust tbAPI.text, errorMsg
|
||||
If errorMsg <> "" Then
|
||||
MsgBox errorMsg, vbOKOnly Or vbExclamation, "Adjustment was not made due to error."
|
||||
Exit Sub
|
||||
End If
|
||||
|
||||
Me.tbCOM = ""
|
||||
Me.cbTAG.text = ""
|
||||
|
||||
Me.Hide
|
||||
|
||||
Set adjust = Nothing
|
||||
End Sub
|
||||
|
||||
Private Sub butCancel_Click()
|
||||
Me.Hide
|
||||
End Sub
|
||||
|
||||
Private Sub cbGoSheet_Click()
|
||||
Dim tags
|
||||
tags = RangeToArray(shConfig.ListObjects("TAGS").DataBodyRange)
|
||||
If UBound(tags, 1) = 1 Then
|
||||
shMonthView.Range("MonthTag").value = tags(1, 1)
|
||||
Else
|
||||
shMonthView.Range("MonthTag").value = ""
|
||||
End If
|
||||
shMonthView.Range("MonthComment").value = ""
|
||||
shMonthView.Range("QtyPctChange").value = 0
|
||||
shMonthView.Range("PricePctChange").value = 0
|
||||
shMonthView.Visible = xlSheetVisible
|
||||
shMonthView.Select
|
||||
Me.Hide
|
||||
End Sub
|
||||
|
||||
Private Sub cbTAG_Change()
|
||||
Dim j As Object
|
||||
If tbAPI.text = "" Then tbAPI.text = "{}"
|
||||
Set j = JsonConverter.ParseJson(tbAPI.text)
|
||||
j("tag") = cbTAG.value
|
||||
tbAPI.text = JsonConverter.ConvertToJson(j)
|
||||
End Sub
|
||||
|
||||
Private Sub opEditPrice_Click()
|
||||
opPlugVol.Visible = False
|
||||
opPlugPrice.Visible = False
|
||||
' opPlugPrice.Value = True
|
||||
' opPlugVol.Value = False
|
||||
|
||||
tbFcPrice.Enabled = True
|
||||
tbFcPrice.BackColor = &H80000018
|
||||
tbFcVal.Enabled = False
|
||||
tbFcVal.BackColor = &H80000005
|
||||
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()
|
||||
opPlugVol.Visible = True
|
||||
opPlugPrice.Visible = True
|
||||
|
||||
tbFcPrice.Enabled = False
|
||||
tbFcPrice.BackColor = &H80000005
|
||||
tbFcVal.Enabled = True
|
||||
tbFcVal.BackColor = &H80000018
|
||||
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
|
||||
|
||||
Private Sub opPlugPrice_Click()
|
||||
calc_val
|
||||
End Sub
|
||||
|
||||
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 = "{}"
|
||||
Set adjust = JsonConverter.ParseJson(tbAPI.text)
|
||||
adjust("message") = tbCOM.text
|
||||
tbAPI.text = JsonConverter.ConvertToJson(adjust)
|
||||
End Sub
|
||||
|
||||
Private Sub tbFcPrice_Change()
|
||||
If load_tb Then Exit Sub
|
||||
set_Price = True
|
||||
If opEditPrice Then calc_price
|
||||
set_Price = False
|
||||
End Sub
|
||||
|
||||
Private Sub tbFcVal_Change()
|
||||
If load_tb Then Exit Sub
|
||||
If opEditSales Then calc_val
|
||||
End Sub
|
||||
|
||||
Private Sub tbFcVol_Change()
|
||||
If load_tb Then Exit Sub
|
||||
If opEditPrice Then calc_price
|
||||
End Sub
|
||||
|
||||
Private Sub tbpd_Change()
|
||||
If load_tb Then Exit Sub
|
||||
If Not VBA.IsNumeric(tbpd.value) Then Exit Sub
|
||||
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 Exit Sub
|
||||
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 Exit Sub
|
||||
tbFcVol = (bVol + pVol) * (1 + tbpv.value / 100)
|
||||
End Sub
|
||||
|
||||
Private Sub UserForm_Activate()
|
||||
Me.Caption = "Forecast Adjust " & shConfig.Range("version").value & " Loading..."
|
||||
Me.mp.Visible = False
|
||||
Me.fraExit.Visible = False
|
||||
|
||||
Dim errorMsg As String
|
||||
Set sp = handler.scenario_package("{""scenario"":" & scenario & "}", errorMsg)
|
||||
Call Utils.frmListBoxHeader(Me.lbSHDR, Me.lbSDET, "Field", "Selection")
|
||||
|
||||
Me.Caption = "Forecast Adjust " & shConfig.Range("version").value
|
||||
|
||||
If errorMsg <> "" Then
|
||||
fpvt.Hide
|
||||
Application.StatusBar = False
|
||||
Exit Sub
|
||||
End If
|
||||
|
||||
'---show existing adjustment if there is one----
|
||||
pVol = 0
|
||||
pVal = 0
|
||||
pPrc = 0
|
||||
bVol = 0
|
||||
bVal = 0
|
||||
bPrc = 0
|
||||
aVol = 0
|
||||
aVal = 0
|
||||
aPrc = 0
|
||||
fVal = 0
|
||||
fVol = 0
|
||||
fPrc = 0
|
||||
Me.tbAPI.value = ""
|
||||
|
||||
If IsNull(sp("package")("totals")) Then
|
||||
MsgBox "An unexpected error has occurred when retrieving the scenario.", vbOKOnly Or vbExclamation, "Error"
|
||||
fpvt.Hide
|
||||
Application.StatusBar = False
|
||||
Exit Sub
|
||||
End If
|
||||
|
||||
Dim i As Long
|
||||
For i = 1 To sp("package")("totals").Count
|
||||
Select Case sp("package")("totals")(i)("order_season")
|
||||
Case 2025
|
||||
Select Case Me.iter_def(sp("package")("totals")(i)("iter"))
|
||||
Case "baseline"
|
||||
bVol = bVol + sp("package")("totals")(i)("units")
|
||||
bVal = bVal + sp("package")("totals")(i)("value_usd")
|
||||
If bVol <> 0 Then bPrc = bVal / bVol
|
||||
|
||||
Case "adjust"
|
||||
pVol = pVol + sp("package")("totals")(i)("units")
|
||||
pVal = pVal + sp("package")("totals")(i)("value_usd")
|
||||
|
||||
Case "exclude"
|
||||
|
||||
End Select
|
||||
End Select
|
||||
Next i
|
||||
|
||||
fVol = bVol + pVol
|
||||
fVal = bVal + pVal
|
||||
If fVol = 0 Then
|
||||
fPrc = 0
|
||||
Else
|
||||
fPrc = fVal / fVol
|
||||
End If
|
||||
If (bVol + pVol) = 0 Then
|
||||
pPrc = 0
|
||||
Else
|
||||
If bVol = 0 Then
|
||||
pPrc = 0
|
||||
Else
|
||||
pPrc = (pVal + bVal) / (bVol + pVol) - bVal / bVol
|
||||
End If
|
||||
End If
|
||||
If aVal <> 0 Then
|
||||
MsgBox aVal
|
||||
End If
|
||||
Me.load_mbox_ann
|
||||
|
||||
'---------------------------------------populate monthly-------------------------------------------------------
|
||||
|
||||
'--parse json into variant array for loading--
|
||||
ReDim month(sp("package")("mpvt").Count + 1, 10)
|
||||
|
||||
For i = 1 To sp("package")("mpvt").Count
|
||||
month(i, 0) = sp("package")("mpvt")(i)("order_month")
|
||||
month(i, 1) = sp("package")("mpvt")(i)("2024 qty")
|
||||
month(i, 2) = sp("package")("mpvt")(i)("2025 base qty")
|
||||
month(i, 3) = sp("package")("mpvt")(i)("2025 adj qty")
|
||||
month(i, 4) = sp("package")("mpvt")(i)("2025 tot qty")
|
||||
month(i, 5) = sp("package")("mpvt")(i)("2024 value_usd")
|
||||
month(i, 6) = sp("package")("mpvt")(i)("2025 base value_usd")
|
||||
month(i, 7) = sp("package")("mpvt")(i)("2025 adj value_usd")
|
||||
month(i, 8) = sp("package")("mpvt")(i)("2025 tot value_usd")
|
||||
If co_num(month(i, 2), 0) = 0 Then
|
||||
month(i, 9) = "addmonth"
|
||||
Else
|
||||
month(i, 9) = "scale"
|
||||
End If
|
||||
Next i
|
||||
|
||||
Me.crunch_array
|
||||
|
||||
ReDim basket(sp("package")("basket").Count, 3)
|
||||
basket(0, 0) = "part_descr"
|
||||
basket(0, 1) = "bill_cust_descr"
|
||||
basket(0, 2) = "ship_cust_descr"
|
||||
basket(0, 3) = "mix"
|
||||
|
||||
For i = 1 To UBound(basket, 1)
|
||||
basket(i, 0) = sp("package")("basket")(i)("part_descr")
|
||||
basket(i, 1) = sp("package")("basket")(i)("bill_cust_descr")
|
||||
basket(i, 2) = sp("package")("basket")(i)("ship_cust_descr")
|
||||
basket(i, 3) = sp("package")("basket")(i)("mix")
|
||||
Next i
|
||||
|
||||
'-------------load tags-------------------------------
|
||||
cbTAG.list = RangeToArray(shConfig.ListObjects("TAGS").DataBodyRange)
|
||||
If cbTAG.ListCount = 1 Then
|
||||
cbTAG.ListIndex = 0
|
||||
End If
|
||||
|
||||
'----------reset spinner buttons----------------------
|
||||
sbpv.value = 0
|
||||
sbpp.value = 0
|
||||
sbpd.value = 0
|
||||
|
||||
Call handler.month_tosheet(month, basket)
|
||||
Application.StatusBar = False
|
||||
|
||||
Me.mp.Visible = True
|
||||
Me.fraExit.Visible = True
|
||||
End Sub
|
||||
|
||||
Sub crunch_array()
|
||||
|
||||
Dim i As Integer
|
||||
|
||||
month(13, 1) = 0
|
||||
month(13, 2) = 0
|
||||
month(13, 3) = 0
|
||||
month(13, 4) = 0
|
||||
month(13, 5) = 0
|
||||
month(13, 6) = 0
|
||||
month(13, 7) = 0
|
||||
month(13, 8) = 0
|
||||
|
||||
For i = 1 To 12
|
||||
month(13, 1) = month(13, 1) + co_num(month(i, 1), 0)
|
||||
month(13, 2) = month(13, 2) + co_num(month(i, 2), 0)
|
||||
month(13, 3) = month(13, 3) + co_num(month(i, 3), 0)
|
||||
month(13, 4) = month(13, 4) + co_num(month(i, 4), 0)
|
||||
month(13, 5) = month(13, 5) + co_num(month(i, 5), 0)
|
||||
month(13, 6) = month(13, 6) + co_num(month(i, 6), 0)
|
||||
month(13, 7) = month(13, 7) + co_num(month(i, 7), 0)
|
||||
month(13, 8) = month(13, 8) + co_num(month(i, 8), 0)
|
||||
Next i
|
||||
|
||||
ReDim mload(UBound(month, 1), 5)
|
||||
For i = 0 To UBound(month, 1)
|
||||
mload(i, 0) = month(i, 0)
|
||||
mload(i, 1) = Format(month(i, 1), "#,###")
|
||||
mload(i, 2) = Format(month(i, 4), "#,###")
|
||||
mload(i, 3) = Format(month(i, 5), "#,###")
|
||||
mload(i, 4) = Format(month(i, 8), "#,###")
|
||||
Next i
|
||||
End Sub
|
||||
|
||||
Public Function rev_cust(cust As String) As String
|
||||
If cust = "" Then
|
||||
rev_cust = ""
|
||||
Exit Function
|
||||
End If
|
||||
|
||||
If InStr(1, cust, " - ") <= 9 Then
|
||||
rev_cust = trim(Mid(cust, 11, 100)) & " - " & trim(Left(cust, 8))
|
||||
Else
|
||||
rev_cust = trim(Right(cust, 8)) & " - " & Mid(cust, 1, InStr(1, cust, " - "))
|
||||
End If
|
||||
|
||||
End Function
|
||||
|
||||
Sub load_mbox_ann()
|
||||
|
||||
load_tb = True
|
||||
|
||||
tbBaseVol = Format(bVol, "#,##0")
|
||||
tbBaseVal = Format(bVal, "#,##0")
|
||||
tbBasePrice = Format(bPrc, "0.00000")
|
||||
|
||||
tbPadjVol = Format(pVol, "#,##0")
|
||||
tbPadjVal = Format(pVal, "#,##0")
|
||||
tbPadjPrice = Format(pPrc, "0.00000")
|
||||
|
||||
tbFcVol = Format(fVol, "#,##0")
|
||||
tbFcVal = Format(fVal, "#,##0")
|
||||
If Not set_Price Then tbFcPrice = Format(fPrc, "0.00000")
|
||||
|
||||
tbAdjVol = Format(aVol, "#,##0")
|
||||
tbAdjVal = Format(aVal, "#,##0")
|
||||
tbAdjPrice = Format(aPrc, "0.00000")
|
||||
|
||||
load_tb = False
|
||||
End Sub
|
||||
|
||||
Function co_num(ByRef one As Variant, ByRef two As Variant) As Variant
|
||||
|
||||
If Not IsNumeric(one) Or IsNull(one) Then
|
||||
co_num = two
|
||||
Else
|
||||
co_num = one
|
||||
End If
|
||||
|
||||
End Function
|
||||
|
||||
Sub calc_val()
|
||||
|
||||
Dim pchange As Double
|
||||
|
||||
If IsNumeric(tbFcVal.value) Then
|
||||
'get textbox value
|
||||
fVal = tbFcVal.value
|
||||
'do calculations
|
||||
aVal = fVal - bVal - pVal
|
||||
|
||||
'---------if volume adjustment method is selected, scale the volume up----------------------------------
|
||||
If opPlugVol Then
|
||||
If (Round(pVal, 2) + Round(bVal, 2)) = 0 Then
|
||||
pchange = 0
|
||||
If co_num(pVal, bVal) = 0 Then
|
||||
MsgBox "Zero times any number is zero. Cannot scale to get to the target."
|
||||
Else
|
||||
fVol = fVal / (co_num(bVal, pVal) / co_num(bVol, pVol))
|
||||
End If
|
||||
Else
|
||||
pchange = fVal / (pVal + bVal)
|
||||
fVol = (pVol + bVol) * pchange
|
||||
End If
|
||||
|
||||
Else
|
||||
fVol = pVol + bVol
|
||||
End If
|
||||
If fVol = 0 Then
|
||||
fPrc = 0
|
||||
Else
|
||||
fPrc = fVal / fVol
|
||||
End If
|
||||
aVol = fVol - (bVol + pVol)
|
||||
aPrc = fPrc - (bPrc + pPrc)
|
||||
Else
|
||||
aVol = fVol - bVol - pVol
|
||||
aPrc = 0
|
||||
|
||||
End If
|
||||
tbFcVal = Format(co_num(tbFcVal, 0), "#,##0")
|
||||
|
||||
Me.load_mbox_ann
|
||||
|
||||
'build json
|
||||
Set adjust = JsonConverter.ParseJson("{""scenario"":" & scenario & "}")
|
||||
adjust("scenario")("version") = handler.plan
|
||||
adjust("scenario")("iter") = handler.basis
|
||||
adjust("stamp") = Format(Date + time, "yyyy-mm-dd hh:mm:ss")
|
||||
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"
|
||||
adjust("amount") = aVal
|
||||
adjust("qty") = aVol
|
||||
Else
|
||||
adjust("type") = "scale_p"
|
||||
adjust("amount") = aVal
|
||||
End If
|
||||
Else
|
||||
adjust("type") = "scale_vp"
|
||||
adjust("qty") = aVol
|
||||
adjust("amount") = aVal
|
||||
End If
|
||||
|
||||
'print json
|
||||
tbAPI = JsonConverter.ConvertToJson(adjust)
|
||||
End Sub
|
||||
|
||||
Sub calc_price()
|
||||
fVol = co_num(tbFcVol.value, 0)
|
||||
fPrc = co_num(tbFcPrice.value, 0)
|
||||
'calc
|
||||
fVal = fPrc * fVol
|
||||
aVal = fVal - bVal - pVal
|
||||
aVol = fVol - (bVol + pVol)
|
||||
|
||||
If (bVol + pVol) = 0 Then
|
||||
aPrc = 0
|
||||
Else
|
||||
'aPrc = fVal / fVol - ((bVal + pVal) / (bVol + pVol))
|
||||
aPrc = fPrc - (bPrc + pPrc)
|
||||
End If
|
||||
'End If
|
||||
|
||||
Me.load_mbox_ann
|
||||
|
||||
'build json
|
||||
Set adjust = JsonConverter.ParseJson("{""scenario"":" & scenario & "}")
|
||||
adjust("scenario")("version") = handler.plan
|
||||
adjust("scenario")("iter") = handler.basis
|
||||
adjust("stamp") = Format(Date + time, "yyyy-mm-dd hh:mm:ss")
|
||||
adjust("user") = Application.UserName
|
||||
adjust("source") = "adj"
|
||||
adjust("message") = tbCOM.text
|
||||
adjust("tag") = cbTAG.text
|
||||
adjust("version") = handler.plan
|
||||
|
||||
If opEditSales Then
|
||||
If opPlugVol Then
|
||||
adjust("type") = "scale_v"
|
||||
adjust("amount") = aVal
|
||||
Else
|
||||
adjust("type") = "scale_p"
|
||||
adjust("amount") = aVal
|
||||
End If
|
||||
Else
|
||||
If aVol = 0 Then
|
||||
adjust("type") = "scale_p"
|
||||
Else
|
||||
adjust("type") = "scale_vp"
|
||||
End If
|
||||
adjust("qty") = aVol
|
||||
adjust("amount") = aVal
|
||||
End If
|
||||
|
||||
'print json
|
||||
tbAPI = JsonConverter.ConvertToJson(adjust)
|
||||
End Sub
|
||||
|
||||
Function iter_def(ByVal iter As String) As String
|
||||
|
||||
Dim i As Integer
|
||||
|
||||
For i = 0 To UBound(handler.baseline)
|
||||
If handler.baseline(i) = iter Then
|
||||
iter_def = "baseline"
|
||||
Exit Function
|
||||
End If
|
||||
Next i
|
||||
|
||||
For i = 0 To UBound(handler.adjust)
|
||||
If handler.adjust(i) = iter Then
|
||||
iter_def = "adjust"
|
||||
Exit Function
|
||||
End If
|
||||
Next i
|
||||
|
||||
iter_def = "exclude"
|
||||
|
||||
End Function
|
||||
|
||||
|
||||
|
||||
|
||||
BIN
Master Template.xlsm_EXPORTS/fpvt.frx
Normal file
BIN
Master Template.xlsm_EXPORTS/fpvt.frx
Normal file
Binary file not shown.
474
Master Template.xlsm_EXPORTS/handler.bas
Normal file
474
Master Template.xlsm_EXPORTS/handler.bas
Normal file
@ -0,0 +1,474 @@
|
||||
Attribute VB_Name = "handler"
|
||||
Option Explicit
|
||||
|
||||
Public sql As String
|
||||
Public jsql As String
|
||||
Public scenario As String
|
||||
Public sc() As Variant
|
||||
Public data() As String
|
||||
Public agg() As String
|
||||
Public showprice As Boolean
|
||||
Public server As String
|
||||
Public plan As String
|
||||
Public basis() As Variant
|
||||
Public baseline() As Variant
|
||||
Public adjust() As Variant
|
||||
|
||||
Sub load_fpvt()
|
||||
|
||||
Application.StatusBar = "retrieving selection data....."
|
||||
|
||||
Dim i As Long
|
||||
Dim s_tot As Object
|
||||
|
||||
fpvt.lbSDET.list = handler.sc
|
||||
|
||||
showprice = False
|
||||
|
||||
For i = 0 To UBound(handler.sc, 1)
|
||||
If handler.sc(i, 0) = "part_descr" Then
|
||||
showprice = True
|
||||
Exit For
|
||||
End If
|
||||
Next i
|
||||
|
||||
|
||||
fpvt.Show
|
||||
|
||||
|
||||
|
||||
End Sub
|
||||
|
||||
Function scenario_package(doc As String, ByRef errorMsg As String) As Object
|
||||
Set scenario_package = makeHttpRequest("GET", "scenario_package", doc, errorMsg)
|
||||
End Function
|
||||
|
||||
Sub pg_main_workset(catg As String, rep As String)
|
||||
Dim errorMsg As String
|
||||
Application.StatusBar = "Querying for " & rep & "'s pool of data..."
|
||||
|
||||
shConfig.Range("current_pool").value = "{""scenario"":{""" & catg & """:""" & rep & """}}"
|
||||
|
||||
Dim json As Object
|
||||
Set json = makeHttpRequest("GET", "get_pool", shConfig.Range("current_pool").value, errorMsg)
|
||||
|
||||
If errorMsg <> "" Then
|
||||
MsgBox errorMsg, vbOKOnly + vbExclamation, "Couldn't " & rep & "'s pool of data."
|
||||
Exit Sub
|
||||
End If
|
||||
|
||||
ReDim res(0, 34)
|
||||
res(0, 0) = "bill_cust_descr"
|
||||
res(0, 1) = "billto_group"
|
||||
res(0, 2) = "ship_cust_descr"
|
||||
res(0, 3) = "shipto_group"
|
||||
res(0, 4) = "quota_rep_descr"
|
||||
res(0, 5) = "director"
|
||||
res(0, 6) = "segm"
|
||||
res(0, 7) = "substance"
|
||||
res(0, 8) = "chan"
|
||||
res(0, 9) = "chansub"
|
||||
res(0, 10) = "part_descr"
|
||||
res(0, 11) = "part_group"
|
||||
res(0, 12) = "branding"
|
||||
res(0, 13) = "majg_descr"
|
||||
res(0, 14) = "ming_descr"
|
||||
res(0, 15) = "majs_descr"
|
||||
res(0, 16) = "mins_descr"
|
||||
res(0, 17) = "order_season"
|
||||
res(0, 18) = "order_month"
|
||||
res(0, 19) = "ship_season"
|
||||
res(0, 20) = "ship_month"
|
||||
res(0, 21) = "request_season"
|
||||
res(0, 22) = "request_month"
|
||||
res(0, 23) = "promo"
|
||||
res(0, 24) = "value_loc"
|
||||
res(0, 25) = "value_usd"
|
||||
res(0, 26) = "cost_loc"
|
||||
res(0, 27) = "cost_usd"
|
||||
res(0, 28) = "units"
|
||||
res(0, 29) = "version"
|
||||
res(0, 30) = "iter"
|
||||
res(0, 31) = "logid"
|
||||
res(0, 32) = "tag"
|
||||
res(0, 33) = "comment"
|
||||
res(0, 34) = "pounds"
|
||||
|
||||
shData.Cells.ClearContents
|
||||
Call Utils.SHTp_DumpVar(res, shData.Name, 1, 1, False, True, True)
|
||||
|
||||
Dim batchSize As Integer
|
||||
batchSize = 1000
|
||||
Dim totalRows As Long
|
||||
totalRows = json("x").Count
|
||||
Dim jsonRow As Long
|
||||
jsonRow = 1
|
||||
Dim sheetRow As Long
|
||||
sheetRow = 2
|
||||
Dim arrayRow As Long
|
||||
|
||||
' While the JSON array still has rows,
|
||||
' 1. move the 1st one to a VBA 2-D array, deleting it from the JSON array.
|
||||
' 2. When 1000 have been copied, put the values onto the worksheet, and
|
||||
' empty the VBA array.
|
||||
' Splitting the JSON array into smaller batches when creating the VBA array
|
||||
' means there is less memory needed for the operation.
|
||||
Do While json("x").Count > 0
|
||||
If jsonRow Mod batchSize = 1 Then
|
||||
ReDim res(batchSize - 1, 34)
|
||||
arrayRow = 0
|
||||
End If
|
||||
res(arrayRow, 0) = json("x")(1)("bill_cust_descr")
|
||||
res(arrayRow, 1) = json("x")(1)("billto_group")
|
||||
res(arrayRow, 2) = json("x")(1)("ship_cust_descr")
|
||||
res(arrayRow, 3) = json("x")(1)("shipto_group")
|
||||
res(arrayRow, 4) = json("x")(1)("quota_rep_descr")
|
||||
res(arrayRow, 5) = json("x")(1)("director")
|
||||
res(arrayRow, 6) = json("x")(1)("segm")
|
||||
res(arrayRow, 7) = json("x")(1)("substance")
|
||||
res(arrayRow, 8) = json("x")(1)("chan")
|
||||
res(arrayRow, 9) = json("x")(1)("chansub")
|
||||
res(arrayRow, 10) = json("x")(1)("part_descr")
|
||||
res(arrayRow, 11) = json("x")(1)("part_group")
|
||||
res(arrayRow, 12) = json("x")(1)("branding")
|
||||
res(arrayRow, 13) = json("x")(1)("majg_descr")
|
||||
res(arrayRow, 14) = json("x")(1)("ming_descr")
|
||||
res(arrayRow, 15) = json("x")(1)("majs_descr")
|
||||
res(arrayRow, 16) = json("x")(1)("mins_descr")
|
||||
res(arrayRow, 17) = json("x")(1)("order_season")
|
||||
res(arrayRow, 18) = json("x")(1)("order_month")
|
||||
res(arrayRow, 19) = json("x")(1)("ship_season")
|
||||
res(arrayRow, 20) = json("x")(1)("ship_month")
|
||||
res(arrayRow, 21) = json("x")(1)("request_season")
|
||||
res(arrayRow, 22) = json("x")(1)("request_month")
|
||||
res(arrayRow, 23) = json("x")(1)("promo")
|
||||
res(arrayRow, 24) = json("x")(1)("value_loc")
|
||||
res(arrayRow, 25) = json("x")(1)("value_usd")
|
||||
res(arrayRow, 26) = json("x")(1)("cost_loc")
|
||||
res(arrayRow, 27) = json("x")(1)("cost_usd")
|
||||
res(arrayRow, 28) = json("x")(1)("units")
|
||||
res(arrayRow, 29) = json("x")(1)("version")
|
||||
res(arrayRow, 30) = json("x")(1)("iter")
|
||||
res(arrayRow, 31) = json("x")(1)("logid")
|
||||
res(arrayRow, 32) = json("x")(1)("tag")
|
||||
res(arrayRow, 33) = json("x")(1)("comment")
|
||||
res(arrayRow, 34) = json("x")(1)("pounds")
|
||||
json("x").Remove 1
|
||||
arrayRow = arrayRow + 1
|
||||
If jsonRow Mod batchSize = 0 Or json("x").Count = 0 Then
|
||||
Application.StatusBar = "Populating spreadsheet: " & Format(jsonRow, "#,##0") & " of " & Format(totalRows, "#,##0") & " rows..."
|
||||
Call Utils.SHTp_DumpVar(res, shData.Name, sheetRow, 1, False, True, True)
|
||||
sheetRow = sheetRow + batchSize
|
||||
End If
|
||||
jsonRow = jsonRow + 1
|
||||
Loop
|
||||
|
||||
Set json = Nothing
|
||||
Application.StatusBar = False
|
||||
End Sub
|
||||
|
||||
Sub pull_rep()
|
||||
openf.Show
|
||||
End Sub
|
||||
|
||||
|
||||
|
||||
Sub request_adjust(doc As String, ByRef errorMsg As String)
|
||||
Dim json As Object
|
||||
Set json = JsonConverter.ParseJson(doc)
|
||||
Set json = makeHttpRequest("POST", json("type"), doc, errorMsg)
|
||||
|
||||
If errorMsg <> "" Then
|
||||
Exit Sub
|
||||
End If
|
||||
|
||||
ReDim res(json("x").Count - 1, 34)
|
||||
|
||||
Dim i As Long
|
||||
For i = 0 To UBound(res, 1)
|
||||
res(i, 0) = json("x")(i + 1)("bill_cust_descr")
|
||||
res(i, 1) = json("x")(i + 1)("billto_group")
|
||||
res(i, 2) = json("x")(i + 1)("ship_cust_descr")
|
||||
res(i, 3) = json("x")(i + 1)("shipto_group")
|
||||
res(i, 4) = json("x")(i + 1)("quota_rep_descr")
|
||||
res(i, 5) = json("x")(i + 1)("director")
|
||||
res(i, 6) = json("x")(i + 1)("segm")
|
||||
res(i, 7) = json("x")(i + 1)("substance")
|
||||
res(i, 8) = json("x")(i + 1)("chan")
|
||||
res(i, 9) = json("x")(i + 1)("chansub")
|
||||
res(i, 10) = json("x")(i + 1)("part_descr")
|
||||
res(i, 11) = json("x")(i + 1)("part_group")
|
||||
res(i, 12) = json("x")(i + 1)("branding")
|
||||
res(i, 13) = json("x")(i + 1)("majg_descr")
|
||||
res(i, 14) = json("x")(i + 1)("ming_descr")
|
||||
res(i, 15) = json("x")(i + 1)("majs_descr")
|
||||
res(i, 16) = json("x")(i + 1)("mins_descr")
|
||||
res(i, 17) = json("x")(i + 1)("order_season")
|
||||
res(i, 18) = json("x")(i + 1)("order_month")
|
||||
res(i, 19) = json("x")(i + 1)("ship_season")
|
||||
res(i, 20) = json("x")(i + 1)("ship_month")
|
||||
res(i, 21) = json("x")(i + 1)("request_season")
|
||||
res(i, 22) = json("x")(i + 1)("request_month")
|
||||
res(i, 23) = json("x")(i + 1)("promo")
|
||||
res(i, 24) = json("x")(i + 1)("value_loc")
|
||||
res(i, 25) = json("x")(i + 1)("value_usd")
|
||||
res(i, 26) = json("x")(i + 1)("cost_loc")
|
||||
res(i, 27) = json("x")(i + 1)("cost_usd")
|
||||
res(i, 28) = json("x")(i + 1)("units")
|
||||
res(i, 29) = json("x")(i + 1)("version")
|
||||
res(i, 30) = json("x")(i + 1)("iter")
|
||||
res(i, 31) = json("x")(i + 1)("logid")
|
||||
res(i, 32) = json("x")(i + 1)("tag")
|
||||
res(i, 33) = json("x")(i + 1)("comment")
|
||||
res(i, 34) = json("x")(i + 1)("pounds")
|
||||
Next i
|
||||
|
||||
errorMsg = ""
|
||||
|
||||
i = shData.UsedRange.Rows.Count + 1
|
||||
Call Utils.SHTp_DumpVar(res, shData.Name, i, 1, False, False, True)
|
||||
shOrders.PivotTables("ptOrders").PivotCache.Refresh
|
||||
|
||||
End Sub
|
||||
|
||||
Sub load_config()
|
||||
|
||||
Dim i As Integer
|
||||
'----server to use---------------------------------------------------------
|
||||
handler.server = shConfig.Range("server").value
|
||||
'---basis------------------------------------------------------------------
|
||||
With shConfig.ListObjects("BASIS")
|
||||
For i = 1 To .DataBodyRange.Rows.Count
|
||||
ReDim Preserve handler.basis(i - 1)
|
||||
handler.basis(i - 1) = .DataBodyRange(i, 1)
|
||||
Next
|
||||
End With
|
||||
'---baseline-----------------------------------------------------------------
|
||||
With shConfig.ListObjects("BASELINE")
|
||||
For i = 1 To .DataBodyRange.Rows.Count
|
||||
ReDim Preserve handler.baseline(i - 1)
|
||||
handler.baseline(i - 1) = .DataBodyRange(i, 1)
|
||||
Next
|
||||
End With
|
||||
'---adjustments-----------------------------------------------------------------
|
||||
With shConfig.ListObjects("ADJUST")
|
||||
For i = 1 To .DataBodyRange.Rows.Count
|
||||
ReDim Preserve handler.adjust(i - 1)
|
||||
handler.adjust(i - 1) = .DataBodyRange(i, 1)
|
||||
Next
|
||||
End With
|
||||
'---plan version--------------------------------------------------------------
|
||||
handler.plan = shConfig.Range("budget").value
|
||||
|
||||
End Sub
|
||||
|
||||
Sub month_tosheet(ByRef pkg() As Variant, ByRef basket() As Variant)
|
||||
|
||||
Dim j As Object
|
||||
Dim i As Integer
|
||||
Dim r As Long
|
||||
|
||||
With shMonthUpdate
|
||||
|
||||
Set j = JsonConverter.ParseJson("{""scenario"":" & scenario & "}")
|
||||
.Cells(1, 16) = JsonConverter.ConvertToJson(j)
|
||||
|
||||
For i = 1 To 12
|
||||
'------------volume-------------------
|
||||
.Cells(i + 1, 1) = co_num(pkg(i, 1), 0)
|
||||
.Cells(i + 1, 2) = co_num(pkg(i, 2), 0)
|
||||
.Cells(i + 1, 3) = co_num(pkg(i, 3), 0)
|
||||
.Cells(i + 1, 4) = 0
|
||||
.Cells(i + 1, 5) = co_num(pkg(i, 4), 0)
|
||||
|
||||
'------------value----------------------
|
||||
.Cells(i + 1, 11) = co_num(pkg(i, 5), 0)
|
||||
.Cells(i + 1, 12) = co_num(pkg(i, 6), 0)
|
||||
.Cells(i + 1, 13) = co_num(pkg(i, 7), 0)
|
||||
.Cells(i + 1, 14) = 0
|
||||
.Cells(i + 1, 15) = co_num(pkg(i, 8), 0)
|
||||
|
||||
'-------------price----------------------
|
||||
If i > 0 Then
|
||||
'--prior--
|
||||
If co_num(pkg(i, 1), 0) = 0 Then
|
||||
.Cells(i + 1, 6) = 0
|
||||
Else
|
||||
.Cells(i + 1, 6) = pkg(i, 5) / pkg(i, 1)
|
||||
End If
|
||||
|
||||
'--base--
|
||||
If co_num(pkg(i, 2), 0) = 0 Then
|
||||
'if there is no monthly base volume,
|
||||
'then use the prior price, if there was no prior price,
|
||||
'then inherit the average price for the year before current adjustments
|
||||
If .Cells(i, 7) <> 0 Then
|
||||
.Cells(i + 1, 7) = .Cells(i, 7)
|
||||
Else
|
||||
If pkg(13, 1) + pkg(13, 2) = 0 Then
|
||||
.Cells(i + 1, 7) = 0
|
||||
Else
|
||||
.Cells(i + 1, 7) = (pkg(13, 5) + pkg(13, 6)) / (pkg(13, 1) + pkg(13, 2))
|
||||
End If
|
||||
End If
|
||||
Else
|
||||
.Cells(i + 1, 7) = pkg(i, 6) / pkg(i, 2)
|
||||
End If
|
||||
|
||||
'--adjust--
|
||||
If (pkg(i, 3) + pkg(i, 2)) = 0 Or pkg(i, 2) = 0 Then
|
||||
.Cells(i + 1, 8) = 0
|
||||
Else
|
||||
.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
|
||||
|
||||
'--current adjust--
|
||||
.Cells(i + 1, 9) = 0
|
||||
|
||||
'--forecast--
|
||||
If co_num(pkg(i, 4), 0) = 0 Then
|
||||
'if there is no monthly base volume,
|
||||
'then use the prior price, if there was no prior price,
|
||||
'then inherit the average price for the year before current adjustments
|
||||
If .Cells(i, 10) <> 0 Then
|
||||
.Cells(i + 1, 10) = .Cells(i, 10)
|
||||
Else
|
||||
If pkg(13, 1) + pkg(13, 2) = 0 Then
|
||||
.Cells(i + 1, 10) = 0
|
||||
Else
|
||||
.Cells(i + 1, 10) = (pkg(13, 5) + pkg(13, 6)) / (pkg(13, 1) + pkg(13, 2))
|
||||
End If
|
||||
End If
|
||||
Else
|
||||
.Cells(i + 1, 10) = pkg(i, 8) / pkg(i, 4)
|
||||
End If
|
||||
|
||||
End If
|
||||
|
||||
Next i
|
||||
|
||||
'scenario
|
||||
.Range("R1:S1000").ClearContents
|
||||
For i = 0 To UBound(handler.sc, 1)
|
||||
.Cells(i + 1, 18) = handler.sc(i, 0)
|
||||
.Cells(i + 1, 19) = handler.sc(i, 1)
|
||||
Next i
|
||||
|
||||
'basket
|
||||
.Range("U1:AC100000").ClearContents
|
||||
Call Utils.SHTp_DumpVar(basket, .Name, 1, 21, False, False, True)
|
||||
Call Utils.SHTp_DumpVar(basket, .Name, 1, 26, False, False, True)
|
||||
shConfig.Range("rebuild").value = 0
|
||||
shConfig.Range("show_basket").value = 0
|
||||
shConfig.Range("new_part").value = 0
|
||||
|
||||
shMonthView.LoadSheet
|
||||
|
||||
End With
|
||||
|
||||
End Sub
|
||||
|
||||
Function co_num(ByRef one As Variant, ByRef two As Variant) As Variant
|
||||
|
||||
If one = "" Or IsNull(one) Then
|
||||
co_num = two
|
||||
Else
|
||||
co_num = one
|
||||
End If
|
||||
|
||||
End Function
|
||||
|
||||
|
||||
Function list_changes(ByRef errorMsg As String) As Variant()
|
||||
If shConfig.Range("current_pool").value = "" Then
|
||||
errorMsg = "Nothing to undo. Load some data with the folder icon first."
|
||||
Exit Function
|
||||
End If
|
||||
|
||||
Dim json As Object
|
||||
Set json = makeHttpRequest("GET", "list_changes", shConfig.Range("current_pool").value, errorMsg)
|
||||
|
||||
If errorMsg <> "" Then
|
||||
Exit Function
|
||||
End If
|
||||
|
||||
ReDim res(json("x").Count - 1, 7)
|
||||
|
||||
Dim i As Long
|
||||
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)("doc")
|
||||
Next i
|
||||
|
||||
list_changes = res
|
||||
|
||||
End Function
|
||||
|
||||
Sub undo_changes(ByVal logid As Integer, ByRef errorMsg As String)
|
||||
Dim json As Object
|
||||
Set json = makeHttpRequest("GET", "undo_change", "{""logid"":" & logid & "}", errorMsg)
|
||||
|
||||
logid = json("x")(1)("id")
|
||||
|
||||
'---------loop through and get a list of each row that needs deleted?-----
|
||||
|
||||
Dim i As Long
|
||||
Dim j As Long
|
||||
j = 0
|
||||
For i = 1 To 100
|
||||
If shData.Cells(1, i) = "logid" Then
|
||||
j = i
|
||||
Exit For
|
||||
End If
|
||||
Next i
|
||||
|
||||
If j = 0 Then
|
||||
errorMsg = "Current data set is not tracking changes. Cannot isolate change locally."
|
||||
Exit Sub
|
||||
End If
|
||||
|
||||
i = 2
|
||||
With shData
|
||||
While .Cells(i, 1) <> ""
|
||||
If .Cells(i, j) = logid Then
|
||||
.Rows(i).Delete
|
||||
Else
|
||||
i = i + 1
|
||||
End If
|
||||
Wend
|
||||
End With
|
||||
|
||||
End Sub
|
||||
|
||||
|
||||
Sub history()
|
||||
changes.Show
|
||||
End Sub
|
||||
|
||||
Function get_swap_fit(doc As String, ByRef errorMsg As String) As Variant()
|
||||
Dim json As Object
|
||||
Set json = makeHttpRequest("GET", "swap_fit", doc, errorMsg)
|
||||
|
||||
Dim res() As Variant
|
||||
ReDim res(json("x").Count - 1, 3)
|
||||
|
||||
Dim i As Integer
|
||||
For i = 0 To UBound(res, 1)
|
||||
res(i, 0) = json("x")(i + 1)("part")
|
||||
res(i, 1) = json("x")(i + 1)("value_usd")
|
||||
res(i, 2) = json("x")(i + 1)("swap")
|
||||
res(i, 3) = json("x")(i + 1)("fit")
|
||||
Next i
|
||||
|
||||
get_swap_fit = res
|
||||
|
||||
End Function
|
||||
|
||||
|
||||
|
||||
69
Master Template.xlsm_EXPORTS/openf.frm
Normal file
69
Master Template.xlsm_EXPORTS/openf.frm
Normal file
@ -0,0 +1,69 @@
|
||||
VERSION 5.00
|
||||
Begin {C62A69F0-16DC-11CE-9E98-00AA00574A4F} openf
|
||||
Caption = "Open a Forecast"
|
||||
ClientHeight = 2400
|
||||
ClientLeft = 120
|
||||
ClientTop = 465
|
||||
ClientWidth = 8220.001
|
||||
OleObjectBlob = "openf.frx":0000
|
||||
StartUpPosition = 1 'CenterOwner
|
||||
End
|
||||
Attribute VB_Name = "openf"
|
||||
Attribute VB_GlobalNameSpace = False
|
||||
Attribute VB_Creatable = False
|
||||
Attribute VB_PredeclaredId = True
|
||||
Attribute VB_Exposed = False
|
||||
Private Sub cbCancel_Click()
|
||||
openf.Hide
|
||||
End Sub
|
||||
|
||||
Private Sub cbOK_Click()
|
||||
If opDSM.value Then
|
||||
Call handler.pg_main_workset("quota_rep_descr", cbDSM.value)
|
||||
ElseIf opDirector.value Then
|
||||
Call handler.pg_main_workset("director", cbDirector.value)
|
||||
ElseIf opSegment.value Then
|
||||
Call handler.pg_main_workset("segm", cbSegment.value)
|
||||
End If
|
||||
If ActiveSheet.CodeName = "shOrders" Then
|
||||
shOrders.PivotTables("ptOrders").PivotCache.Refresh
|
||||
Else
|
||||
shShipments.PivotTables("ptShipments").PivotCache.Refresh
|
||||
End If
|
||||
|
||||
openf.Hide
|
||||
End Sub
|
||||
|
||||
Private Sub cbOK_MouseUp(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)
|
||||
If Button = 2 And Shift = 2 Then
|
||||
shConfig.Range("debug_mode") = Not shConfig.Range("debug_mode")
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Private Sub opDSM_Click()
|
||||
cbDSM.Visible = True
|
||||
cbDirector.Visible = False
|
||||
cbSegment.Visible = False
|
||||
End Sub
|
||||
|
||||
Private Sub opDirector_Click()
|
||||
cbDSM.Visible = False
|
||||
cbDirector.Visible = True
|
||||
cbSegment.Visible = False
|
||||
End Sub
|
||||
|
||||
Private Sub opSegment_Click()
|
||||
cbDSM.Visible = False
|
||||
cbDirector.Visible = False
|
||||
cbSegment.Visible = True
|
||||
End Sub
|
||||
|
||||
Private Sub UserForm_Activate()
|
||||
handler.server = shConfig.Range("server").value
|
||||
cbDSM.list = RangeToArray(shSupportingData.ListObjects("DSM").DataBodyRange)
|
||||
cbDirector.list = RangeToArray(shConfig.ListObjects("DIRECTORS").DataBodyRange)
|
||||
cbSegment.list = RangeToArray(shConfig.ListObjects("SEGMENTS").DataBodyRange)
|
||||
End Sub
|
||||
|
||||
|
||||
|
||||
BIN
Master Template.xlsm_EXPORTS/openf.frx
Normal file
BIN
Master Template.xlsm_EXPORTS/openf.frx
Normal file
Binary file not shown.
35
Master Template.xlsm_EXPORTS/part.frm
Normal file
35
Master Template.xlsm_EXPORTS/part.frm
Normal file
@ -0,0 +1,35 @@
|
||||
VERSION 5.00
|
||||
Begin {C62A69F0-16DC-11CE-9E98-00AA00574A4F} part
|
||||
Caption = "Part Picker"
|
||||
ClientHeight = 1335
|
||||
ClientLeft = 120
|
||||
ClientTop = 465
|
||||
ClientWidth = 9285.001
|
||||
OleObjectBlob = "part.frx":0000
|
||||
StartUpPosition = 1 'CenterOwner
|
||||
End
|
||||
Attribute VB_Name = "part"
|
||||
Attribute VB_GlobalNameSpace = False
|
||||
Attribute VB_Creatable = False
|
||||
Attribute VB_PredeclaredId = True
|
||||
Attribute VB_Exposed = False
|
||||
Option Explicit
|
||||
|
||||
Public useval As Boolean
|
||||
|
||||
Private Sub cmdCancel_Click()
|
||||
useval = False
|
||||
Me.Hide
|
||||
End Sub
|
||||
|
||||
Private Sub cmdOK_Click()
|
||||
useval = True
|
||||
Me.Hide
|
||||
End Sub
|
||||
|
||||
Private Sub UserForm_Activate()
|
||||
useval = False
|
||||
cbPart.list = RangeToArray(shSupportingData.ListObjects("ITEM").DataBodyRange)
|
||||
End Sub
|
||||
|
||||
|
||||
BIN
Master Template.xlsm_EXPORTS/part.frx
Normal file
BIN
Master Template.xlsm_EXPORTS/part.frx
Normal file
Binary file not shown.
33
Master Template.xlsm_EXPORTS/shConfig.cls
Normal file
33
Master Template.xlsm_EXPORTS/shConfig.cls
Normal file
@ -0,0 +1,33 @@
|
||||
VERSION 1.0 CLASS
|
||||
BEGIN
|
||||
MultiUse = -1 'True
|
||||
END
|
||||
Attribute VB_Name = "shConfig"
|
||||
Attribute VB_GlobalNameSpace = False
|
||||
Attribute VB_Creatable = False
|
||||
Attribute VB_PredeclaredId = True
|
||||
Attribute VB_Exposed = True
|
||||
Option Explicit
|
||||
|
||||
Private Sub Worksheet_Change(ByVal Target As Range)
|
||||
If Intersect(Target, shConfig.Range("debug_mode")) Is Nothing Then Exit Sub
|
||||
|
||||
If shConfig.Range("debug_mode").value Then
|
||||
shConfig.Visible = xlSheetVisible
|
||||
shShipments.Visible = xlSheetVisible
|
||||
'shData.Visible = xlSheetVisible
|
||||
shMonthView.Visible = xlSheetVisible
|
||||
shMonthUpdate.Visible = xlSheetVisible
|
||||
shSupportingData.Visible = xlSheetVisible
|
||||
shWalk.Visible = xlSheetVisible
|
||||
Else
|
||||
shConfig.Visible = xlSheetVeryHidden
|
||||
shShipments.Visible = xlSheetVeryHidden
|
||||
'shData.Visible = xlSheetHidden
|
||||
shMonthView.Visible = xlSheetHidden
|
||||
shMonthUpdate.Visible = xlSheetVeryHidden
|
||||
shSupportingData.Visible = xlSheetVeryHidden
|
||||
shWalk.Visible = xlSheetVeryHidden
|
||||
End If
|
||||
End Sub
|
||||
|
||||
9
Master Template.xlsm_EXPORTS/shData.cls
Normal file
9
Master Template.xlsm_EXPORTS/shData.cls
Normal file
@ -0,0 +1,9 @@
|
||||
VERSION 1.0 CLASS
|
||||
BEGIN
|
||||
MultiUse = -1 'True
|
||||
END
|
||||
Attribute VB_Name = "shData"
|
||||
Attribute VB_GlobalNameSpace = False
|
||||
Attribute VB_Creatable = False
|
||||
Attribute VB_PredeclaredId = True
|
||||
Attribute VB_Exposed = True
|
||||
11
Master Template.xlsm_EXPORTS/shHelp.cls
Normal file
11
Master Template.xlsm_EXPORTS/shHelp.cls
Normal file
@ -0,0 +1,11 @@
|
||||
VERSION 1.0 CLASS
|
||||
BEGIN
|
||||
MultiUse = -1 'True
|
||||
END
|
||||
Attribute VB_Name = "shHelp"
|
||||
Attribute VB_GlobalNameSpace = False
|
||||
Attribute VB_Creatable = False
|
||||
Attribute VB_PredeclaredId = True
|
||||
Attribute VB_Exposed = True
|
||||
Option Explicit
|
||||
|
||||
9
Master Template.xlsm_EXPORTS/shMonthUpdate.cls
Normal file
9
Master Template.xlsm_EXPORTS/shMonthUpdate.cls
Normal file
@ -0,0 +1,9 @@
|
||||
VERSION 1.0 CLASS
|
||||
BEGIN
|
||||
MultiUse = -1 'True
|
||||
END
|
||||
Attribute VB_Name = "shMonthUpdate"
|
||||
Attribute VB_GlobalNameSpace = False
|
||||
Attribute VB_Creatable = False
|
||||
Attribute VB_PredeclaredId = True
|
||||
Attribute VB_Exposed = True
|
||||
909
Master Template.xlsm_EXPORTS/shMonthView.cls
Normal file
909
Master Template.xlsm_EXPORTS/shMonthView.cls
Normal file
@ -0,0 +1,909 @@
|
||||
VERSION 1.0 CLASS
|
||||
BEGIN
|
||||
MultiUse = -1 'True
|
||||
END
|
||||
Attribute VB_Name = "shMonthView"
|
||||
Attribute VB_GlobalNameSpace = False
|
||||
Attribute VB_Creatable = False
|
||||
Attribute VB_PredeclaredId = True
|
||||
Attribute VB_Exposed = True
|
||||
Option Explicit
|
||||
|
||||
Private units() As Variant
|
||||
Private price() As Variant
|
||||
Private sales() As Variant
|
||||
Private tunits() As Variant
|
||||
Private tprice() As Variant
|
||||
Private tsales() As Variant
|
||||
Private busy As Boolean
|
||||
Private vedit As String
|
||||
Private adjust() As Object
|
||||
Private jtext() As Variant
|
||||
Private rollback As Boolean
|
||||
Private scenario() As Variant
|
||||
Private orig As Range
|
||||
Private showbasket As Boolean
|
||||
Private np As Object 'json dedicated to new part scenario
|
||||
Private did_load_config As Boolean
|
||||
|
||||
Public Sub MPP_Down() ' Handler for down-triangle on price percent change.
|
||||
If newpart Then Exit Sub
|
||||
|
||||
With shMonthView.Range("PricePctChange")
|
||||
.value = WorksheetFunction.Max(-0.1, .value - 0.01)
|
||||
End With
|
||||
MPP_Change
|
||||
End Sub
|
||||
|
||||
Public Sub MPP_Up() ' Handler for up-triangle on price percent change.
|
||||
If newpart Then Exit Sub
|
||||
|
||||
With shMonthView.Range("PricePctChange")
|
||||
.value = WorksheetFunction.Min(0.1, .value + 0.01)
|
||||
End With
|
||||
MPP_Change
|
||||
End Sub
|
||||
|
||||
Private Sub MPP_Change()
|
||||
Dim i As Long
|
||||
|
||||
Application.ScreenUpdating = False
|
||||
|
||||
busy = True
|
||||
|
||||
With shMonthView
|
||||
For i = 1 To 12
|
||||
If .Range("PriceBaseline").Cells(i) > 0 Then
|
||||
.Range("PriceNewAdj").Cells(i) = .Range("PriceBaseline").Cells(i) * .Range("PricePctChange")
|
||||
End If
|
||||
Next i
|
||||
End With
|
||||
Me.mvp_adj
|
||||
|
||||
busy = False
|
||||
|
||||
Application.ScreenUpdating = True
|
||||
End Sub
|
||||
|
||||
|
||||
Public Sub MPV_Down() ' Handler for down-triangle on qty percent change.
|
||||
If newpart Then Exit Sub
|
||||
|
||||
With shMonthView.Range("QtyPctChange")
|
||||
.value = WorksheetFunction.Max(-0.1, .value - 0.01)
|
||||
End With
|
||||
MPV_Change
|
||||
End Sub
|
||||
|
||||
Public Sub MPV_Up() ' Handler for up-triangle on qty percent change.
|
||||
If newpart Then Exit Sub
|
||||
|
||||
With shMonthView.Range("QtyPctChange")
|
||||
.value = WorksheetFunction.Min(0.1, .value + 0.01)
|
||||
End With
|
||||
MPV_Change
|
||||
End Sub
|
||||
|
||||
Private Sub MPV_Change()
|
||||
Dim i As Long
|
||||
|
||||
Application.ScreenUpdating = False
|
||||
|
||||
busy = True
|
||||
|
||||
With shMonthView
|
||||
For i = 1 To 12
|
||||
If .Range("QtyBaseline").Cells(i) <> 0 Then
|
||||
.Range("QtyNewAdj").Cells(i) = .Range("QtyBaseline").Cells(i) * .Range("QtyPctChange")
|
||||
End If
|
||||
Next i
|
||||
End With
|
||||
|
||||
busy = False
|
||||
|
||||
Call Me.mvp_adj
|
||||
|
||||
Application.ScreenUpdating = True
|
||||
End Sub
|
||||
|
||||
Public Sub ToggleVolumePrice()
|
||||
shMonthView.Range("MonthAdjustVolume").value = (shMonthView.Range("MonthAdjustVolume").value <> True)
|
||||
shMonthView.Range("MonthAdjustPrice").value = Not shMonthView.Range("MonthAdjustVolume").value
|
||||
End Sub
|
||||
|
||||
Private Sub Worksheet_Change(ByVal Target As Range)
|
||||
'---this needs checked prior to busy check because % increase spinners are flagged as dumps
|
||||
If Not did_load_config Then
|
||||
Call handler.load_config
|
||||
did_load_config = True
|
||||
End If
|
||||
|
||||
If busy Then Exit Sub
|
||||
|
||||
If (IntersectsWith(Target, Range("units")) Or _
|
||||
IntersectsWith(Target, Range("price")) Or _
|
||||
IntersectsWith(Target, Range("sales"))) And _
|
||||
Target.Columns.Count > 1 _
|
||||
Then
|
||||
MsgBox "You can only change one column at a time. Your change will be undone."
|
||||
busy = True
|
||||
Application.Undo
|
||||
busy = False
|
||||
Exit Sub
|
||||
End If
|
||||
|
||||
If IntersectsWith(Target, Range("QtyNewAdj")) Then Call Me.mvp_adj
|
||||
If IntersectsWith(Target, Range("QtyFinal")) Then Call Me.mvp_set
|
||||
If IntersectsWith(Target, Range("PriceNewAdj")) Then Call Me.mvp_adj
|
||||
If IntersectsWith(Target, Range("PriceFinal")) Then Call Me.mvp_set
|
||||
If IntersectsWith(Target, Range("SalesNewAdj")) Then Call Me.ms_adj
|
||||
If IntersectsWith(Target, Range("SalesFinal")) Then Call Me.ms_set
|
||||
|
||||
If IntersectsWith(Target, Range("basket")) And shConfig.Range("show_basket").value = 1 Then
|
||||
If RemoveEmptyBasketLines Then ' Lines were removed
|
||||
GetEditBasket shMonthView.Range("basket").Resize(1, 1) ' Don't "touch" the mix column, so as to rescale all rows proportionally to 100% total.
|
||||
Else
|
||||
GetEditBasket Target
|
||||
End If
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
|
||||
If IntersectsWith(Target, Union(Range("basket_new_item"), Range("basket"))) And shConfig.Range("show_basket").value = 1 Then
|
||||
Cancel = True
|
||||
Call Me.basket_pick(Target)
|
||||
Target.Select
|
||||
End If
|
||||
End Sub
|
||||
|
||||
|
||||
Sub picker_shortcut()
|
||||
If IntersectsWith(Selection, Range("basket")) And shConfig.Range("show_basket").value = 1 Then
|
||||
Call Me.basket_pick(Selection)
|
||||
End If
|
||||
|
||||
End Sub
|
||||
|
||||
Public Function rev_cust(cust As String) As String
|
||||
|
||||
If cust = "" Then
|
||||
rev_cust = ""
|
||||
Exit Function
|
||||
End If
|
||||
|
||||
If InStr(1, cust, " - ") <= 9 Then
|
||||
rev_cust = trim(Mid(cust, 11, 100)) & " - " & trim(Left(cust, 8))
|
||||
Else
|
||||
rev_cust = trim(Right(cust, 8)) & " - " & Mid(cust, 1, InStr(1, cust, " - "))
|
||||
End If
|
||||
|
||||
End Function
|
||||
|
||||
Sub mvp_set()
|
||||
|
||||
Dim i As Integer
|
||||
GetSheet
|
||||
|
||||
For i = 1 To 12
|
||||
If units(i, 5) = "" Then units(i, 5) = 0
|
||||
If price(i, 5) = "" Then price(i, 5) = 0
|
||||
units(i, 4) = units(i, 5) - (units(i, 2) + units(i, 3))
|
||||
price(i, 4) = price(i, 5) - (price(i, 2) + price(i, 3))
|
||||
sales(i, 5) = units(i, 5) * price(i, 5)
|
||||
If units(i, 4) = 0 And price(i, 4) = 0 Then
|
||||
sales(i, 4) = 0
|
||||
Else
|
||||
sales(i, 4) = sales(i, 5) - (sales(i, 2) + sales(i, 3))
|
||||
End If
|
||||
Next i
|
||||
|
||||
CrunchArray
|
||||
BuildJson
|
||||
SetSheet
|
||||
|
||||
|
||||
End Sub
|
||||
|
||||
Sub mvp_adj()
|
||||
|
||||
Dim i As Integer
|
||||
GetSheet
|
||||
|
||||
For i = 1 To 12
|
||||
If units(i, 4) = "" Then units(i, 4) = 0
|
||||
If price(i, 4) = "" Then price(i, 4) = 0
|
||||
units(i, 5) = units(i, 4) + (units(i, 2) + units(i, 3))
|
||||
price(i, 5) = price(i, 4) + (price(i, 2) + price(i, 3))
|
||||
sales(i, 5) = units(i, 5) * price(i, 5)
|
||||
If units(i, 4) = 0 And price(i, 4) = 0 Then
|
||||
sales(i, 4) = 0
|
||||
Else
|
||||
sales(i, 4) = sales(i, 5) - (sales(i, 2) + sales(i, 3))
|
||||
End If
|
||||
Next i
|
||||
|
||||
CrunchArray
|
||||
BuildJson
|
||||
SetSheet
|
||||
|
||||
|
||||
End Sub
|
||||
|
||||
Sub ms_set()
|
||||
|
||||
On Error GoTo errh
|
||||
|
||||
Dim i As Integer
|
||||
GetSheet
|
||||
|
||||
For i = 1 To 12
|
||||
If sales(i, 5) = "" Then sales(i, 5) = 0
|
||||
If Round(sales(i, 5) - (sales(i, 2) + sales(i, 3)), 2) <> Round(sales(i, 4), 2) Then
|
||||
sales(i, 4) = sales(i, 5) - (sales(i, 2) + sales(i, 3))
|
||||
|
||||
If shMonthView.Range("MonthAdjustVolume") Then
|
||||
If co_num(price(i, 5), 0) = 0 Then
|
||||
MsgBox "Volume cannot be automatically adjusted because price is 0. Your change will be undone.", vbOKOnly Or vbExclamation, "Division by zero"
|
||||
busy = True
|
||||
Application.Undo
|
||||
busy = False
|
||||
Exit Sub
|
||||
End If
|
||||
units(i, 5) = sales(i, 5) / price(i, 5)
|
||||
units(i, 4) = units(i, 5) - (units(i, 2) + units(i, 3))
|
||||
|
||||
ElseIf shMonthView.Range("MonthAdjustPrice") Then
|
||||
If co_num(units(i, 5), 0) = 0 Then
|
||||
MsgBox "Price cannot be automatically adjusted because volume is 0. Your change will be undone.", vbOKOnly Or vbExclamation, "Division by zero"
|
||||
busy = True
|
||||
Application.Undo
|
||||
busy = False
|
||||
Exit Sub
|
||||
End If
|
||||
price(i, 5) = sales(i, 5) / units(i, 5)
|
||||
price(i, 4) = price(i, 5) - (price(i, 2) + price(i, 3))
|
||||
|
||||
Else
|
||||
MsgBox "Neither Volume or Price was selected. Your change will be undone", vbOKOnly Or vbExclamation, "Bad Setup"
|
||||
busy = True
|
||||
Application.Undo
|
||||
busy = False
|
||||
Exit Sub
|
||||
End If
|
||||
End If
|
||||
Next i
|
||||
|
||||
CrunchArray
|
||||
BuildJson
|
||||
SetSheet
|
||||
|
||||
errh:
|
||||
If Err.Number <> 0 Then rollback = True
|
||||
|
||||
|
||||
End Sub
|
||||
|
||||
Sub ms_adj()
|
||||
|
||||
Dim i As Integer
|
||||
GetSheet
|
||||
|
||||
For i = 1 To 12
|
||||
If sales(i, 4) = "" Then sales(i, 4) = 0
|
||||
If Round(sales(i, 5), 6) <> Round(sales(i, 2) + sales(i, 3) + sales(i, 4), 6) Then
|
||||
sales(i, 5) = sales(i, 4) + sales(i, 2) + sales(i, 3)
|
||||
|
||||
If shMonthView.Range("MonthAdjustVolume") Then
|
||||
If co_num(price(i, 5), 0) = 0 Then
|
||||
MsgBox "Volume cannot be automatically adjusted because price is 0. Your change will be undone.", vbOKOnly Or vbExclamation, "Division by zero"
|
||||
busy = True
|
||||
Application.Undo
|
||||
busy = False
|
||||
Exit Sub
|
||||
End If
|
||||
units(i, 5) = sales(i, 5) / price(i, 5)
|
||||
units(i, 4) = units(i, 5) - (units(i, 2) + units(i, 3))
|
||||
|
||||
ElseIf shMonthView.Range("MonthAdjustPrice") Then
|
||||
If co_num(units(i, 5), 0) = 0 Then
|
||||
MsgBox "Price cannot be automatically adjusted because volume is 0. Your change will be undone.", vbOKOnly Or vbExclamation, "Division by zero"
|
||||
busy = True
|
||||
Application.Undo
|
||||
busy = False
|
||||
Exit Sub
|
||||
End If
|
||||
price(i, 5) = sales(i, 5) / units(i, 5)
|
||||
price(i, 4) = price(i, 5) - (price(i, 2) + price(i, 3))
|
||||
|
||||
Else
|
||||
MsgBox "Neither Volume or Price was selected. Your change will be undone", vbOKOnly Or vbExclamation, "Bad Setup"
|
||||
busy = True
|
||||
Application.Undo
|
||||
busy = False
|
||||
Exit Sub
|
||||
End If
|
||||
End If
|
||||
Next i
|
||||
|
||||
CrunchArray
|
||||
BuildJson
|
||||
SetSheet
|
||||
|
||||
End Sub
|
||||
|
||||
|
||||
Private Sub GetSheet()
|
||||
With shMonthView
|
||||
units = .Range("units")
|
||||
price = .Range("price")
|
||||
sales = .Range("sales")
|
||||
tunits = .Range("tunits")
|
||||
tprice = .Range("tprice")
|
||||
tsales = .Range("tsales")
|
||||
ReDim adjust(12)
|
||||
End With
|
||||
End Sub
|
||||
|
||||
Private Function basejson() As Object
|
||||
Set basejson = JsonConverter.ParseJson(shMonthUpdate.Range("P1").FormulaR1C1)
|
||||
End Function
|
||||
|
||||
Private Sub SetSheet()
|
||||
|
||||
Dim i As Integer
|
||||
|
||||
busy = True
|
||||
|
||||
With shMonthView
|
||||
.Range("units") = units
|
||||
.Range("price") = price
|
||||
.Range("sales") = sales
|
||||
.Range("tunits").FormulaR1C1 = tunits
|
||||
.Range("tprice").FormulaR1C1 = tprice
|
||||
.Range("tsales").FormulaR1C1 = tsales
|
||||
.Range("scenario").ClearContents
|
||||
|
||||
Call Utils.SHTp_DumpVar(Utils.SHTp_get_block(shMonthUpdate.Range("R1")), .Name, .Range("scenario").row, .Range("scenario").Column, False, False, False)
|
||||
'.Range("B32:Q5000").ClearContents
|
||||
End With
|
||||
|
||||
If Me.newpart Then
|
||||
shMonthUpdate.Range("P2:P13").ClearContents
|
||||
shMonthUpdate.Cells(2, 16) = JsonConverter.ConvertToJson(np)
|
||||
Else
|
||||
For i = 1 To 12
|
||||
shMonthUpdate.Cells(i + 1, 16) = JsonConverter.ConvertToJson(adjust(i))
|
||||
Next i
|
||||
End If
|
||||
|
||||
busy = False
|
||||
|
||||
End Sub
|
||||
|
||||
Public Sub LoadSheet()
|
||||
|
||||
units = shMonthUpdate.Range("A2:E13").FormulaR1C1
|
||||
price = shMonthUpdate.Range("F2:J13").FormulaR1C1
|
||||
sales = shMonthUpdate.Range("K2:O13").FormulaR1C1
|
||||
scenario = shMonthUpdate.Range("R1:S13").FormulaR1C1
|
||||
tunits = shMonthView.Range("tunits")
|
||||
tprice = shMonthView.Range("tprice")
|
||||
tsales = shMonthView.Range("tsales")
|
||||
'reset basket
|
||||
shMonthUpdate.Range("U1:X10000").ClearContents
|
||||
Call Utils.SHTp_DumpVar(Utils.SHTp_get_block(shMonthUpdate.Range("Z1")), shMonthUpdate.Name, 1, 21, False, False, False)
|
||||
ReDim adjust(12)
|
||||
CrunchArray
|
||||
SetSheet
|
||||
Call Me.print_basket
|
||||
did_load_config = False
|
||||
|
||||
End Sub
|
||||
|
||||
Private Sub BuildJson()
|
||||
|
||||
Dim i As Long
|
||||
Dim j As Long
|
||||
Dim pos As Long
|
||||
Dim o As Object
|
||||
Dim m As Object
|
||||
Dim list As Object
|
||||
|
||||
load_config
|
||||
|
||||
ReDim adjust(12)
|
||||
|
||||
If Me.newpart Then
|
||||
Set np = JsonConverter.ParseJson(JsonConverter.ConvertToJson(basejson()))
|
||||
np("stamp") = Format(DateTime.Now, "yyyy-MM-dd hh:mm:ss")
|
||||
np("user") = Application.UserName
|
||||
np("scenario")("version") = handler.plan
|
||||
Set np("scenario")("iter") = JsonConverter.ParseJson("[""copy"",""plan""]")
|
||||
np("source") = "adj"
|
||||
np("type") = "new_basket"
|
||||
np("tag") = shMonthView.Range("MonthTag").value
|
||||
Set m = JsonConverter.ParseJson("{}")
|
||||
End If
|
||||
|
||||
For pos = 1 To 12
|
||||
If Me.newpart Then
|
||||
If sales(pos, 5) <> 0 Then
|
||||
Set o = JsonConverter.ParseJson("{}")
|
||||
o("amount") = sales(pos, 5)
|
||||
o("qty") = units(pos, 5)
|
||||
Set m(shMonthView.Range("OrderMonths").Cells(pos, 1).value) = JsonConverter.ParseJson(JsonConverter.ConvertToJson(o))
|
||||
End If
|
||||
Else
|
||||
'if something is changing
|
||||
If Round(units(pos, 4), 2) <> 0 Or (Round(price(pos, 4), 8) <> 0 And Round(units(pos, 5), 2) <> 0) Then
|
||||
Set adjust(pos) = JsonConverter.ParseJson(JsonConverter.ConvertToJson(basejson()))
|
||||
'if there is no existing volume on the target month but units are being added
|
||||
If units(pos, 2) + units(pos, 3) = 0 And units(pos, 4) <> 0 Then
|
||||
'add month
|
||||
adjust(pos)("type") = "addmonth_vp"
|
||||
adjust(pos)("month") = shMonthView.Range("OrderMonths").Cells(pos, 1)
|
||||
adjust(pos)("qty") = units(pos, 4)
|
||||
adjust(pos)("amount") = sales(pos, 4)
|
||||
Else
|
||||
'scale the existing volume(price) on the target month
|
||||
If Round(price(pos, 4), 8) <> 0 Then
|
||||
If Round(units(pos, 4), 2) <> 0 Then
|
||||
adjust(pos)("type") = "scale_vp"
|
||||
Else
|
||||
adjust(pos)("type") = "scale_p"
|
||||
End If
|
||||
Else
|
||||
'if the target price is the same as average and a month is being added
|
||||
adjust(pos)("type") = "scale_v"
|
||||
End If
|
||||
adjust(pos)("qty") = units(pos, 4)
|
||||
adjust(pos)("amount") = sales(pos, 4)
|
||||
'------------add this in to only scale a particular month--------------------
|
||||
adjust(pos)("scenario")("order_month") = shMonthView.Range("OrderMonths").Cells(pos, 1)
|
||||
End If
|
||||
adjust(pos)("stamp") = Format(DateTime.Now, "yyyy-MM-dd hh:mm:ss")
|
||||
adjust(pos)("user") = Application.UserName
|
||||
adjust(pos)("scenario")("version") = handler.plan
|
||||
adjust(pos)("scenario")("iter") = handler.basis
|
||||
adjust(pos)("source") = "adj"
|
||||
End If
|
||||
End If
|
||||
Next pos
|
||||
|
||||
If Me.newpart Then
|
||||
Set np("months") = JsonConverter.ParseJson(JsonConverter.ConvertToJson(m))
|
||||
np("newpart") = shMonthView.Range("basket").Cells(1, 1).value
|
||||
'get the basket from the sheet
|
||||
Dim basket() As Variant
|
||||
basket = shMonthUpdate.Range("U1").CurrentRegion.value
|
||||
Set m = JsonConverter.ParseJson(Utils.json_from_table(basket, "basket", False))
|
||||
If UBound(basket, 1) <= 2 Then
|
||||
Set np("basket") = JsonConverter.ParseJson("[" & Utils.json_from_table(basket, "basket", False) & "]")
|
||||
Else
|
||||
Set np("basket") = m("basket")
|
||||
End If
|
||||
End If
|
||||
|
||||
If Me.newpart Then
|
||||
shMonthUpdate.Range("P2:P13").ClearContents
|
||||
shMonthUpdate.Cells(2, 16) = JsonConverter.ConvertToJson(np)
|
||||
Else
|
||||
For i = 1 To 12
|
||||
shMonthUpdate.Cells(i + 1, 16) = JsonConverter.ConvertToJson(adjust(i))
|
||||
Next i
|
||||
End If
|
||||
|
||||
End Sub
|
||||
|
||||
Private Sub CrunchArray()
|
||||
|
||||
Dim i As Integer
|
||||
Dim j As Integer
|
||||
|
||||
For i = 1 To 5
|
||||
tunits(1, i) = 0
|
||||
tprice(1, i) = 0
|
||||
tsales(1, i) = 0
|
||||
Next i
|
||||
|
||||
For i = 1 To 12
|
||||
For j = 1 To 5
|
||||
tunits(1, j) = tunits(1, j) + units(i, j)
|
||||
tsales(1, j) = tsales(1, j) + sales(i, j)
|
||||
Next j
|
||||
Next i
|
||||
|
||||
'prior
|
||||
If tunits(1, 1) = 0 Then
|
||||
tprice(1, 1) = 0
|
||||
Else
|
||||
tprice(1, 1) = tsales(1, 1) / tunits(1, 1)
|
||||
End If
|
||||
'base
|
||||
If tunits(1, 2) = 0 Then
|
||||
tprice(1, 2) = 0
|
||||
Else
|
||||
tprice(1, 2) = tsales(1, 2) / tunits(1, 2)
|
||||
End If
|
||||
'forecast
|
||||
If tunits(1, 5) <> 0 Then
|
||||
tprice(1, 5) = tsales(1, 5) / tunits(1, 5)
|
||||
Else
|
||||
tprice(1, 5) = 0
|
||||
End If
|
||||
'adjust
|
||||
If (tunits(1, 2) + tunits(1, 3)) = 0 Then
|
||||
tprice(1, 3) = 0
|
||||
Else
|
||||
tprice(1, 3) = (tsales(1, 2) + tsales(1, 3)) / (tunits(1, 2) + tunits(1, 3)) - tprice(1, 2)
|
||||
End If
|
||||
'current adjust
|
||||
tprice(1, 4) = tprice(1, 5) - (tprice(1, 2) + tprice(1, 3))
|
||||
|
||||
|
||||
End Sub
|
||||
|
||||
Sub Cancel()
|
||||
|
||||
shOrders.Select
|
||||
|
||||
End Sub
|
||||
|
||||
Sub reset()
|
||||
|
||||
LoadSheet
|
||||
|
||||
End Sub
|
||||
|
||||
Sub switch_basket()
|
||||
shConfig.Range("show_basket").value = 1 - shConfig.Range("show_basket").value
|
||||
Call Me.print_basket
|
||||
End Sub
|
||||
|
||||
Sub print_basket()
|
||||
|
||||
If shConfig.Range("show_basket").value = 0 Then
|
||||
busy = True
|
||||
shMonthView.Range("basket").ClearContents
|
||||
busy = False
|
||||
Exit Sub
|
||||
End If
|
||||
|
||||
Dim i As Long
|
||||
Dim basket() As Variant
|
||||
basket = Utils.SHTp_get_block(shMonthUpdate.Range("U1"))
|
||||
|
||||
busy = True
|
||||
|
||||
shMonthView.Range("basket").ClearContents
|
||||
For i = 2 To UBound(basket, 1)
|
||||
shMonthView.Range("basket").Resize(1, 1).Offset(i - 2, 0).value = basket(i, 1)
|
||||
shMonthView.Range("basket").Resize(1, 1).Offset(i - 2, 4).value = basket(i, 2)
|
||||
shMonthView.Range("basket").Resize(1, 1).Offset(i - 2, 10).value = basket(i, 3)
|
||||
shMonthView.Range("basket").Resize(1, 1).Offset(i - 2, 15).value = basket(i, 4)
|
||||
Next i
|
||||
|
||||
busy = False
|
||||
|
||||
End Sub
|
||||
|
||||
|
||||
Sub basket_pick(ByRef Target As Range)
|
||||
Dim i As Long
|
||||
With shMonthView
|
||||
build.Initialize .Cells(Target.row, 2), rev_cust(.Cells(Target.row, 6)), rev_cust(.Cells(Target.row, 12))
|
||||
build.Show
|
||||
|
||||
If build.useval Then
|
||||
busy = True
|
||||
|
||||
.Cells(Target.row + i, 2) = build.cbPart.value
|
||||
.Cells(Target.row + i, 6) = rev_cust(build.cbBill.value)
|
||||
.Cells(Target.row + i, 12) = rev_cust(build.cbShip.value)
|
||||
busy = False
|
||||
GetEditBasket Selection
|
||||
|
||||
End If
|
||||
End With
|
||||
Target.Select
|
||||
End Sub
|
||||
|
||||
Private Function RemoveEmptyBasketLines() As Boolean
|
||||
If busy Then Exit Function
|
||||
busy = True
|
||||
|
||||
RemoveEmptyBasketLines = False
|
||||
Application.ScreenUpdating = False
|
||||
|
||||
Dim lastRow As Long
|
||||
lastRow = shMonthView.UsedRange.row + shMonthView.UsedRange.Rows.Count - 1
|
||||
|
||||
Dim i As Long
|
||||
For i = lastRow To shMonthView.Range("basket").row Step -1
|
||||
If WorksheetFunction.CountA(shMonthView.Cells(i, 1).EntireRow) = 0 Then
|
||||
shMonthView.Cells(i, 1).EntireRow.Delete
|
||||
RemoveEmptyBasketLines = True
|
||||
End If
|
||||
Next
|
||||
|
||||
Application.ScreenUpdating = True
|
||||
|
||||
busy = False
|
||||
End Function
|
||||
|
||||
Private Sub GetEditBasket(touchedCells As Range)
|
||||
Dim i As Long
|
||||
Dim mix As Double
|
||||
Dim touch_mix As Double
|
||||
Dim untouched As Long
|
||||
Dim touch() As Boolean
|
||||
Dim basket() As Variant
|
||||
|
||||
ReDim basket(0, 3)
|
||||
|
||||
i = WorksheetFunction.CountA(Range("basket").Resize(, 1))
|
||||
If i > 0 Then
|
||||
|
||||
ReDim basket(i - 1, 3)
|
||||
ReDim touch(i - 1)
|
||||
untouched = i
|
||||
|
||||
busy = True
|
||||
|
||||
With shMonthView.Range("basket")
|
||||
mix = 0
|
||||
For i = 1 To .Rows.Count
|
||||
basket(i - 1, 0) = .Cells(i, 1)
|
||||
basket(i - 1, 1) = .Cells(i, 5)
|
||||
basket(i - 1, 2) = .Cells(i, 11)
|
||||
basket(i - 1, 3) = .Cells(i, 16) * 1
|
||||
mix = mix + basket(i - 1, 3)
|
||||
If IntersectsWith(touchedCells, .Cells(i, 16)) Then
|
||||
touch_mix = touch_mix + basket(i - 1, 3)
|
||||
touch(i - 1) = True
|
||||
untouched = untouched - 1
|
||||
End If
|
||||
Next
|
||||
|
||||
'evaluate mix changes, force to 100, and update the sheet
|
||||
For i = 0 To UBound(basket, 1)
|
||||
If Not touch(i) Then
|
||||
If mix = touch_mix Then
|
||||
basket(i, 3) = (1 - mix) / untouched
|
||||
Else
|
||||
basket(i, 3) = basket(i, 3) + basket(i, 3) * (1 - mix) / (mix - touch_mix)
|
||||
End If
|
||||
.Cells(i + 1, 16) = basket(i, 3)
|
||||
End If
|
||||
Next i
|
||||
|
||||
End With
|
||||
|
||||
busy = False
|
||||
|
||||
shMonthUpdate.Range("U2:X5000").ClearContents
|
||||
Call Utils.SHTp_DumpVar(basket, shMonthUpdate.Name, 2, 21, False, False, True)
|
||||
|
||||
If Me.newpart Then
|
||||
BuildJson
|
||||
End If
|
||||
End If
|
||||
|
||||
End Sub
|
||||
|
||||
|
||||
Sub post_adjust()
|
||||
Dim i As Long
|
||||
Dim msg As String
|
||||
|
||||
If Me.newpart Then
|
||||
If WorksheetFunction.CountA(shMonthView.Range("basket").Resize(, 1)) = 0 Then
|
||||
msg = "At least one row needs to be entered in the lower table. Use the New Business button or double-click in the blue row of the empty table."
|
||||
End If
|
||||
|
||||
If Abs(WorksheetFunction.Sum(shMonthView.Range("basket").Resize(, 1).Offset(0, 15)) - 1#) > 0.000001 Then
|
||||
msg = "The mix column in the lower table does not add up to 100%. Change (or even just retype) one, and the rest will adjust"
|
||||
End If
|
||||
|
||||
If WorksheetFunction.CountIf(shMonthView.Range("SalesFinal"), 0) = 12 And WorksheetFunction.CountIf(shMonthView.Range("SalesNewAdj"), 0) = 12 Then
|
||||
msg = "At least one month needs to have forecast data entered."
|
||||
End If
|
||||
Else
|
||||
If WorksheetFunction.CountA(shMonthUpdate.Range("P2:P13")) = 0 Then msg = "Make sure at least one month has Final values for Volume, Price, and Sales."
|
||||
End If
|
||||
|
||||
If IsEmpty(shMonthView.Range("MonthTag").value) Then msg = "You need to specify a tag for this update."
|
||||
|
||||
If msg <> "" Then
|
||||
MsgBox msg, vbOKOnly Or vbExclamation
|
||||
Exit Sub
|
||||
End If
|
||||
|
||||
Dim adjust As Object
|
||||
Dim jdoc As String
|
||||
|
||||
If Me.newpart Then
|
||||
Set adjust = JsonConverter.ParseJson(shMonthUpdate.Cells(2, 16))
|
||||
adjust("message") = shMonthView.Range("MonthComment").value
|
||||
adjust("tag") = shMonthView.Range("MonthTag").value
|
||||
jdoc = JsonConverter.ConvertToJson(adjust)
|
||||
|
||||
Dim errorMsg As String
|
||||
handler.request_adjust jdoc, errorMsg
|
||||
If errorMsg <> "" Then
|
||||
MsgBox errorMsg, vbOKOnly Or vbCritical, "Adjustment was not made."
|
||||
Exit Sub
|
||||
End If
|
||||
Else
|
||||
Dim allMsg As String
|
||||
For i = 2 To 13
|
||||
If shMonthUpdate.Cells(i, 16) <> "" Then
|
||||
Set adjust = JsonConverter.ParseJson(shMonthUpdate.Cells(i, 16))
|
||||
adjust("message") = shMonthView.Range("MonthComment").value
|
||||
adjust("tag") = shMonthView.Range("MonthTag").value
|
||||
jdoc = JsonConverter.ConvertToJson(adjust)
|
||||
handler.request_adjust jdoc, errorMsg
|
||||
If errorMsg <> "" Then
|
||||
Dim period As String
|
||||
period = Format(i - 1, "00") & " - " & Format(DateSerial(2000, (i - 1) + 5, 1), "mmm")
|
||||
allMsg = IIf(allMsg = "", "", vbNewLine) & period & ": " & msg
|
||||
End If
|
||||
End If
|
||||
Next i
|
||||
|
||||
If allMsg <> "" Then MsgBox allMsg, vbOKOnly Or vbCritical, "Problems Loading Adjustments"
|
||||
End If
|
||||
|
||||
shOrders.Select
|
||||
|
||||
End Sub
|
||||
|
||||
Sub build_new()
|
||||
|
||||
shConfig.Range("rebuild").value = 1
|
||||
Dim i As Long
|
||||
Dim j As Long
|
||||
Dim basket() As Variant
|
||||
Dim m() As Variant
|
||||
|
||||
busy = True
|
||||
|
||||
m = shMonthUpdate.Range("A2:O13").FormulaR1C1
|
||||
|
||||
For i = 1 To UBound(m, 1)
|
||||
For j = 1 To UBound(m, 2)
|
||||
m(i, j) = 0
|
||||
Next j
|
||||
Next i
|
||||
|
||||
shMonthUpdate.Range("A2:O13") = m
|
||||
|
||||
shMonthUpdate.Range("U2:X1000").ClearContents
|
||||
shMonthUpdate.Range("Z2:AC1000").ClearContents
|
||||
shMonthUpdate.Range("R2:S1000").ClearContents
|
||||
LoadSheet
|
||||
|
||||
basket = Utils.SHTp_get_block(shMonthUpdate.Range("U1"))
|
||||
' shMonthView.Cells(32, 2) = basket(1, 1)
|
||||
' shMonthView.Cells(32, 6) = basket(1, 2)
|
||||
' shMonthView.Cells(32, 12) = basket(1, 3)
|
||||
' shMonthView.Cells(32, 17) = basket(1, 4)
|
||||
Call Me.print_basket
|
||||
|
||||
busy = False
|
||||
|
||||
End Sub
|
||||
|
||||
Sub new_part()
|
||||
|
||||
'keep customer mix
|
||||
'add in new part number
|
||||
'retain to _month
|
||||
'set new part flag
|
||||
|
||||
Dim cust() As String
|
||||
Dim i As Long
|
||||
|
||||
'---------build customer mix-------------------------------------------------------------------
|
||||
|
||||
cust = Utils.SHTp_Get(shMonthUpdate.Name, 1, 27, True)
|
||||
If Not Utils.TBLp_Aggregate(cust, True, True, True, Array(0, 1), Array("S", "S"), Array(2)) Then
|
||||
MsgBox "Error building customer mix."
|
||||
End If
|
||||
|
||||
'--------inquire for new part to join with cust mix--------------------------------------------
|
||||
|
||||
part.Show
|
||||
|
||||
If Not part.useval Then
|
||||
Exit Sub
|
||||
End If
|
||||
|
||||
busy = True
|
||||
|
||||
With shMonthView.Range("basket")
|
||||
.ClearContents
|
||||
For i = 1 To UBound(cust, 2)
|
||||
.Cells(i, 1) = part.cbPart.value
|
||||
.Cells(i, 5) = cust(0, i)
|
||||
.Cells(i, 11) = cust(1, i)
|
||||
.Cells(i, 16) = CDbl(cust(2, i))
|
||||
Next i
|
||||
End With
|
||||
|
||||
shConfig.Range("new_part").value = 1
|
||||
|
||||
'------copy revised basket to _month storage---------------------------------------------------
|
||||
|
||||
With shMonthView.Range("basket")
|
||||
i = WorksheetFunction.CountA(.Resize(, 1))
|
||||
If i = 0 Then Exit Sub
|
||||
|
||||
ReDim basket(i - 1, 3)
|
||||
|
||||
For i = 1 To .Rows.Count
|
||||
basket(i - 1, 0) = .Cells(i, 1)
|
||||
basket(i - 1, 1) = .Cells(i, 5)
|
||||
basket(i - 1, 2) = .Cells(i, 11)
|
||||
basket(i - 1, 3) = .Cells(i, 16) * 1
|
||||
Next
|
||||
End With
|
||||
|
||||
shMonthUpdate.Range("U2:AC100000").ClearContents
|
||||
Call Utils.SHTp_DumpVar(basket, shMonthUpdate.Name, 2, 21, False, False, True)
|
||||
Call Utils.SHTp_DumpVar(basket, shMonthUpdate.Name, 2, 26, False, False, True)
|
||||
|
||||
'------reset volume to copy base to forecsat and clear base------------------------------------
|
||||
|
||||
units = shMonthUpdate.Range("A2:E13").FormulaR1C1
|
||||
price = shMonthUpdate.Range("F2:J13").FormulaR1C1
|
||||
sales = shMonthUpdate.Range("K2:O13").FormulaR1C1
|
||||
tunits = shMonthView.Range("tunits")
|
||||
tprice = shMonthView.Range("tprice")
|
||||
tsales = shMonthView.Range("tsales")
|
||||
ReDim adjust(12)
|
||||
For i = 1 To 12
|
||||
'volume
|
||||
units(i, 5) = 0 'units(i, 2)
|
||||
units(i, 4) = 0 'units(i, 2)
|
||||
units(i, 1) = 0
|
||||
units(i, 2) = 0
|
||||
units(i, 3) = 0
|
||||
'sales
|
||||
sales(i, 5) = 0 'sales(i, 2)
|
||||
sales(i, 4) = 0 'sales(i, 2)
|
||||
sales(i, 1) = 0
|
||||
sales(i, 2) = 0
|
||||
sales(i, 3) = 0
|
||||
'price
|
||||
price(i, 5) = 0 'price(i, 2)
|
||||
price(i, 4) = 0 'price(i, 2)
|
||||
price(i, 1) = 0
|
||||
price(i, 2) = 0
|
||||
price(i, 3) = 0
|
||||
Next i
|
||||
CrunchArray
|
||||
BuildJson
|
||||
SetSheet
|
||||
|
||||
'-------------push revised arrays back to _month, not revertable-------------------------------
|
||||
|
||||
shMonthUpdate.Range("A2:E13") = units
|
||||
shMonthUpdate.Range("F2:J13") = price
|
||||
shMonthUpdate.Range("K2:o13") = sales
|
||||
|
||||
|
||||
'force basket to show to demonstrate the part was changed
|
||||
shConfig.Range("show_basket").value = 1
|
||||
Call Me.print_basket
|
||||
busy = False
|
||||
|
||||
End Sub
|
||||
|
||||
Function newpart() As Boolean
|
||||
newpart = shConfig.Range("new_part").value = 1
|
||||
End Function
|
||||
|
||||
Private Sub Worksheet_Deactivate()
|
||||
Forecasting.shMonthView.Visible = IIf(shConfig.Range("debug_mode").value, xlSheetVisible, xlSheetHidden)
|
||||
End Sub
|
||||
105
Master Template.xlsm_EXPORTS/shOrders.cls
Normal file
105
Master Template.xlsm_EXPORTS/shOrders.cls
Normal file
@ -0,0 +1,105 @@
|
||||
VERSION 1.0 CLASS
|
||||
BEGIN
|
||||
MultiUse = -1 'True
|
||||
END
|
||||
Attribute VB_Name = "shOrders"
|
||||
Attribute VB_GlobalNameSpace = False
|
||||
Attribute VB_Creatable = False
|
||||
Attribute VB_PredeclaredId = True
|
||||
Attribute VB_Exposed = True
|
||||
Option Explicit
|
||||
|
||||
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
|
||||
Dim pt As PivotTable
|
||||
Set pt = ActiveSheet.PivotTables("ptOrders")
|
||||
|
||||
Dim intersec As Range
|
||||
Set intersec = Intersect(Target, pt.DataBodyRange)
|
||||
|
||||
If intersec Is Nothing Then
|
||||
Exit Sub
|
||||
ElseIf intersec.address <> Target.address Then
|
||||
Exit Sub
|
||||
End If
|
||||
|
||||
Cancel = True
|
||||
|
||||
Dim i As Long
|
||||
Dim j As Long
|
||||
Dim k As Long
|
||||
|
||||
Dim ri As PivotItemList
|
||||
Dim ci As PivotItemList
|
||||
Dim df As Object
|
||||
Dim rd As Object
|
||||
Dim cd As Object
|
||||
Dim dd As Object
|
||||
|
||||
Dim pf As PivotField
|
||||
Dim pi As PivotItem
|
||||
|
||||
' Serialize the report filters in SQL and JSON format.
|
||||
pt.PivotCache.MissingItemsLimit = xlMissingItemsNone
|
||||
pt.PivotCache.Refresh
|
||||
|
||||
Dim segmSql As String
|
||||
Dim segmJSql As String
|
||||
segmSql = "segm IN ("
|
||||
segmJSql = """segm"": ["
|
||||
|
||||
Set pf = pt.PivotFields("segm")
|
||||
For Each pi In pf.PivotItems
|
||||
If pi.Visible Then
|
||||
If Right(segmSql, 1) <> "(" Then
|
||||
segmSql = segmSql & ", "
|
||||
segmJSql = segmJSql & ", "
|
||||
End If
|
||||
segmSql = segmSql & "'" & escape_sql(pi.Name) & "'"
|
||||
segmJSql = segmJSql & """" & escape_json(pi.Name) & """"
|
||||
End If
|
||||
Next
|
||||
segmSql = segmSql & ")"
|
||||
segmJSql = segmJSql & "]"
|
||||
|
||||
' Serialize the row items in SQL and JSON format.
|
||||
Set ri = Target.Cells.PivotCell.RowItems
|
||||
Set ci = Target.Cells.PivotCell.ColumnItems
|
||||
Set df = Target.Cells.PivotCell.DataField
|
||||
|
||||
Set rd = Target.Cells.PivotTable.RowFields
|
||||
Set cd = Target.Cells.PivotTable.ColumnFields
|
||||
|
||||
Dim idx As Integer
|
||||
idx = IIf(Right(segmSql, 2) = "()", 0, 1)
|
||||
|
||||
handler.sql = IIf(idx = 0, "", segmSql)
|
||||
handler.jsql = IIf(idx = 0, "", segmJSql)
|
||||
ReDim handler.sc(ri.Count + idx - 1, 1)
|
||||
|
||||
If idx = 1 Then
|
||||
handler.sc(0, 0) = "segm"
|
||||
handler.sc(0, 1) = Mid(segmJSql, 9)
|
||||
End If
|
||||
|
||||
Dim key As String
|
||||
Dim value As Variant
|
||||
|
||||
For i = 1 To ri.Count
|
||||
key = ri(i).Parent.Name
|
||||
value = ri(i).value
|
||||
|
||||
If handler.sql <> "" Then handler.sql = handler.sql & vbCrLf & "AND "
|
||||
If handler.sql <> "" Then handler.jsql = handler.jsql & vbCrLf & ","
|
||||
handler.sql = handler.sql & key & " = '" & escape_sql(value) & "'"
|
||||
handler.jsql = handler.jsql & """" & key & """:""" & escape_json(value) & """"
|
||||
handler.sc(idx, 0) = key
|
||||
handler.sc(idx, 1) = value
|
||||
idx = idx + 1
|
||||
Next i
|
||||
|
||||
scenario = "{" & handler.jsql & "}"
|
||||
|
||||
Call handler.load_config
|
||||
Call handler.load_fpvt
|
||||
|
||||
End Sub
|
||||
143
Master Template.xlsm_EXPORTS/shShipments.cls
Normal file
143
Master Template.xlsm_EXPORTS/shShipments.cls
Normal file
@ -0,0 +1,143 @@
|
||||
VERSION 1.0 CLASS
|
||||
BEGIN
|
||||
MultiUse = -1 'True
|
||||
END
|
||||
Attribute VB_Name = "shShipments"
|
||||
Attribute VB_GlobalNameSpace = False
|
||||
Attribute VB_Creatable = False
|
||||
Attribute VB_PredeclaredId = True
|
||||
Attribute VB_Exposed = True
|
||||
Option Explicit
|
||||
|
||||
Dim selectedSeason As Integer
|
||||
Dim selectedMonth As Integer
|
||||
|
||||
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
|
||||
Dim pt As PivotTable
|
||||
Set pt = ActiveSheet.PivotTables("ptShipments")
|
||||
|
||||
Dim intersec As Range
|
||||
Set intersec = Intersect(Target, pt.DataBodyRange)
|
||||
|
||||
If intersec Is Nothing Then
|
||||
Exit Sub
|
||||
ElseIf intersec.address <> Target.address Then
|
||||
Exit Sub
|
||||
End If
|
||||
|
||||
Cancel = True
|
||||
|
||||
If Target.value = "" Then
|
||||
MsgBox "You cannot shift an empty cell.", vbOKOnly + vbExclamation
|
||||
Exit Sub
|
||||
End If
|
||||
|
||||
Dim i As Long
|
||||
Dim j As Long
|
||||
Dim k As Long
|
||||
|
||||
Dim ri As PivotItemList
|
||||
Dim ci As PivotItemList
|
||||
Dim df As Object
|
||||
Dim rd As Object
|
||||
Dim cd As Object
|
||||
Dim dd As Object
|
||||
|
||||
Dim pf As PivotField
|
||||
Dim pi As PivotItem
|
||||
|
||||
' Serialize the report filters in SQL and JSON format.
|
||||
pt.PivotCache.MissingItemsLimit = xlMissingItemsNone
|
||||
pt.PivotCache.Refresh
|
||||
|
||||
Dim segmSql As String
|
||||
Dim segmJSql As String
|
||||
segmSql = "segm IN ("
|
||||
segmJSql = """segm"": ["
|
||||
|
||||
Set pf = pt.PivotFields("Segment")
|
||||
For Each pi In pf.PivotItems
|
||||
If pi.Visible Then
|
||||
If Right(segmSql, 1) <> "(" Then
|
||||
segmSql = segmSql & ", "
|
||||
segmJSql = segmJSql & ", "
|
||||
End If
|
||||
segmSql = segmSql & "'" & escape_sql(pi.Name) & "'"
|
||||
segmJSql = segmJSql & """" & escape_json(pi.Name) & """"
|
||||
End If
|
||||
Next
|
||||
segmSql = segmSql & ")"
|
||||
segmJSql = segmJSql & "]"
|
||||
|
||||
' Serialize the row and column items in SQL and JSON format.
|
||||
Set ri = Target.Cells.PivotCell.RowItems
|
||||
Set ci = Target.Cells.PivotCell.ColumnItems
|
||||
Set df = Target.Cells.PivotCell.DataField
|
||||
|
||||
Set rd = Target.Cells.PivotTable.RowFields
|
||||
Set cd = Target.Cells.PivotTable.ColumnFields
|
||||
|
||||
Dim idx As Integer
|
||||
idx = IIf(Right(segmSql, 2) = "()", 0, 1)
|
||||
|
||||
handler.sql = IIf(idx = 0, "", segmSql)
|
||||
handler.jsql = IIf(idx = 0, "", segmJSql)
|
||||
ReDim handler.sc(ri.Count + ci.Count + idx - 1, 1)
|
||||
|
||||
If idx = 1 Then
|
||||
handler.sc(0, 0) = "segm"
|
||||
handler.sc(0, 1) = Mid(segmJSql, 9)
|
||||
End If
|
||||
|
||||
Dim key As String
|
||||
Dim value As Variant
|
||||
|
||||
For i = 1 To ri.Count
|
||||
key = ri(i).Parent.Name
|
||||
value = ri(i).value
|
||||
|
||||
If handler.sql <> "" Then handler.sql = handler.sql & vbCrLf & "AND "
|
||||
If handler.sql <> "" Then handler.jsql = handler.jsql & vbCrLf & ","
|
||||
handler.sql = handler.sql & key & " = '" & escape_sql(value) & "'"
|
||||
handler.jsql = handler.jsql & """" & key & """:""" & escape_json(value) & """"
|
||||
handler.sc(idx, 0) = key
|
||||
handler.sc(idx, 1) = value
|
||||
idx = idx + 1
|
||||
Next i
|
||||
|
||||
For i = 1 To ci.Count
|
||||
key = ci(i).Parent.Name
|
||||
value = ci(i).value
|
||||
|
||||
If handler.sql <> "" Then handler.sql = handler.sql & vbCrLf & "AND "
|
||||
If handler.sql <> "" Then handler.jsql = handler.jsql & vbCrLf & ","
|
||||
handler.sql = handler.sql & key & " = '" & escape_sql(value) & "'"
|
||||
handler.jsql = handler.jsql & """" & key & """:""" & escape_json(value) & """"
|
||||
handler.sc(idx, 0) = key
|
||||
handler.sc(idx, 1) = value
|
||||
idx = idx + 1
|
||||
|
||||
If key = "ship_season" Then selectedSeason = CInt(value)
|
||||
If key = "ship_month" Then selectedMonth = CInt(Left(value, 2))
|
||||
Next
|
||||
|
||||
scenario = "{" & handler.jsql & "}"
|
||||
|
||||
If selectedSeason = 0 Or selectedMonth = 0 Then
|
||||
MsgBox "Invalid pivot table setup. Make sure SHIP_SEASON and SHIP_MONTH are set as pivot table columns.", vbOKOnly + vbExclamation
|
||||
Exit Sub
|
||||
End If
|
||||
|
||||
Call handler.load_config
|
||||
With shipDateShifter
|
||||
.lbSDET.list = handler.sc
|
||||
.selectedSeason = selectedSeason
|
||||
.selectedMonth = selectedMonth
|
||||
.currentValue = Target.value
|
||||
.numberFormat = IIf(df.numberFormat Like "*$*", "$#,##0", "#,##0")
|
||||
.Show
|
||||
End With
|
||||
|
||||
End Sub
|
||||
|
||||
|
||||
9
Master Template.xlsm_EXPORTS/shSupportingData.cls
Normal file
9
Master Template.xlsm_EXPORTS/shSupportingData.cls
Normal file
@ -0,0 +1,9 @@
|
||||
VERSION 1.0 CLASS
|
||||
BEGIN
|
||||
MultiUse = -1 'True
|
||||
END
|
||||
Attribute VB_Name = "shSupportingData"
|
||||
Attribute VB_GlobalNameSpace = False
|
||||
Attribute VB_Creatable = False
|
||||
Attribute VB_PredeclaredId = True
|
||||
Attribute VB_Exposed = True
|
||||
71
Master Template.xlsm_EXPORTS/shWalk.cls
Normal file
71
Master Template.xlsm_EXPORTS/shWalk.cls
Normal file
@ -0,0 +1,71 @@
|
||||
VERSION 1.0 CLASS
|
||||
BEGIN
|
||||
MultiUse = -1 'True
|
||||
END
|
||||
Attribute VB_Name = "shWalk"
|
||||
Attribute VB_GlobalNameSpace = False
|
||||
Attribute VB_Creatable = False
|
||||
Attribute VB_PredeclaredId = True
|
||||
Attribute VB_Exposed = True
|
||||
'Option Explicit
|
||||
'
|
||||
'Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
|
||||
' Dim pt As PivotTable
|
||||
' Set pt = ActiveSheet.PivotTables("ptWalk")
|
||||
' Dim intersec As Range
|
||||
' Set intersec = Intersect(Target, pt.DataBodyRange)
|
||||
'
|
||||
' If intersec Is Nothing Then
|
||||
' Exit Sub
|
||||
' ElseIf intersec.address <> Target.address Then
|
||||
' Exit Sub
|
||||
' End If
|
||||
'
|
||||
' Cancel = True
|
||||
'
|
||||
' Dim i As Long
|
||||
' Dim j As Long
|
||||
' Dim k As Long
|
||||
'
|
||||
' Dim ri As PivotItemList
|
||||
' Dim ci As PivotItemList
|
||||
' Dim df As Object
|
||||
' Dim rd As Object
|
||||
' Dim cd As Object
|
||||
' Dim dd As Object
|
||||
'
|
||||
' Dim pf As PivotField
|
||||
' Dim pi As PivotItem
|
||||
'
|
||||
' Set ri = Target.Cells.PivotCell.RowItems
|
||||
' Set ci = Target.Cells.PivotCell.ColumnItems
|
||||
' Set df = Target.Cells.PivotCell.DataField
|
||||
'
|
||||
' Set rd = Target.Cells.PivotTable.RowFields
|
||||
' Set cd = Target.Cells.PivotTable.ColumnFields
|
||||
'
|
||||
' dim idx as Integer
|
||||
'
|
||||
' handler.sql = ""
|
||||
' handler.jsql = ""
|
||||
' ReDim handler.sc(ri.Count - 1, 1)
|
||||
'
|
||||
' For i = 1 To ri.Count
|
||||
' key = ri(i).Parent.Name
|
||||
' value = ri(i).value
|
||||
|
||||
' If i <> 1 Then handler.sql = handler.sql & vbCrLf & "AND "
|
||||
' If i <> 1 Then handler.jsql = handler.jsql & vbCrLf & ","
|
||||
' handler.sql = handler.sql & key & " = '" & escape_sql(value) & "'"
|
||||
' jsql = jsql & """" & key & """:""" & escape_json(value) & """"
|
||||
' handler.sc(idx, 0) = key
|
||||
' handler.sc(idx, 1) = value
|
||||
' idx = idx + 1
|
||||
' Next i
|
||||
'
|
||||
' scenario = "{" & handler.jsql & "}"
|
||||
'
|
||||
' Call handler.load_config
|
||||
' Call handler.load_fpvt
|
||||
'
|
||||
'End Sub
|
||||
431
Master Template.xlsm_EXPORTS/shipDateShifter.frm
Normal file
431
Master Template.xlsm_EXPORTS/shipDateShifter.frm
Normal file
@ -0,0 +1,431 @@
|
||||
VERSION 5.00
|
||||
Begin {C62A69F0-16DC-11CE-9E98-00AA00574A4F} shipDateShifter
|
||||
Caption = "Ship Date Shifting"
|
||||
ClientHeight = 5205
|
||||
ClientLeft = 120
|
||||
ClientTop = 465
|
||||
ClientWidth = 18375
|
||||
OleObjectBlob = "shipDateShifter.frx":0000
|
||||
StartUpPosition = 1 'CenterOwner
|
||||
End
|
||||
Attribute VB_Name = "shipDateShifter"
|
||||
Attribute VB_GlobalNameSpace = False
|
||||
Attribute VB_Creatable = False
|
||||
Attribute VB_PredeclaredId = True
|
||||
Attribute VB_Exposed = False
|
||||
Option Explicit
|
||||
|
||||
Public selectedSeason As Integer
|
||||
Public selectedMonth As Integer
|
||||
Public currentValue As Double
|
||||
Public numberFormat As String
|
||||
|
||||
Private Sub cmdCancel_Click()
|
||||
Unload Me
|
||||
End Sub
|
||||
|
||||
Private Sub cmdOK_Click()
|
||||
Dim adjust As Object
|
||||
Set adjust = JsonConverter.ParseJson("{""scenario"":" & scenario & ", ""distributions"":[]}")
|
||||
adjust("scenario")("version") = handler.plan
|
||||
adjust("scenario")("iter") = handler.basis
|
||||
adjust("stamp") = Format(Date + time, "yyyy-mm-dd hh:mm:ss")
|
||||
adjust("user") = Application.UserName
|
||||
adjust("source") = "shift"
|
||||
adjust("type") = "shift_ship_dates"
|
||||
adjust("message") = txtComment.text
|
||||
adjust("tag") = "Shift Shipping"
|
||||
adjust("version") = handler.plan
|
||||
|
||||
Dim distribution As Object
|
||||
Dim distributed As Double
|
||||
Dim month As MSForms.TextBox
|
||||
Dim m As Integer
|
||||
For m = 1 To 12
|
||||
Set month = txtMonth(selectedSeason, m)
|
||||
If month.text <> "" Then
|
||||
If m <> selectedMonth Then distributed = distributed + Val(RemoveFormat(month.text))
|
||||
Set distribution = JsonConverter.ParseJson( _
|
||||
"{""ship_season"":" & selectedSeason & "," & _
|
||||
" ""ship_month"": """ & Me.Controls("lblShipMonth" & Format(m, "00")).Caption & """," & _
|
||||
" ""pct"":" & Val(RemoveFormat(month.text)) / currentValue & _
|
||||
"}")
|
||||
adjust("distributions").Add distribution
|
||||
End If
|
||||
Next
|
||||
|
||||
For m = 1 To 12
|
||||
Set month = txtMonth(selectedSeason + 1, m)
|
||||
If month.text <> "" Then
|
||||
distributed = distributed + Val(RemoveFormat(month.text))
|
||||
Set distribution = JsonConverter.ParseJson( _
|
||||
"{""ship_season"":" & selectedSeason + 1 & "," & _
|
||||
" ""ship_month"": """ & Me.Controls("lblShipMonth" & Format(m, "00")).Caption & """," & _
|
||||
" ""pct"":" & Val(RemoveFormat(month.text)) / currentValue & _
|
||||
"}")
|
||||
adjust("distributions").Add distribution
|
||||
End If
|
||||
Next
|
||||
|
||||
If distributed = 0 Then
|
||||
MsgBox "No shifts were specified.", vbOKOnly + vbInformation
|
||||
Exit Sub
|
||||
End If
|
||||
|
||||
Dim errorMsg As String
|
||||
Dim json As Object
|
||||
Set json = makeHttpRequest("POST", "shift_ship_dates", JsonConverter.ConvertToJson(adjust), errorMsg)
|
||||
|
||||
If errorMsg <> "" Then
|
||||
MsgBox errorMsg, vbOKOnly + vbExclamation, "Couldn't shift the selected ship dates."
|
||||
Exit Sub
|
||||
End If
|
||||
|
||||
ReDim res(json("x").Count - 1, 34)
|
||||
|
||||
Dim i As Long
|
||||
For i = 0 To UBound(res, 1)
|
||||
res(i, 0) = json("x")(i + 1)("bill_cust_descr")
|
||||
res(i, 1) = json("x")(i + 1)("billto_group")
|
||||
res(i, 2) = json("x")(i + 1)("ship_cust_descr")
|
||||
res(i, 3) = json("x")(i + 1)("shipto_group")
|
||||
res(i, 4) = json("x")(i + 1)("quota_rep_descr")
|
||||
res(i, 5) = json("x")(i + 1)("director")
|
||||
res(i, 6) = json("x")(i + 1)("segm")
|
||||
res(i, 7) = json("x")(i + 1)("substance")
|
||||
res(i, 8) = json("x")(i + 1)("chan")
|
||||
res(i, 9) = json("x")(i + 1)("chansub")
|
||||
res(i, 10) = json("x")(i + 1)("part_descr")
|
||||
res(i, 11) = json("x")(i + 1)("part_group")
|
||||
res(i, 12) = json("x")(i + 1)("branding")
|
||||
res(i, 13) = json("x")(i + 1)("majg_descr")
|
||||
res(i, 14) = json("x")(i + 1)("ming_descr")
|
||||
res(i, 15) = json("x")(i + 1)("majs_descr")
|
||||
res(i, 16) = json("x")(i + 1)("mins_descr")
|
||||
res(i, 17) = json("x")(i + 1)("order_season")
|
||||
res(i, 18) = json("x")(i + 1)("order_month")
|
||||
res(i, 19) = json("x")(i + 1)("ship_season")
|
||||
res(i, 20) = json("x")(i + 1)("ship_month")
|
||||
res(i, 21) = json("x")(i + 1)("request_season")
|
||||
res(i, 22) = json("x")(i + 1)("request_month")
|
||||
res(i, 23) = json("x")(i + 1)("promo")
|
||||
res(i, 24) = json("x")(i + 1)("value_loc")
|
||||
res(i, 25) = json("x")(i + 1)("value_usd")
|
||||
res(i, 26) = json("x")(i + 1)("cost_loc")
|
||||
res(i, 27) = json("x")(i + 1)("cost_usd")
|
||||
res(i, 28) = json("x")(i + 1)("units")
|
||||
res(i, 29) = json("x")(i + 1)("version")
|
||||
res(i, 30) = json("x")(i + 1)("iter")
|
||||
res(i, 31) = json("x")(i + 1)("logid")
|
||||
res(i, 32) = json("x")(i + 1)("tag")
|
||||
res(i, 33) = json("x")(i + 1)("comment")
|
||||
res(i, 34) = json("x")(i + 1)("pounds")
|
||||
Next i
|
||||
|
||||
errorMsg = ""
|
||||
|
||||
i = shData.UsedRange.Rows.Count + 1
|
||||
Call Utils.SHTp_DumpVar(res, shData.Name, i, 1, False, False, True)
|
||||
shShipments.PivotTables("ptShipments").PivotCache.Refresh
|
||||
|
||||
Unload Me
|
||||
End Sub
|
||||
|
||||
Private Sub UserForm_Activate()
|
||||
Me.Caption = "Ship Date Shifting " & shConfig.Range("version").value
|
||||
|
||||
Call Utils.frmListBoxHeader(Me.lbSHDR, Me.lbSDET, "Field", "Selection")
|
||||
|
||||
With txtSelectedMonth
|
||||
.text = Format(currentValue, numberFormat)
|
||||
.BackColor = &H80000018
|
||||
.Enabled = False
|
||||
End With
|
||||
UpdatePercentages
|
||||
|
||||
lblSeasonCurrent.Caption = selectedSeason
|
||||
lblSeasonNext.Caption = selectedSeason + 1
|
||||
End Sub
|
||||
|
||||
' Control Accessors
|
||||
Private Function txtSelectedMonth() As MSForms.TextBox
|
||||
Set txtSelectedMonth = txtMonth(selectedSeason, selectedMonth)
|
||||
End Function
|
||||
|
||||
Private Function txtMonth(season As Integer, month As Integer) As MSForms.TextBox
|
||||
Set txtMonth = Me.Controls("txt" & IIf(season = selectedSeason, "Current", "Next") & Format(month, "00"))
|
||||
End Function
|
||||
|
||||
Private Function lblPctSelectedMonth() As MSForms.Label
|
||||
Set lblPctSelectedMonth = lblPctMonth(selectedSeason, selectedMonth)
|
||||
End Function
|
||||
|
||||
Private Function lblPctMonth(season As Integer, month As Integer) As MSForms.Label
|
||||
Set lblPctMonth = Me.Controls("lblPct" & IIf(season = selectedSeason, "Current", "Next") & Format(month, "00"))
|
||||
End Function
|
||||
|
||||
|
||||
Private Sub RemoveFormatting(txtBx As MSForms.TextBox)
|
||||
txtBx.text = RemoveFormat(txtBx.text)
|
||||
End Sub
|
||||
|
||||
Private Function RemoveFormat(text As String)
|
||||
RemoveFormat = Replace(Replace(text, "$", ""), ",", "")
|
||||
End Function
|
||||
|
||||
Private Sub ApplyFormatting(txtBx As MSForms.TextBox)
|
||||
txtBx.text = Format(txtBx.text, numberFormat)
|
||||
End Sub
|
||||
|
||||
|
||||
Private Function Recalculate(updated As MSForms.TextBox) As Boolean
|
||||
Dim month As MSForms.TextBox
|
||||
Dim distributed As Double
|
||||
Dim before As Double
|
||||
Dim m As Integer
|
||||
For m = 1 To 12
|
||||
Set month = txtMonth(selectedSeason, m)
|
||||
If m < selectedMonth Then before = before + Val(RemoveFormat(month.text))
|
||||
If m <> selectedMonth Then distributed = distributed + Val(RemoveFormat(month.text))
|
||||
|
||||
distributed = distributed + Val(RemoveFormat(txtMonth(selectedSeason + 1, m).text))
|
||||
Next
|
||||
|
||||
Dim remaining As Double
|
||||
remaining = Val(RemoveFormat(txtSelectedMonth.text))
|
||||
|
||||
If remaining = 0 And distributed > currentValue Then
|
||||
MsgBox "You cannot shift more than you started with.", vbOKOnly + vbExclamation
|
||||
Recalculate = True ' Failure. Set Cancel=True to stop leaving the textbox.
|
||||
Exit Function
|
||||
ElseIf distributed <= currentValue Then
|
||||
txtSelectedMonth.text = currentValue - distributed
|
||||
Else
|
||||
updated.text = txtSelectedMonth.text
|
||||
txtSelectedMonth.text = 0
|
||||
End If
|
||||
|
||||
ApplyFormatting updated
|
||||
ApplyFormatting txtSelectedMonth
|
||||
lblWarning.Visible = before > 0
|
||||
|
||||
UpdatePercentages
|
||||
|
||||
Recalculate = False ' Success
|
||||
End Function
|
||||
|
||||
Private Sub UpdatePercentages()
|
||||
Dim m As Integer
|
||||
For m = 1 To 12
|
||||
If txtMonth(selectedSeason, m).text = "" Then
|
||||
lblPctMonth(selectedSeason, m).Caption = ""
|
||||
Else
|
||||
lblPctMonth(selectedSeason, m).Caption = Format(txtMonth(selectedSeason, m).text / currentValue, "0%")
|
||||
End If
|
||||
If txtMonth(selectedSeason + 1, m).text = "" Then
|
||||
lblPctMonth(selectedSeason + 1, m).Caption = ""
|
||||
Else
|
||||
lblPctMonth(selectedSeason + 1, m).Caption = Format(txtMonth(selectedSeason + 1, m).text / currentValue, "0%")
|
||||
End If
|
||||
Next
|
||||
End Sub
|
||||
|
||||
|
||||
' Remove formatting before editing a textbox. After editing, restore formatting,
|
||||
' and recalculate the selected month's value.
|
||||
Private Sub txtCurrent01_Enter()
|
||||
RemoveFormatting txtCurrent01
|
||||
End Sub
|
||||
|
||||
Private Sub txtCurrent01_Exit(ByVal Cancel As MSForms.ReturnBoolean)
|
||||
Cancel = Recalculate(txtCurrent01)
|
||||
End Sub
|
||||
|
||||
Private Sub txtCurrent02_Enter()
|
||||
RemoveFormatting txtCurrent02
|
||||
End Sub
|
||||
|
||||
Private Sub txtCurrent02_Exit(ByVal Cancel As MSForms.ReturnBoolean)
|
||||
Cancel = Recalculate(txtCurrent02)
|
||||
End Sub
|
||||
|
||||
Private Sub txtCurrent03_Enter()
|
||||
RemoveFormatting txtCurrent03
|
||||
End Sub
|
||||
|
||||
Private Sub txtCurrent03_Exit(ByVal Cancel As MSForms.ReturnBoolean)
|
||||
Cancel = Recalculate(txtCurrent03)
|
||||
End Sub
|
||||
|
||||
Private Sub txtCurrent04_Enter()
|
||||
RemoveFormatting txtCurrent04
|
||||
End Sub
|
||||
|
||||
Private Sub txtCurrent04_Exit(ByVal Cancel As MSForms.ReturnBoolean)
|
||||
Cancel = Recalculate(txtCurrent04)
|
||||
End Sub
|
||||
|
||||
Private Sub txtCurrent05_Enter()
|
||||
RemoveFormatting txtCurrent05
|
||||
End Sub
|
||||
|
||||
Private Sub txtCurrent05_Exit(ByVal Cancel As MSForms.ReturnBoolean)
|
||||
Cancel = Recalculate(txtCurrent05)
|
||||
End Sub
|
||||
|
||||
Private Sub txtCurrent06_Enter()
|
||||
RemoveFormatting txtCurrent06
|
||||
End Sub
|
||||
|
||||
Private Sub txtCurrent06_Exit(ByVal Cancel As MSForms.ReturnBoolean)
|
||||
Cancel = Recalculate(txtCurrent06)
|
||||
End Sub
|
||||
|
||||
Private Sub txtCurrent07_Enter()
|
||||
RemoveFormatting txtCurrent07
|
||||
End Sub
|
||||
|
||||
Private Sub txtCurrent07_Exit(ByVal Cancel As MSForms.ReturnBoolean)
|
||||
Cancel = Recalculate(txtCurrent07)
|
||||
End Sub
|
||||
|
||||
Private Sub txtCurrent08_Enter()
|
||||
RemoveFormatting txtCurrent08
|
||||
End Sub
|
||||
|
||||
Private Sub txtCurrent08_Exit(ByVal Cancel As MSForms.ReturnBoolean)
|
||||
Cancel = Recalculate(txtCurrent08)
|
||||
End Sub
|
||||
|
||||
Private Sub txtCurrent09_Enter()
|
||||
RemoveFormatting txtCurrent09
|
||||
End Sub
|
||||
|
||||
Private Sub txtCurrent09_Exit(ByVal Cancel As MSForms.ReturnBoolean)
|
||||
Cancel = Recalculate(txtCurrent09)
|
||||
End Sub
|
||||
|
||||
Private Sub txtCurrent10_Enter()
|
||||
RemoveFormatting txtCurrent10
|
||||
End Sub
|
||||
|
||||
Private Sub txtCurrent10_Exit(ByVal Cancel As MSForms.ReturnBoolean)
|
||||
Cancel = Recalculate(txtCurrent10)
|
||||
End Sub
|
||||
|
||||
Private Sub txtCurrent11_Enter()
|
||||
RemoveFormatting txtCurrent11
|
||||
End Sub
|
||||
|
||||
Private Sub txtCurrent11_Exit(ByVal Cancel As MSForms.ReturnBoolean)
|
||||
Cancel = Recalculate(txtCurrent11)
|
||||
End Sub
|
||||
|
||||
Private Sub txtCurrent12_Enter()
|
||||
RemoveFormatting txtCurrent12
|
||||
End Sub
|
||||
|
||||
Private Sub txtCurrent12_Exit(ByVal Cancel As MSForms.ReturnBoolean)
|
||||
Cancel = Recalculate(txtCurrent12)
|
||||
End Sub
|
||||
|
||||
Private Sub txtNext01_Enter()
|
||||
RemoveFormatting txtNext01
|
||||
End Sub
|
||||
|
||||
Private Sub txtNext01_Exit(ByVal Cancel As MSForms.ReturnBoolean)
|
||||
Cancel = Recalculate(txtNext01)
|
||||
End Sub
|
||||
|
||||
Private Sub txtNext02_Enter()
|
||||
RemoveFormatting txtNext02
|
||||
End Sub
|
||||
|
||||
Private Sub txtNext02_Exit(ByVal Cancel As MSForms.ReturnBoolean)
|
||||
Cancel = Recalculate(txtNext02)
|
||||
End Sub
|
||||
|
||||
Private Sub txtNext03_Enter()
|
||||
RemoveFormatting txtNext03
|
||||
End Sub
|
||||
|
||||
Private Sub txtNext03_Exit(ByVal Cancel As MSForms.ReturnBoolean)
|
||||
Cancel = Recalculate(txtNext03)
|
||||
End Sub
|
||||
|
||||
Private Sub txtNext04_Enter()
|
||||
RemoveFormatting txtNext04
|
||||
End Sub
|
||||
|
||||
Private Sub txtNext04_Exit(ByVal Cancel As MSForms.ReturnBoolean)
|
||||
Cancel = Recalculate(txtNext04)
|
||||
End Sub
|
||||
|
||||
Private Sub txtNext05_Enter()
|
||||
RemoveFormatting txtNext05
|
||||
End Sub
|
||||
|
||||
Private Sub txtNext05_Exit(ByVal Cancel As MSForms.ReturnBoolean)
|
||||
Cancel = Recalculate(txtNext05)
|
||||
End Sub
|
||||
|
||||
Private Sub txtNext06_Enter()
|
||||
RemoveFormatting txtNext06
|
||||
End Sub
|
||||
|
||||
Private Sub txtNext06_Exit(ByVal Cancel As MSForms.ReturnBoolean)
|
||||
Cancel = Recalculate(txtNext06)
|
||||
End Sub
|
||||
|
||||
Private Sub txtNext07_Enter()
|
||||
RemoveFormatting txtNext07
|
||||
End Sub
|
||||
|
||||
Private Sub txtNext07_Exit(ByVal Cancel As MSForms.ReturnBoolean)
|
||||
Cancel = Recalculate(txtNext07)
|
||||
End Sub
|
||||
|
||||
Private Sub txtNext08_Enter()
|
||||
RemoveFormatting txtNext08
|
||||
End Sub
|
||||
|
||||
Private Sub txtNext08_Exit(ByVal Cancel As MSForms.ReturnBoolean)
|
||||
Cancel = Recalculate(txtNext08)
|
||||
End Sub
|
||||
|
||||
Private Sub txtNext09_Enter()
|
||||
RemoveFormatting txtNext09
|
||||
End Sub
|
||||
|
||||
Private Sub txtNext09_Exit(ByVal Cancel As MSForms.ReturnBoolean)
|
||||
Cancel = Recalculate(txtNext09)
|
||||
End Sub
|
||||
|
||||
Private Sub txtNext10_Enter()
|
||||
RemoveFormatting txtNext10
|
||||
End Sub
|
||||
|
||||
Private Sub txtNext10_Exit(ByVal Cancel As MSForms.ReturnBoolean)
|
||||
Cancel = Recalculate(txtNext10)
|
||||
End Sub
|
||||
|
||||
Private Sub txtNext11_Enter()
|
||||
RemoveFormatting txtNext11
|
||||
End Sub
|
||||
|
||||
Private Sub txtNext11_Exit(ByVal Cancel As MSForms.ReturnBoolean)
|
||||
Cancel = Recalculate(txtNext11)
|
||||
End Sub
|
||||
|
||||
Private Sub txtNext12_Enter()
|
||||
RemoveFormatting txtNext12
|
||||
End Sub
|
||||
|
||||
Private Sub txtNext12_Exit(ByVal Cancel As MSForms.ReturnBoolean)
|
||||
Cancel = Recalculate(txtNext12)
|
||||
End Sub
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
BIN
Master Template.xlsm_EXPORTS/shipDateShifter.frx
Normal file
BIN
Master Template.xlsm_EXPORTS/shipDateShifter.frx
Normal file
Binary file not shown.
BIN
VBA/build.frx
BIN
VBA/build.frx
Binary file not shown.
@ -15,6 +15,20 @@ Attribute VB_PredeclaredId = True
|
||||
Attribute VB_Exposed = False
|
||||
Private X As Variant
|
||||
|
||||
Private Sub UserForm_Activate()
|
||||
tbPrint.Value = ""
|
||||
|
||||
Dim fail As Boolean
|
||||
X = handler.list_changes("{""scenario"":{""quota_rep_descr"":""" & shData.Cells(2, 5) & """}}", fail)
|
||||
If fail Then
|
||||
Unload Me
|
||||
MsgBox ("No adjustments have been made.")
|
||||
End
|
||||
End If
|
||||
Me.lbHist.list = X
|
||||
Call Utils.frmListBoxHeader(Me.lbHEAD, Me.lbHist, "Modifier", "Owner", "When", "Tag", "Comment", "Sales", "id")
|
||||
End Sub
|
||||
|
||||
Private Sub cbCancel_Click()
|
||||
Me.Hide
|
||||
End Sub
|
||||
@ -34,25 +48,13 @@ Private Sub lbHist_Change()
|
||||
Next i
|
||||
End Sub
|
||||
|
||||
Private Sub UserForm_Activate()
|
||||
Dim fail As Boolean
|
||||
|
||||
X = handler.list_changes("{""scenario"":{""quota_rep_descr"":""" & shData.Cells(2, 5) & """}}", fail)
|
||||
If fail Then
|
||||
Me.Hide
|
||||
Exit Sub
|
||||
End If
|
||||
Me.lbHist.list = X
|
||||
Call Utils.frmListBoxHeader(Me.lbHEAD, Me.lbHist, "Modifier", "Owner", "When", "Tag", "Comment", "Sales", "id")
|
||||
End Sub
|
||||
|
||||
Sub delete_selected()
|
||||
Dim logid As Integer
|
||||
Dim i As Integer
|
||||
Dim fail As Boolean
|
||||
Dim proceed As Boolean
|
||||
|
||||
If MsgBox("Permanently delete these changes?", vbOKCancel) = vbCancel Then
|
||||
If MsgBox("Permanently delete these changes?", vbYesNo) = vbNo Then
|
||||
Exit Sub
|
||||
End If
|
||||
|
||||
|
||||
BIN
VBA/changes.frx
BIN
VBA/changes.frx
Binary file not shown.
21
VBA/fpvt.frm
21
VBA/fpvt.frm
@ -59,9 +59,8 @@ Private Sub butAdjust_Click()
|
||||
Exit Sub
|
||||
End If
|
||||
|
||||
Call handler.request_adjust(tbAPI.text, fail)
|
||||
If fail Then
|
||||
MsgBox "Adjustment was not made due to error.", vbOKOnly Or vbExclamation
|
||||
If Not handler.request_adjust(tbAPI.text, msg) Then
|
||||
MsgBox msg, vbOKOnly Or vbExclamation, "Adjustment was not made due to error."
|
||||
Exit Sub
|
||||
End If
|
||||
|
||||
@ -98,8 +97,8 @@ End Sub
|
||||
Private Sub opEditPrice_Click()
|
||||
opPlugVol.Visible = False
|
||||
opPlugPrice.Visible = False
|
||||
opPlugPrice.Value = True
|
||||
opPlugVol.Value = False
|
||||
' opPlugPrice.Value = True
|
||||
' opPlugVol.Value = False
|
||||
|
||||
tbFcPrice.Enabled = True
|
||||
tbFcPrice.BackColor = &H80000018
|
||||
@ -181,26 +180,20 @@ End Sub
|
||||
|
||||
Private Sub tbpd_Change()
|
||||
If load_tb Then Exit Sub
|
||||
If Not VBA.IsNumeric(tbpd.Value) Then
|
||||
tbpd = "0"
|
||||
End If
|
||||
If Not VBA.IsNumeric(tbpd.Value) Then Exit Sub
|
||||
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
|
||||
If Not VBA.IsNumeric(tbpd.Value) Then Exit Sub
|
||||
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
|
||||
If Not VBA.IsNumeric(tbpv.Value) Then Exit Sub
|
||||
tbFcVol = (bVol + pVol) * (1 + tbpv.Value / 100)
|
||||
End Sub
|
||||
|
||||
|
||||
BIN
VBA/fpvt.frx
BIN
VBA/fpvt.frx
Binary file not shown.
217
VBA/handler.bas
217
VBA/handler.bas
@ -53,8 +53,12 @@ Function scenario_package(doc As String, ByRef status As Boolean) As Object
|
||||
.Open "GET", server & "/scenario_package", True
|
||||
.SetRequestHeader "Content-Type", "application/json"
|
||||
.Send doc
|
||||
Debug.Print "GET /scenario_package (";
|
||||
Dim t As Single
|
||||
t = Timer
|
||||
.WaitForResponse
|
||||
wr = .ResponseText
|
||||
Debug.Print Timer - t; "sec): "; Left(wr, 200)
|
||||
End With
|
||||
|
||||
Set json = JsonConverter.ParseJson(wr)
|
||||
@ -71,32 +75,37 @@ errh:
|
||||
|
||||
End Function
|
||||
|
||||
Sub pg_main_workset(rep As String)
|
||||
|
||||
Sub pg_main_workset(catg As String, rep As String)
|
||||
|
||||
Dim req As New WinHttp.WinHttpRequest
|
||||
Dim wr As String
|
||||
Dim json As Object
|
||||
Dim i As Long
|
||||
Dim j As Long
|
||||
Dim doc As String
|
||||
Dim res() As Variant
|
||||
Dim str() As String
|
||||
|
||||
doc = "{""quota_rep"":""" & rep & """}"
|
||||
doc = "{""scenario"":{""" & catg & """:""" & rep & """}}"
|
||||
|
||||
Application.StatusBar = "Querying for " & rep & "'s pool of data..."
|
||||
With req
|
||||
.Option(WinHttpRequestOption_SslErrorIgnoreFlags) = SslErrorFlag_Ignore_All
|
||||
.Open "GET", handler.server & "/get_pool", True
|
||||
.SetRequestHeader "Content-Type", "application/json"
|
||||
.Send doc
|
||||
Debug.Print "GET /get_pool (";
|
||||
Dim t As Single
|
||||
t = Timer
|
||||
.WaitForResponse
|
||||
wr = .ResponseText
|
||||
Debug.Print Timer - t; "sec): "; Left(wr, 200)
|
||||
End With
|
||||
|
||||
If Mid(wr, 1, 1) <> "{" Then
|
||||
MsgBox (wr)
|
||||
Exit Sub
|
||||
End If
|
||||
|
||||
Application.StatusBar = "Parsing query results..."
|
||||
Set json = JsonConverter.ParseJson(wr)
|
||||
|
||||
If IsNull(json("x")) Then
|
||||
@ -104,46 +113,7 @@ Sub pg_main_workset(rep As String)
|
||||
Exit Sub
|
||||
End If
|
||||
|
||||
ReDim res(json("x").Count, 34)
|
||||
|
||||
For i = 1 To UBound(res, 1)
|
||||
res(i, 0) = json("x")(i)("bill_cust_descr")
|
||||
res(i, 1) = json("x")(i)("billto_group")
|
||||
res(i, 2) = json("x")(i)("ship_cust_descr")
|
||||
res(i, 3) = json("x")(i)("shipto_group")
|
||||
res(i, 4) = json("x")(i)("quota_rep_descr")
|
||||
res(i, 5) = json("x")(i)("director")
|
||||
res(i, 6) = json("x")(i)("segm")
|
||||
res(i, 7) = json("x")(i)("substance")
|
||||
res(i, 8) = json("x")(i)("chan")
|
||||
res(i, 9) = json("x")(i)("chansub")
|
||||
res(i, 10) = json("x")(i)("part_descr")
|
||||
res(i, 11) = json("x")(i)("part_group")
|
||||
res(i, 12) = json("x")(i)("branding")
|
||||
res(i, 13) = json("x")(i)("majg_descr")
|
||||
res(i, 14) = json("x")(i)("ming_descr")
|
||||
res(i, 15) = json("x")(i)("majs_descr")
|
||||
res(i, 16) = json("x")(i)("mins_descr")
|
||||
res(i, 17) = json("x")(i)("order_season")
|
||||
res(i, 18) = json("x")(i)("order_month")
|
||||
res(i, 19) = json("x")(i)("ship_season")
|
||||
res(i, 20) = json("x")(i)("ship_month")
|
||||
res(i, 21) = json("x")(i)("request_season")
|
||||
res(i, 22) = json("x")(i)("request_month")
|
||||
res(i, 23) = json("x")(i)("promo")
|
||||
res(i, 24) = json("x")(i)("value_loc")
|
||||
res(i, 25) = json("x")(i)("value_usd")
|
||||
res(i, 26) = json("x")(i)("cost_loc")
|
||||
res(i, 27) = json("x")(i)("cost_usd")
|
||||
res(i, 28) = json("x")(i)("units")
|
||||
res(i, 29) = json("x")(i)("version")
|
||||
res(i, 30) = json("x")(i)("iter")
|
||||
res(i, 31) = json("x")(i)("logid")
|
||||
res(i, 32) = json("x")(i)("tag")
|
||||
res(i, 33) = json("x")(i)("comment")
|
||||
res(i, 34) = json("x")(i)("pounds")
|
||||
Next i
|
||||
|
||||
ReDim res(0, 34)
|
||||
res(0, 0) = "bill_cust_descr"
|
||||
res(0, 1) = "billto_group"
|
||||
res(0, 2) = "ship_cust_descr"
|
||||
@ -180,25 +150,86 @@ Sub pg_main_workset(rep As String)
|
||||
res(0, 33) = "comment"
|
||||
res(0, 34) = "pounds"
|
||||
|
||||
Set json = Nothing
|
||||
|
||||
ReDim str(UBound(res, 1), UBound(res, 2))
|
||||
|
||||
shData.Cells.ClearContents
|
||||
Call Utils.SHTp_DumpVar(res, shData.Name, 1, 1, False, True, True)
|
||||
|
||||
Dim batchSize As Integer
|
||||
batchSize = 1000
|
||||
Dim totalRows As Long
|
||||
totalRows = json("x").Count
|
||||
Dim jsonRow As Long
|
||||
jsonRow = 1
|
||||
Dim sheetRow As Long
|
||||
sheetRow = 2
|
||||
Dim arrayRow As Long
|
||||
|
||||
' While the JSON array still has rows,
|
||||
' 1. move the 1st one to a VBA 2-D array, deleting it from the JSON array.
|
||||
' 2. When 1000 have been copied, put the values onto the worksheet, and
|
||||
' empty the VBA array.
|
||||
' Splitting the JSON array into smaller batches when creating the VBA array
|
||||
' means there is less memory needed for the operation.
|
||||
Do While json("x").Count > 0
|
||||
If jsonRow Mod batchSize = 1 Then
|
||||
ReDim res(batchSize - 1, 34)
|
||||
arrayRow = 0
|
||||
End If
|
||||
res(arrayRow, 0) = json("x")(1)("bill_cust_descr")
|
||||
res(arrayRow, 1) = json("x")(1)("billto_group")
|
||||
res(arrayRow, 2) = json("x")(1)("ship_cust_descr")
|
||||
res(arrayRow, 3) = json("x")(1)("shipto_group")
|
||||
res(arrayRow, 4) = json("x")(1)("quota_rep_descr")
|
||||
res(arrayRow, 5) = json("x")(1)("director")
|
||||
res(arrayRow, 6) = json("x")(1)("segm")
|
||||
res(arrayRow, 7) = json("x")(1)("substance")
|
||||
res(arrayRow, 8) = json("x")(1)("chan")
|
||||
res(arrayRow, 9) = json("x")(1)("chansub")
|
||||
res(arrayRow, 10) = json("x")(1)("part_descr")
|
||||
res(arrayRow, 11) = json("x")(1)("part_group")
|
||||
res(arrayRow, 12) = json("x")(1)("branding")
|
||||
res(arrayRow, 13) = json("x")(1)("majg_descr")
|
||||
res(arrayRow, 14) = json("x")(1)("ming_descr")
|
||||
res(arrayRow, 15) = json("x")(1)("majs_descr")
|
||||
res(arrayRow, 16) = json("x")(1)("mins_descr")
|
||||
res(arrayRow, 17) = json("x")(1)("order_season")
|
||||
res(arrayRow, 18) = json("x")(1)("order_month")
|
||||
res(arrayRow, 19) = json("x")(1)("ship_season")
|
||||
res(arrayRow, 20) = json("x")(1)("ship_month")
|
||||
res(arrayRow, 21) = json("x")(1)("request_season")
|
||||
res(arrayRow, 22) = json("x")(1)("request_month")
|
||||
res(arrayRow, 23) = json("x")(1)("promo")
|
||||
res(arrayRow, 24) = json("x")(1)("value_loc")
|
||||
res(arrayRow, 25) = json("x")(1)("value_usd")
|
||||
res(arrayRow, 26) = json("x")(1)("cost_loc")
|
||||
res(arrayRow, 27) = json("x")(1)("cost_usd")
|
||||
res(arrayRow, 28) = json("x")(1)("units")
|
||||
res(arrayRow, 29) = json("x")(1)("version")
|
||||
res(arrayRow, 30) = json("x")(1)("iter")
|
||||
res(arrayRow, 31) = json("x")(1)("logid")
|
||||
res(arrayRow, 32) = json("x")(1)("tag")
|
||||
res(arrayRow, 33) = json("x")(1)("comment")
|
||||
res(arrayRow, 34) = json("x")(1)("pounds")
|
||||
json("x").Remove 1
|
||||
arrayRow = arrayRow + 1
|
||||
If jsonRow Mod batchSize = 0 Or json("x").Count = 0 Then
|
||||
Application.StatusBar = "Populating spreadsheet: " & Format(jsonRow, "#,##0") & " of " & Format(totalRows, "#,##0") & " rows..."
|
||||
Call Utils.SHTp_DumpVar(res, shData.Name, sheetRow, 1, False, True, True)
|
||||
sheetRow = sheetRow + batchSize
|
||||
End If
|
||||
jsonRow = jsonRow + 1
|
||||
Loop
|
||||
|
||||
Set json = Nothing
|
||||
Application.StatusBar = False
|
||||
End Sub
|
||||
|
||||
Sub pull_rep()
|
||||
|
||||
openf.Show
|
||||
|
||||
End Sub
|
||||
|
||||
|
||||
|
||||
Function request_adjust(doc As String, ByRef fail As Boolean) As Object
|
||||
Function request_adjust(doc As String, ByRef msg As String) As Boolean
|
||||
|
||||
Dim req As New WinHttp.WinHttpRequest
|
||||
Dim json As Object
|
||||
@ -207,8 +238,10 @@ Function request_adjust(doc As String, ByRef fail As Boolean) As Object
|
||||
Dim j As Long
|
||||
Dim str() As String
|
||||
|
||||
request_adjust = False
|
||||
|
||||
If doc = "" Then
|
||||
fail = True
|
||||
msg = "No data was given to be processed."
|
||||
Exit Function
|
||||
End If
|
||||
|
||||
@ -224,39 +257,31 @@ Function request_adjust(doc As String, ByRef fail As Boolean) As Object
|
||||
.Open "POST", server & "/" & json("type"), True
|
||||
.SetRequestHeader "Content-Type", "application/json"
|
||||
.Send doc
|
||||
Debug.Print "GET /"; json("type"); " (";
|
||||
Dim t As Single
|
||||
t = Timer
|
||||
.WaitForResponse
|
||||
wr = .ResponseText
|
||||
Debug.Print Timer - t; "sec): "; Left(wr, 200)
|
||||
End With
|
||||
|
||||
If Mid(wr, 2, 5) = "error" Then
|
||||
MsgBox (wr)
|
||||
fail = True
|
||||
Exit Function
|
||||
End If
|
||||
|
||||
If Mid(wr, 1, 6) = "<body>" Then
|
||||
MsgBox (wr)
|
||||
fail = True
|
||||
Exit Function
|
||||
End If
|
||||
|
||||
If Mid(wr, 1, 6) = "<!DOCT" Then
|
||||
MsgBox (wr)
|
||||
fail = True
|
||||
If Mid(wr, 2, 5) = "error" Or _
|
||||
Mid(wr, 1, 6) = "<body>" Or _
|
||||
Mid(wr, 1, 6) = "<!DOCT" _
|
||||
Then
|
||||
msg = wr
|
||||
Exit Function
|
||||
End If
|
||||
|
||||
If Mid(wr, 1, 6) = "null" Then
|
||||
MsgBox ("API route not implemented")
|
||||
fail = True
|
||||
msg = "API route not implemented"
|
||||
Exit Function
|
||||
End If
|
||||
|
||||
Set json = JsonConverter.ParseJson(wr)
|
||||
|
||||
If IsNull(json("x")) Then
|
||||
MsgBox ("No adjustment was made.")
|
||||
fail = False
|
||||
msg = "No adjustment was made."
|
||||
Exit Function
|
||||
End If
|
||||
|
||||
@ -300,30 +325,10 @@ Function request_adjust(doc As String, ByRef fail As Boolean) As Object
|
||||
res(i, 34) = json("x")(i + 1)("pounds")
|
||||
Next i
|
||||
|
||||
Set json = Nothing
|
||||
|
||||
ReDim str(UBound(res, 1), UBound(res, 2))
|
||||
|
||||
' For i = 0 To UBound(res, 1)
|
||||
' For j = 0 To UBound(res, 2)
|
||||
' If IsNull(res(i, j)) Then
|
||||
' str(i, j) = ""
|
||||
' Else
|
||||
' str(i, j) = res(i, j)
|
||||
' End If
|
||||
' Next j
|
||||
' Next i
|
||||
|
||||
i = 1
|
||||
Do Until shData.Cells(i, 1) = ""
|
||||
i = i + 1
|
||||
Loop
|
||||
request_adjust = True
|
||||
|
||||
i = shData.UsedRange.Rows.Count + 1
|
||||
Call Utils.SHTp_DumpVar(res, shData.Name, i, 1, False, False, True)
|
||||
|
||||
|
||||
'Call Utils.SHTp_Dump(str, shData.Name, CLng(i), 1, False, False, 28, 29, 30, 31, 32)
|
||||
|
||||
shOrders.PivotTables("ptOrders").PivotCache.Refresh
|
||||
|
||||
End Function
|
||||
@ -481,8 +486,8 @@ Function list_changes(doc As String, ByRef fail As Boolean) As Variant()
|
||||
Dim req As New WinHttp.WinHttpRequest
|
||||
Dim json As Object
|
||||
Dim wr As String
|
||||
Dim i As Integer
|
||||
Dim j As Integer
|
||||
Dim i As Long
|
||||
Dim j As Long
|
||||
Dim res() As Variant
|
||||
|
||||
If doc = "" Then
|
||||
@ -497,14 +502,17 @@ Function list_changes(doc As String, ByRef fail As Boolean) As Variant()
|
||||
.Open "GET", server & "/list_changes", True
|
||||
.SetRequestHeader "Content-Type", "application/json"
|
||||
.Send doc
|
||||
Debug.Print "GET /list_changes (";
|
||||
Dim t As Single
|
||||
t = Timer
|
||||
.WaitForResponse
|
||||
wr = .ResponseText
|
||||
Debug.Print Timer - t; "sec): "; Left(wr, 200)
|
||||
End With
|
||||
|
||||
Set json = JsonConverter.ParseJson(wr)
|
||||
|
||||
If IsNull(json("x")) Then
|
||||
MsgBox ("No history.")
|
||||
fail = True
|
||||
Exit Function
|
||||
End If
|
||||
@ -531,8 +539,8 @@ Function undo_changes(ByVal logid As Integer, ByRef fail As Boolean) As Variant(
|
||||
Dim req As New WinHttp.WinHttpRequest
|
||||
Dim json As Object
|
||||
Dim wr As String
|
||||
Dim i As Integer
|
||||
Dim j As Integer
|
||||
Dim i As Long
|
||||
Dim j As Long
|
||||
Dim res() As Variant
|
||||
Dim doc As String
|
||||
Dim ds As Worksheet
|
||||
@ -546,8 +554,12 @@ Function undo_changes(ByVal logid As Integer, ByRef fail As Boolean) As Variant(
|
||||
.Open "GET", server & "/undo_change", True
|
||||
.SetRequestHeader "Content-Type", "application/json"
|
||||
.Send doc
|
||||
Debug.Print "GET /undo_change (";
|
||||
Dim t As Single
|
||||
t = Timer
|
||||
.WaitForResponse
|
||||
wr = .ResponseText
|
||||
Debug.Print Timer - t; "sec): "; Left(wr, 200)
|
||||
End With
|
||||
|
||||
Set json = JsonConverter.ParseJson(wr)
|
||||
@ -610,8 +622,12 @@ Function get_swap_fit(doc As String, ByRef fail As Boolean) As Variant()
|
||||
.Open "GET", server & "/swap_fit", True
|
||||
.SetRequestHeader "Content-Type", "application/json"
|
||||
.Send doc
|
||||
Debug.Print "GET /swap_fit (";
|
||||
Dim t As Single
|
||||
t = Timer
|
||||
.WaitForResponse
|
||||
wr = .ResponseText
|
||||
Debug.Print Timer - t; "sec): "; Left(wr, 200)
|
||||
End With
|
||||
|
||||
Set json = JsonConverter.ParseJson(wr)
|
||||
@ -634,3 +650,6 @@ Function get_swap_fit(doc As String, ByRef fail As Boolean) As Variant()
|
||||
get_swap_fit = res
|
||||
|
||||
End Function
|
||||
|
||||
|
||||
|
||||
|
||||
@ -1,10 +1,10 @@
|
||||
VERSION 5.00
|
||||
Begin {C62A69F0-16DC-11CE-9E98-00AA00574A4F} openf
|
||||
Caption = "Open a Forecast"
|
||||
ClientHeight = 1365
|
||||
ClientHeight = 2400
|
||||
ClientLeft = 120
|
||||
ClientTop = 465
|
||||
ClientWidth = 6825
|
||||
ClientWidth = 8220.001
|
||||
OleObjectBlob = "openf.frx":0000
|
||||
StartUpPosition = 1 'CenterOwner
|
||||
End
|
||||
@ -14,27 +14,50 @@ Attribute VB_Creatable = False
|
||||
Attribute VB_PredeclaredId = True
|
||||
Attribute VB_Exposed = False
|
||||
Private Sub cbCancel_Click()
|
||||
|
||||
openf.Hide
|
||||
|
||||
End Sub
|
||||
|
||||
Private Sub cbOK_Click()
|
||||
|
||||
Application.StatusBar = "Retrieving data for " & cbDSM.Value & "....."
|
||||
|
||||
openf.Caption = "Retrieving data......"
|
||||
Call handler.pg_main_workset(cbDSM.Value)
|
||||
If opDSM.Value Then
|
||||
Call handler.pg_main_workset("quota_rep_descr", cbDSM.Value)
|
||||
ElseIf opDirector.Value Then
|
||||
Call handler.pg_main_workset("director", cbDirector.Value)
|
||||
ElseIf opSegment.Value Then
|
||||
Call handler.pg_main_workset("segm", cbSegment.Value)
|
||||
End If
|
||||
shOrders.PivotTables("ptOrders").PivotCache.Refresh
|
||||
Application.StatusBar = False
|
||||
openf.Hide
|
||||
End Sub
|
||||
|
||||
Private Sub cbOK_MouseUp(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)
|
||||
If Button = 2 And Shift = 2 Then
|
||||
shConfig.Range("debug_mode") = Not shConfig.Range("debug_mode")
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Private Sub opDSM_Click()
|
||||
cbDSM.Enabled = True
|
||||
cbDirector.Enabled = False
|
||||
cbSegment.Enabled = False
|
||||
End Sub
|
||||
|
||||
Private Sub opDirector_Click()
|
||||
cbDSM.Enabled = False
|
||||
cbDirector.Enabled = True
|
||||
cbSegment.Enabled = False
|
||||
End Sub
|
||||
|
||||
Private Sub opSegment_Click()
|
||||
cbDSM.Enabled = False
|
||||
cbDirector.Enabled = False
|
||||
cbSegment.Enabled = True
|
||||
End Sub
|
||||
|
||||
Private Sub UserForm_Activate()
|
||||
|
||||
handler.server = shConfig.Range("server").Value
|
||||
cbDSM.list = shSupportingData.ListObjects("DSM").DataBodyRange.Value
|
||||
|
||||
cbDirector.list = shConfig.ListObjects("DIRECTORS").DataBodyRange.Value
|
||||
cbSegment.list = shConfig.ListObjects("SEGMENTS").DataBodyRange.Value
|
||||
End Sub
|
||||
|
||||
|
||||
|
||||
BIN
VBA/openf.frx
BIN
VBA/openf.frx
Binary file not shown.
BIN
VBA/part.frx
BIN
VBA/part.frx
Binary file not shown.
@ -14,14 +14,14 @@ Private Sub Worksheet_Change(ByVal Target As Range)
|
||||
|
||||
If shConfig.Range("debug_mode").Value Then
|
||||
shConfig.Visible = xlSheetVisible
|
||||
shData.Visible = xlSheetVisible
|
||||
'shData.Visible = xlSheetVisible
|
||||
shMonthView.Visible = xlSheetVisible
|
||||
shMonthUpdate.Visible = xlSheetVisible
|
||||
shSupportingData.Visible = xlSheetVisible
|
||||
shWalk.Visible = xlSheetVisible
|
||||
Else
|
||||
shConfig.Visible = xlSheetVeryHidden
|
||||
shData.Visible = xlSheetHidden
|
||||
'shData.Visible = xlSheetHidden
|
||||
shMonthView.Visible = xlSheetHidden
|
||||
shMonthUpdate.Visible = xlSheetVeryHidden
|
||||
shSupportingData.Visible = xlSheetVeryHidden
|
||||
|
||||
@ -418,7 +418,7 @@ Private Sub BuildJson()
|
||||
np("stamp") = Format(DateTime.Now, "yyyy-MM-dd hh:mm:ss")
|
||||
np("user") = Application.UserName
|
||||
np("scenario")("version") = handler.plan
|
||||
Set np("scenario")("iter") = JsonConverter.ParseJson("[""copy""]")
|
||||
Set np("scenario")("iter") = JsonConverter.ParseJson("[""copy"",""plan""]")
|
||||
np("source") = "adj"
|
||||
np("type") = "new_basket"
|
||||
np("tag") = shMonthView.Range("MonthTag").Value
|
||||
@ -440,14 +440,7 @@ Private Sub BuildJson()
|
||||
'if there is no existing volume on the target month but units are being added
|
||||
If units(pos, 2) + units(pos, 3) = 0 And units(pos, 4) <> 0 Then
|
||||
'add month
|
||||
If Round(price(pos, 5), 8) <> Round(tprice(1, 2) + tprice(1, 3), 8) Then
|
||||
'if the target price is diferent from the average and a month is being added
|
||||
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"
|
||||
End If
|
||||
adjust(pos)("month") = shMonthView.Range("OrderMonths").Cells(pos, 1)
|
||||
adjust(pos)("qty") = units(pos, 4)
|
||||
adjust(pos)("amount") = sales(pos, 4)
|
||||
@ -726,7 +719,6 @@ Sub post_adjust()
|
||||
Exit Sub
|
||||
End If
|
||||
|
||||
Dim fail As Boolean
|
||||
Dim adjust As Object
|
||||
Dim jdoc As String
|
||||
|
||||
@ -735,19 +727,27 @@ Sub post_adjust()
|
||||
adjust("message") = shMonthView.Range("MonthComment").Value
|
||||
adjust("tag") = shMonthView.Range("MonthTag").Value
|
||||
jdoc = JsonConverter.ConvertToJson(adjust)
|
||||
Call handler.request_adjust(jdoc, fail)
|
||||
If fail Then Exit Sub
|
||||
If Not handler.request_adjust(jdoc, msg) Then
|
||||
MsgBox msg, vbOKOnly Or vbCritical, "Adjustment was not made."
|
||||
Exit Sub
|
||||
End If
|
||||
Else
|
||||
Dim allMsg As String
|
||||
For i = 2 To 13
|
||||
If shMonthUpdate.Cells(i, 16) <> "" Then
|
||||
Set adjust = JsonConverter.ParseJson(shMonthUpdate.Cells(i, 16))
|
||||
adjust("message") = shMonthView.Range("MonthComment").Value
|
||||
adjust("tag") = shMonthView.Range("MonthTag").Value
|
||||
jdoc = JsonConverter.ConvertToJson(adjust)
|
||||
Call handler.request_adjust(jdoc, fail)
|
||||
If fail Then Exit Sub
|
||||
If Not handler.request_adjust(jdoc, msg) Then
|
||||
Dim period As String
|
||||
period = Format(i - 1, "00") & " - " & Format(DateSerial(2000, (i - 1) + 5, 1), "mmm")
|
||||
allMsg = IIf(allMsg = "", "", vbNewLine) & period & ": " & msg
|
||||
End If
|
||||
End If
|
||||
Next i
|
||||
|
||||
If allMsg <> "" Then MsgBox allMsg, vbOKOnly Or vbCritical, "Problems Loading Adjustments"
|
||||
End If
|
||||
|
||||
shOrders.Select
|
||||
|
||||
@ -1,13 +1,13 @@
|
||||
BEGIN;
|
||||
--\timing
|
||||
--CREATE TABLE IF NOT EXISTS rlarp.osmf_stage AS (SELECT * FROM rlarp.osmf_dev) WITH no data;
|
||||
TRUNCATE TABLE rlarp.osmf_dev;
|
||||
TRUNCATE TABLE rlarp.osmf;
|
||||
|
||||
DROP TABLE IF EXISTS tdr;
|
||||
CREATE TEMP TABLE tdr AS (
|
||||
SELECT
|
||||
DATERANGE('2022-06-01','2023-06-01','[)') drange
|
||||
,DATERANGE(('2022-06-01'::date + '1 year'::interval)::date,('2023-06-01'::date + '1 year'::interval)::date,'[)') repl
|
||||
DATERANGE('2024-06-01','2024-06-01','[)') drange
|
||||
,DATERANGE(('2024-06-01'::date + '1 year'::interval)::date,('2024-06-01'::date + '1 year'::interval)::date,'[)') repl
|
||||
,'1 year'::interval AS incr
|
||||
,(SELECT jsonb_agg(x.v) FROM (VALUES('copy'),('actuals'),('actuals_plug')) AS x(v)) iter
|
||||
);
|
||||
@ -148,7 +148,7 @@ gld AS (
|
||||
,'actuals' "version"
|
||||
,'actuals' iter
|
||||
FROM
|
||||
rlarp.osm_dev o
|
||||
rlarp.osm o
|
||||
--snap the ship dates of the historic fiscal period
|
||||
LEFT OUTER JOIN gld ON
|
||||
gld.fspr = o.fspr
|
||||
@ -295,7 +295,7 @@ SELECT
|
||||
,o.rseas + 1 rseas --incremented
|
||||
,(o.sdate + interval '1 year')::date sdate --incremented
|
||||
,o.sseas + 1 sseas --incremented
|
||||
,'b22' "version"
|
||||
,'b26' "version"
|
||||
,'copy' iter
|
||||
FROM
|
||||
baseline o
|
||||
@ -419,7 +419,7 @@ SELECT * FROM baseline
|
||||
,o.version
|
||||
,o.iter
|
||||
FROM
|
||||
rlarp.osmfs_dev o
|
||||
rlarp.osmf o
|
||||
CROSS JOIN tdr
|
||||
WHERE
|
||||
--collect all the rows in the base period and
|
||||
|
||||
@ -15,14 +15,18 @@
|
||||
** 2. In a proper text editor, aka Neovim, remove all instances of NULL from the exported file, leaving nothing between the commas.
|
||||
** 3. In DBeaver,
|
||||
** a. Log into usmidsap01
|
||||
** b. Navigate to the ubm.rlarp.osm_pool table
|
||||
** c. Right-click, and choose Import Data.
|
||||
** d. Follow the self-explanatory steps in the wizard. Make sure to choose the option to empty the table first.
|
||||
** e. Verify the import worked correctly.
|
||||
** f. Run the following statements to finish setting up the system.
|
||||
** DELETE FROM rlarp.osm_log WHERE id > 1;
|
||||
** b. Run the following statements in the ubm database:
|
||||
** TRUNCATE TABLE rlarp.osm_log CASCADE;
|
||||
**
|
||||
** ALTER SEQUENCE rlarp.osm_log_id_seq RESTART 1;
|
||||
**
|
||||
** INSERT INTO rlarp.osm_log (doc)
|
||||
** SELECT jsonb_build_object('user',current_user,'tag','baseline','type','build_pool','stamp',current_timestamp,'source','top level','message','DON''T UNDO')
|
||||
** c. Navigate to the ubm.rlarp.osm_pool table
|
||||
** d. Right-click, and choose Import Data.
|
||||
** e. Follow the self-explanatory steps in the wizard. Make sure to choose the option to empty the table first.
|
||||
** f. Verify the import worked correctly.
|
||||
**
|
||||
*******************************************************************************************************************************************
|
||||
*******************************************************************************************************************************************
|
||||
|
||||
@ -86,8 +90,8 @@ FROM
|
||||
,[Request Month] AS [request_month]
|
||||
,[Promo Code] AS [promo]
|
||||
,[Financial Statement Line] as [fs_line]
|
||||
,[Inventory Currency] as [r_currency]
|
||||
,[Order Currency] as [c_currency]
|
||||
,[Order Currency] as [r_currency]
|
||||
,[Inventory Currency] as [c_currency]
|
||||
,PRICE.LPP_loc * BASE.Units AS [value_loc]
|
||||
,PRICE.LPP_USD * BASE.Units AS [value_usd]
|
||||
,[Standard Cost Local - Historic] AS [cost_loc]
|
||||
@ -630,9 +634,9 @@ SELECT
|
||||
,[Segment] AS [segm]
|
||||
,CASE WHEN [Major Group] LIKE '610%' THEN 'Fiber' ELSE 'Plastic' END [substance]
|
||||
,[Financial Statement Line] as [fs_line]
|
||||
,[Inventory Currency] as [r_currency]
|
||||
,[Inventory Currency] as [c_currency]
|
||||
,[Value USD]/nullif([Value Local],0) as [r_rate]
|
||||
,[Order Currency] as [c_currency]
|
||||
,[Order Currency] as [r_currency]
|
||||
,[Std Cost USD - Current]/nullif([Std Cost Local - Current],0) as [c_rate]
|
||||
,[Units] AS [units]
|
||||
,[value local] AS [value_loc]
|
||||
@ -664,6 +668,7 @@ UNION ALL
|
||||
--
|
||||
-- OPEN ORDERS GOING INTO THE BEGINNING OF 2024 SEASON --
|
||||
-- THESE WERE BACKED OUT OF THE 2024 BASELINE --
|
||||
|
||||
SELECT
|
||||
CASE
|
||||
WHEN [Ship Season] IS NULL THEN CAST([Promise Season] % 100 AS varchar) + LEFT([Promise Month], 2)
|
||||
@ -693,9 +698,9 @@ SELECT
|
||||
,[Segment] AS [segm]
|
||||
,CASE WHEN [Major Group] LIKE '610%' THEN 'Fiber' ELSE 'Plastic' END [substance]
|
||||
,[Financial Statement Line] as [fs_line]
|
||||
,[Inventory Currency] as [r_currency]
|
||||
,[Inventory Currency] as [c_currency]
|
||||
,[Value USD]/nullif([Value Local],0) as [r_rate]
|
||||
,[Order Currency] as [c_currency]
|
||||
,[Order Currency] as [r_currency]
|
||||
,[Std Cost USD - Current]/nullif([Std Cost Local - Current],0) as [c_rate]
|
||||
,[Units] AS [units]
|
||||
,[value local] AS [value_loc]
|
||||
@ -713,6 +718,7 @@ SELECT
|
||||
,[Ship Date] AS [ship_date]
|
||||
,[Ship Month] AS [ship_month]
|
||||
,[Ship Season] AS [ship_season]
|
||||
,[Promise Date]
|
||||
,'b24' AS [version]
|
||||
,'actuals' AS [iter]
|
||||
,1 AS [logid]
|
||||
|
||||
@ -3,8 +3,8 @@
|
||||
|
||||
/*----------------------------------------------------------------------------------------
|
||||
1. copy existing actuals for the current season (which is incomplete)
|
||||
* for example 6/1/22 -> 3/7/23
|
||||
2. fill out a full year of history by going back 2 years to get 3/8/22 -> 5/31/22
|
||||
* for example 6/1/24 -> 3/15/25
|
||||
2. fill out a full year of history by going back 1 years to get 3/15/24 -> 5/31/24
|
||||
3. stack the results of 1 & 2 and increment all rows by 1 year
|
||||
*/----------------------------------------------------------------------------------------
|
||||
|
||||
@ -33,7 +33,7 @@ baseline AS (
|
||||
,null::text dhpost
|
||||
,o.fspr
|
||||
-----------measures--------------------
|
||||
,null::numeric ddqtoi
|
||||
,o.ddqtoi
|
||||
,null::numeric ddqtsi
|
||||
,null::numeric fgqshp
|
||||
,null::numeric diqtsh
|
||||
@ -102,15 +102,15 @@ baseline AS (
|
||||
,o.r_rate
|
||||
,o.c_currency
|
||||
,o.c_rate
|
||||
,sum(o.fb_qty) fb_qty
|
||||
,sum(o.fb_val_loc) fb_val_loc
|
||||
,sum(o.fb_val_loc_dis) fb_val_loc_dis
|
||||
,sum(o.fb_val_loc_qt) fb_val_loc_qt
|
||||
,sum(o.fb_val_loc_pl) fb_val_loc_pl
|
||||
,sum(o.fb_val_loc_tar) fb_val_loc_tar
|
||||
,sum(o.fb_cst_loc) fb_cst_loc
|
||||
,sum(o.fb_cst_loc_cur) fb_cst_loc_cur
|
||||
,sum(o.fb_cst_loc_fut) fb_cst_loc_fut
|
||||
,ROUND(sum(o.fb_qty) ,5) fb_qty
|
||||
,ROUND(sum(o.fb_val_loc) ,2) fb_val_loc
|
||||
,ROUND(sum(o.fb_val_loc_dis),2) fb_val_loc_dis
|
||||
,ROUND(sum(o.fb_val_loc_qt) ,2) fb_val_loc_qt
|
||||
,ROUND(sum(o.fb_val_loc_pl) ,2) fb_val_loc_pl
|
||||
,ROUND(sum(o.fb_val_loc_tar),2) fb_val_loc_tar
|
||||
,ROUND(sum(o.fb_cst_loc) ,2) fb_cst_loc
|
||||
,ROUND(sum(o.fb_cst_loc_cur),2) fb_cst_loc_cur
|
||||
,ROUND(sum(o.fb_cst_loc_fut),2) fb_cst_loc_fut
|
||||
,o.calc_status
|
||||
,o.flag
|
||||
,o.odate
|
||||
@ -122,8 +122,8 @@ baseline AS (
|
||||
-----when null, greatest/least is just going to act like coalesce
|
||||
,greatest(least(o.sdate,gld.edat),gld.sdat) sdate
|
||||
,ss.ssyr sseas
|
||||
,'b24' "version"
|
||||
,'actuals' iter
|
||||
,'B27' "version"
|
||||
,'Act' iter
|
||||
FROM
|
||||
rlarp.osm o
|
||||
--snap the ship dates of the historic fiscal period
|
||||
@ -135,12 +135,12 @@ baseline AS (
|
||||
WHERE
|
||||
(
|
||||
--base period orders booked....
|
||||
o.odate BETWEEN '2018-06-01' AND '2019-05-31'
|
||||
o.odate BETWEEN '2025-06-01' AND '2026-02-28'
|
||||
--...or any open orders currently booked before cutoff....
|
||||
--OR (o.calc_status IN ('OPEN','BACKORDER') and o.odate < '2023-03-01')
|
||||
--...or anything that shipped in that period
|
||||
--OR ((o.fspr BETWEEN '1901' AND '1912' OR o.fspr = '0000') AND o.sdate < '2023-03-01')
|
||||
OR (o.fspr BETWEEN '1901' AND '1912')
|
||||
OR (o.fspr BETWEEN '2601' AND '2609')
|
||||
)
|
||||
AND fs_line = '41010'
|
||||
AND calc_status <> 'CANCELED'
|
||||
@ -149,6 +149,7 @@ baseline AS (
|
||||
AND version = 'ACTUALS'
|
||||
GROUP BY
|
||||
o.fspr
|
||||
,o.ddqtoi
|
||||
,o.plnt
|
||||
,COALESCE(o.promo,'')
|
||||
,o.terms
|
||||
@ -192,7 +193,7 @@ baseline AS (
|
||||
,null::text dhpost
|
||||
,o.fspr
|
||||
-----------measures--------------------
|
||||
,null::numeric ddqtoi
|
||||
,o.ddqtoi
|
||||
,null::numeric ddqtsi
|
||||
,null::numeric fgqshp
|
||||
,null::numeric diqtsh
|
||||
@ -261,28 +262,28 @@ baseline AS (
|
||||
,o.r_rate
|
||||
,o.c_currency
|
||||
,o.c_rate
|
||||
,sum(o.fb_qty) fb_qty
|
||||
,sum(o.fb_val_loc) fb_val_loc
|
||||
,sum(o.fb_val_loc_dis) fb_val_loc_dis
|
||||
,sum(o.fb_val_loc_qt) fb_val_loc_qt
|
||||
,sum(o.fb_val_loc_pl) fb_val_loc_pl
|
||||
,sum(o.fb_val_loc_tar) fb_val_loc_tar
|
||||
,sum(o.fb_cst_loc) fb_cst_loc
|
||||
,sum(o.fb_cst_loc_cur) fb_cst_loc_cur
|
||||
,sum(o.fb_cst_loc_fut) fb_cst_loc_fut
|
||||
,ROUND(sum(o.fb_qty) ,5) fb_qty
|
||||
,ROUND(sum(o.fb_val_loc) ,2) fb_val_loc
|
||||
,ROUND(sum(o.fb_val_loc_dis),2) fb_val_loc_dis
|
||||
,ROUND(sum(o.fb_val_loc_qt) ,2) fb_val_loc_qt
|
||||
,ROUND(sum(o.fb_val_loc_pl) ,2) fb_val_loc_pl
|
||||
,ROUND(sum(o.fb_val_loc_tar),2) fb_val_loc_tar
|
||||
,ROUND(sum(o.fb_cst_loc) ,2) fb_cst_loc
|
||||
,ROUND(sum(o.fb_cst_loc_cur),2) fb_cst_loc_cur
|
||||
,ROUND(sum(o.fb_cst_loc_fut),2) fb_cst_loc_fut
|
||||
,o.calc_status
|
||||
,o.flag
|
||||
,o.odate + interval '1 year' odate
|
||||
,o.oseas + 5 rseas
|
||||
,o.oseas + 1 rseas
|
||||
,o.rdate + interval '1 year' rdate
|
||||
,o.rseas + 5 rseas
|
||||
,o.rseas + 1 rseas
|
||||
,o.pdate + interval '1 year' pdate
|
||||
,o.pseas + 5 pseas
|
||||
,o.pseas + 1 pseas
|
||||
-----when null, greatest/least is just going to act like coalesce
|
||||
,greatest(least(o.sdate,gld.edat),gld.sdat) + interval '1 year' sdate
|
||||
,ss.ssyr sseas
|
||||
,'b24' "version"
|
||||
,'actuals_plug' iter
|
||||
,'B27' "version"
|
||||
,'ActPlug' iter
|
||||
FROM
|
||||
rlarp.osm o
|
||||
LEFT OUTER JOIN rlarp.gld ON
|
||||
@ -290,18 +291,20 @@ baseline AS (
|
||||
LEFT OUTER JOIN rlarp.gld ss ON
|
||||
greatest(least(o.sdate,gld.edat),gld.sdat) + interval '1 year' BETWEEN ss.sdat AND ss.edat
|
||||
WHERE
|
||||
-- true
|
||||
false
|
||||
--o.odate BETWEEN '2022-03-01' AND '2022-05-31'
|
||||
--AND fs_line = '41010'
|
||||
--AND calc_status <> 'CANCELED'
|
||||
AND o.odate BETWEEN '2025-03-01' AND '2025-05-31'
|
||||
AND fs_line = '41010'
|
||||
AND calc_status <> 'CANCELED'
|
||||
--AND NOT (calc_status = 'CLOSED' AND flag = 'REMAINDER')
|
||||
----OR (
|
||||
---- (o.fspr BETWEEN '2209' AND '2212' OR o.fspr = '0000')
|
||||
---- AND o.sdate BETWEEN '2022-03-01' AND '2022-05-31'
|
||||
----)
|
||||
--AND version = 'ACTUALS'
|
||||
AND version = 'ACTUALS'
|
||||
GROUP BY
|
||||
o.fspr
|
||||
,o.ddqtoi
|
||||
,plnt
|
||||
,COALESCE(o.promo,'')
|
||||
,o.terms
|
||||
@ -345,7 +348,7 @@ baseline AS (
|
||||
,null::text dhpost
|
||||
,o.fspr
|
||||
-----------measures--------------------
|
||||
,null::numeric ddqtoi
|
||||
,o.ddqtoi
|
||||
,null::numeric ddqtsi
|
||||
,null::numeric fgqshp
|
||||
,null::numeric diqtsh
|
||||
@ -414,15 +417,15 @@ baseline AS (
|
||||
,null::numeric r_rate
|
||||
,o.c_currency
|
||||
,null::numeric c_rate
|
||||
,sum(o.fb_qty) fb_qty
|
||||
,sum(o.fb_val_loc) fb_val_loc
|
||||
,sum(o.fb_val_loc_dis) fb_val_loc_dis
|
||||
,sum(o.fb_val_loc_qt) fb_val_loc_qt
|
||||
,sum(o.fb_val_loc_pl) fb_val_loc_pl
|
||||
,sum(o.fb_val_loc_tar) fb_val_loc_tar
|
||||
,sum(o.fb_cst_loc) fb_cst_loc
|
||||
,sum(o.fb_cst_loc_cur) fb_cst_loc_cur
|
||||
,sum(o.fb_cst_loc_fut) fb_cst_loc_fut
|
||||
,ROUND(sum(o.fb_qty) ,5) fb_qty
|
||||
,ROUND(sum(o.fb_val_loc) ,2) fb_val_loc
|
||||
,ROUND(sum(o.fb_val_loc_dis),2) fb_val_loc_dis
|
||||
,ROUND(sum(o.fb_val_loc_qt) ,2) fb_val_loc_qt
|
||||
,ROUND(sum(o.fb_val_loc_pl) ,2) fb_val_loc_pl
|
||||
,ROUND(sum(o.fb_val_loc_tar),2) fb_val_loc_tar
|
||||
,ROUND(sum(o.fb_cst_loc) ,2) fb_cst_loc
|
||||
,ROUND(sum(o.fb_cst_loc_cur),2) fb_cst_loc_cur
|
||||
,ROUND(sum(o.fb_cst_loc_fut),2) fb_cst_loc_fut
|
||||
,o.calc_status
|
||||
,o.flag
|
||||
,o.odate odate
|
||||
@ -434,22 +437,24 @@ baseline AS (
|
||||
-----when null, greatest/least is just going to act like coalesce
|
||||
,greatest(least(o.sdate,gld.edat),gld.sdat) sdate
|
||||
,ss.ssyr sseas
|
||||
,'b24' "version"
|
||||
,'forecast_plug' iter
|
||||
,'B27' "version"
|
||||
,'PFc' iter
|
||||
FROM
|
||||
rlarp.osmp o
|
||||
rlarp.osmfs o
|
||||
LEFT OUTER JOIN rlarp.gld ON
|
||||
gld.fspr = o.fspr
|
||||
LEFT OUTER JOIN rlarp.gld ss ON
|
||||
greatest(least(o.sdate,gld.edat),gld.sdat) BETWEEN ss.sdat AND ss.edat
|
||||
WHERE
|
||||
false
|
||||
--o.odate BETWEEN '2020-03-01' AND '2020-05-31'
|
||||
--AND fs_line = '41010'
|
||||
--AND calc_status <> 'CANCELED'
|
||||
-- false
|
||||
o.odate BETWEEN '2026-03-01' AND '2026-05-31'
|
||||
AND fs_line = '41010'
|
||||
AND calc_status <> 'CANCELED'
|
||||
AND version = '5+7'
|
||||
------dont pull forecast for a baseline this time around--
|
||||
GROUP BY
|
||||
o.fspr
|
||||
,o.ddqtoi
|
||||
,plnt
|
||||
,COALESCE(o.promo,'')
|
||||
,o.terms
|
||||
@ -481,11 +486,11 @@ SELECT
|
||||
,o."dilin#"
|
||||
,o.quoten
|
||||
,o.quotel
|
||||
,o.dcodat + interval '5 years' --incremented
|
||||
,o.ddqdat + interval '5 years' --incremented
|
||||
,o.dcodat + interval '1 years' --incremented
|
||||
,o.ddqdat + interval '1 years' --incremented
|
||||
,o.dcmdat
|
||||
,o.fesdat
|
||||
,o.dhidat + interval '5 years' --incremented
|
||||
,o.dhidat + interval '1 years' --incremented
|
||||
,o.fesind
|
||||
,o.dhpost
|
||||
,gld.fspr --incremented
|
||||
@ -569,20 +574,20 @@ SELECT
|
||||
,o.fb_cst_loc_fut
|
||||
,o.calc_status
|
||||
,o.flag
|
||||
,o.odate + interval '5 years' --incremented
|
||||
,o.oseas + 5 --incremented
|
||||
,o.rdate + interval '5 years' --incremented
|
||||
,o.rseas + 5 --incremented
|
||||
,o.pdate + interval '5 years' --incremented
|
||||
,o.pseas + 5 --incremented
|
||||
,o.sdate + interval '5 years' --incremented
|
||||
,o.sseas + 5 --incremented
|
||||
,'b24' "version"
|
||||
,'copy' iter
|
||||
,o.odate + interval '1 years' --incremented
|
||||
,o.oseas + 1 --incremented
|
||||
,o.rdate + interval '1 years' --incremented
|
||||
,o.rseas + 1 --incremented
|
||||
,o.pdate + interval '1 years' --incremented
|
||||
,o.pseas + 1 --incremented
|
||||
,o.sdate + interval '1 years' --incremented
|
||||
,o.sseas + 1 --incremented
|
||||
,'B27' "version"
|
||||
,'Baseline' iter
|
||||
FROM
|
||||
baseline o
|
||||
LEFT OUTER JOIN rlarp.gld ON
|
||||
(o.sdate + interval '5 years') BETWEEN gld.sdat and gld.edat
|
||||
(o.sdate + interval '1 years') BETWEEN gld.sdat and gld.edat
|
||||
WHERE
|
||||
true
|
||||
--o.odate + interval '5 years' >= '2023-06-01'
|
||||
@ -712,7 +717,13 @@ FROM
|
||||
) x;
|
||||
|
||||
---identify short ships: causes disconnect with actual sales-------------------------------------------------------------------
|
||||
--UPDATE rlarp.osmfs SET iter = 'short ship' WHERE calc_status = 'CLOSED' AND flag = 'REMAINDER';
|
||||
UPDATE rlarp.osmf SET iter = 'short ship' WHERE calc_status = 'CLOSED' AND flag = 'REMAINDER';
|
||||
|
||||
---identify goofy ship dates: causes disconnect with sales when splicing in a forecast that has this problem-------------------
|
||||
--UPDATE rlarp.osmfs SET iter = 'bad date' WHERE adj_shipdate < adj_orderdate;
|
||||
UPDATE rlarp.osmf SET iter = 'bad date' WHERE sdate < odate;
|
||||
|
||||
--flag budget orders that are planned to book before the budget
|
||||
UPDATE rlarp.osmf SET iter = 'py carryover' WHERE iter = 'copy' AND odate <= '2025-06-01';
|
||||
|
||||
--set new fiscal periods, may require adding dates to lgdat.gldate
|
||||
UPDATE rlarp.osmf SET fspr = g.fspr FROM rlarp.gld g WHERE sdate BETWEEN sdat AND edat;
|
||||
|
||||
@ -59,7 +59,7 @@ repc AS (
|
||||
)
|
||||
--select * from si
|
||||
,logload AS (
|
||||
INSERT INTO rlarp.osm_log (doc) SELECT jsonb_build_object('user',current_user,'tag','baseline','type','build_pool','stamp',current_timestamp,'source','top level','message','don''t undo') RETURNING *
|
||||
INSERT INTO rlarp.osm_log (doc) SELECT jsonb_build_object('user',current_user,'tag','baseline','type','build_pool','stamp',current_timestamp,'source','top level','message','baseline') RETURNING *
|
||||
)
|
||||
--select * from logload
|
||||
,loadset AS (
|
||||
@ -155,6 +155,7 @@ SELECT
|
||||
,logload.doc->>'tag' tag
|
||||
,logload.doc->>'message' "comment"
|
||||
,logload.doc->>'type' module
|
||||
,round(o.fb_qty * o.lbs) pounds
|
||||
FROM
|
||||
rlarp.osmf o
|
||||
CROSS JOIN logload
|
||||
@ -180,8 +181,10 @@ FROM
|
||||
seg.glec = o.glec
|
||||
LEFT OUTER JOIN "CMS.CUSLG".itemm i ON
|
||||
i.item = o.part
|
||||
WHERE
|
||||
version = 'B27'
|
||||
)
|
||||
SELECT * FROM loadset
|
||||
SELECT * FROM loadset WHERE iter NOT IN ('py carryover','short ship','bad date')
|
||||
) WITH DATA;
|
||||
|
||||
|
||||
|
||||
@ -3,7 +3,7 @@ LANGUAGE plpgsql AS
|
||||
$func$
|
||||
BEGIN
|
||||
|
||||
DELETE FROM rlarp.osmfs;
|
||||
DELETE FROM rlarp.osmfs WHERE version = 'B27';
|
||||
|
||||
INSERT INTO
|
||||
rlarp.osmfs
|
||||
@ -85,29 +85,29 @@ SELECT
|
||||
null::text,
|
||||
null::text,
|
||||
null::text,
|
||||
segm,
|
||||
null::text,
|
||||
null::text,
|
||||
null::text,
|
||||
null::text,
|
||||
null::text,
|
||||
null::text,
|
||||
null::text,
|
||||
null::numeric,
|
||||
CASE WHEN COALESCE(units,0) <> 0 THEN ROUND(pounds/units,5) ELSE null::numeric END, --use pounds from pool by default to accomodate fake parts
|
||||
null::numeric,
|
||||
------------fiscal info-----------------------
|
||||
null::text,
|
||||
fs_line,
|
||||
trim(fs_line),
|
||||
r_currency,
|
||||
r_rate,
|
||||
c_currency,
|
||||
c_rate,
|
||||
units,
|
||||
value_loc,
|
||||
round(units,2),
|
||||
round(value_loc,2),
|
||||
null::numeric,
|
||||
null::numeric,
|
||||
null::numeric,
|
||||
null::numeric,
|
||||
cost_loc,
|
||||
round(cost_loc,2),
|
||||
null::numeric,
|
||||
null::numeric,
|
||||
------------status info-----------------------
|
||||
@ -122,8 +122,8 @@ SELECT
|
||||
ship_date,
|
||||
ship_season,
|
||||
version,
|
||||
iter,
|
||||
tag
|
||||
tag iter,
|
||||
comment tag
|
||||
FROM
|
||||
rlarp.osm_pool
|
||||
WHERE
|
||||
@ -154,7 +154,7 @@ SET
|
||||
,clss = m.clss
|
||||
,brand = m.brand
|
||||
,assc = m.assc
|
||||
,lbs = CASE m.nwun WHEN 'kg' THEN 2.2046 ELSE 1 END*m.nwht
|
||||
,lbs = COALESCE(CASE m.nwun WHEN 'KG' THEN 2.2046 ELSE 1 END*m.nwht,lbs) --if there is not item master, use the pounds that were in there
|
||||
,unti = m.unti
|
||||
FROM
|
||||
"CMS.CUSLG".itemm m
|
||||
@ -197,6 +197,29 @@ WHERE
|
||||
c.part = o.part
|
||||
AND c.plnt = o.plnt;
|
||||
|
||||
|
||||
|
||||
UPDATE
|
||||
rlarp.osmfs o
|
||||
SET
|
||||
fb_cst_loc_fut = c.std * o.fb_qty
|
||||
FROM
|
||||
rlarp.ftcstx c
|
||||
WHERE
|
||||
c.part = o.part
|
||||
AND c.plnt = o.plnt;
|
||||
|
||||
|
||||
UPDATE
|
||||
rlarp.osmfs o
|
||||
SET
|
||||
fb_cst_loc_fut = fb_cst_loc
|
||||
,fb_cst_loc_cur = fb_cst_loc
|
||||
WHERE
|
||||
fb_cst_loc_cur is NULL
|
||||
OR fb_cst_loc_fut IS NULL;
|
||||
|
||||
|
||||
----------------------------SET BILL-TO REP------------------------------------
|
||||
|
||||
UPDATE
|
||||
@ -379,6 +402,50 @@ WHERE
|
||||
AND CR.SHIP_CUST = S.SHIP_CUST
|
||||
AND COALESCE(S.DSM,'') <> CR.QUOTA_REP;
|
||||
|
||||
--------------------------------------------------------------------------
|
||||
---------------------------Add Ownership columns--------------------------
|
||||
--------------------------------------------------------------------------
|
||||
|
||||
UPDATE
|
||||
rlarp.osmfs s
|
||||
SET
|
||||
dsm = cr.default_rep
|
||||
-- keyaccount_rep = cr.keyaccount_rep,
|
||||
-- retail_rep = cr.retail_rep,
|
||||
-- inside_rep = cr.inside_rep
|
||||
FROM (
|
||||
SELECT DISTINCT
|
||||
s.bill_cust,
|
||||
bc.cclass,
|
||||
s.ship_cust,
|
||||
CASE substring(s.ming, 1, 3)
|
||||
WHEN 'A27' THEN '70100'
|
||||
ELSE COALESCE(sc.default_rep, bc.default_rep)
|
||||
END AS default_rep,
|
||||
CASE
|
||||
WHEN COALESCE(sc.keyaccount_rep, '') <> '' AND bc.cclass = 'GDIS' THEN sc.keyaccount_rep
|
||||
ELSE bc.keyaccount_rep
|
||||
END AS keyaccount_rep,
|
||||
s.glec,
|
||||
CASE
|
||||
WHEN COALESCE(s.glec, '') = '1RE' AND COALESCE(bc.retail_rep, '') <> '' THEN bc.retail_rep
|
||||
ELSE NULL
|
||||
END AS retail_rep,
|
||||
CASE SUBSTRING(bc.cclass, 2, 3)
|
||||
WHEN 'DIS' THEN sc.inside_rep
|
||||
ELSE bc.inside_rep
|
||||
END AS inside_rep
|
||||
FROM
|
||||
rlarp.osmfs s
|
||||
LEFT OUTER JOIN rlarp.cust bc ON bc.code = s.bill_cust
|
||||
LEFT OUTER JOIN rlarp.cust sc ON sc.code = s.ship_cust
|
||||
WHERE
|
||||
glec IS NOT NULL
|
||||
) cr
|
||||
WHERE
|
||||
cr.glec = s.glec
|
||||
AND cr.bill_cust = s.bill_cust
|
||||
AND COALESCE(cr.ship_cust, '') = COALESCE(s.ship_cust, '');
|
||||
|
||||
-------------------set fiscal period--------------------------------------
|
||||
|
||||
|
||||
@ -1,5 +1,10 @@
|
||||
DELETE FROM
|
||||
rlarp.osmp
|
||||
WHERE
|
||||
version like 'b26%';
|
||||
|
||||
INSERT INTO
|
||||
rlarp.osmp_dev
|
||||
rlarp.osmp
|
||||
SELECT
|
||||
"ddord#"
|
||||
,"dditm#"
|
||||
@ -11,7 +16,7 @@ SELECT
|
||||
,quotel
|
||||
,dcodat
|
||||
,ddqdat
|
||||
,dcmdat
|
||||
,ddrdat
|
||||
,fesdat
|
||||
,dhidat
|
||||
,fesind
|
||||
@ -27,7 +32,7 @@ SELECT
|
||||
,dhincr
|
||||
,plnt
|
||||
,promo
|
||||
,return_reas
|
||||
,rreas
|
||||
,terms
|
||||
,custpo
|
||||
,remit_to
|
||||
@ -55,14 +60,15 @@ SELECT
|
||||
,dest_prov
|
||||
,dest_post
|
||||
,part
|
||||
,styc
|
||||
,stlc
|
||||
,colc
|
||||
,colgrp
|
||||
,coltier
|
||||
,colstat
|
||||
,sizc
|
||||
,pckg
|
||||
,kit
|
||||
,uomp
|
||||
,suffix
|
||||
,accs_ps
|
||||
,brnd
|
||||
,majg
|
||||
,ming
|
||||
@ -100,12 +106,13 @@ SELECT
|
||||
,oseas
|
||||
,rdate
|
||||
,rseas
|
||||
,pdate
|
||||
,pseas
|
||||
,sdate
|
||||
,sseas
|
||||
,'b22'
|
||||
,version
|
||||
,iter || ' - ' || tag iter
|
||||
FROM
|
||||
rlarp.osmfs_dev
|
||||
rlarp.osmfs
|
||||
WHERE
|
||||
oseas = 2022
|
||||
OR sseas = 2022;
|
||||
version like 'b26%';
|
||||
|
||||
5
build/dump_all.pg.slq
Normal file
5
build/dump_all.pg.slq
Normal file
@ -0,0 +1,5 @@
|
||||
SELECT
|
||||
o.*
|
||||
,o.lbs * o.fb_qty ext_lbs
|
||||
FROM
|
||||
rlarp.osmf o
|
||||
0
build/dump_all.pg.sql
Normal file
0
build/dump_all.pg.sql
Normal file
@ -6,4 +6,4 @@ $PG -f ./build/snap_itemm.sql;
|
||||
$PG -f ./build/snap_cost_current.sql;
|
||||
$PG -f ./build/snap_customer.sql;
|
||||
$PG -f ./build/build_pool.sql;
|
||||
$PG -c "CALL rlarp.convert_pool_all();"
|
||||
# $PG -c "CALL rlarp.convert_pool_all();"
|
||||
|
||||
@ -38,6 +38,17 @@ FROM
|
||||
WHERE
|
||||
c.part = o.part
|
||||
AND c.plnt = o.plnt;
|
||||
|
||||
UPDATE
|
||||
rlarp.osmf o
|
||||
SET
|
||||
fb_cst_loc_fut = c.std * o.fb_qty
|
||||
FROM
|
||||
rlarp.arcstx c
|
||||
WHERE
|
||||
c.part = o.part
|
||||
AND c.plnt = o.plnt;
|
||||
|
||||
--AND version = 'b21';
|
||||
|
||||
commit;
|
||||
|
||||
@ -135,46 +135,37 @@ WHERE
|
||||
---------------------------SET QUOTA REP---------------------------------------
|
||||
|
||||
|
||||
UPDATE
|
||||
rlarp.osmf s
|
||||
SET
|
||||
dsm = cr.quota_rep
|
||||
FROM
|
||||
(
|
||||
|
||||
MERGE INTO
|
||||
rlarp.osmf AS s
|
||||
USING (
|
||||
SELECT DISTINCT
|
||||
version,
|
||||
COALESCE(glec,'') glec,
|
||||
ming,
|
||||
bill_cust,
|
||||
ship_cust,
|
||||
------------quota rep column--------------
|
||||
CASE WHEN COALESCE(ming,'') = 'B52' THEN 'PW' ELSE
|
||||
--if the gl expense code is 1RE use the retail rep assigned to the bill-to customer if available
|
||||
CASE WHEN COALESCE(glec,'') = '1RE' AND COALESCE(cu.currep,'') <> '' THEN
|
||||
cu.currep
|
||||
--default logic
|
||||
ELSE
|
||||
CASE SUBSTR(bill_class,2,3)
|
||||
WHEN 'DIS' THEN
|
||||
ship_rep
|
||||
ELSE
|
||||
bill_rep
|
||||
END
|
||||
END
|
||||
END QUOTA_REP
|
||||
FROM
|
||||
rlarp.osmf s
|
||||
LEFT OUTER JOIN lgdat.cust ON
|
||||
bvcust = bill_cust
|
||||
LEFT OUTER JOIN lgpgm.usrcust cu ON
|
||||
cu.cucust = s.bill_cust
|
||||
WHERE
|
||||
version = 'ACTUALS'
|
||||
) CR
|
||||
WHERE
|
||||
cr.version = s.version
|
||||
AND cr.glec = COALESCE(s.glec,'')
|
||||
AND cr.ming = s.ming
|
||||
AND cr.bill_cust = s.bill_cust
|
||||
AND cr.ship_cust = s.ship_cust
|
||||
AND COALESCE(s.dsm,'') <> cr.quota_rep;
|
||||
s.bill_cust
|
||||
,s.ship_cust
|
||||
,s.glec
|
||||
,CASE substring(bc.cclass, 2, 3)
|
||||
WHEN 'DIR' THEN bc.default_rep
|
||||
ELSE COALESCE(sc.default_rep, bc.default_rep)
|
||||
END AS default_rep
|
||||
,CASE substring(bc.cclass, 2, 3)
|
||||
WHEN 'DIR' THEN bc.tier
|
||||
ELSE COALESCE(sc.tier, bc.tier)
|
||||
END AS customer_tier
|
||||
,CASE
|
||||
WHEN COALESCE(s.glec, '') = '1RE' AND COALESCE(bc.retail_rep, '') <> ''
|
||||
THEN bc.retail_rep
|
||||
ELSE NULL
|
||||
END AS retail_rep
|
||||
FROM rlarp.osmf s
|
||||
LEFT JOIN rlarp.cust bc ON bc.code = s.bill_cust
|
||||
LEFT JOIN rlarp.cust sc ON sc.code = s.ship_cust
|
||||
WHERE glec IS NOT NULL
|
||||
) AS cr
|
||||
ON
|
||||
cr.bill_cust = s.bill_cust AND
|
||||
COALESCE(cr.ship_cust, '') = COALESCE(s.ship_cust, '') AND
|
||||
s.glec = cr.glec
|
||||
WHEN MATCHED THEN
|
||||
UPDATE SET
|
||||
dsm = COALESCE(cr.retail_rep, cr.default_rep);
|
||||
|
||||
|
||||
52
columns
Normal file
52
columns
Normal file
@ -0,0 +1,52 @@
|
||||
fspr
|
||||
plnt
|
||||
promo
|
||||
terms
|
||||
bill_cust_descr
|
||||
ship_cust_descr
|
||||
dsm
|
||||
quota_rep_descr
|
||||
director
|
||||
billto_group
|
||||
shipto_group
|
||||
chan
|
||||
chansub
|
||||
chan_retail
|
||||
part
|
||||
part_descr
|
||||
part_group
|
||||
branding
|
||||
majg_descr
|
||||
ming_descr
|
||||
majs_descr
|
||||
mins_descr
|
||||
segm
|
||||
substance
|
||||
fs_line
|
||||
r_currency
|
||||
r_rate
|
||||
c_currency
|
||||
c_rate
|
||||
units
|
||||
value_loc
|
||||
value_usd
|
||||
cost_loc
|
||||
cost_usd
|
||||
calc_status
|
||||
flag
|
||||
order_date
|
||||
order_month
|
||||
order_season
|
||||
request_date
|
||||
request_month
|
||||
request_season
|
||||
ship_date
|
||||
ship_month
|
||||
ship_season
|
||||
version
|
||||
iter
|
||||
logid
|
||||
tag
|
||||
comment
|
||||
module
|
||||
pounds
|
||||
4
curl_routes/get_pool.sh
Executable file
4
curl_routes/get_pool.sh
Executable file
@ -0,0 +1,4 @@
|
||||
curl -k -X GET https://usmidsap02:8080/get_pool \
|
||||
-H "Content-Type: application/json" \
|
||||
-d '{"scenario":{"quota_rep_descr":"MICHAEL LAZERICK"},"version":"1.10.1","username":"Trowbridge, Paul"}'
|
||||
|
||||
4
curl_routes/get_scenario.sh
Executable file
4
curl_routes/get_scenario.sh
Executable file
@ -0,0 +1,4 @@
|
||||
curl -k -X GET https://usmidsap02:8080/scenario_package \
|
||||
-H "Content-Type: application/json" \
|
||||
-d '{"scenario":{"segm":["Greenhouse","Nursery","Other","Sustainable",""],"shipto_group":"PLEASANT VIEW GARDENS"},"version":"1.10.1","username":"dev"}'
|
||||
|
||||
35
curl_routes/scale_volume.sh
Executable file
35
curl_routes/scale_volume.sh
Executable file
@ -0,0 +1,35 @@
|
||||
curl -k -X POST https://usmidsap02:8080/scale_vp \
|
||||
-H "Content-Type: application/json" \
|
||||
-d '{
|
||||
"qty": "-72370.4782463999",
|
||||
"tag": "Share Lost",
|
||||
"type": "scale_vp",
|
||||
"user": "Trowbridge, Paul",
|
||||
"stamp": "2025-04-04T18:14:42.543Z",
|
||||
"amount": "-23504.4070922587",
|
||||
"source": "adj",
|
||||
"message": "forecasted pounds",
|
||||
"version": "1.10.1",
|
||||
"scenario": {
|
||||
"iter": [
|
||||
"copy",
|
||||
"adj volume",
|
||||
"adj price",
|
||||
"upload volume",
|
||||
"upload price",
|
||||
"plan",
|
||||
"diff",
|
||||
"shift"
|
||||
],
|
||||
"segm": [
|
||||
"Greenhouse",
|
||||
"Nursery",
|
||||
"Other",
|
||||
"Sustainable",
|
||||
""
|
||||
],
|
||||
"version": "b26",
|
||||
"shipto_group": "PLEASANT VIEW GARDENS"
|
||||
},
|
||||
"username": "Trowbridge, Paul"
|
||||
}'
|
||||
528
debug/debug.sql
Normal file
528
debug/debug.sql
Normal file
@ -0,0 +1,528 @@
|
||||
-- 4/5/2025, 11:58:08 AM: POST /new_basket (Add new part and/or customer.)
|
||||
-- 4/5/2025, 11:58:08 AM: SQL file: ./route_sql/new_basket.sql
|
||||
-- 4/5/2025, 11:58:08 AM: Building WHERE from {"scenario":{"segm":["Greenhouse","Nursery","Other","Sustainable",""],"quota_rep_descr":"13028 - RICHARD MEULE","shipto_group":"COSTA","majg_descr":"110 - 110 - INJECTION","part_group":"SQD05500","version":"b26","iter":["copy","plan","adj volume"]},"stamp":"2025-04-05 11:57:43","user":"Trowbridge, Paul","source":"adj","type":"new_basket","months":{"08 - Jan":{"amount":554784.528,"qty":5439064}},"newpart":"KEP015P0X56B316","basket":[{"part_descr":"KEP015P0X56B316","bill_cust_descr":"COST0017 - COSTA FARMS LLC-GOULDS FL","ship_cust_descr":"COST0007 - COSTA COLOR-MIAMI FL","mix":"5.82453157381491E-03"},{"part_descr":"KEP015P0X56B316PYMLI","bill_cust_descr":"COST0017 - COSTA FARMS LLC-GOULDS FL","ship_cust_descr":"COST0007 - COSTA COLOR-MIAMI FL","mix":"5.82453157381491E-03"},{"part_descr":"KEP015P0X19B316","bill_cust_descr":"COST0017 - COSTA FARMS LLC-GOULDS FL","ship_cust_descr":"COST0007 - COSTA COLOR-MIAMI FL","mix":"1.16490631476298E-02"},{"part_descr":"KEP015P0X19B316PYMGL","bill_cust_descr":"COST0017 - COSTA FARMS LLC-GOULDS FL","ship_cust_descr":"COST0007 - COSTA COLOR-MIAMI FL","mix":"1.16490631476298E-02"},{"part_descr":"KET10P15G18B030","bill_cust_descr":"COST0017 - COSTA FARMS LLC-GOULDS FL","ship_cust_descr":"COST0007 - COSTA COLOR-MIAMI FL","mix":"2.23714962721527E-03"},{"part_descr":"KEP010P0X19B524","bill_cust_descr":"COST0017 - COSTA FARMS LLC-GOULDS FL","ship_cust_descr":"COST0007 - COSTA COLOR-MIAMI FL","mix":"6.74586656821835E-02"},{"part_descr":"KEP010P0X19B262PYMLE","bill_cust_descr":"COST0017 - COSTA FARMS LLC-GOULDS FL","ship_cust_descr":"COST0007 - COSTA COLOR-MIAMI FL","mix":"6.74586656821835E-02"},{"part_descr":"KEP010P0X19B524","bill_cust_descr":"COST0017 - COSTA FARMS LLC-GOULDS FL","ship_cust_descr":"COST0007 - COSTA COLOR-MIAMI FL","mix":0.375841137372166},{"part_descr":"KEP010P0X19B262PYMLE","bill_cust_descr":"COST0017 - COSTA FARMS LLC-GOULDS FL","ship_cust_descr":"COST0007 - COSTA COLOR-MIAMI FL","mix":0.375841137372166},{"part_descr":"KET12P10A10B027","bill_cust_descr":"COST0017 - COSTA FARMS LLC-GOULDS FL","ship_cust_descr":"COST0007 - COSTA COLOR-MIAMI FL","mix":0.036989452596991},{"part_descr":"KET10P15A10B030","bill_cust_descr":"COST0017 - COSTA FARMS LLC-GOULDS FL","ship_cust_descr":"COST0007 - COSTA COLOR-MIAMI FL","mix":"2.23714962721527E-03"},{"part_descr":"KET12P10G18B027","bill_cust_descr":"COST0017 - COSTA FARMS LLC-GOULDS FL","ship_cust_descr":"COST0007 - COSTA COLOR-MIAMI FL","mix":0.036989452596991}],"message":"quote mix","tag":"Keystone Incr","version":"1.10.1","username":"Trowbridge, Paul"}
|
||||
-- 4/5/2025, 11:58:08 AM: Returning segm IN ('Greenhouse','Nursery','Other','Sustainable','')
|
||||
-- AND quota_rep_descr = '13028 - RICHARD MEULE'
|
||||
-- AND shipto_group = 'COSTA'
|
||||
-- AND majg_descr = '110 - 110 - INJECTION'
|
||||
-- AND part_group = 'SQD05500'
|
||||
-- AND version = 'b26'
|
||||
-- AND iter IN ('copy','plan','adj volume')
|
||||
-- AND order_date >= least('2025-04-05 11:57:43'::date,'2021-06-01')
|
||||
-- 4/5/2025, 11:58:08 AM: Running query:
|
||||
WITH
|
||||
/*
|
||||
the volume must be expressed in terms of units, since that is what it will be scaling
|
||||
*/
|
||||
target AS (select $${"scenario":{"segm":["Greenhouse","Nursery","Other","Sustainable",""],"quota_rep_descr":"13028 - RICHARD MEULE","shipto_group":"COSTA","majg_descr":"110 - 110 - INJECTION","part_group":"SQD05500","version":"b26","iter":["copy","plan","adj volume"]},"stamp":"2025-04-05T15:58:08.504Z","user":"Trowbridge, Paul","source":"adj","type":"new_basket","months":{"08 - Jan":{"amount":554784.528,"qty":5439064}},"newpart":"KEP015P0X56B316","basket":[{"part_descr":"KEP015P0X56B316","bill_cust_descr":"COST0017 - COSTA FARMS LLC-GOULDS FL","ship_cust_descr":"COST0007 - COSTA COLOR-MIAMI FL","mix":"5.82453157381491E-03"},{"part_descr":"KEP015P0X56B316PYMLI","bill_cust_descr":"COST0017 - COSTA FARMS LLC-GOULDS FL","ship_cust_descr":"COST0007 - COSTA COLOR-MIAMI FL","mix":"5.82453157381491E-03"},{"part_descr":"KEP015P0X19B316","bill_cust_descr":"COST0017 - COSTA FARMS LLC-GOULDS FL","ship_cust_descr":"COST0007 - COSTA COLOR-MIAMI FL","mix":"1.16490631476298E-02"},{"part_descr":"KEP015P0X19B316PYMGL","bill_cust_descr":"COST0017 - COSTA FARMS LLC-GOULDS FL","ship_cust_descr":"COST0007 - COSTA COLOR-MIAMI FL","mix":"1.16490631476298E-02"},{"part_descr":"KET10P15G18B030","bill_cust_descr":"COST0017 - COSTA FARMS LLC-GOULDS FL","ship_cust_descr":"COST0007 - COSTA COLOR-MIAMI FL","mix":"2.23714962721527E-03"},{"part_descr":"KEP010P0X19B524","bill_cust_descr":"COST0017 - COSTA FARMS LLC-GOULDS FL","ship_cust_descr":"COST0007 - COSTA COLOR-MIAMI FL","mix":"6.74586656821835E-02"},{"part_descr":"KEP010P0X19B262PYMLE","bill_cust_descr":"COST0017 - COSTA FARMS LLC-GOULDS FL","ship_cust_descr":"COST0007 - COSTA COLOR-MIAMI FL","mix":"6.74586656821835E-02"},{"part_descr":"KEP010P0X19B524","bill_cust_descr":"COST0017 - COSTA FARMS LLC-GOULDS FL","ship_cust_descr":"COST0007 - COSTA COLOR-MIAMI FL","mix":0.375841137372166},{"part_descr":"KEP010P0X19B262PYMLE","bill_cust_descr":"COST0017 - COSTA FARMS LLC-GOULDS FL","ship_cust_descr":"COST0007 - COSTA COLOR-MIAMI FL","mix":0.375841137372166},{"part_descr":"KET12P10A10B027","bill_cust_descr":"COST0017 - COSTA FARMS LLC-GOULDS FL","ship_cust_descr":"COST0007 - COSTA COLOR-MIAMI FL","mix":0.036989452596991},{"part_descr":"KET10P15A10B030","bill_cust_descr":"COST0017 - COSTA FARMS LLC-GOULDS FL","ship_cust_descr":"COST0007 - COSTA COLOR-MIAMI FL","mix":"2.23714962721527E-03"},{"part_descr":"KET12P10G18B027","bill_cust_descr":"COST0017 - COSTA FARMS LLC-GOULDS FL","ship_cust_descr":"COST0007 - COSTA COLOR-MIAMI FL","mix":0.036989452596991}],"message":"quote mix","tag":"Keystone Incr","version":"1.10.1","username":"Trowbridge, Paul"}$$::json def)
|
||||
-- select 'target', * from target
|
||||
--
|
||||
,GLD AS (
|
||||
SELECT
|
||||
N1COMP COMP
|
||||
,N1CCYY FSYR
|
||||
,KPMAXP PERDS
|
||||
,N1FSPP PERD
|
||||
,to_char(N1FSYP,'FM0000') FSPR
|
||||
,N1SD01 SDAT
|
||||
,N1ED01 EDAT
|
||||
,daterange(n1sd01, n1ed01,'[]') drange
|
||||
,to_char(N1ED01,'yymm') CAPR
|
||||
,N1ED01 - N1SD01 +1 NDAYS
|
||||
,CASE WHEN EXTRACT(MONTH FROM N1ED01) >= 6 THEN EXTRACT(YEAR FROM N1ED01) + 1 ELSE EXTRACT(YEAR FROM N1ED01) END SSYR
|
||||
,to_char(CASE WHEN EXTRACT(MONTH FROM N1ED01) >= 6 THEN EXTRACT(MONTH FROM N1ED01) -5 ELSE EXTRACT(MONTH FROM N1ED01) +7 END,'FM00') SSPR
|
||||
,to_char(CASE WHEN EXTRACT(MONTH FROM N1ED01) >= 6 THEN EXTRACT(MONTH FROM N1ED01) -5 ELSE EXTRACT(MONTH FROM N1ED01) +7 END,'FM00') || ' - '|| TO_CHAR(n1ed01,'FMMon') SORTMO
|
||||
FROM
|
||||
LGDAT.GLDATREF
|
||||
INNER JOIN LGDAT.GLDATE ON
|
||||
KPCOMP = N1COMP AND
|
||||
KPCCYY = N1CCYY
|
||||
WHERE
|
||||
N1COMP = 93
|
||||
--AND DIGITS(N1FSYP) = '1901'
|
||||
)
|
||||
-- select 'GLD', * from GLD
|
||||
--
|
||||
,mseq AS (
|
||||
SELECT * FROM
|
||||
(
|
||||
VALUES
|
||||
('01 - Jun',1,6,-1)
|
||||
,('02 - Jul',2,7,-1)
|
||||
,('03 - Aug',3,8,-1)
|
||||
,('04 - Sep',4,9,-1)
|
||||
,('05 - Oct',5,10,-1)
|
||||
,('06 - Nov',6,11,-1)
|
||||
,('07 - Dec',7,12,-1)
|
||||
,('08 - Jan',8,1,0)
|
||||
,('09 - Feb',9,2,0)
|
||||
,('10 - Mar',10,3,0)
|
||||
,('11 - Apr',11,4,0)
|
||||
,('12 - May',12,5,0)
|
||||
) x(m,s,cal,yr)
|
||||
)
|
||||
-- select 'mseq', * from mseq
|
||||
--
|
||||
,seg AS (
|
||||
SELECT
|
||||
x.GLEC glec
|
||||
,x.SEGM segm
|
||||
FROM
|
||||
(
|
||||
VALUES
|
||||
('1SU','Sustainable'),
|
||||
('1CU','Sustainable'),
|
||||
('1GR','Greenhouse'),
|
||||
('1NU','Nursery'),
|
||||
('1RE','Retail'),
|
||||
('2WI','Greenhouse'),
|
||||
('3BM','Other'),
|
||||
('3CO','Other'),
|
||||
('3PE','Other'),
|
||||
('3PP','Other'),
|
||||
('4CO','Other'),
|
||||
('4RA','Other'),
|
||||
('9MI','Other'),
|
||||
('9SA','Other'),
|
||||
('9TO','Other')
|
||||
) X(GLEC, SEGM)
|
||||
)
|
||||
-- select 'seg', * from seg
|
||||
--
|
||||
,copr AS (
|
||||
SELECT
|
||||
LTRIM(RTRIM(A9)) AS COMP,
|
||||
A30 AS DESCR,
|
||||
SUBSTR(C.A249,242,2) CURR,
|
||||
SUBSTR(C.A249,32,4) AS GL,
|
||||
SUBSTR(C.A249,190,4) AS AR,
|
||||
SUBSTR(C.A249,182,4) AS AP,
|
||||
SUBSTR(C.A249,198,4) AS FA,
|
||||
SUBSTR(C.A249,238,4) AS IC ,
|
||||
SUBSTR(D.A249,9,5) CONS_FUNC
|
||||
FROM
|
||||
LGDAT.CODE
|
||||
LEFT OUTER JOIN LGDAT.NAME C ON
|
||||
'C0000'||LTRIM(RTRIM(A9)) = C.A7
|
||||
LEFT OUTER JOIN LGDAT.NAME D ON
|
||||
'D0000'||LTRIM(RTRIM(A9)) = D.A7
|
||||
WHERE
|
||||
A2 = 'AA' OR A2 IS NULL
|
||||
)
|
||||
-- select 'copr', * from copr
|
||||
--
|
||||
,alldates AS (
|
||||
SELECT
|
||||
bill_cust_descr
|
||||
,ship_cust_descr
|
||||
,promo
|
||||
,terms
|
||||
,r_currency
|
||||
-- ,order_month
|
||||
-- ,mseq.s seq
|
||||
,order_date
|
||||
-- ,request_date
|
||||
,ship_date
|
||||
-- ,ship_month
|
||||
-- ,sum(value_usd) value_usd_net
|
||||
,sum(pounds) pounds_net
|
||||
-- ,sum(value_usd) FILTER (WHERE iter IN ('copy','actuals','actuals_plug')) value_usd_baseline
|
||||
,sum(pounds) FILTER (WHERE iter IN ('copy','actuals','actuals_plug')) pounds_baseline
|
||||
FROM
|
||||
rlarp.osm_pool
|
||||
LEFT OUTER JOIN mseq ON
|
||||
mseq.m = order_month
|
||||
WHERE
|
||||
where_clause
|
||||
AND version = 'b26'
|
||||
GROUP BY
|
||||
bill_cust_descr
|
||||
,ship_cust_descr
|
||||
,promo
|
||||
,terms
|
||||
,r_currency
|
||||
-- ,order_month
|
||||
-- ,mseq.s seq
|
||||
,order_date
|
||||
-- ,request_date
|
||||
,ship_date
|
||||
-- ,ship_month
|
||||
-- HAVING
|
||||
-- sum(value_usd) <> 0
|
||||
)
|
||||
SELECT
|
||||
bill_cust_descr
|
||||
,ship_cust_descr
|
||||
,promo
|
||||
,terms
|
||||
,r_currency
|
||||
,order_date
|
||||
,ship_date
|
||||
,round(pounds_net / sum(pounds_net) OVER (),5) fc_mix
|
||||
,round(pounds_baseline / sum(pounds_baseline) OVER (),5) baseline_mix
|
||||
FROM
|
||||
alldates
|
||||
ORDER BY
|
||||
order_date ASC
|
||||
,ship_date ASC
|
||||
-- --
|
||||
-- ,dom AS (
|
||||
-- SELECT
|
||||
-- extract(day FROM order_date) DOM
|
||||
-- ,sum(value_usd) value_usd
|
||||
-- FROM
|
||||
-- alldates
|
||||
-- GROUP BY
|
||||
-- extract(day FROM order_date)
|
||||
-- )
|
||||
-- -- select 'dom', * from dom
|
||||
-- --
|
||||
-- ,mmix AS (
|
||||
-- SELECT
|
||||
-- to_char(order_date,'Mon') _month
|
||||
-- ,seq
|
||||
-- ,promo
|
||||
-- ,terms
|
||||
-- ,(SELECT r_currency FROM alldates GROUP BY r_currency ORDER BY SUM(value_usd) DESC LIMIT 1) r_currency
|
||||
-- --should terms be included here?
|
||||
-- ,sum(extract(day from order_date)*value_usd) dom_wa
|
||||
-- --,request_date-order_date rlag
|
||||
-- ,sum((request_date-order_date)*(value_usd)) rlag_wa
|
||||
-- --,ship_date - request_date slag
|
||||
-- ,sum((ship_date - request_date)*(value_usd)) slag_wa
|
||||
-- ,COALESCE(nullif(sum(value_usd),0),1) value_usd
|
||||
-- FROM
|
||||
-- alldates
|
||||
-- GROUP BY
|
||||
-- to_char(order_date,'Mon')
|
||||
-- ,seq
|
||||
-- ,promo
|
||||
-- ,terms
|
||||
-- --,extract(day from order_date)
|
||||
-- --,request_date-order_date
|
||||
-- --,ship_date - request_date
|
||||
-- )
|
||||
-- -- select 'mmix', * from mmix
|
||||
-- --
|
||||
-- ,targm AS (
|
||||
-- SELECT
|
||||
-- je.key as month
|
||||
-- ,r.amount
|
||||
-- ,r.qty
|
||||
-- ,s
|
||||
-- ,cal
|
||||
-- ,yr
|
||||
-- FROM
|
||||
-- target
|
||||
-- JOIN LATERAL json_each(def->'months') je ON true
|
||||
-- JOIN LATERAL json_to_record(je.value) as r (amount numeric, qty numeric) ON TRUE
|
||||
-- LEFT OUTER JOIN mseq ON
|
||||
-- mseq.m = je.key
|
||||
-- )
|
||||
-- --select 'targm', * from targm
|
||||
-- --
|
||||
-- ,mmixp AS (
|
||||
-- SELECT
|
||||
-- _month
|
||||
-- ,seq
|
||||
-- ,promo
|
||||
-- ,terms
|
||||
-- ,r_currency
|
||||
-- ,greatest(least(round((dom_wa/value_usd)::numeric,0)::int,28),1) odom
|
||||
-- ,round((rlag_wa/value_usd)::numeric,0)::int rlag
|
||||
-- ,round((slag_wa/value_usd)::numeric,0)::int slag
|
||||
-- ,value_usd/sum(value_usd) over (partition by _month) momix
|
||||
-- --,value_usd/SUM(value_usd) over (PARTITION BY _month) vperc
|
||||
-- FROM
|
||||
-- mmix
|
||||
-- )
|
||||
-- --select 'mmixp', * from mmixp
|
||||
-- --
|
||||
-- ,mxm AS (
|
||||
-- SELECT
|
||||
-- t.month
|
||||
-- ,t.amount
|
||||
-- ,t.qty
|
||||
-- ,t.s
|
||||
-- ,t.cal
|
||||
-- ,t.yr
|
||||
-- ,x.momix
|
||||
-- ,x.odom
|
||||
-- ,x.rlag
|
||||
-- ,x.slag
|
||||
-- ,x.promo
|
||||
-- ,x.terms
|
||||
-- ,x.r_currency
|
||||
-- FROM
|
||||
-- targm t
|
||||
-- LEFT OUTER JOIN mmixp x ON
|
||||
-- x._month = (
|
||||
-- SELECT
|
||||
-- _month
|
||||
-- FROM
|
||||
-- mmixp
|
||||
-- ORDER BY
|
||||
-- abs(seq - t.s) ASC
|
||||
-- LIMIT 1
|
||||
-- )
|
||||
-- )
|
||||
-- -- SELECT 'mxm', * FROM mxm
|
||||
-- --
|
||||
-- ,basemix AS (
|
||||
-- SELECT
|
||||
-- sd.fspr
|
||||
-- ,mxm.promo
|
||||
-- ,mxm.terms
|
||||
-- ,mxm.r_currency
|
||||
-- ,jr.bill_cust_descr
|
||||
-- ,jr.ship_cust_descr
|
||||
-- ,rtrim((regexp_match(jr.part_descr,'(.*?)(?= - |$)'))[1]) part
|
||||
-- ,jr.part_descr
|
||||
-- ,substring(jr.part_descr,1,8) part_group
|
||||
-- ,mxm.qty*mxm.momix*jr.mix units
|
||||
-- ,mxm.amount*mxm.momix*jr.mix value_usd --assume that target dollars are USD
|
||||
-- ,make_date(mxm.yr + 2026,mxm.cal,mxm.odom) order_date
|
||||
-- ,od.sortmo order_month
|
||||
-- ,od.ssyr order_season
|
||||
-- ,make_date(mxm.yr + 2026,mxm.cal,mxm.odom) + rlag request_date
|
||||
-- ,rd.sortmo request_month
|
||||
-- ,rd.ssyr request_season
|
||||
-- ,make_date(mxm.yr + 2026,mxm.cal,mxm.odom) + rlag + slag ship_date
|
||||
-- ,sd.sortmo ship_month
|
||||
-- ,sd.ssyr ship_season
|
||||
-- ,jr.mix
|
||||
-- FROM
|
||||
-- target
|
||||
-- JOIN LATERAL json_array_elements(def->'basket') as ae(e) ON true
|
||||
-- JOIN LATERAL json_to_record(ae.e) as jr(part_descr text, bill_cust_descr text, ship_cust_descr text, mix numeric) ON true
|
||||
-- CROSS JOIN mxm
|
||||
-- LEFT OUTER JOIN gld od ON
|
||||
-- od.drange @> make_date(mxm.yr + 2026,mxm.cal,mxm.odom)
|
||||
-- LEFT OUTER JOIN gld rd ON
|
||||
-- rd.drange @> (make_date(mxm.yr + 2026,mxm.cal,mxm.odom) + rlag)
|
||||
-- LEFT OUTER JOIN gld sd ON
|
||||
-- sd.drange @> (make_date(mxm.yr + 2026,mxm.cal,mxm.odom) + rlag + slag)
|
||||
-- )
|
||||
-- -- SELECT 'basemix', * FROM basemix
|
||||
-- --
|
||||
-- ,log AS (
|
||||
-- INSERT INTO rlarp.osm_log(doc) SELECT $${"scenario":{"segm":["Greenhouse","Nursery","Other","Sustainable",""],"quota_rep_descr":"13028 - RICHARD MEULE","shipto_group":"COSTA","majg_descr":"110 - 110 - INJECTION","part_group":"SQD05500","version":"b26","iter":["copy","plan","adj volume"]},"stamp":"2025-04-05T15:58:08.504Z","user":"Trowbridge, Paul","source":"adj","type":"new_basket","months":{"08 - Jan":{"amount":554784.528,"qty":5439064}},"newpart":"KEP015P0X56B316","basket":[{"part_descr":"KEP015P0X56B316","bill_cust_descr":"COST0017 - COSTA FARMS LLC-GOULDS FL","ship_cust_descr":"COST0007 - COSTA COLOR-MIAMI FL","mix":"5.82453157381491E-03"},{"part_descr":"KEP015P0X56B316PYMLI","bill_cust_descr":"COST0017 - COSTA FARMS LLC-GOULDS FL","ship_cust_descr":"COST0007 - COSTA COLOR-MIAMI FL","mix":"5.82453157381491E-03"},{"part_descr":"KEP015P0X19B316","bill_cust_descr":"COST0017 - COSTA FARMS LLC-GOULDS FL","ship_cust_descr":"COST0007 - COSTA COLOR-MIAMI FL","mix":"1.16490631476298E-02"},{"part_descr":"KEP015P0X19B316PYMGL","bill_cust_descr":"COST0017 - COSTA FARMS LLC-GOULDS FL","ship_cust_descr":"COST0007 - COSTA COLOR-MIAMI FL","mix":"1.16490631476298E-02"},{"part_descr":"KET10P15G18B030","bill_cust_descr":"COST0017 - COSTA FARMS LLC-GOULDS FL","ship_cust_descr":"COST0007 - COSTA COLOR-MIAMI FL","mix":"2.23714962721527E-03"},{"part_descr":"KEP010P0X19B524","bill_cust_descr":"COST0017 - COSTA FARMS LLC-GOULDS FL","ship_cust_descr":"COST0007 - COSTA COLOR-MIAMI FL","mix":"6.74586656821835E-02"},{"part_descr":"KEP010P0X19B262PYMLE","bill_cust_descr":"COST0017 - COSTA FARMS LLC-GOULDS FL","ship_cust_descr":"COST0007 - COSTA COLOR-MIAMI FL","mix":"6.74586656821835E-02"},{"part_descr":"KEP010P0X19B524","bill_cust_descr":"COST0017 - COSTA FARMS LLC-GOULDS FL","ship_cust_descr":"COST0007 - COSTA COLOR-MIAMI FL","mix":0.375841137372166},{"part_descr":"KEP010P0X19B262PYMLE","bill_cust_descr":"COST0017 - COSTA FARMS LLC-GOULDS FL","ship_cust_descr":"COST0007 - COSTA COLOR-MIAMI FL","mix":0.375841137372166},{"part_descr":"KET12P10A10B027","bill_cust_descr":"COST0017 - COSTA FARMS LLC-GOULDS FL","ship_cust_descr":"COST0007 - COSTA COLOR-MIAMI FL","mix":0.036989452596991},{"part_descr":"KET10P15A10B030","bill_cust_descr":"COST0017 - COSTA FARMS LLC-GOULDS FL","ship_cust_descr":"COST0007 - COSTA COLOR-MIAMI FL","mix":"2.23714962721527E-03"},{"part_descr":"KET12P10G18B027","bill_cust_descr":"COST0017 - COSTA FARMS LLC-GOULDS FL","ship_cust_descr":"COST0007 - COSTA COLOR-MIAMI FL","mix":0.036989452596991}],"message":"quote mix","tag":"Keystone Incr","version":"1.10.1","username":"Trowbridge, Paul"}$$::jsonb doc RETURNING *
|
||||
-- )
|
||||
-- -- select 'log', * from log
|
||||
-- --
|
||||
-- ,final AS (
|
||||
-- SELECT
|
||||
-- b.fspr
|
||||
-- ,i.dplt plnt
|
||||
-- ,b.promo
|
||||
-- ,COALESCE(b.terms,bc.bvterm) terms
|
||||
-- ,b.bill_cust_descr
|
||||
-- ,b.ship_cust_descr
|
||||
-- ,(SELECT max(rcode) FROM rlarp.repc WHERE repp ~ (log.doc->'scenario'->>'quota_rep_descr')) dsm
|
||||
-- ,log.doc->'scenario'->>'quota_rep_descr' quota_rep_descr
|
||||
-- ,(SELECT max(director) FROM rlarp.repc WHERE repp ~ (log.doc->'scenario'->>'quota_rep_descr')) director
|
||||
-- ,COALESCE(CASE bc.BVADR6 WHEN '' THEN bc.BVNAME ELSE bc.BVADR6 END,b.bill_cust_descr) billto_group
|
||||
-- ,COALESCE(CASE sc.BVADR6 WHEN '' THEN sc.BVNAME ELSE sc.BVADR6 END,b.ship_cust_descr) shipto_group
|
||||
-- ,CASE SUBSTRING(bc.bvclas,2,3)
|
||||
-- --if the bill to class is ditsributor, then it's either warehouse or drop
|
||||
-- WHEN 'DIS' THEN
|
||||
-- --if the ship-to is a different name than the bill-to then it's drop, otherwise it's warehouse
|
||||
-- CASE SUBSTRING(sc.bvclas,2,3)
|
||||
-- WHEN 'DIS' THEN 'WHS'
|
||||
-- ELSE 'DRP'
|
||||
-- END
|
||||
-- --CASE WHEN RTRIM(SUBSTRING(LTRIM(SC.BVADR7)||SC.BVNAME,1,30)) = RTRIM(SUBSTRING(LTRIM(BC.BVADR7)||BC.BVNAME,1,30)) THEN 'DIS' ELSE 'DRP' END
|
||||
-- --everything else does not involve a distributor and is considered direct
|
||||
-- ELSE 'DIR'
|
||||
-- END chan
|
||||
-- ,CASE SUBSTRING(bc.bvclas,2,3)
|
||||
-- WHEN 'DIS' THEN
|
||||
-- --if the ship-to is a different name than the bill-to then it's drop, otherwise it's warehouse
|
||||
-- CASE SUBSTRING(sc.bvclas,2,3)
|
||||
-- WHEN 'DIS' THEN 'WHS'
|
||||
-- ELSE CASE SUBSTRING(sc.bvclas,1,1) WHEN 'R' THEN 'RDP' ELSE 'DRP' END
|
||||
-- END
|
||||
-- WHEN 'MAS' THEN 'RMN'
|
||||
-- WHEN 'NAT' THEN 'RMN'
|
||||
-- ELSE CASE SUBSTRING(sc.bvclas,1,1) WHEN 'R' THEN 'RDI' ELSE 'DIR' END
|
||||
-- END chansub
|
||||
-- ,null::text chan_retail
|
||||
-- ,b.part
|
||||
-- ,b.part_descr
|
||||
-- ,b.part_group
|
||||
-- ,i.branding
|
||||
-- ,i.majg||' - '||i.majgd majg_descr
|
||||
-- ,i.ming||' - '||i.mingd ming_descr
|
||||
-- ,i.majs||' - '||i.majsd majs_descr
|
||||
-- ,i.mins||' - '||i.minsd mins_descr
|
||||
-- ,seg.segm
|
||||
-- ,CASE WHEN i.majg = '610' THEN 'Fiber' ELSE 'Plastic' END substance
|
||||
-- ,'41010' fs_line --master data
|
||||
-- ,b.r_currency --history cust mix
|
||||
-- ,rx.rate r_rate --master data
|
||||
-- ,copr.curr c_currency --master data
|
||||
-- ,cx.rate c_rate --master data
|
||||
-- ,round(b.units ,2) units
|
||||
-- ,round((b.value_usd / COALESCE(rx.rate,1))::numeric ,2) value_loc --b.value is denominated in USD, need to apply currency to get to local, assume 1 if using a fake customer
|
||||
-- ,round(b.value_usd ,2) value_usd --b.value is already denominated in usd
|
||||
-- ,round((COALESCE(im.cgstcs,ip.chstcs, ir.y0stcs)*b.units)::numeric ,2) cost_loc
|
||||
-- ,round((COALESCE(im.cgstcs,ip.chstcs, ir.y0stcs)*b.units*cx.rate)::numeric,2) cost_usd
|
||||
-- ,'CLOSED' calc_status
|
||||
-- ,'SHIPMENT' flag
|
||||
-- ,b.order_date
|
||||
-- ,b.order_month
|
||||
-- ,b.order_season
|
||||
-- ,b.request_date
|
||||
-- ,b.request_month
|
||||
-- ,b.request_season
|
||||
-- ,b.ship_date
|
||||
-- ,b.ship_month
|
||||
-- ,b.ship_season
|
||||
-- ,'b26' "version"
|
||||
-- ,'adj'||' volume' iter
|
||||
-- ,log.id
|
||||
-- ,COALESCE(log.doc->>'tag','') "tag"
|
||||
-- ,log.doc->>'message' "comment"
|
||||
-- ,log.doc->>'type' module
|
||||
-- ,round(b.units * i.nwht * CASE i.nwun WHEN 'KG' THEN 2.2046 ELSE 1 END, 2) pounds
|
||||
-- FROM
|
||||
-- basemix b
|
||||
-- CROSS JOIN log
|
||||
-- LEFT OUTER JOIN "CMS.CUSLG".itemm i ON
|
||||
-- i.item = b.part
|
||||
-- LEFT OUTER JOIN SEG ON
|
||||
-- SEG.GLEC = i.glec -- AND
|
||||
-- -- SEG.SEGM <> 'Other'
|
||||
-- LEFT OUTER JOIN LGDAT.CUST BC ON
|
||||
-- BC.BVCUST = rtrim(substring(b.bill_cust_descr,1,8))
|
||||
-- LEFT OUTER JOIN LGDAT.CUST SC ON
|
||||
-- SC.BVCUST = rtrim(substring(b.ship_cust_descr,1,8))
|
||||
-- LEFT OUTER JOIN rlarp.repc r ON
|
||||
-- r.rcode = CASE WHEN i.ming = 'B52' THEN 'PW' ELSE
|
||||
-- --if the gl expense code is 1RE use the retail rep assigned to the bill-to customer if available
|
||||
-- CASE WHEN COALESCE(seg.segm,'') = 'Retail' AND COALESCE((SELECT currep FROM lgpgm.usrcust where cucust = bc.bvcust),'') <> ''
|
||||
-- THEN
|
||||
-- (SELECT currep FROM lgpgm.usrcust where cucust = bc.bvcust)
|
||||
-- --default logic
|
||||
-- ELSE
|
||||
-- CASE SUBSTR(bc.bvclas,2,3)
|
||||
-- WHEN 'DIS' THEN sc.bvsalm
|
||||
-- ELSE bc.bvsalm
|
||||
-- END
|
||||
-- END
|
||||
-- END
|
||||
-- LEFT OUTER JOIN lgdat.icstm im ON
|
||||
-- im.cgpart = b.part AND
|
||||
-- im.cgplnt = i.dplt
|
||||
-- LEFT OUTER JOIN lgdat.icstp ip ON
|
||||
-- ip.chpart = b.part AND
|
||||
-- ip.chplnt = i.dplt
|
||||
-- LEFT OUTER JOIN lgdat.icstr ir ON
|
||||
-- ir.y0part = b.part AND
|
||||
-- ir.y0plnt = i.dplt
|
||||
-- LEFT OUTER JOIN lgdat.plnt ON
|
||||
-- yaplnt = i.dplt
|
||||
-- LEFT OUTER JOIN copr ON
|
||||
-- copr.comp = yacomp::text
|
||||
-- LEFT OUTER JOIN (select 'US' fcur, 1.0 rate UNION ALL select 'CA', 0.7409) cx ON
|
||||
-- -- cx.perd = '2412' AND
|
||||
-- -- cx.rtyp = 'MA' AND
|
||||
-- cx.fcur = copr.curr -- AND
|
||||
-- -- cx.tcur = 'US'
|
||||
-- LEFT OUTER JOIN (select 'US' fcur, 1.0 rate UNION ALL select 'CA', 0.7409) rx ON
|
||||
-- -- rx.perd = '2412' AND
|
||||
-- -- rx.rtyp = 'MA' AND
|
||||
-- rx.fcur = COALESCE(bc.bvcurr,b.r_currency) -- AND
|
||||
-- -- rx.tcur = 'US'
|
||||
-- )
|
||||
-- -- select 'final', * from final
|
||||
-- --
|
||||
-- , ins AS (
|
||||
-- INSERT INTO rlarp.osm_pool SELECT * FROM final RETURNING *
|
||||
-- )
|
||||
-- ,insagg AS (
|
||||
-- SELECT
|
||||
-- ---------customer info-----------------
|
||||
-- bill_cust_descr
|
||||
-- ,billto_group
|
||||
-- ,ship_cust_descr
|
||||
-- ,shipto_group
|
||||
-- ,quota_rep_descr
|
||||
-- ,director
|
||||
-- ,segm
|
||||
-- ,substance
|
||||
-- ,chan
|
||||
-- ,chansub
|
||||
-- ---------product info------------------
|
||||
-- ,majg_descr
|
||||
-- ,ming_descr
|
||||
-- ,majs_descr
|
||||
-- ,mins_descr
|
||||
-- --,brand
|
||||
-- --,part_family
|
||||
-- ,part_group
|
||||
-- ,branding
|
||||
-- --,color
|
||||
-- ,part_descr
|
||||
-- ---------dates-------------------------
|
||||
-- ,order_season
|
||||
-- ,order_month
|
||||
-- ,ship_season
|
||||
-- ,ship_month
|
||||
-- ,request_season
|
||||
-- ,request_month
|
||||
-- ,promo
|
||||
-- ,version
|
||||
-- ,iter
|
||||
-- ,logid
|
||||
-- ,tag
|
||||
-- ,comment
|
||||
-- --------values-------------------------
|
||||
-- ,sum(value_loc) value_loc
|
||||
-- ,sum(value_usd) value_usd
|
||||
-- ,sum(cost_loc) cost_loc
|
||||
-- ,sum(cost_usd) cost_usd
|
||||
-- ,sum(units) units
|
||||
-- ,sum(pounds) pounds
|
||||
-- FROM
|
||||
-- ins
|
||||
-- GROUP BY
|
||||
-- ---------customer info-----------------
|
||||
-- bill_cust_descr
|
||||
-- ,billto_group
|
||||
-- ,ship_cust_descr
|
||||
-- ,shipto_group
|
||||
-- ,quota_rep_descr
|
||||
-- ,director
|
||||
-- ,segm
|
||||
-- ,substance
|
||||
-- ,chan
|
||||
-- ,chansub
|
||||
-- ---------product info------------------
|
||||
-- ,majg_descr
|
||||
-- ,ming_descr
|
||||
-- ,majs_descr
|
||||
-- ,mins_descr
|
||||
-- --,brand
|
||||
-- --,part_family
|
||||
-- ,part_group
|
||||
-- ,branding
|
||||
-- --,color
|
||||
-- ,part_descr
|
||||
-- ---------dates-------------------------
|
||||
-- ,order_season
|
||||
-- ,order_month
|
||||
-- ,ship_season
|
||||
-- ,ship_month
|
||||
-- ,request_season
|
||||
-- ,request_month
|
||||
-- ,promo
|
||||
-- ,version
|
||||
-- ,iter
|
||||
-- ,logid
|
||||
-- ,tag
|
||||
-- ,comment
|
||||
-- )
|
||||
-- -- select 'insagg', * from insagg
|
||||
-- --
|
||||
-- SELECT json_agg(row_to_json(insagg)) x from insagg
|
||||
70
debug/mix.csv
Normal file
70
debug/mix.csv
Normal file
@ -0,0 +1,70 @@
|
||||
bill_cust_descr,ship_cust_descr,promo,terms,r_currency,order_month,ship_month,fc_mix,baseline_mix
|
||||
BATT0001 - BATTLEFIELD FARMS - COSTA,BATT0001 - BATTLEFIELD FARMS - COSTA,NONE,1G,US,01 - Jun,01 - Jun,0.01633,0.01085
|
||||
COST0017 - COSTA FARMS LLC-GOULDS FL,COST0044 - COSTA ENGELMANN LOC 1,NONE,7N,US,01 - Jun,03 - Aug,0.00159,0.00106
|
||||
COST0017 - COSTA FARMS LLC-GOULDS FL,COST0007 - COSTA COLOR-MIAMI FL,NONE,7N,US,02 - Jul,02 - Jul,0.00112,0.00074
|
||||
COST0017 - COSTA FARMS LLC-GOULDS FL,COST0015 - COSTA FARMS-FOLIAGE DIV (CNF),NONE,7N,US,02 - Jul,03 - Aug,0.00967,0.00643
|
||||
COST0017 - COSTA FARMS LLC-GOULDS FL,COST0015 - COSTA FARMS-FOLIAGE DIV (CNF),NONE,7N,US,02 - Jul,05 - Oct,0.01631,0.01084
|
||||
COST0017 - COSTA FARMS LLC-GOULDS FL,COST0044 - COSTA ENGELMANN LOC 1,NONE,7N,US,03 - Aug,03 - Aug,0.00159,0.00106
|
||||
COST0017 - COSTA FARMS LLC-GOULDS FL,COSD0002 - COSTA DELRAY,NONE,7N,US,03 - Aug,04 - Sep,0.02773,0.01843
|
||||
COST0017 - COSTA FARMS LLC-GOULDS FL,COST0015 - COSTA FARMS-FOLIAGE DIV (CNF),NONE,7N,US,03 - Aug,05 - Oct,0.02870,0.01908
|
||||
COST0017 - COSTA FARMS LLC-GOULDS FL,COSD0002 - COSTA DELRAY,NONE,7N,US,03 - Aug,05 - Oct,0.02304,0.01531
|
||||
COST0017 - COSTA FARMS LLC-GOULDS FL,COST0015 - COSTA FARMS-FOLIAGE DIV (CNF),NONE,7N,US,03 - Aug,06 - Nov,0.01913,0.01272
|
||||
BATT0001 - BATTLEFIELD FARMS - COSTA,BATT0001 - BATTLEFIELD FARMS - COSTA,REPLACEMENT,1G,US,04 - Sep,04 - Sep,0.00003,0.00002
|
||||
COST0017 - COSTA FARMS LLC-GOULDS FL,COST0015 - COSTA FARMS-FOLIAGE DIV (CNF),NONE,7N,US,04 - Sep,06 - Nov,0.07335,0.04875
|
||||
BATT0001 - BATTLEFIELD FARMS - COSTA,BATT0001 - BATTLEFIELD FARMS - COSTA,NONE,1G,US,05 - Oct,05 - Oct,0.00669,0.00445
|
||||
COST0017 - COSTA FARMS LLC-GOULDS FL,COST0015 - COSTA FARMS-FOLIAGE DIV (CNF),NONE,7N,US,05 - Oct,06 - Nov,0.00183,0.00122
|
||||
BATT0001 - BATTLEFIELD FARMS - COSTA,BATT0001 - BATTLEFIELD FARMS - COSTA,NONE,1G,US,05 - Oct,06 - Nov,0.00628,0.00417
|
||||
COST0017 - COSTA FARMS LLC-GOULDS FL,COST0044 - COSTA ENGELMANN LOC 1,NONE,7N,US,05 - Oct,08 - Jan,0.00159,0.00106
|
||||
BATT0001 - BATTLEFIELD FARMS - COSTA,BATT0001 - BATTLEFIELD FARMS - COSTA,NONE,1G,US,05 - Oct,09 - Feb,0.00831,0.00552
|
||||
BATT0001 - BATTLEFIELD FARMS - COSTA,BATT0001 - BATTLEFIELD FARMS - COSTA,NONE,1G,US,06 - Nov,06 - Nov,0.00255,0.00170
|
||||
COST0017 - COSTA FARMS LLC-GOULDS FL,COST0015 - COSTA FARMS-FOLIAGE DIV (CNF),NONE,7N,US,06 - Nov,11 - Apr,0.01595,0.01060
|
||||
COST0017 - COSTA FARMS LLC-GOULDS FL,COST0015 - COSTA FARMS-FOLIAGE DIV (CNF),NONE,7N,US,07 - Dec,07 - Dec,0.00487,0.00324
|
||||
COST0017 - COSTA FARMS LLC-GOULDS FL,COST0007 - COSTA COLOR-MIAMI FL,NONE,7N,US,07 - Dec,07 - Dec,0.01593,0.01059
|
||||
COST0017 - COSTA FARMS LLC-GOULDS FL,"COST0046 - COSTA LAYMAN, LLC",NONE,7N,US,07 - Dec,08 - Jan,0.02845,0.01891
|
||||
COST0017 - COSTA FARMS LLC-GOULDS FL,COST0007 - COSTA COLOR-MIAMI FL,NONE,7N,US,07 - Dec,08 - Jan,0.00228,0.00151
|
||||
COST0017 - COSTA FARMS LLC-GOULDS FL,COST0002 - COSTA CAROLINA-LEICESTER NC,NONE,7N,US,08 - Jan,08 - Jan,0.02586,0.01719
|
||||
COST0017 - COSTA FARMS LLC-GOULDS FL,COST0007 - COSTA COLOR-MIAMI FL,NONE,7N,US,08 - Jan,08 - Jan,0.02122,0.02110
|
||||
COST0017 - COSTA FARMS LLC-GOULDS FL,COST0015 - COSTA FARMS-FOLIAGE DIV (CNF),NONE,7N,US,08 - Jan,08 - Jan,0.00250,0.00166
|
||||
COST0017 - COSTA FARMS LLC-GOULDS FL,COST0029 - COSTA LAYMAN GHSE,NONE,7N,US,08 - Jan,08 - Jan,0.00786,0.00522
|
||||
METR0002 - METROLINA GREENHOUSES,BATT0001 - BATTLEFIELD FARMS - COSTA,NONE,1A,US,08 - Jan,08 - Jan,0.00293,0.00195
|
||||
COST0017 - COSTA FARMS LLC-GOULDS FL,COST0007 - COSTA COLOR-MIAMI FL,NONE,7N,US,08 - Jan,09 - Feb,0.01229,0.00817
|
||||
COST0017 - COSTA FARMS LLC-GOULDS FL,COST0002 - COSTA CAROLINA-LEICESTER NC,NONE,7N,US,08 - Jan,09 - Feb,0.03269,0.02172
|
||||
METR0002 - METROLINA GREENHOUSES,BATT0001 - BATTLEFIELD FARMS - COSTA,NONE,1A,US,08 - Jan,09 - Feb,0.00367,0.00244
|
||||
COST0017 - COSTA FARMS LLC-GOULDS FL,COST0002 - COSTA CAROLINA-LEICESTER NC,NONE,7N,US,08 - Jan,10 - Mar,0.02959,0.01966
|
||||
COST0017 - COSTA FARMS LLC-GOULDS FL,"COST0046 - COSTA LAYMAN, LLC",NONE,7N,US,08 - Jan,10 - Mar,0.00569,0.00378
|
||||
COST0017 - COSTA FARMS LLC-GOULDS FL,COST0007 - COSTA COLOR-MIAMI FL,NONE,7N,US,08 - Jan,10 - Mar,0.00168,0.00111
|
||||
COST0017 - COSTA FARMS LLC-GOULDS FL,COST0043 - COSTA WAUCHULA II FACILITY,NONE,7N,US,09 - Feb,01 - Jun,0.03212,0.02135
|
||||
COST0017 - COSTA FARMS LLC-GOULDS FL,COSD0002 - COSTA DELRAY,NONE,7N,US,09 - Feb,01 - Jun,0.07144,0.04748
|
||||
COST0017 - COSTA FARMS LLC-GOULDS FL,COST0022 - COSTA FARMS-FOLIAGE DIVISION,NONE,7N,US,09 - Feb,01 - Jun,0.03747,0.02491
|
||||
COST0017 - COSTA FARMS LLC-GOULDS FL,COSD0002 - COSTA DELRAY,NONE,7N,US,09 - Feb,02 - Jul,0.07587,0.05042
|
||||
COST0017 - COSTA FARMS LLC-GOULDS FL,COST0022 - COSTA FARMS-FOLIAGE DIVISION,NONE,7N,US,09 - Feb,03 - Aug,0.03655,0.02429
|
||||
COST0017 - COSTA FARMS LLC-GOULDS FL,COST0043 - COSTA WAUCHULA II FACILITY,NONE,7N,US,09 - Feb,03 - Aug,0.03120,0.02073
|
||||
COST0017 - COSTA FARMS LLC-GOULDS FL,COST0015 - COSTA FARMS-FOLIAGE DIV (CNF),NONE,7N,US,09 - Feb,09 - Feb,0.00586,0.00390
|
||||
COST0017 - COSTA FARMS LLC-GOULDS FL,"COST0046 - COSTA LAYMAN, LLC",NONE,7N,US,09 - Feb,09 - Feb,0.00000,0.06550
|
||||
COST0017 - COSTA FARMS LLC-GOULDS FL,"COST0046 - COSTA LAYMAN, LLC",NONE,7N,US,09 - Feb,10 - Mar,0.00000,0.07878
|
||||
COST0017 - COSTA FARMS LLC-GOULDS FL,COST0007 - COSTA COLOR-MIAMI FL,NONE,7N,US,09 - Feb,11 - Apr,0.00000,0.00354
|
||||
COST0017 - COSTA FARMS LLC-GOULDS FL,COST0002 - COSTA CAROLINA-LEICESTER NC,NONE,7N,US,09 - Feb,11 - Apr,0.00000,0.00354
|
||||
COST0017 - COSTA FARMS LLC-GOULDS FL,"COST0046 - COSTA LAYMAN, LLC",NONE,7N,US,09 - Feb,11 - Apr,0.00000,0.03098
|
||||
COST0017 - COSTA FARMS LLC-GOULDS FL,"COST0046 - COSTA LAYMAN, LLC",NONE,7N,US,09 - Feb,12 - May,0.00499,0.03341
|
||||
COST0017 - COSTA FARMS LLC-GOULDS FL,"COST0046 - COSTA LAYMAN, LLC",NONE,7N,US,10 - Mar,01 - Jun,0.00000,0.07081
|
||||
COST0017 - COSTA FARMS LLC-GOULDS FL,COST0002 - COSTA CAROLINA-LEICESTER NC,NONE,7N,US,10 - Mar,01 - Jun,0.00000,0.00266
|
||||
COST0017 - COSTA FARMS LLC-GOULDS FL,COSD0002 - COSTA DELRAY,NONE,7N,US,10 - Mar,03 - Aug,0.06885,0.04576
|
||||
COST0017 - COSTA FARMS LLC-GOULDS FL,COST0015 - COSTA FARMS-FOLIAGE DIV (CNF),NONE,7N,US,10 - Mar,10 - Mar,0.00291,0.00193
|
||||
BATT0001 - BATTLEFIELD FARMS - COSTA,BATT0001 - BATTLEFIELD FARMS - COSTA,NONE,1G,US,10 - Mar,10 - Mar,0.01410,0.00937
|
||||
BATT0001 - BATTLEFIELD FARMS - COSTA,BATT0001 - BATTLEFIELD FARMS - COSTA,NONE,1G,US,10 - Mar,11 - Apr,0.00251,0.00167
|
||||
BATT0001 - BATTLEFIELD FARMS - COSTA,BATT0001 - BATTLEFIELD FARMS - COSTA,NONE,1G,US,10 - Mar,12 - May,0.00866,0.00576
|
||||
COST0017 - COSTA FARMS LLC-GOULDS FL,COST0002 - COSTA CAROLINA-LEICESTER NC,NONE,7N,US,10 - Mar,12 - May,0.00000,0.00354
|
||||
COST0017 - COSTA FARMS LLC-GOULDS FL,COST0015 - COSTA FARMS-FOLIAGE DIV (CNF),NONE,7N,US,10 - Mar,12 - May,0.03189,0.02120
|
||||
COST0017 - COSTA FARMS LLC-GOULDS FL,"COST0046 - COSTA LAYMAN, LLC",NONE,7N,US,10 - Mar,12 - May,0.00000,0.03541
|
||||
COST0017 - COSTA FARMS LLC-GOULDS FL,COSD0002 - COSTA DELRAY,NONE,7N,US,10 - Mar,12 - May,0.00988,0.00656
|
||||
COST0017 - COSTA FARMS LLC-GOULDS FL,COST0007 - COSTA COLOR-MIAMI FL,NONE,7N,US,10 - Mar,12 - May,0.00000,0.00354
|
||||
BATT0001 - BATTLEFIELD FARMS - COSTA,BATT0001 - BATTLEFIELD FARMS - COSTA,NONE,1G,US,11 - Apr,01 - Jun,0.00346,0.00230
|
||||
COST0017 - COSTA FARMS LLC-GOULDS FL,COST0022 - COSTA FARMS-FOLIAGE DIVISION,NONE,7N,US,11 - Apr,01 - Jun,0.01957,0.01301
|
||||
COST0018 - COSTA COLOR INC-MIAMI FL,COSD0002 - COSTA DELRAY,NONE,7N,US,11 - Apr,01 - Jun,0.00702,0.00467
|
||||
COST0017 - COSTA FARMS LLC-GOULDS FL,COST0022 - COSTA FARMS-FOLIAGE DIVISION,NONE,7N,US,11 - Apr,02 - Jul,0.00277,0.00184
|
||||
COST0018 - COSTA COLOR INC-MIAMI FL,COSD0002 - COSTA DELRAY,NONE,7N,US,11 - Apr,02 - Jul,0.00535,0.00356
|
||||
COST0017 - COSTA FARMS LLC-GOULDS FL,COSD0002 - COSTA DELRAY,NONE,7N,US,11 - Apr,03 - Aug,0.01408,0.00936
|
||||
COST0017 - COSTA FARMS LLC-GOULDS FL,COSD0002 - COSTA DELRAY,NONE,7N,US,11 - Apr,04 - Sep,0.02028,0.01348
|
||||
COST0017 - COSTA FARMS LLC-GOULDS FL,COSD0002 - COSTA DELRAY,NONE,7N,US,11 - Apr,05 - Oct,0.01106,0.00735
|
||||
COST0017 - COSTA FARMS LLC-GOULDS FL,COST0015 - COSTA FARMS-FOLIAGE DIV (CNF),NONE,7N,US,12 - May,03 - Aug,0.00957,0.00636
|
||||
COST0017 - COSTA FARMS LLC-GOULDS FL,COSD0002 - COSTA DELRAY,NONE,7N,US,12 - May,12 - May,0.01326,0.00881
|
||||
|
110
debug/req.json
Normal file
110
debug/req.json
Normal file
@ -0,0 +1,110 @@
|
||||
{
|
||||
"scenario": {
|
||||
"segm": [
|
||||
"Greenhouse",
|
||||
"Nursery",
|
||||
"Other",
|
||||
"Sustainable",
|
||||
""
|
||||
],
|
||||
"quota_rep_descr": "13028 - RICHARD MEULE",
|
||||
"shipto_group": "COSTA",
|
||||
"majg_descr": "110 - 110 - INJECTION",
|
||||
"part_group": "SQD05500",
|
||||
"version": "b26",
|
||||
"iter": [
|
||||
"copy",
|
||||
"plan",
|
||||
"adj volume"
|
||||
]
|
||||
},
|
||||
"stamp": "2025-04-05T15:58:08.504Z",
|
||||
"user": "Trowbridge, Paul",
|
||||
"source": "adj",
|
||||
"type": "new_basket",
|
||||
"months": {
|
||||
"08 - Jan": {
|
||||
"amount": 554784.528,
|
||||
"qty": 5439064
|
||||
}
|
||||
},
|
||||
"newpart": "KEP015P0X56B316",
|
||||
"basket": [
|
||||
{
|
||||
"part_descr": "KEP015P0X56B316",
|
||||
"bill_cust_descr": "COST0017 - COSTA FARMS LLC-GOULDS FL",
|
||||
"ship_cust_descr": "COST0007 - COSTA COLOR-MIAMI FL",
|
||||
"mix": "5.82453157381491E-03"
|
||||
},
|
||||
{
|
||||
"part_descr": "KEP015P0X56B316PYMLI",
|
||||
"bill_cust_descr": "COST0017 - COSTA FARMS LLC-GOULDS FL",
|
||||
"ship_cust_descr": "COST0007 - COSTA COLOR-MIAMI FL",
|
||||
"mix": "5.82453157381491E-03"
|
||||
},
|
||||
{
|
||||
"part_descr": "KEP015P0X19B316",
|
||||
"bill_cust_descr": "COST0017 - COSTA FARMS LLC-GOULDS FL",
|
||||
"ship_cust_descr": "COST0007 - COSTA COLOR-MIAMI FL",
|
||||
"mix": "1.16490631476298E-02"
|
||||
},
|
||||
{
|
||||
"part_descr": "KEP015P0X19B316PYMGL",
|
||||
"bill_cust_descr": "COST0017 - COSTA FARMS LLC-GOULDS FL",
|
||||
"ship_cust_descr": "COST0007 - COSTA COLOR-MIAMI FL",
|
||||
"mix": "1.16490631476298E-02"
|
||||
},
|
||||
{
|
||||
"part_descr": "KET10P15G18B030",
|
||||
"bill_cust_descr": "COST0017 - COSTA FARMS LLC-GOULDS FL",
|
||||
"ship_cust_descr": "COST0007 - COSTA COLOR-MIAMI FL",
|
||||
"mix": "2.23714962721527E-03"
|
||||
},
|
||||
{
|
||||
"part_descr": "KEP010P0X19B524",
|
||||
"bill_cust_descr": "COST0017 - COSTA FARMS LLC-GOULDS FL",
|
||||
"ship_cust_descr": "COST0007 - COSTA COLOR-MIAMI FL",
|
||||
"mix": "6.74586656821835E-02"
|
||||
},
|
||||
{
|
||||
"part_descr": "KEP010P0X19B262PYMLE",
|
||||
"bill_cust_descr": "COST0017 - COSTA FARMS LLC-GOULDS FL",
|
||||
"ship_cust_descr": "COST0007 - COSTA COLOR-MIAMI FL",
|
||||
"mix": "6.74586656821835E-02"
|
||||
},
|
||||
{
|
||||
"part_descr": "KEP010P0X19B524",
|
||||
"bill_cust_descr": "COST0017 - COSTA FARMS LLC-GOULDS FL",
|
||||
"ship_cust_descr": "COST0007 - COSTA COLOR-MIAMI FL",
|
||||
"mix": 0.375841137372166
|
||||
},
|
||||
{
|
||||
"part_descr": "KEP010P0X19B262PYMLE",
|
||||
"bill_cust_descr": "COST0017 - COSTA FARMS LLC-GOULDS FL",
|
||||
"ship_cust_descr": "COST0007 - COSTA COLOR-MIAMI FL",
|
||||
"mix": 0.375841137372166
|
||||
},
|
||||
{
|
||||
"part_descr": "KET12P10A10B027",
|
||||
"bill_cust_descr": "COST0017 - COSTA FARMS LLC-GOULDS FL",
|
||||
"ship_cust_descr": "COST0007 - COSTA COLOR-MIAMI FL",
|
||||
"mix": 0.036989452596991
|
||||
},
|
||||
{
|
||||
"part_descr": "KET10P15A10B030",
|
||||
"bill_cust_descr": "COST0017 - COSTA FARMS LLC-GOULDS FL",
|
||||
"ship_cust_descr": "COST0007 - COSTA COLOR-MIAMI FL",
|
||||
"mix": "2.23714962721527E-03"
|
||||
},
|
||||
{
|
||||
"part_descr": "KET12P10G18B027",
|
||||
"bill_cust_descr": "COST0017 - COSTA FARMS LLC-GOULDS FL",
|
||||
"ship_cust_descr": "COST0007 - COSTA COLOR-MIAMI FL",
|
||||
"mix": 0.036989452596991
|
||||
}
|
||||
],
|
||||
"message": "quote mix",
|
||||
"tag": "Keystone Incr",
|
||||
"version": "1.10.1",
|
||||
"username": "Trowbridge, Paul"
|
||||
}
|
||||
742
debug/scaenario_package_sample.json
Normal file
742
debug/scaenario_package_sample.json
Normal file
@ -0,0 +1,742 @@
|
||||
{
|
||||
"package": {
|
||||
"mpvt": [
|
||||
{
|
||||
"2026 base qty": 312441,
|
||||
"2026 tot value_usd": 26713.92,
|
||||
"2026 base value_usd": 26713.92,
|
||||
"2026 tot qty": 312441,
|
||||
"2026 adj value_usd": null,
|
||||
"2026 adj qty": null,
|
||||
"2025 value_usd": 26713.92,
|
||||
"order_month": "01 - Jun",
|
||||
"2025 qty": 312441
|
||||
},
|
||||
{
|
||||
"2026 base qty": 127228,
|
||||
"2026 tot value_usd": 61846.76,
|
||||
"2026 base value_usd": 61846.76,
|
||||
"2026 tot qty": 127228,
|
||||
"2026 adj value_usd": null,
|
||||
"2026 adj qty": null,
|
||||
"2025 value_usd": 61846.76,
|
||||
"order_month": "02 - Jul",
|
||||
"2025 qty": 127228
|
||||
},
|
||||
{
|
||||
"2026 base qty": 1175025,
|
||||
"2026 tot value_usd": 119418.68,
|
||||
"2026 base value_usd": 119418.68,
|
||||
"2026 tot qty": 1175025,
|
||||
"2026 adj value_usd": null,
|
||||
"2026 adj qty": null,
|
||||
"2025 value_usd": 119418.68,
|
||||
"order_month": "03 - Aug",
|
||||
"2025 qty": 1175025
|
||||
},
|
||||
{
|
||||
"2026 base qty": 1197570,
|
||||
"2026 tot value_usd": 80385.68,
|
||||
"2026 base value_usd": 80385.68,
|
||||
"2026 tot qty": 1197570,
|
||||
"2026 adj value_usd": null,
|
||||
"2026 adj qty": null,
|
||||
"2025 value_usd": 80385.68,
|
||||
"order_month": "04 - Sep",
|
||||
"2025 qty": 1197570
|
||||
},
|
||||
{
|
||||
"2026 base qty": 394909,
|
||||
"2026 tot value_usd": 50636.61,
|
||||
"2026 base value_usd": 50636.61,
|
||||
"2026 tot qty": 394909,
|
||||
"2026 adj value_usd": null,
|
||||
"2026 adj qty": null,
|
||||
"2025 value_usd": 50636.61,
|
||||
"order_month": "05 - Oct",
|
||||
"2025 qty": 394909
|
||||
},
|
||||
{
|
||||
"2026 base qty": 274270,
|
||||
"2026 tot value_usd": 27458.35,
|
||||
"2026 base value_usd": 27458.35,
|
||||
"2026 tot qty": 274270,
|
||||
"2026 adj value_usd": null,
|
||||
"2026 adj qty": null,
|
||||
"2025 value_usd": 27458.35,
|
||||
"order_month": "06 - Nov",
|
||||
"2025 qty": 274270
|
||||
},
|
||||
{
|
||||
"2026 base qty": 688606,
|
||||
"2026 tot value_usd": 73007.28,
|
||||
"2026 base value_usd": 73007.28,
|
||||
"2026 tot qty": 688606,
|
||||
"2026 adj value_usd": null,
|
||||
"2026 adj qty": null,
|
||||
"2025 value_usd": 73007.28,
|
||||
"order_month": "07 - Dec",
|
||||
"2025 qty": 688606
|
||||
},
|
||||
{
|
||||
"2026 base qty": 2991630,
|
||||
"2026 tot value_usd": 228708.03,
|
||||
"2026 base value_usd": 242263.23,
|
||||
"2026 tot qty": 2906910,
|
||||
"2026 adj value_usd": -13555.2,
|
||||
"2026 adj qty": -84720,
|
||||
"2025 value_usd": 242263.23,
|
||||
"order_month": "08 - Jan",
|
||||
"2025 qty": 2991630
|
||||
},
|
||||
{
|
||||
"2026 base qty": 4632500,
|
||||
"2026 tot value_usd": 391877.2,
|
||||
"2026 base value_usd": 758715.6,
|
||||
"2026 tot qty": 2059700,
|
||||
"2026 adj value_usd": -366838.4,
|
||||
"2026 adj qty": -2572800,
|
||||
"2025 value_usd": 758715.6,
|
||||
"order_month": "09 - Feb",
|
||||
"2025 qty": 4632500
|
||||
},
|
||||
{
|
||||
"2026 base qty": 3123826,
|
||||
"2026 tot value_usd": 187563.22,
|
||||
"2026 base value_usd": 377146.42,
|
||||
"2026 tot qty": 1719506,
|
||||
"2026 adj value_usd": -189583.2,
|
||||
"2026 adj qty": -1404320,
|
||||
"2025 value_usd": 377146.42,
|
||||
"order_month": "10 - Mar",
|
||||
"2025 qty": 3123826
|
||||
},
|
||||
{
|
||||
"2026 base qty": 648480,
|
||||
"2026 tot value_usd": 130133.7,
|
||||
"2026 base value_usd": 130133.7,
|
||||
"2026 tot qty": 648480,
|
||||
"2026 adj value_usd": null,
|
||||
"2026 adj qty": null,
|
||||
"2025 value_usd": 130133.7,
|
||||
"order_month": "11 - Apr",
|
||||
"2025 qty": 648480
|
||||
},
|
||||
{
|
||||
"2026 base qty": 219766,
|
||||
"2026 tot value_usd": 42629.07,
|
||||
"2026 base value_usd": 42629.07,
|
||||
"2026 tot qty": 219766,
|
||||
"2026 adj value_usd": null,
|
||||
"2026 adj qty": null,
|
||||
"2025 value_usd": 42629.07,
|
||||
"order_month": "12 - May",
|
||||
"2025 qty": 219766
|
||||
}
|
||||
],
|
||||
"customers": [
|
||||
{
|
||||
"ship_cust_descr": "BATT0001 - BATTLEFIELD FARMS - COSTA",
|
||||
"value_usd": 301066.66,
|
||||
"bill_cust_descr": "BATT0001 - BATTLEFIELD FARMS - COSTA"
|
||||
},
|
||||
{
|
||||
"ship_cust_descr": "COST0029 - COSTA LAYMAN GHSE",
|
||||
"value_usd": 21945,
|
||||
"bill_cust_descr": "COST0017 - COSTA FARMS LLC-GOULDS FL"
|
||||
},
|
||||
{
|
||||
"ship_cust_descr": "COST0015 - COSTA FARMS-FOLIAGE DIV (CNF)",
|
||||
"value_usd": 579244.56,
|
||||
"bill_cust_descr": "COST0017 - COSTA FARMS LLC-GOULDS FL"
|
||||
},
|
||||
{
|
||||
"ship_cust_descr": "COSD0002 - COSTA DELRAY",
|
||||
"value_usd": 32825.1,
|
||||
"bill_cust_descr": "COST0018 - COSTA COLOR INC-MIAMI FL"
|
||||
},
|
||||
{
|
||||
"ship_cust_descr": "COST0046 - COSTA LAYMAN, LLC",
|
||||
"value_usd": 676234.04,
|
||||
"bill_cust_descr": "COST0017 - COSTA FARMS LLC-GOULDS FL"
|
||||
},
|
||||
{
|
||||
"ship_cust_descr": "COST0007 - COSTA COLOR-MIAMI FL",
|
||||
"value_usd": 202689.36,
|
||||
"bill_cust_descr": "COST0017 - COSTA FARMS LLC-GOULDS FL"
|
||||
},
|
||||
{
|
||||
"ship_cust_descr": "COST0044 - COSTA ENGELMANN LOC 1",
|
||||
"value_usd": 10566.18,
|
||||
"bill_cust_descr": "COST0017 - COSTA FARMS LLC-GOULDS FL"
|
||||
},
|
||||
{
|
||||
"ship_cust_descr": "COST0002 - COSTA CAROLINA-LEICESTER NC",
|
||||
"value_usd": 256613.6,
|
||||
"bill_cust_descr": "COST0017 - COSTA FARMS LLC-GOULDS FL"
|
||||
},
|
||||
{
|
||||
"ship_cust_descr": "BATT0001 - BATTLEFIELD FARMS - COSTA",
|
||||
"value_usd": 48060,
|
||||
"bill_cust_descr": "METR0002 - METROLINA GREENHOUSES"
|
||||
},
|
||||
{
|
||||
"ship_cust_descr": "COST0043 - COSTA WAUCHULA II FACILITY",
|
||||
"value_usd": 156153.54,
|
||||
"bill_cust_descr": "COST0017 - COSTA FARMS LLC-GOULDS FL"
|
||||
},
|
||||
{
|
||||
"ship_cust_descr": "COST0022 - COSTA FARMS-FOLIAGE DIVISION",
|
||||
"value_usd": 239334.98,
|
||||
"bill_cust_descr": "COST0017 - COSTA FARMS LLC-GOULDS FL"
|
||||
},
|
||||
{
|
||||
"ship_cust_descr": "COSD0002 - COSTA DELRAY",
|
||||
"value_usd": 886000.78,
|
||||
"bill_cust_descr": "COST0017 - COSTA FARMS LLC-GOULDS FL"
|
||||
}
|
||||
],
|
||||
"basket": [
|
||||
{
|
||||
"mix": 0.1704371123891287,
|
||||
"ship_cust_descr": "COSD0002 - COSTA DELRAY",
|
||||
"part_descr": "MIH09000G18B037 - 9 MILANO HP TS CH BLACK",
|
||||
"bill_cust_descr": "COST0017 - COSTA FARMS LLC-GOULDS FL"
|
||||
},
|
||||
{
|
||||
"mix": 0.1549508202604378,
|
||||
"ship_cust_descr": "COST0046 - COSTA LAYMAN, LLC",
|
||||
"part_descr": "SQD05500G18B107 - 5.5 SQ DEEP WAVE LOCK POT BLCK",
|
||||
"bill_cust_descr": "COST0017 - COSTA FARMS LLC-GOULDS FL"
|
||||
},
|
||||
{
|
||||
"mix": 0.11367668153990793,
|
||||
"ship_cust_descr": "COST0015 - COSTA FARMS-FOLIAGE DIV (CNF)",
|
||||
"part_descr": "AZA06001G18B260 - 6 AZALEA POT REV BLACK",
|
||||
"bill_cust_descr": "COST0017 - COSTA FARMS LLC-GOULDS FL"
|
||||
},
|
||||
{
|
||||
"mix": 5.7463763369630314e-2,
|
||||
"ship_cust_descr": "COSD0002 - COSTA DELRAY",
|
||||
"part_descr": "HZP3E100G18C800 - E-10 3 STRAND HGR BLACK",
|
||||
"bill_cust_descr": "COST0017 - COSTA FARMS LLC-GOULDS FL"
|
||||
},
|
||||
{
|
||||
"mix": 5.233752924370703e-2,
|
||||
"ship_cust_descr": "COST0022 - COSTA FARMS-FOLIAGE DIVISION",
|
||||
"part_descr": "MIH09000G18B037 - 9 MILANO HP TS CH BLACK",
|
||||
"bill_cust_descr": "COST0017 - COSTA FARMS LLC-GOULDS FL"
|
||||
},
|
||||
{
|
||||
"mix": 4.253630113261844e-2,
|
||||
"ship_cust_descr": "COST0002 - COSTA CAROLINA-LEICESTER NC",
|
||||
"part_descr": "SQL04501G18B162 - 04.50 SQ DP PER TL BK @16250 B",
|
||||
"bill_cust_descr": "COST0017 - COSTA FARMS LLC-GOULDS FL"
|
||||
},
|
||||
{
|
||||
"mix": 3.3893920422637495e-2,
|
||||
"ship_cust_descr": "COST0043 - COSTA WAUCHULA II FACILITY",
|
||||
"part_descr": "MIH09000G18B037 - 9 MILANO HP TS CH BLACK",
|
||||
"bill_cust_descr": "COST0017 - COSTA FARMS LLC-GOULDS FL"
|
||||
},
|
||||
{
|
||||
"mix": 3.288376243258855e-2,
|
||||
"ship_cust_descr": "COST0015 - COSTA FARMS-FOLIAGE DIV (CNF)",
|
||||
"part_descr": "ULH12000G18B039 - 1200 ULTRA HB BLACK",
|
||||
"bill_cust_descr": "COST0017 - COSTA FARMS LLC-GOULDS FL"
|
||||
},
|
||||
{
|
||||
"mix": 2.809929053976596e-2,
|
||||
"ship_cust_descr": "BATT0001 - BATTLEFIELD FARMS - COSTA",
|
||||
"part_descr": "SQU04000G18B220 - 04.00 SQ QUART WAVE LOCK BLACK",
|
||||
"bill_cust_descr": "BATT0001 - BATTLEFIELD FARMS - COSTA"
|
||||
},
|
||||
{
|
||||
"mix": 2.7970520595890537e-2,
|
||||
"ship_cust_descr": "COST0007 - COSTA COLOR-MIAMI FL",
|
||||
"part_descr": "SQL03501G18B300 - 03.50 SQ DP PER TL BK @30000 B",
|
||||
"bill_cust_descr": "COST0017 - COSTA FARMS LLC-GOULDS FL"
|
||||
},
|
||||
{
|
||||
"mix": 2.7970520595890537e-2,
|
||||
"ship_cust_descr": "COST0002 - COSTA CAROLINA-LEICESTER NC",
|
||||
"part_descr": "SQL03501G18B300 - 03.50 SQ DP PER TL BK @30000 B",
|
||||
"bill_cust_descr": "COST0017 - COSTA FARMS LLC-GOULDS FL"
|
||||
},
|
||||
{
|
||||
"mix": 2.6585188207886527e-2,
|
||||
"ship_cust_descr": "COST0046 - COSTA LAYMAN, LLC",
|
||||
"part_descr": "SQL04501G18B162 - 04.50 SQ DP PER TL BK @16250 B",
|
||||
"bill_cust_descr": "COST0017 - COSTA FARMS LLC-GOULDS FL"
|
||||
},
|
||||
{
|
||||
"mix": 2.5236375820358658e-2,
|
||||
"ship_cust_descr": "COSD0002 - COSTA DELRAY",
|
||||
"part_descr": "ULH12000G18B039 - 1200 ULTRA HB BLACK",
|
||||
"bill_cust_descr": "COST0017 - COSTA FARMS LLC-GOULDS FL"
|
||||
},
|
||||
{
|
||||
"mix": 1.783358173540251e-2,
|
||||
"ship_cust_descr": "COST0022 - COSTA FARMS-FOLIAGE DIVISION",
|
||||
"part_descr": "HZP3E100G18C800 - E-10 3 STRAND HGR BLACK",
|
||||
"bill_cust_descr": "COST0017 - COSTA FARMS LLC-GOULDS FL"
|
||||
},
|
||||
{
|
||||
"mix": 1.6422507086305004e-2,
|
||||
"ship_cust_descr": "COST0046 - COSTA LAYMAN, LLC",
|
||||
"part_descr": "NRT0T1G5A10B080PYLCC - 01.00 PW T1G 4TL NT OP WHITE",
|
||||
"bill_cust_descr": "COST0017 - COSTA FARMS LLC-GOULDS FL"
|
||||
},
|
||||
{
|
||||
"mix": 1.4178767044206148e-2,
|
||||
"ship_cust_descr": "COST0007 - COSTA COLOR-MIAMI FL",
|
||||
"part_descr": "SQL04501G18B162 - 04.50 SQ DP PER TL BK @16250 B",
|
||||
"bill_cust_descr": "COST0017 - COSTA FARMS LLC-GOULDS FL"
|
||||
},
|
||||
{
|
||||
"mix": 1.4090809432269384e-2,
|
||||
"ship_cust_descr": "BATT0001 - BATTLEFIELD FARMS - COSTA",
|
||||
"part_descr": "PAB12000E26B030 - 12 PANTERRA BOWL SANDSTONE",
|
||||
"bill_cust_descr": "METR0002 - METROLINA GREENHOUSES"
|
||||
},
|
||||
{
|
||||
"mix": 1.3594728500946042e-2,
|
||||
"ship_cust_descr": "BATT0001 - BATTLEFIELD FARMS - COSTA",
|
||||
"part_descr": "SPG19CM1B66C100 - 19.00 CM CLIP CAGE 300GN @100",
|
||||
"bill_cust_descr": "BATT0001 - BATTLEFIELD FARMS - COSTA"
|
||||
},
|
||||
{
|
||||
"mix": 1.2771445253217944e-2,
|
||||
"ship_cust_descr": "BATT0001 - BATTLEFIELD FARMS - COSTA",
|
||||
"part_descr": "SQL03501G18B300 - 03.50 SQ DP PER TL BK @30000 B",
|
||||
"bill_cust_descr": "BATT0001 - BATTLEFIELD FARMS - COSTA"
|
||||
},
|
||||
{
|
||||
"mix": 1.2488573573229316e-2,
|
||||
"ship_cust_descr": "BATT0001 - BATTLEFIELD FARMS - COSTA",
|
||||
"part_descr": "PAN10001B66C096 - 10.00 BULB PAN 2 300GN @96 CN",
|
||||
"bill_cust_descr": "BATT0001 - BATTLEFIELD FARMS - COSTA"
|
||||
},
|
||||
{
|
||||
"mix": 1.1889054490268341e-2,
|
||||
"ship_cust_descr": "COST0043 - COSTA WAUCHULA II FACILITY",
|
||||
"part_descr": "HZP3E100G18C800 - E-10 3 STRAND HGR BLACK",
|
||||
"bill_cust_descr": "COST0017 - COSTA FARMS LLC-GOULDS FL"
|
||||
},
|
||||
{
|
||||
"mix": 1.0625842450677329e-2,
|
||||
"ship_cust_descr": "BATT0001 - BATTLEFIELD FARMS - COSTA",
|
||||
"part_descr": "SQU03500G18B374 - 03.50 SQ PINT WAVE LOCK BLACK",
|
||||
"bill_cust_descr": "BATT0001 - BATTLEFIELD FARMS - COSTA"
|
||||
},
|
||||
{
|
||||
"mix": 8.678337781740693e-3,
|
||||
"ship_cust_descr": "COST0015 - COSTA FARMS-FOLIAGE DIV (CNF)",
|
||||
"part_descr": "HZP4E120G18C500 - E-12 4 STRAND HGR BLACK",
|
||||
"bill_cust_descr": "COST0017 - COSTA FARMS LLC-GOULDS FL"
|
||||
},
|
||||
{
|
||||
"mix": 7.7402698504351174e-3,
|
||||
"ship_cust_descr": "COST0015 - COSTA FARMS-FOLIAGE DIV (CNF)",
|
||||
"part_descr": "TIS40120G18D025 - 4/12/8 IST SHUT TRAY BK @25 BD",
|
||||
"bill_cust_descr": "COST0017 - COSTA FARMS LLC-GOULDS FL"
|
||||
},
|
||||
{
|
||||
"mix": 6.966242865391606e-3,
|
||||
"ship_cust_descr": "COST0007 - COSTA COLOR-MIAMI FL",
|
||||
"part_descr": "AZE08000A10B100PYLPX - 8 PW ELITE/ULTRA AZ POT WHITE",
|
||||
"bill_cust_descr": "COST0017 - COSTA FARMS LLC-GOULDS FL"
|
||||
},
|
||||
{
|
||||
"mix": 6.6517944027176795e-3,
|
||||
"ship_cust_descr": "COSD0002 - COSTA DELRAY",
|
||||
"part_descr": "MIH09000G18B037 - 9 MILANO HP TS CH BLACK",
|
||||
"bill_cust_descr": "COST0018 - COSTA COLOR INC-MIAMI FL"
|
||||
},
|
||||
{
|
||||
"mix": 6.63112436391254e-3,
|
||||
"ship_cust_descr": "COSD0002 - COSTA DELRAY",
|
||||
"part_descr": "HZP4E120G18C500 - E-12 4 STRAND HGR BLACK",
|
||||
"bill_cust_descr": "COST0017 - COSTA FARMS LLC-GOULDS FL"
|
||||
},
|
||||
{
|
||||
"mix": 6.107776572888802e-3,
|
||||
"ship_cust_descr": "COST0015 - COSTA FARMS-FOLIAGE DIV (CNF)",
|
||||
"part_descr": "TUH10000G18B048 - 10.00 TUSCAN SL HB BK@4800 BUL",
|
||||
"bill_cust_descr": "COST0017 - COSTA FARMS LLC-GOULDS FL"
|
||||
},
|
||||
{
|
||||
"mix": 4.730243093143183e-3,
|
||||
"ship_cust_descr": "COST0002 - COSTA CAROLINA-LEICESTER NC",
|
||||
"part_descr": "SQD05500G18B107 - 5.5 SQ DEEP WAVE LOCK POT BLCK",
|
||||
"bill_cust_descr": "COST0017 - COSTA FARMS LLC-GOULDS FL"
|
||||
},
|
||||
{
|
||||
"mix": 4.661753432648423e-3,
|
||||
"ship_cust_descr": "COST0029 - COSTA LAYMAN GHSE",
|
||||
"part_descr": "SQL03501G18B300 - 03.50 SQ DP PER TL BK @30000 B",
|
||||
"bill_cust_descr": "COST0017 - COSTA FARMS LLC-GOULDS FL"
|
||||
},
|
||||
{
|
||||
"mix": 3.974276737750686e-3,
|
||||
"ship_cust_descr": "COST0007 - COSTA COLOR-MIAMI FL",
|
||||
"part_descr": "SQD05500G18C240 - 5.5 SQ DEEP WAVE LOCK POT BLCK",
|
||||
"bill_cust_descr": "COST0017 - COSTA FARMS LLC-GOULDS FL"
|
||||
},
|
||||
{
|
||||
"mix": 3.488985273491587e-3,
|
||||
"ship_cust_descr": "BATT0001 - BATTLEFIELD FARMS - COSTA",
|
||||
"part_descr": "STS10000G18B035 - 10.00 STD STOCK TW BK @3500",
|
||||
"bill_cust_descr": "BATT0001 - BATTLEFIELD FARMS - COSTA"
|
||||
},
|
||||
{
|
||||
"mix": 3.4573205331943527e-3,
|
||||
"ship_cust_descr": "COST0007 - COSTA COLOR-MIAMI FL",
|
||||
"part_descr": "SQD05500G18B107 - 5.5 SQ DEEP WAVE LOCK POT BLCK",
|
||||
"bill_cust_descr": "COST0017 - COSTA FARMS LLC-GOULDS FL"
|
||||
},
|
||||
{
|
||||
"mix": 3.097919866979944e-3,
|
||||
"ship_cust_descr": "COST0044 - COSTA ENGELMANN LOC 1",
|
||||
"part_descr": "AZA06001G18B260 - 6 AZALEA POT REV BLACK",
|
||||
"bill_cust_descr": "COST0017 - COSTA FARMS LLC-GOULDS FL"
|
||||
},
|
||||
{
|
||||
"mix": 2.9722636225670853e-3,
|
||||
"ship_cust_descr": "COSD0002 - COSTA DELRAY",
|
||||
"part_descr": "HZP3E100G18C800 - E-10 3 STRAND HGR BLACK",
|
||||
"bill_cust_descr": "COST0018 - COSTA COLOR INC-MIAMI FL"
|
||||
},
|
||||
{
|
||||
"mix": 2.597429327378173e-3,
|
||||
"ship_cust_descr": "BATT0001 - BATTLEFIELD FARMS - COSTA",
|
||||
"part_descr": "SQL03501G18C832 - 03.50 SQ DP PER TL BK @832 CN",
|
||||
"bill_cust_descr": "BATT0001 - BATTLEFIELD FARMS - COSTA"
|
||||
},
|
||||
{
|
||||
"mix": 2.3875214184114865e-3,
|
||||
"ship_cust_descr": "BATT0001 - BATTLEFIELD FARMS - COSTA",
|
||||
"part_descr": "SPG10004B66C060 - 10 POINT CAGE GREEN",
|
||||
"bill_cust_descr": "BATT0001 - BATTLEFIELD FARMS - COSTA"
|
||||
},
|
||||
{
|
||||
"mix": 2.21653182080642e-3,
|
||||
"ship_cust_descr": "BATT0001 - BATTLEFIELD FARMS - COSTA",
|
||||
"part_descr": "SPG10003B66C060 - 10.00 CLIP CAGE REINFORCED GRN",
|
||||
"bill_cust_descr": "BATT0001 - BATTLEFIELD FARMS - COSTA"
|
||||
},
|
||||
{
|
||||
"mix": 1.7723458805257684e-3,
|
||||
"ship_cust_descr": "COST0029 - COSTA LAYMAN GHSE",
|
||||
"part_descr": "SQL04501G18B162 - 04.50 SQ DP PER TL BK @16250 B",
|
||||
"bill_cust_descr": "COST0017 - COSTA FARMS LLC-GOULDS FL"
|
||||
},
|
||||
{
|
||||
"mix": 1.504708458924587e-3,
|
||||
"ship_cust_descr": "COST0007 - COSTA COLOR-MIAMI FL",
|
||||
"part_descr": "AZE08000A10C270PYLPX - 8 PW ELITE/ULTRA AZ POT WHITE",
|
||||
"bill_cust_descr": "COST0017 - COSTA FARMS LLC-GOULDS FL"
|
||||
},
|
||||
{
|
||||
"mix": 1.3750706666113902e-3,
|
||||
"ship_cust_descr": "COST0007 - COSTA COLOR-MIAMI FL",
|
||||
"part_descr": "STS10000B66B035 - 10.00 STD STOCK TW 300GN @3500",
|
||||
"bill_cust_descr": "COST0017 - COSTA FARMS LLC-GOULDS FL"
|
||||
},
|
||||
{
|
||||
"mix": 7.430659056417713e-4,
|
||||
"ship_cust_descr": "COST0015 - COSTA FARMS-FOLIAGE DIV (CNF)",
|
||||
"part_descr": "HZP3E100G18C800 - E-10 3 STRAND HGR BLACK",
|
||||
"bill_cust_descr": "COST0017 - COSTA FARMS LLC-GOULDS FL"
|
||||
},
|
||||
{
|
||||
"mix": 3.0792200786821885e-4,
|
||||
"ship_cust_descr": "COST0046 - COSTA LAYMAN, LLC",
|
||||
"part_descr": "NRT0T1G5A10C150PYLCC - 01.00 PW T1G 4TL NT OP WHITE",
|
||||
"bill_cust_descr": "COST0017 - COSTA FARMS LLC-GOULDS FL"
|
||||
}
|
||||
],
|
||||
"months": [
|
||||
{
|
||||
"iter": "copy",
|
||||
"order_season": 2026,
|
||||
"seq": 12,
|
||||
"version": "b26",
|
||||
"units": 219766,
|
||||
"value_usd": 42629.07,
|
||||
"order_month": "12 - May"
|
||||
},
|
||||
{
|
||||
"iter": "copy",
|
||||
"order_season": 2026,
|
||||
"seq": 9,
|
||||
"version": "b26",
|
||||
"units": 4632500,
|
||||
"value_usd": 758715.6,
|
||||
"order_month": "09 - Feb"
|
||||
},
|
||||
{
|
||||
"iter": "copy",
|
||||
"order_season": 2026,
|
||||
"seq": 11,
|
||||
"version": "b26",
|
||||
"units": 648480,
|
||||
"value_usd": 130133.7,
|
||||
"order_month": "11 - Apr"
|
||||
},
|
||||
{
|
||||
"iter": "adj volume",
|
||||
"order_season": 2026,
|
||||
"seq": 8,
|
||||
"version": "b26",
|
||||
"units": -84720,
|
||||
"value_usd": -13555.2,
|
||||
"order_month": "08 - Jan"
|
||||
},
|
||||
{
|
||||
"iter": "copy",
|
||||
"order_season": 2026,
|
||||
"seq": 6,
|
||||
"version": "b26",
|
||||
"units": 274270,
|
||||
"value_usd": 27458.35,
|
||||
"order_month": "06 - Nov"
|
||||
},
|
||||
{
|
||||
"iter": "actuals",
|
||||
"order_season": 2025,
|
||||
"seq": 2,
|
||||
"version": "b26-act",
|
||||
"units": 127228,
|
||||
"value_usd": 61846.76,
|
||||
"order_month": "02 - Jul"
|
||||
},
|
||||
{
|
||||
"iter": "actuals",
|
||||
"order_season": 2025,
|
||||
"seq": 1,
|
||||
"version": "b26-act",
|
||||
"units": 312441,
|
||||
"value_usd": 26713.92,
|
||||
"order_month": "01 - Jun"
|
||||
},
|
||||
{
|
||||
"iter": "copy",
|
||||
"order_season": 2026,
|
||||
"seq": 5,
|
||||
"version": "b26",
|
||||
"units": 394909,
|
||||
"value_usd": 50636.61,
|
||||
"order_month": "05 - Oct"
|
||||
},
|
||||
{
|
||||
"iter": "actuals",
|
||||
"order_season": 2025,
|
||||
"seq": 8,
|
||||
"version": "b26-act",
|
||||
"units": 2991630,
|
||||
"value_usd": 242263.23,
|
||||
"order_month": "08 - Jan"
|
||||
},
|
||||
{
|
||||
"iter": "copy",
|
||||
"order_season": 2026,
|
||||
"seq": 2,
|
||||
"version": "b26",
|
||||
"units": 127228,
|
||||
"value_usd": 61846.76,
|
||||
"order_month": "02 - Jul"
|
||||
},
|
||||
{
|
||||
"iter": "actuals_plug",
|
||||
"order_season": 2025,
|
||||
"seq": 12,
|
||||
"version": "b26-act",
|
||||
"units": 219766,
|
||||
"value_usd": 42629.07,
|
||||
"order_month": "12 - May"
|
||||
},
|
||||
{
|
||||
"iter": "actuals",
|
||||
"order_season": 2025,
|
||||
"seq": 5,
|
||||
"version": "b26-act",
|
||||
"units": 394909,
|
||||
"value_usd": 50636.61,
|
||||
"order_month": "05 - Oct"
|
||||
},
|
||||
{
|
||||
"iter": "copy",
|
||||
"order_season": 2026,
|
||||
"seq": 3,
|
||||
"version": "b26",
|
||||
"units": 1175025,
|
||||
"value_usd": 119418.68,
|
||||
"order_month": "03 - Aug"
|
||||
},
|
||||
{
|
||||
"iter": "adj volume",
|
||||
"order_season": 2026,
|
||||
"seq": 9,
|
||||
"version": "b26",
|
||||
"units": -2572800,
|
||||
"value_usd": -366838.4,
|
||||
"order_month": "09 - Feb"
|
||||
},
|
||||
{
|
||||
"iter": "actuals",
|
||||
"order_season": 2025,
|
||||
"seq": 10,
|
||||
"version": "b26-act",
|
||||
"units": 3123826,
|
||||
"value_usd": 377146.42,
|
||||
"order_month": "10 - Mar"
|
||||
},
|
||||
{
|
||||
"iter": "copy",
|
||||
"order_season": 2026,
|
||||
"seq": 4,
|
||||
"version": "b26",
|
||||
"units": 1197570,
|
||||
"value_usd": 80385.68,
|
||||
"order_month": "04 - Sep"
|
||||
},
|
||||
{
|
||||
"iter": "actuals",
|
||||
"order_season": 2025,
|
||||
"seq": 4,
|
||||
"version": "b26-act",
|
||||
"units": 1197570,
|
||||
"value_usd": 80385.68,
|
||||
"order_month": "04 - Sep"
|
||||
},
|
||||
{
|
||||
"iter": "copy",
|
||||
"order_season": 2026,
|
||||
"seq": 1,
|
||||
"version": "b26",
|
||||
"units": 312441,
|
||||
"value_usd": 26713.92,
|
||||
"order_month": "01 - Jun"
|
||||
},
|
||||
{
|
||||
"iter": "copy",
|
||||
"order_season": 2026,
|
||||
"seq": 8,
|
||||
"version": "b26",
|
||||
"units": 2991630,
|
||||
"value_usd": 242263.23,
|
||||
"order_month": "08 - Jan"
|
||||
},
|
||||
{
|
||||
"iter": "copy",
|
||||
"order_season": 2026,
|
||||
"seq": 7,
|
||||
"version": "b26",
|
||||
"units": 688606,
|
||||
"value_usd": 73007.28,
|
||||
"order_month": "07 - Dec"
|
||||
},
|
||||
{
|
||||
"iter": "adj volume",
|
||||
"order_season": 2026,
|
||||
"seq": 10,
|
||||
"version": "b26",
|
||||
"units": -1404320,
|
||||
"value_usd": -189583.2,
|
||||
"order_month": "10 - Mar"
|
||||
},
|
||||
{
|
||||
"iter": "actuals",
|
||||
"order_season": 2025,
|
||||
"seq": 7,
|
||||
"version": "b26-act",
|
||||
"units": 688606,
|
||||
"value_usd": 73007.28,
|
||||
"order_month": "07 - Dec"
|
||||
},
|
||||
{
|
||||
"iter": "actuals",
|
||||
"order_season": 2025,
|
||||
"seq": 9,
|
||||
"version": "b26-act",
|
||||
"units": 4632500,
|
||||
"value_usd": 758715.6,
|
||||
"order_month": "09 - Feb"
|
||||
},
|
||||
{
|
||||
"iter": "actuals",
|
||||
"order_season": 2025,
|
||||
"seq": 3,
|
||||
"version": "b26-act",
|
||||
"units": 1175025,
|
||||
"value_usd": 119418.68,
|
||||
"order_month": "03 - Aug"
|
||||
},
|
||||
{
|
||||
"iter": "actuals_plug",
|
||||
"order_season": 2025,
|
||||
"seq": 11,
|
||||
"version": "b26-act",
|
||||
"units": 648480,
|
||||
"value_usd": 130133.7,
|
||||
"order_month": "11 - Apr"
|
||||
},
|
||||
{
|
||||
"iter": "copy",
|
||||
"order_season": 2026,
|
||||
"seq": 10,
|
||||
"version": "b26",
|
||||
"units": 3123826,
|
||||
"value_usd": 377146.42,
|
||||
"order_month": "10 - Mar"
|
||||
},
|
||||
{
|
||||
"iter": "actuals",
|
||||
"order_season": 2025,
|
||||
"seq": 6,
|
||||
"version": "b26-act",
|
||||
"units": 274270,
|
||||
"value_usd": 27458.35,
|
||||
"order_month": "06 - Nov"
|
||||
}
|
||||
],
|
||||
"totals": [
|
||||
{
|
||||
"iter": "adj volume",
|
||||
"order_season": 2026,
|
||||
"version": "b26",
|
||||
"units": -4061840,
|
||||
"value_usd": -569976.8
|
||||
},
|
||||
{
|
||||
"iter": "actuals",
|
||||
"order_season": 2025,
|
||||
"version": "b26-act",
|
||||
"units": 14918005,
|
||||
"value_usd": 1817592.53
|
||||
},
|
||||
{
|
||||
"iter": "copy",
|
||||
"order_season": 2026,
|
||||
"version": "b26",
|
||||
"units": 15786251,
|
||||
"value_usd": 1990355.3
|
||||
},
|
||||
{
|
||||
"iter": "actuals_plug",
|
||||
"order_season": 2025,
|
||||
"version": "b26-act",
|
||||
"units": 868246,
|
||||
"value_usd": 172762.77
|
||||
}
|
||||
],
|
||||
"tags": [
|
||||
"volume",
|
||||
"Share Lost",
|
||||
"Keystone Incr",
|
||||
"price",
|
||||
"Keystone Repl"
|
||||
]
|
||||
}
|
||||
}
|
||||
212
debug/test.sql
Normal file
212
debug/test.sql
Normal file
File diff suppressed because one or more lines are too long
3
fake_master/customers.pg.sql
Normal file
3
fake_master/customers.pg.sql
Normal file
@ -0,0 +1,3 @@
|
||||
SELECT * FROM (VALUES
|
||||
('TRGS0001','','TARGET STORES','TARGET STORES','US','1','USA','GA','ATLANTA','South','US','US East','Ryan Chitwood','39','RNAT','A','B','','','','50802 - TONY LANDINO','','','')
|
||||
) x(code,default_billto,descr,dba,currency,fxcurr,country,province,city,nursery_region,greenhouse_region,general_region,rep_region,remit_to,cclass,status,ctype,plevel,folder,lists,default_rep,retail_rep,inside_rep,keyaccount_rep)
|
||||
99
fake_master/items.pg.sql
Normal file
99
fake_master/items.pg.sql
Normal file
@ -0,0 +1,99 @@
|
||||
INSERT INTO "CMS.CUSLG".itemm
|
||||
SELECT
|
||||
ITEM
|
||||
,DESCR
|
||||
,DESCR2
|
||||
,DESCR3
|
||||
,GLEC
|
||||
,STLC
|
||||
,STLCD
|
||||
,P93
|
||||
,COLC
|
||||
,COLCD
|
||||
,COLGRP
|
||||
,COLTIER
|
||||
,COLTIERD
|
||||
,COLSTAT
|
||||
,SIZC
|
||||
,PACKAGE
|
||||
,KIT
|
||||
,BRANDING
|
||||
,SUFFIX
|
||||
,SUFFIXD
|
||||
,ACCS
|
||||
,ACCS_PS
|
||||
,ACC_LIST
|
||||
,CATA
|
||||
,CLSS
|
||||
,ASSC
|
||||
,SASC
|
||||
,BRAND
|
||||
,DPLT
|
||||
,HARM
|
||||
,UOMP
|
||||
,UNTI
|
||||
,NWHT
|
||||
,NWUN
|
||||
,TYPE
|
||||
,MAJG
|
||||
,MAJGD
|
||||
,MING
|
||||
,MINGD
|
||||
,MAJS
|
||||
,MAJSD
|
||||
,MINS
|
||||
,MINSD
|
||||
,GLCD
|
||||
,GLDCD
|
||||
,MINO
|
||||
,APLNT
|
||||
,IREAS
|
||||
,PARTGROUP
|
||||
,PARTGROUPD
|
||||
,PRICEGROUP
|
||||
,V1DS
|
||||
,MPCK::numeric
|
||||
,CURSTD::numeric
|
||||
,CURSTDUS::numeric
|
||||
,FUTSTD::numeric
|
||||
,FUTSTDUS::numeric
|
||||
,PRODGROUP
|
||||
FROM (VALUES
|
||||
('RET12000G18C004','12" Room Essentials Planter','','','1RE','ECA16000','ECA16000','G18','G18','BLACK','B','B','BASE','A','CKL','CASE','','','','','','','','','','','','','','','','',1.35460979312176,'LB','M','110','110 - INJECTION','C10','C10 - PACKED FOR R','111','111 - PLANTER','A01','A01 - ROUND POTS','52F','MIDDLEFIELD FINISHED GOODS','0','A','','RET12000','12" Room Essentials Planter','12" Planter','','0',3.34,3.34,3.34,3.34,'DECO'),
|
||||
('RET12000BH9C004','12" Room Essentials Planter','','','1RE','RET12000','','BH9','BH9','','C','M','PREMIUM','A','CXX','CASE','','','','','','','','','','','','','','','','',1.35460979312176,'LB','M','110','110 - INJECTION','C10','C10 - PACKED FOR R','111','111 - PLANTER','A01','A01 - ROUND POTS','52F','MIDDLEFIELD FINISHED GOODS','0','A','','RET12000','12" Room Essentials Planter','12" Planter','','0',4.37,4.37,4.37,4.37,'DECO'),
|
||||
('RET12000E79C004','12" Room Essentials Planter','','','1RE','RET12000','','E79','E79','','C','M','PREMIUM','A','CXX','CASE','','','','','','','','','','','','','','','','',1.35460979312176,'LB','M','110','110 - INJECTION','C10','C10 - PACKED FOR R','111','111 - PLANTER','A01','A01 - ROUND POTS','52F','MIDDLEFIELD FINISHED GOODS','0','A','','RET12000','12" Room Essentials Planter','12" Planter','','0',4.37,4.37,4.37,4.37,'DECO'),
|
||||
('RET12000A69C004','12" Room Essentials Planter','','','1RE','RET12000','','A69','A69','','C','M','PREMIUM','A','CXX','CASE','','','','','','','','','','','','','','','','',1.35460979312176,'LB','M','110','110 - INJECTION','C10','C10 - PACKED FOR R','111','111 - PLANTER','A01','A01 - ROUND POTS','52F','MIDDLEFIELD FINISHED GOODS','0','A','','RET12000','12" Room Essentials Planter','12" Planter','','0',4.37,4.37,4.37,4.37,'DECO'),
|
||||
('RET16000G18C004','16" Room Essentials Planter','','','1RE','RET16000','','G18','G18','','C','M','PREMIUM','A','CXX','CASE','','','','','','','','','','','','','','','','',2.14562285367087,'LB','M','110','110 - INJECTION','C10','C10 - PACKED FOR R','111','111 - PLANTER','A01','A01 - ROUND POTS','52F','MIDDLEFIELD FINISHED GOODS','0','A','','RET16000','16" Room Essentials Planter','16" Planter','','0',5.14,5.14,5.14,5.14,'DECO'),
|
||||
('RET16000BH9C004','16" Room Essentials Planter','','','1RE','RET16000','','BH9','BH9','','C','M','PREMIUM','A','CXX','CASE','','','','','','','','','','','','','','','','',2.14562285367087,'LB','M','110','110 - INJECTION','C10','C10 - PACKED FOR R','111','111 - PLANTER','A01','A01 - ROUND POTS','52F','MIDDLEFIELD FINISHED GOODS','0','A','','RET16000','16" Room Essentials Planter','16" Planter','','0',5.96,5.96,5.96,5.96,'DECO'),
|
||||
('RET16000E79C004','16" Room Essentials Planter','','','1RE','RET16000','','E79','E79','','C','M','PREMIUM','A','CXX','CASE','','','','','','','','','','','','','','','','',2.14562285367087,'LB','M','110','110 - INJECTION','C10','C10 - PACKED FOR R','111','111 - PLANTER','A01','A01 - ROUND POTS','52F','MIDDLEFIELD FINISHED GOODS','0','A','','RET16000','16" Room Essentials Planter','16" Planter','','0',5.96,5.96,5.96,5.96,'DECO'),
|
||||
('RET16000A69C004','16" Room Essentials Planter','','','1RE','RET16000','','A69','A69','','C','M','PREMIUM','A','CXX','CASE','','','','','','','','','','','','','','','','',2.14562285367087,'LB','M','110','110 - INJECTION','C10','C10 - PACKED FOR R','111','111 - PLANTER','A01','A01 - ROUND POTS','52F','MIDDLEFIELD FINISHED GOODS','0','A','','RET16000','16" Room Essentials Planter','16" Planter','','0',5.96,5.96,5.96,5.96,'DECO'),
|
||||
('RET21000G18C004','21" Room Essentials Planter','','','1RE','RET21000','','G18','G18','','B','B','BASE','A','CXX','CASE','','','','','','','','','','','','','','','','',3.64113178326671,'LB','M','110','110 - INJECTION','C10','C10 - PACKED FOR R','111','111 - PLANTER','A01','A01 - ROUND POTS','52F','MIDDLEFIELD FINISHED GOODS','0','A','','RET21000','21" Room Essentials Planter','21" Planter','','0',7.83,7.83,7.83,7.83,'DECO'),
|
||||
('RET21000BH9C004','21" Room Essentials Planter','','','1RE','RET21000','','BH9','BH9','','C','M','PREMIUM','A','CXX','CASE','','','','','','','','','','','','','','','','',3.64113178326671,'LB','M','110','110 - INJECTION','C10','C10 - PACKED FOR R','111','111 - PLANTER','A01','A01 - ROUND POTS','52F','MIDDLEFIELD FINISHED GOODS','0','A','','RET21000','21" Room Essentials Planter','21" Planter','','0',10.62,10.62,10.62,10.62,'DECO'),
|
||||
('RET21000E79C004','21" Room Essentials Planter','','','1RE','RET21000','','E79','E79','','C','M','PREMIUM','A','CXX','CASE','','','','','','','','','','','','','','','','',3.64113178326671,'LB','M','110','110 - INJECTION','C10','C10 - PACKED FOR R','111','111 - PLANTER','A01','A01 - ROUND POTS','52F','MIDDLEFIELD FINISHED GOODS','0','A','','RET21000','21" Room Essentials Planter','21" Planter','','0',10.62,10.62,10.62,10.62,'DECO'),
|
||||
('RET21000A69C004','21" Room Essentials Planter','','','1RE','RET21000','','A69','A69','','C','M','PREMIUM','A','CXX','CASE','','','','','','','','','','','','','','','','',3.64113178326671,'LB','M','110','110 - INJECTION','C10','C10 - PACKED FOR R','111','111 - PLANTER','A01','A01 - ROUND POTS','52F','MIDDLEFIELD FINISHED GOODS','0','A','','RET21000','21" Room Essentials Planter','21" Planter','','0',10.62,10.62,10.62,10.62,'DECO'),
|
||||
('RET04000G18C004','04" Room Essentials Planter','','','1RE','RET04000','','G18','G18','','C','M','PREMIUM','A','CXX','CASE','','','','','','','','','','','','','','','','',0.237303986104519,'LB','M','110','110 - INJECTION','C10','C10 - PACKED FOR R','111','111 - PLANTER','A01','A01 - ROUND POTS','52F','MIDDLEFIELD FINISHED GOODS','0','A','','RET04000','04" Room Essentials Planter','04" Planter','','0',1.39,1.39,1.39,1.39,'DECO'),
|
||||
('RET04000DF9C004','04" Room Essentials Planter','','','1RE','RET04000','','DF9','DF9','','C','M','PREMIUM','A','CXX','CASE','','','','','','','','','','','','','','','','',0.237303986104519,'LB','M','110','110 - INJECTION','C10','C10 - PACKED FOR R','111','111 - PLANTER','A01','A01 - ROUND POTS','52F','MIDDLEFIELD FINISHED GOODS','0','A','','RET04000','04" Room Essentials Planter','04" Planter','','0',1.57,1.57,1.57,1.57,'DECO'),
|
||||
('RET04000BH9C004','04" Room Essentials Planter','','','1RE','RET04000','','BH9','BH9','','C','M','PREMIUM','A','CXX','CASE','','','','','','','','','','','','','','','','',0.237303986104519,'LB','M','110','110 - INJECTION','C10','C10 - PACKED FOR R','111','111 - PLANTER','A01','A01 - ROUND POTS','52F','MIDDLEFIELD FINISHED GOODS','0','A','','RET04000','04" Room Essentials Planter','04" Planter','','0',1.57,1.57,1.57,1.57,'DECO'),
|
||||
('RET04000A69C004','04" Room Essentials Planter','','','1RE','RET04000','','A69','A69','','C','M','PREMIUM','A','CXX','CASE','','','','','','','','','','','','','','','','',0.237303986104519,'LB','M','110','110 - INJECTION','C10','C10 - PACKED FOR R','111','111 - PLANTER','A01','A01 - ROUND POTS','52F','MIDDLEFIELD FINISHED GOODS','0','A','','RET04000','04" Room Essentials Planter','04" Planter','','0',1.57,1.57,1.57,1.57,'DECO'),
|
||||
('RET04000E79C004','04" Room Essentials Planter','','','1RE','RET04000','','E79','E79','','C','M','PREMIUM','A','CXX','CASE','','','','','','','','','','','','','','','','',0.237303986104519,'LB','M','110','110 - INJECTION','C10','C10 - PACKED FOR R','111','111 - PLANTER','A01','A01 - ROUND POTS','52F','MIDDLEFIELD FINISHED GOODS','0','A','','RET04000','04" Room Essentials Planter','04" Planter','','0',1.57,1.57,1.57,1.57,'DECO'),
|
||||
('RET04000C39C004','04" Room Essentials Planter','','','1RE','RET04000','','C39','C39','','C','M','PREMIUM','A','CXX','CASE','','','','','','','','','','','','','','','','',0.237303986104519,'LB','M','110','110 - INJECTION','C10','C10 - PACKED FOR R','111','111 - PLANTER','A01','A01 - ROUND POTS','52F','MIDDLEFIELD FINISHED GOODS','0','A','','RET04000','04" Room Essentials Planter','04" Planter','','0',1.57,1.57,1.57,1.57,'DECO'),
|
||||
('RET08000G18C004','08" Room Essentials Planter','','','1RE','RET08000','','G18','G18','','C','M','PREMIUM','A','CXX','CASE','','','','','','','','','','','','','','','','',0.41,'LB','M','110','110 - INJECTION','C10','C10 - PACKED FOR R','111','111 - PLANTER','A01','A01 - ROUND POTS','52F','MIDDLEFIELD FINISHED GOODS','0','A','','RET08000','08" Room Essentials Planter','08" Planter','','0',1.57,1.57,1.57,1.57,'DECO'),
|
||||
('RET08000DF9C004','08" Room Essentials Planter','','','1RE','RET08000','','DF9','DF9','','C','M','PREMIUM','A','CXX','CASE','','','','','','','','','','','','','','','','',0.41,'LB','M','110','110 - INJECTION','C10','C10 - PACKED FOR R','111','111 - PLANTER','A01','A01 - ROUND POTS','52F','MIDDLEFIELD FINISHED GOODS','0','A','','RET08000','08" Room Essentials Planter','08" Planter','','0',2,2,2,2,'DECO'),
|
||||
('RET08000BH9C004','08" Room Essentials Planter','','','1RE','RET08000','','BH9','BH9','','C','M','PREMIUM','A','CXX','CASE','','','','','','','','','','','','','','','','',0.41,'LB','M','110','110 - INJECTION','C10','C10 - PACKED FOR R','111','111 - PLANTER','A01','A01 - ROUND POTS','52F','MIDDLEFIELD FINISHED GOODS','0','A','','RET08000','08" Room Essentials Planter','08" Planter','','0',2,2,2,2,'DECO'),
|
||||
('RET08000C39C004','08" Room Essentials Planter','','','1RE','RET08000','','C39','C39','','C','M','PREMIUM','A','CXX','CASE','','','','','','','','','','','','','','','','',0.41,'LB','M','110','110 - INJECTION','C10','C10 - PACKED FOR R','111','111 - PLANTER','A01','A01 - ROUND POTS','52F','MIDDLEFIELD FINISHED GOODS','0','A','','RET08000','08" Room Essentials Planter','08" Planter','','0',2,2,2,2,'DECO'),
|
||||
('RET08000E79C004','08" Room Essentials Planter','','','1RE','RET08000','','E79','E79','','C','M','PREMIUM','A','CXX','CASE','','','','','','','','','','','','','','','','',0.41,'LB','M','110','110 - INJECTION','C10','C10 - PACKED FOR R','111','111 - PLANTER','A01','A01 - ROUND POTS','52F','MIDDLEFIELD FINISHED GOODS','0','A','','RET08000','08" Room Essentials Planter','08" Planter','','0',2,2,2,2,'DECO'),
|
||||
('RET08000A69C004','08" Room Essentials Planter','','','1RE','RET08000','','A69','A69','','C','M','PREMIUM','A','CXX','CASE','','','','','','','','','','','','','','','','',0.41,'LB','M','110','110 - INJECTION','C10','C10 - PACKED FOR R','111','111 - PLANTER','A01','A01 - ROUND POTS','52F','MIDDLEFIELD FINISHED GOODS','0','A','','RET08000','08" Room Essentials Planter','08" Planter','','0',2,2,2,2,'DECO'),
|
||||
('REC10000000C0024','10" Threshold Saucer','','','1RE','REC10000','','000','000','','C','M','PREMIUM','A','CXX','CASE','','','','','','','','','','','','','','','','',0.24,'LB','M','110','110 - INJECTION','C10','C10 - PACKED FOR R','111','111 - PLANTER','A01','A01 - ROUND POTS','52F','MIDDLEFIELD FINISHED GOODS','0','A','','REC10000','10" Threshold Saucer','10" Planter','','0',0.48,0.48,0.48,0.48,'DECO'),
|
||||
('REC12000000C0024','12" Threshold Saucer','','','1RE','REC12000','','000','000','','C','M','PREMIUM','A','CXX','CASE','','','','','','','','','','','','','','','','',0.31,'LB','M','110','110 - INJECTION','C10','C10 - PACKED FOR R','111','111 - PLANTER','A01','A01 - ROUND POTS','52F','MIDDLEFIELD FINISHED GOODS','0','A','','REC12000','12" Threshold Saucer','12" Planter','','0',0.58,0.58,0.58,0.58,'DECO'),
|
||||
('REC06000000C0024','06" Threshold Saucer','','','1RE','REC06000','','000','000','','C','M','PREMIUM','A','CXX','CASE','','','','','','','','','','','','','','','','',0.1,'LB','M','110','110 - INJECTION','C10','C10 - PACKED FOR R','111','111 - PLANTER','A01','A01 - ROUND POTS','52F','MIDDLEFIELD FINISHED GOODS','0','A','','REC06000','06" Threshold Saucer','06" Planter','','0',0.3,0.3,0.3,0.3,'DECO'),
|
||||
('REC08000000C0024','08" Threshold Saucer','','','1RE','REC08000','','000','000','','C','M','PREMIUM','A','CXX','CASE','','','','','','','','','','','','','','','','',0.14,'LB','M','110','110 - INJECTION','C10','C10 - PACKED FOR R','111','111 - PLANTER','A01','A01 - ROUND POTS','52F','MIDDLEFIELD FINISHED GOODS','0','A','','REC08000','08" Threshold Saucer','08" Planter','','0',0.37,0.37,0.37,0.37,'DECO'),
|
||||
('REQ10000G18C004','10" Room Essentials SW Planter','','','1RE','REQ10000','','G18','G18','','B','B','BASE','A','CXX','CASE','','','','','','','','','','','','','','','','',1.114170194214,'LB','M','110','110 - INJECTION','C10','C10 - PACKED FOR R','111','111 - PLANTER','A01','A01 - ROUND POTS','52F','MIDDLEFIELD FINISHED GOODS','0','A','','REQ10000','10" Room Essentials SW Planter','10" Planter','','0',2.09,2.09,2.09,2.09,'DECO'),
|
||||
('RES12000G18C004','12" Room Essentials SW Planter','','','1RE','RES12000','','G18','G18','','B','B','BASE','A','CXX','CASE','','','','','','','','','','','','','','','','',0.955711933717807,'LB','M','110','110 - INJECTION','C10','C10 - PACKED FOR R','111','111 - PLANTER','A01','A01 - ROUND POTS','52F','MIDDLEFIELD FINISHED GOODS','0','A','','RES12000','12" Room Essentials SW Planter','12" Planter','','0',3.1,3.1,3.1,3.1,'DECO'),
|
||||
('RES16000G18C002','16" Room Essentials SW Planter','','','1RE','RES16000','','G18','G18','','B','B','BASE','A','CXX','CASE','','','','','','','','','','','','','','','','',2.26561420389623,'LB','M','110','110 - INJECTION','C10','C10 - PACKED FOR R','111','111 - PLANTER','A01','A01 - ROUND POTS','52F','MIDDLEFIELD FINISHED GOODS','0','A','','RES16000','16" Room Essentials SW Planter','16" Planter','','0',5.67,5.67,5.67,5.67,'DECO'),
|
||||
('REW16000G18C004','16" Room Essentials SW Window Box','','','1RE','REW16000','','G18','G18','','B','B','BASE','A','CXX','CASE','','','','','','','','','','','','','','','','',0.750639146304638,'LB','M','110','110 - INJECTION','C10','C10 - PACKED FOR R','111','111 - PLANTER','A01','A01 - ROUND POTS','52F','MIDDLEFIELD FINISHED GOODS','0','A','','REW16000','16" Room Essentials SW Window Box','16" Planter','','0',2.54,2.54,2.54,2.54,'DECO'),
|
||||
('RES20000G18C004','20" Room Essentials SW Planter','','','1RE','RES20000','','G18','G18','','B','B','BASE','A','CXX','CASE','','','','','','','','','','','','','','','','',5.959803675,'LB','M','110','110 - INJECTION','C10','C10 - PACKED FOR R','111','111 - PLANTER','A01','A01 - ROUND POTS','52F','MIDDLEFIELD FINISHED GOODS','0','A','','RES20000','20" Room Essentials SW Planter','20" Planter','','0',9.19,9.19,9.19,9.19,'DECO'),
|
||||
('RES24000G18C004','24" Room Essentials SW Window Box','','','1RE','RES24000','','G18','G18','','B','B','BASE','A','CXX','CASE','','','','','','','','','','','','','','','','',2.25326467485317,'LB','M','110','110 - INJECTION','C10','C10 - PACKED FOR R','111','111 - PLANTER','A01','A01 - ROUND POTS','52F','MIDDLEFIELD FINISHED GOODS','0','A','','RES24000','24" Room Essentials SW Window Box','24" Planter','','0',5.1,5.1,5.1,5.1,'DECO'),
|
||||
('REU08000G18C004','Room Essentials 2 Pack','','','1RE','REU08000','','G18','G18','','B','B','BASE','A','CXX','CASE','','','','','','','','','','','','','','','','',1.30128563157895,'LB','M','110','110 - INJECTION','C10','C10 - PACKED FOR R','111','111 - PLANTER','A01','A01 - ROUND POTS','52F','MIDDLEFIELD FINISHED GOODS','0','A','','REU08000','Room Essentials 2 Pack','Planter Assortment','','0',2.93,2.93,2.93,2.93,'DECO'),
|
||||
('REQ06000G18C004','06" Room Essentials SW Planter','','','1RE','REQ06000','','G18','G18','','B','B','BASE','A','CXX','CASE','','','','','','','','','','','','','','','','',0.333667425107019,'LB','M','110','110 - INJECTION','C10','C10 - PACKED FOR R','111','111 - PLANTER','A01','A01 - ROUND POTS','52F','MIDDLEFIELD FINISHED GOODS','0','A','','REQ06000','06" Room Essentials SW Planter','06" Planter','','0',1.46,1.46,1.46,1.46,'DECO'),
|
||||
('RES08000G18C004','08" Room Essentials SW Planter','','','1RE','RES08000','','G18','G18','','B','B','BASE','A','CXX','CASE','','','','','','','','','','','','','','','','',0.414951121992128,'LB','M','110','110 - INJECTION','C10','C10 - PACKED FOR R','111','111 - PLANTER','A01','A01 - ROUND POTS','52F','MIDDLEFIELD FINISHED GOODS','0','A','','RES08000','08" Room Essentials SW Planter','08" Planter','','0',1.49,1.49,1.49,1.49,'DECO')
|
||||
) x(ITEM,DESCR,DESCR2,DESCR3,GLEC,STLC,STLCD,P93,COLC,COLCD,COLGRP,COLTIER,COLTIERD,COLSTAT,SIZC,PACKAGE,KIT,BRANDING,SUFFIX,SUFFIXD,ACCS,ACCS_PS,ACC_LIST,CATA,CLSS,ASSC,SASC,BRAND,DPLT,HARM,UOMP,UNTI,NWHT,NWUN,TYPE,MAJG,MAJGD,MING,MINGD,MAJS,MAJSD,MINS,MINSD,GLCD,GLDCD,MINO,APLNT,IREAS,PARTGROUP,PARTGROUPD,PRICEGROUP,V1DS,MPCK,CURSTD,CURSTDUS,FUTSTD,FUTSTDUS,PRODGROUP)
|
||||
743
index.js
743
index.js
@ -1,5 +1,7 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
const minSupportedVersion = '1.10.1';
|
||||
|
||||
require('dotenv').config();
|
||||
const express = require('express');
|
||||
var https = require('https');
|
||||
@ -7,10 +9,7 @@ var bodyParser = require('body-parser');
|
||||
const server = express();
|
||||
const pg = require('pg');
|
||||
|
||||
//---------read sql files into variables----------------
|
||||
var fs = require('fs');
|
||||
var readline = require('readline');
|
||||
//-------------------------------------------------------
|
||||
|
||||
var options = {
|
||||
key: fs.readFileSync(process.env.wd + 'key.pem'),
|
||||
@ -19,9 +18,8 @@ var options = {
|
||||
};
|
||||
|
||||
https.createServer(options, server).listen(process.env.nodeport, () => {
|
||||
console.log('started on ' + process.env.nodeport)
|
||||
console.log(`${timestamp()} Web service started on port ${process.env.nodeport}`)
|
||||
});
|
||||
//server.listen(3000, () => console.log('started'))
|
||||
|
||||
var Postgres = new pg.Client({
|
||||
user: process.env.user,
|
||||
@ -34,669 +32,376 @@ var Postgres = new pg.Client({
|
||||
});
|
||||
Postgres.connect();
|
||||
|
||||
Postgres.FirstRow = function(inSQL, args, inResponse) {
|
||||
Postgres.query(inSQL, args, (err, res) => {
|
||||
Postgres.FirstRow = function(sql, response) {
|
||||
console.log(`${timestamp()} Running query:\n${sql}`);
|
||||
Postgres.query(sql, [], (err, res) => {
|
||||
if (err === null) {
|
||||
inResponse.json(res.rows[0]);
|
||||
console.log(`${timestamp()} Reponse: ${JSON.stringify(res.rows[0]).slice(0,5000)}${JSON.stringify(res.rows[0]).length<5000?'':'… (truncated)'}`);
|
||||
response.json(res.rows[0]);
|
||||
return;
|
||||
}
|
||||
console.log(err.stack);
|
||||
inResponse.json(err.stack);
|
||||
console.log(`${timestamp()} ${error()}${JSON.stringify(err.stack)}`);
|
||||
response.json(err.stack);
|
||||
});
|
||||
};
|
||||
|
||||
server.get('/', (req, res) => res.send('node.js express is up and running'))
|
||||
function timestamp() {
|
||||
return `\x1b[33m${new Date().toLocaleString()}:\x1b[0m`
|
||||
}
|
||||
|
||||
server.get('/login', (req, res) => res.sendFile(process.env.wd + 'msauth.html'))
|
||||
function error() {
|
||||
return `\x1b[91mERROR\x1b[0m|`
|
||||
}
|
||||
|
||||
server.get('/logs', (req, res) => res.sendFile(process.env.wd + 'changes.log'))
|
||||
function supported_version(v) {
|
||||
if (v === undefined) return false;
|
||||
|
||||
server.get('/pgbadger', (req, res) => res.sendFile(process.env.wd + 'logs.html'))
|
||||
const formatVersion = function(v) {
|
||||
return v.split('.').map((x) => ('00000'+x).slice(-5)).join('.');
|
||||
}
|
||||
return formatVersion(v) >= formatVersion(minSupportedVersion);
|
||||
}
|
||||
|
||||
server.get('/totals', (req, res) => res.sendFile(process.env.wd + 'totals.log'))
|
||||
function process_route(route, description, path, req, res, callback) {
|
||||
console.log(`\x1b[96m${"▼".repeat(120)}\x1b[0m`)
|
||||
console.log(`${timestamp()} ${route} (${description})`)
|
||||
if (!path) {
|
||||
callback(undefined);
|
||||
return;
|
||||
}
|
||||
|
||||
server.get('/test_sql', function(req, res) {
|
||||
var path = './route_meta/scenario_package.sql'
|
||||
var callback = function(arg) {
|
||||
res.send(arg)
|
||||
};
|
||||
if (!supported_version(req.body.version)) {
|
||||
if (req.body.username) {
|
||||
console.log(`${timestamp()} ${error()}${req.body.username} is using a too-old version of the client - ${req.body.version}`);
|
||||
} else {
|
||||
console.log(`${timestamp()} ${error()}'Anonymous user is using a too-old version of the client - ${req.body.version}`);
|
||||
}
|
||||
res.send(`Obsolete client workbook, version ${req.body.version}`);
|
||||
return;
|
||||
}
|
||||
|
||||
console.log(`${timestamp()} SQL file: ${path}`)
|
||||
fs.readFile(path, 'utf8', function(err, data) {
|
||||
if (!err) {
|
||||
callback(data);
|
||||
} else {
|
||||
callback(err);
|
||||
console.log(`${timestamp()} ${error()}Could not read sql file: ${JSON.stringify(err)}`);
|
||||
res.send('Failed to read needed SQL file.');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function build_where(req, res) {
|
||||
console.log(`${timestamp()} Building WHERE from ${JSON.stringify(req.body)}`);
|
||||
var where = '';
|
||||
for (var column in req.body.scenario) {
|
||||
if (where) {
|
||||
where = `${where}\n AND `;
|
||||
}
|
||||
if (Array.isArray(req.body.scenario[column])) {
|
||||
where = `${where} ${column} IN ('${req.body.scenario[column].join("','")}')`;
|
||||
} else {
|
||||
where = `${where} ${column} = '${req.body.scenario[column]}'`;
|
||||
}
|
||||
};
|
||||
//if the request has a stamp, then it's an adjustment
|
||||
//prevent making adjustment to actual history by limiting to current stamp and beyond
|
||||
if (req.body.stamp) {
|
||||
where = `${where}\n AND order_date >= least('${req.body.stamp}'::date,'2021-06-01')`;
|
||||
}
|
||||
console.log(`${timestamp()} Returning ${where}`);
|
||||
|
||||
if (where == '') {
|
||||
console.log(`${timestamp()} ${error()}Unable to create a WHERE clause.`);
|
||||
|
||||
res.send('No body was sent.');
|
||||
}
|
||||
return where;
|
||||
}
|
||||
|
||||
server.get('/', function(req, res) {
|
||||
process_route('GET /', 'Test if server is up.', undefined, req, res,
|
||||
function(_) {
|
||||
res.send('node.js express is up and running');
|
||||
});
|
||||
})
|
||||
|
||||
server.get('/template', function(_, res) {
|
||||
console.log('Downloading a template for someone.');
|
||||
const file = `${__dirname}/Master Template.xlsm`;
|
||||
res.download(file);
|
||||
})
|
||||
|
||||
server.get('/login', (_, res) => res.sendFile(process.env.wd + 'msauth.html'))
|
||||
|
||||
server.get('/logs', (_, res) => res.sendFile(process.env.wd + 'changes.log'))
|
||||
|
||||
server.get('/pgbadger', (_, res) => res.sendFile(process.env.wd + 'logs.html'))
|
||||
|
||||
server.get('/totals', (_, res) => res.sendFile(process.env.wd + 'totals.log'))
|
||||
|
||||
server.get('/get_pool', bodyParser.json(), function(req, res) {
|
||||
|
||||
var sql = "";
|
||||
var args = [req.body.quota_rep];
|
||||
var path = './route_sql/get_pool.sql';
|
||||
var callback = function(arg) {
|
||||
sql = arg;
|
||||
console.log(new Date().toISOString() + " GET (pool) file: " + path + "-._.".repeat(20));
|
||||
console.log(req.body.quota_rep);
|
||||
sql = sql.replace("rep_replace", req.body.quota_rep);
|
||||
console.log(sql);
|
||||
Postgres.FirstRow(sql, [], res)
|
||||
};
|
||||
|
||||
fs.readFile(path, 'utf8', function(err, data) {
|
||||
if (!err) {
|
||||
callback(data);
|
||||
} else {
|
||||
console.log("fatal error pulling sql file")
|
||||
callback(err);
|
||||
process_route('GET /get_pool', 'Get all data for one DSM.', './route_sql/get_pool.sql', req, res,
|
||||
function(sql) {
|
||||
if (req.body.quota_rep) {
|
||||
// ensure backward compatibility
|
||||
console.log(`${timestamp()} Converting old format… ${JSON.stringify(req.body)}`);
|
||||
req.body = {'scenario':{'quota_rep_descr':req.body.quota_rep}};
|
||||
}
|
||||
});
|
||||
|
||||
var where = build_where(req, res);
|
||||
if (!where) return;
|
||||
|
||||
sql = sql.replace(new RegExp("where_clause", 'g'), where);
|
||||
Postgres.FirstRow(sql, res)
|
||||
});
|
||||
})
|
||||
|
||||
server.get('/scenario_package', bodyParser.json(), function(req, res) {
|
||||
process_route('GET /scenario_package', 'Get all data for a given scenario.', './route_sql/scenario_package.sql', req, res,
|
||||
function(sql) {
|
||||
var where = build_where(req, res);
|
||||
if (!where) return;
|
||||
|
||||
var sql = "";
|
||||
var w = "";
|
||||
var c = 1;
|
||||
var d = 1;
|
||||
var args = [];
|
||||
var path = './route_sql/scenario_package.sql';
|
||||
|
||||
fs.readFile(path, 'utf8', function(err, data) {
|
||||
if (!err) {
|
||||
callback(data);
|
||||
} else {
|
||||
console.log("fatal error pulling sql file")
|
||||
callback(err);
|
||||
}
|
||||
sql = sql.replace(new RegExp("where_clause", 'g'), where)
|
||||
Postgres.FirstRow(sql, res)
|
||||
});
|
||||
|
||||
var callback = function(arg) {
|
||||
sql = arg;
|
||||
|
||||
//parse request body into a where clause
|
||||
({ c, w, d } = build_where(req, c, w, d, args));
|
||||
|
||||
//if there was no body sent, return with nothing
|
||||
if (c == 1) {
|
||||
res.send("no body was sent");
|
||||
return;
|
||||
}
|
||||
console.log(new Date().toISOString() + " GET (scenario package) file: " + path + "-._.".repeat(20))
|
||||
console.log(req.body);
|
||||
//parse the where clause into the main sql statement
|
||||
sql = sql.replace(new RegExp("where_clause", 'g'), w)
|
||||
//execute the sql and send the result
|
||||
console.log(sql);
|
||||
Postgres.FirstRow(sql, [], res)
|
||||
};
|
||||
})
|
||||
|
||||
server.get('/swap_fit', bodyParser.json(), function(req, res) {
|
||||
process_route('GET /swap_fit', 'Obsolete.', './route_sql/swap_fit.sql', req, res,
|
||||
function(sql) {
|
||||
var where = build_where(req, res);
|
||||
if (!where) return;
|
||||
|
||||
var sql = "";
|
||||
var w = "";
|
||||
var c = 1;
|
||||
var d = 1;
|
||||
var args = [];
|
||||
var path = './route_sql/swap_fit.sql';
|
||||
|
||||
fs.readFile(path, 'utf8', function(err, data) {
|
||||
if (!err) {
|
||||
callback(data);
|
||||
} else {
|
||||
console.log("fatal error pulling sql file")
|
||||
callback(err);
|
||||
}
|
||||
});
|
||||
|
||||
var callback = function(arg) {
|
||||
sql = arg;
|
||||
|
||||
//parse request body into a where clause
|
||||
({ c, w, d } = build_where(req, c, w, d, args));
|
||||
|
||||
//if there was no body sent, return with nothing
|
||||
if (c == 1) {
|
||||
res.send("no body was sent");
|
||||
return;
|
||||
}
|
||||
console.log(new Date().toISOString() + "get swap fit: " + path + "-._.".repeat(20))
|
||||
console.log(req.body);
|
||||
//parse the where clause into the main sql statement
|
||||
sql = sql.replace(new RegExp("where_clause", 'g'), w);
|
||||
sql = sql.replace(new RegExp("where_clause", 'g'), where);
|
||||
sql = sql.replace(new RegExp("replace_new_mold", 'g'), req.body.new_mold);
|
||||
//execute the sql and send the result
|
||||
console.log(sql);
|
||||
Postgres.FirstRow(sql, [], res)
|
||||
};
|
||||
Postgres.FirstRow(sql, res)
|
||||
});
|
||||
})
|
||||
|
||||
server.post('/swap', bodyParser.json(), function(req, res) {
|
||||
process_route('POST /swap', 'Obsolete.', './route_sql/swap_post.sql', req, res,
|
||||
function(sql) {
|
||||
var where = build_where(req, res);
|
||||
if (!where) return;
|
||||
|
||||
var sql = "";
|
||||
var w = "";
|
||||
var c = 1;
|
||||
var d = 1;
|
||||
var args = [];
|
||||
var path = './route_sql/swap_post.sql';
|
||||
|
||||
fs.readFile(path, 'utf8', function(err, data) {
|
||||
if (!err) {
|
||||
callback(data);
|
||||
} else {
|
||||
console.log("fatal error pulling sql file")
|
||||
callback(err);
|
||||
}
|
||||
});
|
||||
|
||||
var callback = function(arg) {
|
||||
sql = arg;
|
||||
|
||||
//parse request body into a where clause
|
||||
({ c, w, d } = build_where(req, c, w, d, args));
|
||||
|
||||
//if there was no body sent, return with nothing
|
||||
if (c == 1) {
|
||||
res.send("no body was sent");
|
||||
return;
|
||||
}
|
||||
console.log(new Date().toISOString() + "post swap: " + path + "-._.".repeat(20))
|
||||
console.log(req.body);
|
||||
//parse the where clause into the main sql statement
|
||||
sql = sql.replace(new RegExp("where_clause", 'g'), w);
|
||||
sql = sql.replace(new RegExp("where_clause", 'g'), where);
|
||||
sql = sql.replace(new RegExp("swap_doc", 'g'), JSON.stringify(req.body.swap));
|
||||
sql = sql.replace(new RegExp("replace_version", 'g'), req.body.scenario.version);
|
||||
sql = sql.replace(new RegExp("replace_source", 'g'), req.body.source);
|
||||
sql = sql.replace(new RegExp("replace_iterdef", 'g'), JSON.stringify(req.body));
|
||||
//execute the sql and send the result
|
||||
console.log(sql);
|
||||
Postgres.FirstRow(sql, [], res)
|
||||
};
|
||||
Postgres.FirstRow(sql, res)
|
||||
});
|
||||
})
|
||||
|
||||
server.post('/cust_swap', bodyParser.json(), function(req, res) {
|
||||
process_route('POST /cust_swap', 'Obsolete.', './route_sql/swap_cust.sql', req, res,
|
||||
function(sql) {
|
||||
var where = build_where(req, res);
|
||||
if (!where) return;
|
||||
|
||||
var sql = "";
|
||||
var w = "";
|
||||
var c = 1;
|
||||
var d = 1;
|
||||
var args = [];
|
||||
var path = './route_sql/swap_cust.sql';
|
||||
|
||||
fs.readFile(path, 'utf8', function(err, data) {
|
||||
if (!err) {
|
||||
callback(data);
|
||||
} else {
|
||||
console.log("fatal error pulling sql file")
|
||||
callback(err);
|
||||
}
|
||||
});
|
||||
|
||||
var callback = function(arg) {
|
||||
sql = arg;
|
||||
|
||||
//parse request body into a where clause
|
||||
({ c, w, d } = build_where(req, c, w, d, args));
|
||||
|
||||
//if there was no body sent, return with nothing
|
||||
if (c == 1) {
|
||||
res.send("no body was sent");
|
||||
return;
|
||||
}
|
||||
console.log(new Date().toISOString() + " POST (cust swap) file: " + path + "-._.".repeat(20))
|
||||
console.log(req.body);
|
||||
//parse the where clause into the main sql statement
|
||||
sql = sql.replace(new RegExp("where_clause", 'g'), w);
|
||||
sql = sql.replace(new RegExp("where_clause", 'g'), where);
|
||||
sql = sql.replace(new RegExp("swap_doc", 'g'), JSON.stringify(req.body.swap));
|
||||
sql = sql.replace(new RegExp("replace_version", 'g'), req.body.scenario.version);
|
||||
sql = sql.replace(new RegExp("replace_source", 'g'), req.body.source);
|
||||
sql = sql.replace(new RegExp("replace_iterdef", 'g'), JSON.stringify(req.body));
|
||||
//execute the sql and send the result
|
||||
console.log(sql);
|
||||
//res.json(null);
|
||||
Postgres.FirstRow(sql, [], res)
|
||||
};
|
||||
Postgres.FirstRow(sql, res)
|
||||
});
|
||||
})
|
||||
|
||||
server.get('/list_changes', bodyParser.json(), function(req, res) {
|
||||
|
||||
var sql = "";
|
||||
var w = "";
|
||||
var c = 1;
|
||||
var d = 1;
|
||||
var args = [];
|
||||
var path = './route_sql/list_changes.sql';
|
||||
|
||||
fs.readFile(path, 'utf8', function(err, data) {
|
||||
if (!err) {
|
||||
callback(data);
|
||||
} else {
|
||||
console.log("fatal error pulling sql file")
|
||||
callback(err);
|
||||
}
|
||||
process_route('GET /list_changes', 'Get a list of adjustments made to DSM\'s pool.', './route_sql/list_changes.sql', req, res,
|
||||
function(sql) {
|
||||
var where = build_where(req, res);
|
||||
if (!where) return;
|
||||
sql = sql.replace(new RegExp("where_clause", 'g'), where);
|
||||
Postgres.FirstRow(sql, res)
|
||||
});
|
||||
|
||||
var callback = function(arg) {
|
||||
sql = arg;
|
||||
|
||||
console.log(new Date().toISOString() + "GET (list changes) file: " + path + "-._.".repeat(20))
|
||||
console.log(req.body);
|
||||
//parse the where clause into the main sql statement
|
||||
sql = sql.replace(new RegExp("replace_user", 'g'), req.body.scenario.quota_rep_descr)
|
||||
//execute the sql and send the result
|
||||
console.log(sql);
|
||||
Postgres.FirstRow(sql, [], res)
|
||||
};
|
||||
})
|
||||
|
||||
server.get('/undo_change', bodyParser.json(), function(req, res) {
|
||||
|
||||
var sql = "";
|
||||
var w = "";
|
||||
var c = 1;
|
||||
var d = 1;
|
||||
var args = [];
|
||||
var path = './route_sql/undo.sql';
|
||||
|
||||
fs.readFile(path, 'utf8', function(err, data) {
|
||||
if (!err) {
|
||||
callback(data);
|
||||
} else {
|
||||
console.log("fatal error pulling sql file")
|
||||
callback(err);
|
||||
}
|
||||
});
|
||||
|
||||
var callback = function(arg) {
|
||||
sql = arg;
|
||||
|
||||
console.log(new Date().toISOString() + " GET (undo change) file: " + path + "-._.".repeat(20))
|
||||
console.log(req.body);
|
||||
//parse the where clause into the main sql statement
|
||||
process_route('GET /undo_change', 'Remove an adjustment from the DSM\'s pool.', './route_sql/undo.sql', req, res,
|
||||
function(sql) {
|
||||
sql = sql.replace(new RegExp("replace_id", 'g'), JSON.stringify(req.body.logid))
|
||||
//execute the sql and send the result
|
||||
console.log(sql);
|
||||
Postgres.FirstRow(sql, [], res)
|
||||
};
|
||||
Postgres.FirstRow(sql, res)
|
||||
});
|
||||
})
|
||||
|
||||
//deprecating this route, just use _vp for volume and prive
|
||||
/*
|
||||
server.post('/addmonth_v', bodyParser.json(), function(req, res) {
|
||||
process_route('POST /add_month_v', 'Obsolete.', './route_sql/addmonth_vd.sql', req, res,
|
||||
function(sql) {
|
||||
var where = build_where(req, res);
|
||||
if (!where) return;
|
||||
|
||||
var sql = "";
|
||||
var w = "";
|
||||
var c = 1; //counts iterations through each scaenario key
|
||||
var d = 1; //counts cycles in scenario key values which are arrays
|
||||
var args = [];
|
||||
var path = './route_sql/addmonth_vd.sql';
|
||||
|
||||
fs.readFile(path, 'utf8', function(err, data) {
|
||||
if (!err) {
|
||||
callback(data);
|
||||
} else {
|
||||
console.log("fatal error pulling sql file")
|
||||
callback(err);
|
||||
}
|
||||
});
|
||||
|
||||
var callback = function(arg) {
|
||||
sql = arg;
|
||||
//buile where clause expression
|
||||
({ c, w, d } = build_where(req, c, w, d, args));
|
||||
|
||||
if (c == 1) {
|
||||
res.send("no body was sent");
|
||||
return;
|
||||
}
|
||||
console.log(new Date().toISOString() + " POST (add month volume) file: " + path + "-._.".repeat(20));
|
||||
req.body.stamp = new Date().toISOString()
|
||||
console.log(req.body);
|
||||
//console.log(args);
|
||||
sql = sql.replace(new RegExp("scenario = target_scenario", 'g'), w);
|
||||
sql = sql.replace(new RegExp("scenario = target_scenario", 'g'), where);
|
||||
sql = sql.replace(new RegExp("target_increment", 'g'), req.body.qty);
|
||||
sql = sql.replace(new RegExp("target_month", 'g'), req.body.month);
|
||||
sql = sql.replace(new RegExp("replace_version", 'g'), req.body.scenario.version);
|
||||
sql = sql.replace(new RegExp("replace_source", 'g'), req.body.source);
|
||||
sql = sql.replace(new RegExp("replace_iterdef", 'g'), JSON.stringify(req.body));
|
||||
console.log(sql)
|
||||
Postgres.FirstRow(sql, [], res)
|
||||
}
|
||||
Postgres.FirstRow(sql, res)
|
||||
});
|
||||
})
|
||||
*/
|
||||
|
||||
server.post('/addmonth_vp', bodyParser.json(), function(req, res) {
|
||||
process_route('POST /add_month_vp', 'Add volume and pricing for a new month in the forecast.', './route_sql/addmonth_vupd.sql', req, res,
|
||||
function(sql) {
|
||||
var where = build_where(req, res);
|
||||
if (!where) return;
|
||||
|
||||
var sql = "";
|
||||
var w = "";
|
||||
var c = 1;
|
||||
var d = 1;
|
||||
var args = [];
|
||||
var path = './route_sql/addmonth_vupd.sql';
|
||||
|
||||
var callback = function(arg) {
|
||||
sql = arg;
|
||||
|
||||
({ c, w, d } = build_where(req, c, w, d, args));
|
||||
|
||||
if (c == 1) {
|
||||
res.send("no body was sent");
|
||||
return;
|
||||
}
|
||||
console.log(new Date().toISOString() + " POST (add month volume and price) file: " + path + "-._.".repeat(20));
|
||||
req.body.stamp = new Date().toISOString()
|
||||
console.log(req.body);
|
||||
//console.log(args);
|
||||
sql = sql.replace(new RegExp("where_clause", 'g'), w);
|
||||
sql = sql.replace(new RegExp("where_clause", 'g'), where);
|
||||
sql = sql.replace(new RegExp("target_volume", 'g'), req.body.qty);
|
||||
sql = sql.replace(new RegExp("target_price", 'g'), req.body.amount);
|
||||
sql = sql.replace(new RegExp("target_month", 'g'), req.body.month);
|
||||
sql = sql.replace(new RegExp("replace_version", 'g'), req.body.scenario.version);
|
||||
sql = sql.replace(new RegExp("replace_source", 'g'), req.body.source);
|
||||
sql = sql.replace(new RegExp("replace_iterdef", 'g'), JSON.stringify(req.body));
|
||||
console.log(sql);
|
||||
Postgres.FirstRow(sql, [], res)
|
||||
}
|
||||
|
||||
fs.readFile(path, 'utf8', function(err, data) {
|
||||
if (!err) {
|
||||
callback(data);
|
||||
} else {
|
||||
console.log("fatal error pulling sql file")
|
||||
callback(err);
|
||||
}
|
||||
Postgres.FirstRow(sql, res)
|
||||
});
|
||||
})
|
||||
|
||||
server.post('/scale_v', bodyParser.json(), function(req, res) {
|
||||
process_route('POST /scale_v', 'Scale the volume for the given scenario.', './route_sql/scale_vd.sql', req, res,
|
||||
function(sql) {
|
||||
var where = build_where(req, res);
|
||||
if (!where) return;
|
||||
|
||||
var sql = "";
|
||||
var w = "";
|
||||
var c = 1;
|
||||
var d = 1;
|
||||
var args = [];
|
||||
var path = './route_sql/scale_vd.sql';
|
||||
|
||||
var callback = function(arg) {
|
||||
sql = arg;
|
||||
|
||||
({ c, w, d } = build_where(req, c, w, d, args));
|
||||
|
||||
if (c == 1) {
|
||||
res.send("no body was sent");
|
||||
return;
|
||||
}
|
||||
console.log(new Date().toISOString() + " POST (scale volume) file: " + path + "-._.".repeat(20));
|
||||
req.body.stamp = new Date().toISOString()
|
||||
console.log(req.body);
|
||||
//console.log(args);
|
||||
sql = sql.replace(new RegExp("where_clause", 'g'), w);
|
||||
sql = sql.replace(new RegExp("where_clause", 'g'), where);
|
||||
sql = sql.replace(new RegExp("incr_qty", 'g'), req.body.qty);
|
||||
sql = sql.replace(new RegExp("replace_version", 'g'), req.body.scenario.version);
|
||||
sql = sql.replace(new RegExp("replace_source", 'g'), req.body.source);
|
||||
sql = sql.replace(new RegExp("replace_iterdef", 'g'), JSON.stringify(req.body));
|
||||
console.log(sql);
|
||||
Postgres.FirstRow(sql, [], res)
|
||||
}
|
||||
|
||||
fs.readFile(path, 'utf8', function(err, data) {
|
||||
if (!err) {
|
||||
callback(data);
|
||||
} else {
|
||||
console.log("fatal error pulling sql file")
|
||||
callback(err);
|
||||
}
|
||||
Postgres.FirstRow(sql, res)
|
||||
});
|
||||
})
|
||||
|
||||
server.post('/scale_p', bodyParser.json(), function(req, res) {
|
||||
process_route('POST /scale_p', 'Scale price for the given scenario.', './route_sql/scale_pd.sql', req, res,
|
||||
function(sql) {
|
||||
var where = build_where(req, res);
|
||||
if (!where) return;
|
||||
|
||||
var sql = "";
|
||||
var w = "";
|
||||
var c = 1;
|
||||
var d = 1;
|
||||
var args = [];
|
||||
var path = './route_sql/scale_pd.sql';
|
||||
|
||||
var callback = function(arg) {
|
||||
sql = arg;
|
||||
|
||||
({ c, w, d } = build_where(req, c, w, d, args));
|
||||
|
||||
if (c == 1) {
|
||||
res.send("no body was sent");
|
||||
return;
|
||||
}
|
||||
console.log(new Date().toISOString() + " POST (scale price) file: " + path + "-._.".repeat(20));
|
||||
req.body.stamp = new Date().toISOString()
|
||||
console.log(req.body);
|
||||
//console.log(args);
|
||||
sql = sql.replace(new RegExp("where_clause", 'g'), w);
|
||||
sql = sql.replace(new RegExp("where_clause", 'g'), where);
|
||||
sql = sql.replace(new RegExp("target_increment", 'g'), req.body.amount);
|
||||
sql = sql.replace(new RegExp("replace_version", 'g'), req.body.scenario.version);
|
||||
sql = sql.replace(new RegExp("replace_source", 'g'), req.body.source);
|
||||
sql = sql.replace(new RegExp("replace_iterdef", 'g'), JSON.stringify(req.body));
|
||||
console.log(sql);
|
||||
Postgres.FirstRow(sql, [], res)
|
||||
}
|
||||
|
||||
fs.readFile(path, 'utf8', function(err, data) {
|
||||
if (!err) {
|
||||
callback(data);
|
||||
} else {
|
||||
console.log("fatal error pulling sql file")
|
||||
callback(err);
|
||||
}
|
||||
Postgres.FirstRow(sql, res)
|
||||
});
|
||||
})
|
||||
|
||||
server.post('/scale_vp', bodyParser.json(), function(req, res) {
|
||||
process_route('POST /scale_vp', 'Scale volume and price for the given scenario.', './route_sql/scale_vupd.sql', req, res,
|
||||
function(sql) {
|
||||
var where = build_where(req, res);
|
||||
if (!where) return;
|
||||
|
||||
var sql = "";
|
||||
var w = "";
|
||||
var c = 1;
|
||||
var d = 1;
|
||||
var args = [];
|
||||
var path = './route_sql/scale_vupd.sql';
|
||||
|
||||
var callback = function(arg) {
|
||||
sql = arg;
|
||||
|
||||
({ c, w, d } = build_where(req, c, w, d, args));
|
||||
|
||||
if (c == 1) {
|
||||
res.send("no body was sent");
|
||||
return;
|
||||
}
|
||||
console.log(new Date().toISOString() + " POST (scale volume & price) file: " + path + "-._.".repeat(20));
|
||||
req.body.stamp = new Date().toISOString()
|
||||
console.log(req.body);
|
||||
//console.log(args);
|
||||
sql = sql.replace(new RegExp("where_clause", 'g'), w);
|
||||
sql = sql.replace(new RegExp("where_clause", 'g'), where);
|
||||
sql = sql.replace(new RegExp("target_vol", 'g'), req.body.qty);
|
||||
sql = sql.replace(new RegExp("target_prc", 'g'), req.body.amount);
|
||||
sql = sql.replace(new RegExp("replace_version", 'g'), req.body.scenario.version);
|
||||
sql = sql.replace(new RegExp("replace_source", 'g'), req.body.source);
|
||||
sql = sql.replace(new RegExp("replace_iterdef", 'g'), JSON.stringify(req.body));
|
||||
console.log(sql);
|
||||
Postgres.FirstRow(sql, [], res)
|
||||
}
|
||||
|
||||
fs.readFile(path, 'utf8', function(err, data) {
|
||||
if (!err) {
|
||||
callback(data);
|
||||
} else {
|
||||
console.log("fatal error pulling sql file")
|
||||
callback(err);
|
||||
}
|
||||
Postgres.FirstRow(sql, res)
|
||||
});
|
||||
})
|
||||
|
||||
server.post('/scale_vp_sales', bodyParser.json(), function(req, res) {
|
||||
process_route('POST /scale_vp_sales', 'Obsolete.', './route_sql/scale_vupd.sql', req, res,
|
||||
function(sql) {
|
||||
var where = build_where(req, res);
|
||||
if (!where) return;
|
||||
|
||||
var sql = "";
|
||||
var w = "";
|
||||
var c = 1;
|
||||
var d = 1;
|
||||
var args = [];
|
||||
var path = './route_sql/scale_vupd.sql';
|
||||
|
||||
var callback = function(arg) {
|
||||
sql = arg;
|
||||
|
||||
({ c, w, d } = build_where(req, c, w, d, args));
|
||||
|
||||
if (c == 1) {
|
||||
res.send("no body was sent");
|
||||
return;
|
||||
}
|
||||
console.log(new Date().toISOString() + " POST (scale volume & price sales) file: " + path + "-._.".repeat(20));
|
||||
req.body.stamp = new Date().toISOString()
|
||||
console.log(req.body);
|
||||
//console.log(args);
|
||||
sql = sql.replace(new RegExp("where_clause", 'g'), w);
|
||||
sql = sql.replace(new RegExp("where_clause", 'g'), where);
|
||||
sql = sql.replace(new RegExp("target_vol", 'g'), req.body.qty);
|
||||
sql = sql.replace(new RegExp("target_prc", 'g'), req.body.amount);
|
||||
sql = sql.replace(new RegExp("replace_version", 'g'), req.body.scenario.version);
|
||||
sql = sql.replace(new RegExp("replace_source", 'g'), req.body.source);
|
||||
sql = sql.replace(new RegExp("replace_iterdef", 'g'), JSON.stringify(req.body));
|
||||
console.log(sql);
|
||||
Postgres.FirstRow(sql, [], res)
|
||||
}
|
||||
|
||||
fs.readFile(path, 'utf8', function(err, data) {
|
||||
if (!err) {
|
||||
callback(data);
|
||||
} else {
|
||||
console.log("fatal error pulling sql file")
|
||||
callback(err);
|
||||
}
|
||||
Postgres.FirstRow(sql, res)
|
||||
});
|
||||
})
|
||||
|
||||
server.post('/new_part', bodyParser.json(), function(req, res) {
|
||||
process_route('POST /new_part', 'Obsolete.', './route_sql/new_part.sql', req, res,
|
||||
function(sql) {
|
||||
var where = build_where(req, res);
|
||||
if (!where) return;
|
||||
|
||||
var sql = "";
|
||||
var w = "";
|
||||
var c = 1;
|
||||
var d = 1;
|
||||
var args = [];
|
||||
var path = './route_sql/new_part.sql';
|
||||
|
||||
var callback = function(arg) {
|
||||
sql = arg;
|
||||
|
||||
({ c, w, d } = build_where(req, c, w, d, args));
|
||||
|
||||
if (c == 1) {
|
||||
res.send("no body was sent");
|
||||
return;
|
||||
}
|
||||
console.log(new Date().toISOString() + " POST (new part) file: " + path + "-._.".repeat(20));
|
||||
req.body.stamp = new Date().toISOString()
|
||||
console.log(req.body);
|
||||
//console.log(args);
|
||||
sql = sql.replace(new RegExp("where_clause", 'g'), w);
|
||||
sql = sql.replace(new RegExp("where_clause", 'g'), where);
|
||||
sql = sql.replace(new RegExp("target_vol", 'g'), req.body.qty);
|
||||
sql = sql.replace(new RegExp("target_prc", 'g'), req.body.amount);
|
||||
sql = sql.replace(new RegExp("replace_request", 'g'), JSON.stringify(req.body));
|
||||
sql = sql.replace(new RegExp("replace_version", 'g'), req.body.scenario.version);
|
||||
sql = sql.replace(new RegExp("replace_source", 'g'), req.body.source);
|
||||
sql = sql.replace(new RegExp("replace_iterdef", 'g'), JSON.stringify(req.body));
|
||||
console.log(sql);
|
||||
Postgres.FirstRow(sql, [], res)
|
||||
}
|
||||
|
||||
fs.readFile(path, 'utf8', function(err, data) {
|
||||
if (!err) {
|
||||
callback(data);
|
||||
} else {
|
||||
console.log("fatal error pulling sql file")
|
||||
callback(err);
|
||||
}
|
||||
Postgres.FirstRow(sql, res)
|
||||
});
|
||||
})
|
||||
|
||||
server.post('/new_basket', bodyParser.json(), function(req, res) {
|
||||
|
||||
var sql = "";
|
||||
var w = "";
|
||||
var c = 1;
|
||||
var d = 1;
|
||||
var args = [];
|
||||
var path = './route_sql/new_basket.sql';
|
||||
|
||||
var callback = function(arg) {
|
||||
sql = arg;
|
||||
process_route('POST /new_basket', 'Add new part and/or customer.', './route_sql/new_basket.sql', req, res,
|
||||
function(sql) {
|
||||
req.body.scenario.iter.push("adj volume"); //intercept the request body and force in a "adj volume" at position 1, only a "copy" iteration is being used
|
||||
|
||||
({ c, w, d } = build_where(req, c, w, d, args));
|
||||
var where = build_where(req, res);
|
||||
if (!where) return;
|
||||
|
||||
if (c == 1) {
|
||||
res.send("no body was sent");
|
||||
return;
|
||||
}
|
||||
console.log(new Date().toISOString() + " POST (new basket) file: " + path + "-._.".repeat(20));
|
||||
req.body.stamp = new Date().toISOString()
|
||||
console.log(req.body);
|
||||
//console.log(args);
|
||||
sql = sql.replace(new RegExp("where_clause", 'g'), w);
|
||||
sql = sql.replace(new RegExp("where_clause", 'g'), where);
|
||||
sql = sql.replace(new RegExp("target_vol", 'g'), req.body.qty);
|
||||
sql = sql.replace(new RegExp("target_prc", 'g'), req.body.amount);
|
||||
sql = sql.replace(new RegExp("replace_request", 'g'), JSON.stringify(req.body));
|
||||
sql = sql.replace(new RegExp("replace_version", 'g'), req.body.scenario.version);
|
||||
sql = sql.replace(new RegExp("replace_source", 'g'), req.body.source);
|
||||
sql = sql.replace(new RegExp("replace_iterdef", 'g'), JSON.stringify(req.body));
|
||||
console.log(sql);
|
||||
Postgres.FirstRow(sql, [], res)
|
||||
}
|
||||
|
||||
fs.readFile(path, 'utf8', function(err, data) {
|
||||
if (!err) {
|
||||
callback(data);
|
||||
} else {
|
||||
console.log("fatal error pulling sql file")
|
||||
callback(err);
|
||||
}
|
||||
Postgres.FirstRow(sql, res)
|
||||
});
|
||||
})
|
||||
|
||||
function build_where(req, c, w, d, args) {
|
||||
for (var i in req.body.scenario) {
|
||||
//console.log(i);
|
||||
///console.log(req.body[i]);
|
||||
if (c > 1) {
|
||||
w = w +
|
||||
`
|
||||
AND `;
|
||||
}
|
||||
if (Array.isArray(req.body.scenario[i])) {
|
||||
//if the scenario key has a value that is an array of items, push it into an `IN` statement
|
||||
//iter = [stage1, stage2] --> SQL --> iter IN ('stag1', stage2')
|
||||
w = w + i + " IN (";
|
||||
for (var j in req.body.scenario[i]) {
|
||||
if (d > 1) {
|
||||
w = w + ",";
|
||||
}
|
||||
w = w + "'" + req.body.scenario[i][j] + "'";
|
||||
d = d + 1;
|
||||
}
|
||||
w = w + ")";
|
||||
} else {
|
||||
w = w + i + " = '" + req.body.scenario[i] + "'";
|
||||
}
|
||||
args.push(req.body.scenario[i]);
|
||||
c = c + 1;
|
||||
};
|
||||
//if the request has a stamp, then it's an adjustment
|
||||
//prevent making adjustment to actual history by limiting to current stamp and beyond
|
||||
if (req.body.stamp) {
|
||||
w = w +
|
||||
`
|
||||
AND order_date >= least('` + req.body.stamp + "'::date,'2022-06-01')";
|
||||
}
|
||||
return { c, w, d };
|
||||
}
|
||||
server.post('/mix_change', bodyParser.json(), function(req, res) {
|
||||
process_route('POST /mix_change', 'add new parts over a baseline date profile', './route_sql/mix_change.sql', req, res,
|
||||
function(sql) {
|
||||
req.body.scenario.iter.push("adj volume"); //intercept the request body and force in a "adj volume" at position 1, only a "copy" iteration is being used
|
||||
|
||||
var where = build_where(req, res);
|
||||
if (!where) return;
|
||||
|
||||
req.body.stamp = new Date().toISOString()
|
||||
sql = sql.replace(new RegExp("where_clause", 'g'), where);
|
||||
sql = sql.replace(new RegExp("target_vol", 'g'), req.body.qty);
|
||||
sql = sql.replace(new RegExp("target_prc", 'g'), req.body.amount);
|
||||
sql = sql.replace(new RegExp("replace_request", 'g'), JSON.stringify(req.body));
|
||||
sql = sql.replace(new RegExp("replace_version", 'g'), req.body.scenario.version);
|
||||
sql = sql.replace(new RegExp("replace_source", 'g'), req.body.source);
|
||||
sql = sql.replace(new RegExp("replace_iterdef", 'g'), JSON.stringify(req.body));
|
||||
Postgres.FirstRow(sql, res)
|
||||
});
|
||||
})
|
||||
|
||||
server.post('/shift_ship_dates', bodyParser.json(), function(req, res) {
|
||||
process_route('POST /shift_ship_dates', 'Change ship dates to level out production.', './route_sql/shift_ship_date.sql', req, res,
|
||||
function(sql) {
|
||||
var where = build_where(req, res);
|
||||
if (!where) return;
|
||||
|
||||
req.body.stamp = new Date().toISOString()
|
||||
sql = sql.replace(new RegExp("where_clause", 'g'), where);
|
||||
sql = sql.replace(new RegExp("replace_request", 'g'), JSON.stringify(req.body.distributions));
|
||||
sql = sql.replace(new RegExp("replace_version", 'g'), req.body.scenario.version);
|
||||
sql = sql.replace(new RegExp("replace_source", 'g'), req.body.source);
|
||||
sql = sql.replace(new RegExp("replace_iterdef", 'g'), JSON.stringify(req.body));
|
||||
Postgres.FirstRow(sql, res)
|
||||
});
|
||||
})
|
||||
|
||||
2
inquirey/flag_listing.pg.sql
Normal file
2
inquirey/flag_listing.pg.sql
Normal file
@ -0,0 +1,2 @@
|
||||
|
||||
with clist as (select shipto_group, dsm, sum(pounds) pounds from rlarp.osm_pool where order_season = 2026 group by shipto_group, dsm) select * from clist c left outer join rlarp.cust_flag f ON f.shipgrp = shipto_group and f.dsm = c.dsm;
|
||||
103
inquirey/mix.pg.sql
Normal file
103
inquirey/mix.pg.sql
Normal file
@ -0,0 +1,103 @@
|
||||
SELECT
|
||||
o.fspr
|
||||
,o.plnt
|
||||
,o.promo
|
||||
,o.terms
|
||||
,o.bill_cust_descr
|
||||
,o.ship_cust_descr
|
||||
,o.dsm
|
||||
,o.quota_rep_descr
|
||||
,o.director
|
||||
,o.billto_group
|
||||
,o.shipto_group
|
||||
,o.chan
|
||||
,o.chansub
|
||||
,o.chan_retail
|
||||
,o.part
|
||||
,o.part_descr
|
||||
,o.part_group
|
||||
,o.branding
|
||||
,o.majg_descr
|
||||
,o.ming_descr
|
||||
,o.majs_descr
|
||||
,o.mins_descr
|
||||
,o.segm
|
||||
,o.substance
|
||||
,o.fs_line
|
||||
,o.r_currency
|
||||
,o.r_rate
|
||||
,o.c_currency
|
||||
,o.c_rate
|
||||
,0::numeric units
|
||||
,(c.price_choice * sum(o.units) - sum(value_usd))/o.r_rate value_loc
|
||||
,c.price_choice * sum(o.units) - sum(value_usd) value_usd
|
||||
,0::numeric cost_loc
|
||||
,0::numeric cost_usd
|
||||
,o.calc_status
|
||||
,o.flag
|
||||
,o.order_date
|
||||
,o.order_month
|
||||
,o.order_season
|
||||
,o.request_date
|
||||
,o.request_month
|
||||
,o.request_season
|
||||
,o.ship_date
|
||||
,o.ship_month
|
||||
,o.ship_season
|
||||
,o.version
|
||||
,'Pricing 2' iter
|
||||
,pounds
|
||||
FROM
|
||||
rlarp.osm_pool o
|
||||
-- CROSS JOIN logload
|
||||
INNER JOIN choose c ON
|
||||
c.billto_group = o.billto_group
|
||||
AND c.shipto_group = o.shipto_group
|
||||
-- AND substring(c.dsm,1,5) = substring(o.dsm,1,5)
|
||||
AND c.part = o.part
|
||||
AND c.order_date = o.order_date
|
||||
WHERE
|
||||
o.order_season = 2026
|
||||
GROUP BY
|
||||
o.fspr
|
||||
,o.plnt
|
||||
,o.promo
|
||||
,o.terms
|
||||
,o.bill_cust_descr
|
||||
,o.ship_cust_descr
|
||||
,o.dsm
|
||||
,o.quota_rep_descr
|
||||
,o.director
|
||||
,o.billto_group
|
||||
,o.shipto_group
|
||||
,o.chan
|
||||
,o.chansub
|
||||
,o.chan_retail
|
||||
,o.part
|
||||
,o.part_descr
|
||||
,o.part_group
|
||||
,o.branding
|
||||
,o.majg_descr
|
||||
,o.ming_descr
|
||||
,o.majs_descr
|
||||
,o.mins_descr
|
||||
,o.segm
|
||||
,o.substance
|
||||
,o.fs_line
|
||||
,o.r_currency
|
||||
,o.r_rate
|
||||
,o.c_currency
|
||||
,o.c_rate
|
||||
,c.price_choice
|
||||
,o.calc_status
|
||||
,o.flag
|
||||
,o.order_date
|
||||
,o.order_month
|
||||
,o.order_season
|
||||
,o.request_date
|
||||
,o.request_month
|
||||
,o.request_season
|
||||
,o.ship_date
|
||||
,o.ship_month
|
||||
,o.ship_season
|
||||
,o.version
|
||||
49
inquirey/osmfs.pg.sql
Normal file
49
inquirey/osmfs.pg.sql
Normal file
@ -0,0 +1,49 @@
|
||||
WITH
|
||||
SEG AS (
|
||||
SELECT
|
||||
GLEC
|
||||
,SEGM
|
||||
FROM
|
||||
(
|
||||
VALUES
|
||||
('1CU','Sustainable'),
|
||||
('1SU','Sustainable'),
|
||||
('1GR','Greenhouse'),
|
||||
('1NU','Nursery'),
|
||||
('1RE','Retail'),
|
||||
('2WI','Greenhouse'),
|
||||
('3BM','Other'),
|
||||
('3CO','Other'),
|
||||
('3PE','Other'),
|
||||
('3PP','Other'),
|
||||
('4CO','Other'),
|
||||
('4RA','Other'),
|
||||
('9MI','Other'),
|
||||
('9SA','Other'),
|
||||
('9TO','Other')
|
||||
) X(GLEC, SEGM)
|
||||
)
|
||||
SELECT
|
||||
o.*
|
||||
,o.lbs * o.fb_qty ext_lbs
|
||||
,COALESCE(s.segm,o.glec) segm
|
||||
,og.sortmo omon
|
||||
,sg.sortmo smon
|
||||
,COALESCE(f.flag,CASE WHEN o.shipgrp = 'TARGET STORES' THEN 'RETAIL' ELSE 'YoY' END) price_flag
|
||||
,coalesce(i.futstdus,o.fb_cst_loc_cur * c_rate) cash_cost
|
||||
,CASE WHEN o.shipgrp = 'TARGET STORES' THEN 'Giorgio' ELSE r.director END director
|
||||
FROM
|
||||
rlarp.osmfs o
|
||||
LEFT OUTER JOIN seg s ON
|
||||
s.glec = o.glec
|
||||
LEFT OUTER JOIN rlarp.gld og ON
|
||||
o.odate <@ og.drange
|
||||
LEFT OUTER JOIN rlarp.gld sg ON
|
||||
o.sdate <@ sg.drange
|
||||
LEFT OUTER JOIN rlarp.cust_flag f ON
|
||||
f.shipgrp = o.shipgrp
|
||||
AND f.dsm = o.dsm
|
||||
LEFT OUTER JOIN "CMS.CUSLG".itemm i ON
|
||||
i.item = o.part
|
||||
LEFT OUTER JOIN rlarp.repc r ON
|
||||
r.rcode = substring(o.dsm,1,5)
|
||||
@ -1,19 +1,25 @@
|
||||
SELECT
|
||||
oseas,
|
||||
to_char(CASE WHEN extract(month FROM o.odate) >= 6 THEN -5 ELSE 7 END + extract(month FROM o.odate),'FM00')||' - '||to_char(o.odate,'TMMon') order_month,
|
||||
sseas,
|
||||
to_char(CASE WHEN extract(month FROM o.sdate) >= 6 THEN -5 ELSE 7 END + extract(month FROM o.sdate),'FM00')||' - '||to_char(o.sdate,'TMMon') ship_month,
|
||||
version,
|
||||
iter,
|
||||
calc_status,
|
||||
sum(fb_val_loc * r_rate) value_loc
|
||||
FROM
|
||||
rlarp.osmf_dev o
|
||||
rlarp.osmf o
|
||||
WHERE
|
||||
fs_line = '41010'
|
||||
and calc_status <> 'CANCELED'
|
||||
GROUP BY
|
||||
oseas,
|
||||
to_char(CASE WHEN extract(month FROM o.odate) >= 6 THEN -5 ELSE 7 END + extract(month FROM o.odate),'FM00')||' - '||to_char(o.odate,'TMMon'),
|
||||
sseas,
|
||||
to_char(CASE WHEN extract(month FROM o.sdate) >= 6 THEN -5 ELSE 7 END + extract(month FROM o.sdate),'FM00')||' - '||to_char(o.sdate,'TMMon'),
|
||||
version,
|
||||
iter
|
||||
iter,
|
||||
calc_status
|
||||
ORDER BY
|
||||
oseas asc,
|
||||
order_month asc
|
||||
|
||||
7
inquirey/versions.pg.sql
Normal file
7
inquirey/versions.pg.sql
Normal file
@ -0,0 +1,7 @@
|
||||
|
||||
select
|
||||
tag, comment, sum(value_usd), sum(pounds)
|
||||
from
|
||||
rlarp.osm_pool
|
||||
group by
|
||||
tag, comment;
|
||||
270
lbs_schedule/just_orphans.pg.sql
Normal file
270
lbs_schedule/just_orphans.pg.sql
Normal file
@ -0,0 +1,270 @@
|
||||
WITH
|
||||
newc AS (
|
||||
SELECT * FROM (VALUES
|
||||
('A GARDEN CENTER','30053 - SKYE SAWYER'),
|
||||
('FILANOWSKI & SONS','10042 - JEREMY RHAULT'),
|
||||
('GIESEKE ENTERPRISES','10041 - TAMARA RISKEN'),
|
||||
('HUNTER ROAD GREENHOUSES','40039 - DAVE BODO'),
|
||||
('JAMPLAST INC','13027 - STEVE RUSTEBERG'),
|
||||
('MOUNT PLYMOUTH GREENHOUSES','10046 - DUSTIN KUYKENDOLL 2'),
|
||||
('PINCKARD PLANT FARM INC','10041 - TAMARA RISKEN'),
|
||||
('SHERMAN PLASTICS','13027 - STEVE RUSTEBERG'),
|
||||
('SPRING VALLEY NURSERY','12028 - JACOB WILKINSON'),
|
||||
('A&R SPADA FARMS LLC','30053 - SKYE SAWYER'),
|
||||
('CI FARMS LLC','30054 - JASON MOTTIN'),
|
||||
('GOLDEN EAGLE TREES','40042 - TOM MORRIS'),
|
||||
('TSC NURSERY SALES LTD','40042 - TOM MORRIS')
|
||||
) x(orphan,rep)
|
||||
)
|
||||
,profile AS (
|
||||
SELECT * FROM rlarp.osm WHERE shipgrp IN (select distinct orphan FROM newc ) AND oseas >= 2015
|
||||
)
|
||||
-- SELECT * FROM profile
|
||||
,checkc AS (
|
||||
SELECT shipgrp, min(oseas) oseas FROM profile GROUP BY shipgrp
|
||||
)
|
||||
-- select * from checkc
|
||||
-- SELECT cust, sum(fb_qty) FROM newc LEFT OUTER JOIN profile ON shipgrp = cust GROUP by cust
|
||||
----grouped prices-------------
|
||||
,npgrp AS (
|
||||
SELECT
|
||||
o.bill_dba
|
||||
,o.ship_dba
|
||||
,o.dsm
|
||||
,i.partgroup
|
||||
,i.pricegroup
|
||||
,o.part
|
||||
,o.odate
|
||||
,o.qtyord
|
||||
,i.nwht * CASE WHEN i.nwun = 'KG' THEN 2.2 ELSE 1 END lbs
|
||||
,i.mpck pltq
|
||||
,ROUND(o.sales_usd / o.qty,5) price
|
||||
,(o.pricing->>'guidance_price')::NUMERIC guidance
|
||||
,(o.pricing->>'floor' )::numeric(15,5) floor
|
||||
,(o.pricing->>'ceiling')::numeric(15,5) ceiling
|
||||
,(o.pricing->>'uselimits')::boolean uselimits
|
||||
FROM
|
||||
rlarp.osm_stack o
|
||||
LEFT OUTER JOIN "CMS.CUSLG".itemm i ON
|
||||
i.item = o.part
|
||||
INNER JOIN checkc c ON
|
||||
c.shipgrp = o.customer
|
||||
AND c.oseas = o.oseas
|
||||
WHERE
|
||||
VERSION = 'Actual'
|
||||
-- AND o.oseas >= 2018
|
||||
AND calc_status <> 'CANCELED'
|
||||
AND o.fs_line = '41010'
|
||||
AND o.part <> ''
|
||||
AND substring(o.glec,1,1) <= '2'
|
||||
AND o.qty <> 0
|
||||
AND o.sseas IS NOT NULL
|
||||
-- AND ROUND(o.sales_usd / o.qty,5)
|
||||
-- AND customer in (select distinct renamed FROM newc )
|
||||
GROUP BY
|
||||
o.bill_dba
|
||||
,o.ship_dba
|
||||
,o.dsm
|
||||
,i.partgroup
|
||||
,i.pricegroup
|
||||
,o.part
|
||||
,o.odate
|
||||
,o.qtyord
|
||||
,o.pounds
|
||||
,o.pallets
|
||||
,ROUND(o.sales_usd / o.qty,5)
|
||||
,i.nwht * CASE WHEN i.nwun = 'KG' THEN 2.2 ELSE 1 END
|
||||
,i.mpck
|
||||
,(o.pricing->>'guidance_price')::NUMERIC
|
||||
,(o.pricing->>'floor' )::numeric(15,5)
|
||||
,(o.pricing->>'ceiling')::numeric(15,5)
|
||||
,(o.pricing->>'uselimits')::boolean
|
||||
)
|
||||
SELECT * FROM npgrp
|
||||
-- ----sequenced for most recent price------------
|
||||
-- ,nseq AS (
|
||||
-- SELECT
|
||||
-- bill_dba
|
||||
-- ,ship_dba
|
||||
-- ,part
|
||||
-- ,odate
|
||||
-- ,qtyord
|
||||
-- ,lbs
|
||||
-- ,pltq
|
||||
-- ,price
|
||||
-- ,guidance
|
||||
-- ,floor
|
||||
-- ,ceiling
|
||||
-- ,uselimits
|
||||
-- ,row_number() OVER (PARTITION BY bill_dba, ship_dba, part ORDER BY odate desc) rn
|
||||
-- ,round(avg(price) over (PARTITION BY bill_dba, ship_dba, part),5) avgprice
|
||||
-- FROM
|
||||
-- npgrp
|
||||
-- )
|
||||
-- -- SELECT * FROM seq WHERE rn = 1
|
||||
-- ,ngrp AS (
|
||||
-- SELECT
|
||||
-- o.account
|
||||
-- ,o.shipgrp
|
||||
-- ,o.chan
|
||||
-- ,o.dsm
|
||||
-- ,i.partgroup
|
||||
-- ,i.pricegroup
|
||||
-- ,o.part
|
||||
-- ,o.glec
|
||||
-- ,o.oseas
|
||||
-- -- ,o.odate
|
||||
-- ,og.sortmo omon
|
||||
-- ,o.sseas
|
||||
-- -- ,o.sdate
|
||||
-- ,sg.sortmo smon
|
||||
-- -- ,o.calc_status
|
||||
-- ,ROUND(sum(fb_qty * lbs),5) lbs
|
||||
-- ,ROUND(sum(fb_qty),2) qty
|
||||
-- ,ROUND(sum(fb_val_loc * r_rate),2) sales_usd
|
||||
-- ,ROUND(sum(fb_cst_loc_cur * c_rate),2) cost_curstd_usd
|
||||
-- FROM
|
||||
-- profile o
|
||||
-- LEFT OUTER JOIN rlarp.gld og ON
|
||||
-- o.odate BETWEEN og.sdat and og.edat
|
||||
-- LEFT OUTER JOIN rlarp.gld sg ON
|
||||
-- o.sdate BETWEEN sg.sdat and sg.edat
|
||||
-- LEFT OUTER JOIN "CMS.CUSLG".itemm i ON
|
||||
-- i.item = o.part
|
||||
-- WHERE
|
||||
-- true
|
||||
-- -- iter IN ('actuals','actuals_plug','copy')
|
||||
-- AND fs_line = '41010'
|
||||
-- AND substring(o.glec,1,1) <= '2'
|
||||
-- AND o.calc_status <> 'CANCELED'
|
||||
-- AND o.sseas IS NOT NULL
|
||||
-- GROUP BY
|
||||
-- o.account
|
||||
-- ,o.shipgrp
|
||||
-- ,o.chan
|
||||
-- ,o.dsm
|
||||
-- ,i.partgroup
|
||||
-- ,i.pricegroup
|
||||
-- ,o.part
|
||||
-- ,o.glec
|
||||
-- ,o.oseas
|
||||
-- -- ,o.odate
|
||||
-- ,og.sortmo
|
||||
-- ,o.sseas
|
||||
-- -- ,o.sdate
|
||||
-- ,sg.sortmo
|
||||
-- -- ,o.calc_status
|
||||
-- )
|
||||
-- -- SELECT * FROM grp
|
||||
-- ,nguid AS (
|
||||
-- SELECT
|
||||
-- grp.account
|
||||
-- ,grp.shipgrp
|
||||
-- ,grp.chan
|
||||
-- ,r.repp dsm
|
||||
-- ,r.director
|
||||
-- ,grp.shipgrp||'.'||r.repp lu
|
||||
-- -- ,grp.partgroup
|
||||
-- -- ,grp.pricegroup
|
||||
-- ,grp.part
|
||||
-- -- ,grp.glec
|
||||
-- ,2026 oseas
|
||||
-- ,grp.omon
|
||||
-- -- ,grp.odate
|
||||
-- ,(2026- grp.oseas) + grp.sseas sseas
|
||||
-- ,grp.smon
|
||||
-- -- ,grp.sdate
|
||||
-- ,grp.lbs
|
||||
-- ,grp.qty
|
||||
-- ,grp.sales_usd
|
||||
-- ,CASE WHEN round(grp.sales_usd/grp.qty,5) = 0 THEN null ELSE round(grp.sales_usd/grp.qty,5) END hist_price
|
||||
-- ,grp.cost_curstd_usd
|
||||
-- ,sum(grp.lbs) OVER (PARTITION BY shipgrp, dsm) shiplbs
|
||||
-- ,CASE WHEN seq.floor = 0 THEN null else seq.floor END floor
|
||||
-- ,CASE WHEN seq.ceiling = 0 THEN null else seq.ceiling END ceiling
|
||||
-- ,seq.uselimits
|
||||
-- ,seq.price
|
||||
-- ,seq.avgprice
|
||||
-- ,seq.pltq
|
||||
-- ,ROUND(CASE WHEN seq.uselimits THEN
|
||||
-- CASE
|
||||
-- WHEN glec = '1NU' THEN
|
||||
-- --if more than 8/24 pallets, use floor
|
||||
-- CASE WHEN grp.qty >= 24*seq.pltq THEN seq.floor
|
||||
-- -- if more than a pallet use the target price
|
||||
-- ELSE CASE WHEN qtyord >= 8*seq.pltq THEN (seq.ceiling + seq.floor) / 2
|
||||
-- -- if more than a pallet use the target price
|
||||
-- ELSE CASE WHEN qtyord >= 2*seq.pltq THEN seq.ceiling
|
||||
-- -- if more than a pallet use the target price
|
||||
-- ELSE seq.ceiling * 1.05
|
||||
-- END END END
|
||||
-- ELSE
|
||||
-- CASE WHEN pricegroup ~ '(Hanger|Dish)' THEN
|
||||
-- --at least 1 pallets is lower limit
|
||||
-- CASE WHEN qtyord >= 01*seq.pltq THEN seq.floor
|
||||
-- --at least 2 pallets is mid range
|
||||
-- ELSE CASE WHEN qtyord >= 0.5*seq.pltq THEN (seq.ceiling + seq.floor) / 2
|
||||
-- --less than a pallet is upper + 15%
|
||||
-- ELSE seq.ceiling
|
||||
-- END END
|
||||
-- ELSE
|
||||
-- --at least 8 pallets is lower limit
|
||||
-- CASE WHEN qtyord >= 08*seq.pltq THEN seq.floor
|
||||
-- --at least 2 pallets is mid range
|
||||
-- ELSE CASE WHEN qtyord >= 2*seq.pltq THEN (seq.ceiling + seq.floor) / 2
|
||||
-- --at least 1 pallet is upper range
|
||||
-- ELSE CASE WHEN qtyord >= 1*seq.pltq THEN seq.ceiling
|
||||
-- --less than a pallet is upper + 15%
|
||||
-- ELSE seq.ceiling * 1.15
|
||||
-- END END END
|
||||
-- END
|
||||
-- END
|
||||
-- ELSE
|
||||
-- null
|
||||
-- END,5) guid
|
||||
-- FROM
|
||||
-- ngrp grp
|
||||
-- LEFT OUTER JOIN nseq seq ON
|
||||
-- seq.ship_dba = grp.shipgrp
|
||||
-- AND seq.bill_dba = grp.account
|
||||
-- AND seq.part = grp.part
|
||||
-- AND seq.rn = 1
|
||||
-- LEFT OUTER JOIN rlarp.repc r ON
|
||||
-- r.rcode = grp.dsm
|
||||
-- )
|
||||
-- ,orphans AS (
|
||||
-- SELECT
|
||||
-- account
|
||||
-- ,shipgrp
|
||||
-- ,chan
|
||||
-- ,dsm
|
||||
-- ,director
|
||||
-- ,lu
|
||||
-- --,partgroup
|
||||
-- --,pricegroup
|
||||
-- ,part
|
||||
-- -- ,glec
|
||||
-- ,oseas
|
||||
-- ,omon
|
||||
-- -- ,odate
|
||||
-- ,sseas
|
||||
-- ,smon
|
||||
-- -- ,sdate
|
||||
-- ,lbs
|
||||
-- ,qty
|
||||
-- ,sales_usd
|
||||
-- ,hist_price
|
||||
-- ,cost_curstd_usd
|
||||
-- ,shiplbs
|
||||
-- ,floor
|
||||
-- ,ceiling
|
||||
-- ,uselimits
|
||||
-- ,price
|
||||
-- ,avgprice
|
||||
-- ,pltq
|
||||
-- ,guid
|
||||
-- ,least(hist_price, price, avgprice) lowest_last
|
||||
-- ,least(hist_price, price, avgprice, floor) lowest_floor
|
||||
-- FROM
|
||||
-- nguid
|
||||
-- )
|
||||
334
lbs_schedule/osm_target.pg.sql
Normal file
334
lbs_schedule/osm_target.pg.sql
Normal file
@ -0,0 +1,334 @@
|
||||
WITH
|
||||
tload AS (
|
||||
SELECT
|
||||
account
|
||||
,shipgrp
|
||||
,chan
|
||||
,dsm
|
||||
,director
|
||||
,lu
|
||||
,part
|
||||
,oseas::int oseas
|
||||
,omon
|
||||
,sseas::int sseas
|
||||
,smon
|
||||
,lbs::numeric lbs
|
||||
,qty::numeric qty
|
||||
,sales_usd::numeric sales_usd
|
||||
,hist_price::numeric hist_price
|
||||
,cost_curstd_usd::numeric cost_curstd_usd
|
||||
,shiplbs::numeric shiplbs
|
||||
,floor::numeric floor
|
||||
,ceiling::numeric ceiling
|
||||
,uselimits::numeric uselimits
|
||||
,price::numeric price
|
||||
,avgprice::numeric avgprice
|
||||
,pltq
|
||||
,guid::numeric guid
|
||||
,lowest_last::numeric lowest_last
|
||||
,lowest_floor::numeric lowest_floor
|
||||
FROM (VALUES
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RET12000G18C004','2026','06 - Nov','2026','06 - Nov','28735.2896693825','21212.9646598529','89274.761770991','4.2085','70851.3019639087','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RET12000BH9C004','2026','06 - Nov','2026','06 - Nov','28735.2896693825','21212.9646598529','113256.018318955','5.339','92700.6555635572','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RET12000E79C004','2026','06 - Nov','2026','06 - Nov','28735.2896693825','21212.9646598529','113256.018318955','5.339','92700.6555635572','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RET12000A69C004','2026','06 - Nov','2026','06 - Nov','28735.2896693825','21212.9646598529','113256.018318955','5.339','92700.6555635572','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RET16000G18C004','2026','06 - Nov','2026','06 - Nov','15110.9872270733','7042.70426707117','51918.8158568486','7.372','36199.4999327458','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RET16000BH9C004','2026','06 - Nov','2026','06 - Nov','15110.9872270733','7042.70426707117','59077.7247443265','8.3885','41974.5174317442','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RET16000E79C004','2026','06 - Nov','2026','06 - Nov','15110.9872270733','7042.70426707117','59077.7247443265','8.3885','41974.5174317442','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RET16000A69C004','2026','06 - Nov','2026','06 - Nov','15110.9872270733','7042.70426707117','59077.7247443265','8.3885','41974.5174317442','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RET21000G18C004','2026','06 - Nov','2026','06 - Nov','30895.6799361216','8485.18586394117','96811.7281146367','11.4095','66439.0053146593','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RET21000BH9C004','2026','06 - Nov','2026','06 - Nov','30895.6799361216','8485.18586394117','127040.202754927','14.972','90112.6738750552','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RET21000E79C004','2026','06 - Nov','2026','06 - Nov','30895.6799361216','8485.18586394117','127040.202754927','14.972','90112.6738750552','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RET21000A69C004','2026','06 - Nov','2026','06 - Nov','30895.6799361216','8485.18586394117','127040.202754927','14.972','90112.6738750552','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RET04000G18C004','2026','06 - Nov','2026','06 - Nov','5033.92107087739','21212.9646598529','39297.0170323775','1.8525','29486.0208771955','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RET04000DF9C004','2026','06 - Nov','2026','06 - Nov','5033.92107087739','21212.9646598529','43529.0034820182','2.052','33304.3545159691','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RET04000BH9C004','2026','06 - Nov','2026','06 - Nov','5033.92107087739','21212.9646598529','43529.0034820182','2.052','33304.3545159691','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RET04000A69C004','2026','06 - Nov','2026','06 - Nov','5033.92107087739','21212.9646598529','43529.0034820182','2.052','33304.3545159691','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RET04000E79C004','2026','06 - Nov','2026','06 - Nov','5033.92107087739','21212.9646598529','43529.0034820182','2.052','33304.3545159691','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RET04000A69C004','2026','06 - Nov','2026','06 - Nov','5033.92107087739','21212.9646598529','43529.0034820182','2.052','33304.3545159691','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RET04000C39C004','2026','06 - Nov','2026','06 - Nov','5033.92107087739','21212.9646598529','43529.0034820182','2.052','33304.3545159691','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RET08000G18C004','2026','06 - Nov','2026','06 - Nov','10436.7786126476','25455.5575918235','52476.6319755441','2.0615','39965.2254191629','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RET08000DF9C004','2026','06 - Nov','2026','06 - Nov','10436.7786126476','25455.5575918235','64084.3662374156','2.5175','50911.115183647','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RET08000BH9C004','2026','06 - Nov','2026','06 - Nov','10436.7786126476','25455.5575918235','64084.3662374156','2.5175','50911.115183647','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RET08000C39C004','2026','06 - Nov','2026','06 - Nov','10436.7786126476','25455.5575918235','64084.3662374156','2.5175','50911.115183647','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RET08000E79C004','2026','06 - Nov','2026','06 - Nov','10436.7786126476','25455.5575918235','64084.3662374156','2.5175','50911.115183647','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RET08000A69C004','2026','06 - Nov','2026','06 - Nov','10436.7786126476','25455.5575918235','64084.3662374156','2.5175','50911.115183647','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RET08000C39C004','2026','06 - Nov','2026','06 - Nov','10436.7786126476','25455.5575918235','64084.3662374156','2.5175','50911.115183647','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','REC10000000C0024','2026','06 - Nov','2026','06 - Nov','6516.62274350681','27152.5947646117','18830.3244692582','0.6935','13033.2454870136','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','REC12000000C0024','2026','06 - Nov','2026','06 - Nov','7102.10056811875','22910.0018326411','19152.761532088','0.836','13287.8010629319','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','REC06000000C0024','2026','06 - Nov','2026','06 - Nov','5091.1115183647','50911.115183647','22248.1573352537','0.437','15273.3345550941','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','REC08000000C0024','2026','06 - Nov','2026','06 - Nov','6533.5931152347','46668.5222516764','24827.6538378919','0.532','17267.3532331203','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','REQ10000G18C004','2026','06 - Nov','2026','06 - Nov','14180.9117729538','12727.7787959117','37292.3918720214','2.93','26601.0576834556','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RES12000G18C004','2026','06 - Nov','2026','06 - Nov','40546.9669499111','42425.9293197058','162915.56858767','3.84','131520.380891088','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RES16000G18C002','2026','06 - Nov','2026','06 - Nov','49982.8098017159','22061.483246247','153547.923393879','6.96','125088.610006221','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','REW16000G18C004','2026','06 - Nov','2026','06 - Nov','13375.5566136045','17818.8903142764','56664.0711993991','3.18','45259.9813982622','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RES20000G18C004','2026','06 - Nov','2026','06 - Nov','55627.0460844721','9333.70445033528','137392.129508935','14.72','85776.7438985812','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RES24000G18C004','2026','06 - Nov','2026','06 - Nov','12618.7839140762','5600.22267020117','42785.7012003369','7.64','28561.135618026','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','REU08000G18C004','2026','06 - Nov','2026','06 - Nov','11041.6504460234','8485.18586394117','53117.2635082717','6.26','24861.5945813476','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','REQ06000G18C004','2026','06 - Nov','2026','06 - Nov','11324.9204751029','33940.7434557647','66523.8571732987','1.96','49553.4854454164','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RES08000G18C004','2026','06 - Nov','2026','06 - Nov','25702.8429802452','61941.8568067705','100345.808026968','1.62','92293.366642088','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RET12000G18C004','2026','07 - Dec','2026','07 - Dec','48635.4628552039','35903.6698997439','151100.594773072','4.2085','119918.257465145','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RET12000BH9C004','2026','07 - Dec','2026','07 - Dec','48635.4628552039','35903.6698997439','191689.693594733','5.339','156899.037461881','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RET12000E79C004','2026','07 - Dec','2026','07 - Dec','48635.4628552039','35903.6698997439','191689.693594733','5.339','156899.037461881','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RET12000A69C004','2026','07 - Dec','2026','07 - Dec','48635.4628552039','35903.6698997439','191689.693594733','5.339','156899.037461881','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RET16000G18C004','2026','07 - Dec','2026','07 - Dec','25575.8639096251','11920.018406715','87874.3756943028','7.372','61268.894610515','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RET16000BH9C004','2026','07 - Dec','2026','07 - Dec','25575.8639096251','11920.018406715','99991.0744047286','8.3885','71043.3097040213','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RET16000E79C004','2026','07 - Dec','2026','07 - Dec','25575.8639096251','11920.018406715','99991.0744047286','8.3885','71043.3097040213','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RET16000A69C004','2026','07 - Dec','2026','07 - Dec','25575.8639096251','11920.018406715','99991.0744047286','8.3885','71043.3097040213','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RET21000G18C004','2026','07 - Dec','2026','07 - Dec','52291.9974431496','14361.4679598976','163857.168688451','11.4095','112450.294125998','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RET21000BH9C004','2026','07 - Dec','2026','07 - Dec','52291.9974431496','14361.4679598976','215019.898295586','14.972','152518.789734112','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RET21000E79C004','2026','07 - Dec','2026','07 - Dec','52291.9974431496','14361.4679598976','215019.898295586','14.972','152518.789734112','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RET21000A69C004','2026','07 - Dec','2026','07 - Dec','52291.9974431496','14361.4679598976','215019.898295586','14.972','152518.789734112','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RET04000G18C004','2026','07 - Dec','2026','07 - Dec','8520.08398299007','35903.6698997439','66511.5484892756','1.8525','49906.101160644','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RET04000DF9C004','2026','07 - Dec','2026','07 - Dec','8520.08398299007','35903.6698997439','73674.3306342745','2.052','56368.7617425979','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RET04000BH9C004','2026','07 - Dec','2026','07 - Dec','8520.08398299007','35903.6698997439','73674.3306342745','2.052','56368.7617425979','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RET04000A69C004','2026','07 - Dec','2026','07 - Dec','8520.08398299007','35903.6698997439','73674.3306342745','2.052','56368.7617425979','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RET04000E79C004','2026','07 - Dec','2026','07 - Dec','8520.08398299007','35903.6698997439','73674.3306342745','2.052','56368.7617425979','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RET04000A69C004','2026','07 - Dec','2026','07 - Dec','8520.08398299007','35903.6698997439','73674.3306342745','2.052','56368.7617425979','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RET04000C39C004','2026','07 - Dec','2026','07 - Dec','8520.08398299007','35903.6698997439','73674.3306342745','2.052','56368.7617425979','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RET08000G18C004','2026','07 - Dec','2026','07 - Dec','17664.605590674','43084.4038796927','88818.4985979865','2.0615','67642.5140911175','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RET08000DF9C004','2026','07 - Dec','2026','07 - Dec','17664.605590674','43084.4038796927','108464.986767126','2.5175','86168.8077593854','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RET08000BH9C004','2026','07 - Dec','2026','07 - Dec','17664.605590674','43084.4038796927','108464.986767126','2.5175','86168.8077593854','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RET08000C39C004','2026','07 - Dec','2026','07 - Dec','17664.605590674','43084.4038796927','108464.986767126','2.5175','86168.8077593854','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RET08000E79C004','2026','07 - Dec','2026','07 - Dec','17664.605590674','43084.4038796927','108464.986767126','2.5175','86168.8077593854','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RET08000A69C004','2026','07 - Dec','2026','07 - Dec','17664.605590674','43084.4038796927','108464.986767126','2.5175','86168.8077593854','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RET08000C39C004','2026','07 - Dec','2026','07 - Dec','17664.605590674','43084.4038796927','108464.986767126','2.5175','86168.8077593854','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','REC10000000C0024','2026','07 - Dec','2026','07 - Dec','11029.6073932013','45956.6974716722','31870.9696966047','0.6935','22059.2147864027','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','REC12000000C0024','2026','07 - Dec','2026','07 - Dec','12020.5486824343','38775.9634917234','32416.7054790808','0.836','22490.0588251996','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','REC06000000C0024','2026','07 - Dec','2026','07 - Dec','8616.88077593854','86168.8077593854','37655.7689908514','0.437','25850.6423278156','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','REC08000000C0024','2026','07 - Dec','2026','07 - Dec','11058.3303291211','78988.0737794366','42021.6552506603','0.532','29225.5872983915','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','REQ10000G18C004','2026','07 - Dec','2026','07 - Dec','24001.6793191158','21542.2019398463','63118.6516837498','2.93','45023.2020542789','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RES12000G18C004','2026','07 - Dec','2026','07 - Dec','68627.1315749002','71807.3397994878','275740.184830033','3.84','222602.753378412','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RES16000G18C002','2026','07 - Dec','2026','07 - Dec','84597.6190767357','37339.8166957337','259885.124202306','6.96','211716.76066481','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','REW16000G18C004','2026','07 - Dec','2026','07 - Dec','22638.5881031077','30159.0827157849','95905.883036196','3.18','76604.0700980936','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RES20000G18C004','2026','07 - Dec','2026','07 - Dec','94150.6824783715','15797.6147558873','232540.889206661','14.72','145180.079606605','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RES24000G18C004','2026','07 - Dec','2026','07 - Dec','21357.7243658281','9478.56885353239','72416.2660409875','7.64','48340.7011530152','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','REU08000G18C004','2026','07 - Dec','2026','07 - Dec','18688.3719045961','14361.4679598976','89902.7894289588','6.26','42079.1011224999','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','REQ06000G18C004','2026','07 - Dec','2026','07 - Dec','19167.8161397439','57445.8718395903','112593.908805597','1.96','83870.9728858018','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RES08000G18C004','2026','07 - Dec','2026','07 - Dec','43502.9428769185','104838.716107252','169838.720093749','1.62','156209.686999806','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RET12000G18C004','2026','08 - Jan','2026','08 - Jan','21299.5008585021','15723.7168715697','66173.2624540011','4.2085','52517.2143510429','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RET12000BH9C004','2026','08 - Jan','2026','08 - Jan','21299.5008585021','15723.7168715697','83948.9243773107','5.339','68712.6427287597','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RET12000E79C004','2026','08 - Jan','2026','08 - Jan','21299.5008585021','15723.7168715697','83948.9243773107','5.339','68712.6427287597','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RET12000A69C004','2026','08 - Jan','2026','08 - Jan','21299.5008585021','15723.7168715697','83948.9243773107','5.339','68712.6427287597','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RET16000G18C004','2026','08 - Jan','2026','08 - Jan','11200.7391997444','5220.27400136115','38483.8599380344','7.372','26832.2083669963','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RET16000BH9C004','2026','08 - Jan','2026','08 - Jan','11200.7391997444','5220.27400136115','43790.268460418','8.3885','31112.8330481124','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RET16000E79C004','2026','08 - Jan','2026','08 - Jan','11200.7391997444','5220.27400136115','43790.268460418','8.3885','31112.8330481124','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RET16000A69C004','2026','08 - Jan','2026','08 - Jan','11200.7391997444','5220.27400136115','43790.268460418','8.3885','31112.8330481124','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RET21000G18C004','2026','08 - Jan','2026','08 - Jan','22900.8501008638','6289.48674862789','71759.8990584699','11.4095','49246.6812417563','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RET21000BH9C004','2026','08 - Jan','2026','08 - Jan','22900.8501008638','6289.48674862789','94166.1956004567','14.972','66794.3492704281','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RET21000E79C004','2026','08 - Jan','2026','08 - Jan','22900.8501008638','6289.48674862789','94166.1956004567','14.972','66794.3492704281','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RET21000A69C004','2026','08 - Jan','2026','08 - Jan','22900.8501008638','6289.48674862789','94166.1956004567','14.972','66794.3492704281','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RET04000G18C004','2026','08 - Jan','2026','08 - Jan','3731.30069000237','15723.7168715697','29128.1855045829','1.8525','21855.9664514819','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RET04000DF9C004','2026','08 - Jan','2026','08 - Jan','3731.30069000237','15723.7168715697','32265.0670204611','2.052','24686.2354883645','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RET04000BH9C004','2026','08 - Jan','2026','08 - Jan','3731.30069000237','15723.7168715697','32265.0670204611','2.052','24686.2354883645','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RET04000A69C004','2026','08 - Jan','2026','08 - Jan','3731.30069000237','15723.7168715697','32265.0670204611','2.052','24686.2354883645','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RET04000E79C004','2026','08 - Jan','2026','08 - Jan','3731.30069000237','15723.7168715697','32265.0670204611','2.052','24686.2354883645','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RET04000A69C004','2026','08 - Jan','2026','08 - Jan','3731.30069000237','15723.7168715697','32265.0670204611','2.052','24686.2354883645','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RET04000C39C004','2026','08 - Jan','2026','08 - Jan','3731.30069000237','15723.7168715697','32265.0670204611','2.052','24686.2354883645','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RET08000G18C004','2026','08 - Jan','2026','08 - Jan','7736.0687008123','18868.4602458837','38897.3307968892','2.0615','29623.4825860373','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RET08000DF9C004','2026','08 - Jan','2026','08 - Jan','7736.0687008123','18868.4602458837','47501.3486690121','2.5175','37736.9204917673','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RET08000BH9C004','2026','08 - Jan','2026','08 - Jan','7736.0687008123','18868.4602458837','47501.3486690121','2.5175','37736.9204917673','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RET08000C39C004','2026','08 - Jan','2026','08 - Jan','7736.0687008123','18868.4602458837','47501.3486690121','2.5175','37736.9204917673','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RET08000E79C004','2026','08 - Jan','2026','08 - Jan','7736.0687008123','18868.4602458837','47501.3486690121','2.5175','37736.9204917673','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RET08000A69C004','2026','08 - Jan','2026','08 - Jan','7736.0687008123','18868.4602458837','47501.3486690121','2.5175','37736.9204917673','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RET08000C39C004','2026','08 - Jan','2026','08 - Jan','7736.0687008123','18868.4602458837','47501.3486690121','2.5175','37736.9204917673','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','REC10000000C0024','2026','08 - Jan','2026','08 - Jan','4830.32582294622','20126.3575956092','13957.628992555','0.6935','9660.65164589243','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','REC12000000C0024','2026','08 - Jan','2026','08 - Jan','5264.30040860154','16981.6142212953','14196.6294890029','0.836','9849.33624835127','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','REC06000000C0024','2026','08 - Jan','2026','08 - Jan','3773.69204917673','37736.9204917673','16491.0342549023','0.437','11321.0761475302','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','REC08000000C0024','2026','08 - Jan','2026','08 - Jan','4842.90479644347','34592.1771174534','18403.0382264852','0.532','12799.1055334577','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','REQ10000G18C004','2026','08 - Jan','2026','08 - Jan','10511.3380083377','9434.23012294183','27642.2942602196','2.93','19717.5409569484','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RES12000G18C004','2026','08 - Jan','2026','08 - Jan','30054.6877131184','31447.4337431394','120758.145573655','3.84','97487.0446037322','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RES16000G18C002','2026','08 - Jan','2026','08 - Jan','37048.831333562','16352.6655464325','113814.55220317','6.96','92719.6136482723','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','REW16000G18C004','2026','08 - Jan','2026','08 - Jan','9914.38342373718','13207.9221721186','42001.192507337','3.18','33548.1223171811','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RES20000G18C004','2026','08 - Jan','2026','08 - Jan','41232.5168621699','6918.43542349067','101839.369433783','14.72','63580.4215418793','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RES24000G18C004','2026','08 - Jan','2026','08 - Jan','9353.43968700264','4151.0612540944','31714.1079812813','7.64','21170.4123958815','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','REU08000G18C004','2026','08 - Jan','2026','08 - Jan','8184.41873599566','6289.48674862789','39372.1870464106','6.26','18428.1961734797','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','REQ06000G18C004','2026','08 - Jan','2026','08 - Jan','8394.38739463753','25157.9469945115','49309.5761092426','1.96','36730.6026119868','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RES08000G18C004','2026','08 - Jan','2026','08 - Jan','19051.7559566137','45913.2532649836','74379.4702892734','1.62','68410.7473648255','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RET12000G18C004','2026','09 - Feb','2026','09 - Feb','23249.3812927716','17163.1575460505','72231.1485325535','4.2085','57324.9462038086','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RET12000BH9C004','2026','09 - Feb','2026','09 - Feb','23249.3812927716','17163.1575460505','91634.0981383635','5.339','75002.9984762406','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RET12000E79C004','2026','09 - Feb','2026','09 - Feb','23249.3812927716','17163.1575460505','91634.0981383635','5.339','75002.9984762406','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RET12000A69C004','2026','09 - Feb','2026','09 - Feb','23249.3812927716','17163.1575460505','91634.0981383635','5.339','75002.9984762406','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RET16000G18C004','2026','09 - Feb','2026','09 - Feb','12226.1201398906','5698.16830528876','42006.8967465888','7.372','29288.5850891842','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RET16000BH9C004','2026','09 - Feb','2026','09 - Feb','12226.1201398906','5698.16830528876','47799.0848289148','8.3885','33961.083099521','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RET16000E79C004','2026','09 - Feb','2026','09 - Feb','12226.1201398906','5698.16830528876','47799.0848289148','8.3885','33961.083099521','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RET16000A69C004','2026','09 - Feb','2026','09 - Feb','12226.1201398906','5698.16830528876','47799.0848289148','8.3885','33961.083099521','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RET21000G18C004','2026','09 - Feb','2026','09 - Feb','24997.3273768553','6865.2630184202','78329.2184086652','11.4095','53755.0094342301','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RET21000BH9C004','2026','09 - Feb','2026','09 - Feb','24997.3273768553','6865.2630184202','102786.717911787','14.972','72909.0932556225','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RET21000E79C004','2026','09 - Feb','2026','09 - Feb','24997.3273768553','6865.2630184202','102786.717911787','14.972','72909.0932556225','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RET21000A69C004','2026','09 - Feb','2026','09 - Feb','24997.3273768553','6865.2630184202','102786.717911787','14.972','72909.0932556225','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RET04000G18C004','2026','09 - Feb','2026','09 - Feb','4072.88569981763','17163.1575460505','31794.7493540585','1.8525','23856.7889890102','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RET04000DF9C004','2026','09 - Feb','2026','09 - Feb','4072.88569981763','17163.1575460505','35218.7992844956','2.052','26946.1573472993','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RET04000BH9C004','2026','09 - Feb','2026','09 - Feb','4072.88569981763','17163.1575460505','35218.7992844956','2.052','26946.1573472993','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RET04000A69C004','2026','09 - Feb','2026','09 - Feb','4072.88569981763','17163.1575460505','35218.7992844956','2.052','26946.1573472993','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RET04000E79C004','2026','09 - Feb','2026','09 - Feb','4072.88569981763','17163.1575460505','35218.7992844956','2.052','26946.1573472993','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RET04000A69C004','2026','09 - Feb','2026','09 - Feb','4072.88569981763','17163.1575460505','35218.7992844956','2.052','26946.1573472993','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RET04000C39C004','2026','09 - Feb','2026','09 - Feb','4072.88569981763','17163.1575460505','35218.7992844956','2.052','26946.1573472993','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RET08000G18C004','2026','09 - Feb','2026','09 - Feb','8444.27351265684','20595.7890552606','42458.2191374197','2.0615','32335.3888167591','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RET08000DF9C004','2026','09 - Feb','2026','09 - Feb','8444.27351265684','20595.7890552606','51849.8989466185','2.5175','41191.5781105212','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RET08000BH9C004','2026','09 - Feb','2026','09 - Feb','8444.27351265684','20595.7890552606','51849.8989466185','2.5175','41191.5781105212','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RET08000C39C004','2026','09 - Feb','2026','09 - Feb','8444.27351265684','20595.7890552606','51849.8989466185','2.5175','41191.5781105212','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RET08000E79C004','2026','09 - Feb','2026','09 - Feb','8444.27351265684','20595.7890552606','51849.8989466185','2.5175','41191.5781105212','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RET08000A69C004','2026','09 - Feb','2026','09 - Feb','8444.27351265684','20595.7890552606','51849.8989466185','2.5175','41191.5781105212','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RET08000C39C004','2026','09 - Feb','2026','09 - Feb','8444.27351265684','20595.7890552606','51849.8989466185','2.5175','41191.5781105212','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','REC10000000C0024','2026','09 - Feb','2026','09 - Feb','5272.52199814671','21968.8416589446','15235.3916904781','0.6935','10545.0439962934','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','REC12000000C0024','2026','09 - Feb','2026','09 - Feb','5746.2251464177','18536.2101497345','15496.2716851781','0.836','10751.001886846','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','REC06000000C0024','2026','09 - Feb','2026','09 - Feb','4119.15781105212','41191.5781105212','18000.7196342978','0.437','12357.4734331564','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','REC08000000C0024','2026','09 - Feb','2026','09 - Feb','5286.25252418355','37758.9466013111','20087.7595918975','0.532','13970.8102424851','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','REQ10000G18C004','2026','09 - Feb','2026','09 - Feb','11473.6071458451','10297.8945276303','30172.8309659568','2.93','21522.5995627473','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RES12000G18C004','2026','09 - Feb','2026','09 - Feb','32806.0689740786','34326.315092101','131813.049953668','3.84','106411.576785513','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RES16000G18C002','2026','09 - Feb','2026','09 - Feb','40440.4972608423','17849.6838478925','124233.799581332','6.96','101207.707417551','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','REW16000G18C004','2026','09 - Feb','2026','09 - Feb','10822.0038597379','14417.0523386824','45846.2264370101','3.18','36619.3129402533','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RES20000G18C004','2026','09 - Feb','2026','09 - Feb','45007.1817437245','7551.78932026221','111162.33879426','14.72','69400.9438532097','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RES24000G18C004','2026','09 - Feb','2026','09 - Feb','10209.7080643682','4531.07359215733','34617.402244082','7.64','23108.4753200024','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','REU08000G18C004','2026','09 - Feb','2026','09 - Feb','8933.66812288052','6865.2630184202','42976.5464953104','6.26','20115.2206439712','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','REQ06000G18C004','2026','09 - Feb','2026','09 - Feb','9162.85853615483','27461.0520736808','53823.6620644143','1.96','40093.1360275739','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RES08000G18C004','2026','09 - Feb','2026','09 - Feb','20795.864723531','50116.4200344674','81188.6004558372','1.62','74673.4658513565','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RET12000G18C004','2026','10 - Mar','2026','10 - Mar','25874.95998273','19101.412166156','80388.2931012676','4.2085','63798.7166349611','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RET12000BH9C004','2026','10 - Mar','2026','10 - Mar','25874.95998273','19101.412166156','101982.439555107','5.339','83473.1711661018','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RET12000E79C004','2026','10 - Mar','2026','10 - Mar','25874.95998273','19101.412166156','101982.439555107','5.339','83473.1711661018','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RET12000A69C004','2026','10 - Mar','2026','10 - Mar','25874.95998273','19101.412166156','101982.439555107','5.339','83473.1711661018','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RET16000G18C004','2026','10 - Mar','2026','10 - Mar','13606.8295917223','6341.6688391638','46750.7826823155','7.372','32596.1778333019','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RET16000BH9C004','2026','10 - Mar','2026','10 - Mar','13606.8295917223','6341.6688391638','53197.0890573255','8.3885','37796.3462814162','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RET16000E79C004','2026','10 - Mar','2026','10 - Mar','13606.8295917223','6341.6688391638','53197.0890573255','8.3885','37796.3462814162','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RET16000A69C004','2026','10 - Mar','2026','10 - Mar','13606.8295917223','6341.6688391638','53197.0890573255','8.3885','37796.3462814162','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RET21000G18C004','2026','10 - Mar','2026','10 - Mar','27820.3035773872','7640.56486646241','87175.0248439029','11.4095','59825.6229044007','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RET21000BH9C004','2026','10 - Mar','2026','10 - Mar','27820.3035773872','7640.56486646241','114394.537180675','14.972','81142.7988818308','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RET21000E79C004','2026','10 - Mar','2026','10 - Mar','27820.3035773872','7640.56486646241','114394.537180675','14.972','81142.7988818308','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RET21000A69C004','2026','10 - Mar','2026','10 - Mar','27820.3035773872','7640.56486646241','114394.537180675','14.972','81142.7988818308','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RET04000G18C004','2026','10 - Mar','2026','10 - Mar','4532.84124725418','19101.412166156','35385.366037804','1.8525','26550.9629109569','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RET04000DF9C004','2026','10 - Mar','2026','10 - Mar','4532.84124725418','19101.412166156','39196.0977649522','2.052','29989.217100865','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RET04000BH9C004','2026','10 - Mar','2026','10 - Mar','4532.84124725418','19101.412166156','39196.0977649522','2.052','29989.217100865','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RET04000A69C004','2026','10 - Mar','2026','10 - Mar','4532.84124725418','19101.412166156','39196.0977649522','2.052','29989.217100865','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RET04000E79C004','2026','10 - Mar','2026','10 - Mar','4532.84124725418','19101.412166156','39196.0977649522','2.052','29989.217100865','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RET04000A69C004','2026','10 - Mar','2026','10 - Mar','4532.84124725418','19101.412166156','39196.0977649522','2.052','29989.217100865','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RET04000C39C004','2026','10 - Mar','2026','10 - Mar','4532.84124725418','19101.412166156','39196.0977649522','2.052','29989.217100865','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RET08000G18C004','2026','10 - Mar','2026','10 - Mar','9397.89478574876','22921.6945993872','47253.0734166368','2.0615','35987.0605210379','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RET08000DF9C004','2026','10 - Mar','2026','10 - Mar','9397.89478574876','22921.6945993872','57705.3661539573','2.5175','45843.3891987745','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RET08000BH9C004','2026','10 - Mar','2026','10 - Mar','9397.89478574876','22921.6945993872','57705.3661539573','2.5175','45843.3891987745','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RET08000C39C004','2026','10 - Mar','2026','10 - Mar','9397.89478574876','22921.6945993872','57705.3661539573','2.5175','45843.3891987745','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RET08000E79C004','2026','10 - Mar','2026','10 - Mar','9397.89478574876','22921.6945993872','57705.3661539573','2.5175','45843.3891987745','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RET08000A69C004','2026','10 - Mar','2026','10 - Mar','9397.89478574876','22921.6945993872','57705.3661539573','2.5175','45843.3891987745','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RET08000C39C004','2026','10 - Mar','2026','10 - Mar','9397.89478574876','22921.6945993872','57705.3661539573','2.5175','45843.3891987745','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','REC10000000C0024','2026','10 - Mar','2026','10 - Mar','5867.95381744313','24449.8075726797','16955.9415516534','0.6935','11735.9076348863','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','REC12000000C0024','2026','10 - Mar','2026','10 - Mar','6395.15279322904','20629.5251394485','17246.2830165789','0.836','11965.1245808801','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','REC06000000C0024','2026','10 - Mar','2026','10 - Mar','4584.33891987744','45843.3891987745','20033.5610798644','0.437','13753.0167596323','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','REC08000000C0024','2026','10 - Mar','2026','10 - Mar','5883.23494717606','42023.1067655432','22356.292799269','0.532','15548.549503251','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','REQ10000G18C004','2026','10 - Mar','2026','10 - Mar','12769.3344617566','11460.8472996936','33580.2825881023','2.93','23953.1708563596','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RES12000G18C004','2026','10 - Mar','2026','10 - Mar','36510.8951161156','38202.824332312','146698.845436078','3.84','118428.755430167','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RES16000G18C002','2026','10 - Mar','2026','10 - Mar','45007.4879468441','19865.4686528023','138263.661823504','6.96','112637.207261389','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','REW16000G18C004','2026','10 - Mar','2026','10 - Mar','12044.1448861578','16045.1862195711','51023.692178236','3.18','40754.7729977105','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RES20000G18C004','2026','10 - Mar','2026','10 - Mar','50089.8932272404','8404.62135310865','123716.026317759','14.72','77238.4702350685','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RES24000G18C004','2026','10 - Mar','2026','10 - Mar','11362.7018402858','5042.77281186519','38526.78428265','7.64','25718.1413405125','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','REU08000G18C004','2026','10 - Mar','2026','10 - Mar','9942.55727787445','7640.56486646241','47829.9360640547','6.26','22386.8550587349','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','REQ06000G18C004','2026','10 - Mar','2026','10 - Mar','10197.6304214227','30562.2594658496','59902.0285530653','1.96','44620.8988201405','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RES08000G18C004','2026','10 - Mar','2026','10 - Mar','23144.3650371431','55776.1235251756','90357.3201107845','1.62','83106.4240525116','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RET12000G18C004','2026','11 - Apr','2026','11 - Apr','21531.6294816294','15895.0788566269','66894.4393681145','4.2085','53089.563381134','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RET12000BH9C004','2026','11 - Apr','2026','11 - Apr','21531.6294816294','15895.0788566269','84863.8260155313','5.339','69461.4946034598','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RET12000E79C004','2026','11 - Apr','2026','11 - Apr','21531.6294816294','15895.0788566269','84863.8260155313','5.339','69461.4946034598','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RET12000A69C004','2026','11 - Apr','2026','11 - Apr','21531.6294816294','15895.0788566269','84863.8260155313','5.339','69461.4946034598','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RET16000G18C004','2026','11 - Apr','2026','11 - Apr','11322.8083592856','5277.16618040015','38903.2690819099','7.372','27124.6341672568','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RET16000BH9C004','2026','11 - Apr','2026','11 - Apr','11322.8083592856','5277.16618040015','44267.5085042866','8.3885','31451.9104351849','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RET16000E79C004','2026','11 - Apr','2026','11 - Apr','11322.8083592856','5277.16618040015','44267.5085042866','8.3885','31451.9104351849','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RET16000A69C004','2026','11 - Apr','2026','11 - Apr','11322.8083592856','5277.16618040015','44267.5085042866','8.3885','31451.9104351849','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RET21000G18C004','2026','11 - Apr','2026','11 - Apr','23150.430728958','6358.03154265078','72541.9608858741','11.4095','49783.3869789556','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RET21000BH9C004','2026','11 - Apr','2026','11 - Apr','23150.430728958','6358.03154265078','95192.4482565675','14.972','67522.2949829513','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RET21000E79C004','2026','11 - Apr','2026','11 - Apr','23150.430728958','6358.03154265078','95192.4482565675','14.972','67522.2949829513','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RET21000A69C004','2026','11 - Apr','2026','11 - Apr','23150.430728958','6358.03154265078','95192.4482565675','14.972','67522.2949829513','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RET04000G18C004','2026','11 - Apr','2026','11 - Apr','3771.96557212323','15895.0788566269','29445.6335819014','1.8525','22094.1596107115','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RET04000DF9C004','2026','11 - Apr','2026','11 - Apr','3771.96557212323','15895.0788566269','32616.7018137985','2.052','24955.2738049043','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RET04000BH9C004','2026','11 - Apr','2026','11 - Apr','3771.96557212323','15895.0788566269','32616.7018137985','2.052','24955.2738049043','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RET04000A69C004','2026','11 - Apr','2026','11 - Apr','3771.96557212323','15895.0788566269','32616.7018137985','2.052','24955.2738049043','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RET04000E79C004','2026','11 - Apr','2026','11 - Apr','3771.96557212323','15895.0788566269','32616.7018137985','2.052','24955.2738049043','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RET04000A69C004','2026','11 - Apr','2026','11 - Apr','3771.96557212323','15895.0788566269','32616.7018137985','2.052','24955.2738049043','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RET04000C39C004','2026','11 - Apr','2026','11 - Apr','3771.96557212323','15895.0788566269','32616.7018137985','2.052','24955.2738049043','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RET08000G18C004','2026','11 - Apr','2026','11 - Apr','7820.37879746046','19074.0946279523','39321.2460755237','2.0615','29946.3285658852','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RET08000DF9C004','2026','11 - Apr','2026','11 - Apr','7820.37879746046','19074.0946279523','48019.03322587','2.5175','38148.1892559047','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RET08000BH9C004','2026','11 - Apr','2026','11 - Apr','7820.37879746046','19074.0946279523','48019.03322587','2.5175','38148.1892559047','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RET08000C39C004','2026','11 - Apr','2026','11 - Apr','7820.37879746046','19074.0946279523','48019.03322587','2.5175','38148.1892559047','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RET08000E79C004','2026','11 - Apr','2026','11 - Apr','7820.37879746046','19074.0946279523','48019.03322587','2.5175','38148.1892559047','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RET08000A69C004','2026','11 - Apr','2026','11 - Apr','7820.37879746046','19074.0946279523','48019.03322587','2.5175','38148.1892559047','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RET08000C39C004','2026','11 - Apr','2026','11 - Apr','7820.37879746046','19074.0946279523','48019.03322587','2.5175','38148.1892559047','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','REC10000000C0024','2026','11 - Apr','2026','11 - Apr','4882.9682247558','20345.7009364825','14109.7435994506','0.6935','9765.9364495116','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','REC12000000C0024','2026','11 - Apr','2026','11 - Apr','5321.6724011987','17166.6851651571','14351.3487980713','0.836','9956.67739579112','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','REC06000000C0024','2026','11 - Apr','2026','11 - Apr','3814.81892559047','38148.1892559047','16670.7587048303','0.437','11444.4567767714','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','REC08000000C0024','2026','11 - Apr','2026','11 - Apr','4895.6842878411','34969.1734845793','18603.6002937962','0.532','12938.5941892943','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','REQ10000G18C004','2026','11 - Apr','2026','11 - Apr','10625.8938580409','9537.04731397617','27943.5486299502','2.93','19932.4288862102','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RES12000G18C004','2026','11 - Apr','2026','11 - Apr','30382.2331013279','31790.1577132539','122074.205618895','3.84','98549.4889110871','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RES16000G18C002','2026','11 - Apr','2026','11 - Apr','37452.6010868096','16530.882010892','115054.938795808','6.96','93730.1010017578','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','REW16000G18C004','2026','11 - Apr','2026','11 - Apr','10022.433475642','13351.8662395666','42458.9346418219','3.18','33913.7402484992','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RES20000G18C004','2026','11 - Apr','2026','11 - Apr','41681.8817290216','6993.83469691586','102949.246738601','14.72','64273.3408646567','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RES24000G18C004','2026','11 - Apr','2026','11 - Apr','9455.37639859378','4196.30081814951','32059.7382506623','7.64','21401.1341725625','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','REU08000G18C004','2026','11 - Apr','2026','11 - Apr','8273.61509157719','6358.03154265078','39801.2774569939','6.26','18629.0324199668','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','REQ06000G18C004','2026','11 - Apr','2026','11 - Apr','8485.87205434197','25432.1261706031','49846.9672943821','1.96','37130.9042090805','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RES08000G18C004','2026','11 - Apr','2026','11 - Apr','19259.3879526753','46413.6302613507','75190.0810233881','1.62','69156.3090894125','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text))
|
||||
) as x("account","shipgrp","chan","dsm","director","lu","part","oseas","omon","sseas","smon","lbs","qty","sales_usd","hist_price","cost_curstd_usd","shiplbs","floor","ceiling","uselimits","price","avgprice","pltq","guid","lowest_last","lowest_floor")
|
||||
)
|
||||
,log AS (
|
||||
INSERT INTO rlarp.osm_log (doc) SELECT jsonb_build_object('user',current_user,'tag','Target','type','Target','stamp',current_timestamp,'source','top level','message','Target') RETURNING *
|
||||
)
|
||||
,final AS (
|
||||
SELECT
|
||||
sg.fspr
|
||||
,'152' plnt
|
||||
,'NONE' promo
|
||||
,null::text terms
|
||||
,account
|
||||
,shipgrp
|
||||
,dsm
|
||||
,dsm
|
||||
,director
|
||||
,account
|
||||
,shipgrp
|
||||
,'DIR' chan
|
||||
,'DIR' chansub
|
||||
,'National' chan_retail
|
||||
,part
|
||||
,part
|
||||
,part
|
||||
,'LABELED' branding
|
||||
,'110'
|
||||
,'C10'
|
||||
,'111'
|
||||
,'A01'
|
||||
,'Retail' segm
|
||||
,'Plastic' substance
|
||||
,'41010' fs_line
|
||||
,'US' r_currency
|
||||
,1 r_rate
|
||||
,'US' c_currency
|
||||
,1 c_rate
|
||||
,qty units
|
||||
,sales_usd value_loc
|
||||
,sales_usd value_usd
|
||||
,cost_curstd_usd cost_loc
|
||||
,cost_curstd_usd cost_usd
|
||||
,'SHIPPED' calc_status
|
||||
,'COMPLETE' flag
|
||||
,og.sdat order_date
|
||||
,omon order_month
|
||||
,og.ssyr order_season
|
||||
,sg.sdat request_date
|
||||
,smon request_month
|
||||
,sg.ssyr request_season
|
||||
,sg.sdat ship_date
|
||||
,smon ship_month
|
||||
,sg.ssyr ship_season
|
||||
,'b26' version
|
||||
,'Retail' iter
|
||||
,log.id
|
||||
,COALESCE(log.doc->>'tag','') "tag"
|
||||
,log.doc->>'message' "comment"
|
||||
,log.doc->>'type' module
|
||||
,lbs pounds
|
||||
FROM
|
||||
tload t
|
||||
CROSS JOIN log
|
||||
INNER JOIN rlarp.gld og ON
|
||||
og.sortmo = t.omon
|
||||
AND og.ssyr = 2026
|
||||
INNER JOIN rlarp.gld sg ON
|
||||
sg.sortmo = t.smon
|
||||
AND sg.ssyr = 2026
|
||||
)
|
||||
insert into rlarp.osm_pool select * from final
|
||||
613
lbs_schedule/scale_cust.pg.sql
Normal file
613
lbs_schedule/scale_cust.pg.sql
Normal file
@ -0,0 +1,613 @@
|
||||
WITH
|
||||
newc AS (
|
||||
SELECT * FROM (VALUES
|
||||
('4 ACES','10041 - TAMARA RISKEN'),
|
||||
('A&W ANNUALS','10039 - DUSTIN KUYKENDOLL'),
|
||||
('A GARDEN CENTER','30053 - SKYE SAWYER'),
|
||||
('ALASKA GDN & PET SUPPLY RET','30053 - SKYE SAWYER'),
|
||||
('ALASKA MILL AND FEED','30053 - SKYE SAWYER'),
|
||||
('ALPHA NURSERY','30053 - SKYE SAWYER'),
|
||||
('ANDYS GARDENS','10048 - PHILIP BIEDENBACH'),
|
||||
('ARNOLDS GREENHOUSE INC','10041 - TAMARA RISKEN'),
|
||||
('ASHCOMBE FARM & GREENHOUSE','10048 - PHILIP BIEDENBACH'),
|
||||
('AVA NURSERY','10046 - DUSTIN KUYKENDOLL 2'),
|
||||
('BAYSIDE GARDEN CENTER','13027 - STEVE RUSTEBERG'),
|
||||
('BAYVIEW GREENHOUSES','40039 - DAVE BODO'),
|
||||
('BEAUTIFUL LAND PRODUCTS','13027 - STEVE RUSTEBERG'),
|
||||
('BEAVER BARK LTD','30053 - SKYE SAWYER'),
|
||||
('BEDROCK NURSERY','10041 - TAMARA RISKEN'),
|
||||
('BELLE INVESTMENTS','10039 - DUSTIN KUYKENDOLL'),
|
||||
('BLUE HERON FARM','30053 - SKYE SAWYER'),
|
||||
('BOBBY MURRAY FARMS','10041 - TAMARA RISKEN'),
|
||||
('BOEKESTYN GREENHOUSES LTD','40039 - DAVE BODO'),
|
||||
('BREEZY HILL NURSERY','13027 - STEVE RUSTEBERG'),
|
||||
('BRENTANOS TREE FARM','30053 - SKYE SAWYER'),
|
||||
('BRIGGS NURSERY','30053 - SKYE SAWYER'),
|
||||
('CAAN FLORAL CO INC','13027 - STEVE RUSTEBERG'),
|
||||
('CAPOGNA FLOWERS','40039 - DAVE BODO'),
|
||||
('CARPINITO BROTHERS INC','30053 - SKYE SAWYER'),
|
||||
('CHRIS DOYLE PLANT BROKERAGE','10041 - TAMARA RISKEN'),
|
||||
('CINDYS GREENHOUSE','13027 - STEVE RUSTEBERG'),
|
||||
('D''ADDIO FAMILY NURSERY','10048 - PHILIP BIEDENBACH'),
|
||||
('DAHLINGHAUS VENTURES LLC','10048 - PHILIP BIEDENBACH'),
|
||||
('DAYNABROOK GREENHOUSES','10048 - PHILIP BIEDENBACH'),
|
||||
('DESERT FOREST NURSERY','30035 - RODNEY RIOS'),
|
||||
('DESERT HORIZON NURSERY','30035 - RODNEY RIOS'),
|
||||
('DETWEILER''S FLOWERS','10048 - PHILIP BIEDENBACH'),
|
||||
('DGI','10035 - MATTHEW STAAL'),
|
||||
('DOAN''S NURSERY INC.','10041 - TAMARA RISKEN'),
|
||||
('DRY LAND NATIVE GRASSES','10041 - TAMARA RISKEN'),
|
||||
('EDGEWOOD GREENHOUSE','13027 - STEVE RUSTEBERG'),
|
||||
('FERGUSON LANDSCAPE','13027 - STEVE RUSTEBERG'),
|
||||
('FISHER FARMS','30053 - SKYE SAWYER'),
|
||||
('GEORGE''S PLANT FARM','10040 - RYAN CHITWOOD'),
|
||||
('GIESEL''S GREENHOUSE','10041 - TAMARA RISKEN'),
|
||||
('GILSON FAMILY ENTERPRISE','10042 - JEREMY RHAULT'),
|
||||
('GOLD COAST FARMS LLC','30035 - RODNEY RIOS'),
|
||||
('GOLD HILL NURSERY','30053 - SKYE SAWYER'),
|
||||
('GROWERS NURSERY SUPPLY INC','30053 - SKYE SAWYER'),
|
||||
('HEIRLOOM ROSES','30053 - SKYE SAWYER'),
|
||||
('HENRY WHALEN AND SONS GHSE','10043 - CHERISSE GILSTROP'),
|
||||
('HIGHLAND FARMS','12028 - JACOB WILKINSON'),
|
||||
('HILLEN NURSERY LTD','40039 - DAVE BODO'),
|
||||
('HONEYMOON ACRES','13027 - STEVE RUSTEBERG'),
|
||||
('HOSTYN HILL GREENHOUSE','10041 - TAMARA RISKEN'),
|
||||
('HSU''S','13027 - STEVE RUSTEBERG'),
|
||||
('HUIZENGA BRO GREENHOUSE INC','10035 - MATTHEW STAAL'),
|
||||
('I & G FARM INC','10043 - CHERISSE GILSTROP'),
|
||||
('IMPERIAL''S GARDEN INC','30053 - SKYE SAWYER'),
|
||||
('J FRANK GAUDET TREE NURSERY','40040 - TINA PETTIGREW'),
|
||||
('JACOBSONS GREENHOUSE','30053 - SKYE SAWYER'),
|
||||
('JAMPLAST INC','13027 - STEVE RUSTEBERG'),
|
||||
('JEFF PARSLEY PLANT FARM','10041 - TAMARA RISKEN'),
|
||||
('JEFFEREYS GREENHOUSES','40039 - DAVE BODO'),
|
||||
('KATOS NURSERY','40042 - TOM MORRIS'),
|
||||
('KATYDID GREENHOUSE','10040 - RYAN CHITWOOD'),
|
||||
('LANCASTER FARM','10040 - RYAN CHITWOOD'),
|
||||
('LENO PLANT FARM','10041 - TAMARA RISKEN'),
|
||||
('LIMA GREENHOUSES','30053 - SKYE SAWYER'),
|
||||
('LINNAEA NURSERIES LTD','40042 - TOM MORRIS'),
|
||||
('MAGNOLIA GARDENS','10041 - TAMARA RISKEN'),
|
||||
('MARCUMS NURSERY','10041 - TAMARA RISKEN'),
|
||||
('MARTIN''S NURSERY INC','10047 - RYAN CHITWOOD 2'),
|
||||
('MAYS GREENHOUSE','10048 - PHILIP BIEDENBACH'),
|
||||
('MCCALLISTERS LNDSCP SUPPLY','10041 - TAMARA RISKEN'),
|
||||
('MCCALLS NURSERIES INC','30054 - JASON MOTTIN'),
|
||||
('MEADOWLARK ORNAMENTALS LLC','12028 - JACOB WILKINSON'),
|
||||
('MEDARY ACRES GHSE','13027 - STEVE RUSTEBERG'),
|
||||
('MEDFORD NURSERY INC','10043 - CHERISSE GILSTROP'),
|
||||
('MESQUITE VALLEY GROWERS','30035 - RODNEY RIOS'),
|
||||
('MILLERS BLUE MOUNTAIN GHSE','10043 - CHERISSE GILSTROP'),
|
||||
('MR GREENJEANS FARM MARKET','10043 - CHERISSE GILSTROP'),
|
||||
('MULTIFAB, INC','30053 - SKYE SAWYER'),
|
||||
('NATURALLY BEAUTIFUL PLANT PROD','10043 - CHERISSE GILSTROP'),
|
||||
('NORTHWEST PLANT COMPANY','30053 - SKYE SAWYER'),
|
||||
('OSO GROWERS INC.','10041 - TAMARA RISKEN'),
|
||||
('PARSLEYS PLANT FARM','10041 - TAMARA RISKEN'),
|
||||
('PAYNES NURSERIES & GREENHOUSE','12028 - JACOB WILKINSON'),
|
||||
('PHELPS NURSERY','10048 - PHILIP BIEDENBACH'),
|
||||
('PINE VIEW FARM','10048 - PHILIP BIEDENBACH'),
|
||||
('QUALITREE PROPAGATORS','40042 - TOM MORRIS'),
|
||||
('RAZBUTON INC','10039 - DUSTIN KUYKENDOLL'),
|
||||
('REARDON NURSERY','30053 - SKYE SAWYER'),
|
||||
('SCHROCK SALES','10048 - PHILIP BIEDENBACH'),
|
||||
('SHANER AVENUE NURSERY','10035 - MATTHEW STAAL'),
|
||||
('SHERMAN PLASTICS','13027 - STEVE RUSTEBERG'),
|
||||
('SLC STORE','12028 - JACOB WILKINSON'),
|
||||
('SMITH NURSERY','10041 - TAMARA RISKEN'),
|
||||
('STARLING NURSERY','10046 - DUSTIN KUYKENDOLL 2'),
|
||||
('STEUBER GREENHOUSE','13027 - STEVE RUSTEBERG'),
|
||||
('STEWARTS GREENHOUSE','10046 - DUSTIN KUYKENDOLL 2'),
|
||||
('STOKLEY NURSERY','10047 - RYAN CHITWOOD 2'),
|
||||
('SUAREZ PLANT FARM','10041 - TAMARA RISKEN'),
|
||||
('SUN NURSERIES','10043 - CHERISSE GILSTROP'),
|
||||
('SUNLAND NURSERY','12028 - JACOB WILKINSON'),
|
||||
('SUNRISE GREENHOUSES','40039 - DAVE BODO'),
|
||||
('TEJANA NURSERY','10041 - TAMARA RISKEN'),
|
||||
('THOMAS BECNEL','10041 - TAMARA RISKEN'),
|
||||
('THOMAS BECNEL CITRUS','10041 - TAMARA RISKEN'),
|
||||
('TOM DE SANTO GREENHOUSES','30053 - SKYE SAWYER'),
|
||||
('TONYS GARDEN CENTER','30053 - SKYE SAWYER'),
|
||||
('TREESEARCH FARMS INC','10041 - TAMARA RISKEN'),
|
||||
('UNITED CENTRAL ORCHIDS','13027 - STEVE RUSTEBERG'),
|
||||
('VAN BELLE NURSERY','40042 - TOM MORRIS'),
|
||||
('VAN KLAVEREN''S NURSERY LLC','30053 - SKYE SAWYER'),
|
||||
('VARGAS NURSERY','10041 - TAMARA RISKEN'),
|
||||
('WALNUT GROVE NURSERY','40042 - TOM MORRIS'),
|
||||
('WATERTOWN FLORAL','13027 - STEVE RUSTEBERG'),
|
||||
('WAYFAIR LLC','90015 - ANN MARIE FOX'),
|
||||
('WEAKLAND GREENHOUSES','12028 - JACOB WILKINSON'),
|
||||
('WOODS GREENHOUSE','10043 - CHERISSE GILSTROP'),
|
||||
('YC NURSERIES INC','10041 - TAMARA RISKEN'),
|
||||
('A&R SPADA FARMS LLC','30053 - SKYE SAWYER'),
|
||||
('CI FARMS LLC','30054 - JASON MOTTIN'),
|
||||
('GOLDEN EAGLE TREES','40042 - TOM MORRIS'),
|
||||
('TSC NURSERY SALES LTD','40042 - TOM MORRIS')
|
||||
) x(Renamed,ReRep)
|
||||
)
|
||||
,profile AS (
|
||||
SELECT * FROM rlarp.osm WHERE shipgrp IN (select distinct renamed FROM newc ) AND oseas >= 2018
|
||||
)
|
||||
-- SELECT * FROM profile
|
||||
,checkc AS (
|
||||
SELECT shipgrp, min(oseas) oseas FROM profile GROUP BY shipgrp
|
||||
)
|
||||
-- select * from checkc
|
||||
-- SELECT cust, sum(fb_qty) FROM newc LEFT OUTER JOIN profile ON shipgrp = cust GROUP by cust
|
||||
----grouped prices-------------
|
||||
,npgrp AS (
|
||||
SELECT
|
||||
o.bill_dba
|
||||
,o.ship_dba
|
||||
,o.dsm
|
||||
,i.partgroup
|
||||
,i.pricegroup
|
||||
,o.part
|
||||
,o.odate
|
||||
,o.qtyord
|
||||
,i.nwht * CASE WHEN i.nwun = 'KG' THEN 2.2 ELSE 1 END lbs
|
||||
,i.mpck pltq
|
||||
,ROUND(o.sales_usd / o.qty,5) price
|
||||
,(o.pricing->>'guidance_price')::NUMERIC guidance
|
||||
,(o.pricing->>'floor' )::numeric(15,5) floor
|
||||
,(o.pricing->>'ceiling')::numeric(15,5) ceiling
|
||||
,(o.pricing->>'uselimits')::boolean uselimits
|
||||
FROM
|
||||
rlarp.osm_stack o
|
||||
LEFT OUTER JOIN "CMS.CUSLG".itemm i ON
|
||||
i.item = o.part
|
||||
INNER JOIN checkc c ON
|
||||
c.shipgrp = o.customer
|
||||
AND c.oseas = o.oseas
|
||||
WHERE
|
||||
VERSION = 'Actual'
|
||||
AND o.oseas >= 2018
|
||||
AND calc_status <> 'CANCELED'
|
||||
AND o.fs_line = '41010'
|
||||
AND o.part <> ''
|
||||
AND substring(o.glec,1,1) <= '2'
|
||||
AND o.qty <> 0
|
||||
AND o.sseas IS NOT NULL
|
||||
-- AND customer in (select distinct renamed FROM newc )
|
||||
GROUP BY
|
||||
o.bill_dba
|
||||
,o.ship_dba
|
||||
,o.dsm
|
||||
,i.partgroup
|
||||
,i.pricegroup
|
||||
,o.part
|
||||
,o.odate
|
||||
,o.qtyord
|
||||
,o.pounds
|
||||
,o.pallets
|
||||
,ROUND(o.sales_usd / o.qty,5)
|
||||
,i.nwht * CASE WHEN i.nwun = 'KG' THEN 2.2 ELSE 1 END
|
||||
,i.mpck
|
||||
,(o.pricing->>'guidance_price')::NUMERIC
|
||||
,(o.pricing->>'floor' )::numeric(15,5)
|
||||
,(o.pricing->>'ceiling')::numeric(15,5)
|
||||
,(o.pricing->>'uselimits')::boolean
|
||||
)
|
||||
----sequenced for most recent price------------
|
||||
,nseq AS (
|
||||
SELECT
|
||||
bill_dba
|
||||
,ship_dba
|
||||
,part
|
||||
,odate
|
||||
,qtyord
|
||||
,lbs
|
||||
,pltq
|
||||
,price
|
||||
,guidance
|
||||
,floor
|
||||
,ceiling
|
||||
,uselimits
|
||||
,row_number() OVER (PARTITION BY bill_dba, ship_dba, part ORDER BY odate desc) rn
|
||||
,round(avg(price) over (PARTITION BY bill_dba, ship_dba, part),5) avgprice
|
||||
FROM
|
||||
npgrp
|
||||
)
|
||||
-- SELECT * FROM seq WHERE rn = 1
|
||||
,ngrp AS (
|
||||
SELECT
|
||||
o.account
|
||||
,o.shipgrp
|
||||
,o.chan
|
||||
,o.dsm
|
||||
,i.partgroup
|
||||
,i.pricegroup
|
||||
,o.part
|
||||
,o.glec
|
||||
,o.oseas
|
||||
-- ,o.odate
|
||||
,og.sortmo omon
|
||||
,o.sseas
|
||||
-- ,o.sdate
|
||||
,sg.sortmo smon
|
||||
-- ,o.calc_status
|
||||
,ROUND(sum(fb_qty * lbs),5) lbs
|
||||
,ROUND(sum(fb_qty),2) qty
|
||||
,ROUND(sum(fb_val_loc * r_rate),2) sales_usd
|
||||
,ROUND(sum(fb_cst_loc_cur * c_rate),2) cost_curstd_usd
|
||||
FROM
|
||||
profile o
|
||||
LEFT OUTER JOIN rlarp.gld og ON
|
||||
o.odate BETWEEN og.sdat and og.edat
|
||||
LEFT OUTER JOIN rlarp.gld sg ON
|
||||
o.sdate BETWEEN sg.sdat and sg.edat
|
||||
LEFT OUTER JOIN "CMS.CUSLG".itemm i ON
|
||||
i.item = o.part
|
||||
WHERE
|
||||
true
|
||||
-- iter IN ('actuals','actuals_plug','copy')
|
||||
AND fs_line = '41010'
|
||||
AND substring(o.glec,1,1) <= '2'
|
||||
AND o.calc_status <> 'CANCELED'
|
||||
AND o.sseas IS NOT NULL
|
||||
GROUP BY
|
||||
o.account
|
||||
,o.shipgrp
|
||||
,o.chan
|
||||
,o.dsm
|
||||
,i.partgroup
|
||||
,i.pricegroup
|
||||
,o.part
|
||||
,o.glec
|
||||
,o.oseas
|
||||
-- ,o.odate
|
||||
,og.sortmo
|
||||
,o.sseas
|
||||
-- ,o.sdate
|
||||
,sg.sortmo
|
||||
-- ,o.calc_status
|
||||
)
|
||||
-- SELECT * FROM grp
|
||||
,nguid AS (
|
||||
SELECT
|
||||
grp.account
|
||||
,grp.shipgrp
|
||||
,grp.chan
|
||||
,r.repp dsm
|
||||
,r.director
|
||||
,grp.shipgrp||'.'||r.repp lu
|
||||
-- ,grp.partgroup
|
||||
-- ,grp.pricegroup
|
||||
,grp.part
|
||||
-- ,grp.glec
|
||||
,2026 oseas
|
||||
,grp.omon
|
||||
-- ,grp.odate
|
||||
,(2026- grp.oseas) + grp.sseas sseas
|
||||
,grp.smon
|
||||
-- ,grp.sdate
|
||||
,grp.lbs
|
||||
,grp.qty
|
||||
,grp.sales_usd
|
||||
,CASE WHEN round(grp.sales_usd/grp.qty,5) = 0 THEN null ELSE round(grp.sales_usd/grp.qty,5) END hist_price
|
||||
,grp.cost_curstd_usd
|
||||
,sum(grp.lbs) OVER (PARTITION BY shipgrp, dsm) shiplbs
|
||||
,CASE WHEN seq.floor = 0 THEN null else seq.floor END floor
|
||||
,CASE WHEN seq.ceiling = 0 THEN null else seq.ceiling END ceiling
|
||||
,seq.uselimits
|
||||
,seq.price
|
||||
,seq.avgprice
|
||||
,seq.pltq
|
||||
,ROUND(CASE WHEN seq.uselimits THEN
|
||||
CASE
|
||||
WHEN glec = '1NU' THEN
|
||||
--if more than 8/24 pallets, use floor
|
||||
CASE WHEN grp.qty >= 24*seq.pltq THEN seq.floor
|
||||
-- if more than a pallet use the target price
|
||||
ELSE CASE WHEN qtyord >= 8*seq.pltq THEN (seq.ceiling + seq.floor) / 2
|
||||
-- if more than a pallet use the target price
|
||||
ELSE CASE WHEN qtyord >= 2*seq.pltq THEN seq.ceiling
|
||||
-- if more than a pallet use the target price
|
||||
ELSE seq.ceiling * 1.05
|
||||
END END END
|
||||
ELSE
|
||||
CASE WHEN pricegroup ~ '(Hanger|Dish)' THEN
|
||||
--at least 1 pallets is lower limit
|
||||
CASE WHEN qtyord >= 01*seq.pltq THEN seq.floor
|
||||
--at least 2 pallets is mid range
|
||||
ELSE CASE WHEN qtyord >= 0.5*seq.pltq THEN (seq.ceiling + seq.floor) / 2
|
||||
--less than a pallet is upper + 15%
|
||||
ELSE seq.ceiling
|
||||
END END
|
||||
ELSE
|
||||
--at least 8 pallets is lower limit
|
||||
CASE WHEN qtyord >= 08*seq.pltq THEN seq.floor
|
||||
--at least 2 pallets is mid range
|
||||
ELSE CASE WHEN qtyord >= 2*seq.pltq THEN (seq.ceiling + seq.floor) / 2
|
||||
--at least 1 pallet is upper range
|
||||
ELSE CASE WHEN qtyord >= 1*seq.pltq THEN seq.ceiling
|
||||
--less than a pallet is upper + 15%
|
||||
ELSE seq.ceiling * 1.15
|
||||
END END END
|
||||
END
|
||||
END
|
||||
ELSE
|
||||
null
|
||||
END,5) guid
|
||||
FROM
|
||||
ngrp grp
|
||||
LEFT OUTER JOIN nseq seq ON
|
||||
seq.ship_dba = grp.shipgrp
|
||||
AND seq.bill_dba = grp.account
|
||||
AND seq.part = grp.part
|
||||
AND seq.rn = 1
|
||||
LEFT OUTER JOIN rlarp.repc r ON
|
||||
r.rcode = grp.dsm
|
||||
)
|
||||
,orphans AS (
|
||||
SELECT
|
||||
account
|
||||
,shipgrp
|
||||
,chan
|
||||
,dsm
|
||||
,director
|
||||
,lu
|
||||
--,partgroup
|
||||
--,pricegroup
|
||||
,part
|
||||
-- ,glec
|
||||
,oseas
|
||||
,omon
|
||||
-- ,odate
|
||||
,sseas
|
||||
,smon
|
||||
-- ,sdate
|
||||
,lbs
|
||||
,qty
|
||||
,sales_usd
|
||||
,hist_price
|
||||
,cost_curstd_usd
|
||||
,shiplbs
|
||||
,floor
|
||||
,ceiling
|
||||
,uselimits
|
||||
,price
|
||||
,avgprice
|
||||
,pltq
|
||||
,guid
|
||||
,least(hist_price, price, avgprice) lowest_last
|
||||
,least(hist_price, price, avgprice, floor) lowest_floor
|
||||
FROM
|
||||
nguid
|
||||
)
|
||||
----grouped prices-------------
|
||||
,pgrp AS (
|
||||
SELECT
|
||||
o.bill_dba
|
||||
,o.ship_dba
|
||||
,o.dsm
|
||||
,i.partgroup
|
||||
,i.pricegroup
|
||||
,o.part
|
||||
,o.odate
|
||||
,o.qtyord
|
||||
,i.nwht * CASE WHEN i.nwun = 'KG' THEN 2.2 ELSE 1 END lbs
|
||||
,i.mpck pltq
|
||||
,ROUND(o.sales_usd / o.qty,5) price
|
||||
,(o.pricing->>'guidance_price')::NUMERIC guidance
|
||||
,(o.pricing->>'floor' )::numeric(15,5) floor
|
||||
,(o.pricing->>'ceiling')::numeric(15,5) ceiling
|
||||
,(o.pricing->>'uselimits')::boolean uselimits
|
||||
FROM
|
||||
rlarp.osm_stack o
|
||||
LEFT OUTER JOIN "CMS.CUSLG".itemm i ON
|
||||
i.item = o.part
|
||||
WHERE
|
||||
VERSION = 'Actual'
|
||||
AND oseas >= 2025
|
||||
AND calc_status <> 'CANCELED'
|
||||
AND o.fs_line = '41010'
|
||||
AND o.part <> ''
|
||||
AND substring(o.glec,1,1) <= '2'
|
||||
AND o.qty <> 0
|
||||
GROUP BY
|
||||
o.bill_dba
|
||||
,o.ship_dba
|
||||
,o.dsm
|
||||
,i.partgroup
|
||||
,i.pricegroup
|
||||
,o.part
|
||||
,o.odate
|
||||
,o.qtyord
|
||||
,o.pounds
|
||||
,o.pallets
|
||||
,ROUND(o.sales_usd / o.qty,5)
|
||||
,i.nwht * CASE WHEN i.nwun = 'KG' THEN 2.2 ELSE 1 END
|
||||
,i.mpck
|
||||
,(o.pricing->>'guidance_price')::NUMERIC
|
||||
,(o.pricing->>'floor' )::numeric(15,5)
|
||||
,(o.pricing->>'ceiling')::numeric(15,5)
|
||||
,(o.pricing->>'uselimits')::boolean
|
||||
)
|
||||
----sequenced for most recent price------------
|
||||
,seq AS (
|
||||
SELECT
|
||||
bill_dba
|
||||
,ship_dba
|
||||
,part
|
||||
,odate
|
||||
,qtyord
|
||||
,lbs
|
||||
,pltq
|
||||
,price
|
||||
,guidance
|
||||
,floor
|
||||
,ceiling
|
||||
,uselimits
|
||||
,row_number() OVER (PARTITION BY bill_dba, ship_dba, part ORDER BY odate desc) rn
|
||||
,round(avg(price) over (PARTITION BY bill_dba, ship_dba, part),5) avgprice
|
||||
FROM
|
||||
pgrp
|
||||
)
|
||||
-- SELECT * FROM seq WHERE rn = 1
|
||||
,grp AS (
|
||||
SELECT
|
||||
o.account
|
||||
,o.shipgrp
|
||||
,o.chan
|
||||
,o.dsm
|
||||
,i.partgroup
|
||||
,i.pricegroup
|
||||
,o.part
|
||||
,o.glec
|
||||
,o.oseas
|
||||
-- ,o.odate
|
||||
,og.sortmo omon
|
||||
,o.sseas
|
||||
-- ,o.sdate
|
||||
,sg.sortmo smon
|
||||
-- ,o.calc_status
|
||||
,ROUND(sum(fb_qty * lbs),5) lbs
|
||||
,ROUND(sum(fb_qty),2) qty
|
||||
,ROUND(sum(fb_val_loc * r_rate),2) sales_usd
|
||||
,ROUND(sum(fb_cst_loc_cur * c_rate),2) cost_curstd_usd
|
||||
FROM
|
||||
rlarp.osmf o
|
||||
LEFT OUTER JOIN rlarp.gld og ON
|
||||
o.odate BETWEEN og.sdat and og.edat
|
||||
LEFT OUTER JOIN rlarp.gld sg ON
|
||||
o.sdate BETWEEN sg.sdat and sg.edat
|
||||
LEFT OUTER JOIN "CMS.CUSLG".itemm i ON
|
||||
i.item = o.part
|
||||
WHERE
|
||||
iter IN ('actuals','actuals_plug','copy')
|
||||
AND fs_line = '41010'
|
||||
AND substring(o.glec,1,1) <= '2'
|
||||
GROUP BY
|
||||
o.account
|
||||
,o.shipgrp
|
||||
,o.chan
|
||||
,o.dsm
|
||||
,i.partgroup
|
||||
,i.pricegroup
|
||||
,o.part
|
||||
,o.glec
|
||||
,o.oseas
|
||||
-- ,o.odate
|
||||
,og.sortmo
|
||||
,o.sseas
|
||||
-- ,o.sdate
|
||||
,sg.sortmo
|
||||
-- ,o.calc_status
|
||||
)
|
||||
,guid AS (
|
||||
SELECT
|
||||
grp.account
|
||||
,grp.shipgrp
|
||||
,grp.chan
|
||||
,grp.dsm
|
||||
,r.director
|
||||
,grp.shipgrp||'.'||grp.dsm lu
|
||||
-- ,grp.partgroup
|
||||
-- ,grp.pricegroup
|
||||
,grp.part
|
||||
-- ,grp.glec
|
||||
,grp.oseas
|
||||
,grp.omon
|
||||
-- ,grp.odate
|
||||
,grp.sseas
|
||||
,grp.smon
|
||||
-- ,grp.sdate
|
||||
,grp.lbs
|
||||
,grp.qty
|
||||
,grp.sales_usd
|
||||
,CASE WHEN round(grp.sales_usd/grp.qty,5) = 0 THEN null ELSE round(grp.sales_usd/grp.qty,5) END hist_price
|
||||
,grp.cost_curstd_usd
|
||||
,sum(grp.lbs) OVER (PARTITION BY shipgrp, oseas, dsm) shiplbs
|
||||
,CASE WHEN seq.floor = 0 THEN null else seq.floor END floor
|
||||
,CASE WHEN seq.ceiling = 0 THEN null else seq.ceiling END ceiling
|
||||
,seq.uselimits
|
||||
,seq.price
|
||||
,seq.avgprice
|
||||
,seq.pltq
|
||||
,ROUND(CASE WHEN seq.uselimits THEN
|
||||
CASE
|
||||
WHEN glec = '1NU' THEN
|
||||
--if more than 8/24 pallets, use floor
|
||||
CASE WHEN grp.qty >= 24*seq.pltq THEN seq.floor
|
||||
-- if more than a pallet use the target price
|
||||
ELSE CASE WHEN qtyord >= 8*seq.pltq THEN (seq.ceiling + seq.floor) / 2
|
||||
-- if more than a pallet use the target price
|
||||
ELSE CASE WHEN qtyord >= 2*seq.pltq THEN seq.ceiling
|
||||
-- if more than a pallet use the target price
|
||||
ELSE seq.ceiling * 1.05
|
||||
END END END
|
||||
ELSE
|
||||
CASE WHEN pricegroup ~ '(Hanger|Dish)' THEN
|
||||
--at least 1 pallets is lower limit
|
||||
CASE WHEN qtyord >= 01*seq.pltq THEN seq.floor
|
||||
--at least 2 pallets is mid range
|
||||
ELSE CASE WHEN qtyord >= 0.5*seq.pltq THEN (seq.ceiling + seq.floor) / 2
|
||||
--less than a pallet is upper + 15%
|
||||
ELSE seq.ceiling
|
||||
END END
|
||||
ELSE
|
||||
--at least 8 pallets is lower limit
|
||||
CASE WHEN qtyord >= 08*seq.pltq THEN seq.floor
|
||||
--at least 2 pallets is mid range
|
||||
ELSE CASE WHEN qtyord >= 2*seq.pltq THEN (seq.ceiling + seq.floor) / 2
|
||||
--at least 1 pallet is upper range
|
||||
ELSE CASE WHEN qtyord >= 1*seq.pltq THEN seq.ceiling
|
||||
--less than a pallet is upper + 15%
|
||||
ELSE seq.ceiling * 1.15
|
||||
END END END
|
||||
END
|
||||
END
|
||||
ELSE
|
||||
null
|
||||
END,5) guid
|
||||
FROM
|
||||
grp
|
||||
LEFT OUTER JOIN seq ON
|
||||
seq.ship_dba = grp.shipgrp
|
||||
AND seq.bill_dba = grp.account
|
||||
AND seq.part = grp.part
|
||||
AND seq.rn = 1
|
||||
LEFT OUTER JOIN rlarp.repc r ON
|
||||
r.repp = grp.dsm
|
||||
)
|
||||
,baseline AS (
|
||||
SELECT
|
||||
account
|
||||
,shipgrp
|
||||
,chan
|
||||
,dsm
|
||||
,director
|
||||
,lu
|
||||
--,partgroup
|
||||
--,pricegroup
|
||||
,part
|
||||
-- ,glec
|
||||
,oseas
|
||||
,omon
|
||||
-- ,odate
|
||||
,sseas
|
||||
,smon
|
||||
-- ,sdate
|
||||
,lbs
|
||||
,qty
|
||||
,sales_usd
|
||||
,hist_price
|
||||
,cost_curstd_usd
|
||||
,shiplbs
|
||||
,floor
|
||||
,ceiling
|
||||
,uselimits
|
||||
,price
|
||||
,avgprice
|
||||
,pltq
|
||||
,guid
|
||||
,least(hist_price, price, avgprice) lowest_last
|
||||
,least(hist_price, price, avgprice, floor) lowest_floor
|
||||
FROM
|
||||
guid
|
||||
)
|
||||
SELECT * FROM baseline
|
||||
UNION ALL
|
||||
SELECT * FROM orphans
|
||||
|
||||
263
lbs_schedule/target.pg.sql
Normal file
263
lbs_schedule/target.pg.sql
Normal file
@ -0,0 +1,263 @@
|
||||
SELECT
|
||||
account
|
||||
,shipgrp
|
||||
,chan
|
||||
,dsm
|
||||
,director
|
||||
,lu
|
||||
,part
|
||||
,oseas::int oseas
|
||||
,omon
|
||||
,sseas::int sseas
|
||||
,smon
|
||||
,lbs::numeric lbs
|
||||
,qty::numeric qty
|
||||
,sales_usd::numeric sales_usd
|
||||
,hist_price::numeric hist_price
|
||||
,cost_curstd_usd::numeric cost_curstd_usd
|
||||
,shiplbs::numeric shiplbs
|
||||
,floor::numeric floor
|
||||
,ceiling::numeric ceiling
|
||||
,uselimits::numeric uselimits
|
||||
,price::numeric price
|
||||
,avgprice::numeric avgprice
|
||||
,pltq
|
||||
,guid::numeric guid
|
||||
,lowest_last::numeric lowest_last
|
||||
,lowest_floor::numeric lowest_floor
|
||||
FROM (VALUES
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RET12000G18C004','2026','06 - Nov','2026','06 - Nov','28735.2896693825','21212.9646598529','89274.761770991','4.2085','70851.3019639087','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RET12000BH9C004','2026','06 - Nov','2026','06 - Nov','28735.2896693825','21212.9646598529','113256.018318955','5.339','92700.6555635572','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RET12000E79C004','2026','06 - Nov','2026','06 - Nov','28735.2896693825','21212.9646598529','113256.018318955','5.339','92700.6555635572','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RET12000A69C004','2026','06 - Nov','2026','06 - Nov','28735.2896693825','21212.9646598529','113256.018318955','5.339','92700.6555635572','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RET16000G18C004','2026','06 - Nov','2026','06 - Nov','15110.9872270733','7042.70426707117','51918.8158568486','7.372','36199.4999327458','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RET16000BH9C004','2026','06 - Nov','2026','06 - Nov','15110.9872270733','7042.70426707117','59077.7247443265','8.3885','41974.5174317442','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RET16000E79C004','2026','06 - Nov','2026','06 - Nov','15110.9872270733','7042.70426707117','59077.7247443265','8.3885','41974.5174317442','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RET16000A69C004','2026','06 - Nov','2026','06 - Nov','15110.9872270733','7042.70426707117','59077.7247443265','8.3885','41974.5174317442','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RET21000G18C004','2026','06 - Nov','2026','06 - Nov','30895.6799361216','8485.18586394117','96811.7281146367','11.4095','66439.0053146593','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RET21000BH9C004','2026','06 - Nov','2026','06 - Nov','30895.6799361216','8485.18586394117','127040.202754927','14.972','90112.6738750552','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RET21000E79C004','2026','06 - Nov','2026','06 - Nov','30895.6799361216','8485.18586394117','127040.202754927','14.972','90112.6738750552','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RET21000A69C004','2026','06 - Nov','2026','06 - Nov','30895.6799361216','8485.18586394117','127040.202754927','14.972','90112.6738750552','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RET04000G18C004','2026','06 - Nov','2026','06 - Nov','5033.92107087739','21212.9646598529','39297.0170323775','1.8525','29486.0208771955','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RET04000DF9C004','2026','06 - Nov','2026','06 - Nov','5033.92107087739','21212.9646598529','43529.0034820182','2.052','33304.3545159691','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RET04000BH9C004','2026','06 - Nov','2026','06 - Nov','5033.92107087739','21212.9646598529','43529.0034820182','2.052','33304.3545159691','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RET04000A69C004','2026','06 - Nov','2026','06 - Nov','5033.92107087739','21212.9646598529','43529.0034820182','2.052','33304.3545159691','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RET04000E79C004','2026','06 - Nov','2026','06 - Nov','5033.92107087739','21212.9646598529','43529.0034820182','2.052','33304.3545159691','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RET04000A69C004','2026','06 - Nov','2026','06 - Nov','5033.92107087739','21212.9646598529','43529.0034820182','2.052','33304.3545159691','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RET04000C39C004','2026','06 - Nov','2026','06 - Nov','5033.92107087739','21212.9646598529','43529.0034820182','2.052','33304.3545159691','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RET08000G18C004','2026','06 - Nov','2026','06 - Nov','10436.7786126476','25455.5575918235','52476.6319755441','2.0615','39965.2254191629','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RET08000DF9C004','2026','06 - Nov','2026','06 - Nov','10436.7786126476','25455.5575918235','64084.3662374156','2.5175','50911.115183647','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RET08000BH9C004','2026','06 - Nov','2026','06 - Nov','10436.7786126476','25455.5575918235','64084.3662374156','2.5175','50911.115183647','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RET08000C39C004','2026','06 - Nov','2026','06 - Nov','10436.7786126476','25455.5575918235','64084.3662374156','2.5175','50911.115183647','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RET08000E79C004','2026','06 - Nov','2026','06 - Nov','10436.7786126476','25455.5575918235','64084.3662374156','2.5175','50911.115183647','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RET08000A69C004','2026','06 - Nov','2026','06 - Nov','10436.7786126476','25455.5575918235','64084.3662374156','2.5175','50911.115183647','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RET08000C39C004','2026','06 - Nov','2026','06 - Nov','10436.7786126476','25455.5575918235','64084.3662374156','2.5175','50911.115183647','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','REC10000000C0024','2026','06 - Nov','2026','06 - Nov','6516.62274350681','27152.5947646117','18830.3244692582','0.6935','13033.2454870136','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','REC12000000C0024','2026','06 - Nov','2026','06 - Nov','7102.10056811875','22910.0018326411','19152.761532088','0.836','13287.8010629319','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','REC06000000C0024','2026','06 - Nov','2026','06 - Nov','5091.1115183647','50911.115183647','22248.1573352537','0.437','15273.3345550941','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','REC08000000C0024','2026','06 - Nov','2026','06 - Nov','6533.5931152347','46668.5222516764','24827.6538378919','0.532','17267.3532331203','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','REQ10000G18C004','2026','06 - Nov','2026','06 - Nov','14180.9117729538','12727.7787959117','37292.3918720214','2.93','26601.0576834556','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RES12000G18C004','2026','06 - Nov','2026','06 - Nov','40546.9669499111','42425.9293197058','162915.56858767','3.84','131520.380891088','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RES16000G18C002','2026','06 - Nov','2026','06 - Nov','49982.8098017159','22061.483246247','153547.923393879','6.96','125088.610006221','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','REW16000G18C004','2026','06 - Nov','2026','06 - Nov','13375.5566136045','17818.8903142764','56664.0711993991','3.18','45259.9813982622','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RES20000G18C004','2026','06 - Nov','2026','06 - Nov','55627.0460844721','9333.70445033528','137392.129508935','14.72','85776.7438985812','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RES24000G18C004','2026','06 - Nov','2026','06 - Nov','12618.7839140762','5600.22267020117','42785.7012003369','7.64','28561.135618026','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','REU08000G18C004','2026','06 - Nov','2026','06 - Nov','11041.6504460234','8485.18586394117','53117.2635082717','6.26','24861.5945813476','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','REQ06000G18C004','2026','06 - Nov','2026','06 - Nov','11324.9204751029','33940.7434557647','66523.8571732987','1.96','49553.4854454164','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RES08000G18C004','2026','06 - Nov','2026','06 - Nov','25702.8429802452','61941.8568067705','100345.808026968','1.62','92293.366642088','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RET12000G18C004','2026','07 - Dec','2026','07 - Dec','48635.4628552039','35903.6698997439','151100.594773072','4.2085','119918.257465145','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RET12000BH9C004','2026','07 - Dec','2026','07 - Dec','48635.4628552039','35903.6698997439','191689.693594733','5.339','156899.037461881','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RET12000E79C004','2026','07 - Dec','2026','07 - Dec','48635.4628552039','35903.6698997439','191689.693594733','5.339','156899.037461881','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RET12000A69C004','2026','07 - Dec','2026','07 - Dec','48635.4628552039','35903.6698997439','191689.693594733','5.339','156899.037461881','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RET16000G18C004','2026','07 - Dec','2026','07 - Dec','25575.8639096251','11920.018406715','87874.3756943028','7.372','61268.894610515','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RET16000BH9C004','2026','07 - Dec','2026','07 - Dec','25575.8639096251','11920.018406715','99991.0744047286','8.3885','71043.3097040213','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RET16000E79C004','2026','07 - Dec','2026','07 - Dec','25575.8639096251','11920.018406715','99991.0744047286','8.3885','71043.3097040213','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RET16000A69C004','2026','07 - Dec','2026','07 - Dec','25575.8639096251','11920.018406715','99991.0744047286','8.3885','71043.3097040213','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RET21000G18C004','2026','07 - Dec','2026','07 - Dec','52291.9974431496','14361.4679598976','163857.168688451','11.4095','112450.294125998','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RET21000BH9C004','2026','07 - Dec','2026','07 - Dec','52291.9974431496','14361.4679598976','215019.898295586','14.972','152518.789734112','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RET21000E79C004','2026','07 - Dec','2026','07 - Dec','52291.9974431496','14361.4679598976','215019.898295586','14.972','152518.789734112','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RET21000A69C004','2026','07 - Dec','2026','07 - Dec','52291.9974431496','14361.4679598976','215019.898295586','14.972','152518.789734112','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RET04000G18C004','2026','07 - Dec','2026','07 - Dec','8520.08398299007','35903.6698997439','66511.5484892756','1.8525','49906.101160644','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RET04000DF9C004','2026','07 - Dec','2026','07 - Dec','8520.08398299007','35903.6698997439','73674.3306342745','2.052','56368.7617425979','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RET04000BH9C004','2026','07 - Dec','2026','07 - Dec','8520.08398299007','35903.6698997439','73674.3306342745','2.052','56368.7617425979','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RET04000A69C004','2026','07 - Dec','2026','07 - Dec','8520.08398299007','35903.6698997439','73674.3306342745','2.052','56368.7617425979','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RET04000E79C004','2026','07 - Dec','2026','07 - Dec','8520.08398299007','35903.6698997439','73674.3306342745','2.052','56368.7617425979','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RET04000A69C004','2026','07 - Dec','2026','07 - Dec','8520.08398299007','35903.6698997439','73674.3306342745','2.052','56368.7617425979','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RET04000C39C004','2026','07 - Dec','2026','07 - Dec','8520.08398299007','35903.6698997439','73674.3306342745','2.052','56368.7617425979','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RET08000G18C004','2026','07 - Dec','2026','07 - Dec','17664.605590674','43084.4038796927','88818.4985979865','2.0615','67642.5140911175','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RET08000DF9C004','2026','07 - Dec','2026','07 - Dec','17664.605590674','43084.4038796927','108464.986767126','2.5175','86168.8077593854','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RET08000BH9C004','2026','07 - Dec','2026','07 - Dec','17664.605590674','43084.4038796927','108464.986767126','2.5175','86168.8077593854','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RET08000C39C004','2026','07 - Dec','2026','07 - Dec','17664.605590674','43084.4038796927','108464.986767126','2.5175','86168.8077593854','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RET08000E79C004','2026','07 - Dec','2026','07 - Dec','17664.605590674','43084.4038796927','108464.986767126','2.5175','86168.8077593854','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RET08000A69C004','2026','07 - Dec','2026','07 - Dec','17664.605590674','43084.4038796927','108464.986767126','2.5175','86168.8077593854','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RET08000C39C004','2026','07 - Dec','2026','07 - Dec','17664.605590674','43084.4038796927','108464.986767126','2.5175','86168.8077593854','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','REC10000000C0024','2026','07 - Dec','2026','07 - Dec','11029.6073932013','45956.6974716722','31870.9696966047','0.6935','22059.2147864027','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','REC12000000C0024','2026','07 - Dec','2026','07 - Dec','12020.5486824343','38775.9634917234','32416.7054790808','0.836','22490.0588251996','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','REC06000000C0024','2026','07 - Dec','2026','07 - Dec','8616.88077593854','86168.8077593854','37655.7689908514','0.437','25850.6423278156','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','REC08000000C0024','2026','07 - Dec','2026','07 - Dec','11058.3303291211','78988.0737794366','42021.6552506603','0.532','29225.5872983915','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','REQ10000G18C004','2026','07 - Dec','2026','07 - Dec','24001.6793191158','21542.2019398463','63118.6516837498','2.93','45023.2020542789','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RES12000G18C004','2026','07 - Dec','2026','07 - Dec','68627.1315749002','71807.3397994878','275740.184830033','3.84','222602.753378412','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RES16000G18C002','2026','07 - Dec','2026','07 - Dec','84597.6190767357','37339.8166957337','259885.124202306','6.96','211716.76066481','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','REW16000G18C004','2026','07 - Dec','2026','07 - Dec','22638.5881031077','30159.0827157849','95905.883036196','3.18','76604.0700980936','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RES20000G18C004','2026','07 - Dec','2026','07 - Dec','94150.6824783715','15797.6147558873','232540.889206661','14.72','145180.079606605','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RES24000G18C004','2026','07 - Dec','2026','07 - Dec','21357.7243658281','9478.56885353239','72416.2660409875','7.64','48340.7011530152','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','REU08000G18C004','2026','07 - Dec','2026','07 - Dec','18688.3719045961','14361.4679598976','89902.7894289588','6.26','42079.1011224999','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','REQ06000G18C004','2026','07 - Dec','2026','07 - Dec','19167.8161397439','57445.8718395903','112593.908805597','1.96','83870.9728858018','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RES08000G18C004','2026','07 - Dec','2026','07 - Dec','43502.9428769185','104838.716107252','169838.720093749','1.62','156209.686999806','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RET12000G18C004','2026','08 - Jan','2026','08 - Jan','21299.5008585021','15723.7168715697','66173.2624540011','4.2085','52517.2143510429','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RET12000BH9C004','2026','08 - Jan','2026','08 - Jan','21299.5008585021','15723.7168715697','83948.9243773107','5.339','68712.6427287597','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RET12000E79C004','2026','08 - Jan','2026','08 - Jan','21299.5008585021','15723.7168715697','83948.9243773107','5.339','68712.6427287597','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RET12000A69C004','2026','08 - Jan','2026','08 - Jan','21299.5008585021','15723.7168715697','83948.9243773107','5.339','68712.6427287597','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RET16000G18C004','2026','08 - Jan','2026','08 - Jan','11200.7391997444','5220.27400136115','38483.8599380344','7.372','26832.2083669963','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RET16000BH9C004','2026','08 - Jan','2026','08 - Jan','11200.7391997444','5220.27400136115','43790.268460418','8.3885','31112.8330481124','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RET16000E79C004','2026','08 - Jan','2026','08 - Jan','11200.7391997444','5220.27400136115','43790.268460418','8.3885','31112.8330481124','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RET16000A69C004','2026','08 - Jan','2026','08 - Jan','11200.7391997444','5220.27400136115','43790.268460418','8.3885','31112.8330481124','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RET21000G18C004','2026','08 - Jan','2026','08 - Jan','22900.8501008638','6289.48674862789','71759.8990584699','11.4095','49246.6812417563','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RET21000BH9C004','2026','08 - Jan','2026','08 - Jan','22900.8501008638','6289.48674862789','94166.1956004567','14.972','66794.3492704281','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RET21000E79C004','2026','08 - Jan','2026','08 - Jan','22900.8501008638','6289.48674862789','94166.1956004567','14.972','66794.3492704281','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RET21000A69C004','2026','08 - Jan','2026','08 - Jan','22900.8501008638','6289.48674862789','94166.1956004567','14.972','66794.3492704281','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RET04000G18C004','2026','08 - Jan','2026','08 - Jan','3731.30069000237','15723.7168715697','29128.1855045829','1.8525','21855.9664514819','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RET04000DF9C004','2026','08 - Jan','2026','08 - Jan','3731.30069000237','15723.7168715697','32265.0670204611','2.052','24686.2354883645','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RET04000BH9C004','2026','08 - Jan','2026','08 - Jan','3731.30069000237','15723.7168715697','32265.0670204611','2.052','24686.2354883645','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RET04000A69C004','2026','08 - Jan','2026','08 - Jan','3731.30069000237','15723.7168715697','32265.0670204611','2.052','24686.2354883645','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RET04000E79C004','2026','08 - Jan','2026','08 - Jan','3731.30069000237','15723.7168715697','32265.0670204611','2.052','24686.2354883645','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RET04000A69C004','2026','08 - Jan','2026','08 - Jan','3731.30069000237','15723.7168715697','32265.0670204611','2.052','24686.2354883645','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RET04000C39C004','2026','08 - Jan','2026','08 - Jan','3731.30069000237','15723.7168715697','32265.0670204611','2.052','24686.2354883645','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RET08000G18C004','2026','08 - Jan','2026','08 - Jan','7736.0687008123','18868.4602458837','38897.3307968892','2.0615','29623.4825860373','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RET08000DF9C004','2026','08 - Jan','2026','08 - Jan','7736.0687008123','18868.4602458837','47501.3486690121','2.5175','37736.9204917673','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RET08000BH9C004','2026','08 - Jan','2026','08 - Jan','7736.0687008123','18868.4602458837','47501.3486690121','2.5175','37736.9204917673','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RET08000C39C004','2026','08 - Jan','2026','08 - Jan','7736.0687008123','18868.4602458837','47501.3486690121','2.5175','37736.9204917673','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RET08000E79C004','2026','08 - Jan','2026','08 - Jan','7736.0687008123','18868.4602458837','47501.3486690121','2.5175','37736.9204917673','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RET08000A69C004','2026','08 - Jan','2026','08 - Jan','7736.0687008123','18868.4602458837','47501.3486690121','2.5175','37736.9204917673','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RET08000C39C004','2026','08 - Jan','2026','08 - Jan','7736.0687008123','18868.4602458837','47501.3486690121','2.5175','37736.9204917673','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','REC10000000C0024','2026','08 - Jan','2026','08 - Jan','4830.32582294622','20126.3575956092','13957.628992555','0.6935','9660.65164589243','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','REC12000000C0024','2026','08 - Jan','2026','08 - Jan','5264.30040860154','16981.6142212953','14196.6294890029','0.836','9849.33624835127','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','REC06000000C0024','2026','08 - Jan','2026','08 - Jan','3773.69204917673','37736.9204917673','16491.0342549023','0.437','11321.0761475302','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','REC08000000C0024','2026','08 - Jan','2026','08 - Jan','4842.90479644347','34592.1771174534','18403.0382264852','0.532','12799.1055334577','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','REQ10000G18C004','2026','08 - Jan','2026','08 - Jan','10511.3380083377','9434.23012294183','27642.2942602196','2.93','19717.5409569484','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RES12000G18C004','2026','08 - Jan','2026','08 - Jan','30054.6877131184','31447.4337431394','120758.145573655','3.84','97487.0446037322','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RES16000G18C002','2026','08 - Jan','2026','08 - Jan','37048.831333562','16352.6655464325','113814.55220317','6.96','92719.6136482723','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','REW16000G18C004','2026','08 - Jan','2026','08 - Jan','9914.38342373718','13207.9221721186','42001.192507337','3.18','33548.1223171811','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RES20000G18C004','2026','08 - Jan','2026','08 - Jan','41232.5168621699','6918.43542349067','101839.369433783','14.72','63580.4215418793','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RES24000G18C004','2026','08 - Jan','2026','08 - Jan','9353.43968700264','4151.0612540944','31714.1079812813','7.64','21170.4123958815','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','REU08000G18C004','2026','08 - Jan','2026','08 - Jan','8184.41873599566','6289.48674862789','39372.1870464106','6.26','18428.1961734797','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','REQ06000G18C004','2026','08 - Jan','2026','08 - Jan','8394.38739463753','25157.9469945115','49309.5761092426','1.96','36730.6026119868','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RES08000G18C004','2026','08 - Jan','2026','08 - Jan','19051.7559566137','45913.2532649836','74379.4702892734','1.62','68410.7473648255','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RET12000G18C004','2026','09 - Feb','2026','09 - Feb','23249.3812927716','17163.1575460505','72231.1485325535','4.2085','57324.9462038086','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RET12000BH9C004','2026','09 - Feb','2026','09 - Feb','23249.3812927716','17163.1575460505','91634.0981383635','5.339','75002.9984762406','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RET12000E79C004','2026','09 - Feb','2026','09 - Feb','23249.3812927716','17163.1575460505','91634.0981383635','5.339','75002.9984762406','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RET12000A69C004','2026','09 - Feb','2026','09 - Feb','23249.3812927716','17163.1575460505','91634.0981383635','5.339','75002.9984762406','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RET16000G18C004','2026','09 - Feb','2026','09 - Feb','12226.1201398906','5698.16830528876','42006.8967465888','7.372','29288.5850891842','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RET16000BH9C004','2026','09 - Feb','2026','09 - Feb','12226.1201398906','5698.16830528876','47799.0848289148','8.3885','33961.083099521','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RET16000E79C004','2026','09 - Feb','2026','09 - Feb','12226.1201398906','5698.16830528876','47799.0848289148','8.3885','33961.083099521','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RET16000A69C004','2026','09 - Feb','2026','09 - Feb','12226.1201398906','5698.16830528876','47799.0848289148','8.3885','33961.083099521','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RET21000G18C004','2026','09 - Feb','2026','09 - Feb','24997.3273768553','6865.2630184202','78329.2184086652','11.4095','53755.0094342301','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RET21000BH9C004','2026','09 - Feb','2026','09 - Feb','24997.3273768553','6865.2630184202','102786.717911787','14.972','72909.0932556225','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RET21000E79C004','2026','09 - Feb','2026','09 - Feb','24997.3273768553','6865.2630184202','102786.717911787','14.972','72909.0932556225','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RET21000A69C004','2026','09 - Feb','2026','09 - Feb','24997.3273768553','6865.2630184202','102786.717911787','14.972','72909.0932556225','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RET04000G18C004','2026','09 - Feb','2026','09 - Feb','4072.88569981763','17163.1575460505','31794.7493540585','1.8525','23856.7889890102','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RET04000DF9C004','2026','09 - Feb','2026','09 - Feb','4072.88569981763','17163.1575460505','35218.7992844956','2.052','26946.1573472993','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RET04000BH9C004','2026','09 - Feb','2026','09 - Feb','4072.88569981763','17163.1575460505','35218.7992844956','2.052','26946.1573472993','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RET04000A69C004','2026','09 - Feb','2026','09 - Feb','4072.88569981763','17163.1575460505','35218.7992844956','2.052','26946.1573472993','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RET04000E79C004','2026','09 - Feb','2026','09 - Feb','4072.88569981763','17163.1575460505','35218.7992844956','2.052','26946.1573472993','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RET04000A69C004','2026','09 - Feb','2026','09 - Feb','4072.88569981763','17163.1575460505','35218.7992844956','2.052','26946.1573472993','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RET04000C39C004','2026','09 - Feb','2026','09 - Feb','4072.88569981763','17163.1575460505','35218.7992844956','2.052','26946.1573472993','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RET08000G18C004','2026','09 - Feb','2026','09 - Feb','8444.27351265684','20595.7890552606','42458.2191374197','2.0615','32335.3888167591','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RET08000DF9C004','2026','09 - Feb','2026','09 - Feb','8444.27351265684','20595.7890552606','51849.8989466185','2.5175','41191.5781105212','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RET08000BH9C004','2026','09 - Feb','2026','09 - Feb','8444.27351265684','20595.7890552606','51849.8989466185','2.5175','41191.5781105212','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RET08000C39C004','2026','09 - Feb','2026','09 - Feb','8444.27351265684','20595.7890552606','51849.8989466185','2.5175','41191.5781105212','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RET08000E79C004','2026','09 - Feb','2026','09 - Feb','8444.27351265684','20595.7890552606','51849.8989466185','2.5175','41191.5781105212','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RET08000A69C004','2026','09 - Feb','2026','09 - Feb','8444.27351265684','20595.7890552606','51849.8989466185','2.5175','41191.5781105212','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RET08000C39C004','2026','09 - Feb','2026','09 - Feb','8444.27351265684','20595.7890552606','51849.8989466185','2.5175','41191.5781105212','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','REC10000000C0024','2026','09 - Feb','2026','09 - Feb','5272.52199814671','21968.8416589446','15235.3916904781','0.6935','10545.0439962934','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','REC12000000C0024','2026','09 - Feb','2026','09 - Feb','5746.2251464177','18536.2101497345','15496.2716851781','0.836','10751.001886846','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','REC06000000C0024','2026','09 - Feb','2026','09 - Feb','4119.15781105212','41191.5781105212','18000.7196342978','0.437','12357.4734331564','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','REC08000000C0024','2026','09 - Feb','2026','09 - Feb','5286.25252418355','37758.9466013111','20087.7595918975','0.532','13970.8102424851','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','REQ10000G18C004','2026','09 - Feb','2026','09 - Feb','11473.6071458451','10297.8945276303','30172.8309659568','2.93','21522.5995627473','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RES12000G18C004','2026','09 - Feb','2026','09 - Feb','32806.0689740786','34326.315092101','131813.049953668','3.84','106411.576785513','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RES16000G18C002','2026','09 - Feb','2026','09 - Feb','40440.4972608423','17849.6838478925','124233.799581332','6.96','101207.707417551','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','REW16000G18C004','2026','09 - Feb','2026','09 - Feb','10822.0038597379','14417.0523386824','45846.2264370101','3.18','36619.3129402533','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RES20000G18C004','2026','09 - Feb','2026','09 - Feb','45007.1817437245','7551.78932026221','111162.33879426','14.72','69400.9438532097','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RES24000G18C004','2026','09 - Feb','2026','09 - Feb','10209.7080643682','4531.07359215733','34617.402244082','7.64','23108.4753200024','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','REU08000G18C004','2026','09 - Feb','2026','09 - Feb','8933.66812288052','6865.2630184202','42976.5464953104','6.26','20115.2206439712','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','REQ06000G18C004','2026','09 - Feb','2026','09 - Feb','9162.85853615483','27461.0520736808','53823.6620644143','1.96','40093.1360275739','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RES08000G18C004','2026','09 - Feb','2026','09 - Feb','20795.864723531','50116.4200344674','81188.6004558372','1.62','74673.4658513565','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RET12000G18C004','2026','10 - Mar','2026','10 - Mar','25874.95998273','19101.412166156','80388.2931012676','4.2085','63798.7166349611','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RET12000BH9C004','2026','10 - Mar','2026','10 - Mar','25874.95998273','19101.412166156','101982.439555107','5.339','83473.1711661018','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RET12000E79C004','2026','10 - Mar','2026','10 - Mar','25874.95998273','19101.412166156','101982.439555107','5.339','83473.1711661018','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RET12000A69C004','2026','10 - Mar','2026','10 - Mar','25874.95998273','19101.412166156','101982.439555107','5.339','83473.1711661018','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RET16000G18C004','2026','10 - Mar','2026','10 - Mar','13606.8295917223','6341.6688391638','46750.7826823155','7.372','32596.1778333019','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RET16000BH9C004','2026','10 - Mar','2026','10 - Mar','13606.8295917223','6341.6688391638','53197.0890573255','8.3885','37796.3462814162','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RET16000E79C004','2026','10 - Mar','2026','10 - Mar','13606.8295917223','6341.6688391638','53197.0890573255','8.3885','37796.3462814162','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RET16000A69C004','2026','10 - Mar','2026','10 - Mar','13606.8295917223','6341.6688391638','53197.0890573255','8.3885','37796.3462814162','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RET21000G18C004','2026','10 - Mar','2026','10 - Mar','27820.3035773872','7640.56486646241','87175.0248439029','11.4095','59825.6229044007','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RET21000BH9C004','2026','10 - Mar','2026','10 - Mar','27820.3035773872','7640.56486646241','114394.537180675','14.972','81142.7988818308','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RET21000E79C004','2026','10 - Mar','2026','10 - Mar','27820.3035773872','7640.56486646241','114394.537180675','14.972','81142.7988818308','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RET21000A69C004','2026','10 - Mar','2026','10 - Mar','27820.3035773872','7640.56486646241','114394.537180675','14.972','81142.7988818308','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RET04000G18C004','2026','10 - Mar','2026','10 - Mar','4532.84124725418','19101.412166156','35385.366037804','1.8525','26550.9629109569','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RET04000DF9C004','2026','10 - Mar','2026','10 - Mar','4532.84124725418','19101.412166156','39196.0977649522','2.052','29989.217100865','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RET04000BH9C004','2026','10 - Mar','2026','10 - Mar','4532.84124725418','19101.412166156','39196.0977649522','2.052','29989.217100865','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RET04000A69C004','2026','10 - Mar','2026','10 - Mar','4532.84124725418','19101.412166156','39196.0977649522','2.052','29989.217100865','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RET04000E79C004','2026','10 - Mar','2026','10 - Mar','4532.84124725418','19101.412166156','39196.0977649522','2.052','29989.217100865','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RET04000A69C004','2026','10 - Mar','2026','10 - Mar','4532.84124725418','19101.412166156','39196.0977649522','2.052','29989.217100865','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RET04000C39C004','2026','10 - Mar','2026','10 - Mar','4532.84124725418','19101.412166156','39196.0977649522','2.052','29989.217100865','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RET08000G18C004','2026','10 - Mar','2026','10 - Mar','9397.89478574876','22921.6945993872','47253.0734166368','2.0615','35987.0605210379','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RET08000DF9C004','2026','10 - Mar','2026','10 - Mar','9397.89478574876','22921.6945993872','57705.3661539573','2.5175','45843.3891987745','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RET08000BH9C004','2026','10 - Mar','2026','10 - Mar','9397.89478574876','22921.6945993872','57705.3661539573','2.5175','45843.3891987745','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RET08000C39C004','2026','10 - Mar','2026','10 - Mar','9397.89478574876','22921.6945993872','57705.3661539573','2.5175','45843.3891987745','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RET08000E79C004','2026','10 - Mar','2026','10 - Mar','9397.89478574876','22921.6945993872','57705.3661539573','2.5175','45843.3891987745','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RET08000A69C004','2026','10 - Mar','2026','10 - Mar','9397.89478574876','22921.6945993872','57705.3661539573','2.5175','45843.3891987745','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RET08000C39C004','2026','10 - Mar','2026','10 - Mar','9397.89478574876','22921.6945993872','57705.3661539573','2.5175','45843.3891987745','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','REC10000000C0024','2026','10 - Mar','2026','10 - Mar','5867.95381744313','24449.8075726797','16955.9415516534','0.6935','11735.9076348863','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','REC12000000C0024','2026','10 - Mar','2026','10 - Mar','6395.15279322904','20629.5251394485','17246.2830165789','0.836','11965.1245808801','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','REC06000000C0024','2026','10 - Mar','2026','10 - Mar','4584.33891987744','45843.3891987745','20033.5610798644','0.437','13753.0167596323','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','REC08000000C0024','2026','10 - Mar','2026','10 - Mar','5883.23494717606','42023.1067655432','22356.292799269','0.532','15548.549503251','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','REQ10000G18C004','2026','10 - Mar','2026','10 - Mar','12769.3344617566','11460.8472996936','33580.2825881023','2.93','23953.1708563596','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RES12000G18C004','2026','10 - Mar','2026','10 - Mar','36510.8951161156','38202.824332312','146698.845436078','3.84','118428.755430167','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RES16000G18C002','2026','10 - Mar','2026','10 - Mar','45007.4879468441','19865.4686528023','138263.661823504','6.96','112637.207261389','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','REW16000G18C004','2026','10 - Mar','2026','10 - Mar','12044.1448861578','16045.1862195711','51023.692178236','3.18','40754.7729977105','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RES20000G18C004','2026','10 - Mar','2026','10 - Mar','50089.8932272404','8404.62135310865','123716.026317759','14.72','77238.4702350685','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RES24000G18C004','2026','10 - Mar','2026','10 - Mar','11362.7018402858','5042.77281186519','38526.78428265','7.64','25718.1413405125','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','REU08000G18C004','2026','10 - Mar','2026','10 - Mar','9942.55727787445','7640.56486646241','47829.9360640547','6.26','22386.8550587349','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','REQ06000G18C004','2026','10 - Mar','2026','10 - Mar','10197.6304214227','30562.2594658496','59902.0285530653','1.96','44620.8988201405','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RES08000G18C004','2026','10 - Mar','2026','10 - Mar','23144.3650371431','55776.1235251756','90357.3201107845','1.62','83106.4240525116','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RET12000G18C004','2026','11 - Apr','2026','11 - Apr','21531.6294816294','15895.0788566269','66894.4393681145','4.2085','53089.563381134','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RET12000BH9C004','2026','11 - Apr','2026','11 - Apr','21531.6294816294','15895.0788566269','84863.8260155313','5.339','69461.4946034598','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RET12000E79C004','2026','11 - Apr','2026','11 - Apr','21531.6294816294','15895.0788566269','84863.8260155313','5.339','69461.4946034598','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RET12000A69C004','2026','11 - Apr','2026','11 - Apr','21531.6294816294','15895.0788566269','84863.8260155313','5.339','69461.4946034598','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RET16000G18C004','2026','11 - Apr','2026','11 - Apr','11322.8083592856','5277.16618040015','38903.2690819099','7.372','27124.6341672568','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RET16000BH9C004','2026','11 - Apr','2026','11 - Apr','11322.8083592856','5277.16618040015','44267.5085042866','8.3885','31451.9104351849','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RET16000E79C004','2026','11 - Apr','2026','11 - Apr','11322.8083592856','5277.16618040015','44267.5085042866','8.3885','31451.9104351849','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RET16000A69C004','2026','11 - Apr','2026','11 - Apr','11322.8083592856','5277.16618040015','44267.5085042866','8.3885','31451.9104351849','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RET21000G18C004','2026','11 - Apr','2026','11 - Apr','23150.430728958','6358.03154265078','72541.9608858741','11.4095','49783.3869789556','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RET21000BH9C004','2026','11 - Apr','2026','11 - Apr','23150.430728958','6358.03154265078','95192.4482565675','14.972','67522.2949829513','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RET21000E79C004','2026','11 - Apr','2026','11 - Apr','23150.430728958','6358.03154265078','95192.4482565675','14.972','67522.2949829513','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RET21000A69C004','2026','11 - Apr','2026','11 - Apr','23150.430728958','6358.03154265078','95192.4482565675','14.972','67522.2949829513','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RET04000G18C004','2026','11 - Apr','2026','11 - Apr','3771.96557212323','15895.0788566269','29445.6335819014','1.8525','22094.1596107115','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RET04000DF9C004','2026','11 - Apr','2026','11 - Apr','3771.96557212323','15895.0788566269','32616.7018137985','2.052','24955.2738049043','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RET04000BH9C004','2026','11 - Apr','2026','11 - Apr','3771.96557212323','15895.0788566269','32616.7018137985','2.052','24955.2738049043','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RET04000A69C004','2026','11 - Apr','2026','11 - Apr','3771.96557212323','15895.0788566269','32616.7018137985','2.052','24955.2738049043','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RET04000E79C004','2026','11 - Apr','2026','11 - Apr','3771.96557212323','15895.0788566269','32616.7018137985','2.052','24955.2738049043','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RET04000A69C004','2026','11 - Apr','2026','11 - Apr','3771.96557212323','15895.0788566269','32616.7018137985','2.052','24955.2738049043','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RET04000C39C004','2026','11 - Apr','2026','11 - Apr','3771.96557212323','15895.0788566269','32616.7018137985','2.052','24955.2738049043','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RET08000G18C004','2026','11 - Apr','2026','11 - Apr','7820.37879746046','19074.0946279523','39321.2460755237','2.0615','29946.3285658852','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RET08000DF9C004','2026','11 - Apr','2026','11 - Apr','7820.37879746046','19074.0946279523','48019.03322587','2.5175','38148.1892559047','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RET08000BH9C004','2026','11 - Apr','2026','11 - Apr','7820.37879746046','19074.0946279523','48019.03322587','2.5175','38148.1892559047','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RET08000C39C004','2026','11 - Apr','2026','11 - Apr','7820.37879746046','19074.0946279523','48019.03322587','2.5175','38148.1892559047','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RET08000E79C004','2026','11 - Apr','2026','11 - Apr','7820.37879746046','19074.0946279523','48019.03322587','2.5175','38148.1892559047','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RET08000A69C004','2026','11 - Apr','2026','11 - Apr','7820.37879746046','19074.0946279523','48019.03322587','2.5175','38148.1892559047','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RET08000C39C004','2026','11 - Apr','2026','11 - Apr','7820.37879746046','19074.0946279523','48019.03322587','2.5175','38148.1892559047','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','REC10000000C0024','2026','11 - Apr','2026','11 - Apr','4882.9682247558','20345.7009364825','14109.7435994506','0.6935','9765.9364495116','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','REC12000000C0024','2026','11 - Apr','2026','11 - Apr','5321.6724011987','17166.6851651571','14351.3487980713','0.836','9956.67739579112','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','REC06000000C0024','2026','11 - Apr','2026','11 - Apr','3814.81892559047','38148.1892559047','16670.7587048303','0.437','11444.4567767714','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','REC08000000C0024','2026','11 - Apr','2026','11 - Apr','4895.6842878411','34969.1734845793','18603.6002937962','0.532','12938.5941892943','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','REQ10000G18C004','2026','11 - Apr','2026','11 - Apr','10625.8938580409','9537.04731397617','27943.5486299502','2.93','19932.4288862102','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RES12000G18C004','2026','11 - Apr','2026','11 - Apr','30382.2331013279','31790.1577132539','122074.205618895','3.84','98549.4889110871','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RES16000G18C002','2026','11 - Apr','2026','11 - Apr','37452.6010868096','16530.882010892','115054.938795808','6.96','93730.1010017578','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','REW16000G18C004','2026','11 - Apr','2026','11 - Apr','10022.433475642','13351.8662395666','42458.9346418219','3.18','33913.7402484992','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RES20000G18C004','2026','11 - Apr','2026','11 - Apr','41681.8817290216','6993.83469691586','102949.246738601','14.72','64273.3408646567','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RES24000G18C004','2026','11 - Apr','2026','11 - Apr','9455.37639859378','4196.30081814951','32059.7382506623','7.64','21401.1341725625','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','REU08000G18C004','2026','11 - Apr','2026','11 - Apr','8273.61509157719','6358.03154265078','39801.2774569939','6.26','18629.0324199668','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','REQ06000G18C004','2026','11 - Apr','2026','11 - Apr','8485.87205434197','25432.1261706031','49846.9672943821','1.96','37130.9042090805','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text)),
|
||||
('TARGET STORES','TARGET STORES','DIR','50802 - TONY LANDINO','Giorgio','TARGET STORES.50802 - TONY LANDINO','RES08000G18C004','2026','11 - Apr','2026','11 - Apr','19259.3879526753','46413.6302613507','75190.0810233881','1.62','69156.3090894125','3929835.20215167',CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text),CAST(NULL AS text))
|
||||
) x("account","shipgrp","chan","dsm","director","lu","part","oseas","omon","sseas","smon","lbs","qty","sales_usd","hist_price","cost_curstd_usd","shiplbs","floor","ceiling","uselimits","price","avgprice","pltq","guid","lowest_last","lowest_floor")
|
||||
78
lbs_schedule/unpivot.pg.sql
Normal file
78
lbs_schedule/unpivot.pg.sql
Normal file
@ -0,0 +1,78 @@
|
||||
WITH
|
||||
cols AS (
|
||||
SELECT
|
||||
"Renamed" shipcust
|
||||
,"ReRep" dsm
|
||||
-- "Ship-To Group" shipcust
|
||||
-- ,"Default Rep" dsm
|
||||
,"FY26"::numeric lbs
|
||||
FROM
|
||||
rlarp.lbs_upload
|
||||
WHERE
|
||||
"FY26"::numeric <> 0
|
||||
AND "Renamed" <> '(blank)'
|
||||
)
|
||||
,no_customermaster AS (
|
||||
SELECT
|
||||
l.*
|
||||
FROM
|
||||
cols l
|
||||
LEFT OUTER JOIN rlarp.cust c ON
|
||||
c.dba = l.shipcust
|
||||
AND c.default_rep = l.dsm
|
||||
WHERE
|
||||
c.dba IS NULL
|
||||
)
|
||||
,last_season AS (
|
||||
SELECT
|
||||
l.shipcust
|
||||
,l.dsm
|
||||
,l.lbs
|
||||
,max(oseas) max_oseas
|
||||
FROM
|
||||
cols l
|
||||
LEFT OUTER JOIN rlarp.osm_stack o ON
|
||||
l.shipcust = o.ship_dba
|
||||
AND l.dsm = o.dsm
|
||||
WHERE
|
||||
qty <> 0
|
||||
AND sales_usd <> 0
|
||||
AND fs_line = '41010'
|
||||
AND oseas <= 2025
|
||||
AND version = 'Actual'
|
||||
GROUP BY
|
||||
l.shipcust
|
||||
,l.dsm
|
||||
,l.lbs
|
||||
)
|
||||
,all_with_last_season AS (
|
||||
select
|
||||
l.*
|
||||
,s.max_oseas
|
||||
from
|
||||
cols l
|
||||
LEFT OUTER JOIN last_season s ON
|
||||
s.shipcust = l.shipcust
|
||||
AND s.dsm = l.dsm
|
||||
)
|
||||
select
|
||||
c.*
|
||||
,o.bill_cust
|
||||
,o.ship_cust
|
||||
,o.part
|
||||
,o.promo
|
||||
,o.programd
|
||||
,o.qty
|
||||
,o.odate
|
||||
,o.sdate
|
||||
from
|
||||
all_with_last_season c
|
||||
left outer join rlarp.osm_stack o ON
|
||||
c.shipcust = o.ship_dba
|
||||
AND c.dsm = o.dsm
|
||||
AND c.max_oseas = o.oseas
|
||||
WHERE
|
||||
version = 'Actual'
|
||||
AND fs_line = '41010'
|
||||
AND qty <> 0
|
||||
AND sales_usd <> 0
|
||||
4589
lbs_schedule/upload.pg.sql
Normal file
4589
lbs_schedule/upload.pg.sql
Normal file
File diff suppressed because it is too large
Load Diff
429
offline/baseline_orphans.pg.sql
Normal file
429
offline/baseline_orphans.pg.sql
Normal file
@ -0,0 +1,429 @@
|
||||
-- WITH
|
||||
-- newc AS (
|
||||
CREATE TABLE rlarp.orphans AS (
|
||||
SELECT renamed, rerep, pounds::numeric pounds FROM (VALUES
|
||||
('MARTIN''S NURSERY INC','10049 - STEVEN STUPPIELLO','160000'),
|
||||
('BRENTANOS TREE FARM','30053 - SKYE SAWYER','125000'),
|
||||
('QUALITREE PROPAGATORS','40042 - TOM MORRIS','122256'),
|
||||
('HSU''S','13027 - STEVE RUSTEBERG','98054'),
|
||||
('LANCASTER FARM','10040 - RYAN CHITWOOD','88733'),
|
||||
('NATURALLY BEAUTIFUL PLANT PROD','10043 - CHERISSE GILSTROP','66876'),
|
||||
('REARDON NURSERY','30053 - SKYE SAWYER','54000'),
|
||||
('VAN BELLE NURSERY','40042 - TOM MORRIS','52690'),
|
||||
('DEVAN GREENHOUSES','40042 - TOM MORRIS','50554'),
|
||||
('STEWARTS GREENHOUSE','10046 - DUSTIN KUYKENDOLL 2','46585'),
|
||||
('DESERT FOREST NURSERY','30035 - RODNEY RIOS','45292'),
|
||||
('LINNAEA NURSERIES LTD','40042 - TOM MORRIS','40617'),
|
||||
('MILLERS BLUE MOUNTAIN GHSE','10043 - CHERISSE GILSTROP','38029'),
|
||||
('BRIGGS NURSERY','30053 - SKYE SAWYER','38000'),
|
||||
('VAN KLAVEREN''S NURSERY LLC','30053 - SKYE SAWYER','36000'),
|
||||
('BLUE HERON FARM','30053 - SKYE SAWYER','36000'),
|
||||
('GROWERS NURSERY SUPPLY INC','30053 - SKYE SAWYER','33683'),
|
||||
('DESERT HORIZON NURSERY','30035 - RODNEY RIOS','25834'),
|
||||
('MEADOWLARK ORNAMENTALS LLC','12028 - JACOB WILKINSON','25350'),
|
||||
('PHELPS NURSERY','10048 - PHILIP BIEDENBACH','22000'),
|
||||
('VARGAS NURSERY','10041 - TAMARA RISKEN','21800'),
|
||||
('MEDFORD NURSERY INC','10043 - CHERISSE GILSTROP','21600'),
|
||||
('SUNLAND NURSERY','12028 - JACOB WILKINSON','19315'),
|
||||
('TOM DE SANTO GREENHOUSES','30053 - SKYE SAWYER','18000'),
|
||||
('LIMA GREENHOUSES','30053 - SKYE SAWYER','18000'),
|
||||
('JACOBSONS GREENHOUSE','30053 - SKYE SAWYER','18000'),
|
||||
('GOLD HILL NURSERY','30053 - SKYE SAWYER','18000'),
|
||||
('ALASKA MILL AND FEED','30053 - SKYE SAWYER','18000'),
|
||||
('HUIZENGA BRO GREENHOUSE INC','10035 - MATTHEW STAAL','17100'),
|
||||
('SCHROCK SALES','10048 - PHILIP BIEDENBACH','16146'),
|
||||
('HEIRLOOM ROSES','30053 - SKYE SAWYER','16000'),
|
||||
('ASHCOMBE FARM & GREENHOUSE','10048 - PHILIP BIEDENBACH','16000'),
|
||||
('SUNRISE GREENHOUSES','40039 - DAVE BODO','15770'),
|
||||
('ALPHA NURSERY','30053 - SKYE SAWYER','15683'),
|
||||
('BREEZY HILL NURSERY','13027 - STEVE RUSTEBERG','15555'),
|
||||
('SALGACA CORPORATION','10046 - DUSTIN KUYKENDOLL 2','15268'),
|
||||
('EDGEWOOD GREENHOUSE','13027 - STEVE RUSTEBERG','15000'),
|
||||
('DGI','10035 - MATTHEW STAAL','15000'),
|
||||
('DAYNABROOK GREENHOUSES','10048 - PHILIP BIEDENBACH','15000'),
|
||||
('RAZBUTON INC','10039 - DUSTIN KUYKENDOLL','14710'),
|
||||
('GOLD COAST FARMS LLC','30035 - RODNEY RIOS','14560'),
|
||||
('A&W ANNUALS','10039 - DUSTIN KUYKENDOLL','13866'),
|
||||
('MESQUITE VALLEY GROWERS','30035 - RODNEY RIOS','13440'),
|
||||
('MULTIFAB, INC','30053 - SKYE SAWYER','13050'),
|
||||
('CAAN FLORAL CO INC','13027 - STEVE RUSTEBERG','12661'),
|
||||
('WEAKLAND GREENHOUSES','12028 - JACOB WILKINSON','11604'),
|
||||
('BEAVER BARK LTD','30053 - SKYE SAWYER','11107'),
|
||||
('HONEYMOON ACRES','13027 - STEVE RUSTEBERG','10500'),
|
||||
('HENRY WHALEN AND SONS GHSE','10043 - CHERISSE GILSTROP','10063'),
|
||||
('HILLEN NURSERY LTD','40039 - DAVE BODO','10000'),
|
||||
('HIGHLAND FARMS','12028 - JACOB WILKINSON','10000'),
|
||||
('WALNUT GROVE NURSERY','40042 - TOM MORRIS','9712'),
|
||||
('KATOS NURSERY','40042 - TOM MORRIS','9634'),
|
||||
('BAYVIEW GREENHOUSES','40039 - DAVE BODO','9631'),
|
||||
('CARPINITO BROTHERS INC','30053 - SKYE SAWYER','9000'),
|
||||
('AVA NURSERY','10049 - STEVEN STUPPIELLO','8924'),
|
||||
('BELLE INVESTMENTS','10039 - DUSTIN KUYKENDOLL','8647'),
|
||||
('SUN NURSERIES','10043 - CHERISSE GILSTROP','8334'),
|
||||
('GEORGE''S PLANT FARM','10040 - RYAN CHITWOOD','8000'),
|
||||
('D''ADDIO FAMILY NURSERY','10048 - PHILIP BIEDENBACH','8000'),
|
||||
('MR GREENJEANS FARM MARKET','10043 - CHERISSE GILSTROP','7817'),
|
||||
('BOEKESTYN GREENHOUSES LTD','40039 - DAVE BODO','7639'),
|
||||
('FISHER FARMS','30053 - SKYE SAWYER','7238'),
|
||||
('PINE VIEW FARM','10048 - PHILIP BIEDENBACH','7000'),
|
||||
('GILSON FAMILY ENTERPRISE','10042 - JEREMY RHAULT','6763'),
|
||||
('STARLING NURSERY','10049 - STEVEN STUPPIELLO','6400'),
|
||||
('MCCALLS NURSERIES INC','30054 - JASON MOTTIN','6000'),
|
||||
('I & G FARM INC','10043 - CHERISSE GILSTROP','5715'),
|
||||
('THOMAS BECNEL','10041 - TAMARA RISKEN','5000'),
|
||||
('MAYS GREENHOUSE','10048 - PHILIP BIEDENBACH','5000'),
|
||||
('DRY LAND NATIVE GRASSES','10041 - TAMARA RISKEN','5000'),
|
||||
('CAPOGNA FLOWERS','40039 - DAVE BODO','5000'),
|
||||
('ANDYS GARDENS','10048 - PHILIP BIEDENBACH','5000'),
|
||||
('BOBBY MURRAY FARMS','10041 - TAMARA RISKEN','4940'),
|
||||
('J FRANK GAUDET TREE NURSERY','40040 - TINA PETTIGREW','4909'),
|
||||
('NORTHWEST PLANT COMPANY','30053 - SKYE SAWYER','4566'),
|
||||
('KATYDID GREENHOUSE','10040 - RYAN CHITWOOD','4122'),
|
||||
('MCCALLISTERS LNDSCP SUPPLY','10041 - TAMARA RISKEN','3920'),
|
||||
('SHANER AVENUE NURSERY','10035 - MATTHEW STAAL','3500'),
|
||||
('BEAUTIFUL LAND PRODUCTS','13027 - STEVE RUSTEBERG','3368'),
|
||||
('PARSLEYS PLANT FARM','10041 - TAMARA RISKEN','3000'),
|
||||
('ALASKA GDN & PET SUPPLY RET','30053 - SKYE SAWYER','2380'),
|
||||
('MARCUMS NURSERY','10041 - TAMARA RISKEN','2338'),
|
||||
('UNITED CENTRAL ORCHIDS','13027 - STEVE RUSTEBERG','2298'),
|
||||
('JEFF PARSLEY PLANT FARM','10041 - TAMARA RISKEN','2000'),
|
||||
('BEDROCK NURSERY','10041 - TAMARA RISKEN','1955'),
|
||||
('WAYFAIR LLC','90015 - ANN MARIE FOX','1800'),
|
||||
('VM INNOVATIONS-NE','90015 - ANN MARIE FOX','1730'),
|
||||
('DOAN''S NURSERY INC.','10041 - TAMARA RISKEN','1500'),
|
||||
('KLEIN''S FLORAL AND GREENHOUSE','13027 - STEVE RUSTEBERG','1207'),
|
||||
('DAHLINGHAUS VENTURES LLC','10048 - PHILIP BIEDENBACH','1051'),
|
||||
('YC NURSERIES INC','10041 - TAMARA RISKEN','1000'),
|
||||
('TEJANA NURSERY','10041 - TAMARA RISKEN','1000'),
|
||||
('TREESEARCH FARMS INC','10041 - TAMARA RISKEN','1000'),
|
||||
('THOMAS BECNEL CITRUS','10041 - TAMARA RISKEN','1000'),
|
||||
('SUAREZ PLANT FARM','10041 - TAMARA RISKEN','1000'),
|
||||
('SMITH NURSERY','10041 - TAMARA RISKEN','1000'),
|
||||
('OSO GROWERS INC.','10041 - TAMARA RISKEN','1000'),
|
||||
('LENO PLANT FARM','10041 - TAMARA RISKEN','1000'),
|
||||
('GIESEL''S GREENHOUSE','10041 - TAMARA RISKEN','1000'),
|
||||
('CHRIS DOYLE PLANT BROKERAGE','10041 - TAMARA RISKEN','1000')
|
||||
) x(renamed,rerep,pounds)
|
||||
) WITH DATA
|
||||
-- )
|
||||
-- ,seg AS (
|
||||
-- SELECT
|
||||
-- x.GLEC glec
|
||||
-- ,x.SEGM segm
|
||||
-- FROM
|
||||
-- (
|
||||
-- VALUES
|
||||
-- ('1SU','Sustainable'),
|
||||
-- ('1CU','Sustainable'),
|
||||
-- ('1GR','Greenhouse'),
|
||||
-- ('1NU','Nursery'),
|
||||
-- ('1RE','Retail'),
|
||||
-- ('2WI','Greenhouse'),
|
||||
-- ('3BM','Other'),
|
||||
-- ('3CO','Other'),
|
||||
-- ('3PE','Other'),
|
||||
-- ('3PP','Other'),
|
||||
-- ('4CO','Other'),
|
||||
-- ('4RA','Other'),
|
||||
-- ('9MI','Other'),
|
||||
-- ('9SA','Other'),
|
||||
-- ('9TO','Other')
|
||||
-- ) X(GLEC, SEGM)
|
||||
-- )
|
||||
-- ,profile AS (
|
||||
-- SELECT * FROM rlarp.osm WHERE shipgrp IN (select distinct renamed FROM newc ) AND oseas >= 2018
|
||||
-- )
|
||||
-- -- SELECT * FROM profile
|
||||
-- ,checkc AS (
|
||||
-- SELECT shipgrp, min(oseas) oseas FROM profile GROUP BY shipgrp
|
||||
-- )
|
||||
-- -- select * from checkc
|
||||
-- -- SELECT cust, sum(fb_qty) FROM newc LEFT OUTER JOIN profile ON shipgrp = cust GROUP by cust
|
||||
----grouped prices-------------
|
||||
,npgrp AS (
|
||||
SELECT
|
||||
o.bill_dba
|
||||
,o.ship_dba
|
||||
,o.bill_cust
|
||||
,o.ship_cust
|
||||
,o.promo
|
||||
,o.terms
|
||||
,o.dsm
|
||||
,o.part
|
||||
,o.odate
|
||||
,o.qtyord
|
||||
,i.nwht * CASE WHEN i.nwun = 'KG' THEN 2.2 ELSE 1 END lbs
|
||||
,i.mpck pltq
|
||||
,ROUND(o.sales_usd / o.qty,5) price
|
||||
,(o.pricing->>'guidance_price')::NUMERIC guidance
|
||||
,(o.pricing->>'floor' )::numeric(15,5) floor
|
||||
,(o.pricing->>'ceiling')::numeric(15,5) ceiling
|
||||
,(o.pricing->>'uselimits')::boolean uselimits
|
||||
FROM
|
||||
rlarp.osm_stack o
|
||||
INNER JOIN "CMS.CUSLG".itemm i ON
|
||||
i.item = o.part
|
||||
INNER JOIN checkc c ON
|
||||
c.shipgrp = o.customer
|
||||
AND c.oseas = o.oseas
|
||||
WHERE
|
||||
VERSION = 'Actual'
|
||||
AND o.oseas >= 2018
|
||||
AND calc_status <> 'CANCELED'
|
||||
AND o.fs_line = '41010'
|
||||
AND o.part <> ''
|
||||
AND substring(o.glec,1,1) <= '2'
|
||||
AND o.qty <> 0
|
||||
AND o.sseas IS NOT NULL
|
||||
-- AND customer in (select distinct renamed FROM newc )
|
||||
GROUP BY
|
||||
o.bill_dba
|
||||
,o.ship_dba
|
||||
,o.dsm
|
||||
,i.partgroup
|
||||
,i.pricegroup
|
||||
,o.part
|
||||
,o.odate
|
||||
,o.qtyord
|
||||
,o.pounds
|
||||
,o.pallets
|
||||
,ROUND(o.sales_usd / o.qty,5)
|
||||
,i.nwht * CASE WHEN i.nwun = 'KG' THEN 2.2 ELSE 1 END
|
||||
,i.mpck
|
||||
,(o.pricing->>'guidance_price')::NUMERIC
|
||||
,(o.pricing->>'floor' )::numeric(15,5)
|
||||
,(o.pricing->>'ceiling')::numeric(15,5)
|
||||
,(o.pricing->>'uselimits')::boolean
|
||||
)
|
||||
----sequenced for most recent price------------
|
||||
,nseq AS (
|
||||
SELECT
|
||||
bill_dba
|
||||
,ship_dba
|
||||
,part
|
||||
,odate
|
||||
,qtyord
|
||||
,lbs
|
||||
,pltq
|
||||
,price
|
||||
,guidance
|
||||
,floor
|
||||
,ceiling
|
||||
,uselimits
|
||||
,row_number() OVER (PARTITION BY bill_dba, ship_dba, part ORDER BY odate desc) rn
|
||||
,round(avg(price) over (PARTITION BY bill_dba, ship_dba, part),5) avgprice
|
||||
FROM
|
||||
npgrp
|
||||
)
|
||||
-- SELECT * FROM seq WHERE rn = 1
|
||||
,ngrp AS (
|
||||
SELECT
|
||||
sg.fspr
|
||||
,i.dplt
|
||||
,o.promo
|
||||
,o.terms
|
||||
,o.bill_cust
|
||||
,o.ship_cust
|
||||
,o.dsm
|
||||
,o.dsm
|
||||
,null:: director
|
||||
,o.account
|
||||
,o.shipgrp
|
||||
,o.chan
|
||||
,o.chansub
|
||||
,null::channel_retail
|
||||
,i.partgroup
|
||||
,i.pricegroup
|
||||
,o.part
|
||||
,o.part || ' - ' || i.descr
|
||||
,i.partgroup
|
||||
,i.branding
|
||||
,i.majgd majg_descr
|
||||
,i.mingd ming_descr
|
||||
,i.majsd majs_descr
|
||||
,i.minsd mins_descr
|
||||
,seg.segm
|
||||
,CASE WHEN i.majg = '610' THEN 'Fiber' ELSE 'Plastic' END substance
|
||||
,o.fs_line
|
||||
,o.r_currency
|
||||
,rx.rate r_rate
|
||||
,pl.curr c_currency
|
||||
,rx.rate r_rate
|
||||
,pl.curr c_currency
|
||||
,cx.rate c_rate
|
||||
,ROUND(sum(fb_qty * lbs),5) lbs
|
||||
,ROUND(sum(fb_qty),2) qty
|
||||
,ROUND(sum(fb_val_loc * r_rate),2) sales_usd
|
||||
,ROUND(sum(fb_cst_loc_cur * c_rate),2) cost_curstd_usd
|
||||
,'CLOSED' calc_status
|
||||
,'SHIPMENT' flag
|
||||
,o.odate
|
||||
,o.oseas
|
||||
,o.odate
|
||||
,og.sortmo omon
|
||||
,o.sseas
|
||||
,o.sdate
|
||||
,sg.sortmo smon
|
||||
-- ,o.calc_status
|
||||
FROM
|
||||
profile o
|
||||
LEFT OUTER JOIN rlarp.gld og ON
|
||||
o.odate BETWEEN og.sdat and og.edat
|
||||
LEFT OUTER JOIN rlarp.gld sg ON
|
||||
o.sdate BETWEEN sg.sdat and sg.edat
|
||||
LEFT OUTER JOIN "CMS.CUSLG".itemm i ON
|
||||
i.item = o.part
|
||||
LEFT OUTER JOIN seg ON
|
||||
seg.glec = i.glec
|
||||
LEFT OUTER JOIN rlarp.plpr pl ON
|
||||
pl.plnt = i.dplt
|
||||
LEFT OUTER JOIN rlarp.ffcret cx ON
|
||||
cx.perd = pl.gl AND
|
||||
cx.rtyp = 'MA' AND
|
||||
cx.fcur = pl.curr AND
|
||||
cx.tcur = 'US'
|
||||
LEFT OUTER JOIN rlarp.ffcret rx ON
|
||||
rx.perd = pl.gl AND
|
||||
rx.rtyp = 'MA' AND
|
||||
rx.fcur = b.r_currency AND
|
||||
rx.tcur = 'US'
|
||||
WHERE
|
||||
true
|
||||
-- iter IN ('actuals','actuals_plug','copy')
|
||||
AND fs_line = '41010'
|
||||
AND substring(o.glec,1,1) <= '2'
|
||||
AND o.calc_status <> 'CANCELED'
|
||||
AND o.sseas IS NOT NULL
|
||||
GROUP BY
|
||||
o.account
|
||||
,o.shipgrp
|
||||
,o.chan
|
||||
,o.dsm
|
||||
,i.partgroup
|
||||
,i.pricegroup
|
||||
,o.part
|
||||
,o.glec
|
||||
,o.oseas
|
||||
,o.odate
|
||||
,og.sortmo
|
||||
,o.sseas
|
||||
,o.sdate
|
||||
,sg.sortmo
|
||||
-- ,o.calc_status
|
||||
)
|
||||
-- SELECT * FROM ngrp
|
||||
,nguid AS (
|
||||
SELECT
|
||||
grp.account
|
||||
,grp.shipgrp
|
||||
,grp.chan
|
||||
,r.repp dsm
|
||||
,r.director
|
||||
,grp.shipgrp||'.'||r.repp lu
|
||||
-- ,grp.partgroup
|
||||
-- ,grp.pricegroup
|
||||
,grp.part
|
||||
-- ,grp.glec
|
||||
,2026 oseas
|
||||
,grp.omon
|
||||
,grp.odate
|
||||
,(2026- grp.oseas) + grp.sseas sseas
|
||||
,grp.smon
|
||||
,grp.sdate
|
||||
,grp.lbs
|
||||
,grp.qty
|
||||
,grp.sales_usd
|
||||
,CASE WHEN round(grp.sales_usd/grp.qty,5) = 0 THEN null ELSE round(grp.sales_usd/grp.qty,5) END hist_price
|
||||
,grp.cost_curstd_usd
|
||||
,sum(grp.lbs) OVER (PARTITION BY shipgrp, dsm) shiplbs
|
||||
,CASE WHEN seq.floor = 0 THEN null else seq.floor END floor
|
||||
,CASE WHEN seq.ceiling = 0 THEN null else seq.ceiling END ceiling
|
||||
,seq.uselimits
|
||||
,seq.price
|
||||
,seq.avgprice
|
||||
,seq.pltq
|
||||
,ROUND(CASE WHEN seq.uselimits THEN
|
||||
CASE
|
||||
WHEN glec = '1NU' THEN
|
||||
--if more than 8/24 pallets, use floor
|
||||
CASE WHEN grp.qty >= 24*seq.pltq THEN seq.floor
|
||||
-- if more than a pallet use the target price
|
||||
ELSE CASE WHEN qtyord >= 8*seq.pltq THEN (seq.ceiling + seq.floor) / 2
|
||||
-- if more than a pallet use the target price
|
||||
ELSE CASE WHEN qtyord >= 2*seq.pltq THEN seq.ceiling
|
||||
-- if more than a pallet use the target price
|
||||
ELSE seq.ceiling * 1.05
|
||||
END END END
|
||||
ELSE
|
||||
CASE WHEN pricegroup ~ '(Hanger|Dish)' THEN
|
||||
--at least 1 pallets is lower limit
|
||||
CASE WHEN qtyord >= 01*seq.pltq THEN seq.floor
|
||||
--at least 2 pallets is mid range
|
||||
ELSE CASE WHEN qtyord >= 0.5*seq.pltq THEN (seq.ceiling + seq.floor) / 2
|
||||
--less than a pallet is upper + 15%
|
||||
ELSE seq.ceiling
|
||||
END END
|
||||
ELSE
|
||||
--at least 8 pallets is lower limit
|
||||
CASE WHEN qtyord >= 08*seq.pltq THEN seq.floor
|
||||
--at least 2 pallets is mid range
|
||||
ELSE CASE WHEN qtyord >= 2*seq.pltq THEN (seq.ceiling + seq.floor) / 2
|
||||
--at least 1 pallet is upper range
|
||||
ELSE CASE WHEN qtyord >= 1*seq.pltq THEN seq.ceiling
|
||||
--less than a pallet is upper + 15%
|
||||
ELSE seq.ceiling * 1.15
|
||||
END END END
|
||||
END
|
||||
END
|
||||
ELSE
|
||||
null
|
||||
END,5) guid
|
||||
FROM
|
||||
ngrp grp
|
||||
LEFT OUTER JOIN nseq seq ON
|
||||
seq.ship_dba = grp.shipgrp
|
||||
AND seq.bill_dba = grp.account
|
||||
AND seq.part = grp.part
|
||||
AND seq.rn = 1
|
||||
LEFT OUTER JOIN rlarp.repc r ON
|
||||
r.rcode = grp.dsm
|
||||
)
|
||||
select * from nguid
|
||||
|
||||
-- ,orphans AS (
|
||||
-- SELECT
|
||||
-- account
|
||||
-- ,shipgrp
|
||||
-- ,chan
|
||||
-- ,dsm
|
||||
-- ,director
|
||||
-- ,lu
|
||||
-- --,partgroup
|
||||
-- --,pricegroup
|
||||
-- ,part
|
||||
-- -- ,glec
|
||||
-- ,oseas
|
||||
-- ,omon
|
||||
-- -- ,odate
|
||||
-- ,sseas
|
||||
-- ,smon
|
||||
-- -- ,sdate
|
||||
-- ,lbs
|
||||
-- ,qty
|
||||
-- ,sales_usd
|
||||
-- ,hist_price
|
||||
-- ,cost_curstd_usd
|
||||
-- ,shiplbs
|
||||
-- ,floor
|
||||
-- ,ceiling
|
||||
-- ,uselimits
|
||||
-- ,price
|
||||
-- ,avgprice
|
||||
-- ,pltq
|
||||
-- ,guid
|
||||
-- ,least(hist_price, price, avgprice) lowest_last
|
||||
-- ,least(hist_price, price, avgprice, floor) lowest_floor
|
||||
-- FROM
|
||||
-- nguid
|
||||
-- )
|
||||
-- SELECT * FROM orphans
|
||||
4485
offline/customer_flags.pg.sql
Normal file
4485
offline/customer_flags.pg.sql
Normal file
File diff suppressed because it is too large
Load Diff
2
offline/flag_count.sql
Normal file
2
offline/flag_count.sql
Normal file
@ -0,0 +1,2 @@
|
||||
select shipgrp, CASE WHEN count(distinct flag) > 1 THEN 'Floor' ELSE string_agg(DISTINCT flag,', ') END from rlarp.cust_flag group by shipgrp
|
||||
-- select shipgrp, dsm, flag from rlarp.cust_flag
|
||||
353
offline/keystone.pg.sql
Normal file
353
offline/keystone.pg.sql
Normal file
@ -0,0 +1,353 @@
|
||||
WITH
|
||||
customers AS (
|
||||
SELECT shipgrp,dsm,pounds::numeric pounds FROM (VALUES
|
||||
('AL PAR PEAT CO','10035 - MATTHEW STAAL','20000'),
|
||||
('AMA PLASTICS','40040 - TINA PETTIGREW','10000'),
|
||||
('AMERICAN FARMS','10039 - DUSTIN KUYKENDOLL','50000'),
|
||||
('ARMSTRONG GROWERS','30035 - RODNEY RIOS','50000'),
|
||||
('AUBIN NURSERIES LTD','40040 - TINA PETTIGREW','5000'),
|
||||
('BRADFORD CO-OP STORAGE LTD','40040 - TINA PETTIGREW','5000'),
|
||||
('BRADFORD GREENHOUSES','40040 - TINA PETTIGREW','50000'),
|
||||
('CAL COLOR','30054 - JASON MOTTIN','15000'),
|
||||
('CONROE GREENHOUSES INC','10041 - TAMARA RISKEN','13438'),
|
||||
('CY GROWERS SUPPLIES LTD','40042 - TOM MORRIS','18710'),
|
||||
('DAN & JERRYS GREENHOUSE','13027 - STEVE RUSTEBERG','50000'),
|
||||
('DEVRY GREENHOUSES','40042 - TOM MORRIS','24957'),
|
||||
('DREAM WITH COLORS','30035 - RODNEY RIOS','50000'),
|
||||
('ENCHANTED GARDENS','10041 - TAMARA RISKEN','2396'),
|
||||
('FREEMAN HERBS','40039 - DAVE BODO','20000'),
|
||||
('GARDEN STATE GROWERS','10043 - CHERISSE GILSTROP','60000'),
|
||||
('GREAT LAKES GREENHOUSES','13025 - JAMES REGER','2000'),
|
||||
('GREEN LAKE NURSERY','10041 - TAMARA RISKEN','11218'),
|
||||
('HALIFAX SEED CO INC','40040 - TINA PETTIGREW','5000'),
|
||||
('HARTS NURSERY','30053 - SKYE SAWYER','15000'),
|
||||
('HEARTLAND GROWERS','10048 - PHILIP BIEDENBACH','67000'),
|
||||
('HJS WHOLESALE LTD','40040 - TINA PETTIGREW','10000'),
|
||||
('HYDROGARDEN SUPPLY SERVICES','40040 - TINA PETTIGREW','10000'),
|
||||
('IRRIGATION PLUS INC','40040 - TINA PETTIGREW','3000'),
|
||||
('IWASAKI BROS INC','30053 - SKYE SAWYER','14000'),
|
||||
('JEFFRIES NURSERIES','40040 - TINA PETTIGREW','5000'),
|
||||
('JOHNSON GARDEN CENTER','10041 - TAMARA RISKEN','1240'),
|
||||
('KAW VALLEY GREENHOUSES','10041 - TAMARA RISKEN','6100'),
|
||||
('KAWAHARA NURSERY','30054 - JASON MOTTIN','25000'),
|
||||
('LA FERME GROVER INC','40043 - JEFFREY SCHAEFER','4000'),
|
||||
('LUCAS GREENHOUSE','10043 - CHERISSE GILSTROP','22500'),
|
||||
('MARIA GARDENS','10048 - PHILIP BIEDENBACH','9000'),
|
||||
('MARTINSON''S GARDEN WORKS','10049 - STEVEN STUPPIELLO','50000'),
|
||||
('MEYERS FRUIT FARM','70011 - DNU-SUSAN MURTAUGH','20000'),
|
||||
('NOEL WILSON INC','40043 - JEFFREY SCHAEFER','20000'),
|
||||
('NUTRIEN AG SOLUTIONS','40042 - TOM MORRIS','8993'),
|
||||
('OELSCHIG NURSERY INC','10040 - RYAN CHITWOOD','56924'),
|
||||
('OLSONS GREENHOUSE GARDENS','12028 - JACOB WILKINSON','20000'),
|
||||
('PACIFIC GROWER','30053 - SKYE SAWYER','88000'),
|
||||
('PARKS BROTHERS FARMS','10041 - TAMARA RISKEN','10380'),
|
||||
('PETERSON NURSERY LLC','10041 - TAMARA RISKEN','2396'),
|
||||
('PINEAE GREENHOUSES & DIST INC','12028 - JACOB WILKINSON','50000'),
|
||||
('PLEASANT VALLEY FARM INC','10041 - TAMARA RISKEN','54666'),
|
||||
('PLEASANT VIEW GARDENS','13028 - RICHARD MEULE','28000'),
|
||||
('RAINBOW GREENHOUSES','40042 - TOM MORRIS','7929'),
|
||||
('REKKER GARDENS INC','40040 - TINA PETTIGREW','2500'),
|
||||
('RICHARDSON BROS GREENHOUSE INC','13027 - STEVE RUSTEBERG','90000'),
|
||||
('ROWE PLANT FARM','10041 - TAMARA RISKEN','4096'),
|
||||
('SEDAN FLORAL','10041 - TAMARA RISKEN','27744'),
|
||||
('SHERIDAN NURSERIES','40039 - DAVE BODO','18816'),
|
||||
('SMITH GARDENS INC','30053 - SKYE SAWYER','44000'),
|
||||
('STOKLEY NURSERY','10049 - STEVEN STUPPIELLO','80000'),
|
||||
('TERIS SUPPLY SERVICES','40043 - JEFFREY SCHAEFER','12000'),
|
||||
('TIDAL CREEK GROWERS','10043 - CHERISSE GILSTROP','20623'),
|
||||
('UNCLE JOHN''S PLANT FARM','10048 - PHILIP BIEDENBACH','10000'),
|
||||
('WELBY GARDENS','12028 - JACOB WILKINSON','4507')
|
||||
) x(shipgrp,dsm,pounds)
|
||||
)
|
||||
,parts AS (
|
||||
SELECT part,units::numeric units,price::numeric price,pounds::numeric pounds FROM (VALUES
|
||||
('KEP010P0G18B524','43378',0.04,956.4849,0.02205),
|
||||
('KET12P10G18B027','3615',0.54,1075.8963,0.29762),
|
||||
('KEP010Q0G18B281','28919',0.072,1275.03871,0.04409),
|
||||
('KET08Q11G18B019','3615',0.6785,914.595,0.253),
|
||||
('KEP015P0G18B316','36149',0.05506,956.50254,0.02646),
|
||||
('KET10P15G18B030','3615',0.5488,1075.8963,0.29762),
|
||||
('KEP020Q0G18B170','28919',0.105,1912.70266,0.06614),
|
||||
('KET08Q21G18B019','3615',0.9132,1753.3473,0.48502)
|
||||
) x(part,units,price,pounds,weight)
|
||||
)
|
||||
,seg AS (
|
||||
SELECT
|
||||
x.GLEC glec
|
||||
,x.SEGM segm
|
||||
FROM
|
||||
(
|
||||
VALUES
|
||||
('1SU','Sustainable'),
|
||||
('1CU','Sustainable'),
|
||||
('1GR','Greenhouse'),
|
||||
('1NU','Nursery'),
|
||||
('1RE','Retail'),
|
||||
('2WI','Greenhouse'),
|
||||
('3BM','Other'),
|
||||
('3CO','Other'),
|
||||
('3PE','Other'),
|
||||
('3PP','Other'),
|
||||
('4CO','Other'),
|
||||
('4RA','Other'),
|
||||
('9MI','Other'),
|
||||
('9SA','Other'),
|
||||
('9TO','Other')
|
||||
) X(GLEC, SEGM)
|
||||
)
|
||||
,keystone AS (
|
||||
select
|
||||
c.shipgrp
|
||||
,c.dsm
|
||||
,c.pounds
|
||||
,p.part
|
||||
,p.units
|
||||
,p.price
|
||||
,p.pounds
|
||||
,c.pounds/10000 scale
|
||||
,round((c.pounds/10000)*p.units,0) fc_units
|
||||
,round((c.pounds/10000)*p.units,0)*(p.pounds/p.units) fc_lbs
|
||||
FROM
|
||||
customers c
|
||||
CROSS JOIN parts p
|
||||
)
|
||||
,alldates AS (
|
||||
SELECT
|
||||
bill_cust_descr
|
||||
,ship_cust_descr
|
||||
,shipto_group
|
||||
,promo
|
||||
,terms
|
||||
,r_currency
|
||||
-- ,order_month
|
||||
-- ,mseq.s seq
|
||||
,order_date
|
||||
-- ,request_date
|
||||
,ship_date
|
||||
-- ,ship_month
|
||||
-- ,sum(value_usd) value_usd_net
|
||||
,sum(pounds) pounds_net
|
||||
-- ,sum(value_usd) FILTER (WHERE iter IN ('copy','actuals','actuals_plug')) value_usd_baseline
|
||||
,sum(pounds) FILTER (WHERE iter IN ('copy','actuals','actuals_plug')) pounds_baseline
|
||||
FROM
|
||||
rlarp.osm_pool
|
||||
WHERE
|
||||
shipto_group IN (select distinct shipgrp FROM customers)
|
||||
-----------------scenario----------------------------
|
||||
-- AND version IN ('b26')
|
||||
AND order_season = 2026
|
||||
AND ship_season = 2026
|
||||
-----------------additional params-------------------
|
||||
AND calc_status||flag <> 'CLOSEDREMAINDER' --exclude short ships when building order adjustments
|
||||
AND order_date <= ship_date
|
||||
GROUP BY
|
||||
bill_cust_descr
|
||||
,ship_cust_descr
|
||||
,shipto_group
|
||||
,promo
|
||||
,terms
|
||||
,r_currency
|
||||
-- ,order_month
|
||||
-- ,mseq.s seq
|
||||
,order_date
|
||||
-- ,request_date
|
||||
,ship_date
|
||||
-- ,ship_month
|
||||
-- HAVING
|
||||
-- sum(value_usd) <> 0
|
||||
)
|
||||
,date_rank as (
|
||||
SELECT
|
||||
bill_cust_descr
|
||||
,ship_cust_descr
|
||||
,shipto_group
|
||||
,promo
|
||||
,terms
|
||||
,r_currency
|
||||
,order_date
|
||||
,ship_date
|
||||
,row_number() over (partition by shipto_group order by pounds_baseline desc) rn
|
||||
,COALESCE(pounds_baseline ,pounds_net) pounds
|
||||
-- ,CASE WHEN sum(pounds_net) OVER () = 0 THEN 0 ELSE round(pounds_net / sum(pounds_net) OVER (),5) END fc_mix
|
||||
-- ,CASE WHEN sum(pounds_baseline) OVER () = 0 THEN 0 ELSE round(pounds_baseline / sum(pounds_baseline) OVER (),5) END baseline_mix
|
||||
FROM
|
||||
alldates
|
||||
ORDER BY
|
||||
order_date ASC
|
||||
,ship_date ASC
|
||||
)
|
||||
,date_mix as (
|
||||
SELECT
|
||||
bill_cust_descr
|
||||
,ship_cust_descr
|
||||
,shipto_group
|
||||
,promo
|
||||
,terms
|
||||
,r_currency
|
||||
,order_date
|
||||
,ship_date
|
||||
,rn
|
||||
,pounds/sum(pounds) over (partition by shipto_group) mix
|
||||
-- ,CASE WHEN sum(pounds_net) OVER () = 0 THEN 0 ELSE round(pounds_net / sum(pounds_net) OVER (),5) END fc_mix
|
||||
-- ,CASE WHEN sum(pounds_baseline) OVER () = 0 THEN 0 ELSE round(pounds_baseline / sum(pounds_baseline) OVER (),5) END baseline_mix
|
||||
FROM
|
||||
date_rank
|
||||
WHERE
|
||||
rn <= 3
|
||||
ORDER BY
|
||||
order_date ASC
|
||||
,ship_date ASC
|
||||
)
|
||||
,combine AS (
|
||||
SELECT
|
||||
k.*
|
||||
,d.*
|
||||
,k.scale * d.mix factor
|
||||
,d.mix * k.scale * k.fc_lbs split_pounds
|
||||
,d.mix * k.scale * k.units split_units
|
||||
FROM
|
||||
keystone k
|
||||
LEFT OUTER JOIN date_mix d ON
|
||||
d.shipto_group = k.shipgrp
|
||||
)
|
||||
-- SELECT * FROM date_mix where shipto_group ~ 'SHERIDAN'
|
||||
-- select * from combine
|
||||
,basemix AS (
|
||||
SELECT
|
||||
od.fspr
|
||||
,c.promo
|
||||
,c.terms
|
||||
,c.r_currency
|
||||
,c.bill_cust_descr
|
||||
,c.ship_cust_descr
|
||||
,c.dsm quota_rep_descr
|
||||
,c.part
|
||||
,round(c.factor * c.units,0) units
|
||||
,round(c.factor * c.fc_lbs,0) pounds
|
||||
,round(c.factor * c.units,0)* c.price value_usd --assume that target dollars are USD
|
||||
,c.order_date
|
||||
,od.sortmo order_month
|
||||
,od.ssyr order_season
|
||||
,c.ship_date request_date
|
||||
,sd.sortmo request_month
|
||||
,sd.ssyr request_season
|
||||
,c.ship_date
|
||||
,sd.sortmo ship_month
|
||||
,sd.ssyr ship_season
|
||||
,c.factor
|
||||
,c.split_pounds
|
||||
FROM
|
||||
combine c
|
||||
LEFT OUTER JOIN rlarp.gld sd ON
|
||||
c.ship_date <@ sd.drange
|
||||
LEFT OUTER JOIN rlarp.gld od ON
|
||||
c.order_date <@ od.drange
|
||||
)
|
||||
,log AS (
|
||||
INSERT INTO rlarp.osm_log (doc) SELECT jsonb_build_object('user',current_user,'tag','Keystone Incr','type','Keystone Incr','stamp',current_timestamp,'source','top level','message','Keystone Incr') RETURNING *
|
||||
)
|
||||
,final AS (
|
||||
SELECT
|
||||
b.fspr
|
||||
,i.dplt plnt
|
||||
,b.promo
|
||||
,b.terms
|
||||
,b.bill_cust_descr
|
||||
,b.ship_cust_descr
|
||||
,r.rcode
|
||||
,b.quota_rep_descr
|
||||
,r.director
|
||||
,bc.dba billto_group
|
||||
,sc.dba shipto_group
|
||||
,CASE SUBSTRING(bc.cclass,2,3)
|
||||
--if the bill to class is ditsributor, then it's either warehouse or drop
|
||||
WHEN 'DIS' THEN
|
||||
--if the ship-to is a different name than the bill-to then it's drop, otherwise it's warehouse
|
||||
CASE SUBSTRING(sc.cclass,2,3)
|
||||
WHEN 'DIS' THEN 'WHS'
|
||||
ELSE 'DRP'
|
||||
END
|
||||
--CASE WHEN RTRIM(SUBSTRING(LTRIM(SC.BVADR7)||SC.BVNAME,1,30)) = RTRIM(SUBSTRING(LTRIM(BC.BVADR7)||BC.BVNAME,1,30)) THEN 'DIS' ELSE 'DRP' END
|
||||
--everything else does not involve a distributor and is considered direct
|
||||
ELSE 'DIR'
|
||||
END chan
|
||||
,CASE SUBSTRING(bc.cclass,2,3)
|
||||
WHEN 'DIS' THEN
|
||||
--if the ship-to is a different name than the bill-to then it's drop, otherwise it's warehouse
|
||||
CASE SUBSTRING(sc.cclass,2,3)
|
||||
WHEN 'DIS' THEN 'WHS'
|
||||
ELSE CASE SUBSTRING(sc.cclass,1,1) WHEN 'R' THEN 'RDP' ELSE 'DRP' END
|
||||
END
|
||||
WHEN 'MAS' THEN 'RMN'
|
||||
WHEN 'NAT' THEN 'RMN'
|
||||
ELSE CASE SUBSTRING(sc.cclass,1,1) WHEN 'R' THEN 'RDI' ELSE 'DIR' END
|
||||
END chansub
|
||||
,null::text chan_retail
|
||||
,b.part
|
||||
,b.part || ' - ' || i.descr
|
||||
,i.partgroup
|
||||
,i.branding
|
||||
,i.majgd majg_descr
|
||||
,i.mingd ming_descr
|
||||
,i.majsd majs_descr
|
||||
,i.minsd mins_descr
|
||||
,seg.segm
|
||||
,CASE WHEN i.majg = '610' THEN 'Fiber' ELSE 'Plastic' END substance
|
||||
,'41010' fs_line --master data
|
||||
,b.r_currency --history cust mix
|
||||
,rx.rate r_rate --master data
|
||||
,pl.curr c_currency --master data
|
||||
,cx.rate c_rate --master data
|
||||
,round(b.units ,2) units
|
||||
,round((b.value_usd / COALESCE(rx.rate,1))::numeric ,2) value_loc --b.value is denominated in USD, need to apply currency to get to local, assume 1 if using a fake customer
|
||||
,round(b.value_usd ,2) value_usd --b.value is already denominated in usd
|
||||
,round((i.futstd*b.units)::numeric ,2) cost_loc
|
||||
,round((i.futstdus*b.units)::numeric,2) cost_usd
|
||||
,'CLOSED' calc_status
|
||||
,'SHIPMENT' flag
|
||||
,b.order_date
|
||||
,b.order_month
|
||||
,b.order_season
|
||||
,b.request_date
|
||||
,b.request_month
|
||||
,b.request_season
|
||||
,b.ship_date
|
||||
,b.ship_month
|
||||
,b.ship_season
|
||||
,'b26' "version"
|
||||
,'Keystone Incr' iter
|
||||
,log.id
|
||||
,COALESCE(log.doc->>'tag','') "tag"
|
||||
,log.doc->>'message' "comment"
|
||||
,log.doc->>'type' module
|
||||
,round(b.units * i.nwht * CASE i.nwun WHEN 'KG' THEN 2.2046 ELSE 1 END, 2) pounds
|
||||
-- ,i.nwht * CASE i.nwun WHEN 'KG' THEN 2.2046 ELSE 1 END weight
|
||||
-- ,b.pounds ref_pounds
|
||||
FROM
|
||||
basemix b
|
||||
CROSS JOIN log
|
||||
LEFT OUTER JOIN rlarp.repc r ON
|
||||
r.repp = b.quota_rep_descr
|
||||
LEFT OUTER JOIN "CMS.CUSLG".itemm i ON
|
||||
i.item = b.part
|
||||
LEFT OUTER JOIN rlarp.cust bc ON
|
||||
bc.code = rtrim(substring(b.bill_cust_descr,1,8))
|
||||
LEFT OUTER JOIN rlarp.cust sc ON
|
||||
sc.code = rtrim(substring(b.ship_cust_descr,1,8))
|
||||
LEFT OUTER JOIN seg ON
|
||||
seg.glec = i.glec
|
||||
LEFT OUTER JOIN rlarp.plpr pl ON
|
||||
pl.plnt = i.dplt
|
||||
LEFT OUTER JOIN rlarp.ffcret cx ON
|
||||
cx.perd = pl.gl AND
|
||||
cx.rtyp = 'MA' AND
|
||||
cx.fcur = pl.curr AND
|
||||
cx.tcur = 'US'
|
||||
LEFT OUTER JOIN rlarp.ffcret rx ON
|
||||
rx.perd = pl.gl AND
|
||||
rx.rtyp = 'MA' AND
|
||||
rx.fcur = b.r_currency AND
|
||||
rx.tcur = 'US'
|
||||
)
|
||||
INSERT INTO rlarp.osm_pool SELECT * FROM final;
|
||||
-- select * from final
|
||||
1787
offline/mass_scale_decr.sql
Normal file
1787
offline/mass_scale_decr.sql
Normal file
File diff suppressed because it is too large
Load Diff
1787
offline/mass_scale_incr.sql
Normal file
1787
offline/mass_scale_incr.sql
Normal file
File diff suppressed because it is too large
Load Diff
377
offline/new_cust_profile.pg.sql
Normal file
377
offline/new_cust_profile.pg.sql
Normal file
@ -0,0 +1,377 @@
|
||||
WITH
|
||||
newc AS (
|
||||
SELECT * FROM (VALUES
|
||||
('4 ACES','10041 - TAMARA RISKEN'),
|
||||
('A&W ANNUALS','10039 - DUSTIN KUYKENDOLL'),
|
||||
('A GARDEN CENTER','30053 - SKYE SAWYER'),
|
||||
('ALASKA GDN & PET SUPPLY RET','30053 - SKYE SAWYER'),
|
||||
('ALASKA MILL AND FEED','30053 - SKYE SAWYER'),
|
||||
('ALPHA NURSERY','30053 - SKYE SAWYER'),
|
||||
('ANDYS GARDENS','10048 - PHILIP BIEDENBACH'),
|
||||
('ARNOLDS GREENHOUSE INC','10041 - TAMARA RISKEN'),
|
||||
('ASHCOMBE FARM & GREENHOUSE','10048 - PHILIP BIEDENBACH'),
|
||||
('AVA NURSERY','10046 - DUSTIN KUYKENDOLL 2'),
|
||||
('BAYSIDE GARDEN CENTER','13027 - STEVE RUSTEBERG'),
|
||||
('BAYVIEW GREENHOUSES','40039 - DAVE BODO'),
|
||||
('BEAUTIFUL LAND PRODUCTS','13027 - STEVE RUSTEBERG'),
|
||||
('BEAVER BARK LTD','30053 - SKYE SAWYER'),
|
||||
('BEDROCK NURSERY','10041 - TAMARA RISKEN'),
|
||||
('BELLE INVESTMENTS','10039 - DUSTIN KUYKENDOLL'),
|
||||
('BLUE HERON FARM','30053 - SKYE SAWYER'),
|
||||
('BOBBY MURRAY FARMS','10041 - TAMARA RISKEN'),
|
||||
('BOEKESTYN GREENHOUSES LTD','40039 - DAVE BODO'),
|
||||
('BREEZY HILL NURSERY','13027 - STEVE RUSTEBERG'),
|
||||
('BRENTANOS TREE FARM','30053 - SKYE SAWYER'),
|
||||
('BRIGGS NURSERY','30053 - SKYE SAWYER'),
|
||||
('CAAN FLORAL CO INC','13027 - STEVE RUSTEBERG'),
|
||||
('CAPOGNA FLOWERS','40039 - DAVE BODO'),
|
||||
('CARPINITO BROTHERS INC','30053 - SKYE SAWYER'),
|
||||
('CHRIS DOYLE PLANT BROKERAGE','10041 - TAMARA RISKEN'),
|
||||
('CINDYS GREENHOUSE','13027 - STEVE RUSTEBERG'),
|
||||
('D''ADDIO FAMILY NURSERY','10048 - PHILIP BIEDENBACH'),
|
||||
('DAHLINGHAUS VENTURES LLC','10048 - PHILIP BIEDENBACH'),
|
||||
('DAYNABROOK GREENHOUSES','10048 - PHILIP BIEDENBACH'),
|
||||
('DESERT FOREST NURSERY','30035 - RODNEY RIOS'),
|
||||
('DESERT HORIZON NURSERY','30035 - RODNEY RIOS'),
|
||||
('DETWEILER''S FLOWERS','10048 - PHILIP BIEDENBACH'),
|
||||
('DGI','10035 - MATTHEW STAAL'),
|
||||
('DOAN''S NURSERY INC.','10041 - TAMARA RISKEN'),
|
||||
('DRY LAND NATIVE GRASSES','10041 - TAMARA RISKEN'),
|
||||
('EDGEWOOD GREENHOUSE','13027 - STEVE RUSTEBERG'),
|
||||
('FERGUSON LANDSCAPE','13027 - STEVE RUSTEBERG'),
|
||||
('FISHER FARMS','30053 - SKYE SAWYER'),
|
||||
('GEORGE''S PLANT FARM','10040 - RYAN CHITWOOD'),
|
||||
('GIESEL''S GREENHOUSE','10041 - TAMARA RISKEN'),
|
||||
('GILSON FAMILY ENTERPRISE','10042 - JEREMY RHAULT'),
|
||||
('GOLD COAST FARMS LLC','30035 - RODNEY RIOS'),
|
||||
('GOLD HILL NURSERY','30053 - SKYE SAWYER'),
|
||||
('GROWERS NURSERY SUPPLY INC','30053 - SKYE SAWYER'),
|
||||
('HEIRLOOM ROSES','30053 - SKYE SAWYER'),
|
||||
('HENRY WHALEN AND SONS GHSE','10043 - CHERISSE GILSTROP'),
|
||||
('HIGHLAND FARMS','12028 - JACOB WILKINSON'),
|
||||
('HILLEN NURSERY LTD','40039 - DAVE BODO'),
|
||||
('HONEYMOON ACRES','13027 - STEVE RUSTEBERG'),
|
||||
('HOSTYN HILL GREENHOUSE','10041 - TAMARA RISKEN'),
|
||||
('HSU''S','13027 - STEVE RUSTEBERG'),
|
||||
('HUIZENGA BRO GREENHOUSE INC','10035 - MATTHEW STAAL'),
|
||||
('I & G FARM INC','10043 - CHERISSE GILSTROP'),
|
||||
('IMPERIAL''S GARDEN INC','30053 - SKYE SAWYER'),
|
||||
('J FRANK GAUDET TREE NURSERY','40040 - TINA PETTIGREW'),
|
||||
('JACOBSONS GREENHOUSE','30053 - SKYE SAWYER'),
|
||||
('JAMPLAST INC','13027 - STEVE RUSTEBERG'),
|
||||
('JEFF PARSLEY PLANT FARM','10041 - TAMARA RISKEN'),
|
||||
('JEFFEREYS GREENHOUSES','40039 - DAVE BODO'),
|
||||
('KATOS NURSERY','40042 - TOM MORRIS'),
|
||||
('KATYDID GREENHOUSE','10040 - RYAN CHITWOOD'),
|
||||
('LANCASTER FARM','10040 - RYAN CHITWOOD'),
|
||||
('LENO PLANT FARM','10041 - TAMARA RISKEN'),
|
||||
('LIMA GREENHOUSES','30053 - SKYE SAWYER'),
|
||||
('LINNAEA NURSERIES LTD','40042 - TOM MORRIS'),
|
||||
('MAGNOLIA GARDENS','10041 - TAMARA RISKEN'),
|
||||
('MARCUMS NURSERY','10041 - TAMARA RISKEN'),
|
||||
('MARTIN''S NURSERY INC','10047 - RYAN CHITWOOD 2'),
|
||||
('MAYS GREENHOUSE','10048 - PHILIP BIEDENBACH'),
|
||||
('MCCALLISTERS LNDSCP SUPPLY','10041 - TAMARA RISKEN'),
|
||||
('MCCALLS NURSERIES INC','30054 - JASON MOTTIN'),
|
||||
('MEADOWLARK ORNAMENTALS LLC','12028 - JACOB WILKINSON'),
|
||||
('MEDARY ACRES GHSE','13027 - STEVE RUSTEBERG'),
|
||||
('MEDFORD NURSERY INC','10043 - CHERISSE GILSTROP'),
|
||||
('MESQUITE VALLEY GROWERS','30035 - RODNEY RIOS'),
|
||||
('MILLERS BLUE MOUNTAIN GHSE','10043 - CHERISSE GILSTROP'),
|
||||
('MR GREENJEANS FARM MARKET','10043 - CHERISSE GILSTROP'),
|
||||
('MULTIFAB, INC','30053 - SKYE SAWYER'),
|
||||
('NATURALLY BEAUTIFUL PLANT PROD','10043 - CHERISSE GILSTROP'),
|
||||
('NORTHWEST PLANT COMPANY','30053 - SKYE SAWYER'),
|
||||
('OSO GROWERS INC.','10041 - TAMARA RISKEN'),
|
||||
('PARSLEYS PLANT FARM','10041 - TAMARA RISKEN'),
|
||||
('PAYNES NURSERIES & GREENHOUSE','12028 - JACOB WILKINSON'),
|
||||
('PHELPS NURSERY','10048 - PHILIP BIEDENBACH'),
|
||||
('PINE VIEW FARM','10048 - PHILIP BIEDENBACH'),
|
||||
('QUALITREE PROPAGATORS','40042 - TOM MORRIS'),
|
||||
('RAZBUTON INC','10039 - DUSTIN KUYKENDOLL'),
|
||||
('REARDON NURSERY','30053 - SKYE SAWYER'),
|
||||
('SCHROCK SALES','10048 - PHILIP BIEDENBACH'),
|
||||
('SHANER AVENUE NURSERY','10035 - MATTHEW STAAL'),
|
||||
('SHERMAN PLASTICS','13027 - STEVE RUSTEBERG'),
|
||||
('SLC STORE','12028 - JACOB WILKINSON'),
|
||||
('SMITH NURSERY','10041 - TAMARA RISKEN'),
|
||||
('STARLING NURSERY','10046 - DUSTIN KUYKENDOLL 2'),
|
||||
('STEUBER GREENHOUSE','13027 - STEVE RUSTEBERG'),
|
||||
('STEWARTS GREENHOUSE','10046 - DUSTIN KUYKENDOLL 2'),
|
||||
('STOKLEY NURSERY','10047 - RYAN CHITWOOD 2'),
|
||||
('SUAREZ PLANT FARM','10041 - TAMARA RISKEN'),
|
||||
('SUN NURSERIES','10043 - CHERISSE GILSTROP'),
|
||||
('SUNLAND NURSERY','12028 - JACOB WILKINSON'),
|
||||
('SUNRISE GREENHOUSES','40039 - DAVE BODO'),
|
||||
('TEJANA NURSERY','10041 - TAMARA RISKEN'),
|
||||
('THOMAS BECNEL','10041 - TAMARA RISKEN'),
|
||||
('THOMAS BECNEL CITRUS','10041 - TAMARA RISKEN'),
|
||||
('TOM DE SANTO GREENHOUSES','30053 - SKYE SAWYER'),
|
||||
('TONYS GARDEN CENTER','30053 - SKYE SAWYER'),
|
||||
('TREESEARCH FARMS INC','10041 - TAMARA RISKEN'),
|
||||
('UNITED CENTRAL ORCHIDS','13027 - STEVE RUSTEBERG'),
|
||||
('VAN BELLE NURSERY','40042 - TOM MORRIS'),
|
||||
('VAN KLAVEREN''S NURSERY LLC','30053 - SKYE SAWYER'),
|
||||
('VARGAS NURSERY','10041 - TAMARA RISKEN'),
|
||||
('WALNUT GROVE NURSERY','40042 - TOM MORRIS'),
|
||||
('WATERTOWN FLORAL','13027 - STEVE RUSTEBERG'),
|
||||
('WAYFAIR LLC','90015 - ANN MARIE FOX'),
|
||||
('WEAKLAND GREENHOUSES','12028 - JACOB WILKINSON'),
|
||||
('WOODS GREENHOUSE','10043 - CHERISSE GILSTROP'),
|
||||
('YC NURSERIES INC','10041 - TAMARA RISKEN'),
|
||||
('A&R SPADA FARMS LLC','30053 - SKYE SAWYER'),
|
||||
('CI FARMS LLC','30054 - JASON MOTTIN'),
|
||||
('GOLDEN EAGLE TREES','40042 - TOM MORRIS'),
|
||||
('TSC NURSERY SALES LTD','40042 - TOM MORRIS')
|
||||
) x(Renamed,ReRep)
|
||||
)
|
||||
,profile AS (
|
||||
SELECT * FROM rlarp.osm WHERE shipgrp IN (select distinct renamed FROM newc ) AND oseas >= 2018
|
||||
)
|
||||
-- SELECT * FROM profile
|
||||
,checkc AS (
|
||||
SELECT shipgrp, min(oseas) oseas FROM profile GROUP BY shipgrp
|
||||
)
|
||||
-- select * from checkc
|
||||
-- SELECT cust, sum(fb_qty) FROM newc LEFT OUTER JOIN profile ON shipgrp = cust GROUP by cust
|
||||
----grouped prices-------------
|
||||
,npgrp AS (
|
||||
SELECT
|
||||
o.bill_dba
|
||||
,o.ship_dba
|
||||
,o.dsm
|
||||
,i.partgroup
|
||||
,i.pricegroup
|
||||
,o.part
|
||||
,o.odate
|
||||
,o.qtyord
|
||||
,i.nwht * CASE WHEN i.nwun = 'KG' THEN 2.2 ELSE 1 END lbs
|
||||
,i.mpck pltq
|
||||
,ROUND(o.sales_usd / o.qty,5) price
|
||||
,(o.pricing->>'guidance_price')::NUMERIC guidance
|
||||
,(o.pricing->>'floor' )::numeric(15,5) floor
|
||||
,(o.pricing->>'ceiling')::numeric(15,5) ceiling
|
||||
,(o.pricing->>'uselimits')::boolean uselimits
|
||||
FROM
|
||||
rlarp.osm_stack o
|
||||
LEFT OUTER JOIN "CMS.CUSLG".itemm i ON
|
||||
i.item = o.part
|
||||
INNER JOIN checkc c ON
|
||||
c.shipgrp = o.customer
|
||||
AND c.oseas = o.oseas
|
||||
WHERE
|
||||
VERSION = 'Actual'
|
||||
AND o.oseas >= 2018
|
||||
AND calc_status <> 'CANCELED'
|
||||
AND o.fs_line = '41010'
|
||||
AND o.part <> ''
|
||||
AND substring(o.glec,1,1) <= '2'
|
||||
AND o.qty <> 0
|
||||
AND o.sseas IS NOT NULL
|
||||
-- AND customer in (select distinct renamed FROM newc )
|
||||
GROUP BY
|
||||
o.bill_dba
|
||||
,o.ship_dba
|
||||
,o.dsm
|
||||
,i.partgroup
|
||||
,i.pricegroup
|
||||
,o.part
|
||||
,o.odate
|
||||
,o.qtyord
|
||||
,o.pounds
|
||||
,o.pallets
|
||||
,ROUND(o.sales_usd / o.qty,5)
|
||||
,i.nwht * CASE WHEN i.nwun = 'KG' THEN 2.2 ELSE 1 END
|
||||
,i.mpck
|
||||
,(o.pricing->>'guidance_price')::NUMERIC
|
||||
,(o.pricing->>'floor' )::numeric(15,5)
|
||||
,(o.pricing->>'ceiling')::numeric(15,5)
|
||||
,(o.pricing->>'uselimits')::boolean
|
||||
)
|
||||
----sequenced for most recent price------------
|
||||
,nseq AS (
|
||||
SELECT
|
||||
bill_dba
|
||||
,ship_dba
|
||||
,part
|
||||
,odate
|
||||
,qtyord
|
||||
,lbs
|
||||
,pltq
|
||||
,price
|
||||
,guidance
|
||||
,floor
|
||||
,ceiling
|
||||
,uselimits
|
||||
,row_number() OVER (PARTITION BY bill_dba, ship_dba, part ORDER BY odate desc) rn
|
||||
,round(avg(price) over (PARTITION BY bill_dba, ship_dba, part),5) avgprice
|
||||
FROM
|
||||
npgrp
|
||||
)
|
||||
-- SELECT * FROM seq WHERE rn = 1
|
||||
,ngrp AS (
|
||||
SELECT
|
||||
o.account
|
||||
,o.shipgrp
|
||||
,o.chan
|
||||
,o.dsm
|
||||
,i.partgroup
|
||||
,i.pricegroup
|
||||
,o.part
|
||||
,o.glec
|
||||
,o.oseas
|
||||
-- ,o.odate
|
||||
,og.sortmo omon
|
||||
,o.sseas
|
||||
-- ,o.sdate
|
||||
,sg.sortmo smon
|
||||
-- ,o.calc_status
|
||||
,ROUND(sum(fb_qty * lbs),5) lbs
|
||||
,ROUND(sum(fb_qty),2) qty
|
||||
,ROUND(sum(fb_val_loc * r_rate),2) sales_usd
|
||||
,ROUND(sum(fb_cst_loc_cur * c_rate),2) cost_curstd_usd
|
||||
FROM
|
||||
profile o
|
||||
LEFT OUTER JOIN rlarp.gld og ON
|
||||
o.odate BETWEEN og.sdat and og.edat
|
||||
LEFT OUTER JOIN rlarp.gld sg ON
|
||||
o.sdate BETWEEN sg.sdat and sg.edat
|
||||
LEFT OUTER JOIN "CMS.CUSLG".itemm i ON
|
||||
i.item = o.part
|
||||
WHERE
|
||||
true
|
||||
-- iter IN ('actuals','actuals_plug','copy')
|
||||
AND fs_line = '41010'
|
||||
AND substring(o.glec,1,1) <= '2'
|
||||
AND o.calc_status <> 'CANCELED'
|
||||
AND o.sseas IS NOT NULL
|
||||
GROUP BY
|
||||
o.account
|
||||
,o.shipgrp
|
||||
,o.chan
|
||||
,o.dsm
|
||||
,i.partgroup
|
||||
,i.pricegroup
|
||||
,o.part
|
||||
,o.glec
|
||||
,o.oseas
|
||||
-- ,o.odate
|
||||
,og.sortmo
|
||||
,o.sseas
|
||||
-- ,o.sdate
|
||||
,sg.sortmo
|
||||
-- ,o.calc_status
|
||||
)
|
||||
-- SELECT * FROM grp
|
||||
,nguid AS (
|
||||
SELECT
|
||||
grp.account
|
||||
,grp.shipgrp
|
||||
,grp.chan
|
||||
,r.repp dsm
|
||||
,r.director
|
||||
,grp.shipgrp||'.'||r.repp lu
|
||||
-- ,grp.partgroup
|
||||
-- ,grp.pricegroup
|
||||
,grp.part
|
||||
-- ,grp.glec
|
||||
,2026 oseas
|
||||
,grp.omon
|
||||
-- ,grp.odate
|
||||
,(2026- grp.oseas) + grp.sseas sseas
|
||||
,grp.smon
|
||||
-- ,grp.sdate
|
||||
,grp.lbs
|
||||
,grp.qty
|
||||
,grp.sales_usd
|
||||
,CASE WHEN round(grp.sales_usd/grp.qty,5) = 0 THEN null ELSE round(grp.sales_usd/grp.qty,5) END hist_price
|
||||
,grp.cost_curstd_usd
|
||||
,sum(grp.lbs) OVER (PARTITION BY shipgrp, dsm) shiplbs
|
||||
,CASE WHEN seq.floor = 0 THEN null else seq.floor END floor
|
||||
,CASE WHEN seq.ceiling = 0 THEN null else seq.ceiling END ceiling
|
||||
,seq.uselimits
|
||||
,seq.price
|
||||
,seq.avgprice
|
||||
,seq.pltq
|
||||
,ROUND(CASE WHEN seq.uselimits THEN
|
||||
CASE
|
||||
WHEN glec = '1NU' THEN
|
||||
--if more than 8/24 pallets, use floor
|
||||
CASE WHEN grp.qty >= 24*seq.pltq THEN seq.floor
|
||||
-- if more than a pallet use the target price
|
||||
ELSE CASE WHEN qtyord >= 8*seq.pltq THEN (seq.ceiling + seq.floor) / 2
|
||||
-- if more than a pallet use the target price
|
||||
ELSE CASE WHEN qtyord >= 2*seq.pltq THEN seq.ceiling
|
||||
-- if more than a pallet use the target price
|
||||
ELSE seq.ceiling * 1.05
|
||||
END END END
|
||||
ELSE
|
||||
CASE WHEN pricegroup ~ '(Hanger|Dish)' THEN
|
||||
--at least 1 pallets is lower limit
|
||||
CASE WHEN qtyord >= 01*seq.pltq THEN seq.floor
|
||||
--at least 2 pallets is mid range
|
||||
ELSE CASE WHEN qtyord >= 0.5*seq.pltq THEN (seq.ceiling + seq.floor) / 2
|
||||
--less than a pallet is upper + 15%
|
||||
ELSE seq.ceiling
|
||||
END END
|
||||
ELSE
|
||||
--at least 8 pallets is lower limit
|
||||
CASE WHEN qtyord >= 08*seq.pltq THEN seq.floor
|
||||
--at least 2 pallets is mid range
|
||||
ELSE CASE WHEN qtyord >= 2*seq.pltq THEN (seq.ceiling + seq.floor) / 2
|
||||
--at least 1 pallet is upper range
|
||||
ELSE CASE WHEN qtyord >= 1*seq.pltq THEN seq.ceiling
|
||||
--less than a pallet is upper + 15%
|
||||
ELSE seq.ceiling * 1.15
|
||||
END END END
|
||||
END
|
||||
END
|
||||
ELSE
|
||||
null
|
||||
END,5) guid
|
||||
FROM
|
||||
ngrp grp
|
||||
LEFT OUTER JOIN nseq seq ON
|
||||
seq.ship_dba = grp.shipgrp
|
||||
AND seq.bill_dba = grp.account
|
||||
AND seq.part = grp.part
|
||||
AND seq.rn = 1
|
||||
LEFT OUTER JOIN rlarp.repc r ON
|
||||
r.rcode = grp.dsm
|
||||
)
|
||||
,orphans AS (
|
||||
SELECT
|
||||
account
|
||||
,shipgrp
|
||||
,chan
|
||||
,dsm
|
||||
,director
|
||||
,lu
|
||||
--,partgroup
|
||||
--,pricegroup
|
||||
,part
|
||||
-- ,glec
|
||||
,oseas
|
||||
,omon
|
||||
-- ,odate
|
||||
,sseas
|
||||
,smon
|
||||
-- ,sdate
|
||||
,lbs
|
||||
,qty
|
||||
,sales_usd
|
||||
,hist_price
|
||||
,cost_curstd_usd
|
||||
,shiplbs
|
||||
,floor
|
||||
,ceiling
|
||||
,uselimits
|
||||
,price
|
||||
,avgprice
|
||||
,pltq
|
||||
,guid
|
||||
,least(hist_price, price, avgprice) lowest_last
|
||||
,least(hist_price, price, avgprice, floor) lowest_floor
|
||||
FROM
|
||||
nguid
|
||||
)
|
||||
368
offline/orphan_pool.pg.sql
Normal file
368
offline/orphan_pool.pg.sql
Normal file
@ -0,0 +1,368 @@
|
||||
-- BEGIN;
|
||||
|
||||
--only do this when starting fresh
|
||||
-- TRUNCATE TABLE rlarp.osm_pool;
|
||||
-- TRUNCATE TABLE rlarp.osm_log CASCADE;
|
||||
-- ALTER SEQUENCE rlarp.osm_log_id_seq RESTART 1;
|
||||
--
|
||||
--
|
||||
-- DROP TABLE IF EXISTS rlarp.osm_pool_stage;
|
||||
|
||||
-- CREATE TABLE rlarp.osm_pool_stage AS (
|
||||
WITH
|
||||
-- ,orphans AS (
|
||||
-- SELECT
|
||||
-- renamed
|
||||
-- ,rerep
|
||||
-- ,pounds
|
||||
-- FROM
|
||||
--
|
||||
-- )
|
||||
profile AS (
|
||||
SELECT * FROM rlarp.osm WHERE shipgrp IN (select distinct renamed FROM rlarp.orphans ) AND oseas >= 2018
|
||||
)
|
||||
-- SELECT * FROM profile
|
||||
,checkc AS (
|
||||
SELECT shipgrp, min(oseas) oseas FROM profile GROUP BY shipgrp
|
||||
)
|
||||
-- SELECT * FROM checkc
|
||||
,repc AS (
|
||||
SELECT
|
||||
LTRIM(RTRIM(C.A9)) RCODE
|
||||
,C.A30 REPP
|
||||
,COALESCE(Q.DIR,'Other') DIRECTOR
|
||||
FROM
|
||||
LGDAT.CODE C
|
||||
LEFT OUTER JOIN RLARP.QRH Q ON
|
||||
Q.QR = LTRIM(RTRIM(C.A9))
|
||||
WHERE
|
||||
C.A2 = 'MM'
|
||||
)
|
||||
--select * from repc
|
||||
,SEG AS (
|
||||
SELECT
|
||||
GLEC
|
||||
,SEGM
|
||||
FROM
|
||||
(
|
||||
VALUES
|
||||
('1CU','Sustainable'),
|
||||
('1SU','Sustainable'),
|
||||
('1GR','Greenhouse'),
|
||||
('1NU','Nursery'),
|
||||
('1RE','Retail'),
|
||||
('2WI','Greenhouse'),
|
||||
('3BM','Other'),
|
||||
('3CO','Other'),
|
||||
('3PE','Other'),
|
||||
('3PP','Other'),
|
||||
('4CO','Other'),
|
||||
('4RA','Other'),
|
||||
('9MI','Other'),
|
||||
('9SA','Other'),
|
||||
('9TO','Other')
|
||||
) X(GLEC, SEGM)
|
||||
)
|
||||
--select * from seg
|
||||
----------------------------------------------------sales major codes----------------------------------------------------------------------------------------------------------------------------------
|
||||
-- ,SJ AS (
|
||||
-- SELECT * FROM LGDAT.MMSL WHERE COALESCE(BSMNCD,'') = ''
|
||||
-- )
|
||||
-- --select * from sj
|
||||
-- ----------------------------------------------------sales minor codes----------------------------------------------------------------------------------------------------------------------------------
|
||||
-- ,SI AS (
|
||||
-- SELECT * FROM LGDAT.MMSL WHERE COALESCE(BSMNCD,'') <> ''
|
||||
-- )
|
||||
--select * from si
|
||||
,logload AS (
|
||||
INSERT INTO rlarp.osm_log (doc) SELECT jsonb_build_object('user',current_user,'tag','New Cust','type','orphans','stamp',current_timestamp,'source','top level','message','New Customer') RETURNING *
|
||||
)
|
||||
--select * from logload
|
||||
,loadset AS (
|
||||
SELECT
|
||||
o.fspr
|
||||
,o.plnt
|
||||
,o.promo
|
||||
,o.terms
|
||||
,o.bill_cust||' - '||bc.bvname bill_cust_descr
|
||||
,o.ship_cust||' - '||sc.bvname ship_cust_descr
|
||||
,o.dsm
|
||||
,coalesce(repc.repp,dsm) quota_rep_descr
|
||||
,repc.director
|
||||
,o.account billto_group
|
||||
,o.shipgrp shipto_group
|
||||
,chan
|
||||
,chansub
|
||||
,CASE seg.segm
|
||||
--for 1RE coded product
|
||||
WHEN 'Retail' THEN
|
||||
CASE o.bill_class
|
||||
WHEN 'RONL' THEN 'Online'
|
||||
WHEN 'RNAT' THEN 'National'
|
||||
WHEN 'RMAS' THEN 'National'
|
||||
ELSE
|
||||
------ ship-to class ---------------------
|
||||
CASE o.chan
|
||||
WHEN 'GDIS' THEN 'Distribution'
|
||||
WHEN 'NDIS' THEN 'Distribution'
|
||||
WHEN 'RDIS' THEN 'Distribution'
|
||||
WHEN 'GDRP' THEN 'Grower'
|
||||
WHEN 'NDRP' THEN 'Grower'
|
||||
WHEN 'RDRP' THEN 'Distribution'
|
||||
WHEN 'GDIR' THEN 'Grower'
|
||||
WHEN 'NDIR' THEN 'Grower'
|
||||
-------this will probably need reviewed--------
|
||||
WHEN 'RDIR' THEN 'Distribution'
|
||||
WHEN 'NDIR' THEN 'Grower'
|
||||
WHEN 'GDIR' THEN 'Grower'
|
||||
ELSE 'Distribution'
|
||||
END
|
||||
END
|
||||
--for 1SU 1CU coded product
|
||||
WHEN 'Sustainable' THEN
|
||||
CASE SUBSTRING(o.coltier,1,1)
|
||||
--anything with a bio color tier is bio on the channel
|
||||
WHEN 'R' THEN 'Bio'
|
||||
ELSE
|
||||
CASE o.glec
|
||||
--any 1SU that is not bio is fiber
|
||||
WHEN '1SU' THEN 'Fiber'
|
||||
--any 1CU that is not bio is commercial
|
||||
WHEN '1CU' THEN 'Commercial'
|
||||
ELSE o.chan
|
||||
END
|
||||
END
|
||||
ELSE o.chan
|
||||
END chan_retail
|
||||
,part
|
||||
,part||coalesce(' - '||i.descr,'') part_descr
|
||||
,stlcd part_group
|
||||
,brnd branding
|
||||
,o.majg||' - '||i.majgd majg_descr
|
||||
,o.ming||' - '||i.mingd ming_descr
|
||||
,o.majs||' - '||i.majsd majs_descr
|
||||
,o.mins||' - '||i.minsd mins_descr
|
||||
,seg.segm
|
||||
,CASE WHEN o.majg = '610' THEN 'Fiber' ELSE 'Plastic' END substance
|
||||
,fs_line
|
||||
,r_currency
|
||||
,r_rate
|
||||
,c_currency
|
||||
,c_rate
|
||||
,round(fb_qty,2) units
|
||||
,round(fb_val_loc,2) value_loc
|
||||
,round(fb_val_loc * r_rate,2) value_usd
|
||||
,round(fb_qty * i.curstd,2) cost_loc
|
||||
,round(fb_qty * i.curstdus,2) cost_usd
|
||||
,sum(fb_qty * i.nwht * case i.nwun WHEN 'KG' THEN 2.2046 ELSE 1 END) OVER (partition by o.shipgrp) cust_lbs
|
||||
,fb_qty * i.nwht * case i.nwun WHEN 'KG' THEN 2.2046 ELSE 1 END line_lbs
|
||||
,calc_status
|
||||
,flag
|
||||
,(odate + ((2026 - o.oseas)||' years')::interval)::date order_date
|
||||
,to_char(CASE WHEN extract(month FROM o.odate) >= 6 THEN -5 ELSE 7 END + extract(month FROM o.odate),'FM00')||' - '||to_char(o.odate,'TMMon') order_month
|
||||
,2026 order_season
|
||||
,(rdate + ((2026 - o.oseas)||' years')::interval)::date request_date
|
||||
,to_char(CASE WHEN extract(month FROM o.rdate) >= 6 THEN -5 ELSE 7 END + extract(month FROM o.rdate),'FM00')||' - '||to_char(o.rdate,'TMMon') request_month
|
||||
,rseas + (2026 - o.oseas) request_season
|
||||
,(sdate + ((2026 - o.oseas)||' years')::interval)::date ship_date
|
||||
,to_char(CASE WHEN extract(month FROM o.sdate) >= 6 THEN -5 ELSE 7 END + extract(month FROM o.sdate),'FM00')||' - '||to_char(o.sdate,'TMMon') ship_month
|
||||
,sseas + (2026 - o.oseas) ship_season
|
||||
,'b26' version
|
||||
,'fc orphans' iter
|
||||
,logload.id logid
|
||||
,logload.doc->>'tag' tag
|
||||
,logload.doc->>'message' "comment"
|
||||
,logload.doc->>'type' module
|
||||
-- ,round(o.fb_qty * o.lbs) pounds
|
||||
FROM
|
||||
checkc p
|
||||
INNER JOIN rlarp.osm o ON
|
||||
p.shipgrp = o.shipgrp
|
||||
AND p.oseas = o.oseas
|
||||
CROSS JOIN logload
|
||||
LEFT OUTER JOIN lgdat.cust bc ON
|
||||
bc.bvcust = o.bill_cust
|
||||
LEFT OUTER JOIN lgdat.cust sc ON
|
||||
sc.bvcust = o.ship_cust
|
||||
LEFT OUTER JOIN repc ON
|
||||
repc.rcode = o.dsm
|
||||
/*
|
||||
LEFT OUTER JOIN lgdat.majg ON
|
||||
bqgrp = o.majg
|
||||
LEFT OUTER JOIN lgdat.mmgp ON
|
||||
brmgrp = o.ming
|
||||
AND BRGRP = o.majg
|
||||
LEFT OUTER JOIN si ON
|
||||
si.bsmjcd = o.majs
|
||||
AND si.bsmncd = o.mins
|
||||
LEFT OUTER JOIN sj ON
|
||||
sj.bsmjcd = o.majs
|
||||
*/
|
||||
LEFT OUTER JOIN seg ON
|
||||
seg.glec = o.glec
|
||||
LEFT OUTER JOIN "CMS.CUSLG".itemm i ON
|
||||
i.item = o.part
|
||||
WHERE
|
||||
iter NOT IN ('py carryover','short ship','bad date')
|
||||
AND sseas IS NOT NULL
|
||||
AND odate <= sdate
|
||||
AND fs_line = '41010'
|
||||
AND calc_status <> 'CANCELLED'
|
||||
)
|
||||
,scale AS (
|
||||
SELECT
|
||||
fspr
|
||||
,plnt
|
||||
,promo
|
||||
,terms
|
||||
,bill_cust_descr
|
||||
,ship_cust_descr
|
||||
,dsm
|
||||
,quota_rep_descr
|
||||
,director
|
||||
,billto_group
|
||||
,shipto_group
|
||||
,chan
|
||||
,chansub
|
||||
,chan_retail
|
||||
,part
|
||||
,part_descr
|
||||
,part_group
|
||||
,branding
|
||||
,majg_descr
|
||||
,ming_descr
|
||||
,majs_descr
|
||||
,mins_descr
|
||||
,segm
|
||||
,substance
|
||||
,fs_line
|
||||
,r_currency
|
||||
,r_rate
|
||||
,c_currency
|
||||
,c_rate
|
||||
,round(units * pounds/cust_lbs,2) units
|
||||
,round(value_loc * pounds/cust_lbs,2) value_loc
|
||||
,round(value_usd * pounds/cust_lbs,2) value_usd
|
||||
,round(cost_loc * pounds/cust_lbs,2) cost_loc
|
||||
,round(cost_usd * pounds/cust_lbs,2) cost_usd
|
||||
,calc_status
|
||||
,flag
|
||||
,order_date
|
||||
,order_month
|
||||
,order_season
|
||||
,request_date
|
||||
,request_month
|
||||
,request_season
|
||||
,ship_date
|
||||
,ship_month
|
||||
,ship_season
|
||||
,version
|
||||
,iter
|
||||
-- ,cust_lbs
|
||||
,logid
|
||||
,tag
|
||||
,comment
|
||||
,module
|
||||
,round(line_lbs * pounds/cust_lbs,5) pounds
|
||||
-- ,pounds/cust_lbs factor
|
||||
FROM
|
||||
rlarp.orphans o
|
||||
INNER JOIN loadset l ON
|
||||
l.shipto_group = o.renamed
|
||||
WHERE
|
||||
cust_lbs >= 1000
|
||||
)
|
||||
----grouped prices-------------
|
||||
,npgrp AS (
|
||||
SELECT
|
||||
o.bill_dba
|
||||
,o.ship_dba
|
||||
,o.bill_cust
|
||||
,o.ship_cust
|
||||
,o.promo
|
||||
,o.terms
|
||||
,o.dsm
|
||||
,o.part
|
||||
,o.odate
|
||||
,o.qtyord
|
||||
,i.nwht * CASE WHEN i.nwun = 'KG' THEN 2.2 ELSE 1 END lbs
|
||||
,i.mpck pltq
|
||||
,ROUND(o.sales_usd / o.qty,5) price
|
||||
,(o.pricing->>'guidance_price')::NUMERIC guidance
|
||||
,(o.pricing->>'floor' )::numeric(15,5) floor
|
||||
,(o.pricing->>'ceiling')::numeric(15,5) ceiling
|
||||
,(o.pricing->>'uselimits')::boolean uselimits
|
||||
FROM
|
||||
rlarp.osm_stack o
|
||||
INNER JOIN "CMS.CUSLG".itemm i ON
|
||||
i.item = o.part
|
||||
INNER JOIN checkc c ON
|
||||
c.shipgrp = o.customer
|
||||
AND c.oseas = o.oseas
|
||||
WHERE
|
||||
VERSION = 'Actual'
|
||||
AND o.oseas >= 2018
|
||||
AND calc_status <> 'CANCELED'
|
||||
AND o.fs_line = '41010'
|
||||
AND o.part <> ''
|
||||
AND substring(o.glec,1,1) <= '2'
|
||||
AND o.qty <> 0
|
||||
AND o.sseas IS NOT NULL
|
||||
-- AND customer in (select distinct renamed FROM newc )
|
||||
GROUP BY
|
||||
o.bill_dba
|
||||
,o.ship_dba
|
||||
,o.dsm
|
||||
,i.partgroup
|
||||
,i.pricegroup
|
||||
,o.part
|
||||
,o.odate
|
||||
,o.qtyord
|
||||
,o.pounds
|
||||
,o.pallets
|
||||
,ROUND(o.sales_usd / o.qty,5)
|
||||
,i.nwht * CASE WHEN i.nwun = 'KG' THEN 2.2 ELSE 1 END
|
||||
,i.mpck
|
||||
,(o.pricing->>'guidance_price')::NUMERIC
|
||||
,(o.pricing->>'floor' )::numeric(15,5)
|
||||
,(o.pricing->>'ceiling')::numeric(15,5)
|
||||
,(o.pricing->>'uselimits')::boolean
|
||||
)
|
||||
----sequenced for most recent price------------
|
||||
,nseq AS (
|
||||
SELECT
|
||||
bill_dba
|
||||
,ship_dba
|
||||
,part
|
||||
,odate
|
||||
,qtyord
|
||||
,lbs
|
||||
,pltq
|
||||
,price
|
||||
,guidance
|
||||
,floor
|
||||
,ceiling
|
||||
,uselimits
|
||||
,row_number() OVER (PARTITION BY bill_dba, ship_dba, part ORDER BY odate desc) rn
|
||||
,round(avg(price) over (PARTITION BY bill_dba, ship_dba, part),5) avgprice
|
||||
FROM
|
||||
npgrp
|
||||
)
|
||||
-- SELECT * FROM seq WHERE rn = 1
|
||||
INSERT INTO rlarp.osm_pool SELECT * FROM scale;
|
||||
-- select * from scale) WITH DATA;
|
||||
|
||||
-- INSERT INTO rlarp.osm_pool SELECT * FROM rlarp.osm_pool_stage;
|
||||
|
||||
-- SELECT * FROM loadset WHERE iter NOT IN ('py carryover','short ship','bad date')
|
||||
-- ) WITH DATA;
|
||||
|
||||
|
||||
|
||||
--CREATE INDEX osm_qr ON rlarp.osm_pool(quota_rep_descr, bill_cust_descr, ship_cust_descr);
|
||||
--ALTER TABLE rlarp.osm_pool ADD CONSTRAINT logfk FOREIGN KEY (logid) REFERENCES rlarp.osm_log(id);
|
||||
--CREATE INDEX osm_pool_logid ON rlarp.osm_pool(logid);
|
||||
--GRANT ALL ON TABLE rlarp.osm_log TO api;
|
||||
--GRANT ALL ON TABLE rlarp.osm_pool TO api;
|
||||
|
||||
-- COMMIT;
|
||||
4807
offline/price_down_2.pg.sql
Normal file
4807
offline/price_down_2.pg.sql
Normal file
File diff suppressed because it is too large
Load Diff
381
offline/price_down_3.pg.sql
Normal file
381
offline/price_down_3.pg.sql
Normal file
@ -0,0 +1,381 @@
|
||||
WITH
|
||||
----grouped prices-------------
|
||||
custflag AS (
|
||||
select shipgrp, CASE WHEN count(distinct flag) > 1 THEN 'YoY' ELSE string_agg(DISTINCT flag,', ') END flag from rlarp.cust_flag group by shipgrp
|
||||
)
|
||||
,pgrp AS (
|
||||
SELECT
|
||||
o.bill_dba
|
||||
,o.ship_dba
|
||||
,o.dsm
|
||||
,i.partgroup
|
||||
,i.pricegroup
|
||||
,o.part
|
||||
,o.odate
|
||||
,o.qtyord
|
||||
,i.nwht * CASE WHEN i.nwun = 'KG' THEN 2.2 ELSE 1 END lbs
|
||||
,i.mpck pltq
|
||||
,ROUND(o.sales_usd / o.qty,5) price
|
||||
,(o.pricing->>'guidance_price')::NUMERIC guidance
|
||||
,(o.pricing->>'floor' )::numeric(15,5) floor
|
||||
,(o.pricing->>'ceiling')::numeric(15,5) ceiling
|
||||
,(o.pricing->>'uselimits')::boolean uselimits
|
||||
FROM
|
||||
rlarp.osm_stack o
|
||||
LEFT OUTER JOIN "CMS.CUSLG".itemm i ON
|
||||
i.item = o.part
|
||||
INNER JOIN custflag c ON
|
||||
c.shipgrp = o.ship_dba
|
||||
-- AND c.dsm = o.default_rep
|
||||
WHERE
|
||||
VERSION = 'Actual'
|
||||
AND o.oseas >= 2025
|
||||
AND calc_status <> 'CANCELED'
|
||||
AND o.fs_line = '41010'
|
||||
AND o.part <> ''
|
||||
AND substring(o.glec,1,1) <= '2'
|
||||
AND o.qty <> 0
|
||||
AND o.sseas IS NOT NULL
|
||||
AND o.sales_usd <> 0
|
||||
-- AND customer in (select distinct renamed FROM newc )
|
||||
GROUP BY
|
||||
o.bill_dba
|
||||
,o.ship_dba
|
||||
,o.dsm
|
||||
,i.partgroup
|
||||
,i.pricegroup
|
||||
,o.part
|
||||
,o.odate
|
||||
,o.qtyord
|
||||
,o.pounds
|
||||
,o.pallets
|
||||
,ROUND(o.sales_usd / o.qty,5)
|
||||
,i.nwht * CASE WHEN i.nwun = 'KG' THEN 2.2 ELSE 1 END
|
||||
,i.mpck
|
||||
,(o.pricing->>'guidance_price')::NUMERIC
|
||||
,(o.pricing->>'floor' )::numeric(15,5)
|
||||
,(o.pricing->>'ceiling')::numeric(15,5)
|
||||
,(o.pricing->>'uselimits')::boolean
|
||||
)
|
||||
-- SELECT * FROM pgrp where ship_dba ~ 'MONROVIA'
|
||||
-- select * from npgrp limit 100
|
||||
--sequenced for most recent price------------
|
||||
,seq AS (
|
||||
SELECT
|
||||
bill_dba
|
||||
,ship_dba
|
||||
,part
|
||||
,odate
|
||||
,qtyord
|
||||
,lbs
|
||||
,pltq
|
||||
,price last_price
|
||||
,guidance
|
||||
,floor
|
||||
,ceiling
|
||||
,uselimits
|
||||
,row_number() OVER (PARTITION BY bill_dba, ship_dba, part ORDER BY odate desc) rn
|
||||
,round(avg(price) over (PARTITION BY bill_dba, ship_dba, part),5) avgprice
|
||||
FROM
|
||||
pgrp
|
||||
)
|
||||
-- SELECT * FROM SEQ WHERE ship_dba = 'MONROVIA'
|
||||
-- SELECT * FROM seq WHERE ship_dba like 'COSTA%'
|
||||
,partlist AS (
|
||||
SELECT
|
||||
billto_group
|
||||
,shipto_group
|
||||
,dsm
|
||||
,part
|
||||
,glec
|
||||
,pricegroup
|
||||
----order date as a proxy for order size
|
||||
,order_date
|
||||
,sum(units) qty
|
||||
,round(sum(value_usd)/sum(units),5) hist_price
|
||||
FROM
|
||||
rlarp.osm_pool o
|
||||
INNER JOIN "CMS.CUSLG".itemm i ON
|
||||
i.item = o.part
|
||||
WHERE
|
||||
order_season = 2026
|
||||
GROUP BY
|
||||
billto_group
|
||||
,shipto_group
|
||||
,dsm
|
||||
,part
|
||||
,glec
|
||||
,pricegroup
|
||||
,order_date
|
||||
HAVING
|
||||
abs(sum(units)) > 10
|
||||
)
|
||||
,combine AS MATERIALIZED (
|
||||
-- select * from partlist
|
||||
-- SELECT * FROM seq WHERE rn = 1 LIMIT 1000
|
||||
-- ,guid AS (
|
||||
SELECT
|
||||
p.billto_group
|
||||
,p.shipto_group
|
||||
-- ,p.dsm
|
||||
,p.part
|
||||
,p.glec
|
||||
,p.pricegroup
|
||||
,p.order_date
|
||||
,p.qty
|
||||
,p.hist_price
|
||||
,CASE WHEN seq.floor = 0 THEN null else seq.floor END floor
|
||||
,CASE WHEN seq.ceiling = 0 THEN null else seq.ceiling END ceiling
|
||||
,seq.uselimits
|
||||
,seq.last_price
|
||||
,seq.avgprice
|
||||
,seq.pltq
|
||||
,ROUND(CASE WHEN seq.uselimits THEN
|
||||
CASE
|
||||
WHEN glec = '1NU' THEN
|
||||
--if more than 8/24 pallets, use floor
|
||||
CASE WHEN p.qty >= 24*seq.pltq THEN seq.floor
|
||||
-- if more than a pallet use the target price
|
||||
ELSE CASE WHEN qtyord >= 8*seq.pltq THEN (seq.ceiling + seq.floor) / 2
|
||||
-- if more than a pallet use the target price
|
||||
ELSE CASE WHEN qtyord >= 2*seq.pltq THEN seq.ceiling
|
||||
-- if more than a pallet use the target price
|
||||
ELSE seq.ceiling * 1.05
|
||||
END END END
|
||||
ELSE
|
||||
CASE WHEN pricegroup ~ '(Hanger|Dish)' THEN
|
||||
--at least 1 pallets is lower limit
|
||||
CASE WHEN qtyord >= 01*seq.pltq THEN seq.floor
|
||||
--at least 2 pallets is mid range
|
||||
ELSE CASE WHEN qtyord >= 0.5*seq.pltq THEN (seq.ceiling + seq.floor) / 2
|
||||
--less than a pallet is upper + 15%
|
||||
ELSE seq.ceiling
|
||||
END END
|
||||
ELSE
|
||||
--at least 8 pallets is lower limit
|
||||
CASE WHEN qtyord >= 08*seq.pltq THEN seq.floor
|
||||
--at least 2 pallets is mid range
|
||||
ELSE CASE WHEN qtyord >= 2*seq.pltq THEN (seq.ceiling + seq.floor) / 2
|
||||
--at least 1 pallet is upper range
|
||||
ELSE CASE WHEN qtyord >= 1*seq.pltq THEN seq.ceiling
|
||||
--less than a pallet is upper + 15%
|
||||
ELSE seq.ceiling * 1.15
|
||||
END END END
|
||||
END
|
||||
END
|
||||
ELSE
|
||||
null
|
||||
END,5) guid
|
||||
,least(hist_price, last_price, avgprice) lowest_last
|
||||
,least(hist_price, last_price, avgprice, CASE WHEN uselimits THEN
|
||||
ROUND(CASE WHEN seq.uselimits THEN
|
||||
CASE
|
||||
WHEN glec = '1NU' THEN
|
||||
--if more than 8/24 pallets, use floor
|
||||
CASE WHEN p.qty >= 24*seq.pltq THEN seq.floor
|
||||
-- if more than a pallet use the target price
|
||||
ELSE CASE WHEN qtyord >= 8*seq.pltq THEN (seq.ceiling + seq.floor) / 2
|
||||
-- if more than a pallet use the target price
|
||||
ELSE CASE WHEN qtyord >= 2*seq.pltq THEN seq.ceiling
|
||||
-- if more than a pallet use the target price
|
||||
ELSE seq.ceiling * 1.05
|
||||
END END END
|
||||
ELSE
|
||||
CASE WHEN pricegroup ~ '(Hanger|Dish)' THEN
|
||||
--at least 1 pallets is lower limit
|
||||
CASE WHEN qtyord >= 01*seq.pltq THEN seq.floor
|
||||
--at least 2 pallets is mid range
|
||||
ELSE CASE WHEN qtyord >= 0.5*seq.pltq THEN (seq.ceiling + seq.floor) / 2
|
||||
--less than a pallet is upper + 15%
|
||||
ELSE seq.ceiling
|
||||
END END
|
||||
ELSE
|
||||
--at least 8 pallets is lower limit
|
||||
CASE WHEN qtyord >= 08*seq.pltq THEN seq.floor
|
||||
--at least 2 pallets is mid range
|
||||
ELSE CASE WHEN qtyord >= 2*seq.pltq THEN (seq.ceiling + seq.floor) / 2
|
||||
--at least 1 pallet is upper range
|
||||
ELSE CASE WHEN qtyord >= 1*seq.pltq THEN seq.ceiling
|
||||
--less than a pallet is upper + 15%
|
||||
ELSE seq.ceiling * 1.15
|
||||
END END END
|
||||
END
|
||||
END
|
||||
ELSE
|
||||
null
|
||||
END,5) ELSE hist_price END) lowest_guid
|
||||
,c.flag
|
||||
FROM
|
||||
partlist p
|
||||
INNER JOIN custflag c ON
|
||||
c.shipgrp = p.shipto_group
|
||||
-- AND substring(c.dsm,1,5) = substring(p.dsm,1,5)
|
||||
LEFT OUTER JOIN seq seq ON
|
||||
seq.ship_dba = p.shipto_group
|
||||
AND seq.bill_dba = p.billto_group
|
||||
AND seq.part = p.part
|
||||
AND seq.rn = 1
|
||||
LEFT OUTER JOIN rlarp.repc r ON
|
||||
r.rcode = p.dsm
|
||||
)
|
||||
-- SELECT * FROM combine where shipto_group = 'MONROVIA'
|
||||
,choose AS MATERIALIZED (
|
||||
SELECT
|
||||
billto_group
|
||||
,shipto_group
|
||||
-- ,dsm
|
||||
,part
|
||||
,glec
|
||||
,pricegroup
|
||||
,order_date
|
||||
,qty
|
||||
,hist_price
|
||||
,floor
|
||||
,ceiling
|
||||
,uselimits
|
||||
,last_price
|
||||
,avgprice
|
||||
,pltq
|
||||
,guid
|
||||
,lowest_last
|
||||
,lowest_guid
|
||||
,flag
|
||||
,CASE flag
|
||||
WHEN 'YoY' THEN lowest_last
|
||||
WHEN 'Floor' THEN lowest_guid
|
||||
WHEN 'Retail' THEN hist_price
|
||||
WHEN 'Warehouse' THEN hist_price
|
||||
WHEN 'Orphan' THEN lowest_guid
|
||||
ELSE lowest_last
|
||||
END price_choice
|
||||
FROM
|
||||
combine
|
||||
)
|
||||
-- SELECT * FROM choose where shipto_group = 'COSTA' and part = 'XNS0T1G3X19C150PYKXR'
|
||||
-- ,logload AS (
|
||||
-- INSERT INTO rlarp.osm_log (doc) SELECT jsonb_build_object('user',current_user,'tag','Pricing 2','type','Pricing 2','stamp',current_timestamp,'source','top level','message','Pricing 2') RETURNING *
|
||||
-- )
|
||||
,delta_row AS (
|
||||
SELECT
|
||||
o.fspr
|
||||
,o.plnt
|
||||
,o.promo
|
||||
,o.terms
|
||||
,o.bill_cust_descr
|
||||
,o.ship_cust_descr
|
||||
,o.dsm
|
||||
,o.quota_rep_descr
|
||||
,o.director
|
||||
,o.billto_group
|
||||
,o.shipto_group
|
||||
,o.chan
|
||||
,o.chansub
|
||||
,o.chan_retail
|
||||
,o.part
|
||||
,o.part_descr
|
||||
,o.part_group
|
||||
,o.branding
|
||||
,o.majg_descr
|
||||
,o.ming_descr
|
||||
,o.majs_descr
|
||||
,o.mins_descr
|
||||
,o.segm
|
||||
,o.substance
|
||||
,o.fs_line
|
||||
,o.r_currency
|
||||
,o.r_rate
|
||||
,o.c_currency
|
||||
,o.c_rate
|
||||
,0::numeric units
|
||||
,(c.price_choice * sum(o.units) - sum(value_usd))/o.r_rate value_loc
|
||||
,c.price_choice * sum(o.units) - sum(value_usd) value_usd
|
||||
,0::numeric cost_loc
|
||||
,0::numeric cost_usd
|
||||
,o.calc_status
|
||||
,o.flag
|
||||
,o.order_date
|
||||
,o.order_month
|
||||
,o.order_season
|
||||
,o.request_date
|
||||
,o.request_month
|
||||
,o.request_season
|
||||
,o.ship_date
|
||||
,o.ship_month
|
||||
,o.ship_season
|
||||
,o.version
|
||||
,'Pricing 2' iter
|
||||
-- ,logload.id logid
|
||||
-- ,logload.doc->>'tag' tag
|
||||
-- ,logload.doc->>'message' "comment"
|
||||
-- ,logload.doc->>'type' module
|
||||
,0::NUMERIC pounds
|
||||
FROM
|
||||
rlarp.osm_pool o
|
||||
-- CROSS JOIN logload
|
||||
INNER JOIN choose c ON
|
||||
c.billto_group = o.billto_group
|
||||
AND c.shipto_group = o.shipto_group
|
||||
-- AND substring(c.dsm,1,5) = substring(o.dsm,1,5)
|
||||
AND c.part = o.part
|
||||
AND c.order_date = o.order_date
|
||||
WHERE
|
||||
o.order_season = 2026
|
||||
GROUP BY
|
||||
o.fspr
|
||||
,o.plnt
|
||||
,o.promo
|
||||
,o.terms
|
||||
,o.bill_cust_descr
|
||||
,o.ship_cust_descr
|
||||
,o.dsm
|
||||
,o.quota_rep_descr
|
||||
,o.director
|
||||
,o.billto_group
|
||||
,o.shipto_group
|
||||
,o.chan
|
||||
,o.chansub
|
||||
,o.chan_retail
|
||||
,o.part
|
||||
,o.part_descr
|
||||
,o.part_group
|
||||
,o.branding
|
||||
,o.majg_descr
|
||||
,o.ming_descr
|
||||
,o.majs_descr
|
||||
,o.mins_descr
|
||||
,o.segm
|
||||
,o.substance
|
||||
,o.fs_line
|
||||
,o.r_currency
|
||||
,o.r_rate
|
||||
,o.c_currency
|
||||
,o.c_rate
|
||||
,c.price_choice
|
||||
,o.calc_status
|
||||
,o.flag
|
||||
,o.order_date
|
||||
,o.order_month
|
||||
,o.order_season
|
||||
,o.request_date
|
||||
,o.request_month
|
||||
,o.request_season
|
||||
,o.ship_date
|
||||
,o.ship_month
|
||||
,o.ship_season
|
||||
,o.version
|
||||
-- ,logload.id
|
||||
-- ,logload.doc->>'tag'
|
||||
-- ,logload.doc->>'message'
|
||||
-- ,logload.doc->>'type'
|
||||
)
|
||||
SELECT * FROM delta_row
|
||||
-- SELECT * FROM choose where shipto_group = 'GRIFFIN' and part = 'HSI12001B661050'
|
||||
-- SELECT SUM(value_usd), count(*) from delta_row
|
||||
-- -- SELECT * FROM delta_row WHERE shipto_group = 'MONROVIA'
|
||||
-- -- INSERT INTO rlarp.osm_pool SELECT * FROM delta_row
|
||||
-- -- SELECT billto_group, shipto_group, substring(dsm,1,5), part, order_date, count(*) over (PARTITION BY billto_group, shipto_group, substring(dsm,1,5), part, order_date) cnt
|
||||
-- -- FROM
|
||||
-- -- choose
|
||||
-- -- GROUP BY
|
||||
-- -- billto_group, shipto_group, substring(dsm,1,5), part, order_date
|
||||
-- -- select shipto_group, sum(value_usd) from delta_row group by shipto_group
|
||||
376
offline/price_down_inq.pg.sql
Normal file
376
offline/price_down_inq.pg.sql
Normal file
@ -0,0 +1,376 @@
|
||||
WITH
|
||||
----grouped prices-------------
|
||||
pgrp AS (
|
||||
SELECT
|
||||
o.bill_dba
|
||||
,o.ship_dba
|
||||
,c.dsm
|
||||
,i.partgroup
|
||||
,i.pricegroup
|
||||
,o.part
|
||||
,o.odate
|
||||
,o.qtyord
|
||||
,i.nwht * CASE WHEN i.nwun = 'KG' THEN 2.2 ELSE 1 END lbs
|
||||
,i.mpck pltq
|
||||
,ROUND(o.sales_usd / o.qty,5) price
|
||||
,(o.pricing->>'guidance_price')::NUMERIC guidance
|
||||
,(o.pricing->>'floor' )::numeric(15,5) floor
|
||||
,(o.pricing->>'ceiling')::numeric(15,5) ceiling
|
||||
,(o.pricing->>'uselimits')::boolean uselimits
|
||||
FROM
|
||||
rlarp.osm_stack o
|
||||
LEFT OUTER JOIN "CMS.CUSLG".itemm i ON
|
||||
i.item = o.part
|
||||
INNER JOIN rlarp.cust_flag c ON
|
||||
c.shipgrp = o.customer
|
||||
AND c.dsm = o.default_rep
|
||||
WHERE
|
||||
VERSION = 'Actual'
|
||||
AND o.oseas >= 2025
|
||||
AND calc_status <> 'CANCELED'
|
||||
AND o.fs_line = '41010'
|
||||
AND o.part <> ''
|
||||
AND substring(o.glec,1,1) <= '2'
|
||||
AND o.qty <> 0
|
||||
AND o.sseas IS NOT NULL
|
||||
AND o.sales_usd <> 0
|
||||
-- AND customer in (select distinct renamed FROM newc )
|
||||
GROUP BY
|
||||
o.bill_dba
|
||||
,o.ship_dba
|
||||
,c.dsm
|
||||
,i.partgroup
|
||||
,i.pricegroup
|
||||
,o.part
|
||||
,o.odate
|
||||
,o.qtyord
|
||||
,o.pounds
|
||||
,o.pallets
|
||||
,ROUND(o.sales_usd / o.qty,5)
|
||||
,i.nwht * CASE WHEN i.nwun = 'KG' THEN 2.2 ELSE 1 END
|
||||
,i.mpck
|
||||
,(o.pricing->>'guidance_price')::NUMERIC
|
||||
,(o.pricing->>'floor' )::numeric(15,5)
|
||||
,(o.pricing->>'ceiling')::numeric(15,5)
|
||||
,(o.pricing->>'uselimits')::boolean
|
||||
)
|
||||
-- SELECT * FROM pgrp where ship_dba ~ 'MONROVIA'
|
||||
-- select * from npgrp limit 100
|
||||
--sequenced for most recent price------------
|
||||
,seq AS (
|
||||
SELECT
|
||||
bill_dba
|
||||
,ship_dba
|
||||
,part
|
||||
,odate
|
||||
,qtyord
|
||||
,lbs
|
||||
,pltq
|
||||
,price last_price
|
||||
,guidance
|
||||
,floor
|
||||
,ceiling
|
||||
,uselimits
|
||||
,row_number() OVER (PARTITION BY bill_dba, ship_dba, part ORDER BY odate desc) rn
|
||||
,round(avg(price) over (PARTITION BY bill_dba, ship_dba, part),5) avgprice
|
||||
FROM
|
||||
pgrp
|
||||
)
|
||||
-- SELECT * FROM SEQ WHERE ship_dba = 'MONROVIA'
|
||||
-- SELECT * FROM seq WHERE ship_dba like 'COSTA%'
|
||||
,partlist AS (
|
||||
SELECT
|
||||
billto_group
|
||||
,shipto_group
|
||||
,dsm
|
||||
,part
|
||||
,glec
|
||||
,pricegroup
|
||||
----order date as a proxy for order size
|
||||
,order_date
|
||||
,sum(units) qty
|
||||
,round(sum(value_usd)/sum(units),5) hist_price
|
||||
FROM
|
||||
rlarp.osm_pool o
|
||||
INNER JOIN "CMS.CUSLG".itemm i ON
|
||||
i.item = o.part
|
||||
WHERE
|
||||
order_season = 2026
|
||||
GROUP BY
|
||||
billto_group
|
||||
,shipto_group
|
||||
,dsm
|
||||
,part
|
||||
,glec
|
||||
,pricegroup
|
||||
,order_date
|
||||
HAVING
|
||||
abs(sum(units)) > 10
|
||||
)
|
||||
,combine AS MATERIALIZED (
|
||||
-- select * from partlist
|
||||
-- SELECT * FROM seq WHERE rn = 1 LIMIT 1000
|
||||
-- ,guid AS (
|
||||
SELECT
|
||||
p.billto_group
|
||||
,p.shipto_group
|
||||
,p.dsm
|
||||
,p.part
|
||||
,p.glec
|
||||
,p.pricegroup
|
||||
,p.order_date
|
||||
,p.qty
|
||||
,p.hist_price
|
||||
,CASE WHEN seq.floor = 0 THEN null else seq.floor END floor
|
||||
,CASE WHEN seq.ceiling = 0 THEN null else seq.ceiling END ceiling
|
||||
,seq.uselimits
|
||||
,seq.last_price
|
||||
,seq.avgprice
|
||||
,seq.pltq
|
||||
,ROUND(CASE WHEN seq.uselimits THEN
|
||||
CASE
|
||||
WHEN glec = '1NU' THEN
|
||||
--if more than 8/24 pallets, use floor
|
||||
CASE WHEN p.qty >= 24*seq.pltq THEN seq.floor
|
||||
-- if more than a pallet use the target price
|
||||
ELSE CASE WHEN qtyord >= 8*seq.pltq THEN (seq.ceiling + seq.floor) / 2
|
||||
-- if more than a pallet use the target price
|
||||
ELSE CASE WHEN qtyord >= 2*seq.pltq THEN seq.ceiling
|
||||
-- if more than a pallet use the target price
|
||||
ELSE seq.ceiling * 1.05
|
||||
END END END
|
||||
ELSE
|
||||
CASE WHEN pricegroup ~ '(Hanger|Dish)' THEN
|
||||
--at least 1 pallets is lower limit
|
||||
CASE WHEN qtyord >= 01*seq.pltq THEN seq.floor
|
||||
--at least 2 pallets is mid range
|
||||
ELSE CASE WHEN qtyord >= 0.5*seq.pltq THEN (seq.ceiling + seq.floor) / 2
|
||||
--less than a pallet is upper + 15%
|
||||
ELSE seq.ceiling
|
||||
END END
|
||||
ELSE
|
||||
--at least 8 pallets is lower limit
|
||||
CASE WHEN qtyord >= 08*seq.pltq THEN seq.floor
|
||||
--at least 2 pallets is mid range
|
||||
ELSE CASE WHEN qtyord >= 2*seq.pltq THEN (seq.ceiling + seq.floor) / 2
|
||||
--at least 1 pallet is upper range
|
||||
ELSE CASE WHEN qtyord >= 1*seq.pltq THEN seq.ceiling
|
||||
--less than a pallet is upper + 15%
|
||||
ELSE seq.ceiling * 1.15
|
||||
END END END
|
||||
END
|
||||
END
|
||||
ELSE
|
||||
null
|
||||
END,5) guid
|
||||
,least(hist_price, last_price, avgprice) lowest_last
|
||||
,least(hist_price, last_price, avgprice, CASE WHEN uselimits THEN
|
||||
ROUND(CASE WHEN seq.uselimits THEN
|
||||
CASE
|
||||
WHEN glec = '1NU' THEN
|
||||
--if more than 8/24 pallets, use floor
|
||||
CASE WHEN p.qty >= 24*seq.pltq THEN seq.floor
|
||||
-- if more than a pallet use the target price
|
||||
ELSE CASE WHEN qtyord >= 8*seq.pltq THEN (seq.ceiling + seq.floor) / 2
|
||||
-- if more than a pallet use the target price
|
||||
ELSE CASE WHEN qtyord >= 2*seq.pltq THEN seq.ceiling
|
||||
-- if more than a pallet use the target price
|
||||
ELSE seq.ceiling * 1.05
|
||||
END END END
|
||||
ELSE
|
||||
CASE WHEN pricegroup ~ '(Hanger|Dish)' THEN
|
||||
--at least 1 pallets is lower limit
|
||||
CASE WHEN qtyord >= 01*seq.pltq THEN seq.floor
|
||||
--at least 2 pallets is mid range
|
||||
ELSE CASE WHEN qtyord >= 0.5*seq.pltq THEN (seq.ceiling + seq.floor) / 2
|
||||
--less than a pallet is upper + 15%
|
||||
ELSE seq.ceiling
|
||||
END END
|
||||
ELSE
|
||||
--at least 8 pallets is lower limit
|
||||
CASE WHEN qtyord >= 08*seq.pltq THEN seq.floor
|
||||
--at least 2 pallets is mid range
|
||||
ELSE CASE WHEN qtyord >= 2*seq.pltq THEN (seq.ceiling + seq.floor) / 2
|
||||
--at least 1 pallet is upper range
|
||||
ELSE CASE WHEN qtyord >= 1*seq.pltq THEN seq.ceiling
|
||||
--less than a pallet is upper + 15%
|
||||
ELSE seq.ceiling * 1.15
|
||||
END END END
|
||||
END
|
||||
END
|
||||
ELSE
|
||||
null
|
||||
END,5) ELSE hist_price END) lowest_guid
|
||||
,c.flag
|
||||
FROM
|
||||
partlist p
|
||||
INNER JOIN rlarp.cust_flag c ON
|
||||
c.shipgrp = p.shipto_group
|
||||
AND substring(c.dsm,1,5) = substring(p.dsm,1,5)
|
||||
LEFT OUTER JOIN seq seq ON
|
||||
seq.ship_dba = p.shipto_group
|
||||
AND seq.bill_dba = p.billto_group
|
||||
AND seq.part = p.part
|
||||
AND seq.rn = 1
|
||||
LEFT OUTER JOIN rlarp.repc r ON
|
||||
r.rcode = p.dsm
|
||||
)
|
||||
-- SELECT * FROM combine where shipto_group = 'MONROVIA'
|
||||
,choose AS MATERIALIZED (
|
||||
SELECT
|
||||
billto_group
|
||||
,shipto_group
|
||||
,dsm
|
||||
,part
|
||||
,glec
|
||||
,pricegroup
|
||||
,order_date
|
||||
,qty
|
||||
,hist_price
|
||||
,floor
|
||||
,ceiling
|
||||
,uselimits
|
||||
,last_price
|
||||
,avgprice
|
||||
,pltq
|
||||
,guid
|
||||
,lowest_last
|
||||
,lowest_guid
|
||||
,flag
|
||||
,CASE flag
|
||||
WHEN 'YoY' THEN lowest_last
|
||||
WHEN 'Floor' THEN lowest_guid
|
||||
WHEN 'Retail' THEN hist_price
|
||||
WHEN 'Warehouse' THEN hist_price
|
||||
WHEN 'Orphan' THEN lowest_guid
|
||||
ELSE lowest_last
|
||||
END price_choice
|
||||
FROM
|
||||
combine
|
||||
)
|
||||
-- SELECT * FROM choose where shipto_group = 'MONROVIA' and part = 'NBB005G1BE2B014PYIQX'
|
||||
,logload AS (
|
||||
INSERT INTO rlarp.osm_log (doc) SELECT jsonb_build_object('user',current_user,'tag','Pricing 2','type','Pricing 2','stamp',current_timestamp,'source','top level','message','Pricing 2') RETURNING *
|
||||
)
|
||||
,delta_row AS (
|
||||
SELECT
|
||||
o.fspr
|
||||
,o.plnt
|
||||
,o.promo
|
||||
,o.terms
|
||||
,o.bill_cust_descr
|
||||
,o.ship_cust_descr
|
||||
,o.dsm
|
||||
,o.quota_rep_descr
|
||||
,o.director
|
||||
,o.billto_group
|
||||
,o.shipto_group
|
||||
,o.chan
|
||||
,o.chansub
|
||||
,o.chan_retail
|
||||
,o.part
|
||||
,o.part_descr
|
||||
,o.part_group
|
||||
,o.branding
|
||||
,o.majg_descr
|
||||
,o.ming_descr
|
||||
,o.majs_descr
|
||||
,o.mins_descr
|
||||
,o.segm
|
||||
,o.substance
|
||||
,o.fs_line
|
||||
,o.r_currency
|
||||
,o.r_rate
|
||||
,o.c_currency
|
||||
,o.c_rate
|
||||
,0::numeric units
|
||||
,(c.price_choice * sum(o.units) - sum(value_usd))/o.r_rate value_loc
|
||||
,c.price_choice * sum(o.units) - sum(value_usd) value_usd
|
||||
,0::numeric cost_loc
|
||||
,0::numeric cost_usd
|
||||
,o.calc_status
|
||||
,o.flag
|
||||
,o.order_date
|
||||
,o.order_month
|
||||
,o.order_season
|
||||
,o.request_date
|
||||
,o.request_month
|
||||
,o.request_season
|
||||
,o.ship_date
|
||||
,o.ship_month
|
||||
,o.ship_season
|
||||
,o.version
|
||||
,'Pricing 2' iter
|
||||
,logload.id logid
|
||||
,logload.doc->>'tag' tag
|
||||
,logload.doc->>'message' "comment"
|
||||
,logload.doc->>'type' module
|
||||
,0::NUMERIC pounds
|
||||
FROM
|
||||
rlarp.osm_pool o
|
||||
CROSS JOIN logload
|
||||
INNER JOIN choose c ON
|
||||
c.billto_group = o.billto_group
|
||||
AND c.shipto_group = o.shipto_group
|
||||
AND substring(c.dsm,1,5) = substring(o.dsm,1,5)
|
||||
AND c.part = o.part
|
||||
AND c.order_date = o.order_date
|
||||
WHERE
|
||||
o.order_season = 2026
|
||||
GROUP BY
|
||||
o.fspr
|
||||
,o.plnt
|
||||
,o.promo
|
||||
,o.terms
|
||||
,o.bill_cust_descr
|
||||
,o.ship_cust_descr
|
||||
,o.dsm
|
||||
,o.quota_rep_descr
|
||||
,o.director
|
||||
,o.billto_group
|
||||
,o.shipto_group
|
||||
,o.chan
|
||||
,o.chansub
|
||||
,o.chan_retail
|
||||
,o.part
|
||||
,o.part_descr
|
||||
,o.part_group
|
||||
,o.branding
|
||||
,o.majg_descr
|
||||
,o.ming_descr
|
||||
,o.majs_descr
|
||||
,o.mins_descr
|
||||
,o.segm
|
||||
,o.substance
|
||||
,o.fs_line
|
||||
,o.r_currency
|
||||
,o.r_rate
|
||||
,o.c_currency
|
||||
,o.c_rate
|
||||
,c.price_choice
|
||||
,o.calc_status
|
||||
,o.flag
|
||||
,o.order_date
|
||||
,o.order_month
|
||||
,o.order_season
|
||||
,o.request_date
|
||||
,o.request_month
|
||||
,o.request_season
|
||||
,o.ship_date
|
||||
,o.ship_month
|
||||
,o.ship_season
|
||||
,o.version
|
||||
,logload.id
|
||||
,logload.doc->>'tag'
|
||||
,logload.doc->>'message'
|
||||
,logload.doc->>'type'
|
||||
)
|
||||
-- SELECT SUM(value_usd) from delta_row
|
||||
-- SELECT * FROM delta_row WHERE shipto_group = 'MONROVIA'
|
||||
INSERT INTO rlarp.osm_pool SELECT * FROM delta_row
|
||||
-- SELECT billto_group, shipto_group, substring(dsm,1,5), part, order_date, count(*) over (PARTITION BY billto_group, shipto_group, substring(dsm,1,5), part, order_date) cnt
|
||||
-- FROM
|
||||
-- choose
|
||||
-- GROUP BY
|
||||
-- billto_group, shipto_group, substring(dsm,1,5), part, order_date
|
||||
-- select shipto_group, sum(value_usd) from delta_row group by shipto_group
|
||||
660
offline/scale_baseline.sql
Normal file
660
offline/scale_baseline.sql
Normal file
@ -0,0 +1,660 @@
|
||||
BEGIN;
|
||||
|
||||
WITH
|
||||
targ AS (
|
||||
SELECT shipgrp, dsm, factor::numeric factor FROM (VALUES
|
||||
('THE HOME DEPOT','50802 - TONY LANDINO','0.440751824'),
|
||||
('VAS AGRICULTURAL SUPPLY','12024 - JORDAN BUKOWSKI','-0.8601909665'),
|
||||
('GABRIEL FARMS INC','30053 - SKYE SAWYER','-0.0715868208'),
|
||||
('ALTMAN PLANTS','13028 - RICHARD MEULE','0.016339572'),
|
||||
('COSTA','13028 - RICHARD MEULE','0.2508189317'),
|
||||
('GREENLEAF NURSERY','10040 - RYAN CHITWOOD','-0.412598872'),
|
||||
('GREENLEAF NURSERY','10041 - TAMARA RISKEN','0.0199982064'),
|
||||
('AMAZON.COM','90015 - ANN MARIE FOX','-0.5665240102'),
|
||||
('MENARDS','50802 - TONY LANDINO','-0.5519801472'),
|
||||
('DIAMOND R','12024 - JORDAN BUKOWSKI','0.0104182224'),
|
||||
('EXCEL FARMS','10039 - DUSTIN KUYKENDOLL','-0.0000011839'),
|
||||
('BRON & SONS NURSERY','40042 - TOM MORRIS','0.0000014073'),
|
||||
('K&M','10039 - DUSTIN KUYKENDOLL','-0.0000135002'),
|
||||
('PACIFIC NURSERY POTS','30054 - JASON MOTTIN','-0.6312431332'),
|
||||
('JOHNSON FARMS','10043 - CHERISSE GILSTROP','-1'),
|
||||
('BLUE SKY NURSERY','40039 - DAVE BODO','0.0012046155'),
|
||||
('BFG SUPPLY','12024 - JORDAN BUKOWSKI','-0.366117146'),
|
||||
('J FRANK SCHMIDT & SON','30053 - SKYE SAWYER','-0.0009623929'),
|
||||
('RAILROAD NURSERY','10039 - DUSTIN KUYKENDOLL','-0.0000057726'),
|
||||
('HYDROFARM','10043 - CHERISSE GILSTROP','-0.5000064822'),
|
||||
('HYDROFARM','30035 - RODNEY RIOS','-0.8226750126'),
|
||||
('GRIFFIN','12024 - JORDAN BUKOWSKI','2.3176518423'),
|
||||
('ARIS KEEPSAKE','10039 - DUSTIN KUYKENDOLL','0.0000016618'),
|
||||
('BWI','12024 - JORDAN BUKOWSKI','-0.136024701'),
|
||||
('MOREJON FARMS','10039 - DUSTIN KUYKENDOLL','-0.0000021757'),
|
||||
('GREEN ISLAND DISTRIBUTORS INC','10042 - JEREMY RHAULT','-0.0999971942'),
|
||||
('LOUIS DAVINO SR LLC','12010 - CHRIS SOLTIS','0.0000272248'),
|
||||
('WALNUT SPRINGS - GLENWOOD','10043 - CHERISSE GILSTROP','-1'),
|
||||
('CLI COLOR','10039 - DUSTIN KUYKENDOLL','-0.0000349348'),
|
||||
('FRED MEYER','12026 - JAMEY SCHIESSWOHL','-0.1316064985'),
|
||||
('EMERALD COAST GROWERS','10043 - CHERISSE GILSTROP','0'),
|
||||
('EMERALD COAST GROWERS','10049 - STEVEN STUPPIELLO','0'),
|
||||
('GREENHOUSE MEGASTORE','13027 - STEVE RUSTEBERG','-0.1236816944'),
|
||||
('CY GROWERS SUPPLIES LTD','40042 - TOM MORRIS','-0.1094421705'),
|
||||
('JR SIMPLOT','30053 - SKYE SAWYER','-0.0734864387'),
|
||||
('MEANS NURSERY','30053 - SKYE SAWYER','-0.0795608156'),
|
||||
('A MILIAN','10039 - DUSTIN KUYKENDOLL','0.0000497803'),
|
||||
('KINNEY BONDED','10041 - TAMARA RISKEN','0.019962672'),
|
||||
('PLANT ODYSSEY INC','10041 - TAMARA RISKEN','0.0199875015'),
|
||||
('HAPPY PLANTS','10046 - DUSTIN KUYKENDOLL 2','-0.0000047103'),
|
||||
('RA DUDLEY','10040 - RYAN CHITWOOD','-1'),
|
||||
('CIVANO NURSERY','30035 - RODNEY RIOS','-0.2980987747'),
|
||||
('BABIKOW GREENHOUSES','10043 - CHERISSE GILSTROP','0.0000196166'),
|
||||
('HERITAGE LANDSCAPE','12024 - JORDAN BUKOWSKI','-0.04285507'),
|
||||
('BYLANDS','40042 - TOM MORRIS','-0.0053753495'),
|
||||
('WINDMILL NURSERY','13028 - RICHARD MEULE','-1'),
|
||||
('GRAYS ORNAMENTAL','10039 - DUSTIN KUYKENDOLL','-0.3226838413'),
|
||||
('DALLAS JOHNSON GREENHOUSE','13025 - JAMES REGER','-1'),
|
||||
('CONROE GREENHOUSES INC','10041 - TAMARA RISKEN','15.8241676329'),
|
||||
('GREEN CIRCLE','13025 - JAMES REGER','-1'),
|
||||
('GRC AGROINDUSTRIAL','10039 - DUSTIN KUYKENDOLL','0.0000150273'),
|
||||
('CARLIN HORTICULTURAL SUPP','13027 - STEVE RUSTEBERG','-0.29834931'),
|
||||
('BRANTLEY NURSERIES','10049 - STEVEN STUPPIELLO','-0.0000117946'),
|
||||
('SPANISH RIVER NURSERY','10039 - DUSTIN KUYKENDOLL','-0.0000481066'),
|
||||
('RICHARDSON BROS GREENHOUSE INC','13027 - STEVE RUSTEBERG','-0.0000166548'),
|
||||
('THREE VOLCANOES FARM','10049 - STEVEN STUPPIELLO','0.000003968'),
|
||||
('DICKMAN FARM & GREENHOUSE','10042 - JEREMY RHAULT','-1'),
|
||||
('SMITH GARDENS INC','30053 - SKYE SAWYER','-0.0167235656'),
|
||||
('SMITH GARDENS INC','30054 - JASON MOTTIN','-1'),
|
||||
('YODERS PRODUCE','10048 - PHILIP BIEDENBACH','-0.1236827566'),
|
||||
('FULL BLOOM MARKET GDNS','10042 - JEREMY RHAULT','-0.0000232378'),
|
||||
('TERIS SUPPLY SERVICES','40043 - JEFFREY SCHAEFER','0.0679511504'),
|
||||
('LA FERME GROVER INC','40043 - JEFFREY SCHAEFER','-0.0765125598'),
|
||||
('FARMERS COOP','10035 - MATTHEW STAAL','-1'),
|
||||
('OCEAN STATE JOBBERS','12026 - JAMEY SCHIESSWOHL','-0.5254427663'),
|
||||
('NATURES WAY NRSY OF MIAMI INC','10039 - DUSTIN KUYKENDOLL','-0.00000336'),
|
||||
('BEAVER NURSERY','12028 - JACOB WILKINSON','0.248451206'),
|
||||
('AL PAR PEAT CO','10035 - MATTHEW STAAL','-1'),
|
||||
('WYATT QUARLES','10040 - RYAN CHITWOOD','-0.058431792'),
|
||||
('DEWAR NURSERIES','10046 - DUSTIN KUYKENDOLL 2','0.6966861322'),
|
||||
('CALIFORNIA PLANT CO','30035 - RODNEY RIOS','-1'),
|
||||
('PLANTPEDDLER INC','13027 - STEVE RUSTEBERG','-0.3000161715'),
|
||||
('KRUEGER-MADDUX GREENHOUSES','10048 - PHILIP BIEDENBACH','-1'),
|
||||
('MCALLISTER GREENHOUSES','10040 - RYAN CHITWOOD','-1'),
|
||||
('YOUNGS PLANT FARM INC','13025 - JAMES REGER','-1'),
|
||||
('SEPERS NURSERY','10043 - CHERISSE GILSTROP','-0.0000009416'),
|
||||
('WILSON NURSERY & GARDEN CENTER','10040 - RYAN CHITWOOD','0.0000097942'),
|
||||
('MICHAELS NURSERY','10041 - TAMARA RISKEN','0.0200335767'),
|
||||
('REKKER GARDENS INC','40040 - TINA PETTIGREW','0'),
|
||||
('PURA INDUSTRIES NY LLC','10042 - JEREMY RHAULT','-0.0000115999'),
|
||||
('BLOOM MASTERS','10049 - STEVEN STUPPIELLO','0.0000301392'),
|
||||
('BAMBOO HAMMOCK','10039 - DUSTIN KUYKENDOLL','-1'),
|
||||
('METROLINA','13025 - JAMES REGER','-1'),
|
||||
('GARDEN STATE GROWERS','10043 - CHERISSE GILSTROP','-1'),
|
||||
('JC BAKKER & SONS','40039 - DAVE BODO','-1'),
|
||||
('DEVRY GREENHOUSES','40042 - TOM MORRIS','-1'),
|
||||
('THREE RIVERS NURSERY','10049 - STEVEN STUPPIELLO','-0.0000209756'),
|
||||
('DOUG INGRAM NURSERY','10039 - DUSTIN KUYKENDOLL','-0.000036888'),
|
||||
('JOLLY FARMER CO INC','10042 - JEREMY RHAULT','0.0250241111'),
|
||||
('NUTRIEN AG SOLUTIONS','30035 - RODNEY RIOS','-0.5080022231'),
|
||||
('NUTRIEN AG SOLUTIONS','40042 - TOM MORRIS','-1'),
|
||||
('ARETT SALES','12026 - JAMEY SCHIESSWOHL','0.0338398347'),
|
||||
('CAVICCHIO GREENHOUSES INC','10042 - JEREMY RHAULT','0.0000008435'),
|
||||
('HYBELS','10035 - MATTHEW STAAL','-1'),
|
||||
('RECORD BUCK FARMS INC','10046 - DUSTIN KUYKENDOLL 2','-0.0000122924'),
|
||||
('THE ARBORY','40039 - DAVE BODO','-0.0000225592'),
|
||||
('INTEGRITY PROPAGATION LLC','10043 - CHERISSE GILSTROP','-0.0032525443'),
|
||||
('RAINBOW GREENHOUSES','40042 - TOM MORRIS','-0.000104256'),
|
||||
('FRANTZ WHOLESALE NSY LLC','30054 - JASON MOTTIN','-0.3196442316'),
|
||||
('ARMSTRONG GROWERS','30035 - RODNEY RIOS','-0.212703206'),
|
||||
('RED OAK GREENHOUSES','13027 - STEVE RUSTEBERG','-0.3000260875'),
|
||||
('OBC NORTHWEST INC','30053 - SKYE SAWYER','0.0206653268'),
|
||||
('JIFFY PRODUCTS OF AMERICA','10048 - PHILIP BIEDENBACH','-1'),
|
||||
('MAAX BATH INC','70011 - DNU-SUSAN MURTAUGH','-1'),
|
||||
('VM INNOVATIONS-IN','90015 - ANN MARIE FOX','-1'),
|
||||
('POLY PLASTIC','70011 - DNU-SUSAN MURTAUGH','-1'),
|
||||
('MAPLE LEAF NURSERIES LTD','40040 - TINA PETTIGREW','-0.8443683117'),
|
||||
('DESERT TREE FARM','30035 - RODNEY RIOS','-1'),
|
||||
('GROWERS DEPOT INC','30035 - RODNEY RIOS','-0.5281922805'),
|
||||
('WELBY GARDENS','12028 - JACOB WILKINSON','-0.0561280093'),
|
||||
('MINDERS NURSERY - MANHEIM','10043 - CHERISSE GILSTROP','-0.0000393453'),
|
||||
('SUR-SEAL PACKAGING','70011 - DNU-SUSAN MURTAUGH','-1'),
|
||||
('IWASAKI BROS INC','30053 - SKYE SAWYER','-0.0126515783'),
|
||||
('VAN WINGERDEN INTERNATIONAL','10040 - RYAN CHITWOOD','-1'),
|
||||
('MATSUDAS','30035 - RODNEY RIOS','-0.2886618125'),
|
||||
('OLEANDER AVE','30054 - JASON MOTTIN','-1'),
|
||||
('AMBS FOLIAGE INC','10046 - DUSTIN KUYKENDOLL 2','0.0000034137'),
|
||||
('HOLLANDIA NURSERY','30054 - JASON MOTTIN','-0.3004302354'),
|
||||
('K & M NURSERY','10039 - DUSTIN KUYKENDOLL','-1'),
|
||||
('FOLIDAGE CREEK NURSERY','10041 - TAMARA RISKEN','0.0199707404'),
|
||||
('CANADIAN TIRE CORP LTD','12026 - JAMEY SCHIESSWOHL','-0.0220333464'),
|
||||
('CANDLELIGHT CABINETRY','70011 - DNU-SUSAN MURTAUGH','-1'),
|
||||
('QUALITY GHSE & PERENNIAL FARM','10048 - PHILIP BIEDENBACH','-1'),
|
||||
('ONE FLORAL','40039 - DAVE BODO','-1'),
|
||||
('RAZBUTONS INC','10046 - DUSTIN KUYKENDOLL 2','0.0000159734'),
|
||||
('CUPP & SONS NURSERY','10042 - JEREMY RHAULT','-1'),
|
||||
('HJS WHOLESALE LTD','40040 - TINA PETTIGREW','0.00009371'),
|
||||
('CM BROWN NURSERIES INC','10048 - PHILIP BIEDENBACH','-1'),
|
||||
('KENT''S NURSERY','10041 - TAMARA RISKEN','0.0200605171'),
|
||||
('RUIBALS PLANTS OF TEXAS','10041 - TAMARA RISKEN','0.0200042193'),
|
||||
('VM INNOVATIONS-PA','90015 - ANN MARIE FOX','1.5920580878'),
|
||||
('ACOSTA','10039 - DUSTIN KUYKENDOLL','0.0000257142'),
|
||||
('KC SCHAEFER SUPPLY','10043 - CHERISSE GILSTROP','-0.5000270916'),
|
||||
('ENCHANTED GARDENS','10041 - TAMARA RISKEN','0.0199827174'),
|
||||
('J&R EXOTIC FOLIAGE','10039 - DUSTIN KUYKENDOLL','0.0000257142'),
|
||||
('ALLSEATING CORPORATION (C)','70011 - DNU-SUSAN MURTAUGH','-1'),
|
||||
('WILLIAMS PLANT FARM','10040 - RYAN CHITWOOD','-0.0000415724'),
|
||||
('WOLFPACK PACKAGING INC','70011 - DNU-SUSAN MURTAUGH','-1'),
|
||||
('HYDROGARDEN SUPPLY SERVICES','40040 - TINA PETTIGREW','-0.0000030116'),
|
||||
('JOSEPH DAVINO & SONS','10043 - CHERISSE GILSTROP','-1'),
|
||||
('PIONEER PACKAGING','70011 - DNU-SUSAN MURTAUGH','-1'),
|
||||
('KITH FURNITURE','70011 - DNU-SUSAN MURTAUGH','-1'),
|
||||
('GREAT DANE NURSERY','10046 - DUSTIN KUYKENDOLL 2','-0.0000286859'),
|
||||
('GEORGE SANT & SONS','40039 - DAVE BODO','-1'),
|
||||
('AARON''S CREEK FARMS INC','10040 - RYAN CHITWOOD','-0.0002477164'),
|
||||
('GREENHOUSE & GARDEN SUPPLY INC','12028 - JACOB WILKINSON','0.0997796775'),
|
||||
('DO IT BEST','12026 - JAMEY SCHIESSWOHL','1.0535583302'),
|
||||
('PLEASANT VALLEY FARM INC','10041 - TAMARA RISKEN','0.0306236644'),
|
||||
('DEGOEDE BROTHERS LLC','30053 - SKYE SAWYER','-0.0405669773'),
|
||||
('ROCKWELL FARMS','13025 - JAMES REGER','-1'),
|
||||
('URBAN GROWERS','10048 - PHILIP BIEDENBACH','-1'),
|
||||
('FRANK SMITH NURSERY','10040 - RYAN CHITWOOD','0.0001029045'),
|
||||
('LEIDER GREENHOUSES','13027 - STEVE RUSTEBERG','-1'),
|
||||
('REDDING FARMS LLC','10039 - DUSTIN KUYKENDOLL','0.0000325335'),
|
||||
('BAUCOMS NURSERY COMPANY','10040 - RYAN CHITWOOD','0.0000415918'),
|
||||
('RIVERBEND NURSERY LLC','10040 - RYAN CHITWOOD','-1'),
|
||||
('PERENNIAL FAVORITES','12028 - JACOB WILKINSON','-0.1000068838'),
|
||||
('BRADFORD CO-OP STORAGE LTD','40040 - TINA PETTIGREW','0.0001125369'),
|
||||
('SKAGIT','30054 - JASON MOTTIN','-1'),
|
||||
('HILLCREST NURSERY','10043 - CHERISSE GILSTROP','0.0000254784'),
|
||||
('TREELAND NURSERIES','30035 - RODNEY RIOS','-0.2876943211'),
|
||||
('CLINTON NURSERIES INC.','10042 - JEREMY RHAULT','-0.0000028571'),
|
||||
('DS COLE GROWERS','10042 - JEREMY RHAULT','-0.0000385037'),
|
||||
('PROFESSIONAL GARDENER CO','40042 - TOM MORRIS','-0.0070326166'),
|
||||
('MAGIC GREENS','10039 - DUSTIN KUYKENDOLL','0.0000998055'),
|
||||
('ELGIN TREE FARM INC','30035 - RODNEY RIOS','-0.2343502839'),
|
||||
('KUBE PAK CORPORATION','10043 - CHERISSE GILSTROP','0.0001013'),
|
||||
('METROLINA GREENHOUSES','13025 - JAMES REGER','-1'),
|
||||
('CAL COLOR','30054 - JASON MOTTIN','-1'),
|
||||
('BAILEY NURSERIES INC','10040 - RYAN CHITWOOD','-1'),
|
||||
('BAILEY NURSERIES INC','13027 - STEVE RUSTEBERG','-1'),
|
||||
('GREEN THINGS','30035 - RODNEY RIOS','-1'),
|
||||
('FLOWERLAND GARDEN CTR OF CLEVE','13025 - JAMES REGER','-1'),
|
||||
('FREEMAN HERBS','40039 - DAVE BODO','0.0000638169'),
|
||||
('ISLAND GROWER SUPPLIES LLC','30035 - RODNEY RIOS','0.0307130885'),
|
||||
('T&L NURSERY INC','30053 - SKYE SAWYER','-0.0042972977'),
|
||||
('HARDING NURSERY','12028 - JACOB WILKINSON','0.1499256715'),
|
||||
('LINWYCK GARDENS','10043 - CHERISSE GILSTROP','-0.0000210014'),
|
||||
('HUMMERT INTERNATIONAL','13027 - STEVE RUSTEBERG','-0.3002573298'),
|
||||
('RADEBAUGH GREENHOUSE','10043 - CHERISSE GILSTROP','-1'),
|
||||
('CREACH GREENHOUSES','30053 - SKYE SAWYER','0.0730369292'),
|
||||
('WOODBURN NURSERY','30053 - SKYE SAWYER','-1'),
|
||||
('INDOOR SUN HYDRO','30054 - JASON MOTTIN','-1'),
|
||||
('HIONIS GREENHOUSE INC','10043 - CHERISSE GILSTROP','-0.0409862709'),
|
||||
('BAJA CACTUS AND SUCCULENTS','30054 - JASON MOTTIN','0.0072846828'),
|
||||
('JOSEPH''S NURSERY','10041 - TAMARA RISKEN','0.0200076151'),
|
||||
('CHARLES SPITZNER','10042 - JEREMY RHAULT','0.1500830025'),
|
||||
('A-MILLIAN PLANTS','10039 - DUSTIN KUYKENDOLL','-1'),
|
||||
('VM INNOVATIONS-NV','90015 - ANN MARIE FOX','-1'),
|
||||
('KURT WEISS','10042 - JEREMY RHAULT','-1'),
|
||||
('EVERBLOOM GROWERS INC','10039 - DUSTIN KUYKENDOLL','0.0000604212'),
|
||||
('MANNINGS GREENHOUSE','12028 - JACOB WILKINSON','-0.0000531462'),
|
||||
('BI WATER FARM & GREENHOUSE','10048 - PHILIP BIEDENBACH','0.0119085591'),
|
||||
('PACK''S NURSERY INC','10049 - STEVEN STUPPIELLO','-1'),
|
||||
('DISTRIBUTION FRANKARL INC','40043 - JEFFREY SCHAEFER','0.0713028573'),
|
||||
('BOETHING TREE FARM','30035 - RODNEY RIOS','0.3263039225'),
|
||||
('CLIFFORDS PERENNIAL & VINE','10040 - RYAN CHITWOOD','-1'),
|
||||
('EVERDE','30035 - RODNEY RIOS','-1'),
|
||||
('DUTCHMAN TREE FARM','10035 - MATTHEW STAAL','0.0309023282'),
|
||||
('RED BARN SUPPLY','13027 - STEVE RUSTEBERG','-0.306708479'),
|
||||
('CASSCO','10049 - STEVEN STUPPIELLO','-1'),
|
||||
('F & B FARMS','30053 - SKYE SAWYER','-0.0033209346'),
|
||||
('GULLEY GREENHOUSE','12028 - JACOB WILKINSON','-0.1501501531'),
|
||||
('KAWAHARA NURSERY','30054 - JASON MOTTIN','5.7110911724'),
|
||||
('CHAPARRAL PLUMBING CO INC','10041 - TAMARA RISKEN','0.0200520833'),
|
||||
('EDWARDS GNHSE & FLOWERSHOP LLC','12028 - JACOB WILKINSON','0.000020116'),
|
||||
('EAGLE CREEK WHOLESALE','10048 - PHILIP BIEDENBACH','-1'),
|
||||
('MORTELLAROS NURSERY','10041 - TAMARA RISKEN','0.0199538016'),
|
||||
('PACIFIC GROWER','30053 - SKYE SAWYER','0.0241844078'),
|
||||
('NORTHLAND TREE FARM','40039 - DAVE BODO','-0.0000268663'),
|
||||
('PASTANCH LLC','10042 - JEREMY RHAULT','-0.2999789467'),
|
||||
('HOLMBERG FARMS INC','10039 - DUSTIN KUYKENDOLL','0.0000609575'),
|
||||
('CROSS CREEK / HANOVER FARMS','10040 - RYAN CHITWOOD','0.0000692419'),
|
||||
('NEAL MAST & SON GREENHOUSES','10035 - MATTHEW STAAL','-1'),
|
||||
('WILLOWBROOK NURSERIES INC','40039 - DAVE BODO','-1'),
|
||||
('VM INNOVATIONS-GA','90015 - ANN MARIE FOX','-1'),
|
||||
('OLSONS GREENHOUSE GARDENS','12028 - JACOB WILKINSON','0.000037714'),
|
||||
('VERAS NURSERY INC','13028 - RICHARD MEULE','-1'),
|
||||
('ACE HARDWARE','12026 - JAMEY SCHIESSWOHL','-0.3712496921'),
|
||||
('KEMBER FLOORS WAREHOUSE','70011 - DNU-SUSAN MURTAUGH','-1'),
|
||||
('A&R BELLEY','70011 - DNU-SUSAN MURTAUGH','-1'),
|
||||
('NANA''S BLOOMERS','12028 - JACOB WILKINSON','0.1498426531'),
|
||||
('JOHN WEDDINGTON GREENHOUSE','10040 - RYAN CHITWOOD','-1'),
|
||||
('GRAVANO FARMS','10040 - RYAN CHITWOOD','-0.8373113252'),
|
||||
('WALLA WALLA NURSERY CO','30053 - SKYE SAWYER','-0.0004426839'),
|
||||
('SALMON WHOLESALE NURSERY','10049 - STEVEN STUPPIELLO','-0.0000122924'),
|
||||
('CATOCTIN MOUNTAIN GROWERS','10043 - CHERISSE GILSTROP','-1'),
|
||||
('WENGERLAWN NURSERY CO','10048 - PHILIP BIEDENBACH','-1'),
|
||||
('BIOFLORAL INC','40043 - JEFFREY SCHAEFER','0.0141502354'),
|
||||
('BRADS BEDDING PLANTS INC','10039 - DUSTIN KUYKENDOLL','0.0000399548'),
|
||||
('MILARCH NURSERY INC','10035 - MATTHEW STAAL','-0.1495858143'),
|
||||
('KEMBER INTERIORS CARTERSVILLE','70011 - DNU-SUSAN MURTAUGH','-1'),
|
||||
('VM INNOVATIONS-TX','90015 - ANN MARIE FOX','-1'),
|
||||
('VARNERS GREENHOUSE','10035 - MATTHEW STAAL','-1'),
|
||||
('C STARS NURSERY','30035 - RODNEY RIOS','0.8597159708'),
|
||||
('RONA','12026 - JAMEY SCHIESSWOHL','-0.0946765369'),
|
||||
('AMA PLASTICS','40040 - TINA PETTIGREW','-0.0001141491'),
|
||||
('EVERDE - HUNTINGTON BEACH','30035 - RODNEY RIOS','-1'),
|
||||
('GREENBELT GROWERS','30035 - RODNEY RIOS','-0.0035076531'),
|
||||
('SPARETIME SUPPLY','30054 - JASON MOTTIN','-1'),
|
||||
('OSI PACKAGING LLC','70011 - DNU-SUSAN MURTAUGH','-1'),
|
||||
('5 STAR','10040 - RYAN CHITWOOD','-1'),
|
||||
('AJ BILLES DC CANADIAN TIRE','12026 - JAMEY SCHIESSWOHL','0.4251180352'),
|
||||
('ORLANDO NURSERY INC','10039 - DUSTIN KUYKENDOLL','-1'),
|
||||
('ARIZONA EAST','10046 - DUSTIN KUYKENDOLL 2','0.0000044107'),
|
||||
('THE GROOVY PLANTS RANCH LLC','10048 - PHILIP BIEDENBACH','-0.0149155531'),
|
||||
('GERTEX DISTRIBUTING INC','70011 - DNU-SUSAN MURTAUGH','-1'),
|
||||
('GLOBAL CASEGOODS','70011 - DNU-SUSAN MURTAUGH','-1'),
|
||||
('PREMIER COLOR','30035 - RODNEY RIOS','0.2114662861'),
|
||||
('B&T GROWERS SUPPLY','10041 - TAMARA RISKEN','-1'),
|
||||
('VAN WINGERDEN GREENHOUSES','30053 - SKYE SAWYER','0.0406244163'),
|
||||
('KEMBER INTERIORS','70011 - DNU-SUSAN MURTAUGH','-1'),
|
||||
('OTTO-EMMAS','10042 - JEREMY RHAULT','0'),
|
||||
('HYDRO EASY GROW','10041 - TAMARA RISKEN','-1'),
|
||||
('SUPPLYONE CANADA INC','70011 - DNU-SUSAN MURTAUGH','-1'),
|
||||
('J BERRY NURSERY','10041 - TAMARA RISKEN','-1'),
|
||||
('NIAGARA CONSERVATION CORP.','70011 - DNU-SUSAN MURTAUGH','-1'),
|
||||
('FERNWOOD NURSERIES INC','10047 - RYAN CHITWOOD 2','-1'),
|
||||
('MEYERS FRUIT FARM','70011 - DNU-SUSAN MURTAUGH','-1'),
|
||||
('MARTINS PRODUCE','10048 - PHILIP BIEDENBACH','2.6023433902'),
|
||||
('JONGS ORGANIC FERTILIZER','30035 - RODNEY RIOS','-1'),
|
||||
('ZINO NURSERIES','10042 - JEREMY RHAULT','-1'),
|
||||
('MONTEREY BOTANICALS','30054 - JASON MOTTIN','-0.085653176'),
|
||||
('BATEMAN GREENHOUSES','10042 - JEREMY RHAULT','-0.0000634523'),
|
||||
('DUARTE NURSERY','30054 - JASON MOTTIN','-0.0621968551'),
|
||||
('PURE BEAUTY FARMS','10040 - RYAN CHITWOOD','-0.0000294542'),
|
||||
('MOUSER CABINETRY','70011 - DNU-SUSAN MURTAUGH','-1'),
|
||||
('NORTEX NURSERIES','10041 - TAMARA RISKEN','0.0204598002'),
|
||||
('GRAINGER FARMERS CO-OP','10040 - RYAN CHITWOOD','0.000204654'),
|
||||
('VANDENBERG BULB CO INC','10035 - MATTHEW STAAL','-1'),
|
||||
('BRADLEY CALDWELL INC','12026 - JAMEY SCHIESSWOHL','0.4966431753'),
|
||||
('MOUNTAIN VIEW GREENHOUSES','10040 - RYAN CHITWOOD','-1'),
|
||||
('W ATLEE BURPEE & CO','10048 - PHILIP BIEDENBACH','-1'),
|
||||
('PIKE NURSERIES','10040 - RYAN CHITWOOD','-1'),
|
||||
('SUBURBAN LAWN & GDN INC','10041 - TAMARA RISKEN','0.0200565389'),
|
||||
('ROEBUCK WHOLESALE NURSERY','10040 - RYAN CHITWOOD','-1'),
|
||||
('DBA COUNTRYSIDE GREENHOUSE INC','10035 - MATTHEW STAAL','-1'),
|
||||
('RITCHIE FEED & SEED','40043 - JEFFREY SCHAEFER','-0.0281052901'),
|
||||
('EARL MAY AMES','13027 - STEVE RUSTEBERG','-0.3500851409'),
|
||||
('THREE H FURNITURE','70011 - DNU-SUSAN MURTAUGH','-1'),
|
||||
('HOME HARDWARE STORES','12026 - JAMEY SCHIESSWOHL','0.3281120678'),
|
||||
('EARL MAY SEED','13027 - STEVE RUSTEBERG','-0.1502231632'),
|
||||
('WADE NURSERY','10040 - RYAN CHITWOOD','-1'),
|
||||
('MOSS GREENHOUSES, INC.','12028 - JACOB WILKINSON','-0.0998029064'),
|
||||
('SLAPPENDEL GREENHOUSES','40039 - DAVE BODO','-1'),
|
||||
('BAUMAN FARMS','30053 - SKYE SAWYER','-1'),
|
||||
('RUSTY OAK NURSERY LTD','10048 - PHILIP BIEDENBACH','0.0063656121'),
|
||||
('GREEN LAKE NURSERY','10041 - TAMARA RISKEN','0.0200507993'),
|
||||
('CANOYERS-NE','13027 - STEVE RUSTEBERG','-0.3002345676'),
|
||||
('RUSHTON FARMS','10035 - MATTHEW STAAL','-0.1140616141'),
|
||||
('SELECT TREES INC','10040 - RYAN CHITWOOD','-1'),
|
||||
('RIVERSIDE SUPPLY','10042 - JEREMY RHAULT','-1'),
|
||||
('PLEASANT VIEW GARDENS','13028 - RICHARD MEULE','-1'),
|
||||
('DOWNSVIEW KITCHENS','70011 - DNU-SUSAN MURTAUGH','-1'),
|
||||
('LENERTZ INDUSTRIAL SUPPLY CO','70011 - DNU-SUSAN MURTAUGH','-1'),
|
||||
('SILVER CANYON NURSERY','30035 - RODNEY RIOS','0.7939294575'),
|
||||
('WALLACES GARDEN CENTER','13027 - STEVE RUSTEBERG','-1'),
|
||||
('WEIGEL FARMS - GIBSONVILLE','10040 - RYAN CHITWOOD','-1'),
|
||||
('AMHERST GREENHOUSE','10048 - PHILIP BIEDENBACH','-1'),
|
||||
('COLLIERS GREENHOUSE','10040 - RYAN CHITWOOD','-1'),
|
||||
('GREEN LEGACY','10048 - PHILIP BIEDENBACH','-1'),
|
||||
('KROGER','12026 - JAMEY SCHIESSWOHL','-0.0200505497'),
|
||||
('IMPERIAL DADE CANADA INC','70011 - DNU-SUSAN MURTAUGH','-1'),
|
||||
('COOKS FARM & GHSE','12028 - JACOB WILKINSON','0.0005816715'),
|
||||
('NOEL WILSON INC','40043 - JEFFREY SCHAEFER','0.1669751449'),
|
||||
('DEBONO GREENHOUSES LTD','40040 - TINA PETTIGREW','-1'),
|
||||
('K W COUNTERTOP','70011 - DNU-SUSAN MURTAUGH','-1'),
|
||||
('HENDRIKS & SON GREENHOUSE','40039 - DAVE BODO','-1'),
|
||||
('PINEAE GREENHOUSES & DIST INC','12028 - JACOB WILKINSON','0.0002667378'),
|
||||
('CONFREDA GREENHOUSE','10042 - JEREMY RHAULT','0'),
|
||||
('DAVIDS NURSERY (DIV. SHEELIE)','10041 - TAMARA RISKEN','0.0201554448'),
|
||||
('CASCADES CONTAINERBOARD PKG','70011 - DNU-SUSAN MURTAUGH','-1'),
|
||||
('TRUE VALUE','12026 - JAMEY SCHIESSWOHL','-1'),
|
||||
('ESHRAGHI NURSERIES LLC','30053 - SKYE SAWYER','-1'),
|
||||
('WCP SOLUTIONS','70011 - DNU-SUSAN MURTAUGH','-1'),
|
||||
('FREE STATE GROWERS INC','10041 - TAMARA RISKEN','0.0204279214'),
|
||||
('DIXIE GREEN','10049 - STEVEN STUPPIELLO','-1'),
|
||||
('DOWN HOME RANCH','10041 - TAMARA RISKEN','0.0201178726'),
|
||||
('HORTMARK','10035 - MATTHEW STAAL','-1'),
|
||||
('BELL NURSERY','10040 - RYAN CHITWOOD','-1'),
|
||||
('GRACE ROSE FARM','30035 - RODNEY RIOS','-1'),
|
||||
('AYA KITCHENS AND BATH LTD','70011 - DNU-SUSAN MURTAUGH','-1'),
|
||||
('SKH WHOLESALE DIST','12026 - JAMEY SCHIESSWOHL','-1'),
|
||||
('FOX HOLLOW FARMS INC','40039 - DAVE BODO','-0.0000114658'),
|
||||
('TOM STRAIN AND SONS','10048 - PHILIP BIEDENBACH','-0.0003152852'),
|
||||
('ZYWICKI GREENHOUSE','10035 - MATTHEW STAAL','-1'),
|
||||
('ALLWOOD PRODUCTS','70011 - DNU-SUSAN MURTAUGH','-1'),
|
||||
('SOUTH CENTRAL GROWERS INC','13025 - JAMES REGER','0.133992561'),
|
||||
('PARSONS NURSERY INC','10040 - RYAN CHITWOOD','0.0004602117'),
|
||||
('SUNBLEST GARDENS','10049 - STEVEN STUPPIELLO','23.2454076168'),
|
||||
('TOTALTOYS INC','12026 - JAMEY SCHIESSWOHL','0.028277635'),
|
||||
('INTERMOUNTAIN FARMERS ASSN','12026 - JAMEY SCHIESSWOHL','-0.0112696963'),
|
||||
('NEIL VANDERKRUK HOLDINGS','40039 - DAVE BODO','-1'),
|
||||
('APPLE VALLEY GREENHOUSE','12028 - JACOB WILKINSON','-1'),
|
||||
('ALLIANCE INTERNATIONAL LLC','12026 - JAMEY SCHIESSWOHL','-0.5074741986'),
|
||||
('DEANS GREENHOUSE INC','10048 - PHILIP BIEDENBACH','-1'),
|
||||
('SEWICKLEY CREEK GREENHOUSE','10048 - PHILIP BIEDENBACH','-1'),
|
||||
('FEDERATED CO-OPERATIVES LTD','12026 - JAMEY SCHIESSWOHL','1.0361043655'),
|
||||
('TRUE LEAF','12028 - JACOB WILKINSON','-1'),
|
||||
('PEPINIERE ABBOTSFORD','40043 - JEFFREY SCHAEFER','-1'),
|
||||
('GUTHRIE GREENHOUSES','10041 - TAMARA RISKEN','1.018860266'),
|
||||
('NAUSET ENTERPRISES','70011 - DNU-SUSAN MURTAUGH','-1'),
|
||||
('ROWE PLANT FARM','10041 - TAMARA RISKEN','0.0199105766'),
|
||||
('PR BEAN CO LLC','70011 - DNU-SUSAN MURTAUGH','-1'),
|
||||
('HORIZON PLANTS LLC','10035 - MATTHEW STAAL','-1'),
|
||||
('SUPPLYONE PHILADELPHIA','70011 - DNU-SUSAN MURTAUGH','-1'),
|
||||
('WILDHAGEN GREENHOUSES','40039 - DAVE BODO','-1'),
|
||||
('EAST COAST NURSERIES','10042 - JEREMY RHAULT','-1'),
|
||||
('CCF INDUSTRIES','70011 - DNU-SUSAN MURTAUGH','-1'),
|
||||
('SHIPPERS SUPPLY INC','70011 - DNU-SUSAN MURTAUGH','-1'),
|
||||
('FOSTERS INC','12026 - JAMEY SCHIESSWOHL','-1'),
|
||||
('JOYFUL BUTTERFLY','10040 - RYAN CHITWOOD','-1'),
|
||||
('ALDERSHOT GREENHOUSES','40039 - DAVE BODO','20.6720986337'),
|
||||
('STACKTECK','OTH - OTHER ACCOUNTS - REP UNDEFINED','-1'),
|
||||
('PEPINIERE LEMAY INC','40043 - JEFFREY SCHAEFER','-1'),
|
||||
('CANAPA VALLEY','10035 - MATTHEW STAAL','-1'),
|
||||
('IVY ACRES','10042 - JEREMY RHAULT','-1'),
|
||||
('KEMMERS PLANTS','10048 - PHILIP BIEDENBACH','0.0416666667'),
|
||||
('WARDS GREENHOUSE','12028 - JACOB WILKINSON','-1'),
|
||||
('GENERAL FILMS, INC','70011 - DNU-SUSAN MURTAUGH','-1'),
|
||||
('POSSIBILITY PLACE NURSERY','13027 - STEVE RUSTEBERG','-0.3512132822'),
|
||||
('MISSOURI WILDFLOWERS NURSERY','13027 - STEVE RUSTEBERG','-0.3015414258'),
|
||||
('DA HOERR & SONS INC','13027 - STEVE RUSTEBERG','-0.2891111438'),
|
||||
('MAPLE GREENHOUSES','40039 - DAVE BODO','-1'),
|
||||
('FLRISH FARMS','30054 - JASON MOTTIN','-1'),
|
||||
('KERKSIEK WOOD DESIGN INC','70011 - DNU-SUSAN MURTAUGH','-1'),
|
||||
('WORTHINGTON FARMS INC','10040 - RYAN CHITWOOD','0.0000818398'),
|
||||
('KOCH & CO. INC','70011 - DNU-SUSAN MURTAUGH','-1'),
|
||||
('HORIZON DISTRIBUTION INC','12026 - JAMEY SCHIESSWOHL','-1'),
|
||||
('FULCRUM ACOUSTIC LLC','70011 - DNU-SUSAN MURTAUGH','-1'),
|
||||
('JOE PYE','10043 - CHERISSE GILSTROP','-1'),
|
||||
('ADARIO SALES','10048 - PHILIP BIEDENBACH','-1'),
|
||||
('THE BOX MAKER INC','70011 - DNU-SUSAN MURTAUGH','-1'),
|
||||
('BURO UNIQUE DESIGNS, INC','70011 - DNU-SUSAN MURTAUGH','-1'),
|
||||
('SALIBA, MARTIN','40039 - DAVE BODO','-1'),
|
||||
('HARTS GREENHOUSE & FLORIST','10042 - JEREMY RHAULT','-1'),
|
||||
('POST GARDENS','10035 - MATTHEW STAAL','-1'),
|
||||
('OLSONS GREENHOUSE','10042 - JEREMY RHAULT','0.0984783754'),
|
||||
('ERVA TOOL & DIE CO','12026 - JAMEY SCHIESSWOHL','0.1337457512'),
|
||||
('POTVIN CONSTRUCTION LIMITED','70011 - DNU-SUSAN MURTAUGH','-1'),
|
||||
('DARRELL NORRIS','10048 - PHILIP BIEDENBACH','-1'),
|
||||
('WALDO & ASSOCIATES','10048 - PHILIP BIEDENBACH','-1'),
|
||||
('GREEN TECH GREENHOUSES','10040 - RYAN CHITWOOD','-1'),
|
||||
('HAFNER''S GREENHOUSES','13027 - STEVE RUSTEBERG','-1'),
|
||||
('COIVIC CONTRACTING LTD','40040 - TINA PETTIGREW','-1'),
|
||||
('LANDA PACKAGING DISTRIBUTIONS','70011 - DNU-SUSAN MURTAUGH','-1'),
|
||||
('WHITEBIRD','70011 - DNU-SUSAN MURTAUGH','-1'),
|
||||
('MARLIN ORCHARDS &GARDEN CENTRE','40040 - TINA PETTIGREW','-1'),
|
||||
('GREEN LEAF PLANT FARM','10040 - RYAN CHITWOOD','-1'),
|
||||
('TAWAKONI PLANT FARM','10041 - TAMARA RISKEN','0.02'),
|
||||
('NUNAN THE FLORIST','10042 - JEREMY RHAULT','-1'),
|
||||
('CW KITCHENS INC','70011 - DNU-SUSAN MURTAUGH','-1'),
|
||||
('NURSERYLAND','12026 - JAMEY SCHIESSWOHL','-1'),
|
||||
('BUCKERFIELDS ABBOTSFORD','12026 - JAMEY SCHIESSWOHL','0.4237712854'),
|
||||
('KURTZ CHRISTMAS TREE FARM','10048 - PHILIP BIEDENBACH','-0.041662683'),
|
||||
('GAB - INDUSPAC LTEE','70011 - DNU-SUSAN MURTAUGH','-1'),
|
||||
('CANAC MARQUIS GRENIER','12026 - JAMEY SCHIESSWOHL','-1'),
|
||||
('ECONOBOX - SPRINGBROOK','70011 - DNU-SUSAN MURTAUGH','-1'),
|
||||
('TEMPO FRAMING SYSTEMS','70011 - DNU-SUSAN MURTAUGH','-1'),
|
||||
('MIKE & JOHN ROUSH','10048 - PHILIP BIEDENBACH','-1'),
|
||||
('WALNUT HILL FARM','10042 - JEREMY RHAULT','0.0988065397'),
|
||||
('MARC DANIEL ENTERPRISES, INC','70011 - DNU-SUSAN MURTAUGH','-1'),
|
||||
('CANYON CREEK CABINET CO.','70011 - DNU-SUSAN MURTAUGH','-1'),
|
||||
('ALS GARDEN CENTER','30053 - SKYE SAWYER','-1'),
|
||||
('CIMARRON LUMBER CO','12026 - JAMEY SCHIESSWOHL','1.719878515'),
|
||||
('VAN WINGERDEN GREENHOUSE LLC','10043 - CHERISSE GILSTROP','-1'),
|
||||
('WOJO GREENHOUSES','10035 - MATTHEW STAAL','-1'),
|
||||
('BUCHWALTER GREENHOUSE','10048 - PHILIP BIEDENBACH','0.1293386367'),
|
||||
('ERICH GUMTO GREENHOUSE','10048 - PHILIP BIEDENBACH','-1'),
|
||||
('GREENE BEE GREENHOUSE','10042 - JEREMY RHAULT','-1'),
|
||||
('BOYERTS GREENHOUSE','10048 - PHILIP BIEDENBACH','-1'),
|
||||
('DANIEL J WAGNER','10035 - MATTHEW STAAL','-1'),
|
||||
('GARDEN AVE GREENHOUSE','12028 - JACOB WILKINSON','-1'),
|
||||
('HALIFAX SEED CO INC','40040 - TINA PETTIGREW','-0.0016432951'),
|
||||
('RUHLIG FARMS & GARDEN','10035 - MATTHEW STAAL','-1'),
|
||||
('PL ROHRER & BRO INC RET','12026 - JAMEY SCHIESSWOHL','-1'),
|
||||
('MONTEREY BAY NURSERY','30054 - JASON MOTTIN','-1'),
|
||||
('LIBERTY DISTRIBUTORS, INC','70011 - DNU-SUSAN MURTAUGH','-1'),
|
||||
('TRILLIUM HILL GREENHOUSES','40039 - DAVE BODO','-1'),
|
||||
('MARIANI NURSERY INC','13027 - STEVE RUSTEBERG','-0.2755555556'),
|
||||
('GOTTAS FARM','10042 - JEREMY RHAULT','-1'),
|
||||
('SOUTHWEST PLANT SUPPLY','30035 - RODNEY RIOS','-1'),
|
||||
('DRUMMER LANDSCAPE & GARDEN CTR','13027 - STEVE RUSTEBERG','-1'),
|
||||
('NATALEX MANUFACTURING LTD','70011 - DNU-SUSAN MURTAUGH','-1'),
|
||||
('CAMPBELLS GREENHOUSE','10035 - MATTHEW STAAL','-1'),
|
||||
('SUNWIZE POWER AND BATTERY','70011 - DNU-SUSAN MURTAUGH','-1'),
|
||||
('KW GREENERY','13027 - STEVE RUSTEBERG','-1'),
|
||||
('CRYSTAL LAKE GREENHOUSE','10042 - JEREMY RHAULT','-1'),
|
||||
('JONES GREENHOUSE','10047 - RYAN CHITWOOD 2','-1'),
|
||||
('LUPINE LADY PORCUPINE GNHSE','12028 - JACOB WILKINSON','-1'),
|
||||
('ARCHITECTUAL BRASS','10040 - RYAN CHITWOOD','-1'),
|
||||
('BOBS MARKET & GREENHOUSE','10048 - PHILIP BIEDENBACH','-1'),
|
||||
('HALVERSON FAMILY FARM','10048 - PHILIP BIEDENBACH','-1'),
|
||||
('KEEPU GROWING LLC','10048 - PHILIP BIEDENBACH','0.0034904014'),
|
||||
('ABELE GREENHOUSES','10035 - MATTHEW STAAL','-1'),
|
||||
('ALTON GREENHOUSES','40040 - TINA PETTIGREW','-1'),
|
||||
('HATCHER LAWN & GREENHOUSE','10048 - PHILIP BIEDENBACH','-1'),
|
||||
('RIDGEVIEW ORCHARDS LIMITED','40040 - TINA PETTIGREW','-1'),
|
||||
('SUNRISE GREENHOUSE','10035 - MATTHEW STAAL','-1'),
|
||||
('CANADIAN FOOD INSPECTION AG','40043 - JEFFREY SCHAEFER','-1'),
|
||||
('ALLPACK SOLUTIONS INC','70011 - DNU-SUSAN MURTAUGH','-1'),
|
||||
('CAROLINA PACKAGING & SUPPLY','70011 - DNU-SUSAN MURTAUGH','-1'),
|
||||
('BARRY WOODLEY GREENHOUSE','40040 - TINA PETTIGREW','-1'),
|
||||
('PATRICK LYONS GREENHOUSES','10042 - JEREMY RHAULT','-1'),
|
||||
('TERRA GREENHOUSES LTD','40040 - TINA PETTIGREW','-1'),
|
||||
('FULLERS NURSERY','10041 - TAMARA RISKEN','0.0244259065'),
|
||||
('HILLARDS GREENHOUSES','10042 - JEREMY RHAULT','-1'),
|
||||
('BONNIE BROOKE GARDENS','13027 - STEVE RUSTEBERG','-0.2818671454'),
|
||||
('SPANISH FORK','12028 - JACOB WILKINSON','-1'),
|
||||
('TWELVE OAKS FARM','10035 - MATTHEW STAAL','-1'),
|
||||
('MIKE PARRAN','10035 - MATTHEW STAAL','-1'),
|
||||
('PERINO''S GARDEN CENTER','10041 - TAMARA RISKEN','0.0282603582'),
|
||||
('MISSOURI BOTANICAL GARDEN','13027 - STEVE RUSTEBERG','-0.3074854589'),
|
||||
('FLORIDA STATE UNIVERSITY','10046 - DUSTIN KUYKENDOLL 2','-1'),
|
||||
('SEMINIS VEGETABLE SEEDS','30035 - RODNEY RIOS','-1'),
|
||||
('HOOPERS NURSERY GREENHOUSE','12028 - JACOB WILKINSON','-1'),
|
||||
('PATRICK GIBSON','13027 - STEVE RUSTEBERG','-1'),
|
||||
('KOHLER LANDSCAPING','13027 - STEVE RUSTEBERG','0.0225489297'),
|
||||
('SCHROTH WHOLESALE SUPPLY CO','13027 - STEVE RUSTEBERG','-1'),
|
||||
('THE GARDEN NETWORK','40043 - JEFFREY SCHAEFER','-1'),
|
||||
('SIERRA VISTA GROWERS','12028 - JACOB WILKINSON','-1'),
|
||||
('WILSONS GARDEN CENTER','10048 - PHILIP BIEDENBACH','-1'),
|
||||
('GOODE GREENHOUSE INC','13027 - STEVE RUSTEBERG','-1'),
|
||||
('BIG BLOOMERS','10040 - RYAN CHITWOOD','-1'),
|
||||
('ANTONS GREENHOUSE','13027 - STEVE RUSTEBERG','-0.3037974684'),
|
||||
('SRC CORPORATION','12028 - JACOB WILKINSON','-1'),
|
||||
('JJ''S ACRES','50105 - GLENKIRK ASSOCIATES INC','-1'),
|
||||
('MIDDLETOWN NURSERY','10042 - JEREMY RHAULT','-1'),
|
||||
('PAN AMERICAN SEED','13027 - STEVE RUSTEBERG','-1'),
|
||||
('TELLYS GREENHOUSE','10035 - MATTHEW STAAL','-1'),
|
||||
('BLUE SKY FLOWER FARM LLC','13027 - STEVE RUSTEBERG','-1'),
|
||||
('CARL BREHOB & SON','10048 - PHILIP BIEDENBACH','-1'),
|
||||
('CBI OPERATIONS LLC','10042 - JEREMY RHAULT','-1'),
|
||||
('WJ STRASSELL & SONS INC','10048 - PHILIP BIEDENBACH','-1'),
|
||||
('YOUNGBLOOD NURSERY','30053 - SKYE SAWYER','-1'),
|
||||
('MADISON TREE FARMS, LLC','10048 - PHILIP BIEDENBACH','-1'),
|
||||
('LANCASTER GREENHOUSE','10048 - PHILIP BIEDENBACH','-1'),
|
||||
('CK GREENHOUSES','10042 - JEREMY RHAULT','-1'),
|
||||
('HIDDEN SPRINGS GREENHOUSE','10043 - CHERISSE GILSTROP','-1'),
|
||||
('GWINNETT GREENHOUSE','10040 - RYAN CHITWOOD','-1'),
|
||||
('VIADUCT GARDENS','13027 - STEVE RUSTEBERG','-1'),
|
||||
('NC WILDLIFE RESOURCE COMM','10040 - RYAN CHITWOOD','-1'),
|
||||
('STEINBRINK LANDSCAPING CENTER','13027 - STEVE RUSTEBERG','-1'),
|
||||
('BFG','30053 - SKYE SAWYER','-1'),
|
||||
('ARAUJO FARMS','10042 - JEREMY RHAULT','-1'),
|
||||
('PETITTI GARDEN CENTER','50105 - GLENKIRK ASSOCIATES INC','-1'),
|
||||
('CHATTAHOOCHEE NATURE CENTER','10040 - RYAN CHITWOOD','-1'),
|
||||
('CANOYERS-IA','13027 - STEVE RUSTEBERG','-1'),
|
||||
('RICHLAND COMMUNITY COLLEGE','13027 - STEVE RUSTEBERG','-1'),
|
||||
('BOULEVARD FLOWER GARDENS','50105 - GLENKIRK ASSOCIATES INC','-1'),
|
||||
('HOLLANDALE LANDSCAPING','40040 - TINA PETTIGREW','-1'),
|
||||
('MICHIGAN BLUEBERRY GROWERS','10035 - MATTHEW STAAL','-1'),
|
||||
('QUAD CITY BOTANICAL CTR','13027 - STEVE RUSTEBERG','-1'),
|
||||
('WINDING CREEK NURSERY','13027 - STEVE RUSTEBERG','-0.3390439932'),
|
||||
('WILDWOOD ARTISANS','70011 - DNU-SUSAN MURTAUGH','-1'),
|
||||
('CREATIVE TOUCH FLORAL & GHSE','13027 - STEVE RUSTEBERG','-1'),
|
||||
('PRIVY PINE','13028 - RICHARD MEULE','-1'),
|
||||
('FROG HOLLOW FARM','30053 - SKYE SAWYER','-1'),
|
||||
('BROHLS GREENHOUSE','10035 - MATTHEW STAAL','-1'),
|
||||
('INDIAN TRAIL GARDEN CENTER','10048 - PHILIP BIEDENBACH','-1'),
|
||||
('NESSRALLA''S OF AVON INC','10042 - JEREMY RHAULT','-1'),
|
||||
('LOCKWOOD GHSE & FARM','10042 - JEREMY RHAULT','-1'),
|
||||
('FARMERS MARKET','10048 - PHILIP BIEDENBACH','-1'),
|
||||
('MANDEL GREENHOUSE','10035 - MATTHEW STAAL','-1'),
|
||||
('DRAGONFLY NATIVES LLC','10042 - JEREMY RHAULT','-1'),
|
||||
('GOLDEN STATE FC','50801 - DNU-MARK WILKINSON','-1'),
|
||||
('ULSTER AMERICAN HOMSTEAD','10040 - RYAN CHITWOOD','-1'),
|
||||
('MILLCREEK GARDENS INC','12028 - JACOB WILKINSON','-1'),
|
||||
('KIM ROSSI','10039 - DUSTIN KUYKENDOLL','-1'),
|
||||
('AGWAY OF ORLEANS','10042 - JEREMY RHAULT','-1'),
|
||||
('JENS NORTHSHORE NURSERY','13027 - STEVE RUSTEBERG','-1'),
|
||||
('CARAS NURSERY','12028 - JACOB WILKINSON','-1'),
|
||||
('JOST GREENHOUSE','13027 - STEVE RUSTEBERG','-1'),
|
||||
('DGI PROPAGATORS','10035 - MATTHEW STAAL','-1'),
|
||||
('LEGACY GROWERS AND NURSERY','10041 - TAMARA RISKEN','-1')
|
||||
) x(shipgrp,dsm,factor)
|
||||
-- WHERE
|
||||
-- factor::numeric > 0
|
||||
)
|
||||
--SELECT * FROM agg_curr
|
||||
----------------create a log entry--------------------
|
||||
,log AS (
|
||||
INSERT INTO
|
||||
rlarp.osm_log(doc)
|
||||
SELECT
|
||||
$${
|
||||
"message":"forecasted pounds",
|
||||
"tag":"baseline",
|
||||
"type":"build"
|
||||
}$$::jsonb doc
|
||||
RETURNING *
|
||||
)
|
||||
-------build adjustment rows collapsed for all iterations----------
|
||||
,dv AS (
|
||||
SELECT
|
||||
o.fspr
|
||||
,o.plnt ---master data
|
||||
,o.promo --history date mix
|
||||
,o.terms
|
||||
,o.bill_cust_descr --history cust mix
|
||||
,o.ship_cust_descr --history cust mix
|
||||
,o.dsm
|
||||
,o.quota_rep_descr --master data
|
||||
,o.director
|
||||
,o.billto_group --master data
|
||||
,o.shipto_group
|
||||
,o.chan --master data
|
||||
,o.chansub
|
||||
,o.chan_retail
|
||||
,o.part
|
||||
,o.part_descr
|
||||
,o.part_group
|
||||
,o.branding
|
||||
,o.majg_descr
|
||||
,o.ming_descr
|
||||
,o.majs_descr
|
||||
,o.mins_descr
|
||||
,o.segm
|
||||
,o.substance
|
||||
,o.fs_line --master data
|
||||
,o.r_currency --history cust mix
|
||||
,o.r_rate --master data
|
||||
,o.c_currency --master data
|
||||
,o.c_rate --master data
|
||||
,SUM(Round(o.units*s.factor /*- o.units */ ,2)) units
|
||||
,SUM(Round(o.value_loc*s.factor /*- o.value_loc */ ,2)) value_loc
|
||||
,SUM(Round(o.value_usd*s.factor /*- o.value_usd */ ,2)) value_usd
|
||||
,SUM(Round(o.cost_loc*s.factor /*- o.cost_loc */ ,2)) cost_loc
|
||||
,SUM(Round(o.cost_usd*s.factor /*- o.cost_usd */ ,2)) cost_usd
|
||||
,o.calc_status --0
|
||||
,o.flag --0
|
||||
,o.order_date --history date mix
|
||||
,o.order_month
|
||||
,o.order_season
|
||||
,o.request_date --history date mix
|
||||
,o.request_month
|
||||
,o.request_season
|
||||
,o.ship_date --history date mix
|
||||
,o.ship_month
|
||||
,o.ship_season
|
||||
,'b26' aS version
|
||||
,'fc pounds' iter
|
||||
,log.id
|
||||
,coalescE(log.doc->>'tag','') AS "tag"
|
||||
,log.doc->>'message' AS "comment"
|
||||
,log.doc->>'type' module
|
||||
,SUM(round(o.pounds*s.factor ,2)) pounds
|
||||
FROM
|
||||
rlarp.osm_pool o
|
||||
INNER JOIN targ s ON
|
||||
s.shipgrp = o.shipto_group
|
||||
AND s.dsm = o.quota_rep_descr
|
||||
CROSS JOIN log
|
||||
WHERE
|
||||
o.order_season = 2026
|
||||
AND o.order_month IN ('11 - Apr','12 - May')
|
||||
GROUP BY
|
||||
o.fspr
|
||||
,o.plnt ---master data
|
||||
,o.promo --history date mix
|
||||
,o.terms
|
||||
,o.bill_cust_descr --history cust mix
|
||||
,o.ship_cust_descr --history cust mix
|
||||
,o.dsm
|
||||
,o.quota_rep_descr --master data
|
||||
,o.director
|
||||
,o.billto_group --master data
|
||||
,o.shipto_group
|
||||
,o.chan --master data
|
||||
,o.chansub
|
||||
,o.chan_retail
|
||||
,o.part
|
||||
,o.part_descr
|
||||
,o.part_group
|
||||
,o.branding
|
||||
,o.majg_descr
|
||||
,o.ming_descr
|
||||
,o.majs_descr
|
||||
,o.mins_descr
|
||||
,o.segm
|
||||
,o.substance
|
||||
,o.fs_line --master data
|
||||
,o.r_currency --history cust mix
|
||||
,o.r_rate --master data
|
||||
,o.c_currency --master data
|
||||
,o.c_rate --master data
|
||||
,o.calc_status --0
|
||||
,o.flag --0
|
||||
,o.order_date --history date mix
|
||||
,o.order_month
|
||||
,o.order_season
|
||||
,o.request_date --history date mix
|
||||
,o.request_month
|
||||
,o.request_season
|
||||
,o.ship_date --history date mix
|
||||
,o.ship_month
|
||||
,o.ship_season
|
||||
,log.id
|
||||
,coalescE(log.doc->>'tag','')
|
||||
,log.doc->>'message'
|
||||
,log.doc->>'type'
|
||||
)
|
||||
-- SELECT * FROM dv
|
||||
INSERT INTO rlarp.osm_pool SELECT * FROM dv;
|
||||
--SELECT
|
||||
-- billto_group
|
||||
-- ,sum(value_usd) val
|
||||
-- ,sum(cost_usd) AS cost
|
||||
-- ,sum(units) units
|
||||
--FROM
|
||||
-- dv
|
||||
--GROUP BY
|
||||
-- billto_group
|
||||
|
||||
COMMIT;
|
||||
67
offline/snap_last_price.pg.sql
Normal file
67
offline/snap_last_price.pg.sql
Normal file
@ -0,0 +1,67 @@
|
||||
WITH
|
||||
grp AS (
|
||||
SELECT
|
||||
o.bill_dba
|
||||
,o.ship_dba
|
||||
,o.part
|
||||
,o.odate
|
||||
,o.qtyord
|
||||
,i.nwht * CASE WHEN i.nwun = 'KG' THEN 2.2 ELSE 1 END lbs
|
||||
,i.mpck pltq
|
||||
,ROUND(o.sales_usd / o.qty,5) price
|
||||
,(o.pricing->>'guidance_price')::NUMERIC guidance
|
||||
,(o.pricing->>'floor' )::numeric(15,5) floor
|
||||
,(o.pricing->>'ceiling')::numeric(15,5) ceiling
|
||||
,(o.pricing->>'uselimits')::boolean uselimits
|
||||
FROM
|
||||
rlarp.osm_stack o
|
||||
LEFT OUTER JOIN "CMS.CUSLG".itemm i ON
|
||||
i.item = o.part
|
||||
WHERE
|
||||
VERSION = 'Actual'
|
||||
AND oseas >= 2024
|
||||
AND calc_status <> 'CANCELED'
|
||||
AND o.fs_line = '41010'
|
||||
AND o.part <> ''
|
||||
AND substring(o.glec,1,1) <= '2'
|
||||
AND o.qty <> 0
|
||||
GROUP BY
|
||||
o.bill_dba
|
||||
,o.ship_dba
|
||||
,o.part
|
||||
,o.odate
|
||||
,o.qtyord
|
||||
,o.pounds
|
||||
,o.pallets
|
||||
,ROUND(o.sales_usd / o.qty,5)
|
||||
,i.nwht * CASE WHEN i.nwun = 'KG' THEN 2.2 ELSE 1 END
|
||||
,i.mpck
|
||||
,(o.pricing->>'guidance_price')::NUMERIC
|
||||
,(o.pricing->>'floor' )::numeric(15,5)
|
||||
,(o.pricing->>'ceiling')::numeric(15,5)
|
||||
,(o.pricing->>'uselimits')::boolean
|
||||
)
|
||||
,seq AS (
|
||||
SELECT
|
||||
bill_dba
|
||||
,ship_dba
|
||||
,part
|
||||
,odate
|
||||
,qtyord
|
||||
,lbs
|
||||
,pltq
|
||||
,price
|
||||
,guidance
|
||||
,floor
|
||||
,ceiling
|
||||
,uselimits
|
||||
,row_number() OVER (PARTITION BY bill_dba, ship_dba, part ORDER BY odate desc) rn
|
||||
,round(avg(price) over (PARTITION BY bill_dba, ship_dba, part),5) avgprice
|
||||
FROM
|
||||
grp
|
||||
)
|
||||
SELECT * FROM seq WHERE rn = 1
|
||||
SELECT
|
||||
|
||||
FROM
|
||||
rlarp.osm
|
||||
@ -8,8 +8,8 @@ target AS (select target_volume vincr, target_price pincr)
|
||||
sum(units) tot
|
||||
,sum(units) FILTER (WHERE iter IN ('copy','plan','diff')) base
|
||||
,COALESCE(sum(units) FILTER (WHERE module = 'new basket'),0) newpart
|
||||
,sum(value_loc *r_rate) totsales
|
||||
,sum(value_loc *r_rate) FILTER (WHERE iter IN ('plan','diff','copy')) basesales
|
||||
,coalesce(sum(value_loc *r_rate),0) totsales
|
||||
,coalesce(sum(value_loc *r_rate) FILTER (WHERE iter IN ('plan','diff','copy')),0) basesales
|
||||
,COALESCE(sum(value_loc *r_rate) FILTER (WHERE module = 'new basket'),0) newpartsales
|
||||
FROM
|
||||
rlarp.osm_pool
|
||||
@ -20,6 +20,8 @@ target AS (select target_volume vincr, target_price pincr)
|
||||
AND calc_status||flag <> 'CLOSEDREMAINDER' --exclude short ships when building order adjustments
|
||||
AND order_date <= ship_date
|
||||
)
|
||||
-- select 'testv', * from testv
|
||||
--
|
||||
,flagv AS (
|
||||
SELECT
|
||||
tot
|
||||
@ -54,6 +56,8 @@ target AS (select target_volume vincr, target_price pincr)
|
||||
FROM
|
||||
testv
|
||||
)
|
||||
-- select 'flagv', * from flagv
|
||||
--
|
||||
,GLD AS MATERIALIZED (
|
||||
SELECT
|
||||
N1COMP COMP
|
||||
@ -76,6 +80,8 @@ target AS (select target_volume vincr, target_price pincr)
|
||||
WHERE
|
||||
N1COMP = 93
|
||||
)
|
||||
-- select 'gld', * from gld
|
||||
--
|
||||
,mseq AS (
|
||||
SELECT * FROM
|
||||
(
|
||||
@ -94,6 +100,8 @@ target AS (select target_volume vincr, target_price pincr)
|
||||
,('12 - May',12,5,0)
|
||||
) x(m,s,cal,yr)
|
||||
)
|
||||
-- select 'mseq', * from mseq
|
||||
--
|
||||
,alldates AS MATERIALIZED(
|
||||
SELECT
|
||||
promo
|
||||
@ -127,10 +135,11 @@ target AS (select target_volume vincr, target_price pincr)
|
||||
,order_date
|
||||
,request_date
|
||||
,ship_date
|
||||
HAVING
|
||||
sum(CASE (SELECT flagsales FROM flagv) WHEN 'no price'THEN 1.0 ELSE value_usd END) <> 0
|
||||
-- HAVING
|
||||
-- sum(CASE (SELECT flagsales FROM flagv) WHEN 'no price'THEN 1.0 ELSE value_usd END) <> 0
|
||||
)
|
||||
--select * from alldates
|
||||
-- select 'alldates', * from alldates
|
||||
--
|
||||
,dom AS (
|
||||
SELECT
|
||||
extract(day FROM order_date) DOM
|
||||
@ -140,6 +149,8 @@ target AS (select target_volume vincr, target_price pincr)
|
||||
GROUP BY
|
||||
extract(day FROM order_date)
|
||||
)
|
||||
-- select 'dom', * from dom
|
||||
--
|
||||
---------------------may want ot look at a top-5 mix solution in the future facilitated by sum() over (order by sales desc)---------------
|
||||
,mmix AS (
|
||||
SELECT
|
||||
@ -151,18 +162,19 @@ target AS (select target_volume vincr, target_price pincr)
|
||||
,sum((request_date-order_date)*(value_usd)) rlag_wa
|
||||
--,ship_date - request_date slag
|
||||
,sum((ship_date - request_date)*(value_usd)) slag_wa
|
||||
,sum(value_usd) value_usd
|
||||
,coalesce(nullif(sum(value_usd),0),1) value_usd
|
||||
FROM
|
||||
alldates
|
||||
GROUP BY
|
||||
to_char(order_date,'Mon')
|
||||
,seq
|
||||
,promo
|
||||
--,extract(day from order_date)
|
||||
--,request_date-order_date
|
||||
--,ship_date - request_date
|
||||
)
|
||||
-- select 'mmix', * from mmix
|
||||
--
|
||||
,targm AS (select s, m from mseq where m = 'target_month' )
|
||||
-- select 'targm', * from targm
|
||||
--
|
||||
,mmixp AS (
|
||||
SELECT
|
||||
_month
|
||||
@ -172,10 +184,11 @@ target AS (select target_volume vincr, target_price pincr)
|
||||
,round((rlag_wa/value_usd)::numeric,0)::int rlag
|
||||
,round((slag_wa/value_usd)::numeric,0)::int slag
|
||||
,value_usd/sum(value_usd) over (partition by _month) momix
|
||||
--,value_usd/SUM(value_usd) over (PARTITION BY _month) vperc
|
||||
FROM
|
||||
mmix
|
||||
)
|
||||
-- select 'mmixp', * from mmixp
|
||||
--
|
||||
,closest AS (
|
||||
SELECT
|
||||
_month, targm.s, m
|
||||
@ -186,6 +199,8 @@ target AS (select target_volume vincr, target_price pincr)
|
||||
abs(seq - targm.s) ASC
|
||||
LIMIT 1
|
||||
)
|
||||
-- select 'closest', * from closest
|
||||
--
|
||||
---------------------the role of basemix here is to get non-dated info which is then dated in the next step---------------------
|
||||
,basemix AS (
|
||||
SELECT
|
||||
@ -276,16 +291,33 @@ SELECT
|
||||
,o.calc_status
|
||||
,o.flag
|
||||
)
|
||||
-- select 'basemix', * from basemix
|
||||
--
|
||||
,vscale AS (
|
||||
SELECT
|
||||
(SELECT vincr::numeric FROM target) incr
|
||||
,(SELECT sum(units) FROM basemix) base
|
||||
,(SELECT vincr::numeric FROM target)/(SELECT sum(units) FROM basemix) factor
|
||||
-- If sum(units) = 0, then we're likely working with a single row. We can't
|
||||
-- scale 0, no matter how we try, so we just use mod_volume to set the value we want.
|
||||
-- When sum(units) <> 0, then we use factor to scale units.
|
||||
,CASE
|
||||
WHEN (SELECT sum(units)::numeric FROM basemix) = 0
|
||||
THEN 0
|
||||
ELSE (SELECT vincr::numeric FROM target)/(SELECT sum(units)::numeric FROM basemix)
|
||||
END AS factor
|
||||
,CASE
|
||||
WHEN (SELECT sum(units)::numeric FROM basemix) = 0
|
||||
THEN (SELECT vincr::numeric FROM target)
|
||||
ELSE 0
|
||||
END AS mod_volume
|
||||
)
|
||||
--select * from SCALE
|
||||
-- select 'vscale', * from vscale
|
||||
--
|
||||
,log AS (
|
||||
INSERT INTO rlarp.osm_log(doc) SELECT $$replace_iterdef$$::jsonb doc RETURNING *
|
||||
)
|
||||
-- select 'log', * from log
|
||||
--
|
||||
,volume AS (
|
||||
SELECT
|
||||
sd.fspr
|
||||
@ -317,21 +349,21 @@ SELECT
|
||||
,b.r_rate
|
||||
,b.c_currency
|
||||
,b.c_rate
|
||||
,round(b.units*s.factor*m.momix ,2) units
|
||||
,round((CASE WHEN s.factor = 0 THEN s.mod_volume ELSE b.units*s.factor END)*m.momix, 2) units
|
||||
,round(b.value_loc*s.factor*m.momix,2) value_loc
|
||||
,round(b.value_usd*s.factor*m.momix,2) value_usd
|
||||
,round(b.cost_loc*s.factor*m.momix ,2) cost_loc
|
||||
,round(b.cost_usd*s.factor*m.momix ,2) cost_usd
|
||||
,b.calc_status
|
||||
,b.flag
|
||||
,make_date(mseq.yr + 2024,mseq.cal,m.odom) order_date
|
||||
,od.sspr || ' - ' || to_char(make_date(mseq.yr + 2024,mseq.cal,m.odom),'Mon') order_month
|
||||
,make_date(mseq.yr + 2025,mseq.cal,m.odom) order_date
|
||||
,od.sspr || ' - ' || to_char(make_date(mseq.yr + 2025,mseq.cal,m.odom),'Mon') order_month
|
||||
,od.ssyr order_season
|
||||
,make_date(mseq.yr + 2024,mseq.cal,m.odom) + rlag request_date
|
||||
,rd.sspr || ' - ' ||to_char(make_date(mseq.yr + 2024,mseq.cal,m.odom) + rlag,'Mon') request_month
|
||||
,make_date(mseq.yr + 2025,mseq.cal,m.odom) + rlag request_date
|
||||
,rd.sspr || ' - ' ||to_char(make_date(mseq.yr + 2025,mseq.cal,m.odom) + rlag,'Mon') request_month
|
||||
,rd.ssyr request_season
|
||||
,make_date(mseq.yr + 2024,mseq.cal,m.odom) + rlag + slag ship_date
|
||||
,sd.sspr || ' - ' || to_char(make_date(mseq.yr + 2024,mseq.cal,m.odom) + rlag + slag,'Mon') ship_month
|
||||
,make_date(mseq.yr + 2025,mseq.cal,m.odom) + rlag + slag ship_date
|
||||
,sd.sspr || ' - ' || to_char(make_date(mseq.yr + 2025,mseq.cal,m.odom) + rlag + slag,'Mon') ship_month
|
||||
,sd.ssyr ship_season
|
||||
,'replace_version' "version"
|
||||
,'replace_source'||' volume' iter
|
||||
@ -339,7 +371,11 @@ SELECT
|
||||
,COALESCE(log.doc->>'tag','') "tag"
|
||||
,log.doc->>'message' "comment"
|
||||
,log.doc->>'type' module
|
||||
,round(b.pounds*s.factor*m.momix, 2) pounds
|
||||
,round(CASE
|
||||
WHEN s.factor = 0 THEN s.mod_volume * i.nwht * (CASE i.nwun
|
||||
WHEN 'KG' THEN 2.2046
|
||||
ELSE 1 END)
|
||||
ELSE b.pounds*s.factor END, 2) pounds
|
||||
FROM
|
||||
basemix b
|
||||
CROSS JOIN vscale s
|
||||
@ -349,34 +385,35 @@ FROM
|
||||
LEFT OUTER JOIN mseq ON
|
||||
mseq.m = closest.m
|
||||
LEFT OUTER JOIN gld od ON
|
||||
make_date(mseq.yr + 2024,mseq.cal,m.odom) BETWEEN od.sdat AND od.edat
|
||||
make_date(mseq.yr + 2025,mseq.cal,m.odom) BETWEEN od.sdat AND od.edat
|
||||
LEFT OUTER JOIN gld rd ON
|
||||
make_date(mseq.yr + 2024,mseq.cal,m.odom) + rlag BETWEEN rd.sdat AND rd.edat
|
||||
make_date(mseq.yr + 2025,mseq.cal,m.odom) + rlag BETWEEN rd.sdat AND rd.edat
|
||||
LEFT OUTER JOIN gld sd ON
|
||||
make_date(mseq.yr + 2024,mseq.cal,m.odom) + rlag + slag BETWEEN sd.sdat AND sd.edat
|
||||
make_date(mseq.yr + 2025,mseq.cal,m.odom) + rlag + slag BETWEEN sd.sdat AND sd.edat
|
||||
LEFT OUTER JOIN "CMS.CUSLG".itemm i ON i.item = b.part
|
||||
WHERE
|
||||
m._month = (SELECT _month FROM closest)
|
||||
)
|
||||
-- select 'volume', * from volume
|
||||
--
|
||||
,pscale AS (
|
||||
SELECT
|
||||
(SELECT pincr::numeric FROM target) incr
|
||||
,(SELECT sum(value_loc * r_rate) FROM volume) base
|
||||
,CASE WHEN (SELECT sum(value_loc * r_rate) FROM volume) = 0 THEN
|
||||
0
|
||||
ELSE
|
||||
((SELECT pincr::numeric FROM target) - (SELECT sum(value_loc * r_rate) FROM volume))/(SELECT sum(value_loc * r_rate) FROM volume)
|
||||
CASE
|
||||
WHEN (SELECT coalesce(sum(value_usd),0) FROM volume) = 0 AND (SELECT sum(units) FROM volume) = 0 THEN 'both'
|
||||
WHEN (SELECT coalesce(sum(value_usd),0) FROM volume) = 0 THEN 'value'
|
||||
ELSE 'other'
|
||||
END zero_values
|
||||
,CASE
|
||||
WHEN (SELECT coalesce(sum(value_usd),0) FROM volume) = 0 AND (SELECT coalesce(sum(units),0) FROM volume) = 0 -- Split pincr evenly between rows.
|
||||
THEN (SELECT pincr::numeric FROM target) / (SELECT nullif(count(*),0) FROM volume)
|
||||
WHEN (SELECT coalesce(sum(value_usd),0) FROM volume) = 0 -- Get a per-unit pincr value
|
||||
THEN (SELECT pincr::numeric FROM target) / (SELECT nullif(sum(units),0) FROM volume)
|
||||
ELSE -- Find percent change for existing value_loc
|
||||
(SELECT pincr::numeric FROM target) / (SELECT nullif(sum(value_usd),0) FROM volume) - 1
|
||||
END factor
|
||||
,CASE WHEN (SELECT sum(value_loc * r_rate) FROM volume) = 0 THEN
|
||||
CASE WHEN ((SELECT pincr::numeric FROM target) - (SELECT sum(value_loc * r_rate) FROM volume)) <> 0 THEN
|
||||
--if the base value is -0- but the target value hasn't been achieved, derive a price to apply
|
||||
((SELECT pincr::numeric FROM target) - (SELECT sum(value_loc * r_rate) FROM volume))/(SELECT sum(units) FROM volume)
|
||||
ELSE
|
||||
0
|
||||
END
|
||||
ELSE
|
||||
0
|
||||
END mod_price
|
||||
)
|
||||
-- select 'pscale', * from pscale
|
||||
--
|
||||
,price AS (
|
||||
SELECT
|
||||
b.fspr
|
||||
@ -409,8 +446,16 @@ SELECT
|
||||
,b.c_currency
|
||||
,b.c_rate
|
||||
,0::numeric units
|
||||
,round((CASE WHEN p.factor = 0 THEN b.units * p.mod_price/b.r_rate ELSE b.value_loc*p.factor END)::numeric,2) value_loc
|
||||
,round((CASE WHEN p.factor = 0 THEN b.units * p.mod_price ELSE b.value_usd*p.factor END)::numeric ,2) value_usd
|
||||
,round(CASE p.zero_values
|
||||
WHEN 'both' THEN p.factor / b.r_rate
|
||||
WHEN 'value' THEN b.units * p.factor / b.r_rate
|
||||
WHEN 'other' THEN b.value_loc * p.factor
|
||||
END, 2) AS value_loc
|
||||
,round(CASE p.zero_values
|
||||
WHEN 'both' THEN p.factor
|
||||
WHEN 'value' THEN b.units * p.factor
|
||||
WHEN 'other' THEN b.value_usd * p.factor
|
||||
END, 2) AS value_usd
|
||||
,0::numeric cost_loc
|
||||
,0::numeric cost_usd
|
||||
,b.calc_status
|
||||
@ -436,8 +481,10 @@ FROM
|
||||
CROSS JOIN pscale p
|
||||
CROSS JOIN log
|
||||
WHERE
|
||||
p.factor <> 0 or p.mod_price <> 0
|
||||
abs(p.factor) > 0.00001
|
||||
)
|
||||
-- select 'price', * from price UNION ALL SELECT 'volume', * FROM volume
|
||||
--
|
||||
, ins AS (
|
||||
INSERT INTO rlarp.osm_pool (SELECT * FROM price UNION ALL SELECT * FROM volume) RETURNING *
|
||||
)
|
||||
@ -524,4 +571,6 @@ FROM
|
||||
,tag
|
||||
,comment
|
||||
)
|
||||
-- select 'insagg', * from insagg
|
||||
--
|
||||
SELECT json_agg(row_to_json(insagg)) x from insagg
|
||||
|
||||
@ -45,7 +45,7 @@ SELECT
|
||||
FROM
|
||||
rlarp.osm_pool
|
||||
WHERE
|
||||
quota_rep_descr = 'rep_replace'
|
||||
where_clause
|
||||
GROUP BY
|
||||
---------customer info-----------------
|
||||
bill_cust_descr
|
||||
|
||||
@ -14,8 +14,9 @@ from
|
||||
inner join rlarp.osm_pool on
|
||||
id = logid
|
||||
WHERE
|
||||
quota_rep_descr = 'replace_user'
|
||||
where_clause
|
||||
AND tag NOT IN ('Initial Build','last price')
|
||||
AND ol.id <> 1
|
||||
group BY
|
||||
ol.doc->>'user'
|
||||
,quota_rep_descr
|
||||
|
||||
301
route_sql/mix_change.sql
Normal file
301
route_sql/mix_change.sql
Normal file
@ -0,0 +1,301 @@
|
||||
WITH
|
||||
/*
|
||||
the volume must be expressed in terms of units, since that is what it will be scaling
|
||||
*/
|
||||
target AS (select $$replace_request$$::json def)
|
||||
,seg AS (
|
||||
SELECT
|
||||
x.GLEC glec
|
||||
,x.SEGM segm
|
||||
FROM
|
||||
(
|
||||
VALUES
|
||||
('1SU','Sustainable'),
|
||||
('1CU','Sustainable'),
|
||||
('1GR','Greenhouse'),
|
||||
('1NU','Nursery'),
|
||||
('1RE','Retail'),
|
||||
('2WI','Greenhouse'),
|
||||
('3BM','Other'),
|
||||
('3CO','Other'),
|
||||
('3PE','Other'),
|
||||
('3PP','Other'),
|
||||
('4CO','Other'),
|
||||
('4RA','Other'),
|
||||
('9MI','Other'),
|
||||
('9SA','Other'),
|
||||
('9TO','Other')
|
||||
) X(GLEC, SEGM)
|
||||
)
|
||||
,copr AS (
|
||||
SELECT
|
||||
LTRIM(RTRIM(A9)) AS COMP,
|
||||
A30 AS DESCR,
|
||||
SUBSTR(C.A249,242,2) CURR,
|
||||
SUBSTR(C.A249,32,4) AS GL,
|
||||
SUBSTR(C.A249,190,4) AS AR,
|
||||
SUBSTR(C.A249,182,4) AS AP,
|
||||
SUBSTR(C.A249,198,4) AS FA,
|
||||
SUBSTR(C.A249,238,4) AS IC ,
|
||||
SUBSTR(D.A249,9,5) CONS_FUNC
|
||||
FROM
|
||||
LGDAT.CODE
|
||||
LEFT OUTER JOIN LGDAT.NAME C ON
|
||||
'C0000'||LTRIM(RTRIM(A9)) = C.A7
|
||||
LEFT OUTER JOIN LGDAT.NAME D ON
|
||||
'D0000'||LTRIM(RTRIM(A9)) = D.A7
|
||||
WHERE
|
||||
A2 = 'AA' OR A2 IS NULL
|
||||
)
|
||||
,parts AS (
|
||||
SELECT
|
||||
jr.*
|
||||
FROM
|
||||
target
|
||||
JOIN LATERAL json_array_elements(def->'parts') as ae(e) ON true
|
||||
JOIN LATERAL json_to_record(ae.e) as jr(part text, qty numeric, price numeric, pounds numeric) ON true
|
||||
)
|
||||
-- SELECT * FROM parts
|
||||
,dates AS (
|
||||
SELECT
|
||||
jr.*
|
||||
,def->'scenario'->>'quota_rep_descr' quota_rep_descr
|
||||
FROM
|
||||
target
|
||||
JOIN LATERAL json_array_elements(def->'dates') as ae(e) ON true
|
||||
JOIN LATERAL json_to_record(ae.e) as jr(
|
||||
bill_cust_descr text
|
||||
,ship_cust_descr text
|
||||
,promo text
|
||||
,terms text
|
||||
,r_currency text
|
||||
,order_date date
|
||||
,ship_date date
|
||||
,fc_mix numeric
|
||||
,baseline_mix numeric
|
||||
) ON true
|
||||
)
|
||||
-- SELECT * FROM dates
|
||||
,basemix AS (
|
||||
SELECT
|
||||
od.fspr
|
||||
,d.promo
|
||||
,d.terms
|
||||
,d.r_currency
|
||||
,d.bill_cust_descr
|
||||
,d.ship_cust_descr
|
||||
,d.quota_rep_descr
|
||||
,p.part
|
||||
,round(d.fc_mix * p.qty,0) units
|
||||
,round(d.fc_mix * p.qty,0)* p.price value_usd --assume that target dollars are USD
|
||||
,d.order_date
|
||||
,od.sortmo order_month
|
||||
,od.ssyr order_season
|
||||
,d.ship_date request_date
|
||||
,sd.sortmo request_month
|
||||
,sd.ssyr request_season
|
||||
,d.ship_date
|
||||
,sd.sortmo ship_month
|
||||
,sd.ssyr ship_season
|
||||
FROM
|
||||
dates d
|
||||
CROSS JOIN parts p
|
||||
LEFT OUTER JOIN rlarp.gld sd ON
|
||||
d.ship_date <@ sd.drange
|
||||
LEFT OUTER JOIN rlarp.gld od ON
|
||||
d.order_date <@ od.drange
|
||||
)
|
||||
,log AS (
|
||||
INSERT INTO rlarp.osm_log(doc) SELECT $$replace_iterdef$$::jsonb doc RETURNING *
|
||||
)
|
||||
-- SELECT * FROM basemix
|
||||
,final AS (
|
||||
SELECT
|
||||
b.fspr
|
||||
,i.dplt plnt
|
||||
,b.promo
|
||||
,b.terms
|
||||
,b.bill_cust_descr
|
||||
,b.ship_cust_descr
|
||||
,r.rcode
|
||||
,b.quota_rep_descr
|
||||
,r.director
|
||||
,bc.dba billto_group
|
||||
,sc.dba shipto_group
|
||||
,CASE SUBSTRING(bc.cclass,2,3)
|
||||
--if the bill to class is ditsributor, then it's either warehouse or drop
|
||||
WHEN 'DIS' THEN
|
||||
--if the ship-to is a different name than the bill-to then it's drop, otherwise it's warehouse
|
||||
CASE SUBSTRING(sc.cclass,2,3)
|
||||
WHEN 'DIS' THEN 'WHS'
|
||||
ELSE 'DRP'
|
||||
END
|
||||
--CASE WHEN RTRIM(SUBSTRING(LTRIM(SC.BVADR7)||SC.BVNAME,1,30)) = RTRIM(SUBSTRING(LTRIM(BC.BVADR7)||BC.BVNAME,1,30)) THEN 'DIS' ELSE 'DRP' END
|
||||
--everything else does not involve a distributor and is considered direct
|
||||
ELSE 'DIR'
|
||||
END chan
|
||||
,CASE SUBSTRING(bc.cclass,2,3)
|
||||
WHEN 'DIS' THEN
|
||||
--if the ship-to is a different name than the bill-to then it's drop, otherwise it's warehouse
|
||||
CASE SUBSTRING(sc.cclass,2,3)
|
||||
WHEN 'DIS' THEN 'WHS'
|
||||
ELSE CASE SUBSTRING(sc.cclass,1,1) WHEN 'R' THEN 'RDP' ELSE 'DRP' END
|
||||
END
|
||||
WHEN 'MAS' THEN 'RMN'
|
||||
WHEN 'NAT' THEN 'RMN'
|
||||
ELSE CASE SUBSTRING(sc.cclass,1,1) WHEN 'R' THEN 'RDI' ELSE 'DIR' END
|
||||
END chansub
|
||||
,null::text chan_retail
|
||||
,b.part
|
||||
,b.part || ' - ' || i.descr
|
||||
,i.partgroup
|
||||
,i.branding
|
||||
,i.majgd majg_descr
|
||||
,i.mingd ming_descr
|
||||
,i.majsd majs_descr
|
||||
,i.minsd mins_descr
|
||||
,seg.segm
|
||||
,CASE WHEN i.majg = '610' THEN 'Fiber' ELSE 'Plastic' END substance
|
||||
,'41010' fs_line --master data
|
||||
,b.r_currency --history cust mix
|
||||
,rx.rate r_rate --master data
|
||||
,pl.curr c_currency --master data
|
||||
,cx.rate c_rate --master data
|
||||
,round(b.units ,2) units
|
||||
,round((b.value_usd / COALESCE(rx.rate,1))::numeric ,2) value_loc --b.value is denominated in USD, need to apply currency to get to local, assume 1 if using a fake customer
|
||||
,round(b.value_usd ,2) value_usd --b.value is already denominated in usd
|
||||
,round((i.futstd*b.units)::numeric ,2) cost_loc
|
||||
,round((i.futstdus*b.units)::numeric,2) cost_usd
|
||||
,'CLOSED' calc_status
|
||||
,'SHIPMENT' flag
|
||||
,b.order_date
|
||||
,b.order_month
|
||||
,b.order_season
|
||||
,b.request_date
|
||||
,b.request_month
|
||||
,b.request_season
|
||||
,b.ship_date
|
||||
,b.ship_month
|
||||
,b.ship_season
|
||||
,'replace_version' "version"
|
||||
,'replace_source'||' volume' iter
|
||||
,log.id
|
||||
,COALESCE(log.doc->>'tag','') "tag"
|
||||
,log.doc->>'message' "comment"
|
||||
,log.doc->>'type' module
|
||||
,round(b.units * i.nwht * CASE i.nwun WHEN 'KG' THEN 2.2046 ELSE 1 END, 2) pounds
|
||||
FROM
|
||||
basemix b
|
||||
CROSS JOIN log
|
||||
LEFT OUTER JOIN rlarp.repc r ON
|
||||
r.repp = b.quota_rep_descr
|
||||
LEFT OUTER JOIN "CMS.CUSLG".itemm i ON
|
||||
i.item = b.part
|
||||
LEFT OUTER JOIN rlarp.cust bc ON
|
||||
bc.code = rtrim(substring(b.bill_cust_descr,1,8))
|
||||
LEFT OUTER JOIN rlarp.cust sc ON
|
||||
sc.code = rtrim(substring(b.ship_cust_descr,1,8))
|
||||
LEFT OUTER JOIN seg ON
|
||||
seg.glec = i.glec
|
||||
LEFT OUTER JOIN rlarp.plpr pl ON
|
||||
pl.plnt = i.dplt
|
||||
LEFT OUTER JOIN rlarp.ffcret cx ON
|
||||
cx.perd = pl.gl AND
|
||||
cx.rtyp = 'MA' AND
|
||||
cx.fcur = pl.curr AND
|
||||
cx.tcur = 'US'
|
||||
LEFT OUTER JOIN rlarp.ffcret rx ON
|
||||
rx.perd = pl.gl AND
|
||||
rx.rtyp = 'MA' AND
|
||||
rx.fcur = b.r_currency AND
|
||||
rx.tcur = 'US'
|
||||
)
|
||||
, ins AS (
|
||||
INSERT INTO rlarp.osm_pool SELECT * FROM final RETURNING *
|
||||
)
|
||||
,insagg AS (
|
||||
SELECT
|
||||
---------customer info-----------------
|
||||
bill_cust_descr
|
||||
,billto_group
|
||||
,ship_cust_descr
|
||||
,shipto_group
|
||||
,quota_rep_descr
|
||||
,director
|
||||
,segm
|
||||
,substance
|
||||
,chan
|
||||
,chansub
|
||||
---------product info------------------
|
||||
,majg_descr
|
||||
,ming_descr
|
||||
,majs_descr
|
||||
,mins_descr
|
||||
--,brand
|
||||
--,part_family
|
||||
,part_group
|
||||
,branding
|
||||
--,color
|
||||
,part_descr
|
||||
---------dates-------------------------
|
||||
,order_season
|
||||
,order_month
|
||||
,ship_season
|
||||
,ship_month
|
||||
,request_season
|
||||
,request_month
|
||||
,promo
|
||||
,version
|
||||
,iter
|
||||
,logid
|
||||
,tag
|
||||
,comment
|
||||
--------values-------------------------
|
||||
,sum(value_loc) value_loc
|
||||
,sum(value_usd) value_usd
|
||||
,sum(cost_loc) cost_loc
|
||||
,sum(cost_usd) cost_usd
|
||||
,sum(units) units
|
||||
,sum(pounds) pounds
|
||||
FROM
|
||||
ins
|
||||
GROUP BY
|
||||
---------customer info-----------------
|
||||
bill_cust_descr
|
||||
,billto_group
|
||||
,ship_cust_descr
|
||||
,shipto_group
|
||||
,quota_rep_descr
|
||||
,director
|
||||
,segm
|
||||
,substance
|
||||
,chan
|
||||
,chansub
|
||||
---------product info------------------
|
||||
,majg_descr
|
||||
,ming_descr
|
||||
,majs_descr
|
||||
,mins_descr
|
||||
--,brand
|
||||
--,part_family
|
||||
,part_group
|
||||
,branding
|
||||
--,color
|
||||
,part_descr
|
||||
---------dates-------------------------
|
||||
,order_season
|
||||
,order_month
|
||||
,ship_season
|
||||
,ship_month
|
||||
,request_season
|
||||
,request_month
|
||||
,promo
|
||||
,version
|
||||
,iter
|
||||
,logid
|
||||
,tag
|
||||
,comment
|
||||
)
|
||||
-- select 'insagg', * from insagg
|
||||
--
|
||||
SELECT json_agg(row_to_json(insagg)) x from insagg
|
||||
@ -1,10 +1,10 @@
|
||||
-- Connection: usmidsap01.ubm
|
||||
WITH
|
||||
/*
|
||||
the volume must be expressed in terms of units, since that is what it will be scaling
|
||||
*/
|
||||
target AS (select $$replace_request$$::json def)
|
||||
--select * from newm
|
||||
-- select 'target', * from target
|
||||
--
|
||||
,GLD AS (
|
||||
SELECT
|
||||
N1COMP COMP
|
||||
@ -29,6 +29,8 @@ target AS (select $$replace_request$$::json def)
|
||||
N1COMP = 93
|
||||
--AND DIGITS(N1FSYP) = '1901'
|
||||
)
|
||||
-- select 'GLD', * from GLD
|
||||
--
|
||||
,mseq AS (
|
||||
SELECT * FROM
|
||||
(
|
||||
@ -47,6 +49,8 @@ target AS (select $$replace_request$$::json def)
|
||||
,('12 - May',12,5,0)
|
||||
) x(m,s,cal,yr)
|
||||
)
|
||||
-- select 'mseq', * from mseq
|
||||
--
|
||||
,seg AS (
|
||||
SELECT
|
||||
x.GLEC glec
|
||||
@ -71,6 +75,8 @@ target AS (select $$replace_request$$::json def)
|
||||
('9TO','Other')
|
||||
) X(GLEC, SEGM)
|
||||
)
|
||||
-- select 'seg', * from seg
|
||||
--
|
||||
,copr AS (
|
||||
SELECT
|
||||
LTRIM(RTRIM(A9)) AS COMP,
|
||||
@ -91,6 +97,8 @@ target AS (select $$replace_request$$::json def)
|
||||
WHERE
|
||||
A2 = 'AA' OR A2 IS NULL
|
||||
)
|
||||
-- select 'copr', * from copr
|
||||
--
|
||||
,alldates AS (
|
||||
SELECT
|
||||
promo
|
||||
@ -122,10 +130,11 @@ target AS (select $$replace_request$$::json def)
|
||||
,order_date
|
||||
,request_date
|
||||
,ship_date
|
||||
HAVING
|
||||
sum(value_usd) <> 0
|
||||
-- HAVING
|
||||
-- sum(value_usd) <> 0
|
||||
)
|
||||
--select * from alldates
|
||||
-- select 'alldates', * from alldates
|
||||
--
|
||||
,dom AS (
|
||||
SELECT
|
||||
extract(day FROM order_date) DOM
|
||||
@ -135,8 +144,8 @@ target AS (select $$replace_request$$::json def)
|
||||
GROUP BY
|
||||
extract(day FROM order_date)
|
||||
)
|
||||
--select * from dom
|
||||
---------------------may want ot look at a top-5 mix solution in the future facilitated by sum() over (order by sales desc)---------------
|
||||
-- select 'dom', * from dom
|
||||
--
|
||||
,mmix AS (
|
||||
SELECT
|
||||
to_char(order_date,'Mon') _month
|
||||
@ -150,7 +159,7 @@ target AS (select $$replace_request$$::json def)
|
||||
,sum((request_date-order_date)*(value_usd)) rlag_wa
|
||||
--,ship_date - request_date slag
|
||||
,sum((ship_date - request_date)*(value_usd)) slag_wa
|
||||
,sum(value_usd) value_usd
|
||||
,COALESCE(nullif(sum(value_usd),0),1) value_usd
|
||||
FROM
|
||||
alldates
|
||||
GROUP BY
|
||||
@ -162,7 +171,8 @@ target AS (select $$replace_request$$::json def)
|
||||
--,request_date-order_date
|
||||
--,ship_date - request_date
|
||||
)
|
||||
--select * from mmix
|
||||
-- select 'mmix', * from mmix
|
||||
--
|
||||
,targm AS (
|
||||
SELECT
|
||||
je.key as month
|
||||
@ -178,7 +188,8 @@ target AS (select $$replace_request$$::json def)
|
||||
LEFT OUTER JOIN mseq ON
|
||||
mseq.m = je.key
|
||||
)
|
||||
--select * from targm
|
||||
--select 'targm', * from targm
|
||||
--
|
||||
,mmixp AS (
|
||||
SELECT
|
||||
_month
|
||||
@ -194,8 +205,8 @@ target AS (select $$replace_request$$::json def)
|
||||
FROM
|
||||
mmix
|
||||
)
|
||||
--select * from mmixp
|
||||
--month cross join mix
|
||||
--select 'mmixp', * from mmixp
|
||||
--
|
||||
,mxm AS (
|
||||
SELECT
|
||||
t.month
|
||||
@ -224,8 +235,8 @@ FROM
|
||||
LIMIT 1
|
||||
)
|
||||
)
|
||||
--SELECT * FROM mxm
|
||||
--this basemix is probably join going to be part-bill-ship with all master data joined later since it is not known if any original is salvaged
|
||||
-- SELECT 'mxm', * FROM mxm
|
||||
--
|
||||
,basemix AS (
|
||||
SELECT
|
||||
sd.fspr
|
||||
@ -239,13 +250,13 @@ SELECT
|
||||
,substring(jr.part_descr,1,8) part_group
|
||||
,mxm.qty*mxm.momix*jr.mix units
|
||||
,mxm.amount*mxm.momix*jr.mix value_usd --assume that target dollars are USD
|
||||
,make_date(mxm.yr + 2024,mxm.cal,mxm.odom) order_date
|
||||
,make_date(mxm.yr + 2026,mxm.cal,mxm.odom) order_date
|
||||
,od.sortmo order_month
|
||||
,od.ssyr order_season
|
||||
,make_date(mxm.yr + 2024,mxm.cal,mxm.odom) + rlag request_date
|
||||
,make_date(mxm.yr + 2026,mxm.cal,mxm.odom) + rlag request_date
|
||||
,rd.sortmo request_month
|
||||
,rd.ssyr request_season
|
||||
,make_date(mxm.yr + 2024,mxm.cal,mxm.odom) + rlag + slag ship_date
|
||||
,make_date(mxm.yr + 2026,mxm.cal,mxm.odom) + rlag + slag ship_date
|
||||
,sd.sortmo ship_month
|
||||
,sd.ssyr ship_season
|
||||
,jr.mix
|
||||
@ -255,16 +266,19 @@ SELECT
|
||||
JOIN LATERAL json_to_record(ae.e) as jr(part_descr text, bill_cust_descr text, ship_cust_descr text, mix numeric) ON true
|
||||
CROSS JOIN mxm
|
||||
LEFT OUTER JOIN gld od ON
|
||||
od.drange @> make_date(mxm.yr + 2024,mxm.cal,mxm.odom)
|
||||
od.drange @> make_date(mxm.yr + 2026,mxm.cal,mxm.odom)
|
||||
LEFT OUTER JOIN gld rd ON
|
||||
rd.drange @> (make_date(mxm.yr + 2024,mxm.cal,mxm.odom) + rlag)
|
||||
rd.drange @> (make_date(mxm.yr + 2026,mxm.cal,mxm.odom) + rlag)
|
||||
LEFT OUTER JOIN gld sd ON
|
||||
sd.drange @> (make_date(mxm.yr + 2024,mxm.cal,mxm.odom) + rlag + slag)
|
||||
sd.drange @> (make_date(mxm.yr + 2026,mxm.cal,mxm.odom) + rlag + slag)
|
||||
)
|
||||
--SELECT * FROM basemix
|
||||
-- SELECT 'basemix', * FROM basemix
|
||||
--
|
||||
,log AS (
|
||||
INSERT INTO rlarp.osm_log(doc) SELECT $$replace_iterdef$$::jsonb doc RETURNING *
|
||||
)
|
||||
-- select 'log', * from log
|
||||
--
|
||||
,final AS (
|
||||
SELECT
|
||||
b.fspr
|
||||
@ -346,8 +360,8 @@ FROM
|
||||
LEFT OUTER JOIN "CMS.CUSLG".itemm i ON
|
||||
i.item = b.part
|
||||
LEFT OUTER JOIN SEG ON
|
||||
SEG.GLEC = i.glec
|
||||
--AND SEG.SEGM <> 'Other'
|
||||
SEG.GLEC = i.glec -- AND
|
||||
-- SEG.SEGM <> 'Other'
|
||||
LEFT OUTER JOIN LGDAT.CUST BC ON
|
||||
BC.BVCUST = rtrim(substring(b.bill_cust_descr,1,8))
|
||||
LEFT OUTER JOIN LGDAT.CUST SC ON
|
||||
@ -367,29 +381,31 @@ FROM
|
||||
END
|
||||
END
|
||||
LEFT OUTER JOIN lgdat.icstm im ON
|
||||
im.cgpart = b.part
|
||||
AND im.cgplnt = i.dplt
|
||||
im.cgpart = b.part AND
|
||||
im.cgplnt = i.dplt
|
||||
LEFT OUTER JOIN lgdat.icstp ip ON
|
||||
ip.chpart = b.part
|
||||
AND ip.chplnt = i.dplt
|
||||
ip.chpart = b.part AND
|
||||
ip.chplnt = i.dplt
|
||||
LEFT OUTER JOIN lgdat.icstr ir ON
|
||||
ir.y0part = b.part
|
||||
AND ir.y0plnt = i.dplt
|
||||
ir.y0part = b.part AND
|
||||
ir.y0plnt = i.dplt
|
||||
LEFT OUTER JOIN lgdat.plnt ON
|
||||
yaplnt = i.dplt
|
||||
LEFT OUTER JOIN copr ON
|
||||
copr.comp = yacomp::text
|
||||
LEFT OUTER JOIN rlarp.ffcret cx ON
|
||||
cx.perd = '2310'
|
||||
AND cx.rtyp = 'MA'
|
||||
AND cx.fcur = copr.curr
|
||||
AND cx.tcur = 'US'
|
||||
LEFT OUTER JOIN rlarp.ffcret rx ON
|
||||
rx.perd = '2310'
|
||||
AND rx.rtyp = 'MA'
|
||||
AND rx.fcur = COALESCE(bc.bvcurr,b.r_currency)
|
||||
AND rx.tcur = 'US'
|
||||
LEFT OUTER JOIN (select 'US' fcur, 1.0 rate UNION ALL select 'CA', 0.7409) cx ON
|
||||
-- cx.perd = '2412' AND
|
||||
-- cx.rtyp = 'MA' AND
|
||||
cx.fcur = copr.curr -- AND
|
||||
-- cx.tcur = 'US'
|
||||
LEFT OUTER JOIN (select 'US' fcur, 1.0 rate UNION ALL select 'CA', 0.7409) rx ON
|
||||
-- rx.perd = '2412' AND
|
||||
-- rx.rtyp = 'MA' AND
|
||||
rx.fcur = COALESCE(bc.bvcurr,b.r_currency) -- AND
|
||||
-- rx.tcur = 'US'
|
||||
)
|
||||
-- select 'final', * from final
|
||||
--
|
||||
, ins AS (
|
||||
INSERT INTO rlarp.osm_pool SELECT * FROM final RETURNING *
|
||||
)
|
||||
@ -476,4 +492,6 @@ FROM
|
||||
,tag
|
||||
,comment
|
||||
)
|
||||
-- select 'insagg', * from insagg
|
||||
--
|
||||
SELECT json_agg(row_to_json(insagg)) x from insagg
|
||||
|
||||
@ -28,9 +28,9 @@ target AS (select target_increment incr)
|
||||
,substance
|
||||
,fs_line --master data
|
||||
,r_currency --history cust mix
|
||||
,r_rate --master data
|
||||
,coalesce(r_rate,1) as r_rate --master data
|
||||
,c_currency --master data
|
||||
,c_rate --master data
|
||||
,coalesce(c_rate,1) as c_rate --master data
|
||||
,sum(coalesce(units,0)) units --history value
|
||||
,sum(coalesce(value_loc,0)) value_loc --history value
|
||||
,sum(coalesce(value_usd,0)) value_usd --0
|
||||
@ -98,29 +98,31 @@ target AS (select target_increment incr)
|
||||
,ship_month
|
||||
,ship_season
|
||||
)
|
||||
-- select 'basemix', * from basemix
|
||||
--
|
||||
,scale AS (
|
||||
SELECT
|
||||
(SELECT incr::numeric FROM target) incr
|
||||
,(SELECT sum(value_loc * r_rate) FROM basemix) base
|
||||
,CASE WHEN (SELECT sum(value_loc * r_rate) FROM basemix) = 0 THEN
|
||||
0
|
||||
ELSE
|
||||
(SELECT incr::numeric FROM target)/(SELECT sum(value_loc * r_rate) FROM basemix)
|
||||
CASE
|
||||
WHEN (SELECT coalesce(sum(value_loc),0) FROM basemix) = 0 AND (SELECT sum(units) FROM basemix) = 0 THEN 'both'
|
||||
WHEN (SELECT coalesce(sum(value_loc),0) FROM basemix) = 0 THEN 'cost'
|
||||
ELSE 'other'
|
||||
END zero_values
|
||||
,CASE
|
||||
WHEN (SELECT coalesce(sum(value_loc),0) FROM basemix) = 0 AND (SELECT coalesce(sum(units),0) FROM basemix) = 0 -- Split incr evenly between rows.
|
||||
THEN (SELECT incr::numeric FROM target) / (SELECT nullif(count(*),0) FROM basemix)
|
||||
WHEN (SELECT coalesce(sum(value_loc),0) FROM basemix) = 0 -- Get a per-unit incr value
|
||||
THEN (SELECT incr::numeric FROM target) / (SELECT nullif(sum(units),0) FROM basemix)
|
||||
ELSE -- Find percent change for existing value_loc
|
||||
(SELECT incr::numeric FROM target) / (SELECT nullif(sum(value_loc * r_rate),0) FROM basemix)
|
||||
END factor
|
||||
,CASE WHEN (SELECT sum(value_loc * r_rate) FROM basemix) = 0 THEN
|
||||
CASE WHEN ((SELECT incr::numeric FROM target) - (SELECT sum(value_loc * r_rate) FROM basemix)) <> 0 THEN
|
||||
--if the base value is -0- but the target value hasn't been achieved, derive a price to apply
|
||||
((SELECT incr::numeric FROM target) - (SELECT sum(value_loc * r_rate) FROM basemix))/(SELECT sum(units) FROM basemix)
|
||||
ELSE
|
||||
0
|
||||
END
|
||||
ELSE
|
||||
0
|
||||
END mod_price
|
||||
)
|
||||
-- select 'scale', * from scale
|
||||
--
|
||||
,log AS (
|
||||
INSERT INTO rlarp.osm_log(doc) SELECT $$replace_iterdef$$::jsonb doc RETURNING *
|
||||
)
|
||||
-- select 'log', * from log
|
||||
--
|
||||
,final AS (
|
||||
SELECT
|
||||
fspr
|
||||
@ -153,8 +155,16 @@ target AS (select target_increment incr)
|
||||
,c_currency --master data
|
||||
,c_rate --master data
|
||||
,0::numeric units
|
||||
,round((CASE WHEN s.factor = 0 THEN b.units * s.mod_price/b.r_rate ELSE b.value_loc*s.factor END)::numeric,2) value_loc
|
||||
,round((CASE WHEN s.factor = 0 THEN b.units * s.mod_price ELSE b.value_usd*s.factor END)::numeric ,2) value_usd
|
||||
,round(CASE s.zero_values
|
||||
WHEN 'both' THEN s.factor / b.r_rate
|
||||
WHEN 'cost' THEN b.units * s.factor / b.r_rate
|
||||
WHEN 'other' THEN b.value_loc * s.factor
|
||||
END, 2) AS value_loc
|
||||
,round(CASE s.zero_values
|
||||
WHEN 'both' THEN s.factor
|
||||
WHEN 'cost' THEN b.units * s.factor
|
||||
WHEN 'other' THEN b.value_usd * s.factor
|
||||
END, 2) AS value_usd
|
||||
,0::numeric cost_loc
|
||||
,0::numeric cost_usd
|
||||
,calc_status --0
|
||||
@ -180,9 +190,10 @@ target AS (select target_increment incr)
|
||||
CROSS JOIN scale s
|
||||
CROSS JOIN log
|
||||
WHERE
|
||||
s.factor <> 0 or s.mod_price <> 0
|
||||
s.factor <> 0
|
||||
)
|
||||
--select sum(value_usd), count(*) from final
|
||||
-- select 'final', * from final
|
||||
--
|
||||
, ins AS (
|
||||
INSERT INTO rlarp.osm_pool SELECT * FROM final RETURNING *
|
||||
)
|
||||
@ -269,4 +280,6 @@ target AS (select target_increment incr)
|
||||
,tag
|
||||
,comment
|
||||
)
|
||||
-- select 'insagg', * from insagg
|
||||
--
|
||||
SELECT json_agg(row_to_json(insagg)) x from insagg
|
||||
|
||||
@ -14,6 +14,8 @@ target AS (select incr_qty qincr)
|
||||
AND calc_status||flag <> 'CLOSEDREMAINDER' --exclude short ships when building order adjustments
|
||||
AND order_date <= ship_date
|
||||
)
|
||||
-- select 'testv', * from testv
|
||||
--
|
||||
,flagv AS (
|
||||
SELECT
|
||||
tot
|
||||
@ -35,7 +37,8 @@ target AS (select incr_qty qincr)
|
||||
FROM
|
||||
testv
|
||||
)
|
||||
--ever need receive a target of -0- qty but value <> 0?
|
||||
-- select 'flagv', * from flagv
|
||||
--
|
||||
,basemix AS (
|
||||
SELECT
|
||||
fspr
|
||||
@ -64,9 +67,9 @@ target AS (select incr_qty qincr)
|
||||
,substance
|
||||
,fs_line --master data
|
||||
,r_currency --history cust mix
|
||||
,r_rate --master data
|
||||
,coalesce(r_rate,1) as r_rate --master data
|
||||
,c_currency --master data
|
||||
,c_rate --master data
|
||||
,coalesce(c_rate,1) as c_rate --master data
|
||||
,sum(coalesce(units,0)) units --history value
|
||||
,sum(coalesce(value_loc,0)) value_loc --history value
|
||||
,sum(coalesce(value_usd,0)) value_usd --0
|
||||
@ -139,17 +142,33 @@ target AS (select incr_qty qincr)
|
||||
,ship_month
|
||||
,ship_season
|
||||
)
|
||||
--SELECT * FROM basemix
|
||||
-- select 'basemix', * from basemix
|
||||
--
|
||||
,scale AS (
|
||||
SELECT
|
||||
(SELECT qincr::numeric FROM target) incr
|
||||
,(SELECT sum(value_loc *r_rate) FROM basemix) base
|
||||
,(SELECT qincr FROM target)/(SELECT SUM(units) FROM basemix) factor
|
||||
-- If sum(units) = 0, then we're likely working with a single row. We can't
|
||||
-- scale 0, no matter how we try, so we just use mod_volume to set the value we want.
|
||||
-- When sum(units) <> 0, then we use factor to scale units.
|
||||
,CASE
|
||||
WHEN (SELECT sum(units)::numeric FROM basemix) = 0
|
||||
THEN 0
|
||||
ELSE (SELECT qincr::numeric FROM target)/(SELECT sum(units)::numeric FROM basemix)
|
||||
END AS factor
|
||||
,CASE
|
||||
WHEN (SELECT sum(units)::numeric FROM basemix) = 0
|
||||
THEN (SELECT qincr::numeric FROM target)
|
||||
ELSE 0
|
||||
END AS mod_volume
|
||||
)
|
||||
--select * from scale
|
||||
-- select 'scale', * from scale
|
||||
--
|
||||
,log AS (
|
||||
INSERT INTO rlarp.osm_log(doc) SELECT $$replace_iterdef$$::jsonb doc RETURNING *
|
||||
)
|
||||
-- select 'log', * from log
|
||||
--
|
||||
,final AS (
|
||||
SELECT
|
||||
fspr
|
||||
@ -166,10 +185,10 @@ target AS (select incr_qty qincr)
|
||||
,chan --master data
|
||||
,chansub
|
||||
,chan_retail
|
||||
,part
|
||||
,b.part
|
||||
,part_descr
|
||||
,part_group
|
||||
,branding
|
||||
,b.branding
|
||||
,majg_descr
|
||||
,ming_descr
|
||||
,majs_descr
|
||||
@ -181,7 +200,7 @@ target AS (select incr_qty qincr)
|
||||
,r_rate --master data
|
||||
,c_currency --master data
|
||||
,c_rate --master data
|
||||
,round(units*s.factor ,2) units
|
||||
,round(CASE WHEN s.factor = 0 THEN s.mod_volume ELSE units*s.factor END, 2) units
|
||||
,round(value_loc*s.factor, 2) value_loc
|
||||
,round(value_usd*s.factor, 2) value_usd
|
||||
,round(cost_loc*s.factor, 2) cost_loc
|
||||
@ -203,13 +222,19 @@ target AS (select incr_qty qincr)
|
||||
,COALESCE(log.doc->>'tag','') "tag"
|
||||
,log.doc->>'message' "comment"
|
||||
,log.doc->>'type' module
|
||||
,round(pounds*s.factor, 2) pounds
|
||||
,round(CASE
|
||||
WHEN s.factor = 0 THEN s.mod_volume * i.nwht * (CASE i.nwun
|
||||
WHEN 'KG' THEN 2.2046
|
||||
ELSE 1 END)
|
||||
ELSE pounds*s.factor END, 2) pounds
|
||||
FROM
|
||||
basemix b
|
||||
CROSS JOIN scale s
|
||||
CROSS JOIN log
|
||||
LEFT OUTER JOIN "CMS.CUSLG".itemm i ON i.item = b.part
|
||||
)
|
||||
--select sum(value_usd), count(*) from final
|
||||
-- select 'final', * from final
|
||||
--
|
||||
, ins AS (
|
||||
INSERT INTO rlarp.osm_pool SELECT * FROM final RETURNING *
|
||||
)
|
||||
@ -296,4 +321,6 @@ FROM
|
||||
,tag
|
||||
,comment
|
||||
)
|
||||
-- select 'insagg', * from insagg
|
||||
--
|
||||
SELECT json_agg(row_to_json(insagg)) x from insagg
|
||||
|
||||
@ -13,8 +13,9 @@ target AS (select target_vol vincr, target_prc pincr)
|
||||
-----------------additional params-------------------
|
||||
AND calc_status||flag <> 'CLOSEDREMAINDER' --exclude short ships when building order adjustments
|
||||
AND order_date <= ship_date
|
||||
|
||||
)
|
||||
-- select 'testv', * from testv
|
||||
--
|
||||
,flagv AS (
|
||||
SELECT
|
||||
tot
|
||||
@ -36,6 +37,8 @@ target AS (select target_vol vincr, target_prc pincr)
|
||||
FROM
|
||||
testv
|
||||
)
|
||||
-- select 'flagv', * from flagv
|
||||
--
|
||||
,basemix AS (
|
||||
SELECT
|
||||
fspr
|
||||
@ -64,9 +67,9 @@ target AS (select target_vol vincr, target_prc pincr)
|
||||
,substance
|
||||
,fs_line --master data
|
||||
,r_currency --history cust mix
|
||||
,r_rate --master data
|
||||
,coalesce(r_rate,1) as r_rate --master data
|
||||
,c_currency --master data
|
||||
,c_rate --master data
|
||||
,coalesce(c_rate,1) as c_rate --master data
|
||||
,sum(coalesce(units,0)) units --history value
|
||||
,sum(coalesce(value_loc,0)) value_loc --history value
|
||||
,sum(coalesce(value_usd,0)) value_usd --0
|
||||
@ -139,13 +142,28 @@ target AS (select target_vol vincr, target_prc pincr)
|
||||
,ship_month
|
||||
,ship_season
|
||||
)
|
||||
-- select 'basemix', * from basemix
|
||||
--
|
||||
,vscale AS (
|
||||
SELECT
|
||||
(SELECT vincr::numeric FROM target) incr
|
||||
,(SELECT sum(units)::numeric FROM basemix) base
|
||||
,(SELECT vincr::numeric FROM target)/(SELECT sum(units)::numeric FROM basemix) factor
|
||||
-- If sum(units) = 0, then we're likely working with a single row. We can't
|
||||
-- scale 0, no matter how we try, so we just use mod_volume to set the value we want.
|
||||
-- When sum(units) <> 0, then we use factor to scale units.
|
||||
,CASE
|
||||
WHEN (SELECT sum(units)::numeric FROM basemix) = 0
|
||||
THEN 0
|
||||
ELSE (SELECT vincr::numeric FROM target)/(SELECT sum(units)::numeric FROM basemix)
|
||||
END AS factor
|
||||
,CASE
|
||||
WHEN (SELECT sum(units)::numeric FROM basemix) = 0
|
||||
THEN (SELECT vincr::numeric FROM target)
|
||||
ELSE 0
|
||||
END AS mod_volume
|
||||
)
|
||||
--select * from vscale
|
||||
-- select 'vscale', * from vscale
|
||||
--
|
||||
,log AS (
|
||||
INSERT INTO rlarp.osm_log(doc) SELECT $$replace_iterdef$$::jsonb doc RETURNING *
|
||||
)
|
||||
@ -165,10 +183,10 @@ target AS (select target_vol vincr, target_prc pincr)
|
||||
,chan --master data
|
||||
,chansub
|
||||
,chan_retail
|
||||
,part
|
||||
,b.part
|
||||
,part_descr
|
||||
,part_group
|
||||
,branding
|
||||
,b.branding
|
||||
,majg_descr
|
||||
,ming_descr
|
||||
,majs_descr
|
||||
@ -180,7 +198,7 @@ target AS (select target_vol vincr, target_prc pincr)
|
||||
,r_rate --master data
|
||||
,c_currency --master data
|
||||
,c_rate --master data
|
||||
,round(units*s.factor ,2) units
|
||||
,round(CASE WHEN s.factor = 0 THEN s.mod_volume ELSE units*s.factor END, 2) units
|
||||
,round(value_loc*s.factor, 2) value_loc
|
||||
,round(value_usd*s.factor, 2) value_usd
|
||||
,round(cost_loc*s.factor, 2) cost_loc
|
||||
@ -202,35 +220,37 @@ target AS (select target_vol vincr, target_prc pincr)
|
||||
,COALESCE(log.doc->>'tag','') "tag"
|
||||
,log.doc->>'message' "comment"
|
||||
,log.doc->>'type' module
|
||||
,round(pounds*s.factor, 2) pounds
|
||||
,round(CASE
|
||||
WHEN s.factor = 0 THEN s.mod_volume * i.nwht * (CASE i.nwun
|
||||
WHEN 'KG' THEN 2.2046
|
||||
ELSE 1 END)
|
||||
ELSE pounds*s.factor END, 2) pounds
|
||||
FROM
|
||||
basemix b
|
||||
CROSS JOIN vscale s
|
||||
CROSS JOIN log
|
||||
LEFT OUTER JOIN "CMS.CUSLG".itemm i ON i.item = b.part
|
||||
)
|
||||
-- select 'volume', * from volume
|
||||
--
|
||||
,pscale AS (
|
||||
SELECT
|
||||
(SELECT pincr::numeric FROM target) incr
|
||||
,(SELECT sum(value_loc * r_rate) FROM volume) base
|
||||
,CASE WHEN (SELECT sum(value_loc * r_rate) FROM volume) = 0 THEN
|
||||
--if the base value is -0- scaling will not work, need to generate price, factor goes to -0-
|
||||
0
|
||||
ELSE
|
||||
--if the target $amount is not achieved, adjust further
|
||||
((SELECT pincr::numeric FROM target)-(SELECT sum(value_loc * r_rate) FROM volume))/(SELECT sum(value_loc * r_rate) FROM volume)
|
||||
CASE
|
||||
WHEN (SELECT coalesce(sum(value_loc),0) FROM volume) = 0 AND (SELECT sum(units) FROM volume) = 0 THEN 'both'
|
||||
WHEN (SELECT coalesce(sum(value_loc),0) FROM volume) = 0 THEN 'cost'
|
||||
ELSE 'other'
|
||||
END zero_values
|
||||
,CASE
|
||||
WHEN (SELECT coalesce(sum(value_loc),0) FROM volume) = 0 AND (SELECT coalesce(sum(units),0) FROM volume) = 0 -- Split pincr evenly between rows.
|
||||
THEN (SELECT pincr::numeric FROM target) / (SELECT nullif(count(*),0) FROM volume)
|
||||
WHEN (SELECT coalesce(sum(value_loc),0) FROM volume) = 0 -- Get a per-unit pincr value
|
||||
THEN (SELECT pincr::numeric FROM target) / (SELECT nullif(sum(units),0) FROM volume)
|
||||
ELSE -- Find percent change for existing value_loc
|
||||
(SELECT pincr::numeric FROM target) / (SELECT nullif(sum(value_loc),0) FROM volume) - 1
|
||||
END factor
|
||||
,CASE WHEN (SELECT sum(value_loc * r_rate) FROM volume) = 0 THEN
|
||||
CASE WHEN ((SELECT pincr::numeric FROM target) - (SELECT sum(value_loc * r_rate) FROM volume)) <> 0 THEN
|
||||
--if the base value is -0- but the target value hasn't been achieved, derive a price to apply
|
||||
((SELECT pincr::numeric FROM target) - (SELECT sum(value_loc * r_rate) FROM volume))/(SELECT sum(units) FROM volume)
|
||||
ELSE
|
||||
0
|
||||
END
|
||||
ELSE
|
||||
0
|
||||
END mod_price
|
||||
)
|
||||
--select * from pscale
|
||||
-- select 'pscale', * from pscale
|
||||
--
|
||||
,pricing AS (
|
||||
SELECT
|
||||
fspr
|
||||
@ -263,8 +283,16 @@ FROM
|
||||
,c_currency --master data
|
||||
,c_rate --master data
|
||||
,0::numeric units
|
||||
,round((CASE WHEN s.factor = 0 THEN b.units * s.mod_price/b.r_rate ELSE b.value_loc*s.factor END)::numeric,2) value_loc
|
||||
,round((CASE WHEN s.factor = 0 THEN b.units * s.mod_price ELSE b.value_usd*s.factor END)::numeric ,2) value_usd
|
||||
,round(CASE s.zero_values
|
||||
WHEN 'both' THEN s.factor / b.r_rate
|
||||
WHEN 'cost' THEN b.units * s.factor / b.r_rate
|
||||
WHEN 'other' THEN b.value_loc * s.factor
|
||||
END, 2) AS value_loc
|
||||
,round(CASE s.zero_values
|
||||
WHEN 'both' THEN s.factor
|
||||
WHEN 'cost' THEN b.units * s.factor
|
||||
WHEN 'other' THEN b.value_usd * s.factor
|
||||
END, 2) AS value_usd
|
||||
,0::numeric cost_loc
|
||||
,0::numeric cost_usd
|
||||
,calc_status --0
|
||||
@ -290,9 +318,10 @@ FROM
|
||||
CROSS JOIN pscale s
|
||||
CROSS JOIN log
|
||||
WHERE
|
||||
s.factor <> 0 or s.mod_price <> 0
|
||||
s.factor <> 0
|
||||
)
|
||||
--select sum(value_usd), sum(units) from pricing
|
||||
-- select 'price', * from price UNION ALL SELECT 'volume', * FROM volume
|
||||
--
|
||||
, ins AS (
|
||||
INSERT INTO rlarp.osm_pool (SELECT * FROM pricing UNION ALL SELECT * FROM volume) RETURNING *
|
||||
)
|
||||
@ -379,4 +408,6 @@ FROM
|
||||
,tag
|
||||
,comment
|
||||
)
|
||||
-- select 'insagg', * from insagg
|
||||
--
|
||||
SELECT json_agg(row_to_json(insagg)) x from insagg
|
||||
|
||||
@ -17,10 +17,10 @@ mseq AS (
|
||||
,('10 - Mar',10)
|
||||
,('11 - Apr',11)
|
||||
,('12 - May',12)
|
||||
|
||||
) x(m,s)
|
||||
)
|
||||
--select * from mseq
|
||||
-- select 'mseq', * from mseq
|
||||
--
|
||||
,base AS (
|
||||
SELECT
|
||||
order_season
|
||||
@ -36,7 +36,7 @@ FROM
|
||||
rlarp.osm_pool
|
||||
WHERE
|
||||
where_clause
|
||||
AND order_season IN (2023,2024)
|
||||
AND order_season IN (2025,2026)
|
||||
GROUP BY
|
||||
order_season
|
||||
,order_month
|
||||
@ -46,6 +46,8 @@ GROUP BY
|
||||
,bill_cust_descr
|
||||
,ship_cust_descr
|
||||
)
|
||||
-- select 'base', * from base
|
||||
--
|
||||
, basket1 AS (
|
||||
SELECT
|
||||
part_descr
|
||||
@ -59,6 +61,8 @@ GROUP BY
|
||||
,bill_cust_descr
|
||||
,ship_cust_descr
|
||||
)
|
||||
-- select 'basket1', * from basket1
|
||||
--
|
||||
,basket AS (
|
||||
SELECT
|
||||
part_descr
|
||||
@ -70,6 +74,8 @@ GROUP BY
|
||||
ORDER BY
|
||||
mix DESC
|
||||
)
|
||||
-- select 'basket', * from basket
|
||||
--
|
||||
,months AS (
|
||||
SELECT
|
||||
order_season
|
||||
@ -90,18 +96,20 @@ GROUP BY
|
||||
,order_month
|
||||
,s
|
||||
)
|
||||
-- select 'months', * from months
|
||||
--
|
||||
,mpvt AS (
|
||||
SELECT
|
||||
order_month
|
||||
,seq
|
||||
,SUM(units) FILTER (WHERE order_season = 2023) "2023 qty"
|
||||
,SUM(units) FILTER (WHERE order_season = 2024 AND iter IN ('copy','short ship','bad_ship','plan')) "2024 base qty"
|
||||
,SUM(units) FILTER (WHERE order_season = 2024 AND iter NOT IN ('copy','short ship','bad_ship','plan')) "2024 adj qty"
|
||||
,SUM(units) FILTER (WHERE order_season = 2024) "2024 tot qty"
|
||||
,SUM(value_usd) FILTER (WHERE order_season = 2023) "2023 value_usd"
|
||||
,SUM(value_usd) FILTER (WHERE order_season = 2024 AND iter IN ('copy','short ship','bad_ship','plan')) "2024 base value_usd"
|
||||
,SUM(value_usd) FILTER (WHERE order_season = 2024 AND iter NOT IN ('copy','short ship','bad_ship','plan')) "2024 adj value_usd"
|
||||
,SUM(value_usd) FILTER (WHERE order_season = 2024) "2024 tot value_usd"
|
||||
,SUM(units) FILTER (WHERE order_season = 2025) "2025 qty"
|
||||
,SUM(units) FILTER (WHERE order_season = 2026 AND iter IN ('copy','short ship','bad_ship','plan')) "2026 base qty"
|
||||
,SUM(units) FILTER (WHERE order_season = 2026 AND iter NOT IN ('copy','short ship','bad_ship','plan')) "2026 adj qty"
|
||||
,SUM(units) FILTER (WHERE order_season = 2026) "2026 tot qty"
|
||||
,SUM(value_usd) FILTER (WHERE order_season = 2025) "2025 value_usd"
|
||||
,SUM(value_usd) FILTER (WHERE order_season = 2026 AND iter IN ('copy','short ship','bad_ship','plan')) "2026 base value_usd"
|
||||
,SUM(value_usd) FILTER (WHERE order_season = 2026 AND iter NOT IN ('copy','short ship','bad_ship','plan')) "2026 adj value_usd"
|
||||
,SUM(value_usd) FILTER (WHERE order_season = 2026) "2026 tot value_usd"
|
||||
FROM
|
||||
months
|
||||
GROUP BY
|
||||
@ -110,17 +118,19 @@ GROUP BY
|
||||
ORDER BY
|
||||
seq ASC
|
||||
)
|
||||
-- select 'mpvt', * from mpvt
|
||||
--
|
||||
,mlist AS (
|
||||
SELECT
|
||||
mseq.m order_month
|
||||
,"2023 qty"
|
||||
,"2024 base qty"
|
||||
,"2024 adj qty"
|
||||
,"2024 tot qty"
|
||||
,"2023 value_usd"
|
||||
,"2024 base value_usd"
|
||||
,"2024 adj value_usd"
|
||||
,"2024 tot value_usd"
|
||||
,"2025 qty"
|
||||
,"2026 base qty"
|
||||
,"2026 adj qty"
|
||||
,"2026 tot qty"
|
||||
,"2025 value_usd"
|
||||
,"2026 base value_usd"
|
||||
,"2026 adj value_usd"
|
||||
,"2026 tot value_usd"
|
||||
FROM
|
||||
mseq
|
||||
LEFT OUTER JOIN mpvt ON
|
||||
@ -128,6 +138,8 @@ GROUP BY
|
||||
ORDER BY
|
||||
mseq.s ASC
|
||||
)
|
||||
-- select 'mlist', * from mlist
|
||||
--
|
||||
,totals AS (
|
||||
SELECT
|
||||
order_season
|
||||
@ -142,6 +154,8 @@ GROUP BY
|
||||
,version
|
||||
,iter
|
||||
)
|
||||
-- select 'totals', * from totals
|
||||
--
|
||||
,tags AS (
|
||||
SELECT DISTINCT
|
||||
doc->>'tag' tag
|
||||
@ -157,6 +171,8 @@ GROUP BY
|
||||
('volume')
|
||||
) x(tag)
|
||||
)
|
||||
-- select 'tags', * from tags
|
||||
--
|
||||
,custs AS (
|
||||
SELECT
|
||||
bill_cust_descr
|
||||
@ -168,6 +184,83 @@ GROUP BY
|
||||
bill_cust_descr
|
||||
,ship_cust_descr
|
||||
)
|
||||
,alldates AS (
|
||||
SELECT
|
||||
bill_cust_descr
|
||||
,ship_cust_descr
|
||||
,promo
|
||||
,terms
|
||||
,r_currency
|
||||
-- ,order_month
|
||||
-- ,mseq.s seq
|
||||
,order_date
|
||||
-- ,request_date
|
||||
,ship_date
|
||||
-- ,ship_month
|
||||
-- ,sum(value_usd) value_usd_net
|
||||
,sum(pounds) pounds_net
|
||||
-- ,sum(value_usd) FILTER (WHERE iter IN ('copy','actuals','actuals_plug')) value_usd_baseline
|
||||
,sum(pounds) FILTER (WHERE iter IN ('copy','actuals','actuals_plug')) pounds_baseline
|
||||
FROM
|
||||
rlarp.osm_pool
|
||||
LEFT OUTER JOIN mseq ON
|
||||
mseq.m = order_month
|
||||
WHERE
|
||||
where_clause
|
||||
-----------------scenario----------------------------
|
||||
-- AND version IN ('b26')
|
||||
AND order_season = 2026
|
||||
-----------------additional params-------------------
|
||||
AND calc_status||flag <> 'CLOSEDREMAINDER' --exclude short ships when building order adjustments
|
||||
AND order_date <= ship_date
|
||||
GROUP BY
|
||||
bill_cust_descr
|
||||
,ship_cust_descr
|
||||
,promo
|
||||
,terms
|
||||
,r_currency
|
||||
-- ,order_month
|
||||
-- ,mseq.s seq
|
||||
,order_date
|
||||
-- ,request_date
|
||||
,ship_date
|
||||
-- ,ship_month
|
||||
-- HAVING
|
||||
-- sum(value_usd) <> 0
|
||||
)
|
||||
,date_mix as (
|
||||
SELECT
|
||||
bill_cust_descr
|
||||
,ship_cust_descr
|
||||
,promo
|
||||
,terms
|
||||
,r_currency
|
||||
,order_date
|
||||
,ship_date
|
||||
,CASE WHEN sum(pounds_net) OVER () = 0 THEN 0 ELSE round(pounds_net / sum(pounds_net) OVER (),5) END fc_mix
|
||||
,CASE WHEN sum(pounds_baseline) OVER () = 0 THEN 0 ELSE round(pounds_baseline / sum(pounds_baseline) OVER (),5) END baseline_mix
|
||||
FROM
|
||||
alldates
|
||||
ORDER BY
|
||||
order_date ASC
|
||||
,ship_date ASC
|
||||
)
|
||||
,part_mix as (
|
||||
SELECT
|
||||
part
|
||||
,sum(units) qty
|
||||
,ROUND(CASE WHEN sum(units) = 0 THEN 0 ELSE sum(value_usd)/sum(units) END,5) price
|
||||
,sum(pounds) pounds
|
||||
FROM
|
||||
rlarp.osm_pool
|
||||
WHERE
|
||||
where_clause
|
||||
AND version IN ('B27')
|
||||
GROUP BY
|
||||
part
|
||||
)
|
||||
-- select 'custs', * from custs
|
||||
--
|
||||
SELECT
|
||||
jsonb_build_object(
|
||||
'months'
|
||||
@ -182,4 +275,8 @@ SELECT
|
||||
,(SELECT jsonb_agg(tag) FROM tags)
|
||||
,'customers'
|
||||
,(SELECT jsonb_agg(row_to_json(custs)::jsonb) FROM custs)
|
||||
,'date_mix'
|
||||
,(SELECT jsonb_agg(row_to_json(date_mix)::jsonb) FROM date_mix)
|
||||
,'part_mix'
|
||||
,(SELECT jsonb_agg(row_to_json(part_mix)::jsonb) FROM part_mix)
|
||||
) package
|
||||
|
||||
202
route_sql/shift_ship_date.sql
Normal file
202
route_sql/shift_ship_date.sql
Normal file
@ -0,0 +1,202 @@
|
||||
WITH
|
||||
target as (
|
||||
SELECT ship_season, ship_month, pct
|
||||
FROM json_to_recordset('replace_request')
|
||||
AS x(ship_season int, ship_month text, pct numeric)
|
||||
)
|
||||
-- select 'target', * from target
|
||||
--
|
||||
,mseq AS (
|
||||
SELECT * FROM
|
||||
(
|
||||
VALUES
|
||||
('01 - Jun', 1, 6, -1)
|
||||
,('02 - Jul', 2, 7, -1)
|
||||
,('03 - Aug', 3, 8, -1)
|
||||
,('04 - Sep', 4, 9, -1)
|
||||
,('05 - Oct', 5, 10, -1)
|
||||
,('06 - Nov', 6, 11, -1)
|
||||
,('07 - Dec', 7, 12, -1)
|
||||
,('08 - Jan', 8, 1, 0)
|
||||
,('09 - Feb', 9, 2, 0)
|
||||
,('10 - Mar', 10, 3, 0)
|
||||
,('11 - Apr', 11, 4, 0)
|
||||
,('12 - May', 12, 5, 0)
|
||||
) x(m,s,cal,yr)
|
||||
)
|
||||
-- select 'mseq', * from mseq
|
||||
--
|
||||
,basemix AS (
|
||||
SELECT
|
||||
fspr ,plnt ,promo ,terms ,bill_cust_descr ,ship_cust_descr ,dsm ,quota_rep_descr ,director
|
||||
,billto_group ,shipto_group ,chan ,chansub ,chan_retail ,part ,part_descr ,part_group
|
||||
,branding ,majg_descr ,ming_descr ,majs_descr ,mins_descr ,segm ,substance ,fs_line
|
||||
,r_currency ,coalesce(r_rate,1) as r_rate
|
||||
,c_currency ,coalesce(c_rate,1) as c_rate
|
||||
,sum(coalesce(units,0)) units
|
||||
,sum(coalesce(value_loc,0)) value_loc
|
||||
,sum(coalesce(value_usd,0)) value_usd
|
||||
,sum(coalesce(cost_loc,0)) cost_loc
|
||||
,sum(coalesce(cost_usd,0)) cost_usd
|
||||
,sum(coalesce(pounds,0)) pounds
|
||||
,calc_status ,flag
|
||||
,order_date ,order_month ,order_season
|
||||
,request_date ,request_month ,request_season
|
||||
,ship_date ,ship_month ,ship_season
|
||||
FROM
|
||||
rlarp.osm_pool
|
||||
WHERE
|
||||
-----------------scenario----------------------------
|
||||
where_clause
|
||||
-----------------additional params-------------------
|
||||
AND order_date <= ship_date
|
||||
GROUP BY
|
||||
fspr ,plnt ,promo ,terms ,bill_cust_descr ,ship_cust_descr ,dsm ,quota_rep_descr ,director
|
||||
,billto_group ,shipto_group ,chan ,chansub ,chan_retail ,part ,part_descr ,part_group
|
||||
,branding ,majg_descr ,ming_descr ,majs_descr ,mins_descr ,segm ,substance ,fs_line
|
||||
,r_currency ,r_rate
|
||||
,c_currency ,c_rate
|
||||
,calc_status ,flag
|
||||
,order_date ,order_month ,order_season
|
||||
,request_date ,request_month ,request_season
|
||||
,ship_date ,ship_month ,ship_season
|
||||
)
|
||||
-- select 'basemix', * from basemix
|
||||
--
|
||||
,subtractions AS (
|
||||
SELECT
|
||||
fspr ,plnt ,promo ,terms ,bill_cust_descr ,ship_cust_descr ,dsm ,quota_rep_descr ,director
|
||||
,billto_group ,shipto_group ,chan ,chansub ,chan_retail ,part ,part_descr ,part_group
|
||||
,branding ,majg_descr ,ming_descr ,majs_descr ,mins_descr ,segm ,substance ,fs_line
|
||||
,r_currency ,r_rate
|
||||
,c_currency ,c_rate
|
||||
,-(1 - target.pct) * units as units
|
||||
,-(1 - target.pct) * value_loc as value_loc
|
||||
,-(1 - target.pct) * value_usd as value_usd
|
||||
,-(1 - target.pct) * cost_loc as cost_loc
|
||||
,-(1 - target.pct) * cost_usd as cost_usd
|
||||
,-(1 - target.pct) * pounds as pounds
|
||||
,calc_status ,flag
|
||||
,order_date ,order_month ,order_season
|
||||
,request_date ,request_month ,request_season
|
||||
,ship_date ,basemix.ship_month ,basemix.ship_season
|
||||
FROM basemix
|
||||
INNER JOIN target ON
|
||||
basemix.ship_season = target.ship_season AND
|
||||
basemix.ship_month = target.ship_month
|
||||
)
|
||||
-- select 'subtraction', * from subtraction
|
||||
--
|
||||
,additions AS (
|
||||
SELECT
|
||||
fspr ,plnt ,promo ,terms ,bill_cust_descr ,ship_cust_descr ,dsm ,quota_rep_descr ,director
|
||||
,billto_group ,shipto_group ,chan ,chansub ,chan_retail ,part ,part_descr ,part_group
|
||||
,branding ,majg_descr ,ming_descr ,majs_descr ,mins_descr ,segm ,substance ,fs_line
|
||||
,r_currency ,r_rate
|
||||
,c_currency ,c_rate
|
||||
,t.pct * coalesce(units) as units
|
||||
,t.pct * coalesce(value_loc) as value_loc
|
||||
,t.pct * coalesce(value_usd) as value_usd
|
||||
,t.pct * coalesce(cost_loc) as cost_loc
|
||||
,t.pct * coalesce(cost_usd) as cost_usd
|
||||
,t.pct * coalesce(pounds) as pounds
|
||||
,calc_status ,flag
|
||||
,order_date ,order_month ,order_season
|
||||
,request_date ,request_month ,request_season
|
||||
-- These case statements fix the situation where a ship date was specified that is earlier than
|
||||
-- the order date. If that happens, the new ship date becomes order date + 15 days. This also
|
||||
-- handles overflow into the next month and/or season.
|
||||
,case
|
||||
when t.ship_season <= b.order_season AND t.ship_month < b.order_month then b.order_date + 15
|
||||
else make_date(t.ship_season, tMonths.cal, 1)
|
||||
end as ship_date
|
||||
,case
|
||||
when t.ship_season <= b.order_season AND t.ship_month < b.order_month then bMonths.m
|
||||
else t.ship_month
|
||||
end as ship_month
|
||||
,case
|
||||
when t.ship_season <= b.order_season AND t.ship_month < b.order_month then
|
||||
case
|
||||
when b.order_month > bMonths.m then b.order_season + 1 -- May-to-June rollover
|
||||
else b.order_season
|
||||
end
|
||||
else t.ship_season
|
||||
end as ship_season
|
||||
FROM basemix b
|
||||
LEFT OUTER JOIN target t ON
|
||||
b.ship_season <> t.ship_season OR
|
||||
b.ship_month <> t.ship_month
|
||||
INNER JOIN mseq bMonths ON
|
||||
EXTRACT (month FROM (b.order_date + 15)) = bMonths.cal
|
||||
INNER JOIN mseq tMonths ON
|
||||
t.ship_month = tMonths.m
|
||||
)
|
||||
-- select 'additions', * from additions
|
||||
--
|
||||
,log AS (
|
||||
INSERT INTO rlarp.osm_log(doc) SELECT $$replace_iterdef$$::jsonb doc RETURNING *
|
||||
)
|
||||
-- select 'log', * from log
|
||||
--
|
||||
,final AS (
|
||||
SELECT
|
||||
fspr ,plnt ,promo ,terms ,bill_cust_descr ,ship_cust_descr ,dsm ,quota_rep_descr ,director
|
||||
,billto_group ,shipto_group ,chan ,chansub ,chan_retail ,part ,part_descr ,part_group
|
||||
,branding ,majg_descr ,ming_descr ,majs_descr ,mins_descr ,segm ,substance ,fs_line
|
||||
,r_currency ,r_rate
|
||||
,c_currency ,c_rate
|
||||
,units ,value_loc ,value_usd ,cost_loc ,cost_usd ,calc_status ,flag
|
||||
,order_date ,order_month ,order_season
|
||||
,request_date ,request_month ,request_season
|
||||
,ship_date ,ship_month ,ship_season
|
||||
,'replace_version' "version"
|
||||
,'replace_source' iter
|
||||
,log.id
|
||||
,COALESCE(log.doc->>'tag','Volume') "tag"
|
||||
,log.doc->>'message' "comment"
|
||||
,log.doc->>'type' module
|
||||
,pounds
|
||||
FROM
|
||||
( SELECT * FROM subtractions
|
||||
UNION ALL
|
||||
SELECT * FROM additions
|
||||
) f
|
||||
CROSS JOIN log
|
||||
)
|
||||
-- select 'final', * from final
|
||||
--
|
||||
, ins AS (
|
||||
INSERT INTO rlarp.osm_pool SELECT * FROM final RETURNING *
|
||||
)
|
||||
,insagg AS (
|
||||
SELECT
|
||||
---------customer info-----------------
|
||||
bill_cust_descr ,billto_group ,ship_cust_descr ,shipto_group ,quota_rep_descr ,director
|
||||
,segm ,substance ,chan ,chansub
|
||||
---------product info------------------
|
||||
,majg_descr ,ming_descr ,majs_descr ,mins_descr ,part_group ,branding ,part_descr
|
||||
---------dates-------------------------
|
||||
,order_season ,order_month ,ship_season ,ship_month ,request_season ,request_month
|
||||
,promo ,version ,iter ,logid ,tag ,comment
|
||||
--------values-------------------------
|
||||
,sum(value_loc) value_loc
|
||||
,sum(value_usd) value_usd
|
||||
,sum(cost_loc) cost_loc
|
||||
,sum(cost_usd) cost_usd
|
||||
,sum(units) units
|
||||
,sum(pounds) pounds
|
||||
FROM
|
||||
ins
|
||||
GROUP BY
|
||||
---------customer info-----------------
|
||||
bill_cust_descr ,billto_group ,ship_cust_descr ,shipto_group ,quota_rep_descr ,director
|
||||
,segm ,substance ,chan ,chansub
|
||||
---------product info------------------
|
||||
,majg_descr ,ming_descr ,majs_descr ,mins_descr ,part_group ,branding ,part_descr
|
||||
---------dates-------------------------
|
||||
,order_season ,order_month ,ship_season ,ship_month ,request_season ,request_month
|
||||
,promo ,version ,iter ,logid ,tag ,comment
|
||||
)
|
||||
-- select 'insagg', * from insagg
|
||||
--
|
||||
SELECT json_agg(row_to_json(insagg)) x FROM insagg
|
||||
@ -27,7 +27,8 @@ target AS (select 'replace_new_mold' new_mold)
|
||||
coltier,
|
||||
sizc
|
||||
)
|
||||
--SELECT * FROM basemix
|
||||
-- SELECT 'basemix', * FROM basemix
|
||||
--
|
||||
,tag AS (
|
||||
SELECT
|
||||
b.part
|
||||
@ -55,7 +56,8 @@ target AS (select 'replace_new_mold' new_mold)
|
||||
CASE WHEN b.colc = i.colc THEN '1' ELSE '0' END||
|
||||
CASE WHEN substring(b.part,9,12) = substring(i.item,9,12) THEN '1' ELSE 0 END >= '111110'
|
||||
)
|
||||
--SELECT * FROM tag
|
||||
-- SELECT 'tag', * FROM tag
|
||||
--
|
||||
,rsort AS (
|
||||
SELECT
|
||||
part,
|
||||
@ -69,6 +71,8 @@ ORDER BY
|
||||
part
|
||||
,fit desc
|
||||
)
|
||||
-- select 'rsort', * from rsort
|
||||
--
|
||||
SELECT
|
||||
json_agg(row_to_json(rsort)) x
|
||||
FROM
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
WITH
|
||||
d AS (
|
||||
DELETE FROM rlarp.osm_log WHERE id = replace_id RETURNING id
|
||||
DELETE FROM rlarp.osm_log WHERE id <> 1 AND id = replace_id RETURNING id
|
||||
)
|
||||
,d_osm AS (
|
||||
DELETE FROM rlarp.osm_pool WHERE logid IN (select id from d)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user