Fix r_currency and c_currency. They were swapped. :(

This commit is contained in:
PhilRunninger 2023-08-29 20:30:36 -04:00
parent f0ec96fe2a
commit 123da3ea11

View File

@ -20,7 +20,7 @@
** **
** ALTER SEQUENCE rlarp.osm_log_id_seq RESTART 1; ** ALTER SEQUENCE rlarp.osm_log_id_seq RESTART 1;
** **
** INSERT INTO rlarp.osm_log (doc) ** 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') ** 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 ** c. Navigate to the ubm.rlarp.osm_pool table
** d. Right-click, and choose Import Data. ** d. Right-click, and choose Import Data.
@ -90,8 +90,8 @@ FROM
,[Request Month] AS [request_month] ,[Request Month] AS [request_month]
,[Promo Code] AS [promo] ,[Promo Code] AS [promo]
,[Financial Statement Line] as [fs_line] ,[Financial Statement Line] as [fs_line]
,[Inventory Currency] as [r_currency] ,[Order Currency] as [r_currency]
,[Order Currency] as [c_currency] ,[Inventory Currency] as [c_currency]
,PRICE.LPP_loc * BASE.Units AS [value_loc] ,PRICE.LPP_loc * BASE.Units AS [value_loc]
,PRICE.LPP_USD * BASE.Units AS [value_usd] ,PRICE.LPP_USD * BASE.Units AS [value_usd]
,[Standard Cost Local - Historic] AS [cost_loc] ,[Standard Cost Local - Historic] AS [cost_loc]
@ -634,9 +634,9 @@ SELECT
,[Segment] AS [segm] ,[Segment] AS [segm]
,CASE WHEN [Major Group] LIKE '610%' THEN 'Fiber' ELSE 'Plastic' END [substance] ,CASE WHEN [Major Group] LIKE '610%' THEN 'Fiber' ELSE 'Plastic' END [substance]
,[Financial Statement Line] as [fs_line] ,[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] ,[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] ,[Std Cost USD - Current]/nullif([Std Cost Local - Current],0) as [c_rate]
,[Units] AS [units] ,[Units] AS [units]
,[value local] AS [value_loc] ,[value local] AS [value_loc]
@ -668,6 +668,7 @@ UNION ALL
-- --
-- OPEN ORDERS GOING INTO THE BEGINNING OF 2024 SEASON -- -- OPEN ORDERS GOING INTO THE BEGINNING OF 2024 SEASON --
-- THESE WERE BACKED OUT OF THE 2024 BASELINE -- -- THESE WERE BACKED OUT OF THE 2024 BASELINE --
SELECT SELECT
CASE CASE
WHEN [Ship Season] IS NULL THEN CAST([Promise Season] % 100 AS varchar) + LEFT([Promise Month], 2) WHEN [Ship Season] IS NULL THEN CAST([Promise Season] % 100 AS varchar) + LEFT([Promise Month], 2)
@ -697,9 +698,9 @@ SELECT
,[Segment] AS [segm] ,[Segment] AS [segm]
,CASE WHEN [Major Group] LIKE '610%' THEN 'Fiber' ELSE 'Plastic' END [substance] ,CASE WHEN [Major Group] LIKE '610%' THEN 'Fiber' ELSE 'Plastic' END [substance]
,[Financial Statement Line] as [fs_line] ,[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] ,[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] ,[Std Cost USD - Current]/nullif([Std Cost Local - Current],0) as [c_rate]
,[Units] AS [units] ,[Units] AS [units]
,[value local] AS [value_loc] ,[value local] AS [value_loc]
@ -717,6 +718,7 @@ SELECT
,[Ship Date] AS [ship_date] ,[Ship Date] AS [ship_date]
,[Ship Month] AS [ship_month] ,[Ship Month] AS [ship_month]
,[Ship Season] AS [ship_season] ,[Ship Season] AS [ship_season]
,[Promise Date]
,'b24' AS [version] ,'b24' AS [version]
,'actuals' AS [iter] ,'actuals' AS [iter]
,1 AS [logid] ,1 AS [logid]