
EXEC pricing.single_price_call
    @bill = 'GRIF0001',
    @ship = 'GRIF0001',
    @part = 'XNS0T1G3G18B096',
    @v1ds = 'v1:B..PLT..',
    @vol = 9600;

EXEC pricing.single_price_call
    @bill = 'FARM0001',
    @ship = 'KEYB0001',
    @part = 'HCA10000B661100',
    @v1ds = 'v1:T..CSE..D',
    @vol = 172000;

SELECT g.*
FROM (SELECT 
        TRY_CAST(.33275 AS NUMERIC(20,5)) AS tprice,
        TRY_CAST(.758 AS NUMERIC(20,5)) AS last_price_norm,
        TRY_CAST(null AS NUMERIC(20,5)) AS listprice_eff,
        TRY_CAST('2025-06-01' AS DATE) AS last_date
     ) q
CROSS APPLY pricing.guidance_logic(q.tprice, q.last_price_norm, q.listprice_eff, q.last_date, 0.05,  1.0, 1.0) g;


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',
    @part = 'XNS0T1G3G18B096',
    @v1ds = 'v1:B..PLT..',
    @vol = 9600;

SELECT 
	guidance_price, ui_json
FROM pricing.single_price_call_fn(
    'GRIF0001',
    'GRIF0001',
    'XNS0T1G3G18B096',
    'v1:B..PLT..',
    9600
) f



SELECT TOP 10
	q.qid,
	q.qrn,
	q.qcustomer,
	q.part,
	q.v1ds,
	q.units_each,
	q.price,
	q.targetp,
	q.lastsalesprice,
	q.finalrecommendedprice,
	q.lowerpricelimit,
	q.upperpricelimit,
	q.curstdus,
	p.guidance_price,
	p.expl
FROM 
	rlarp.live_quotes q
	OUTER APPLY pricing.single_price_call_fn(
		q.billto
		,q.shipto
		,q.part 
		,q.v1ds 
		,q.units_each
	) p
WHERE
	qstat LIKE 'Submitted%'


SELECT 
	* 
FROM pricequote.single_price_call(
    'GRIF0001',
    'GRIF0001',
    'XNS0T1G3G18B096',
    'v1:B..PLT..',
    9600
) f