Compare commits
No commits in common. "061387c1dcf0c47281b9262f11d857a7f7406139" and "c088150ad30d1b80fb0f6995cf69846e6bea4649" have entirely different histories.
061387c1dc
...
c088150ad3
@ -1,8 +0,0 @@
|
|||||||
user=api
|
|
||||||
password=pw
|
|
||||||
host=usmidlnx01
|
|
||||||
port=5030
|
|
||||||
database=ubm
|
|
||||||
ssl=enable
|
|
||||||
wd=/mnt/c/Users/PTrowbridge/forecast_api/
|
|
||||||
nodeport=8080
|
|
10
README.md
10
README.md
@ -1,10 +0,0 @@
|
|||||||
Special concepts
|
|
||||||
* relationships betwen dates (order, request, ship) and apply that mix to a new month
|
|
||||||
* apply a base mix of promo codes and terms codes to a new month of forecast where there is no existing baseline to pull from
|
|
||||||
* effects of building baselines off of original, or all changes so far
|
|
||||||
* pricing and units
|
|
||||||
|
|
||||||
Slowness Options
|
|
||||||
* move json to a separate table and the change can be marked with a sequence
|
|
||||||
* have the data actually be a query from the database
|
|
||||||
* reduce number of columns in fc_pool
|
|
@ -1,4 +0,0 @@
|
|||||||
openssl genrsa -out key.pem
|
|
||||||
openssl req -new -key key.pem -out csr.pem
|
|
||||||
openssl x509 -req -days 9999 -in csr.pem -signkey key.pem -out cert.pem
|
|
||||||
rm csr.pem
|
|
@ -1,13 +0,0 @@
|
|||||||
[Unit]
|
|
||||||
Description=forecast_api
|
|
||||||
After=network.target
|
|
||||||
|
|
||||||
[Service]
|
|
||||||
ExecStart=/usr/bin/node //opt/forecast_api/index.js
|
|
||||||
Restart=always
|
|
||||||
User=fc_api
|
|
||||||
Environemnt=NODE_ENV=production
|
|
||||||
WorkingDirectory=//opt/forecast_api
|
|
||||||
|
|
||||||
[Install]
|
|
||||||
WantedBy=multi-user.target
|
|
490
package-lock.json
generated
490
package-lock.json
generated
@ -1,490 +0,0 @@
|
|||||||
{
|
|
||||||
"name": "nodet",
|
|
||||||
"version": "1.0.0",
|
|
||||||
"lockfileVersion": 1,
|
|
||||||
"requires": true,
|
|
||||||
"dependencies": {
|
|
||||||
"accepts": {
|
|
||||||
"version": "1.3.7",
|
|
||||||
"resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.7.tgz",
|
|
||||||
"integrity": "sha512-Il80Qs2WjYlJIBNzNkK6KYqlVMTbZLXgHx2oT0pU/fjRHyEp+PEfEPY0R3WCwAGVOtauxh1hOxNgIf5bv7dQpA==",
|
|
||||||
"requires": {
|
|
||||||
"mime-types": "~2.1.24",
|
|
||||||
"negotiator": "0.6.2"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"array-flatten": {
|
|
||||||
"version": "1.1.1",
|
|
||||||
"resolved": "https://registry.npmjs.org/array-flatten/-/array-flatten-1.1.1.tgz",
|
|
||||||
"integrity": "sha1-ml9pkFGx5wczKPKgCJaLZOopVdI="
|
|
||||||
},
|
|
||||||
"body-parser": {
|
|
||||||
"version": "1.19.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.19.0.tgz",
|
|
||||||
"integrity": "sha512-dhEPs72UPbDnAQJ9ZKMNTP6ptJaionhP5cBb541nXPlW60Jepo9RV/a4fX4XWW9CuFNK22krhrj1+rgzifNCsw==",
|
|
||||||
"requires": {
|
|
||||||
"bytes": "3.1.0",
|
|
||||||
"content-type": "~1.0.4",
|
|
||||||
"debug": "2.6.9",
|
|
||||||
"depd": "~1.1.2",
|
|
||||||
"http-errors": "1.7.2",
|
|
||||||
"iconv-lite": "0.4.24",
|
|
||||||
"on-finished": "~2.3.0",
|
|
||||||
"qs": "6.7.0",
|
|
||||||
"raw-body": "2.4.0",
|
|
||||||
"type-is": "~1.6.17"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"buffer-writer": {
|
|
||||||
"version": "2.0.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/buffer-writer/-/buffer-writer-2.0.0.tgz",
|
|
||||||
"integrity": "sha512-a7ZpuTZU1TRtnwyCNW3I5dc0wWNC3VR9S++Ewyk2HHZdrO3CQJqSpd+95Us590V6AL7JqUAH2IwZ/398PmNFgw=="
|
|
||||||
},
|
|
||||||
"bytes": {
|
|
||||||
"version": "3.1.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/bytes/-/bytes-3.1.0.tgz",
|
|
||||||
"integrity": "sha512-zauLjrfCG+xvoyaqLoV8bLVXXNGC4JqlxFCutSDWA6fJrTo2ZuvLYTqZ7aHBLZSMOopbzwv8f+wZcVzfVTI2Dg=="
|
|
||||||
},
|
|
||||||
"content-disposition": {
|
|
||||||
"version": "0.5.3",
|
|
||||||
"resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-0.5.3.tgz",
|
|
||||||
"integrity": "sha512-ExO0774ikEObIAEV9kDo50o+79VCUdEB6n6lzKgGwupcVeRlhrj3qGAfwq8G6uBJjkqLrhT0qEYFcWng8z1z0g==",
|
|
||||||
"requires": {
|
|
||||||
"safe-buffer": "5.1.2"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"content-type": {
|
|
||||||
"version": "1.0.4",
|
|
||||||
"resolved": "https://registry.npmjs.org/content-type/-/content-type-1.0.4.tgz",
|
|
||||||
"integrity": "sha512-hIP3EEPs8tB9AT1L+NUqtwOAps4mk2Zob89MWXMHjHWg9milF/j4osnnQLXBCBFBk/tvIG/tUc9mOUJiPBhPXA=="
|
|
||||||
},
|
|
||||||
"cookie": {
|
|
||||||
"version": "0.4.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/cookie/-/cookie-0.4.0.tgz",
|
|
||||||
"integrity": "sha512-+Hp8fLp57wnUSt0tY0tHEXh4voZRDnoIrZPqlo3DPiI4y9lwg/jqx+1Om94/W6ZaPDOUbnjOt/99w66zk+l1Xg=="
|
|
||||||
},
|
|
||||||
"cookie-signature": {
|
|
||||||
"version": "1.0.6",
|
|
||||||
"resolved": "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.0.6.tgz",
|
|
||||||
"integrity": "sha1-4wOogrNCzD7oylE6eZmXNNqzriw="
|
|
||||||
},
|
|
||||||
"debug": {
|
|
||||||
"version": "2.6.9",
|
|
||||||
"resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz",
|
|
||||||
"integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==",
|
|
||||||
"requires": {
|
|
||||||
"ms": "2.0.0"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"depd": {
|
|
||||||
"version": "1.1.2",
|
|
||||||
"resolved": "https://registry.npmjs.org/depd/-/depd-1.1.2.tgz",
|
|
||||||
"integrity": "sha1-m81S4UwJd2PnSbJ0xDRu0uVgtak="
|
|
||||||
},
|
|
||||||
"destroy": {
|
|
||||||
"version": "1.0.4",
|
|
||||||
"resolved": "https://registry.npmjs.org/destroy/-/destroy-1.0.4.tgz",
|
|
||||||
"integrity": "sha1-l4hXRCxEdJ5CBmE+N5RiBYJqvYA="
|
|
||||||
},
|
|
||||||
"dotenv": {
|
|
||||||
"version": "6.2.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/dotenv/-/dotenv-6.2.0.tgz",
|
|
||||||
"integrity": "sha512-HygQCKUBSFl8wKQZBSemMywRWcEDNidvNbjGVyZu3nbZ8qq9ubiPoGLMdRDpfSrpkkm9BXYFkpKxxFX38o/76w=="
|
|
||||||
},
|
|
||||||
"ee-first": {
|
|
||||||
"version": "1.1.1",
|
|
||||||
"resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz",
|
|
||||||
"integrity": "sha1-WQxhFWsK4vTwJVcyoViyZrxWsh0="
|
|
||||||
},
|
|
||||||
"encodeurl": {
|
|
||||||
"version": "1.0.2",
|
|
||||||
"resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-1.0.2.tgz",
|
|
||||||
"integrity": "sha1-rT/0yG7C0CkyL1oCw6mmBslbP1k="
|
|
||||||
},
|
|
||||||
"escape-html": {
|
|
||||||
"version": "1.0.3",
|
|
||||||
"resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz",
|
|
||||||
"integrity": "sha1-Aljq5NPQwJdN4cFpGI7wBR0dGYg="
|
|
||||||
},
|
|
||||||
"etag": {
|
|
||||||
"version": "1.8.1",
|
|
||||||
"resolved": "https://registry.npmjs.org/etag/-/etag-1.8.1.tgz",
|
|
||||||
"integrity": "sha1-Qa4u62XvpiJorr/qg6x9eSmbCIc="
|
|
||||||
},
|
|
||||||
"express": {
|
|
||||||
"version": "4.17.1",
|
|
||||||
"resolved": "https://registry.npmjs.org/express/-/express-4.17.1.tgz",
|
|
||||||
"integrity": "sha512-mHJ9O79RqluphRrcw2X/GTh3k9tVv8YcoyY4Kkh4WDMUYKRZUq0h1o0w2rrrxBqM7VoeUVqgb27xlEMXTnYt4g==",
|
|
||||||
"requires": {
|
|
||||||
"accepts": "~1.3.7",
|
|
||||||
"array-flatten": "1.1.1",
|
|
||||||
"body-parser": "1.19.0",
|
|
||||||
"content-disposition": "0.5.3",
|
|
||||||
"content-type": "~1.0.4",
|
|
||||||
"cookie": "0.4.0",
|
|
||||||
"cookie-signature": "1.0.6",
|
|
||||||
"debug": "2.6.9",
|
|
||||||
"depd": "~1.1.2",
|
|
||||||
"encodeurl": "~1.0.2",
|
|
||||||
"escape-html": "~1.0.3",
|
|
||||||
"etag": "~1.8.1",
|
|
||||||
"finalhandler": "~1.1.2",
|
|
||||||
"fresh": "0.5.2",
|
|
||||||
"merge-descriptors": "1.0.1",
|
|
||||||
"methods": "~1.1.2",
|
|
||||||
"on-finished": "~2.3.0",
|
|
||||||
"parseurl": "~1.3.3",
|
|
||||||
"path-to-regexp": "0.1.7",
|
|
||||||
"proxy-addr": "~2.0.5",
|
|
||||||
"qs": "6.7.0",
|
|
||||||
"range-parser": "~1.2.1",
|
|
||||||
"safe-buffer": "5.1.2",
|
|
||||||
"send": "0.17.1",
|
|
||||||
"serve-static": "1.14.1",
|
|
||||||
"setprototypeof": "1.1.1",
|
|
||||||
"statuses": "~1.5.0",
|
|
||||||
"type-is": "~1.6.18",
|
|
||||||
"utils-merge": "1.0.1",
|
|
||||||
"vary": "~1.1.2"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"finalhandler": {
|
|
||||||
"version": "1.1.2",
|
|
||||||
"resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-1.1.2.tgz",
|
|
||||||
"integrity": "sha512-aAWcW57uxVNrQZqFXjITpW3sIUQmHGG3qSb9mUah9MgMC4NeWhNOlNjXEYq3HjRAvL6arUviZGGJsBg6z0zsWA==",
|
|
||||||
"requires": {
|
|
||||||
"debug": "2.6.9",
|
|
||||||
"encodeurl": "~1.0.2",
|
|
||||||
"escape-html": "~1.0.3",
|
|
||||||
"on-finished": "~2.3.0",
|
|
||||||
"parseurl": "~1.3.3",
|
|
||||||
"statuses": "~1.5.0",
|
|
||||||
"unpipe": "~1.0.0"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"forwarded": {
|
|
||||||
"version": "0.1.2",
|
|
||||||
"resolved": "https://registry.npmjs.org/forwarded/-/forwarded-0.1.2.tgz",
|
|
||||||
"integrity": "sha1-mMI9qxF1ZXuMBXPozszZGw/xjIQ="
|
|
||||||
},
|
|
||||||
"fresh": {
|
|
||||||
"version": "0.5.2",
|
|
||||||
"resolved": "https://registry.npmjs.org/fresh/-/fresh-0.5.2.tgz",
|
|
||||||
"integrity": "sha1-PYyt2Q2XZWn6g1qx+OSyOhBWBac="
|
|
||||||
},
|
|
||||||
"http-errors": {
|
|
||||||
"version": "1.7.2",
|
|
||||||
"resolved": "https://registry.npmjs.org/http-errors/-/http-errors-1.7.2.tgz",
|
|
||||||
"integrity": "sha512-uUQBt3H/cSIVfch6i1EuPNy/YsRSOUBXTVfZ+yR7Zjez3qjBz6i9+i4zjNaoqcoFVI4lQJ5plg63TvGfRSDCRg==",
|
|
||||||
"requires": {
|
|
||||||
"depd": "~1.1.2",
|
|
||||||
"inherits": "2.0.3",
|
|
||||||
"setprototypeof": "1.1.1",
|
|
||||||
"statuses": ">= 1.5.0 < 2",
|
|
||||||
"toidentifier": "1.0.0"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"iconv-lite": {
|
|
||||||
"version": "0.4.24",
|
|
||||||
"resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz",
|
|
||||||
"integrity": "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==",
|
|
||||||
"requires": {
|
|
||||||
"safer-buffer": ">= 2.1.2 < 3"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"inherits": {
|
|
||||||
"version": "2.0.3",
|
|
||||||
"resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz",
|
|
||||||
"integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4="
|
|
||||||
},
|
|
||||||
"ipaddr.js": {
|
|
||||||
"version": "1.9.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.9.0.tgz",
|
|
||||||
"integrity": "sha512-M4Sjn6N/+O6/IXSJseKqHoFc+5FdGJ22sXqnjTpdZweHK64MzEPAyQZyEU3R/KRv2GLoa7nNtg/C2Ev6m7z+eA=="
|
|
||||||
},
|
|
||||||
"media-typer": {
|
|
||||||
"version": "0.3.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz",
|
|
||||||
"integrity": "sha1-hxDXrwqmJvj/+hzgAWhUUmMlV0g="
|
|
||||||
},
|
|
||||||
"merge-descriptors": {
|
|
||||||
"version": "1.0.1",
|
|
||||||
"resolved": "https://registry.npmjs.org/merge-descriptors/-/merge-descriptors-1.0.1.tgz",
|
|
||||||
"integrity": "sha1-sAqqVW3YtEVoFQ7J0blT8/kMu2E="
|
|
||||||
},
|
|
||||||
"methods": {
|
|
||||||
"version": "1.1.2",
|
|
||||||
"resolved": "https://registry.npmjs.org/methods/-/methods-1.1.2.tgz",
|
|
||||||
"integrity": "sha1-VSmk1nZUE07cxSZmVoNbD4Ua/O4="
|
|
||||||
},
|
|
||||||
"mime": {
|
|
||||||
"version": "1.6.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/mime/-/mime-1.6.0.tgz",
|
|
||||||
"integrity": "sha512-x0Vn8spI+wuJ1O6S7gnbaQg8Pxh4NNHb7KSINmEWKiPE4RKOplvijn+NkmYmmRgP68mc70j2EbeTFRsrswaQeg=="
|
|
||||||
},
|
|
||||||
"mime-db": {
|
|
||||||
"version": "1.43.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.43.0.tgz",
|
|
||||||
"integrity": "sha512-+5dsGEEovYbT8UY9yD7eE4XTc4UwJ1jBYlgaQQF38ENsKR3wj/8q8RFZrF9WIZpB2V1ArTVFUva8sAul1NzRzQ=="
|
|
||||||
},
|
|
||||||
"mime-types": {
|
|
||||||
"version": "2.1.26",
|
|
||||||
"resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.26.tgz",
|
|
||||||
"integrity": "sha512-01paPWYgLrkqAyrlDorC1uDwl2p3qZT7yl806vW7DvDoxwXi46jsjFbg+WdwotBIk6/MbEhO/dh5aZ5sNj/dWQ==",
|
|
||||||
"requires": {
|
|
||||||
"mime-db": "1.43.0"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"ms": {
|
|
||||||
"version": "2.0.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz",
|
|
||||||
"integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g="
|
|
||||||
},
|
|
||||||
"negotiator": {
|
|
||||||
"version": "0.6.2",
|
|
||||||
"resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.2.tgz",
|
|
||||||
"integrity": "sha512-hZXc7K2e+PgeI1eDBe/10Ard4ekbfrrqG8Ep+8Jmf4JID2bNg7NvCPOZN+kfF574pFQI7mum2AUqDidoKqcTOw=="
|
|
||||||
},
|
|
||||||
"on-finished": {
|
|
||||||
"version": "2.3.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.3.0.tgz",
|
|
||||||
"integrity": "sha1-IPEzZIGwg811M3mSoWlxqi2QaUc=",
|
|
||||||
"requires": {
|
|
||||||
"ee-first": "1.1.1"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"packet-reader": {
|
|
||||||
"version": "1.0.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/packet-reader/-/packet-reader-1.0.0.tgz",
|
|
||||||
"integrity": "sha512-HAKu/fG3HpHFO0AA8WE8q2g+gBJaZ9MG7fcKk+IJPLTGAD6Psw4443l+9DGRbOIh3/aXr7Phy0TjilYivJo5XQ=="
|
|
||||||
},
|
|
||||||
"parseurl": {
|
|
||||||
"version": "1.3.3",
|
|
||||||
"resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.3.tgz",
|
|
||||||
"integrity": "sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ=="
|
|
||||||
},
|
|
||||||
"path-to-regexp": {
|
|
||||||
"version": "0.1.7",
|
|
||||||
"resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.7.tgz",
|
|
||||||
"integrity": "sha1-32BBeABfUi8V60SQ5yR6G/qmf4w="
|
|
||||||
},
|
|
||||||
"pg": {
|
|
||||||
"version": "7.18.1",
|
|
||||||
"resolved": "https://registry.npmjs.org/pg/-/pg-7.18.1.tgz",
|
|
||||||
"integrity": "sha512-1KtKBKg/zWrjEEv//klBbVOPGucuc7HHeJf6OEMueVcUeyF3yueHf+DvhVwBjIAe9/97RAydO/lWjkcMwssuEw==",
|
|
||||||
"requires": {
|
|
||||||
"buffer-writer": "2.0.0",
|
|
||||||
"packet-reader": "1.0.0",
|
|
||||||
"pg-connection-string": "0.1.3",
|
|
||||||
"pg-packet-stream": "^1.1.0",
|
|
||||||
"pg-pool": "^2.0.10",
|
|
||||||
"pg-types": "^2.1.0",
|
|
||||||
"pgpass": "1.x",
|
|
||||||
"semver": "4.3.2"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"pg-connection-string": {
|
|
||||||
"version": "0.1.3",
|
|
||||||
"resolved": "https://registry.npmjs.org/pg-connection-string/-/pg-connection-string-0.1.3.tgz",
|
|
||||||
"integrity": "sha1-2hhHsglA5C7hSSvq9l1J2RskXfc="
|
|
||||||
},
|
|
||||||
"pg-int8": {
|
|
||||||
"version": "1.0.1",
|
|
||||||
"resolved": "https://registry.npmjs.org/pg-int8/-/pg-int8-1.0.1.tgz",
|
|
||||||
"integrity": "sha512-WCtabS6t3c8SkpDBUlb1kjOs7l66xsGdKpIPZsg4wR+B3+u9UAum2odSsF9tnvxg80h4ZxLWMy4pRjOsFIqQpw=="
|
|
||||||
},
|
|
||||||
"pg-packet-stream": {
|
|
||||||
"version": "1.1.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/pg-packet-stream/-/pg-packet-stream-1.1.0.tgz",
|
|
||||||
"integrity": "sha512-kRBH0tDIW/8lfnnOyTwKD23ygJ/kexQVXZs7gEyBljw4FYqimZFxnMMx50ndZ8In77QgfGuItS5LLclC2TtjYg=="
|
|
||||||
},
|
|
||||||
"pg-pool": {
|
|
||||||
"version": "2.0.10",
|
|
||||||
"resolved": "https://registry.npmjs.org/pg-pool/-/pg-pool-2.0.10.tgz",
|
|
||||||
"integrity": "sha512-qdwzY92bHf3nwzIUcj+zJ0Qo5lpG/YxchahxIN8+ZVmXqkahKXsnl2aiJPHLYN9o5mB/leG+Xh6XKxtP7e0sjg=="
|
|
||||||
},
|
|
||||||
"pg-types": {
|
|
||||||
"version": "2.2.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/pg-types/-/pg-types-2.2.0.tgz",
|
|
||||||
"integrity": "sha512-qTAAlrEsl8s4OiEQY69wDvcMIdQN6wdz5ojQiOy6YRMuynxenON0O5oCpJI6lshc6scgAY8qvJ2On/p+CXY0GA==",
|
|
||||||
"requires": {
|
|
||||||
"pg-int8": "1.0.1",
|
|
||||||
"postgres-array": "~2.0.0",
|
|
||||||
"postgres-bytea": "~1.0.0",
|
|
||||||
"postgres-date": "~1.0.4",
|
|
||||||
"postgres-interval": "^1.1.0"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"pgpass": {
|
|
||||||
"version": "1.0.2",
|
|
||||||
"resolved": "https://registry.npmjs.org/pgpass/-/pgpass-1.0.2.tgz",
|
|
||||||
"integrity": "sha1-Knu0G2BltnkH6R2hsHwYR8h3swY=",
|
|
||||||
"requires": {
|
|
||||||
"split": "^1.0.0"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"postgres-array": {
|
|
||||||
"version": "2.0.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/postgres-array/-/postgres-array-2.0.0.tgz",
|
|
||||||
"integrity": "sha512-VpZrUqU5A69eQyW2c5CA1jtLecCsN2U/bD6VilrFDWq5+5UIEVO7nazS3TEcHf1zuPYO/sqGvUvW62g86RXZuA=="
|
|
||||||
},
|
|
||||||
"postgres-bytea": {
|
|
||||||
"version": "1.0.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/postgres-bytea/-/postgres-bytea-1.0.0.tgz",
|
|
||||||
"integrity": "sha1-AntTPAqokOJtFy1Hz5zOzFIazTU="
|
|
||||||
},
|
|
||||||
"postgres-date": {
|
|
||||||
"version": "1.0.4",
|
|
||||||
"resolved": "https://registry.npmjs.org/postgres-date/-/postgres-date-1.0.4.tgz",
|
|
||||||
"integrity": "sha512-bESRvKVuTrjoBluEcpv2346+6kgB7UlnqWZsnbnCccTNq/pqfj1j6oBaN5+b/NrDXepYUT/HKadqv3iS9lJuVA=="
|
|
||||||
},
|
|
||||||
"postgres-interval": {
|
|
||||||
"version": "1.2.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/postgres-interval/-/postgres-interval-1.2.0.tgz",
|
|
||||||
"integrity": "sha512-9ZhXKM/rw350N1ovuWHbGxnGh/SNJ4cnxHiM0rxE4VN41wsg8P8zWn9hv/buK00RP4WvlOyr/RBDiptyxVbkZQ==",
|
|
||||||
"requires": {
|
|
||||||
"xtend": "^4.0.0"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"proxy-addr": {
|
|
||||||
"version": "2.0.5",
|
|
||||||
"resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.5.tgz",
|
|
||||||
"integrity": "sha512-t/7RxHXPH6cJtP0pRG6smSr9QJidhB+3kXu0KgXnbGYMgzEnUxRQ4/LDdfOwZEMyIh3/xHb8PX3t+lfL9z+YVQ==",
|
|
||||||
"requires": {
|
|
||||||
"forwarded": "~0.1.2",
|
|
||||||
"ipaddr.js": "1.9.0"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"qs": {
|
|
||||||
"version": "6.7.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/qs/-/qs-6.7.0.tgz",
|
|
||||||
"integrity": "sha512-VCdBRNFTX1fyE7Nb6FYoURo/SPe62QCaAyzJvUjwRaIsc+NePBEniHlvxFmmX56+HZphIGtV0XeCirBtpDrTyQ=="
|
|
||||||
},
|
|
||||||
"range-parser": {
|
|
||||||
"version": "1.2.1",
|
|
||||||
"resolved": "https://registry.npmjs.org/range-parser/-/range-parser-1.2.1.tgz",
|
|
||||||
"integrity": "sha512-Hrgsx+orqoygnmhFbKaHE6c296J+HTAQXoxEF6gNupROmmGJRoyzfG3ccAveqCBrwr/2yxQ5BVd/GTl5agOwSg=="
|
|
||||||
},
|
|
||||||
"raw-body": {
|
|
||||||
"version": "2.4.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/raw-body/-/raw-body-2.4.0.tgz",
|
|
||||||
"integrity": "sha512-4Oz8DUIwdvoa5qMJelxipzi/iJIi40O5cGV1wNYp5hvZP8ZN0T+jiNkL0QepXs+EsQ9XJ8ipEDoiH70ySUJP3Q==",
|
|
||||||
"requires": {
|
|
||||||
"bytes": "3.1.0",
|
|
||||||
"http-errors": "1.7.2",
|
|
||||||
"iconv-lite": "0.4.24",
|
|
||||||
"unpipe": "1.0.0"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"safe-buffer": {
|
|
||||||
"version": "5.1.2",
|
|
||||||
"resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz",
|
|
||||||
"integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g=="
|
|
||||||
},
|
|
||||||
"safer-buffer": {
|
|
||||||
"version": "2.1.2",
|
|
||||||
"resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz",
|
|
||||||
"integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg=="
|
|
||||||
},
|
|
||||||
"semver": {
|
|
||||||
"version": "4.3.2",
|
|
||||||
"resolved": "https://registry.npmjs.org/semver/-/semver-4.3.2.tgz",
|
|
||||||
"integrity": "sha1-x6BxWKgL7dBSNVt3DYLWZA+AO+c="
|
|
||||||
},
|
|
||||||
"send": {
|
|
||||||
"version": "0.17.1",
|
|
||||||
"resolved": "https://registry.npmjs.org/send/-/send-0.17.1.tgz",
|
|
||||||
"integrity": "sha512-BsVKsiGcQMFwT8UxypobUKyv7irCNRHk1T0G680vk88yf6LBByGcZJOTJCrTP2xVN6yI+XjPJcNuE3V4fT9sAg==",
|
|
||||||
"requires": {
|
|
||||||
"debug": "2.6.9",
|
|
||||||
"depd": "~1.1.2",
|
|
||||||
"destroy": "~1.0.4",
|
|
||||||
"encodeurl": "~1.0.2",
|
|
||||||
"escape-html": "~1.0.3",
|
|
||||||
"etag": "~1.8.1",
|
|
||||||
"fresh": "0.5.2",
|
|
||||||
"http-errors": "~1.7.2",
|
|
||||||
"mime": "1.6.0",
|
|
||||||
"ms": "2.1.1",
|
|
||||||
"on-finished": "~2.3.0",
|
|
||||||
"range-parser": "~1.2.1",
|
|
||||||
"statuses": "~1.5.0"
|
|
||||||
},
|
|
||||||
"dependencies": {
|
|
||||||
"ms": {
|
|
||||||
"version": "2.1.1",
|
|
||||||
"resolved": "https://registry.npmjs.org/ms/-/ms-2.1.1.tgz",
|
|
||||||
"integrity": "sha512-tgp+dl5cGk28utYktBsrFqA7HKgrhgPsg6Z/EfhWI4gl1Hwq8B/GmY/0oXZ6nF8hDVesS/FpnYaD/kOWhYQvyg=="
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"serve-static": {
|
|
||||||
"version": "1.14.1",
|
|
||||||
"resolved": "https://registry.npmjs.org/serve-static/-/serve-static-1.14.1.tgz",
|
|
||||||
"integrity": "sha512-JMrvUwE54emCYWlTI+hGrGv5I8dEwmco/00EvkzIIsR7MqrHonbD9pO2MOfFnpFntl7ecpZs+3mW+XbQZu9QCg==",
|
|
||||||
"requires": {
|
|
||||||
"encodeurl": "~1.0.2",
|
|
||||||
"escape-html": "~1.0.3",
|
|
||||||
"parseurl": "~1.3.3",
|
|
||||||
"send": "0.17.1"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"setprototypeof": {
|
|
||||||
"version": "1.1.1",
|
|
||||||
"resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.1.1.tgz",
|
|
||||||
"integrity": "sha512-JvdAWfbXeIGaZ9cILp38HntZSFSo3mWg6xGcJJsd+d4aRMOqauag1C63dJfDw7OaMYwEbHMOxEZ1lqVRYP2OAw=="
|
|
||||||
},
|
|
||||||
"split": {
|
|
||||||
"version": "1.0.1",
|
|
||||||
"resolved": "https://registry.npmjs.org/split/-/split-1.0.1.tgz",
|
|
||||||
"integrity": "sha512-mTyOoPbrivtXnwnIxZRFYRrPNtEFKlpB2fvjSnCQUiAA6qAZzqwna5envK4uk6OIeP17CsdF3rSBGYVBsU0Tkg==",
|
|
||||||
"requires": {
|
|
||||||
"through": "2"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"statuses": {
|
|
||||||
"version": "1.5.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/statuses/-/statuses-1.5.0.tgz",
|
|
||||||
"integrity": "sha1-Fhx9rBd2Wf2YEfQ3cfqZOBR4Yow="
|
|
||||||
},
|
|
||||||
"through": {
|
|
||||||
"version": "2.3.8",
|
|
||||||
"resolved": "https://registry.npmjs.org/through/-/through-2.3.8.tgz",
|
|
||||||
"integrity": "sha1-DdTJ/6q8NXlgsbckEV1+Doai4fU="
|
|
||||||
},
|
|
||||||
"toidentifier": {
|
|
||||||
"version": "1.0.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/toidentifier/-/toidentifier-1.0.0.tgz",
|
|
||||||
"integrity": "sha512-yaOH/Pk/VEhBWWTlhI+qXxDFXlejDGcQipMlyxda9nthulaxLZUNcUqFxokp0vcYnvteJln5FNQDRrxj3YcbVw=="
|
|
||||||
},
|
|
||||||
"type-is": {
|
|
||||||
"version": "1.6.18",
|
|
||||||
"resolved": "https://registry.npmjs.org/type-is/-/type-is-1.6.18.tgz",
|
|
||||||
"integrity": "sha512-TkRKr9sUTxEH8MdfuCSP7VizJyzRNMjj2J2do2Jr3Kym598JVdEksuzPQCnlFPW4ky9Q+iA+ma9BGm06XQBy8g==",
|
|
||||||
"requires": {
|
|
||||||
"media-typer": "0.3.0",
|
|
||||||
"mime-types": "~2.1.24"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"unpipe": {
|
|
||||||
"version": "1.0.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz",
|
|
||||||
"integrity": "sha1-sr9O6FFKrmFltIF4KdIbLvSZBOw="
|
|
||||||
},
|
|
||||||
"utils-merge": {
|
|
||||||
"version": "1.0.1",
|
|
||||||
"resolved": "https://registry.npmjs.org/utils-merge/-/utils-merge-1.0.1.tgz",
|
|
||||||
"integrity": "sha1-n5VxD1CiZ5R7LMwSR0HBAoQn5xM="
|
|
||||||
},
|
|
||||||
"vary": {
|
|
||||||
"version": "1.1.2",
|
|
||||||
"resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz",
|
|
||||||
"integrity": "sha1-IpnwLG3tMNSllhsLn3RSShj2NPw="
|
|
||||||
},
|
|
||||||
"xtend": {
|
|
||||||
"version": "4.0.2",
|
|
||||||
"resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.2.tgz",
|
|
||||||
"integrity": "sha512-LKYU1iAXJXUgAXn9URjiu+MWhyUXHsvfp7mcuYm9dSUKK0/CjtrUwFAxD82/mCWbtLsGjFIad0wIsod4zrTAEQ=="
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -10,7 +10,7 @@
|
|||||||
"license": "ISC",
|
"license": "ISC",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"dotenv": "^6.2.0",
|
"dotenv": "^6.2.0",
|
||||||
"express": "^4.17.1",
|
"express": "^4.16.4",
|
||||||
"pg": "^7.18.1"
|
"pg": "^7.8.0"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,131 +0,0 @@
|
|||||||
DROP TABLE IF EXISTS rlarp.osm_pool;
|
|
||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS rlarp.osm_pool AS (
|
|
||||||
WITH
|
|
||||||
repc AS (
|
|
||||||
SELECT
|
|
||||||
LTRIM(RTRIM(C.A9)) RCODE
|
|
||||||
,C.A30 REPP
|
|
||||||
,COALESCE(Q.DIR,'Other') DIRECTOR
|
|
||||||
FROM
|
|
||||||
LGDAT.CODE C
|
|
||||||
LEFT OUTER JOIN RLARP.QRH Q ON
|
|
||||||
Q.QR = LTRIM(RTRIM(C.A9))
|
|
||||||
WHERE
|
|
||||||
C.A2 = 'MM'
|
|
||||||
)
|
|
||||||
,SEG AS (
|
|
||||||
SELECT
|
|
||||||
GLEC
|
|
||||||
,SEGM
|
|
||||||
FROM
|
|
||||||
(
|
|
||||||
VALUES
|
|
||||||
('1CU','Retail'),
|
|
||||||
('1GR','Greenhouse'),
|
|
||||||
('1NU','Nursery'),
|
|
||||||
('1RE','Retail'),
|
|
||||||
('2WI','Greenhouse'),
|
|
||||||
('3BM','Other'),
|
|
||||||
('3CO','Other'),
|
|
||||||
('3PE','Other'),
|
|
||||||
('3PP','Other'),
|
|
||||||
('4CO','Other'),
|
|
||||||
('4RA','Other'),
|
|
||||||
('9MI','Other'),
|
|
||||||
('9SA','Other'),
|
|
||||||
('9TO','Other')
|
|
||||||
) X(GLEC, SEGM)
|
|
||||||
)
|
|
||||||
----------------------------------------------------sales major codes----------------------------------------------------------------------------------------------------------------------------------
|
|
||||||
,SJ AS (
|
|
||||||
SELECT * FROM LGDAT.MMSL WHERE COALESCE(BSMNCD,'') = ''
|
|
||||||
)
|
|
||||||
----------------------------------------------------sales minor codes----------------------------------------------------------------------------------------------------------------------------------
|
|
||||||
,SI AS (
|
|
||||||
SELECT * FROM LGDAT.MMSL WHERE COALESCE(BSMNCD,'') <> ''
|
|
||||||
)
|
|
||||||
SELECT
|
|
||||||
fspr
|
|
||||||
,plnt
|
|
||||||
,promo
|
|
||||||
,terms
|
|
||||||
,bill_cust||' - '||bc.bvname bill_custd
|
|
||||||
,ship_cust||' - '||sc.bvname ship_custd
|
|
||||||
,dsm
|
|
||||||
,coalesce(repc.repp,dsm) dsmd
|
|
||||||
,repc.director
|
|
||||||
,account bill_dba
|
|
||||||
,shipgrp ship_dba
|
|
||||||
,chan
|
|
||||||
,chansub
|
|
||||||
,CASE seg.segm
|
|
||||||
WHEN 'Retail' THEN
|
|
||||||
CASE o.bill_class
|
|
||||||
WHEN 'RMAS' THEN 'MASS'
|
|
||||||
WHEN 'RNAT' THEN 'NATIONAL'
|
|
||||||
ELSE 'OTHER'
|
|
||||||
END
|
|
||||||
ELSE o.chan
|
|
||||||
END chan_retail
|
|
||||||
,part
|
|
||||||
,part||coalesce(' - '||i.descr,'') partd
|
|
||||||
,stlcd partgroup
|
|
||||||
,brnd
|
|
||||||
,o.majg||' - '||i.majgd majgd
|
|
||||||
,o.ming||' - '||i.mingd mingd
|
|
||||||
,o.majs||' - '||i.majsd majsd
|
|
||||||
,o.mins||' - '||i.minsd minsd
|
|
||||||
,seg.segm
|
|
||||||
,fs_line
|
|
||||||
,r_currency
|
|
||||||
,r_rate
|
|
||||||
,c_currency
|
|
||||||
,c_rate
|
|
||||||
,fb_qty
|
|
||||||
,fb_val_loc
|
|
||||||
,fb_val_loc * r_rate value_usd
|
|
||||||
,fb_cst_loc
|
|
||||||
,fb_cst_loc * c_rate cost_usd
|
|
||||||
,calc_status
|
|
||||||
,flag
|
|
||||||
,o.odate
|
|
||||||
,to_char(CASE WHEN extract(month FROM o.odate) > 6 THEN -5 ELSE 7 END + extract(month FROM o.odate),'FM00')||' - '||to_char(o.odate,'TMMon') omonth
|
|
||||||
,oseas
|
|
||||||
,rdate
|
|
||||||
,to_char(CASE WHEN extract(month FROM o.rdate) > 6 THEN -5 ELSE 7 END + extract(month FROM o.rdate),'FM00')||' - '||to_char(o.rdate,'TMMon') rmonth
|
|
||||||
,rseas
|
|
||||||
,sdate
|
|
||||||
,to_char(CASE WHEN extract(month FROM o.sdate) > 6 THEN -5 ELSE 7 END + extract(month FROM o.sdate),'FM00')||' - '||to_char(o.sdate,'TMMon') smonth
|
|
||||||
,sseas
|
|
||||||
,version
|
|
||||||
,iter
|
|
||||||
,null::int logid
|
|
||||||
,null::text "comment"
|
|
||||||
,null::text iterdet
|
|
||||||
FROM
|
|
||||||
rlarp.osmf_dev o
|
|
||||||
LEFT OUTER JOIN lgdat.cust bc ON
|
|
||||||
bc.bvcust = o.bill_cust
|
|
||||||
LEFT OUTER JOIN lgdat.cust sc ON
|
|
||||||
sc.bvcust = o.ship_cust
|
|
||||||
LEFT OUTER JOIN repc ON
|
|
||||||
repc.rcode = o.dsm
|
|
||||||
/*
|
|
||||||
LEFT OUTER JOIN lgdat.majg ON
|
|
||||||
bqgrp = o.majg
|
|
||||||
LEFT OUTER JOIN lgdat.mmgp ON
|
|
||||||
brmgrp = o.ming
|
|
||||||
AND BRGRP = o.majg
|
|
||||||
LEFT OUTER JOIN si ON
|
|
||||||
si.bsmjcd = o.majs
|
|
||||||
AND si.bsmncd = o.mins
|
|
||||||
LEFT OUTER JOIN sj ON
|
|
||||||
sj.bsmjcd = o.majs
|
|
||||||
*/
|
|
||||||
LEFT OUTER JOIN seg ON
|
|
||||||
seg.glec = o.glec
|
|
||||||
LEFT OUTER JOIN rlarp.itemm i ON
|
|
||||||
i.item = o.part
|
|
||||||
--LIMIT 100
|
|
||||||
) WITH DATA;
|
|
@ -1,572 +0,0 @@
|
|||||||
--\timing
|
|
||||||
truncate table rlarp.osmf_dev;
|
|
||||||
|
|
||||||
WITH
|
|
||||||
gld AS (
|
|
||||||
SELECT
|
|
||||||
N1COMP COMP
|
|
||||||
,N1CCYY FSYR
|
|
||||||
,KPMAXP PERDS
|
|
||||||
,N1FSPP PERD
|
|
||||||
,to_char(N1FSYP,'FM0000') FSPR
|
|
||||||
,N1SD01 SDAT
|
|
||||||
,N1ED01 EDAT
|
|
||||||
,to_char(N1ED01,'yymm') CAPR
|
|
||||||
,N1ED01 - N1SD01 +1 NDAYS
|
|
||||||
,CASE WHEN EXTRACT(MONTH FROM N1ED01) >= 6 THEN EXTRACT(YEAR FROM N1ED01) + 1 ELSE EXTRACT(YEAR FROM N1ED01) END SSYR
|
|
||||||
,to_char(CASE WHEN EXTRACT(MONTH FROM N1ED01) >= 6 THEN EXTRACT(MONTH FROM N1ED01) -5 ELSE EXTRACT(MONTH FROM N1ED01) +7 END,'00') SSPR
|
|
||||||
FROM
|
|
||||||
LGDAT.GLDATREF
|
|
||||||
INNER JOIN LGDAT.GLDATE ON
|
|
||||||
KPCOMP = N1COMP AND
|
|
||||||
KPCCYY = N1CCYY
|
|
||||||
WHERE
|
|
||||||
N1COMP = 93
|
|
||||||
--AND DIGITS(N1FSYP) = '1901'
|
|
||||||
)
|
|
||||||
--SELECT * FROM gld
|
|
||||||
,baseline AS (
|
|
||||||
SELECT
|
|
||||||
-----------documents-------------
|
|
||||||
null::int "ddord#"
|
|
||||||
,null::int "dditm#"
|
|
||||||
,null::int "fgbol#"
|
|
||||||
,null::int "fgent#"
|
|
||||||
,null::int "diinv#"
|
|
||||||
,null::int "dilin#"
|
|
||||||
,null::int quoten
|
|
||||||
,null::int quotel
|
|
||||||
----------dates/status------------------
|
|
||||||
,o.odate dcodat
|
|
||||||
,o.rdate ddqdat
|
|
||||||
,null::date dcmdat
|
|
||||||
,null::date fesdat
|
|
||||||
,greatest(least(o.sdate,gld.edat),gld.sdat) dhidat
|
|
||||||
,null::text fesind
|
|
||||||
,null::text dhpost
|
|
||||||
,o.fspr
|
|
||||||
-----------measures--------------------
|
|
||||||
,null::numeric ddqtoi
|
|
||||||
,null::numeric ddqtsi
|
|
||||||
,null::numeric fgqshp
|
|
||||||
,null::numeric diqtsh
|
|
||||||
,null::numeric diext
|
|
||||||
,null::numeric ditdis
|
|
||||||
,null::jsonb discj
|
|
||||||
,null::text dhincr
|
|
||||||
,plnt
|
|
||||||
,o.promo
|
|
||||||
,null::text return_reas
|
|
||||||
,o.terms
|
|
||||||
,null::text custpo
|
|
||||||
,null::text remit_to
|
|
||||||
,null::text bill_class
|
|
||||||
,o.bill_cust
|
|
||||||
,null::text bill_rep
|
|
||||||
,null::text bill_terr
|
|
||||||
,null::text ship_class
|
|
||||||
,ship_cust
|
|
||||||
,null::text ship_rep
|
|
||||||
,null::text ship_terr
|
|
||||||
,null::text dsm
|
|
||||||
,null::text account
|
|
||||||
,null::text shipgrp
|
|
||||||
,null::text geo
|
|
||||||
,null::text chan
|
|
||||||
,null::text chansub
|
|
||||||
,null::text orig_ctry
|
|
||||||
,null::text orig_prov
|
|
||||||
,null::text orig_post
|
|
||||||
,null::text bill_ctry
|
|
||||||
,null::text bill_prov
|
|
||||||
,null::text bill_post
|
|
||||||
,null::text dest_ctry
|
|
||||||
,null::text dest_prov
|
|
||||||
,null::text dest_post
|
|
||||||
,o.part
|
|
||||||
,null::text styc
|
|
||||||
,null::text colc
|
|
||||||
,null::text colgrp
|
|
||||||
,null::text coltier
|
|
||||||
,null::text colstat
|
|
||||||
,null::text sizc
|
|
||||||
,null::text pckg
|
|
||||||
,null::text kit
|
|
||||||
,null::text brnd
|
|
||||||
,null::text majg
|
|
||||||
,null::text ming
|
|
||||||
,null::text majs
|
|
||||||
,null::text mins
|
|
||||||
,null::text gldco
|
|
||||||
,null::text gldc
|
|
||||||
,null::text glec
|
|
||||||
,null::text harm
|
|
||||||
,null::text clss
|
|
||||||
,null::text brand
|
|
||||||
,null::text assc
|
|
||||||
,null::text ddunit
|
|
||||||
,null::text unti
|
|
||||||
,null::numeric lbs
|
|
||||||
,null::numeric plt
|
|
||||||
,null::text plcd
|
|
||||||
,o.fs_line
|
|
||||||
,o.r_currency
|
|
||||||
,null::numeric r_rate
|
|
||||||
,o.c_currency
|
|
||||||
,null::numeric c_rate
|
|
||||||
,sum(o.fb_qty) fb_qty
|
|
||||||
,sum(o.fb_val_loc) fb_val_loc
|
|
||||||
,sum(o.fb_val_loc_dis) fb_val_loc_dis
|
|
||||||
,sum(o.fb_val_loc_qt) fb_val_loc_qt
|
|
||||||
,sum(o.fb_val_loc_pl) fb_val_loc_pl
|
|
||||||
,sum(o.fb_val_loc_tar) fb_val_loc_tar
|
|
||||||
,sum(o.fb_cst_loc) fb_cst_loc
|
|
||||||
,sum(o.fb_cst_loc_cur) fb_cst_loc_cur
|
|
||||||
,sum(o.fb_cst_loc_fut) fb_cst_loc_fut
|
|
||||||
,o.calc_status
|
|
||||||
,o.flag
|
|
||||||
,o.odate
|
|
||||||
,o.oseas
|
|
||||||
,o.rdate
|
|
||||||
,o.rseas
|
|
||||||
-----when null, greatest/least is just going to act like coalesce
|
|
||||||
,greatest(least(o.sdate,gld.edat),gld.sdat) sdate
|
|
||||||
,ss.ssyr sseas
|
|
||||||
,'15mo' "version"
|
|
||||||
,'actuals' iter
|
|
||||||
FROM
|
|
||||||
rlarp.osm_dev o
|
|
||||||
--snap the ship dates of the historic fiscal period
|
|
||||||
LEFT OUTER JOIN gld ON
|
|
||||||
gld.fspr = o.fspr
|
|
||||||
--get the shipping season for open orders based on the snapped date
|
|
||||||
LEFT OUTER JOIN gld ss ON
|
|
||||||
greatest(least(o.sdate,gld.edat),gld.sdat) BETWEEN ss.sdat AND ss.edat
|
|
||||||
WHERE
|
|
||||||
(
|
|
||||||
o.odate BETWEEN '2019-06-01' AND '2019-01-31'
|
|
||||||
OR (o.calc_status IN ('OPEN','BACKORDER') and o.odate < '2020-02-01')
|
|
||||||
OR o.fspr BETWEEN '2001' AND '2008'
|
|
||||||
)
|
|
||||||
AND fs_line = '41010'
|
|
||||||
AND calc_status <> 'CANCELED'
|
|
||||||
GROUP BY
|
|
||||||
o.fspr
|
|
||||||
,plnt
|
|
||||||
,o.promo
|
|
||||||
,o.terms
|
|
||||||
,o.bill_cust
|
|
||||||
,ship_cust
|
|
||||||
,o.part
|
|
||||||
,o.fs_line
|
|
||||||
,o.r_currency
|
|
||||||
,o.c_currency
|
|
||||||
,o.calc_status
|
|
||||||
,o.flag
|
|
||||||
,o.odate
|
|
||||||
,o.oseas
|
|
||||||
,o.rdate
|
|
||||||
,o.rseas
|
|
||||||
,greatest(least(o.sdate,gld.edat),gld.sdat)
|
|
||||||
,ss.ssyr
|
|
||||||
UNION ALL
|
|
||||||
SELECT
|
|
||||||
-----------documents-------------
|
|
||||||
null::int "ddord#"
|
|
||||||
,null::int "dditm#"
|
|
||||||
,null::int "fgbol#"
|
|
||||||
,null::int "fgent#"
|
|
||||||
,null::int "diinv#"
|
|
||||||
,null::int "dilin#"
|
|
||||||
,null::int quoten
|
|
||||||
,null::int quotel
|
|
||||||
----------dates/status------------------
|
|
||||||
,o.odate + interval '1 year' dcodat
|
|
||||||
,o.rdate + interval '1 year' ddqdat
|
|
||||||
,null::date dcmdat
|
|
||||||
,null::date fesdat
|
|
||||||
,greatest(least(o.sdate,gld.edat),gld.sdat) + interval '1 year' dhidat
|
|
||||||
,null::text fesind
|
|
||||||
,null::text dhpost
|
|
||||||
,o.fspr
|
|
||||||
-----------measures--------------------
|
|
||||||
,null::numeric ddqtoi
|
|
||||||
,null::numeric ddqtsi
|
|
||||||
,null::numeric fgqshp
|
|
||||||
,null::numeric diqtsh
|
|
||||||
,null::numeric diext
|
|
||||||
,null::numeric ditdis
|
|
||||||
,null::jsonb discj
|
|
||||||
,null::text dhincr
|
|
||||||
,plnt
|
|
||||||
,o.promo
|
|
||||||
,null::text return_reas
|
|
||||||
,o.terms
|
|
||||||
,null::text custpo
|
|
||||||
,null::text remit_to
|
|
||||||
,null::text bill_class
|
|
||||||
,o.bill_cust
|
|
||||||
,null::text bill_rep
|
|
||||||
,null::text bill_terr
|
|
||||||
,null::text ship_class
|
|
||||||
,ship_cust
|
|
||||||
,null::text ship_rep
|
|
||||||
,null::text ship_terr
|
|
||||||
,null::text dsm
|
|
||||||
,null::text account
|
|
||||||
,null::text shipgrp
|
|
||||||
,null::text geo
|
|
||||||
,null::text chan
|
|
||||||
,null::text chansub
|
|
||||||
,null::text orig_ctry
|
|
||||||
,null::text orig_prov
|
|
||||||
,null::text orig_post
|
|
||||||
,null::text bill_ctry
|
|
||||||
,null::text bill_prov
|
|
||||||
,null::text bill_post
|
|
||||||
,null::text dest_ctry
|
|
||||||
,null::text dest_prov
|
|
||||||
,null::text dest_post
|
|
||||||
,o.part
|
|
||||||
,null::text styc
|
|
||||||
,null::text colc
|
|
||||||
,null::text colgrp
|
|
||||||
,null::text coltier
|
|
||||||
,null::text colstat
|
|
||||||
,null::text sizc
|
|
||||||
,null::text pckg
|
|
||||||
,null::text kit
|
|
||||||
,null::text brnd
|
|
||||||
,null::text majg
|
|
||||||
,null::text ming
|
|
||||||
,null::text majs
|
|
||||||
,null::text mins
|
|
||||||
,null::text gldco
|
|
||||||
,null::text gldc
|
|
||||||
,null::text glec
|
|
||||||
,null::text harm
|
|
||||||
,null::text clss
|
|
||||||
,null::text brand
|
|
||||||
,null::text assc
|
|
||||||
,null::text ddunit
|
|
||||||
,null::text unti
|
|
||||||
,null::numeric lbs
|
|
||||||
,null::numeric plt
|
|
||||||
,null::text plcd
|
|
||||||
,o.fs_line
|
|
||||||
,o.r_currency
|
|
||||||
,null::numeric r_rate
|
|
||||||
,o.c_currency
|
|
||||||
,null::numeric c_rate
|
|
||||||
,sum(o.fb_qty) fb_qty
|
|
||||||
,sum(o.fb_val_loc) fb_val_loc
|
|
||||||
,sum(o.fb_val_loc_dis) fb_val_loc_dis
|
|
||||||
,sum(o.fb_val_loc_qt) fb_val_loc_qt
|
|
||||||
,sum(o.fb_val_loc_pl) fb_val_loc_pl
|
|
||||||
,sum(o.fb_val_loc_tar) fb_val_loc_tar
|
|
||||||
,sum(o.fb_cst_loc) fb_cst_loc
|
|
||||||
,sum(o.fb_cst_loc_cur) fb_cst_loc_cur
|
|
||||||
,sum(o.fb_cst_loc_fut) fb_cst_loc_fut
|
|
||||||
,o.calc_status
|
|
||||||
,o.flag
|
|
||||||
,o.odate + interval '1 year' odate
|
|
||||||
,o.oseas + 1 rseas
|
|
||||||
,o.rdate + interval '1 year' rdate
|
|
||||||
,o.rseas + 1 rseas
|
|
||||||
-----when null, greatest/least is just going to act like coalesce
|
|
||||||
,greatest(least(o.sdate,gld.edat),gld.sdat) + interval '1 year' sdate
|
|
||||||
,ss.ssyr sseas
|
|
||||||
,'actuals' "version"
|
|
||||||
,'actuals_plug' iter
|
|
||||||
FROM
|
|
||||||
rlarp.osm_dev o
|
|
||||||
LEFT OUTER JOIN gld ON
|
|
||||||
gld.fspr = o.fspr
|
|
||||||
LEFT OUTER JOIN gld ss ON
|
|
||||||
greatest(least(o.sdate,gld.edat),gld.sdat) + interval '1 year' BETWEEN ss.sdat AND ss.edat
|
|
||||||
WHERE
|
|
||||||
o.odate BETWEEN '2019-02-01' AND '2019-05-31'
|
|
||||||
AND fs_line = '41010'
|
|
||||||
AND calc_status <> 'CANCELED'
|
|
||||||
------exclude actuals for now and use forecast to get the plug for the rest of the year
|
|
||||||
AND false
|
|
||||||
GROUP BY
|
|
||||||
o.fspr
|
|
||||||
,plnt
|
|
||||||
,o.promo
|
|
||||||
,o.terms
|
|
||||||
,o.bill_cust
|
|
||||||
,ship_cust
|
|
||||||
,o.part
|
|
||||||
,o.fs_line
|
|
||||||
,o.r_currency
|
|
||||||
,o.c_currency
|
|
||||||
,o.calc_status
|
|
||||||
,o.flag
|
|
||||||
,o.odate
|
|
||||||
,o.oseas
|
|
||||||
,o.rdate
|
|
||||||
,o.rseas
|
|
||||||
,greatest(least(o.sdate,gld.edat),gld.sdat)
|
|
||||||
,ss.ssyr
|
|
||||||
UNION ALL
|
|
||||||
SELECT
|
|
||||||
-----------documents-------------
|
|
||||||
null::int "ddord#"
|
|
||||||
,null::int "dditm#"
|
|
||||||
,null::int "fgbol#"
|
|
||||||
,null::int "fgent#"
|
|
||||||
,null::int "diinv#"
|
|
||||||
,null::int "dilin#"
|
|
||||||
,null::int quoten
|
|
||||||
,null::int quotel
|
|
||||||
----------dates/status------------------
|
|
||||||
,o.odate + interval '1 year' dcodat
|
|
||||||
,o.rdate + interval '1 year' ddqdat
|
|
||||||
,null::date dcmdat
|
|
||||||
,null::date fesdat
|
|
||||||
,greatest(least(o.sdate,gld.edat),gld.sdat) + interval '1 year' dhidat
|
|
||||||
,null::text fesind
|
|
||||||
,null::text dhpost
|
|
||||||
,o.fspr
|
|
||||||
-----------measures--------------------
|
|
||||||
,null::numeric ddqtoi
|
|
||||||
,null::numeric ddqtsi
|
|
||||||
,null::numeric fgqshp
|
|
||||||
,null::numeric diqtsh
|
|
||||||
,null::numeric diext
|
|
||||||
,null::numeric ditdis
|
|
||||||
,null::jsonb discj
|
|
||||||
,null::text dhincr
|
|
||||||
,plnt
|
|
||||||
,o.promo
|
|
||||||
,null::text return_reas
|
|
||||||
,o.terms
|
|
||||||
,null::text custpo
|
|
||||||
,null::text remit_to
|
|
||||||
,null::text bill_class
|
|
||||||
,o.bill_cust
|
|
||||||
,null::text bill_rep
|
|
||||||
,null::text bill_terr
|
|
||||||
,null::text ship_class
|
|
||||||
,ship_cust
|
|
||||||
,null::text ship_rep
|
|
||||||
,null::text ship_terr
|
|
||||||
,null::text dsm
|
|
||||||
,null::text account
|
|
||||||
,null::text shipgrp
|
|
||||||
,null::text geo
|
|
||||||
,null::text chan
|
|
||||||
,null::text chansub
|
|
||||||
,null::text orig_ctry
|
|
||||||
,null::text orig_prov
|
|
||||||
,null::text orig_post
|
|
||||||
,null::text bill_ctry
|
|
||||||
,null::text bill_prov
|
|
||||||
,null::text bill_post
|
|
||||||
,null::text dest_ctry
|
|
||||||
,null::text dest_prov
|
|
||||||
,null::text dest_post
|
|
||||||
,o.part
|
|
||||||
,null::text styc
|
|
||||||
,null::text colc
|
|
||||||
,null::text colgrp
|
|
||||||
,null::text coltier
|
|
||||||
,null::text colstat
|
|
||||||
,null::text sizc
|
|
||||||
,null::text pckg
|
|
||||||
,null::text kit
|
|
||||||
,null::text brnd
|
|
||||||
,null::text majg
|
|
||||||
,null::text ming
|
|
||||||
,null::text majs
|
|
||||||
,null::text mins
|
|
||||||
,null::text gldco
|
|
||||||
,null::text gldc
|
|
||||||
,null::text glec
|
|
||||||
,null::text harm
|
|
||||||
,null::text clss
|
|
||||||
,null::text brand
|
|
||||||
,null::text assc
|
|
||||||
,null::text ddunit
|
|
||||||
,null::text unti
|
|
||||||
,null::numeric lbs
|
|
||||||
,null::numeric plt
|
|
||||||
,null::text plcd
|
|
||||||
,o.fs_line
|
|
||||||
,o.r_currency
|
|
||||||
,null::numeric r_rate
|
|
||||||
,o.c_currency
|
|
||||||
,null::numeric c_rate
|
|
||||||
,sum(o.fb_qty) fb_qty
|
|
||||||
,sum(o.fb_val_loc) fb_val_loc
|
|
||||||
,sum(o.fb_val_loc_dis) fb_val_loc_dis
|
|
||||||
,sum(o.fb_val_loc_qt) fb_val_loc_qt
|
|
||||||
,sum(o.fb_val_loc_pl) fb_val_loc_pl
|
|
||||||
,sum(o.fb_val_loc_tar) fb_val_loc_tar
|
|
||||||
,sum(o.fb_cst_loc) fb_cst_loc
|
|
||||||
,sum(o.fb_cst_loc_cur) fb_cst_loc_cur
|
|
||||||
,sum(o.fb_cst_loc_fut) fb_cst_loc_fut
|
|
||||||
,o.calc_status
|
|
||||||
,o.flag
|
|
||||||
,o.odate odate
|
|
||||||
,o.oseas rseas
|
|
||||||
,o.rdate rdate
|
|
||||||
,o.rseas rseas
|
|
||||||
-----when null, greatest/least is just going to act like coalesce
|
|
||||||
,greatest(least(o.sdate,gld.edat),gld.sdat) sdate
|
|
||||||
,ss.ssyr sseas
|
|
||||||
,'actuals' "version"
|
|
||||||
,'forecast_plug' iter
|
|
||||||
FROM
|
|
||||||
rlarp.osmp_dev o
|
|
||||||
LEFT OUTER JOIN gld ON
|
|
||||||
gld.fspr = o.fspr
|
|
||||||
LEFT OUTER JOIN gld ss ON
|
|
||||||
greatest(least(o.sdate,gld.edat),gld.sdat) BETWEEN ss.sdat AND ss.edat
|
|
||||||
WHERE
|
|
||||||
o.odate BETWEEN '2020-02-01' AND '2020-05-31'
|
|
||||||
AND fs_line = '41010'
|
|
||||||
AND calc_status <> 'CANCELED'
|
|
||||||
GROUP BY
|
|
||||||
o.fspr
|
|
||||||
,plnt
|
|
||||||
,o.promo
|
|
||||||
,o.terms
|
|
||||||
,o.bill_cust
|
|
||||||
,ship_cust
|
|
||||||
,o.part
|
|
||||||
,o.fs_line
|
|
||||||
,o.r_currency
|
|
||||||
,o.c_currency
|
|
||||||
,o.calc_status
|
|
||||||
,o.flag
|
|
||||||
,o.odate
|
|
||||||
,o.oseas
|
|
||||||
,o.rdate
|
|
||||||
,o.rseas
|
|
||||||
,greatest(least(o.sdate,gld.edat),gld.sdat)
|
|
||||||
,ss.ssyr
|
|
||||||
)
|
|
||||||
,incr AS (
|
|
||||||
SELECT
|
|
||||||
o."ddord#"
|
|
||||||
,o."dditm#"
|
|
||||||
,o."fgbol#"
|
|
||||||
,o."fgent#"
|
|
||||||
,o."diinv#"
|
|
||||||
,o."dilin#"
|
|
||||||
,o.quoten
|
|
||||||
,o.quotel
|
|
||||||
,o.dcodat + interval '1 year' --incremented
|
|
||||||
,o.ddqdat + interval '1 year' --incremented
|
|
||||||
,o.dcmdat
|
|
||||||
,o.fesdat
|
|
||||||
,o.dhidat + interval '1 year' --incremented
|
|
||||||
,o.fesind
|
|
||||||
,o.dhpost
|
|
||||||
,gld.fspr --incremented
|
|
||||||
,o.ddqtoi
|
|
||||||
,o.ddqtsi
|
|
||||||
,o.fgqshp
|
|
||||||
,o.diqtsh
|
|
||||||
,o.diext
|
|
||||||
,o.ditdis
|
|
||||||
,o.discj
|
|
||||||
,o.dhincr
|
|
||||||
,o.plnt
|
|
||||||
,o.promo
|
|
||||||
,o.return_reas
|
|
||||||
,o.terms
|
|
||||||
,o.custpo
|
|
||||||
,o.remit_to
|
|
||||||
,o.bill_class
|
|
||||||
,o.bill_cust
|
|
||||||
,o.bill_rep
|
|
||||||
,o.bill_terr
|
|
||||||
,o.ship_class
|
|
||||||
,o.ship_cust
|
|
||||||
,o.ship_rep
|
|
||||||
,o.ship_terr
|
|
||||||
,o.dsm
|
|
||||||
,o.account
|
|
||||||
,o.shipgrp
|
|
||||||
,o.geo
|
|
||||||
,o.chan
|
|
||||||
,o.chansub
|
|
||||||
,o.orig_ctry
|
|
||||||
,o.orig_prov
|
|
||||||
,o.orig_post
|
|
||||||
,o.bill_ctry
|
|
||||||
,o.bill_prov
|
|
||||||
,o.bill_post
|
|
||||||
,o.dest_ctry
|
|
||||||
,o.dest_prov
|
|
||||||
,o.dest_post
|
|
||||||
,o.part
|
|
||||||
,o.styc
|
|
||||||
,o.colc
|
|
||||||
,o.colgrp
|
|
||||||
,o.coltier
|
|
||||||
,o.colstat
|
|
||||||
,o.sizc
|
|
||||||
,o.pckg
|
|
||||||
,o.kit
|
|
||||||
,o.brnd
|
|
||||||
,o.majg
|
|
||||||
,o.ming
|
|
||||||
,o.majs
|
|
||||||
,o.mins
|
|
||||||
,o.gldco
|
|
||||||
,o.gldc
|
|
||||||
,o.glec
|
|
||||||
,o.harm
|
|
||||||
,o.clss
|
|
||||||
,o.brand
|
|
||||||
,o.assc
|
|
||||||
,o.ddunit
|
|
||||||
,o.unti
|
|
||||||
,o.lbs
|
|
||||||
,o.plt
|
|
||||||
,o.plcd
|
|
||||||
,o.fs_line
|
|
||||||
,o.r_currency
|
|
||||||
,o.r_rate
|
|
||||||
,o.c_currency
|
|
||||||
,o.c_rate
|
|
||||||
,o.fb_qty
|
|
||||||
,o.fb_val_loc
|
|
||||||
,o.fb_val_loc_dis
|
|
||||||
,o.fb_val_loc_qt
|
|
||||||
,o.fb_val_loc_pl
|
|
||||||
,o.fb_val_loc_tar
|
|
||||||
,o.fb_cst_loc
|
|
||||||
,o.fb_cst_loc_cur
|
|
||||||
,o.fb_cst_loc_fut
|
|
||||||
,o.calc_status
|
|
||||||
,o.flag
|
|
||||||
,o.odate + interval '1 year' --incremented
|
|
||||||
,o.oseas + 1 --incremented
|
|
||||||
,o.rdate + interval '1 year' --incremented
|
|
||||||
,o.rseas + 1 --incremented
|
|
||||||
,o.sdate + interval '1 year' --incremented
|
|
||||||
,o.sseas + 1 --incremented
|
|
||||||
,'b21' "version"
|
|
||||||
,'baseline' iter
|
|
||||||
FROM
|
|
||||||
baseline o
|
|
||||||
LEFT OUTER JOIN gld ON
|
|
||||||
o.sdate + interval '1 year' BETWEEN gld.sdat and gld.edat
|
|
||||||
WHERE
|
|
||||||
o.odate + interval '1 year' >= '2020-06-01'
|
|
||||||
)
|
|
||||||
INSERT INTO rlarp.osmf_dev
|
|
||||||
SELECT * FROM incr
|
|
||||||
UNION ALL
|
|
||||||
SELECT * FROM baseline;
|
|
||||||
|
|
||||||
---identify short ships: causes disconnect with actual sales-------------------------------------------------------------------
|
|
||||||
--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;
|
|
@ -1,193 +0,0 @@
|
|||||||
----------------------------SET BILL-TO REP------------------------------------
|
|
||||||
|
|
||||||
UPDATE
|
|
||||||
RLARP.OSMF_DEV S
|
|
||||||
SET
|
|
||||||
BILL_REP = C.BVSALM
|
|
||||||
,BILL_CLASS = C.BVCLAS
|
|
||||||
,BILL_TERR = C.BVTERR
|
|
||||||
FROM
|
|
||||||
LGDAT.CUST C
|
|
||||||
WHERE
|
|
||||||
C.BVCUST = S.BILL_CUST
|
|
||||||
AND (
|
|
||||||
COALESCE(S.BILL_REP,'') <> C.BVSALM
|
|
||||||
OR COALESCE(S.BILL_CLASS,'') <> C.BVCLAS
|
|
||||||
OR COALESCE(S.BILL_TERR,'') <> C.BVTERR
|
|
||||||
);
|
|
||||||
|
|
||||||
----------------------------SET SHIP-TO REP------------------------------------
|
|
||||||
|
|
||||||
UPDATE
|
|
||||||
RLARP.OSMF_DEV S
|
|
||||||
SET
|
|
||||||
SHIP_REP = C.BVSALM
|
|
||||||
,SHIP_CLASS = C.BVCLAS
|
|
||||||
,SHIP_TERR = C.BVTERR
|
|
||||||
FROM
|
|
||||||
LGDAT.CUST C
|
|
||||||
WHERE
|
|
||||||
C.BVCUST = S.SHIP_CUST
|
|
||||||
AND (
|
|
||||||
COALESCE(S.SHIP_REP,'') <> C.BVSALM
|
|
||||||
OR COALESCE(S.SHIP_CLASS,'') <> C.BVCLAS
|
|
||||||
OR COALESCE(S.SHIP_TERR,'') <> C.BVTERR
|
|
||||||
);
|
|
||||||
|
|
||||||
----------------------------SET BILLTO GROUP------------------------------------
|
|
||||||
|
|
||||||
UPDATE
|
|
||||||
RLARP.OSMF_DEV O
|
|
||||||
SET
|
|
||||||
ACCOUNT = CASE BVADR6 WHEN '' THEN BVNAME ELSE BVADR6 END
|
|
||||||
FROM
|
|
||||||
LGDAT.CUST C
|
|
||||||
WHERE
|
|
||||||
C.BVCUST = O.BILL_CUST
|
|
||||||
AND CASE BVADR6 WHEN '' THEN BVNAME ELSE BVADR6 END <> COALESCE(O.ACCOUNT,'');
|
|
||||||
|
|
||||||
|
|
||||||
----------------------------SET SHIPTO GROUP------------------------------------
|
|
||||||
|
|
||||||
UPDATE
|
|
||||||
RLARP.OSMF_DEV O
|
|
||||||
SET
|
|
||||||
SHIPGRP = CASE BVADR6 WHEN '' THEN BVNAME ELSE BVADR6 END
|
|
||||||
FROM
|
|
||||||
LGDAT.CUST C
|
|
||||||
WHERE
|
|
||||||
C.BVCUST = O.SHIP_CUST
|
|
||||||
AND CASE BVADR6 WHEN '' THEN BVNAME ELSE BVADR6 END <> COALESCE(O.SHIPGRP,'');
|
|
||||||
|
|
||||||
|
|
||||||
---------------------------SET CHANNEL-----------------------------------------
|
|
||||||
|
|
||||||
|
|
||||||
UPDATE
|
|
||||||
rlarp.osmF_dev
|
|
||||||
SET
|
|
||||||
CHAN = CASE SUBSTRING(BILL_CLASS,2,3)
|
|
||||||
--if the bill to class is ditsributor, then it's either warehouse or drop
|
|
||||||
WHEN 'DIS' THEN
|
|
||||||
--if the ship-to is a different name than the bill-to then it's drop, otherwise it's warehouse
|
|
||||||
CASE SUBSTRING(SHIP_CLASS,2,3)
|
|
||||||
WHEN 'DIS' THEN 'WHS'
|
|
||||||
ELSE 'DRP'
|
|
||||||
END
|
|
||||||
--CASE WHEN RTRIM(SUBSTRING(LTRIM(SC.BVADR7)||SC.BVNAME,1,30)) = RTRIM(SUBSTRING(LTRIM(BC.BVADR7)||BC.BVNAME,1,30)) THEN 'DIS' ELSE 'DRP' END
|
|
||||||
--everything else does not involve a distributor and is considered direct
|
|
||||||
ELSE 'DIR'
|
|
||||||
END,
|
|
||||||
CHANSUB = CASE SUBSTRING(BILL_CLASS,2,3)
|
|
||||||
WHEN 'DIS' THEN
|
|
||||||
--if the ship-to is a different name than the bill-to then it's drop, otherwise it's warehouse
|
|
||||||
CASE SUBSTRING(SHIP_CLASS,2,3)
|
|
||||||
WHEN 'DIS' THEN 'WHS'
|
|
||||||
ELSE CASE SUBSTRING(SHIP_CLASS,1,1) WHEN 'R' THEN 'RDP' ELSE 'DRP' END
|
|
||||||
END
|
|
||||||
WHEN 'MAS' THEN 'RMN'
|
|
||||||
WHEN 'NAT' THEN 'RMN'
|
|
||||||
ELSE CASE SUBSTRING(SHIP_CLASS,1,1) WHEN 'R' THEN 'RDI' ELSE 'DIR' END
|
|
||||||
END
|
|
||||||
WHERE
|
|
||||||
COALESCE(CHAN,'') <> CASE SUBSTRING(BILL_CLASS,2,3)
|
|
||||||
--if the bill to class is ditsributor, then it's either warehouse or drop
|
|
||||||
WHEN 'DIS' THEN
|
|
||||||
--if the ship-to is a different name than the bill-to then it's drop, otherwise it's warehouse
|
|
||||||
CASE SUBSTRING(SHIP_CLASS,2,3)
|
|
||||||
WHEN 'DIS' THEN 'WHS'
|
|
||||||
ELSE 'DRP'
|
|
||||||
END
|
|
||||||
--CASE WHEN RTRIM(SUBSTRING(LTRIM(SC.BVADR7)||SC.BVNAME,1,30)) = RTRIM(SUBSTRING(LTRIM(BC.BVADR7)||BC.BVNAME,1,30)) THEN 'DIS' ELSE 'DRP' END
|
|
||||||
--everything else does not involve a distributor and is considered direct
|
|
||||||
ELSE 'DIR'
|
|
||||||
END
|
|
||||||
OR
|
|
||||||
COALESCE(CHANSUB,'') <> CASE SUBSTRING(BILL_CLASS,2,3)
|
|
||||||
WHEN 'DIS' THEN
|
|
||||||
--if the ship-to is a different name than the bill-to then it's drop, otherwise it's warehouse
|
|
||||||
CASE SUBSTRING(SHIP_CLASS,2,3)
|
|
||||||
WHEN 'DIS' THEN 'WHS'
|
|
||||||
ELSE CASE SUBSTRING(SHIP_CLASS,1,1) WHEN 'R' THEN 'RDP' ELSE 'DRP' END
|
|
||||||
END
|
|
||||||
WHEN 'MAS' THEN 'RMN'
|
|
||||||
WHEN 'NAT' THEN 'RMN'
|
|
||||||
ELSE CASE SUBSTRING(SHIP_CLASS,1,1) WHEN 'R' THEN 'RDI' ELSE 'DIR' END
|
|
||||||
END;
|
|
||||||
|
|
||||||
|
|
||||||
---------------------------SET QUOTA REP---------------------------------------
|
|
||||||
|
|
||||||
|
|
||||||
UPDATE
|
|
||||||
RLARP.OSMF_DEV S
|
|
||||||
SET
|
|
||||||
DSM = CR.QUOTA_REP
|
|
||||||
FROM
|
|
||||||
(
|
|
||||||
SELECT DISTINCT
|
|
||||||
VERSION,
|
|
||||||
COALESCE(GLEC,'') GLEC,
|
|
||||||
COALESCE(MING,'') MING,
|
|
||||||
BILL_CUST,
|
|
||||||
SHIP_CUST,
|
|
||||||
------------quota rep column--------------
|
|
||||||
RTRIM(
|
|
||||||
--retail items go to currep, or if null go to 90005
|
|
||||||
CASE WHEN S.GLEC IN ('1RE','1CU') THEN
|
|
||||||
CASE WHEN BVCTRY = 'CAN' THEN
|
|
||||||
--Rachel Bowman
|
|
||||||
'50300'
|
|
||||||
ELSE
|
|
||||||
--select customers go to select reps
|
|
||||||
CASE ACCOUNT
|
|
||||||
------Alecia Latini-------------------------------
|
|
||||||
WHEN 'DO IT BEST' THEN '90006'
|
|
||||||
WHEN 'ACE HARDWARE' THEN '90006'
|
|
||||||
WHEN 'ALDI' THEN '90006'
|
|
||||||
WHEN 'AMAZON.COM' THEN '90006'
|
|
||||||
WHEN 'GARDEN RIDGE CORP' THEN '90006' --AKA "At Home"
|
|
||||||
WHEN 'TRUE VALUE' THEN '90006'
|
|
||||||
WHEN 'WAYFAIR' THEN '90006'
|
|
||||||
WHEN 'GRIFFIN' THEN '90006'
|
|
||||||
WHEN 'WAL-MART' THEN '90006'
|
|
||||||
------Tony Landino--------------------------------
|
|
||||||
WHEN 'THE HOME DEPOT' THEN '50802'
|
|
||||||
WHEN 'FRED MEYER' THEN '50802'
|
|
||||||
WHEN 'MENARDS' THEN '50802'
|
|
||||||
WHEN 'KROGER' THEN '50802'
|
|
||||||
WHEN 'OCEAN STATE JOBBERS' THEN '50802'
|
|
||||||
WHEN 'AURORA WHOLESALE' THEN '50802'
|
|
||||||
WHEN 'LEON KORRAL' THEN '50802'
|
|
||||||
--all other retail goes to Doran Marable-----------
|
|
||||||
ELSE '50200'
|
|
||||||
END
|
|
||||||
END
|
|
||||||
--minor group b52 goes to dedicated rep
|
|
||||||
ELSE
|
|
||||||
CASE WHEN MING = 'B52' THEN
|
|
||||||
'PW'
|
|
||||||
--gdir, ndir go to bill-to rep
|
|
||||||
ELSE
|
|
||||||
CASE WHEN BILL_CLASS IN ('GDIR','NDIR') THEN
|
|
||||||
BILL_REP
|
|
||||||
ELSE
|
|
||||||
SHIP_REP
|
|
||||||
END
|
|
||||||
END
|
|
||||||
END
|
|
||||||
) QUOTA_REP
|
|
||||||
FROM
|
|
||||||
RLARP.OSMF_DEV S
|
|
||||||
LEFT OUTER JOIN LGDAT.CUST ON
|
|
||||||
BVCUST = BILL_CUST
|
|
||||||
WHERE
|
|
||||||
COALESCE(GLEC,'') IS NOT NULL
|
|
||||||
) CR
|
|
||||||
WHERE
|
|
||||||
CR.VERSION = S.VERSION
|
|
||||||
AND CR.GLEC = COALESCE(S.GLEC,'')
|
|
||||||
AND CR.MING = COALESCE(S.MING,'')
|
|
||||||
AND CR.BILL_CUST = S.BILL_CUST
|
|
||||||
AND CR.SHIP_CUST = S.SHIP_CUST
|
|
||||||
AND COALESCE(S.DSM,'') <> CR.QUOTA_REP;
|
|
@ -1,27 +0,0 @@
|
|||||||
UPDATE
|
|
||||||
rlarp.osmf_dev
|
|
||||||
SET
|
|
||||||
r_rate = .75
|
|
||||||
WHERE
|
|
||||||
r_currency = 'CA';
|
|
||||||
|
|
||||||
UPDATE
|
|
||||||
rlarp.osmf_dev
|
|
||||||
SET
|
|
||||||
r_rate = 1
|
|
||||||
WHERE
|
|
||||||
r_currency = 'US';
|
|
||||||
|
|
||||||
UPDATE
|
|
||||||
rlarp.osmf_dev
|
|
||||||
SET
|
|
||||||
c_rate = .75
|
|
||||||
WHERE
|
|
||||||
c_currency = 'CA';
|
|
||||||
|
|
||||||
UPDATE
|
|
||||||
rlarp.osmf_dev
|
|
||||||
SET
|
|
||||||
c_rate = 1
|
|
||||||
WHERE
|
|
||||||
c_currency = 'US';
|
|
@ -1,27 +0,0 @@
|
|||||||
UPDATE
|
|
||||||
RLARP.OSMF_DEV O
|
|
||||||
SET
|
|
||||||
COLC = M.COLC
|
|
||||||
,COLGRP = M.COLGRP
|
|
||||||
,COLTIER = M.COLTIER
|
|
||||||
,COLSTAT = M.COLSTAT
|
|
||||||
,SIZC = M.SIZC
|
|
||||||
,PCKG = M.PACKAGE
|
|
||||||
,KIT = M.KIT
|
|
||||||
,BRND = M.BRANDING
|
|
||||||
,MAJG = M.MAJG
|
|
||||||
,MING = M.MING
|
|
||||||
,MAJS = M.MAJS
|
|
||||||
,MINS = M.MINS
|
|
||||||
,GLDC = M.GLCD
|
|
||||||
,GLEC = M.GLEC
|
|
||||||
,HARM = M.HARM
|
|
||||||
,CLSS = M.CLSS
|
|
||||||
,BRAND = M.BRAND
|
|
||||||
,ASSC = M.ASSC
|
|
||||||
,LBS = CASE M.NWUN WHEN 'KG' THEN 2.2046 ELSE 1 END*M.NWHT
|
|
||||||
,UNTI = M.UNTI
|
|
||||||
FROM
|
|
||||||
RLARP.ITEMM M
|
|
||||||
WHERE
|
|
||||||
M.ITEM = O.PART
|
|
@ -1,126 +0,0 @@
|
|||||||
|column |alt_name |osmp_dev|osm_fcpool|osmp_source|osm_stack_retain|ui |revised_pool|
|
|
||||||
|---------------|--------------|--------|----------|-----------|----------------|---|------------|
|
|
||||||
|ddord# | |x | |null |x | | |
|
|
||||||
|dditm# | |x | |null | | | |
|
|
||||||
|fgbol# | |x | |null | | | |
|
|
||||||
|fgent# | |x | |null | | | |
|
|
||||||
|diinv# | |x | |null |x | | |
|
|
||||||
|dilin# | |x | |null | | | |
|
|
||||||
|quoten | |x | |null |x | | |
|
|
||||||
|quotel | |x | |null | | | |
|
|
||||||
|dcodat | |x | |null | | | |
|
|
||||||
|ddqdat | |x | |null | | | |
|
|
||||||
|dcmdat | |x | |null | | | |
|
|
||||||
|fesdat | |x | |null | | | |
|
|
||||||
|dhidat | |x | |null | | | |
|
|
||||||
|fesind | |x | |null | | | |
|
|
||||||
|dhpost | |x | |null | | | |
|
|
||||||
|fspr | |x | |forecast | | |x |
|
|
||||||
|ddqtoi | |x | |forecast | | |x |
|
|
||||||
|ddqtsi | |x | |null | | | |
|
|
||||||
|fgqshp | |x | |null | | | |
|
|
||||||
|diqtsh | |x | |null | | | |
|
|
||||||
|diext | |x | |null | | | |
|
|
||||||
|ditdis | |x | |null | | | |
|
|
||||||
|discj | |x | |null | | | |
|
|
||||||
|dhincr | |x | |forecast | | |x |
|
|
||||||
|plnt | |x | |forecast |x | |x |
|
|
||||||
|promo | |x | |forecast |x |x |x |
|
|
||||||
|return_reas | |x | |null | | | |
|
|
||||||
|terms | |x | |forecast | | |x |
|
|
||||||
|custpo | |x | |null | | | |
|
|
||||||
|remit_to | |x | |forecast | | |x |
|
|
||||||
|bill_class | |x | |cust |x | | |
|
|
||||||
|bill_cust | |x | |forecast | | |x |
|
|
||||||
|bill_cust_descr| | | |ui_only | |x |x |
|
|
||||||
|bill_rep | |x | |cust | | | |
|
|
||||||
|bill_terr | |x | |cust | | | |
|
|
||||||
|ship_class | |x | |cust |x | | |
|
|
||||||
|ship_cust | |x | |forecast |x | |x |
|
|
||||||
|ship_cust_descr| | | |ui_only | |x |x |
|
|
||||||
|ship_rep | |x | |cust | | | |
|
|
||||||
|ship_terr | |x | |cust | | | |
|
|
||||||
|dsm |quota_rep |x | |forecast |x |x |x |
|
|
||||||
|quota_rep_descr| | | |ui_only | |x |x |
|
|
||||||
|account |billto_group |x | |cust |x |x |x |
|
|
||||||
|shipgrp |shipto_group |x | |cust |x |x |x |
|
|
||||||
|geo | |x | |cust |x | | |
|
|
||||||
|chan | |x | |cust |x |x |x |
|
|
||||||
|chansub |mod_chan |x | |cust |x |x |x |
|
|
||||||
|chanretail |mod_chansub | | |ui_only | |x |x |
|
|
||||||
|orig_ctry | |x | |plnt | | | |
|
|
||||||
|orig_prov | |x | |plnt | | | |
|
|
||||||
|orig_post | |x | |plnt | | | |
|
|
||||||
|bill_ctry | |x | |cust |x | | |
|
|
||||||
|bill_prov | |x | |cust |x | | |
|
|
||||||
|bill_post | |x | |cust |x | | |
|
|
||||||
|dest_ctry | |x | |cust |x | | |
|
|
||||||
|dest_prov | |x | |cust |x | | |
|
|
||||||
|dest_post | |x | |cust |x | | |
|
|
||||||
|part | |x | |forecast |x | |x |
|
|
||||||
|part_descr | | | |ui_only | |x |x |
|
|
||||||
|part_group | | | |ui_only | |x |x |
|
|
||||||
|styc | |x | |itemm |x | | |
|
|
||||||
|colc |color |x | |itemm |x | | |
|
|
||||||
|colgrp | |x | |itemm |x | | |
|
|
||||||
|coltier | |x | |itemm |x | | |
|
|
||||||
|colstat | |x | |itemm | | | |
|
|
||||||
|sizc | |x | |itemm |x | | |
|
|
||||||
|pckg | |x | |itemm |x | | |
|
|
||||||
|kit | |x | |itemm |x | | |
|
|
||||||
|brnd |branding |x | |itemm |x |x |x |
|
|
||||||
|majg | |x | |itemm |x | | |
|
|
||||||
|majgd |majg_descr | | |ui_only | |x |x |
|
|
||||||
|ming | |x | |itemm |x | | |
|
|
||||||
|mingd |ming_descr | | |ui_only | |x |x |
|
|
||||||
|majs | |x | |itemm |x | | |
|
|
||||||
|majsd |majs_descr | | |ui_only | |x |x |
|
|
||||||
|mins | |x | |itemm |x | | |
|
|
||||||
|minsd |mins_descr | | |ui_only | |x |x |
|
|
||||||
|gldco |ord_gldc |x | |itemm | | | |
|
|
||||||
|gldc | |x | |itemm | | | |
|
|
||||||
|glec | |x | |itemm |x | | |
|
|
||||||
|segm | | | |ui_only | |x |x |
|
|
||||||
|harm | |x | |itemm | | | |
|
|
||||||
|clss | |x | |itemm |x | | |
|
|
||||||
|brand | |x | |itemm | | | |
|
|
||||||
|assc | |x | |itemm | | | |
|
|
||||||
|ddunit | |x | |itemm | | | |
|
|
||||||
|unti |units |x | |itemm | | | |
|
|
||||||
|lbs | |x | |itemm |x | | |
|
|
||||||
|plt | |x | |punit |x | | |
|
|
||||||
|plcd | |x | |iprcbhc |x | | |
|
|
||||||
|fs_line | |x | |forecast |x | |x |
|
|
||||||
|r_currency | |x | |forecast |x | |x |
|
|
||||||
|r_rate | |x | |forecast |x | |x |
|
|
||||||
|c_currency | |x | |forecast |x | |x |
|
|
||||||
|c_rate | |x | |forecast |x | |x |
|
|
||||||
|fb_qty | |x | |forecast |x |x |x |
|
|
||||||
|fb_val_loc |value_loc |x | |forecast |x |x |x |
|
|
||||||
|value_usd | | | |ui_only | |x |x |
|
|
||||||
|fb_val_loc_dis | |x | |null | | | |
|
|
||||||
|fb_val_loc_qt | |x | |null |x | | |
|
|
||||||
|fb_val_loc_pl | |x | |pricel |x | | |
|
|
||||||
|fb_val_loc_tar | |x | |target |x | | |
|
|
||||||
|fb_cst_loc |cost_loc |x | |forecast |x |x |x |
|
|
||||||
|cost_usd | | | |ui_only | |x |x |
|
|
||||||
|fb_cst_loc_cur | |x | |icstx |x | | |
|
|
||||||
|fb_cst_loc_fut | |x | |icstx | | | |
|
|
||||||
|calc_status | |x | |forecast |x | |x |
|
|
||||||
|flag | |x | |forecast |x | |x |
|
|
||||||
|odate |orderdate |x | |forecast |x |x |x |
|
|
||||||
|order_month | | | |ui_only | |x |x |
|
|
||||||
|oseas |order_season |x | |forecast |x |x |x |
|
|
||||||
|rdate |requestdate |x | |forecast |x |x |x |
|
|
||||||
|request_month | | | |ui_only | |x |x |
|
|
||||||
|rseas |request_season|x | |forecast |x |x |x |
|
|
||||||
|sdate |shipdate |x | |forecast |x |x |x |
|
|
||||||
|ship_month | | | |ui_only | |x |x |
|
|
||||||
|sseas |ship_season |x | |forecast |x |x |x |
|
|
||||||
|version | |x | |forecast | |x |x |
|
|
||||||
|iter | |x | |forecast | |x |x |
|
|
||||||
|log | |x | |forecast | |x |x |
|
|
||||||
|comment | | | |ui_only | |x |x |
|
|
||||||
|iterdet | | | |forecast | | |x |
|
|
||||||
|iterdef | | | |forecast | | |x |
|
|
||||||
|director_descr | | | |forecast | | |x |
|
|
Loading…
Reference in New Issue
Block a user