Compare commits

...

3 Commits

Author SHA1 Message Date
7596038b54 remove price drop 2025-09-03 09:35:09 -04:00
1b7ec3635b testing 2025-08-30 08:56:15 -04:00
ca2e9ea3be add approval columns to quote review 2025-08-30 08:55:48 -04:00
3 changed files with 30 additions and 24 deletions

View File

@ -10,38 +10,41 @@
SELECT SELECT
ui_json->'data' *, ui_json->'data'
FROM pricequote.single_price_call( FROM pricequote.single_price_call(
'GRIF0001', 'BFGS0001',
'GRIF0001', 'SPRI0019',
'XNS0T1G3G18B096', 'INT12040G18C100',
'v1:B..PLT..', 'v1:B..CSE..',
9600 7037
) f; ) f;
--
-- SELECT SELECT
-- ui_json *, ui_json->'data'
-- FROM pricequote.single_price_call( FROM pricequote.single_price_call(
-- 'BFGS0001', 'BELL0039',
-- 'BOBS0002', 'BELL0039',
-- 'HTI10754B12B024LXB04', 'XNS0T1G3X19B096PZBND',
-- 'v1:L.L.PLT..', 'v1:L.P.PLT..',
-- 172000 82420
-- ) f; ) f;
--
SELECT * FROM rlarp.cust WHERE code = 'PACK0009'
-- SELECT * FROM pricequote.lastpricedetail l WHERE customer = 'HYBELS' AND l.partgroup = 'HZP3E100'; -- SELECT * FROM pricequote.lastpricedetail l WHERE customer = 'HYBELS' AND l.partgroup = 'HZP3E100';
-- --
SELECT SELECT
pc.expl, pc.hist q.billto, q.shipto, q.part, q.v1ds, q.units_each, pc.tprice, pc.tmath
FROM FROM
pricequote.live_quotes pricequote.live_quotes q
LEFT JOIN LATERAL pricequote.single_price_call( LEFT JOIN LATERAL pricequote.single_price_call(
billto, shipto, part, v1ds, units_each billto, shipto, part, v1ds, units_each
) pc ON TRUE ) pc ON TRUE
WHERE WHERE
qid = 113800 qid = 113761
AND qrn = 4; -- AND qrn = 4;
create table pricequote.target_prices_base as ( create table pricequote.target_prices_base as (
with with

View File

@ -356,14 +356,14 @@ BEGIN
q2.last_price_norm, q2.last_price_norm,
q2.listprice_eff, q2.listprice_eff,
q2.last_date, q2.last_date,
.95, 1.0, 1.0 1.0, 1.0, 1.0
) g ON TRUE ) g ON TRUE
JOIN LATERAL pricequote.approval_logic( JOIN LATERAL pricequote.approval_logic(
q2.tprice, q2.tprice,
q2.last_price_norm, q2.last_price_norm,
q2.listprice_eff, q2.listprice_eff,
q2.last_date, q2.last_date,
.95, 1.0, 1.0 1.0, 1.0, 1.0
) a ON TRUE ) a ON TRUE
) s ) s
WHERE q.ctid = s.ctid; WHERE q.ctid = s.ctid;

View File

@ -105,6 +105,9 @@ lq AS MATERIALIZED (
-- ,jsonb_pretty(pricing) pricing -- ,jsonb_pretty(pricing) pricing
,p.guidance_price ,p.guidance_price
,p.guidance_reason ,p.guidance_reason
,p.approval_price
,p.approval_reason
,p.tprice guidance_target
,jsonb_pretty(p.ui_json->'data') expl ,jsonb_pretty(p.ui_json->'data') expl
FROM FROM
lq lq
@ -175,4 +178,4 @@ lq AS MATERIALIZED (
WHERE WHERE
COALESCE(g.bestprice,1) = 1 COALESCE(g.bestprice,1) = 1
) )
SELECT * FROM hist --WHERE qid = 108655 SELECT * FROM hist --LIMIT 1000--WHERE qid = 108655