Merge pull request #2 from The-HC-Companies/dev

part# whitespace
This commit is contained in:
Paul Trowbridge 2021-04-13 16:23:42 -04:00 committed by GitHub
commit 14ed4a95fe
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 30 additions and 6 deletions

View File

@ -23,7 +23,8 @@ repc AS (
FROM FROM
( (
VALUES VALUES
('1CU','Retail'), ('1SU','Sustainable'),
('1CU','Sustainable'),
('1GR','Greenhouse'), ('1GR','Greenhouse'),
('1NU','Nursery'), ('1NU','Nursery'),
('1RE','Retail'), ('1RE','Retail'),

View File

@ -8,7 +8,8 @@ SEG AS (
FROM FROM
( (
VALUES VALUES
('1CU','Retail'), ('1SU','Sustainable'),
('1CU','Sustainable'),
('1GR','Greenhouse'), ('1GR','Greenhouse'),
('1NU','Nursery'), ('1NU','Nursery'),
('1RE','Retail'), ('1RE','Retail'),

15
over_under_ship.sql Normal file
View File

@ -0,0 +1,15 @@
SELECT
calc_status,
flag,
sum(fb_val_loc * r_rate) filter (where fb_qty < 0) overship,
sum(fb_val_loc * r_rate) filter (where fb_qty > 0) undership
FROM
rlarp.osm_dev
WHERE
oseas = 2021
AND version = 'ACTUALS'
AND calc_status = 'CLOSED'
AND flag = 'REMAINDER'
GROUP BY
calc_status,
flag;

View File

@ -53,7 +53,8 @@ target AS (select $$replace_request$$::json def)
FROM FROM
( (
VALUES VALUES
('1CU','Retail'), ('1SU','Sustainable'),
('1CU','Sustainable'),
('1GR','Greenhouse'), ('1GR','Greenhouse'),
('1NU','Nursery'), ('1NU','Nursery'),
('1RE','Retail'), ('1RE','Retail'),

View File

@ -37,7 +37,8 @@ target AS (SELECT $$swap_doc$$::jsonb swap)
FROM FROM
( (
VALUES VALUES
('1CU','Retail'), ('1SU','Sustainable'),
('1CU','Sustainable'),
('1GR','Greenhouse'), ('1GR','Greenhouse'),
('1NU','Nursery'), ('1NU','Nursery'),
('1RE','Retail'), ('1RE','Retail'),

View File

@ -2,7 +2,11 @@ WITH
target AS (SELECT $$swap_doc$$::jsonb swap) target AS (SELECT $$swap_doc$$::jsonb swap)
,pl AS ( ,pl AS (
SELECT SELECT
x.* -----trim white space on CMS part numbers coming from spreadsheet master data----
rtrim(x.original) AS original
,sales
,rtrim(x."replace") AS replace
,rtrim(x.fit) fit
FROM FROM
TARGET TARGET
LEFT JOIN LATERAL jsonb_to_recordset(target.swap->'rows') AS x(original text, sales numeric, replace text, fit text)ON TRUE LEFT JOIN LATERAL jsonb_to_recordset(target.swap->'rows') AS x(original text, sales numeric, replace text, fit text)ON TRUE
@ -17,7 +21,8 @@ target AS (SELECT $$swap_doc$$::jsonb swap)
FROM FROM
( (
VALUES VALUES
('1CU','Retail'), ('1CU','Sustainable'),
('1SU','Sustainable'),
('1GR','Greenhouse'), ('1GR','Greenhouse'),
('1NU','Nursery'), ('1NU','Nursery'),
('1RE','Retail'), ('1RE','Retail'),