start working on parameterizing the baseline route
This commit is contained in:
parent
4a04a81241
commit
90d62a2bb0
@ -14,6 +14,16 @@ DECLARE
|
|||||||
_perd_joins text;
|
_perd_joins text;
|
||||||
_interval interval;
|
_interval interval;
|
||||||
|
|
||||||
|
/*----------------parameters listing--------------
|
||||||
|
app_baseline_from_date
|
||||||
|
app_baseline_to_date
|
||||||
|
app_first_forecast_date
|
||||||
|
app_openorder_cutoff
|
||||||
|
app_openstatus_code
|
||||||
|
app_plug_fromdate
|
||||||
|
app_plug_todate
|
||||||
|
------------------------------------------------*/
|
||||||
|
|
||||||
BEGIN
|
BEGIN
|
||||||
|
|
||||||
-----------------populate application variables--------------------------------------------
|
-----------------populate application variables--------------------------------------------
|
||||||
|
11
index.js
11
index.js
@ -61,6 +61,15 @@ server.get('/baseline', bodyParser.json(), function(req, res) {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
//list of parameters that will need to be supplied from the app
|
||||||
|
//app_baseline_from_date
|
||||||
|
//app_baseline_to_date
|
||||||
|
//app_first_forecast_date
|
||||||
|
//app_openorder_cutoff
|
||||||
|
//app_openstatus_code
|
||||||
|
//app_plug_fromdate
|
||||||
|
//app_plug_todate
|
||||||
|
|
||||||
var callback = function(arg) {
|
var callback = function(arg) {
|
||||||
sql = arg;
|
sql = arg;
|
||||||
|
|
||||||
@ -68,6 +77,8 @@ server.get('/baseline', bodyParser.json(), function(req, res) {
|
|||||||
console.log(req.body);
|
console.log(req.body);
|
||||||
//parse the where clause into the main sql statement
|
//parse the where clause into the main sql statement
|
||||||
//sql = sql.replace(new RegExp("where_clause", 'g'), w)
|
//sql = sql.replace(new RegExp("where_clause", 'g'), w)
|
||||||
|
sql = sql.replace(new RegExp("[app_baseline_from_date]",'g'), "$1");
|
||||||
|
args.push(req.body.app_baseline_from_date);
|
||||||
//execute the sql and send the result
|
//execute the sql and send the result
|
||||||
console.log(sql);
|
console.log(sql);
|
||||||
//Postgres.FirstRow(sql, [], res)
|
//Postgres.FirstRow(sql, [], res)
|
||||||
|
@ -1,28 +1,9 @@
|
|||||||
{
|
{
|
||||||
"scenario": {
|
"app_baseline_from_date":"2020-06-01",
|
||||||
"quota_rep_descr": "TINA PETTIGREW",
|
"app_baseline_to_date":"2020-10-31",
|
||||||
"substance": "Plastic",
|
"app_first_forecast_date":"2021-06-01",
|
||||||
"chan": "DIR",
|
"app_openorder_cutoff":"2020-10-31",
|
||||||
"billto_group": "H&A MASTRONARDI",
|
"app_openstatus_code":["OPEN","BACKORDERD"],
|
||||||
"shipto_group": "H&A MASTRONARDI",
|
"app_plug_fromdate":"2020-11-01",
|
||||||
"majg_descr": "110 - INJECTION",
|
"app_plug_todate":"2020-05-31"
|
||||||
"part_descr": "HWA13000E21B025LZBLD - 13.00 WRAPT HP CHOCOLATE",
|
}
|
||||||
"version": "b21",
|
|
||||||
"iter": [
|
|
||||||
"copy",
|
|
||||||
"adj volume",
|
|
||||||
"adj price",
|
|
||||||
"upload volume",
|
|
||||||
"upload price"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"stamp": "2020-02-19 17:03:38",
|
|
||||||
"user": "Trowbridge, Paul",
|
|
||||||
"source": "adj",
|
|
||||||
"message": "2% on volume and price",
|
|
||||||
"tag": "standard price",
|
|
||||||
"version": "b21",
|
|
||||||
"type": "scale_vp",
|
|
||||||
"qty": 453.60,
|
|
||||||
"amount": 728.43624
|
|
||||||
}
|
|
||||||
|
Loading…
Reference in New Issue
Block a user