increment periods
This commit is contained in:
		
							parent
							
								
									76edca43dc
								
							
						
					
					
						commit
						8a3baf269d
					
				@ -1,3 +1,3 @@
 | 
			
		||||
 | 
			
		||||
DELETE FROM rlarp.osmf_dev WHERE odate < '2020-05-01';
 | 
			
		||||
INSERT INTO rlarp.osmf_dev SELECT * FROM rlarp.osmfs_dev WHERE odate < '2020-05-01';
 | 
			
		||||
DELETE FROM rlarp.osmf_dev WHERE odate < '2020-06-01';
 | 
			
		||||
INSERT INTO rlarp.osmf_dev SELECT * FROM rlarp.osmfs_dev WHERE odate < '2020-06-01';
 | 
			
		||||
 | 
			
		||||
@ -1,6 +1,6 @@
 | 
			
		||||
BEGIN;
 | 
			
		||||
 | 
			
		||||
DELETE FROM rlarp.osm_pool WHERE order_date < '2020-05-01';
 | 
			
		||||
DELETE FROM rlarp.osm_pool WHERE order_date < '2020-06-01';
 | 
			
		||||
 | 
			
		||||
INSERT INTO rlarp.osm_pool
 | 
			
		||||
WITH
 | 
			
		||||
@ -134,7 +134,7 @@ FROM
 | 
			
		||||
    LEFT OUTER JOIN rlarp.itemm i ON
 | 
			
		||||
        i.item = o.part
 | 
			
		||||
WHERE
 | 
			
		||||
    odate < '2020-05-01';
 | 
			
		||||
    odate < '2020-06-01';
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
SELECT
 | 
			
		||||
@ -160,4 +160,4 @@ GROUP BY
 | 
			
		||||
    
 | 
			
		||||
--ROLLBACK;
 | 
			
		||||
 | 
			
		||||
commit;
 | 
			
		||||
commit;
 | 
			
		||||
 | 
			
		||||
@ -145,11 +145,11 @@ gld AS (
 | 
			
		||||
    WHERE
 | 
			
		||||
        (
 | 
			
		||||
            --base period orders booked....
 | 
			
		||||
            o.odate <@ daterange('2019-06-01','2020-05-01')
 | 
			
		||||
            o.odate <@ daterange('2019-06-01','2020-06-01')
 | 
			
		||||
            --...or any open orders currently booked before cutoff....
 | 
			
		||||
            OR (o.calc_status IN ('OPEN','BACKORDER') and o.odate < '2020-05-01')
 | 
			
		||||
            OR (o.calc_status IN ('OPEN','BACKORDER') and o.odate < '2020-06-01')
 | 
			
		||||
            --...or anything that shipped in that period
 | 
			
		||||
            OR o.fspr BETWEEN '2001' AND '2011'
 | 
			
		||||
            OR o.fspr BETWEEN '2001' AND '2012'
 | 
			
		||||
        )
 | 
			
		||||
        AND fs_line = '41010'
 | 
			
		||||
        AND calc_status <> 'CANCELED'
 | 
			
		||||
@ -184,4 +184,4 @@ SELECT * FROM baseline;
 | 
			
		||||
--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-------------------
 | 
			
		||||
--UPDATE rlarp.osmfs SET iter = 'bad date' WHERE adj_shipdate < adj_orderdate;
 | 
			
		||||
--UPDATE rlarp.osmfs SET iter = 'bad date' WHERE adj_shipdate < adj_orderdate;
 | 
			
		||||
 | 
			
		||||
@ -82,7 +82,7 @@ WHERE
 | 
			
		||||
    b.bvcust = rtrim(substring(o.bill_cust_descr,1,8))
 | 
			
		||||
    AND s.bvcust = rtrim(substring(o.ship_cust_descr,1,8));
 | 
			
		||||
 | 
			
		||||
BEGIN;
 | 
			
		||||
--BEGIN;
 | 
			
		||||
    
 | 
			
		||||
UPDATE
 | 
			
		||||
    rlarp.osm_pool o
 | 
			
		||||
@ -97,5 +97,5 @@ WHERE
 | 
			
		||||
    and c.a2 = 'MM'
 | 
			
		||||
    AND q.qr = LTRIM(RTRIM(c.a9));
 | 
			
		||||
    
 | 
			
		||||
    
 | 
			
		||||
ROLLBACK;
 | 
			
		||||
COMMIT;  
 | 
			
		||||
--ROLLBACK;
 | 
			
		||||
 | 
			
		||||
		Loading…
	
		Reference in New Issue
	
	Block a user