add terms to base mix
This commit is contained in:
parent
fb1fcabb00
commit
43a194b116
@ -151,6 +151,8 @@ target AS (select $$replace_request$$::json def)
|
|||||||
to_char(order_date,'Mon') _month
|
to_char(order_date,'Mon') _month
|
||||||
,seq
|
,seq
|
||||||
,promo
|
,promo
|
||||||
|
,terms
|
||||||
|
--should terms be included here?
|
||||||
,sum(extract(day from order_date)*value_usd) dom_wa
|
,sum(extract(day from order_date)*value_usd) dom_wa
|
||||||
--,request_date-order_date rlag
|
--,request_date-order_date rlag
|
||||||
,sum((request_date-order_date)*(value_usd)) rlag_wa
|
,sum((request_date-order_date)*(value_usd)) rlag_wa
|
||||||
@ -163,6 +165,7 @@ target AS (select $$replace_request$$::json def)
|
|||||||
to_char(order_date,'Mon')
|
to_char(order_date,'Mon')
|
||||||
,seq
|
,seq
|
||||||
,promo
|
,promo
|
||||||
|
,terms
|
||||||
--,extract(day from order_date)
|
--,extract(day from order_date)
|
||||||
--,request_date-order_date
|
--,request_date-order_date
|
||||||
--,ship_date - request_date
|
--,ship_date - request_date
|
||||||
@ -189,6 +192,7 @@ target AS (select $$replace_request$$::json def)
|
|||||||
_month
|
_month
|
||||||
,seq
|
,seq
|
||||||
,promo
|
,promo
|
||||||
|
,terms
|
||||||
,greatest(least(round((dom_wa/value_usd)::numeric,0)::int,28),1) odom
|
,greatest(least(round((dom_wa/value_usd)::numeric,0)::int,28),1) odom
|
||||||
,round((rlag_wa/value_usd)::numeric,0)::int rlag
|
,round((rlag_wa/value_usd)::numeric,0)::int rlag
|
||||||
,round((slag_wa/value_usd)::numeric,0)::int slag
|
,round((slag_wa/value_usd)::numeric,0)::int slag
|
||||||
@ -212,6 +216,7 @@ SELECT
|
|||||||
,x.rlag
|
,x.rlag
|
||||||
,x.slag
|
,x.slag
|
||||||
,x.promo
|
,x.promo
|
||||||
|
,x.terms
|
||||||
FROM
|
FROM
|
||||||
targm t
|
targm t
|
||||||
LEFT OUTER JOIN mmixp x ON
|
LEFT OUTER JOIN mmixp x ON
|
||||||
@ -231,6 +236,7 @@ FROM
|
|||||||
SELECT
|
SELECT
|
||||||
sd.fspr
|
sd.fspr
|
||||||
,mxm.promo
|
,mxm.promo
|
||||||
|
,mxm.terms
|
||||||
,jr.bill_cust_descr
|
,jr.bill_cust_descr
|
||||||
,jr.ship_cust_descr
|
,jr.ship_cust_descr
|
||||||
,(regexp_match(jr.part_descr,'(.*?)(?= - |$)'))[1] part
|
,(regexp_match(jr.part_descr,'(.*?)(?= - |$)'))[1] part
|
||||||
@ -269,7 +275,7 @@ SELECT
|
|||||||
b.fspr
|
b.fspr
|
||||||
,i.dplt plnt
|
,i.dplt plnt
|
||||||
,b.promo
|
,b.promo
|
||||||
,bc.bvterm terms
|
,b.terms
|
||||||
,b.bill_cust_descr
|
,b.bill_cust_descr
|
||||||
,b.ship_cust_descr
|
,b.ship_cust_descr
|
||||||
,(SELECT max(rcode) FROM repc WHERE rname = log.doc->'scenario'->>'quota_rep_descr') dsm
|
,(SELECT max(rcode) FROM repc WHERE rname = log.doc->'scenario'->>'quota_rep_descr') dsm
|
||||||
|
Loading…
Reference in New Issue
Block a user