From 123da3ea118ae946bb0ed15673783359babfb573 Mon Sep 17 00:00:00 2001 From: PhilRunninger Date: Tue, 29 Aug 2023 20:30:36 -0400 Subject: [PATCH] Fix r_currency and c_currency. They were swapped. :( --- build/build_baseline_from_FAnalysis.sql | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/build/build_baseline_from_FAnalysis.sql b/build/build_baseline_from_FAnalysis.sql index 34b8409..abc3a2c 100644 --- a/build/build_baseline_from_FAnalysis.sql +++ b/build/build_baseline_from_FAnalysis.sql @@ -20,7 +20,7 @@ ** ** 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') ** c. Navigate to the ubm.rlarp.osm_pool table ** d. Right-click, and choose Import Data. @@ -90,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] @@ -634,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] @@ -668,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) @@ -697,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] @@ -717,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]