diff --git a/offline/last_price.sql b/offline/last_price.sql index 8379d7a..b16f0b0 100644 --- a/offline/last_price.sql +++ b/offline/last_price.sql @@ -1,51 +1,51 @@ -BEGIN; +--BEGIN; WITH ------------------goal price increases--------------------- incr AS ( SELECT * FROM (VALUES - ('110','PP','B',0.3), - ('110','PP','T',0.3), - ('110','PP','L',0.4), - ('110','PP','M',0.4), - ('110','PP','P',0.4), - ('110','PP','C',0.4), - ('210','PE','B',0.3), - ('210','PE','T',0.3), - ('210','PE','L',0.3), - ('210','PE','M',0.3), - ('210','PE','P',0.3), - ('210','PE','C',0.3), - ('310','PE','B',0.25), - ('310','PE','T',0.3), - ('310','PE','L',0.3), - ('310','PE','M',0.3), - ('310','PE','P',0.3), - ('310','PE','C',0.3), - ('310','PP','B',0.25), - ('310','PP','T',0.25), - ('310','PP','L',0.25), - ('310','PP','M',0.25), - ('310','PP','P',0.25), - ('310','PP','C',0.25), - ('310','PS','B',0.25), - ('310','PS','T',0.25), - ('310','PS','L',0.25), - ('310','PS','M',0.25), - ('310','PS','P',0.25), - ('310','PS','C',0.25), - ('320','PE','B',0.25), - ('320','PE','T',0.25), - ('320','PE','L',0.25), - ('320','PE','M',0.25), - ('320','PE','P',0.25), - ('320','PE','C',0.25), - ('320','PP','B',0.25), - ('320','PP','T',0.25), - ('320','PP','L',0.25), - ('320','PP','M',0.25), - ('320','PP','P',0.25), - ('320','PP','C',0.25), + ('110','PP','B',0.35), + ('110','PP','T',0.35), + ('110','PP','L',0.45), + ('110','PP','M',0.45), + ('110','PP','P',0.45), + ('110','PP','C',0.45), + ('210','PE','B',0.4), + ('210','PE','T',0.4), + ('210','PE','L',0.4), + ('210','PE','M',0.4), + ('210','PE','P',0.4), + ('210','PE','C',0.4), + ('310','PE','B',0.3), + ('310','PE','T',0.35), + ('310','PE','L',0.35), + ('310','PE','M',0.35), + ('310','PE','P',0.35), + ('310','PE','C',0.35), + ('310','PP','B',0.3), + ('310','PP','T',0.3), + ('310','PP','L',0.3), + ('310','PP','M',0.3), + ('310','PP','P',0.3), + ('310','PP','C',0.3), + ('310','PS','B',0.3), + ('310','PS','T',0.3), + ('310','PS','L',0.3), + ('310','PS','M',0.3), + ('310','PS','P',0.3), + ('310','PS','C',0.3), + ('320','PE','B',0.3), + ('320','PE','T',0.3), + ('320','PE','L',0.3), + ('320','PE','M',0.3), + ('320','PE','P',0.3), + ('320','PE','C',0.3), + ('320','PP','B',0.3), + ('320','PP','T',0.3), + ('320','PP','L',0.3), + ('320','PP','M',0.3), + ('320','PP','P',0.3), + ('320','PP','C',0.3), ('910','PE','B',0.25), ('910','PE','D',0.25), ('910','PE','F',0.25), @@ -55,6 +55,14 @@ incr AS ( ('910','PS','B',0.25), ('910','PS','D',0.25), ('910','PS','F',0.25), + ('910','','B',0.25), + ('910','','T',0.25), + ('910','','L',0.25), + ('910','','M',0.25), + ('910','','P',0.25), + ('910','','D',0.25), + ('910','','F',0.25), + ('910','','C',0.25), ('610','','B',0.02), ('610','','S',0.02), ('610','','W',0.02) @@ -268,14 +276,15 @@ SELECT ELSE CASE p.majg WHEN '610' THEN .02 ElSE CASE p.colgrp - WHEN 'B' THEN .15 - WHEN 'C' THEN .20 + WHEN 'B' THEN .20 + WHEN 'C' THEN .25 ELSE 1 END END END rate ,ms.avg_price target - ,JSONB_AGG(DISTINCT plist.jcpric/1000) jcprice + ----------------potential price list increase of 5% across board----- + ,JSONB_AGG(DISTINCT (plist.jcpric*1.05)/1000) jcprice --,CASE WHEN sum(val_usd) FILTER (WHERE oseas = 2020) IS NULL -- THEN CASE WHEN sum(units) FILTER (WHERE oseas = 2021) IS NULL -- THEN 'unknown' @@ -347,7 +356,7 @@ GROUP BY SELECT $${ "message":"application of last price and target increases to all forecast orders", - "tag":"last price", + "tag":"last price r1", "type":"build" }$$::jsonb doc RETURNING *