From 7f990ab611ec870b4574bce60da1e5e053a7b9d9 Mon Sep 17 00:00:00 2001 From: Paul Trowbridge Date: Tue, 12 Aug 2025 23:08:02 -0400 Subject: [PATCH] commit: 2025-08-12 23:08:02 --- example_usage.ms.sql | 8 ++++---- example_usage.pg.sql | 10 ++++++++++ procs/lastprice_logic.pg.sql | 1 + procs/single_price_call.pg.sql | 5 +++-- 4 files changed, 18 insertions(+), 6 deletions(-) diff --git a/example_usage.ms.sql b/example_usage.ms.sql index 74fadcb..fecdf01 100644 --- a/example_usage.ms.sql +++ b/example_usage.ms.sql @@ -8,10 +8,10 @@ EXEC pricing.single_price_call EXEC pricing.single_price_call @bill = 'BFGS0001', - @ship = 'NEWM0004', - @part = 'HTI10754B661050', - @v1ds = 'v1:L..PLT..', - @vol = 14400; + @ship = 'BOBS0002', + @part = 'HTI10754B12B024LXB04', + @v1ds = 'v1:L.L.PLT..', + @vol = 172000; SELECT * FROM pricing.lastpricedetail l WHERE customer = 'HYBELS' AND l.partgroup = 'HZP3E100' diff --git a/example_usage.pg.sql b/example_usage.pg.sql index 070e365..416be36 100644 --- a/example_usage.pg.sql +++ b/example_usage.pg.sql @@ -18,6 +18,16 @@ FROM pricequote.single_price_call( 50000 ) f +SELECT + ui_json +FROM pricequote.single_price_call( + 'BFGS0001', + 'BOBS0002', + 'HTI10754B12B024LXB04', + 'v1:L.L.PLT..', + 172000 +) f + SELECT * FROM pricequote.lastpricedetail l WHERE customer = 'HYBELS' AND l.partgroup = 'HZP3E100' SELECT diff --git a/procs/lastprice_logic.pg.sql b/procs/lastprice_logic.pg.sql index 614805c..1cf5cd0 100644 --- a/procs/lastprice_logic.pg.sql +++ b/procs/lastprice_logic.pg.sql @@ -20,6 +20,7 @@ BEGIN best JSONB := NULL; best_date DATE := NULL; BEGIN + -- set dates IF dsq IS NOT NULL AND (dsq->>'price') IS NOT NULL THEN dsq_date := (dsq->>'odate')::date; END IF; diff --git a/procs/single_price_call.pg.sql b/procs/single_price_call.pg.sql index 6f45aa9..f1f9521 100644 --- a/procs/single_price_call.pg.sql +++ b/procs/single_price_call.pg.sql @@ -35,7 +35,7 @@ ==================================================================================== */ ---DROP FUNCTION pricequote.single_price_call(text,text,text,text,numeric); +--DROP FUNCTION pricequote.single_price_call(text,text,text,text,numeric) CASCADE; CREATE OR REPLACE FUNCTION pricequote.single_price_call( _bill TEXT, @@ -79,6 +79,7 @@ RETURNS TABLE ( last_order TEXT, last_quote TEXT, last_source TEXT, + hist JSONB, tprice NUMERIC, tmath JSONB, volume_range TEXT, @@ -567,7 +568,7 @@ BEGIN _chan, _cust, _tier, _pltq, _plevel, _partgroup, _part_v1ds, _v0ds, _curstd_orig, _futstd_orig, _curstd, _futstd, _curstd_last, _futstd_last, _customized, _last_premium, _last_premium_method, _last_price_norm, _last_isdiff, _last_v0ds, _tprice_last, - _last_price, _last_qty, _last_dataseg, _last_date, _last_order, _last_quote, _last_source, + _last_price, _last_qty, _last_dataseg, _last_date, _last_order, _last_quote, _last_source, _hist, _tprice, _tmath, _volume_range, _list_price, _list_code, _listprice_eff, _list_relevance, _guidance_price, _guidance_reason,