
 SELECT * FROM 
 pricequote.single_price_call(
                        'GRIF0001' ,
                        'GRIF0001' ,
                        'XNS0T1G3G18B096' ,
                        'v1:B..PLT..',
                        9600
                )
                
	SELECT pricing FROM rlarp.osm_stack l WHERE l.customer ='CROS-B-CREST FARM' AND partgroup = 'STG04250'
	
	SELECT * FROM pricequote.lastpricedetail l LEFT JOIN lateral pricequote.pick_last_price_from_hist (part_stats,'v1:B..PLT..') x ON TRUE  WHERE customer = 'GRIFFIN' AND partgroup = 'XNS0T1G3'
	
	CALL pricequote.process_queue()	
	
	REFRESH MATERIALIZED VIEW rlarp.osm_stack_pretty;
                
                
SELECT 
	q.qid,
	q.qrn,
--	q.qcustomer,
	q.partbuilt,
	i.pricegroup,
	q.v1ds,
	q.units_each,
	q.targetp,
	q.lastsalesprice,
--	q.finalrecommendedprice,
--	q.lowerpricelimit,
--	q.upperpricelimit,
	q.curstdus,
	q.price,
	p.guidance_price guidance,
	p.expl
FROM 
	pricequote.live_quotes q
	LEFT OUTER JOIN "CMS.CUSLG".itemm i ON 
		i.item = q.part
	LEFT JOIN LATERAL pricequote.single_price_call(
		q.billto
		,q.shipto
		,q.part 
		,q.v1ds 
		,q.units_each
	) p ON TRUE
WHERE
--	qstat LIKE 'Submitted%'
	qid = 111832 --AND q.qrn = 1
ORDER BY 
	qrn ASC
