start working on parameterizing the baseline route
This commit is contained in:
parent
4a04a81241
commit
90d62a2bb0
@ -14,6 +14,16 @@ DECLARE
|
||||
_perd_joins text;
|
||||
_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
|
||||
|
||||
-----------------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) {
|
||||
sql = arg;
|
||||
|
||||
@ -68,6 +77,8 @@ server.get('/baseline', bodyParser.json(), function(req, res) {
|
||||
console.log(req.body);
|
||||
//parse the where clause into the main sql statement
|
||||
//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
|
||||
console.log(sql);
|
||||
//Postgres.FirstRow(sql, [], res)
|
||||
|
@ -1,28 +1,9 @@
|
||||
{
|
||||
"scenario": {
|
||||
"quota_rep_descr": "TINA PETTIGREW",
|
||||
"substance": "Plastic",
|
||||
"chan": "DIR",
|
||||
"billto_group": "H&A MASTRONARDI",
|
||||
"shipto_group": "H&A MASTRONARDI",
|
||||
"majg_descr": "110 - INJECTION",
|
||||
"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
|
||||
}
|
||||
"app_baseline_from_date":"2020-06-01",
|
||||
"app_baseline_to_date":"2020-10-31",
|
||||
"app_first_forecast_date":"2021-06-01",
|
||||
"app_openorder_cutoff":"2020-10-31",
|
||||
"app_openstatus_code":["OPEN","BACKORDERD"],
|
||||
"app_plug_fromdate":"2020-11-01",
|
||||
"app_plug_todate":"2020-05-31"
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user