diff --git a/example_usage.ms.sql b/example_usage.ms.sql index af64ec4..74fadcb 100644 --- a/example_usage.ms.sql +++ b/example_usage.ms.sql @@ -1,10 +1,10 @@ EXEC pricing.single_price_call - @bill = 'FARM0001', - @ship = 'KEYB0001', - @part = 'HSI1000BB661050', - @v1ds = 'v1:L..CSE..D', - @vol = 50000; + @bill = 'GRIF0001', + @ship = 'GRIF0001', + @part = 'XNS0T1G3G18B096', + @v1ds = 'v1:B..PLT..', + @vol = 9600; EXEC pricing.single_price_call @bill = 'BFGS0001', @@ -15,6 +15,10 @@ EXEC pricing.single_price_call SELECT * FROM pricing.lastpricedetail l WHERE customer = 'HYBELS' AND l.partgroup = 'HZP3E100' +SELECT * FROM pricing.pricelist_ranged pr WHERE pr.jcpart = 'XNS0T1G3G18B096' AND + +SELECT * FROM CMSInterfaceIN.[CMS.CUSLG]. + EXEC pricing.single_price_call @bill = 'GRIF0001', @ship = 'GRIF0001', diff --git a/procs/single_price_call.ms.sql b/procs/single_price_call.ms.sql index edb5760..7245721 100644 --- a/procs/single_price_call.ms.sql +++ b/procs/single_price_call.ms.sql @@ -504,7 +504,7 @@ BEGIN SELECT * FROM ( SELECT ----------------------label------------------------------------------------ - CASE WHEN value <> '' THEN RTRIM(SUBSTRING(value,1,18)) ELSE 'No Target' END AS label, + CASE WHEN value <> '' THEN replace(RTRIM(SUBSTRING(value,1,18)),'Anchor:', 'Floor: ') ELSE 'No Target' END AS label, ----------------------value------------------------------------------------ CASE WHEN value <> '' THEN TRY_CAST(SUBSTRING(value,23,7) AS NUMERIC(20,5)) @@ -524,7 +524,7 @@ BEGIN UNION ALL SELECT ----------------------label------------------------------------------------ - 'Price' AS label, + 'Target' AS label, ----------------------value------------------------------------------------ tprice AS value, ----------------------type------------------------------------------------- diff --git a/procs/single_price_call.pg.sql b/procs/single_price_call.pg.sql index ed30b70..6f45aa9 100644 --- a/procs/single_price_call.pg.sql +++ b/procs/single_price_call.pg.sql @@ -454,10 +454,10 @@ BEGIN 'type', 'currency', 'note', CASE WHEN _last_price IS NOT NULL THEN CASE _last_source - WHEN 'mrq' THEN 'Recent similar ' || _last_part || ' ' - WHEN 'mrs' THEN 'Recent similar ' || _last_part || ' ' - WHEN 'dsq' THEN 'Last quote' - WHEN 'dss' THEN 'Last sale' + WHEN 'mrq' THEN 'Recent similar ' || _last_part || ' ' || 'qty: ' || _last_qty + WHEN 'mrs' THEN 'Recent similar ' || _last_part || ' ' || 'qty: ' || _last_qty + WHEN 'dsq' THEN 'Last quote ' || 'qty: ' || _last_qty + WHEN 'dss' THEN 'Last sale ' || 'qty: ' || _last_qty ELSE '' END || CASE WHEN COALESCE(_last_order, '0') = '0' THEN ' Qt# ' || COALESCE(_last_quote, '') ELSE ' Ord# ' || COALESCE(_last_order, '') END diff --git a/quote_review/quote_review.pg.sql b/quote_review/quote_review.pg.sql index d72178d..8e972d5 100644 --- a/quote_review/quote_review.pg.sql +++ b/quote_review/quote_review.pg.sql @@ -1,7 +1,7 @@ -- set work_mem TO '4GB'; -- DROP VIEW IF EXISTS rlarp.quote_review; -CREATE VIEW rlarp.quote_review AS +CREATE OR REPLACE VIEW rlarp.quote_review AS WITH ---------------------get quote lines from SQL Server--------------------- lq AS MATERIALIZED ( @@ -105,7 +105,7 @@ lq AS MATERIALIZED ( -- ,jsonb_pretty(pricing) pricing ,p.guidance_price ,p.guidance_reason - ,jsonb_pretty(p.ui_json->'details') expl + ,jsonb_pretty(p.ui_json->'data') expl FROM lq LEFT OUTER JOIN "CMS.CUSLG".itemm i ON