From 032736f0e97d1fe094306bd02febfc301885f24b Mon Sep 17 00:00:00 2001 From: Paul Trowbridge Date: Mon, 3 May 2021 12:33:34 -0400 Subject: [PATCH] convert script to live db and do rounding on final build --- build/build_pool.sql | 12 ++++++------ build/rebuild_forecast.sh | 10 +++++----- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/build/build_pool.sql b/build/build_pool.sql index e1f2685..5a58add 100644 --- a/build/build_pool.sql +++ b/build/build_pool.sql @@ -121,11 +121,11 @@ SELECT ,r_rate ,c_currency ,c_rate - ,fb_qty units - ,fb_val_loc value_loc - ,fb_val_loc * r_rate value_usd - ,fb_cst_loc_cur cost_loc - ,fb_cst_loc_cur * c_rate cost_usd + ,round(fb_qty,2) units + ,round(fb_val_loc,2) value_loc + ,round(fb_val_loc * r_rate,2) value_usd + ,round(fb_cst_loc_cur,2) cost_loc + ,round(fb_cst_loc_cur * c_rate,2) cost_usd ,calc_status ,flag ,o.odate order_date @@ -171,7 +171,7 @@ FROM --LIMIT 100 ) WITH DATA; -INSERT INTO rlarp.osm_pool SELECT * FROM rlarp.osm_pool_stage; +--INSERT INTO rlarp.osm_pool SELECT * FROM rlarp.osm_pool_stage; --CREATE INDEX osm_qr ON rlarp.osm_pool(quota_rep_descr, bill_cust_descr, ship_cust_descr); --ALTER TABLE rlarp.osm_pool ADD CONSTRAINT logfk FOREIGN KEY (logid) REFERENCES rlarp.osm_log(id); diff --git a/build/rebuild_forecast.sh b/build/rebuild_forecast.sh index 66e6391..3bb1b33 100644 --- a/build/rebuild_forecast.sh +++ b/build/rebuild_forecast.sh @@ -1,5 +1,5 @@ -$PGD -f ./build_stage.sql -$PGD -f ./snap_itemm.sql -$PGD -f ./snap_cost_current.sql -$PGD -f ./snap_customer.sql -$PGD -f ./build_pool.sql +$PG -f ./build_stage.sql +$PG -f ./snap_itemm.sql +$PG -f ./snap_cost_current.sql +$PG -f ./snap_customer.sql +$PG -f ./build_pool.sql