update quota_rep logic to mirror current sales matrix, create readme, adjust rebuild script
This commit is contained in:
parent
ce91851d48
commit
037070ed1e
13
build/readme.md
Normal file
13
build/readme.md
Normal file
@ -0,0 +1,13 @@
|
||||
Build A New Forecast
|
||||
------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
* overwrite osmf: review dates and execute build_forecase.sql
|
||||
* the product and customer attributes are wiped, they will need to be snapped (itemm must come first)
|
||||
1. snap_itemm.sql
|
||||
2. snap_customer.sql
|
||||
3. snap_cost_current.sql
|
||||
4. snap_fx.sql (if necessary)
|
||||
5. offline/last_price.sql (if necessary)
|
||||
* build the pool for the more limited UI data set: build_pool.sql
|
||||
* copy the pool to osmfs_dev from inclusion in the osm_stack and reporting: convert_pool_all.sql
|
||||
* refresh osm_stack_refresh() to integrate into reporting
|
@ -1,6 +1,8 @@
|
||||
psql -U ptrowbridge -d ubm -p 5030 -h usmidlnx01 -f build/build_forecast.sql
|
||||
psql -U ptrowbridge -d ubm -p 5030 -h usmidlnx01 -f build/snap_cost_current.sql
|
||||
psql -U ptrowbridge -d ubm -p 5030 -h usmidlnx01 -f build/fx.sql
|
||||
psql -U ptrowbridge -d ubm -p 5030 -h usmidlnx01 -f build/customer.sql
|
||||
psql -U ptrowbridge -d ubm -p 5030 -h usmidlnx01 -f build/snap_itemm.sql
|
||||
psql -U ptrowbridge -d ubm -p 5030 -h usmidlnx01 -f build/build_pool.sql
|
||||
psql -U ptrowbridge -d ubm -p 5030 -h usmidlnx01 -f build/snap_cost_current.sql
|
||||
psql -U ptrowbridge -d ubm -p 5030 -h usmidlnx01 -f build/snap_fx.sql
|
||||
psql -U ptrowbridge -d ubm -p 5030 -h usmidlnx01 -f build/customer.sql
|
||||
psql -U ptrowbridge -d ubm -p 5030 -h usmidlnx01 -f build/build_pool.sql
|
||||
psql -U ptrowbridge -d ubm -p 5030 -h usmidlnx01 -f build/convert_pool_all.sql
|
||||
psql -U ptrowbridge -d ubm -p 5030 -h usmidlnx01 -c "CALL rlarp.osm_stack_refresh();"
|
||||
|
@ -144,66 +144,37 @@ FROM
|
||||
SELECT DISTINCT
|
||||
VERSION,
|
||||
COALESCE(GLEC,'') GLEC,
|
||||
COALESCE(MING,'') MING,
|
||||
MING,
|
||||
BILL_CUST,
|
||||
SHIP_CUST,
|
||||
------------quota rep column--------------
|
||||
RTRIM(
|
||||
--retail items go to currep, or if null go to 90005
|
||||
CASE WHEN S.GLEC IN ('1RE','1CU') THEN
|
||||
CASE WHEN BVCTRY = 'CAN' THEN
|
||||
--Rachel Bowman
|
||||
'50300'
|
||||
ELSE
|
||||
--select customers go to select reps
|
||||
CASE ACCOUNT
|
||||
------Alecia Latini-------------------------------
|
||||
WHEN 'DO IT BEST' THEN '90006'
|
||||
WHEN 'ACE HARDWARE' THEN '90006'
|
||||
WHEN 'ALDI' THEN '90006'
|
||||
WHEN 'AMAZON.COM' THEN '90006'
|
||||
WHEN 'GARDEN RIDGE CORP' THEN '90006' --AKA "At Home"
|
||||
WHEN 'TRUE VALUE' THEN '90006'
|
||||
WHEN 'WAYFAIR' THEN '90006'
|
||||
WHEN 'GRIFFIN' THEN '90006'
|
||||
WHEN 'WAL-MART' THEN '90006'
|
||||
------Tony Landino--------------------------------
|
||||
WHEN 'THE HOME DEPOT' THEN '50802'
|
||||
WHEN 'FRED MEYER' THEN '50802'
|
||||
WHEN 'MENARDS' THEN '50802'
|
||||
WHEN 'KROGER' THEN '50802'
|
||||
WHEN 'OCEAN STATE JOBBERS' THEN '50802'
|
||||
WHEN 'AURORA WHOLESALE' THEN '50802'
|
||||
WHEN 'LEON KORRAL' THEN '50802'
|
||||
--all other retail goes to Doran Marable-----------
|
||||
ELSE '50200'
|
||||
END
|
||||
END
|
||||
--minor group b52 goes to dedicated rep
|
||||
CASE WHEN COALESCE(ming,'') = 'B52' THEN 'PW' ELSE
|
||||
--if the gl expense code is 1RE use the retail rep assigned to the bill-to customer if available
|
||||
CASE WHEN COALESCE(glec,'') = '1RE' AND COALESCE(cu.currep,'') <> '' THEN
|
||||
cu.currep
|
||||
--default logic
|
||||
ELSE
|
||||
CASE WHEN MING = 'B52' THEN
|
||||
'PW'
|
||||
--gdir, ndir go to bill-to rep
|
||||
ELSE
|
||||
CASE WHEN BILL_CLASS IN ('GDIR','NDIR') THEN
|
||||
BILL_REP
|
||||
CASE SUBSTR(bill_class,2,3)
|
||||
WHEN 'DIS' THEN
|
||||
ship_rep
|
||||
ELSE
|
||||
SHIP_REP
|
||||
END
|
||||
bill_rep
|
||||
END
|
||||
END
|
||||
) QUOTA_REP
|
||||
END QUOTA_REP
|
||||
FROM
|
||||
RLARP.OSMF_DEV S
|
||||
LEFT OUTER JOIN LGDAT.CUST ON
|
||||
BVCUST = BILL_CUST
|
||||
BVCUST = BILL_CUST
|
||||
LEFT OUTER JOIN lgpgm.usrcust cu ON
|
||||
cu.cucust = s.bill_cust
|
||||
WHERE
|
||||
COALESCE(GLEC,'') IS NOT NULL
|
||||
version = 'ACTUALS'
|
||||
) CR
|
||||
WHERE
|
||||
CR.VERSION = S.VERSION
|
||||
AND CR.GLEC = COALESCE(S.GLEC,'')
|
||||
AND CR.MING = COALESCE(S.MING,'')
|
||||
AND CR.MING = S.MING
|
||||
AND CR.BILL_CUST = S.BILL_CUST
|
||||
AND CR.SHIP_CUST = S.SHIP_CUST
|
||||
AND COALESCE(S.DSM,'') <> CR.QUOTA_REP;
|
||||
AND COALESCE(S.DSM,'') <> CR.QUOTA_REP;
|
||||
|
Loading…
Reference in New Issue
Block a user