fix up volume and price
This commit is contained in:
parent
157f8f356d
commit
0ce9056d7c
12
index.js
12
index.js
@ -165,7 +165,7 @@ server.post('/addmonth_vp', bodyParser.json(), function (req, res) {
|
||||
var path = './route_sql/addmonth_vupd.sql';
|
||||
|
||||
var callback = function(arg){
|
||||
sql = arg
|
||||
sql = arg;
|
||||
|
||||
({ c, w, d } = build_where(req, c, w, d, args));
|
||||
|
||||
@ -180,6 +180,10 @@ server.post('/addmonth_vp', bodyParser.json(), function (req, res) {
|
||||
sql = sql.replace(new RegExp("target_volume",'g'),req.body.qty);
|
||||
sql = sql.replace(new RegExp("target_price",'g'),req.body.amount);
|
||||
sql = sql.replace(new RegExp("target_month",'g'),req.body.month);
|
||||
sql = sql.replace(new RegExp("replace_version",'g'),req.body.scenario.version);
|
||||
sql = sql.replace(new RegExp("replace_iteration",'g'),"tool volume & price");
|
||||
sql = sql.replace(new RegExp("replace_iterdet",'g'),"addmonth_vupd");
|
||||
sql = sql.replace(new RegExp("replace_iterdef",'g'),JSON.stringify(req.body));
|
||||
//console.log(sql);
|
||||
Postgres.FirstRow(sql,[],res)
|
||||
}
|
||||
@ -204,7 +208,7 @@ server.post('/scale_v', bodyParser.json(), function (req, res) {
|
||||
var path = './route_sql/scale_vd.sql';
|
||||
|
||||
var callback = function(arg){
|
||||
sql = arg
|
||||
sql = arg;
|
||||
|
||||
({ c, w, d } = build_where(req, c, w, d, args));
|
||||
|
||||
@ -241,7 +245,7 @@ server.post('/scale_p', bodyParser.json(), function (req, res) {
|
||||
var path = './route_sql/scale_pd.sql';
|
||||
|
||||
var callback = function(arg){
|
||||
sql = arg
|
||||
sql = arg;
|
||||
|
||||
({ c, w, d } = build_where(req, c, w, d, args));
|
||||
|
||||
@ -278,7 +282,7 @@ server.post('/scale_vp', bodyParser.json(), function (req, res) {
|
||||
var path = './route_sql/scale_vupd.sql';
|
||||
|
||||
var callback = function(arg){
|
||||
sql = arg
|
||||
sql = arg;
|
||||
|
||||
({ c, w, d } = build_where(req, c, w, d, args));
|
||||
|
||||
|
@ -61,8 +61,6 @@ target AS (select target_volume vincr, target_price pincr)
|
||||
-----------------scenario----------------------------
|
||||
where_clause
|
||||
-----------------additional params-------------------
|
||||
AND version = 'b20'
|
||||
AND iter = 'copy'
|
||||
AND calc_status||flag <> 'CLOSEDREMAINDER' --exclude short ships when building order adjustments
|
||||
AND adj_orderdate <= adj_shipdate
|
||||
GROUP BY
|
||||
@ -247,8 +245,6 @@ SELECT
|
||||
-----------------scenario----------------------------
|
||||
where_clause
|
||||
-----------------additional params-------------------
|
||||
AND version = 'b20'
|
||||
AND iter = 'copy'
|
||||
AND calc_status||flag <> 'CLOSEDREMAINDER' --exclude short ships when building order adjustments
|
||||
AND adj_orderdate <= adj_shipdate
|
||||
GROUP BY
|
||||
@ -395,11 +391,11 @@ SELECT
|
||||
,make_date(mseq.yr + 2020,mseq.cal,m.odom) adj_orderdate
|
||||
,make_date(mseq.yr + 2020,mseq.cal,m.odom) + rlag adj_requestdate
|
||||
,make_date(mseq.yr + 2020,mseq.cal,m.odom) + rlag + slag adj_shipdate
|
||||
,b.version --calculated
|
||||
,b.iter --calculated
|
||||
,'replace_version' "version" --calculated
|
||||
,'replace_iteration' iter --calculated
|
||||
-----------------------ui columns--------------------------------
|
||||
,'adjust volume' iterdet
|
||||
,null::jsonb iterdef
|
||||
,'replace_iterdet' iterdet
|
||||
,$$replace_iterdef$$::jsonb iterdef
|
||||
,od.ssyr order_season
|
||||
,to_char(make_date(mseq.yr + 2020,mseq.cal,m.odom),'Mon') order_month
|
||||
,sd.ssyr ship_season
|
||||
@ -530,8 +526,8 @@ SELECT
|
||||
,b.version --calculated
|
||||
,b.iter --calculated
|
||||
-----------------------ui columns--------------------------------
|
||||
,'adjust p & v' iterdet
|
||||
,null::jsonb iterdef
|
||||
,b.iterdet
|
||||
,b.iterdef
|
||||
,b.order_season
|
||||
,b.order_month
|
||||
,b.ship_season
|
||||
|
Loading…
Reference in New Issue
Block a user