Compare commits

..

No commits in common. "ae9bba67bd862a6af80f3aeb4c6254c7fb419173" and "f111c8818fa5086df962fb832ef4504fde19a276" have entirely different histories.

2 changed files with 520 additions and 594 deletions

View File

@ -1,5 +1,5 @@
--\timing --\timing
truncate table rlarp.osmf_dev; truncate table rlarp.osmfs;
WITH WITH
gld AS ( gld AS (
@ -25,546 +25,483 @@ gld AS (
--AND DIGITS(N1FSYP) = '1901' --AND DIGITS(N1FSYP) = '1901'
) )
--SELECT * FROM gld --SELECT * FROM gld
,baseline AS ( ,cop AS (
SELECT SELECT
-----------documents------------- o.plnt
null::int "ddord#" ,o."ddord#"
,null::int "dditm#" ,o."dditm#"
,null::int "fgbol#" ,o."fgbol#"
,null::int "fgent#" ,o."fgent#"
,null::int "diinv#" ,o."diinv#"
,null::int "dilin#" ,o."dilin#"
,null::int quoten
,null::int quotel
----------dates/status------------------
,o.odate dcodat
,o.rdate ddqdat
,null::date dcmdat
,null::date fesdat
,greatest(least(o.sdate,gld.edat),gld.sdat) dhidat
,null::text fesind
,null::text dhpost
,o.fspr
-----------measures--------------------
,null::numeric ddqtoi
,null::numeric ddqtsi
,null::numeric fgqshp
,null::numeric diqtsh
,null::numeric diext
,null::numeric ditdis
,null::jsonb discj
,null::text dhincr
,plnt
,o.promo ,o.promo
,null::text return_reas ,o.return_reas
,o.terms ,o.terms
,null::text custpo ,o.custpo
,null::text remit_to ,o.dhincr
,null::text bill_class ,o.diext
,o.ditdis
,o.dcodat
,o.ddqdat
,o.dcmdat
,o.dhidat
,o.fspr
,o.remit_to
,o.bill_class
,o.bill_cust ,o.bill_cust
,null::text bill_rep ,o.bill_rep
,null::text bill_terr ,o.bill_terr
,null::text ship_class ,o.ship_class
,ship_cust ,o.ship_cust
,null::text ship_rep ,o.ship_rep
,null::text ship_terr ,o.ship_terr
,null::text dsm ,o.quota_rep
,null::text account ,o.account
,null::text shipgrp ,o.shipgrp
,null::text geo ,o.geo
,null::text chan ,o.chan
,null::text chansub ,o.orig_ctry
,null::text orig_ctry ,o.orig_prov
,null::text orig_prov ,o.orig_post
,null::text orig_post ,o.dest_ctry
,null::text bill_ctry ,o.dest_prov
,null::text bill_prov ,o.dest_post
,null::text bill_post
,null::text dest_ctry
,null::text dest_prov
,null::text dest_post
,o.part ,o.part
,null::text styc ,o.ord_gldc
,null::text colc ,o.majg
,null::text colgrp ,o.ming
,null::text coltier ,o.majs
,null::text colstat ,o.mins
,null::text sizc ,o.gldc
,null::text pckg ,o.glec
,null::text kit ,o.harm
,null::text brnd ,o.clss
,null::text majg ,o.brand
,null::text ming ,o.assc
,null::text majs
,null::text mins
,null::text gldco
,null::text gldc
,null::text glec
,null::text harm
,null::text clss
,null::text brand
,null::text assc
,null::text ddunit
,null::text unti
,null::numeric lbs
,null::numeric plt
,null::text plcd
,o.fs_line ,o.fs_line
,o.r_currency ,o.r_currency
,null::numeric r_rate ,o.r_rate
,o.c_currency ,o.c_currency
,null::numeric c_rate ,o.c_rate
,o.ddqtoi
,o.ddqtsi
,o.fgqshp
,o.diqtsh
,sum(o.fb_qty) fb_qty ,sum(o.fb_qty) fb_qty
,sum(o.fb_val_loc) fb_val_loc
,sum(o.fb_val_loc_dis) fb_val_loc_dis
,sum(o.fb_val_loc_qt) fb_val_loc_qt
,sum(o.fb_val_loc_pl) fb_val_loc_pl
,sum(o.fb_val_loc_tar) fb_val_loc_tar
,sum(o.fb_cst_loc) fb_cst_loc ,sum(o.fb_cst_loc) fb_cst_loc
,sum(o.fb_cst_loc_cur) fb_cst_loc_cur ,sum(o.fb_cst_loc_cur) fb_cst_loc_cur
,sum(o.fb_cst_loc_fut) fb_cst_loc_fut ,sum(o.fb_cst_loc_fut) fb_cst_loc_fut
,sum(o.fb_val_loc) fb_val_loc
,sum(o.fb_val_loc_pl) fb_val_loc_pl
,o.calc_status ,o.calc_status
,o.flag ,o.flag
,o.odate ,o.orderdate
,o.oseas ,o.requestdate
,o.rdate ,greatest(least(o.shipdate,gld.edat),gld.sdat) shipdate
,o.rseas ,o.adj_orderdate
-----when null, greatest/least is just going to act like coalesce ,o.adj_requestdate
,greatest(least(o.sdate,gld.edat),gld.sdat) sdate ,greatest(least(o.adj_shipdate,gld.edat),gld.sdat) adj_shipdate
,ss.ssyr sseas ,'9p3' "version"
,'15mo' "version" ,'actual' iter
,'actuals' iter
FROM FROM
rlarp.osm_dev o rlarp.osm_dev o
--snap the ship dates of the historic fiscal period
LEFT OUTER JOIN gld ON LEFT OUTER JOIN gld ON
gld.fspr = o.fspr gld.fspr = o.fspr
--get the shipping season for open orders based on the snapped date
LEFT OUTER JOIN gld ss ON
greatest(least(o.sdate,gld.edat),gld.sdat) BETWEEN ss.sdat AND ss.edat
WHERE WHERE
( (
o.odate BETWEEN '2019-06-01' AND '2019-01-31' o.adj_orderdate BETWEEN '2019-06-01' AND '2019-01-31'
OR (o.calc_status IN ('OPEN','BACKORDER') and o.odate < '2020-02-01') OR o.calc_status IN ('OPEN','BACKORDER')
OR o.fspr BETWEEN '2001' AND '2008' OR o.fspr BETWEEN '2001' AND '2008'
) )
AND fs_line = '41010' AND fs_line = '41010'
AND calc_status <> 'CANCELED' AND calc_status <> 'CANCELED'
GROUP BY GROUP BY
o.fspr o.plnt
,plnt ,o."ddord#"
,o."dditm#"
,o."fgbol#"
,o."fgent#"
,o."diinv#"
,o."dilin#"
,o.promo ,o.promo
,o.return_reas
,o.terms ,o.terms
,o.custpo
,o.dhincr
,o.diext
,o.ditdis
,o.dcodat
,o.ddqdat
,o.dcmdat
,o.dhidat
,o.fspr
,o.remit_to
,o.bill_class
,o.bill_cust ,o.bill_cust
,ship_cust ,o.bill_rep
,o.bill_terr
,o.ship_class
,o.ship_cust
,o.ship_rep
,o.ship_terr
,o.quota_rep
,o.account
,o.shipgrp
,o.geo
,o.chan
,o.orig_ctry
,o.orig_prov
,o.orig_post
,o.dest_ctry
,o.dest_prov
,o.dest_post
,o.part ,o.part
,o.ord_gldc
,o.majg
,o.ming
,o.majs
,o.mins
,o.gldc
,o.glec
,o.harm
,o.clss
,o.brand
,o.assc
,o.fs_line ,o.fs_line
,o.r_currency ,o.r_currency
,o.r_rate
,o.c_currency ,o.c_currency
,o.c_rate
,o.ddqtoi
,o.ddqtsi
,o.fgqshp
,o.diqtsh
,o.calc_status ,o.calc_status
,o.flag ,o.flag
,o.odate ,o.orderdate
,o.oseas ,o.requestdate
,o.rdate ,greatest(least(o.shipdate,gld.edat),gld.sdat)
,o.rseas ,o.adj_orderdate
,greatest(least(o.sdate,gld.edat),gld.sdat) ,o.adj_requestdate
,ss.ssyr ,greatest(least(o.adj_shipdate,gld.edat),gld.sdat)
UNION ALL UNION ALL
SELECT SELECT
-----------documents------------- o.plnt
null::int "ddord#" ,o."ddord#"
,null::int "dditm#" ,o."dditm#"
,null::int "fgbol#" ,o."fgbol#"
,null::int "fgent#" ,o."fgent#"
,null::int "diinv#" ,o."diinv#"
,null::int "dilin#" ,o."dilin#"
,null::int quoten
,null::int quotel
----------dates/status------------------
,o.odate + interval '1 year' dcodat
,o.rdate + interval '1 year' ddqdat
,null::date dcmdat
,null::date fesdat
,greatest(least(o.sdate,gld.edat),gld.sdat) + interval '1 year' dhidat
,null::text fesind
,null::text dhpost
,o.fspr
-----------measures--------------------
,null::numeric ddqtoi
,null::numeric ddqtsi
,null::numeric fgqshp
,null::numeric diqtsh
,null::numeric diext
,null::numeric ditdis
,null::jsonb discj
,null::text dhincr
,plnt
,o.promo ,o.promo
,null::text return_reas ,o.return_reas
,o.terms ,o.terms
,null::text custpo ,o.custpo
,null::text remit_to ,o.dhincr
,null::text bill_class ,o.diext
,o.ditdis
,o.dcodat
,o.ddqdat
,o.dcmdat
,o.dhidat
,o.fspr
,o.remit_to
,o.bill_class
,o.bill_cust ,o.bill_cust
,null::text bill_rep ,o.bill_rep
,null::text bill_terr ,o.bill_terr
,null::text ship_class ,o.ship_class
,ship_cust ,o.ship_cust
,null::text ship_rep ,o.ship_rep
,null::text ship_terr ,o.ship_terr
,null::text dsm ,o.quota_rep
,null::text account ,o.account
,null::text shipgrp ,o.shipgrp
,null::text geo ,o.geo
,null::text chan ,o.chan
,null::text chansub ,o.orig_ctry
,null::text orig_ctry ,o.orig_prov
,null::text orig_prov ,o.orig_post
,null::text orig_post ,o.dest_ctry
,null::text bill_ctry ,o.dest_prov
,null::text bill_prov ,o.dest_post
,null::text bill_post
,null::text dest_ctry
,null::text dest_prov
,null::text dest_post
,o.part ,o.part
,null::text styc ,o.ord_gldc
,null::text colc ,o.majg
,null::text colgrp ,o.ming
,null::text coltier ,o.majs
,null::text colstat ,o.mins
,null::text sizc ,o.gldc
,null::text pckg ,o.glec
,null::text kit ,o.harm
,null::text brnd ,o.clss
,null::text majg ,o.brand
,null::text ming ,o.assc
,null::text majs
,null::text mins
,null::text gldco
,null::text gldc
,null::text glec
,null::text harm
,null::text clss
,null::text brand
,null::text assc
,null::text ddunit
,null::text unti
,null::numeric lbs
,null::numeric plt
,null::text plcd
,o.fs_line ,o.fs_line
,o.r_currency ,o.r_currency
,null::numeric r_rate ,o.r_rate
,o.c_currency ,o.c_currency
,null::numeric c_rate ,o.c_rate
,o.ddqtoi
,o.ddqtsi
,o.fgqshp
,o.diqtsh
,sum(o.fb_qty) fb_qty ,sum(o.fb_qty) fb_qty
,sum(o.fb_val_loc) fb_val_loc
,sum(o.fb_val_loc_dis) fb_val_loc_dis
,sum(o.fb_val_loc_qt) fb_val_loc_qt
,sum(o.fb_val_loc_pl) fb_val_loc_pl
,sum(o.fb_val_loc_tar) fb_val_loc_tar
,sum(o.fb_cst_loc) fb_cst_loc ,sum(o.fb_cst_loc) fb_cst_loc
,sum(o.fb_cst_loc_cur) fb_cst_loc_cur ,sum(o.fb_cst_loc_cur) fb_cst_loc_cur
,sum(o.fb_cst_loc_fut) fb_cst_loc_fut ,sum(o.fb_cst_loc_fut) fb_cst_loc_fut
,o.calc_status
,o.flag
,o.odate + interval '1 year' odate
,o.oseas + 1 rseas
,o.rdate + interval '1 year' rdate
,o.rseas + 1 rseas
-----when null, greatest/least is just going to act like coalesce
,greatest(least(o.sdate,gld.edat),gld.sdat) + interval '1 year' sdate
,ss.ssyr sseas
,'actuals' "version"
,'actuals_plug' iter
FROM
rlarp.osm_dev o
LEFT OUTER JOIN gld ON
gld.fspr = o.fspr
LEFT OUTER JOIN gld ss ON
greatest(least(o.sdate,gld.edat),gld.sdat) + interval '1 year' BETWEEN ss.sdat AND ss.edat
WHERE
o.odate BETWEEN '2019-02-01' AND '2019-05-31'
AND fs_line = '41010'
AND calc_status <> 'CANCELED'
------exclude actuals for now and use forecast to get the plug for the rest of the year
AND false
GROUP BY
o.fspr
,plnt
,o.promo
,o.terms
,o.bill_cust
,ship_cust
,o.part
,o.fs_line
,o.r_currency
,o.c_currency
,o.calc_status
,o.flag
,o.odate
,o.oseas
,o.rdate
,o.rseas
,greatest(least(o.sdate,gld.edat),gld.sdat)
,ss.ssyr
UNION ALL
SELECT
-----------documents-------------
null::int "ddord#"
,null::int "dditm#"
,null::int "fgbol#"
,null::int "fgent#"
,null::int "diinv#"
,null::int "dilin#"
,null::int quoten
,null::int quotel
----------dates/status------------------
,o.odate + interval '1 year' dcodat
,o.rdate + interval '1 year' ddqdat
,null::date dcmdat
,null::date fesdat
,greatest(least(o.sdate,gld.edat),gld.sdat) + interval '1 year' dhidat
,null::text fesind
,null::text dhpost
,o.fspr
-----------measures--------------------
,null::numeric ddqtoi
,null::numeric ddqtsi
,null::numeric fgqshp
,null::numeric diqtsh
,null::numeric diext
,null::numeric ditdis
,null::jsonb discj
,null::text dhincr
,plnt
,o.promo
,null::text return_reas
,o.terms
,null::text custpo
,null::text remit_to
,null::text bill_class
,o.bill_cust
,null::text bill_rep
,null::text bill_terr
,null::text ship_class
,ship_cust
,null::text ship_rep
,null::text ship_terr
,null::text dsm
,null::text account
,null::text shipgrp
,null::text geo
,null::text chan
,null::text chansub
,null::text orig_ctry
,null::text orig_prov
,null::text orig_post
,null::text bill_ctry
,null::text bill_prov
,null::text bill_post
,null::text dest_ctry
,null::text dest_prov
,null::text dest_post
,o.part
,null::text styc
,null::text colc
,null::text colgrp
,null::text coltier
,null::text colstat
,null::text sizc
,null::text pckg
,null::text kit
,null::text brnd
,null::text majg
,null::text ming
,null::text majs
,null::text mins
,null::text gldco
,null::text gldc
,null::text glec
,null::text harm
,null::text clss
,null::text brand
,null::text assc
,null::text ddunit
,null::text unti
,null::numeric lbs
,null::numeric plt
,null::text plcd
,o.fs_line
,o.r_currency
,null::numeric r_rate
,o.c_currency
,null::numeric c_rate
,sum(o.fb_qty) fb_qty
,sum(o.fb_val_loc) fb_val_loc ,sum(o.fb_val_loc) fb_val_loc
,sum(o.fb_val_loc_dis) fb_val_loc_dis
,sum(o.fb_val_loc_qt) fb_val_loc_qt
,sum(o.fb_val_loc_pl) fb_val_loc_pl ,sum(o.fb_val_loc_pl) fb_val_loc_pl
,sum(o.fb_val_loc_tar) fb_val_loc_tar
,sum(o.fb_cst_loc) fb_cst_loc
,sum(o.fb_cst_loc_cur) fb_cst_loc_cur
,sum(o.fb_cst_loc_fut) fb_cst_loc_fut
,o.calc_status ,o.calc_status
,o.flag ,o.flag
,o.odate odate ,o.orderdate
,o.oseas rseas ,o.requestdate
,o.rdate rdate ,greatest(least(o.shipdate,gld.edat),gld.sdat) shipdate
,o.rseas rseas ,o.adj_orderdate
-----when null, greatest/least is just going to act like coalesce ,o.adj_requestdate
,greatest(least(o.sdate,gld.edat),gld.sdat) sdate ,greatest(least(o.adj_shipdate,gld.edat),gld.sdat) adj_shipdate
,ss.ssyr sseas ,'9p3' "version"
,'actuals' "version" ,'forecast' iter
,'forecast_plug' iter
FROM FROM
rlarp.osmp_dev o rlarp.osmf o
LEFT OUTER JOIN gld ON LEFT OUTER JOIN gld ON
gld.fspr = o.fspr gld.fspr = o.fspr
LEFT OUTER JOIN gld ss ON
greatest(least(o.sdate,gld.edat),gld.sdat) BETWEEN ss.sdat AND ss.edat
WHERE WHERE
o.odate BETWEEN '2020-02-01' AND '2020-05-31' o.adj_orderdate BETWEEN '2019-03-01' AND '2019-05-31'
AND fs_line = '41010' AND fs_line = '41010'
AND calc_status <> 'CANCELED' AND calc_status <> 'CANCELED'
GROUP BY GROUP BY
o.fspr o.plnt
,plnt ,o."ddord#"
,o."dditm#"
,o."fgbol#"
,o."fgent#"
,o."diinv#"
,o."dilin#"
,o.promo ,o.promo
,o.return_reas
,o.terms ,o.terms
,o.custpo
,o.dhincr
,o.diext
,o.ditdis
,o.dcodat
,o.ddqdat
,o.dcmdat
,o.dhidat
,o.fspr
,o.remit_to
,o.bill_class
,o.bill_cust ,o.bill_cust
,ship_cust ,o.bill_rep
,o.bill_terr
,o.ship_class
,o.ship_cust
,o.ship_rep
,o.ship_terr
,o.quota_rep
,o.account
,o.shipgrp
,o.geo
,o.chan
,o.orig_ctry
,o.orig_prov
,o.orig_post
,o.dest_ctry
,o.dest_prov
,o.dest_post
,o.part ,o.part
,o.ord_gldc
,o.majg
,o.ming
,o.majs
,o.mins
,o.gldc
,o.glec
,o.harm
,o.clss
,o.brand
,o.assc
,o.fs_line ,o.fs_line
,o.r_currency ,o.r_currency
,o.r_rate
,o.c_currency ,o.c_currency
,o.c_rate
,o.ddqtoi
,o.ddqtsi
,o.fgqshp
,o.diqtsh
,o.calc_status ,o.calc_status
,o.flag ,o.flag
,o.odate ,o.orderdate
,o.oseas ,o.requestdate
,o.rdate ,greatest(least(o.shipdate,gld.edat),gld.sdat)
,o.rseas ,o.adj_orderdate
,greatest(least(o.sdate,gld.edat),gld.sdat) ,o.adj_requestdate
,ss.ssyr ,greatest(least(o.adj_shipdate,gld.edat),gld.sdat)
) )
,incr AS ( ,incr AS (
SELECT SELECT
o."ddord#" o.plnt
,o."dditm#" ,o."ddord#"
,o."fgbol#" ,o."dditm#"
,o."fgent#" ,o."fgbol#"
,o."diinv#" ,o."fgent#"
,o."dilin#" ,o."diinv#"
,o.quoten ,o."dilin#"
,o.quotel ,o.promo
,o.dcodat + interval '1 year' --incremented ,o.return_reas
,o.ddqdat + interval '1 year' --incremented ,o.terms
,o.dcmdat ,o.custpo
,o.fesdat ,o.dhincr
,o.dhidat + interval '1 year' --incremented ,o.diext
,o.fesind ,o.ditdis
,o.dhpost ,o.dcodat
,gld.fspr --incremented ,o.ddqdat
,o.ddqtoi ,o.dcmdat
,o.ddqtsi ,o.dhidat
,o.fgqshp ,gld.fspr
,o.diqtsh ,o.remit_to
,o.diext ,o.bill_class
,o.ditdis ,o.bill_cust
,o.discj ,o.bill_rep
,o.dhincr ,o.bill_terr
,o.plnt ,o.ship_class
,o.promo ,o.ship_cust
,o.return_reas ,o.ship_rep
,o.terms ,o.ship_terr
,o.custpo ,o.quota_rep
,o.remit_to ,o.account
,o.bill_class ,o.shipgrp
,o.bill_cust ,o.geo
,o.bill_rep ,o.chan
,o.bill_terr ,o.orig_ctry
,o.ship_class ,o.orig_prov
,o.ship_cust ,o.orig_post
,o.ship_rep ,o.dest_ctry
,o.ship_terr ,o.dest_prov
,o.dsm ,o.dest_post
,o.account ,o.part
,o.shipgrp ,o.ord_gldc
,o.geo ,o.majg
,o.chan ,o.ming
,o.chansub ,o.majs
,o.orig_ctry ,o.mins
,o.orig_prov ,o.gldc
,o.orig_post ,o.glec
,o.bill_ctry ,o.harm
,o.bill_prov ,o.clss
,o.bill_post ,o.brand
,o.dest_ctry ,o.assc
,o.dest_prov ,o.fs_line
,o.dest_post ,o.r_currency
,o.part ,o.r_rate
,o.styc ,o.c_currency
,o.colc ,o.c_rate
,o.colgrp ,o.ddqtoi
,o.coltier ,o.ddqtsi
,o.colstat ,o.fgqshp
,o.sizc ,o.diqtsh
,o.pckg ,sum(o.fb_qty) fb_qty
,o.kit ,sum(o.fb_cst_loc) fb_cst_loc
,o.brnd ,sum(o.fb_cst_loc_cur) fb_cst_loc_cur
,o.majg ,sum(o.fb_cst_loc_fut) fb_cst_loc_fut
,o.ming ,sum(o.fb_val_loc) fb_val_loc
,o.majs ,sum(o.fb_val_loc_pl) fb_val_loc_pl
,o.mins ,o.calc_status
,o.gldco ,o.flag
,o.gldc ----these dates should already be snapped since the derive from the adjusted set
,o.glec ,o.orderdate + interval '1 year' orderdate
,o.harm ,o.requestdate + interval '1 year' requestdate
,o.clss ,o.shipdate + interval '1 year' shipdate
,o.brand ,o.adj_orderdate + interval '1 year' adj_orderdate
,o.assc ,o.adj_requestdate + interval '1 year' adj_requestdate
,o.ddunit ,o.adj_shipdate + interval '1 year' adj_shipdate
,o.unti ,'b20' "version"
,o.lbs ,'copy' iter
,o.plt FROM
,o.plcd cop o
,o.fs_line LEFT OUTER JOIN gld ON
,o.r_currency (o.adj_shipdate + interval '1 year') BETWEEN gld.sdat AND gld.edat
,o.r_rate WHERE
,o.c_currency adj_orderdate BETWEEN '2018-06-01' AND '2019-05-31'
,o.c_rate GROUP BY
,o.fb_qty o.plnt
,o.fb_val_loc ,o."ddord#"
,o.fb_val_loc_dis ,o."dditm#"
,o.fb_val_loc_qt ,o."fgbol#"
,o.fb_val_loc_pl ,o."fgent#"
,o.fb_val_loc_tar ,o."diinv#"
,o.fb_cst_loc ,o."dilin#"
,o.fb_cst_loc_cur ,o.promo
,o.fb_cst_loc_fut ,o.return_reas
,o.calc_status ,o.terms
,o.flag ,o.custpo
,o.odate + interval '1 year' --incremented ,o.dhincr
,o.oseas + 1 --incremented ,o.diext
,o.rdate + interval '1 year' --incremented ,o.ditdis
,o.rseas + 1 --incremented ,o.dcodat
,o.sdate + interval '1 year' --incremented ,o.ddqdat
,o.sseas + 1 --incremented ,o.dcmdat
,'b21' "version" ,o.dhidat
,'baseline' iter ,gld.fspr
FROM ,o.remit_to
baseline o ,o.bill_class
LEFT OUTER JOIN gld ON ,o.bill_cust
o.sdate + interval '1 year' BETWEEN gld.sdat and gld.edat ,o.bill_rep
,o.bill_terr
,o.ship_class
,o.ship_cust
,o.ship_rep
,o.ship_terr
,o.quota_rep
,o.account
,o.shipgrp
,o.geo
,o.chan
,o.orig_ctry
,o.orig_prov
,o.orig_post
,o.dest_ctry
,o.dest_prov
,o.dest_post
,o.part
,o.ord_gldc
,o.majg
,o.ming
,o.majs
,o.mins
,o.gldc
,o.glec
,o.harm
,o.clss
,o.brand
,o.assc
,o.fs_line
,o.r_currency
,o.r_rate
,o.c_currency
,o.c_rate
,o.ddqtoi
,o.ddqtsi
,o.fgqshp
,o.diqtsh
,o.calc_status
,o.flag
,o.orderdate + interval '1 year'
,o.requestdate + interval '1 year'
,o.shipdate + interval '1 year'
,o.adj_orderdate + interval '1 year'
,o.adj_requestdate + interval '1 year'
,o.adj_shipdate + interval '1 year'
) )
INSERT INTO rlarp.osmf_dev INSERT INTO rlarp.osmfs
SELECT * FROM incr SELECT * FROM incr
UNION ALL UNION ALL
SELECT * FROM baseline; SELECT * FROM cop;
---identify short ships: causes disconnect with actual sales------------------------------------------------------------------- ---identify short ships: causes disconnect with actual sales-------------------------------------------------------------------
--UPDATE rlarp.osmfs SET iter = 'short ship' WHERE calc_status = 'CLOSED' AND flag = 'REMAINDER'; UPDATE rlarp.osmfs SET iter = 'short ship' WHERE calc_status = 'CLOSED' AND flag = 'REMAINDER';
---identify goofy ship dates: causes disconnect with sales when splicing in a forecast that has this problem------------------- ---identify goofy ship dates: causes disconnect with sales when splicing in a forecast that has this problem-------------------
--UPDATE rlarp.osmfs SET iter = 'bad date' WHERE adj_shipdate < adj_orderdate; UPDATE rlarp.osmfs SET iter = 'bad date' WHERE adj_shipdate < adj_orderdate;

View File

@ -1,126 +1,115 @@
|column |alt_name |osmp_dev|osm_fcpool|osmp_source|osm_stack_retain|ui |revised_pool| | column | osmp_dev | source | osm_stack_retain | ui |
|---------------|--------------|--------|----------|-----------|----------------|---|------------| | -------------- | -------- | -------- | ---------------- | --- |
|ddord# | |x | |null |x | | | | ddord# | x | null | x | |
|dditm# | |x | |null | | | | | dditm# | x | null | | |
|fgbol# | |x | |null | | | | | fgbol# | x | null | | |
|fgent# | |x | |null | | | | | fgent# | x | null | | |
|diinv# | |x | |null |x | | | | diinv# | x | null | x | |
|dilin# | |x | |null | | | | | dilin# | x | null | | |
|quoten | |x | |null |x | | | | quoten | x | null | x | |
|quotel | |x | |null | | | | | quotel | x | null | | |
|dcodat | |x | |null | | | | | dcodat | x | null | | |
|ddqdat | |x | |null | | | | | ddqdat | x | null | | |
|dcmdat | |x | |null | | | | | dcmdat | x | null | | |
|fesdat | |x | |null | | | | | fesdat | x | null | | |
|dhidat | |x | |null | | | | | dhidat | x | null | | |
|fesind | |x | |null | | | | | fesind | x | null | | |
|dhpost | |x | |null | | | | | dhpost | x | null | | |
|fspr | |x | |forecast | | |x | | fspr | x | forecast | | |
|ddqtoi | |x | |forecast | | |x | | ddqtoi | x | forecast | | |
|ddqtsi | |x | |null | | | | | ddqtsi | x | null | | |
|fgqshp | |x | |null | | | | | fgqshp | x | null | | |
|diqtsh | |x | |null | | | | | diqtsh | x | null | | |
|diext | |x | |null | | | | | diext | x | null | | |
|ditdis | |x | |null | | | | | ditdis | x | null | | |
|discj | |x | |null | | | | | discj | x | null | | |
|dhincr | |x | |forecast | | |x | | dhincr | x | forecast | | |
|plnt | |x | |forecast |x | |x | | plnt | x | forecast | x | |
|promo | |x | |forecast |x |x |x | | promo | x | forecast | x | x |
|return_reas | |x | |null | | | | | return_reas | x | null | | |
|terms | |x | |forecast | | |x | | terms | x | forecast | | |
|custpo | |x | |null | | | | | custpo | x | null | | |
|remit_to | |x | |forecast | | |x | | remit_to | x | forecast | | |
|bill_class | |x | |cust |x | | | | bill_class | x | cust | x | |
|bill_cust | |x | |forecast | | |x | | bill_cust | x | forecast | | x |
|bill_cust_descr| | | |ui_only | |x |x | | bill_rep | x | cust | | |
|bill_rep | |x | |cust | | | | | bill_terr | x | cust | | |
|bill_terr | |x | |cust | | | | | ship_class | x | cust | x | |
|ship_class | |x | |cust |x | | | | ship_cust | x | forecast | x | x |
|ship_cust | |x | |forecast |x | |x | | ship_rep | x | cust | | |
|ship_cust_descr| | | |ui_only | |x |x | | ship_terr | x | cust | | |
|ship_rep | |x | |cust | | | | | dsm | x | forecast | x | x |
|ship_terr | |x | |cust | | | | | account | x | cust | x | x |
|dsm |quota_rep |x | |forecast |x |x |x | | shipgrp | x | cust | x | x |
|quota_rep_descr| | | |ui_only | |x |x | | geo | x | cust | x | |
|account |billto_group |x | |cust |x |x |x | | chan | x | cust | x | x |
|shipgrp |shipto_group |x | |cust |x |x |x | | chansub | x | cust | x | x |
|geo | |x | |cust |x | | | | chanretail | | ui_only | | x |
|chan | |x | |cust |x |x |x | | orig_ctry | x | plnt | | |
|chansub |mod_chan |x | |cust |x |x |x | | orig_prov | x | plnt | | |
|chanretail |mod_chansub | | |ui_only | |x |x | | orig_post | x | plnt | | |
|orig_ctry | |x | |plnt | | | | | bill_ctry | x | cust | x | |
|orig_prov | |x | |plnt | | | | | bill_prov | x | cust | x | |
|orig_post | |x | |plnt | | | | | bill_post | x | cust | x | |
|bill_ctry | |x | |cust |x | | | | dest_ctry | x | cust | x | |
|bill_prov | |x | |cust |x | | | | dest_prov | x | cust | x | |
|bill_post | |x | |cust |x | | | | dest_post | x | cust | x | |
|dest_ctry | |x | |cust |x | | | | part | x | forecast | x | |
|dest_prov | |x | |cust |x | | | | partd | | ui_only | | x |
|dest_post | |x | |cust |x | | | | part_groupd | | ui_only | | x |
|part | |x | |forecast |x | |x | | styc | x | itemm | x | |
|part_descr | | | |ui_only | |x |x | | colc | x | itemm | x | |
|part_group | | | |ui_only | |x |x | | colgrp | x | itemm | x | |
|styc | |x | |itemm |x | | | | coltier | x | itemm | x | |
|colc |color |x | |itemm |x | | | | colstat | x | itemm | | |
|colgrp | |x | |itemm |x | | | | sizc | x | itemm | x | |
|coltier | |x | |itemm |x | | | | pckg | x | itemm | x | |
|colstat | |x | |itemm | | | | | kit | x | itemm | x | |
|sizc | |x | |itemm |x | | | | brnd | x | itemm | x | x |
|pckg | |x | |itemm |x | | | | majg | x | itemm | x | |
|kit | |x | |itemm |x | | | | majgd | | ui_only | | x |
|brnd |branding |x | |itemm |x |x |x | | ming | x | itemm | x | |
|majg | |x | |itemm |x | | | | mingd | | ui_only | | x |
|majgd |majg_descr | | |ui_only | |x |x | | majs | x | itemm | x | |
|ming | |x | |itemm |x | | | | majsd | | ui_only | | x |
|mingd |ming_descr | | |ui_only | |x |x | | mins | x | itemm | x | |
|majs | |x | |itemm |x | | | | minsd | | ui_only | | x |
|majsd |majs_descr | | |ui_only | |x |x | | gldco | x | itemm | | |
|mins | |x | |itemm |x | | | | gldc | x | itemm | | |
|minsd |mins_descr | | |ui_only | |x |x | | glec | x | itemm | x | |
|gldco |ord_gldc |x | |itemm | | | | | segm | | ui_only | | x |
|gldc | |x | |itemm | | | | | harm | x | itemm | | |
|glec | |x | |itemm |x | | | | clss | x | itemm | x | |
|segm | | | |ui_only | |x |x | | brand | x | itemm | | |
|harm | |x | |itemm | | | | | assc | x | itemm | | |
|clss | |x | |itemm |x | | | | ddunit | x | itemm | | |
|brand | |x | |itemm | | | | | unti | x | itemm | | |
|assc | |x | |itemm | | | | | lbs | x | itemm | x | |
|ddunit | |x | |itemm | | | | | plt | x | punit | x | |
|unti |units |x | |itemm | | | | | plcd | x | iprcbhc | x | |
|lbs | |x | |itemm |x | | | | fs_line | x | forecast | x | |
|plt | |x | |punit |x | | | | r_currency | x | forecast | x | |
|plcd | |x | |iprcbhc |x | | | | r_rate | x | forecast | x | |
|fs_line | |x | |forecast |x | |x | | c_currency | x | forecast | x | |
|r_currency | |x | |forecast |x | |x | | c_rate | x | forecast | x | |
|r_rate | |x | |forecast |x | |x | | fb_qty | x | forecast | x | x |
|c_currency | |x | |forecast |x | |x | | fb_val_loc | x | forecast | x | x |
|c_rate | |x | |forecast |x | |x | | value_usd | | ui_only | | x |
|fb_qty | |x | |forecast |x |x |x | | fb_val_loc_dis | x | null | | |
|fb_val_loc |value_loc |x | |forecast |x |x |x | | fb_val_loc_qt | x | null | x | |
|value_usd | | | |ui_only | |x |x | | fb_val_loc_pl | x | pricel | x | |
|fb_val_loc_dis | |x | |null | | | | | fb_val_loc_tar | x | target | x | |
|fb_val_loc_qt | |x | |null |x | | | | fb_cst_loc | x | forecast | x | x |
|fb_val_loc_pl | |x | |pricel |x | | | | cost_loc | | ui_only | | x |
|fb_val_loc_tar | |x | |target |x | | | | fb_cst_loc_cur | x | icstx | x | |
|fb_cst_loc |cost_loc |x | |forecast |x |x |x | | fb_cst_loc_fut | x | icstx | | |
|cost_usd | | | |ui_only | |x |x | | calc_status | x | forecast | x | |
|fb_cst_loc_cur | |x | |icstx |x | | | | flag | x | forecast | x | |
|fb_cst_loc_fut | |x | |icstx | | | | | odate | x | forecast | x | x |
|calc_status | |x | |forecast |x | |x | | oseas | x | forecast | x | x |
|flag | |x | |forecast |x | |x | | rdate | x | forecast | x | x |
|odate |orderdate |x | |forecast |x |x |x | | rseas | x | forecast | x | x |
|order_month | | | |ui_only | |x |x | | sdate | x | forecast | x | x |
|oseas |order_season |x | |forecast |x |x |x | | sseas | x | forecast | x | x |
|rdate |requestdate |x | |forecast |x |x |x | | version | x | forecast | | x |
|request_month | | | |ui_only | |x |x | | iter | x | forecast | | x |
|rseas |request_season|x | |forecast |x |x |x |
|sdate |shipdate |x | |forecast |x |x |x |
|ship_month | | | |ui_only | |x |x |
|sseas |ship_season |x | |forecast |x |x |x |
|version | |x | |forecast | |x |x |
|iter | |x | |forecast | |x |x |
|log | |x | |forecast | |x |x |
|comment | | | |ui_only | |x |x |
|iterdet | | | |forecast | | |x |
|iterdef | | | |forecast | | |x |
|director_descr | | | |forecast | | |x |